cmtk-3.0.0/0000755000177700000170000000000012263615446011520 5ustar torstenmancmtk-3.0.0/cmtkIncludeDirectories.cmake0000644000177700000170000000332511613631712017154 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## ## Copyright 2004-2010 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 3281 $ ## ## $LastChangedDate: 2011-07-26 14:38:18 -0700 (Tue, 26 Jul 2011) $ ## ## $LastChangedBy: torstenrohlfing $ ## #----------------------------------------------------------------------------- # Include directories for other projects installed on the system. SET(CMTK_INCLUDE_DIRS_SYSTEM ${QT_INCLUDE_DIR} ${QT_INCLUDE_PATH} ) #----------------------------------------------------------------------------- # Include directories from the build tree. SET(CMTK_INCLUDE_DIRS_BUILD_TREE ${CMTK_BINARY_DIR}) # These directories are always needed. SET(CMTK_INCLUDE_DIRS_BUILD_TREE ${CMTK_INCLUDE_DIRS_BUILD_TREE} ${DCMTK_INCLUDE_DIRS} ${NRRD_INCLUDE_DIRS} ${MXML_INCLUDE_DIR} ${SQLITE_INCLUDE_DIR} ${ZCONF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMTK_SOURCE_DIR}/libs ) cmtk-3.0.0/testing/0000755000177700000170000000000012263615446013175 5ustar torstenmancmtk-3.0.0/testing/CMakeLists.txt0000644000177700000170000000225111544266330015730 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## ## Copyright 2004-2011 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 3071 $ ## ## $LastChangedDate: 2011-03-28 22:23:36 -0700 (Mon, 28 Mar 2011) $ ## ## $LastChangedBy: torsten_at_home $ ## IF(BUILD_APPS) SUBDIRS(apps) ENDIF(BUILD_APPS) IF(BUILD_GUI) SUBDIRS(gui) ENDIF(BUILD_GUI) SUBDIRS(libs) cmtk-3.0.0/testing/libs/0000755000177700000170000000000012263615446014126 5ustar torstenmancmtk-3.0.0/testing/libs/CMakeLists.txt0000644000177700000170000000243312207731365016665 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## ## Copyright 2004-2010, 2013 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 4802 $ ## ## $LastChangedDate: 2013-08-29 13:45:41 -0700 (Thu, 29 Aug 2013) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ========================================== # Delegate testing to separate subdirs for each library SUBDIRS(System) SUBDIRS(Registration) SUBDIRS(IO) SUBDIRS(Base) IF(CMTK_USE_CUDA) SUBDIRS(GPU) ENDIF(CMTK_USE_CUDA) cmtk-3.0.0/testing/libs/GPU/0000755000177700000170000000000012263615446014561 5ustar torstenmancmtk-3.0.0/testing/libs/GPU/CMakeLists.txt0000644000177700000170000000373611414730166017324 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## ## Copyright 2004-2010 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 1960 $ ## ## $LastChangedDate: 2010-07-06 15:38:46 -0700 (Tue, 06 Jul 2010) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ========================================== # Setup binary test drivers SET(CMTK_LIBRARIES "cmtkGPU;cmtkBase;cmtkNumerics;cmtkSystem") SET(DRIVERS libGPUTests) FOREACH(D ${DRIVERS}) CUDA_ADD_EXECUTABLE(${D} ${D}.cxx) TARGET_LINK_LIBRARIES(${D} ${CMTK_LIBRARIES} ${CMTK_SYSTEM_LIBRARIES}) ENDFOREACH(D ${DRIVERS}) IF(CMTK_USE_CUDA) # ========================================== # Tests for "cmtk::DeviceHistogram" class SET(Tests ${Tests} DeviceHistogramEntropy DeviceHistogramPopulate DeviceHistogramPopulateLog) # ========================================== # Tests for "cmtk::DeviceMemory" class SET(Tests ${Tests} DeviceMemory) # ========================================== # Tests for "cmtk::UniformVolume" class SET(Tests ${Tests} DeviceUniformVolume) ENDIF(CMTK_USE_CUDA) FOREACH(T ${Tests}) ADD_TEST(${T} ${EXECUTABLE_OUTPUT_PATH}/libGPUTests ${T}) ENDFOREACH(T Tests) cmtk-3.0.0/testing/libs/GPU/cmtkDeviceMemoryTests.txx0000644000177700000170000000634511452717235021626 0ustar torstenman/* // // Copyright 2010 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include // test "DeviceMemory" class int testDeviceMemory() { size_t memFreeBefore, memTotalBefore; cudaError_t status = cudaMemGetInfo( &memFreeBefore, &memTotalBefore ); if ( status != cudaSuccess ) { std::cerr << "Call to cudaMemGetInfo() failed with error " << cudaGetErrorString( status ) << std::endl; return 1; } try { float floatHost[100]; cmtk::DeviceMemory::SmartPtr floatDevice = cmtk::DeviceMemory::Create( 100 ); floatDevice->CopyToDevice( floatHost, 100 ); floatDevice->CopyToHost( floatHost, 100 ); int intHost[100]; cmtk::DeviceMemory::SmartPtr intDevice = cmtk::DeviceMemory::Create( 100 ); intDevice->CopyToDevice( intHost, 100 ); intDevice->CopyToHost( intHost, 100 ); char charHost[100]; cmtk::DeviceMemory::SmartPtr charDevice = cmtk::DeviceMemory::Create( 100 ); charDevice->CopyToDevice( charHost, 100 ); charDevice->CopyToHost( charHost, 100 ); cmtk::DeviceMemory::SmartPtr float2Device = cmtk::DeviceMemory::Create( 100 ); float2Device->CopyOnDevice( *floatDevice, 100 ); size_t memFreeAfter, memTotalAfter; if ( cudaMemGetInfo( &memFreeAfter, &memTotalAfter ) != cudaSuccess ) { std::cerr << "Second call to cudaMemGetInfo() failed." << std::endl; return 1; } if ( memFreeBefore == memFreeAfter ) { std::cerr << "Free device memory constant despite allocation at" << memFreeBefore << std::endl; return 1; } } catch ( std::bad_alloc ) { std::cerr << "Caught bad_alloc()" << std::endl; return 1; } size_t memFreeAfter, memTotalAfter; if ( cudaMemGetInfo( &memFreeAfter, &memTotalAfter ) != cudaSuccess ) { std::cerr << "Third call to cudaMemGetInfo() failed." << std::endl; return 1; } if ( memTotalBefore != memTotalAfter ) { std::cerr << "Total device memory changed by " << (memTotalBefore - memTotalAfter) << std::endl; return 1; } if ( memFreeBefore != memFreeAfter ) { std::cerr << "Free device memory changed by" << (memFreeBefore - memFreeAfter) << std::endl; return 1; } return 0; } cmtk-3.0.0/testing/libs/GPU/cmtkDeviceUniformVolumeTests.txx0000644000177700000170000000415112220370626023147 0ustar torstenman/* // // Copyright 2010, 2012, 2013 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4876 $ // // $LastChangedDate: 2013-09-24 13:09:58 -0700 (Tue, 24 Sep 2013) $ // // $LastChangedBy: torstenrohlfing $ // */ #include // test "DeviceUniformVolume" class int testDeviceUniformVolume() { try { const int dims[3] = { 10, 10, 10 }; const float size[3] = { 9, 9, 9 }; cmtk::UniformVolume volume( (cmtk::FixedVector<3,int>::FromPointer( dims )), cmtk::FixedVector<3,float>::FromPointer( size ) ); // first, try to create representation of actually empty volume. cmtk::DeviceUniformVolume::SmartPtr volumeDevice = cmtk::DeviceUniformVolume::Create( volume ); // second, allocate pixel data and create another device instance. volume.CreateDataArray( cmtk::TYPE_INT ); cmtk::DeviceUniformVolume::SmartPtr volumeDevice2 = cmtk::DeviceUniformVolume::Create( volume ); // third, change pixel data to double precision float and create another device instance. volume.CreateDataArray( cmtk::TYPE_DOUBLE ); cmtk::DeviceUniformVolume::SmartPtr volumeDevice3 = cmtk::DeviceUniformVolume::Create( volume ); } catch ( std::bad_alloc ) { std::cerr << "Caught bad_alloc()" << std::endl; return 1; } return 0; } cmtk-3.0.0/testing/libs/GPU/libGPUTests.cxx0000644000177700000170000000346511452717235017460 0ustar torstenman/* // // Copyright 2004-2010 SRI International // // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include #include "cmtkDeviceHistogramTests.txx" #include "cmtkDeviceMemoryTests.txx" #include "cmtkDeviceUniformVolumeTests.txx" int main( const int argc, const char* argv[] ) { cmtk::TestFunctionMap map; map.AddTest( "DeviceHistogramEntropy", &testDeviceHistogramEntropy ); map.AddTest( "DeviceHistogramPopulate", &testDeviceHistogramPopulate ); map.AddTest( "DeviceHistogramPopulateLog", &testDeviceHistogramPopulateLog ); map.AddTest( "DeviceMemory", &testDeviceMemory ); map.AddTest( "DeviceUniformVolume", &testDeviceUniformVolume ); // is test name given on command line? if ( argc < 2 ) { } else { return map.RunTestByName( argv[1] ); } } cmtk-3.0.0/testing/libs/GPU/cmtkDeviceHistogramTests.txx0000644000177700000170000001556511452717235022317 0ustar torstenman/* // // Copyright 2010 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include #include int checkEntropy( const std::string& testName, const float hData[100], cmtk::DeviceHistogram& dHist, const float baseline ) { dHist.GetDataOnDevice().CopyToDevice( hData, 100 ); const float entropy = dHist.GetEntropy(); if ( fabs( entropy - baseline ) > 1e-5 ) { std::cerr << "Test " << testName << " entropy " << entropy << " deviates from baseline " << baseline << std::endl; return 1; } return 0; } // test "DeviceHistogram" class int testDeviceHistogramEntropy() { try { cmtk::DeviceHistogram::SmartPtr histogram100 = cmtk::DeviceHistogram::Create( 100 ); cmtk::DeviceHistogram::SmartPtr histogram200 = cmtk::DeviceHistogram::Create( 200 ); float floatHost[100]; // compute entropy for all-zeros for ( size_t i = 0; i < 100; ++i ) floatHost[i] = 0; if ( checkEntropy( "AllZeros100", floatHost, *histogram100, 0 ) || checkEntropy( "AllZeros200", floatHost, *histogram200, 0 ) ) return 1; // compute entropy for single non-zero bin floatHost[0] = 1; if ( checkEntropy( "SingleBin100", floatHost, *histogram100, 0 ) || checkEntropy( "SingleBin200", floatHost, *histogram200, 0 ) ) return 1; // compute entropy for all-ones for ( size_t i = 0; i < 100; ++i ) floatHost[i] = 1; if ( checkEntropy( "AllOnes100", floatHost, *histogram100, 4.60517 ) || checkEntropy( "AllOnes200", floatHost, *histogram200, 4.60517 ) ) return 1; // compute entropy for 50x 0, 50x 1 for ( size_t i = 0; i < 50; ++i ) floatHost[i] = 0; if ( checkEntropy( "50One50Zero100", floatHost, *histogram100, 3.91202 ) || checkEntropy( "50One50Zero200", floatHost, *histogram200, 3.91202 ) ) return 1; // compute entropy for 50x "0 1" alternating for ( size_t i = 0; i < 50; ++i ) { floatHost[i<<1] = 1; floatHost[1+(i<<1)] = 0; } if ( checkEntropy( "50OneZeroPairs100", floatHost, *histogram100, 3.91202 ) || checkEntropy( "50OneZeroPairs200", floatHost, *histogram200, 3.91202 ) ) return 1; } catch ( std::bad_alloc ) { std::cerr << "Caught bad_alloc()" << std::endl; return 1; } return 0; } template int compareHistogramToBaseline( const cmtk::DeviceHistogram& histD, const float* base ) { cmtk::FixedVector histogram; histD.GetDataOnDevice().CopyToHost( &histogram[0], NBINS ); for ( size_t j = 0; j < NBINS; ++j ) { if ( histogram[j] != base[j] ) { std::cerr << "actual\tbaseline" << std::endl; for ( size_t i = 0; i < NBINS; ++i ) { std::cerr << histogram[i] << "\t" << base[i] << std::endl; } std::cerr << std::endl; return 1; } } return 0; } int testDeviceHistogramPopulate() { try { cmtk::DeviceHistogram::SmartPtr histogramD = cmtk::DeviceHistogram::Create( 4 ); const float data[10] = { 0, 6, 3, 7, 2, 2, 8, 8, 1, 10 }; cmtk::DeviceMemory::SmartPtr dataD = cmtk::DeviceMemory::Create( 10, data ); // reset histogram histogramD->Reset(); const float baseline0[4] = { 0, 0, 0, 0 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline0 ) ) return 1; // populate histogram from data histogramD->Populate( *dataD, 0.0 /*rangeFrom*/, 10.0 /*rangeTo*/ ); const float baseline1[4] = { 5, 1, 3, 1 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline1 ) ) return 1; // add same data to histogram second time without reset histogramD->Populate( *dataD, 0.0 /*rangeFrom*/, 10.0 /*rangeTo*/ ); const float baseline2[4] = { 10, 2, 6, 2 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline2 ) ) return 1; // reset and populate histogram using mask const int mask[10] = { 0, 0, 1, 1, 0, 0, 0, 1, 1, 1 }; cmtk::DeviceMemory::SmartPtr maskD = cmtk::DeviceMemory::Create( 10, mask ); histogramD->Reset(); histogramD->Populate( *dataD, *maskD, 0.0 /*rangeFrom*/, 10.0 /*rangeTo*/ ); const float baseline3[4] = { 2, 0, 2, 1 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline3 ) ) return 1; } catch ( std::bad_alloc ) { std::cerr << "Caught bad_alloc()" << std::endl; return 1; } return 0; } int testDeviceHistogramPopulateLog() { try { cmtk::DeviceHistogram::SmartPtr histogramD = cmtk::DeviceHistogram::Create( 4 ); const float data[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; cmtk::DeviceMemory::SmartPtr dataD = cmtk::DeviceMemory::Create( 10, data ); // reset histogram histogramD->Reset(); const float baseline0[4] = { 0, 0, 0, 0 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline0 ) ) return 1; // populate histogram from data histogramD->Populate( *dataD, 0.0 /*rangeFrom*/, 9.0 /*rangeTo*/, true /*logScale*/ ); const float baseline1[4] = { 4, 3, 3, 0 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline1 ) ) return 1; // add same data to histogram second time without reset histogramD->Populate( *dataD, 0.0 /*rangeFrom*/, 9.0 /*rangeTo*/, true /*logScale*/ ); const float baseline2[4] = { 8, 6, 6, 0 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline2 ) ) return 1; // reset and populate histogram using mask const int mask[10] = { 0, 0, 1, 1, 0, 0, 0, 1, 1, 1 }; cmtk::DeviceMemory::SmartPtr maskD = cmtk::DeviceMemory::Create( 10, mask ); histogramD->Reset(); histogramD->Populate( *dataD, *maskD, 0.0 /*rangeFrom*/, 9.0 /*rangeTo*/, true /*logScale*/ ); const float baseline3[4] = { 2, 0, 3, 0 }; if ( compareHistogramToBaseline<4>( *histogramD, baseline3 ) ) return 1; } catch ( std::bad_alloc ) { std::cerr << "Caught bad_alloc()" << std::endl; return 1; } return 0; } cmtk-3.0.0/testing/libs/Registration/0000755000177700000170000000000012263615446016600 5ustar torstenmancmtk-3.0.0/testing/libs/Registration/CMakeLists.txt0000644000177700000170000000471511761260653021345 0ustar torstenman## ## Copyright 2004-2012 SRI International ## ## Copyright 1997-2009 Torsten Rohlfing ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 4367 $ ## ## $LastChangedDate: 2012-05-29 16:54:19 -0700 (Tue, 29 May 2012) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ========================================== # Setup binary test drivers SET(CMTK_LIBRARIES "cmtkRegistration;cmtkIO;cmtkBase;cmtkNumerics;cmtkSystem") SET(DRIVERS libRegistrationTests) IF(CMTK_USE_SQLITE) SET(DRIVERS ${DRIVERS} libRegistrationTestsSQLite) ENDIF(CMTK_USE_SQLITE) FOREACH(D ${DRIVERS}) ADD_EXECUTABLE(${D} ${D}.cxx) TARGET_LINK_LIBRARIES(${D} ${CMTK_LIBRARIES} ${CMTK_SYSTEM_LIBRARIES}) ENDFOREACH(D ${DRIVERS}) # ========================================== # Tests for "cmtk::TypedArraySimilarity" class SET(Tests ${Tests} TypedArraySimilarity) FOREACH(T ${Tests}) ADD_TEST(${T} ${EXECUTABLE_OUTPUT_PATH}/libRegistrationTests ${T}) ENDFOREACH(T ${Tests}) # ========================================== # Tests for "cmtk::XformImageDB" class IF(CMTK_USE_SQLITE) SET(Tests ImageXformDBCreate ImageXformDBAddImage ImageXformDBAddImageRepeat ImageXformDBAddImagePair ImageXformDBAddImageThenXform ImageXformDBAddImageWithXform ImageXformDBAddXformSameSpace ImageXformDBAddXformRefined ImageXformDBFindXform ImageXformDBFindXformSameSpace ImageXformDBFindXformInverse ImageXformDBFindXformNone ImageXformDBFindXformMultiple ImageXformDBFindXformLevels ImageXformDBFindXformLevelsInverse ) FOREACH(T ${Tests}) ADD_TEST(${T} ${EXECUTABLE_OUTPUT_PATH}/libRegistrationTestsSQLite ${T}) ENDFOREACH(T ${Tests}) ENDIF(CMTK_USE_SQLITE) cmtk-3.0.0/testing/libs/Registration/cmtkImageXformDBTests.txx0000644000177700000170000003275312217637632023525 0ustar torstenman/* // // Copyright 2010, 2013 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4859 $ // // $LastChangedDate: 2013-09-22 12:06:02 -0700 (Sun, 22 Sep 2013) $ // // $LastChangedBy: torsten_at_home $ // */ #include // test database creation int testImageXformDBCreate() { cmtk::ImageXformDB db( "imagexform.sqlite" ); return 0; } // test open of existing file int testImageXformDBOpen() { cmtk::ImageXformDB db( CMTK_DATADIR "/empty.sqlite", true /*readOnly*/ ); return 0; } // test adding an image to a database int testImageXformDBAddImage() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); db.AddImage( "image1.nii" ); const cmtk::ImageXformDB::PrimaryKeyType key1 = db.FindImageSpaceID( "image1.nii" ); if ( key1 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image1." << std::endl; return 1; } db.AddImage( "image2.nii", "image1.nii" ); const cmtk::ImageXformDB::PrimaryKeyType key2 = db.FindImageSpaceID( "image2.nii" ); if ( key2 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image2." << std::endl; return 1; } if ( key1 != key2 ) { std::cerr << "Keys for image1 and image2 do not match." << std::endl; return 1; } db.AddImage( "image3.nii", "image2.nii" ); const cmtk::ImageXformDB::PrimaryKeyType key3 = db.FindImageSpaceID( "image3.nii" ); if ( key3 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image3." << std::endl; return 1; } if ( key1 != key3 ) { std::cerr << "Keys for image1 and image3 do not match." << std::endl; return 1; } db.AddImage( "image4.nii" ); const cmtk::ImageXformDB::PrimaryKeyType key4 = db.FindImageSpaceID( "image4.nii" ); if ( key4 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image4." << std::endl; return 1; } if ( key4 == key1 ) { std::cerr << "Keys for image1 and image4 match when they should not." << std::endl; return 1; } return 0; } // test adding an image to a database repeatedly without creating multiple entries. int testImageXformDBAddImageRepeat() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); db.AddImage( "image1.nii" ); const cmtk::ImageXformDB::PrimaryKeyType key1 = db.FindImageSpaceID( "image1.nii" ); if ( key1 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image1 (first add)" << std::endl; return 1; } db.AddImage( "image1.nii" ); const cmtk::ImageXformDB::PrimaryKeyType key2 = db.FindImageSpaceID( "image1.nii" ); if ( key2 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image1 (second add)" << std::endl; return 1; } if ( key1 != key2 ) { std::cerr << "Two different keys." << std::endl; return 1; } const std::vector list = db.GetSpaceImageList( db.FindImageSpaceID( "image1.nii" ) ); if ( list.size() != 1 ) { std::cerr << "Number of entries is not equal to 1." << std::endl; return 1; } return 0; } // test adding an image to a database int testImageXformDBAddImagePair() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); db.AddImage( "image2.nii", "image1.nii" ); const cmtk::ImageXformDB::PrimaryKeyType key1 = db.FindImageSpaceID( "image1.nii" ); if ( key1 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image1." << std::endl; return 1; } const cmtk::ImageXformDB::PrimaryKeyType key2 = db.FindImageSpaceID( "image2.nii" ); if ( key2 == cmtk::ImageXformDB::NOTFOUND ) { std::cerr << "No space key for image2." << std::endl; return 1; } if ( key1 != key2 ) { std::cerr << "Keys for image1 and image2 do not match." << std::endl; return 1; } return 0; } // test adding images, then a transformation to a database int testImageXformDBAddImageThenXform() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); db.AddImage( "image1.nii" ); db.AddImage( "image2.nii" ); db.AddImage( "image4.nii" ); if ( ! db.AddImagePairXform( "xform12", true /*invertible*/, "image1.nii", "image2.nii" ) || ! db.AddImagePairXform( "xform21", false /*invertible*/, "image2.nii", "image1.nii" ) || ! db.AddImagePairXform( "xform42", false /*invertible*/, "image4.nii", "image2.nii" ) ) return 1; return 0; } // test adding images and transformations to a database int testImageXformDBAddImageWithXform() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); if ( ! db.AddImagePairXform( "xform12", true /*invertible*/, "image1.nii", "image2.nii" ) || ! db.AddImagePairXform( "xform21", false /*invertible*/, "image2.nii", "image1.nii" ) || ! db.AddImagePairXform( "xform42", false /*invertible*/, "image4.nii", "image2.nii" ) ) return 1; return 0; } // test: try adding a transformation between images in the same space int testImageXformDBAddXformSameSpace() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); db.AddImage( "image1.nii" ); db.AddImage( "image2.nii", "image1.nii" ); if ( db.AddImagePairXform( "xform12", true /*invertible*/, "image1.nii", "image2.nii" ) ) return 1; return 0; } // test: add transformation, then add its refinement. int testImageXformDBAddXformRefined() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); db.AddImage( "image1.nii" ); db.AddImage( "image2.nii" ); if ( ! db.AddImagePairXform( "xform12", true /*invertible*/, "image1.nii", "image2.nii" ) || ! db.AddRefinedXform( "xform12refined", true /*invertible*/, "xform12" ) ) { std::cerr << "DB add transformation." << std::endl; return 1; } if ( (db.FindXformLevel( "xform12" ) != 0) || (db.FindXformLevel( "xform12refined" ) != 1) ) { std::cerr << "DB transformation levels are incorrect." << std::endl; return 1; } return 0; } // test getting simple transformations int testImageXformDBFindXform() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); if ( ! db.AddImagePairXform( "xform12", true /*invertible*/, "image1.nii", "image2.nii" ) ) return 1; std::string xform; bool inverse; if ( ! db.FindXform( "image1.nii", "image2.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "xform12" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } return 0; } // test getting transformation between two images in the same space. int testImageXformDBFindXformSameSpace() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); db.AddImage( "image1.nii" ); db.AddImage( "image2.nii", "image1.nii" ); std::string xform; bool inverse; if ( ! db.FindXform( "image1.nii", "image2.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } return 0; } // test getting inverse transformations int testImageXformDBFindXformInverse() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); if ( ! db.AddImagePairXform( "xform12", true /*invertible*/, "image1.nii", "image2.nii" ) ) return 1; std::string xform; bool inverse; if ( ! db.FindXform( "image2.nii", "image1.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "xform12" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( !inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } return 0; } // test getting transformations when none actually exists int testImageXformDBFindXformNone() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); if ( ! db.AddImagePairXform( "xform12", true /*invertible*/, "image1.nii", "image2.nii" ) ) return 1; std::string xform; bool inverse; if ( db.FindXform( "image1.nii", "image3.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup succeeded when it should have failed." << std::endl; return 1; } if ( db.FindXform( "image3.nii", "image2.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup succeeded when it should have failed." << std::endl; return 1; } if ( db.FindXform( "image3.nii", "image3.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup succeeded when it should have failed." << std::endl; return 1; } return 0; } // test getting transformations when multiple different ones exist int testImageXformDBFindXformMultiple() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); if ( ! db.AddImagePairXform( "affine12", true /*invertible*/, "image1.nii", "image2.nii" ) || ! db.AddImagePairXform( "nonrigid12", false /*invertible*/, "image1.nii", "image2.nii" ) ) return 1; std::string xform; bool inverse; if ( ! db.FindXform( "image1.nii", "image2.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "nonrigid12" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } if ( ! db.FindXform( "image2.nii", "image1.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "nonrigid12" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( !inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } return 0; } // test getting transformations when multiple refinement levels exist. int testImageXformDBFindXformLevels() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); if ( ! db.AddImagePairXform( "affine12", true /*invertible*/, "image1.nii", "image2.nii" ) || ! db.AddRefinedXform( "nonrigid12", false /*invertible*/, "affine12" ) ) return 1; std::string xform; bool inverse; if ( ! db.FindXform( "image1.nii", "image2.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "nonrigid12" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } if ( ! db.FindXform( "image2.nii", "image1.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "nonrigid12" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( !inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } return 0; } // test getting transformations when multiple refinement levels exist and the refined transformation is based on an inverted initial transformation int testImageXformDBFindXformLevelsInverse() { cmtk::ImageXformDB db( ":memory:" ); db.DebugModeOn(); if ( ! db.AddImagePairXform( "affine12", true /*invertible*/, "image1.nii", "image2.nii" ) || ! db.AddRefinedXform( "nonrigid21", false /*invertible*/, "affine12", true /*initInverse*/ ) ) return 1; std::string xform; bool inverse; if ( ! db.FindXform( "image1.nii", "image2.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "affine12" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } if ( ! db.FindXform( "image2.nii", "image1.nii", xform, inverse ) ) { std::cerr << "DB transformation lookup failed." << std::endl; return 1; } if ( xform != "nonrigid21" ) { std::cerr << "DB transformation returned wrong xform." << std::endl; return 1; } if ( inverse ) { std::cerr << "DB transformation returned wrong inversion flag." << std::endl; return 1; } return 0; } cmtk-3.0.0/testing/libs/Registration/libRegistrationTestsSQLite.cxx0000644000177700000170000000662211430605055024566 0ustar torstenman/* // // Copyright 2004-2010 SRI International // // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2192 $ // // $LastChangedDate: 2010-08-11 13:38:05 -0700 (Wed, 11 Aug 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include "cmtkImageXformDBTests.txx" /** Set up table of test names and function pointers */ typedef int (*testFuncPtr)(); typedef struct __testNameAndFunctionPointer { const char* name; const testFuncPtr func; } testNameAndFunctionPointer; const testNameAndFunctionPointer testTable[] = { { "ImageXformDBCreate", &testImageXformDBCreate }, { "ImageXformDBOpen", &testImageXformDBOpen }, { "ImageXformDBAddImage", &testImageXformDBAddImage }, { "ImageXformDBAddImageRepeat", &testImageXformDBAddImageRepeat }, { "ImageXformDBAddImagePair", &testImageXformDBAddImagePair }, { "ImageXformDBAddImageThenXform", &testImageXformDBAddImageThenXform }, { "ImageXformDBAddImageWithXform", &testImageXformDBAddImageWithXform }, { "ImageXformDBAddXformSameSpace", &testImageXformDBAddXformSameSpace }, { "ImageXformDBAddXformRefined", &testImageXformDBAddXformRefined }, { "ImageXformDBFindXform", &testImageXformDBFindXform }, { "ImageXformDBFindXformSameSpace", &testImageXformDBFindXformSameSpace }, { "ImageXformDBFindXformInverse", &testImageXformDBFindXformInverse }, { "ImageXformDBFindXformNone", &testImageXformDBFindXformNone }, { "ImageXformDBFindXformMultiple", &testImageXformDBFindXformMultiple }, { "ImageXformDBFindXformLevels", &testImageXformDBFindXformLevels }, { "ImageXformDBFindXformLevelsInverse", &testImageXformDBFindXformLevelsInverse }, { NULL, NULL } }; int main( const int argc, const char* argv[] ) { int testNumber = -1; // is test name given on command line? if ( argc < 2 ) { // no: ask user in dialog mode for ( size_t i = 0; testTable[i].name; ++i ) { std::cout << i << ". " << testTable[i].name << std::endl; } std::cout << "Run test number: "; std::cin >> testNumber; } else { // batch mode: find test by name given on command line for ( size_t i = 0; testTable[i].name; ++i ) { if ( !strcmp( argv[1], testTable[i].name ) ) testNumber = i; } } // run test, or return error if none found if ( testNumber < 0 ) { std::cerr << "Test " << argv[1] << " not found!" << std::endl; return 2; } else return testTable[testNumber].func(); } cmtk-3.0.0/testing/libs/Registration/libRegistrationTests.cxx0000644000177700000170000000425711761260653023516 0ustar torstenman/* // // Copyright 2004-2012 SRI International // // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4367 $ // // $LastChangedDate: 2012-05-29 16:54:19 -0700 (Tue, 29 May 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include "cmtkTypedArraySimilarityTests.txx" /** Set up table of test names and function pointers */ typedef int (*testFuncPtr)(); typedef struct __testNameAndFunctionPointer { const char* name; const testFuncPtr func; } testNameAndFunctionPointer; const testNameAndFunctionPointer testTable[] = { { "TypedArraySimilarity", &testTypedArraySimilarity }, { NULL, NULL } }; int main( const int argc, const char* argv[] ) { int testNumber = -1; // is test name given on command line? if ( argc < 2 ) { // no: ask user in dialog mode for ( size_t i = 0; testTable[i].name; ++i ) { std::cout << i << ". " << testTable[i].name << std::endl; } std::cout << "Run test number: "; std::cin >> testNumber; } else { // batch mode: find test by name given on command line for ( size_t i = 0; testTable[i].name; ++i ) { if ( !strcmp( argv[1], testTable[i].name ) ) testNumber = i; } } // run test, or return error if none found if ( testNumber < 0 ) return 2; else return testTable[testNumber].func(); } cmtk-3.0.0/testing/libs/Registration/cmtkTypedArraySimilarityTests.txx0000644000177700000170000000677411452717235025416 0ustar torstenman/* // // Copyright 2004-2010 SRI International // // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #ifdef HAVE_IEEEFP_H # include #endif #include #include // Check TypedArraySimilarity result against baseline. int testTypedArraySimilarityCheck( const char* name, const cmtk::Types::DataItem result, const cmtk::Types::DataItem baseline ) { const cmtk::Types::DataItem tolerance = 1e-4; const cmtk::Types::DataItem error = 2 * fabs(result-baseline) / (fabs(result)+fabs(baseline)); if ( !finite( result ) || (error > tolerance) ) { std::cerr << name << " returned " << result << ", which exceeds tolerance for baseline " << baseline << std::endl; return 0; } return 1; } // test "TypedArraySimilarity" class int testTypedArraySimilarity() { cmtk::UniformVolume::SmartPtr testVolume( cmtk::VolumeIO::Read( CMTK_DATADIR "/spgr_3t.hdr" ) ); if ( ! testVolume ) { std::cerr << "SETUP ERROR: could not read test image 'spgr_3t.hdr'" << std::endl; return 1; } cmtk::TypedArray::SmartPtr data0( testVolume->GetOrthoSlice( 2, 34 )->GetPixelData() ); cmtk::TypedArray::SmartPtr data1( testVolume->GetOrthoSlice( 2, 35 )->GetPixelData() ); int success = 0; success += testTypedArraySimilarityCheck( "GetMutualInformation", cmtk::TypedArraySimilarity::GetMutualInformation( data0, data1 ), 1.55075 ); success += testTypedArraySimilarityCheck( "GetNormalizedMutualInformation", cmtk::TypedArraySimilarity::GetNormalizedMutualInformation( data0, data1 ), 1.29928 ); success += testTypedArraySimilarityCheck( "GetPeakSignalToNoiseRatio", cmtk::TypedArraySimilarity::GetPeakSignalToNoiseRatio( data0, data1 ), -4.98786 ); success += testTypedArraySimilarityCheck( "GetMinusMeanSquaredDifference", cmtk::TypedArraySimilarity::GetMinusMeanSquaredDifference( data0, data1 ), -9545.03 ); success += testTypedArraySimilarityCheck( "GetCrossCorrelation", cmtk::TypedArraySimilarity::GetCrossCorrelation( data0, data1 ), 0.964253 ); success += testTypedArraySimilarityCheck( "GetCorrelationRatio", cmtk::TypedArraySimilarity::GetCorrelationRatio( data0, data1 ), 0.933251 ); cmtk::Types::DataItem scaleFactor = 0; success += testTypedArraySimilarityCheck( "GetDifferenceImageEntropy", cmtk::TypedArraySimilarity::GetDifferenceArrayEntropy( data0, data1, scaleFactor ), 2.89753 ); success += testTypedArraySimilarityCheck( "GetDifferenceImageEntropy::scaleFactor", scaleFactor, 1.01683 ); return (success == 8) ? 0 : 1; } cmtk-3.0.0/testing/libs/Base/0000755000177700000170000000000012263615446015000 5ustar torstenmancmtk-3.0.0/testing/libs/Base/CMakeLists.txt0000644000177700000170000000544012024721403017525 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## ## Copyright 2004-2012 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 4510 $ ## ## $LastChangedDate: 2012-09-14 14:34:59 -0700 (Fri, 14 Sep 2012) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ========================================== # Setup binary test drivers SET(CMTK_LIBRARIES "cmtkBase;cmtkNumerics;cmtkSystem") SET(DRIVERS libBaseTests) FOREACH(D ${DRIVERS}) ADD_EXECUTABLE(${D} ${D}.cxx) TARGET_LINK_LIBRARIES(${D} ${CMTK_LIBRARIES} ${CMTK_SYSTEM_LIBRARIES}) ENDFOREACH(D ${DRIVERS}) # ========================================== # Tests for "cmtk::DataGrid" class SET(Tests ${Tests} DataGridMatches) # ========================================== # Tests for "cmtk::Region" class SET(Tests ${Tests} RegionSizeInt RegionSizeFloat) # ========================================== # Tests for "cmtk::ParametricPlane" class SET(Tests ${Tests} ParametricPlaneMirror ParametricPlaneMirrorOffset) # ========================================== # Tests for "cmtk::ScalarImage" class SET(Tests ${Tests} ScalarImage) # ========================================== # Tests for "cmtk::SplineWarpXform" class SET(Tests ${Tests} SplineWarpXform SplineWarpXformInverse) # ========================================== # Tests for "cmtk::SymmetricMatrix" class SET(Tests ${Tests} SymmetricMatrix SymmetricMatrixResize SymmetricMatrixEqual) # ========================================== # Tests for "cmtk::TypedArray" class SET(Tests ${Tests} TypedArrayMatchHistogram1 TypedArrayMatchHistogram2 TypedArrayMatchHistogram3 TypedArrayMatchHistogram4) # ========================================== # Tests for "cmtk::UniformVolume" class SET(Tests ${Tests} UniformVolumeMatches) # ========================================== # Tests for "cmtk::MathUtil" functions SET(Tests ${Tests} EigenSystemSymmetricMatrix3x3 MathUtilUniformRandom) FOREACH(T ${Tests}) ADD_TEST(${T} ${EXECUTABLE_OUTPUT_PATH}/libBaseTests ${T}) ENDFOREACH(T Tests) cmtk-3.0.0/testing/libs/Base/cmtkScalarImageTests.txx0000644000177700000170000000234311452717235021617 0ustar torstenman/* // // Copyright 2004-2010 SRI International // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include // test "GridMatches" function int testScalarImage() { cmtk::ScalarImage image; cmtk::ScalarImage image2( image ); return 0; } cmtk-3.0.0/testing/libs/Base/cmtkUniformVolumeTests.txx0000644000177700000170000000433711765704432022265 0ustar torstenman/* // // Copyright 2004-2012 SRI International // // Copyright 1997-2010 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4427 $ // // $LastChangedDate: 2012-06-12 11:23:22 -0700 (Tue, 12 Jun 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include // test "GridMatches" function int testUniformVolumeMatches() { const int dims1[3] = { 10, 11, 12 }; const cmtk::Types::Coordinate size1a[3] = { 9, 10, 11 }; const cmtk::Types::Coordinate size1b[3] = { 10, 11, 12 }; const int dims2[3] = { 11, 12, 10 }; const cmtk::Types::Coordinate size2[3] = { 11, 12, 10 }; cmtk::UniformVolume volume1a( (cmtk::UniformVolume::IndexType::FromPointer( dims1 )), cmtk::FixedVector<3,cmtk::Types::Coordinate>::FromPointer( size1a ) ); cmtk::UniformVolume volume1b( (cmtk::UniformVolume::IndexType::FromPointer( dims1 )), cmtk::FixedVector<3,cmtk::Types::Coordinate>::FromPointer( size1b ) ); cmtk::UniformVolume volume1c( (cmtk::UniformVolume::IndexType::FromPointer( dims1 )), cmtk::FixedVector<3,cmtk::Types::Coordinate>::FromPointer( size1b ) ); cmtk::UniformVolume volume2( (cmtk::UniformVolume::IndexType::FromPointer( dims2 )), cmtk::FixedVector<3,cmtk::Types::Coordinate>::FromPointer( size2 ) ); if ( volume1a.GridMatches( volume1b ) ) return 1; if ( !volume1b.GridMatches( volume1c ) ) return 1; if ( volume1a.GridMatches( volume2 ) ) return 1; return 0; } cmtk-3.0.0/testing/libs/Base/cmtkParametricPlaneTests.txx0000644000177700000170000000752311452730031022510 0ustar torstenman/* // // Copyright 2010 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2401 $ // // $LastChangedDate: 2010-10-05 16:09:13 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include #include // test parametric plane reflection with zero offset int testParametricPlaneMirror() { typedef cmtk::ParametricPlane PlaneType; typedef PlaneType::CoordinateVectorType VectorType; typedef cmtk::AffineXform::MatrixType MatrixType; VectorType origin; std::fill( origin.begin(), origin.end(), 0 ); PlaneType plane; plane.SetOrigin( origin ); plane.SetTheta( cmtk::Units::Degrees( 30 ) ); plane.SetPhi( cmtk::Units::Degrees( 45 ) ); for ( double rho = 0; rho < 21; rho += 20 ) { plane.SetRho( rho ); VectorType v; v[0] = v[1] = v[2] = 1; VectorType pv = v; plane.MirrorInPlace( pv ); MatrixType pm = plane.GetMirrorXformMatrix(); VectorType mv = v * pm; if ( sqrt( (mv-pv).SumOfSquares() ) > 1e-5 ) { std::cerr << "ParametricPlane::MirrorInPlace and mirror matrix produce different results." << std::endl; return 1; } mv *= pm; if ( sqrt( (mv-v).SumOfSquares() ) > 1e-5 ) { std::cerr << "ParametricPlane mirror matrix applied twice does not return to original point." << std::endl; return 1; } plane.MirrorInPlace( pv ); if ( sqrt( (pv-v).SumOfSquares() ) > 1e-5 ) { std::cerr << "ParametricPlane::MirrorInPlane applied twice does not return to original point." << std::endl; return 1; } } return 0; } // test parametric plane reflection with non-zero offset int testParametricPlaneMirrorOffset() { typedef cmtk::ParametricPlane PlaneType; typedef PlaneType::CoordinateVectorType VectorType; typedef cmtk::AffineXform::MatrixType MatrixType; VectorType origin; origin[0] = 10; origin[1] = 20; origin[2] = 30; PlaneType plane; plane.SetOrigin( origin ); plane.SetTheta( cmtk::Units::Degrees( 30 ) ); plane.SetPhi( cmtk::Units::Degrees( 45 ) ); for ( double rho = 0; rho < 21; rho += 20 ) { plane.SetRho( rho ); VectorType v; v[0] = v[1] = v[2] = 1; VectorType pv = v; plane.MirrorInPlace( pv ); MatrixType pm = plane.GetMirrorXformMatrix(); VectorType mv = v * pm; if ( sqrt( (mv-pv).SumOfSquares() ) > 1e-5 ) { std::cerr << "ParametricPlane::MirrorInPlace and mirror matrix produce different results." << std::endl; return 1; } mv *= pm; if ( sqrt( (mv-v).SumOfSquares() ) > 1e-5 ) { std::cerr << "ParametricPlane mirror matrix applied twice does not return to original point." << std::endl; return 1; } plane.MirrorInPlace( pv ); if ( sqrt( (pv-v).SumOfSquares() ) > 1e-5 ) { std::cerr << "ParametricPlane::MirrorInPlane applied twice does not return to original point." << std::endl; return 1; } } return 0; } cmtk-3.0.0/testing/libs/Base/cmtkMathUtilTests.txx0000644000177700000170000000432112024721403021160 0ustar torstenman/* // // Copyright 1997-2009 Torsten Rohlfing // Copyright 2004-2009 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include // test whether uniform random numbers are reasonably uniform; does NOT test whether they are random! int testMathUtilUniformRandom() { const size_t nSamples = 100000; const size_t nBins = 50; unsigned int histogram[nBins]; memset( histogram, 0, sizeof( histogram ) ); for ( size_t n = 0; n < nSamples; ++n ) { ++histogram[static_cast( nBins * cmtk::MathUtil::UniformRandom() )]; } // allow +/- 5% deviation in each bin. This seems to be what Numerical Recipes can do. const unsigned int lower = static_cast( 0.95 * nSamples / nBins ); const unsigned int upper = static_cast( 1.05 * nSamples / nBins ); unsigned int countOutside = 0; for ( size_t n = 0; n < nBins; ++n ) { if ( (histogram[n] < lower ) || (histogram[n] > upper ) ) ++countOutside; } const unsigned int threshold = static_cast( 0.05 * nBins ); if ( countOutside > threshold ) { std::cerr << "Too many bins outside +/- 5% range. Actual: " << countOutside << ", threshold: " << threshold << std::endl; return 1; } return 0; } cmtk-3.0.0/testing/libs/Base/cmtkTypedArrayTests.txx0000644000177700000170000000220311452717235021526 0ustar torstenman/* // // Copyright 2004-2010 SRI International // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include cmtk-3.0.0/testing/libs/Base/cmtkTypedArrayFunctionHistogramMatchingTests.txx0000644000177700000170000001466011452717235026577 0ustar torstenman/* // // Copyright 2004-2010 SRI International // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include #include // test "TypedArray::MatchHistogramToReference" function int testTypedArrayMatchHistogram1() { float data1[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 }; cmtk::TypedArray::SmartPtr array1( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data1, sizeof( data1 ) / sizeof( *data1 ), false /*freeArray*/ ) ); float data2[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 }; cmtk::TypedArray::SmartPtr array2( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data2, sizeof( data2 ) / sizeof( *data2 ), false /*freeArray*/ ) ); array2->ApplyFunctionObject( cmtk::TypedArrayFunctionHistogramMatching( *array2, *array1 ) ); float maxDeviation = 0; for ( size_t i = 0; iGetDataSize(); ++i ) { cmtk::Types::DataItem value; array2->Get( value, i ); maxDeviation = std::max( maxDeviation, fabs(value-data1[i]) ); } if ( maxDeviation > 0.01 ) return 1; else return 0; } // test "TypedArray::MatchHistogramToReference" function int testTypedArrayMatchHistogram2() { float data1[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 }; cmtk::TypedArray::SmartPtr array1( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data1, sizeof( data1 ) / sizeof( *data1 ), false /*freeArray*/ ) ); float data2[] = { 0.1, 0.1, 0.5, 0.5, 2.5, 2.5, 3.0, 3.0 }; float base2[] = { 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 }; cmtk::TypedArray::SmartPtr array2( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data2, sizeof( data2 ) / sizeof( *data2 ), false /*freeArray*/ ) ); array2->ApplyFunctionObject( cmtk::TypedArrayFunctionHistogramMatching( *array2, *array1 ) ); for ( size_t i = 0; iGetDataSize(); ++i ) { cmtk::Types::DataItem value; array2->Get( value, i ); } float maxDeviation = 0; for ( size_t i = 0; iGetDataSize(); ++i ) { cmtk::Types::DataItem value; array2->Get( value, i ); maxDeviation = std::max( maxDeviation, fabs(value-base2[i]) ); } if ( maxDeviation > 0.01 ) return 1; else return 0; } // test histogram matching from existing histograms int testTypedArrayMatchHistogram3() { float data1[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 }; cmtk::TypedArray::SmartPtr array1( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data1, sizeof( data1 ) / sizeof( *data1 ), false /*freeArray*/ ) ); float data2[] = { 0.1, 0.1, 0.5, 0.5, 2.5, 2.5, 3.0, 3.0 }; cmtk::TypedArray::SmartPtr array2a( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data2, sizeof( data2 ) / sizeof( *data2 ), false /*freeArray*/ ) ); cmtk::TypedArray::SmartPtr array2b( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data2, sizeof( data2 ) / sizeof( *data2 ), false /*freeArray*/ ) ); array2a->ApplyFunctionObject( cmtk::TypedArrayFunctionHistogramMatching( *array2a, *array1 ) ); cmtk::TypedArrayFunctionHistogramMatching::HistogramType::SmartPtr hist1( array1->GetHistogram( cmtk::TypedArrayFunctionHistogramMatching::DefaultNumberOfHistogramBins ) ); cmtk::TypedArrayFunctionHistogramMatching::HistogramType::SmartPtr hist2b( array2b->GetHistogram( cmtk::TypedArrayFunctionHistogramMatching::DefaultNumberOfHistogramBins ) ); array2b->ApplyFunctionObject( cmtk::TypedArrayFunctionHistogramMatching( *hist2b, *hist1 ) ); float maxDeviation = 0; for ( size_t i = 0; iGetDataSize(); ++i ) { cmtk::Types::DataItem a, b; array2a->Get( a, i ); array2b->Get( b, i ); maxDeviation = std::max( maxDeviation, fabs(a-b) ); } if ( maxDeviation > 1e-8 ) return 1; else return 0; } // test whether histogram matching breaks with unequal numbers of bins for both histograms. int testTypedArrayMatchHistogram4() { float data1[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3 }; cmtk::TypedArray::SmartPtr array1a( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data1, sizeof( data1 ) / sizeof( *data1 ), false /*freeArray*/ ) ); cmtk::TypedArray::SmartPtr array1b( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data1, sizeof( data1 ) / sizeof( *data1 ), false /*freeArray*/ ) ); float data2[] = { 0.1, 0.1, 0.5, 0.5, 2.5, 2.5, 3.0, 3.0 }; cmtk::TypedArray::SmartPtr array2a( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data2, sizeof( data2 ) / sizeof( *data2 ), false /*freeArray*/ ) ); cmtk::TypedArray::SmartPtr array2b( cmtk::TypedArray::Create( cmtk::TYPE_FLOAT, data2, sizeof( data2 ) / sizeof( *data2 ), false /*freeArray*/ ) ); cmtk::TypedArrayFunctionHistogramMatching::HistogramType::SmartPtr hist1a( array1a->GetHistogram( cmtk::TypedArrayFunctionHistogramMatching::DefaultNumberOfHistogramBins ) ); cmtk::TypedArrayFunctionHistogramMatching::HistogramType::SmartPtr hist2a( array2a->GetHistogram( cmtk::TypedArrayFunctionHistogramMatching::DefaultNumberOfHistogramBins / 2 ) ); array2a->ApplyFunctionObject( cmtk::TypedArrayFunctionHistogramMatching( *hist2a, *hist1a ) ); cmtk::TypedArrayFunctionHistogramMatching::HistogramType::SmartPtr hist1b( array1b->GetHistogram( cmtk::TypedArrayFunctionHistogramMatching::DefaultNumberOfHistogramBins / 2 ) ); cmtk::TypedArrayFunctionHistogramMatching::HistogramType::SmartPtr hist2b( array2b->GetHistogram( cmtk::TypedArrayFunctionHistogramMatching::DefaultNumberOfHistogramBins ) ); array2b->ApplyFunctionObject( cmtk::TypedArrayFunctionHistogramMatching( *hist2b, *hist1b ) ); // here, we're only testing for crashes, leaks, etc. return 0; } cmtk-3.0.0/testing/libs/Base/cmtkRegionTests.txx0000644000177700000170000000507711765704432020703 0ustar torstenman/* // // Copyright 2010, 2012 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4427 $ // // $LastChangedDate: 2012-06-12 11:23:22 -0700 (Tue, 12 Jun 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include // test "Size" member function for int regions int testRegionSizeInt() { const int regionFromArray[] = { 1, 2, 3 }; const int regionToArray[] = { 2, 4, 7 }; const cmtk::Region<3,int> r3( (cmtk::FixedVector<3,int>::FromPointer( regionFromArray )), cmtk::FixedVector<3,int>::FromPointer( regionToArray ) ); if ( r3.Size() != 8 ) return 1; const cmtk::Region<2,int> r2( (cmtk::FixedVector<2,int>::FromPointer( regionFromArray )), cmtk::FixedVector<2,int>::FromPointer( regionToArray ) ); if ( r2.Size() != 2 ) return 1; const cmtk::Region<1,int> r1( (cmtk::FixedVector<1,int>::FromPointer( regionFromArray )), cmtk::FixedVector<1,int>::FromPointer( regionToArray ) ); if ( r1.Size() != 1 ) return 1; return 0; } // test "Size" member function for float regions int testRegionSizeFloat() { const float regionFromArray[] = { 1, 2, 3 }; const float regionToArray[] = { 2, 4, 7 }; const cmtk::Region<3,float> r3( (cmtk::FixedVector<3,float>::FromPointer( regionFromArray )), cmtk::FixedVector<3,float>::FromPointer( regionToArray ) ); if ( r3.Size() != 8 ) return 1; const cmtk::Region<2,float> r2( (cmtk::FixedVector<2,float>::FromPointer( regionFromArray )), cmtk::FixedVector<2,float>::FromPointer( regionToArray ) ); if ( r2.Size() != 2 ) return 1; const cmtk::Region<1,float> r1( (cmtk::FixedVector<1,float>::FromPointer( regionFromArray )), cmtk::FixedVector<1,float>::FromPointer( regionToArray ) ); if ( r1.Size() != 1 ) return 1; return 0; } cmtk-3.0.0/testing/libs/Base/libBaseTests.cxx0000644000177700000170000000607712024721403020104 0ustar torstenman/* // // Copyright 2004-2012 SRI International // // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4510 $ // // $LastChangedDate: 2012-09-14 14:34:59 -0700 (Fri, 14 Sep 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include "cmtkDataGridTests.txx" #include "cmtkEigenSystemSymmetricMatrix3x3Tests.txx" #include "cmtkMathUtilTests.txx" #include "cmtkParametricPlaneTests.txx" #include "cmtkRegionTests.txx" #include "cmtkScalarImageTests.txx" #include "cmtkSplineWarpXformTests.txx" #include "cmtkSymmetricMatrixTests.txx" #include "cmtkTypedArrayFunctionHistogramMatchingTests.txx" #include "cmtkUniformVolumeTests.txx" int main( const int argc, const char* argv[] ) { cmtk::TestFunctionMap map; map.AddTest( "DataGridMatches", &testDataGridMatches ); map.AddTest( "EigenSystemSymmetricMatrix3x3", &testEigenSystemSymmetricMatrix3x3 ); map.AddTest( "MathUtilUniformRandom", &testMathUtilUniformRandom ); map.AddTest( "ParametricPlaneMirror", &testParametricPlaneMirror ); map.AddTest( "ParametricPlaneMirrorOffset", &testParametricPlaneMirrorOffset ); map.AddTest( "RegionSizeInt", &testRegionSizeInt ); map.AddTest( "RegionSizeFloat", &testRegionSizeFloat ); map.AddTest( "ScalarImage", &testScalarImage ); map.AddTest( "SplineWarpXform", &testSplineWarpXform ); map.AddTest( "SplineWarpXformInverse", &testSplineWarpXformInverse ); map.AddTest( "SymmetricMatrix", &testSymmetricMatrix ); map.AddTest( "SymmetricMatrixResize", &testSymmetricMatrixResize ); map.AddTest( "SymmetricMatrixEqual", &testSymmetricMatrixEqual ); map.AddTest( "TypedArrayMatchHistogram1", &testTypedArrayMatchHistogram1 ); map.AddTest( "TypedArrayMatchHistogram2", &testTypedArrayMatchHistogram2 ); map.AddTest( "TypedArrayMatchHistogram3", &testTypedArrayMatchHistogram3 ); map.AddTest( "TypedArrayMatchHistogram4", &testTypedArrayMatchHistogram4 ); map.AddTest( "UniformVolumeMatches", &testUniformVolumeMatches ); // is test name given on command line? if ( argc < 2 ) { } else { return map.RunTestByName( argv[1] ); } } cmtk-3.0.0/testing/libs/Base/cmtkSymmetricMatrixTests.txx0000644000177700000170000000612411551654734022615 0ustar torstenman/* // // Copyright 2010-2011 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 3142 $ // // $LastChangedDate: 2011-04-14 13:32:28 -0700 (Thu, 14 Apr 2011) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include // test symmetric behaviour int testSymmetricMatrix() { cmtk::SymmetricMatrix m( 2 ); m(0,0) = -1; m(1,1) = -2; if ( m(0,0) != -1 ) { cmtk::StdErr << "testSymmetricMatrix test failed at label A\n"; return 1; } if ( m(1,1) != -2 ) { cmtk::StdErr << "testSymmetricMatrix test failed at label B\n"; return 1; } m(0,1) = 0; m(1,0) = 1; if ( m(0,1) != 1 ) { cmtk::StdErr << "testSymmetricMatrix test failed at label C\n"; return 1; } m(0,1) = 2; if ( m(1,0) != 2 ) { cmtk::StdErr << "testSymmetricMatrix test failed at label D\n"; return 1; } if ( m(0,0) != -1 ) { cmtk::StdErr << "testSymmetricMatrix test failed at label E\n"; return 1; } if ( m(1,1) != -2 ) { cmtk::StdErr << "testSymmetricMatrix test failed at label F\n"; return 1; } return 0; } // test resize functionality int testSymmetricMatrixResize() { cmtk::SymmetricMatrix m( 1 ); m(0,0) = 1; m.Resize( 2 ); m(0,1) = 2; m(1,1) = 3; if ( m(0,0) != 1 ) { cmtk::StdErr << "testSymmetricMatrixResize failed at label A\n"; return 1; } if ( m(1,0) != 2 ) { cmtk::StdErr << "testSymmetricMatrixResize failed at label B\n"; return 1; } if ( m(1,1) != 3 ) { cmtk::StdErr << "testSymmetricMatrixResize failed at label C\n"; return 1; } m.Resize( 1 ); if ( m(0,0) != 1 ) { cmtk::StdErr << "testSymmetricMatrixResize failed at label D\n"; return 1; } return 0; } // test equality/inequality operators int testSymmetricMatrixEqual() { cmtk::SymmetricMatrix m1( 1 ); cmtk::SymmetricMatrix m2( 2 ); if ( m1 == m2 ) { cmtk::StdErr << "testSymmetricMatrixEqual failed at label A\n"; return 1; } m1.Resize( 2 ); m1(0,0) = m2(0,0) = 1; m1(1,0) = m2(1,0) = 2; m1(1,1) = m2(1,1) = 3; if ( m1 != m2 ) { cmtk::StdErr << "testSymmetricMatrixEqual failed at label B\n"; return 1; } return 0; } cmtk-3.0.0/testing/libs/Base/cmtkSplineWarpXformTests.txx0000644000177700000170000003337511765704432022562 0ustar torstenman/* // // Copyright 1997-2009 Torsten Rohlfing // // Copyright 2004-2012 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4427 $ // // $LastChangedDate: 2012-06-12 11:23:22 -0700 (Tue, 12 Jun 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include #include int testSplineWarpXform() { return 0; } int testSplineWarpXformInverse() { // parameters for the current WarpSingleLevel baseline transformation const cmtk::Types::Coordinate domain[3] = { 357.1875, 357.1875, 125 }; const int dims[3] = { 7, 7, 4 }; const size_t nparameters = 3 * 7 * 7 * 4; cmtk::Types::Coordinate parameters[nparameters] = { -88.706249, -84.998951480000002, -133.41214640000001, 0.58282801900000003, -85.552844629999996, -132.6599301, 89.312814939999996, -86.301460410000004, -132.5876548, 177.77193539999999, -85.646700699999997, -133.84530789999999, 266.44951250000003, -79.496837150000005, -133.9639134, 355.83432440000001, -82.938156820000003, -133.6333545, 444.48369489999999, -85.145062800000005, -134.2765378, -87.318911839999998, 3.4110965480000002, -132.63593660000001, 2.617442912, -0.38841385519999999, -127.8795088, 90.052308600000003, -4.7583292430000004, -131.88906729999999, 179.2010363, 0.1205040694, -133.54224679999999, 264.80709460000003, 12.066754080000001, -130.28005279999999, 357.41610070000002, 7.3845064359999997, -127.76716690000001, 445.47999440000001, 3.1919038909999999, -132.9684795, -83.704470520000001, 92.192599630000004, -132.28900619999999, 4.9322056060000001, 90.245003139999994, -128.26304400000001, 87.099999409999995, 74.254342940000001, -135.77073709999999, 170.00687600000001, 88.896090749999999, -155.3283208, 273.92401669999998, 93.242624550000002, -140.88084140000001, 361.17963400000002, 89.683891509999995, -130.97434670000001, 445.75771220000001, 91.876312139999996, -133.26873420000001, -81.061337280000004, 181.6535792, -133.0931166, 1.0531317360000001, 188.02919120000001, -137.56335189999999, 89.184044760000006, 178.8696482, -159.36757170000001, 174.015658, 183.60500909999999, -151.0189499, 267.2078841, 179.12156770000001, -144.6624151, 359.74886040000001, 176.8779567, -137.3049566, 444.22113439999998, 180.80086940000001, -133.6307272, -83.727375629999997, 267.29410710000002, -133.48054730000001, 1.7494822249999999, 266.0169631, -132.43946500000001, 99.806269929999999, 267.21390309999998, -150.58490649999999, 177.13017690000001, 262.75285589999999, -147.6204467, 260.4250389, 252.11927119999999, -145.32091500000001, 359.6639907, 257.1055576, -136.3139481, 445.63570859999999, 268.85830870000001, -133.20231140000001, -87.196138289999993, 356.09219039999999, -131.7662282, 5.5288343080000004, 348.41581830000001, -127.61307909999999, 93.661780930000006, 350.04663319999997, -134.64285319999999, 179.84697249999999, 356.04154419999998, -138.72237849999999, 263.79976570000002, 351.84695269999997, -134.74277140000001, 354.08110850000003, 354.72597280000002, -127.8249725, 446.35394769999999, 356.2593943, -132.68096320000001, -88.868390099999999, 445.57343600000002, -132.74548110000001, 0.13575482220000001, 444.76912679999998, -131.80384480000001, 88.728966940000007, 444.62619749999999, -132.15681269999999, 177.92944069999999, 446.30323390000001, -133.03929260000001, 266.35346240000001, 444.6431498, -132.9607939, 355.45975850000002, 445.66228130000002, -133.26875509999999, 444.53735660000001, 445.56110649999999, -133.65817060000001, -87.595741469999993, -85.615120719999993, -5.958190739, 0.44238839149999998, -98.505404619999993, -2.2983611289999999, 91.516483010000002, -100.0147607, -5.1136814890000002, 181.5319556, -104.2308865, -5.8053919389999997, 268.33913130000002, -88.234155250000001, -6.6261121190000001, 357.53476169999999, -84.906273350000006, -3.6736957480000001, 445.84451159999998, -85.767281420000003, -6.19765224, -84.004465359999998, 1.1194690920000001, -2.3237842579999999, 7.0343907919999999, 2.887315584, 9.3485539650000007, 85.201014270000002, 3.2166232570000002, -2.638737415, 185.81284930000001, 3.2168928389999998, -5.0315402049999998, 263.85491830000001, -5.885358095, -1.5863716800000001, 355.65862499999997, -0.22509619959999999, 9.7554431780000002, 446.56552870000002, 0.91509386459999997, -1.77461844, -76.155025309999999, 91.465387050000004, -4.5014921750000001, -0.025622953949999999, 91.082948139999999, 36.132634940000003, 88.895439049999993, 91.715001909999998, 5.5567657759999998, 175.59212350000001, 91.715271490000006, -19.827600650000001, 267.31410360000001, 91.71554107, -18.57972865, 355.65862499999997, 92.067915659999997, 15.83988965, 447.8203795, 94.976408219999996, -1.8117929740000001, -89.183814949999999, 182.31435640000001, -0.18152812469999999, -0.025622953949999999, 180.213111, 29.576301829999998, 88.895439049999993, 180.21338059999999, -50.387582109999997, 177.81650099999999, 187.63108, -6.3127768949999998, 266.73756300000002, 188.21391969999999, -39.724707619999997, 355.65862499999997, 194.76894530000001, 12.719229840000001, 448.49040489999999, 180.30507940000001, 6.4192943600000003, -86.124877290000001, 266.36517220000002, 0.81955630999999995, -0.025622953949999999, 268.71148959999999, 6.6378779159999999, 88.895439049999993, 268.71175920000002, -8.5170915610000009, 177.81650099999999, 268.71202879999998, -40.255468520000001, 266.73756300000002, 268.71229840000001, -11.29851287, 355.65862499999997, 268.71256799999998, 12.631458200000001, 455.28980799999999, 262.68077749999998, 3.5113257330000001, -83.442058020000005, 352.86904729999998, -1.6556360590000001, -0.025622953949999999, 357.20986829999998, 18.933949649999999, 92.201104720000004, 357.21013790000001, -5.9082610569999998, 185.02496339999999, 357.21040749999997, -38.860956639999998, 265.44028609999998, 357.21067699999998, -14.704373049999999, 355.65862499999997, 357.2109466, 9.0930626809999993, 444.68610519999999, 356.86132309999999, -1.78315417, -87.485908379999998, 444.2545389, -4.8936582450000001, 3.2569376710000002, 444.43092489999998, 0.096468254239999995, 91.317244149999993, 442.34335479999999, -6.8668513320000004, 174.63876999999999, 450.46435989999998, -5.3950795060000001, 265.36603500000001, 445.70905570000002, -3.9132990560000001, 354.38166330000001, 445.87286769999997, -4.1942974719999997, 445.27059109999999, 444.60602310000002, -6.1777497380000002, -87.057384740000003, 11 -86.151767390000003, 121.0374534, 1.7057175179999999, -96.19556394, 122.554754, 89.579146320000007, -104.5236975, 118.37620750000001, 179.89012020000001, -104.9898585, 117.0390142, 267.55622369999998, -91.202323030000002, 116.7009912, 355.50636229999998, -91.482698450000001, 121.1113952, 445.60660159999998, -86.026599090000005, 120.60045580000001, -84.171902759999995, -0.01482944089, 121.7216818, 7.2181945880000002, 3.0001385580000002, 107.25279829999999, 80.852307519999997, 3.0004081390000001, 107.9820965, 176.8311132, 3.0006777210000002, 120.5239799, 263.74011230000002, 3.0009473029999998, 120.63115879999999, 355.37072819999997, 3.0012168840000002, 104.91928830000001, 446.56621439999998, -2.4291254979999999, 119.3823773, -81.5035065, 90.071761339999995, 120.84644969999999, 0.20142214319999999, 90.574182809999996, 113.35627599999999, 89.122484139999997, 91.498786789999997, 128.82387059999999, 175.58544979999999, 101.4990564, 122.9002965, 268.38340210000001, 91.499325959999993, 120.5156942, 355.88567010000003, 91.499595540000001, 131.39708440000001, 444.7709438, 96.842661910000004, 119.9692496, -89.055928379999997, 182.5025977, 120.1122323, 0.20142214319999999, 179.9968959, 122.4469038, 89.122484139999997, 179.9971654, 122.601725, 178.04354609999999, 179.997435, 126.95405100000001, 266.96460810000002, 179.99770459999999, 109.6421946, 355.88567010000003, 180.75639219999999, 121.4688462, 447.20440389999999, 185.2565166, 129.8153983, -89.080491530000003, 271.57375159999998, 118.9826401, 0.20142214319999999, 268.49527449999999, 133.51210159999999, 89.122484139999997, 268.49554410000002, 123.2495995, 178.04354609999999, 268.49581369999999, 156.55418539999999, 266.96460810000002, 268.49608330000001, 126.9632696, 355.88567010000003, 268.49635280000001, 125.8377127, 456.11810259999999, 263.93876160000002, 124.1798611, -78.757516609999996, 354.1474331, 118.3106315, 0.20142214319999999, 356.99365319999998, 106.9986686, 80.916068390000007, 356.99392280000001, 122.5179942, 183.90640450000001, 356.99419230000001, 139.70791149999999, 274.36699199999998, 356.99446189999998, 128.8031953, 355.88567010000003, 356.9947315, 113.7361619, 431.15941249999997, 357.78121429999999, 120.79886980000001, -87.137463229999994, 444.211366, 121.661636, 3.032267085, 442.4181438, 122.02193889999999, 90.122988419999999, 447.11456579999998, 119.2880096, 171.88924359999999, 443.27612269999997, 126.6859994, 266.08858839999999, 445.49284060000002, 123.3604062, 354.6575727, 447.03908790000003, 121.0512234, 444.93700189999998, 444.38999630000001, 120.7991143, -88.437080820000006, -85.679078360000005, 248.01994110000001, 0.90716082620000005, -87.579235199999999, 247.72265619999999, 90.422524789999997, -89.779116000000002, 247.09381070000001, 177.9337969, -99.358937710000006, 246.43002150000001, 268.200943, -91.2776566, 246.78031390000001, 356.61125870000001, -87.247415489999995, 247.33492340000001, 445.13719680000003, -85.752559039999994, 247.14701299999999, -88.667440450000001, 2.378526865, 248.15868649999999, 2.8663826349999999, -1.1642714359999999, 247.05720909999999, 89.347263699999999, -9.1457145759999996, 242.8314393, 174.87415490000001, -9.2338554550000005, 240.81855210000001, 271.94218269999999, -10.368706850000001, 243.2065522, 357.89138079999998, -12.21101354, 243.7249606, 445.92261459999997, 1.966463385, 247.059834, -88.912398969999998, 91.495463610000002, 248.26963259999999, 2.7270593399999998, 91.117068270000004, 244.86417639999999, 82.594282609999993, 92.770709539999999, 245.50448940000001, 178.86315379999999, 126.0907351, 229.5875126, 276.54213440000001, 100.338989, 241.38238050000001, 357.5755231, 92.732282940000005, 243.25368760000001, 448.57513119999999, 91.815159890000004, 244.83041610000001, -90.320214309999997, 180.10600199999999, 246.54689540000001, 3.6745516139999999, 186.6898391, 241.52917769999999, 89.349529239999995, 179.11642739999999, 239.24101239999999, 173.81978810000001, 162.44730430000001, 250.41458320000001, 265.41958579999999, 180.45522170000001, 247.98236069999999, 353.23377349999998, 192.21066049999999, 251.7287273, 445.66010940000001, 181.26521289999999, 246.71072000000001, -86.986800479999999, 269.28480500000001, 244.58283109999999, 0.51393186719999995, 268.80303909999998, 236.98863900000001, 89.621769709999995, 266.26399020000002, 238.93264049999999, 179.266944, 238.34859410000001, 265.1629236, 269.35367380000002, 256.8740277, 257.8996176, 361.80705540000002, 263.43252030000002, 246.61417800000001, 436.91912619999999, 269.42811289999997, 247.08582329999999, -87.15915038, 359.0044408, 247.66274319999999, -0.82839372629999997, 360.31312320000001, 241.9673334, 92.841495690000002, 355.37873960000002, 250.24562259999999, 175.9934432, 348.99376549999999, 257.76013139999998, 266.66541599999999, 356.44961849999999, 252.0638975, 353.65442949999999, 358.05145049999999, 245.86233609999999, 442.59605629999999, 357.38704439999998, 247.363855, -88.558712749999998, 445.28969480000001, 248.99420019999999, 0.055054464290000001, 448.6656423, 248.6825187, 89.390803320000003, 450.3772573, 249.60217069999999, 177.06173150000001, 446.93556389999998, 250.2954866, 266.63590900000003, 444.83473020000002, 249.33391330000001, 355.91280690000002, 445.81271129999999, 248.44589859999999, 444.89687249999997, 445.23544709999999 }; cmtk::CoordinateVector::SmartPtr vParameters( new cmtk::CoordinateVector( sizeof( nparameters ), parameters, false /*free*/ ) ); cmtk::SplineWarpXform splineWarp( cmtk::FixedVector<3,cmtk::Types::Coordinate>::FromPointer( domain ), cmtk::SplineWarpXform::ControlPointIndexType::FromPointer( dims ), vParameters ); int failed = 0, total = 0; #pragma omp parallel for reduction(+:failed) reduction(+:total) for ( int k = 0; k < (int)domain[2]; k += 4 ) { cmtk::Xform::SpaceVectorType v, vX, u; v[2] = k; for ( int j = 0; j < (int)domain[1]; j += 8 ) { v[1] = j; for ( int i = 0; i < (int)domain[0]; i += 8 ) { v[0] = i; ++total; vX = splineWarp.Apply( v ); const bool success = splineWarp.ApplyInverse( vX, u, 0.1 /*accuracy*/ ); if ( ! success ) { ++failed; } } } } std::cerr << "Inversion failed for " << failed << " out of " << total << " points." << std::endl; return failed != 0; } cmtk-3.0.0/testing/libs/Base/cmtkDataGridTests.txx0000644000177700000170000000327711765704432021137 0ustar torstenman/* // // Copyright 2004-2010 SRI International // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4427 $ // // $LastChangedDate: 2012-06-12 11:23:22 -0700 (Tue, 12 Jun 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include // test "GridMatches" function int testDataGridMatches() { const int dims1_array[3] = { 10, 11, 12 }; cmtk::DataGrid::IndexType dims1 = cmtk::DataGrid::IndexType::FromPointer( dims1_array ); const int dims2_array[3] = { 11, 12, 10 }; cmtk::DataGrid::IndexType dims2 = cmtk::DataGrid::IndexType::FromPointer( dims2_array ); cmtk::DataGrid grid1a( dims1 ); cmtk::DataGrid grid1b( dims1 ); cmtk::DataGrid grid2( dims2 ); if ( !grid1a.GridMatches( grid1b ) ) return 1; if ( !grid1b.GridMatches( grid1a ) ) return 1; if ( grid1a.GridMatches( grid2 ) ) return 1; return 0; } cmtk-3.0.0/testing/libs/Base/cmtkEigenSystemSymmetricMatrix3x3Tests.txx0000644000177700000170000000551511452717235025327 0ustar torstenman/* // // Copyright 1997-2009 Torsten Rohlfing // // Copyright 2004-2010 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include #include template bool testMatrixEigensystem ( const T m[3][3], const T evals[3], const T evecs[3][3] ) { const T tolerance = 1e-6; cmtk::Matrix3x3 matrix( &m[0][0] ); cmtk::EigenSystemSymmetricMatrix3x3 es( matrix ); // compare eigenvalues for ( size_t i = 0; i<3; ++i ) { if ( fabs( evals[i] - es.GetNthEigenvalue(i) ) > tolerance ) { std::cerr << "Eigenvalues do not match." << std::endl << " ACTUAL: " << es.GetNthEigenvalue(0) << " " << es.GetNthEigenvalue(1) << " " << es.GetNthEigenvalue(2) << std::endl << " BASELN: " << evals[0] << " " << evals[1] << " " << evals[2] << std::endl; return false; } } // compare eigenvectors for ( size_t i = 0; i<3; ++i ) { const cmtk::FixedVector<3,T> actual = es.GetNthEigenvector( i ); for ( size_t j = 0; j<3; ++j ) { if ( fabs( evecs[i][j] - actual[j] ) > tolerance ) { std::cerr << "Eigenvectors do not match." << std::endl; for ( size_t ii = 0; ii<3; ++ii ) { const cmtk::FixedVector<3,T> ev = es.GetNthEigenvector( ii ); std::cerr << " ACTUAL: " << ev[0] << " " << ev[1] << " " << ev[2] << std::endl; std::cerr << " BASELN: " << evecs[ii][0] << " " << evecs[ii][1] << " " << evecs[ii][2] << " " << std::endl; } return false; } } } return true; } // test eigenvalues computation int testEigenSystemSymmetricMatrix3x3() { const double dm1[3][3] = { { 1, 0, 0 }, { 0, -2, 0 }, { 0, 0, 3 } }; const double evals1[3] = { 1, -2, 3 }; const double evecs1[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; if ( ! testMatrixEigensystem( dm1, evals1, evecs1 ) ) { return 1; } return 0; } cmtk-3.0.0/testing/libs/IO/0000755000177700000170000000000012263615446014435 5ustar torstenmancmtk-3.0.0/testing/libs/IO/CMakeLists.txt0000644000177700000170000000340211763211566017173 0ustar torstenman## ## Copyright 1997-2010 Torsten Rohlfing ## ## Copyright 2004-2012 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 4412 $ ## ## $LastChangedDate: 2012-06-04 12:58:46 -0700 (Mon, 04 Jun 2012) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ========================================== # Setup binary test drivers SET(CMTK_LIBRARIES "cmtkIO;cmtkBase;cmtkNumerics;cmtkSystem") SET(DRIVERS "") IF(CMTK_USE_SQLITE) LIST(APPEND DRIVERS libIOTestsSQLite) ENDIF(CMTK_USE_SQLITE) FOREACH(D ${DRIVERS}) ADD_EXECUTABLE(${D} ${D}.cxx) TARGET_LINK_LIBRARIES(${D} ${CMTK_LIBRARIES} ${CMTK_SYSTEM_LIBRARIES}) ENDFOREACH(D ${DRIVERS}) # ========================================== # Tests for "cmtk::SQLite" class IF(CMTK_USE_SQLITE) SET(Tests SQLiteNew SQLiteOpen SQLiteCreateAndInsert SQLiteQuery ) FOREACH(T ${Tests}) ADD_TEST(${T} ${EXECUTABLE_OUTPUT_PATH}/libIOTestsSQLite ${T}) ENDFOREACH(T Tests) ENDIF(CMTK_USE_SQLITE) cmtk-3.0.0/testing/libs/IO/cmtkSQLiteTests.txx0000644000177700000170000000365411452717235020253 0ustar torstenman/* // // Copyright 2004-2010 SRI International // // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2398 $ // // $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include // test SQLite database creation int testSQLiteNew() { cmtk::SQLite db( ":memory:" ); return 0; } // test SQLite open of existing file int testSQLiteOpen() { cmtk::SQLite db( CMTK_DATADIR "/empty.sqlite", true /*readOnly*/ ); return 0; } // test SQLite table creation and data insertion int testSQLiteCreateAndInsert() { cmtk::SQLite db( ":memory:" ); db.Exec( "create table testing ( id integer primary key, data text )" ); db.Exec( "insert into testing values ( NULL, 'test1')" ); db.Exec( "insert into testing values ( 2, 'test2')" ); db.Exec( "insert into testing values ( NULL, 'test3')" ); return 0; } // test SQLite database query int testSQLiteQuery() { cmtk::SQLite db( CMTK_DATADIR "/testDB.sqlite", true /*readOnly*/ ); cmtk::SQLite::TableType table; db.Query( "select * from testing", table ); return 0; } cmtk-3.0.0/testing/libs/IO/libIOTestsSQLite.cxx0000644000177700000170000000460711434566214020270 0ustar torstenman/* // // Copyright 2004-2010 SRI International // // Copyright 1997-2009 Torsten Rohlfing // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 2280 $ // // $LastChangedDate: 2010-08-23 14:47:56 -0700 (Mon, 23 Aug 2010) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include "cmtkSQLiteTests.txx" /** Set up table of test names and function pointers */ typedef int (*testFuncPtr)(); typedef struct __testNameAndFunctionPointer { const char* name; const testFuncPtr func; } testNameAndFunctionPointer; const testNameAndFunctionPointer testTable[] = { { "SQLiteNew", &testSQLiteNew }, { "SQLiteOpen", &testSQLiteOpen }, { "SQLiteCreateAndInsert", &testSQLiteCreateAndInsert }, { "SQLiteQuery", &testSQLiteQuery }, { NULL, NULL } }; int main( const int argc, const char* argv[] ) { int testNumber = -1; // is test name given on command line? if ( argc < 2 ) { // no: ask user in dialog mode for ( size_t i = 0; testTable[i].name; ++i ) { std::cout << i << ". " << testTable[i].name << std::endl; } std::cout << "Run test number: "; std::cin >> testNumber; } else { // batch mode: find test by name given on command line for ( size_t i = 0; testTable[i].name; ++i ) { if ( !strcmp( argv[1], testTable[i].name ) ) testNumber = i; } } // run test, or return error if none found if ( testNumber < 0 ) { std::cerr << "Test " << argv[1] << " not found!" << std::endl; return 2; } else return testTable[testNumber].func(); } cmtk-3.0.0/testing/libs/System/0000755000177700000170000000000012263615446015412 5ustar torstenmancmtk-3.0.0/testing/libs/System/CMakeLists.txt0000644000177700000170000000317511730722076020154 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## ## Copyright 2004-2012 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 4039 $ ## ## $LastChangedDate: 2012-03-16 13:36:14 -0700 (Fri, 16 Mar 2012) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ========================================== # Setup binary test drivers SET(CMTK_LIBRARIES "cmtkSystem") SET(DRIVERS libSystemTests) FOREACH(D ${DRIVERS}) ADD_EXECUTABLE(${D} ${D}.cxx) TARGET_LINK_LIBRARIES(${D} ${CMTK_LIBRARIES}) ENDFOREACH(D ${DRIVERS}) # ========================================== # Tests for "StackBacktrace" class SET(Tests StackBacktrace) # ========================================== # Tests for "StrUtility" functions LIST(APPEND Tests StrNStr) FOREACH(T ${Tests}) ADD_TEST(${T} ${EXECUTABLE_OUTPUT_PATH}/libSystemTests ${T}) ENDFOREACH(T Tests) cmtk-3.0.0/testing/libs/System/testStackBacktrace.txx0000644000177700000170000000261211730722076021721 0ustar torstenman/* // // Copyright 1997-2009 Torsten Rohlfing // // Copyright 2004-2011 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4039 $ // // $LastChangedDate: 2012-03-16 13:36:14 -0700 (Fri, 16 Mar 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include namespace cmtk { static StackBacktrace StackBacktraceInstance; } // deliberately crash to test stack trace output int testStackBacktrace() { cmtk::StackBacktrace::SetExitCode( 0 ); char* nullPtr = NULL; (*nullPtr) = 0; // if we didn't catch a SEGFAULT, the test failed return 1; } cmtk-3.0.0/testing/libs/System/testStrNStr.txx0000644000177700000170000000505111730722076020433 0ustar torstenman/* // // Copyright 1997-2009 Torsten Rohlfing // // Copyright 2004-2011 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4039 $ // // $LastChangedDate: 2012-03-16 13:36:14 -0700 (Fri, 16 Mar 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include int testStrNStr() { const char* needle = "needle"; const char* haystack1 = "this is the needle"; // make sure we find needle if ( cmtk::StrNStr( haystack1, strlen( haystack1 ), needle ) == NULL ) { cmtk::StdErr << "StrNStr test #1 failed\n"; return 1; } // make sure we stop looking after nBytes needle if ( cmtk::StrNStr( haystack1, strlen( haystack1 ) - 1, needle ) != NULL ) { cmtk::StdErr << "StrNStr test #2 failed\n"; return 1; } // make sure we find only needle const char* haystack2 = "this is not the Needle"; if ( cmtk::StrNStr( haystack2, strlen( haystack2 ), needle ) != NULL ) { cmtk::StdErr << "StrNStr test #3 failed\n"; return 1; } // make sure we find only needle const char* haystack3 = "this is not the needl either"; if ( cmtk::StrNStr( haystack3, strlen( haystack3 ), needle ) != NULL ) { cmtk::StdErr << "StrNStr test #4 failed\n"; return 1; } // make sure we find only needle const char haystack4[] = "first put \x00 then put needle"; if ( cmtk::StrNStr( haystack4, sizeof( haystack4 ), needle ) == NULL ) { cmtk::StdErr << "StrNStr test #5 failed\n"; return 1; } // make sure we can find prefixes const char* haystack5 = "needle first"; if ( cmtk::StrNStr( haystack5, strlen( haystack5 ), needle ) == NULL ) { cmtk::StdErr << "StrNStr test #6 failed\n"; return 1; } return 0; } cmtk-3.0.0/testing/libs/System/libSystemTests.cxx0000644000177700000170000000432511730722076021134 0ustar torstenman/* // // Copyright 1997-2009 Torsten Rohlfing // // Copyright 2004-2011 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4039 $ // // $LastChangedDate: 2012-03-16 13:36:14 -0700 (Fri, 16 Mar 2012) $ // // $LastChangedBy: torstenrohlfing $ // */ #include #include #include #include "testStackBacktrace.txx" #include "testStrNStr.txx" /** Set up table of test names and function pointers */ typedef int (*testFuncPtr)(); typedef struct { const char* name; const testFuncPtr func; } testNameAndFunctionPointer; const testNameAndFunctionPointer testTable[] = { { "StackBacktrace", &testStackBacktrace }, { "StrNStr", &testStrNStr }, { NULL, NULL } }; int main( const int argc, const char* argv[] ) { int testNumber = -1; // is test name given on command line? if ( argc < 2 ) { // no: ask user in dialog mode for ( size_t i = 0; testTable[i].name; ++i ) { std::cout << i << ". " << testTable[i].name << std::endl; } std::cout << "Run test number: "; std::cin >> testNumber; } else { // batch mode: find test by name given on command line for ( size_t i = 0; testTable[i].name; ++i ) { if ( !strcmp( argv[1], testTable[i].name ) ) testNumber = i; } } // run test, or return error if none found if ( testNumber < 0 ) return 2; else return testTable[testNumber].func(); } cmtk-3.0.0/testing/gui/0000755000177700000170000000000012263615446013761 5ustar torstenmancmtk-3.0.0/testing/gui/testDriverFunctions.sh0000644000177700000170000000341411213300741020322 0ustar torstenman#!/bin/sh ## ## Copyright 1997-2009 Torsten Rohlfing ## Copyright 2004-2009 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 41 $ ## ## $LastChangedDate: 2009-06-08 14:25:53 -0700 (Mon, 08 Jun 2009) $ ## ## $LastChangedBy: torstenrohlfing $ ## BUILDNAME=$1 BINDIR=$2 DATADIR=$3 RUNTEST=$4 HOSTNAME=`uname -n` tmpdir=${BINDIR}/../testing/temporary/${HOSTNAME}/${RUNTEST} mkdir -p ${tmpdir} BASELINE=${DATADIR}/testing/baseline/${RUNTEST} if [ -d ${DATADIR}/testing/baseline/${BUILDNAME}/${RUNTEST} ]; then BASELINE=${DATADIR}/testing/${BUILDNAME}/${RUNTEST} fi cd ${DATADIR}/testing/inputs run() { local cmd=$* if ! $cmd; then exit 1 fi } get_unzipped() { if [ -e ${1}.gz ]; then local tmp=`mktemp` gzip -cd ${1}.gz > ${tmp} echo ${tmp} else echo ${1} fi } check_result() { local result=`get_unzipped $1` local baseline=`get_unzipped $2` echo "diff $1 $2" if ! diff $result $baseline; then exit 1 fi } cmtk-3.0.0/testing/gui/CMakeLists.txt0000644000177700000170000000415111313020114016473 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## Copyright 2004-2009 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 1076 $ ## ## $LastChangedDate: 2009-12-18 16:37:32 -0800 (Fri, 18 Dec 2009) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ========================================== # Tests for "triplanar" gui application # (batch mode) SET(testDriver ${CMAKE_CURRENT_BINARY_DIR}/triplanarTestDriver.sh) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/triplanarTestDriver.sh.in ${CMAKE_CURRENT_BINARY_DIR}/triplanarTestDriver.sh @ONLY) SET(testList triplanarDefault triplanarZoom300 triplanarZoom25 triplanarSetPixelWindowLevel triplanarColormaps triplanarPhantomAx triplanarPhantomSa triplanarPhantomCo) IF(IGS_BUILD_NRRD OR IGS_USE_TEEM) SET(testList ${testList} triplanarPhantomAxNrrd triplanarPhantomSaNrrd triplanarPhantomCoNrrd) ENDIF(IGS_BUILD_NRRD OR IGS_USE_TEEM) # ========================================== # Set up all tests FOREACH(testName ${testList}) IF(CMTK_TESTING_MEMORYCHECK) ADD_TEST(${testName} /bin/sh ${testDriver} ${testName} ${MEMORYCHECK_COMMAND}) ELSE(CMTK_TESTING_MEMORYCHECK) ADD_TEST(${testName} /bin/sh ${testDriver} ${testName}) ENDIF(CMTK_TESTING_MEMORYCHECK) ENDFOREACH(testName ${testList}) cmtk-3.0.0/testing/gui/triplanarTestDriver.sh.in0000644000177700000170000001101311314230570020711 0ustar torstenman#!/bin/sh ## ## Copyright 1997-2009 Torsten Rohlfing ## Copyright 2004-2009 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 1092 $ ## ## $LastChangedDate: 2009-12-22 12:52:08 -0800 (Tue, 22 Dec 2009) $ ## ## $LastChangedBy: torstenrohlfing $ ## RUNTEST=$1 VALGRIND=$2 BUILDNAME=@BUILDNAME@ DATADIR=@CMTK_DATA_ROOT@/testing/inputs BINDIR=@EXECUTABLE_OUTPUT_PATH@/@CMAKE_BUILD_TYPE@ if [ ! -d ${BINDIR} ]; then BINDIR=@EXECUTABLE_OUTPUT_PATH@ fi BASELINE_DEFAULT=@CMTK_DATA_ROOT@/testing/baseline/${RUNTEST} BASELINE=${BINDIR}/../testing/baseline/${RUNTEST} if [ ! -d ${BASELINE} ]; then BASELINE=${BASELINE_DEFAULT} fi HOSTNAME=`uname -n` tmpdir=${BINDIR}/../testing/temporary/${HOSTNAME}/${RUNTEST} mkdir -p ${tmpdir} cd ${DATADIR} run() { cmd=$* echo "cd $PWD; $cmd" if $cmd; then return else exit 1 fi } run_eval() { cmd=$* echo "cd $PWD; $cmd" if eval "$cmd"; then return else exit 1 fi } get_unzipped() { if test -f ${1}.gz; then tmp=`mktemp` gzip -cd ${1}.gz > ${tmp} echo ${tmp} else echo ${1} fi } check_result() { baseline=`get_unzipped ${BASELINE}/$1` result=`get_unzipped ${tmpdir}/$1` if test ! -f ${result}; then echo "Results file ${result} does not exist" exit 1 fi if test ! -f ${baseline}; then echo "Baseline file ${baseline} does not exist" exit 1 fi echo "diff ${BASELINE}/$1 ${tmpdir}/$1" if diff $result $baseline; then return else exit 1 fi } check_results() { for r in $*; do check_result $r done } case ${RUNTEST} in triplanarDefault) run ${BINDIR}/triplanar --exec load pat001_pet.hdr export-panel ${tmpdir}/panel.ppm export-axial ${tmpdir}/axial.ppm export-coronal ${tmpdir}/coronal.ppm export-sagittal ${tmpdir}/sagittal.ppm for img in panel axial sagittal coronal; do if check_result ${img}.ppm; then echo $img ok. else exit $? fi done ;; triplanarZoom300) run ${BINDIR}/triplanar --exec load pat001_pet.hdr zoom 300 export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarZoom25) run ${BINDIR}/triplanar --exec load pat001_pet.hdr zoom 25 export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarSetPixelWindowLevel) run ${BINDIR}/triplanar --exec load pat002_ct.hdr crosshair off goto-pixel 32,20,0 window-level 500:0 export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarColormaps) run ${BINDIR}/triplanar --exec load parc1.hdr crosshair off window-level 116:58 colormap Labels export-axial ${tmpdir}/labels.ppm colormap Red export-axial ${tmpdir}/red.ppm colormap Rainbow export-axial ${tmpdir}/rainbow.ppm for img in labels red rainbow; do if check_result ${img}.ppm; then echo $img ok. else exit $? fi done ;; triplanarPhantomAx) run ${BINDIR}/triplanar --exec load phantom_ax.hdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomSa) run ${BINDIR}/triplanar --exec load phantom_sa.hdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomCo) run ${BINDIR}/triplanar --exec load phantom_co.hdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomAxNrrd) run ${BINDIR}/triplanar --exec load phantom_ax.nhdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomSaNrrd) run ${BINDIR}/triplanar --exec load phantom_sa.nhdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomCoNrrd) run ${BINDIR}/triplanar --exec load phantom_co.nhdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; esac if [ "${tmpdir}" != "" ]; then rm -rf ${tmpdir} fi cmtk-3.0.0/testing/gui/triplanarTestDriver.sh0000644000177700000170000001056611305033275020323 0ustar torstenman#!/bin/sh ## ## Copyright 1997-2009 Torsten Rohlfing ## Copyright 2004-2009 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 918 $ ## ## $LastChangedDate: 2009-11-30 13:18:53 -0800 (Mon, 30 Nov 2009) $ ## ## $LastChangedBy: torstenrohlfing $ ## BUILDNAME=$1 BINDIR=$2 DATADIR=$3 RUNTEST=$4 HOSTNAME=`uname -n` tmpdir=${BINDIR}/../testing/temporary/${HOSTNAME}/${RUNTEST} mkdir -p ${tmpdir} BASELINE=${DATADIR}/testing/baseline/${RUNTEST} if [ -d ${DATADIR}/testing/baseline/${BUILDNAME}/${RUNTEST} ]; then BASELINE=${DATADIR}/testing/${BUILDNAME}/${RUNTEST} fi cd ${DATADIR}/testing/inputs run() { cmd=$* echo "cd $PWD; $cmd" if $cmd; then return else exit 1 fi } run_eval() { cmd=$* echo "cd $PWD; $cmd" if eval "$cmd"; then return else exit 1 fi } get_unzipped() { if test -f ${1}.gz; then tmp=`mktemp` gzip -cd ${1}.gz > ${tmp} echo ${tmp} else echo ${1} fi } check_result() { baseline=`get_unzipped ${BASELINE}/$1` result=`get_unzipped ${tmpdir}/$1` if test ! -f ${result}; then echo "Results file ${result} does not exist" exit 1 fi if test ! -f ${baseline}; then echo "Baseline file ${baseline} does not exist" exit 1 fi echo "diff ${BASELINE}/$1 ${tmpdir}/$1" if diff $result $baseline; then return else exit 1 fi } check_results() { for r in $*; do check_result $r done } case ${RUNTEST} in triplanarDefault) run ${BINDIR}/triplanar --exec load pat001_pet.hdr export-panel ${tmpdir}/panel.ppm export-axial ${tmpdir}/axial.ppm export-coronal ${tmpdir}/coronal.ppm export-sagittal ${tmpdir}/sagittal.ppm for img in panel axial sagittal coronal; do if check_result ${img}.ppm; then echo $img ok. else exit $? fi done ;; triplanarZoom300) run ${BINDIR}/triplanar --exec load pat001_pet.hdr zoom 300 export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarZoom25) run ${BINDIR}/triplanar --exec load pat001_pet.hdr zoom 25 export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarSetPixelWindowLevel) run ${BINDIR}/triplanar --exec load pat002_ct.hdr crosshair off goto-pixel 32,20,0 window-level 500:0 export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarColormaps) run ${BINDIR}/triplanar --exec load parc1.hdr crosshair off window-level 116:58 colormap Labels export-axial ${tmpdir}/labels.ppm colormap Red export-axial ${tmpdir}/red.ppm colormap Rainbow export-axial ${tmpdir}/rainbow.ppm for img in labels red rainbow; do if check_result ${img}.ppm; then echo $img ok. else exit $? fi done ;; triplanarPhantomAx) run ${BINDIR}/triplanar --exec load phantom_ax.hdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomSa) run ${BINDIR}/triplanar --exec load phantom_sa.hdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomCo) run ${BINDIR}/triplanar --exec load phantom_co.hdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomAxNrrd) run ${BINDIR}/triplanar --exec load phantom_ax.nhdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomSaNrrd) run ${BINDIR}/triplanar --exec load phantom_sa.nhdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; triplanarPhantomCoNrrd) run ${BINDIR}/triplanar --exec load phantom_co.nhdr crosshair off export-panel ${tmpdir}/panel.ppm check_result panel.ppm ;; esac if [ "${tmpdir}" != "" ]; then rm -rf ${tmpdir} fi cmtk-3.0.0/testing/apps/0000755000177700000170000000000012263615446014140 5ustar torstenmancmtk-3.0.0/testing/apps/appsTestDriver.sh.in0000755000177700000170000036155512262344156020076 0ustar torstenman#!/bin/bash ## ## Copyright 2004-2014 SRI International ## ## Copyright 1997-2011 Torsten Rohlfing ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 5099 $ ## ## $LastChangedDate: 2014-01-05 13:02:38 -0800 (Sun, 05 Jan 2014) $ ## ## $LastChangedBy: torsten_at_home $ ## RUNTEST=$1 CONFIG=$2 VALGRIND=$3 BUILDNAME=@BUILDNAME@ DATADIR=@CMTK_DATA_ROOT@/testing/inputs BINDIR=@EXECUTABLE_OUTPUT_PATH@/${CONFIG} if [ ! -d ${BINDIR}/. ]; then BINDIR=@EXECUTABLE_OUTPUT_PATH@ fi BASELINE_DEFAULT=@CMTK_DATA_ROOT@/testing/baseline/${RUNTEST} BASELINE=${BINDIR}/../testing/baseline/${RUNTEST} if [ ! -d ${BASELINE} ]; then BASELINE=${BASELINE_DEFAULT} fi HOSTNAME=`uname -n` NUMDIFF=@NUMDIFF_EXECUTABLE@ tmpdir=${BINDIR}/../testing/temporary/${HOSTNAME}/${RUNTEST} if [ -e ${tmpdir} ]; then rm -rf ${tmpdir} fi mkdir -p ${tmpdir} sqlite=${BINDIR}/sqlite if [ ! -f ${sqlite} ]; then sqlite=sqlite3 fi sed=/opt/local/bin/gsed if [ ! -f ${sed} ]; then sed=sed fi cd ${DATADIR} run() { cmd=$* echo "pushd $PWD; ${BINDIR}/$cmd; popd" 1>&2 if ${VALGRIND} ${BINDIR}/$cmd; then return else exit 1 fi } run_expect_fail() { cmd=$* echo "pushd $PWD; ${BINDIR}/$cmd; popd" if ${BINDIR}/$cmd; then exit 1 else return fi } run_eval() { cmd=$* echo "pushd $PWD; $cmd; popd" if eval "${VALGRIND} $cmd"; then return else exit 1 fi } get_unzipped() { if test -f ${1}.gz; then if [ "`uname`" = "Darwin" ]; then local tmp=`mktemp /tmp/temp.XXXX` else local tmp=`mktemp` fi gzip -cd ${1}.gz > ${tmp} echo ${tmp} else echo ${1} fi } remove_if_tempfile() { for f in $*; do local dir=`dirname $f` if [ "${dir}" == "/tmp" ]; then rm $f fi done } check_result() { baseline=`get_unzipped ${BASELINE}/$1` result=`get_unzipped ${tmpdir}/$1` if test ! -f ${result}; then echo "Results file ${result} does not exist" remove_if_tempfile ${baseline} ${result} exit 1 fi if test ! -f ${baseline}; then echo "Baseline file ${baseline} does not exist" remove_if_tempfile ${baseline} ${result} exit 1 fi local diff="cmp" if file ${result} | fgrep text; then ## diff="diff --strip-trailing-cr" diff="${NUMDIFF} --relative-tolerance=1e-5 --absolute-tolerance=5e-7" fi echo "${diff} ${tmpdir}/$1 ${BASELINE}/$1" if ${diff} $result $baseline; then remove_if_tempfile ${baseline} ${result} return else remove_if_tempfile ${baseline} ${result} exit 1 fi } check_results() { for r in $*; do check_result $r done } check_image() { baseline=${BASELINE}/$1 result=${tmpdir}/$1 abs_threshold=1e-5 ## if this is made much smaller, need to adjust "scale=" on next line: # see if maximum relative difference between images exceeds 1e-6 difference=`${BINDIR}/similarity $baseline $result | fgrep SIMval | cut -f3` compare=`echo "SCALE; $difference > $abs_threshold" | sed 's/e/*10^/g;s/SCALE/scale=10/' | bc` echo difference=$difference compare=$compare if [ "${compare}" = "0" ]; then return else echo "Absolute image difference $difference exceeds threshold $abs_threshold" fi rel_threshold=1e-5 ## if this is made much smaller, need to adjust "scale=" on next line: difference=`${BINDIR}/similarity $baseline $result | fgrep SIMval | cut -f4` compare=`echo "SCALE; $difference > $rel_threshold" | sed 's/e/*10^/g;s/SCALE/scale=10/' | bc` echo difference=$difference compare=$compare if [ "${compare}" = "0" ]; then return else echo "Relative image difference $difference exceeds threshold $rel_threshold" exit 1 fi } check_images() { for r in $*; do check_image $r done } case ${RUNTEST} in average_imagesMean) run average_images -o ${tmpdir}/average.hdr spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results average.img ;; average_imagesMeanNormPadd) run average_images -o ${tmpdir}/average.hdr --set-padding-value 0 --normalize-mean-stdev spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results average.img ;; average_imagesMeanAbsLog) run average_images --set-padding-value 0 -o ${tmpdir}/average.hdr --abs --log spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results average.img ;; average_imagesVariance) run average_images -o ${tmpdir}/variance.hdr --var spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results variance.img ;; average_imagesStDev) run average_images -o ${tmpdir}/stdev.hdr --stdev spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results stdev.img ;; average_imagesEntropy) run average_images -o ${tmpdir}/entropy.hdr --entropy spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results entropy.img ;; average_imagesZScore) run average_images -o ${tmpdir}/zscore.hdr --zscore spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results zscore.img ;; avg_admDefault2) run avg_adm --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list check_results avg.img avg.warp ;; avg_admDefault3) run avg_adm --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list check_results avg.img avg.warp ;; avg_admJacobianFloat) run avg_adm --jacobian --float --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list check_results avg.img avg.warp ;; avg_admLabels) run avg_adm --nn --label --replace-from spgr_brain_ --replace-to parc --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list check_results avg.img avg.warp ;; avg_admPaddOutZeroNN) run avg_adm --nn --pad-out 0 --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp spgr_brain_12_warp.list spgr_brain_13_warp.list check_results avg.img avg.warp ;; avg_admNoReferenceModelCubic) run avg_adm --byte --cubic --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp --no-ref-model spgr_brain_12_warp.list spgr_brain_13_warp.list check_results avg.img avg.warp ;; avg_admNoScaleModelAutoScale) run avg_adm --byte --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp --no-scale-model --auto-scale spgr_brain_12_warp.list spgr_brain_13_warp.list check_results avg.img avg.warp ;; avg_admWithAffineNoRefData) run avg_adm --byte --output ${tmpdir}/avg.hdr --output-warp ${tmpdir}/avg.warp --no-ref-data --with-affine spgr_brain_12_warp.list spgr_brain_13_warp.list check_results avg.img avg.warp ;; concat_affineABA) run concat_affine -o ${tmpdir}/concat.xform affineA.xform affineB.xform affineA.xform check_results concat.xform ;; concat_affineABAInvert) run concat_affine --invert-output -o ${tmpdir}/concat.xform affineA.xform affineB.xform affineA.xform check_results concat.xform ;; concat_affineAB1A) run concat_affine -o ${tmpdir}/concat.xform affineA.xform --inverse affineB.xform affineA.xform check_results concat.xform ;; concat_affineAA1) run concat_affine -o ${tmpdir}/concat.xform affineA.xform --inverse affineA.xform check_results concat.xform ;; concat_affineA1A) run concat_affine -o ${tmpdir}/concat.xform -- --inverse affineA.xform affineA.xform check_results concat.xform ;; convert_warpFractional) run convert_warp --fractional 0.5 vol001_mr_t0t1_warp.xform ${tmpdir}/fractional.xform check_results fractional.xform ;; convert_warpDeformation) run convert_warp --deformation-only vol001_mr_t0t1_warp.xform ${tmpdir}/deformation.xform check_results deformation.xform ;; convertxType) run convertx --byte --char --float --double --int --uint --short --ushort spgr_brain_1.hdr ${tmpdir}/convert.nii check_results convert.nii ;; convertxBinarize) run convertx --binarize-thresh 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr check_results thresh.img ;; convertxBinarizeOtsu) run convertx --otsu-thresh --byte phantom_ax.nii ${tmpdir}/binary.nii check_results binary.nii ;; convertxBinarizeOtsuNBins) run convertx --otsu-thresh-nbins 128 --byte phantom_ax.nii ${tmpdir}/binary.nii check_results binary.nii ;; convertxPruneHighLow) run convertx --prune-histogram 16 pat001_pet.hdr ${tmpdir}/prune.nii check_results prune.nii ;; convertxPruneHigh) run convertx --prune-histogram-high 16 pat001_pet.hdr ${tmpdir}/prune.nii check_results prune.nii ;; convertxPruneLow) run convertx --prune-histogram-low 16 pat001_pet.hdr ${tmpdir}/prune.nii check_results prune.nii ;; convertxBoundaryMap) run convertx --boundary-map parc1.hdr ${tmpdir}/boundary_map.hdr check_results boundary_map.img ;; convertxConnectedComponents) run convertx --connected-components binary_mask.nii ${tmpdir}/connected.hdr check_results connected.img ;; convertxDistanceUnsigned) run convertx --distance-map parc1_bin.hdr ${tmpdir}/dmap.hdr check_results dmap.img ;; convertxLaplace) run convertx --float --laplace-filter spgr_brain_1.hdr ${tmpdir}/laplace.hdr check_results laplace.img ;; convertxMapValues) run convertx --map-values 82,86:254 --map-values 16:255 --set-padding 128 --map-values 0 parc3.hdr ${tmpdir}/mapped.hdr check_results mapped.img ;; convertxMapValues2) run convertx --set-padding 128 --map-values 82,86:254+16:255+0 parc3.hdr ${tmpdir}/mapped.hdr check_results mapped.img ;; convertxMapValues3) run convertx --set-padding 128 --map-values 16:255+82,86:254+0 parc3.hdr ${tmpdir}/mapped.hdr check_results mapped.img ;; convertxMapValuesOnly) run convertx --set-padding 255 --map-values-only 82,86:1 parc3.hdr ${tmpdir}/mapped.hdr check_results mapped.img ;; convertxMapValuesOnly2) run convertx --set-padding 255 --map-values-only 82:1+86:1 parc3.hdr ${tmpdir}/mapped.hdr check_results mapped.img ;; convertxRevert) run convertx --revert parc1_bin.hdr ${tmpdir}/revert.hdr check_results revert.img run convertx --revert parc1.hdr ${tmpdir}/revert.hdr check_results revert.img ;; convertxDistanceSigned) run convertx --signed-distance-map parc1_bin.hdr ${tmpdir}/dmap.hdr check_results dmap.img ;; convertxDistanceSigned2) run convertx --signed-distance-map parc1.hdr ${tmpdir}/dmap.hdr check_results dmap.img ;; convertxBoundaryMapMultiValue) run convertx --multi-boundary-map parc1.hdr ${tmpdir}/boundary_map_multi.hdr check_results boundary_map_multi.img ;; convertxCropThresholdWriteRegion) run_eval "${BINDIR}/convertx --crop-by-threshold-write-region 1 spgr_brain_1.hdr ${tmpdir}/cropped.nii > ${tmpdir}/crop.txt" check_results cropped.nii crop.txt ;; convertxCropRegion1) run_eval "${BINDIR}/convertx --crop-by-index 2,2,2,12,12,12 spgr_brain_1.hdr ${tmpdir}/cropped.nii" check_results cropped.nii ;; convertxCropRegion2) run_eval "${BINDIR}/convertx --crop-by-index 10,10,10,-10,-10,-10 spgr_brain_1.hdr ${tmpdir}/cropped.nii" check_results cropped.nii ;; convertxResample) run convertx --resample 1.0 phantom_ax.nii ${tmpdir}/resample.nii check_results resample.nii ;; convertxDownsample) run convertx --downsample-average 8,4,1 phantom_ax.hdr ${tmpdir}/downsample.hdr check_results downsample.hdr downsample.img ;; convertxDownsampleNiftiSform) run convertx --downsample-average 8,4,1 phantom_ax_sform.nii ${tmpdir}/downsample_ax.nii run convertx --downsample-average 1,8,4 phantom_sa_sform.nii ${tmpdir}/downsample_sa.nii run convertx --downsample-average 4,1,8 phantom_co_sform.nii ${tmpdir}/downsample_co.nii check_results downsample_ax.nii downsample_sa.nii downsample_co.nii ;; convertxDownsampleNiftiQform) run convertx --downsample-average 8,4,1 phantom_ax_qform.nii ${tmpdir}/downsample_ax.nii run convertx --downsample-average 1,8,4 phantom_sa_qform.nii ${tmpdir}/downsample_sa.nii run convertx --downsample-average 4,1,8 phantom_co_qform.nii ${tmpdir}/downsample_co.nii check_results downsample_ax.nii downsample_sa.nii downsample_co.nii ;; convertxDownsampleNiftiQformSform) run convertx --downsample-average 8,4,1 phantom_ax_qform_sform.nii ${tmpdir}/downsample_ax.nii run convertx --downsample-average 1,8,4 phantom_sa_qform_sform.nii ${tmpdir}/downsample_sa.nii run convertx --downsample-average 4,1,8 phantom_co_qform_sform.nii ${tmpdir}/downsample_co.nii check_results downsample_ax.nii downsample_sa.nii downsample_co.nii ;; convertxDownsampleNrrd) run convertx --downsample-average 8,4,1 phantom_ax.nhdr ${tmpdir}/downsample.nhdr check_results downsample.nhdr downsample.raw ;; convertxDownsampleSelect) run convertx --downsample-select 8,4,1 phantom_ax.hdr ${tmpdir}/downsample.hdr check_results downsample.hdr downsample.img ;; convertxDownsampleSelectNrrd) run convertx --downsample-select 8,4,1 phantom_ax.nhdr ${tmpdir}/downsample.nhdr check_results downsample.nhdr downsample.raw ;; convertxFlipX) run convertx --flip-x parc1_bin.hdr ${tmpdir}/flip.hdr check_results flip.img ;; convertxFlipYZ) run convertx --flip-y --flip-z parc1_bin.hdr ${tmpdir}/flip.hdr check_results flip.img ;; convertxErodeDilateErode) run convertx --erode 1 --dilate 2 --erode 1 parc1_bin.hdr ${tmpdir}/parc1_ede.img check_results parc1_ede.img ;; convertxDilateErodeDilate) run convertx --dilate 1 --erode 2 --dilate 1 parc1_bin.hdr ${tmpdir}/parc1_ded.img check_results parc1_ded.img ;; convertxErodeByDistance) run convertx --erode-distance 10 parc1_bin.hdr ${tmpdir}/parc1_erode.nii check_results parc1_erode.nii ;; convertxDilateByDistance) run convertx --dilate-distance 10 parc1_bin.hdr ${tmpdir}/parc1_dilate.nii check_results parc1_dilate.nii ;; convertxGaussianFilterSigma) run convertx --gaussian-filter-sigma 5.0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxGaussianFilterFWHM) run convertx --gaussian-filter-fwhm 10.0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxHistogramEqualization) run convertx --histogram-equalization spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxHistogramEqualizationNBins) run convertx --histogram-equalization-nbins 32 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxMask) run convertx --mask spgr_3t_mask.hdr spgr_3t.hdr ${tmpdir}/masked.hdr check_results masked.img ;; convertxMaskInverse) run convertx --mask-inverse spgr_3t_mask.hdr spgr_3t.hdr ${tmpdir}/masked.hdr check_results masked.img ;; convertxMedianFilter1) run convertx --median-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxMedianFilter2) run convertx --median-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxMedianFilterXYZ) run convertx --median-filter 2,2,1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxMeanFilter) run convertx --float --mean-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastMean0Filter) run convertx --float --fast-mean-filter 0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastMean1Filter) run convertx --float --fast-mean-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastMean2Filter) run convertx --float --fast-mean-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastMean2PadFilter) run convertx --set-padding 0 --float --fast-mean-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxVarianceFilter) run convertx --float --variance-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastVariance0Filter) run convertx --float --fast-variance-filter 0 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastVariance1Filter) run convertx --float --fast-variance-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastVariance2Filter) run convertx --float --fast-variance-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxFastVariance2PadFilter) run convertx --set-padding 0 --float --fast-variance-filter 2 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxThirdMomentFilter) run convertx --float --third-moment-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxStandardDeviationFilter) run convertx --float --standard-deviation-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxSmoothnessFilter) run convertx --float --smoothness-filter 1 spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.img ;; convertxNiftiToAnalyze) run convertx spgr_brain_1.nii ${tmpdir}/spgr_brain_1.hdr check_results spgr_brain_1.hdr spgr_brain_1.img ;; convertxNiftiToMetaImage) run convertx spgr_brain_1.nii ${tmpdir}/spgr_brain_1.mha check_results spgr_brain_1.mha ;; convertxAnalyzeToNifti) run convertx spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.nii check_results spgr_brain_1.nii ;; convertxAnalyzeToNiftiRAS) export CMTK_LEGACY_WRITE_IMAGES_RAS=1 run convertx spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.nii unset CMTK_LEGACY_WRITE_IMAGES_RAS check_results spgr_brain_1.nii ;; convertxNiftiDetachedToNifti) run convertx spgr_brain_nifti.hdr ${tmpdir}/spgr_brain_1.nii check_results spgr_brain_1.nii ;; convertxAnalyzeToNiftiDetached) run convertx spgr_brain_1.hdr ${tmpdir}/spgr_brain_1.img check_results spgr_brain_1.hdr spgr_brain_1.img ;; convertxUncompressedNIFTI1) export CMTK_WRITE_UNCOMPRESSED=1 run convertx parc1_bin.hdr ${tmpdir}/out.nii unset CMTK_WRITE_UNCOMPRESSED if [ ! -e ${tmpdir}/out.nii ]; then exit 1; fi ;; convertxUncompressedNIFTI2) export CMTK_WRITE_UNCOMPRESSED=1 run convertx parc1_bin.hdr ${tmpdir}/out.nii.gz unset CMTK_WRITE_UNCOMPRESSED if [ ! -e ${tmpdir}/out.nii.gz ]; then exit 1; fi ;; convertxUncompressedNIFTI3) unset CMTK_WRITE_UNCOMPRESSED run convertx parc1_bin.hdr ${tmpdir}/out.nii if [ ! -e ${tmpdir}/out.nii.gz ]; then exit 1; fi ;; convertxUncompressedNIFTI4) unset CMTK_WRITE_UNCOMPRESSED run convertx parc1_bin.hdr ${tmpdir}/out.nii.gz if [ ! -e ${tmpdir}/out.nii.gz ]; then exit 1; fi ;; convertxThresholdBelow) run convertx --set-padding 0 --thresh-below 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr check_results thresh.img ;; convertxThresholdAbove) run convertx --set-padding 0 --thresh-above 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr check_results thresh.img ;; convertxThresholdBelowToPadding) run convertx --set-padding 0 --thresh-below-to-padding 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr check_results thresh.img ;; convertxThresholdAboveToPadding) run convertx --set-padding 0 --thresh-above-to-padding 100 spgr_brain_1.hdr ${tmpdir}/thresh.hdr check_results thresh.img ;; convertxScaleToRange) run convertx --scale-to-range 128:192 spgr_brain_1.hdr ${tmpdir}/scaled.hdr check_results scaled.img ;; convertxReplacePadding) run convertx --byte --set-padding 0 --replace-padding 255 spgr_brain_1.hdr ${tmpdir}/replaced.hdr check_results replaced.img ;; convertxReplaceInfNaN) run convertx --replace-inf-nan 255 infinite.nii ${tmpdir}/replaced.hdr check_results replaced.img ;; dbtool_AddImages) run dbtool add_images ${tmpdir}/db.sqlite image1 image2 ${sqlite} ${tmpdir}/db.sqlite "SELECT * FROM images ORDER BY path ASC" > ${tmpdir}/images check_results images ;; dbtool_AddImages2) run dbtool add_images ${tmpdir}/db.sqlite image1 image2 image3 image3 ${sqlite} ${tmpdir}/db.sqlite "SELECT * FROM images ORDER BY path ASC" > ${tmpdir}/images check_results images ;; dbtool_ListSpace) run_eval "${BINDIR}/dbtool list_space images.sqlite image1c > ${tmpdir}/list.txt" check_results list.txt ;; dbtool_GetXform1) run_eval "${BINDIR}/dbtool get_xform imagesSingleXform.sqlite image1.nii image2.nii > ${tmpdir}/xform.txt" check_results xform.txt ;; dbtool_GetXform2) run_eval "${BINDIR}/dbtool get_xform imagesSingleXform.sqlite image2.nii image1.nii > ${tmpdir}/xform.txt" check_results xform.txt ;; dbtool_GetXform3) run_eval "${BINDIR}/dbtool get_xform imagesMultiXforms.sqlite image1.nii image2.nii > ${tmpdir}/xform.txt" check_results xform.txt ;; dbtool_GetXform4) run_eval "${BINDIR}/dbtool get_xform imagesMultiXforms.sqlite image2.nii image1.nii > ${tmpdir}/xform.txt" check_results xform.txt ;; dbtool_GetXform5) run_eval "${BINDIR}/dbtool get_xform --all imagesMultiXforms.sqlite image1.nii image2.nii > ${tmpdir}/xform.txt" check_results xform.txt ;; dbtool_GetXform6) run_eval "${BINDIR}/dbtool get_xform --all imagesMultiXforms.sqlite image2.nii image1.nii > ${tmpdir}/xform.txt" check_results xform.txt ;; dcm2image) run dcm2image -O ${tmpdir}/00%n.hdr dcm/ check_results 001.hdr 001.img 002.hdr 002.img 003.hdr 003.img ;; dcm2imageSubs) run dcm2image -O ${tmpdir}/%D_%R_%E%N.nii dcm/ check_results 3-plane-localizer_5.104_1.52-1.nii 3-plane-localizer_5.104_1.52-2.nii 3-plane-localizer_5.104_1.52-3.nii ;; dcm2imageZ) run dcm2image -O ${tmpdir}/00%n.nii dcmz/ check_results 001.nii 002.nii 003.nii ;; dcm2imageNrrd) run dcm2image -O ${tmpdir}/00%n.nhdr dcm/ check_results 001.nhdr 001.raw 002.nhdr 002.raw 003.nhdr 003.raw ;; dcm2imageEmbedPatientNameAnalyze) run dcm2image --embed PatientName -O ${tmpdir}/00%n.hdr dcm/ check_results 001.hdr 002.hdr 003.hdr ;; dcm2imageEmbedPatientNameNifti) run dcm2image --embed PatientName -O ${tmpdir}/00%n.nii dcm/ check_results 001.nii 002.nii 003.nii ;; dcm2imageEmbedSeriesDescriptionNifti) run dcm2image --embed SeriesDescription -O ${tmpdir}/00%n.nii dcm/ check_results 001.nii 002.nii 003.nii ;; dcm2imageEmbedStudyIDDateNifti) run dcm2image --embed StudyID_StudyDate -O ${tmpdir}/00%n.nii dcm/ check_results 001.nii ;; dcm2imageEmbedPatientNameNrrd) run dcm2image --embed PatientName -O ${tmpdir}/00%n.nhdr dcm/ check_results 001.nhdr 002.nhdr 003.nhdr ;; dcm2imageMosaic) run dcm2image -x --include-identifiers -O ${tmpdir}/00.nii mr-mosaic/ check_results 00.nii 00.nii.xml ;; dcm2imageMosaicPACS) run dcm2image -x --include-identifiers -O ${tmpdir}/00.nii mr-mosaic-pacs/ check_results 00.nii 00.nii.xml ;; dcm2imageDiffusionGEXML) run dcm2image -x --tolerance 1e-4 --include-identifiers -O ${tmpdir}/%n.nii mr-dwi-ge/ check_results 1.nii 1.nii.xml 2.nii 2.nii.xml ;; dcm2imageDiffusionSiemensXML) run dcm2image -x --include-identifiers -O ${tmpdir}/%n.nii mr-dwi-siemens/ check_results 1.nii 1.nii.xml 2.nii 2.nii.xml 3.nii 3.nii.xml 4.nii 4.nii.xml ;; dcm2imageMosaicAnon) run dcm2image -x -O ${tmpdir}/00.nii mr-mosaic/ check_results 00.nii 00.nii.xml ;; dcm2imageMosaicPACSAnon) run dcm2image -x -O ${tmpdir}/00.nii mr-mosaic-pacs/ check_results 00.nii 00.nii.xml ;; dcm2imageDiffusionGEXMLAnon) run dcm2image -x --tolerance 1e-4 -O ${tmpdir}/%n.nii mr-dwi-ge/ check_results 1.nii 1.nii.xml 2.nii 2.nii.xml ;; dcm2imageDiffusionSiemensXMLAnon) run dcm2image -x -O ${tmpdir}/%n.nii mr-dwi-siemens/ check_results 1.nii 1.nii.xml 2.nii 2.nii.xml 3.nii 3.nii.xml 4.nii 4.nii.xml ;; dcm2imageExclude) run dcm2image --exclude ImageOrientationPatient=1\\-0\\0\\-0\\1\\0 -O ${tmpdir}/image%n.nii dcm/ check_results image1.nii image2.nii ;; dcm2imageInclude) run dcm2image --filter ImageOrientationPatient=1\\-0\\0\\-0\\1\\0 -O ${tmpdir}/image%n.nii dcm/ check_results image.nii ;; dcm2imageSubsDirName) run dcm2image -x --tolerance 1e-4 --include-identifiers -O ${tmpdir}/%1/%0.nii mr-dwi-ge/ mr-dwi-siemens/ check_results mr-dwi-ge/I0150.dcm.nii mr-dwi-ge/I0150.dcm.nii.xml mr-dwi-ge/I0280.dcm.nii mr-dwi-ge/I0280.dcm.nii.xml check_results mr-dwi-siemens/I0001.dcm.nii mr-dwi-siemens/I0001.dcm.nii.xml mr-dwi-siemens/I0002.dcm.nii mr-dwi-siemens/I0002.dcm.nii.xml check_results mr-dwi-siemens/I0003.dcm.nii mr-dwi-siemens/I0003.dcm.nii.xml mr-dwi-siemens/I0004.dcm.nii mr-dwi-siemens/I0004.dcm.nii.xml ;; describeEmpty) run_eval "${BINDIR}/describe -m empty.nii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMountPoints) run_eval "CMTK_MOUNTPOINTS=INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMountPointsMulti) run_eval "CMTK_MOUNTPOINTS=DUMMY=/fs/dummy,INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMountPointsPrefix) run_eval "CMTK_MOUNTPOINTS=^INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMountPointsPrefixInvalid) run_eval "CMTK_MOUNTPOINTS=^NPUTS=INVALID,^INPUTS=${DATADIR} ${BINDIR}/describe -m INPUTS/spgr_brain_1.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeDICOM) run_eval "${BINDIR}/describe -m dcm/I0007.dcm > ${tmpdir}/describe.txt" check_results describe.txt ;; describeDICOMZ) run_eval "${BINDIR}/describe -m dcmz/I0007.dcm > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMosaicDICOM) run_eval "${BINDIR}/describe -m mr-mosaic/fmri.dcm > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMosaicPACSDICOM) run_eval "${BINDIR}/describe -m mr-mosaic-pacs/image.dcm > ${tmpdir}/describe.txt" check_results describe.txt ;; describeVanderbilt) run_eval "${BINDIR}/describe -m vanderbilt/header.ascii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeBZip2a) run_eval "${BINDIR}/describe -m bzip_test.nii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeBZip2b) run_eval "${BINDIR}/describe -m bzip_test.nii.bz2 > ${tmpdir}/describe.txt" check_results describe.txt ;; describeLZMAa) run_eval "${BINDIR}/describe -m lzma_test.nii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeLZMAb) run_eval "${BINDIR}/describe -m lzma_test.nii.lzma > ${tmpdir}/describe.txt" check_results describe.txt ;; describeXZa) run_eval "${BINDIR}/describe -m xz_test.nii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeXZb) run_eval "${BINDIR}/describe -m xz_test.nii.xz > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMR1) run_eval "${BINDIR}/describe -m parc1_bin.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMR2) run_eval "${BINDIR}/describe -m phantom_ax.hdr phantom_co.hdr phantom_sa.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMR3) run_eval "${BINDIR}/describe -m header_only.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMR4) run_eval "${BINDIR}/describe -m phantom_ax.nii phantom_co.nii phantom_sa.nii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeHuman) run_eval "${BINDIR}/describe --read-ras phantom_ax.nii phantom_co.nii phantom_sa.nii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMRBiorad) run_eval "${BINDIR}/describe -m bioradvol.PIC > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMRBioradGz) run_eval "${BINDIR}/describe -m gz_bioradvol.PIC.gz > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMRNrrd1) run_eval "${BINDIR}/describe -m phantom_ax.nhdr phantom_co.nhdr phantom_sa.nhdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeMRNrrd2) run_eval "${BINDIR}/describe -m split_ax_0.nhdr split_ax_1.nhdr split_ax_2.nhdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeNrrdNoOrigin) run_eval "${BINDIR}/describe -m phantom_ax_noOrigin.nhdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeNiftiDetached348) run_eval "${BINDIR}/describe -m spgr_brain_nifti_hdr348.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeEmbedAnalyze) run_eval "${BINDIR}/describe -m embed_patient.hdr > ${tmpdir}/describe.txt" check_results describe.txt ;; describeEmbedNifti) run_eval "${BINDIR}/describe -m embed_patient.nii > ${tmpdir}/describe.txt" check_results describe.txt ;; describeEmbedNrrd) run_eval "${BINDIR}/describe -m embed_patient.nrrd > ${tmpdir}/describe.txt" check_results describe.txt ;; describeXform) run_eval "${BINDIR}/describe spgr_brain_12_warp.list vol001_mr_t0t1.list > ${tmpdir}/describe.txt" check_results describe.txt ;; describeXformMachine) run_eval "${BINDIR}/describe -m spgr_brain_12_warp.list vol001_mr_t0t1.list > ${tmpdir}/describe.txt" check_results describe.txt ;; destripeDefault) run destripe -y stripes_crop_byte.nii ${tmpdir}/destripe.nii check_results destripe.nii ;; destripeKernelFloat) run destripe -y --kernel-fwhm 5 --kernel-radius 2 --write-float stripes_crop_byte.nii ${tmpdir}/destripe.nii check_results destripe.nii ;; detect_adni_phantomDefault) run detect_adni_phantom --write-labels ${tmpdir}/labels.nii --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan.nii ${tmpdir}/magphan.xml check_results labels.nii rigid.xform affine.xform magphan.xml ;; detect_adni_phantomRefineXform) run detect_adni_phantom --tolerant --refine-xform --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_lowcontrast.nii ${tmpdir}/magphan.xml check_results rigid.xform affine.xform magphan.xml ;; detect_adni_phantomRefineOutliers) run detect_adni_phantom --tolerant --refine-outliers --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_lowcontrast.nii ${tmpdir}/magphan.xml check_results rigid.xform affine.xform magphan.xml ;; detect_adni_phantomExcludeOutliers) run detect_adni_phantom --tolerant --exclude-outliers --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_lowcontrast.nii ${tmpdir}/magphan.xml check_results rigid.xform affine.xform magphan.xml ;; detect_adni_phantomErodeNonStd) run detect_adni_phantom --erode-snr 20 --erode-cnr 2 spgr_magphan.nii ${tmpdir}/magphan.xml check_results magphan.xml ;; detect_adni_phantomBadFOV) run_expect_fail detect_adni_phantom spgr_magphan_badFOV.nii ${tmpdir}/magphan.xml ;; detect_adni_phantomTolerantBadFOV) run detect_adni_phantom --tolerant --write-labels ${tmpdir}/labels.nii spgr_magphan_badFOV.nii ${tmpdir}/magphan.xml check_results magphan.xml labels.nii ;; detect_adni_phantomMissingSphere) run detect_adni_phantom --write-labels ${tmpdir}/labels.nii --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_missingSphere.nii ${tmpdir}/magphan.xml check_results labels.nii rigid.xform affine.xform magphan.xml ;; detect_adni_phantomBrokenSNR) run detect_adni_phantom --write-labels ${tmpdir}/labels.nii --write-rigid ${tmpdir}/rigid.xform --write-affine ${tmpdir}/affine.xform spgr_magphan_brokenSNR.nii ${tmpdir}/magphan.xml check_results labels.nii rigid.xform affine.xform magphan.xml ;; detect_spheres_matched_filter) run detect_spheres_matched_filter --radius 15 --filter-margin 2 adni_phantom2mm.nii ${tmpdir}/filtered.nii run convertx --float --downsample-select 4,4,4 ${tmpdir}/filtered.nii ${tmpdir}/filtered.nii check_images filtered.nii ;; detect_spheres_matched_filterNormalized) run detect_spheres_matched_filter --normalized --radius 15 --filter-margin 1 adni_phantom2mm.nii ${tmpdir}/filtered.nii run convertx --float --downsample-select 4,4,4 ${tmpdir}/filtered.nii ${tmpdir}/filtered.nii check_images filtered.nii ;; dof2mat) run_eval "${BINDIR}/dof2mat parc1_parc2_9dof.xform > ${tmpdir}/matrix" check_results matrix ;; dof2matTranspose) run_eval "${BINDIR}/dof2mat --transpose parc1_parc2_9dof.xform > ${tmpdir}/matrix" check_results matrix ;; dof2matLegacy) run_eval "${BINDIR}/dof2mat vol001_mr_t0t1.list > ${tmpdir}/matrix" check_results matrix ;; dof2matLegacyFwd) run_eval "${BINDIR}/dof2mat vol001_mr_t0t1_fwd.list > ${tmpdir}/matrix" check_results matrix ;; dof2matFixed) run_eval "${BINDIR}/dof2mat vol001_mr_t0t1_fwd24.list > ${tmpdir}/matrix" check_results matrix ;; stream_pixels) run_eval "${BINDIR}/stream_pixels jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw" check_results stream.raw ;; stream_pixelsConvert) run_eval "${BINDIR}/stream_pixels --convert int jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw" check_results stream.raw ;; stream_pixelsReorient) run_eval "${BINDIR}/stream_pixels --reorient RIP jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw" check_results stream.raw ;; stream_pixelsEndian) run_eval "${BINDIR}/stream_pixels --change-endian jacobian-01.nii jacobian-02.nii > ${tmpdir}/stream.raw" check_results stream.raw ;; epiunwarp) export CMTK_NUM_THREADS=1 run epiunwarp --no-init-shift-com --write-jacobian-fwd ${tmpdir}/jacobian.nii --folding-constraint-weight 0 --smooth-sigma-max 16 --smooth-sigma-min 0 --smooth-sigma-diff 1 --iterations 5 --smoothness-constraint-weight 1e4 --phase-encode-ap dwi_fwd.nii dwi_rev.nii ${tmpdir}/c1.nii ${tmpdir}/c2.nii ${tmpdir}/df.nrrd unset CMTK_NUM_THREADS check_images c1.nii c2.nii jacobian.nii check_results df.nrrd ;; epiunwarpInitShift) export CMTK_NUM_THREADS=1 run epiunwarp --write-jacobian-fwd ${tmpdir}/jacobian.nii --folding-constraint-weight 0 --smooth-sigma-max 16 --smooth-sigma-min 0 --smooth-sigma-diff 1 --iterations 5 --smoothness-constraint-weight 1e4 --phase-encode-ap dwi_fwd.nii dwi_rev.nii ${tmpdir}/c1.nii ${tmpdir}/c2.nii ${tmpdir}/df.nrrd unset CMTK_NUM_THREADS check_images c1.nii c2.nii jacobian.nii check_results df.nrrd ;; fib2image) run_eval "${BINDIR}/fib2image -o ${tmpdir}/fibers.nii fiber_grid.hdr < fibers.fib" check_images fibers.nii ;; fibxform) run_eval "${BINDIR}/fibxform crop-x30.xform < fibers.fib > ${tmpdir}/output.fib" check_results output.fib ;; fibxformSourceTarget) run_eval "${BINDIR}/fibxform --source-image fiber_grid.hdr --target-image fiber_grid.hdr crop-x30.xform < fibers.fib > ${tmpdir}/output.fib" check_results output.fib ;; filterGaussian) run filter --gaussian 1 --radius 2 rat_fse_erly.hdr ${tmpdir}/filter.hdr check_results filter.img ;; filterGaussianSmallKernel) run filter --gaussian 1 --radius 1.1 rat_fse_erly.hdr ${tmpdir}/filter.hdr check_results filter.img ;; filterGaussianNoFilter) run filter --gaussian 1 --radius 0.5 rat_fse_erly.hdr ${tmpdir}/filter.hdr check_results filter.img ;; filterRohlfing) run filter --rohlfing --intensity-gaussian 1 --gaussian 10 spgr_3t.hdr ${tmpdir}/filter.hdr spgr_3t_mask.hdr check_results filter.img ;; filmFourthOrder) run film --coronal --nmi --fourth-order-error --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; filmCubic) run film --coronal --nmi --cubic --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; filmMSDLinearNoTrunc) run film --msd --coronal --linear --no-truncation --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; filmMISincRefSPGR) run film --mi --coronal --cubic --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --reference-image interleave_3dspgr.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; fit_affine_xform) run fit_affine_xform -o ${tmpdir}/affine.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list check_results affine.xform ;; fit_affine_xformRigid) run fit_affine_xform --rigid -o ${tmpdir}/rigid.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list check_results rigid.xform ;; fit_affine_xformReverse) run fit_affine_xform -o ${tmpdir}/affine.xform vol001_mr_t1.hdr --inverse vol001_mr_t0t1.list vol001_mr_t0t1_warp.xform check_results affine.xform ;; fit_affine_xform_landmarksRigid) run fit_affine_xform_landmarks landmarksSource landmarksTargetRigid ${tmpdir}/affine.xform check_results affine.xform ;; fit_affine_xform_landmarksScales) run fit_affine_xform_landmarks landmarksSource landmarksTargetScales ${tmpdir}/affine.xform check_results affine.xform ;; fit_affine_xform_landmarksShear) run fit_affine_xform_landmarks landmarksSource landmarksTargetShear ${tmpdir}/affine.xform check_results affine.xform ;; fit_affine_xform_landmarksRigidRigid) run fit_affine_xform_landmarks --rigid landmarksSource landmarksTargetRigid ${tmpdir}/affine.xform check_results affine.xform ;; fit_affine_xform_landmarksRigidRigidFlip) run fit_affine_xform_landmarks --rigid landmarksSource2 landmarksTarget2 ${tmpdir}/rigid.xform check_results rigid.xform ;; fit_affine_xform_landmarksRigidScales) run fit_affine_xform_landmarks --rigid landmarksSource landmarksTargetScales ${tmpdir}/affine.xform check_results affine.xform ;; fit_affine_xform_landmarksRigidShear) run fit_affine_xform_landmarks --rigid landmarksSource landmarksTargetShear ${tmpdir}/affine.xform check_results affine.xform ;; fit_affine_dfieldDField) run fit_affine_dfield vol001_mr_t0t1_dfield.nrrd ${tmpdir}/affine_fit.xform check_results affine_fit.xform ;; fit_affine_dfieldFFD) run fit_affine_dfield vol001_mr_t0t1_warp.xform ${tmpdir}/affine_fit.xform check_results affine_fit.xform ;; fit_spline_dfieldSpacing) run fit_spline_dfield --final-cp-spacing 40 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform check_results warp.xform ;; fit_spline_dfieldSpacingMultiLevel) run fit_spline_dfield --final-cp-spacing 40 --levels 2 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform check_results warp.xform ;; fit_spline_dfieldDims) run fit_spline_dfield --final-cp-dims 10,10,5 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform check_results warp.xform ;; fit_spline_dfieldDimsRelative) run fit_spline_dfield --relative --final-cp-dims 10,10,5 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform check_results warp.xform ;; fit_spline_dfieldDimsMultiLevel) run fit_spline_dfield --final-cp-dims 10,10,5 --levels 2 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform check_results warp.xform ;; fit_spline_dfieldDimsMultiLevelSafe) run fit_spline_dfield --final-cp-dims 10,10,5 --levels 400 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform check_results warp.xform ;; fit_spline_dfieldDimsWithAffine) run fit_spline_dfield --fit-affine-first --final-cp-dims 10,10,5 vol001_mr_t0t1_dfield.nrrd ${tmpdir}/warp.xform check_results warp.xform ;; fit_spline_xformSpacing) run fit_spline_xform --final-cp-spacing 40 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list check_results warp.xform ;; fit_spline_xformSpacingReverse) run fit_spline_xform --final-cp-spacing 40 -o ${tmpdir}/warp.xform vol001_mr_t1.hdr --inverse vol001_mr_t0t1.list vol001_mr_t0t1_warp.xform check_results warp.xform ;; fit_spline_xformSpacingMultiLevel) run fit_spline_xform --final-cp-spacing 40 --levels 2 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list check_results warp.xform ;; fit_spline_xformDims) run fit_spline_xform --final-cp-dims 10,10,5 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list check_results warp.xform ;; fit_spline_xformDimsMultiLevel) run fit_spline_xform --final-cp-dims 10,10,5 --levels 2 -o ${tmpdir}/warp.xform vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1.list check_results warp.xform ;; glmDefault) run_eval "${BINDIR}/glm -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt" check_results model_stdout.txt model_fstat_00_model.img model_tstat_00_age.img model_param_00_age.img check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img ;; glmNormalize) run_eval "${BINDIR}/glm --normalize -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt" check_results model_stdout.txt model_fstat_00_model.img model_tstat_00_age.img model_param_00_age.img check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img ;; glmExp) run_eval "${BINDIR}/glm --exp -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt" check_results model_stdout.txt model_fstat_00_model.img model_tstat_00_age.img model_param_00_age.img check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img ;; glmNoConstant) run_eval "${BINDIR}/glm --exclude-constant -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt" check_results model_stdout.txt model_fstat_00_model.img model_tstat_00_age.img model_param_00_age.img check_results model_tstat_01_sex.img model_param_01_sex.img ;; glmIgnore) run_eval "${BINDIR}/glm --ignore-parameter 1 -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt" check_results model_stdout.txt model_fstat_00_model.img model_tstat_00_age.img model_param_00_age.img check_results model_tstat_02_CONST.img model_param_02_CONST.img ;; glmSelect) run_eval "${BINDIR}/glm --select-parameter age -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt" check_results model_stdout.txt model_fstat_00_model.img check_results model_tstat_00_age.img model_param_00_age.img model_tstat_02_CONST.img model_param_02_CONST.img ;; glmCrop) run_eval "${BINDIR}/glm --crop 10,10,0,20,20,2 -v -O ${tmpdir}/model_%s_%02d_%s.hdr jacobian_glm.txt jacobian-%s.nii | fgrep -v ${tmpdir} > ${tmpdir}/model_stdout.txt" check_results model_stdout.txt model_fstat_00_model.img model_tstat_00_age.img model_param_00_age.img check_results model_tstat_01_sex.img model_param_01_sex.img model_tstat_02_CONST.img model_param_02_CONST.img ;; gmmDefault) run gmm --mask gmm/mask.nii gmm/spgr.nii ${tmpdir}/gmm.nii gmm/prior1.nii gmm/prior2.nii gmm/prior3.nii check_results gmm.nii ;; gmmAlternative) run gmm --classes 2 --iterations 5 --priors-init-only --prior-epsilon 0.05 --probability-maps gmm/spgr.nii ${tmpdir}/gmm.nii gmm/prior1.nii gmm/prior2.nii check_results gmm.nii check_images gmm_prob1.nii gmm_prob2.nii ;; gregxformFordwardBackward) run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform -f vol001_mr_t0t1_warp.xform | ${BINDIR}/gregxform vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyz" check_results vol001_t0_points.xyz ;; gregxformAffine) run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform -f vol001_mr_t0t1.list > ${tmpdir}/vol001_t0_points.xyz" check_results vol001_t0_points.xyz ;; gregxformAffineFromWarp) run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform --affine -f vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyz" check_results vol001_t0_points.xyz ;; gregxformAffineFromWarpFwdBwd) run_eval "cat vol001_t0_points.xyz | ${BINDIR}/gregxform --affine -f vol001_mr_t0t1_warp.xform | ${BINDIR}/gregxform --affine vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyz" check_results vol001_t0_points.xyz ;; groupwise_affineFromInit) run groupwise_affine -v --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_affineMatchHistograms) export CMTK_NUM_THREADS=1 run groupwise_affine -v --match-histograms --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms unset CMTK_NUM_THREADS check_results groupwise.xforms average.nii ;; groupwise_affineFromInitSampling) run groupwise_affine -v --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-to 1 --sampling-density 0.5 --zero-sum groupwise_init_brain123.xforms ## no baseline; this mode uses probabilistic sampling ;; groupwise_affineBackground) run groupwise_affine -v --force-background 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results groupwise.xforms average.nii ;; groupwise_affineUseTemplate) export CMTK_NUM_THREADS=1 run groupwise_affine -v --force-background 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --template-with-data spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr unset CMTK_NUM_THREADS check_results groupwise.xforms average.nii ;; groupwise_affineZeroSumSmooth) export CMTK_NUM_THREADS=1 run groupwise_affine -v --smooth 0.5 --downsample-to 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr unset CMTK_NUM_THREADS check_results groupwise.xforms average.nii ;; groupwise_affineRMIFromInit) run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_affineRMIFromInitDeltaF) run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --dofs 6,9 -e 4 --delta-f-threshold 0.1 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_affineRMIFromInitSampling) run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --dofs 6 --dofs 9 -e 4 -a 0.25 --downsample-to 1 --sampling-density 0.5 --zero-sum groupwise_init_brain123.xforms ## no baseline; this mode uses probabilistic sampling ;; groupwise_affineRMIBackground) run groupwise_affine --rmi --force-background 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --downsample-to 1 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results groupwise.xforms average.nii ;; groupwise_affineRMIZeroSumSmooth) run groupwise_affine --rmi --smooth 0.5 --downsample-to 0 -O ${tmpdir} --template spgr_brain_1.hdr --dofs 6 --dofs 9 -e 2 -a 0.25 --downsample-from 2 --sampling-density 1.0 --zero-sum spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results groupwise.xforms average.nii ;; groupwise_warpFromInit) run groupwise_warp -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpFromInitProtect) run groupwise_warp -v --force-background 0 -vv --disable-cp-mask box_corner.nii -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms ;; groupwise_warpFitFromInit) run groupwise_warp -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --grid-spacing-fit --refine-grid 1 -e 4 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpUseTemplate) run groupwise_warp -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template-with-data spgr_brain_1.hdr groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpUseTemplateMatchHistograms) export CMTK_NUM_THREADS=1 run groupwise_warp -v --match-histograms --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template-with-data spgr_brain_1.hdr groupwise_init_brain123.xforms unset CMTK_NUM_THREADS check_results groupwise.xforms average.nii ;; groupwise_warpMatchHistograms) export CMTK_NUM_THREADS=1 run groupwise_warp -v --match-histograms --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template spgr_brain_1.hdr groupwise_init_brain123.xforms unset CMTK_NUM_THREADS check_results groupwise.xforms average.nii ;; groupwise_warpFromInitZeroSum) run groupwise_warp -v --zero-sum --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpFromInitNoBG) run groupwise_warp -v -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpUseTemplateNoBG) run groupwise_warp -v -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 2 --template-with-data spgr_brain_1.hdr groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpRMIFromInit) run groupwise_warp --rmi -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpRMIFitFromInit) run groupwise_warp --rmi -v --force-background 0 -O ${tmpdir} --grid-spacing 200 --grid-spacing-fit --refine-grid 1 -e 4 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_warpRMIFromInitZeroSum) run groupwise_warp --rmi -v --zero-sum --force-background 0 -O ${tmpdir} --grid-spacing 200 --refine-grid 1 -e 2 -a 1 --downsample-from 2 --downsample-to 1 groupwise_init_brain123.xforms check_results groupwise.xforms average.nii ;; groupwise_initCentersOfMass) run groupwise_init -O ${tmpdir} --align-centers-of-mass spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results groupwise.xforms # cannot compare separate xforms due to local file system path in the file check_results average.nii ;; groupwise_initCenterFOV) run groupwise_init -O ${tmpdir} --center-template spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results groupwise.xforms # cannot compare separate xforms due to local file system path in the file check_results average.nii ;; groupwise_initCentersOfMassScale) run groupwise_init -O ${tmpdir} --align-centers-of-mass --init-scales spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results groupwise.xforms # cannot compare separate xforms due to local file system path in the file check_results average.nii ;; groupwise_initCentersOfMassTemplate) run groupwise_init -O ${tmpdir} --template spgr_brain_1.hdr --align-centers-of-mass spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr check_results groupwise.xforms check_results pairs/target-000.list/registration pairs/target-001.list/registration pairs/target-002.list/registration check_results average.nii ;; hausdorffBinary12) run_eval "${BINDIR}/hausdorff parc1_bin.hdr parc2_bin.hdr > ${tmpdir}/hd.txt" check_results hd.txt ;; hausdorffBinary21) run_eval "${BINDIR}/hausdorff parc2_bin.hdr parc1_bin.hdr > ${tmpdir}/hd.txt" check_results hd.txt ;; hausdorffBinaryForced) run_eval "${BINDIR}/hausdorff parc1.hdr parc2.hdr > ${tmpdir}/hd.txt" check_results hd.txt ;; histogram) run histogram -o ${tmpdir}/histogram spgr_3t.hdr check_results histogram ;; histogramNorm) run histogram --normalize -o ${tmpdir}/histogram spgr_3t.hdr check_results histogram ;; histogramBinsMinMax) run histogram --min 300 --max 3000 --nbins 16 -o ${tmpdir}/histogram spgr_3t.hdr check_results histogram ;; histogramBinsMinMaxTrunc) run histogram --truncate --min 300 --max 3000 --nbins 16 -o ${tmpdir}/histogram spgr_3t.hdr check_results histogram ;; histogramMask) run histogram --mask spgr_3t_mask.hdr -o ${tmpdir}/histogram spgr_3t.hdr check_results histogram ;; imagemathAbsPop) run imagemath --in pat001_pet.hdr pat001_mr_T1.hdr --pop --abs --out ${tmpdir}/abs.nii check_results abs.nii ;; imagemathSqrSqrt) run imagemath --in pat001_pet.hdr --sqr --sqrt --out ${tmpdir}/abs.nii check_results abs.nii ;; imagemathLogExp) run imagemath --in spgr_brain_1.hdr --log --exp --out ${tmpdir}/logexp.nii check_results logexp.nii ;; imagemathDupAddMulDiv) run imagemath --in spgr_brain_1.hdr --dup --in spgr_brain_2.hdr spgr_brain_3.hdr --add --mul --div --out ${tmpdir}/damd.nii check_results damd.nii ;; imagemathThreshAboveBelow) run imagemath --in pat001_pet.hdr --thresh-above 1000 --thresh-below 0 --out ${tmpdir}/thresh.nii check_results thresh.nii ;; imagemathAverage) run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --average --out ${tmpdir}/average.hdr check_results average.img ;; imagemathVariance) run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr --variance --out ${tmpdir}/variance.nii check_results variance.nii ;; imagemathMaskAverage) run imagemath --in spgr_3t.hdr spgr_3t_mask.hdr --mask-average --out ${tmpdir}/average.hdr check_results average.img ;; imagemathXor) run imagemath --in parc1.hdr --scalar-xor 1 --out ${tmpdir}/xor.hdr check_results xor.img ;; imagemathDupFillMaxValue) run imagemath --in parc1.hdr --dup --fill 1 --max-value --out ${tmpdir}/result.hdr check_results result.img ;; imagemathAnd) run imagemath --in parc1.hdr --scalar-and 1 --out ${tmpdir}/and.hdr check_results and.img ;; imagemathContractLabels) run imagemath --in parc1.hdr parc2.hdr parc3.hdr --contract-labels --out ${tmpdir}/contract.hdr check_results contract.img ;; imagemathMaxIndex) run imagemath --in parc1.hdr parc2.hdr parc3.hdr --max-index --out ${tmpdir}/maxidx.nii check_results maxidx.nii ;; imagemathMaxValue) run imagemath --in parc1.hdr parc2.hdr parc3.hdr --max-value --out ${tmpdir}/maxval.nii check_results maxval.nii ;; imagemathVote) run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --vote --out ${tmpdir}/vote.hdr check_results vote.img ;; imagemathProduct) run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --product --out ${tmpdir}/prod.nii check_results prod.nii ;; imagemathStackEntropyLabels) run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --stack-entropy-labels --out ${tmpdir}/entropy.hdr check_results entropy.img ;; imagemathSTAPLE) run imagemath --in parc1_bin.hdr parc2_bin.hdr parc3_bin.hdr --staple 10 --out ${tmpdir}/staple.hdr check_results staple.img ;; imagemathMultiClassSTAPLE) run imagemath --in parc1.hdr parc2.hdr parc3.hdr --mstaple 2 --out ${tmpdir}/mstaple.hdr check_results mstaple.img ;; imagemathMultiClassDisputedSTAPLE) run imagemath --in parc1.hdr parc2.hdr parc3.hdr --mstaple-disputed 2 --out ${tmpdir}/mstaple.hdr check_results mstaple.img ;; imagemathCombinePCA) run imagemath --in rat_fse_erly.hdr rat_fse_late.hdr --combine-pca --trunc --out ${tmpdir}/combine_pca.hdr check_results combine_pca.img ;; imagemathT2) run imagemath --float --in rat_fse_erly.hdr --log --in rat_fse_late.hdr --log --scalar-mul -1 --add --one-over --out ${tmpdir}/t2.hdr check_results t2.img ;; imagemathAtan2) run imagemath --float --in rat_fse_erly.hdr rat_fse_late.hdr --atan2 --out ${tmpdir}/atan.nii check_results atan.nii ;; imagemathLogOddsAdd) run imagemath --float --in pbmap_wm_2.nii --logit --in pbmap_wm_1.nii --logit --average --logistic --out ${tmpdir}/logodds_add.hdr check_results logodds_add.img ;; imagemathLogOddsAdd2) run imagemath --float --in pbmap_wm_2.nii pbmap_wm_1.nii --all --logit --average --all --logistic --out ${tmpdir}/logodds_add.hdr check_results logodds_add.img ;; imagemathMatchMeanSDev) run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr --match-mean-sdev --out ${tmpdir}/match.nii check_results match.nii ;; imagemathMatchMeanSDev3) run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr spgr_brain_3.hdr --match-mean-sdev3 --out ${tmpdir}/match.nii check_results match.nii ;; imagemathMatchHistograms) run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr --match-histograms --out ${tmpdir}/match_histograms.hdr check_results match_histograms.img ;; imagemathMatchHistogramsPadding) run imagemath --set-padding-value 0 --in spgr_brain_1.hdr spgr_brain_2.hdr --match-histograms --out ${tmpdir}/match_histograms.hdr check_results match_histograms.img ;; imagemathMatchHistogramsPadding2) run imagemath --in spgr_brain_1.hdr spgr_brain_2.hdr --set-padding-value 0 --match-histograms --out ${tmpdir}/match_histograms.hdr check_results match_histograms.img ;; imagemathMatchHistogramsPaddingUnset) run imagemath --set-padding-value 0 --in spgr_brain_1.hdr --unset-padding --in spgr_brain_2.hdr --match-histograms --out ${tmpdir}/match_histograms.hdr check_results match_histograms.img ;; interleaved_bad_slicesDefault) run interleaved_bad_slices rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt check_results badSlices.txt ;; interleaved_bad_slicesStdDev1) run interleaved_bad_slices --stdev-thresh 1 rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt check_results badSlices.txt ;; interleaved_bad_slicesRMS) run interleaved_bad_slices --rms rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt check_results badSlices.txt ;; interleaved_bad_slicesBulk) run interleaved_bad_slices --bad-slices-thresh 1 rsfMRI-motion/*.nii* > ${tmpdir}/badSlices.txt check_results badSlices.txt ;; jidbBoxFourthOrder) run jidb --coronal --nmi --psf box --fourth-order-error --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; jidbGaussian) run jidb --coronal --nmi --psf gaussian --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --write-injected-image ${tmpdir}/injected.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; jidbGaussianScale) run jidb --psf gaussian --nmi --psf-scale 0.5 --no-truncation --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; jidbMIRefSPGR) run jidb --mi --passes 3 --num-iterations 3 --injection-kernel-radius 2 --injection-kernel-sigma 1 --reference-image interleave_3dspgr.hdr interleave_thnfse.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; levelsetDefault) run levelset -v vol001_mr_t1.hdr ${tmpdir}/levelset.hdr check_results levelset.img ;; levelsetScaleInitial) run levelset -v --scale-initial-sphere 0.5 vol001_mr_t1.hdr ${tmpdir}/levelset.hdr check_results levelset.img ;; levelsetBinarizeFastWideBinary) run levelset -v --binarize --delta 1.0 --filter-sigma 4.0 vol001_mr_t1.hdr ${tmpdir}/levelset.hdr check_results levelset.img ;; lvoteDefault) run lvote -v -o ${tmpdir}/lvote.nii lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lvote.nii ;; lvoteGlobalWeights) run lvote -v -o ${tmpdir}/lvote.nii --use-global-weights lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lvote.nii ;; lvoteRadius3) run lvote -v -o ${tmpdir}/lvote.nii --patch-radius 3 lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lvote.nii ;; lvoteOutliersGlobal) run lvote -v -o ${tmpdir}/lvote.nii --patch-radius 3 --no-global-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lvote.nii ;; lsbaRadius3) run lsba -v -o ${tmpdir}/lsba.nii --patch-radius 3 lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lsba.nii ;; lsbaRadius3Outliers) run lsba -v -o ${tmpdir}/lsba.nii --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lsba.nii ;; lsbaRadius3OutliersGlobal) run lsba -v -o ${tmpdir}/lsba.nii --patch-radius 3 --no-global-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lsba.nii ;; lsbaRadius3Search1) run lsba -v -o ${tmpdir}/lsba.nii --search-radius 1 --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lsba.nii ;; lmsbaRadius3) run lmsba -v -o ${tmpdir}/lmsba.nii --patch-radius 3 lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lmsba.nii ;; lmsbaRadius3Outliers) run lmsba -v -o ${tmpdir}/lmsba.nii --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lmsba.nii ;; lmsbaRadius3OutliersGlobal) run lmsba -v -o ${tmpdir}/lmsba.nii --patch-radius 3 --no-global-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lmsba.nii ;; lmsbaRadius3Search1) run lmsba -v -o ${tmpdir}/lmsba.nii --search-radius 1 --patch-radius 3 --no-local-outliers lvote_target.nii lvote_atlas_i0.nii lvote_atlas_l0.nii lvote_atlas_i1.nii lvote_atlas_l1.nii lvote_atlas_i2.nii lvote_atlas_l2.nii check_results lmsba.nii ;; make_initial_affineCenterOfMass) run make_initial_affine --mode centers-of-mass box1.hdr box3.hdr ${tmpdir}/xform check_results xform ;; make_initial_affinePrincipalAxes1) run make_initial_affine --mode principal-axes box1.hdr box2.hdr ${tmpdir}/xform check_results xform ;; make_initial_affinePrincipalAxes2) run make_initial_affine --mode principal-axes box1.hdr box3.hdr ${tmpdir}/xform check_results xform ;; make_initial_affinePrincipalAxes3) run make_initial_affine --mode principal-axes box2.hdr box3.hdr ${tmpdir}/xform check_results xform ;; make_initial_affinePrincipalAxes4) run make_initial_affine --mode principal-axes box1.hdr box4.hdr ${tmpdir}/xform check_results xform ;; make_initial_affinePrincipalAxes5) run make_initial_affine --mode principal-axes box2.hdr box4.hdr ${tmpdir}/xform check_results xform ;; make_initial_affinePrincipalAxes6) run make_initial_affine --mode principal-axes box3.hdr box4.hdr ${tmpdir}/xform check_results xform ;; make_initial_affineDirectionVectorsNrrdAxSa) run make_initial_affine phantom_ax.nhdr phantom_sa.nhdr ${tmpdir}/xform check_results xform ;; make_initial_affineDirectionVectorsNrrdAxCo) run make_initial_affine phantom_ax.nhdr phantom_co.nhdr ${tmpdir}/xform check_results xform ;; make_initial_affineDirectionVectorsNrrdSaCo) run make_initial_affine phantom_sa.nhdr phantom_co.nhdr ${tmpdir}/xform check_results xform ;; make_initial_affineDirectionVectorsNrrdAxSaNative) run make_initial_affine --native-space phantom_ax.nhdr phantom_sa.nhdr ${tmpdir}/xform check_results xform ;; make_initial_affineDirectionVectorsNrrdAxCoNative) run make_initial_affine --native-space phantom_ax.nhdr phantom_co.nhdr ${tmpdir}/xform check_results xform ;; make_initial_affineDirectionVectorsNrrdSaCoNative) run make_initial_affine --native-space phantom_sa.nhdr phantom_co.nhdr ${tmpdir}/xform check_results xform ;; make_initial_affineDB) run make_initial_affine --db ${tmpdir}/db.sqlite box1.hdr box3.hdr ${tmpdir}/xform # only test for crash; local xform path in database is not portable for comparison ;; mat2dof1) run_eval "${BINDIR}/mat2dof --transpose --center -28,-48,-28 --offset 28,48,28 --pixel-size 1.06667,0.5,1.06667 -l ${tmpdir} < rigid-air.mat" check_results registration ;; mat2dof2) run_eval "${BINDIR}/mat2dof --transpose --center -28,-48,-28 --offset 28,48,28 --pixel-size 1.06667,0.5,1.06667 --inverse -l ${tmpdir} < rigid-air.mat" check_results registration ;; mat2dofFile) run_eval "${BINDIR}/mat2dof --transpose --center -28,-48,-28 --offset 28,48,28 --pixel-size 1.06667,0.5,1.06667 -l ${tmpdir} rigid-air.mat" check_results registration ;; mcaffine1) export CMTK_NUM_THREADS=1 run mcaffine --downsample-from 4 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --dofs 6 --covariance -o ${tmpdir}/xform pat001_mr_T1.hdr -- pat001_pet.hdr unset CMTK_NUM_THREADS check_results xform ;; mcaffine2) run mcaffine --initial-xform mcaffine2_initial.xform --downsample-from 4 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --dofs 6 --histograms -o ${tmpdir}/xform pat001_mr_T1.hdr -- pat001_pet.hdr check_results xform ;; mcaffine3) run mcaffine --downsample-from 4 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --dofs 6 --dofs 9 --covariance -o ${tmpdir}/xform rat_fse_erly.hdr rat_fse_late.hdr -- rat2_fse_erly.hdr rat2_fse_late.hdr check_results xform ;; mcaffine4) run mcaffine --downsample-from 4 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --dofs 6,9 --covariance -o ${tmpdir}/xform rat_fse_erly.hdr rat_fse_late.hdr -- rat2_fse_erly.hdr rat2_fse_late.hdr check_results xform ;; mcwarp1) # Test breaks when using multiple threads due to floating point effects export CMTK_NUM_THREADS=1 run mcwarp --downsample-from 2 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --covariance -o ${tmpdir}/xform mcaffine_rat_rat2.xform unset CMTK_NUM_THREADS check_results xform ;; mcwarp2) # Test breaks when using multiple threads due to floating point effects export CMTK_NUM_THREADS=1 run mcwarp --downsample-from 2 --downsample-to 1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --histograms -o ${tmpdir}/xform mcaffine_rat_rat2.xform unset CMTK_NUM_THREADS check_results xform ;; mcwarp3) # Test breaks when using multiple threads due to floating point effects export CMTK_NUM_THREADS=1 run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --covariance -o ${tmpdir}/xform mcaffine_rat_rat2.xform unset CMTK_NUM_THREADS check_results xform ;; mcwarp4) # Test breaks when using multiple threads due to floating point effects export CMTK_NUM_THREADS=1 run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --refine-grid 2 --covariance --intensity-correction -o ${tmpdir}/xform mcaffine_rat_rat2.xform unset CMTK_NUM_THREADS check_results xform ;; mcwarp5) # Test breaks when using multiple threads due to floating point effects export CMTK_NUM_THREADS=1 run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --adaptive-fix-thresh-factor 0.5 -o ${tmpdir}/xform mcaffine_rat_rat2.xform unset CMTK_NUM_THREADS check_results xform ;; mcwarp6) # Test breaks when using multiple threads due to floating point effects export CMTK_NUM_THREADS=1 run mcwarp --downsample-from 2 --downsample-to 1 --delta-f-threshold 0.1 --initial-step-size 1 --final-step-size 0.5 --grid-spacing 14 --adaptive-fix-thresh-factor-entropy 0.5 -o ${tmpdir}/xform mcaffine_rat_rat2.xform unset CMTK_NUM_THREADS check_results xform ;; mk_adni_phantom2mm) run mk_adni_phantom --resolution 2 ${tmpdir}/phantom.nii check_results phantom.nii ;; mk_adni_phantom2mmLabels) run mk_adni_phantom --resolution 2 --write-labels ${tmpdir}/phantom.lbl --write-landmarks ${tmpdir}/phantom.xyz --labels ${tmpdir}/phantom.nii check_results phantom.nii phantom.lbl phantom.xyz ;; mk_analyze_hdrDefault) run mk_analyze_hdr ${tmpdir}/analyze.hdr run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt" check_results analyze.hdr analyze.txt ;; mk_analyze_hdrImport) run mk_analyze_hdr --import spgr_3t.hdr ${tmpdir}/analyze.hdr run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt" check_results analyze.hdr analyze.txt ;; mk_analyze_hdrLittleEndian) run mk_analyze_hdr --description LittleEndian --little-endian --float --dims 100,200,300 --voxel 0.3,0.2,0.1 --offset 1024 ${tmpdir}/analyze.hdr run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt" check_results analyze.hdr analyze.txt ;; mk_analyze_hdrBigEndian) run mk_analyze_hdr --description BigEndian --big-endian --ushort --dims 100,200,300 --voxel 0.3,0.2,0.1 --offset 1024 ${tmpdir}/analyze.hdr run_eval "${BINDIR}/describe -m ${tmpdir}/analyze.hdr | fgrep --invert-match FNAME > ${tmpdir}/analyze.txt" check_results analyze.hdr analyze.txt ;; mk_nifti_hdrDefault) run mk_nifti_hdr ${tmpdir}/nifti.hdr run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.hdr | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt" check_results nifti.hdr nifti.txt ;; mk_nifti_hdrDescription) run_eval "${BINDIR}/mk_nifti_hdr --description \"This is a description text\" ${tmpdir}/nifti.hdr" check_results nifti.hdr ;; mk_nifti_hdrImport) run mk_nifti_hdr --import phantom_ax.nii ${tmpdir}/nifti.hdr run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.hdr | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt" check_results nifti.hdr nifti.txt ;; mk_nifti_hdrDefaultAttached) run mk_nifti_hdr --attached ${tmpdir}/nifti.nii run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.nii | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt" check_results nifti.nii nifti.txt ;; mk_nifti_hdrDescriptionAttached) run_eval "${BINDIR}/mk_nifti_hdr --attached --description \"This is a description text\" ${tmpdir}/nifti.nii" check_results nifti.nii ;; mk_nifti_hdrImportAttached) run mk_nifti_hdr --attached --import phantom_ax.nii ${tmpdir}/nifti.nii run_eval "${BINDIR}/describe -m ${tmpdir}/nifti.nii | fgrep --invert-match FNAME > ${tmpdir}/nifti.txt" check_results nifti.nii nifti.txt ;; mk_phantom_3dBoxIndexed) run mk_phantom_3d -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 2,2,2 box 2,2,2 5,5,5 10 check_results phantom.nii ;; mk_phantom_3dBoxIndexedRange) run mk_phantom_3d -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 2,2,2 box 11,11,11 5,5,5 10 check_results phantom.nii ;; mk_phantom_3dBoxAbsolute) run mk_phantom_3d --absolute -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 box 2,2,2 5,5,5 10 check_results phantom.nii ;; mk_phantom_3dBoxRelative) run mk_phantom_3d --relative -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 box 0.1,0.2,0.3 0.5,0.5,0.5 10 check_results phantom.nii ;; mk_phantom_3dSphereIndexed) run mk_phantom_3d --coordinates indexed -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 sphere 7,7,7 5 20 check_results phantom.nii ;; mk_phantom_3dSphereAbsolute) run mk_phantom_3d --coordinates absolute -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 sphere 7,7,7 5 20 check_results phantom.nii ;; mk_phantom_3dSphereAbsolute2) run mk_phantom_3d --coordinates absolute -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,2 sphere 7,7,7 5 20 check_results phantom.nii ;; mk_phantom_3dSphereRelative) run mk_phantom_3d --coordinates relative -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,1 sphere 0.5,0.4,0.3 0.4 20 check_results phantom.nii ;; mk_phantom_3dSphereRelative2) run mk_phantom_3d --coordinates relative -o ${tmpdir}/phantom.nii --dims 10,10,10 --voxel 1,1,2 sphere 0.5,0.4,0.3 0.4 20 check_results phantom.nii ;; mk_phantom_3dBoxSphere) run mk_phantom_3d -o ${tmpdir}/phantom.nii --char --bg 50 --dims 10,10,10 --voxel 1,1,1 sphere 7,7,7 5 20 box 2,2,2 5,5,5 10 check_results phantom.nii ;; mk_phantom_3dImport) run mk_phantom_3d -o ${tmpdir}/phantom.nii --import spgr_3t_mask.hdr sphere 30,40,30 20 0 check_results phantom.nii ;; mk_phantom_3dImportGrid) run mk_phantom_3d -o ${tmpdir}/phantom.nii --import-grid spgr_3t_mask.hdr sphere 30,40,30 20 10 check_results phantom.nii ;; mk_phantom_3dMRSVoxel) run mk_phantom_3d --echo -v --bg 0 -o ${tmpdir}/voxel.nii --import-grid ge-mrs/lfse.nii mrs-voxel ge-mrs/spectro.dcm 100 check_results voxel.nii ;; mrbiasMulIncremental) run mrbias --incremental -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr check_results corrected.img bias_mul.img ;; mrbiasMulAutoThresh) run mrbias -v -M 2 --set-padding-value 0 --thresh-auto spgr_3t.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; mrbiasMulOtsuThresh) run mrbias -v -M 2 --set-padding-value 0 --thresh-otsu-nbins 256 spgr_3t.hdr ${tmpdir}/corrected.hdr check_results corrected.img ;; mrbiasMulLogIntensity) run mrbias --log-intensities -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr check_results corrected.img bias_mul.img ;; mrbiasAddMulMask) export CMTK_NUM_THREADS=1 run mrbias -A 1 -M 2 --mask spgr_3t_mask.hdr --write-bias-add ${tmpdir}/bias_add.hdr --write-bias-mul ${tmpdir}/bias_mul.hdr spgr_3t.hdr ${tmpdir}/corrected.hdr unset CMTK_NUM_THREADS check_results corrected.img bias_mul.img bias_add.img ;; mrbiasMulIncrementalCUDA) run mrbias_cuda --incremental -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr check_results corrected.img bias_mul.img ;; mrbiasMulLogIntensityCUDA) run mrbias_cuda --log-intensities -M 2 --write-bias-mul ${tmpdir}/bias_mul.hdr --thresh-min 100 spgr_3t.hdr ${tmpdir}/corrected.hdr check_results corrected.img bias_mul.img ;; mrbiasAddMulMaskCUDA) run mrbias_cuda -A 1 -M 2 --mask spgr_3t_mask.hdr --write-bias-add ${tmpdir}/bias_add.hdr --write-bias-mul ${tmpdir}/bias_mul.hdr spgr_3t.hdr ${tmpdir}/corrected.hdr check_results corrected.img bias_mul.img bias_add.img ;; overlap) run_eval "${BINDIR}/overlap parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt" check_results overlap.txt ;; overlapNumLabels) run_eval "${BINDIR}/overlap -N 2 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt" check_results overlap.txt ;; overlapByLabel) run_eval "${BINDIR}/overlap --by-label parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt" check_results overlap.txt ;; overlapFirst) run_eval "${BINDIR}/overlap --first-label 10 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt" check_results overlap.txt ;; overlapFirstByLabel) run_eval "${BINDIR}/overlap --by-label --first-label 10 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt" check_results overlap.txt ;; overlapFirstByLabelNumLabels) run_eval "${BINDIR}/overlap --by-label --first-label 10 --num-labels 10 parc1.hdr parc2.hdr parc3.hdr > ${tmpdir}/overlap.txt" check_results overlap.txt ;; probeIndexed) run_eval "echo 98 154 1 |${BINDIR}/probe --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt" check_results probe.txt ;; probeAbsolute) run_eval "echo 91.875 144.375 3 |${BINDIR}/probe --absolute phantom_ax.nii.gz > ${tmpdir}/probe.txt" check_results probe.txt ;; probeRelative) run_eval "echo 0.384313725 0.603921569 0.5 |${BINDIR}/probe --relative phantom_ax.nii.gz > ${tmpdir}/probe.txt" check_results probe.txt ;; probePhysical) run_eval "echo -27.656 24.844 0 |${BINDIR}/probe --physical phantom_ax.nii.gz > ${tmpdir}/probe.txt" check_results probe.txt ;; probeIndexedLinear) run_eval "echo 98.5 154.5 1 |${BINDIR}/probe --linear --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt" check_results probe.txt ;; probeIndexedCubic) run_eval "echo 98.5 154.5 1 |${BINDIR}/probe --cubic --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt" check_results probe.txt ;; probeIndexedSinc) run_eval "echo 98.5 154.5 1 |${BINDIR}/probe --sinc-cosine --indexed phantom_ax.nii.gz > ${tmpdir}/probe.txt" check_results probe.txt ;; pxsearchIndexed) run_eval "echo 98 154 1 |${BINDIR}/pxsearch --input-coordinates indexed --output-coordinates indexed phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt" check_results pxsearch.txt ;; pxsearchIndexedRadius3) run_eval "echo 98 154 1 |${BINDIR}/pxsearch --radius 3 --input-coordinates indexed --output-coordinates indexed phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt" check_results pxsearch.txt ;; pxsearchIndexedRadius311) run_eval "echo 98 154 1 |${BINDIR}/pxsearch --radius 3,1,1 --input-coordinates indexed --output-coordinates indexed phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt" check_results pxsearch.txt ;; pxsearchAbsolute) run_eval "echo 91.875 144.375 3 |${BINDIR}/pxsearch --input-coordinates absolute --output-coordinates absolute phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt" check_results pxsearch.txt ;; pxsearchRelative) run_eval "echo 0.384313725 0.603921569 0.5 |${BINDIR}/pxsearch --input-coordinates relative --output-coordinates relative phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt" check_results pxsearch.txt ;; pxsearchPhysical) run_eval "echo -27.656 24.844 0 |${BINDIR}/pxsearch --input-coordinates physical --output-coordinates physical phantom_ax.nii.gz > ${tmpdir}/pxsearch.txt" check_results pxsearch.txt ;; reformatxNoXform) run reformatx --linear -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr check_results reformat.img ;; reformatxLinear) run reformatx --linear -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list check_results reformat.img ;; reformatxNearestNeighbor) run reformatx --nn -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list check_results reformat.img ;; reformatxPartialVolume) run reformatx --pv -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list check_results reformat.img ;; reformatxLinearFwdBwd) run reformatx --linear --short -o ${tmpdir}/reformat.hdr --floating vol001_mr_t0.hdr vol001_mr_t0.hdr vol001_mr_t0t1.list --inverse vol001_mr_t0t1.list check_results vol001_mr_t0.img ;; reformatxCubic) run reformatx --cubic -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list check_results reformat.img ;; reformatxCubicInverse) run reformatx --cubic -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr --inverse vol001_mr_t0t1.list check_results reformat.img ;; reformatxSincCosine) run reformatx --sinc-cosine -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list check_results reformat.img ;; reformatxSincHamming) run reformatx --sinc-hamming -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list check_results reformat.img ;; reformatxSincCosine5) run reformatx --sinc-cosine --sinc-window-radius 5 -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0_crop.hdr vol001_mr_t0t1.list check_results reformat.img ;; reformatxMassPreserving) run reformatx --preserve-mass -o ${tmpdir}/reformat.hdr --floating vol001_mr_t1.hdr vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform check_results reformat.img ;; reformatxJacobian) run reformatx -o ${tmpdir}/jacobian.hdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --jacobian vol001_mr_t0t1_warp.xform check_results jacobian.img ;; reformatxInverseJacobian) run reformatx -o ${tmpdir}/jacobian.hdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --jacobian --inverse vol001_mr_t0t1_warp.xform check_results jacobian.img ;; reformatxDfieldNrrd) run reformatx -o ${tmpdir}/reformat.hdr --floating parc2.hdr parc1.hdr parc1_parc2_dfield.nrrd check_results reformat.img ;; reformatxDfieldNrrdJacobian) run reformatx -o ${tmpdir}/jacobian.hdr vol001_mr_t0.hdr --jacobian vol001_mr_t0t1_dfield.nrrd check_results jacobian.img ;; reformatxTargetGrid) run reformatx -o ${tmpdir}/reformat.nii --target-grid 32,43,21:5.625,5.625,7.5 --floating spgr_brain_1.hdr check_results reformat.nii ;; reformatxTargetGridAnalyze) run reformatx -o ${tmpdir}/reformat.hdr --target-grid 32,43,21:5.625,5.625,7.5 --floating spgr_brain_1.hdr check_results reformat.hdr reformat.img ;; reformatxTargetGridOffset) run reformatx -o ${tmpdir}/reformat.nii --target-grid 32,43,21:5.625,5.625,7.5:5.625,0,0 --floating spgr_brain_1.hdr check_results reformat.nii ;; registrationAffineMrMrMSD) run registration -i --dofs 6,9 --msd --match-histograms -o ${tmpdir} pat001_mr_T1.hdr pat002_mr_T2.hdr check_results registration ;; registrationFromList) run registration -v --dofs 0 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; registrationWithInitial) run registration -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list vol001_mr_t0.hdr vol001_mr_t1.hdr check_results registration ;; registrationWithInitialInverse) run registration -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list --initial-is-inverse vol001_mr_t0t1.list check_results registration ;; registrationAutoLevelsRat4) run registration -v -i --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationAutoLevelsRat2) run registration -v -i --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationAutoLevelsRatToRat) run registration -v -i --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr check_results registration ;; registrationAutoLevelsRatToRatDeltaFThreshold) run registration -v -i --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms --delta-f-threshold 0.01 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr check_results registration ;; registrationAutoLevelsCt3) run registration --msd --auto-multi-levels 3 --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_ct.hdr check_results registration ;; registrationxAffineMrMrMSD) run registrationx --init fov --dofs 6,9 --msd --match-histograms -o ${tmpdir} pat001_mr_T1.hdr pat002_mr_T2.hdr check_results registration ;; registrationxShearNoScaleMrMrMSD) run registrationx --auto-multi-levels 4 --init fov --dofs 603 --msd --match-histograms -o ${tmpdir} pat001_mr_T1.hdr pat002_mr_T2.hdr check_results registration ;; registrationxFromList) run registrationx -v --dofs 0 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; registrationxWithInitial) run registrationx -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list vol001_mr_t0.hdr vol001_mr_t1.hdr check_results registration ;; registrationxWithInitialInverse) run registrationx -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list --initial-is-inverse vol001_mr_t0t1.list check_results registration ;; registrationxFromListDB) run registrationx --db ${tmpdir}/db.sqlite -v --dofs 0 -o ${tmpdir} vol001_mr_t0t1.list ;; registrationxWithInitialDB) run registrationx --db ${tmpdir}/db.sqlite -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list vol001_mr_t0.hdr vol001_mr_t1.hdr ;; registrationxWithInitialInverseDB) run registrationx --db ${tmpdir}/db.sqlite -v --dofs 0 -o ${tmpdir} --initial vol001_mr_t0t1.list --initial-is-inverse vol001_mr_t0t1.list ;; registrationxAutoLevelsRat4) run registrationx -v --auto-multi-levels 4 --dofs 6 -o ${tmpdir} --write-itk ${tmpdir}/xform.tfm rat_fse_erly.hdr rat_fse_late.hdr check_results registration xform.tfm ;; registrationxAutoLevelsRat4XY) run registrationx -v --restrict-in-plane xy --auto-multi-levels 4 --dofs 6,9,12 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat4XZ) run registrationx -v --restrict-in-plane xz --auto-multi-levels 4 --dofs 6,9,12 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat4YZ) run registrationx -v --restrict-in-plane yz --auto-multi-levels 4 --dofs 6,9,12 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat4Symmetric) run registrationx -v --symmetric --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat4NONE) run registrationx -v --init none --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat4FOV) run registrationx -v --init fov --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat4COM) run registrationx -v --init com --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat4PAX) run registrationx -v --init pax --auto-multi-levels 4 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat2) run registrationx -v --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat2Cubic) run registrationx -v --cubic --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat2Sinc) run registrationx -v --cosine-sinc --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRat2NN) run registrationx -v --nearest-neighbor --init fov --auto-multi-levels 2 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; registrationxAutoLevelsRatToRat) export CMTK_NUM_THREADS=1 run registrationx -v --init fov --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr unset CMTK_NUM_THREADS check_results registration ;; registrationxAutoLevelsRatToRatNCC) run registrationx -v --init fov --auto-multi-levels 2 --ncc -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr check_results registration ;; registrationxAutoLevelsRatToRatRMS) run registrationx -v --init fov --auto-multi-levels 2 --rms -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr check_results registration ;; registrationxAutoLevelsRatToRatCR) run registrationx -v --init fov --auto-multi-levels 2 --cr -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr check_results registration ;; registrationxAutoLevelsRatToRatMI) run registrationx -v --init fov --auto-multi-levels 2 --mi -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr check_results registration ;; registrationxAutoLevelsRatToRatDeltaFThreshold) export CMTK_NUM_THREADS=1 run registrationx -v --init fov --auto-multi-levels 2 --dofs 6,9 --msd --match-histograms --delta-f-threshold 0.01 -o ${tmpdir} rat_fse_erly.hdr rat2_fse_erly.hdr unset CMTK_NUM_THREADS check_results registration ;; registrationxAutoLevelsCt3) run registrationx --pad-flt -10000 --write-reformatted ${tmpdir}/reformat.nii --msd --auto-multi-levels 3 --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_ct.hdr check_results registration reformat.nii ;; registrationxAutoLevelsLabelsNN) run registrationx -v --interpolation nearest-neighbor --class-ref label --class-flt label --auto-multi-levels 4 --dofs 6,9 --nmi -o ${tmpdir} parc1.hdr parc2.hdr check_results registration ;; registrationxAutoLevelsLabelsPV) run registrationx -v --interpolation partial-volume --class-ref label --class-flt label --auto-multi-levels 4 --dofs 6,9 --nmi -o ${tmpdir} parc1.hdr parc2.hdr check_results registration ;; reorientHdrSaToAx) run reorient -o RAS phantom_sa.hdr ${tmpdir}/reorient.hdr check_results reorient.hdr reorient.img ;; reorientHdrSaToAxNifti) run reorient -i RAS -o RAS phantom_sa.hdr ${tmpdir}/reorient.nii check_results reorient.nii ;; reorientHdrCoToAx) run reorient -o RAS phantom_co.hdr ${tmpdir}/reorient.hdr check_results reorient.hdr reorient.img ;; reorientHdrAxToSa) run reorient -o ASL phantom_ax.hdr ${tmpdir}/reorient.hdr check_results reorient.hdr reorient.img ;; reorientHdrCoToSa) run reorient -o ASL phantom_co.hdr ${tmpdir}/reorient.hdr check_results reorient.hdr reorient.img ;; reorientHdrAxToCo) run reorient -o LSA phantom_ax.hdr ${tmpdir}/reorient.hdr check_results reorient.hdr reorient.img ;; reorientHdrSaToCo) run reorient -o LSA phantom_sa.hdr ${tmpdir}/reorient.hdr check_results reorient.hdr reorient.img ;; reorientNrrdToNrrd) run reorient vol001_mr_t0_crop.nrrd ${tmpdir}/vol001_mr_t0_crop.nhdr check_results vol001_mr_t0_crop.nhdr vol001_mr_t0_crop.raw ;; reorientNrrdToNrrdRAS) run reorient --output-orientation RAS vol001_mr_t0_crop.nrrd ${tmpdir}/vol001_mr_t0_crop.nhdr check_results vol001_mr_t0_crop.nhdr vol001_mr_t0_crop.raw ;; reorientNrrdToNrrdSpaceLPS) run reorient --output-space LPS vol001_mr_t0_crop.nrrd ${tmpdir}/vol001_mr_t0_crop.nhdr check_results vol001_mr_t0_crop.nhdr vol001_mr_t0_crop.raw ;; registrationRigidMrPet) run registration -i --dofs 6 -o ${tmpdir} pat001_mr_T1.hdr pat001_pet.hdr check_results registration ;; registrationRigidMrCt) run registration -i --dofs 6 -o ${tmpdir} pat002_mr_T2.hdr pat002_ct.hdr check_results registration ;; registrationRigidCt) run registration --msd -i --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_ct.hdr check_results registration ;; registrationRigidPetMr) run registration -i --dofs 6 -o ${tmpdir} pat001_pet.hdr pat001_mr_T1.hdr check_results registration ;; registrationRigidCtMr) run registration -i --dofs 6 -o ${tmpdir} pat002_ct.hdr pat002_mr_T2.hdr check_results registration ;; registrationRigidMrPetNoSwap) run registration --no-switch -i --dofs 6 -o ${tmpdir} pat001_mr_T1.hdr pat001_pet.hdr check_results registration ;; registrationRigidMrCtNoSwap) run registration --no-switch -i --dofs 6 -o ${tmpdir} pat002_mr_T2.hdr pat002_ct.hdr check_results registration ;; registrationRigidPetMrDOF9) run registration -i --dofs 9 -o ${tmpdir} pat001_pet.hdr pat001_mr_T1.hdr check_results registration ;; registrationRigidCtMrDOF7) run registration -i --dofs 7 -o ${tmpdir} pat002_ct.hdr pat002_mr_T2.hdr check_results registration ;; registrationRigidLabelsDOF69) run registration --dofs 6 --dofs 9 --class-ref label --class-flt label -o ${tmpdir} parc1.hdr parc2.hdr check_results registration ;; registrationRigidCrop) run registration -v -i -e 2.0 -a 0.125 --sampling 0.25 --crop-index-ref 17,20,0,47,49,12 --crop-index-flt 12,15,0,52,54,12 --dofs 6 -o ${tmpdir} rat_fse_erly.hdr rat_fse_late.hdr check_results registration ;; sbaDefault) run sba -o ${tmpdir}/sba.nii -n 255 parc1.hdr parc2.hdr parc3.hdr check_results sba.nii ;; sbaOutliers) run sba --exclude-outliers -o ${tmpdir}/sba.nii -n 255 parc1.hdr parc1.hdr parc1.hdr parc1.hdr parc1.hdr parc2.hdr check_results sba.nii ;; sbaOutliers2) run sba --exclude-outliers -o ${tmpdir}/sba.nii -n 255 parc1.hdr parc2.hdr parc3.hdr check_results sba.nii ;; sbaiDefault) run sbai -o ${tmpdir}/sbai.nii -n 255 parc12_warp.xform parc13_warp.xform check_results sbai.nii ;; sequenceDefault) run_eval "cat numbers.txt | ${BINDIR}/sequence > ${tmpdir}/sequence.txt" check_results sequence.txt ;; sequenceFormat) run_eval "cat numbers.txt | ${BINDIR}/sequence --format %g > ${tmpdir}/sequence.txt" check_results sequence.txt ;; sequenceThresh) run_eval "cat numbers.txt | ${BINDIR}/sequence --thresh 1e4 > ${tmpdir}/sequence.txt" check_results sequence.txt ;; sequenceAbs) run_eval "cat numbers.txt | ${BINDIR}/sequence --abs > ${tmpdir}/sequence.txt" check_results sequence.txt ;; sequenceAbsThresh) run_eval "cat numbers.txt | ${BINDIR}/sequence --thresh 1000 --abs > ${tmpdir}/sequence.txt" check_results sequence.txt ;; similarityGrey) run_eval "${BINDIR}/similarity --histogram-text-file ${tmpdir}/histogram.txt rat_fse_erly.hdr rat_fse_late.hdr > ${tmpdir}/similarity.txt" check_results histogram.txt similarity.txt ;; similarityWithInf) run_eval "${BINDIR}/similarity float_with_inf.nii.gz float_with_inf.nii.gz > ${tmpdir}/similarity.txt" check_results similarity.txt ;; similarityLabels) run_eval "${BINDIR}/similarity --labels --histogram-text-file ${tmpdir}/histogram.txt parc1.hdr parc2.hdr > ${tmpdir}/similarity.txt" check_results histogram.txt similarity.txt ;; similarityGreyMask) run_eval "${BINDIR}/similarity --mask rat_fse_erly.hdr --histogram-text-file ${tmpdir}/histogram.txt rat_fse_erly.hdr rat_fse_late.hdr > ${tmpdir}/similarity.txt" check_results histogram.txt similarity.txt ;; similarityLabelsMask) run_eval "${BINDIR}/similarity --mask parc3_bin.hdr --labels --histogram-text-file ${tmpdir}/histogram.txt parc1.hdr parc2.hdr > ${tmpdir}/similarity.txt" check_results histogram.txt similarity.txt ;; splitAxial) run split --output-xform-path ${tmpdir}/split_ax_%1d.xform --axial spgr_3t.hdr ${tmpdir}/split_ax_%1d.hdr check_results split_ax_0.img split_ax_1.img split_ax_0.xform split_ax_1.xform ;; splitAxialSlices) run split --factor 0 --axial phantom_ax_downsampled.nii ${tmpdir}/slice_%1d.nii check_results slice_0.nii slice_1.nii slice_2.nii ;; splitAxialNrrd) run split --axial --factor 3 spgr_3t.hdr ${tmpdir}/split_ax_%1d.nhdr check_results split_ax_0.nhdr split_ax_0.raw split_ax_1.nhdr split_ax_1.raw split_ax_2.nhdr split_ax_2.raw ;; splitSagittal2) run split --output-xform-path ${tmpdir}/split_sa_%1d.xform --factor 2 --sagittal spgr_3t.hdr ${tmpdir}/split_sa_%1d.hdr check_results split_sa_0.img split_sa_1.img split_sa_0.xform split_sa_1.xform ;; splitCoronal3) run split --output-xform-path ${tmpdir}/split_co_%1d.xform --factor 3 --coronal spgr_3t.hdr ${tmpdir}/split_co_%1d.hdr check_results split_co_0.img split_co_1.img split_co_2.img split_co_0.xform split_co_1.xform split_co_2.xform ;; statisticsGrey) run_eval "${BINDIR}/statistics spgr_3t.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsPercentiles) run_eval "${BINDIR}/statistics -p 0.1 --percentile 0.5 -p 0.75 spgr_3t.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsGreyColumn) run_eval "${BINDIR}/statistics -C spgr_3t.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsGreyExpNotation) run_eval "${BINDIR}/statistics -E spgr_3t.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsGreyMask) run_eval "${BINDIR}/statistics -m spgr_3t_mask.hdr spgr_3t.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsGreyMultiMask) run_eval "${BINDIR}/statistics -M spgr_3t_mask.hdr spgr_3t.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsMaskMismatch) run_eval "${BINDIR}/statistics -M parc1.hdr spgr_3t.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsLabels) run_eval "${BINDIR}/statistics -l parc1.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsLabelsAllUpToHi) run_eval "${BINDIR}/statistics --mask-output-all-up-to 256 -l parc1.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; statisticsLabelsAllUpToLo) run_eval "${BINDIR}/statistics --mask-output-all-up-to 2 -l parc1.hdr > ${tmpdir}/statistics.txt" check_results statistics.txt ;; streamxformFordwardBackward) run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyzl" check_results vol001_t0_points.xyzl ;; streamxformAffineForward) run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --affine-only vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t1_points.xyzl" check_results vol001_t1_points.xyzl ;; streamxformAffineForwardBackward) run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --affine-only vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyzl" check_results vol001_t0_points.xyzl ;; streamxformFordwardBackwardTolerance) run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --inversion-tolerance 0.1 vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform > ${tmpdir}/vol001_t0_points.xyzl" check_results vol001_t0_points.xyzl ;; streamxformAffine) run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform vol001_mr_t0t1.list > ${tmpdir}/vol001_t0_points.xyzl" check_results vol001_t0_points.xyzl ;; streamxformAffineFromTo) run_eval "cat vol001_t0_points.xyzl | ${BINDIR}/streamxform --source-image vol001_mr_t0.hdr --target-image vol001_mr_t1.hdr vol001_mr_t0t1.list > ${tmpdir}/vol001_t0_points.xyzl" check_results vol001_t0_points.xyzl ;; symmetry_plane) run sympl --sampling 1 --levels 4 --accuracy 0.1 --write-xform ${tmpdir}/xform --sinc --write-subtract ${tmpdir}/subtract.hdr --write-marked ${tmpdir}/marked.nii --write-mirror ${tmpdir}/mirror.nii -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters xform subtract.img marked.nii mirror.nii ;; symmetry_planeThresh) run sympl --sampling 1 --levels 4 --accuracy 0.1 --min-value -224 --max-value 176 --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters aligned.img ;; symplx_Default) run symplx --sampling 1 --levels 4 --accuracy 0.1 --write-xform ${tmpdir}/xform --sinc --write-subtract ${tmpdir}/subtract.hdr --write-marked ${tmpdir}/marked.nii --write-mirror ${tmpdir}/mirror.nii -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters xform subtract.img marked.nii mirror.nii ;; symplx_Thresh) run symplx --sampling 1 --levels 4 --accuracy 0.1 --min-value -224 --max-value 176 --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters aligned.img ;; symplx_FixOffset) run symplx --sampling 1 --levels 4 --accuracy 0.1 --fix-offset --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters aligned.img ;; symplx_DefaultCUDA) run symplx_cuda --sampling 1 --levels 4 --accuracy 0.1 --write-xform ${tmpdir}/xform --sinc --write-subtract ${tmpdir}/subtract.hdr -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters xform subtract.img ;; symplx_ThreshCUDA) run symplx_cuda --sampling 1 --levels 4 --accuracy 0.1 --min-value -224 --max-value 176 --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters aligned.img ;; symplx_FixOffsetCUDA) run symplx_cuda --sampling 1 --levels 4 --accuracy 0.1 --fix-offset --cubic --write-aligned ${tmpdir}/aligned.hdr -o ${tmpdir}/parameters cad001_ct.hdr check_results parameters aligned.img ;; ttestDefault) run ttest -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; ttestOneSided) run ttest -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; ttestSymmetric) run ttest -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr --symmetric jacobian-01.nii jacobian-02.nii jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; ttestLog) run ttest --log -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; ttestAbsLog) run ttest --abs --log -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; ttestInvert) run ttest --invert -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; ttestPaired) run ttest --paired -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; ttestCrossCorrelation) run ttest --cross-correlation -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/pvals.hdr jacobian-01.nii jacobian-02.nii jacobian-03.nii -- jacobian-04.nii jacobian-03.nii jacobian-02.nii check_results ttest.img pvals.img ;; ttestZScores) run ttest --zscores -o ${tmpdir}/zscores.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii check_results zscores.img ;; ttestMask) run ttest --mask jacobian-mask.nii -o ${tmpdir}/ttest.hdr --tstats-file ${tmpdir}/tstats.hdr jacobian-01.nii jacobian-02.nii -- jacobian-03.nii jacobian-04.nii check_results ttest.img tstats.img ;; unsplitHdrAx) run unsplit --axial -o ${tmpdir}/unsplit.hdr split_ax_0.hdr split_ax_1.hdr check_results unsplit.hdr unsplit.img ;; unsplitHdrSa) run unsplit --sagittal -o ${tmpdir}/unsplit.hdr split_sa_0.hdr split_sa_1.hdr check_results unsplit.hdr unsplit.img ;; unsplitHdrCo) run unsplit --coronal -o ${tmpdir}/unsplit.hdr split_co_0.hdr split_co_1.hdr split_co_2.hdr check_results unsplit.hdr unsplit.img ;; unsplitHdrNrrdAx) run unsplit --axial -o ${tmpdir}/unsplit.nhdr split_ax_0.hdr split_ax_1.hdr check_results unsplit.nhdr unsplit.raw ;; unsplitHdrNrrdSa) run unsplit --sagittal -o ${tmpdir}/unsplit.nhdr split_sa_0.hdr split_sa_1.hdr check_results unsplit.nhdr unsplit.raw ;; unsplitHdrNrrdCo) run unsplit --coronal -o ${tmpdir}/unsplit.nhdr split_co_0.hdr split_co_1.hdr split_co_2.hdr check_results unsplit.nhdr unsplit.raw ;; unsplitNrrdNrrd) run unsplit --axial -o ${tmpdir}/unsplit.nhdr split_ax_0.nhdr split_ax_1.nhdr split_ax_2.nhdr check_results unsplit.nhdr unsplit.raw ;; unsplitSlices) run unsplit --axial -o ${tmpdir}/unsplit.nii phantom_ax_downsampled_slice_0.nii phantom_ax_downsampled_slice_1.nii phantom_ax_downsampled_slice_2.nii check_results unsplit.nii ;; unwarp_image_phantomSpacing) run unwarp_image_phantom --iterations-per-level 1 --final-cp-spacing 80 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomSpacingInverse) run unwarp_image_phantom --iterations-per-level 1 --final-cp-spacing 80 --fit-inverse magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomSpacingLevels) run unwarp_image_phantom --iterations-per-level 1 --final-cp-spacing 80 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomSpacingDirect) run unwarp_image_phantom --iterations-per-level 1 --no-fit-affine --final-cp-spacing 80 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomDims) run unwarp_image_phantom --iterations-per-level 1 --final-cp-dims 5,5,5 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomDimsLevels) run unwarp_image_phantom --iterations-per-level 1 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomDimsLevelsIterations) run unwarp_image_phantom --iterations-per-level 10 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomDimsLevelsThreshold) run unwarp_image_phantom --iterations-per-level 1 --rms-threshold 0.1 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomDimsLevelsIterationsThreshold) run unwarp_image_phantom --iterations-per-level 10 --rms-threshold 0.1 --final-cp-dims 5,5,5 --levels 3 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; unwarp_image_phantomDimsDefault) run unwarp_image_phantom --final-cp-dims 5,5,5 magphan.xml spgr_magphan.nii ${tmpdir}/ffd.xform check_results ffd.xform ;; volume_injection) run volume_injection --recon-grid-path spgr_3t.hdr -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.img ;; volume_injectionReconGrid) run volume_injection --recon-grid 49,65,35:3.75,3.75,3.75 -o ${tmpdir}/injection.nii --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.nii ;; volume_injectionReconGridOffset) run volume_injection --recon-grid 48,64,34:3.75,3.75,3.75:1.875,1.875,1.875 -o ${tmpdir}/injection.nii --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.nii ;; volume_injectionIsotropic) run volume_injection --recon-grid-path spgr_3t.hdr -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.img ;; volume_injectionNoXform) run volume_injection -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --exclude-first-image spgr_3t.hdr -- split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.img ;; volume_injectionNoXformIsotropic) run volume_injection -o ${tmpdir}/injection.hdr --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --exclude-first-image spgr_3t.hdr -- split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.img ;; volume_reconstructionFourthOrder) run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --linear --fourth-order-error --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --write-injected-image ${tmpdir}/injection.hdr split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.img reconstruction.img ;; volume_reconstructionCubic) run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --cubic --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --write-injected-image ${tmpdir}/injection.hdr split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.img reconstruction.img ;; volume_reconstructionNoXform) run volume_reconstruction -o ${tmpdir}/reconstruction.hdr --linear --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 --isotropic-injection --write-injected-image ${tmpdir}/injection.hdr --exclude-first-image spgr_3t.hdr -- split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results injection.img reconstruction.img ;; volume_reconstructionBoxPSF) run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --deblurring box --psf 0.9375,0.9375,1.25 --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results reconstruction.img ;; volume_reconstructionGaussianPSF) run volume_reconstruction --recon-grid-path spgr_3t.hdr -o ${tmpdir}/reconstruction.hdr --deblurring gaussian --psf 0.9375,0.9375,1.25 --num-iterations 2 --injection-kernel-sigma 0.5 --injection-kernel-radius 2 split_ax_0.hdr split_ax_01.xform split_ax_1.hdr check_results reconstruction.img ;; warpSingleLevel) run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --no-adaptive-fix -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpSingleLevelExact) run warp --fast --exploration 8 --grid-spacing 180 --exact-spacing --accuracy 1 --sampling 3 --no-adaptive-fix -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpInverseConsistentCC) run warp --fast --exploration 8 --grid-spacing 80 --accuracy 1 --ncc --ic-weight 1e-2 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpMultiLevel) run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpMultiLevelMatchHistograms) run warp --fast --exploration 8 --match-histograms --msd --grid-spacing 160 --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpMultiLevelDeltaFThreshold) run warp --fast --exploration 8 --delta-f-threshold 0.01 --msd --grid-spacing 160 --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpMultiLevelExact) run warp --fast --exploration 8 --grid-spacing 160 --exact-spacing --accuracy 1 --refine 1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpDelayRefine) run warp --fast --exploration 12 --grid-spacing 160 --accuracy 2 --refine 1 --delay-refine --sampling 6 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpEnergy) run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --refine 1 --energy-weight 1e-1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpEnergyRelax) run warp --fast --exploration 8 --grid-spacing 160 --accuracy 1 --refine 1 --energy-weight 1e-1 --relax 1e-2 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpJacobian) export CMTK_NUM_THREADS=1 run warp --fast --exploration 12 --grid-spacing 160 --accuracy 2 --refine 1 --jacobian-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list unset CMTK_NUM_THREADS check_results registration ;; warpRigidity) run warp --fast --exploration 12 --grid-spacing 160 --accuracy 2 --refine 1 --rigidity-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpLabels) run warp --fast --exploration 8 --grid-spacing 90 --accuracy 1 --refine 1 --class-ref label --class-flt label -o ${tmpdir} --initial parc1_parc2_9dof.xform parc1.hdr parc2.hdr check_results registration ;; warpxSingleLevel) run warpx --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --no-adaptive-fix -o ${tmpdir} --write-itk-xform ${tmpdir}/xform.tfm vol001_mr_t0t1.list check_results registration xform.tfm ;; warpxSingleLevelExact) run warpx --fast --max-stepsize 8 --grid-spacing 180 --exact-spacing --min-stepsize 1 --sampling 3 --no-adaptive-fix -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpxInverseConsistentCC) export CMTK_NUM_THREADS=1 run warpx --fast --max-stepsize 8 --grid-spacing 80 --min-stepsize 1 --ncc --inverse-consistency-weight 1e-2 -o ${tmpdir} vol001_mr_t0t1.list unset CMTK_NUM_THREADS check_results registration ;; warpxMultiLevel) run warpx --pad-flt -10000 --write-reformatted ${tmpdir}/reformat.nii --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration reformat.nii ;; warpxMultiLevelMatchHistograms) export CMTK_NUM_THREADS=1 run warpx --fast --max-stepsize 8 --match-histograms --msd --grid-spacing 160 --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list unset CMTK_NUM_THREADS check_results registration ;; warpxMultiLevelDeltaFThreshold) export CMTK_NUM_THREADS=1 run warpx --fast --max-stepsize 8 --delta-f-threshold 0.01 --msd --grid-spacing 160 --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list unset CMTK_NUM_THREADS check_results registration ;; warpxMultiLevelExact) run warpx --fast --max-stepsize 8 --grid-spacing 160 --exact-spacing --min-stepsize 1 --grid-refine 1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpxDelayRefine) run warpx --fast --max-stepsize 12 --grid-spacing 160 --min-stepsize 2 --grid-refine 1 --delay-refine --sampling 6 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpxEnergy) run warpx --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --grid-refine 1 --smoothness-constraint-weight 1e-1 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpxEnergyRelax) run warpx --fast --max-stepsize 8 --grid-spacing 160 --min-stepsize 1 --grid-refine 1 --smoothness-constraint-weight 1e-1 --constraint-relaxation-factor 1e-2 -o ${tmpdir} vol001_mr_t0t1.list check_results registration ;; warpxJacobian) export CMTK_NUM_THREADS=1 run warpx --fast --max-stepsize 12 --grid-spacing 160 --min-stepsize 2 --grid-refine 1 --jacobian-constraint-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list unset CMTK_NUM_THREADS check_results registration ;; warpxJacobianUnfold) export CMTK_NUM_THREADS=1 run warpx --fast --relax-to-unfold --max-stepsize 12 --grid-spacing 160 --min-stepsize 2 --grid-refine 1 --jacobian-constraint-weight 1e-1 --sampling 12 --omit-original-data -o ${tmpdir} vol001_mr_t0t1.list unset CMTK_NUM_THREADS check_results registration ;; warpxLabels) run warpx --fast --max-stepsize 8 --grid-spacing 90 --min-stepsize 1 --grid-refine 1 --class-ref label --class-flt label -o ${tmpdir} --initial parc1_parc2_9dof.xform parc1.hdr parc2.hdr check_results registration ;; vtkxform) run_eval "${BINDIR}/vtkxform vol001_mr_t0t1.list < polydata_ascii.vtk > ${tmpdir}/output.vtk" check_results output.vtk ;; vtkxformInverse) run_eval "${BINDIR}/vtkxform -- --inverse vol001_mr_t0t1.list < polydata_ascii.vtk > ${tmpdir}/output.vtk" check_results output.vtk ;; xform2dfieldWarpNrrd) run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0t1_warp.xform check_results dfield.nhdr dfield.raw ;; xform2dfieldAffineNrrd) run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform check_results dfield.nhdr dfield.raw ;; xform2dfieldDownsampleXYZNrrd) run xform2dfield -v --downsample 4,4,2 ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform check_results dfield.nhdr dfield.raw ;; xform2dfieldDownsampleXNrrd) run xform2dfield -v --downsample 4 ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform check_results dfield.nhdr dfield.raw ;; xform2dfieldConcatNrrd) run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform vol001_mr_t0t1_warp.xform check_results dfield.nhdr dfield.raw ;; xform2dfieldInverseNrrd) run xform2dfield -v ${tmpdir}/dfield.nhdr vol001_mr_t0_crop.hdr vol001_mr_t0_crop.xform --inverse vol001_mr_t0t1_warp.xform check_results dfield.nhdr dfield.raw ;; xform2scalarAffine) run xform2scalar --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1.list check_results magnitude.nii ;; xform2scalarAffineDoubleY) run xform2scalar --mode x-component --output ${tmpdir}/xcomponent.nii vol001_mr_t0.hdr vol001_mr_t0t1.list check_results xcomponent.nii ;; xform2scalarWarp) run xform2scalar --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform check_results magnitude.nii ;; xform2scalarWarpInverseError) run xform2scalar --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform --inverse vol001_mr_t0t1_warp.xform check_results magnitude.nii ;; xform2scalarWarpOnly) run xform2scalar --warp-only --float --output ${tmpdir}/magnitude.nii vol001_mr_t0.hdr vol001_mr_t0t1_warp.xform check_results magnitude.nii ;; xform2scalarDfield) run xform2scalar --float --output ${tmpdir}/magnitude.nii parc1.hdr parc1_parc2_dfield.nrrd check_results magnitude.nii ;; vol2csvLabels) run vol2csv -o ${tmpdir}/volumes.csv --labels-file sri24_ventricles.txt ncanda_t1_ventricles.nii ncanda_t1_pve_0.nii ncanda_t1_pve_1.nii ncanda_t1_pve_2.nii check_results volumes.csv ;; vol2csvScale) run vol2csv -o ${tmpdir}/volumes.csv --pixel-scale-image ncanda_t1_jacobian.nii ncanda_t1_ventricles.nii ncanda_t1_pve_0.nii ncanda_t1_pve_1.nii ncanda_t1_pve_2.nii check_results volumes.csv ;; help_film) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --help > ${tmpdir}/film.help" check_results film.help ;; help_all_film) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --help-all > ${tmpdir}/film.help" check_results film.help ;; xml_film) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --xml | ${sed} '//{ N; s/^.*$// }' > ${tmpdir}/film.xml" check_results film.xml ;; xml_gmm) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/gmm --xml | ${sed} '//{ N; s/^.*$// }' > ${tmpdir}/gmm.xml" check_results gmm.xml ;; xml_levelset) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/levelset --xml | ${sed} '//{ N; s/^.*$// }' > ${tmpdir}/levelset.xml" check_results levelset.xml ;; xml_mrbias) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/mrbias --xml | ${sed} '//{ N; s/^.*$// }' > ${tmpdir}/mrbias.xml" check_results mrbias.xml ;; xml_registration) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/registration --xml | ${sed} '//{ N; s/^.*$// }' > ${tmpdir}/registration.xml" check_results registration.xml ;; wiki_film) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --wiki > ${tmpdir}/film.wiki" check_results film.wiki ;; wiki_levelset) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/levelset --wiki > ${tmpdir}/levelset.wiki" check_results levelset.wiki ;; wiki_mrbias) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/mrbias --wiki > ${tmpdir}/mrbias.wiki" check_results mrbias.wiki ;; wiki_registration) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/registration --wiki > ${tmpdir}/registration.wiki" check_results registration.wiki ;; man_film) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/film --man | fgrep -v .TH > ${tmpdir}/film.man" check_results film.man ;; man_levelset) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/levelset --man | fgrep -v .TH > ${tmpdir}/levelset.man" check_results levelset.man ;; man_mrbias) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/mrbias --man | fgrep -v .TH > ${tmpdir}/mrbias.man" check_results mrbias.man ;; man_registration) run_eval "CMTK_CONSOLE_LINE_WIDTH=100 ${BINDIR}/registration --man | fgrep -v .TH > ${tmpdir}/registration.man" check_results registration.man ;; *) exit 2 ;; esac if [ "${tmpdir}" != "" ]; then rm -rf ${tmpdir} fi cmtk-3.0.0/testing/apps/CMakeLists.txt0000644000177700000170000006704012262344156016703 0ustar torstenman## ## Copyright 2004-2014 SRI International ## ## Copyright 1997-2011 Torsten Rohlfing ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 5099 $ ## ## $LastChangedDate: 2014-01-05 13:02:38 -0800 (Sun, 05 Jan 2014) $ ## ## $LastChangedBy: torsten_at_home $ ## FIND_PROGRAM(SH_PATH sh PATHS C:/cygwin/bin) SET(testDriver ${SH_PATH} ${CMAKE_CURRENT_BINARY_DIR}/appsTestDriver.sh) SET(testList "") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/appsTestDriver.sh.in ${CMAKE_CURRENT_BINARY_DIR}/appsTestDriver.sh @ONLY) # On Windows, remove "\r" (CR) from line ends, which would make Cygwin's sh choke IF(${CMAKE_SYSTEM_NAME} MATCHES "Windows") EXECUTE_PROCESS(COMMAND c:\\cygwin\\bin\\sed -i.bak s/\\r//g ${CMAKE_CURRENT_BINARY_DIR}/appsTestDriver.sh) ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows") # ========================================== # Tests for "avg_adm" tool LIST(APPEND testList avg_admDefault2 avg_admDefault3 avg_admJacobianFloat avg_admLabels avg_admPaddOutZeroNN avg_admNoReferenceModelCubic avg_admNoScaleModelAutoScale avg_admWithAffineNoRefData) # ========================================== # Tests for "dbtool" IF(CMTK_USE_SQLITE) LIST(APPEND testList dbtool_AddImages dbtool_AddImages2 dbtool_ListSpace dbtool_GetXform1 dbtool_GetXform2 dbtool_GetXform3 dbtool_GetXform4 dbtool_GetXform5 dbtool_GetXform6) ENDIF(CMTK_USE_SQLITE) # ========================================== # Tests for "describe" tool LIST(APPEND testList describeMountPoints describeMountPointsMulti describeMountPointsPrefix describeMountPointsPrefixInvalid describeBZip2a describeBZip2b describeLZMAa describeLZMAb describeXZa describeXZb describeEmpty describeDICOM describeMosaicDICOM describeMosaicPACSDICOM describeDICOMZ describeVanderbilt describeMR1 describeMR2 describeMR3 describeMR4 describeHuman describeMRBiorad describeMRBioradGz describeNiftiDetached348 describeEmbedAnalyze describeEmbedNifti describeXform describeXformMachine) IF(CMTK_BUILD_NRRD) LIST(APPEND testList describeMRNrrd1 describeMRNrrd2 describeNrrdNoOrigin describeEmbedNrrd) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "destripe" tool LIST(APPEND testList destripeDefault destripeKernelFloat) # ========================================== # Tests for "detect_adni_phantom" tool IF(CMTK_USE_FFTW) LIST(APPEND testList detect_adni_phantomDefault detect_adni_phantomRefineXform detect_adni_phantomRefineOutliers detect_adni_phantomExcludeOutliers detect_adni_phantomErodeNonStd detect_adni_phantomBadFOV detect_adni_phantomTolerantBadFOV detect_adni_phantomMissingSphere detect_adni_phantomBrokenSNR) ENDIF(CMTK_USE_FFTW) # ========================================== # Tests for "detect_spheres_matched_filter" tool IF(CMTK_USE_FFTW) LIST(APPEND testList detect_spheres_matched_filter detect_spheres_matched_filterNormalized) ENDIF(CMTK_USE_FFTW) # ========================================== # Tests for "epiunwarp" tool IF(CMTK_BUILD_NRRD) LIST(APPEND testList epiunwarp epiunwarpInitShift) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "fib2image" tool LIST(APPEND testList fib2image) # ========================================== # Tests for "fibxform" tool LIST(APPEND testList fibxform fibxformSourceTarget) # ========================================== # Tests for "groupwise_init" tool LIST(APPEND testList groupwise_initCenterFOV groupwise_initCentersOfMass groupwise_initCentersOfMassScale groupwise_initCentersOfMassTemplate) # ========================================== # Tests for "groupwise_affine" tool LIST(APPEND testList groupwise_affineFromInit groupwise_affineMatchHistograms groupwise_affineFromInitSampling groupwise_affineBackground groupwise_affineUseTemplate groupwise_affineZeroSumSmooth groupwise_affineRMIFromInit groupwise_affineRMIFromInitDeltaF groupwise_affineRMIFromInitSampling groupwise_affineRMIBackground groupwise_affineRMIZeroSumSmooth) # ========================================== # Tests for "groupwise_warp" tool LIST(APPEND testList groupwise_warpFromInit groupwise_warpFromInitProtect groupwise_warpFitFromInit groupwise_warpFromInitZeroSum groupwise_warpUseTemplate groupwise_warpUseTemplateMatchHistograms groupwise_warpMatchHistograms groupwise_warpFromInitNoBG groupwise_warpUseTemplateNoBG groupwise_warpRMIFromInit groupwise_warpRMIFitFromInit groupwise_warpRMIFromInitZeroSum ) # ========================================== # Tests for xml, wiki, man, and help markups IF(CMTK_USE_SQLITE) FOREACH(t film levelset mrbias registration) LIST(APPEND testList xml_${t} wiki_${t} man_${t}) ENDFOREACH(t film levelset mrbias registration) LIST(APPEND xml_gmm) ENDIF(CMTK_USE_SQLITE) FOREACH(t film) LIST(APPEND testList help_${t} help_all_${t}) ENDFOREACH(t film) # ========================================== # Tests for "concat_affine" tool LIST(APPEND testList concat_affineABA concat_affineABAInvert concat_affineAB1A concat_affineAA1 concat_affineA1A) # ========================================== # Tests for "average_images" tool LIST(APPEND testList average_imagesMean average_imagesMeanNormPadd average_imagesMeanAbsLog average_imagesVariance average_imagesStDev average_imagesEntropy average_imagesZScore) # ========================================== # Tests for "convert_warp" tool LIST(APPEND testList convert_warpFractional convert_warpDeformation) # ========================================== # Tests for "convertx" tool LIST(APPEND testList convertxType convertxBinarize convertxBinarizeOtsu convertxBinarizeOtsuNBins convertxPruneHighLow convertxPruneHigh convertxPruneLow convertxBoundaryMap convertxBoundaryMapMultiValue convertxConnectedComponents convertxCropThresholdWriteRegion convertxCropRegion1 convertxCropRegion2 convertxResample convertxDownsample convertxDownsampleNiftiSform convertxDownsampleNiftiQform convertxDownsampleNiftiQformSform convertxDownsampleSelect convertxDistanceUnsigned convertxDistanceSigned convertxDistanceSigned2 convertxFlipX convertxFlipYZ convertxErodeDilateErode convertxDilateErodeDilate convertxErodeByDistance convertxDilateByDistance convertxGaussianFilterSigma convertxGaussianFilterFWHM convertxHistogramEqualization convertxHistogramEqualizationNBins convertxLaplace convertxMapValues convertxMapValues2 convertxMapValues3 convertxMapValuesOnly convertxMapValuesOnly2 convertxMask convertxMaskInverse convertxMedianFilter1 convertxMedianFilter2 convertxMedianFilterXYZ convertxMeanFilter convertxFastMean0Filter convertxFastMean1Filter convertxFastMean2Filter convertxFastMean2PadFilter convertxVarianceFilter convertxFastVariance0Filter convertxFastVariance1Filter convertxFastVariance2Filter convertxFastVariance2PadFilter convertxThirdMomentFilter convertxStandardDeviationFilter convertxSmoothnessFilter convertxNiftiToAnalyze convertxNiftiToMetaImage convertxAnalyzeToNifti convertxAnalyzeToNiftiRAS convertxNiftiDetachedToNifti convertxAnalyzeToNiftiDetached convertxUncompressedNIFTI1 convertxUncompressedNIFTI2 convertxUncompressedNIFTI3 convertxUncompressedNIFTI4 convertxThresholdBelow convertxThresholdAbove convertxThresholdBelowToPadding convertxThresholdAboveToPadding convertxScaleToRange convertxRevert convertxReplacePadding convertxReplaceInfNaN) IF(CMTK_BUILD_NRRD) LIST(APPEND testList convertxDownsampleNrrd convertxDownsampleSelectNrrd) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "dcm2image" tool IF(CMTK_USE_DCMTK) LIST(APPEND testList dcm2image dcm2imageSubs dcm2imageZ dcm2imageEmbedPatientNameAnalyze dcm2imageEmbedPatientNameNifti dcm2imageEmbedSeriesDescriptionNifti dcm2imageEmbedStudyIDDateNifti dcm2imageMosaic dcm2imageMosaicPACS dcm2imageDiffusionGEXML dcm2imageDiffusionSiemensXML dcm2imageMosaicAnon dcm2imageMosaicPACSAnon dcm2imageDiffusionGEXMLAnon dcm2imageDiffusionSiemensXMLAnon dcm2imageExclude dcm2imageInclude dcm2imageSubsDirName) IF(CMTK_BUILD_NRRD) LIST(APPEND testList dcm2imageNrrd dcm2imageEmbedPatientNameNrrd) ENDIF(CMTK_BUILD_NRRD) ENDIF(CMTK_USE_DCMTK) # ========================================== # Tests for "dof2mat" tool LIST(APPEND testList dof2mat dof2matTranspose dof2matLegacy dof2matLegacyFwd dof2matFixed) # ========================================== # Tests for "filter" tool LIST(APPEND testList filterGaussian filterGaussianSmallKernel filterGaussianNoFilter filterRohlfing) # ========================================== # Tests for "film" tool LIST(APPEND testList filmCubic filmFourthOrder filmMSDLinearNoTrunc filmMISincRefSPGR) # ========================================== # Tests for "fit_affine_xform_landmarks" tool LIST(APPEND testList fit_affine_xform_landmarksRigid fit_affine_xform_landmarksScales fit_affine_xform_landmarksShear fit_affine_xform_landmarksRigidRigid fit_affine_xform_landmarksRigidRigidFlip fit_affine_xform_landmarksRigidScales fit_affine_xform_landmarksRigidShear) # ========================================== # Tests for "fit_affine_xform" tool LIST(APPEND testList fit_affine_xform fit_affine_xformRigid fit_affine_xformReverse) # ========================================== # Tests for "fit_affine_dfield" tool LIST(APPEND testList fit_affine_dfieldFFD) IF(CMTK_BUILD_NRRD) LIST(APPEND testList fit_affine_dfieldDField) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "fit_spline_dfield" tool IF(CMTK_BUILD_NRRD) LIST(APPEND testList fit_spline_dfieldSpacing fit_spline_dfieldSpacingMultiLevel fit_spline_dfieldDims fit_spline_dfieldDimsRelative fit_spline_dfieldDimsMultiLevel fit_spline_dfieldDimsMultiLevelSafe fit_spline_dfieldDimsWithAffine) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "fit_spline_xform" tool LIST(APPEND testList fit_spline_xformSpacing fit_spline_xformSpacingReverse fit_spline_xformSpacingMultiLevel fit_spline_xformDims fit_spline_xformDimsMultiLevel) # ========================================== # Tests for "glm" tool LIST(APPEND testList glmDefault glmNormalize glmExp glmNoConstant glmIgnore glmSelect glmCrop) # ========================================== # Tests for "gmm" tool LIST(APPEND testList gmmDefault gmmAlternative) # ========================================== # Tests for "gregxform" tool LIST(APPEND testList gregxformFordwardBackward gregxformAffine gregxformAffineFromWarp gregxformAffineFromWarpFwdBwd) # ========================================== # Tests for "hausdorff" tool LIST(APPEND testList hausdorffBinary12 hausdorffBinary21 hausdorffBinaryForced) # ========================================== # Tests for "histogram" tool LIST(APPEND testList histogram histogramNorm histogramBinsMinMax histogramBinsMinMaxTrunc histogramMask) # ========================================== # Tests for "imagemath" tool LIST(APPEND testList imagemathAbsPop imagemathSqrSqrt imagemathLogExp imagemathDupAddMulDiv imagemathThreshAboveBelow imagemathAverage imagemathVariance imagemathMaskAverage imagemathXor imagemathDupFillMaxValue imagemathAnd imagemathContractLabels imagemathMaxIndex imagemathMaxValue imagemathStackEntropyLabels imagemathVote imagemathProduct imagemathSTAPLE imagemathMultiClassSTAPLE imagemathMultiClassDisputedSTAPLE imagemathCombinePCA imagemathT2 imagemathAtan2 imagemathLogOddsAdd imagemathLogOddsAdd2 imagemathMatchMeanSDev imagemathMatchMeanSDev3 imagemathMatchHistograms imagemathMatchHistogramsPadding imagemathMatchHistogramsPadding2 imagemathMatchHistogramsPaddingUnset) # ========================================== # Tests for "interleaved_bad_slices" tool LIST(APPEND testList interleaved_bad_slicesDefault interleaved_bad_slicesStdDev1 interleaved_bad_slicesRMS interleaved_bad_slicesBulk) # ========================================== # Tests for "jidb" tool LIST(APPEND testList jidbGaussian jidbBoxFourthOrder jidbGaussianScale jidbMIRefSPGR) # ========================================== # Tests for "levelset" tool LIST(APPEND testList levelsetDefault levelsetScaleInitial levelsetBinarizeFastWideBinary ) # ========================================== # Tests for "lmsba" tool LIST(APPEND testList lmsbaRadius3 lmsbaRadius3Outliers lmsbaRadius3OutliersGlobal lmsbaRadius3Search1) # ========================================== # Tests for "lsba" tool LIST(APPEND testList lsbaRadius3 lsbaRadius3Outliers lsbaRadius3OutliersGlobal lsbaRadius3Search1) # ========================================== # Tests for "lvote" tool LIST(APPEND testList lvoteDefault lvoteGlobalWeights lvoteRadius3 lvoteOutliersGlobal) # ========================================== # Tests for "make_initial_affine" tool LIST(APPEND testList make_initial_affineCenterOfMass make_initial_affinePrincipalAxes1 make_initial_affinePrincipalAxes2 make_initial_affinePrincipalAxes3 make_initial_affinePrincipalAxes4 make_initial_affinePrincipalAxes5 make_initial_affinePrincipalAxes6) IF(CMTK_BUILD_NRRD) LIST(APPEND testList make_initial_affineDirectionVectorsNrrdAxSa make_initial_affineDirectionVectorsNrrdAxCo make_initial_affineDirectionVectorsNrrdSaCo make_initial_affineDirectionVectorsNrrdAxSaNative make_initial_affineDirectionVectorsNrrdAxCoNative make_initial_affineDirectionVectorsNrrdSaCoNative) ENDIF(CMTK_BUILD_NRRD) IF(CMTK_USE_SQLITE) LIST(APPEND testList make_initial_affineDB) ENDIF(CMTK_USE_SQLITE) # ========================================== # Tests for "mat2dof" tool LIST(APPEND testList mat2dof1 mat2dof2 mat2dofFile) # ========================================== # Multi-channel registration requires hash map to build IF(HAVE_STL_HASH_MAP) # ========================================== # Tests for "mcaffine" tool LIST(APPEND testList mcaffine1 mcaffine2 mcaffine3 mcaffine4) # ========================================== # Tests for "mcwarp" tool LIST(APPEND testList mcwarp1 mcwarp2 mcwarp3 mcwarp4 mcwarp5 mcwarp6) ENDIF(HAVE_STL_HASH_MAP) # ========================================== # Tests for "mk_adni_phantom" tool LIST(APPEND testList mk_adni_phantom2mm mk_adni_phantom2mmLabels) # ========================================== # Tests for "mk_analyze_hdr" tool LIST(APPEND testList mk_analyze_hdrDefault mk_analyze_hdrImport mk_analyze_hdrLittleEndian mk_analyze_hdrBigEndian) # ========================================== # Tests for "mk_nifti_hdr" tool LIST(APPEND testList mk_nifti_hdrDefault mk_nifti_hdrDescription mk_nifti_hdrImport mk_nifti_hdrDefaultAttached mk_nifti_hdrDescriptionAttached mk_nifti_hdrImportAttached) # ========================================== # Tests for "mk_phantom_3d" tool LIST(APPEND testList mk_phantom_3dBoxIndexed mk_phantom_3dBoxIndexedRange mk_phantom_3dBoxAbsolute mk_phantom_3dBoxRelative mk_phantom_3dSphereIndexed mk_phantom_3dSphereAbsolute mk_phantom_3dSphereAbsolute2 mk_phantom_3dSphereRelative mk_phantom_3dSphereRelative2 mk_phantom_3dBoxSphere mk_phantom_3dImport mk_phantom_3dImportGrid mk_phantom_3dMRSVoxel) # ========================================== # Tests for "reorient" tool LIST(APPEND testList reorientHdrSaToAx reorientHdrSaToAxNifti reorientHdrCoToAx reorientHdrAxToSa reorientHdrCoToSa reorientHdrAxToCo reorientHdrSaToCo) IF(CMTK_BUILD_NRRD) LIST(APPEND testList reorientNrrdToNrrd reorientNrrdToNrrdRAS reorientNrrdToNrrdSpaceLPS) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "split" tool LIST(APPEND testList splitAxial splitAxialSlices splitSagittal2 splitCoronal3) IF(CMTK_BUILD_NRRD) LIST(APPEND testList splitAxialNrrd) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "overlap" tool LIST(APPEND testList overlap overlapNumLabels overlapByLabel overlapFirst overlapFirstByLabel overlapFirstByLabelNumLabels) # ========================================== # Tests for "probe" tool LIST(APPEND testList probeIndexed probeAbsolute probeRelative probePhysical probeIndexedLinear probeIndexedCubic probeIndexedSinc) # ========================================== # Tests for "pxsearch" tool LIST(APPEND testList pxsearchIndexed pxsearchIndexedRadius3 pxsearchIndexedRadius311 pxsearchAbsolute pxsearchRelative pxsearchPhysical) # ========================================== # Tests for "registration" tool LIST(APPEND testList registrationAffineMrMrMSD registrationRigidMrPet registrationRigidMrCt registrationRigidCt registrationRigidPetMr registrationRigidCtMr registrationRigidMrPetNoSwap registrationRigidMrCtNoSwap registrationRigidPetMrDOF9 registrationRigidCtMrDOF7 registrationRigidLabelsDOF69 registrationRigidCrop registrationAutoLevelsRat4 registrationAutoLevelsRat2 registrationAutoLevelsRatToRat registrationAutoLevelsRatToRatDeltaFThreshold registrationAutoLevelsCt3 registrationFromList registrationWithInitial registrationWithInitialInverse) # ========================================== # Tests for "registrationx" tool LIST(APPEND testList registrationxAffineMrMrMSD registrationxShearNoScaleMrMrMSD registrationxFromList registrationxWithInitial registrationxWithInitialInverse registrationxAutoLevelsRat4 registrationxAutoLevelsRat4XY registrationxAutoLevelsRat4YZ registrationxAutoLevelsRat4XZ registrationxAutoLevelsRat4Symmetric registrationxAutoLevelsRat4NONE registrationxAutoLevelsRat4FOV registrationxAutoLevelsRat4COM registrationxAutoLevelsRat4PAX registrationxAutoLevelsRat2 registrationxAutoLevelsRat2Cubic registrationxAutoLevelsRat2Sinc registrationxAutoLevelsRat2NN registrationxAutoLevelsRatToRat registrationxAutoLevelsRatToRatDeltaFThreshold registrationxAutoLevelsRatToRatRMS registrationxAutoLevelsRatToRatNCC registrationxAutoLevelsRatToRatCR registrationxAutoLevelsRatToRatMI registrationxAutoLevelsLabelsNN registrationxAutoLevelsLabelsPV registrationxAutoLevelsCt3) IF(CMTK_USE_SQLITE) LIST(APPEND testList registrationxFromListDB registrationxWithInitialDB registrationxWithInitialInverseDB ) ENDIF(CMTK_USE_SQLITE) # ========================================== # Tests for "mrbias" tool LIST(APPEND testList mrbiasMulIncremental mrbiasMulAutoThresh mrbiasMulOtsuThresh mrbiasMulLogIntensity mrbiasAddMulMask) IF(CMTK_USE_CUDA) LIST(APPEND testList mrbiasMulIncrementalCUDA mrbiasMulLogIntensityCUDA mrbiasAddMulMaskCUDA) ENDIF(CMTK_USE_CUDA) # ========================================== # Tests for "reformatx" tool LIST(APPEND testList reformatxNoXform reformatxLinear ## reformatxLinearFwdBwd reformatxNearestNeighbor reformatxPartialVolume reformatxCubic reformatxCubicInverse reformatxSincCosine reformatxSincCosine5 reformatxMassPreserving reformatxJacobian reformatxInverseJacobian reformatxSincHamming reformatxTargetGrid reformatxTargetGridAnalyze reformatxTargetGridOffset) IF(CMTK_BUILD_NRRD) LIST(APPEND testList reformatxDfieldNrrd reformatxDfieldNrrdJacobian) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "sba" tool LIST(APPEND testList sbaDefault sbaOutliers sbaOutliers2) # ========================================== # Tests for "sbai" tool LIST(APPEND testList sbaiDefault) # ========================================== # Tests for "sequence" tool LIST(APPEND testList sequenceDefault sequenceFormat sequenceThresh sequenceAbs sequenceAbsThresh) # ========================================== # Tests for "similarity" tool LIST(APPEND testList similarityGrey similarityWithInf similarityLabels similarityGreyMask similarityLabelsMask) # ========================================== # Tests for "streamxform" tool LIST(APPEND testList streamxformFordwardBackward streamxformAffineForward streamxformAffineForwardBackward streamxformFordwardBackwardTolerance streamxformAffine streamxformAffineFromTo) # ========================================== # Tests for "sympl" tool LIST(APPEND testList symmetry_plane symmetry_planeThresh) # ========================================== # Tests for "symplx" tool LIST(APPEND testList symplx_Default symplx_Thresh symplx_FixOffset) IF(CMTK_USE_CUDA) LIST(APPEND testList symplx_DefaultCUDA symplx_ThreshCUDA symplx_FixOffsetCUDA) ENDIF(CMTK_USE_CUDA) # ========================================== # Tests for "statistics" tool LIST(APPEND testList statisticsGrey statisticsPercentiles statisticsGreyColumn statisticsGreyExpNotation statisticsGreyMask statisticsGreyMultiMask statisticsMaskMismatch statisticsLabels statisticsLabelsAllUpToHi statisticsLabelsAllUpToLo) # ========================================== # Tests for "stream_pixels" tool LIST(APPEND testList stream_pixels stream_pixelsConvert stream_pixelsReorient stream_pixelsEndian) # ========================================== # Tests for "ttest" tool LIST(APPEND testList ttestDefault ttestLog ttestAbsLog ttestInvert ttestPaired ttestCrossCorrelation ttestZScores ttestMask ttestOneSided) # ========================================== # Tests for "unsplit" tool LIST(APPEND testList unsplitHdrAx unsplitHdrSa unsplitHdrCo unsplitSlices) IF(CMTK_BUILD_NRRD) LIST(APPEND testList unsplitHdrNrrdAx unsplitHdrNrrdSa unsplitHdrNrrdCo unsplitNrrdNrrd) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "unwarp_image_phantom" tool LIST(APPEND testList unwarp_image_phantomSpacing unwarp_image_phantomSpacingInverse unwarp_image_phantomSpacingLevels unwarp_image_phantomSpacingDirect unwarp_image_phantomDims unwarp_image_phantomDimsLevels unwarp_image_phantomDimsLevelsIterations unwarp_image_phantomDimsLevelsThreshold unwarp_image_phantomDimsLevelsIterationsThreshold unwarp_image_phantomDimsDefault) # ========================================== # Tests for "volume_injection" tool LIST(APPEND testList volume_injection volume_injectionReconGrid volume_injectionReconGridOffset volume_injectionIsotropic volume_injectionNoXform volume_injectionNoXformIsotropic) # ========================================== # Tests for "volume_reconstruction" tool LIST(APPEND testList volume_reconstructionFourthOrder volume_reconstructionCubic volume_reconstructionNoXform volume_reconstructionBoxPSF volume_reconstructionGaussianPSF) # ========================================== # Tests for "warp" tool LIST(APPEND testList warpSingleLevel warpSingleLevelExact warpInverseConsistentCC warpMultiLevel warpMultiLevelMatchHistograms warpMultiLevelDeltaFThreshold warpMultiLevelExact warpDelayRefine warpEnergy warpEnergyRelax warpRigidity warpJacobian warpLabels) # ========================================== # Tests for "warpx" tool LIST(APPEND testList warpxSingleLevel warpxSingleLevelExact warpxInverseConsistentCC warpxMultiLevel warpxMultiLevelMatchHistograms warpxMultiLevelDeltaFThreshold warpxMultiLevelExact warpxDelayRefine warpxEnergy warpxEnergyRelax warpxJacobian warpxJacobianUnfold warpxLabels) # ========================================== # Tests for "xform2dfield" tool IF(CMTK_BUILD_NRRD) LIST(APPEND testList xform2dfieldWarpNrrd xform2dfieldAffineNrrd xform2dfieldDownsampleXYZNrrd xform2dfieldDownsampleXNrrd xform2dfieldConcatNrrd xform2dfieldInverseNrrd) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Tests for "xform2scalar" tool LIST(APPEND testList xform2scalarAffine xform2scalarAffineDoubleY xform2scalarWarp xform2scalarWarpInverseError xform2scalarWarpOnly) # ========================================== # Tests for "vol2csv" tool LIST(APPEND testList vol2csvLabels vol2csvScale) # ========================================== # Tests for "vtkxform" tool LIST(APPEND testList vtkxform vtkxformInverse) IF(CMTK_BUILD_NRRD) LIST(APPEND testList xform2scalarDfield) ENDIF(CMTK_BUILD_NRRD) # ========================================== # Set up all tests FOREACH(testName ${testList}) IF(CMTK_TESTING_MEMORYCHECK) ADD_TEST(NAME ${testName} COMMAND ${testDriver} ${testName} $ ${MEMORYCHECK_COMMAND}) ELSE(CMTK_TESTING_MEMORYCHECK) ADD_TEST(NAME ${testName} COMMAND ${testDriver} ${testName} $) ENDIF(CMTK_TESTING_MEMORYCHECK) ENDFOREACH(testName ${testList}) SET_TESTS_PROPERTIES(groupwise_warpFromInit PROPERTIES TIMEOUT 4800) SET_TESTS_PROPERTIES(groupwise_warpFitFromInit PROPERTIES TIMEOUT 4800) SET_TESTS_PROPERTIES(groupwise_warpFromInitZeroSum PROPERTIES TIMEOUT 4800) SET_TESTS_PROPERTIES(groupwise_warpUseTemplate PROPERTIES TIMEOUT 6400) SET_TESTS_PROPERTIES(groupwise_warpFromInitNoBG PROPERTIES TIMEOUT 4800) SET_TESTS_PROPERTIES(groupwise_warpUseTemplateNoBG PROPERTIES TIMEOUT 6400) SET_TESTS_PROPERTIES(groupwise_warpRMIFromInit groupwise_warpRMIFitFromInit groupwise_warpRMIFromInitZeroSum PROPERTIES TIMEOUT 4800) # ========================================== # Set up test properties, now that the tests # have been defined. SET_TESTS_PROPERTIES(avg_admLabels filmFourthOrder jidbGaussian jidbGaussianScale volume_reconstructionGaussianPSF volume_reconstructionNoXform PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(filmCubic PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(filmMSDLinearNoTrunc PROPERTIES TIMEOUT 3600) SET_TESTS_PROPERTIES(filmMISincRefSPGR PROPERTIES TIMEOUT 3600) SET_TESTS_PROPERTIES(jidbMIRefSPGR PROPERTIES TIMEOUT 3600) SET_TESTS_PROPERTIES(registrationxShearNoScaleMrMrMSD PROPERTIES TIMEOUT 900) IF(HAVE_STL_HASH_MAP) SET_TESTS_PROPERTIES(mcaffine2 PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(mcwarp1 mcwarp2 mcwarp3 mcwarp4 mcwarp5 mcwarp6 PROPERTIES TIMEOUT 1800) ENDIF(HAVE_STL_HASH_MAP) SET_TESTS_PROPERTIES(mrbiasAddMulMask PROPERTIES TIMEOUT 3600) SET_TESTS_PROPERTIES(mrbiasMulIncremental PROPERTIES TIMEOUT 3600) SET_TESTS_PROPERTIES(mrbiasMulLogIntensity PROPERTIES TIMEOUT 3600) SET_TESTS_PROPERTIES(volume_reconstructionCubic PROPERTIES TIMEOUT 2400) SET_TESTS_PROPERTIES(volume_reconstructionFourthOrder PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(warpDelayRefine PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(warpInverseConsistentCC PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(warpLabels PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(warpMultiLevel PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(warpMultiLevelExact PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(warpSingleLevel PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(warpSingleLevelExact PROPERTIES TIMEOUT 1800) SET_TESTS_PROPERTIES(xform2scalarWarpInverseError PROPERTIES TIMEOUT 1800) cmtk-3.0.0/CMakeLists.txt0000644000177700000170000006620012263604605014257 0ustar torstenman## ## Copyright 1997-2010 Torsten Rohlfing ## ## Copyright 2004-2014 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 5127 $ ## ## $LastChangedDate: 2014-01-09 12:41:41 -0800 (Thu, 09 Jan 2014) $ ## ## $LastChangedBy: torstenrohlfing $ ## ## ## This file used to borrow heavily from the analogous InsightToolkit file. ## It may have evolved away since then, however. ## CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required IF(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) ## libraries with full paths vs. search paths ENDIF(COMMAND cmake_policy) SET(CMAKE_OVERRIDE_COMPILER_MISMATCH 1) PROJECT(CMTK) SET(CMTK_VERSION_MAJOR "3") SET(CMTK_VERSION_MINOR "0") SET(CMTK_VERSION_PATCH "0") SET(CMTK_VERSION_STRING "${CMTK_VERSION_MAJOR}.${CMTK_VERSION_MINOR}.${CMTK_VERSION_PATCH}") #----------------------------------------------------------------------------- # Test for some required system information. INCLUDE (${CMAKE_ROOT}/Modules/CMakeDetermineSystem.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake) #----------------------------------------------------------------------------- # On Mac, if we have MacPorts installed, we need to look for libraries in # /opt/local. MESSAGE(STATUS "System is " ${CMAKE_SYSTEM}) IF(CMAKE_SYSTEM MATCHES "Darwin.*") IF(EXISTS /opt/local) LIST(INSERT CMAKE_PREFIX_PATH 0 "/opt/local") ENDIF(EXISTS /opt/local) ENDIF(CMAKE_SYSTEM MATCHES "Darwin.*") #----------------------------------------------------------------------------- # Output directories. IF(NOT LIBRARY_OUTPUT_PATH) SET (LIBRARY_OUTPUT_PATH ${CMTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.") ENDIF(NOT LIBRARY_OUTPUT_PATH) IF(NOT EXECUTABLE_OUTPUT_PATH) SET (EXECUTABLE_OUTPUT_PATH ${CMTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.") ENDIF(NOT EXECUTABLE_OUTPUT_PATH) MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) IF(NOT CMTK_BUILD_LIB_DIR) # variable used for generating CMTKConfig.cmake for the build tree SET(CMTK_BUILD_LIB_DIR "/bin") ENDIF(NOT CMTK_BUILD_LIB_DIR) SET(CMTK_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}") SET(CMTK_EXECUTABLE_PATH "${EXECUTABLE_OUTPUT_PATH}") SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) # set CMTK_DIR so it can be used by subprojects SET(CMTK_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "CMTK dir to be used by subprojects") #----------------------------------------------------------------------------- # Setup install target directories IF(NOT CMTK_INSTALL_BIN_DIR) SET(CMTK_INSTALL_BIN_DIR bin CACHE PATH "Binary files will be installed here") ENDIF(NOT CMTK_INSTALL_BIN_DIR) IF(NOT CMTK_INSTALL_LIB_DIR) # 64 bit libraries are not installed in the same directories on solaris # Ref: http://docs.sun.com/app/docs/doc/816-5138/6mba6ua5m?a=view SET(sun64 ) IF(CMAKE_SYSTEM MATCHES "SunOS.*" AND CMAKE_SIZEOF_VOID_P EQUAL 8) EXEC_PROGRAM("uname" ARGS "-p" OUTPUT_VARIABLE sunproc ) IF("${sunproc}" STREQUAL "sparc") SET(sun64 "/sparcv9") ENDIF("${sunproc}" STREQUAL "sparc") IF("${sunproc}" STREQUAL "i386") SET(sun64 "/amd64") ENDIF("${sunproc}" STREQUAL "i386") IF("${sun64}" STREQUAL "") # sun64 is not set - solaris has been ported to a new architecture? MESSAGE("Warning: Unknown processor '${sunproc}'. The libraries may not be installed in the right place.") ENDIF("${sun64}" STREQUAL "") ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*" AND CMAKE_SIZEOF_VOID_P EQUAL 8) SET(CMTK_INSTALL_LIB_DIR "lib${sun64}/cmtk" CACHE PATH "Library files will be installed here") ENDIF(NOT CMTK_INSTALL_LIB_DIR) IF(NOT CMTK_INSTALL_DATA_DIR) SET(CMTK_INSTALL_DATA_DIR "share/cmtk" CACHE PATH "Data files will be installed here") ENDIF(NOT CMTK_INSTALL_DATA_DIR) IF(NOT CMTK_INSTALL_INCLUDE_DIR) SET(CMTK_INSTALL_INCLUDE_DIR "include/cmtk" CACHE PATH "Include files will be installed here") ENDIF(NOT CMTK_INSTALL_INCLUDE_DIR) #----------------------------------------------------------------------------- # Check for system headers. INCLUDE (CheckIncludeFiles) CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H) CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H) CHECK_INCLUDE_FILES (fcntl.h HAVE_FCNTL_H) CHECK_INCLUDE_FILES (ieeefp.h HAVE_IEEEFP_H) CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H) CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H) CHECK_INCLUDE_FILES (pthread.h HAVE_PTHREAD_H) CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H) CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H) CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H) CHECK_INCLUDE_FILES (values.h HAVE_VALUES_H) CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H) CHECK_INCLUDE_FILES (sys/procfs.h HAVE_SYS_PROCFS_H) CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILES (sys/time.h HAVE_SYS_TIME_H) CHECK_INCLUDE_FILES (sys/times.h HAVE_SYS_TIMES_H) CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H) CHECK_INCLUDE_FILES (sys/utsname.h HAVE_SYS_UTSNAME_H) IF(HAVE_SYS_STAT_H) SET(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h) ENDIF(HAVE_SYS_STAT_H) CHECK_TYPE_SIZE("((struct stat*)0)->st_mode" SIZEOF_ST_SIZE) IF(SIZEOF_ST_SIZE EQUAL 4) CHECK_TYPE_SIZE("struct stat64" CMTK_USE_STAT64) ENDIF(SIZEOF_ST_SIZE EQUAL 4) SET(CMAKE_EXTRA_INCLUDE_FILES) INCLUDE(TestBigEndian) TEST_BIG_ENDIAN(WORDS_BIGENDIAN) #----------------------------------------------------------------------------- # Test NaN high bit INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestQnanhibit.cmake) TEST_QNANHIBIT(QNANHIBIT_VALUE ${CMAKE_CURRENT_SOURCE_DIR}/CMake) IF(QNANHIBIT_VALUE) SET(QNANHIBIT 1 CACHE INTERNAL "The 22nd bit of 32-bit floating-point quiet NaN.") ELSE(QNANHIBIT_VALUE) SET(QNANHIBIT 0 CACHE INTERNAL "The 22nd bit of 32-bit floating-point quiet NaN.") ENDIF(QNANHIBIT_VALUE) #----------------------------------------------------------------------------- # Check for at least one of the typical STL hash map implementations INCLUDE (CheckIncludeFileCXX) CHECK_INCLUDE_FILE_CXX(unordered_map HAVE_UNORDERED_MAP) IF(NOT HAVE_UNORDERED_MAP) CHECK_INCLUDE_FILE_CXX(hash_map HAVE_HASH_MAP) IF(NOT HAVE_HASH_MAP) CHECK_INCLUDE_FILE_CXX(hash_map.h HAVE_HASH_MAP_H) ENDIF(NOT HAVE_HASH_MAP) ENDIF(NOT HAVE_UNORDERED_MAP) # set a single flag is we have ANY hash map implementation in STL SET(HAVE_STL_HASH_MAP ${HAVE_UNORDERED_MAP}${HAVE_HASH_MAP}${HAVE_HASH_MAP_H} CACHE INTERNAL "Flag for presence of ANY hash map implementation in the C++ STL") #----------------------------------------------------------------------------- # build configuration options. OPTION(BUILD_SHARED_LIBS "Build CMTK with shared libraries." OFF) SET(CMTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) OPTION(CMTK_BUILD_WRAPPER "Build 'cmtk' wrapper script and install all actual executables in a private directory to avoid name collisions" ON) MARK_AS_ADVANCED(CMTK_BUILD_WRAPPER) OPTION(CMTK_BUILD_UNSTABLE "Build 'unstable' library and tools" OFF) MARK_AS_ADVANCED(CMTK_BUILD_UNSTABLE) OPTION(CMTK_BUILD_STACKTRACE "Build tools with stack trace printing in case of crash (increases build time)" ON) MARK_AS_ADVANCED(CMTK_BUILD_STACKTRACE) OPTION(CMTK_BUILD_DEMO "Build demonstration code. Strange things will happen if you turn this on." OFF) MARK_AS_ADVANCED(CMTK_BUILD_DEMO) IF(CMTK_BUILD_DEMO) MESSAGE( WARNING "Demo mode is enabled. Make sure not to use this build for production use!") ENDIF(CMTK_BUILD_DEMO) #----------------------------------------------------------------------------- # Add an option to use or not to use SMP multi-core parallelism OPTION(CMTK_USE_SMP "Enable shared-memory parallelism (requires at least POSIX Threads, OpenMP, or Windows threads)" ON) #----------------------------------------------------------------------------- # Add an option to enable or disable POSIX threads if pthread.h header exists IF(HAVE_PTHREAD_H) OPTION(CMTK_USE_PTHREADS "Use POSIX Threads for SMP parallelism" ON) MARK_AS_ADVANCED(CMTK_USE_PTHREADS) IF(NOT CMTK_USE_SMP) SET(CMTK_USE_PTHREADS OFF) ENDIF(NOT CMTK_USE_SMP) ENDIF(HAVE_PTHREAD_H) #----------------------------------------------------------------------------- # for the gnu compiler a -D_PTHREADS is needed on sun # for the native compiler a -mt flag is needed on the sun IF(CMTK_USE_PTHREADS) IF(${CMAKE_SYSTEM} MATCHES "SunOS.*") IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMTK_REQUIRED_CXX_FLAGS "${CMTK_REQUIRED_CXX_FLAGS} -D_PTHREADS") ELSE(CMAKE_COMPILER_IS_GNUCXX) SET(CMTK_REQUIRED_CXX_FLAGS "${CMTK_REQUIRED_CXX_FLAGS} -mt") SET(CMTK_REQUIRED_C_FLAGS "${CMTK_REQUIRED_C_FLAGS} -mt") ENDIF(CMAKE_COMPILER_IS_GNUCXX) ENDIF(${CMAKE_SYSTEM} MATCHES "SunOS.*") ENDIF(CMTK_USE_PTHREADS) # mingw thread support IF(MINGW) SET(CMTK_REQUIRED_CXX_FLAGS "${CMTK_REQUIRED_CXX_FLAGS} -mthreads") SET(CMTK_REQUIRED_C_FLAGS "${CMTK_REQUIRED_C_FLAGS} -mthreads") SET(CMTK_REQUIRED_LINK_FLAGS "${CMTK_REQUIRED_LINK_FLAGS} -mthreads") ENDIF(MINGW) #----------------------------------------------------------------------------- # Check for, and configure, OpenMP IF(NOT DEFINED CMTK_USE_OPENMP) FIND_PACKAGE(OpenMP) IF(OPENMP_FOUND) OPTION(CMTK_USE_OPENMP "Use OpenMP for SMP parallelism" ON) MARK_AS_ADVANCED(CMTK_USE_OPENMP) IF(NOT CMTK_USE_SMP) SET(CMTK_USE_OPENMP OFF) ENDIF(NOT CMTK_USE_SMP) ENDIF(OPENMP_FOUND) ENDIF(NOT DEFINED CMTK_USE_OPENMP) IF(CMTK_USE_OPENMP) SET(CMTK_REQUIRED_CXX_FLAGS "${CMTK_REQUIRED_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") SET(CMTK_REQUIRED_LINK_FLAGS "${CMTK_REQUIRED_LINK_FLAGS} ${OpenMP_C_FLAGS}") ENDIF(CMTK_USE_OPENMP) #----------------------------------------------------------------------------- # Check for, and configure, Grand Central Dispatch CHECK_INCLUDE_FILES(dispatch/dispatch.h HAVE_DISPATCH_H) IF(HAVE_DISPATCH_H) OPTION(CMTK_USE_GCD "Use Grand Central Dispatch for SMP parallelism with system-level load balancing" ON) IF(NOT CMTK_USE_SMP) SET(CMTK_USE_GCD OFF) ENDIF(NOT CMTK_USE_SMP) IF(CMTK_USE_GCD) ENDIF(CMTK_USE_GCD) ENDIF(HAVE_DISPATCH_H) #----------------------------------------------------------------------------- # Check for, and configure, CUDA OPTION(CMTK_USE_CUDA "Use CUDA for GPU computing" OFF) IF(CMTK_USE_CUDA) # check using cmake's own FindCUDA above v2.8 or use our own for earlier versions IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STRLESS 2.8) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindCUDA.cmake) ELSE (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STRLESS 2.8) FIND_PACKAGE(CUDA) ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STRLESS 2.8) ENDIF(CMTK_USE_CUDA) #----------------------------------------------------------------------------- # Check whether compiler supports variable-size automatic arrays, i.e., # things like "const int size = 10; const char string[size];" rather than # "const char string[10];" INCLUDE(${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake) CHECK_CXX_SOURCE_COMPILES("class A {}; class B : public A {}; int main() { int size = 10; B array[size]; }" CMTK_COMPILER_VAR_AUTO_ARRAYSIZE) #----------------------------------------------------------------------------- # Configure Dart testing support. This should be done before any # MESSAGE(FATAL_ERROR ...) commands are invoked. INCLUDE(${CMAKE_ROOT}/Modules/CTest.cmake) MARK_AS_ADVANCED(TCL_TCLSH DART_ROOT) ENABLE_TESTING() IF(BUILD_TESTING) SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard") MARK_AS_ADVANCED(BUILDNAME) OPTION(CMTK_TESTING_MEMORYCHECK "Test using memory checking" OFF) MARK_AS_ADVANCED(CMTK_TESTING_MEMORYCHECK) IF(NOT CMTK_DATA_ROOT) GET_FILENAME_COMPONENT(CMTK_SVN_ROOT ${CMAKE_CURRENT_SOURCE_DIR} PATH) SET(CMTK_DATA_ROOT ${CMTK_SVN_ROOT}/data CACHE PATH "Root directory of the CMTK data tree") ENDIF(NOT CMTK_DATA_ROOT) MARK_AS_ADVANCED(CMTK_DATA_ROOT) ENDIF(BUILD_TESTING) SET(CMTK_ROOT_PATH_SRI24 "CMTK_ROOT_PATH_SRI24-NOTFOUND" CACHE PATH "Root path of the SRI24 atlas data (usually ends with \"sri24\")" ) #----------------------------------------------------------------------------- # Configure Doxygen support FIND_PACKAGE(Doxygen) IF(DOXYGEN_FOUND) OPTION(BUILD_DOCUMENTATION "Build html-based library API documentation using Doxygen" OFF) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) IF(BUILD_DOCUMENTATION) ADD_CUSTOM_TARGET(doc COMMAND doxygen DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ DESTINATION ${CMTK_INSTALL_DATA_DIR}/doc/html/ COMPONENT documentation) ENDIF(BUILD_DOCUMENTATION) ENDIF(DOXYGEN_FOUND) #----------------------------------------------------------------------------- # Add an option to use double-precision floats for coordinates. OPTION(CMTK_COORDINATES_DOUBLE "Use double precision floats for coordinates (turn off to save memory)" ON) MARK_AS_ADVANCED(CMTK_COORDINATES_DOUBLE) OPTION(CMTK_DATA_DOUBLE "Use double precision floats for data exchange between typed arrays" ON) MARK_AS_ADVANCED(CMTK_DATA_DOUBLE) OPTION(CMTK_NUMERICS_DOUBLE "Use double precision floats for numerical algorithms" ON) MARK_AS_ADVANCED(CMTK_NUMERICS_DOUBLE) #----------------------------------------------------------------------------- # Add an option to use or not use zlib library OPTION(CMTK_BUILD_ZLIB "Build bundled zlib library, even if system zlib exists" OFF) FIND_PACKAGE(ZLIB) IF(CMTK_BUILD_ZLIB) MESSAGE( STATUS "Building bundled zlib by user configuration" ) SET(CMTK_BUILD_ZLIB 1) SET(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/zlib") SET(ZCONF_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Utilities/zlib") SET(ZLIB_LIBRARIES "cmtkZlib" CACHE INTERNAL "") SET(ZLIB_INCLUDE_DIRS ${ZCONF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) ELSE(CMTK_BUILD_ZLIB) IF(ZLIB_FOUND) MESSAGE( STATUS "Using system zlib" ) ELSE(ZLIB_FOUND) MESSAGE( STATUS "Building bundled zlib due to missing system zlib" ) SET(CMTK_BUILD_ZLIB 1) SET(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/zlib") SET(ZCONF_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Utilities/zlib") SET(ZLIB_LIBRARIES "cmtkZlib" CACHE INTERNAL "") SET(ZLIB_INCLUDE_DIRS ${ZCONF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) ENDIF(ZLIB_FOUND) ENDIF(CMTK_BUILD_ZLIB) INCLUDE_DIRECTORIES(BEFORE ${ZLIB_INCLUDE_DIRS}) #----------------------------------------------------------------------------- # Add an option to use or not use mxml library OPTION(CMTK_BUILD_MXML "Build bundled mxml library, even if system library exists" OFF) FIND_PACKAGE(MXML) IF(CMTK_BUILD_MXML) MESSAGE( STATUS "Building bundled mxml by user configuration" ) SET(CMTK_BUILD_MXML 1) SET(MXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/mxml") INCLUDE_DIRECTORIES(BEFORE ${MXML_INCLUDE_DIR}) SET(MXML_LIBRARIES "cmtkMxml" CACHE INTERNAL "") ELSE(CMTK_BUILD_MXML) IF(NOT MXML_FOUND OR ${MXML_VERSION} STRLESS 2.7) IF(NOT MXML_FOUND) MESSAGE( STATUS "Building bundled mxml due to missing system mxml" ) ELSE(NOT MXML_FOUND) MESSAGE( STATUS "Building bundled mxml due to outdated system mxml (minimum version required is 2.7, installed version is ${MXML_VERSION})" ) ENDIF(NOT MXML_FOUND) SET(CMTK_BUILD_MXML 1) SET(MXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/mxml") INCLUDE_DIRECTORIES(BEFORE ${MXML_INCLUDE_DIR}) SET(MXML_LIBRARIES "cmtkMxml" CACHE INTERNAL "") ELSE(NOT MXML_FOUND OR ${MXML_VERSION} STRLESS 2.7) MESSAGE( STATUS "Using system mxml version ${MXML_VERSION}" ) ENDIF(NOT MXML_FOUND OR ${MXML_VERSION} STRLESS 2.7) ENDIF(CMTK_BUILD_MXML) #----------------------------------------------------------------------------- # Add an option to use or not use bzip2 library OPTION(CMTK_USE_BZIP2 "Compile support for on-the-fly BZip2 decompression" ON) IF(CMTK_USE_BZIP2) FIND_PACKAGE(BZip2) IF(BZIP2_FOUND) MESSAGE( STATUS "Found system libbz2" ) SET(CMTK_BZIP2_LIBS ${BZIP2_LIBRARIES}) ELSE(BZIP2_FOUND) SET(CMTK_USE_BZIP2 OFF) ENDIF(BZIP2_FOUND) ENDIF(CMTK_USE_BZIP2) #----------------------------------------------------------------------------- # Add an option to use or not use lzma decompression library OPTION(CMTK_USE_LZMA "Compile support for on-the-fly LZMA decompression" ON) IF(CMTK_USE_LZMA) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindLZMA.cmake) IF(LZMA_FOUND) MESSAGE( STATUS "Found system lzma library" ) SET(CMTK_LZMA_LIBS ${LZMA_LIBRARY}) ELSE(LZMA_FOUND) SET(CMTK_USE_LZMA OFF) ENDIF(LZMA_FOUND) ENDIF(CMTK_USE_LZMA) IF(CMTK_USE_LZMA) INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR}) ENDIF(CMTK_USE_LZMA) #----------------------------------------------------------------------------- # Add an option to build with DICOM support OPTION(CMTK_USE_DCMTK "Build with optional DICOM support" ON) IF(CMTK_USE_DCMTK) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindConfigDCMTK.cmake) OPTION(CMTK_BUILD_DCMTK "Build bundled DCMTK library, even if system library exists" OFF) IF(NOT DCMTK_FOUND) MESSAGE( STATUS "DCMTK library not found - defaulting to bundled version." ) SET(CMTK_BUILD_DCMTK ON CACHE BOOL "Build bundled DCMTK library, even if system library exists" FORCE ) ENDIF(NOT DCMTK_FOUND) IF(CMTK_BUILD_DCMTK) MESSAGE( STATUS "Building bundled DCMTK library for DICOM support." ) SET(DCMTK_SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/dcmtk) SET(DCMTK_BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/Utilities/dcmtk) SET(DCMTK_INCLUDE_DIR "${DCMTK_SOURCE_ROOT}") SET(DCMTK_INCLUDE_DIRS "${DCMTK_BINARY_ROOT};${DCMTK_INCLUDE_DIR};${DCMTK_INCLUDE_DIR}/dcmtk/dcmjpeg;${DCMTK_INCLUDE_DIR}/dcmtk/dcmimage;${DCMTK_INCLUDE_DIR}/dcmtk/dcmimgle;${DCMTK_INCLUDE_DIR}/dcmtk/dcmdata;${DCMTK_INCLUDE_DIR}/dcmtk/ofstd") INCLUDE_DIRECTORIES(BEFORE ${DCMTK_INCLUDE_DIRS}) SET(DCMTK_LIBRARIES "D4CMTK") ELSE(CMTK_BUILD_DCMTK) MESSAGE( STATUS "Using system DCMTK library." ) # system DCMTK should support jpeg ADD_DEFINITIONS(-DCMTK_USE_DCMTK_JPEG) ENDIF(CMTK_BUILD_DCMTK) IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") ADD_DEFINITIONS(-DHAVE_CONFIG_H) SET(CMTK_REQUIRED_CXX_FLAGS "${CMTK_REQUIRED_CXX_FLAGS} -DHAVE_CONFIG_H") ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") ELSE(CMTK_USE_DCMTK) MESSAGE( STATUS "Building without DICOM support." ) SET(CMTK_BUILD_DCMTK OFF) UNSET(DCMTK_INCLUDE_DIRS CACHE) UNSET(DCMTK_LIBRARIES CACHE) ENDIF(CMTK_USE_DCMTK) #----------------------------------------------------------------------------- # Add an option to use or not use sqlite3 library OPTION(CMTK_USE_SQLITE "Use sqlite3 library for optional database support" OFF) IF(CMTK_USE_SQLITE) OPTION(CMTK_BUILD_SQLITE "Build bundled sqlite3 library, even if system library exists" OFF) IF(CMTK_BUILD_SQLITE) MESSAGE( STATUS "Building bundled sqlite3 library by user configuration" ) SET(CMTK_BUILD_SQLITE 1) SET(SQLITE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/sqlite3") SET(CMTK_SQLITE_LIB "cmtksqlite3" CACHE INTERNAL "") INCLUDE_DIRECTORIES(BEFORE ${SQLITE_INCLUDE_DIR}) ELSE(CMTK_BUILD_SQLITE) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindSQLite3.cmake) IF(SQLITE3_FOUND AND SQLITE3_VERSION STRGREATER "3.5.0") MESSAGE( STATUS "Using system sqlite3 library" ) SET(SQLITE_INCLUDE_DIR "${SQLITE3_INCLUDE_DIR}") SET(CMTK_SQLITE_LIB ${SQLITE3_LIBRARIES} CACHE INTERNAL "") ELSE(SQLITE3_FOUND AND SQLITE3_VERSION STRGREATER "3.5.0") MESSAGE( STATUS "Building bundled sqlite3 library due to missing or outdated system library" ) SET(CMTK_BUILD_SQLITE 1) SET(SQLITE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/sqlite3") SET(CMTK_SQLITE_LIB "cmtksqlite3" CACHE INTERNAL "") INCLUDE_DIRECTORIES(BEFORE ${SQLITE_INCLUDE_DIR}) ENDIF(SQLITE3_FOUND AND SQLITE3_VERSION STRGREATER "3.5.0") ENDIF(CMTK_BUILD_SQLITE) # if we're using SQLite and building with test support, then we need the "sqlite3" tool. IF(BUILD_TESTING) FIND_PROGRAM(SQLITE3_EXECUTABLE sqlite3) ENDIF(BUILD_TESTING) ENDIF(CMTK_USE_SQLITE) #----------------------------------------------------------------------------- # Add an option to use or not use TEEM (for NrrdIO support) OPTION(CMTK_BUILD_NRRD "Build NrrdIO library for NRRD import/export" ON) IF(CMTK_BUILD_NRRD) ADD_DEFINITIONS(-DTEEM_ZLIB) SET(CMTK_REQUIRED_CXX_FLAGS "${CMTK_REQUIRED_CXX_FLAGS} -DTEEM_ZLIB") SET(NRRD_LIBRARIES "NrrdIO" CACHE INTERNAL "The library name for the NrrdIO library") SET(NRRD_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/Utilities/NrrdIO ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/NrrdIO) ENDIF(CMTK_BUILD_NRRD) #----------------------------------------------------------------------------- # Set up CPack support, to be able to distribute binary packages. # INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmtkConfigureCPack.cmake) #----------------------------------------------------------------------------- # Configure bundled utilities. ADD_SUBDIRECTORY(Utilities) #----------------------------------------------------------------------------- # Add an option to enable or disable QT support and GUI applications OPTION(CMTK_USE_QT "Use Qt (GUI applications need this)" OFF) IF(CMTK_USE_QT) SET (QT_MT_REQUIRED true) SET (QT_MIN_VERSION "4.3.0") FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui REQUIRED) IF (QT_FOUND) MESSAGE("Qt4 Found OK (${qt_version_str})") INCLUDE(${QT_USE_FILE}) ELSE(QT_FOUND) MESSAGE(FATAL_ERROR "No Qt4") ENDIF(QT_FOUND) ENDIF(CMTK_USE_QT) #----------------------------------------------------------------------------- # Add options to enable or disable different compoments OPTION(BUILD_APPS "Build command line tools" ON) IF(BUILD_APPS) SUBDIRS(apps) ENDIF(BUILD_APPS) IF(CMTK_USE_QT) OPTION(BUILD_GUI "Build GUI applications" ON) ENDIF(CMTK_USE_QT) #----------------------------------------------------------------------------- # Add an option to use FFTW library OPTION(CMTK_USE_FFTW "Use FFTW library for fast Fourier transform (required for some specialized tools)" ON) IF(CMTK_USE_FFTW) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindFFTW.cmake) IF(FFTWD_FOUND) SET(FFTW_LIBS ${FFTWD_LIB}) IF(CMTK_USE_SMP) IF(CMTK_USE_OPENMP AND FFTWD_OMP_LIB) SET(FFTW_LIBS ${FFTWD_OMP_LIB} ${FFTWD_LIB}) ELSE(CMTK_USE_OPENMP AND FFTWD_OMP_LIB) IF(FFTWD_THREADS_LIB) SET(FFTW_LIBS ${FFTWD_THREADS_LIB} ${FFTWD_LIB}) ENDIF(FFTWD_THREADS_LIB) ENDIF(CMTK_USE_OPENMP AND FFTWD_OMP_LIB) ENDIF(CMTK_USE_SMP) SET(CMTK_FFTW_LIBRARIES ${FFTW_LIBS} CACHE INTERNAL "Link libraries for FFTW support.") SET(CMTK_USE_FFTW_FOUND ON) ELSE(FFTWD_FOUND) MESSAGE( WARNING "Cannot find FFTW3 library - disabling FFT support.") SET(CMTK_USE_FFTW_FOUND OFF) UNSET(CMTK_FFTW_LIBRARIES CACHE) ENDIF(FFTWD_FOUND) ENDIF(CMTK_USE_FFTW) #----------------------------------------------------------------------------- # Add an option to enable building of test code OPTION(BUILD_TESTING "Build test code" ON) IF (BUILD_TESTING) SUBDIRS(testing) ENDIF (BUILD_TESTING) #----------------------------------------------------------------------------- # Create the list of include directories needed for header files. INCLUDE(${CMTK_SOURCE_DIR}/cmtkIncludeDirectories.cmake) INCLUDE_DIRECTORIES( ${CMTK_INCLUDE_DIRS_BUILD_TREE} ${CMTK_INCLUDE_DIRS_SYSTEM} ) SUBDIRS(libs) LINK_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${DCMTK_LIBRARY_DIR} ) SET(CMTK_SYSTEM_LIBRARIES ${CMAKE_THREAD_LIBS}) #----------------------------------------------------------------------------- # Dispatch the build into the proper subdirectories. IF(BUILD_GUI) SUBDIRS(gui) ENDIF(BUILD_GUI) SUBDIRS(scripts) #----------------------------------------------------------------------------- # Configure this tree CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.ctest.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.ctest @ONLY) #----------------------------------------------------------------------------- # Help other projects use CMTK. # Copy the UseCMTK.cmake file to the binary tree for backward compatability. CONFIGURE_FILE(${CMTK_SOURCE_DIR}/UseCMTK.cmake.in ${CMTK_BINARY_DIR}/UseCMTK.cmake COPYONLY IMMEDIATE) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/UseCMTK.cmake DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT libraries) # Create the CMTKConfig.cmake file containing the CMTK configuration. INCLUDE(${CMTK_SOURCE_DIR}/cmtkGenerateCMTKConfig.cmake) #----------------------------------------------------------------------------- # Add compiler flags CMTK needs to work on this platform. This must be # done AFTER the call to CMAKE_EXPORT_BUILD_SETTINGS. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMTK_REQUIRED_C_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMTK_REQUIRED_CXX_FLAGS}") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMTK_REQUIRED_LINK_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMTK_REQUIRED_LINK_FLAGS}") SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMTK_REQUIRED_LINK_FLAGS}") #----------------------------------------------------------------------------- # Settings for rpath when building shared libraries # Disable rpath altogether if we don't use shared libraries IF(CMTK_BUILD_SHARED_LIBS) # use, i.e. don't skip the full RPATH for the build tree SET(CMAKE_SKIP_BUILD_RPATH FALSE) # when building, don't use the install RPATH already # (but later on when installing) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # the RPATH to be used when installing SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMTK_INSTALL_LIB_DIR}") # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) ELSE(CMTK_BUILD_SHARED_LIBS) SET(CMAKE_SKIP_RPATH TRUE) ENDIF(CMTK_BUILD_SHARED_LIBS) # Save library dependencies. EXPORT_LIBRARY_DEPENDENCIES(${CMTK_BINARY_DIR}/CMTKLibraryDepends.cmake) INSTALL(FILES ${CMTK_BINARY_DIR}/CMTKLibraryDepends.cmake DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT libraries) #----------------------------------------------------------------------------- # After everything else is done, do we want to build man pages? OPTION(BUILD_MANPAGES "Create application manpages" OFF) #----------------------------------------------------------------------------- # Configure third-party contributions. OPTION(BUILD_CONTRIB "Build, install, and package third-party contributions" OFF) IF(BUILD_CONTRIB) ADD_SUBDIRECTORY(contrib) ENDIF(BUILD_CONTRIB) cmtk-3.0.0/DISCLAIMER0000644000177700000170000000075411210045173013046 0ustar torstenmanThis software is provided as is, with no warranty whatsoever. It may or may not compile on your system. Should you get it to compile, it may or may not run. It may crash at any time. It may destroy your data, format your harddisk, set your CPU on fire, and give you herpes. So make sure you have backups of all your valuable data. Be sure not to run the software as root. And please please PLEASE, do not use it for clinical purposes, because none of this is approved. Otherwise, have fun! cmtk-3.0.0/README.txt0000644000177700000170000001066312263604537013223 0ustar torstenman The Computational Morphometry Toolkit ========================================================================== Release Notes -- CMTK 3.0.0 =========================== CHANGES THAT BREAK BACKWARD COMPATIBILITY: ------------------------------------------ 1. Affine Transformations: Affine transformation matrices were broken when shear and non-isotropic scale were used. Existing transformation files will continue to be read and generate the same matrices as before, but these matrices will not strictly be containing the specified scale and shear components. Newly-created transformation files will use a different meaning of the "shear" coefficients. https://www.nitrc.org/tracker/index.php?func=detail&aid=7179&group_id=212&atid=877 2. NIFTI Image Import/Export: Handling of NIFTI qform and sform has changed in a way that breaks regression tests, but should otherwise be benign. This should also make CMTK largely NIFTI-compliant in the it puts image-to-physical coordinates into the header's qform fields, rather than sform as before. https://www.nitrc.org/tracker/index.php?func=detail&aid=7169&group_id=212&atid=877 OTHER USER-VISIBLE CHANGES: --------------------------- 1. Contributed pipeline scripts from the N-CANDA project, which briefly appeared in the CMTK code tree, have been moved into their own, project-specific repository. 2. unwarp_image_phantom default behaviour has been changed to multi-iteration fitting. Also now supports residual-controlled fitting. 3. mk_analyze_hdr and mk_nifti_hdr default behaviour has changed - data type now defaults to "byte" and orientation (for Analyze) now defaults to "axial", rather than being "UNKNOWN" 4. dcm2image default behaviour has changed - potentially identifiable metadata is no longer embedded in the "Description" field of NIFTI or Analyze images created from DICOM files. 5. xform2scalar now puts padding pixels where application of transformation sequence failed (e.g., due to failed numerical inversion of nonrigid transformation). 6. fit_spline_xform was broken due to two bugs in the spline fitting code. These have been fixed, but as a result, the tool now generates different output (as it should, since the previous output was plain invalid). Platform Support ================ CMTK has been built and tested on the following platforms: - Linux 64bit (Fedora 20), gcc 4.8.2, CUDA 3.2 - Linux 64bit (Fedora 20), clang 3.3 - Linux 64bit (Fedora 19), gcc 4.8.2, CUDA 3.2 - Linux, i386, Oracle Solaris Studio 12.3 C++ 5.12 2011/11/16 - MacOSX 10.6, x86_64, gcc 4.2.1, CUDA 4.1 - MacOSX 10.6, x86_64, MacPorts gcc 4.8.2, CUDA 4.1 - MacOSX 10.6, x86_64, llvm-gcc-4.2.1 - MacOSX 10.6, x86_64, clang 2.0 - Cygwin, gcc 4.8.2 - Windows XP, VisualStudio 10SP1 (2010 Express Edition), CUDA 4.1 - Windows 7 64bit, VisualStudio 2012 Express for Desktop, CUDA 4.1 Platform-Specific Issues ======================== MacOS-X ------- - Code coverage tests are only supported with gcc compiler and SDK 10.6. Older SDKs or the clang and llvm compiler front-ends do not support code coverage. http://www.nitrc.org/tracker/index.php?func=detail&aid=5450&group_id=212&atid=877 - To use a pre-compiled binary distribution of CMTK on MacOS, the following MacPorts packages have to be installed under /opt/local: - qt4 - sqlite3 - dcmtk SolarisStudio Compiler, Linux/Intel ----------------------------------- - SolarisStudio C++ 12.2 crashes when compiling the "Numerics" library with full optimization, -O3. A bug report has been filed with, and accepted by, Oracle: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6989625 Workaround: build "MinSizeRel" configuration, which sets optimization level to O2. Note that OpenMP must be disabled, because otherwise optimization is bumped back to O3 by default. This problem is also fixed in SolarisStudio 12.3, but see next issue. - SolarisStudio C++ 12.3 crashes when compiling the file "cmtkEchoPlanarUnwarpFunctional.cxx" with OpenMP support turned on. Workaround: set "CMTK_USE_OPENMP" configuration option to "OFF"; this will lead to much of CMTK's functionality executing single-threaded. Open64 Compiler --------------- - CMTK does not build in Release mode with the Open64 compiler due to internal compiler errors. ========================================================================== This software is available from http://www.nitrc.org/projects/cmtk/ ========================================================================== cmtk-3.0.0/Utilities/0000755000177700000170000000000012263615445013472 5ustar torstenmancmtk-3.0.0/Utilities/mxml/0000755000177700000170000000000012263615446014450 5ustar torstenmancmtk-3.0.0/Utilities/mxml/test.xml0000644000177700000170000000154311210045173016135 0ustar torstenman 123 Now is the time for all good men to come to the aid of their country. cmtk-3.0.0/Utilities/mxml/install-sh0000755000177700000170000001267111210045173016444 0ustar torstenman#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 cmtk-3.0.0/Utilities/mxml/mxml-get.c0000644000177700000170000002201211747570117016344 0ustar torstenman/* * "$Id: mxml-get.c 427 2011-01-03 02:03:29Z mike $" * * Node get functions for Mini-XML, a small XML-like file parsing library. * * Copyright 2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxmlGetCDATA() - Get the value for a CDATA node. * mxmlGetCustom() - Get the value for a custom node. * mxmlGetElement() - Get the name for an element node. * mxmlGetFirstChild() - Get the first child of an element node. * mxmlGetInteger() - Get the integer value from the specified node or its * first child. * mxmlGetLastChild() - Get the last child of an element node. * mxmlGetNextSibling() - Get the next node for the current parent. * mxmlGetOpaque() - Get an opaque string value for a node or its first * child. * mxmlGetParent() - Get the parent node. * mxmlGetPrevSibling() - Get the previous node for the current parent. * mxmlGetReal() - Get the real value for a node or its first child. * mxmlGetText() - Get the text value for a node or its first child. * mxmlGetType() - Get the node type. * mxmlGetUserData() - Get the user data pointer for a node. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * 'mxmlGetCDATA()' - Get the value for a CDATA node. * * @code NULL@ is returned if the node is not a CDATA element. * * @since Mini-XML 2.7@ */ const char * /* O - CDATA value or NULL */ mxmlGetCDATA(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || strncmp(node->value.element.name, "![CDATA[", 8)) return (NULL); /* * Return the text following the CDATA declaration... */ return (node->value.element.name + 8); } /* * 'mxmlGetCustom()' - Get the value for a custom node. * * @code NULL@ is returned if the node (or its first child) is not a custom * value node. * * @since Mini-XML 2.7@ */ const void * /* O - Custom value or NULL */ mxmlGetCustom(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (NULL); /* * Return the integer value... */ if (node->type == MXML_CUSTOM) return (node->value.custom.data); else if (node->type == MXML_ELEMENT && node->child && node->child->type == MXML_CUSTOM) return (node->child->value.custom.data); else return (NULL); } /* * 'mxmlGetElement()' - Get the name for an element node. * * @code NULL@ is returned if the node is not an element node. * * @since Mini-XML 2.7@ */ const char * /* O - Element name or NULL */ mxmlGetElement(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node || node->type != MXML_ELEMENT) return (NULL); /* * Return the element name... */ return (node->value.element.name); } /* * 'mxmlGetFirstChild()' - Get the first child of an element node. * * @code NULL@ is returned if the node is not an element node or if the node * has no children. * * @since Mini-XML 2.7@ */ mxml_node_t * /* O - First child or NULL */ mxmlGetFirstChild(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node || node->type != MXML_ELEMENT) return (NULL); /* * Return the first child node... */ return (node->child); } /* * 'mxmlGetInteger()' - Get the integer value from the specified node or its * first child. * * 0 is returned if the node (or its first child) is not an integer value node. * * @since Mini-XML 2.7@ */ int /* O - Integer value or 0 */ mxmlGetInteger(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (0); /* * Return the integer value... */ if (node->type == MXML_INTEGER) return (node->value.integer); else if (node->type == MXML_ELEMENT && node->child && node->child->type == MXML_INTEGER) return (node->child->value.integer); else return (0); } /* * 'mxmlGetLastChild()' - Get the last child of an element node. * * @code NULL@ is returned if the node is not an element node or if the node * has no children. * * @since Mini-XML 2.7@ */ mxml_node_t * /* O - Last child or NULL */ mxmlGetLastChild(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node || node->type != MXML_ELEMENT) return (NULL); /* * Return the node type... */ return (node->last_child); } /* * 'mxmlGetNextSibling()' - Get the next node for the current parent. * * @code NULL@ is returned if this is the last child for the current parent. * * @since Mini-XML 2.7@ */ mxml_node_t * mxmlGetNextSibling(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (NULL); /* * Return the node type... */ return (node->next); } /* * 'mxmlGetOpaque()' - Get an opaque string value for a node or its first child. * * @code NULL@ is returned if the node (or its first child) is not an opaque * value node. * * @since Mini-XML 2.7@ */ const char * /* O - Opaque string or NULL */ mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (NULL); /* * Return the integer value... */ if (node->type == MXML_OPAQUE) return (node->value.opaque); else if (node->type == MXML_ELEMENT && node->child && node->child->type == MXML_OPAQUE) return (node->child->value.opaque); else return (NULL); } /* * 'mxmlGetParent()' - Get the parent node. * * @code NULL@ is returned for a root node. * * @since Mini-XML 2.7@ */ mxml_node_t * /* O - Parent node or NULL */ mxmlGetParent(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (NULL); /* * Return the node type... */ return (node->parent); } /* * 'mxmlGetPrevSibling()' - Get the previous node for the current parent. * * @code NULL@ is returned if this is the first child for the current parent. * * @since Mini-XML 2.7@ */ mxml_node_t * /* O - Previous node or NULL */ mxmlGetPrevSibling(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (NULL); /* * Return the node type... */ return (node->prev); } /* * 'mxmlGetReal()' - Get the real value for a node or its first child. * * 0.0 is returned if the node (or its first child) is not a real value node. * * @since Mini-XML 2.7@ */ double /* O - Real value or 0.0 */ mxmlGetReal(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (0.0); /* * Return the integer value... */ if (node->type == MXML_REAL) return (node->value.real); else if (node->type == MXML_ELEMENT && node->child && node->child->type == MXML_REAL) return (node->child->value.real); else return (0.0); } /* * 'mxmlGetText()' - Get the text value for a node or its first child. * * @code NULL@ is returned if the node (or its first child) is not a text node. * The "whitespace" argument can be NULL. * * @since Mini-XML 2.7@ */ const char * /* O - Text string or NULL */ mxmlGetText(mxml_node_t *node, /* I - Node to get */ int *whitespace) /* O - 1 if string is preceded by whitespace, 0 otherwise */ { /* * Range check input... */ if (!node) { if (whitespace) *whitespace = 0; return (NULL); } /* * Return the integer value... */ if (node->type == MXML_TEXT) { if (whitespace) *whitespace = node->value.text.whitespace; return (node->value.text.string); } else if (node->type == MXML_ELEMENT && node->child && node->child->type == MXML_TEXT) { if (whitespace) *whitespace = node->child->value.text.whitespace; return (node->child->value.text.string); } else { if (whitespace) *whitespace = 0; return (NULL); } } /* * 'mxmlGetType()' - Get the node type. * * @code MXML_IGNORE@ is returned if "node" is @code NULL@. * * @since Mini-XML 2.7@ */ mxml_type_t /* O - Type of node */ mxmlGetType(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (MXML_IGNORE); /* * Return the node type... */ return (node->type); } /* * 'mxmlGetUserData()' - Get the user data pointer for a node. * * @since Mini-XML 2.7@ */ void * /* O - User data pointer */ mxmlGetUserData(mxml_node_t *node) /* I - Node to get */ { /* * Range check input... */ if (!node) return (NULL); /* * Return the user data pointer... */ return (node->user_data); } /* * End of "$Id: mxml-get.c 427 2011-01-03 02:03:29Z mike $". */ cmtk-3.0.0/Utilities/mxml/config.h.cmake0000644000177700000170000000427111643636605017152 0ustar torstenman/* * "$Id: config.h.in 387 2009-04-18 17:05:52Z mike $" * * Configuration file for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2009 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. */ /* * Include necessary headers... */ /* * add "cmtk_" prefix to exported symbols - we are building this library bundled with CMTK */ #include #include #include #include #include #include /* * Version number... */ #define MXML_VERSION "@MXML_VERSION@" /* * Inline function support... */ #define inline @C_INLINE@ /* * Long long support... */ #cmakedefine HAVE_LONG_LONG /* * Do we have the snprintf() and vsnprintf() functions? */ #cmakedefine HAVE_SNPRINTF #cmakedefine HAVE_VSNPRINTF /* * Do we have the strXXX() functions? */ #cmakedefine HAVE_STRDUP /* * Do we have threading support? */ #cmakedefine HAVE_PTHREAD_H /* * Define prototypes for string functions as needed... */ # ifndef HAVE_STRDUP extern char *_mxml_strdup(const char *); # define strdup _mxml_strdup # endif /* !HAVE_STRDUP */ extern char *_mxml_strdupf(const char *, ...); extern char *_mxml_vstrdupf(const char *, va_list); # ifndef HAVE_SNPRINTF extern int _mxml_snprintf(char *, size_t, const char *, ...); # define snprintf _mxml_snprintf # endif /* !HAVE_SNPRINTF */ # ifndef HAVE_VSNPRINTF extern int _mxml_vsnprintf(char *, size_t, const char *, va_list); # define vsnprintf _mxml_vsnprintf # endif /* !HAVE_VSNPRINTF */ #ifdef _MSC_VER #if _MSC_VER >= 1400 /* disable warnings about "deprecated" C runtime functions */ #pragma warning( disable : 4996 ) #endif #endif /* * End of "$Id: config.h.in 387 2009-04-18 17:05:52Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml-entity.c0000644000177700000170000002443211747570117017111 0ustar torstenman/* * "$Id: mxml-entity.c 408 2010-09-19 05:26:46Z mike $" * * Character entity support code for Mini-XML, a small XML-like * file parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxmlEntityAddCallback() - Add a callback to convert entities to * Unicode. * mxmlEntityGetName() - Get the name that corresponds to the * character value. * mxmlEntityGetValue() - Get the character corresponding to a named * entity. * mxmlEntityRemoveCallback() - Remove a callback. * _mxml_entity_cb() - Lookup standard (X)HTML entities. */ /* * Include necessary headers... */ #include "mxml-private.h" /* * 'mxmlEntityAddCallback()' - Add a callback to convert entities to Unicode. */ int /* O - 0 on success, -1 on failure */ mxmlEntityAddCallback( mxml_entity_cb_t cb) /* I - Callback function to add */ { _mxml_global_t *global = _mxml_global(); /* Global data */ if (global->num_entity_cbs < (int)(sizeof(global->entity_cbs) / sizeof(global->entity_cbs[0]))) { global->entity_cbs[global->num_entity_cbs] = cb; global->num_entity_cbs ++; return (0); } else { mxml_error("Unable to add entity callback!"); return (-1); } } /* * 'mxmlEntityGetName()' - Get the name that corresponds to the character value. * * If val does not need to be represented by a named entity, NULL is returned. */ const char * /* O - Entity name or NULL */ mxmlEntityGetName(int val) /* I - Character value */ { switch (val) { case '&' : return ("amp"); case '<' : return ("lt"); case '>' : return ("gt"); case '\"' : return ("quot"); default : return (NULL); } } /* * 'mxmlEntityGetValue()' - Get the character corresponding to a named entity. * * The entity name can also be a numeric constant. -1 is returned if the * name is not known. */ int /* O - Character value or -1 on error */ mxmlEntityGetValue(const char *name) /* I - Entity name */ { int i; /* Looping var */ int ch; /* Character value */ _mxml_global_t *global = _mxml_global(); /* Global data */ for (i = 0; i < global->num_entity_cbs; i ++) if ((ch = (global->entity_cbs[i])(name)) >= 0) return (ch); return (-1); } /* * 'mxmlEntityRemoveCallback()' - Remove a callback. */ void mxmlEntityRemoveCallback( mxml_entity_cb_t cb) /* I - Callback function to remove */ { int i; /* Looping var */ _mxml_global_t *global = _mxml_global(); /* Global data */ for (i = 0; i < global->num_entity_cbs; i ++) if (cb == global->entity_cbs[i]) { /* * Remove the callback... */ global->num_entity_cbs --; if (i < global->num_entity_cbs) memmove(global->entity_cbs + i, global->entity_cbs + i + 1, (global->num_entity_cbs - i) * sizeof(global->entity_cbs[0])); return; } } /* * '_mxml_entity_cb()' - Lookup standard (X)HTML entities. */ int /* O - Unicode value or -1 */ _mxml_entity_cb(const char *name) /* I - Entity name */ { int diff, /* Difference between names */ current, /* Current entity in search */ first, /* First entity in search */ last; /* Last entity in search */ static const struct { const char *name; /* Entity name */ int val; /* Character value */ } entities[] = { { "AElig", 198 }, { "Aacute", 193 }, { "Acirc", 194 }, { "Agrave", 192 }, { "Alpha", 913 }, { "Aring", 197 }, { "Atilde", 195 }, { "Auml", 196 }, { "Beta", 914 }, { "Ccedil", 199 }, { "Chi", 935 }, { "Dagger", 8225 }, { "Delta", 916 }, { "Dstrok", 208 }, { "ETH", 208 }, { "Eacute", 201 }, { "Ecirc", 202 }, { "Egrave", 200 }, { "Epsilon", 917 }, { "Eta", 919 }, { "Euml", 203 }, { "Gamma", 915 }, { "Iacute", 205 }, { "Icirc", 206 }, { "Igrave", 204 }, { "Iota", 921 }, { "Iuml", 207 }, { "Kappa", 922 }, { "Lambda", 923 }, { "Mu", 924 }, { "Ntilde", 209 }, { "Nu", 925 }, { "OElig", 338 }, { "Oacute", 211 }, { "Ocirc", 212 }, { "Ograve", 210 }, { "Omega", 937 }, { "Omicron", 927 }, { "Oslash", 216 }, { "Otilde", 213 }, { "Ouml", 214 }, { "Phi", 934 }, { "Pi", 928 }, { "Prime", 8243 }, { "Psi", 936 }, { "Rho", 929 }, { "Scaron", 352 }, { "Sigma", 931 }, { "THORN", 222 }, { "Tau", 932 }, { "Theta", 920 }, { "Uacute", 218 }, { "Ucirc", 219 }, { "Ugrave", 217 }, { "Upsilon", 933 }, { "Uuml", 220 }, { "Xi", 926 }, { "Yacute", 221 }, { "Yuml", 376 }, { "Zeta", 918 }, { "aacute", 225 }, { "acirc", 226 }, { "acute", 180 }, { "aelig", 230 }, { "agrave", 224 }, { "alefsym", 8501 }, { "alpha", 945 }, { "amp", '&' }, { "and", 8743 }, { "ang", 8736 }, { "apos", '\'' }, { "aring", 229 }, { "asymp", 8776 }, { "atilde", 227 }, { "auml", 228 }, { "bdquo", 8222 }, { "beta", 946 }, { "brkbar", 166 }, { "brvbar", 166 }, { "bull", 8226 }, { "cap", 8745 }, { "ccedil", 231 }, { "cedil", 184 }, { "cent", 162 }, { "chi", 967 }, { "circ", 710 }, { "clubs", 9827 }, { "cong", 8773 }, { "copy", 169 }, { "crarr", 8629 }, { "cup", 8746 }, { "curren", 164 }, { "dArr", 8659 }, { "dagger", 8224 }, { "darr", 8595 }, { "deg", 176 }, { "delta", 948 }, { "diams", 9830 }, { "die", 168 }, { "divide", 247 }, { "eacute", 233 }, { "ecirc", 234 }, { "egrave", 232 }, { "empty", 8709 }, { "emsp", 8195 }, { "ensp", 8194 }, { "epsilon", 949 }, { "equiv", 8801 }, { "eta", 951 }, { "eth", 240 }, { "euml", 235 }, { "euro", 8364 }, { "exist", 8707 }, { "fnof", 402 }, { "forall", 8704 }, { "frac12", 189 }, { "frac14", 188 }, { "frac34", 190 }, { "frasl", 8260 }, { "gamma", 947 }, { "ge", 8805 }, { "gt", '>' }, { "hArr", 8660 }, { "harr", 8596 }, { "hearts", 9829 }, { "hellip", 8230 }, { "hibar", 175 }, { "iacute", 237 }, { "icirc", 238 }, { "iexcl", 161 }, { "igrave", 236 }, { "image", 8465 }, { "infin", 8734 }, { "int", 8747 }, { "iota", 953 }, { "iquest", 191 }, { "isin", 8712 }, { "iuml", 239 }, { "kappa", 954 }, { "lArr", 8656 }, { "lambda", 955 }, { "lang", 9001 }, { "laquo", 171 }, { "larr", 8592 }, { "lceil", 8968 }, { "ldquo", 8220 }, { "le", 8804 }, { "lfloor", 8970 }, { "lowast", 8727 }, { "loz", 9674 }, { "lrm", 8206 }, { "lsaquo", 8249 }, { "lsquo", 8216 }, { "lt", '<' }, { "macr", 175 }, { "mdash", 8212 }, { "micro", 181 }, { "middot", 183 }, { "minus", 8722 }, { "mu", 956 }, { "nabla", 8711 }, { "nbsp", 160 }, { "ndash", 8211 }, { "ne", 8800 }, { "ni", 8715 }, { "not", 172 }, { "notin", 8713 }, { "nsub", 8836 }, { "ntilde", 241 }, { "nu", 957 }, { "oacute", 243 }, { "ocirc", 244 }, { "oelig", 339 }, { "ograve", 242 }, { "oline", 8254 }, { "omega", 969 }, { "omicron", 959 }, { "oplus", 8853 }, { "or", 8744 }, { "ordf", 170 }, { "ordm", 186 }, { "oslash", 248 }, { "otilde", 245 }, { "otimes", 8855 }, { "ouml", 246 }, { "para", 182 }, { "part", 8706 }, { "permil", 8240 }, { "perp", 8869 }, { "phi", 966 }, { "pi", 960 }, { "piv", 982 }, { "plusmn", 177 }, { "pound", 163 }, { "prime", 8242 }, { "prod", 8719 }, { "prop", 8733 }, { "psi", 968 }, { "quot", '\"' }, { "rArr", 8658 }, { "radic", 8730 }, { "rang", 9002 }, { "raquo", 187 }, { "rarr", 8594 }, { "rceil", 8969 }, { "rdquo", 8221 }, { "real", 8476 }, { "reg", 174 }, { "rfloor", 8971 }, { "rho", 961 }, { "rlm", 8207 }, { "rsaquo", 8250 }, { "rsquo", 8217 }, { "sbquo", 8218 }, { "scaron", 353 }, { "sdot", 8901 }, { "sect", 167 }, { "shy", 173 }, { "sigma", 963 }, { "sigmaf", 962 }, { "sim", 8764 }, { "spades", 9824 }, { "sub", 8834 }, { "sube", 8838 }, { "sum", 8721 }, { "sup", 8835 }, { "sup1", 185 }, { "sup2", 178 }, { "sup3", 179 }, { "supe", 8839 }, { "szlig", 223 }, { "tau", 964 }, { "there4", 8756 }, { "theta", 952 }, { "thetasym", 977 }, { "thinsp", 8201 }, { "thorn", 254 }, { "tilde", 732 }, { "times", 215 }, { "trade", 8482 }, { "uArr", 8657 }, { "uacute", 250 }, { "uarr", 8593 }, { "ucirc", 251 }, { "ugrave", 249 }, { "uml", 168 }, { "upsih", 978 }, { "upsilon", 965 }, { "uuml", 252 }, { "weierp", 8472 }, { "xi", 958 }, { "yacute", 253 }, { "yen", 165 }, { "yuml", 255 }, { "zeta", 950 }, { "zwj", 8205 }, { "zwnj", 8204 } }; /* * Do a binary search for the named entity... */ first = 0; last = (int)(sizeof(entities) / sizeof(entities[0]) - 1); while ((last - first) > 1) { current = (first + last) / 2; if ((diff = strcmp(name, entities[current].name)) == 0) return (entities[current].val); else if (diff < 0) last = current; else first = current; } /* * If we get here, there is a small chance that there is still * a match; check first and last... */ if (!strcmp(name, entities[first].name)) return (entities[first].val); else if (!strcmp(name, entities[last].name)) return (entities[last].val); else return (-1); } /* * End of "$Id: mxml-entity.c 408 2010-09-19 05:26:46Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml-string.c0000644000177700000170000002321411747570117017100 0ustar torstenman/* * "$Id: mxml-string.c 424 2010-12-25 16:21:50Z mike $" * * String functions for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * _mxml_snprintf() - Format a string. * _mxml_strdup() - Duplicate a string. * _mxml_strdupf() - Format and duplicate a string. * _mxml_vsnprintf() - Format a string into a fixed size buffer. * _mxml_vstrdupf() - Format and duplicate a string. */ /* * Include necessary headers... */ #include "config.h" /* * The va_copy macro is part of C99, but many compilers don't implement it. * Provide a "direct assignment" implmentation when va_copy isn't defined... */ #ifndef va_copy # ifdef __va_copy # define va_copy(dst,src) __va_copy(dst,src) # else # define va_copy(dst,src) memcpy(&dst, &src, sizeof(va_list)) # endif /* __va_copy */ #endif /* va_copy */ #ifndef HAVE_SNPRINTF /* * '_mxml_snprintf()' - Format a string. */ int /* O - Number of bytes formatted */ _mxml_snprintf(char *buffer, /* I - Output buffer */ size_t bufsize, /* I - Size of output buffer */ const char *format, /* I - Printf-style format string */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Argument list */ int bytes; /* Number of bytes formatted */ va_start(ap, format); bytes = vsnprintf(buffer, bufsize, format, ap); va_end(ap); return (bytes); } #endif /* !HAVE_SNPRINTF */ /* * '_mxml_strdup()' - Duplicate a string. */ #ifndef HAVE_STRDUP char * /* O - New string pointer */ _mxml_strdup(const char *s) /* I - String to duplicate */ { char *t; /* New string pointer */ if (s == NULL) return (NULL); if ((t = malloc(strlen(s) + 1)) == NULL) return (NULL); return (strcpy(t, s)); } #endif /* !HAVE_STRDUP */ /* * '_mxml_strdupf()' - Format and duplicate a string. */ char * /* O - New string pointer */ _mxml_strdupf(const char *format, /* I - Printf-style format string */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Pointer to additional arguments */ char *s; /* Pointer to formatted string */ /* * Get a pointer to the additional arguments, format the string, * and return it... */ va_start(ap, format); s = _mxml_vstrdupf(format, ap); va_end(ap); return (s); } #ifndef HAVE_VSNPRINTF /* * '_mxml_vsnprintf()' - Format a string into a fixed size buffer. */ int /* O - Number of bytes formatted */ _mxml_vsnprintf(char *buffer, /* O - Output buffer */ size_t bufsize, /* O - Size of output buffer */ const char *format, /* I - Printf-style format string */ va_list ap) /* I - Pointer to additional arguments */ { char *bufptr, /* Pointer to position in buffer */ *bufend, /* Pointer to end of buffer */ sign, /* Sign of format width */ size, /* Size character (h, l, L) */ type; /* Format type character */ int width, /* Width of field */ prec; /* Number of characters of precision */ char tformat[100], /* Temporary format string for sprintf() */ *tptr, /* Pointer into temporary format */ temp[1024]; /* Buffer for formatted numbers */ char *s; /* Pointer to string */ int slen; /* Length of string */ int bytes; /* Total number of bytes needed */ /* * Loop through the format string, formatting as needed... */ bufptr = buffer; bufend = buffer + bufsize - 1; bytes = 0; while (*format) { if (*format == '%') { tptr = tformat; *tptr++ = *format++; if (*format == '%') { if (bufptr && bufptr < bufend) *bufptr++ = *format; bytes ++; format ++; continue; } else if (strchr(" -+#\'", *format)) { *tptr++ = *format; sign = *format++; } else sign = 0; if (*format == '*') { /* * Get width from argument... */ format ++; width = va_arg(ap, int); snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", width); tptr += strlen(tptr); } else { width = 0; while (isdigit(*format & 255)) { if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format; width = width * 10 + *format++ - '0'; } } if (*format == '.') { if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format; format ++; if (*format == '*') { /* * Get precision from argument... */ format ++; prec = va_arg(ap, int); snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", prec); tptr += strlen(tptr); } else { prec = 0; while (isdigit(*format & 255)) { if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format; prec = prec * 10 + *format++ - '0'; } } } else prec = -1; if (*format == 'l' && format[1] == 'l') { size = 'L'; if (tptr < (tformat + sizeof(tformat) - 2)) { *tptr++ = 'l'; *tptr++ = 'l'; } format += 2; } else if (*format == 'h' || *format == 'l' || *format == 'L') { if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format; size = *format++; } if (!*format) break; if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format; type = *format++; *tptr = '\0'; switch (type) { case 'E' : /* Floating point formats */ case 'G' : case 'e' : case 'f' : case 'g' : if ((width + 2) > sizeof(temp)) break; sprintf(temp, tformat, va_arg(ap, double)); bytes += strlen(temp); if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { strncpy(bufptr, temp, (size_t)(bufend - bufptr)); bufptr = bufend; } else { strcpy(bufptr, temp); bufptr += strlen(temp); } } break; case 'B' : /* Integer formats */ case 'X' : case 'b' : case 'd' : case 'i' : case 'o' : case 'u' : case 'x' : if ((width + 2) > sizeof(temp)) break; #ifdef HAVE_LONG_LONG if (size == 'L') sprintf(temp, tformat, va_arg(ap, long long)); else #endif /* HAVE_LONG_LONG */ sprintf(temp, tformat, va_arg(ap, int)); bytes += strlen(temp); if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { strncpy(bufptr, temp, (size_t)(bufend - bufptr)); bufptr = bufend; } else { strcpy(bufptr, temp); bufptr += strlen(temp); } } break; case 'p' : /* Pointer value */ if ((width + 2) > sizeof(temp)) break; sprintf(temp, tformat, va_arg(ap, void *)); bytes += strlen(temp); if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { strncpy(bufptr, temp, (size_t)(bufend - bufptr)); bufptr = bufend; } else { strcpy(bufptr, temp); bufptr += strlen(temp); } } break; case 'c' : /* Character or character array */ bytes += width; if (bufptr) { if (width <= 1) *bufptr++ = va_arg(ap, int); else { if ((bufptr + width) > bufend) width = bufend - bufptr; memcpy(bufptr, va_arg(ap, char *), (size_t)width); bufptr += width; } } break; case 's' : /* String */ if ((s = va_arg(ap, char *)) == NULL) s = "(null)"; slen = strlen(s); if (slen > width && prec != width) width = slen; bytes += width; if (bufptr) { if ((bufptr + width) > bufend) width = bufend - bufptr; if (slen > width) slen = width; if (sign == '-') { strncpy(bufptr, s, (size_t)slen); memset(bufptr + slen, ' ', (size_t)(width - slen)); } else { memset(bufptr, ' ', (size_t)(width - slen)); strncpy(bufptr + width - slen, s, (size_t)slen); } bufptr += width; } break; case 'n' : /* Output number of chars so far */ *(va_arg(ap, int *)) = bytes; break; } } else { bytes ++; if (bufptr && bufptr < bufend) *bufptr++ = *format; format ++; } } /* * Nul-terminate the string and return the number of characters needed. */ *bufptr = '\0'; return (bytes); } #endif /* !HAVE_VSNPRINTF */ /* * '_mxml_vstrdupf()' - Format and duplicate a string. */ char * /* O - New string pointer */ _mxml_vstrdupf(const char *format, /* I - Printf-style format string */ va_list ap) /* I - Pointer to additional arguments */ { int bytes; /* Number of bytes required */ char *buffer, /* String buffer */ temp[256]; /* Small buffer for first vsnprintf */ va_list apcopy; /* Copy of argument list */ /* * First format with a tiny buffer; this will tell us how many bytes are * needed... */ va_copy(apcopy, ap); bytes = vsnprintf(temp, sizeof(temp), format, apcopy); if (bytes < sizeof(temp)) { /* * Hey, the formatted string fits in the tiny buffer, so just dup that... */ return (strdup(temp)); } /* * Allocate memory for the whole thing and reformat to the new, larger * buffer... */ if ((buffer = calloc(1, bytes + 1)) != NULL) vsnprintf(buffer, bytes + 1, format, ap); /* * Return the new string... */ return (buffer); } /* * End of "$Id: mxml-string.c 424 2010-12-25 16:21:50Z mike $". */ cmtk-3.0.0/Utilities/mxml/config.h.in0000644000177700000170000000334511747570117016501 0ustar torstenman/* * "$Id: config.h.in 408 2010-09-19 05:26:46Z mike $" * * Configuration file for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ */ /* * Include necessary headers... */ #include #include #include #include #include /* * Version number... */ #define MXML_VERSION "" /* * Inline function support... */ #define inline /* * Long long support... */ #undef HAVE_LONG_LONG /* * Do we have the snprintf() and vsnprintf() functions? */ #undef HAVE_SNPRINTF #undef HAVE_VSNPRINTF /* * Do we have the strXXX() functions? */ #undef HAVE_STRDUP /* * Do we have threading support? */ #undef HAVE_PTHREAD_H /* * Define prototypes for string functions as needed... */ # ifndef HAVE_STRDUP extern char *_mxml_strdup(const char *); # define strdup _mxml_strdup # endif /* !HAVE_STRDUP */ extern char *_mxml_strdupf(const char *, ...); extern char *_mxml_vstrdupf(const char *, va_list); # ifndef HAVE_SNPRINTF extern int _mxml_snprintf(char *, size_t, const char *, ...); # define snprintf _mxml_snprintf # endif /* !HAVE_SNPRINTF */ # ifndef HAVE_VSNPRINTF extern int _mxml_vsnprintf(char *, size_t, const char *, va_list); # define vsnprintf _mxml_vsnprintf # endif /* !HAVE_VSNPRINTF */ /* * End of "$Id: config.h.in 408 2010-09-19 05:26:46Z mike $". */ cmtk-3.0.0/Utilities/mxml/testmxml.c0000644000177700000170000004326311747570117016502 0ustar torstenman/* * "$Id: testmxml.c 439 2011-04-13 15:43:32Z mike $" * * Test program for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * main() - Main entry for test program. * sax_cb() - SAX callback. * type_cb() - XML data type callback for mxmlLoadFile()... * whitespace_cb() - Let the mxmlSaveFile() function know when to insert * newlines and tabs... */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" #ifndef WIN32 # include #endif /* !WIN32 */ #include #ifndef O_BINARY # define O_BINARY 0 #endif /* !O_BINARY */ /* * Globals... */ int event_counts[6]; /* * Local functions... */ void sax_cb(mxml_node_t *node, mxml_sax_event_t event, void *data); mxml_type_t type_cb(mxml_node_t *node); const char *whitespace_cb(mxml_node_t *node, int where); /* * 'main()' - Main entry for test program. */ int /* O - Exit status */ main(int argc, /* I - Number of command-line args */ char *argv[]) /* I - Command-line args */ { int i; /* Looping var */ FILE *fp; /* File to read */ int fd; /* File descriptor */ mxml_node_t *tree, /* XML tree */ *node; /* Node which should be in test.xml */ mxml_index_t *ind; /* XML index */ char buffer[16384]; /* Save string */ static const char *types[] = /* Strings for node types */ { "MXML_ELEMENT", "MXML_INTEGER", "MXML_OPAQUE", "MXML_REAL", "MXML_TEXT" }; /* * Check arguments... */ if (argc != 2) { fputs("Usage: testmxml filename.xml\n", stderr); return (1); } /* * Test the basic functionality... */ tree = mxmlNewElement(MXML_NO_PARENT, "element"); if (!tree) { fputs("ERROR: No parent node in basic test!\n", stderr); return (1); } if (tree->type != MXML_ELEMENT) { fprintf(stderr, "ERROR: Parent has type %s (%d), expected MXML_ELEMENT!\n", tree->type < MXML_ELEMENT || tree->type > MXML_TEXT ? "UNKNOWN" : types[tree->type], tree->type); mxmlDelete(tree); return (1); } if (strcmp(tree->value.element.name, "element")) { fprintf(stderr, "ERROR: Parent value is \"%s\", expected \"element\"!\n", tree->value.element.name); mxmlDelete(tree); return (1); } mxmlNewInteger(tree, 123); mxmlNewOpaque(tree, "opaque"); mxmlNewReal(tree, 123.4f); mxmlNewText(tree, 1, "text"); mxmlLoadString(tree, "string string string", MXML_NO_CALLBACK); mxmlLoadString(tree, "1 2 3", MXML_INTEGER_CALLBACK); mxmlLoadString(tree, "1.0 2.0 3.0", MXML_REAL_CALLBACK); mxmlLoadString(tree, "opaque opaque opaque", MXML_OPAQUE_CALLBACK); mxmlLoadString(tree, "valuevalue2" "", MXML_OPAQUE_CALLBACK); node = tree->child; if (!node) { fputs("ERROR: No first child node in basic test!\n", stderr); mxmlDelete(tree); return (1); } if (node->type != MXML_INTEGER) { fprintf(stderr, "ERROR: First child has type %s (%d), expected MXML_INTEGER!\n", node->type < MXML_ELEMENT || node->type > MXML_TEXT ? "UNKNOWN" : types[node->type], node->type); mxmlDelete(tree); return (1); } if (node->value.integer != 123) { fprintf(stderr, "ERROR: First child value is %d, expected 123!\n", node->value.integer); mxmlDelete(tree); return (1); } node = node->next; if (!node) { fputs("ERROR: No second child node in basic test!\n", stderr); mxmlDelete(tree); return (1); } if (node->type != MXML_OPAQUE) { fprintf(stderr, "ERROR: Second child has type %s (%d), expected MXML_OPAQUE!\n", node->type < MXML_ELEMENT || node->type > MXML_TEXT ? "UNKNOWN" : types[node->type], node->type); mxmlDelete(tree); return (1); } if (!node->value.opaque || strcmp(node->value.opaque, "opaque")) { fprintf(stderr, "ERROR: Second child value is \"%s\", expected \"opaque\"!\n", node->value.opaque ? node->value.opaque : "(null)"); mxmlDelete(tree); return (1); } node = node->next; if (!node) { fputs("ERROR: No third child node in basic test!\n", stderr); mxmlDelete(tree); return (1); } if (node->type != MXML_REAL) { fprintf(stderr, "ERROR: Third child has type %s (%d), expected MXML_REAL!\n", node->type < MXML_ELEMENT || node->type > MXML_TEXT ? "UNKNOWN" : types[node->type], node->type); mxmlDelete(tree); return (1); } if (node->value.real != 123.4f) { fprintf(stderr, "ERROR: Third child value is %f, expected 123.4!\n", node->value.real); mxmlDelete(tree); return (1); } node = node->next; if (!node) { fputs("ERROR: No fourth child node in basic test!\n", stderr); mxmlDelete(tree); return (1); } if (node->type != MXML_TEXT) { fprintf(stderr, "ERROR: Fourth child has type %s (%d), expected MXML_TEXT!\n", node->type < MXML_ELEMENT || node->type > MXML_TEXT ? "UNKNOWN" : types[node->type], node->type); mxmlDelete(tree); return (1); } if (!node->value.text.whitespace || !node->value.text.string || strcmp(node->value.text.string, "text")) { fprintf(stderr, "ERROR: Fourth child value is %d,\"%s\", expected 1,\"text\"!\n", node->value.text.whitespace, node->value.text.string ? node->value.text.string : "(null)"); mxmlDelete(tree); return (1); } for (i = 0; i < 4; i ++) { node = node->next; if (!node) { fprintf(stderr, "ERROR: No group #%d child node in basic test!\n", i + 1); mxmlDelete(tree); return (1); } if (node->type != MXML_ELEMENT) { fprintf(stderr, "ERROR: Group child #%d has type %s (%d), expected MXML_ELEMENT!\n", i + 1, node->type < MXML_ELEMENT || node->type > MXML_TEXT ? "UNKNOWN" : types[node->type], node->type); mxmlDelete(tree); return (1); } } /* * Test mxmlFindPath... */ node = mxmlFindPath(tree, "*/two"); if (!node) { fputs("ERROR: Unable to find value for \"*/two\".\n", stderr); mxmlDelete(tree); return (1); } else if (node->type != MXML_OPAQUE || strcmp(node->value.opaque, "value")) { fputs("ERROR: Bad value for \"*/two\".\n", stderr); mxmlDelete(tree); return (1); } node = mxmlFindPath(tree, "foo/*/two"); if (!node) { fputs("ERROR: Unable to find value for \"foo/*/two\".\n", stderr); mxmlDelete(tree); return (1); } else if (node->type != MXML_OPAQUE || strcmp(node->value.opaque, "value")) { fputs("ERROR: Bad value for \"foo/*/two\".\n", stderr); mxmlDelete(tree); return (1); } node = mxmlFindPath(tree, "foo/bar/one/two"); if (!node) { fputs("ERROR: Unable to find value for \"foo/bar/one/two\".\n", stderr); mxmlDelete(tree); return (1); } else if (node->type != MXML_OPAQUE || strcmp(node->value.opaque, "value")) { fputs("ERROR: Bad value for \"foo/bar/one/two\".\n", stderr); mxmlDelete(tree); return (1); } /* * Test indices... */ ind = mxmlIndexNew(tree, NULL, NULL); if (!ind) { fputs("ERROR: Unable to create index of all nodes!\n", stderr); mxmlDelete(tree); return (1); } if (ind->num_nodes != 10) { fprintf(stderr, "ERROR: Index of all nodes contains %d " "nodes; expected 10!\n", ind->num_nodes); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexReset(ind); if (!mxmlIndexFind(ind, "group", NULL)) { fputs("ERROR: mxmlIndexFind for \"group\" failed!\n", stderr); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexDelete(ind); ind = mxmlIndexNew(tree, "group", NULL); if (!ind) { fputs("ERROR: Unable to create index of groups!\n", stderr); mxmlDelete(tree); return (1); } if (ind->num_nodes != 4) { fprintf(stderr, "ERROR: Index of groups contains %d " "nodes; expected 4!\n", ind->num_nodes); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexReset(ind); if (!mxmlIndexEnum(ind)) { fputs("ERROR: mxmlIndexEnum failed!\n", stderr); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexDelete(ind); ind = mxmlIndexNew(tree, NULL, "type"); if (!ind) { fputs("ERROR: Unable to create index of type attributes!\n", stderr); mxmlDelete(tree); return (1); } if (ind->num_nodes != 3) { fprintf(stderr, "ERROR: Index of type attributes contains %d " "nodes; expected 3!\n", ind->num_nodes); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexReset(ind); if (!mxmlIndexFind(ind, NULL, "string")) { fputs("ERROR: mxmlIndexFind for \"string\" failed!\n", stderr); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexDelete(ind); ind = mxmlIndexNew(tree, "group", "type"); if (!ind) { fputs("ERROR: Unable to create index of elements and attributes!\n", stderr); mxmlDelete(tree); return (1); } if (ind->num_nodes != 3) { fprintf(stderr, "ERROR: Index of elements and attributes contains %d " "nodes; expected 3!\n", ind->num_nodes); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexReset(ind); if (!mxmlIndexFind(ind, "group", "string")) { fputs("ERROR: mxmlIndexFind for \"string\" failed!\n", stderr); mxmlIndexDelete(ind); mxmlDelete(tree); return (1); } mxmlIndexDelete(ind); /* * Check the mxmlDelete() works properly... */ for (i = 0; i < 9; i ++) { if (tree->child) mxmlDelete(tree->child); else { fprintf(stderr, "ERROR: Child pointer prematurely NULL on child #%d\n", i + 1); mxmlDelete(tree); return (1); } } if (tree->child) { fputs("ERROR: Child pointer not NULL after deleting all children!\n", stderr); return (1); } if (tree->last_child) { fputs("ERROR: Last child pointer not NULL after deleting all children!\n", stderr); return (1); } mxmlDelete(tree); /* * Open the file... */ if (argv[1][0] == '<') tree = mxmlLoadString(NULL, argv[1], type_cb); else if ((fp = fopen(argv[1], "rb")) == NULL) { perror(argv[1]); return (1); } else { /* * Read the file... */ tree = mxmlLoadFile(NULL, fp, type_cb); fclose(fp); } if (!tree) { fputs("Unable to read XML file!\n", stderr); return (1); } if (!strcmp(argv[1], "test.xml")) { /* * Verify that mxmlFindElement() and indirectly mxmlWalkNext() work * properly... */ if ((node = mxmlFindElement(tree, tree, "choice", NULL, NULL, MXML_DESCEND)) == NULL) { fputs("Unable to find first element in XML tree!\n", stderr); mxmlDelete(tree); return (1); } if (!mxmlFindElement(node, tree, "choice", NULL, NULL, MXML_NO_DESCEND)) { fputs("Unable to find second element in XML tree!\n", stderr); mxmlDelete(tree); return (1); } } /* * Print the XML tree... */ mxmlSaveFile(tree, stdout, whitespace_cb); /* * Save the XML tree to a string and print it... */ if (mxmlSaveString(tree, buffer, sizeof(buffer), whitespace_cb) > 0) fputs(buffer, stderr); /* * Delete the tree... */ mxmlDelete(tree); /* * Read from/write to file descriptors... */ if (argv[1][0] != '<') { /* * Open the file again... */ if ((fd = open(argv[1], O_RDONLY | O_BINARY)) < 0) { perror(argv[1]); return (1); } /* * Read the file... */ tree = mxmlLoadFd(NULL, fd, type_cb); close(fd); /* * Create filename.xmlfd... */ snprintf(buffer, sizeof(buffer), "%sfd", argv[1]); if ((fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) < 0) { perror(buffer); mxmlDelete(tree); return (1); } /* * Write the file... */ mxmlSaveFd(tree, fd, whitespace_cb); close(fd); /* * Delete the tree... */ mxmlDelete(tree); } /* * Test SAX methods... */ memset(event_counts, 0, sizeof(event_counts)); if (argv[1][0] == '<') mxmlSAXLoadString(NULL, argv[1], type_cb, sax_cb, NULL); else if ((fp = fopen(argv[1], "rb")) == NULL) { perror(argv[1]); return (1); } else { /* * Read the file... */ mxmlSAXLoadFile(NULL, fp, type_cb, sax_cb, NULL); fclose(fp); } if (!strcmp(argv[1], "test.xml")) { if (event_counts[MXML_SAX_CDATA] != 1) { fprintf(stderr, "MXML_SAX_CDATA seen %d times, expected 1 times!\n", event_counts[MXML_SAX_CDATA]); return (1); } if (event_counts[MXML_SAX_COMMENT] != 1) { fprintf(stderr, "MXML_SAX_COMMENT seen %d times, expected 1 times!\n", event_counts[MXML_SAX_COMMENT]); return (1); } if (event_counts[MXML_SAX_DATA] != 60) { fprintf(stderr, "MXML_SAX_DATA seen %d times, expected 60 times!\n", event_counts[MXML_SAX_DATA]); return (1); } if (event_counts[MXML_SAX_DIRECTIVE] != 1) { fprintf(stderr, "MXML_SAX_DIRECTIVE seen %d times, expected 1 times!\n", event_counts[MXML_SAX_DIRECTIVE]); return (1); } if (event_counts[MXML_SAX_ELEMENT_CLOSE] != 20) { fprintf(stderr, "MXML_SAX_ELEMENT_CLOSE seen %d times, expected 20 times!\n", event_counts[MXML_SAX_ELEMENT_CLOSE]); return (1); } if (event_counts[MXML_SAX_ELEMENT_OPEN] != 20) { fprintf(stderr, "MXML_SAX_ELEMENT_OPEN seen %d times, expected 20 times!\n", event_counts[MXML_SAX_ELEMENT_OPEN]); return (1); } } /* * Return... */ return (0); } /* * 'sax_cb()' - Process nodes via SAX. */ void sax_cb(mxml_node_t *node, /* I - Current node */ mxml_sax_event_t event, /* I - SAX event */ void *data) /* I - SAX user data */ { /* * This SAX callback just counts the different events. */ event_counts[event] ++; } /* * 'type_cb()' - XML data type callback for mxmlLoadFile()... */ mxml_type_t /* O - Data type */ type_cb(mxml_node_t *node) /* I - Element node */ { const char *type; /* Type string */ /* * You can lookup attributes and/or use the element name, hierarchy, etc... */ if ((type = mxmlElementGetAttr(node, "type")) == NULL) type = node->value.element.name; if (!strcmp(type, "integer")) return (MXML_INTEGER); else if (!strcmp(type, "opaque") || !strcmp(type, "pre")) return (MXML_OPAQUE); else if (!strcmp(type, "real")) return (MXML_REAL); else return (MXML_TEXT); } /* * 'whitespace_cb()' - Let the mxmlSaveFile() function know when to insert * newlines and tabs... */ const char * /* O - Whitespace string or NULL */ whitespace_cb(mxml_node_t *node, /* I - Element node */ int where) /* I - Open or close tag? */ { mxml_node_t *parent; /* Parent node */ int level; /* Indentation level */ const char *name; /* Name of element */ static const char *tabs = "\t\t\t\t\t\t\t\t"; /* Tabs for indentation */ /* * We can conditionally break to a new line before or after any element. * These are just common HTML elements... */ name = node->value.element.name; if (!strcmp(name, "html") || !strcmp(name, "head") || !strcmp(name, "body") || !strcmp(name, "pre") || !strcmp(name, "p") || !strcmp(name, "h1") || !strcmp(name, "h2") || !strcmp(name, "h3") || !strcmp(name, "h4") || !strcmp(name, "h5") || !strcmp(name, "h6")) { /* * Newlines before open and after close... */ if (where == MXML_WS_BEFORE_OPEN || where == MXML_WS_AFTER_CLOSE) return ("\n"); } else if (!strcmp(name, "dl") || !strcmp(name, "ol") || !strcmp(name, "ul")) { /* * Put a newline before and after list elements... */ return ("\n"); } else if (!strcmp(name, "dd") || !strcmp(name, "dt") || !strcmp(name, "li")) { /* * Put a tab before
  • 's,
    's, and
    's, and a newline after them... */ if (where == MXML_WS_BEFORE_OPEN) return ("\t"); else if (where == MXML_WS_AFTER_CLOSE) return ("\n"); } else if (!strncmp(name, "?xml", 4)) { if (where == MXML_WS_AFTER_OPEN) return ("\n"); else return (NULL); } else if (where == MXML_WS_BEFORE_OPEN || ((!strcmp(name, "choice") || !strcmp(name, "option")) && where == MXML_WS_BEFORE_CLOSE)) { for (level = -1, parent = node->parent; parent; level ++, parent = parent->parent); if (level > 8) level = 8; else if (level < 0) level = 0; return (tabs + 8 - level); } else if (where == MXML_WS_AFTER_CLOSE || ((!strcmp(name, "group") || !strcmp(name, "option") || !strcmp(name, "choice")) && where == MXML_WS_AFTER_OPEN)) return ("\n"); else if (where == MXML_WS_AFTER_OPEN && !node->child) return ("\n"); /* * Return NULL for no added whitespace... */ return (NULL); } /* * End of "$Id: testmxml.c 439 2011-04-13 15:43:32Z mike $". */ cmtk-3.0.0/Utilities/mxml/README0000644000177700000170000001415211747570117015334 0ustar torstenmanREADME - 2011-12-20 ------------------- INTRODUCTION This README file describes the Mini-XML library version 2.7. Mini-XML is a small XML parsing library that you can use to read XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a "make" program. Mini-XML provides the following functionality: - Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings. - Data is stored in a linked-list tree structure, preserving the XML data hierarchy. - Supports arbitrary element names, attributes, and attribute values with no preset limits, just available memory. - Supports integer, real, opaque ("cdata"), and text data types in "leaf" nodes. - Functions for creating and managing trees of data. - "Find" and "walk" functions for easily locating and navigating trees of data. Mini-XML doesn't do validation or other types of processing on the data based upon schema files or other sources of definition information. BUILDING Mini-XML Mini-XML comes with an autoconf-based configure script; just type the following command to get things going: ./configure The default install prefix is /usr/local, which can be overridden using the --prefix option: ./configure --prefix=/foo Other configure options can be found using the --help option: ./configure --help Once you have configured the software, type "make" to do the build and run the test program to verify that things are working, as follows: make If you are using Mini-XML under Microsoft Windows with Visual C++ 2008, use the included project files in the "vcnet" subdirectory to build the library instead. INSTALLING Mini-XML The "install" target will install Mini-XML in the lib and include directories: make install Once you have installed it, use the "-lmxml" option to link your application against it. DOCUMENTATION The documentation is available in the "doc" subdirectory in the files "mxml.html" (HTML) and "mxml.pdf" (PDF). You can also look at the "testmxml.c" and "mxmldoc.c" source files for examples of using Mini-XML. Mini-XML provides a single header file which you include: #include Nodes are defined by the "mxml_node_t" structure; the "type" member defines the node type (element, integer, opaque, real, or text) which determines which value you want to look at in the "value" union. New nodes can be created using the "mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()", "mxmlNewReal()", and "mxmlNewText()" functions. Only elements can have child nodes, and the top node must be an element, usually "?xml". You load an XML file using the "mxmlLoadFile()" function: FILE *fp; mxml_node_t *tree; fp = fopen("filename.xml", "r"); tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK); fclose(fp); Similarly, you save an XML file using the "mxmlSaveFile()" function: FILE *fp; mxml_node_t *tree; fp = fopen("filename.xml", "w"); mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); fclose(fp); The "mxmlLoadString()", "mxmlSaveAllocString()", and "mxmlSaveString()" functions load XML node trees from and save XML node trees to strings: char buffer[8192]; char *ptr; mxml_node_t *tree; ... tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK); ... mxmlSaveString(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK); ... ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); You can find a named element/node using the "mxmlFindElement()" function: mxml_node_t *node = mxmlFindElement(tree, tree, "name", "attr", "value", MXML_DESCEND); The "name", "attr", and "value" arguments can be passed as NULL to act as wildcards, e.g.: /* Find the first "a" element */ node = mxmlFindElement(tree, tree, "a", NULL, NULL, MXML_DESCEND); /* Find the first "a" element with "href" attribute */ node = mxmlFindElement(tree, tree, "a", "href", NULL, MXML_DESCEND); /* Find the first "a" element with "href" to a URL */ node = mxmlFindElement(tree, tree, "a", "href", "http://www.minixml.org/", MXML_DESCEND); /* Find the first element with a "src" attribute*/ node = mxmlFindElement(tree, tree, NULL, "src", NULL, MXML_DESCEND); /* Find the first element with a "src" = "foo.jpg" */ node = mxmlFindElement(tree, tree, NULL, "src", "foo.jpg", MXML_DESCEND); You can also iterate with the same function: mxml_node_t *node; for (node = mxmlFindElement(tree, tree, "name", NULL, NULL, MXML_DESCEND); node != NULL; node = mxmlFindElement(node, tree, "name", NULL, NULL, MXML_DESCEND)) { ... do something ... } The "mxmlFindPath()" function finds the (first) value node under a specific element using a "path": mxml_node_t *value = mxmlFindPath(tree, "path/to/*/foo/bar"); The "mxmlGetInteger()", "mxmlGetOpaque()", "mxmlGetReal()", and "mxmlGetText()" functions retrieve the value from a node: mxml_node_t *node; int intvalue = mxmlGetInteger(node); const char *opaquevalue = mxmlGetOpaque(node); double realvalue = mxmlGetReal(node); int whitespacevalue; const char *textvalue = mxmlGetText(node, &whitespacevalue); Finally, once you are done with the XML data, use the "mxmlDelete()" function to recursively free the memory that is used for a particular node or the entire tree: mxmlDelete(tree); GETTING HELP AND REPORTING PROBLEMS The Mini-XML web site provides access to a discussion forum and bug reporting page: http://www.minixml.org/ LEGAL STUFF The Mini-XML library is Copyright 2003-2011 by Michael Sweet. License terms are described in the file "COPYING". cmtk-3.0.0/Utilities/mxml/mxml.list.in0000644000177700000170000000631611210045173016716 0ustar torstenman# # "$Id: mxml.list.in 399 2009-05-17 17:20:51Z mike $" # # EPM software list file for Mini-XML, a small XML library. # # Copyright 2003-2009 by Michael Sweet. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2, 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. # # Directories... $prefix=@prefix@ $exec_prefix=@exec_prefix@ $bindir=@bindir@ $datarootdir=@datarootdir@ $docdir=@docdir@ $includedir=@includedir@ $libdir=@libdir@ $mandir=@mandir@ $srcdir=@srcdir@ $PICFLAG=@PICFLAG@ # Product information %product mxml %copyright 2003-2009 by Michael Sweet %vendor Michael Sweet %license ${srcdir}/COPYING %readme ${srcdir}/README %version @VERSION@ %description <], [pthread_create(0, 0, 0, 0);], have_pthread=yes) AC_MSG_RESULT([$have_pthread]) LIBS="$SAVELIBS" if test $have_pthread = yes; then PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT" PTHREAD_LIBS="$flag" # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to # be POSIX-compliant... :( if test $uname = SunOS; then PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" fi break fi done fi fi AC_SUBST(PTHREAD_FLAGS) AC_SUBST(PTHREAD_LIBS) dnl Shared library support... DSO="${DSO:=:}" DSOFLAGS="${DSOFLAGS:=}" AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=no]) if test x$enable_shared != xno; then AC_MSG_CHECKING(for shared library support) PICFLAG=1 case "$uname" in SunOS* | UNIX_S*) AC_MSG_RESULT(yes) LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)" LDFLAGS="$LDFLAGS -R\$(libdir)" ;; HP-UX*) AC_MSG_RESULT(yes) LIBMXML="libmxml.sl.1" DSO="ld" DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)" LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)" ;; IRIX) AC_MSG_RESULT(yes) LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)" ;; OSF1* | Linux | GNU) AC_MSG_RESULT(yes) LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)" LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)" ;; *BSD*) AC_MSG_RESULT(yes) LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)" LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)" ;; Darwin*) AC_MSG_RESULT(yes) LIBMXML="libmxml.1.dylib" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -lc" ;; *) AC_MSG_RESULT(no) AC_MSG_WARN(shared libraries not supported on this platform.) PICFLAG=0 LIBMXML="libmxml.a" ;; esac else PICFLAG=0 LIBMXML="libmxml.a" fi AC_SUBST(DSO) AC_SUBST(DSOFLAGS) AC_SUBST(LIBMXML) AC_SUBST(PICFLAG) dnl Add -Wall for GCC... if test -n "$GCC"; then CFLAGS="-Wall $CFLAGS" if test "x$OPTIM" = x; then OPTIM="-Os -g" fi if test "x$use_ansi" = xyes; then CFLAGS="-ansi -pedantic $CFLAGS" fi if test $PICFLAG = 1 -a $uname != AIX; then OPTIM="-fPIC $OPTIM" fi else case $uname in HP-UX*) CFLAGS="-Ae $CFLAGS" if test "x$OPTIM" = x; then OPTIM="-O" fi OPTIM="+DAportable $OPTIM" if test $PICFLAG = 1; then OPTIM="+z $OPTIM" fi ;; UNIX_SVR* | SunOS*) if test "x$OPTIM" = x; then OPTIM="-O" fi if test $PICFLAG = 1; then OPTIM="-KPIC $OPTIM" fi ;; *) if test "x$OPTIM" = x; then OPTIM="-O" fi ;; esac fi dnl Fix "prefix" variable if it hasn't been specified... if test "$prefix" = "NONE"; then prefix="/usr/local" fi dnl Fix "exec_prefix" variable if it hasn't been specified... if test "$exec_prefix" = "NONE"; then exec_prefix="$prefix" fi dnl Fix "docdir" variable if it hasn't been specified... if test "$docdir" = "NONE"; then docdir="$datadir/doc/mxml" fi dnl Fix "mandir" variable if it hasn't been specified... if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then case "$uname" in *BSD* | Darwin* | Linux*) # BSD, Darwin (MacOS X), and Linux mandir="/usr/share/man" ;; IRIX*) # SGI IRIX mandir="/usr/share/catman/u_man" ;; *) # All others mandir="/usr/man" ;; esac fi dnl pkg-config stuff... if test "$includedir" != /usr/include; then PC_CFLAGS="-I$includedir" else PC_CFLAGS="" fi if test "$libdir" != /usr/lib; then PC_LIBS="-L$libdir -lmxml" else PC_LIBS="-lmxml" fi AC_SUBST(PC_CFLAGS) AC_SUBST(PC_LIBS) dnl Output the makefile, etc... AC_OUTPUT(Makefile mxml.list mxml.pc) dnl dnl End of "$Id: configure.in 427 2011-01-03 02:03:29Z mike $". dnl cmtk-3.0.0/Utilities/mxml/mxmldoc.c0000644000177700000170000043237311747570117016274 0ustar torstenman/*#define DEBUG 1*/ /* * "$Id: mxmldoc.c 440 2011-08-11 18:51:26Z mike $" * * Documentation generator using Mini-XML, a small XML-like file parsing * library. * * Copyright 2003-2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * main() - Main entry for test program. * add_variable() - Add a variable or argument. * find_public() - Find a public function, type, etc. * get_comment_info() - Get info from comment. * get_text() - Get the text for a node. * load_cb() - Set the type of child nodes. * new_documentation() - Create a new documentation tree. * remove_directory() - Remove a directory. * safe_strcpy() - Copy a string allowing for overlapping strings. * scan_file() - Scan a source file. * sort_node() - Insert a node sorted into a tree. * update_comment() - Update a comment node. * usage() - Show program usage... * write_description() - Write the description text. * write_element() - Write an element's text nodes. * write_file() - Copy a file to the output. * write_function() - Write documentation for a function. * write_html() - Write HTML documentation. * write_html_head() - Write the standard HTML header. * write_man() - Write manpage documentation. * write_scu() - Write a structure, class, or union. * write_string() - Write a string, quoting HTML special chars as needed. * write_toc() - Write a table-of-contents. * write_tokens() - Write nodes for all APIs. * ws_cb() - Whitespace callback for saving. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" #include #include #ifndef WIN32 # include # include #endif /* !WIN32 */ #ifdef __APPLE__ # include # include extern char **environ; #endif /* __APPLE__ */ /* * This program scans source and header files and produces public API * documentation for code that conforms to the CUPS Configuration * Management Plan (CMP) coding standards. Please see the following web * page for details: * * http://www.cups.org/cmp.html * * Using Mini-XML, this program creates and maintains an XML representation * of the public API code documentation which can then be converted to HTML * as desired. The following is a poor-man's schema: * * * * * [optional...] * * descriptive text * * * * descriptive text * ... * * * * descriptive text * type string * * * * descriptive text * * descriptive text * type string * * * descriptive text * type string * * function names separated by spaces * * * * descriptive text * type string * * * * descriptive text * ... * ... * * * * descriptive text * ... * * * * descriptive text * ... * ... * ... * ... * ... * * * */ /* * Basic states for file parser... */ #define STATE_NONE 0 /* No state - whitespace, etc. */ #define STATE_PREPROCESSOR 1 /* Preprocessor directive */ #define STATE_C_COMMENT 2 /* Inside a C comment */ #define STATE_CXX_COMMENT 3 /* Inside a C++ comment */ #define STATE_STRING 4 /* Inside a string constant */ #define STATE_CHARACTER 5 /* Inside a character constant */ #define STATE_IDENTIFIER 6 /* Inside a keyword/identifier */ /* * Output modes... */ #define OUTPUT_NONE 0 /* No output */ #define OUTPUT_HTML 1 /* Output HTML */ #define OUTPUT_XML 2 /* Output XML */ #define OUTPUT_MAN 3 /* Output nroff/man */ #define OUTPUT_TOKENS 4 /* Output docset Tokens.xml file */ /* * Local functions... */ static mxml_node_t *add_variable(mxml_node_t *parent, const char *name, mxml_node_t *type); static mxml_node_t *find_public(mxml_node_t *node, mxml_node_t *top, const char *name); static char *get_comment_info(mxml_node_t *description); static char *get_text(mxml_node_t *node, char *buffer, int buflen); static mxml_type_t load_cb(mxml_node_t *node); static mxml_node_t *new_documentation(mxml_node_t **mxmldoc); static int remove_directory(const char *path); static void safe_strcpy(char *dst, const char *src); static int scan_file(const char *filename, FILE *fp, mxml_node_t *doc); static void sort_node(mxml_node_t *tree, mxml_node_t *func); static void update_comment(mxml_node_t *parent, mxml_node_t *comment); static void usage(const char *option); static void write_description(FILE *out, mxml_node_t *description, const char *element, int summary); static void write_element(FILE *out, mxml_node_t *doc, mxml_node_t *element, int mode); static void write_file(FILE *out, const char *file); static void write_function(FILE *out, mxml_node_t *doc, mxml_node_t *function, int level); static void write_html(const char *section, const char *title, const char *footerfile, const char *headerfile, const char *introfile, const char *cssfile, const char *framefile, const char *docset, const char *docversion, const char *feedname, const char *feedurl, mxml_node_t *doc); static void write_html_head(FILE *out, const char *section, const char *title, const char *cssfile); static void write_man(const char *man_name, const char *section, const char *title, const char *headerfile, const char *footerfile, const char *introfile, mxml_node_t *doc); static void write_scu(FILE *out, mxml_node_t *doc, mxml_node_t *scut); static void write_string(FILE *out, const char *s, int mode); static void write_toc(FILE *out, mxml_node_t *doc, const char *introfile, const char *target, int xml); static void write_tokens(FILE *out, mxml_node_t *doc, const char *path); static const char *ws_cb(mxml_node_t *node, int where); /* * 'main()' - Main entry for test program. */ int /* O - Exit status */ main(int argc, /* I - Number of command-line args */ char *argv[]) /* I - Command-line args */ { int i; /* Looping var */ int len; /* Length of argument */ FILE *fp; /* File to read */ mxml_node_t *doc; /* XML documentation tree */ mxml_node_t *mxmldoc; /* mxmldoc node */ const char *cssfile, /* CSS stylesheet file */ *docset, /* Documentation set directory */ *docversion, /* Documentation set version */ *feedname, /* Feed name for documentation set */ *feedurl, /* Feed URL for documentation set */ *footerfile, /* Footer file */ *framefile, /* Framed HTML basename */ *headerfile, /* Header file */ *introfile, /* Introduction file */ *name, /* Name of manpage */ *path, /* Path to help file for tokens */ *section, /* Section/keywords of documentation */ *title, /* Title of documentation */ *xmlfile; /* XML file */ int mode, /* Output mode */ update; /* Updated XML file */ /* * Check arguments... */ cssfile = NULL; doc = NULL; docset = NULL; docversion = NULL; feedname = NULL; feedurl = NULL; footerfile = NULL; framefile = NULL; headerfile = NULL; introfile = NULL; mode = OUTPUT_HTML; mxmldoc = NULL; name = NULL; path = NULL; section = NULL; title = NULL; update = 0; xmlfile = NULL; for (i = 1; i < argc; i ++) if (!strcmp(argv[i], "--help")) { /* * Show help... */ usage(NULL); } else if (!strcmp(argv[i], "--version")) { /* * Show version... */ puts(MXML_VERSION + 10); return (0); } else if (!strcmp(argv[i], "--css") && !cssfile) { /* * Set CSS stylesheet file... */ i ++; if (i < argc) cssfile = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--docset") && !docset) { /* * Set documentation set directory... */ i ++; if (i < argc) docset = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--docversion") && !docversion) { /* * Set documentation set directory... */ i ++; if (i < argc) docversion = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--footer") && !footerfile) { /* * Set footer file... */ i ++; if (i < argc) footerfile = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--feedname") && !feedname) { /* * Set documentation set feed name... */ i ++; if (i < argc) feedname = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--feedurl") && !feedurl) { /* * Set documentation set feed name... */ i ++; if (i < argc) feedurl = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--framed") && !framefile) { /* * Set base filename for framed HTML output... */ i ++; if (i < argc) framefile = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--header") && !headerfile) { /* * Set header file... */ i ++; if (i < argc) headerfile = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--intro") && !introfile) { /* * Set intro file... */ i ++; if (i < argc) introfile = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--man") && !name) { /* * Output manpage... */ i ++; if (i < argc) { mode = OUTPUT_MAN; name = argv[i]; } else usage(NULL); } else if (!strcmp(argv[i], "--no-output")) mode = OUTPUT_NONE; else if (!strcmp(argv[i], "--section") && !section) { /* * Set section/keywords... */ i ++; if (i < argc) section = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--title") && !title) { /* * Set title... */ i ++; if (i < argc) title = argv[i]; else usage(NULL); } else if (!strcmp(argv[i], "--tokens")) { /* * Output Tokens.xml file... */ mode = OUTPUT_TOKENS; i ++; if (i < argc) path = argv[i]; else usage(NULL); } else if (argv[i][0] == '-') { /* * Unknown/bad option... */ usage(argv[i]); } else { /* * Process XML or source file... */ len = (int)strlen(argv[i]); if (len > 4 && !strcmp(argv[i] + len - 4, ".xml")) { /* * Set XML file... */ if (xmlfile) usage(NULL); xmlfile = argv[i]; if (!doc) { if ((fp = fopen(argv[i], "r")) != NULL) { /* * Read the existing XML file... */ doc = mxmlLoadFile(NULL, fp, load_cb); fclose(fp); if (!doc) { mxmldoc = NULL; fprintf(stderr, "mxmldoc: Unable to read the XML documentation file " "\"%s\"!\n", argv[i]); } else if ((mxmldoc = mxmlFindElement(doc, doc, "mxmldoc", NULL, NULL, MXML_DESCEND)) == NULL) { fprintf(stderr, "mxmldoc: XML documentation file \"%s\" is missing " " node!!\n", argv[i]); mxmlDelete(doc); doc = NULL; } } else { doc = NULL; mxmldoc = NULL; } if (!doc) doc = new_documentation(&mxmldoc); } } else { /* * Load source file... */ update = 1; if (!doc) doc = new_documentation(&mxmldoc); if ((fp = fopen(argv[i], "r")) == NULL) { fprintf(stderr, "mxmldoc: Unable to open source file \"%s\": %s\n", argv[i], strerror(errno)); mxmlDelete(doc); return (1); } else if (scan_file(argv[i], fp, mxmldoc)) { fclose(fp); mxmlDelete(doc); return (1); } else fclose(fp); } } if (update && xmlfile) { /* * Save the updated XML documentation file... */ if ((fp = fopen(xmlfile, "w")) != NULL) { /* * Write over the existing XML file... */ mxmlSetWrapMargin(0); if (mxmlSaveFile(doc, fp, ws_cb)) { fprintf(stderr, "mxmldoc: Unable to write the XML documentation file \"%s\": " "%s!\n", xmlfile, strerror(errno)); fclose(fp); mxmlDelete(doc); return (1); } fclose(fp); } else { fprintf(stderr, "mxmldoc: Unable to create the XML documentation file \"%s\": " "%s!\n", xmlfile, strerror(errno)); mxmlDelete(doc); return (1); } } switch (mode) { case OUTPUT_HTML : /* * Write HTML documentation... */ write_html(section, title ? title : "Documentation", footerfile, headerfile, introfile, cssfile, framefile, docset, docversion, feedname, feedurl, mxmldoc); break; case OUTPUT_MAN : /* * Write manpage documentation... */ write_man(name, section, title, footerfile, headerfile, introfile, mxmldoc); break; case OUTPUT_TOKENS : fputs("\n" "\n", stdout); write_tokens(stdout, mxmldoc, path); fputs("\n", stdout); break; } /* * Delete the tree and return... */ mxmlDelete(doc); return (0); } /* * 'add_variable()' - Add a variable or argument. */ static mxml_node_t * /* O - New variable/argument */ add_variable(mxml_node_t *parent, /* I - Parent node */ const char *name, /* I - "argument" or "variable" */ mxml_node_t *type) /* I - Type nodes */ { mxml_node_t *variable, /* New variable */ *node, /* Current node */ *next; /* Next node */ char buffer[16384], /* String buffer */ *bufptr; /* Pointer into buffer */ #ifdef DEBUG fprintf(stderr, "add_variable(parent=%p, name=\"%s\", type=%p)\n", parent, name, type); #endif /* DEBUG */ /* * Range check input... */ if (!type || !type->child) return (NULL); /* * Create the variable/argument node... */ variable = mxmlNewElement(parent, name); /* * Check for a default value... */ for (node = type->child; node; node = node->next) if (!strcmp(node->value.text.string, "=")) break; if (node) { /* * Default value found, copy it and add as a "default" attribute... */ for (bufptr = buffer; node; bufptr += strlen(bufptr)) { if (node->value.text.whitespace && bufptr > buffer) *bufptr++ = ' '; strcpy(bufptr, node->value.text.string); next = node->next; mxmlDelete(node); node = next; } mxmlElementSetAttr(variable, "default", buffer); } /* * Extract the argument/variable name... */ if (type->last_child->value.text.string[0] == ')') { /* * Handle "type (*name)(args)"... */ for (node = type->child; node; node = node->next) if (node->value.text.string[0] == '(') break; for (bufptr = buffer; node; bufptr += strlen(bufptr)) { if (node->value.text.whitespace && bufptr > buffer) *bufptr++ = ' '; strcpy(bufptr, node->value.text.string); next = node->next; mxmlDelete(node); node = next; } } else { /* * Handle "type name"... */ strcpy(buffer, type->last_child->value.text.string); mxmlDelete(type->last_child); } /* * Set the name... */ mxmlElementSetAttr(variable, "name", buffer); /* * Add the remaining type information to the variable node... */ mxmlAdd(variable, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, type); /* * Add new new variable node... */ return (variable); } /* * 'find_public()' - Find a public function, type, etc. */ static mxml_node_t * /* I - Found node or NULL */ find_public(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ const char *name) /* I - Name of element */ { mxml_node_t *description, /* Description node */ *comment; /* Comment node */ for (node = mxmlFindElement(node, top, name, NULL, NULL, node == top ? MXML_DESCEND_FIRST : MXML_NO_DESCEND); node; node = mxmlFindElement(node, top, name, NULL, NULL, MXML_NO_DESCEND)) { /* * Get the description for this node... */ description = mxmlFindElement(node, node, "description", NULL, NULL, MXML_DESCEND_FIRST); /* * A missing or empty description signals a private node... */ if (!description) continue; /* * Look for @private@ in the comment text... */ for (comment = description->child; comment; comment = comment->next) if ((comment->type == MXML_TEXT && strstr(comment->value.text.string, "@private@")) || (comment->type == MXML_OPAQUE && strstr(comment->value.opaque, "@private@"))) break; if (!comment) { /* * No @private@, so return this node... */ return (node); } } /* * If we get here, there are no (more) public nodes... */ return (NULL); } /* * 'get_comment_info()' - Get info from comment. */ static char * /* O - Info from comment */ get_comment_info( mxml_node_t *description) /* I - Description node */ { char text[10240], /* Description text */ since[255], /* @since value */ *ptr; /* Pointer into text */ static char info[1024]; /* Info string */ if (!description) return (""); get_text(description, text, sizeof(text)); for (ptr = strchr(text, '@'); ptr; ptr = strchr(ptr + 1, '@')) { if (!strncmp(ptr, "@deprecated@", 12)) return (" DEPRECATED "); else if (!strncmp(ptr, "@since ", 7)) { strncpy(since, ptr + 7, sizeof(since) - 1); since[sizeof(since) - 1] = '\0'; if ((ptr = strchr(since, '@')) != NULL) *ptr = '\0'; snprintf(info, sizeof(info), " %s ", since); return (info); } } return (""); } /* * 'get_text()' - Get the text for a node. */ static char * /* O - Text in node */ get_text(mxml_node_t *node, /* I - Node to get */ char *buffer, /* I - Buffer */ int buflen) /* I - Size of buffer */ { char *ptr, /* Pointer into buffer */ *end; /* End of buffer */ int len; /* Length of node */ mxml_node_t *current; /* Current node */ ptr = buffer; end = buffer + buflen - 1; for (current = node->child; current && ptr < end; current = current->next) { if (current->type == MXML_TEXT) { if (current->value.text.whitespace) *ptr++ = ' '; len = (int)strlen(current->value.text.string); if (len > (int)(end - ptr)) len = (int)(end - ptr); memcpy(ptr, current->value.text.string, len); ptr += len; } else if (current->type == MXML_OPAQUE) { len = (int)strlen(current->value.opaque); if (len > (int)(end - ptr)) len = (int)(end - ptr); memcpy(ptr, current->value.opaque, len); ptr += len; } } *ptr = '\0'; return (buffer); } /* * 'load_cb()' - Set the type of child nodes. */ static mxml_type_t /* O - Node type */ load_cb(mxml_node_t *node) /* I - Node */ { if (!strcmp(node->value.element.name, "description")) return (MXML_OPAQUE); else return (MXML_TEXT); } /* * 'new_documentation()' - Create a new documentation tree. */ static mxml_node_t * /* O - New documentation */ new_documentation(mxml_node_t **mxmldoc)/* O - mxmldoc node */ { mxml_node_t *doc; /* New documentation */ /* * Create an empty XML documentation file... */ doc = mxmlNewXML(NULL); *mxmldoc = mxmlNewElement(doc, "mxmldoc"); mxmlElementSetAttr(*mxmldoc, "xmlns", "http://www.easysw.com"); mxmlElementSetAttr(*mxmldoc, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); mxmlElementSetAttr(*mxmldoc, "xsi:schemaLocation", "http://www.minixml.org/mxmldoc.xsd"); return (doc); } /* * 'remove_directory()' - Remove a directory. */ static int /* O - 1 on success, 0 on failure */ remove_directory(const char *path) /* I - Directory to remove */ { #ifdef WIN32 /* TODO: Add Windows directory removal code */ #else DIR *dir; /* Directory */ struct dirent *dent; /* Current directory entry */ char filename[1024]; /* Current filename */ struct stat fileinfo; /* File information */ if ((dir = opendir(path)) == NULL) { fprintf(stderr, "mxmldoc: Unable to open directory \"%s\": %s\n", path, strerror(errno)); return (0); } while ((dent = readdir(dir)) != NULL) { /* * Skip "." and ".."... */ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) continue; /* * See if we have a file or directory... */ snprintf(filename, sizeof(filename), "%s/%s", path, dent->d_name); if (stat(filename, &fileinfo)) { fprintf(stderr, "mxmldoc: Unable to stat \"%s\": %s\n", filename, strerror(errno)); closedir(dir); return (0); } if (S_ISDIR(fileinfo.st_mode)) { if (!remove_directory(filename)) { closedir(dir); return (0); } } else if (unlink(filename)) { fprintf(stderr, "mxmldoc: Unable to remove \"%s\": %s\n", filename, strerror(errno)); closedir(dir); return (0); } } closedir(dir); if (rmdir(path)) { fprintf(stderr, "mxmldoc: Unable to remove directory \"%s\": %s\n", path, strerror(errno)); return (0); } #endif /* WIN32 */ return (1); } /* * 'safe_strcpy()' - Copy a string allowing for overlapping strings. */ static void safe_strcpy(char *dst, /* I - Destination string */ const char *src) /* I - Source string */ { while (*src) *dst++ = *src++; *dst = '\0'; } /* * 'scan_file()' - Scan a source file. */ static int /* O - 0 on success, -1 on error */ scan_file(const char *filename, /* I - Filename */ FILE *fp, /* I - File to scan */ mxml_node_t *tree) /* I - Function tree */ { int state, /* Current parser state */ braces, /* Number of braces active */ parens; /* Number of active parenthesis */ int ch; /* Current character */ char buffer[65536], /* String buffer */ *bufptr; /* Pointer into buffer */ const char *scope; /* Current variable/function scope */ mxml_node_t *comment, /* node */ *constant, /* node */ *enumeration, /* node */ *function, /* node */ *fstructclass, /* function struct/class node */ *structclass, /* or node */ *typedefnode, /* node */ *variable, /* or node */ *returnvalue, /* node */ *type, /* node */ *description, /* node */ *node, /* Current node */ *next; /* Next node */ #if DEBUG > 1 mxml_node_t *temp; /* Temporary node */ int oldstate, /* Previous state */ oldch; /* Old character */ static const char *states[] = /* State strings */ { "STATE_NONE", "STATE_PREPROCESSOR", "STATE_C_COMMENT", "STATE_CXX_COMMENT", "STATE_STRING", "STATE_CHARACTER", "STATE_IDENTIFIER" }; #endif /* DEBUG > 1 */ #ifdef DEBUG fprintf(stderr, "scan_file(filename=\"%s\", fp=%p, tree=%p)\n", filename, fp, tree); #endif /* DEBUG */ /* * Initialize the finite state machine... */ state = STATE_NONE; braces = 0; parens = 0; bufptr = buffer; comment = mxmlNewElement(MXML_NO_PARENT, "temp"); constant = NULL; enumeration = NULL; function = NULL; variable = NULL; returnvalue = NULL; type = NULL; description = NULL; typedefnode = NULL; structclass = NULL; fstructclass = NULL; if (!strcmp(tree->value.element.name, "class")) scope = "private"; else scope = NULL; /* * Read until end-of-file... */ while ((ch = getc(fp)) != EOF) { #if DEBUG > 1 oldstate = state; oldch = ch; #endif /* DEBUG > 1 */ switch (state) { case STATE_NONE : /* No state - whitespace, etc. */ switch (ch) { case '/' : /* Possible C/C++ comment */ ch = getc(fp); bufptr = buffer; if (ch == '*') state = STATE_C_COMMENT; else if (ch == '/') state = STATE_CXX_COMMENT; else { ungetc(ch, fp); if (type) { #ifdef DEBUG fputs("Identifier: <<<< / >>>\n", stderr); #endif /* DEBUG */ ch = type->last_child->value.text.string[0]; mxmlNewText(type, isalnum(ch) || ch == '_', "/"); } } break; case '#' : /* Preprocessor */ #ifdef DEBUG fputs(" #preprocessor...\n", stderr); #endif /* DEBUG */ state = STATE_PREPROCESSOR; break; case '\'' : /* Character constant */ state = STATE_CHARACTER; bufptr = buffer; *bufptr++ = ch; break; case '\"' : /* String constant */ state = STATE_STRING; bufptr = buffer; *bufptr++ = ch; break; case '{' : #ifdef DEBUG fprintf(stderr, " open brace, function=%p, type=%p...\n", function, type); if (type) fprintf(stderr, " type->child=\"%s\"...\n", type->child->value.text.string); #endif /* DEBUG */ if (function) { if (fstructclass) { sort_node(fstructclass, function); fstructclass = NULL; } else sort_node(tree, function); function = NULL; } else if (type && type->child && ((!strcmp(type->child->value.text.string, "typedef") && type->child->next && (!strcmp(type->child->next->value.text.string, "struct") || !strcmp(type->child->next->value.text.string, "union") || !strcmp(type->child->next->value.text.string, "class"))) || !strcmp(type->child->value.text.string, "union") || !strcmp(type->child->value.text.string, "struct") || !strcmp(type->child->value.text.string, "class"))) { /* * Start of a class or structure... */ if (!strcmp(type->child->value.text.string, "typedef")) { #ifdef DEBUG fputs(" starting typedef...\n", stderr); #endif /* DEBUG */ typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef"); mxmlDelete(type->child); } else typedefnode = NULL; structclass = mxmlNewElement(MXML_NO_PARENT, type->child->value.text.string); #ifdef DEBUG fprintf(stderr, "%c%s: <<<< %s >>>\n", toupper(type->child->value.text.string[0]), type->child->value.text.string + 1, type->child->next ? type->child->next->value.text.string : "(noname)"); fputs(" type =", stderr); for (node = type->child; node; node = node->next) fprintf(stderr, " \"%s\"", node->value.text.string); putc('\n', stderr); fprintf(stderr, " scope = %s\n", scope ? scope : "(null)"); #endif /* DEBUG */ if (type->child->next) { mxmlElementSetAttr(structclass, "name", type->child->next->value.text.string); sort_node(tree, structclass); } if (typedefnode && type->child) type->child->value.text.whitespace = 0; else if (structclass && type->child && type->child->next && type->child->next->next) { for (bufptr = buffer, node = type->child->next->next; node; bufptr += strlen(bufptr)) { if (node->value.text.whitespace && bufptr > buffer) *bufptr++ = ' '; strcpy(bufptr, node->value.text.string); next = node->next; mxmlDelete(node); node = next; } mxmlElementSetAttr(structclass, "parent", buffer); mxmlDelete(type); type = NULL; } else { mxmlDelete(type); type = NULL; } if (typedefnode && comment->last_child) { /* * Copy comment for typedef as well as class/struct/union... */ mxmlNewText(comment, 0, comment->last_child->value.text.string); description = mxmlNewElement(typedefnode, "description"); #ifdef DEBUG fprintf(stderr, " duplicating comment %p/%p for typedef...\n", comment->last_child, comment->child); #endif /* DEBUG */ update_comment(typedefnode, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); } description = mxmlNewElement(structclass, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to %s...\n", comment->last_child, comment->child, structclass->value.element.name); #endif /* DEBUG */ update_comment(structclass, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); if (scan_file(filename, fp, structclass)) { mxmlDelete(comment); return (-1); } #ifdef DEBUG fputs(" ended typedef...\n", stderr); #endif /* DEBUG */ structclass = NULL; break; } else if (type && type->child && type->child->next && (!strcmp(type->child->value.text.string, "enum") || (!strcmp(type->child->value.text.string, "typedef") && !strcmp(type->child->next->value.text.string, "enum")))) { /* * Enumeration type... */ if (!strcmp(type->child->value.text.string, "typedef")) { #ifdef DEBUG fputs(" starting typedef...\n", stderr); #endif /* DEBUG */ typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef"); mxmlDelete(type->child); } else typedefnode = NULL; enumeration = mxmlNewElement(MXML_NO_PARENT, "enumeration"); #ifdef DEBUG fprintf(stderr, "Enumeration: <<<< %s >>>\n", type->child->next ? type->child->next->value.text.string : "(noname)"); #endif /* DEBUG */ if (type->child->next) { mxmlElementSetAttr(enumeration, "name", type->child->next->value.text.string); sort_node(tree, enumeration); } if (typedefnode && type->child) type->child->value.text.whitespace = 0; else { mxmlDelete(type); type = NULL; } if (typedefnode && comment->last_child) { /* * Copy comment for typedef as well as class/struct/union... */ mxmlNewText(comment, 0, comment->last_child->value.text.string); description = mxmlNewElement(typedefnode, "description"); #ifdef DEBUG fprintf(stderr, " duplicating comment %p/%p for typedef...\n", comment->last_child, comment->child); #endif /* DEBUG */ update_comment(typedefnode, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); } description = mxmlNewElement(enumeration, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to enumeration...\n", comment->last_child, comment->child); #endif /* DEBUG */ update_comment(enumeration, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); } else if (type && type->child && !strcmp(type->child->value.text.string, "extern")) { if (scan_file(filename, fp, tree)) { mxmlDelete(comment); return (-1); } } else if (type) { mxmlDelete(type); type = NULL; } braces ++; function = NULL; variable = NULL; break; case '}' : #ifdef DEBUG fputs(" close brace...\n", stderr); #endif /* DEBUG */ if (structclass) scope = NULL; if (!typedefnode) enumeration = NULL; constant = NULL; structclass = NULL; if (braces > 0) braces --; else { mxmlDelete(comment); return (0); } break; case '(' : if (type) { #ifdef DEBUG fputs("Identifier: <<<< ( >>>\n", stderr); #endif /* DEBUG */ mxmlNewText(type, 0, "("); } parens ++; break; case ')' : if (type && parens) { #ifdef DEBUG fputs("Identifier: <<<< ) >>>\n", stderr); #endif /* DEBUG */ mxmlNewText(type, 0, ")"); } if (function && type && !parens) { /* * Check for "void" argument... */ if (type->child && type->child->next) variable = add_variable(function, "argument", type); else mxmlDelete(type); type = NULL; } if (parens > 0) parens --; break; case ';' : #ifdef DEBUG fputs("Identifier: <<<< ; >>>\n", stderr); fprintf(stderr, " enumeration=%p, function=%p, type=%p, type->child=%p, typedefnode=%p\n", enumeration, function, type, type ? type->child : NULL, typedefnode); #endif /* DEBUG */ if (function) { if (!strcmp(tree->value.element.name, "class")) { #ifdef DEBUG fputs(" ADDING FUNCTION TO CLASS\n", stderr); #endif /* DEBUG */ sort_node(tree, function); } else mxmlDelete(function); function = NULL; variable = NULL; } if (type) { /* * See if we have a typedef... */ if (type->child && !strcmp(type->child->value.text.string, "typedef")) { /* * Yes, add it! */ typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef"); for (node = type->child->next; node; node = node->next) if (!strcmp(node->value.text.string, "(")) break; if (node) { for (node = node->next; node; node = node->next) if (strcmp(node->value.text.string, "*")) break; } if (!node) node = type->last_child; #ifdef DEBUG fprintf(stderr, " ADDING TYPEDEF FOR %p(%s)...\n", node, node->value.text.string); #endif /* DEBUG */ mxmlElementSetAttr(typedefnode, "name", node->value.text.string); sort_node(tree, typedefnode); if (type->child != node) mxmlDelete(type->child); mxmlDelete(node); if (type->child) type->child->value.text.whitespace = 0; mxmlAdd(typedefnode, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, type); type = NULL; break; } else if (typedefnode && enumeration) { /* * Add enum typedef... */ node = type->child; #ifdef DEBUG fprintf(stderr, " ADDING TYPEDEF FOR %p(%s)...\n", node, node->value.text.string); #endif /* DEBUG */ mxmlElementSetAttr(typedefnode, "name", node->value.text.string); sort_node(tree, typedefnode); mxmlDelete(type); type = mxmlNewElement(typedefnode, "type"); mxmlNewText(type, 0, "enum"); mxmlNewText(type, 1, mxmlElementGetAttr(enumeration, "name")); enumeration = NULL; type = NULL; break; } mxmlDelete(type); type = NULL; } break; case ':' : if (type) { #ifdef DEBUG fputs("Identifier: <<<< : >>>\n", stderr); #endif /* DEBUG */ mxmlNewText(type, 1, ":"); } break; case '*' : if (type) { #ifdef DEBUG fputs("Identifier: <<<< * >>>\n", stderr); #endif /* DEBUG */ ch = type->last_child->value.text.string[0]; mxmlNewText(type, isalnum(ch) || ch == '_', "*"); } break; case ',' : if (type && !enumeration) { #ifdef DEBUG fputs("Identifier: <<<< , >>>\n", stderr); #endif /* DEBUG */ mxmlNewText(type, 0, ","); } break; case '&' : if (type) { #ifdef DEBUG fputs("Identifier: <<<< & >>>\n", stderr); #endif /* DEBUG */ mxmlNewText(type, 1, "&"); } break; case '+' : if (type) { #ifdef DEBUG fputs("Identifier: <<<< + >>>\n", stderr); #endif /* DEBUG */ ch = type->last_child->value.text.string[0]; mxmlNewText(type, isalnum(ch) || ch == '_', "+"); } break; case '-' : if (type) { #ifdef DEBUG fputs("Identifier: <<<< - >>>\n", stderr); #endif /* DEBUG */ ch = type->last_child->value.text.string[0]; mxmlNewText(type, isalnum(ch) || ch == '_', "-"); } break; case '=' : if (type) { #ifdef DEBUG fputs("Identifier: <<<< = >>>\n", stderr); #endif /* DEBUG */ ch = type->last_child->value.text.string[0]; mxmlNewText(type, isalnum(ch) || ch == '_', "="); } break; default : /* Other */ if (isalnum(ch) || ch == '_' || ch == '.' || ch == ':' || ch == '~') { state = STATE_IDENTIFIER; bufptr = buffer; *bufptr++ = ch; } break; } break; case STATE_PREPROCESSOR : /* Preprocessor directive */ if (ch == '\n') state = STATE_NONE; else if (ch == '\\') getc(fp); break; case STATE_C_COMMENT : /* Inside a C comment */ switch (ch) { case '\n' : while ((ch = getc(fp)) != EOF) if (ch == '*') { ch = getc(fp); if (ch == '/') { *bufptr = '\0'; if (comment->child != comment->last_child) { #ifdef DEBUG fprintf(stderr, " removing comment %p(%20.20s), last comment %p(%20.20s)...\n", comment->child, comment->child ? comment->child->value.text.string : "", comment->last_child, comment->last_child ? comment->last_child->value.text.string : ""); #endif /* DEBUG */ mxmlDelete(comment->child); #ifdef DEBUG fprintf(stderr, " new comment %p, last comment %p...\n", comment->child, comment->last_child); #endif /* DEBUG */ } #ifdef DEBUG fprintf(stderr, " processing comment, variable=%p, " "constant=%p, typedefnode=%p, tree=\"%s\"\n", variable, constant, typedefnode, tree->value.element.name); #endif /* DEBUG */ if (variable) { if (strstr(buffer, "@private@")) { /* * Delete private variables... */ mxmlDelete(variable); } else { description = mxmlNewElement(variable, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to variable...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(variable, mxmlNewText(description, 0, buffer)); } variable = NULL; } else if (constant) { if (strstr(buffer, "@private@")) { /* * Delete private constants... */ mxmlDelete(constant); } else { description = mxmlNewElement(constant, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to constant...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(constant, mxmlNewText(description, 0, buffer)); } constant = NULL; } else if (typedefnode) { if (strstr(buffer, "@private@")) { /* * Delete private typedefs... */ mxmlDelete(typedefnode); if (structclass) { mxmlDelete(structclass); structclass = NULL; } if (enumeration) { mxmlDelete(enumeration); enumeration = NULL; } } else { description = mxmlNewElement(typedefnode, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to typedef %s...\n", comment->last_child, comment->child, mxmlElementGetAttr(typedefnode, "name")); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(typedefnode, mxmlNewText(description, 0, buffer)); if (structclass) { description = mxmlNewElement(structclass, "description"); update_comment(structclass, mxmlNewText(description, 0, buffer)); } else if (enumeration) { description = mxmlNewElement(enumeration, "description"); update_comment(enumeration, mxmlNewText(description, 0, buffer)); } } typedefnode = NULL; } else if (strcmp(tree->value.element.name, "mxmldoc") && !mxmlFindElement(tree, tree, "description", NULL, NULL, MXML_DESCEND_FIRST)) { description = mxmlNewElement(tree, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to parent...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(tree, mxmlNewText(description, 0, buffer)); } else { #ifdef DEBUG fprintf(stderr, " before adding comment, child=%p, last_child=%p\n", comment->child, comment->last_child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); #ifdef DEBUG fprintf(stderr, " after adding comment, child=%p, last_child=%p\n", comment->child, comment->last_child); #endif /* DEBUG */ } #ifdef DEBUG fprintf(stderr, "C comment: <<<< %s >>>\n", buffer); #endif /* DEBUG */ state = STATE_NONE; break; } else ungetc(ch, fp); } else if (ch == '\n' && bufptr > buffer && bufptr < (buffer + sizeof(buffer) - 1)) *bufptr++ = ch; else if (!isspace(ch)) break; if (ch != EOF) ungetc(ch, fp); if (bufptr > buffer && bufptr < (buffer + sizeof(buffer) - 1)) *bufptr++ = '\n'; break; case '/' : if (ch == '/' && bufptr > buffer && bufptr[-1] == '*') { while (bufptr > buffer && (bufptr[-1] == '*' || isspace(bufptr[-1] & 255))) bufptr --; *bufptr = '\0'; if (comment->child != comment->last_child) { #ifdef DEBUG fprintf(stderr, " removing comment %p(%20.20s), last comment %p(%20.20s)...\n", comment->child, comment->child ? comment->child->value.text.string : "", comment->last_child, comment->last_child ? comment->last_child->value.text.string : ""); #endif /* DEBUG */ mxmlDelete(comment->child); #ifdef DEBUG fprintf(stderr, " new comment %p, last comment %p...\n", comment->child, comment->last_child); #endif /* DEBUG */ } #ifdef DEBUG fprintf(stderr, " processing comment, variable=%p, " "constant=%p, typedefnode=%p, tree=\"%s\"\n", variable, constant, typedefnode, tree->value.element.name); #endif /* DEBUG */ if (variable) { if (strstr(buffer, "@private@")) { /* * Delete private variables... */ mxmlDelete(variable); } else { description = mxmlNewElement(variable, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to variable...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(variable, mxmlNewText(description, 0, buffer)); } variable = NULL; } else if (constant) { if (strstr(buffer, "@private@")) { /* * Delete private constants... */ mxmlDelete(constant); } else { description = mxmlNewElement(constant, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to constant...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(constant, mxmlNewText(description, 0, buffer)); } constant = NULL; } else if (typedefnode) { if (strstr(buffer, "@private@")) { /* * Delete private typedefs... */ mxmlDelete(typedefnode); if (structclass) { mxmlDelete(structclass); structclass = NULL; } if (enumeration) { mxmlDelete(enumeration); enumeration = NULL; } } else { description = mxmlNewElement(typedefnode, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to typedef %s...\n", comment->last_child, comment->child, mxmlElementGetAttr(typedefnode, "name")); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(typedefnode, mxmlNewText(description, 0, buffer)); if (structclass) { description = mxmlNewElement(structclass, "description"); update_comment(structclass, mxmlNewText(description, 0, buffer)); } else if (enumeration) { description = mxmlNewElement(enumeration, "description"); update_comment(enumeration, mxmlNewText(description, 0, buffer)); } } typedefnode = NULL; } else if (strcmp(tree->value.element.name, "mxmldoc") && !mxmlFindElement(tree, tree, "description", NULL, NULL, MXML_DESCEND_FIRST)) { description = mxmlNewElement(tree, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to parent...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(tree, mxmlNewText(description, 0, buffer)); } else mxmlNewText(comment, 0, buffer); #ifdef DEBUG fprintf(stderr, "C comment: <<<< %s >>>\n", buffer); #endif /* DEBUG */ state = STATE_NONE; break; } default : if (ch == ' ' && bufptr == buffer) break; if (bufptr < (buffer + sizeof(buffer) - 1)) *bufptr++ = ch; break; } break; case STATE_CXX_COMMENT : /* Inside a C++ comment */ if (ch == '\n') { state = STATE_NONE; *bufptr = '\0'; if (comment->child != comment->last_child) { #ifdef DEBUG fprintf(stderr, " removing comment %p(%20.20s), last comment %p(%20.20s)...\n", comment->child, comment->child ? comment->child->value.text.string : "", comment->last_child, comment->last_child ? comment->last_child->value.text.string : ""); #endif /* DEBUG */ mxmlDelete(comment->child); #ifdef DEBUG fprintf(stderr, " new comment %p, last comment %p...\n", comment->child, comment->last_child); #endif /* DEBUG */ } if (variable) { if (strstr(buffer, "@private@")) { /* * Delete private variables... */ mxmlDelete(variable); } else { description = mxmlNewElement(variable, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to variable...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(variable, mxmlNewText(description, 0, buffer)); } variable = NULL; } else if (constant) { if (strstr(buffer, "@private@")) { /* * Delete private constants... */ mxmlDelete(constant); } else { description = mxmlNewElement(constant, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to constant...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(constant, mxmlNewText(description, 0, buffer)); } constant = NULL; } else if (typedefnode) { if (strstr(buffer, "@private@")) { /* * Delete private typedefs... */ mxmlDelete(typedefnode); typedefnode = NULL; if (structclass) { mxmlDelete(structclass); structclass = NULL; } if (enumeration) { mxmlDelete(enumeration); enumeration = NULL; } } else { description = mxmlNewElement(typedefnode, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to typedef %s...\n", comment->last_child, comment->child, mxmlElementGetAttr(typedefnode, "name")); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(typedefnode, mxmlNewText(description, 0, buffer)); if (structclass) { description = mxmlNewElement(structclass, "description"); update_comment(structclass, mxmlNewText(description, 0, buffer)); } else if (enumeration) { description = mxmlNewElement(enumeration, "description"); update_comment(enumeration, mxmlNewText(description, 0, buffer)); } } } else if (strcmp(tree->value.element.name, "mxmldoc") && !mxmlFindElement(tree, tree, "description", NULL, NULL, MXML_DESCEND_FIRST)) { description = mxmlNewElement(tree, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to parent...\n", comment->last_child, comment->child); #endif /* DEBUG */ mxmlNewText(comment, 0, buffer); update_comment(tree, mxmlNewText(description, 0, buffer)); } else mxmlNewText(comment, 0, buffer); #ifdef DEBUG fprintf(stderr, "C++ comment: <<<< %s >>>\n", buffer); #endif /* DEBUG */ } else if (ch == ' ' && bufptr == buffer) break; else if (bufptr < (buffer + sizeof(buffer) - 1)) *bufptr++ = ch; break; case STATE_STRING : /* Inside a string constant */ *bufptr++ = ch; if (ch == '\\') *bufptr++ = getc(fp); else if (ch == '\"') { *bufptr = '\0'; if (type) mxmlNewText(type, type->child != NULL, buffer); state = STATE_NONE; } break; case STATE_CHARACTER : /* Inside a character constant */ *bufptr++ = ch; if (ch == '\\') *bufptr++ = getc(fp); else if (ch == '\'') { *bufptr = '\0'; if (type) mxmlNewText(type, type->child != NULL, buffer); state = STATE_NONE; } break; case STATE_IDENTIFIER : /* Inside a keyword or identifier */ if (isalnum(ch) || ch == '_' || ch == '[' || ch == ']' || (ch == ',' && (parens > 1 || (type && !enumeration && !function))) || ch == ':' || ch == '.' || ch == '~') { if (bufptr < (buffer + sizeof(buffer) - 1)) *bufptr++ = ch; } else { ungetc(ch, fp); *bufptr = '\0'; state = STATE_NONE; #ifdef DEBUG fprintf(stderr, " braces=%d, type=%p, type->child=%p, buffer=\"%s\"\n", braces, type, type ? type->child : NULL, buffer); #endif /* DEBUG */ if (!braces) { if (!type || !type->child) { if (!strcmp(tree->value.element.name, "class")) { if (!strcmp(buffer, "public") || !strcmp(buffer, "public:")) { scope = "public"; #ifdef DEBUG fputs(" scope = public\n", stderr); #endif /* DEBUG */ break; } else if (!strcmp(buffer, "private") || !strcmp(buffer, "private:")) { scope = "private"; #ifdef DEBUG fputs(" scope = private\n", stderr); #endif /* DEBUG */ break; } else if (!strcmp(buffer, "protected") || !strcmp(buffer, "protected:")) { scope = "protected"; #ifdef DEBUG fputs(" scope = protected\n", stderr); #endif /* DEBUG */ break; } } } if (!type) type = mxmlNewElement(MXML_NO_PARENT, "type"); #ifdef DEBUG fprintf(stderr, " function=%p (%s), type->child=%p, ch='%c', parens=%d\n", function, function ? mxmlElementGetAttr(function, "name") : "null", type->child, ch, parens); #endif /* DEBUG */ if (!function && ch == '(') { if (type->child && !strcmp(type->child->value.text.string, "extern")) { /* * Remove external declarations... */ mxmlDelete(type); type = NULL; break; } if (type->child && !strcmp(type->child->value.text.string, "static") && !strcmp(tree->value.element.name, "mxmldoc")) { /* * Remove static functions... */ mxmlDelete(type); type = NULL; break; } function = mxmlNewElement(MXML_NO_PARENT, "function"); if ((bufptr = strchr(buffer, ':')) != NULL && bufptr[1] == ':') { *bufptr = '\0'; bufptr += 2; if ((fstructclass = mxmlFindElement(tree, tree, "class", "name", buffer, MXML_DESCEND_FIRST)) == NULL) fstructclass = mxmlFindElement(tree, tree, "struct", "name", buffer, MXML_DESCEND_FIRST); } else bufptr = buffer; mxmlElementSetAttr(function, "name", bufptr); if (scope) mxmlElementSetAttr(function, "scope", scope); #ifdef DEBUG fprintf(stderr, "function: %s\n", buffer); fprintf(stderr, " scope = %s\n", scope ? scope : "(null)"); fprintf(stderr, " comment = %p\n", comment); fprintf(stderr, " child = (%p) %s\n", comment->child, comment->child ? comment->child->value.text.string : "(null)"); fprintf(stderr, " last_child = (%p) %s\n", comment->last_child, comment->last_child ? comment->last_child->value.text.string : "(null)"); #endif /* DEBUG */ if (type->last_child && strcmp(type->last_child->value.text.string, "void")) { returnvalue = mxmlNewElement(function, "returnvalue"); mxmlAdd(returnvalue, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, type); description = mxmlNewElement(returnvalue, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to returnvalue...\n", comment->last_child, comment->child); #endif /* DEBUG */ update_comment(returnvalue, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); } else mxmlDelete(type); description = mxmlNewElement(function, "description"); #ifdef DEBUG fprintf(stderr, " adding comment %p/%p to function...\n", comment->last_child, comment->child); #endif /* DEBUG */ update_comment(function, comment->last_child); mxmlAdd(description, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, comment->last_child); type = NULL; } else if (function && ((ch == ')' && parens == 1) || ch == ',')) { /* * Argument definition... */ if (strcmp(buffer, "void")) { mxmlNewText(type, type->child != NULL && type->last_child->value.text.string[0] != '(' && type->last_child->value.text.string[0] != '*', buffer); #ifdef DEBUG fprintf(stderr, "Argument: <<<< %s >>>\n", buffer); #endif /* DEBUG */ variable = add_variable(function, "argument", type); } else mxmlDelete(type); type = NULL; } else if (type->child && !function && (ch == ';' || ch == ',')) { #ifdef DEBUG fprintf(stderr, " got semicolon, typedefnode=%p, structclass=%p\n", typedefnode, structclass); #endif /* DEBUG */ if (typedefnode || structclass) { #ifdef DEBUG fprintf(stderr, "Typedef/struct/class: <<<< %s >>>>\n", buffer); #endif /* DEBUG */ if (typedefnode) { mxmlElementSetAttr(typedefnode, "name", buffer); sort_node(tree, typedefnode); } if (structclass && !mxmlElementGetAttr(structclass, "name")) { #ifdef DEBUG fprintf(stderr, "setting struct/class name to %s!\n", type->last_child->value.text.string); #endif /* DEBUG */ mxmlElementSetAttr(structclass, "name", buffer); sort_node(tree, structclass); structclass = NULL; } if (typedefnode) mxmlAdd(typedefnode, MXML_ADD_BEFORE, MXML_ADD_TO_PARENT, type); else mxmlDelete(type); type = NULL; typedefnode = NULL; } else if (type->child && !strcmp(type->child->value.text.string, "typedef")) { /* * Simple typedef... */ #ifdef DEBUG fprintf(stderr, "Typedef: <<<< %s >>>\n", buffer); #endif /* DEBUG */ typedefnode = mxmlNewElement(MXML_NO_PARENT, "typedef"); mxmlElementSetAttr(typedefnode, "name", buffer); mxmlDelete(type->child); sort_node(tree, typedefnode); if (type->child) type->child->value.text.whitespace = 0; mxmlAdd(typedefnode, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, type); type = NULL; } else if (!parens) { /* * Variable definition... */ if (type->child && !strcmp(type->child->value.text.string, "static") && !strcmp(tree->value.element.name, "mxmldoc")) { /* * Remove static functions... */ mxmlDelete(type); type = NULL; break; } mxmlNewText(type, type->child != NULL && type->last_child->value.text.string[0] != '(' && type->last_child->value.text.string[0] != '*', buffer); #ifdef DEBUG fprintf(stderr, "Variable: <<<< %s >>>>\n", buffer); fprintf(stderr, " scope = %s\n", scope ? scope : "(null)"); #endif /* DEBUG */ variable = add_variable(MXML_NO_PARENT, "variable", type); type = NULL; sort_node(tree, variable); if (scope) mxmlElementSetAttr(variable, "scope", scope); } } else { #ifdef DEBUG fprintf(stderr, "Identifier: <<<< %s >>>>\n", buffer); #endif /* DEBUG */ mxmlNewText(type, type->child != NULL && type->last_child->value.text.string[0] != '(' && type->last_child->value.text.string[0] != '*', buffer); } } else if (enumeration && !isdigit(buffer[0] & 255)) { #ifdef DEBUG fprintf(stderr, "Constant: <<<< %s >>>\n", buffer); #endif /* DEBUG */ constant = mxmlNewElement(MXML_NO_PARENT, "constant"); mxmlElementSetAttr(constant, "name", buffer); sort_node(enumeration, constant); } else if (type) { mxmlDelete(type); type = NULL; } } break; } #if DEBUG > 1 if (state != oldstate) { fprintf(stderr, " changed states from %s to %s on receipt of character '%c'...\n", states[oldstate], states[state], oldch); fprintf(stderr, " variable = %p\n", variable); if (type) { fputs(" type =", stderr); for (temp = type->child; temp; temp = temp->next) fprintf(stderr, " \"%s\"", temp->value.text.string); fputs("\n", stderr); } } #endif /* DEBUG > 1 */ } mxmlDelete(comment); /* * All done, return with no errors... */ return (0); } /* * 'sort_node()' - Insert a node sorted into a tree. */ static void sort_node(mxml_node_t *tree, /* I - Tree to sort into */ mxml_node_t *node) /* I - Node to add */ { mxml_node_t *temp; /* Current node */ const char *tempname, /* Name of current node */ *nodename, /* Name of node */ *scope; /* Scope */ #if DEBUG > 1 fprintf(stderr, " sort_node(tree=%p, node=%p)\n", tree, node); #endif /* DEBUG > 1 */ /* * Range check input... */ if (!tree || !node || node->parent == tree) return; /* * Get the node name... */ if ((nodename = mxmlElementGetAttr(node, "name")) == NULL) return; if (nodename[0] == '_') return; /* Hide private names */ #if DEBUG > 1 fprintf(stderr, " nodename=%p (\"%s\")\n", nodename, nodename); #endif /* DEBUG > 1 */ /* * Delete any existing definition at this level, if one exists... */ if ((temp = mxmlFindElement(tree, tree, node->value.element.name, "name", nodename, MXML_DESCEND_FIRST)) != NULL) { /* * Copy the scope if needed... */ if ((scope = mxmlElementGetAttr(temp, "scope")) != NULL && mxmlElementGetAttr(node, "scope") == NULL) { #ifdef DEBUG fprintf(stderr, " copying scope %s for %s\n", scope, nodename); #endif /* DEBUG */ mxmlElementSetAttr(node, "scope", scope); } mxmlDelete(temp); } /* * Add the node into the tree at the proper place... */ for (temp = tree->child; temp; temp = temp->next) { #if DEBUG > 1 fprintf(stderr, " temp=%p\n", temp); #endif /* DEBUG > 1 */ if ((tempname = mxmlElementGetAttr(temp, "name")) == NULL) continue; #if DEBUG > 1 fprintf(stderr, " tempname=%p (\"%s\")\n", tempname, tempname); #endif /* DEBUG > 1 */ if (strcmp(nodename, tempname) < 0) break; } if (temp) mxmlAdd(tree, MXML_ADD_BEFORE, temp, node); else mxmlAdd(tree, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, node); } /* * 'update_comment()' - Update a comment node. */ static void update_comment(mxml_node_t *parent, /* I - Parent node */ mxml_node_t *comment) /* I - Comment node */ { char *ptr; /* Pointer into comment */ #ifdef DEBUG fprintf(stderr, "update_comment(parent=%p, comment=%p)\n", parent, comment); #endif /* DEBUG */ /* * Range check the input... */ if (!parent || !comment) return; /* * Convert "\/" to "/"... */ for (ptr = strstr(comment->value.text.string, "\\/"); ptr; ptr = strstr(ptr, "\\/")) safe_strcpy(ptr, ptr + 1); /* * Update the comment... */ ptr = comment->value.text.string; if (*ptr == '\'') { /* * Convert "'name()' - description" to "description". */ for (ptr ++; *ptr && *ptr != '\''; ptr ++); if (*ptr == '\'') { ptr ++; while (isspace(*ptr & 255)) ptr ++; if (*ptr == '-') ptr ++; while (isspace(*ptr & 255)) ptr ++; safe_strcpy(comment->value.text.string, ptr); } } else if (!strncmp(ptr, "I ", 2) || !strncmp(ptr, "O ", 2) || !strncmp(ptr, "IO ", 3)) { /* * 'Convert "I - description", "IO - description", or "O - description" * to description + direction attribute. */ ptr = strchr(ptr, ' '); *ptr++ = '\0'; if (!strcmp(parent->value.element.name, "argument")) mxmlElementSetAttr(parent, "direction", comment->value.text.string); while (isspace(*ptr & 255)) ptr ++; if (*ptr == '-') ptr ++; while (isspace(*ptr & 255)) ptr ++; safe_strcpy(comment->value.text.string, ptr); } /* * Eliminate leading and trailing *'s... */ for (ptr = comment->value.text.string; *ptr == '*'; ptr ++); for (; isspace(*ptr & 255); ptr ++); if (ptr > comment->value.text.string) safe_strcpy(comment->value.text.string, ptr); for (ptr = comment->value.text.string + strlen(comment->value.text.string) - 1; ptr > comment->value.text.string && *ptr == '*'; ptr --) *ptr = '\0'; for (; ptr > comment->value.text.string && isspace(*ptr & 255); ptr --) *ptr = '\0'; #ifdef DEBUG fprintf(stderr, " updated comment = %s\n", comment->value.text.string); #endif /* DEBUG */ } /* * 'usage()' - Show program usage... */ static void usage(const char *option) /* I - Unknown option */ { if (option) printf("mxmldoc: Bad option \"%s\"!\n\n", option); puts("Usage: mxmldoc [options] [filename.xml] [source files] >filename.html"); puts("Options:"); puts(" --css filename.css Set CSS stylesheet file"); puts(" --docset bundleid.docset Generate documentation set"); puts(" --docversion version Set documentation version"); puts(" --feedname name Set documentation set feed name"); puts(" --feedurl url Set documentation set feed URL"); puts(" --footer footerfile Set footer file"); puts(" --framed basename Generate framed HTML to basename*.html"); puts(" --header headerfile Set header file"); puts(" --intro introfile Set introduction file"); puts(" --man name Generate man page"); puts(" --no-output Do no generate documentation file"); puts(" --section section Set section name"); puts(" --title title Set documentation title"); puts(" --tokens path Generate Xcode docset Tokens.xml file"); puts(" --version Show mxmldoc/Mini-XML version"); exit(1); } /* * 'write_description()' - Write the description text. */ static void write_description( FILE *out, /* I - Output file */ mxml_node_t *description, /* I - Description node */ const char *element, /* I - HTML element, if any */ int summary) /* I - Show summary */ { char text[10240], /* Text for description */ *start, /* Start of code/link */ *ptr; /* Pointer into text */ int col; /* Current column */ if (!description) return; get_text(description, text, sizeof(text)); ptr = strstr(text, "\n\n"); if (summary) { if (ptr) *ptr = '\0'; ptr = text; } else if (!ptr || !ptr[2]) return; else ptr += 2; if (element && *element) fprintf(out, "<%s class=\"%s\">", element, summary ? "description" : "discussion"); else if (!summary) fputs(".PP\n", out); for (col = 0; *ptr; ptr ++) { if (*ptr == '@' && (!strncmp(ptr + 1, "deprecated@", 11) || !strncmp(ptr + 1, "since ", 6))) { ptr ++; while (*ptr && *ptr != '@') ptr ++; if (!*ptr) return; } else if (!strncmp(ptr, "@code ", 6)) { for (ptr += 6; isspace(*ptr & 255); ptr ++); for (start = ptr, ptr ++; *ptr && *ptr != '@'; ptr ++); if (*ptr) *ptr = '\0'; else ptr --; if (element && *element) fprintf(out, "%s", start); else if (element) fputs(start, out); else fprintf(out, "\\fB%s\\fR", start); } else if (!strncmp(ptr, "@link ", 6)) { for (ptr += 6; isspace(*ptr & 255); ptr ++); for (start = ptr, ptr ++; *ptr && *ptr != '@'; ptr ++); if (*ptr) *ptr = '\0'; else ptr --; if (element && *element) fprintf(out, "%s", start, start); else if (element) fputs(start, out); else fprintf(out, "\\fI%s\\fR", start); } else if (element) { if (*ptr == '&') fputs("&", out); else if (*ptr == '<') fputs("<", out); else if (*ptr == '>') fputs(">", out); else if (*ptr == '\"') fputs(""", out); else if (*ptr & 128) { /* * Convert UTF-8 to Unicode constant... */ int ch; /* Unicode character */ ch = *ptr & 255; if ((ch & 0xe0) == 0xc0) { ch = ((ch & 0x1f) << 6) | (ptr[1] & 0x3f); ptr ++; } else if ((ch & 0xf0) == 0xe0) { ch = ((((ch * 0x0f) << 6) | (ptr[1] & 0x3f)) << 6) | (ptr[2] & 0x3f); ptr += 2; } if (ch == 0xa0) { /* * Handle non-breaking space as-is... */ fputs(" ", out); } else fprintf(out, "&#x%x;", ch); } else if (*ptr == '\n' && ptr[1] == '\n' && ptr[2] && ptr[2] != '@') { fputs("
    \n
    \n", out); ptr ++; } else putc(*ptr, out); } else if (*ptr == '\n' && ptr[1] == '\n' && ptr[2] && ptr[2] != '@') { fputs("\n.PP\n", out); ptr ++; } else { if (*ptr == '\\' || (*ptr == '.' && col == 0)) putc('\\', out); putc(*ptr, out); if (*ptr == '\n') col = 0; else col ++; } } if (element && *element) fprintf(out, "\n", element); else if (!element) putc('\n', out); } /* * 'write_element()' - Write an element's text nodes. */ static void write_element(FILE *out, /* I - Output file */ mxml_node_t *doc, /* I - Document tree */ mxml_node_t *element, /* I - Element to write */ int mode) /* I - Output mode */ { mxml_node_t *node; /* Current node */ if (!element) return; for (node = element->child; node; node = mxmlWalkNext(node, element, MXML_NO_DESCEND)) if (node->type == MXML_TEXT) { if (node->value.text.whitespace) putc(' ', out); if (mode == OUTPUT_HTML && (mxmlFindElement(doc, doc, "class", "name", node->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "enumeration", "name", node->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "struct", "name", node->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "typedef", "name", node->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "union", "name", node->value.text.string, MXML_DESCEND))) { fputs("value.text.string, mode); fputs("\">", out); write_string(out, node->value.text.string, mode); fputs("", out); } else write_string(out, node->value.text.string, mode); } if (!strcmp(element->value.element.name, "type") && element->last_child->value.text.string[0] != '*') putc(' ', out); } /* * 'write_file()' - Copy a file to the output. */ static void write_file(FILE *out, /* I - Output file */ const char *file) /* I - File to copy */ { FILE *fp; /* Copy file */ char line[8192]; /* Line from file */ if ((fp = fopen(file, "r")) == NULL) { fprintf(stderr, "mxmldoc: Unable to open \"%s\": %s\n", file, strerror(errno)); return; } while (fgets(line, sizeof(line), fp)) fputs(line, out); fclose(fp); } /* * 'write_function()' - Write documentation for a function. */ static void write_function(FILE *out, /* I - Output file */ mxml_node_t *doc, /* I - Document */ mxml_node_t *function, /* I - Function */ int level) /* I - Base heading level */ { mxml_node_t *arg, /* Current argument */ *adesc, /* Description of argument */ *description, /* Description of function */ *type, /* Type for argument */ *node; /* Node in description */ const char *name, /* Name of function/type */ *defval; /* Default value */ char prefix; /* Prefix character */ char *sep; /* Newline separator */ name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "%s%s\n", level, level == 3 ? "function" : "method", get_comment_info(description), name, name, level); if (description) write_description(out, description, "p", 1); fputs("

    \n", out); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) write_element(out, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); else fputs("void ", out); fprintf(out, "%s ", name); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "%c
    \n    ", prefix); if (type->child) write_element(out, doc, type, OUTPUT_HTML); fputs(mxmlElementGetAttr(arg, "name"), out); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) fprintf(out, " %s", defval); } if (prefix == '(') fputs("(void);

    \n", out); else { fprintf(out, "
    \n);

    \n" "Parameters\n" "
    \n", level + 1, level + 1); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND)) { fprintf(out, "
    %s
    \n", mxmlElementGetAttr(arg, "name")); adesc = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); write_description(out, adesc, "dd", 1); write_description(out, adesc, "dd", 0); } fputs("
    \n", out); } arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) { fprintf(out, "Return Value\n", level + 1, level + 1); adesc = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); write_description(out, adesc, "p", 1); write_description(out, adesc, "p", 0); } if (description) { for (node = description->child; node; node = node->next) if (node->value.text.string && (sep = strstr(node->value.text.string, "\n\n")) != NULL) { sep += 2; if (*sep && strncmp(sep, "@since ", 7) && strncmp(sep, "@deprecated@", 12)) break; } if (node) { fprintf(out, "Discussion\n", level + 1, level + 1); write_description(out, description, "p", 0); } } } /* * 'write_html()' - Write HTML documentation. */ static void write_html(const char *section, /* I - Section */ const char *title, /* I - Title */ const char *footerfile, /* I - Footer file */ const char *headerfile, /* I - Header file */ const char *introfile, /* I - Intro file */ const char *cssfile, /* I - Stylesheet file */ const char *framefile, /* I - Framed HTML basename */ const char *docset, /* I - Documentation set directory */ const char *docversion, /* I - Documentation set version */ const char *feedname, /* I - Feed name for doc set */ const char *feedurl, /* I - Feed URL for doc set */ mxml_node_t *doc) /* I - XML documentation */ { FILE *out; /* Output file */ mxml_node_t *function, /* Current function */ *scut, /* Struct/class/union/typedef */ *arg, /* Current argument */ *description, /* Description of function/var */ *type; /* Type for argument */ const char *name, /* Name of function/type */ *defval, /* Default value */ *basename; /* Base filename for framed output */ char filename[1024]; /* Current output filename */ if (framefile) { /* * Get the basename of the frame file... */ if ((basename = strrchr(framefile, '/')) != NULL) basename ++; else basename = framefile; if (strstr(basename, ".html")) fputs("mxmldoc: Frame base name should not contain .html extension!\n", stderr); /* * Create the container HTML file for the frames... */ snprintf(filename, sizeof(filename), "%s.html", framefile); if ((out = fopen(filename, "w")) == NULL) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } fputs("\n" "\n" "\n" "\t", out); write_string(out, title, OUTPUT_HTML); fputs("\n", out); if (section) fprintf(out, "\t\n", section); fputs("\t\n" "\t\n" "\n", out); fputs("\n", out); fprintf(out, "\n", basename); fprintf(out, "\n", basename); fputs("\n" "\n" "<h1>", out); write_string(out, title, OUTPUT_HTML); fprintf(out, "</h1>\n" "<ul>\n" "\t<li><a href=\"%s-toc.html\">Table of Contents</a></li>\n" "\t<li><a href=\"%s-body.html\">Body</a></li>\n" "</ul>\n", basename, basename); fputs("\n" "\n", out); fclose(out); /* * Write the table-of-contents file... */ snprintf(filename, sizeof(filename), "%s-toc.html", framefile); if ((out = fopen(filename, "w")) == NULL) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } write_html_head(out, section, title, cssfile); snprintf(filename, sizeof(filename), "%s-body.html", basename); fputs("
    \n", out); fprintf(out, "

    ", filename); write_string(out, title, OUTPUT_HTML); fputs("

    \n", out); write_toc(out, doc, introfile, filename, 0); fputs("
    \n" "\n" "\n", out); fclose(out); /* * Finally, open the body file... */ snprintf(filename, sizeof(filename), "%s-body.html", framefile); if ((out = fopen(filename, "w")) == NULL) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } } else if (docset) { /* * Create an Xcode documentation set - start by removing any existing * output directory... */ #ifdef __APPLE__ const char *id; /* Identifier */ if (!access(docset, 0) && !remove_directory(docset)) return; /* * Then make the Apple standard bundle directory structure... */ if (mkdir(docset, 0755)) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", docset, strerror(errno)); return; } snprintf(filename, sizeof(filename), "%s/Contents", docset); if (mkdir(filename, 0755)) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } snprintf(filename, sizeof(filename), "%s/Contents/Resources", docset); if (mkdir(filename, 0755)) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } snprintf(filename, sizeof(filename), "%s/Contents/Resources/Documentation", docset); if (mkdir(filename, 0755)) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } /* * The Info.plist file, which describes the documentation set... */ if ((id = strrchr(docset, '/')) != NULL) id ++; else id = docset; snprintf(filename, sizeof(filename), "%s/Contents/Info.plist", docset); if ((out = fopen(filename, "w")) == NULL) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } fputs("\n" "\n" "\n" "\n" "\tCFBundleIdentifier\n" "\t", out); write_string(out, id, OUTPUT_HTML); fputs("\n" "\tCFBundleName\n" "\t", out); write_string(out, title, OUTPUT_HTML); fputs("\n" "\tCFBundleVersion\n" "\t", out); write_string(out, docversion ? docversion : "0.0", OUTPUT_HTML); fputs("\n" "\tCFBundleShortVersionString\n" "\t", out); write_string(out, docversion ? docversion : "0.0", OUTPUT_HTML); fputs("\n", out); if (feedname) { fputs("\tDocSetFeedName\n" "\t", out); write_string(out, feedname ? feedname : title, OUTPUT_HTML); fputs("\n", out); } if (feedurl) { fputs("\tDocSetFeedURL\n" "\t", out); write_string(out, feedurl, OUTPUT_HTML); fputs("\n", out); } fputs("\n" "\n", out); fclose(out); /* * Next the Nodes.xml file... */ snprintf(filename, sizeof(filename), "%s/Contents/Resources/Nodes.xml", docset); if ((out = fopen(filename, "w")) == NULL) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } fputs("\n" "\n" "\n" "\n" "", out); write_string(out, title, OUTPUT_HTML); fputs("\n" "Documentation/index.html\n" "\n", out); write_toc(out, doc, introfile, NULL, 1); fputs("\n" "\n" "\n" "\n", out); fclose(out); /* * Then the Tokens.xml file... */ snprintf(filename, sizeof(filename), "%s/Contents/Resources/Tokens.xml", docset); if ((out = fopen(filename, "w")) == NULL) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } fputs("\n" "\n", out); write_tokens(out, doc, "index.html"); fputs("\n", out); fclose(out); /* * Finally the HTML file... */ snprintf(filename, sizeof(filename), "%s/Contents/Resources/Documentation/index.html", docset); if ((out = fopen(filename, "w")) == NULL) { fprintf(stderr, "mxmldoc: Unable to create \"%s\": %s\n", filename, strerror(errno)); return; } #else fputs("mxmldoc: Xcode documentation sets can only be created on " "Mac OS X.\n", stderr); return; #endif /* __APPLE__ */ } else out = stdout; /* * Standard header... */ write_html_head(out, section, title, cssfile); fputs("
    \n", out); /* * Header... */ if (headerfile) { /* * Use custom header... */ write_file(out, headerfile); } else { /* * Use standard header... */ fputs("

    ", out); write_string(out, title, OUTPUT_HTML); fputs("

    \n", out); } /* * Table of contents... */ if (!framefile) write_toc(out, doc, introfile, NULL, 0); /* * Intro... */ if (introfile) write_file(out, introfile); /* * List of classes... */ if ((scut = find_public(doc, doc, "class")) != NULL) { fputs("

    Classes

    \n", out); while (scut) { write_scu(out, doc, scut); scut = find_public(scut, doc, "class"); } } /* * List of functions... */ if ((function = find_public(doc, doc, "function")) != NULL) { fputs("

    Functions

    \n", out); while (function) { write_function(out, doc, function, 3); function = find_public(function, doc, "function"); } } /* * List of types... */ if ((scut = find_public(doc, doc, "typedef")) != NULL) { fputs("

    Data Types

    \n", out); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "

    %s%s

    \n", get_comment_info(description), name, name); if (description) write_description(out, description, "p", 1); fputs("

    \n" "typedef ", out); type = mxmlFindElement(scut, scut, "type", NULL, NULL, MXML_DESCEND_FIRST); for (type = type->child; type; type = type->next) if (!strcmp(type->value.text.string, "(")) break; else { if (type->value.text.whitespace) putc(' ', out); if (mxmlFindElement(doc, doc, "class", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "enumeration", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "struct", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "typedef", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "union", "name", type->value.text.string, MXML_DESCEND)) { fputs("value.text.string, OUTPUT_HTML); fputs("\">", out); write_string(out, type->value.text.string, OUTPUT_HTML); fputs("", out); } else write_string(out, type->value.text.string, OUTPUT_HTML); } if (type) { /* * Output function type... */ if (type->prev && type->prev->value.text.string[0] != '*') putc(' ', out); fprintf(out, "(*%s", name); for (type = type->next->next; type; type = type->next) { if (type->value.text.whitespace) putc(' ', out); if (mxmlFindElement(doc, doc, "class", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "enumeration", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "struct", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "typedef", "name", type->value.text.string, MXML_DESCEND) || mxmlFindElement(doc, doc, "union", "name", type->value.text.string, MXML_DESCEND)) { fputs("value.text.string, OUTPUT_HTML); fputs("\">", out); write_string(out, type->value.text.string, OUTPUT_HTML); fputs("", out); } else write_string(out, type->value.text.string, OUTPUT_HTML); } fputs(";\n", out); } else { type = mxmlFindElement(scut, scut, "type", NULL, NULL, MXML_DESCEND_FIRST); if (type->last_child->value.text.string[0] != '*') putc(' ', out); fprintf(out, "%s;\n", name); } fputs("

    \n", out); scut = find_public(scut, doc, "typedef"); } } /* * List of structures... */ if ((scut = find_public(doc, doc, "struct")) != NULL) { fputs("

    Structures

    \n", out); while (scut) { write_scu(out, doc, scut); scut = find_public(scut, doc, "struct"); } } /* * List of unions... */ if ((scut = find_public(doc, doc, "union")) != NULL) { fputs("

    Unions

    \n", out); while (scut) { write_scu(out, doc, scut); scut = find_public(scut, doc, "union"); } } /* * Variables... */ if ((arg = find_public(doc, doc, "variable")) != NULL) { fputs("

    Variables

    \n", out); while (arg) { name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "

    %s%s

    \n", get_comment_info(description), name, name); if (description) write_description(out, description, "p", 1); fputs("

    ", out); write_element(out, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); fputs(mxmlElementGetAttr(arg, "name"), out); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) fprintf(out, " %s", defval); fputs(";

    \n", out); arg = find_public(arg, doc, "variable"); } } /* * List of enumerations... */ if ((scut = find_public(doc, doc, "enumeration")) != NULL) { fputs("

    Constants

    \n", out); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "

    %s%s

    \n", get_comment_info(description), name, name); if (description) write_description(out, description, "p", 1); fputs("

    Constants

    \n" "
    \n", out); for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "constant", NULL, NULL, MXML_NO_DESCEND)) { description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "
    %s %s
    \n", mxmlElementGetAttr(arg, "name"), get_comment_info(description)); write_description(out, description, "dd", 1); write_description(out, description, "dd", 0); } fputs("
    \n", out); scut = find_public(scut, doc, "enumeration"); } } /* * Footer... */ if (footerfile) { /* * Use custom footer... */ write_file(out, footerfile); } fputs("
    \n" "\n" "\n", out); /* * Close output file as needed... */ if (out != stdout) fclose(out); #ifdef __APPLE__ /* * When generating document sets, run the docsetutil program to index it... */ if (docset) { const char *args[4]; /* Argument array */ pid_t pid; /* Process ID */ int status; /* Exit status */ args[0] = "/Developer/usr/bin/docsetutil"; args[1] = "index"; args[2] = docset; args[3] = NULL; if (posix_spawn(&pid, args[0], NULL, NULL, (char **)args, environ)) { fprintf(stderr, "mxmldoc: Unable to index documentation set \"%s\": %s\n", docset, strerror(errno)); } else { while (wait(&status) != pid); if (status) { if (WIFEXITED(status)) fprintf(stderr, "mxmldoc: docsetutil exited with status %d\n", WEXITSTATUS(status)); else fprintf(stderr, "mxmldoc: docsetutil crashed with signal %d\n", WTERMSIG(status)); } else { /* * Remove unneeded temporary XML files... */ snprintf(filename, sizeof(filename), "%s/Contents/Resources/Nodes.xml", docset); unlink(filename); snprintf(filename, sizeof(filename), "%s/Contents/Resources/Tokens.xml", docset); unlink(filename); } } } #endif /* __APPLE__ */ } /* * 'write_html_head()' - Write the standard HTML header. */ static void write_html_head(FILE *out, /* I - Output file */ const char *section, /* I - Section */ const char *title, /* I - Title */ const char *cssfile) /* I - Stylesheet */ { fputs("\n" "\n", out); if (section) fprintf(out, "\n", section); fputs("\n" "\t", out); write_string(out, title, OUTPUT_HTML); fputs("\t\n", out); if (section) fprintf(out, "\t\n", section); fputs("\t\n" "\t\n" "\n" "\n" "\n", out); } /* * 'write_man()' - Write manpage documentation. */ static void write_man(const char *man_name, /* I - Name of manpage */ const char *section, /* I - Section */ const char *title, /* I - Title */ const char *footerfile, /* I - Footer file */ const char *headerfile, /* I - Header file */ const char *introfile, /* I - Intro file */ mxml_node_t *doc) /* I - XML documentation */ { int i; /* Looping var */ mxml_node_t *function, /* Current function */ *scut, /* Struct/class/union/typedef */ *arg, /* Current argument */ *description, /* Description of function/var */ *type; /* Type for argument */ const char *name, /* Name of function/type */ *cname, /* Class name */ *defval, /* Default value */ *parent; /* Parent class */ int inscope; /* Variable/method scope */ char prefix; /* Prefix character */ time_t curtime; /* Current time */ struct tm *curdate; /* Current date */ char buffer[1024]; /* String buffer */ static const char * const scopes[] = /* Scope strings */ { "private", "protected", "public" }; /* * Standard man page... */ curtime = time(NULL); curdate = localtime(&curtime); strftime(buffer, sizeof(buffer), "%x", curdate); printf(".TH %s %s \"%s\" \"%s\" \"%s\"\n", man_name, section ? section : "3", title ? title : "", buffer, title ? title : ""); /* * Header... */ if (headerfile) { /* * Use custom header... */ write_file(stdout, headerfile); } else { /* * Use standard header... */ puts(".SH NAME"); printf("%s \\- %s\n", man_name, title ? title : man_name); } /* * Intro... */ if (introfile) write_file(stdout, introfile); /* * List of classes... */ if (find_public(doc, doc, "class")) { puts(".SH CLASSES"); for (scut = find_public(doc, doc, "class"); scut; scut = find_public(scut, doc, "class")) { cname = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".SS %s\n", cname); write_description(stdout, description, NULL, 1); printf(".PP\n" ".nf\n" "class %s", cname); if ((parent = mxmlElementGetAttr(scut, "parent")) != NULL) printf(" %s", parent); puts("\n{"); for (i = 0; i < 3; i ++) { inscope = 0; for (arg = mxmlFindElement(scut, scut, "variable", "scope", scopes[i], MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "variable", "scope", scopes[i], MXML_NO_DESCEND)) { if (!inscope) { inscope = 1; printf(" %s:\n", scopes[i]); } printf(" "); write_element(stdout, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); printf("%s;\n", mxmlElementGetAttr(arg, "name")); } for (function = mxmlFindElement(scut, scut, "function", "scope", scopes[i], MXML_DESCEND_FIRST); function; function = mxmlFindElement(function, scut, "function", "scope", scopes[i], MXML_NO_DESCEND)) { if (!inscope) { inscope = 1; printf(" %s:\n", scopes[i]); } name = mxmlElementGetAttr(function, "name"); printf(" "); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) write_element(stdout, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); else if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", stdout); printf("%s", name); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); putchar(prefix); if (prefix == ',') putchar(' '); if (type->child) write_element(stdout, doc, type, OUTPUT_MAN); fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); } if (prefix == '(') puts("(void);"); else puts(");"); } } puts("};\n" ".fi"); write_description(stdout, description, NULL, 0); } } /* * List of enumerations... */ if (find_public(doc, doc, "enumeration")) { puts(".SH ENUMERATIONS"); for (scut = find_public(doc, doc, "enumeration"); scut; scut = find_public(scut, doc, "enumeration")) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".SS %s\n", name); write_description(stdout, description, NULL, 1); write_description(stdout, description, NULL, 0); for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "constant", NULL, NULL, MXML_NO_DESCEND)) { description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".TP 5\n%s\n.br\n", mxmlElementGetAttr(arg, "name")); write_description(stdout, description, NULL, 1); } } } /* * List of functions... */ if (find_public(doc, doc, "function")) { puts(".SH FUNCTIONS"); for (function = find_public(doc, doc, "function"); function; function = find_public(function, doc, "function")) { name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".SS %s\n", name); write_description(stdout, description, NULL, 1); puts(".PP\n" ".nf"); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) write_element(stdout, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); else fputs("void", stdout); printf(" %s ", name); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); printf("%c\n ", prefix); if (type->child) write_element(stdout, doc, type, OUTPUT_MAN); fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); } if (prefix == '(') puts("(void);"); else puts("\n);"); puts(".fi"); write_description(stdout, description, NULL, 0); } } /* * List of structures... */ if (find_public(doc, doc, "struct")) { puts(".SH STRUCTURES"); for (scut = find_public(doc, doc, "struct"); scut; scut = find_public(scut, doc, "struct")) { cname = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".SS %s\n", cname); write_description(stdout, description, NULL, 1); printf(".PP\n" ".nf\n" "struct %s\n{\n", cname); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { printf(" "); write_element(stdout, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); printf("%s;\n", mxmlElementGetAttr(arg, "name")); } for (function = mxmlFindElement(scut, scut, "function", NULL, NULL, MXML_DESCEND_FIRST); function; function = mxmlFindElement(function, scut, "function", NULL, NULL, MXML_NO_DESCEND)) { name = mxmlElementGetAttr(function, "name"); printf(" "); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) write_element(stdout, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); else if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", stdout); fputs(name, stdout); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); putchar(prefix); if (prefix == ',') putchar(' '); if (type->child) write_element(stdout, doc, type, OUTPUT_MAN); fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); } if (prefix == '(') puts("(void);"); else puts(");"); } puts("};\n" ".fi"); write_description(stdout, description, NULL, 0); } } /* * List of types... */ if (find_public(doc, doc, "typedef")) { puts(".SH TYPES"); for (scut = find_public(doc, doc, "typedef"); scut; scut = find_public(scut, doc, "typedef")) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".SS %s\n", name); write_description(stdout, description, NULL, 1); fputs(".PP\n" ".nf\n" "typedef ", stdout); type = mxmlFindElement(scut, scut, "type", NULL, NULL, MXML_DESCEND_FIRST); for (type = type->child; type; type = type->next) if (!strcmp(type->value.text.string, "(")) break; else { if (type->value.text.whitespace) putchar(' '); write_string(stdout, type->value.text.string, OUTPUT_MAN); } if (type) { /* * Output function type... */ printf(" (*%s", name); for (type = type->next->next; type; type = type->next) { if (type->value.text.whitespace) putchar(' '); write_string(stdout, type->value.text.string, OUTPUT_MAN); } puts(";"); } else printf(" %s;\n", name); puts(".fi"); write_description(stdout, description, NULL, 0); } } /* * List of unions... */ if (find_public(doc, doc, "union")) { puts(".SH UNIONS"); for (scut = find_public(doc, doc, "union"); scut; scut = find_public(scut, doc, "union")) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".SS %s\n", name); write_description(stdout, description, NULL, 1); printf(".PP\n" ".nf\n" "union %s\n{\n", name); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { printf(" "); write_element(stdout, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); printf("%s;\n", mxmlElementGetAttr(arg, "name")); } puts("};\n" ".fi"); write_description(stdout, description, NULL, 0); } } /* * Variables... */ if (find_public(doc, doc, "variable")) { puts(".SH VARIABLES"); for (arg = find_public(doc, doc, "variable"); arg; arg = find_public(arg, doc, "variable")) { name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); printf(".SS %s\n", name); write_description(stdout, description, NULL, 1); puts(".PP\n" ".nf"); write_element(stdout, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_MAN); fputs(mxmlElementGetAttr(arg, "name"), stdout); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) printf(" %s", defval); puts(";\n" ".fi"); write_description(stdout, description, NULL, 0); } } if (footerfile) { /* * Use custom footer... */ write_file(stdout, footerfile); } } /* * 'write_scu()' - Write a structure, class, or union. */ static void write_scu(FILE *out, /* I - Output file */ mxml_node_t *doc, /* I - Document */ mxml_node_t *scut) /* I - Structure, class, or union */ { int i; /* Looping var */ mxml_node_t *function, /* Current function */ *arg, /* Current argument */ *description, /* Description of function/var */ *type; /* Type for argument */ const char *name, /* Name of function/type */ *cname, /* Class name */ *defval, /* Default value */ *parent, /* Parent class */ *scope; /* Scope for variable/function */ int inscope, /* Variable/method scope */ maxscope; /* Maximum scope */ char prefix; /* Prefix character */ static const char * const scopes[] = /* Scope strings */ { "private", "protected", "public" }; cname = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "

    %s%s

    \n", scut->value.element.name, get_comment_info(description), cname, cname); if (description) write_description(out, description, "p", 1); fprintf(out, "

    %s %s", scut->value.element.name, cname); if ((parent = mxmlElementGetAttr(scut, "parent")) != NULL) fprintf(out, " %s", parent); fputs(" {
    \n", out); maxscope = !strcmp(scut->value.element.name, "class") ? 3 : 1; for (i = 0; i < maxscope; i ++) { inscope = maxscope == 1; for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { if (maxscope > 1 && ((scope = mxmlElementGetAttr(arg, "scope")) == NULL || strcmp(scope, scopes[i]))) continue; if (!inscope) { inscope = 1; fprintf(out, "  %s:
    \n", scopes[i]); } fputs("    ", out); write_element(out, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); fprintf(out, "%s;
    \n", mxmlElementGetAttr(arg, "name")); } for (function = mxmlFindElement(scut, scut, "function", NULL, NULL, MXML_DESCEND_FIRST); function; function = mxmlFindElement(function, scut, "function", NULL, NULL, MXML_NO_DESCEND)) { if (maxscope > 1 && ((scope = mxmlElementGetAttr(arg, "scope")) == NULL || strcmp(scope, scopes[i]))) continue; if (!inscope) { inscope = 1; fprintf(out, "  %s:
    \n", scopes[i]); } name = mxmlElementGetAttr(function, "name"); fputs("    ", out); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) write_element(out, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_HTML); else if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", out); fprintf(out, "%s", cname, name, name); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); putc(prefix, out); if (prefix == ',') putc(' ', out); if (type->child) write_element(out, doc, type, OUTPUT_HTML); fputs(mxmlElementGetAttr(arg, "name"), out); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) fprintf(out, " %s", defval); } if (prefix == '(') fputs("(void);
    \n", out); else fputs(");
    \n", out); } } fputs("};

    \n" "

    Members

    \n" "
    \n", out); for (arg = mxmlFindElement(scut, scut, "variable", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "variable", NULL, NULL, MXML_NO_DESCEND)) { description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "
    %s %s
    \n", mxmlElementGetAttr(arg, "name"), get_comment_info(description)); write_description(out, description, "dd", 1); write_description(out, description, "dd", 0); } fputs("
    \n", out); for (function = mxmlFindElement(scut, scut, "function", NULL, NULL, MXML_DESCEND_FIRST); function; function = mxmlFindElement(function, scut, "function", NULL, NULL, MXML_NO_DESCEND)) { write_function(out, doc, function, 4); } } /* * 'write_string()' - Write a string, quoting HTML special chars as needed. */ static void write_string(FILE *out, /* I - Output file */ const char *s, /* I - String to write */ int mode) /* I - Output mode */ { switch (mode) { case OUTPUT_HTML : case OUTPUT_XML : while (*s) { if (*s == '&') fputs("&", out); else if (*s == '<') fputs("<", out); else if (*s == '>') fputs(">", out); else if (*s == '\"') fputs(""", out); else if (*s & 128) { /* * Convert UTF-8 to Unicode constant... */ int ch; /* Unicode character */ ch = *s & 255; if ((ch & 0xe0) == 0xc0) { ch = ((ch & 0x1f) << 6) | (s[1] & 0x3f); s ++; } else if ((ch & 0xf0) == 0xe0) { ch = ((((ch * 0x0f) << 6) | (s[1] & 0x3f)) << 6) | (s[2] & 0x3f); s += 2; } if (ch == 0xa0) { /* * Handle non-breaking space as-is... */ fputs(" ", out); } else fprintf(out, "&#x%x;", ch); } else putc(*s, out); s ++; } break; case OUTPUT_MAN : while (*s) { if (*s == '\\' || *s == '-') putc('\\', out); putc(*s++, out); } break; } } /* * 'write_toc()' - Write a table-of-contents. */ static void write_toc(FILE *out, /* I - Output file */ mxml_node_t *doc, /* I - Document */ const char *introfile, /* I - Introduction file */ const char *target, /* I - Target name */ int xml) /* I - Write XML nodes? */ { FILE *fp; /* Intro file */ mxml_node_t *function, /* Current function */ *scut, /* Struct/class/union/typedef */ *arg, /* Current argument */ *description; /* Description of function/var */ const char *name, /* Name of function/type */ *targetattr; /* Target attribute, if any */ int xmlid = 1; /* Current XML node ID */ /* * If target is set, it is the frame file that contains the body. * Otherwise, we are creating a single-file... */ if (target) targetattr = " target=\"body\""; else targetattr = ""; /* * The table-of-contents is a nested unordered list. Start by * reading any intro file to see if there are any headings there. */ if (!xml) fputs("

    Contents

    \n" "
      \n", out); if (introfile && (fp = fopen(introfile, "r")) != NULL) { char line[8192], /* Line from file */ *ptr, /* Pointer in line */ *end, /* End of line */ *anchor, /* Anchor name */ quote, /* Quote character for value */ level = '2', /* Current heading level */ newlevel; /* New heading level */ int inelement; /* In an element? */ while (fgets(line, sizeof(line), fp)) { /* * See if this line has a heading... */ if ((ptr = strstr(line, "') inelement = 0; *ptr++ = '\0'; } /* * Write text until we see ""... */ if (xml) { if (newlevel < level) fputs("\n" "\n", out); else if (newlevel > level && newlevel == '3') fputs("\n", out); else if (xmlid > 1) fputs("\n", out); level = newlevel; fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "", xmlid ++, anchor); quote = 0; while (*ptr) { if (inelement) { if (*ptr == quote) quote = 0; else if (*ptr == '>') inelement = 0; else if (*ptr == '\'' || *ptr == '\"') quote = *ptr; } else if (*ptr == '<') { if (!strncmp(ptr, "", 4) || !strncmp(ptr, "", 4)) break; inelement = 1; } else putc(*ptr, out); ptr ++; } fputs("\n", out); } else { if (newlevel < level) fputs("\n" "
  • \n", out); else if (newlevel > level) fputs("\n", out); } } fclose(fp); } /* * Next the classes... */ if ((scut = find_public(doc, doc, "class")) != NULL) { if (xml) fprintf(out, "\n" "Documentation/index.html\n" "CLASSES\n" "Classes\n" "\n", xmlid ++); else fprintf(out, "
  • Classes" "
      \n", target ? target : "", targetattr); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (xml) { fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "%s\n" "\n", xmlid ++, name, name); } else { fprintf(out, "\t
    • %s
    • \n", name); } scut = find_public(scut, doc, "class"); } if (xml) fputs("\n", out); else fputs("
  • \n", out); } /* * Functions... */ if ((function = find_public(doc, doc, "function")) != NULL) { if (xml) fprintf(out, "\n" "Documentation/index.html\n" "FUNCTIONS\n" "Functions\n" "\n", xmlid ++); else fprintf(out, "
  • Functions" "
      \n", target ? target : "", targetattr); while (function) { name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); if (xml) { fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "%s\n" "\n", xmlid ++, name, name); } else { fprintf(out, "\t
    • %s
    • \n", name); } function = find_public(function, doc, "function"); } if (xml) fputs("\n", out); else fputs("
  • \n", out); } /* * Data types... */ if ((scut = find_public(doc, doc, "typedef")) != NULL) { if (xml) fprintf(out, "\n" "Documentation/index.html\n" "TYPES\n" "Data Types\n" "\n", xmlid ++); else fprintf(out, "
  • Data Types" "
      \n", target ? target : "", targetattr); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (xml) { fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "%s\n" "\n", xmlid ++, name, name); } else { fprintf(out, "\t
    • %s
    • \n", name); } scut = find_public(scut, doc, "typedef"); } if (xml) fputs("\n", out); else fputs("
  • \n", out); } /* * Structures... */ if ((scut = find_public(doc, doc, "struct")) != NULL) { if (xml) fprintf(out, "\n" "Documentation/index.html\n" "STRUCTURES\n" "Structures\n" "\n", xmlid ++); else fprintf(out, "
  • Structures" "
      \n", target ? target : "", targetattr); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (xml) { fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "%s\n" "\n", xmlid ++, name, name); } else { fprintf(out, "\t
    • %s
    • \n", name); } scut = find_public(scut, doc, "struct"); } if (xml) fputs("\n", out); else fputs("
  • \n", out); } /* * Unions... */ if ((scut = find_public(doc, doc, "union")) != NULL) { if (xml) fprintf(out, "\n" "Documentation/index.html\n" "UNIONS\n" "Unions\n" "\n", xmlid ++); else fprintf(out, "
  • Unions
      \n", target ? target : "", targetattr); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (xml) { fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "%s\n" "\n", xmlid ++, name, name); } else { fprintf(out, "\t
    • %s
    • \n", name); } scut = find_public(scut, doc, "union"); } if (xml) fputs("\n", out); else fputs("
  • \n", out); } /* * Globals variables... */ if ((arg = find_public(doc, doc, "variable")) != NULL) { if (xml) fprintf(out, "\n" "Documentation/index.html\n" "VARIABLES\n" "Variables\n" "\n", xmlid ++); else fprintf(out, "
  • Variables" "
      \n", target ? target : "", targetattr); while (arg) { name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); if (xml) { fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "%s\n" "\n", xmlid ++, name, name); } else { fprintf(out, "\t
    • %s
    • \n", name); } arg = find_public(arg, doc, "variable"); } if (xml) fputs("\n", out); else fputs("
  • \n", out); } /* * Enumerations/constants... */ if ((scut = find_public(doc, doc, "enumeration")) != NULL) { if (xml) fprintf(out, "\n" "Documentation/index.html\n" "ENUMERATIONS\n" "Constants\n" "\n", xmlid ++); else fprintf(out, "
  • Constants" "
      \n", target ? target : "", targetattr); while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); if (xml) { fprintf(out, "\n" "Documentation/index.html\n" "%s\n" "%s\n" "\n", xmlid ++, name, name); } else { fprintf(out, "\t
    • %s
    • \n", name); } scut = find_public(scut, doc, "enumeration"); } if (xml) fputs("\n", out); else fputs("
  • \n", out); } /* * Close out the HTML table-of-contents list as needed... */ if (!xml) fputs("\n", out); } /* * 'write_tokens()' - Write nodes for all APIs. */ static void write_tokens(FILE *out, /* I - Output file */ mxml_node_t *doc, /* I - Document */ const char *path) /* I - Path to help file */ { mxml_node_t *function, /* Current function */ *scut, /* Struct/class/union/typedef */ *arg, /* Current argument */ *description, /* Description of function/var */ *type, /* Type node */ *node; /* Current child node */ const char *name, /* Name of function/type */ *cename, /* Current class/enum name */ *defval; /* Default value for argument */ char prefix; /* Prefix for declarations */ /* * Classes... */ if ((scut = find_public(doc, doc, "class")) != NULL) { while (scut) { cename = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/cpp/cl/%s\n" "", path, cename, cename); write_description(out, description, "", 1); fputs("\n" "\n", out); if ((function = find_public(scut, scut, "function")) != NULL) { while (function) { name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s.%s\n" "//apple_ref/cpp/clm/%s/%s", path, cename, name, cename, name); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg && (type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST)) != NULL) { for (node = type->child; node; node = node->next) fputs(node->value.text.string, out); } else if (strcmp(cename, name) && strcmp(cename, name + 1)) fputs("void", out); fputs("/", out); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); putc(prefix, out); for (node = type->child; node; node = node->next) fputs(node->value.text.string, out); fputs(mxmlElementGetAttr(arg, "name"), out); } if (prefix == '(') fputs("(void", out); fputs(")\n" "", out); write_description(out, description, "", 1); fputs("\n" "", out); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) write_element(out, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_XML); else if (strcmp(cename, name) && strcmp(cename, name + 1)) fputs("void ", out); fputs(name, out); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); putc(prefix, out); if (prefix == ',') putc(' ', out); if (type->child) write_element(out, doc, type, OUTPUT_XML); fputs(mxmlElementGetAttr(arg, "name"), out); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) fprintf(out, " %s", defval); } if (prefix == '(') fputs("(void);", out); else fputs(");", out); fputs("\n" "\n", out); function = find_public(function, doc, "function"); } } scut = find_public(scut, doc, "class"); } } /* * Functions... */ if ((function = find_public(doc, doc, "function")) != NULL) { while (function) { name = mxmlElementGetAttr(function, "name"); description = mxmlFindElement(function, function, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/c/func/%s\n" "", path, name, name); write_description(out, description, "", 1); fputs("\n" "", out); arg = mxmlFindElement(function, function, "returnvalue", NULL, NULL, MXML_DESCEND_FIRST); if (arg) write_element(out, doc, mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST), OUTPUT_XML); else // if (strcmp(cname, name) && strcmp(cname, name + 1)) fputs("void ", out); fputs(name, out); for (arg = mxmlFindElement(function, function, "argument", NULL, NULL, MXML_DESCEND_FIRST), prefix = '('; arg; arg = mxmlFindElement(arg, function, "argument", NULL, NULL, MXML_NO_DESCEND), prefix = ',') { type = mxmlFindElement(arg, arg, "type", NULL, NULL, MXML_DESCEND_FIRST); putc(prefix, out); if (prefix == ',') putc(' ', out); if (type->child) write_element(out, doc, type, OUTPUT_XML); fputs(mxmlElementGetAttr(arg, "name"), out); if ((defval = mxmlElementGetAttr(arg, "default")) != NULL) fprintf(out, " %s", defval); } if (prefix == '(') fputs("(void);", out); else fputs(");", out); fputs("\n" "\n", out); function = find_public(function, doc, "function"); } } /* * Data types... */ if ((scut = find_public(doc, doc, "typedef")) != NULL) { while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/c/tdef/%s\n" "", path, name, name); write_description(out, description, "", 1); fputs("\n" "\n", out); scut = find_public(scut, doc, "typedef"); } } /* * Structures... */ if ((scut = find_public(doc, doc, "struct")) != NULL) { while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/c/tag/%s\n" "", path, name, name); write_description(out, description, "", 1); fputs("\n" "\n", out); scut = find_public(scut, doc, "struct"); } } /* * Unions... */ if ((scut = find_public(doc, doc, "union")) != NULL) { while (scut) { name = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/c/tag/%s\n" "", path, name, name); write_description(out, description, "", 1); fputs("\n" "\n", out); scut = find_public(scut, doc, "union"); } } /* * Globals variables... */ if ((arg = find_public(doc, doc, "variable")) != NULL) { while (arg) { name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/c/data/%s\n" "", path, name, name); write_description(out, description, "", 1); fputs("\n" "\n", out); arg = find_public(arg, doc, "variable"); } } /* * Enumerations/constants... */ if ((scut = find_public(doc, doc, "enumeration")) != NULL) { while (scut) { cename = mxmlElementGetAttr(scut, "name"); description = mxmlFindElement(scut, scut, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/c/tag/%s\n" "", path, cename, cename); write_description(out, description, "", 1); fputs("\n" "\n", out); for (arg = mxmlFindElement(scut, scut, "constant", NULL, NULL, MXML_DESCEND_FIRST); arg; arg = mxmlFindElement(arg, scut, "constant", NULL, NULL, MXML_NO_DESCEND)) { name = mxmlElementGetAttr(arg, "name"); description = mxmlFindElement(arg, arg, "description", NULL, NULL, MXML_DESCEND_FIRST); fprintf(out, "\n" "Documentation/%s\n" "%s\n" "//apple_ref/c/econst/%s\n" "", path, cename, name); write_description(out, description, "", 1); fputs("\n" "\n", out); } scut = find_public(scut, doc, "enumeration"); } } } /* * 'ws_cb()' - Whitespace callback for saving. */ static const char * /* O - Whitespace string or NULL for none */ ws_cb(mxml_node_t *node, /* I - Element node */ int where) /* I - Where value */ { const char *name; /* Name of element */ int depth; /* Depth of node */ static const char *spaces = " "; /* Whitespace (40 spaces) for indent */ name = node->value.element.name; switch (where) { case MXML_WS_BEFORE_CLOSE : if (strcmp(name, "argument") && strcmp(name, "class") && strcmp(name, "constant") && strcmp(name, "enumeration") && strcmp(name, "function") && strcmp(name, "mxmldoc") && strcmp(name, "namespace") && strcmp(name, "returnvalue") && strcmp(name, "struct") && strcmp(name, "typedef") && strcmp(name, "union") && strcmp(name, "variable")) return (NULL); for (depth = -4; node; node = node->parent, depth += 2); if (depth > 40) return (spaces); else if (depth < 2) return (NULL); else return (spaces + 40 - depth); case MXML_WS_AFTER_CLOSE : return ("\n"); case MXML_WS_BEFORE_OPEN : for (depth = -4; node; node = node->parent, depth += 2); if (depth > 40) return (spaces); else if (depth < 2) return (NULL); else return (spaces + 40 - depth); default : case MXML_WS_AFTER_OPEN : if (strcmp(name, "argument") && strcmp(name, "class") && strcmp(name, "constant") && strcmp(name, "enumeration") && strcmp(name, "function") && strcmp(name, "mxmldoc") && strcmp(name, "namespace") && strcmp(name, "returnvalue") && strcmp(name, "struct") && strcmp(name, "typedef") && strcmp(name, "union") && strcmp(name, "variable") && strncmp(name, "?xml", 4)) return (NULL); else return ("\n"); } } /* * End of "$Id: mxmldoc.c 440 2011-08-11 18:51:26Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml-node.c0000644000177700000170000004447311747570117016531 0ustar torstenman/* * "$Id: mxml-node.c 436 2011-01-22 01:02:05Z mike $" * * Node support code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxmlAdd() - Add a node to a tree. * mxmlDelete() - Delete a node and all of its children. * mxmlGetRefCount() - Get the current reference (use) count for a node. * mxmlNewCDATA() - Create a new CDATA node. * mxmlNewCustom() - Create a new custom data node. * mxmlNewElement() - Create a new element node. * mxmlNewInteger() - Create a new integer node. * mxmlNewOpaque() - Create a new opaque string. * mxmlNewReal() - Create a new real number node. * mxmlNewText() - Create a new text fragment node. * mxmlNewTextf() - Create a new formatted text fragment node. * mxmlRemove() - Remove a node from its parent. * mxmlNewXML() - Create a new XML document tree. * mxmlRelease() - Release a node. * mxmlRetain() - Retain a node. * mxml_new() - Create a new node. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Local functions... */ static mxml_node_t *mxml_new(mxml_node_t *parent, mxml_type_t type); /* * 'mxmlAdd()' - Add a node to a tree. * * Adds the specified node to the parent. If the child argument is not * NULL, puts the new node before or after the specified child depending * on the value of the where argument. If the child argument is NULL, * puts the new node at the beginning of the child list (MXML_ADD_BEFORE) * or at the end of the child list (MXML_ADD_AFTER). The constant * MXML_ADD_TO_PARENT can be used to specify a NULL child pointer. */ void mxmlAdd(mxml_node_t *parent, /* I - Parent node */ int where, /* I - Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER */ mxml_node_t *child, /* I - Child node for where or MXML_ADD_TO_PARENT */ mxml_node_t *node) /* I - Node to add */ { #ifdef DEBUG fprintf(stderr, "mxmlAdd(parent=%p, where=%d, child=%p, node=%p)\n", parent, where, child, node); #endif /* DEBUG */ /* * Range check input... */ if (!parent || !node) return; #if DEBUG > 1 fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent); if (parent) { fprintf(stderr, " BEFORE: parent->child=%p\n", parent->child); fprintf(stderr, " BEFORE: parent->last_child=%p\n", parent->last_child); fprintf(stderr, " BEFORE: parent->prev=%p\n", parent->prev); fprintf(stderr, " BEFORE: parent->next=%p\n", parent->next); } #endif /* DEBUG > 1 */ /* * Remove the node from any existing parent... */ if (node->parent) mxmlRemove(node); /* * Reset pointers... */ node->parent = parent; switch (where) { case MXML_ADD_BEFORE : if (!child || child == parent->child || child->parent != parent) { /* * Insert as first node under parent... */ node->next = parent->child; if (parent->child) parent->child->prev = node; else parent->last_child = node; parent->child = node; } else { /* * Insert node before this child... */ node->next = child; node->prev = child->prev; if (child->prev) child->prev->next = node; else parent->child = node; child->prev = node; } break; case MXML_ADD_AFTER : if (!child || child == parent->last_child || child->parent != parent) { /* * Insert as last node under parent... */ node->parent = parent; node->prev = parent->last_child; if (parent->last_child) parent->last_child->next = node; else parent->child = node; parent->last_child = node; } else { /* * Insert node after this child... */ node->prev = child; node->next = child->next; if (child->next) child->next->prev = node; else parent->last_child = node; child->next = node; } break; } #if DEBUG > 1 fprintf(stderr, " AFTER: node->parent=%p\n", node->parent); if (parent) { fprintf(stderr, " AFTER: parent->child=%p\n", parent->child); fprintf(stderr, " AFTER: parent->last_child=%p\n", parent->last_child); fprintf(stderr, " AFTER: parent->prev=%p\n", parent->prev); fprintf(stderr, " AFTER: parent->next=%p\n", parent->next); } #endif /* DEBUG > 1 */ } /* * 'mxmlDelete()' - Delete a node and all of its children. * * If the specified node has a parent, this function first removes the * node from its parent using the mxmlRemove() function. */ void mxmlDelete(mxml_node_t *node) /* I - Node to delete */ { int i; /* Looping var */ #ifdef DEBUG fprintf(stderr, "mxmlDelete(node=%p)\n", node); #endif /* DEBUG */ /* * Range check input... */ if (!node) return; /* * Remove the node from its parent, if any... */ mxmlRemove(node); /* * Delete children... */ while (node->child) mxmlDelete(node->child); /* * Now delete any node data... */ switch (node->type) { case MXML_ELEMENT : if (node->value.element.name) free(node->value.element.name); if (node->value.element.num_attrs) { for (i = 0; i < node->value.element.num_attrs; i ++) { if (node->value.element.attrs[i].name) free(node->value.element.attrs[i].name); if (node->value.element.attrs[i].value) free(node->value.element.attrs[i].value); } free(node->value.element.attrs); } break; case MXML_INTEGER : /* Nothing to do */ break; case MXML_OPAQUE : if (node->value.opaque) free(node->value.opaque); break; case MXML_REAL : /* Nothing to do */ break; case MXML_TEXT : if (node->value.text.string) free(node->value.text.string); break; case MXML_CUSTOM : if (node->value.custom.data && node->value.custom.destroy) (*(node->value.custom.destroy))(node->value.custom.data); break; default : break; } /* * Free this node... */ free(node); } /* * 'mxmlGetRefCount()' - Get the current reference (use) count for a node. * * The initial reference count of new nodes is 1. Use the @link mxmlRetain@ * and @link mxmlRelease@ functions to increment and decrement a node's * reference count. * * @since Mini-XML 2.7@. */ int /* O - Reference count */ mxmlGetRefCount(mxml_node_t *node) /* I - Node */ { /* * Range check input... */ if (!node) return (0); /* * Return the reference count... */ return (node->ref_count); } /* * 'mxmlNewCDATA()' - Create a new CDATA node. * * The new CDATA node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * CDATA node has no parent. The data string must be nul-terminated and * is copied into the new node. CDATA nodes use the MXML_ELEMENT type. * * @since Mini-XML 2.3@ */ mxml_node_t * /* O - New node */ mxmlNewCDATA(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ const char *data) /* I - Data string */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewCDATA(parent=%p, data=\"%s\")\n", parent, data ? data : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!data) return (NULL); /* * Create the node and set the name value... */ if ((node = mxml_new(parent, MXML_ELEMENT)) != NULL) node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data); return (node); } /* * 'mxmlNewCustom()' - Create a new custom data node. * * The new custom node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * element node has no parent. NULL can be passed when the data in the * node is not dynamically allocated or is separately managed. * * @since Mini-XML 2.1@ */ mxml_node_t * /* O - New node */ mxmlNewCustom( mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ void *data, /* I - Pointer to data */ mxml_custom_destroy_cb_t destroy) /* I - Function to destroy data */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewCustom(parent=%p, data=%p, destroy=%p)\n", parent, data, destroy); #endif /* DEBUG */ /* * Create the node and set the value... */ if ((node = mxml_new(parent, MXML_CUSTOM)) != NULL) { node->value.custom.data = data; node->value.custom.destroy = destroy; } return (node); } /* * 'mxmlNewElement()' - Create a new element node. * * The new element node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * element node has no parent. */ mxml_node_t * /* O - New node */ mxmlNewElement(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ const char *name) /* I - Name of element */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewElement(parent=%p, name=\"%s\")\n", parent, name ? name : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!name) return (NULL); /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_ELEMENT)) != NULL) node->value.element.name = strdup(name); return (node); } /* * 'mxmlNewInteger()' - Create a new integer node. * * The new integer node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * integer node has no parent. */ mxml_node_t * /* O - New node */ mxmlNewInteger(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ int integer) /* I - Integer value */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewInteger(parent=%p, integer=%d)\n", parent, integer); #endif /* DEBUG */ /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_INTEGER)) != NULL) node->value.integer = integer; return (node); } /* * 'mxmlNewOpaque()' - Create a new opaque string. * * The new opaque node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * opaque node has no parent. The opaque string must be nul-terminated and * is copied into the new node. */ mxml_node_t * /* O - New node */ mxmlNewOpaque(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ const char *opaque) /* I - Opaque string */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewOpaque(parent=%p, opaque=\"%s\")\n", parent, opaque ? opaque : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!opaque) return (NULL); /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_OPAQUE)) != NULL) node->value.opaque = strdup(opaque); return (node); } /* * 'mxmlNewReal()' - Create a new real number node. * * The new real number node is added to the end of the specified parent's * child list. The constant MXML_NO_PARENT can be used to specify that * the new real number node has no parent. */ mxml_node_t * /* O - New node */ mxmlNewReal(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ double real) /* I - Real number value */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewReal(parent=%p, real=%g)\n", parent, real); #endif /* DEBUG */ /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_REAL)) != NULL) node->value.real = real; return (node); } /* * 'mxmlNewText()' - Create a new text fragment node. * * The new text node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * text node has no parent. The whitespace parameter is used to specify * whether leading whitespace is present before the node. The text * string must be nul-terminated and is copied into the new node. */ mxml_node_t * /* O - New node */ mxmlNewText(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *string) /* I - String */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewText(parent=%p, whitespace=%d, string=\"%s\")\n", parent, whitespace, string ? string : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!string) return (NULL); /* * Create the node and set the text value... */ if ((node = mxml_new(parent, MXML_TEXT)) != NULL) { node->value.text.whitespace = whitespace; node->value.text.string = strdup(string); } return (node); } /* * 'mxmlNewTextf()' - Create a new formatted text fragment node. * * The new text node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * text node has no parent. The whitespace parameter is used to specify * whether leading whitespace is present before the node. The format * string must be nul-terminated and is formatted into the new node. */ mxml_node_t * /* O - New node */ mxmlNewTextf(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *format, /* I - Printf-style frmat string */ ...) /* I - Additional args as needed */ { mxml_node_t *node; /* New node */ va_list ap; /* Pointer to arguments */ #ifdef DEBUG fprintf(stderr, "mxmlNewTextf(parent=%p, whitespace=%d, format=\"%s\", ...)\n", parent, whitespace, format ? format : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!format) return (NULL); /* * Create the node and set the text value... */ if ((node = mxml_new(parent, MXML_TEXT)) != NULL) { va_start(ap, format); node->value.text.whitespace = whitespace; node->value.text.string = _mxml_vstrdupf(format, ap); va_end(ap); } return (node); } /* * 'mxmlRemove()' - Remove a node from its parent. * * Does not free memory used by the node - use mxmlDelete() for that. * This function does nothing if the node has no parent. */ void mxmlRemove(mxml_node_t *node) /* I - Node to remove */ { #ifdef DEBUG fprintf(stderr, "mxmlRemove(node=%p)\n", node); #endif /* DEBUG */ /* * Range check input... */ if (!node || !node->parent) return; /* * Remove from parent... */ #if DEBUG > 1 fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent); if (node->parent) { fprintf(stderr, " BEFORE: node->parent->child=%p\n", node->parent->child); fprintf(stderr, " BEFORE: node->parent->last_child=%p\n", node->parent->last_child); } fprintf(stderr, " BEFORE: node->child=%p\n", node->child); fprintf(stderr, " BEFORE: node->last_child=%p\n", node->last_child); fprintf(stderr, " BEFORE: node->prev=%p\n", node->prev); fprintf(stderr, " BEFORE: node->next=%p\n", node->next); #endif /* DEBUG > 1 */ if (node->prev) node->prev->next = node->next; else node->parent->child = node->next; if (node->next) node->next->prev = node->prev; else node->parent->last_child = node->prev; node->parent = NULL; node->prev = NULL; node->next = NULL; #if DEBUG > 1 fprintf(stderr, " AFTER: node->parent=%p\n", node->parent); if (node->parent) { fprintf(stderr, " AFTER: node->parent->child=%p\n", node->parent->child); fprintf(stderr, " AFTER: node->parent->last_child=%p\n", node->parent->last_child); } fprintf(stderr, " AFTER: node->child=%p\n", node->child); fprintf(stderr, " AFTER: node->last_child=%p\n", node->last_child); fprintf(stderr, " AFTER: node->prev=%p\n", node->prev); fprintf(stderr, " AFTER: node->next=%p\n", node->next); #endif /* DEBUG > 1 */ } /* * 'mxmlNewXML()' - Create a new XML document tree. * * The "version" argument specifies the version number to put in the * ?xml element node. If NULL, version 1.0 is assumed. * * @since Mini-XML 2.3@ */ mxml_node_t * /* O - New ?xml node */ mxmlNewXML(const char *version) /* I - Version number to use */ { char element[1024]; /* Element text */ snprintf(element, sizeof(element), "?xml version=\"%s\" encoding=\"utf-8\"?", version ? version : "1.0"); return (mxmlNewElement(NULL, element)); } /* * 'mxmlRelease()' - Release a node. * * When the reference count reaches zero, the node (and any children) * is deleted via mxmlDelete(). * * @since Mini-XML 2.3@ */ int /* O - New reference count */ mxmlRelease(mxml_node_t *node) /* I - Node */ { if (node) { if ((-- node->ref_count) <= 0) { mxmlDelete(node); return (0); } else return (node->ref_count); } else return (-1); } /* * 'mxmlRetain()' - Retain a node. * * @since Mini-XML 2.3@ */ int /* O - New reference count */ mxmlRetain(mxml_node_t *node) /* I - Node */ { if (node) return (++ node->ref_count); else return (-1); } /* * 'mxml_new()' - Create a new node. */ static mxml_node_t * /* O - New node */ mxml_new(mxml_node_t *parent, /* I - Parent node */ mxml_type_t type) /* I - Node type */ { mxml_node_t *node; /* New node */ #if DEBUG > 1 fprintf(stderr, "mxml_new(parent=%p, type=%d)\n", parent, type); #endif /* DEBUG > 1 */ /* * Allocate memory for the node... */ if ((node = calloc(1, sizeof(mxml_node_t))) == NULL) { #if DEBUG > 1 fputs(" returning NULL\n", stderr); #endif /* DEBUG > 1 */ return (NULL); } #if DEBUG > 1 fprintf(stderr, " returning %p\n", node); #endif /* DEBUG > 1 */ /* * Set the node type... */ node->type = type; node->ref_count = 1; /* * Add to the parent if present... */ if (parent) mxmlAdd(parent, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, node); /* * Return the new node... */ return (node); } /* * End of "$Id: mxml-node.c 436 2011-01-22 01:02:05Z mike $". */ cmtk-3.0.0/Utilities/mxml/test/0000755000177700000170000000000012263615446015427 5ustar torstenmancmtk-3.0.0/Utilities/mxml/test/functype.cxx0000644000177700000170000000011511210045173017766 0ustar torstenmantypedef int (*foo_func_t)(void *foo, int bar); /**** Foo function type ****/ cmtk-3.0.0/Utilities/mxml/test/dotest.sh0000755000177700000170000000154211210045173017253 0ustar torstenman#!/bin/sh (cd ..; make mxmldoc-static) files="" mode="" while test $# -gt 0; do arg="$1" shift case "$arg" in -f) framed="--framed framed" ;; -g) mode="gdb" ;; -v) mode="valgrind" ;; *.h | *.c | *.cxx) files="$files $arg" ;; *) echo "Usage: ./dotest.sh [-f] [-g] [-v] [files]" exit 1 ;; esac done if test "$files" = ""; then files=*.cxx fi rm -f test.xml case "$mode" in gdb) echo "break malloc_error_break" >.gdbcmds echo "set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib" >>.gdbcmds echo "run $framed test.xml $files >test.html 2>test.log" >>.gdbcmds gdb -x .gdbcmds ../mxmldoc-static ;; valgrind) valgrind --log-fd=3 --leak-check=yes \ ../mxmldoc-static $framed test.xml $files \ >test.html 2>test.log 3>test.valgrind ;; *) ../mxmldoc-static $framed test.xml $files >test.html 2>test.log ;; esac cmtk-3.0.0/Utilities/mxml/test/function.cxx0000644000177700000170000000313511210045173017763 0ustar torstenman/* * 'foo_void_function()' - Do foo with bar. * * Use the @link foo_float_function@ or @link foo_int_function@ functions * instead. Pass @code NULL@ for "three" then there is no string to print. * * @deprecated@ */ void foo_void_function(int one, /* I - Integer */ float *two, /* O - Real number */ const char *three) /* I - String */ { if (one) { puts("Hello, World!"); } else puts(three); *two = 2.0f; } /* * 'foo_float_function()' - Do foo with bar. * * @since 1.2@ */ float /* O - Real number */ foo_float_function(int one, /* I - Integer */ const char *two) /* I - String */ { if (one) { puts("Hello, World!"); } else puts(two); return (2.0f); } /* * 'foo_default_string()' - Do something with a defaulted string arg. */ int /* O - Integer value */ foo_default_string(int one, /* I - Integer */ const char *two = "2") /* I - String */ { if (one) { puts("Hello, World!"); } else puts(two); return (2); } /* * 'foo_default_int()' - Do something with a defaulted int arg. */ int /* O - Integer value */ foo_default_int(int one, /* I - Integer */ int two = 2) /* I - Integer */ { if (one) { puts("Hello, World!"); } else puts(two); return (2); } /* * 'foo_void_func()' - Function taking no arguments. */ void foo_void_func(void) { puts("foo_void_func()"); } /* * 'foo_private_func()' - Private function. * * @private@ */ void foo_private_func(void) { puts("foo_private_func()"); } cmtk-3.0.0/Utilities/mxml/test/class.cxx0000644000177700000170000000254411210045173017246 0ustar torstenmanclass foo_c : public bar_c // Foo class derived from bar { float foo; /* Real number */ int bar; /* Integer */ public: foo_c(float f, int b); ~foo_c(); // 'get_bar()' - Get the value of bar. int // O - Value of bar get_bar() { return (bar); } // 'get_foo()' - Get the value of foo. float // O - Value of foo get_foo() { return (foo); } // 'set_bar()' - Set the value of bar. void set_bar(int b) // I - Value of bar { bar = b; } // 'set_foo()' - Set the value of foo. void set_foo(float f) // I - Value of foo { foo = f; } // 'set_foobar()' - Set foo and optionally bar (should show default args). void set_foobar(float f, // I - Value of foo int b = 0) // I - Value of bar { foo = f; bar = b; } protected: static int global; /* Global integer */ // 'get_global()' - Get the global integer. int // O - Integer get_global() { return (global); } private: int barfoo; // Another private integer public: // 'get_barfoo()' - Get the barfoo value. int // O - Barfoo value get_barfoo() { return (barfoo); } } // 'foo_c::foo_c()' - Create a foo_c class. foo_c::foo_c(float f, // I - Value of foo int b) // I - Value of bar { foo = f; bar = b; } // 'foo_c::~foo_c()' - Destroy a foo_c class. foo_c::~foo_c() { } cmtk-3.0.0/Utilities/mxml/test/struct.cxx0000644000177700000170000000166211210045173017465 0ustar torstenmantypedef struct foo_s /* Foo structure */ { float foo; /* Real number */ int bar; /* Integer */ foo_s(float f, int b); ~foo_s(); // 'get_bar()' - Get the value of bar. int // O - Value of bar get_bar() { return (bar); } // 'get_foo()' - Get the value of foo. float // O - Value of foo get_foo() { return (foo); } // 'set_bar()' - Set the value of bar. void set_bar(int b) // I - Value of bar { bar = b; } // 'set_foo()' - Set the value of foo. void set_foo(float f) // I - Value of foo { foo = f; } } foo_t; // 'foo_s::foo_s()' - Create a foo_s structure. foo_s::foo_s(float f, // I - Value of foo int b) // I - Value of bar { foo = f; bar = b; } // 'foo_s::~foo_s()' - Destroy a foo_s structure. foo_s::~foo_s() { } typedef struct foo_private_s /* @private@ */ { int a; /* Value of "a" */ char b[255]; /* Value of "b" */ } foo_private_t; cmtk-3.0.0/Utilities/mxml/test/enum.cxx0000644000177700000170000000076111210045173017104 0ustar torstenmantypedef enum foo_enum_e /* Sample enumeration type */ { FOO_ONE, /* One fish */ FOO_TWO, /* Two fish */ FOO_RED, /* Red fish */ FOO_BLUE, /* Blue fish */ FOO_PRIVATE /* Private fish @private@ */ } foo_enum_t; typedef enum foo_enum2_e /* Sample enumeration type #2 */ { FOO2_ONE, /* One fish #2 */ FOO2_TWO, /* Two fish #2 */ FOO2_RED, /* Red fish #2 */ FOO2_BLUE, /* Blue fish #2 */ FOO2_PRIVATE /* Private fish #2 @private@ */ } foo_enum2_t; cmtk-3.0.0/Utilities/mxml/test/type.cxx0000644000177700000170000000015011210045173017111 0ustar torstenmantypedef int foo_simple_t; /* Simple integer type */ typedef int foo_simple_private_t; /* @private@ */ cmtk-3.0.0/Utilities/mxml/vcnet/0000755000177700000170000000000012263615446015567 5ustar torstenmancmtk-3.0.0/Utilities/mxml/vcnet/mxml1.def0000644000177700000170000000242611747570117017312 0ustar torstenmanLIBRARY "MXML1" EXPORTS _mxml_strdupf _mxml_vstrdupf mxml_ignore_cb mxml_integer_cb mxml_opaque_cb mxml_real_cb mxmlAdd mxmlDelete mxmlElementDeleteAttr mxmlElementGetAttr mxmlElementSetAttr mxmlElementSetAttrf mxmlEntityAddCallback mxmlEntityGetName mxmlEntityGetValue mxmlEntityRemoveCallback mxmlFindElement mxmlFindPath mxmlGetCDATA mxmlGetCustom mxmlGetElement mxmlGetFirstChild mxmlGetInteger mxmlGetLastChild mxmlGetNextSibling mxmlGetOpaque mxmlGetParent mxmlGetPrevSibling mxmlGetReal mxmlGetRefCount mxmlGetText mxmlGetType mxmlGetUserData mxmlIndexDelete mxmlIndexEnum mxmlIndexFind mxmlIndexGetCount mxmlIndexNew mxmlIndexReset mxmlLoadFd mxmlLoadFile mxmlLoadString mxmlNewCDATA mxmlNewCustom mxmlNewElement mxmlNewInteger mxmlNewOpaque mxmlNewReal mxmlNewText mxmlNewTextf mxmlNewXML mxmlRelease mxmlRemove mxmlRetain mxmlSaveAllocString mxmlSaveFd mxmlSaveFile mxmlSaveString mxmlSAXLoadFd mxmlSAXLoadFile mxmlSAXLoadString mxmlSetCDATA mxmlSetCustom mxmlSetCustomHandlers mxmlSetElement mxmlSetErrorCallback mxmlSetInteger mxmlSetOpaque mxmlSetReal mxmlSetText mxmlSetTextf mxmlSetUserData mxmlSetWrapMargin mxmlWalkNext mxmlWalkPrev cmtk-3.0.0/Utilities/mxml/vcnet/config.h0000644000177700000170000000546111747570117017214 0ustar torstenman/* * "$Id: config.h 408 2010-09-19 05:26:46Z mike $" * * Configuration file for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ */ /* * Beginning with VC2005, Microsoft breaks ISO C and POSIX conformance * by deprecating a number of functions in the name of security, even * when many of the affected functions are otherwise completely secure. * The _CRT_SECURE_NO_DEPRECATE definition ensures that we won't get * warnings from their use... * * Then Microsoft decided that they should ignore this in VC2008 and use * yet another define (_CRT_SECURE_NO_WARNINGS) instead. Bastards. */ #define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_WARNINGS /* * Include necessary headers... */ #include #include #include #include #include #include /* * Microsoft also renames the POSIX functions to _name, and introduces * a broken compatibility layer using the original names. As a result, * random crashes can occur when, for example, strdup() allocates memory * from a different heap than used by malloc() and free(). * * To avoid moronic problems like this, we #define the POSIX function * names to the corresponding non-standard Microsoft names. */ #define close _close #define open _open #define read _read #define snprintf _snprintf #define strdup _strdup #define vsnprintf _vsnprintf #define write _write /* * Version number... */ #define MXML_VERSION "Mini-XML v2.7" /* * Inline function support... */ #define inline _inline /* * Long long support... */ #define HAVE_LONG_LONG 1 /* * Do we have the snprintf() and vsnprintf() functions? */ #define HAVE_SNPRINTF 1 #define HAVE_VSNPRINTF 1 /* * Do we have the strXXX() functions? */ #define HAVE_STRDUP 1 /* * Define prototypes for string functions as needed... */ # ifndef HAVE_STRDUP extern char *_mxml_strdup(const char *); # define strdup _mxml_strdup # endif /* !HAVE_STRDUP */ extern char *_mxml_strdupf(const char *, ...); extern char *_mxml_vstrdupf(const char *, va_list); # ifndef HAVE_SNPRINTF extern int _mxml_snprintf(char *, size_t, const char *, ...); # define snprintf _mxml_snprintf # endif /* !HAVE_SNPRINTF */ # ifndef HAVE_VSNPRINTF extern int _mxml_vsnprintf(char *, size_t, const char *, va_list); # define vsnprintf _mxml_vsnprintf # endif /* !HAVE_VSNPRINTF */ /* * End of "$Id: config.h 408 2010-09-19 05:26:46Z mike $". */ cmtk-3.0.0/Utilities/mxml/vcnet/mxml.sln0000644000177700000170000000565311747570117017274 0ustar torstenmanMicrosoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mxmldoc", "mxmldoc.vcproj", "{D909892E-520A-4322-9A47-DAEBDA9CC7A7}" ProjectSection(ProjectDependencies) = postProject {E5AA9476-9751-4654-8109-B1A2112D5E73} = {E5AA9476-9751-4654-8109-B1A2112D5E73} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mxml1", "mxml1.vcproj", "{E5AA9476-9751-4654-8109-B1A2112D5E73}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testmxml", "testmxml.vcproj", "{75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}" ProjectSection(ProjectDependencies) = postProject {E5AA9476-9751-4654-8109-B1A2112D5E73} = {E5AA9476-9751-4654-8109-B1A2112D5E73} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|Win32.ActiveCfg = Debug|Win32 {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|Win32.Build.0 = Debug|Win32 {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|x64.ActiveCfg = Debug|x64 {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Debug|x64.Build.0 = Debug|x64 {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|Win32.ActiveCfg = Release|Win32 {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|Win32.Build.0 = Release|Win32 {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|x64.ActiveCfg = Release|x64 {D909892E-520A-4322-9A47-DAEBDA9CC7A7}.Release|x64.Build.0 = Release|x64 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|Win32.ActiveCfg = Debug|Win32 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|Win32.Build.0 = Debug|Win32 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|x64.ActiveCfg = Debug|x64 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Debug|x64.Build.0 = Debug|x64 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|Win32.ActiveCfg = Release|Win32 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|Win32.Build.0 = Release|Win32 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|x64.ActiveCfg = Release|x64 {E5AA9476-9751-4654-8109-B1A2112D5E73}.Release|x64.Build.0 = Release|x64 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|Win32.ActiveCfg = Debug|Win32 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|Win32.Build.0 = Debug|Win32 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|x64.ActiveCfg = Debug|x64 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Debug|x64.Build.0 = Debug|x64 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|Win32.ActiveCfg = Release|Win32 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|Win32.Build.0 = Release|Win32 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|x64.ActiveCfg = Release|x64 {75CAC6C4-A6BC-4935-A3C9-8F0AE0744227}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal cmtk-3.0.0/Utilities/mxml/vcnet/mxmldoc.vcproj0000644000177700000170000001656311747570117020473 0ustar torstenman cmtk-3.0.0/Utilities/mxml/vcnet/mxml1.vcproj0000644000177700000170000002160311747570117020055 0ustar torstenman cmtk-3.0.0/Utilities/mxml/vcnet/testmxml.vcproj0000644000177700000170000001734711747570117020706 0ustar torstenman cmtk-3.0.0/Utilities/mxml/CMakeLists.txt0000644000177700000170000000502311775657514017221 0ustar torstenman## ## Copyright 2009-2012 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 199 $ ## ## $LastChangedDate: 2009-07-13 16:38:02 -0700 (Mon, 13 Jul 2009) $ ## ## $LastChangedBy: torstenrohlfing $ ## PROJECT(MiniXML) INCLUDE_REGULAR_EXPRESSION("^.*.h$") SET(MXML_VERSION_MAJOR 2) SET(MXML_VERSION_MINOR 7) SET(MXML_VERSION "Mini-XML v2.7") SET(mxml_SRCS mxml-attr.c mxml-entity.c mxml-index.c mxml-private.c mxml-get.c mxml-set.c mxml-file.c mxml-node.c mxml-search.c mxml-string.c) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckCInline.cmake) CHECK_TYPE_SIZE("long long" LONG_LONG_SIZE) IF(LONG_LONG_SIZE) SET(HAVE_LONG_LONG 1) ENDIF(LONG_LONG_SIZE) INCLUDE(CheckFunctionExists) CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP) CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF) CHECK_INCLUDE_FILES(pthread.h HAVE_PTHREAD_H) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) ADD_LIBRARY(cmtkMxml ${mxml_SRCS}) TARGET_LINK_LIBRARIES(cmtkMxml) INSTALL(TARGETS cmtkMxml RUNTIME DESTINATION ${CMTK_INSTALL_BIN_DIR} COMPONENT runtime LIBRARY DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT runtime ARCHIVE DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT libraries) FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") INSTALL(FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${CMTK_INSTALL_INCLUDE_DIR} COMPONENT headers) SET(MXML_LIBRARIES "cmtkMxml" CACHE INTERNAL "Libraries for the mxml library") SET(MXML_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "Include directory for the mxml library headers.") cmtk-3.0.0/Utilities/mxml/mxml.xml0000644000177700000170000016214711747570117016163 0ustar torstenman Add a node to a tree. Adds the specified node to the parent. If the child argument is not NULL, puts the new node before or after the specified child depending on the value of the where argument. If the child argument is NULL, puts the new node at the beginning of the child list (MXML_ADD_BEFORE) or at the end of the child list (MXML_ADD_AFTER). The constant MXML_ADD_TO_PARENT can be used to specify a NULL child pointer. mxml_node_t * Parent node int Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER mxml_node_t * Child node for where or MXML_ADD_TO_PARENT mxml_node_t * Node to add Delete a node and all of its children. If the specified node has a parent, this function first removes the node from its parent using the mxmlRemove() function. mxml_node_t * Node to delete Delete an attribute. @since Mini-XML 2.4@ mxml_node_t * Element const char * Attribute name const char * Attribute value or NULL Get an attribute. This function returns NULL if the node is not an element or the named attribute does not exist. mxml_node_t * Element node const char * Name of attribute Set an attribute. If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is copied into the element node. This function does nothing if the node is not an element. mxml_node_t * Element node const char * Name of attribute const char * Attribute value Set an attribute with a formatted value. If the named attribute already exists, the value of the attribute is replaced by the new formatted string. The formatted string value is copied into the element node. This function does nothing if the node is not an element. @since Mini-XML 2.3@ mxml_node_t * Element node const char * Name of attribute const char * Printf-style attribute value Additional arguments as needed int 0 on success, -1 on failure Add a callback to convert entities to Unicode. mxml_entity_cb_t Callback function to add const char * Entity name or NULL Get the name that corresponds to the character value. If val does not need to be represented by a named entity, NULL is returned. int Character value int Character value or -1 on error Get the character corresponding to a named entity. The entity name can also be a numeric constant. -1 is returned if the name is not known. const char * Entity name Remove a callback. mxml_entity_cb_t Callback function to remove mxml_node_t * Element node or NULL Find the named element. The search is constrained by the name, attribute name, and value; any NULL names or values are treated as wildcards, so different kinds of searches can be implemented by looking for all elements of a given name or all elements with a specific attribute. The descend argument determines whether the search descends into child nodes; normally you will use MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find additional direct descendents of the node. The top node argument constrains the search to a particular node's children. mxml_node_t * Current node mxml_node_t * Top node const char * Element name or NULL for any const char * Attribute name, or NULL for none const char * Attribute value, or NULL for any int Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST mxml_node_t * Found node or NULL Find a node with the given path. The "path" is a slash-separated list of element names. The name "*" is considered a wildcard for one or more levels of elements. For example, "foo/one/two", "bar/two/one", "*/one", and so forth. The first child node of the found node is returned if the given node has children and the first child is a value node. @since Mini-XML 2.7@ mxml_node_t * Top node const char * Path to element const char * CDATA value or NULL Get the value for a CDATA node. @code NULL@ is returned if the node is not a CDATA element. @since Mini-XML 2.7@ mxml_node_t * Node to get const void * Custom value or NULL Get the value for a custom node. @code NULL@ is returned if the node (or its first child) is not a custom value node. @since Mini-XML 2.7@ mxml_node_t * Node to get const char * Element name or NULL Get the name for an element node. @code NULL@ is returned if the node is not an element node. @since Mini-XML 2.7@ mxml_node_t * Node to get mxml_node_t * First child or NULL Get the first child of an element node. @code NULL@ is returned if the node is not an element node or if the node has no children. @since Mini-XML 2.7@ mxml_node_t * Node to get int Integer value or 0 Get the integer value from the specified node or its first child. 0 is returned if the node (or its first child) is not an integer value node. @since Mini-XML 2.7@ mxml_node_t * Node to get mxml_node_t * Last child or NULL Get the last child of an element node. @code NULL@ is returned if the node is not an element node or if the node has no children. @since Mini-XML 2.7@ mxml_node_t * Node to get mxml_node_t * Get the next node for the current parent. @code NULL@ is returned if this is the last child for the current parent. @since Mini-XML 2.7@ Return the node type... mxml_node_t * Node to get const char * Opaque string or NULL Get an opaque string value for a node or its first child. @code NULL@ is returned if the node (or its first child) is not an opaque value node. @since Mini-XML 2.7@ mxml_node_t * Node to get mxml_node_t * Parent node or NULL Get the parent node. @code NULL@ is returned for a root node. @since Mini-XML 2.7@ mxml_node_t * Node to get mxml_node_t * Previous node or NULL Get the previous node for the current parent. @code NULL@ is returned if this is the first child for the current parent. @since Mini-XML 2.7@ mxml_node_t * Node to get double Real value or 0.0 Get the real value for a node or its first child. 0.0 is returned if the node (or its first child) is not a real value node. @since Mini-XML 2.7@ mxml_node_t * Node to get int Reference count Get the current reference (use) count for a node. The initial reference count of new nodes is 1. Use the @link mxmlRetain@ and @link mxmlRelease@ functions to increment and decrement a node's reference count. @since Mini-XML 2.7@. mxml_node_t * Node const char * Text string or NULL Get the text value for a node or its first child. @code NULL@ is returned if the node (or its first child) is not a text node. The "whitespace" argument can be NULL. @since Mini-XML 2.7@ mxml_node_t * Node to get int * 1 if string is preceded by whitespace, 0 otherwise mxml_type_t Type of node Get the node type. @code MXML_IGNORE@ is returned if "node" is @code NULL@. @since Mini-XML 2.7@ mxml_node_t * Node to get void * User data pointer Get the user data pointer for a node. @since Mini-XML 2.7@ mxml_node_t * Node to get Delete an index. mxml_index_t * Index to delete mxml_node_t * Next node or NULL if there is none Return the next node in the index. Nodes are returned in the sorted order of the index. mxml_index_t * Index to enumerate mxml_node_t * Node or NULL if none found Find the next matching node. You should call mxmlIndexReset() prior to using this function for the first time with a particular set of "element" and "value" strings. Passing NULL for both "element" and "value" is equivalent to calling mxmlIndexEnum(). mxml_index_t * Index to search const char * Element name to find, if any const char * Attribute value, if any int Number of nodes in index Get the number of nodes in an index. @since Mini-XML 2.7@ mxml_index_t * Index of nodes mxml_index_t * New index Create a new index. The index will contain all nodes that contain the named element and/or attribute. If both "element" and "attr" are NULL, then the index will contain a sorted list of the elements in the node tree. Nodes are sorted by element name and optionally by attribute value if the "attr" argument is not NULL. mxml_node_t * XML node tree const char * Element to index or NULL for all const char * Attribute to index or NULL for none mxml_node_t * First node or NULL if there is none Reset the enumeration/find pointer in the index and return the first node in the index. This function should be called prior to using mxmlIndexEnum() or mxmlIndexFind() for the first time. mxml_index_t * Index to reset mxml_node_t * First node or NULL if the file could not be read. Load a file descriptor into an XML node tree. The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. mxml_node_t * Top node int File descriptor to read from mxml_load_cb_t Callback function or MXML_NO_CALLBACK mxml_node_t * First node or NULL if the file could not be read. Load a file into an XML node tree. The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. mxml_node_t * Top node FILE * File to read from mxml_load_cb_t Callback function or MXML_NO_CALLBACK mxml_node_t * First node or NULL if the string has errors. Load a string into an XML node tree. The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. mxml_node_t * Top node const char * String to load mxml_load_cb_t Callback function or MXML_NO_CALLBACK mxml_node_t * New node Create a new CDATA node. The new CDATA node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new CDATA node has no parent. The data string must be nul-terminated and is copied into the new node. CDATA nodes use the MXML_ELEMENT type. @since Mini-XML 2.3@ mxml_node_t * Parent node or MXML_NO_PARENT const char * Data string mxml_node_t * New node Create a new custom data node. The new custom node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent. NULL can be passed when the data in the node is not dynamically allocated or is separately managed. @since Mini-XML 2.1@ mxml_node_t * Parent node or MXML_NO_PARENT void * Pointer to data mxml_custom_destroy_cb_t Function to destroy data mxml_node_t * New node Create a new element node. The new element node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent. mxml_node_t * Parent node or MXML_NO_PARENT const char * Name of element mxml_node_t * New node Create a new integer node. The new integer node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new integer node has no parent. mxml_node_t * Parent node or MXML_NO_PARENT int Integer value mxml_node_t * New node Create a new opaque string. The new opaque node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new opaque node has no parent. The opaque string must be nul-terminated and is copied into the new node. mxml_node_t * Parent node or MXML_NO_PARENT const char * Opaque string mxml_node_t * New node Create a new real number node. The new real number node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new real number node has no parent. mxml_node_t * Parent node or MXML_NO_PARENT double Real number value mxml_node_t * New node Create a new text fragment node. The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The text string must be nul-terminated and is copied into the new node. mxml_node_t * Parent node or MXML_NO_PARENT int 1 = leading whitespace, 0 = no whitespace const char * String mxml_node_t * New node Create a new formatted text fragment node. The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The format string must be nul-terminated and is formatted into the new node. mxml_node_t * Parent node or MXML_NO_PARENT int 1 = leading whitespace, 0 = no whitespace const char * Printf-style frmat string Additional args as needed mxml_node_t * New ?xml node Create a new XML document tree. The "version" argument specifies the version number to put in the ?xml element node. If NULL, version 1.0 is assumed. @since Mini-XML 2.3@ const char * Version number to use int New reference count Release a node. When the reference count reaches zero, the node (and any children) is deleted via mxmlDelete(). @since Mini-XML 2.3@ mxml_node_t * Node Remove a node from its parent. Does not free memory used by the node - use mxmlDelete() for that. This function does nothing if the node has no parent. mxml_node_t * Node to remove int New reference count Retain a node. @since Mini-XML 2.3@ mxml_node_t * Node mxml_node_t * First node or NULL if the file could not be read. Load a file descriptor into an XML node tree using a SAX callback. The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. @since Mini-XML 2.3@ mxml_node_t * Top node int File descriptor to read from mxml_load_cb_t Callback function or MXML_NO_CALLBACK mxml_sax_cb_t SAX callback or MXML_NO_CALLBACK void * SAX user data mxml_node_t * First node or NULL if the file could not be read. Load a file into an XML node tree using a SAX callback. The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. @since Mini-XML 2.3@ mxml_node_t * Top node FILE * File to read from mxml_load_cb_t Callback function or MXML_NO_CALLBACK mxml_sax_cb_t SAX callback or MXML_NO_CALLBACK void * SAX user data mxml_node_t * First node or NULL if the string has errors. Load a string into an XML node tree using a SAX callback. The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. @since Mini-XML 2.3@ mxml_node_t * Top node const char * String to load mxml_load_cb_t Callback function or MXML_NO_CALLBACK mxml_sax_cb_t SAX callback or MXML_NO_CALLBACK void * SAX user data char * Allocated string or NULL Save an XML tree to an allocated string. This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed using the free() function when you are done with it. NULL is returned if the node would produce an empty string or if the string cannot be allocated. The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. mxml_node_t * Node to write mxml_save_cb_t Whitespace callback or MXML_NO_CALLBACK int 0 on success, -1 on error. Save an XML tree to a file descriptor. The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. mxml_node_t * Node to write int File descriptor to write to mxml_save_cb_t Whitespace callback or MXML_NO_CALLBACK int 0 on success, -1 on error. Save an XML tree to a file. The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. mxml_node_t * Node to write FILE * File to write to mxml_save_cb_t Whitespace callback or MXML_NO_CALLBACK int Size of string Save an XML node tree to a string. This function returns the total number of bytes that would be required for the string but only copies (bufsize - 1) characters into the specified buffer. The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. mxml_node_t * Node to write char * String buffer int Size of string buffer mxml_save_cb_t Whitespace callback or MXML_NO_CALLBACK int 0 on success, -1 on failure Set the element name of a CDATA node. The node is not changed if it (or its first child) is not a CDATA element node. @since Mini-XML 2.3@ mxml_node_t * Node to set const char * New data string int 0 on success, -1 on failure Set the data and destructor of a custom data node. The node is not changed if it (or its first child) is not a custom node. @since Mini-XML 2.1@ mxml_node_t * Node to set void * New data pointer mxml_custom_destroy_cb_t New destructor function Set the handling functions for custom data. The load function accepts a node pointer and a data string and must return 0 on success and non-zero on error. The save function accepts a node pointer and must return a malloc'd string on success and NULL on error. mxml_custom_load_cb_t Load function mxml_custom_save_cb_t Save function int 0 on success, -1 on failure Set the name of an element node. The node is not changed if it is not an element node. mxml_node_t * Node to set const char * New name string Set the error message callback. mxml_error_cb_t Error callback function int 0 on success, -1 on failure Set the value of an integer node. The node is not changed if it (or its first child) is not an integer node. mxml_node_t * Node to set int Integer value int 0 on success, -1 on failure Set the value of an opaque node. The node is not changed if it (or its first child) is not an opaque node. mxml_node_t * Node to set const char * Opaque string int 0 on success, -1 on failure Set the value of a real number node. The node is not changed if it (or its first child) is not a real number node. mxml_node_t * Node to set double Real number value int 0 on success, -1 on failure Set the value of a text node. The node is not changed if it (or its first child) is not a text node. mxml_node_t * Node to set int 1 = leading whitespace, 0 = no whitespace const char * String int 0 on success, -1 on failure Set the value of a text node to a formatted string. The node is not changed if it (or its first child) is not a text node. mxml_node_t * Node to set int 1 = leading whitespace, 0 = no whitespace const char * Printf-style format string Additional arguments as needed int 0 on success, -1 on failure Set the user data pointer for a node. @since Mini-XML 2.7@ mxml_node_t * Node to set void * User data pointer Set the wrap margin when saving XML data. Wrapping is disabled when "column" is 0. @since Mini-XML 2.3@ int Column for wrapping, 0 to disable wrapping mxml_node_t * Next node or NULL Walk to the next logical node in the tree. The descend argument controls whether the first child is considered to be the next node. The top node argument constrains the walk to the node's children. mxml_node_t * Current node mxml_node_t * Top node int Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST mxml_node_t * Previous node or NULL Walk to the previous logical node in the tree. The descend argument controls whether the previous node's last child is considered to be the previous node. The top node argument constrains the walk to the node's children. mxml_node_t * Current node mxml_node_t * Top node int Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST An XML element attribute value. @private@ char * Attribute name char * Attribute value struct mxml_attr_s An XML element attribute value. @private@ void(*)(void *) Custom data destructor int(*)(mxml_node_t *, const char *) Custom data load callback function An XML custom value. @private@ void * Pointer to (allocated) custom data mxml_custom_destroy_cb_t Pointer to destructor function char *(*)(mxml_node_t *) Custom data save callback function struct mxml_custom_s An XML custom value. @private@ An XML element value. @private@ mxml_attr_t * Attributes char * Name of element int Number of attributes struct mxml_element_s An XML element value. @private@ int(*)(const char *) Entity callback function void(*)(const char *) Error callback function An XML node index. @private@ int Allocated nodes in index char * Attribute used for indexing or NULL int Current node mxml_node_t ** Node array int Number of nodes in index struct mxml_index_s An XML node index. mxml_type_t(*)(mxml_node_t *) Load callback function An XML node. @private@ struct mxml_node_s * First child node struct mxml_node_s * Last child node struct mxml_node_s * Next node under same parent struct mxml_node_s * Parent node struct mxml_node_s * Previous node under same parent int Use count mxml_type_t Node type void * User data mxml_value_t Node value struct mxml_node_s An XML node. const char *(*)(mxml_node_t *, int) Save callback function void(*)(mxml_node_t *, mxml_sax_event_t, void *) SAX callback function SAX event type. CDATA node Comment node Data node Processing directive node Element closed Element opened enum mxml_sax_event_e SAX event type. An XML text value. @private@ char * Fragment string int Leading whitespace? struct mxml_text_s An XML text value. @private@ The XML node type. Custom data @since Mini-XML 2.1@ XML element with attributes Ignore/throw away node @since Mini-XML 2.3@ Integer value Opaque string Real value Text fragment The XML node type. enum mxml_type_e union mxml_value_u An XML node value. @private@ An XML node value. @private@ mxml_custom_t Custom data @since Mini-XML 2.1@ mxml_element_t Element int Integer number char * Opaque string double Real number mxml_text_t Text fragment cmtk-3.0.0/Utilities/mxml/mxml-private.h0000644000177700000170000000211511747570117017246 0ustar torstenman/* * "$Id: mxml-private.h 408 2010-09-19 05:26:46Z mike $" * * Private definitions for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Global, per-thread data... */ typedef struct _mxml_global_s { void (*error_cb)(const char *); int num_entity_cbs; int (*entity_cbs[100])(const char *name); int wrap; mxml_custom_load_cb_t custom_load_cb; mxml_custom_save_cb_t custom_save_cb; } _mxml_global_t; /* * Functions... */ extern _mxml_global_t *_mxml_global(void); extern int _mxml_entity_cb(const char *name); /* * End of "$Id: mxml-private.h 408 2010-09-19 05:26:46Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml-file.c0000644000177700000170000020270511747570117016515 0ustar torstenman/* * "$Id: mxml-file.c 438 2011-03-24 05:47:51Z mike $" * * File loading code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxmlLoadFd() - Load a file descriptor into an XML node tree. * mxmlLoadFile() - Load a file into an XML node tree. * mxmlLoadString() - Load a string into an XML node tree. * mxmlSaveAllocString() - Save an XML tree to an allocated string. * mxmlSaveFd() - Save an XML tree to a file descriptor. * mxmlSaveFile() - Save an XML tree to a file. * mxmlSaveString() - Save an XML node tree to a string. * mxmlSAXLoadFd() - Load a file descriptor into an XML node tree * using a SAX callback. * mxmlSAXLoadFile() - Load a file into an XML node tree * using a SAX callback. * mxmlSAXLoadString() - Load a string into an XML node tree * using a SAX callback. * mxmlSetCustomHandlers() - Set the handling functions for custom data. * mxmlSetErrorCallback() - Set the error message callback. * mxmlSetWrapMargin() - Set the wrap margin when saving XML data. * mxml_add_char() - Add a character to a buffer, expanding as needed. * mxml_fd_getc() - Read a character from a file descriptor. * mxml_fd_putc() - Write a character to a file descriptor. * mxml_fd_read() - Read a buffer of data from a file descriptor. * mxml_fd_write() - Write a buffer of data to a file descriptor. * mxml_file_getc() - Get a character from a file. * mxml_file_putc() - Write a character to a file. * mxml_get_entity() - Get the character corresponding to an entity... * mxml_load_data() - Load data into an XML node tree. * mxml_parse_element() - Parse an element for any attributes... * mxml_string_getc() - Get a character from a string. * mxml_string_putc() - Write a character to a string. * mxml_write_name() - Write a name string. * mxml_write_node() - Save an XML node to a file. * mxml_write_string() - Write a string, escaping & and < as needed. * mxml_write_ws() - Do whitespace callback... */ /* * Include necessary headers... */ #ifndef WIN32 # include #endif /* !WIN32 */ #include "mxml-private.h" /* * Character encoding... */ #define ENCODE_UTF8 0 /* UTF-8 */ #define ENCODE_UTF16BE 1 /* UTF-16 Big-Endian */ #define ENCODE_UTF16LE 2 /* UTF-16 Little-Endian */ /* * Macro to test for a bad XML character... */ #define mxml_bad_char(ch) ((ch) < ' ' && (ch) != '\n' && (ch) != '\r' && (ch) != '\t') /* * Types and structures... */ typedef int (*_mxml_getc_cb_t)(void *, int *); typedef int (*_mxml_putc_cb_t)(int, void *); typedef struct _mxml_fdbuf_s /**** File descriptor buffer ****/ { int fd; /* File descriptor */ unsigned char *current, /* Current position in buffer */ *end, /* End of buffer */ buffer[8192]; /* Character buffer */ } _mxml_fdbuf_t; /* * Local functions... */ static int mxml_add_char(int ch, char **ptr, char **buffer, int *bufsize); static int mxml_fd_getc(void *p, int *encoding); static int mxml_fd_putc(int ch, void *p); static int mxml_fd_read(_mxml_fdbuf_t *buf); static int mxml_fd_write(_mxml_fdbuf_t *buf); static int mxml_file_getc(void *p, int *encoding); static int mxml_file_putc(int ch, void *p); static int mxml_get_entity(mxml_node_t *parent, void *p, int *encoding, _mxml_getc_cb_t getc_cb); static inline int mxml_isspace(int ch) { return (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n'); } static mxml_node_t *mxml_load_data(mxml_node_t *top, void *p, mxml_load_cb_t cb, _mxml_getc_cb_t getc_cb, mxml_sax_cb_t sax_cb, void *sax_data); static int mxml_parse_element(mxml_node_t *node, void *p, int *encoding, _mxml_getc_cb_t getc_cb); static int mxml_string_getc(void *p, int *encoding); static int mxml_string_putc(int ch, void *p); static int mxml_write_name(const char *s, void *p, _mxml_putc_cb_t putc_cb); static int mxml_write_node(mxml_node_t *node, void *p, mxml_save_cb_t cb, int col, _mxml_putc_cb_t putc_cb, _mxml_global_t *global); static int mxml_write_string(const char *s, void *p, _mxml_putc_cb_t putc_cb); static int mxml_write_ws(mxml_node_t *node, void *p, mxml_save_cb_t cb, int ws, int col, _mxml_putc_cb_t putc_cb); /* * 'mxmlLoadFd()' - Load a file descriptor into an XML node tree. * * The nodes in the specified file are added to the specified top node. * If no top node is provided, the XML file MUST be well-formed with a * single parent node like for the entire file. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. */ mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxmlLoadFd(mxml_node_t *top, /* I - Top node */ int fd, /* I - File descriptor to read from */ mxml_load_cb_t cb) /* I - Callback function or MXML_NO_CALLBACK */ { _mxml_fdbuf_t buf; /* File descriptor buffer */ /* * Initialize the file descriptor buffer... */ buf.fd = fd; buf.current = buf.buffer; buf.end = buf.buffer; /* * Read the XML data... */ return (mxml_load_data(top, &buf, cb, mxml_fd_getc, MXML_NO_CALLBACK, NULL)); } /* * 'mxmlLoadFile()' - Load a file into an XML node tree. * * The nodes in the specified file are added to the specified top node. * If no top node is provided, the XML file MUST be well-formed with a * single parent node like for the entire file. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. */ mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxmlLoadFile(mxml_node_t *top, /* I - Top node */ FILE *fp, /* I - File to read from */ mxml_load_cb_t cb) /* I - Callback function or MXML_NO_CALLBACK */ { /* * Read the XML data... */ return (mxml_load_data(top, fp, cb, mxml_file_getc, MXML_NO_CALLBACK, NULL)); } /* * 'mxmlLoadString()' - Load a string into an XML node tree. * * The nodes in the specified string are added to the specified top node. * If no top node is provided, the XML string MUST be well-formed with a * single parent node like for the entire string. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. */ mxml_node_t * /* O - First node or NULL if the string has errors. */ mxmlLoadString(mxml_node_t *top, /* I - Top node */ const char *s, /* I - String to load */ mxml_load_cb_t cb) /* I - Callback function or MXML_NO_CALLBACK */ { /* * Read the XML data... */ return (mxml_load_data(top, (void *)&s, cb, mxml_string_getc, MXML_NO_CALLBACK, NULL)); } /* * 'mxmlSaveAllocString()' - Save an XML tree to an allocated string. * * This function returns a pointer to a string containing the textual * representation of the XML node tree. The string should be freed * using the free() function when you are done with it. NULL is returned * if the node would produce an empty string or if the string cannot be * allocated. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ char * /* O - Allocated string or NULL */ mxmlSaveAllocString( mxml_node_t *node, /* I - Node to write */ mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int bytes; /* Required bytes */ char buffer[8192]; /* Temporary buffer */ char *s; /* Allocated string */ /* * Write the node to the temporary buffer... */ bytes = mxmlSaveString(node, buffer, sizeof(buffer), cb); if (bytes <= 0) return (NULL); if (bytes < (int)(sizeof(buffer) - 1)) { /* * Node fit inside the buffer, so just duplicate that string and * return... */ return (strdup(buffer)); } /* * Allocate a buffer of the required size and save the node to the * new buffer... */ if ((s = malloc(bytes + 1)) == NULL) return (NULL); mxmlSaveString(node, s, bytes + 1, cb); /* * Return the allocated string... */ return (s); } /* * 'mxmlSaveFd()' - Save an XML tree to a file descriptor. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ int /* O - 0 on success, -1 on error. */ mxmlSaveFd(mxml_node_t *node, /* I - Node to write */ int fd, /* I - File descriptor to write to */ mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int col; /* Final column */ _mxml_fdbuf_t buf; /* File descriptor buffer */ _mxml_global_t *global = _mxml_global(); /* Global data */ /* * Initialize the file descriptor buffer... */ buf.fd = fd; buf.current = buf.buffer; buf.end = buf.buffer + sizeof(buf.buffer); /* * Write the node... */ if ((col = mxml_write_node(node, &buf, cb, 0, mxml_fd_putc, global)) < 0) return (-1); if (col > 0) if (mxml_fd_putc('\n', &buf) < 0) return (-1); /* * Flush and return... */ return (mxml_fd_write(&buf)); } /* * 'mxmlSaveFile()' - Save an XML tree to a file. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ int /* O - 0 on success, -1 on error. */ mxmlSaveFile(mxml_node_t *node, /* I - Node to write */ FILE *fp, /* I - File to write to */ mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int col; /* Final column */ _mxml_global_t *global = _mxml_global(); /* Global data */ /* * Write the node... */ if ((col = mxml_write_node(node, fp, cb, 0, mxml_file_putc, global)) < 0) return (-1); if (col > 0) if (putc('\n', fp) < 0) return (-1); /* * Return 0 (success)... */ return (0); } /* * 'mxmlSaveString()' - Save an XML node tree to a string. * * This function returns the total number of bytes that would be * required for the string but only copies (bufsize - 1) characters * into the specified buffer. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ int /* O - Size of string */ mxmlSaveString(mxml_node_t *node, /* I - Node to write */ char *buffer, /* I - String buffer */ int bufsize, /* I - Size of string buffer */ mxml_save_cb_t cb) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int col; /* Final column */ char *ptr[2]; /* Pointers for putc_cb */ _mxml_global_t *global = _mxml_global(); /* Global data */ /* * Write the node... */ ptr[0] = buffer; ptr[1] = buffer + bufsize; if ((col = mxml_write_node(node, ptr, cb, 0, mxml_string_putc, global)) < 0) return (-1); if (col > 0) mxml_string_putc('\n', ptr); /* * Nul-terminate the buffer... */ if (ptr[0] >= ptr[1]) buffer[bufsize - 1] = '\0'; else ptr[0][0] = '\0'; /* * Return the number of characters... */ return (ptr[0] - buffer); } /* * 'mxmlSAXLoadFd()' - Load a file descriptor into an XML node tree * using a SAX callback. * * The nodes in the specified file are added to the specified top node. * If no top node is provided, the XML file MUST be well-formed with a * single parent node like for the entire file. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. * * The SAX callback must call mxmlRetain() for any nodes that need to * be kept for later use. Otherwise, nodes are deleted when the parent * node is closed or after each data, comment, CDATA, or directive node. * * @since Mini-XML 2.3@ */ mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxmlSAXLoadFd(mxml_node_t *top, /* I - Top node */ int fd, /* I - File descriptor to read from */ mxml_load_cb_t cb, /* I - Callback function or MXML_NO_CALLBACK */ mxml_sax_cb_t sax_cb, /* I - SAX callback or MXML_NO_CALLBACK */ void *sax_data) /* I - SAX user data */ { _mxml_fdbuf_t buf; /* File descriptor buffer */ /* * Initialize the file descriptor buffer... */ buf.fd = fd; buf.current = buf.buffer; buf.end = buf.buffer; /* * Read the XML data... */ return (mxml_load_data(top, &buf, cb, mxml_fd_getc, sax_cb, sax_data)); } /* * 'mxmlSAXLoadFile()' - Load a file into an XML node tree * using a SAX callback. * * The nodes in the specified file are added to the specified top node. * If no top node is provided, the XML file MUST be well-formed with a * single parent node like for the entire file. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. * * The SAX callback must call mxmlRetain() for any nodes that need to * be kept for later use. Otherwise, nodes are deleted when the parent * node is closed or after each data, comment, CDATA, or directive node. * * @since Mini-XML 2.3@ */ mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxmlSAXLoadFile( mxml_node_t *top, /* I - Top node */ FILE *fp, /* I - File to read from */ mxml_load_cb_t cb, /* I - Callback function or MXML_NO_CALLBACK */ mxml_sax_cb_t sax_cb, /* I - SAX callback or MXML_NO_CALLBACK */ void *sax_data) /* I - SAX user data */ { /* * Read the XML data... */ return (mxml_load_data(top, fp, cb, mxml_file_getc, sax_cb, sax_data)); } /* * 'mxmlSAXLoadString()' - Load a string into an XML node tree * using a SAX callback. * * The nodes in the specified string are added to the specified top node. * If no top node is provided, the XML string MUST be well-formed with a * single parent node like for the entire string. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. * * The SAX callback must call mxmlRetain() for any nodes that need to * be kept for later use. Otherwise, nodes are deleted when the parent * node is closed or after each data, comment, CDATA, or directive node. * * @since Mini-XML 2.3@ */ mxml_node_t * /* O - First node or NULL if the string has errors. */ mxmlSAXLoadString( mxml_node_t *top, /* I - Top node */ const char *s, /* I - String to load */ mxml_load_cb_t cb, /* I - Callback function or MXML_NO_CALLBACK */ mxml_sax_cb_t sax_cb, /* I - SAX callback or MXML_NO_CALLBACK */ void *sax_data) /* I - SAX user data */ { /* * Read the XML data... */ return (mxml_load_data(top, (void *)&s, cb, mxml_string_getc, sax_cb, sax_data)); } /* * 'mxmlSetCustomHandlers()' - Set the handling functions for custom data. * * The load function accepts a node pointer and a data string and must * return 0 on success and non-zero on error. * * The save function accepts a node pointer and must return a malloc'd * string on success and NULL on error. * */ void mxmlSetCustomHandlers( mxml_custom_load_cb_t load, /* I - Load function */ mxml_custom_save_cb_t save) /* I - Save function */ { _mxml_global_t *global = _mxml_global(); /* Global data */ global->custom_load_cb = load; global->custom_save_cb = save; } /* * 'mxmlSetErrorCallback()' - Set the error message callback. */ void mxmlSetErrorCallback(mxml_error_cb_t cb)/* I - Error callback function */ { _mxml_global_t *global = _mxml_global(); /* Global data */ global->error_cb = cb; } /* * 'mxmlSetWrapMargin()' - Set the wrap margin when saving XML data. * * Wrapping is disabled when "column" is 0. * * @since Mini-XML 2.3@ */ void mxmlSetWrapMargin(int column) /* I - Column for wrapping, 0 to disable wrapping */ { _mxml_global_t *global = _mxml_global(); /* Global data */ global->wrap = column; } /* * 'mxml_add_char()' - Add a character to a buffer, expanding as needed. */ static int /* O - 0 on success, -1 on error */ mxml_add_char(int ch, /* I - Character to add */ char **bufptr, /* IO - Current position in buffer */ char **buffer, /* IO - Current buffer */ int *bufsize) /* IO - Current buffer size */ { char *newbuffer; /* New buffer value */ if (*bufptr >= (*buffer + *bufsize - 4)) { /* * Increase the size of the buffer... */ if (*bufsize < 1024) (*bufsize) *= 2; else (*bufsize) += 1024; if ((newbuffer = realloc(*buffer, *bufsize)) == NULL) { free(*buffer); mxml_error("Unable to expand string buffer to %d bytes!", *bufsize); return (-1); } *bufptr = newbuffer + (*bufptr - *buffer); *buffer = newbuffer; } if (ch < 0x80) { /* * Single byte ASCII... */ *(*bufptr)++ = ch; } else if (ch < 0x800) { /* * Two-byte UTF-8... */ *(*bufptr)++ = 0xc0 | (ch >> 6); *(*bufptr)++ = 0x80 | (ch & 0x3f); } else if (ch < 0x10000) { /* * Three-byte UTF-8... */ *(*bufptr)++ = 0xe0 | (ch >> 12); *(*bufptr)++ = 0x80 | ((ch >> 6) & 0x3f); *(*bufptr)++ = 0x80 | (ch & 0x3f); } else { /* * Four-byte UTF-8... */ *(*bufptr)++ = 0xf0 | (ch >> 18); *(*bufptr)++ = 0x80 | ((ch >> 12) & 0x3f); *(*bufptr)++ = 0x80 | ((ch >> 6) & 0x3f); *(*bufptr)++ = 0x80 | (ch & 0x3f); } return (0); } /* * 'mxml_fd_getc()' - Read a character from a file descriptor. */ static int /* O - Character or EOF */ mxml_fd_getc(void *p, /* I - File descriptor buffer */ int *encoding) /* IO - Encoding */ { _mxml_fdbuf_t *buf; /* File descriptor buffer */ int ch, /* Current character */ temp; /* Temporary character */ /* * Grab the next character in the buffer... */ buf = (_mxml_fdbuf_t *)p; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); ch = *(buf->current)++; switch (*encoding) { case ENCODE_UTF8 : /* * Got a UTF-8 character; convert UTF-8 to Unicode and return... */ if (!(ch & 0x80)) { #if DEBUG > 1 printf("mxml_fd_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } return (ch); } else if (ch == 0xfe) { /* * UTF-16 big-endian BOM? */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); ch = *(buf->current)++; if (ch != 0xff) return (EOF); *encoding = ENCODE_UTF16BE; return (mxml_fd_getc(p, encoding)); } else if (ch == 0xff) { /* * UTF-16 little-endian BOM? */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); ch = *(buf->current)++; if (ch != 0xfe) return (EOF); *encoding = ENCODE_UTF16LE; return (mxml_fd_getc(p, encoding)); } else if ((ch & 0xe0) == 0xc0) { /* * Two-byte value... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x1f) << 6) | (temp & 0x3f); if (ch < 0x80) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } } else if ((ch & 0xf0) == 0xe0) { /* * Three-byte value... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x0f) << 6) | (temp & 0x3f); if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x800) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } /* * Ignore (strip) Byte Order Mark (BOM)... */ if (ch == 0xfeff) return (mxml_fd_getc(p, encoding)); } else if ((ch & 0xf8) == 0xf0) { /* * Four-byte value... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x07) << 6) | (temp & 0x3f); if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x10000) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } } else return (EOF); break; case ENCODE_UTF16BE : /* * Read UTF-16 big-endian char... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; ch = (ch << 8) | temp; if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); lch = *(buf->current)++; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; lch = (lch << 8) | temp; if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; case ENCODE_UTF16LE : /* * Read UTF-16 little-endian char... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; ch |= (temp << 8); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); lch = *(buf->current)++; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; lch |= (temp << 8); if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; } #if DEBUG > 1 printf("mxml_fd_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } /* * 'mxml_fd_putc()' - Write a character to a file descriptor. */ static int /* O - 0 on success, -1 on error */ mxml_fd_putc(int ch, /* I - Character */ void *p) /* I - File descriptor buffer */ { _mxml_fdbuf_t *buf; /* File descriptor buffer */ /* * Flush the write buffer as needed... */ buf = (_mxml_fdbuf_t *)p; if (buf->current >= buf->end) if (mxml_fd_write(buf) < 0) return (-1); *(buf->current)++ = ch; /* * Return successfully... */ return (0); } /* * 'mxml_fd_read()' - Read a buffer of data from a file descriptor. */ static int /* O - 0 on success, -1 on error */ mxml_fd_read(_mxml_fdbuf_t *buf) /* I - File descriptor buffer */ { int bytes; /* Bytes read... */ /* * Range check input... */ if (!buf) return (-1); /* * Read from the file descriptor... */ while ((bytes = read(buf->fd, buf->buffer, sizeof(buf->buffer))) < 0) #ifdef EINTR if (errno != EAGAIN && errno != EINTR) #else if (errno != EAGAIN) #endif /* EINTR */ return (-1); if (bytes == 0) return (-1); /* * Update the pointers and return success... */ buf->current = buf->buffer; buf->end = buf->buffer + bytes; return (0); } /* * 'mxml_fd_write()' - Write a buffer of data to a file descriptor. */ static int /* O - 0 on success, -1 on error */ mxml_fd_write(_mxml_fdbuf_t *buf) /* I - File descriptor buffer */ { int bytes; /* Bytes written */ unsigned char *ptr; /* Pointer into buffer */ /* * Range check... */ if (!buf) return (-1); /* * Return 0 if there is nothing to write... */ if (buf->current == buf->buffer) return (0); /* * Loop until we have written everything... */ for (ptr = buf->buffer; ptr < buf->current; ptr += bytes) if ((bytes = write(buf->fd, ptr, buf->current - ptr)) < 0) return (-1); /* * All done, reset pointers and return success... */ buf->current = buf->buffer; return (0); } /* * 'mxml_file_getc()' - Get a character from a file. */ static int /* O - Character or EOF */ mxml_file_getc(void *p, /* I - Pointer to file */ int *encoding) /* IO - Encoding */ { int ch, /* Character from file */ temp; /* Temporary character */ FILE *fp; /* Pointer to file */ /* * Read a character from the file and see if it is EOF or ASCII... */ fp = (FILE *)p; ch = getc(fp); if (ch == EOF) return (EOF); switch (*encoding) { case ENCODE_UTF8 : /* * Got a UTF-8 character; convert UTF-8 to Unicode and return... */ if (!(ch & 0x80)) { if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } #if DEBUG > 1 printf("mxml_file_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else if (ch == 0xfe) { /* * UTF-16 big-endian BOM? */ ch = getc(fp); if (ch != 0xff) return (EOF); *encoding = ENCODE_UTF16BE; return (mxml_file_getc(p, encoding)); } else if (ch == 0xff) { /* * UTF-16 little-endian BOM? */ ch = getc(fp); if (ch != 0xfe) return (EOF); *encoding = ENCODE_UTF16LE; return (mxml_file_getc(p, encoding)); } else if ((ch & 0xe0) == 0xc0) { /* * Two-byte value... */ if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x1f) << 6) | (temp & 0x3f); if (ch < 0x80) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } } else if ((ch & 0xf0) == 0xe0) { /* * Three-byte value... */ if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x0f) << 6) | (temp & 0x3f); if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x800) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } /* * Ignore (strip) Byte Order Mark (BOM)... */ if (ch == 0xfeff) return (mxml_file_getc(p, encoding)); } else if ((ch & 0xf8) == 0xf0) { /* * Four-byte value... */ if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x07) << 6) | (temp & 0x3f); if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x10000) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } } else return (EOF); break; case ENCODE_UTF16BE : /* * Read UTF-16 big-endian char... */ ch = (ch << 8) | getc(fp); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch = (getc(fp) << 8) | getc(fp); if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; case ENCODE_UTF16LE : /* * Read UTF-16 little-endian char... */ ch |= (getc(fp) << 8); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch = getc(fp) | (getc(fp) << 8); if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; } #if DEBUG > 1 printf("mxml_file_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } /* * 'mxml_file_putc()' - Write a character to a file. */ static int /* O - 0 on success, -1 on failure */ mxml_file_putc(int ch, /* I - Character to write */ void *p) /* I - Pointer to file */ { return (putc(ch, (FILE *)p) == EOF ? -1 : 0); } /* * 'mxml_get_entity()' - Get the character corresponding to an entity... */ static int /* O - Character value or EOF on error */ mxml_get_entity(mxml_node_t *parent, /* I - Parent node */ void *p, /* I - Pointer to source */ int *encoding, /* IO - Character encoding */ int (*getc_cb)(void *, int *)) /* I - Get character function */ { int ch; /* Current character */ char entity[64], /* Entity string */ *entptr; /* Pointer into entity */ entptr = entity; while ((ch = (*getc_cb)(p, encoding)) != EOF) if (ch > 126 || (!isalnum(ch) && ch != '#')) break; else if (entptr < (entity + sizeof(entity) - 1)) *entptr++ = ch; else { mxml_error("Entity name too long under parent <%s>!", parent ? parent->value.element.name : "null"); break; } *entptr = '\0'; if (ch != ';') { mxml_error("Character entity \"%s\" not terminated under parent <%s>!", entity, parent ? parent->value.element.name : "null"); return (EOF); } if (entity[0] == '#') { if (entity[1] == 'x') ch = strtol(entity + 2, NULL, 16); else ch = strtol(entity + 1, NULL, 10); } else if ((ch = mxmlEntityGetValue(entity)) < 0) mxml_error("Entity name \"%s;\" not supported under parent <%s>!", entity, parent ? parent->value.element.name : "null"); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x under parent <%s> not allowed by XML standard!", ch, parent ? parent->value.element.name : "null"); return (EOF); } return (ch); } /* * 'mxml_load_data()' - Load data into an XML node tree. */ static mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxml_load_data( mxml_node_t *top, /* I - Top node */ void *p, /* I - Pointer to data */ mxml_load_cb_t cb, /* I - Callback function or MXML_NO_CALLBACK */ _mxml_getc_cb_t getc_cb, /* I - Read function */ mxml_sax_cb_t sax_cb, /* I - SAX callback or MXML_NO_CALLBACK */ void *sax_data) /* I - SAX user data */ { mxml_node_t *node, /* Current node */ *first, /* First node added */ *parent; /* Current parent node */ int ch, /* Character from file */ whitespace; /* Non-zero if whitespace seen */ char *buffer, /* String buffer */ *bufptr; /* Pointer into buffer */ int bufsize; /* Size of buffer */ mxml_type_t type; /* Current node type */ int encoding; /* Character encoding */ _mxml_global_t *global = _mxml_global(); /* Global data */ static const char * const types[] = /* Type strings... */ { "MXML_ELEMENT", /* XML element with attributes */ "MXML_INTEGER", /* Integer value */ "MXML_OPAQUE", /* Opaque string */ "MXML_REAL", /* Real value */ "MXML_TEXT", /* Text fragment */ "MXML_CUSTOM" /* Custom data */ }; /* * Read elements and other nodes from the file... */ if ((buffer = malloc(64)) == NULL) { mxml_error("Unable to allocate string buffer!"); return (NULL); } bufsize = 64; bufptr = buffer; parent = top; first = NULL; whitespace = 0; encoding = ENCODE_UTF8; if (cb && parent) type = (*cb)(parent); else type = MXML_TEXT; while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if ((ch == '<' || (mxml_isspace(ch) && type != MXML_OPAQUE && type != MXML_CUSTOM)) && bufptr > buffer) { /* * Add a new value node... */ *bufptr = '\0'; switch (type) { case MXML_INTEGER : node = mxmlNewInteger(parent, strtol(buffer, &bufptr, 0)); break; case MXML_OPAQUE : node = mxmlNewOpaque(parent, buffer); break; case MXML_REAL : node = mxmlNewReal(parent, strtod(buffer, &bufptr)); break; case MXML_TEXT : node = mxmlNewText(parent, whitespace, buffer); break; case MXML_CUSTOM : if (global->custom_load_cb) { /* * Use the callback to fill in the custom data... */ node = mxmlNewCustom(parent, NULL, NULL); if ((*global->custom_load_cb)(node, buffer)) { mxml_error("Bad custom value '%s' in parent <%s>!", buffer, parent ? parent->value.element.name : "null"); mxmlDelete(node); node = NULL; } break; } default : /* Ignore... */ node = NULL; break; } if (*bufptr) { /* * Bad integer/real number value... */ mxml_error("Bad %s value '%s' in parent <%s>!", type == MXML_INTEGER ? "integer" : "real", buffer, parent ? parent->value.element.name : "null"); break; } bufptr = buffer; whitespace = mxml_isspace(ch) && type == MXML_TEXT; if (!node && type != MXML_IGNORE) { /* * Print error and return... */ mxml_error("Unable to add value node of type %s to parent <%s>!", types[type], parent ? parent->value.element.name : "null"); goto error; } if (sax_cb) { (*sax_cb)(node, MXML_SAX_DATA, sax_data); if (!mxmlRelease(node)) node = NULL; } if (!first && node) first = node; } else if (mxml_isspace(ch) && type == MXML_TEXT) whitespace = 1; /* * Add lone whitespace node if we have an element and existing * whitespace... */ if (ch == '<' && whitespace && type == MXML_TEXT) { if (parent) { node = mxmlNewText(parent, whitespace, ""); if (sax_cb) { (*sax_cb)(node, MXML_SAX_DATA, sax_data); if (!mxmlRelease(node)) node = NULL; } if (!first && node) first = node; } whitespace = 0; } if (ch == '<') { /* * Start of open/close tag... */ bufptr = buffer; while ((ch = (*getc_cb)(p, &encoding)) != EOF) if (mxml_isspace(ch) || ch == '>' || (ch == '/' && bufptr > buffer)) break; else if (ch == '<') { mxml_error("Bare < in element!"); goto error; } else if (ch == '&') { if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; else if (((bufptr - buffer) == 1 && buffer[0] == '?') || ((bufptr - buffer) == 3 && !strncmp(buffer, "!--", 3)) || ((bufptr - buffer) == 8 && !strncmp(buffer, "![CDATA[", 8))) break; *bufptr = '\0'; if (!strcmp(buffer, "!--")) { /* * Gather rest of comment... */ while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if (ch == '>' && bufptr > (buffer + 4) && bufptr[-3] != '-' && bufptr[-2] == '-' && bufptr[-1] == '-') break; else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } /* * Error out if we didn't get the whole comment... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in comment node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; if (!parent && first) { /* * There can only be one root element! */ mxml_error("<%s> cannot be a second root node after <%s>", buffer, first->value.element.name); goto error; } if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* * Just print error for now... */ mxml_error("Unable to add comment node to parent <%s>!", parent ? parent->value.element.name : "null"); break; } if (sax_cb) { (*sax_cb)(node, MXML_SAX_COMMENT, sax_data); if (!mxmlRelease(node)) node = NULL; } if (node && !first) first = node; } else if (!strcmp(buffer, "![CDATA[")) { /* * Gather CDATA section... */ while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if (ch == '>' && !strncmp(bufptr - 2, "]]", 2)) break; else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } /* * Error out if we didn't get the whole comment... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in CDATA node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; if (!parent && first) { /* * There can only be one root element! */ mxml_error("<%s> cannot be a second root node after <%s>", buffer, first->value.element.name); goto error; } if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* * Print error and return... */ mxml_error("Unable to add CDATA node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } if (sax_cb) { (*sax_cb)(node, MXML_SAX_CDATA, sax_data); if (!mxmlRelease(node)) node = NULL; } if (node && !first) first = node; } else if (buffer[0] == '?') { /* * Gather rest of processing instruction... */ while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if (ch == '>' && bufptr > buffer && bufptr[-1] == '?') break; else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } /* * Error out if we didn't get the whole processing instruction... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in processing instruction node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; if (!parent && first) { /* * There can only be one root element! */ mxml_error("<%s> cannot be a second root node after <%s>", buffer, first->value.element.name); goto error; } if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* * Print error and return... */ mxml_error("Unable to add processing instruction node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } if (sax_cb) { (*sax_cb)(node, MXML_SAX_DIRECTIVE, sax_data); if (!mxmlRelease(node)) node = NULL; } if (node) { if (!first) first = node; if (!parent) { parent = node; if (cb) type = (*cb)(parent); } } } else if (buffer[0] == '!') { /* * Gather rest of declaration... */ do { if (ch == '>') break; else { if (ch == '&') if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } } while ((ch = (*getc_cb)(p, &encoding)) != EOF); /* * Error out if we didn't get the whole declaration... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in declaration node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; if (!parent && first) { /* * There can only be one root element! */ mxml_error("<%s> cannot be a second root node after <%s>", buffer, first->value.element.name); goto error; } if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* * Print error and return... */ mxml_error("Unable to add declaration node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } if (sax_cb) { (*sax_cb)(node, MXML_SAX_DIRECTIVE, sax_data); if (!mxmlRelease(node)) node = NULL; } if (node) { if (!first) first = node; if (!parent) { parent = node; if (cb) type = (*cb)(parent); } } } else if (buffer[0] == '/') { /* * Handle close tag... */ if (!parent || strcmp(buffer + 1, parent->value.element.name)) { /* * Close tag doesn't match tree; print an error for now... */ mxml_error("Mismatched close tag <%s> under parent <%s>!", buffer, parent ? parent->value.element.name : "(null)"); goto error; } /* * Keep reading until we see >... */ while (ch != '>' && ch != EOF) ch = (*getc_cb)(p, &encoding); node = parent; parent = parent->parent; if (sax_cb) { (*sax_cb)(node, MXML_SAX_ELEMENT_CLOSE, sax_data); if (!mxmlRelease(node) && first == node) first = NULL; } /* * Ascend into the parent and set the value type as needed... */ if (cb && parent) type = (*cb)(parent); } else { /* * Handle open tag... */ if (!parent && first) { /* * There can only be one root element! */ mxml_error("<%s> cannot be a second root node after <%s>", buffer, first->value.element.name); goto error; } if ((node = mxmlNewElement(parent, buffer)) == NULL) { /* * Just print error for now... */ mxml_error("Unable to add element node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } if (mxml_isspace(ch)) { if ((ch = mxml_parse_element(node, p, &encoding, getc_cb)) == EOF) goto error; } else if (ch == '/') { if ((ch = (*getc_cb)(p, &encoding)) != '>') { mxml_error("Expected > but got '%c' instead for element <%s/>!", ch, buffer); mxmlDelete(node); goto error; } ch = '/'; } if (sax_cb) (*sax_cb)(node, MXML_SAX_ELEMENT_OPEN, sax_data); if (!first) first = node; if (ch == EOF) break; if (ch != '/') { /* * Descend into this node, setting the value type as needed... */ parent = node; if (cb && parent) type = (*cb)(parent); } else if (sax_cb) { (*sax_cb)(node, MXML_SAX_ELEMENT_CLOSE, sax_data); if (!mxmlRelease(node) && first == node) first = NULL; } } bufptr = buffer; } else if (ch == '&') { /* * Add character entity to current buffer... */ if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } else if (type == MXML_OPAQUE || type == MXML_CUSTOM || !mxml_isspace(ch)) { /* * Add character to current buffer... */ if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } } /* * Free the string buffer - we don't need it anymore... */ free(buffer); /* * Find the top element and return it... */ if (parent) { node = parent; while (parent->parent != top && parent->parent) parent = parent->parent; if (node != parent) { mxml_error("Missing close tag under parent <%s>!", node->value.element.name, node->parent ? node->parent->value.element.name : "(null)"); mxmlDelete(first); return (NULL); } } if (parent) return (parent); else return (first); /* * Common error return... */ error: mxmlDelete(first); free(buffer); return (NULL); } /* * 'mxml_parse_element()' - Parse an element for any attributes... */ static int /* O - Terminating character */ mxml_parse_element( mxml_node_t *node, /* I - Element node */ void *p, /* I - Data to read from */ int *encoding, /* IO - Encoding */ _mxml_getc_cb_t getc_cb) /* I - Data callback */ { int ch, /* Current character in file */ quote; /* Quoting character */ char *name, /* Attribute name */ *value, /* Attribute value */ *ptr; /* Pointer into name/value */ int namesize, /* Size of name string */ valsize; /* Size of value string */ /* * Initialize the name and value buffers... */ if ((name = malloc(64)) == NULL) { mxml_error("Unable to allocate memory for name!"); return (EOF); } namesize = 64; if ((value = malloc(64)) == NULL) { free(name); mxml_error("Unable to allocate memory for value!"); return (EOF); } valsize = 64; /* * Loop until we hit a >, /, ?, or EOF... */ while ((ch = (*getc_cb)(p, encoding)) != EOF) { #if DEBUG > 1 fprintf(stderr, "parse_element: ch='%c'\n", ch); #endif /* DEBUG > 1 */ /* * Skip leading whitespace... */ if (mxml_isspace(ch)) continue; /* * Stop at /, ?, or >... */ if (ch == '/' || ch == '?') { /* * Grab the > character and print an error if it isn't there... */ quote = (*getc_cb)(p, encoding); if (quote != '>') { mxml_error("Expected '>' after '%c' for element %s, but got '%c'!", ch, node->value.element.name, quote); goto error; } break; } else if (ch == '<') { mxml_error("Bare < in element %s!", node->value.element.name); goto error; } else if (ch == '>') break; /* * Read the attribute name... */ name[0] = ch; ptr = name + 1; if (ch == '\"' || ch == '\'') { /* * Name is in quotes, so get a quoted string... */ quote = ch; while ((ch = (*getc_cb)(p, encoding)) != EOF) { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &name, &namesize)) goto error; if (ch == quote) break; } } else { /* * Grab an normal, non-quoted name... */ while ((ch = (*getc_cb)(p, encoding)) != EOF) if (mxml_isspace(ch) || ch == '=' || ch == '/' || ch == '>' || ch == '?') break; else { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &name, &namesize)) goto error; } } *ptr = '\0'; if (mxmlElementGetAttr(node, name)) goto error; while (ch != EOF && mxml_isspace(ch)) ch = (*getc_cb)(p, encoding); if (ch == '=') { /* * Read the attribute value... */ while ((ch = (*getc_cb)(p, encoding)) != EOF && mxml_isspace(ch)); if (ch == EOF) { mxml_error("Missing value for attribute '%s' in element %s!", name, node->value.element.name); goto error; } if (ch == '\'' || ch == '\"') { /* * Read quoted value... */ quote = ch; ptr = value; while ((ch = (*getc_cb)(p, encoding)) != EOF) if (ch == quote) break; else { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &value, &valsize)) goto error; } *ptr = '\0'; } else { /* * Read unquoted value... */ value[0] = ch; ptr = value + 1; while ((ch = (*getc_cb)(p, encoding)) != EOF) if (mxml_isspace(ch) || ch == '=' || ch == '/' || ch == '>') break; else { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &value, &valsize)) goto error; } *ptr = '\0'; } /* * Set the attribute with the given string value... */ mxmlElementSetAttr(node, name, value); } else { mxml_error("Missing value for attribute '%s' in element %s!", name, node->value.element.name); goto error; } /* * Check the end character... */ if (ch == '/' || ch == '?') { /* * Grab the > character and print an error if it isn't there... */ quote = (*getc_cb)(p, encoding); if (quote != '>') { mxml_error("Expected '>' after '%c' for element %s, but got '%c'!", ch, node->value.element.name, quote); ch = EOF; } break; } else if (ch == '>') break; } /* * Free the name and value buffers and return... */ free(name); free(value); return (ch); /* * Common error return point... */ error: free(name); free(value); return (EOF); } /* * 'mxml_string_getc()' - Get a character from a string. */ static int /* O - Character or EOF */ mxml_string_getc(void *p, /* I - Pointer to file */ int *encoding) /* IO - Encoding */ { int ch; /* Character */ const char **s; /* Pointer to string pointer */ s = (const char **)p; if ((ch = (*s)[0] & 255) != 0 || *encoding == ENCODE_UTF16LE) { /* * Got character; convert UTF-8 to integer and return... */ (*s)++; switch (*encoding) { case ENCODE_UTF8 : if (!(ch & 0x80)) { #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } return (ch); } else if (ch == 0xfe) { /* * UTF-16 big-endian BOM? */ if (((*s)[0] & 255) != 0xff) return (EOF); *encoding = ENCODE_UTF16BE; (*s)++; return (mxml_string_getc(p, encoding)); } else if (ch == 0xff) { /* * UTF-16 little-endian BOM? */ if (((*s)[0] & 255) != 0xfe) return (EOF); *encoding = ENCODE_UTF16LE; (*s)++; return (mxml_string_getc(p, encoding)); } else if ((ch & 0xe0) == 0xc0) { /* * Two-byte value... */ if (((*s)[0] & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x1f) << 6) | ((*s)[0] & 0x3f); (*s)++; if (ch < 0x80) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else if ((ch & 0xf0) == 0xe0) { /* * Three-byte value... */ if (((*s)[0] & 0xc0) != 0x80 || ((*s)[1] & 0xc0) != 0x80) return (EOF); ch = ((((ch & 0x0f) << 6) | ((*s)[0] & 0x3f)) << 6) | ((*s)[1] & 0x3f); (*s) += 2; if (ch < 0x800) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } /* * Ignore (strip) Byte Order Mark (BOM)... */ if (ch == 0xfeff) return (mxml_string_getc(p, encoding)); #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else if ((ch & 0xf8) == 0xf0) { /* * Four-byte value... */ if (((*s)[0] & 0xc0) != 0x80 || ((*s)[1] & 0xc0) != 0x80 || ((*s)[2] & 0xc0) != 0x80) return (EOF); ch = ((((((ch & 0x07) << 6) | ((*s)[0] & 0x3f)) << 6) | ((*s)[1] & 0x3f)) << 6) | ((*s)[2] & 0x3f); (*s) += 3; if (ch < 0x10000) { mxml_error("Invalid UTF-8 sequence for character 0x%04x!", ch); return (EOF); } #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else return (EOF); case ENCODE_UTF16BE : /* * Read UTF-16 big-endian char... */ ch = (ch << 8) | ((*s)[0] & 255); (*s) ++; if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; /* Lower word */ if (!(*s)[0]) return (EOF); lch = (((*s)[0] & 255) << 8) | ((*s)[1] & 255); (*s) += 2; if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); case ENCODE_UTF16LE : /* * Read UTF-16 little-endian char... */ ch = ch | (((*s)[0] & 255) << 8); if (!ch) { (*s) --; return (EOF); } (*s) ++; if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; /* Lower word */ if (!(*s)[1]) return (EOF); lch = (((*s)[1] & 255) << 8) | ((*s)[0] & 255); (*s) += 2; if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } } return (EOF); } /* * 'mxml_string_putc()' - Write a character to a string. */ static int /* O - 0 on success, -1 on failure */ mxml_string_putc(int ch, /* I - Character to write */ void *p) /* I - Pointer to string pointers */ { char **pp; /* Pointer to string pointers */ pp = (char **)p; if (pp[0] < pp[1]) pp[0][0] = ch; pp[0] ++; return (0); } /* * 'mxml_write_name()' - Write a name string. */ static int /* O - 0 on success, -1 on failure */ mxml_write_name(const char *s, /* I - Name to write */ void *p, /* I - Write pointer */ int (*putc_cb)(int, void *)) /* I - Write callback */ { char quote; /* Quote character */ const char *name; /* Entity name */ if (*s == '\"' || *s == '\'') { /* * Write a quoted name string... */ if ((*putc_cb)(*s, p) < 0) return (-1); quote = *s++; while (*s && *s != quote) { if ((name = mxmlEntityGetName(*s)) != NULL) { if ((*putc_cb)('&', p) < 0) return (-1); while (*name) { if ((*putc_cb)(*name, p) < 0) return (-1); name ++; } if ((*putc_cb)(';', p) < 0) return (-1); } else if ((*putc_cb)(*s, p) < 0) return (-1); s ++; } /* * Write the end quote... */ if ((*putc_cb)(quote, p) < 0) return (-1); } else { /* * Write a non-quoted name string... */ while (*s) { if ((*putc_cb)(*s, p) < 0) return (-1); s ++; } } return (0); } /* * 'mxml_write_node()' - Save an XML node to a file. */ static int /* O - Column or -1 on error */ mxml_write_node(mxml_node_t *node, /* I - Node to write */ void *p, /* I - File to write to */ mxml_save_cb_t cb, /* I - Whitespace callback */ int col, /* I - Current column */ _mxml_putc_cb_t putc_cb,/* I - Output callback */ _mxml_global_t *global)/* I - Global data */ { int i, /* Looping var */ width; /* Width of attr + value */ mxml_attr_t *attr; /* Current attribute */ char s[255]; /* Temporary string */ /* * Print the node value... */ switch (node->type) { case MXML_ELEMENT : col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_OPEN, col, putc_cb); if ((*putc_cb)('<', p) < 0) return (-1); if (node->value.element.name[0] == '?' || !strncmp(node->value.element.name, "!--", 3) || !strncmp(node->value.element.name, "![CDATA[", 8)) { /* * Comments, CDATA, and processing instructions do not * use character entities. */ const char *ptr; /* Pointer into name */ for (ptr = node->value.element.name; *ptr; ptr ++) if ((*putc_cb)(*ptr, p) < 0) return (-1); } else if (mxml_write_name(node->value.element.name, p, putc_cb) < 0) return (-1); col += strlen(node->value.element.name) + 1; for (i = node->value.element.num_attrs, attr = node->value.element.attrs; i > 0; i --, attr ++) { width = strlen(attr->name); if (attr->value) width += strlen(attr->value) + 3; if (global->wrap > 0 && (col + width) > global->wrap) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else { if ((*putc_cb)(' ', p) < 0) return (-1); col ++; } if (mxml_write_name(attr->name, p, putc_cb) < 0) return (-1); if (attr->value) { if ((*putc_cb)('=', p) < 0) return (-1); if ((*putc_cb)('\"', p) < 0) return (-1); if (mxml_write_string(attr->value, p, putc_cb) < 0) return (-1); if ((*putc_cb)('\"', p) < 0) return (-1); } col += width; } if (node->child) { /* * Write children... */ mxml_node_t *child; /* Current child */ if ((*putc_cb)('>', p) < 0) return (-1); else col ++; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); for (child = node->child; child; child = child->next) { if ((col = mxml_write_node(child, p, cb, col, putc_cb, global)) < 0) return (-1); } /* * The ? and ! elements are special-cases and have no end tags... */ if (node->value.element.name[0] != '!' && node->value.element.name[0] != '?') { col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_CLOSE, col, putc_cb); if ((*putc_cb)('<', p) < 0) return (-1); if ((*putc_cb)('/', p) < 0) return (-1); if (mxml_write_string(node->value.element.name, p, putc_cb) < 0) return (-1); if ((*putc_cb)('>', p) < 0) return (-1); col += strlen(node->value.element.name) + 3; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_CLOSE, col, putc_cb); } } else if (node->value.element.name[0] == '!' || node->value.element.name[0] == '?') { /* * The ? and ! elements are special-cases... */ if ((*putc_cb)('>', p) < 0) return (-1); else col ++; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); } else { if ((*putc_cb)(' ', p) < 0) return (-1); if ((*putc_cb)('/', p) < 0) return (-1); if ((*putc_cb)('>', p) < 0) return (-1); col += 3; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); } break; case MXML_INTEGER : if (node->prev) { if (global->wrap > 0 && col > global->wrap) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else if ((*putc_cb)(' ', p) < 0) return (-1); else col ++; } sprintf(s, "%d", node->value.integer); if (mxml_write_string(s, p, putc_cb) < 0) return (-1); col += strlen(s); break; case MXML_OPAQUE : if (mxml_write_string(node->value.opaque, p, putc_cb) < 0) return (-1); col += strlen(node->value.opaque); break; case MXML_REAL : if (node->prev) { if (global->wrap > 0 && col > global->wrap) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else if ((*putc_cb)(' ', p) < 0) return (-1); else col ++; } sprintf(s, "%f", node->value.real); if (mxml_write_string(s, p, putc_cb) < 0) return (-1); col += strlen(s); break; case MXML_TEXT : if (node->value.text.whitespace && col > 0) { if (global->wrap > 0 && col > global->wrap) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else if ((*putc_cb)(' ', p) < 0) return (-1); else col ++; } if (mxml_write_string(node->value.text.string, p, putc_cb) < 0) return (-1); col += strlen(node->value.text.string); break; case MXML_CUSTOM : if (global->custom_save_cb) { char *data; /* Custom data string */ const char *newline; /* Last newline in string */ if ((data = (*global->custom_save_cb)(node)) == NULL) return (-1); if (mxml_write_string(data, p, putc_cb) < 0) return (-1); if ((newline = strrchr(data, '\n')) == NULL) col += strlen(data); else col = strlen(newline); free(data); break; } default : /* Should never happen */ return (-1); } return (col); } /* * 'mxml_write_string()' - Write a string, escaping & and < as needed. */ static int /* O - 0 on success, -1 on failure */ mxml_write_string( const char *s, /* I - String to write */ void *p, /* I - Write pointer */ _mxml_putc_cb_t putc_cb) /* I - Write callback */ { const char *name; /* Entity name, if any */ while (*s) { if ((name = mxmlEntityGetName(*s)) != NULL) { if ((*putc_cb)('&', p) < 0) return (-1); while (*name) { if ((*putc_cb)(*name, p) < 0) return (-1); name ++; } if ((*putc_cb)(';', p) < 0) return (-1); } else if ((*putc_cb)(*s, p) < 0) return (-1); s ++; } return (0); } /* * 'mxml_write_ws()' - Do whitespace callback... */ static int /* O - New column */ mxml_write_ws(mxml_node_t *node, /* I - Current node */ void *p, /* I - Write pointer */ mxml_save_cb_t cb, /* I - Callback function */ int ws, /* I - Where value */ int col, /* I - Current column */ _mxml_putc_cb_t putc_cb) /* I - Write callback */ { const char *s; /* Whitespace string */ if (cb && (s = (*cb)(node, ws)) != NULL) { while (*s) { if ((*putc_cb)(*s, p) < 0) return (-1); else if (*s == '\n') col = 0; else if (*s == '\t') { col += MXML_TAB; col = col - (col % MXML_TAB); } else col ++; s ++; } } return (col); } /* * End of "$Id: mxml-file.c 438 2011-03-24 05:47:51Z mike $". */ cmtk-3.0.0/Utilities/mxml/COPYING0000644000177700000170000006311011747570117015505 0ustar torstenman Mini-XML License September 18, 2010 The Mini-XML library and included programs are provided under the terms of the GNU Library General Public License version 2 (LGPL2) with the following exceptions: 1. Static linking of applications to the Mini-XML library does not constitute a derivative work and does not require the author to provide source code for the application, use the shared Mini-XML libraries, or link their applications against a user-supplied version of Mini-XML. If you link the application to a modified version of Mini-XML, then the changes to Mini-XML must be provided under the terms of the LGPL2 in sections 1, 2, and 4. 2. You do not have to provide a copy of the Mini-XML license with programs that are linked to the Mini-XML library, nor do you have to identify the Mini-XML license in your program or documentation as required by section 6 of the LGPL2. GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! cmtk-3.0.0/Utilities/mxml/CHANGES0000644000177700000170000003100211747570117015440 0ustar torstenmanCHANGES - 2011-12-20 -------------------- CHANGES IN Mini-XML 2.7 - Added 64-bit configurations to the VC++ project files (STR #129) - Fixed conformance of mxmldoc's HTML and CSS output. - Added data accessor ("get") functions and made the mxml_node_t and mxml_index_t structures private but still available in the Mini-XML header to preserve source compatibility (STR #118) - Updated the source headers to reference the Mini-XML license and its exceptions to the LGPL2 (STR #108) - Fixed a memory leak when loading a badly-formed XML file (STR #121) - Added a new mxmlFindPath() function to find the value node of a named element (STR #110) - Building a static version of the library did not work on Windows (STR #112) - The shared library did not include a destructor for the thread- specific data key on UNIX-based operating systems (STR #103) - mxmlLoad* did not error out on XML with multiple root nodes (STR #101) - Fixed an issue with the _mxml_vstrdupf function (STR #107) - mxmlSave* no longer write all siblings of the passed node, just that node and its children (STR #109) CHANGES IN Mini-XML 2.6 - Documentation fixes (STR #91, STR #92) - The mxmldoc program did not handle typedef comments properly (STR #72) - Added support for "long long" printf formats. - The XML parser now ignores BOMs in UTF-8 XML files (STR #89) - The mxmldoc program now supports generating Xcode documentation sets. - mxmlSave*() did not output UTF-8 correctly on some platforms. - mxmlNewXML() now adds encoding="utf-8" in the ?xml directive to avoid problems with non-conformant XML parsers that assume something other than UTF-8 as the default encoding. - Wrapping was not disabled when mxmlSetWrapMargin(0) was called, and "" was always followed by a newline (STR #76) - The mxml.pc.in file was broken (STR #79) - The mxmldoc program now handles "typedef enum name {} name" correctly (STR #72) CHANGES IN Mini-XML 2.5 - The mxmldoc program now makes greater use of CSS and supports a --css option to embed an alternate stylesheet. - The mxmldoc program now supports --header and --footer options to insert documentation content before and after the generated content. - The mxmldoc program now supports a --framed option to generate framed HTML output. - The mxmldoc program now creates a table of contents including any headings in the --intro file when generating HTML output. - The man pages and man page output from mxmldoc did not use "\-" for dashes (STR #68) - The debug version of the Mini-XML DLL could not be built (STR #65) - Processing instructions and directives did not work when not at the top level of a document (STR #67) - Spaces around the "=" in attributes were not supported (STR #67) CHANGES IN Mini-XML 2.4 - Fixed shared library build problems on HP-UX and Mac OS X. - The mxmldoc program did not output argument descriptions for functions properly. - All global settings (custom, error, and entity callbacks and the wrap margin) are now managed separately for each thread. - Added mxmlElementDeleteAttr() function (STR #59) - mxmlElementSetAttrf() did not work (STR #57) - mxmlLoad*() incorrectly treated declarations as parent elements (STR #56) - mxmlLoad*() incorrectly allowed attributes without values (STR #47) - Fixed Visual C++ build problems (STR #49) - mxmlLoad*() did not return NULL when an element contained an error (STR #46) - Added support for the apos character entity (STR #54) - Fixed whitespace detection with Unicode characters (STR #48) - mxmlWalkNext() and mxmlWalkPrev() did not work correctly when called with a node with no children as the top node (STR #53) CHANGES IN Mini-XML 2.3 - Added two exceptions to the LGPL to support static linking of applications against Mini-XML - The mxmldoc utility can now generate man pages, too. - Added a mxmlNewXML() function - Added a mxmlElementSetAttrf() function (STR #43) - Added snprintf() emulation function for test program (STR #32) - Added the _CRT_SECURE_NO_DEPRECATE definition when building on VC++ 2005 (STR #36) - mxmlLoad*() did not detect missing > characters in elements (STR #41) - mxmlLoad*() did not detect missing close tags at the end of an XML document (STR #45) - Added user_data and ref_count members to mxml_node_t structure - Added mxmlReleaseNode() and mxmlRetainNode() APIs for reference-counted nodes - Added mxmlSetWrapMargin() to control the wrapping of XML output - Added conditional check for EINTR error code for certain Windows compilers that do not define it (STR #33) - The mxmldoc program now generates correct HTML 4.0 output - previously it generated invalid XHTML - The mxmldoc program now supports "@deprecated@, "@private@", and "@since version@" comments - Fixed function and enumeration type bugs in mxmldoc. - Fixed the XML schema for mxmldoc - The mxmldoc program now supports --intro, --section, and --title options - The mxmlLoad*() functions could leak a node on an error (STR #27) - The mxml_vsnprintf() function could get in an infinite loop on a buffer overflow (STR #25) - Added new mxmlNewCDATA() and mxmlSetCDATA() functions to create and set CDATA nodes, which are really just special element nodes - Added new MXML_IGNORE type and MXML_IGNORE_CB callback to ignore non-element nodes, e.g. whitespace - mxmlLoad*() crashed when reporting an error in some invalid XML (STR #23) CHANGES IN Mini-XML 2.2.2 - mxmlLoad*() did not treat custom data as opaque, so whitespace characters would be lost. CHANGES IN Mini-XML 2.2.1 - mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now correctly return NULL on error (STR #21) - mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), and mxmlNewTextf() incorrectly required a parent node (STR #22) - Fixed an XML output bug in mxmldoc. - The "make install" target now uses the install command to set the proper permissions on UNIX/Linux/OSX. - Fixed a MingW/Cygwin compilation problem (STR #18) CHANGES IN Mini-XML 2.2 - Added shared library support (STR #17) - mxmlLoad*() now returns an error when an XML stream contains illegal control characters (STR #10) - mxmlLoad*() now returns an error when an element contains two attributes with the same name in conformance with the XML spec (STR #16) - Added support for CDATA (STR #14, STR #15) - Updated comment and processing instruction handling - no entity support per XML specification. - Added checking for invalid comment termination ("--->" is not allowed) CHANGES IN Mini-XML 2.1 - Added support for custom data nodes (STR #6) - Now treat UTF-8 sequences which are longer than necessary as an error (STR #4) - Fixed entity number support (STR #8) - Fixed mxmlLoadString() bug with UTF-8 (STR #7) - Fixed entity lookup bug (STR #5) - Added mxmlLoadFd() and mxmlSaveFd() functions. - Fixed multi-word UTF-16 handling. CHANGES IN Mini-XML 2.0 - New programmers manual. - Added Visual C++ project files for Microsoft Windows users. - Added optimizations to mxmldoc, mxmlSaveFile(), and mxmlIndexNew() (STR #2) - mxmlEntityAddCallback() now returns an integer status (STR #2) - Added UTF-16 support (input only; all output is UTF-8) - Added index functions to build a searchable index of XML nodes. - Added character entity callback interface to support additional character entities beyond those defined in the XHTML specification. - Added support for XHTML character entities. - The mxmldoc utility now produces XML output which conforms to an updated XML schema, described in the file "doc/mxmldoc.xsd". - Changed the whitespace callback interface to return strings instead of a single character, allowing for greater control over the formatting of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS. - The mxmldoc utility is now capable of documenting C++ classes, functions, and structures, and correctly handles C++ comments. - Added new modular tests for mxmldoc. - Updated the mxmldoc output to be more compatible with embedding in manuals produced with HTMLDOC. - The makefile incorrectly included a "/" separator between the destination path and install path. This caused problems when building and installing with MingW. CHANGES IN Mini-XML 1.3 - Fixes for mxmldoc. - Added support for reading standard HTML entity names. - mxmlLoadString/File() did not decode character entities in element names, attribute names, or attribute values. - mxmlLoadString/File() would crash when loading non- conformant XML data under an existing parent (top) node. - Fixed several bugs in the mxmldoc utility. - Added new error callback function to catch a variety of errors and log them to someplace other than stderr. - The mxmlElementSetAttr() function now allows for NULL attribute values. - The load and save functions now properly handle quoted element and attribute name strings properly, e.g. for !DOCTYPE declarations. CHANGES IN Mini-XML 1.2 - Added new "set" methods to set the value of a node. - Added new formatted text methods mxmlNewTextf() and mxmlSetTextf() to create/set a text node value using printf-style formats. - Added new standard callbacks for use with the mxmlLoad functions. - Updated the HTML documentation to include examples of the walk and load function output. - Added --with/without-ansi configure option to control the strdup() function check. - Added --with/without-snprintf configure option to control the snprintf() and vsnprintf() function checks. CHANGES IN Mini-XML 1.1.2 - The mxml(3) man page wasn't updated for the string functions. - mxmlSaveString() returned the wrong number of characters. - mxml_add_char() updated the buffer pointer in the wrong place. CHANGES IN Mini-XML 1.1.1 - The private mxml_add_ch() function did not update the start-of-buffer pointer which could cause a crash when using mxmlSaveString(). - The private mxml_write_ws() function called putc() instead of using the proper callback which could cause a crash when using mxmlSaveString(). - Added a mxmlSaveAllocString() convenience function for saving an XML node tree to an allocated string. CHANGES IN Mini-XML 1.1 - The mxmlLoadFile() function now uses dynamically allocated string buffers for element names, attribute names, and attribute values. Previously they were capped at 16383, 255, and 255 bytes, respectively. - Added a new mxmlLoadString() function for loading an XML node tree from a string. - Added a new mxmlSaveString() function for saving an XML node tree to a string. - Add emulation of strdup() if the local platform does not provide the function. CHANGES IN Mini-XML 1.0 - The mxmldoc program now handles function arguments, structures, unions, enumerations, classes, and typedefs properly. - Documentation provided via mxmldoc and more in-line comments in the code. - Added man pages and packaging files. CHANGES IN Mini-XML 0.93 - New mxmldoc example program that is also used to create and update code documentation using XML and produce HTML reference pages. - Added mxmlAdd() and mxmlRemove() functions to add and remove nodes from a tree. This provides more flexibility over where the nodes are inserted and allows nodes to be moved within the tree as needed. - mxmlLoadFile() now correctly handles comments. - mxmlLoadFile() now supports the required "gt", "quot", and "nbsp" character entities. - mxmlSaveFile() now uses newlines as whitespace when valid to do so. - mxmlFindElement() now also takes attribute name and attribute value string arguments to limit the search to specific elements with attributes and/or values. NULL pointers can be used as "wildcards". - Added uninstall target to makefile, and auto-reconfig if Makefile.in or configure.in are changed. - mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev() now all provide "descend" arguments to control whether they descend into child nodes in the tree. - Fixed some whitespace issues in mxmlLoadFile(). - Fixed Unicode output and whitespace issues in mxmlSaveFile(). - mxmlSaveFile() now supports a whitespace callback to provide more human-readable XML output under program control. CHANGES IN Mini-XML 0.92 - mxmlSaveFile() didn't return a value on success. CHANGES IN Mini-XML 0.91 - mxmlWalkNext() would go into an infinite loop. CHANGES IN Mini-XML 0.9 - Initial public release. cmtk-3.0.0/Utilities/mxml/mxml-attr.c0000644000177700000170000001600011747570117016537 0ustar torstenman/* * "$Id: mxml-attr.c 408 2010-09-19 05:26:46Z mike $" * * Attribute support code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxmlElementDeleteAttr() - Delete an attribute. * mxmlElementGetAttr() - Get an attribute. * mxmlElementSetAttr() - Set an attribute. * mxmlElementSetAttrf() - Set an attribute with a formatted value. * mxml_set_attr() - Set or add an attribute name/value pair. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Local functions... */ static int mxml_set_attr(mxml_node_t *node, const char *name, char *value); /* * 'mxmlElementDeleteAttr()' - Delete an attribute. * * @since Mini-XML 2.4@ */ void mxmlElementDeleteAttr(mxml_node_t *node,/* I - Element */ const char *name)/* I - Attribute name */ { int i; /* Looping var */ mxml_attr_t *attr; /* Cirrent attribute */ #ifdef DEBUG fprintf(stderr, "mxmlElementDeleteAttr(node=%p, name=\"%s\")\n", node, name ? name : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name) return; /* * Look for the attribute... */ for (i = node->value.element.num_attrs, attr = node->value.element.attrs; i > 0; i --, attr ++) { #ifdef DEBUG printf(" %s=\"%s\"\n", attr->name, attr->value); #endif /* DEBUG */ if (!strcmp(attr->name, name)) { /* * Delete this attribute... */ free(attr->name); free(attr->value); i --; if (i > 0) memmove(attr, attr + 1, i * sizeof(mxml_attr_t)); node->value.element.num_attrs --; return; } } } /* * 'mxmlElementGetAttr()' - Get an attribute. * * This function returns NULL if the node is not an element or the * named attribute does not exist. */ const char * /* O - Attribute value or NULL */ mxmlElementGetAttr(mxml_node_t *node, /* I - Element node */ const char *name) /* I - Name of attribute */ { int i; /* Looping var */ mxml_attr_t *attr; /* Cirrent attribute */ #ifdef DEBUG fprintf(stderr, "mxmlElementGetAttr(node=%p, name=\"%s\")\n", node, name ? name : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name) return (NULL); /* * Look for the attribute... */ for (i = node->value.element.num_attrs, attr = node->value.element.attrs; i > 0; i --, attr ++) { #ifdef DEBUG printf(" %s=\"%s\"\n", attr->name, attr->value); #endif /* DEBUG */ if (!strcmp(attr->name, name)) { #ifdef DEBUG printf(" Returning \"%s\"!\n", attr->value); #endif /* DEBUG */ return (attr->value); } } /* * Didn't find attribute, so return NULL... */ #ifdef DEBUG puts(" Returning NULL!\n"); #endif /* DEBUG */ return (NULL); } /* * 'mxmlElementSetAttr()' - Set an attribute. * * If the named attribute already exists, the value of the attribute * is replaced by the new string value. The string value is copied * into the element node. This function does nothing if the node is * not an element. */ void mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */ const char *name, /* I - Name of attribute */ const char *value) /* I - Attribute value */ { char *valuec; /* Copy of value */ #ifdef DEBUG fprintf(stderr, "mxmlElementSetAttr(node=%p, name=\"%s\", value=\"%s\")\n", node, name ? name : "(null)", value ? value : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name) return; if (value) valuec = strdup(value); else valuec = NULL; if (mxml_set_attr(node, name, valuec)) free(valuec); } /* * 'mxmlElementSetAttrf()' - Set an attribute with a formatted value. * * If the named attribute already exists, the value of the attribute * is replaced by the new formatted string. The formatted string value is * copied into the element node. This function does nothing if the node * is not an element. * * @since Mini-XML 2.3@ */ void mxmlElementSetAttrf(mxml_node_t *node, /* I - Element node */ const char *name, /* I - Name of attribute */ const char *format,/* I - Printf-style attribute value */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Argument pointer */ char *value; /* Value */ #ifdef DEBUG fprintf(stderr, "mxmlElementSetAttrf(node=%p, name=\"%s\", format=\"%s\", ...)\n", node, name ? name : "(null)", format ? format : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name || !format) return; /* * Format the value... */ va_start(ap, format); value = _mxml_vstrdupf(format, ap); va_end(ap); if (!value) mxml_error("Unable to allocate memory for attribute '%s' in element %s!", name, node->value.element.name); else if (mxml_set_attr(node, name, value)) free(value); } /* * 'mxml_set_attr()' - Set or add an attribute name/value pair. */ static int /* O - 0 on success, -1 on failure */ mxml_set_attr(mxml_node_t *node, /* I - Element node */ const char *name, /* I - Attribute name */ char *value) /* I - Attribute value */ { int i; /* Looping var */ mxml_attr_t *attr; /* New attribute */ /* * Look for the attribute... */ for (i = node->value.element.num_attrs, attr = node->value.element.attrs; i > 0; i --, attr ++) if (!strcmp(attr->name, name)) { /* * Free the old value as needed... */ if (attr->value) free(attr->value); attr->value = value; return (0); } /* * Add a new attribute... */ if (node->value.element.num_attrs == 0) attr = malloc(sizeof(mxml_attr_t)); else attr = realloc(node->value.element.attrs, (node->value.element.num_attrs + 1) * sizeof(mxml_attr_t)); if (!attr) { mxml_error("Unable to allocate memory for attribute '%s' in element %s!", name, node->value.element.name); return (-1); } node->value.element.attrs = attr; attr += node->value.element.num_attrs; if ((attr->name = strdup(name)) == NULL) { mxml_error("Unable to allocate memory for attribute '%s' in element %s!", name, node->value.element.name); return (-1); } attr->value = value; node->value.element.num_attrs ++; return (0); } /* * End of "$Id: mxml-attr.c 408 2010-09-19 05:26:46Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml-private.c0000644000177700000170000001561411747570117017251 0ustar torstenman/* * "$Id: mxml-private.c 422 2010-11-07 22:55:11Z mike $" * * Private functions for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxml_error() - Display an error message. * mxml_integer_cb() - Default callback for integer values. * mxml_opaque_cb() - Default callback for opaque values. * mxml_real_cb() - Default callback for real number values. * _mxml_global() - Get global data. */ /* * Include necessary headers... */ #include "mxml-private.h" /* * Some crazy people think that unloading a shared object is a good or safe * thing to do. Unfortunately, most objects are simply *not* safe to unload * and bad things *will* happen. * * The following mess of conditional code allows us to provide a destructor * function in Mini-XML for our thread-global storage so that it can possibly * be unloaded safely, although since there is no standard way to do so I * can't even provide any guarantees that you can do it safely on all platforms. * * This code currently supports AIX, HP-UX, Linux, Mac OS X, Solaris, and * Windows. It might work on the BSDs and IRIX, but I haven't tested that. */ #if defined(__sun) || defined(_AIX) # pragma fini(_mxml_fini) # define _MXML_FINI _mxml_fini #elif defined(__hpux) # pragma FINI _mxml_fini # define _MXML_FINI _mxml_fini #elif defined(__GNUC__) /* Linux and Mac OS X */ # define _MXML_FINI __attribute((destructor)) _mxml_fini #else # define _MXML_FINI _fini #endif /* __sun */ /* * 'mxml_error()' - Display an error message. */ void mxml_error(const char *format, /* I - Printf-style format string */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Pointer to arguments */ char s[1024]; /* Message string */ _mxml_global_t *global = _mxml_global(); /* Global data */ /* * Range check input... */ if (!format) return; /* * Format the error message string... */ va_start(ap, format); vsnprintf(s, sizeof(s), format, ap); va_end(ap); /* * And then display the error message... */ if (global->error_cb) (*global->error_cb)(s); else fprintf(stderr, "mxml: %s\n", s); } /* * 'mxml_ignore_cb()' - Default callback for ignored values. */ mxml_type_t /* O - Node type */ mxml_ignore_cb(mxml_node_t *node) /* I - Current node */ { (void)node; return (MXML_IGNORE); } /* * 'mxml_integer_cb()' - Default callback for integer values. */ mxml_type_t /* O - Node type */ mxml_integer_cb(mxml_node_t *node) /* I - Current node */ { (void)node; return (MXML_INTEGER); } /* * 'mxml_opaque_cb()' - Default callback for opaque values. */ mxml_type_t /* O - Node type */ mxml_opaque_cb(mxml_node_t *node) /* I - Current node */ { (void)node; return (MXML_OPAQUE); } /* * 'mxml_real_cb()' - Default callback for real number values. */ mxml_type_t /* O - Node type */ mxml_real_cb(mxml_node_t *node) /* I - Current node */ { (void)node; return (MXML_REAL); } #ifdef HAVE_PTHREAD_H /**** POSIX threading ****/ # include static pthread_key_t _mxml_key = -1; /* Thread local storage key */ static pthread_once_t _mxml_key_once = PTHREAD_ONCE_INIT; /* One-time initialization object */ static void _mxml_init(void); static void _mxml_destructor(void *g); /* * '_mxml_destructor()' - Free memory used for globals... */ static void _mxml_destructor(void *g) /* I - Global data */ { free(g); } /* * '_mxml_fini()' - Clean up when unloaded. */ static void _MXML_FINI(void) { _mxml_global_t *global; /* Global data */ if (_mxml_key != -1) { if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) != NULL) _mxml_destructor(global); pthread_key_delete(_mxml_key); _mxml_key = -1; } } /* * '_mxml_global()' - Get global data. */ _mxml_global_t * /* O - Global data */ _mxml_global(void) { _mxml_global_t *global; /* Global data */ pthread_once(&_mxml_key_once, _mxml_init); if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) == NULL) { global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t)); pthread_setspecific(_mxml_key, global); global->num_entity_cbs = 1; global->entity_cbs[0] = _mxml_entity_cb; global->wrap = 72; } return (global); } /* * '_mxml_init()' - Initialize global data... */ static void _mxml_init(void) { pthread_key_create(&_mxml_key, _mxml_destructor); } #elif defined(WIN32) && defined(MXML1_EXPORTS) /**** WIN32 threading ****/ # include static DWORD _mxml_tls_index; /* Index for global storage */ /* * 'DllMain()' - Main entry for library. */ BOOL WINAPI /* O - Success/failure */ DllMain(HINSTANCE hinst, /* I - DLL module handle */ DWORD reason, /* I - Reason */ LPVOID reserved) /* I - Unused */ { _mxml_global_t *global; /* Global data */ (void)hinst; (void)reserved; switch (reason) { case DLL_PROCESS_ATTACH : /* Called on library initialization */ if ((_mxml_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) return (FALSE); break; case DLL_THREAD_DETACH : /* Called when a thread terminates */ if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) != NULL) free(global); break; case DLL_PROCESS_DETACH : /* Called when library is unloaded */ if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) != NULL) free(global); TlsFree(_mxml_tls_index); break; default: break; } return (TRUE); } /* * '_mxml_global()' - Get global data. */ _mxml_global_t * /* O - Global data */ _mxml_global(void) { _mxml_global_t *global; /* Global data */ if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) == NULL) { global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t)); global->num_entity_cbs = 1; global->entity_cbs[0] = _mxml_entity_cb; global->wrap = 72; TlsSetValue(_mxml_tls_index, (LPVOID)global); } return (global); } #else /**** No threading ****/ /* * '_mxml_global()' - Get global data. */ _mxml_global_t * /* O - Global data */ _mxml_global(void) { static _mxml_global_t global = /* Global data */ { NULL, /* error_cb */ 1, /* num_entity_cbs */ { _mxml_entity_cb }, /* entity_cbs */ 72, /* wrap */ NULL, /* custom_load_cb */ NULL /* custom_save_cb */ }; return (&global); } #endif /* HAVE_PTHREAD_H */ /* * End of "$Id: mxml-private.c 422 2010-11-07 22:55:11Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml.spec0000644000177700000170000000533111210045173016264 0ustar torstenman# # "$Id: mxml.spec 399 2009-05-17 17:20:51Z mike $" # # RPM "spec" file for Mini-XML, a small XML library. # # Copyright 2003-2009 by Michael Sweet. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2, 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. # Summary: Miniature XML development library Name: mxml Version: 2.6 Release: 1 License: LGPL Group: Development/Libraries Source: http://www.easysw.com/~mike/mxml/mxml-%{version}.tar.gz Url: http://www.easysw.com/~mike/mxml/ Packager: Michael Sweet Vendor: Michael Sweet # Use buildroot so as not to disturb the version already installed BuildRoot: /var/tmp/%{name}-root %description Mini-XML is a small XML parsing library that you can use to read XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML provides the following functionality: - Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings. - Data is stored in a linked-list tree structure, preserving the XML data hierarchy. - Supports arbitrary element names, attributes, and attribute values with no preset limits, just available memory. - Supports integer, real, opaque ("cdata"), and text data types in "leaf" nodes. - Functions for creating and managing trees of data. - "Find" and "walk" functions for easily locating and navigating trees of data. Mini-XML doesn't do validation or other types of processing on the data based upon schema files or other sources of definition information, nor does it support character entities other than those required by the XML specification. %prep %setup %build CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS" ./configure --enable-shared --prefix=/usr # If we got this far, all prerequisite libraries must be here. make %install # Make sure the RPM_BUILD_ROOT directory exists. rm -rf $RPM_BUILD_ROOT make BUILDROOT=$RPM_BUILD_ROOT install %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %dir /usr/bin /usr/bin/* %dir /usr/include /usr/include/mxml.h %dir /usr/lib /usr/lib/* %dir /usr/lib/pkgconfig /usr/lib/pkgconfig/mxml.pc %dir /usr/share/doc/mxml /usr/share/doc/mxml/* %dir /usr/share/man/man1 /usr/share/man/man1/* %dir /usr/share/man/man3 /usr/share/man/man3/* # # End of "$Id: mxml.spec 399 2009-05-17 17:20:51Z mike $". # cmtk-3.0.0/Utilities/mxml/doc/0000755000177700000170000000000012263615446015215 5ustar torstenmancmtk-3.0.0/Utilities/mxml/doc/9.gif0000644000177700000170000000277211210045173016045 0ustar torstenmanGIF89addç        ! "! #"!$#"%$#&%#'&$'&$('%)(&*)'+*(,+)-,*.-+/.,0/-10.21/320431542653664775886997::8;;9<<:=<;>==@?>A@?BA@CBADCCFEDGFEHGFIHGJIHKJILKKNMLONMPONQPORQPSRQTSRUTSUUTVVUWWVXXWYYXZZY[[Z\\[]]\^^]__^``_a``baacbbdcbedcfedgfehgfihgjihkjilkjmlknmlonmponqporqpsrqtsrttsuutvvuwwvxxwyyxzzy{{z||{}}|~~}~€€€‚‚ƒƒ‚„ƒƒ…„„†……‡††ˆ‡‡‰ˆˆŠ‰‰‹ŠŠŒ‹‹ŒŒŽŽ‘’‘‘“’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸ ¡¡¡¢¢¡££¢¤¤£¥¥¤¦¦¥§¦¦¨§§©¨¨ª©©«ªª¬««­¬¬®­­¯®®°¯¯±°°²±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËÊËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßààààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîíîïîïðïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþù H°`Á2*\Ȱ¡Ã‡#*,c°¢Å‹}IÜȱ£G¾0мå£É“(£Œ\É/Ê—0;æay1¦Í›iü„³§Ï„Ÿtò;ò³(Î#4W]jsÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®~Xb–Ž]5MHÀ.¬è«)–˜ÀÎ,xU‡Ð¸,É4Ã]ƒXUŒzïoE5Wj\jø¢;©!ù-eÐX¤TF TsÑÍ#á1å‡ð'è•|––ö‰ëôJµ0]³„}Rg;‡tZ¡í•e‚ˆhòîÈn6G–|‡GdyÀ£qåA¬ ÷ñÍkèé]ï-òv‡Ï=þεüáÊ(·—O¨ž;F¨ë´÷˜oä»õ ;Íïxh¿òhþmÔC€¼ÅC`D›> >¤ÙH àçMƒ°’ø CaCg¬ ~lÈ4áa‡ƒˆk•ˆÝJ¤§"t+åsÂá÷¢D:á€=+=ó‘9â§K8¤76t—ŽìCÓ!ð“ èDC6%“²m©£] ÅdB †™äŠf¢–ir6fBzÈ6Fò¼©~ 1ÀJªØ©›Ý·çHWø©P­£ÐJEªPw­6(yŽ.äKÇ(éf¥ ñME±à jrêP&¥šjÞHŒ¨jÓJá¸Sª²Ð­²–‰Q/câ’˯À lm#ÅÊd9(r‚kT¥0êÞE¢éÃJûÐçì›,)µÑ-g¢¹ÒÃÒ~Š£“¨ YW£ŸmZdˆ£íVÄi¼=Àé1ôòÓŒªùJ%iOñú+™Qm&60Á]Þƒ•gK)âzñ³SøTvW‘U5w £AÉI%@.#B›`ƒÕê“Am©lÓœ)»<«E2Çv‘U5¤ÕEðå¼U"iësDN±ÔóÐ ÍÎH+´³˜M³WYË9ÃÜXȵ¢,ÛĪfÜî¿LRôW@;cmtk-3.0.0/Utilities/mxml/doc/8.gif0000644000177700000170000000277611210045173016050 0ustar torstenmanGIF89addç        ! "! #"!$#"%$#&%#'&$'&$('%)(&*)'+*(,+)-,*.-+/.,0/-10.21/320431542653664775886997::8;;9<<:=<;>==@?>A@?BA@CBADCBEDCFEDGFEHGFIHGJIHKJILKJMLKNMLONMPONQPORQPSRQTSRUTSUUTVVUWWVXXXZZY[[Z\\[]]\^^]__^``_a``baacbbdcbedcfedgfehgfihgjihkjilkjmlknmlonmponqporqpsrqtsrttsuutvvuwwvxxwyyxzzy{{z||{}}|~~}~€€€‚‚ƒƒ‚„ƒƒ…„„†……‡††ˆ‡‡‰ˆˆŠ‰‰‹ŠŠŒ‹‹ŒŒŽŽŽ‘’‘‘“’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¡££¢¤¤£¥¥¥§¦¦¨§§©¨¨ª©ª¬««­¬¬®­­¯®¯±°°²±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËÊËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßààààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîíîïîïðïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþù H°`A3*\Ȱ¡Ã‡#*4c°¢Å‹}IÜȱ£G¾0м8å£É“(§Œ\ÉOÊ—0;êay1¦Í›i…³§Ï„¢tòKò³(Î$4W]jsÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ® yT ö-Þ7Ym€MXÑ%Öâh¢á:³ VhB R¸Z°dTvy+:ˆªr`TŠ-Ò‹:PãÒz‰EX’ÓÈ+5,¸óJF9õL34ŸH—þyú§jš”ÖžÔ÷zµl:M= 0æ¨Û…±,ÆÑ6ðˆ,kxl·òøÆ•`L®Ôäâ†æ'±Wo¨iä”òFþnwÈL„ÂŽ-Ö#DáÙÈÀS›HBTî4Ùq %PY-Mú ¥Að Y×ŃãBÒU4Ý2£NHãJp˜ KútD†qðñ)Q,¥`0,Ô›ŒÛ±´„~+MÖ'¢61ðõ±Ò5/ P¨z,ÅùÒ¦ãʨˆ²‰š¤À™š!…Ω:!©åk¹ú¬`ÉÚ‘­¥®”…{¨ÞægG=àºÖ"ÂæTl­+ÙsR ,¥øèJ:¬*ÒwðÙC“³ö œ¦4}²Ñ:9k_^v<C^B@&F娸îW¾k8r ï@ã yǽ–ÕšOŠÈkEKAf”¡õkTZªq™ÂKŲ£T9U8ª=UeGµo`ÜpE_\ÏJˆ€U˜aW&L[-÷T—]1÷oÍŸ^dÎ(iuT<Ä&FJÝ‘S,m4DC¯´óÒ ù,ÔSbóÒ3{F2Î+×fñ•ù/‡ˆå;cmtk-3.0.0/Utilities/mxml/doc/7.gif0000644000177700000170000000245211210045173016036 0ustar torstenmanGIF89addç        ! #"!$#"%$#&%#'&$'&$('%)(&*)'+*)-,*.-+/.,0/-10.21/320431542653664775886997::8;;9<<:=<;>==@?>A@ADCBEDFIHGJIHKJILKKNMLONMPONQPORQPSRQTSRUTSUUUWWWYYXZZY[[[]]\^^]__^``_a`acbbdcbedehgfihgjihkjilkjmlknmlonorqpsrqtsrttsuutvvuwwvxxwyyxzzy{{{}}|~~}~€€€‚‚‚„ƒƒ…„„†……‡††ˆ‡ˆŠ‰ŠŒ‹‹ŒŽ’‘’““”•••––˜™™™ššš›››œœœžžŸ   ¡¡¡¢¢£¥¥¥§¦¦¨§§©¨¨ª©©«ªª¬««­¬­¯®®°¯¯±°°²±²³³µ¶¶·¸¸¸¹¹¹ººº»»»¼¼½¾¾¿ÀÀÀÁÁÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÈÉÉÊËÊËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßààààáááâââãããääåæææçççèèèéééêêêëëìíííîíîïîðððòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþ£ H°`Á+*\Ȱ¡Ã‡#*¼b°¢Å‹3IÜȱ£G™0мˆä£É“(‘Œ\ Ê—0;¢ay1¦Í›i„³§Ï„ƒtFûñ³(Î4Q]jÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9Vt¶lÄ™m ]KfÁ’1ÙÊ SåÀ›sóVŒ+P£Z½€Æ  gàÀ Ö›ïâ¼j:~,צäɔך}˜¹òæ†Ù~Zçè°V*8 våÖ]Wö‚ÍÕØJÚX·ÜÆ-5õȼ¥®ì<ê®Ýņ@ž¼èÊÍ6É,zQÌ­+éA»Ïc#þyï)!ûx·#yœ¿ Éüú“îß{ùJ>Ìò#í£ÉF?Ê#ñù'ÑJDh’]t8ŸHB(è:Hva… %3-nta‡`|ˆáJCt8`~&B¤‰ˆ®¤TŠœ¡cCŒ°(áJ\ÌèòÀ£‚ÏühàJ`è8!FF2dƒÚ¤,%¹ÐJ‰H©ÐJ9X ÀOê÷I—öE©¥˜V’)¥™£]ÆT hnFÑU}´i–`RA#gYtFÕk} w'X„¦eDÁ5hCæy蔑µhBh¥õhB_ZÕ¢Z]••T‰ôb’N±´éŒ²dŒ™ £^Ž:©^†ú—èa~Éhij&G[;cmtk-3.0.0/Utilities/mxml/doc/6.gif0000644000177700000170000000273611210045173016042 0ustar torstenmanGIF89addç        ! "! #"!$#"%$#'&$'&$('%)(&*)'+*(,+)-,*.-+/.,0/-10.21/320431542653664775886997::8;;9<<:=<;>==@?>A@?BA@CBADCBEDCFEDGFEHGFIHGJIHKJILKJMLKNMLONMPONQPORQPSRQTSRUTSUUTVVUWWVXXWYYXZZY[[Z\\[]]\^^]__^``_a``baacbbdcbedcfedgfehgfihgjihkjilkjmlknmlonmponqporqpsrqtsrttsuutvvuwwvxxwyyxzzy{{{}}|~~~€€€‚‚ƒƒ‚„ƒƒ…„„†……‡††ˆ‡‡‰ˆˆŠ‰‰‹ŠŠŒ‹‹ŒŒŽŽ‘’‘‘“’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸ ¡¡¡¢¢¡££¢¤¤£¥¥¤¦¦¥§¦¦¨§§©¨¨ª©©«ªª¬««­¬¬®­­¯®®°¯¯±°°²±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÅÆÆÇÈÈÈÉÉÉÊÊÊËÊËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßààààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîíîïîïðïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþó H°`A3*\Ȱ¡Ã‡#*4c°¢Å‹{IÜȱ£G½0м(å£É“(¥Œ\™/Ê—0;æay1¦Í›iô„³§Ï„žtæCò³(N$4U]jSÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ® s0R6n¶R[€­è¬Ö‘é\Y°k ¡YI-Xòª¼1U9«8À™Ô¸ñÅFCæ“*À±ÈF6¶Œ1BQÍŠ9üŒp©è•ø~–6 éôJ`aºf¥ÎRuÖ6YµD*, íöÈG8´‡s\iøJåÍ=÷:zÄ•WL®ÑÕ-Æ=IÊñ£YõñK¡V$çÈQ%’R({äTœ-s¤2K"ÇìPÉÂÚ¬gÛ¬1g ,ñlþRLðµéÞG`;cmtk-3.0.0/Utilities/mxml/doc/5.gif0000644000177700000170000000263011210045173016032 0ustar torstenmanGIF89addç        ! "! #"!$#"%$#&%#'&$'&$('%)(&*)'+*(,+)-,*.-,0/-10.21/320431542653665886997::8;;9<<:=<;>==@?>A@?BA@CBADCBEDCFEDGFEHGFIHHKJILKJMLKNMLONNQPORQPSRQTSRUTSUUTVVUWWVXXWYYY[[Z\\[]]\^^]__^``_a``baacbbdcbedcfedgfehgfihgjihkjilkjmlknmlonmponqporqpsrqtsrttsuutvvuwwvxxwyyxzzy{{z||{}}|~~}~€€€‚‚ƒƒ‚„ƒƒ…„„†……‡††ˆ‡ˆŠ‰‰‹ŠŠŒ‹‹ŒŒŽŽŽ‘’‘’“““””•–––———˜˜˜™™™ššš››œžžžŸŸŸ   ¡¡¡¢¢¡££¢¤¤£¥¥¤¦¦¥§¦¦¨§§©¨¨ª©©«ªª¬««­¬¬®­­¯®®°¯¯±°°²±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÊËÊËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßààààáááââãäääåååææçèèèéééêêêëëëìììíííîíîïîïðïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþé H°`A1*\Ȱ¡Ã‡#*c°¢Å‹sIÜȱ£G¹0мøä£É“(ŸŒ\IÏÊ—0;Úay1¦Í›iÔ„³§Ï„štÒ3ò³(N#4U]jSÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9Vt¶lÄ™"ÊV`Ï‚%‹új˶§ÊKéÖ}+P£Q½B}†¤Ç°ÎŸnóf‰˜°Q‹û¤‡Ð(©È+Vþ‹y¤Y”=6ZähÒ¥¿žÞh!µêÕa„mÖ4í°¶owÍ­+ÆU½¹À¸#8Ö9³_=—\yTÞÎ9¿ŽÞØ"·†^äU´&„ºGŒlþÚ ùÇ{D,Ð6˜y‡Ïf—ŒãýB×ÃÙOˆßàþþþ½`€Ô1`A¢xWË@ƒ*ÇÖ*9°€©´Ct4­Q69Ç’  “Ê¡°R ß±r›ŒôÍGÐ$¡hIÃ’zûÅÄR‚=Âdc/ ‘ e†d’8.é•’N>Ùd”bAIe•S^Ñ‘ZJÄe—9Y d–i¦™2 ÝjóäJY|¹Ú-+Í¡&F¤ô††œÀRš· À§—ƒžÆ']¶’:ÆÑ”@GiШn¡Ð”ÂFÚv#M

    3More Mini-XML Programming Techniques

    This chapter shows additional ways to use the Mini-XML library in your programs.

    Load Callbacks

    Chapter 2 introduced the mxmlLoadFile() and mxmlLoadString() functions. The last argument to these functions is a callback function which is used to determine the value type of each data node in an XML document.

    Mini-XML defines several standard callbacks for simple XML data files:

    • MXML_INTEGER_CALLBACK - All data nodes contain whitespace-separated integers.
    • MXML_OPAQUE_CALLBACK - All data nodes contain opaque strings ("CDATA").
    • MXML_REAL_CALLBACK - All data nodes contain whitespace-separated floating-point numbers.
    • MXML_TEXT_CALLBACK - All data nodes contain whitespace-separated strings.

    You can provide your own callback functions for more complex XML documents. Your callback function will receive a pointer to the current element node and must return the value type of the immediate children for that element node: MXML_INTEGER, MXML_OPAQUE, MXML_REAL, or MXML_TEXT. The function is called after the element and its attributes have been read, so you can look at the element name, attributes, and attribute values to determine the proper value type to return.

    The following callback function looks for an attribute named "type" or the element name to determine the value type for its child nodes:

        mxml_type_t
        type_cb(mxml_node_t *node)
        {
          const char *type;
    
         /*
          * You can lookup attributes and/or use the
          * element name, hierarchy, etc...
          */
    
          type = mxmlElementGetAttr(node, "type");
          if (type == NULL)
    	type = mxmlGetElement(node);
    
          if (!strcmp(type, "integer"))
    	return (MXML_INTEGER);
          else if (!strcmp(type, "opaque"))
    	return (MXML_OPAQUE);
          else if (!strcmp(type, "real"))
    	return (MXML_REAL);
          else
    	return (MXML_TEXT);
        }
    

    To use this callback function, simply use the name when you call any of the load functions:

        FILE *fp;
        mxml_node_t *tree;
    
        fp = fopen("filename.xml", "r");
        tree = mxmlLoadFile(NULL, fp, type_cb);
        fclose(fp);
    

    Save Callbacks

    Chapter 2 also introduced the mxmlSaveFile(), mxmlSaveString(), and mxmlSaveAllocString() functions. The last argument to these functions is a callback function which is used to automatically insert whitespace in an XML document.

    Your callback function will be called up to four times for each element node with a pointer to the node and a "where" value of MXML_WS_BEFORE_OPEN, MXML_WS_AFTER_OPEN, MXML_WS_BEFORE_CLOSE, or MXML_WS_AFTER_CLOSE. The callback function should return NULL if no whitespace should be added and the string to insert (spaces, tabs, carriage returns, and newlines) otherwise.

    The following whitespace callback can be used to add whitespace to XHTML output to make it more readable in a standard text editor:

        const char *
        whitespace_cb(mxml_node_t *node,
                      int where)
        {
          const char *name;
    
         /*
          * We can conditionally break to a new line
          * before or after any element. These are
          * just common HTML elements...
          */
    
          name = mxmlGetElement(node);
    
          if (!strcmp(name, "html") ||
              !strcmp(name, "head") ||
              !strcmp(name, "body") ||
    	  !strcmp(name, "pre") ||
              !strcmp(name, "p") ||
    	  !strcmp(name, "h1") ||
              !strcmp(name, "h2") ||
              !strcmp(name, "h3") ||
    	  !strcmp(name, "h4") ||
              !strcmp(name, "h5") ||
              !strcmp(name, "h6"))
          {
           /*
    	* Newlines before open and after
            * close...
    	*/
    
    	if (where == MXML_WS_BEFORE_OPEN ||
                where == MXML_WS_AFTER_CLOSE)
    	  return ("\n");
          }
          else if (!strcmp(name, "dl") ||
                   !strcmp(name, "ol") ||
                   !strcmp(name, "ul"))
          {
           /*
    	* Put a newline before and after list
            * elements...
    	*/
    
    	return ("\n");
          }
          else if (!strcmp(name, "dd") ||
                   !strcmp(name, "dt") ||
                   !strcmp(name, "li"))
          {
           /*
    	* Put a tab before <li>'s, * <dd>'s,
            * and <dt>'s, and a newline after them...
    	*/
    
    	if (where == MXML_WS_BEFORE_OPEN)
    	  return ("\t");
    	else if (where == MXML_WS_AFTER_CLOSE)
    	  return ("\n");
          }
    
         /*
          * Return NULL for no added whitespace...
          */
    
          return (NULL);
        }
    

    To use this callback function, simply use the name when you call any of the save functions:

        FILE *fp;
        mxml_node_t *tree;
    
        fp = fopen("filename.xml", "w");
        mxmlSaveFile(tree, fp, whitespace_cb);
        fclose(fp);
    

    Custom Data Types

    Mini-XML supports custom data types via global load and save callbacks. Only a single set of callbacks can be active at any time, however your callbacks can store additional information in order to support multiple custom data types as needed. The MXML_CUSTOM node type identifies custom data nodes.

    The load callback receives a pointer to the current data node and a string of opaque character data from the XML source with character entities converted to the corresponding UTF-8 characters. For example, if we wanted to support a custom date/time type whose value is encoded as "yyyy-mm-ddThh:mm:ssZ" (ISO format), the load callback would look like the following:

        typedef struct
        {
          unsigned      year,    /* Year */
                        month,   /* Month */
                        day,     /* Day */
                        hour,    /* Hour */
                        minute,  /* Minute */
                        second;  /* Second */
          time_t        unix;    /* UNIX time */
        } iso_date_time_t;
    
        int
        load_custom(mxml_node_t *node,
                    const char *data)
        {
          iso_date_time_t *dt;
          struct tm tmdata;
    
         /*
          * Allocate data structure...
          */
    
          dt = calloc(1, sizeof(iso_date_time_t));
    
         /*
          * Try reading 6 unsigned integers from the
          * data string...
          */
    
          if (sscanf(data, "%u-%u-%uT%u:%u:%uZ",
                     &(dt->year), &(dt->month),
                     &(dt->day), &(dt->hour),
                     &(dt->minute),
                     &(dt->second)) != 6)
          {
           /*
            * Unable to read numbers, free the data
            * structure and return an error...
            */
    
            free(dt);
    
            return (-1);
          }
    
         /*
          * Range check values...
          */
    
          if (dt->month < 1 || dt->month > 12 ||
              dt->day < 1 || dt->day > 31 ||
              dt->hour < 0 || dt->hour > 23 ||
              dt->minute < 0 || dt->minute > 59 ||
              dt->second < 0 || dt->second > 59)
          {
           /*
            * Date information is out of range...
            */
    
            free(dt);
    
            return (-1);
          }
    
         /*
          * Convert ISO time to UNIX time in
          * seconds...
          */
    
          tmdata.tm_year = dt->year - 1900;
          tmdata.tm_mon  = dt->month - 1;
          tmdata.tm_day  = dt->day;
          tmdata.tm_hour = dt->hour;
          tmdata.tm_min  = dt->minute;
          tmdata.tm_sec  = dt->second;
    
          dt->unix = gmtime(&tmdata);
    
         /*
          * Assign custom node data and destroy
          * function pointers...
          */
    
          mxmlSetCustom(node, data, destroy);
    
         /*
          * Return with no errors...
          */
    
          return (0);
        }
    

    The function itself can return 0 on success or -1 if it is unable to decode the custom data or the data contains an error. Custom data nodes contain a void pointer to the allocated custom data for the node and a pointer to a destructor function which will free the custom data when the node is deleted.

    The save callback receives the node pointer and returns an allocated string containing the custom data value. The following save callback could be used for our ISO date/time type:

        char *
        save_custom(mxml_node_t *node)
        {
          char data[255];
          iso_date_time_t *dt;
    
    
          dt = (iso_date_time_t *)mxmlGetCustom(node);
    
          snprintf(data, sizeof(data),
                   "%04u-%02u-%02uT%02u:%02u:%02uZ",
                   dt->year, dt->month, dt->day,
                   dt->hour, dt->minute, dt->second);
    
          return (strdup(data));
        }
    

    You register the callback functions using the mxmlSetCustomHandlers() function:

        mxmlSetCustomHandlers(load_custom,
                              save_custom);
    

    Changing Node Values

    All of the examples so far have concentrated on creating and loading new XML data nodes. Many applications, however, need to manipulate or change the nodes during their operation, so Mini-XML provides functions to change node values safely and without leaking memory.

    Existing nodes can be changed using the mxmlSetElement(), mxmlSetInteger(), mxmlSetOpaque(), mxmlSetReal(), mxmlSetText(), and mxmlSetTextf() functions. For example, use the following function call to change a text node to contain the text "new" with leading whitespace:

        mxml_node_t *node;
    
        mxmlSetText(node, 1, "new");
    

    Formatted Text

    The mxmlNewTextf() and mxmlSetTextf() functions create and change text nodes, respectively, using printf-style format strings and arguments. For example, use the following function call to create a new text node containing a constructed filename:

        mxml_node_t *node;
    
        node = mxmlNewTextf(node, 1, "%s/%s",
                            path, filename);
    

    Indexing

    Mini-XML provides functions for managing indices of nodes. The current implementation provides the same functionality as mxmlFindElement(). The advantage of using an index is that searching and enumeration of elements is significantly faster. The only disadvantage is that each index is a static snapshot of the XML document, so indices are not well suited to XML data that is updated more often than it is searched. The overhead of creating an index is approximately equal to walking the XML document tree. Nodes in the index are sorted by element name and attribute value.

    Indices are stored in mxml_index_t structures. The mxmlIndexNew() function creates a new index:

        mxml_node_t *tree;
        mxml_index_t *ind;
    
        ind = mxmlIndexNew(tree, "element",
                           "attribute");
    

    The first argument is the XML node tree to index. Normally this will be a pointer to the ?xml element.

    The second argument contains the element to index; passing NULL indexes all element nodes alphabetically.

    The third argument contains the attribute to index; passing NULL causes only the element name to be indexed.

    Once the index is created, the mxmlIndexEnum(), mxmlIndexFind(), and mxmlIndexReset() functions are used to access the nodes in the index. The mxmlIndexReset() function resets the "current" node pointer in the index, allowing you to do new searches and enumerations on the same index. Typically you will call this function prior to your calls to mxmlIndexEnum() and mxmlIndexFind().

    The mxmlIndexEnum() function enumerates each of the nodes in the index and can be used in a loop as follows:

        mxml_node_t *node;
    
        mxmlIndexReset(ind);
    
        while ((node = mxmlIndexEnum(ind)) != NULL)
        {
          // do something with node
        }
    

    The mxmlIndexFind() function locates the next occurrence of the named element and attribute value in the index. It can be used to find all matching elements in an index, as follows:

        mxml_node_t *node;
    
        mxmlIndexReset(ind);
    
        while ((node = mxmlIndexFind(ind, "element",
                                     "attr-value"))
                    != NULL)
        {
          // do something with node
        }
    

    The second and third arguments represent the element name and attribute value, respectively. A NULL pointer is used to return all elements or attributes in the index. Passing NULL for both the element name and attribute value is equivalent to calling mxmlIndexEnum.

    When you are done using the index, delete it using the mxmlIndexDelete() function:

        mxmlIndexDelete(ind);
    

    SAX (Stream) Loading of Documents

    Mini-XML supports an implementation of the Simple API for XML (SAX) which allows you to load and process an XML document as a stream of nodes. Aside from allowing you to process XML documents of any size, the Mini-XML implementation also allows you to retain portions of the document in memory for later processing.

    The mxmlSAXLoadFd, mxmlSAXLoadFile, and mxmlSAXLoadString functions provide the SAX loading APIs. Each function works like the corresponding mxmlLoad function but uses a callback to process each node as it is read.

    The callback function receives the node, an event code, and a user data pointer you supply:

        void
        sax_cb(mxml_node_t *node,
               mxml_sax_event_t event,
               void *data)
        {
          ... do something ...
        }
    

    The event will be one of the following:

    • MXML_SAX_CDATA - CDATA was just read
    • MXML_SAX_COMMENT - A comment was just read
    • MXML_SAX_DATA - Data (custom, integer, opaque, real, or text) was just read
    • MXML_SAX_DIRECTIVE - A processing directive was just read
    • MXML_SAX_ELEMENT_CLOSE - A close element was just read (</element>)
    • MXML_SAX_ELEMENT_OPEN - An open element was just read (<element>)

    Elements are released after the close element is processed. All other nodes are released after they are processed. The SAX callback can retain the node using the mxmlRetain function. For example, the following SAX callback will retain all nodes, effectively simulating a normal in-memory load:

        void
        sax_cb(mxml_node_t *node,
               mxml_sax_event_t event,
               void *data)
        {
          if (event != MXML_SAX_ELEMENT_CLOSE)
            mxmlRetain(node);
        }
    

    More typically the SAX callback will only retain a small portion of the document that is needed for post-processing. For example, the following SAX callback will retain the title and headings in an XHTML file. It also retains the (parent) elements like <html>, <head>, and <body>, and processing directives like <?xml ... ?> and <!DOCTYPE ... >:

        void
        sax_cb(mxml_node_t *node,
               mxml_sax_event_t event,
               void *data)
        {
          if (event == MXML_SAX_ELEMENT_OPEN)
          {
           /*
            * Retain headings and titles...
            */
    
            char *name = mxmlGetElement(node);
    
            if (!strcmp(name, "html") ||
                !strcmp(name, "head") ||
                !strcmp(name, "title") ||
                !strcmp(name, "body") ||
                !strcmp(name, "h1") ||
                !strcmp(name, "h2") ||
                !strcmp(name, "h3") ||
                !strcmp(name, "h4") ||
                !strcmp(name, "h5") ||
                !strcmp(name, "h6"))
              mxmlRetain(node);
          }
          else if (event == MXML_SAX_DIRECTIVE)
            mxmlRetain(node);
          else if (event == MXML_SAX_DATA)
          {
            if (mxmlGetRefCount(mxmlGetParent(node)) > 1)
            {
             /*
              * If the parent was retained, then retain
              * this data node as well.
              */
    
              mxmlRetain(node);
            }
          }
        }
    

    The resulting skeleton document tree can then be searched just like one loaded using the mxmlLoad functions. For example, a filter that reads an XHTML document from stdin and then shows the title and headings in the document would look like:

        mxml_node_t *doc, *title, *body, *heading;
    
        doc = mxmlSAXLoadFd(NULL, 0,
                            MXML_TEXT_CALLBACK,
                            sax_cb, NULL);
    
        title = mxmlFindElement(doc, doc, "title",
                                NULL, NULL,
                                MXML_DESCEND);
    
        if (title)
          print_children(title);
    
        body = mxmlFindElement(doc, doc, "body",
                               NULL, NULL,
                               MXML_DESCEND);
    
        if (body)
        {
          for (heading = mxmlGetFirstChild(body);
               heading;
               heading = mxmlGetNextSibling(heading))
            print_children(heading);
        }
    
    cmtk-3.0.0/Utilities/mxml/doc/4.gif0000644000177700000170000000254411210045173016035 0ustar torstenmanGIF89addç  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþÿ H°`A5*\Ȱ¡Ã‡#*Tc°¢Å‹‡IÜȱ£ÇÃ0мhå£É“(­Œ\ù¯Ê—0;öay1¦Í›i$…³§Ï„¤tþkò³(Î&4a]jÆJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9Vt¶lÄ™Í2¤HÓhÁ’j 5ªr`\…éæº¨ñ.¡ÿ–† |÷`Â{ S9ÌT`áÈ‹þCwd¦”ãBŽ\øçfÎqùZ2éÒ=—}úåjÖ­MbœÆ2vÌ ¯´ #Ý#y£´•¸Há'‹WŽ\ìÅ\rw7ç‚yíé1ŽXx;ÄPÌ—þõî0¼x‹äú»¨©a÷ô -˜?_>CŒÊK·`ÑÅ|½ß| H>í‘Ó~é9@` ’‡Ñ8]µ#‘…Í=]péÁsQÙEØ\~xœ„ãUh¢p`\´MGÚ–"w/ÚFÎE@xT#jµ¸aŽ­Ýx‘¥-qQ_>"š‘G‚ˆÜkTÂfV•¯¡†åjZn¹Y—^2VZ˜—I&``žÙ–™j®ùd›nvgœü-(e²9‰g€zîé^Ÿ~âxg %J¨‹†Êg¢ŠþÉh£‚®©’•›•þDQl?ÆäX‘€&g¥Zöö“o>Ó`£NŠè?Kp¹êQ]vÉÚ$AdÙ*Zié:d}¾.Z‘UÁ.¤ÕEP{U")U¬S,%k+³,ëê±zMºZ®„òºZ¬xÒŠ%ªé±ªæ¥¼±X@;cmtk-3.0.0/Utilities/mxml/doc/chapters.xcf.gz0000644000177700000170000001464511210045173020142 0ustar torstenman‹µY x•Źž“L˜IÈ ä„$'$8‚¶ÚÛZ)¸A±>UHB€”Å‚õ†VkÕkoëm+¹]½VPÛZm+¨m-VêÒ6t×.6¸`Ep’fîûÍr’ˆ}žÞ{ŸËó̼_þÿüËüïÌ7ï÷²º³ûòø–öUñUë:c±é®Ùt †®Mžu3cÔðoGË@+ö1ýn<à `Îjܶ¡}}wwGÏ&æORcùöLgwëꎆÕ:Wú“1Y·qÓÖuñΞM6v´oê\ß³1‘U·juûúuë7Äë,4lXÝÖoœÑhÿ½G0Ë \Úö—Îz÷O èÒ-/omïìYŸ[ßë ?Ö°¹§s^¾}M½õ–õ«VmìØyõ©‡Ü‘Ñ—²á±=ø¸3F¸Çõ2­‰Ž¤ù3c<†xÁG¦é_Öˆxìˆ8{Dœ3"Îó÷ú€1æ q.ðŸî9?/Å즎-›ÖµníØ˜mª£cñʦJ¢s}ÂÅÝm›7Æ/jíÙÿHü¬õëV†s ;¯êˆ75ŽøJ©ÃîC]Þ¹¥c}ã5˜*ÄÆVûÅ[7oZOGŸ8׺®³u£ÿ{]kÏê͘sñÊŽžåK/¢ÇµµnìhXÙ¹Á͵øºMpð=cÖnÞ¸©sÕÖøºŽU›èy= a¾4Ì1œ¶õ[º×¯ìˆ¯ÜÚÓÚÝÙîÛÎÓ¿õ.òñÙÓ`bàGÅXzÅ•£ÏóÙhg¡]ˆÖ†ø5hŸÇ,Yÿ¬Þƒ™…<ö`÷ÈÍÛ–ûŸ°Ò7ƒÝ[Áêh =†ãã  Òƒ¶å33¢úwæÃfDû¿ý>]±(}zkaïˆ÷_÷ããÆ°f6TqùÞ· 7³Y¿ò #ÍL‰e˜±¦E%×39f‹jv½còL‚Eå}ʘZåÝôŽ)2SY[vØŒ7ÕLU>h&˜JXqÜ”˜)L~ÛL4q¦¦ÿÕ”™ ¦–œ0åf2ÓWšÉ¦œ©´Ï™ Süª‰›‰Lžl¦˜RàvS Ô[L•)aú|Sm&05󰘩‚gÌT3¿ºÇÔõZSkÆ1Uõ&°‡dê€z™I˜B¦²ž·ˆGÖ›¦ò^±ˆ[O3ùLÉ-êf:Ác€<¦g˜‚›pN:ËX¥=ËÔž\–Ëô| 7ǰ¢õx”Ò—"³ë? Ô+)šDÑ Ï¼ o¤N§ðkxWub R¿~¡¾Š¢:x8“¡ƒW"èz» b4uײ粧³êÚ¾»ô«gž?òê[o¾vôÅ?ÿòáïíºvÝy3rX‹vÜßû䑟|aÍÁJY•<ùø¿ŸW€¤RkÕ½1¼à43ôì¿ÍŒa(3LôÛî|¤¬F½õ•zä´&£î‡åà/ öïw@“uäËfúë G ÏÖ¿ h1ž«b¯cÙ©·2inŽ££?¤ós(ÚLÑEͧ¨›~¨³)¼¡þ†¦¿BÑ>Šî¡èKí§è“ý–¢6ŠþJÑ"ŠþNÑé½AQEïP§hˆ¢bŠ4E¹ˆ°r„î fa[ÖöQã«ez/¦`½ƒ: *vÄŒ3uL?ààF+|ØAƒƒ‰ H鲌wPá`†ƒ…:\ïà^=þïõd÷R—8ØÀÄ•Ç-êóÜt~€I>ÓÍõÛXI¬,ˆô~‹z+ÖÖÉY ˆu?âRð”—‚«Ù¬Î}ë 98ã—ƒßÿ,F,ÄÆ;‘{‹±M|p¾oJ›»ó0’S³z¾ý2²i:{#6&g\YÝ™í¾á»OGÈ–šQÙ!1œdætja&i†vco2H#Ç—Ç>æ"mT@ïÌ1Ñ+8À¨»'A·˜èäÍ%83)éú—i^¼ÌešÇNyŠïF.mÌìkÜÿ†ƒüÂÁ3Ž98îà¤=ê/O:øƒ¯9èup±ƒ&@QÑX‹ºß-Á/;¸€ÕŠL¨wkø“â,÷‡Ýª¿ kÔ c,êMXWHGs-ênÌq¤‘?±¨ÏEVKC.AæQ/‘‰ÔÙHA™tÿ‰HSê¾4 ÒÖ/³‘¯ÆþV‚4†´v¸iãQ5HsH~ÏMEÖC2üm9’ąç³),2}9R¯bÛbŸaú4$ÏH}. ‡ð‹?ÍÇ/ÒL¤oʰyS˜ì2æ±…¸õ¨,ëÃ,ñqM©L+ìz EïP”KÑqŠŠ):J}ý Es(úEçSôcŠ:)º›¢ë)úE÷Qô Š(ú8íÆù´/ è\ŠŠ)Ú‰HÅ^¥þŽ~øs:XM§o¥èŠVÑþ>F»z&>ò$Ę·éè´•â-pôÃõ"ROIqö<\Ÿ1jÜï5mÿaw„ÅÒÒy†ÈÊ-,©H4Ÿ½¤ó3·=þžPÄNƪ?öù_)¬Í6”÷±»Þ„d*cQn×ïüzþo쥵u;ç¸ÛíÎÅÚßv{eÓKn“¬ü³Û' ¸DXõ’MLjÁt]‚é. *öÖT=S“߀î›F †@e>kòÍt¦×XPY/C60}ƒ:À ¦Ÿ4¹W;h± Ò_‡¤œÉôOÜì ÃÁ9¦;(që ÃtPä ÂA£ƒ lvp«ƒƒ<7WYÄ#ìÛ|ÐÀÉ¢>Û½øwNµ¶¨¿„Ña°õß ¶ƒ¯gú£ø$ø4“_â‹eìǧ™„Æ`)\³â@Ý’îdÁ}™V¨}™N­¸?ÃI€]1·÷o¶ 0Ù쮬ÜmðVGжO Þ©²ÙFý †)WD‹‚@=•]:ÎèK,¨?¦Cw7z‰ƒÅFWAÒÓš!PÏÆ '=ÛÁ5~ (1zŠÛšønp°ß‚z-ÅXjôg:Xãà³¾âàûžpðŒƒÃ^qð¦å rð–ƒ×qðO:Øçà79èqpƒFÞWeZÄõv÷:èuð!€ ”ìG¸ÙÁBÀȵœ…$ð­÷¡9´ÞwSAp¸Œ ‚K¨dx’Ê•’âÇ ¨d¸u…ê/Ç÷F1Ó€$~.î¨ÄQ3ƒQ6‰Ž™eÆ#¹$ ,$y”dl9rOÛgKÕ¨qû*,T1Õ5…$[TÚOl²P¯#WA¸]jAžŽt‡Ò)³;:J©)/C¼¡´š÷¶Í'êŠ …W`"¥¿J’ÒRaÉI›bÔÙ¯¡|ƒ„¨yÊIõü{­Tb—:>û÷V£GâÚ!—ifüÔfTŠÏÚe^þw›T¢¬M/Øü¹´ß.Ë¡XË®ã¨=g±¡ìKî9‰r´™òÜmGL†iaƒiM¿{ÄÄÌéøaÕEײm|Û»DžŠ}Õ ªkÕðìØ§ðld½´[ð.ÐIÅûI ÆKb~c %ßD¦Œ^]Ÿ……ö¾ŽáEÇ®¯À²Œ¦í¶¸j~ëg¿ÿšÙ–ñ¼:…LùÍlå=Ý"ª«zT­S=_v:çÕñNçôXe£žà@ä¶ÁéNÓü«Ó4?¥â™ðå2|rdFõA§fzœšAb´jæ{  õ'ÒɘŸå:ó£±NÆ ÁZs ©#ê *â NŽœeõËÏÊ!VÔUéø ?üŸû(±÷™íÔ¿Ù#fD#kç"´g½Ÿ”@»b„Ý7×›’#ýá±gµ¶w­Þ°~sÏÊÿo2ü{/2møtñïßõšé8ö&c³¾ˆöM´ïŒ>?¡ƒ±òCŒM½&Å›ŒûU>ÃXÕhÿö ´o3V}ÚZ´+Ñ®AÛ¶‹±šçÐ^Eb¬ï–8—±†f´n´­ŒÍXFO»Ê öïZ“Ì3§™¡þí‹‹x:o2ÑÞ®j.x£‰öw•ò,Þ`¢£ÛyŸf¢þ5<#_ï_Ê y­Q^ÈÇñ©F=½œó*L¸«y ¯4êÎ^ÊãF½´œ—ñ £î(åå|²Ñ]|2/Goá¼Ì¨Û2yœOD]Î+9rH¯âŒ:¾Ws¬­’|*Çjhä5ëg ×r,œyÇŠ9žä  ^Èëy]=çÓ½¦sˆþÛxÇéÏ´¨[ø žCÏŸÉ!òïàËã¥R‹z9ŸÅ³Œ¾“Ïæ¤õk,ê«y—F?Í› –„ÑòÓ.ŒÁþÍç,d @á-kXú]¶_cû¤íóЃӃ}] ŠˆÓƒ;/˜ Ó%8Ý×S+…§ô”Ë, Níl–9œìÊ”yœ>²LJpz`©'‰ÓVY,‰Ó^Y"ÁéÝõ²T‚Ó#­²L‚Ó=å²\‚Ó9Y‚ÓƒIY!Áéí92.Áé§e¥§+e•$NËj N/S%qÚ,k$q:KÖJpz¸YÖIâtLõbY/ èêi2Ÿî5]‚ÓÛeƒ§s,ꤜ!sèù3%8Ý#%8=RnQ·ÊYœÞ-gKâ´Þ¢î•M’8•Í­y@žF°2‘s–@æAÙBЧÇ2-êr.A3 ®˜GÐã ÷É$AƒZ@Œîv:ÁN8˜Pæ œ¾Ïö]¶_`û"ô´NûÖÎ/´ëtÇùÅ"]§Ý5Bâ´»Ld âtG“È´N×J‘',§¢P§KÄ8Aœ®ÅÂr*J8½+!JqºB” pº»L” pÚ-& Z§IQ!ˆÓlÄ©¨à´]T ât‘¨Äé|1U§M¢F§¢V§M¢N§óE¨‰zQ@WOÄ©˜.ˆSÑ hf[ÔI1CPQ.f pº[4 â´Ì¢^!f pz—˜-ˆÓ„EÝ+šq*š VˆSqÁq*æ,Ð:-kÄ©´¨wˆ¹MâTÌ#èvP NE’ ÛA €Ö©8`‡ƒó°NÅ|ô}¶_kûù¶/DbàÁ]W·-l©)ÍËäÛòNðõõ®\œ¬//Ê‘8 íöEÉDYa¶ÀÝ”£I4ç'2óJkZ¶]½ëÁHÀi|0/¹fW?*³F>T´x{¿É4Í<ªîÚ‹"ª…G¥]ûM:Å`ãö£Æ Dkúù¶Ü3y\žÈ)*¯O.^ÙÛ÷½—,ZÐÕGÕ^£špÁ΃t/Õöì£{ɨ¼çº—lÞyÌÌß(³ë Ä½d\œÈ.,K$µ‡{‰ÁÂùkûì{‰¡âówØ÷QM·½—ˆÊºí½Ä`ÓÜ ß-’kûî%¶ÅšZºŠ;ÆÕ…Bi§sµüi(ì ®®VÐÔc¸ª¹u»Äñ— ©3¹*½¢s,GÍ=ÉdsÕÒEšÃUæmPzy\oƒVÍçÐå%¦€«…Ç¡á ¹J¾‰[ÄUãï8®P†ŽÇß/`Å8Õê®Jèê|SJ÷Ê3¹¾ r{"§R Ç”qÔæ9¦œžŸm&q}ø$¼ÕK&ËLæz9 ‚ë;ñ *ðî ª<ÎQÕK3…ë§ X¨äúQ|À…€*®÷Cµ–ª¹î7œ`•qp*×Û4jèŠ4‚.¥€Z®÷Bñ×ÒA Õ€:õc:Ôòh»ƒÅŠu\õÛ~—íר>I½Î3–e;R-=@ìHÕjÙ‘ª×²#UýÝÄŽ!v¤*ßCìHÝCìH•Ø‘z±ƒ·:BìHÝJìH™`ïnÙ‘º—Ø‘Žú Ø‘ú±#ÁØ‘úbGêeÄŽÔ‰‰L 2-RïtÐLìÐi=ʉ‰Š4FÐã –Ø‘ÑA,°Zítpƒ €:©Ú¾Ïö]¶_@½.ÉŽPK,;B­°ìÏŽP‰»ˆ·ìU¶›Øº›Ø*i׎PÙ–áØºØj‘eG¨ù–¡š,;‚ÖØÁß–œ·ì½ˆØ¡«ÁŽpìÇž`׎pìÐóÁŽÐ»‰¼•eGèÄŽÐw;xwËŽpìÇýìÇŽÐKˆáØŽáÖŽÐk-(iÙz‡ƒ&bG8vè=,”;±C-Ô;‚Ö6»h‡ƒóêÖõ}¶_kûùÔk2Áù®¤nuWS×FÝBêZ¨«¡®”º<ê°Iäôr= Hýu}ÔõR·’ºÅÔ%©«§®œº"ê°™äôJ= ýu}ÔõR×NÝ"ê’Ô%¨+£®:l:9½£6×ã½ Å1  (AJЀ4  (AJЀ4 „Pf¯Ç›AñaH R‚†” !%hH R‚†” !%hH ;¤Ì2Y/0¨ *AƒJР4¨ *AƒJР4¨ *a•YöO jT<ñXÄcË÷ÑË^JS\µ¤økKqº+Å31îzPëkF¨xRô^Þ‹}/ý©ðeÁp‘@%ƒ/ †Ë *.|©‘*<\âË_¤`ôà )OÍšdj&­LÍ®¾ÔŒ£¹çi§]#D+ X¯f‡µ­Wº¤{½ ÖĤ½^VϤ¥½²Nél'»½ ÷šC 2Ã\-KÍßdjN·§æy_jîÓ*pú+h±µ#4é5/Þ†¥œv$ó¼è–€$½<‹$½LÉJ§2½èôôŸšx¤ÉÖLijµ¤ÖV[j½íJ­ÁÚ¨ó†·k¿uï [ºß߇w{¿÷“¨qº`X%fð bXOºðZÃ+ DRºÄfZ €¦ZX¹å©ÕœL­ð•©Uß—Ê´— ïh~wë »žß‡7D¿=ÒfYã¶Îá”·ßd‡·\Jñ~;ö›sØ«S[·ÝÈ1šh!”¥rJ2•gÚS¹§/•(Ý'}¿ô…ÁïÃ{†ßAh?©q»Ëð^càö¡á]ÉÀíX~ÿ ÛYjw³ x»Þ»ðN†÷5¼Ëá=`xGÄû#Á.ñî‰÷R¼³Œï»xÆ{2Þ¡ †M0p‚¡ ž`øÈûAÞ fQ0¼—¬¥`5ë)XQÁš VU°®R^VÊÝJù])lNÊKŸì ãïx×À{ÞQðþ‚w‚ùà½ïL£ÂûÞÅðžF°8¼ãáýï†xo$X%Á: VJ°V‚Õ¬ïÄx_&Ø4Á¶ñ.N0u‚ÉLŸ`S(˜DÁ4J¹H)_)å4¥¼§9);**÷5]iNº¯×}õîky_Ùû:?”ýÞðž@°¼càýï&sÁ{ Þyð>„w%‚IL‹`bS#˜ÁôðˆwD‚A ïŸ;%Ø+Án öK°c‚=ìš”“rtROÊõ™“2‚’Á:ÃlËz˜²š8ÉQÆB“Ä!1ÊZh-o2ÿÕ9ó‚S0'x)7aØ`á:œâHàNΘ|‚9Á9Hy ÃöÂÏá?wr®À¼àÌ ¾AÊI6F8§¸¾„öµ/¯}±íKo_ˆû²÷Õº¯ÝC)JûPê‡Ò?XÁðN÷ ‚lï2Ó!˜Á”&E0-‚‰AE³ý(®`ôå£/&}ié M_vú"4Ô¤¾Dõk¨_}9ë‹[_ê†Ê×¾,öE²/™C*êPa‡Š;Tà¡"÷º/×Cõªy_܇Z?ÔþÁ Þ@ð ‚w> c싾ѿ…¾Ñ¿©¾±ÿd º1cmtk-3.0.0/Utilities/mxml/doc/mxml.book0000644000177700000170000000163511210045173017034 0ustar torstenman#HTMLDOC 1.8.27.1 -t pdf14 -f "mxml.pdf" --book --toclevels 3 --no-numbered --toctitle "Table of Contents" --title --titleimage "title.html" --linkstyle plain --size 4.25x6.875in --left 0.750in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --header1 ... --footer h.1 --nup 1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=95 --fontsize 9.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Helvetica --headfootsize 8.0 --headfootfont Helvetica-Oblique --charset iso-8859-1 --links --embedfonts --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 300 --no-strict --no-overflow intro.html install.html basics.html advanced.html mxmldoc.html license.html relnotes.html reference.html schema.html cmtk-3.0.0/Utilities/mxml/doc/3.gif0000644000177700000170000000265211210045173016034 0ustar torstenmanGIF89addç  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþÿ H°`A5*\Ȱ¡Ã‡#*Tc°¢Å‹‡IÜȱ£ÇÃ0мhå£É“(­Œ\ù¯Ê—0;öay1¦Í›i$…³§Ï„¤tþkò³(Î&4a]jÆJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®búUÎ^»g¨€UXÑ%V]4ûÕà:³àUDB ÚÃZ°$SGy-JU9)‚ÀñD¨Ñ(Ä"ï1 ùoi(È+™ 4ºóÊ~K7ÿ¼à™e*£ÿþ,MÓ¨jŸåX·^{R6Í´?*Ó™À¡(¡¹=Ò¬ QgðŽ,‘³$~<âï‘':F`É«yÄä±[w¸rÊÇ9Ú·þ3Ìl2¼x¶#k“?¿p}öôìÛÃ÷ê>~}ŽæÙß߸’_|©$¬ÆQͳ=å‡ NѬÄÜ‚>™  „0=1!…(Ñ4†19ðŠN,pXdˆ8b`&ª'”.)ª¨Ó$-ž˜—1*‡˜?5òç9æT=rÇA.„ÀxCË V$G…Ï“i “Tâ7[–Å]È¥B®TÈ—]HfB.xy¦šd²ù¥›`ÁÙœ\Ñ)ß|çÙ‰žâ陟‹™Ñ€j&æIþºÔ=v¦¨QC°4æ{#AAàp6 zœNOè¸e|'UÂCô‚¶·` ©²´…‘­Ž¤‡±b$b¨µDäO¯ùdF®=èEK=,n¨U¶”¹*Õ>©*hcLAÀš1WQ¦¬TØ€| äV IJ’87€EXagÊ([írT—]ñjYQ½eVd¾ iuTü*D•HJ|€S,\ïÀ,íÛ®¿ª®‰¼TÎëÙ¸=®kµ-j l¯RX@;cmtk-3.0.0/Utilities/mxml/doc/intro.man0000644000177700000170000001151611747570117017052 0ustar torstenman.SH INCLUDE FILE #include .SH LIBRARY \-lmxml .SH DESCRIPTION Mini-XML is a small XML parsing library that you can use to read XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a "make" program. .PP Mini-XML provides the following functionality: .IP \(bu 4 Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings. .IP \(bu 4 Data is stored in a linked-list tree structure, preserving the XML data hierarchy. .IP \(bu 4 Supports arbitrary element names, attributes, and attribute values with no preset limits, just available memory. .IP \(bu 4 Supports integer, real, opaque ("CDATA"), and text data types in "leaf" nodes. .IP \(bu 4 Functions for creating, indexing, and managing trees of data. .IP \(bu 4 "Find" and "walk" functions for easily locating and navigating trees of data. .PP Mini-XML doesn't do validation or other types of processing on the data based upon schema files or other sources of definition information, nor does it support character entities other than those required by the XML specification. .SH USING MINI-XML Mini-XML provides a single header file which you include: .nf #include .fi .PP Nodes are defined by the "mxml_node_t" structure; the "type" member defines the node type (element, integer, opaque, real, or text) which determines which value you want to look at in the "value" union. New nodes can be created using the "mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()", "mxmlNewReal()", and "mxmlNewText()" functions. Only elements can have child nodes, and the top node must be an element, usually "?xml". .PP You load an XML file using the "mxmlLoadFile()" function: .nf FILE *fp; mxml_node_t *tree; fp = fopen("filename.xml", "r"); tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK); fclose(fp); .fi .PP Similarly, you save an XML file using the "mxmlSaveFile()" function: .nf FILE *fp; mxml_node_t *tree; fp = fopen("filename.xml", "w"); mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); fclose(fp); .fi .PP The "mxmlLoadString()", "mxmlSaveAllocString()", and "mxmlSaveString()" functions load XML node trees from and save XML node trees to strings: .nf char buffer[8192]; char *ptr; mxml_node_t *tree; ... tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK); ... mxmlSaveString(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK); ... ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); .fi .PP You can find a named element/node using the "mxmlFindElement()" function: .nf mxml_node_t *node = mxmlFindElement(tree, tree, "name", "attr", "value", MXML_DESCEND); .fi .PP The "name", "attr", and "value" arguments can be passed as NULL to act as wildcards, e.g.: .nf /* Find the first "a" element */ node = mxmlFindElement(tree, tree, "a", NULL, NULL, MXML_DESCEND); /* Find the first "a" element with "href" attribute */ node = mxmlFindElement(tree, tree, "a", "href", NULL, MXML_DESCEND); /* Find the first "a" element with "href" to a URL */ node = mxmlFindElement(tree, tree, "a", "href", "http://www.easysw.com/~mike/mxml/", MXML_DESCEND); /* Find the first element with a "src" attribute*/ node = mxmlFindElement(tree, tree, NULL, "src", NULL, MXML_DESCEND); /* Find the first element with a "src" = "foo.jpg" */ node = mxmlFindElement(tree, tree, NULL, "src", "foo.jpg", MXML_DESCEND); .fi .PP You can also iterate with the same function: .nf mxml_node_t *node; for (node = mxmlFindElement(tree, tree, "name", NULL, NULL, MXML_DESCEND); node != NULL; node = mxmlFindElement(node, tree, "name", NULL, NULL, MXML_DESCEND)) { ... do something ... } .fi .PP To find the value of a specific node in the tree, use the "mxmlFindPath()" function: .nf mxml_node_t *value = mxmlFindPath(tree, "path/to/*/foo/bar"); .fi .PP The "mxmlGetInteger()", "mxmlGetOpaque()", "mxmlGetReal()", and "mxmlGetText()" functions retrieve the value from a node: .nf mxml_node_t *node; int intvalue = mxmlGetInteger(node); const char *opaquevalue = mxmlGetOpaque(node); double realvalue = mxmlGetReal(node); int whitespacevalue; const char *textvalue = mxmlGetText(node, &whitespacevalue); .fi .PP Finally, once you are done with the XML data, use the "mxmlDelete()" function to recursively free the memory that is used for a particular node or the entire tree: .nf mxmlDelete(tree); .fi cmtk-3.0.0/Utilities/mxml/doc/2.gif0000644000177700000170000000261111210045173016026 0ustar torstenmanGIF89addç  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþÿ H°`A5*\Ȱ¡Ã‡#*Tc°¢Å‹‡IÜȱ£ÇÃ0мhå£É“(­Œ\ù¯Ê—0;öay1¦Í›i$…³§Ï„¤tþkò³(Î&4a]jÆJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9VtÉÕ‹¿•vºÎ,ˆuŽÐÁ°,µÕÛŠRUŒ:âîEwQj\ͯH KCþcÊÏðÈ0K.Ýçx¥ £’‹&«Ì2HÑjàL³h蟤u†=y)5M<«½êôW‚á’·±;fQ QN9¹7Ò\'¶tðˆÆ‹¯<ÑËXbî0ÞJv&“SWøÜäîÛ¹þ/? >üòÑo_ ¥zê+¸oþüÈóGÖO¸2A~‘ûÙàH_vøY‚ ö„À{ ÚÏJÑD¸àHþYØÓ=jxÒw+‰âáMv8bz,½qbL¼­xR-ºøQ :a £I¡èDÅ5FÓ<¢H“Ar„…P7¹Q=BA dD0 õdD•5Ï”9 5–9'\6dNô„ÙÐ[;š©Rª©"BçfB›é8gB…é樴yg:Ás§x,Y3(4•sèpjwgŒwŠBÓ'‹ è¤Ûap)nûµ)¦ð} *s¢Žœ ¥:JÝ,©š[«p®zt‹°êwE8Õj«M™ñªk7õJë¯åúÏ`ÃkÐMŠ-V©pÑõìCzí5íC‘uíBk±µíB_m[Õ·Z]Õ³T‰¤T¥N±tîé²dÕœåúifeÚNÙmeÒY­kȺØlª³*HÑ];cmtk-3.0.0/Utilities/mxml/doc/1.gif0000644000177700000170000000237011210045173016027 0ustar torstenmanGIF89addç  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþÿ H°`A5*\Ȱ¡Ã‡#*Tc°¢Å‹‡IÜȱ£ÇÃ0мhå£É“(­Œ\ù¯Ê—0;öay1¦Í›i$…³§Ï„¤tþkò³(Î&4a]jÆJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9Vt¶lÄ™Í6ü*µ`Iµ ©°ªr Ü…»Ôx÷€…¼\Cþë›P$X„iÖ;ø.‘‡Âý±¬dµ½XÆÚ@çæ¨„6þìsD:шIŸT EIèPT}RöbÚmÆÝQ÷\Þ}[Þ[ølâG\9Aæ?‡žSzjê75cÏ^y»MíÞaÞ‚r>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþÿ H°`A5*\Ȱ¡Ã‡#*Tc°¢Å‹‡IÜȱ£ÇÃ0мhå£É“(­Œ\ù¯Ê—0;öay1¦Í›i$…³§Ï„¤tþkò³(Î&4a]jÆJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ® ydªæÎÝ5MDÀ*¬è’k–”ºÎ,ˆÐ°,)uß]ºRU”*äoE?RjdzͰÅ{QCþ‹ªÏ1ƨ™Þ³,’if£’9_<·ô¢'DLbôtQÕ+ÕÂ4{$dÙ'uâhD'n“ìXÆ‹(%¿ß…oŒÇ9Ç1Í9²äã\"K !D¯þp»ôØÜþ¦©äc••6Â7üÞëHtêzï8_}ý÷¹¯|vÒWûø3¬äšGçTC| ²v&Ù5Ò&ÐÏO„ùáG¡~ÒסsZ÷!r!FT¢l'v7âo):ÔbW/Ê·"n1.TãU7&”#f3æÔ£Z;îèÙ. £‘2Ž„!’62‰£“:BÉ£’( Yš”V¤”CR™—WziR–¯a ¦–fŠÞ–jrئ‡o:çMšá+)eU"¡ƒ"]rR,+åµdœ&žfgc*Š&¢>BŠœ&+…ðQ+qaB€2 §§›ÆH&SÉ>›*”K»lÔ K²¤ºKÄDD M²*dŠN4T‚N‚ä:km æj±•!l“ÈV´l’ÍöìB6D;ÐL øÓ\Í~‘ídLÙÑ-R­@¬‰›®hzý³˜THX6V¡uuÄ]U)_]É1 j &í´]ÔÁEqKÂİOU=|“VA%1J|b¤çÅ9Å’Åo”ñJV…ÅB™©a«|€Â–ñ˱Àµ½ËphÖš¶,E;cmtk-3.0.0/Utilities/mxml/doc/mxmldoc.xsd0000644000177700000170000001551211747570117017405 0ustar torstenman Mini-XML 2.7 documentation schema for mxmldoc output. Copyright 2003-2011 by Michael Sweet. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2, 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. cmtk-3.0.0/Utilities/mxml/doc/makedocs.sh0000755000177700000170000000142211747570117017342 0ustar torstenman#!/bin/sh # # "$Id: makedocs.sh 408 2010-09-19 05:26:46Z mike $" # # Script to make documentation... # # Copyright 2003-2010 by Michael R Sweet. # # These coded instructions, statements, and computer programs are the # property of Michael R Sweet and are protected by Federal copyright # law. Distribution and use rights are outlined in the file "COPYING" # which should have been included with this file. If this file is # missing or damaged, see the license at: # # http://www.minixml.org/ # htmldoc --verbose --path "hires;." --batch mxml.book -f mxml.pdf htmldoc --verbose --batch mxml.book --no-title -f mxml.html rm -rf mxml.d mkdir mxml.d htmldoc --verbose --batch mxml.book --no-title -t html -d mxml.d # # End of "$Id: makedocs.sh 408 2010-09-19 05:26:46Z mike $". # cmtk-3.0.0/Utilities/mxml/doc/intro.html0000644000177700000170000001250711747570117017244 0ustar torstenman Mini-XML Programmers Manual, Version 2.7

    0Introduction

    This programmers manual describes Mini-XML version 2.7, a small XML parsing library that you can use to read and write XML data files in your C and C++ applications.

    Mini-XML was initially developed for the Gutenprint project to replace the rather large and unwieldy libxml2 library with something substantially smaller and easier-to-use. It all began one morning in June of 2003 when Robert posted the following sentence to the developer's list:

    It's bad enough that we require libxml2, but rolling our own XML parser is a bit more than we can handle.

    I then replied with:

    Given the limited scope of what you use in XML, it should be trivial to code a mini-XML API in a few hundred lines of code.

    I took my own challenge and coded furiously for two days to produced the initial public release of Mini-XML, total lines of code: 696. Robert promptly integrated Mini-XML into Gutenprint and removed libxml2.

    Thanks to lots of feedback and support from various developers, Mini-XML has evolved since then to provide a more complete XML implementation and now stands at a whopping 3,965 lines of code, compared to 103,893 lines of code for libxml2 version 2.6.9.

    Aside from Gutenprint, Mini-XML is used for the following projects/software applications:

    Please email me (mxml @ easysw . com) if you would like your project added or removed from this list, or if you have any comments/quotes you would like me to publish about your experiences with Mini-XML.

    Organization of This Document

    This manual is organized into the following chapters and appendices:

    Notation Conventions

    Various font and syntax conventions are used in this guide. Examples and their meanings and uses are explained below:

    mxmldoc
    mxmldoc(1)
    The names of commands; the first mention of a command or function in a chapter is followed by a manual page section number.

    /var
    /etc/hosts
    File and directory names.

    Request ID is Printer-123
    Screen output.

    lp -d printer filename ENTER
    Literal user input; special keys like ENTER are in ALL CAPS.

    12.3
    Numbers in the text are written using the period (.) to indicate the decimal point.

    Abbreviations

    The following abbreviations are used throughout this manual:

    Gb
    Gigabytes, or 1073741824 bytes

    kb
    Kilobytes, or 1024 bytes

    Mb
    Megabytes, or 1048576 bytes

    UTF-8, UTF-16
    Unicode Transformation Format, 8-bit or 16-bit

    W3C
    World Wide Web Consortium

    XML
    Extensible Markup Language

    Other References

    The Unicode Standard, Version 4.0, Addison-Wesley, ISBN 0-321-18578-1
    The definition of the Unicode character set which is used for XML.

    Extensible Markup Language (XML) 1.0 (Third Edition)
    The XML specification from the World Wide Web Consortium (W3C)

    Legal Stuff

    The Mini-XML library is copyright 2003-2011 by Michael Sweet. License terms are described in Appendix A - Mini-XML License.

    cmtk-3.0.0/Utilities/mxml/doc/relnotes.html0000644000177700000170000003502211747570117017741 0ustar torstenman

    BRelease Notes

    Changes in Mini-XML 2.7

    • Added 64-bit configurations to the VC++ project files (STR #129)
    • Fixed conformance of mxmldoc's HTML and CSS output.
    • Added data accessor ("get") functions and made the mxml_node_t and mxml_index_t structures private but still available in the Mini-XML header to preserve source compatibility (STR #118)
    • Updated the source headers to reference the Mini-XML license and its exceptions to the LGPL2 (STR #108)
    • Added a new mxmlFindPath() function to find the value node of a named element (STR #110)
    • Building a static version of the library did not work on Windows (STR #112)
    • The shared library did not include a destructor for the thread- specific data key on UNIX-based operating systems (STR #103)
    • mxmlLoad* did not error out on XML with multiple root nodes (STR #101)
    • Fixed an issue with the _mxml_vstrdupf function (STR #107)
    • mxmlSave* no longer write all siblings of the passed node, just that node and its children (STR #109)

    Changes in Mini-XML 2.6

    • Documentation fixes (STR #91, STR #92)
    • The mxmldoc program did not handle typedef comments properly (STR #72)
    • Added support for "long long" printf formats.
    • The XML parser now ignores BOMs in UTF-8 XML files (STR #89)
    • The mxmldoc program now supports generating Xcode documentation sets.
    • mxmlSave*() did not output UTF-8 correctly on some platforms.
    • mxmlNewXML() now adds encoding="utf-8" in the ?xml directive to avoid problems with non-conformant XML parsers that assume something other than UTF-8 as the default encoding.
    • Wrapping was not disabled when mxmlSetWrapMargin(0) was called, and "<?xml ... ?>" was always followed by a newline (STR #76)
    • The mxml.pc.in file was broken (STR #79)
    • The mxmldoc program now handles "typedef enum name {} name" correctly (STR #72)

    Changes in Mini-XML 2.5

    • The mxmldoc program now makes greater use of CSS and supports a --css option to embed an alternate stylesheet.
    • The mxmldoc program now supports --header and --footer options to insert documentation content before and after the generated content.
    • The mxmldoc program now supports a --framed option to generate framed HTML output.
    • The mxmldoc program now creates a table of contents including any headings in the --intro file when generating HTML output.
    • The man pages and man page output from mxmldoc did not use "\-" for dashes (STR #68)
    • The debug version of the Mini-XML DLL could not be built (STR #65)
    • Processing instructions and directives did not work when not at the top level of a document (STR #67)
    • Spaces around the "=" in attributes were not supported (STR #67)

    Changes in Mini-XML 2.4

    • Fixed shared library build problems on HP-UX and Mac OS X.
    • The mxmldoc program did not output argument descriptions for functions properly.
    • All global settings (custom, error, and entity callbacks and the wrap margin) are now managed separately for each thread.
    • Added mxmlElementDeleteAttr() function (STR #59)
    • mxmlElementSetAttrf() did not work (STR #57)
    • mxmlLoad*() incorrectly treated declarations as parent elements (STR #56)
    • mxmlLoad*() incorrectly allowed attributes without values (STR #47)
    • Fixed Visual C++ build problems (STR #49)
    • mxmlLoad*() did not return NULL when an element contained an error (STR #46)
    • Added support for the apos character entity (STR #54)
    • Fixed whitespace detection with Unicode characters (STR #48)
    • mxmlWalkNext() and mxmlWalkPrev() did not work correctly when called with a node with no children as the top node (STR #53)

    Changes in Mini-XML 2.3

    • Added two exceptions to the LGPL to support static linking of applications against Mini-XML
    • The mxmldoc utility can now generate man pages, too.
    • Added a mxmlNewXML() function
    • Added a mxmlElementSetAttrf() function (STR #43)
    • Added a snprintf() emulation function for the test program (STR #32)
    • Added the _CRT_SECURE_NO_DEPRECATE definition when building on VC++ 2005 (STR #36)
    • mxmlLoad*() did not detect missing > characters in elements (STR #41)
    • mxmlLoad*() did not detect missing close tags at the end of an XML document (STR #45)
    • Added user_data and ref_count members to mxml_node_t structure
    • Added mxmlReleaseNode() and mxmlRetainNode() APIs for reference-counted nodes
    • Added mxmlSetWrapMargin() to control the wrapping of XML output
    • Added conditional check for EINTR error code for certain Windows compilers that do not define it (STR #33)
    • The mxmldoc program now generates correct HTML 4.0 output - previously it generated invalid XHTML
    • The mxmldoc program now supports "@deprecated@, "@private@", and "@since version@" comments
    • Fixed function and enumeration type bugs in mxmldoc
    • Fixed the XML schema for mxmldoc
    • The mxmldoc program now supports --intro, --section, and --title options
    • The mxmlLoad*() functions could leak a node on an error (STR #27)
    • The mxml_vsnprintf() function could get in an infinite loop on a buffer overflow (STR #25)
    • Added new mxmlNewCDATA() and mxmlSetCDATA() functions to create and set CDATA nodes, which are really just special element nodes
    • Added new MXML_IGNORE type and MXML_IGNORE_CB callback to ignore non-element nodes, e.g. whitespace
    • mxmlLoad*() did not treat custom data as opaque, so whitespace characters would be lost

    Changes in Mini-XML 2.2.2

    • mxmlLoad*() did not treat custom data as opaque, so whitespace characters would be lost.

    Changes in Mini-XML 2.2.1

    • mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now correctly return NULL on error (STR #21)
    • mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), and mxmlNewTextf() incorrectly required a parent node (STR #22)
    • Fixed an XML output bug in mxmldoc.
    • The "make install" target now uses the install command to set the proper permissions on UNIX/Linux/OSX.
    • Fixed a MingW/Cygwin compilation problem (STR #18)

    Changes in Mini-XML 2.2

    • Added shared library support (STR #17)
    • mxmlLoad*() now returns an error when an XML stream contains illegal control characters (STR #10)
    • mxmlLoad*() now returns an error when an element contains two attributes with the same name in conformance with the XML spec (STR #16)
    • Added support for CDATA (STR #14, STR #15)
    • Updated comment and processing instruction handling - no entity support per XML specification.
    • Added checking for invalid comment termination ("--->" is not allowed)

    Changes in Mini-XML 2.1

    • Added support for custom data nodes (STR #6)
    • Now treat UTF-8 sequences which are longer than necessary as an error (STR #4)
    • Fixed entity number support (STR #8)
    • Fixed mxmlLoadString() bug with UTF-8 (STR #7)
    • Fixed entity lookup bug (STR #5)
    • Added mxmlLoadFd() and mxmlSaveFd() functions.
    • Fixed multi-word UTF-16 handling.

    Changes in Mini-XML 2.0

    • New programmers manual.
    • Added Visual C++ project files for Microsoft Windows users.
    • Added optimizations to mxmldoc, mxmlSaveFile(), and mxmlIndexNew() (STR #2)
    • mxmlEntityAddCallback() now returns an integer status (STR #2)
    • Added UTF-16 support (input only; all output is UTF-8)
    • Added index functions to build a searchable index of XML nodes.
    • Added character entity callback interface to support additional character entities beyond those defined in the XHTML specification.
    • Added support for XHTML character entities.
    • The mxmldoc utility now produces XML output which conforms to an updated XML schema, described in the file "doc/mxmldoc.xsd".
    • Changed the whitespace callback interface to return strings instead of a single character, allowing for greater control over the formatting of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.
    • The mxmldoc utility now produces XML output which conforms to an updated XML schema, described in the file "doc/mxmldoc.xsd".
    • Changed the whitespace callback interface to return strings instead of a single character, allowing for greater control over the formatting of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.
    • The mxmldoc utility is now capable of documenting C++ classes, functions, and structures, and correctly handles C++ comments.
    • Added new modular tests for mxmldoc.
    • Updated the mxmldoc output to be more compatible with embedding in manuals produced with HTMLDOC.
    • The makefile incorrectly included a "/" separator between the destination path and install path. This caused problems when building and installing with MingW.

    Changes in Mini-XML 1.3

    • Fixes for mxmldoc.
    • Added support for reading standard HTML entity names.
    • mxmlLoadString/File() did not decode character entities in element names, attribute names, or attribute values.
    • mxmlLoadString/File() would crash when loading non- conformant XML data under an existing parent (top) node.
    • Fixed several bugs in the mxmldoc utility.
    • Added new error callback function to catch a variety of errors and log them to someplace other than stderr.
    • The mxmlElementSetAttr() function now allows for NULL attribute values.
    • The load and save functions now properly handle quoted element and attribute name strings properly, e.g. for !DOCTYPE declarations.

    Changes in Mini-XML 1.2

    • Added new "set" methods to set the value of a node.
    • Added new formatted text methods mxmlNewTextf() and mxmlSetTextf() to create/set a text node value using printf-style formats.
    • Added new standard callbacks for use with the mxmlLoad functions.
    • Updated the HTML documentation to include examples of the walk and load function output.
    • Added --with/without-ansi configure option to control the strdup() function check.
    • Added --with/without-snprintf configure option to control the snprintf() and vsnprintf() function checks.

    Changes in Mini-XML 1.1.2

    • The mxml(3) man page wasn't updated for the string functions.
    • mxmlSaveString() returned the wrong number of characters.
    • mxml_add_char() updated the buffer pointer in the wrong place.

    Changes in Mini-XML 1.1.1

    • The private mxml_add_ch() function did not update the start-of-buffer pointer which could cause a crash when using mxmlSaveString().
    • The private mxml_write_ws() function called putc() instead of using the proper callback which could cause a crash when using mxmlSaveString().
    • Added a mxmlSaveAllocString() convenience function for saving an XML node tree to an allocated string.

    Changes in Mini-XML 1.1

    • The mxmlLoadFile() function now uses dynamically allocated string buffers for element names, attribute names, and attribute values. Previously they were capped at 16383, 255, and 255 bytes, respectively.
    • Added a new mxmlLoadString() function for loading an XML node tree from a string.
    • Added a new mxmlSaveString() function for saving an XML node tree to a string.
    • Add emulation of strdup() if the local platform does not provide the function.

    Changes in Mini-XML 1.0

    • The mxmldoc program now handles function arguments, structures, unions, enumerations, classes, and typedefs properly.
    • Documentation provided via mxmldoc and more in-line comments in the code.
    • Added man pages and packaging files.

    Changes in Mini-XML 0.93

    • New mxmldoc example program that is also used to create and update code documentation using XML and produce HTML reference pages.
    • Added mxmlAdd() and mxmlRemove() functions to add and remove nodes from a tree. This provides more flexibility over where the nodes are inserted and allows nodes to be moved within the tree as needed.
    • mxmlLoadFile() now correctly handles comments.
    • mxmlLoadFile() now supports the required "gt", "quot", and "nbsp" character entities.
    • mxmlSaveFile() now uses newlines as whitespace when valid to do so.
    • mxmlFindElement() now also takes attribute name and attribute value string arguments to limit the search to specific elements with attributes and/or values.
    • NULL pointers can be used as "wildcards".
    • Added uninstall target to makefile, and auto-reconfig if Makefile.in or configure.in are changed.
    • mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev() now all provide "descend" arguments to control whether they descend into child nodes in the tree.
    • Fixed some whitespace issues in mxmlLoadFile().
    • Fixed Unicode output and whitespace issues in mxmlSaveFile().
    • mxmlSaveFile() now supports a whitespace callback to provide more human-readable XML output under program control.

    Changes in Mini-XML 0.92

    • mxmlSaveFile() didn't return a value on success.

    Changes in Mini-XML 0.91

    • mxmlWalkNext() would go into an infinite loop.

    Changes in Mini-XML 0.9

    • Initial public release.
    cmtk-3.0.0/Utilities/mxml/doc/license.html0000644000177700000170000006523111747570117017535 0ustar torstenman

    AMini-XML License

    The Mini-XML library and included programs are provided under the terms of the GNU Library General Public License version 2 (LGPL2) with the following exceptions:

    1. Static linking of applications to the Mini-XML library does not constitute a derivative work and does not require the author to provide source code for the application, use the shared Mini-XML libraries, or link their applications against a user-supplied version of Mini-XML.

    If you link the application to a modified version of Mini-XML, then the changes to Mini-XML must be provided under the terms of the LGPL2 in sections 1, 2, and 4.

    2. You do not have to provide a copy of the Mini-XML license with programs that are linked to the Mini-XML library, nor do you have to identify the Mini-XML license in your program or documentation as required by section 6 of the LGPL2.

     

    GNU LIBRARY GENERAL PUBLIC LICENSE

    Version 2, June 1991
    Copyright (C) 1991 Free Software Foundation, Inc.
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
    [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.]

    Preamble

    The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.

    This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too.

    When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

    To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it.

    For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights.

    Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library.

    Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations.

    Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

    Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license.

    The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such.

    Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better.

    However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries.

    The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the libary" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library.

    Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one.

    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you".

    A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.

    The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)

    "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.

    Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.

    1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.

    You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

    2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

      a) The modified work must itself be a software library.

      b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.

      c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.

      d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.

      (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)

    These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

    Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.

    In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

    3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.

    Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.

    This option is useful when you wish to copy part of the code of the Library into a program that is not a library.

    4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.

    If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.

    5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.

    However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.

    When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.

    If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)

    Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.

    6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.

    You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:

      a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)

      b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.

      c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.

      d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.

    For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

    It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.

    7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:

      a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.

      b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

    8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

    9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.

    10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

    11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.

    If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.

    It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

    This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

    12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

    13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

    Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.

    14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

    NO WARRANTY

    15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

    16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

    END OF TERMS AND CONDITIONS

    How to Apply These Terms to Your New Libraries

    If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).

    To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

      one line to give the library's name and an idea of what it does.
      Copyright (C) year name of author

      This library 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 2.1 of the License, or (at your option) any later version.

      This library 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 Lesser General Public License for more details.

      You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

    Also add information on how to contact you by electronic and paper mail.

    You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:

      Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker.

      signature of Ty Coon, 1 April 1990 Ty Coon, President of Vice

    That's all there is to it! cmtk-3.0.0/Utilities/mxml/doc/mxmldoc.man0000644000177700000170000001020511210045173017334 0ustar torstenman.\" .\" "$Id: mxmldoc.man 390 2009-05-05 13:38:00Z mike $" .\" .\" mxmldoc man page for mini-XML, a small XML-like file parsing library. .\" .\" Copyright 2003-2009 by Michael Sweet. .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU Library General Public .\" License as published by the Free Software Foundation; either .\" version 2, 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. .\" .TH mxmldoc 1 "Mini-XML" "4 May 2009" "Michael Sweet" .SH NAME mxmldoc \- mini-xml documentation generator .SH SYNOPSIS .B mxmldoc \-\-no-output [ .I filename.xml ] .I source file(s) ] .br .B mxmldoc [ \-\-footer .I footerfile ] [ \-\-header .I headerfile ] [ \-\-intro .I introfile ] [ \-\-section .I section ] [ \-\-title .I title ] [ .I filename.xml ] [ .I source file(s) ] > .I filename.html .br .B mxmldoc \-\-docset .I directory.docset [ \-\-docversion .I version ] [ \-\-feedname .I name ] [ \-\-feedurl .I url ] [ \-\-footer .I footerfile ] [ \-\-header .I headerfile ] [ \-\-intro .I introfile ] [ \-\-section .I section ] [ \-\-title .I title ] [ .I filename.xml ] [ .I source file(s) ] .br .B mxmldoc \-\-tokens .I path [ .I filename.xml ] [ .I source file(s) ] > tokens.xml .br .B mxmldoc \-\-framed .I basename [ \-\-footer .I footerfile ] [ \-\-header .I headerfile ] [ \-\-intro .I introfile ] [ \-\-section .I section ] [ \-\-title .I title ] [ .I filename.xml ] [ .I source file(s) ] .br .B mxmldoc [ \-\-footer .I footerfile ] [ \-\-header .I headerfile ] [ \-\-intro .I introfile ] \-\-man .I manpage [ \-\-section .I section ] [ \-\-title .I title ] [ .I filename.xml ] [ .I source file(s) ] > .I filename.man .SH DESCRIPTION \fImxmldoc\fR scans the specified C and C++ source files to produce an XML representation of globally accessible classes, constants, enumerations, functions, structures, typedefs, unions, and variables - the XML file is updated as necessary. By default, a HTML representation of the XML file is written to the standard output. Use the \fI\-\-no-output\fR option to disable the HTML output. .PP Man page source can be generated using the \fI\-\-man\fR option. .PP If no source files are specified then the current XML file is converted to the standard output. .PP In general, any C or C++ source code is handled by \fImxmldoc\fR, however it was specifically written to handle code with documentation that is formatted according to the CUPS Developer Guide which is available at "http://www.cups.org/documentation.php". .SH OPTIONS .TP 5 \-\-docset directory.docset .br Creates an Xcode documentation set in the specified directory. .TP 5 \-\-docversion version .br Specifies the version number for the Xcode documentation set. .TP 5 \-\-feedname name .br Specifies the Xcode documentation set feed name, typically the project or company name. .TP 5 \-\-feedurl url .br Specifies the Xcode documentation set feed URL which must point to an ATOM file linking to updates. .TP 5 \-\-footer footerfile .br Inserts the specified file at the bottom of the output documentation. .TP 5 \-\-framed basename .br Creates HTML documentation using frames - one for the table-of-contents and one for the body. .TP 5 \-\-header headerfile .br Inserts the specified file at the top of the output documentation. .TP 5 \-\-intro introfile .br Inserts the specified file before the table of contents. .TP 5 \-\-man manpage .br Generated a man page instead of HTML documentation. .TP 5 \-\-no-output .br Disables generation of documentation on the standard output. .TP 5 \-\-section section .br Sets the section/keywords in the output documentation. .TP 5 \-\-title title .br Sets the title of the output documentation. .TP 5 \-\-tokens .br Generates a Tokens.xml file for use with the Xcode documentation tools. .SH SEE ALSO mxml(3), Mini-XML Programmers Manual, http://www.minixml.org/ .SH COPYRIGHT Copyright 2003-2009 by Michael Sweet. .\" .\" End of "$Id: mxmldoc.man 390 2009-05-05 13:38:00Z mike $". .\" cmtk-3.0.0/Utilities/mxml/doc/docset.intro0000644000177700000170000001215711747570117017562 0ustar torstenman

    Introduction

    Mini-XML is a small XML parsing library that you can use to read XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a "make" program.

    Mini-XML provides the following functionality:

    • Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings.
    • Data is stored in a linked-list tree structure, preserving the XML data hierarchy.
    • Supports arbitrary element names, attributes, and attribute values with no preset limits, just available memory.
    • Supports integer, real, opaque ("CDATA"), and text data types in "leaf" nodes.
    • Functions for creating, indexing, and managing trees of data.
    • "Find" and "walk" functions for easily locating and navigating trees of data.

    Mini-XML doesn't do validation or other types of processing on the data based upon schema files or other sources of definition information, nor does it support character entities other than those required by the XML specification.

    Using Mini-XML

    Mini-XML provides a single header file which you include:

    #include <mxml.h>
    

    Nodes are defined by the "mxml_node_t" structure; the "type" member defines the node type (element, integer, opaque, real, or text) which determines which value you want to look at in the "value" union. New nodes can be created using the "mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()", "mxmlNewReal()", and "mxmlNewText()" functions. Only elements can have child nodes, and the top node must be an element, usually "?xml".

    You load an XML file using the "mxmlLoadFile()" function:

    FILE *fp;
    mxml_node_t *tree;
    
    fp = fopen("filename.xml", "r");
    tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK);
    fclose(fp);
    

    Similarly, you save an XML file using the "mxmlSaveFile()" function:

    FILE *fp;
    mxml_node_t *tree;
    
    fp = fopen("filename.xml", "w");
    mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
    fclose(fp);
    

    The "mxmlLoadString()", "mxmlSaveAllocString()", and "mxmlSaveString()" functions load XML node trees from and save XML node trees to strings:

    char buffer[8192];
    char *ptr;
    mxml_node_t *tree;
    
    ...
    tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK);
    
    ...
    mxmlSaveString(tree, buffer, sizeof(buffer),
    	       MXML_NO_CALLBACK);
    
    ...
    ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK);
    

    You can find a named element/node using the "mxmlFindElement()" function:

    mxml_node_t *node = mxmlFindElement(tree, tree, "name",
    				    "attr", "value",
    				    MXML_DESCEND);
    

    The "name", "attr", and "value" arguments can be passed as NULL to act as wildcards, e.g.:

    /* Find the first "a" element */
    node = mxmlFindElement(tree, tree, "a", NULL, NULL,
    		       MXML_DESCEND);
    
    /* Find the first "a" element with "href" attribute */
    node = mxmlFindElement(tree, tree, "a", "href", NULL,
    		       MXML_DESCEND);
    
    /* Find the first "a" element with "href" to a URL */
    node = mxmlFindElement(tree, tree, "a", "href",
    		       "http://www.easysw.com/~mike/mxml/",
    		       MXML_DESCEND);
    
    /* Find the first element with a "src" attribute*/
    node = mxmlFindElement(tree, tree, NULL, "src", NULL,
    		       MXML_DESCEND);
    
    /* Find the first element with a "src" = "foo.jpg" */
    node = mxmlFindElement(tree, tree, NULL, "src",
    		       "foo.jpg", MXML_DESCEND);
    

    You can also iterate with the same function:

    mxml_node_t *node;
    
    for (node = mxmlFindElement(tree, tree, "name", NULL,
    			    NULL, MXML_DESCEND);
         node != NULL;
         node = mxmlFindElement(node, tree, "name", NULL,
    			    NULL, MXML_DESCEND))
    {
      ... do something ...
    }
    

    The "mxmlFindPath()" function finds the (first) value node under a specific element using a "path":

    mxml_node_t *value = mxmlFindPath(tree, "path/to/*/foo/bar");
    

    The "mxmlGetInteger()", "mxmlGetOpaque()", "mxmlGetReal()", and "mxmlGetText()" functions retrieve the value from a node:

    mxml_node_t *node;
    
    int intvalue = mxmlGetInteger(node);
    
    const char *opaquevalue = mxmlGetOpaque(node);
    
    double realvalue = mxmlGetReal(node);
    
    int whitespacevalue;
    const char *textvalue = mxmlGetText(node, &whitespacevalue);
    

    Finally, once you are done with the XML data, use the "mxmlDelete()" function to recursively free the memory that is used for a particular node or the entire tree:

    mxmlDelete(tree);
    
    cmtk-3.0.0/Utilities/mxml/doc/install.html0000644000177700000170000000714111747570117017555 0ustar torstenman

    1Building, Installing, and Packaging Mini-XML

    This chapter describes how to build, install, and package Mini-XML on your system from the source archive. You will need an ANSI/ISO-C compatible compiler to build Mini-XML - GCC works, as do most vendors' C compilers. If you are building Mini-XML on Windows, we recommend using the Visual C++ environment with the supplied solution file. For other operating systems, you'll need a POSIX-compatible shell and make program in addition to the C compiler.

    Compiling Mini-XML

    Mini-XML comes with both an autoconf-based configure script and a Visual C++ solution that can be used to compile the library and associated tools.

    Compiling with Visual C++

    Open the mxml.sln solution in the vcnet folder. Choose the desired build configuration, "Debug" (the default) or "Release", and then choose Build Solution from the Build menu.

    Compiling with Command-Line Tools

    Type the following command to configure the Mini-XML source code for your system:

        ./configure ENTER
    

    The default install prefix is /usr/local, which can be overridden using the --prefix option:

        ./configure --prefix=/foo ENTER
    

    Other configure options can be found using the --help option:

        ./configure --help ENTER
    

    Once you have configured the software, use the make(1) program to do the build and run the test program to verify that things are working, as follows:

        make ENTER
    

    Installing Mini-XML

    If you are using Visual C++, copy the mxml.lib and and mxml.h files to the Visual C++ lib and include directories, respectively.

    Otherwise, use the make command with the install target to install Mini-XML in the configured directories:

        make install ENTER
    

    Creating Mini-XML Packages

    Mini-XML includes two files that can be used to create binary packages. The first file is mxml.spec which is used by the rpmbuild(8) software to create Red Hat Package Manager ("RPM") packages which are commonly used on Linux. Since rpmbuild wants to compile the software on its own, you can provide it with the Mini-XML tar file to build the package:

        rpmbuild -ta mxml-version.tar.gz ENTER
    

    The second file is mxml.list which is used by the epm(1) program to create software packages in a variety of formats. The epm program is available from the following URL:

        http://www.epmhome.org/
    

    Use the make command with the epm target to create portable and native packages for your system:

        make epm ENTER
    

    The packages are stored in a subdirectory named dist for your convenience. The portable packages utilize scripts and tar files to install the software on the target system. After extracting the package archive, use the mxml.install script to install the software.

    The native packages will be in the local OS's native format: RPM for Red Hat Linux, DPKG for Debian Linux, PKG for Solaris, and so forth. Use the corresponding commands to install the native packages.

    cmtk-3.0.0/Utilities/mxml/doc/footer.man0000644000177700000170000000020211747570117017203 0ustar torstenman.SH SEE ALSO mxmldoc(1), Mini-XML Programmers Manual, http://www.minixml.org/ .SH COPYRIGHT Copyright 2003-2011 by Michael Sweet. cmtk-3.0.0/Utilities/mxml/doc/docset.header0000644000177700000170000000035011210045173017627 0ustar torstenman

    Mini-XML API Reference

    Header mxml.h
    Library -lmxml
    cmtk-3.0.0/Utilities/mxml/doc/docset.css0000644000177700000170000000375411747570117017222 0ustar torstenmanbody { background: white; color: black; font-family: "lucida grande", geneva, helvetica, arial, sans-serif; } h1, h2, h3, h4, h5, h6, p, td, th { font-family: "lucida grande", geneva, helvetica, arial, sans-serif; } kbd { color: #006600; font-family: monaco, courier, monospace; font-weight: bold; } pre { font-family: monaco, courier, monospace; } pre.example { background: white; border: dotted thin #999999; margin-left: 36pt; padding: 10px; } pre.example em { color: #3f0000; font-family: "lucida grande", geneva, helvetica, arial, sans-serif; } div.summary table { border: solid thin #999999; border-collapse: collapse; border-spacing: 0; margin: 10px; width: 33%; } div.summary table td, div.summary table th { background: white; border: solid thin #999999; border-spacing: 0; padding: 5px; text-align: left; vertical-align: top; } div.summary table thead th { background: #f0f0f0; } div.body h1 { margin: 0; } div.body h2 { margin-top: 1.5em; } div.body h3, div.body h4, div.body h5 { margin-bottom: 0.5em; margin-top: 1.5em; } .class, .enumeration, .function, .struct, .typedef, .union { border-bottom: solid thin #999999; margin-bottom: 0; margin-top: 2em; } .description { margin-top: 0.5em; } code, p.code, pre, ul.code li { font-family: monaco, courier, monospace; font-size: 90%; } ul.code, ul.contents, ul.subcontents { list-style-type: none; margin: 0; padding-left: 0; } ul.code li { margin: 0; } ul.contents > li { margin-top: 1em; } ul.contents li ul.code, ul.contents li ul.subcontents { padding-left: 2em; } div.body dl { margin-left: 0; margin-top: 0; } div.body dt { font-style: italic; margin-left: 0; margin-top: 0; } div.body dd { margin-bottom: 0.5em; } span.info { background: black; border: thin solid black; color: white; font-size: 80%; font-style: italic; font-weight: bold; white-space: nowrap; } h2 span.info, h3 span.info, h4 span.info { float: right; font-size: 100%; } cmtk-3.0.0/Utilities/mxml/doc/basics.html0000644000177700000170000004652111747570117017360 0ustar torstenman

    2Getting Started with Mini-XML

    This chapter describes how to write programs that use Mini-XML to access data in an XML file. Mini-XML provides the following functionality:

    • Functions for creating and managing XML documents in memory.
    • Reading of UTF-8 and UTF-16 encoded XML files and strings.
    • Writing of UTF-8 encoded XML files and strings.
    • Support for arbitrary element names, attributes, and attribute values with no preset limits, just available memory.
    • Support for integer, real, opaque ("CDATA"), and text data types in "leaf" nodes.
    • "Find", "index", and "walk" functions for easily accessing data in an XML document.

    Mini-XML doesn't do validation or other types of processing on the data based upon schema files or other sources of definition information, nor does it support character entities other than those required by the XML specification.

    The Basics

    Mini-XML provides a single header file which you include:

        #include <mxml.h>
    

    The Mini-XML library is included with your program using the -lmxml option:

        gcc -o myprogram myprogram.c -lmxml ENTER
    

    If you have the pkg-config(1) software installed, you can use it to determine the proper compiler and linker options for your installation:

        pkg-config --cflags mxml ENTER
        pkg-config --libs mxml ENTER
    

    Nodes

    Every piece of information in an XML file is stored in memory in "nodes". Nodes are defined by the mxml_node_t structure. Each node has a typed value, optional user data, a parent node, sibling nodes (previous and next), and potentially child nodes.

    For example, if you have an XML file like the following:

        <?xml version="1.0" encoding="utf-8"?>
        <data>
            <node>val1</node>
            <node>val2</node>
            <node>val3</node>
            <group>
                <node>val4</node>
                <node>val5</node>
                <node>val6</node>
            </group>
            <node>val7</node>
            <node>val8</node>
        </data>
    

    the node tree for the file would look like the following in memory:

        ?xml version="1.0" encoding="utf-8"?
          |
        data
          |
        node - node - node - group - node - node
          |      |      |      |       |      |
        val1   val2   val3     |     val7   val8
                               |
                             node - node - node
                               |      |      |
                             val4   val5   val6
    

    where "-" is a pointer to the sibling node and "|" is a pointer to the first child or parent node.

    The mxmlGetType function gets the type of a node, one of MXML_CUSTOM, MXML_ELEMENT, MXML_INTEGER, MXML_OPAQUE, MXML_REAL, or MXML_TEXT. The parent and sibling nodes are accessed using the mxmlGetParent, mxmlGetNext, and mxmlGetPrevious functions. The mxmlGetUserData function gets any user data associated with the node.

    CDATA Nodes

    CDATA (MXML_ELEMENT) nodes are created using the mxmlNewCDATA function. The mxmlGetCDATA function retrieves the CDATA string pointer for a node.

    Note:

    CDATA nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

    Custom Nodes

    Custom (MXML_CUSTOM) nodes are created using the mxmlNewCustom function or using a custom load callback specified using the mxmlSetCustomHandlers function. The mxmlGetCustom function retrieves the custom value pointer for a node.

    Comment Nodes

    Comment (MXML_ELEMENT) nodes are created using the mxmlNewElement function. The mxmlGetElement function retrieves the comment string pointer for a node, including the surrounding "!--" and "--" characters.

    Note:

    Comment nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

    Element Nodes

    Element (MXML_ELEMENT) nodes are created using the mxmlNewElement function. The mxmlGetElement function retrieves the element name, the mxmlElementGetAttr function retrieves the value string for a named attribute associated with the element, and the mxmlGetFirstChild and mxmlGetLastChild functions retrieve the first and last child nodes for the element, respectively.

    Integer Nodes

    Integer (MXML_INTEGER) nodes are created using the mxmlNewInteger function. The mxmlGetInteger function retrieves the integer value for a node.

    Opaque Nodes

    Opaque (MXML_OPAQUE) nodes are created using the mxmlNewOpaque function. The mxmlGetOpaque function retrieves the opaque string pointer for a node. Opaque nodes are like string nodes but preserve all whitespace between nodes.

    Text Nodes

    Text (MXML_TEXT) nodes are created using the mxmlNewText and mxmlNewTextf functions. Each text node consists of a text string and (leading) whitespace value - the mxmlGetText function retrieves the text string pointer and whitespace value for a node.

    Processing Instruction Nodes

    Processing instruction (MXML_ELEMENT) nodes are created using the mxmlNewElement function. The mxmlGetElement function retrieves the processing instruction string for a node, including the surrounding "?" characters.

    Note:

    Processing instruction nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

    Real Number Nodes

    Real number (MXML_REAL) nodes are created using the mxmlNewReal function. The mxmlGetReal function retrieves the CDATA string pointer for a node.

    XML Declaration Nodes

    XML declaration (MXML_ELEMENT) nodes are created using the mxmlNewXML function. The mxmlGetElement function retrieves the XML declaration string for a node, including the surrounding "?" characters.

    Note:

    XML declaration nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

    Creating XML Documents

    You can create and update XML documents in memory using the various mxmlNew functions. The following code will create the XML document described in the previous section:

        mxml_node_t *xml;    /* <?xml ... ?> */
        mxml_node_t *data;   /* <data> */
        mxml_node_t *node;   /* <node> */
        mxml_node_t *group;  /* <group> */
    
        xml = mxmlNewXML("1.0");
    
        data = mxmlNewElement(xml, "data");
    
            node = mxmlNewElement(data, "node");
            mxmlNewText(node, 0, "val1");
            node = mxmlNewElement(data, "node");
            mxmlNewText(node, 0, "val2");
            node = mxmlNewElement(data, "node");
            mxmlNewText(node, 0, "val3");
    
            group = mxmlNewElement(data, "group");
    
                node = mxmlNewElement(group, "node");
                mxmlNewText(node, 0, "val4");
                node = mxmlNewElement(group, "node");
                mxmlNewText(node, 0, "val5");
                node = mxmlNewElement(group, "node");
                mxmlNewText(node, 0, "val6");
    
            node = mxmlNewElement(data, "node");
            mxmlNewText(node, 0, "val7");
            node = mxmlNewElement(data, "node");
            mxmlNewText(node, 0, "val8");
    

    We start by creating the declaration node common to all XML files using the mxmlNewXML function:

        xml = mxmlNewXML("1.0");
    

    We then create the <data> node used for this document using the mxmlNewElement function. The first argument specifies the parent node (xml) while the second specifies the element name (data):

        data = mxmlNewElement(xml, "data");
    

    Each <node>...</node> in the file is created using the mxmlNewElement and mxmlNewText functions. The first argument of mxmlNewText specifies the parent node (node). The second argument specifies whether whitespace appears before the text - 0 or false in this case. The last argument specifies the actual text to add:

        node = mxmlNewElement(data, "node");
        mxmlNewText(node, 0, "val1");
    

    The resulting in-memory XML document can then be saved or processed just like one loaded from disk or a string.

    Loading XML

    You load an XML file using the mxmlLoadFile function:

        FILE *fp;
        mxml_node_t *tree;
    
        fp = fopen("filename.xml", "r");
        tree = mxmlLoadFile(NULL, fp,
                            MXML_TEXT_CALLBACK);
        fclose(fp);
    

    The first argument specifies an existing XML parent node, if any. Normally you will pass NULL for this argument unless you are combining multiple XML sources. The XML file must contain a complete XML document including the ?xml element if the parent node is NULL.

    The second argument specifies the stdio file to read from, as opened by fopen() or popen(). You can also use stdin if you are implementing an XML filter program.

    The third argument specifies a callback function which returns the value type of the immediate children for a new element node: MXML_CUSTOM, MXML_IGNORE, MXML_INTEGER, MXML_OPAQUE, MXML_REAL, or MXML_TEXT. Load callbacks are described in detail in Chapter 3. The example code uses the MXML_TEXT_CALLBACK constant which specifies that all data nodes in the document contain whitespace-separated text values. Other standard callbacks include MXML_IGNORE_CALLBACK, MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, and MXML_REAL_CALLBACK.

    The mxmlLoadString function loads XML node trees from a string:

        char buffer[8192];
        mxml_node_t *tree;
    
        ...
        tree = mxmlLoadString(NULL, buffer,
                              MXML_TEXT_CALLBACK);
    

    The first and third arguments are the same as used for mxmlLoadFile(). The second argument specifies the string or character buffer to load and must be a complete XML document including the ?xml element if the parent node is NULL.

    Saving XML

    You save an XML file using the mxmlSaveFile function:

        FILE *fp;
        mxml_node_t *tree;
    
        fp = fopen("filename.xml", "w");
        mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
        fclose(fp);
    

    The first argument is the XML node tree to save. It should normally be a pointer to the top-level ?xml node in your XML document.

    The second argument is the stdio file to write to, as opened by fopen() or popen(). You can also use stdout if you are implementing an XML filter program.

    The third argument is the whitespace callback to use when saving the file. Whitespace callbacks are covered in detail in Chapter 3. The previous example code uses the MXML_NO_CALLBACK constant to specify that no special whitespace handling is required.

    The mxmlSaveAllocString, and mxmlSaveString functions save XML node trees to strings:

        char buffer[8192];
        char *ptr;
        mxml_node_t *tree;
    
        ...
        mxmlSaveString(tree, buffer, sizeof(buffer),
                       MXML_NO_CALLBACK);
    
        ...
        ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK);
    

    The first and last arguments are the same as used for mxmlSaveFile(). The mxmlSaveString function takes pointer and size arguments for saving the XML document to a fixed-size buffer, while mxmlSaveAllocString() returns a string buffer that was allocated using malloc().

    Controlling Line Wrapping

    When saving XML documents, Mini-XML normally wraps output lines at column 75 so that the text is readable in terminal windows. The mxmlSetWrapMargin function overrides the default wrap margin:

        /* Set the margin to 132 columns */
        mxmlSetWrapMargin(132);
    
        /* Disable wrapping */
        mxmlSetWrapMargin(0);
    

    Memory Management

    Once you are done with the XML data, use the mxmlDelete function to recursively free the memory that is used for a particular node or the entire tree:

        mxmlDelete(tree);
    

    You can also use reference counting to manage memory usage. The mxmlRetain and mxmlRelease functions increment and decrement a node's use count, respectively. When the use count goes to 0, mxmlRelease will automatically call mxmlDelete to actually free the memory used by the node tree. New nodes automatically start with a use count of 1.

    Finding and Iterating Nodes

    The mxmlWalkPrev and mxmlWalkNextfunctions can be used to iterate through the XML node tree:

        mxml_node_t *node;
        
        node = mxmlWalkPrev(current, tree,
                            MXML_DESCEND);
    
        node = mxmlWalkNext(current, tree,
                            MXML_DESCEND);
    

    In addition, you can find a named element/node using the mxmlFindElement function:

        mxml_node_t *node;
        
        node = mxmlFindElement(tree, tree, "name",
                               "attr", "value",
                               MXML_DESCEND);
    

    The name, attr, and value arguments can be passed as NULL to act as wildcards, e.g.:

        /* Find the first "a" element */
        node = mxmlFindElement(tree, tree, "a",
                               NULL, NULL,
                               MXML_DESCEND);
    
        /* Find the first "a" element with "href"
           attribute */
        node = mxmlFindElement(tree, tree, "a",
                               "href", NULL,
                               MXML_DESCEND);
    
        /* Find the first "a" element with "href"
           to a URL */
        node = mxmlFindElement(tree, tree, "a",
                               "href",
                               "http://www.easysw.com/",
                               MXML_DESCEND);
    
        /* Find the first element with a "src"
           attribute */
        node = mxmlFindElement(tree, tree, NULL,
                               "src", NULL,
                               MXML_DESCEND);
    
        /* Find the first element with a "src"
           = "foo.jpg" */
        node = mxmlFindElement(tree, tree, NULL,
                               "src", "foo.jpg",
                               MXML_DESCEND);
    

    You can also iterate with the same function:

        mxml_node_t *node;
    
        for (node = mxmlFindElement(tree, tree,
                                    "name",
                                    NULL, NULL,
                                    MXML_DESCEND);
             node != NULL;
             node = mxmlFindElement(node, tree,
                                    "name",
                                    NULL, NULL,
                                    MXML_DESCEND))
        {
          ... do something ...
        }
    

    The MXML_DESCEND argument can actually be one of three constants:

    • MXML_NO_DESCEND means to not to look at any child nodes in the element hierarchy, just look at siblings at the same level or parent nodes until the top node or top-of-tree is reached.

      The previous node from "group" would be the "node" element to the left, while the next node from "group" would be the "node" element to the right.

    • MXML_DESCEND_FIRST means that it is OK to descend to the first child of a node, but not to descend further when searching. You'll normally use this when iterating through direct children of a parent node, e.g. all of the "node" and "group" elements under the "?xml" parent node in the example above.

      This mode is only applicable to the search function; the walk functions treat this as MXML_DESCEND since every call is a first time.

    • MXML_DESCEND means to keep descending until you hit the bottom of the tree. The previous node from "group" would be the "val3" node and the next node would be the first node element under "group".

      If you were to walk from the root node "?xml" to the end of the tree with mxmlWalkNext(), the order would be:

      ?xml data node val1 node val2 node val3 group node val4 node val5 node val6 node val7 node val8

      If you started at "val8" and walked using mxmlWalkPrev(), the order would be reversed, ending at "?xml".

    Finding Specific Nodes

    You can find specific nodes in the tree using the mxmlFindPath, for example:

        mxml_node_t *value;
    
        value = mxmlFindPath(tree, "path/to/*/foo/bar");
    

    The second argument is a "path" to the parent node. Each component of the path is separated by a slash (/) and represents a named element in the document tree or a wildcard (*) path representing 0 or more intervening nodes.

    cmtk-3.0.0/Utilities/mxml/doc/mxmldoc.html0000644000177700000170000001410211747570117017545 0ustar torstenman

    4Using the mxmldoc Utility

    This chapter describes how to use mxmldoc(1) program to automatically generate documentation from C and C++ source files.

    The Basics

    Originally developed to generate the Mini-XML and CUPS API documentation, mxmldoc is now a general-purpose utility which scans C and C++ source files to produce HTML and man page documentation along with an XML file representing the functions, types, and definitions in those source files. Unlike popular documentation generators like Doxygen or Javadoc, mxmldoc uses in-line comments rather than comment headers, allowing for more "natural" code documentation.

    By default, mxmldoc produces HTML documentation. For example, the following command will scan all of the C source and header files in the current directory and produce a HTML documentation file called filename.html:

        mxmldoc *.h *.c >filename.html ENTER
    

    You can also specify an XML file to create which contains all of the information from the source files. For example, the following command creates an XML file called filename.xml in addition to the HTML file:

        mxmldoc filename.xml *.h *.c >filename.html ENTER
    

    The --no-output option disables the normal HTML output:

        mxmldoc --no-output filename.xml *.h *.c ENTER
    

    You can then run mxmldoc again with the XML file alone to generate the HTML documentation:

        mxmldoc filename.xml >filename.html ENTER
    

    Creating Man Pages

    The --man filename option tells mxmldoc to create a man page instead of HTML documentation, for example:

        mxmldoc --man filename filename.xml \
            >filename.man ENTER
    
        mxmldoc --man filename *.h *.c \
            >filename.man ENTER
    

    Creating Xcode Documentation Sets

    The --docset directory.docset option tells mxmldoc to create an Xcode documentation set containing the HTML documentation, for example:

        mxmldoc --docset foo.docset *.h *.c foo.xml ENTER
    

    Xcode documentation sets can only be built on Mac OS X with Xcode 3.0 or higher installed.

    Commenting Your Code

    As noted previously, mxmldoc looks for in-line comments to describe the functions, types, and constants in your code. Mxmldoc will document all public names it finds in your source files - any names starting with the underscore character (_) or names that are documented with the @private@ directive are treated as private and are not documented.

    Comments appearing directly before a function or type definition are used to document that function or type. Comments appearing after argument, definition, return type, or variable declarations are used to document that argument, definition, return type, or variable. For example, the following code excerpt defines a key/value structure and a function that creates a new instance of that structure:

        /* A key/value pair. This is used with the
           dictionary structure. */
    
        struct keyval
        {
          char *key; /* Key string */
          char *val; /* Value string */
        };
    
        /* Create a new key/value pair. */
    
        struct keyval * /* New key/value pair */
        new_keyval(
            const char *key, /* Key string */
    	const char *val) /* Value string */
        {
          ...
        }
    

    Mxmldoc also knows to remove extra asterisks (*) from the comment string, so the comment string:

        /*
         * Compute the value of PI.
         *
         * The function connects to an Internet server
         * that streams audio of mathematical monks
         * chanting the first 100 digits of PI.
         */
    

    will be shown as:

        Compute the value of PI.
    
        The function connects to an Internet server
        that streams audio of mathematical monks
        chanting the first 100 digits of PI.
    

    Comments can also include the following special @name ...@ directive strings:

    • @deprecated@ - flags the item as deprecated to discourage its use
    • @private@ - flags the item as private so it will not be included in the documentation
    • @since ...@ - flags the item as new since a particular release. The text following the @since up to the closing @ is highlighted in the generated documentation, e.g. @since Mini-XML 2.7@.

    Titles, Sections, and Introductions

    Mxmldoc also provides options to set the title, section, and introduction text for the generated documentation. The --title text option specifies the title for the documentation. The title string is usually put in quotes:

        mxmldoc filename.xml \
            --title "My Famous Documentation" \
            >filename.html ENTER
    

    The --section name option specifies the section for the documentation. For HTML documentation, the name is placed in a HTML comment such as:

        <!-- SECTION: name -->
    

    For man pages, the section name is usually just a number ("3"), or a number followed by a vendor name ("3acme"). The section name is used in the .TH directive in the man page:

        .TH mylibrary 3acme "My Title" ...
    

    The default section name for man page output is "3". There is no default section name for HTML output.

    Finally, the --intro filename option specifies a file to embed after the title and section but before the generated documentation. For HTML documentation, the file must consist of valid HTML without the usual DOCTYPE, html, and body elements. For man page documentation, the file must consist of valid nroff(1) text.

    cmtk-3.0.0/Utilities/mxml/doc/logo.gif0000644000177700000170000001324411210045173016631 0ustar torstenmanGIF87a,,çL  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,,,@þÿ H° Áƒ*DøNÙ)Dl¨üpñBƒ2jÜȱ£Ç CŠI²¤É“%4 ðÁÅ*lRön¡Í›8sêÜI°ž# (ƒ J´¨Ñ£H“Ðà¨ϧPÎâ´ªÕ«X³jÍŠe^Ô¯{5ØJ¶¬Ù³hÑ6è6¡˜´pãÊK¥˜¨ŽêêÝË·o\G6×õK8+«Ãˆ'.LÔ‡âLJëðm°Î Ƙ¯âÌ4ËMV„ÑTƹ´éÓ¨5*£à—ÕÍ lÚ T•ñ‘lŸNnéÚf©nÿ3çÁ¤g›  ³n­3ƒ6àí\VdŒv8 ‘Ü-²7Î{—Eþv€–óÉÈã “§–ë]a—“è‚ÿyûM’íz?¡zý!ôßziå‡Pô!—`zöÙ„ßMvVŸH4 gxP„%UhÐ…!yXˆq’†q¸ B$n$"A-b¨Š©xÞ„â’‰ ÑH9*H¡Ž2šåã@@†HäBŠÄãGG ”äM¸d‘Xf©å–\véå—`†)æ˜d–iæ™h¦©¦Œ/䣓E…àNúÐ`eT¥õÇW1j¥”kî5„?9ñRR"9áÓB_Ý1mõ™ÑŸÿLè\[äÔŽYÀNõœÀN¬(£'= Bxú „þ—fF‡pòˆpÔ‹0€t u@Ò1 Qq®Iz¥–ÆêW#;¹ãkUÄ ¤ ¡# ¢Q´ÿ‹¬²™•ÑIq;à íÒQòqdÛ×91‘'9 BÔ»¹¡P#a@(BßxÄow8%+ïViääÍ`ÙÐON‰¬È"H•@Õ§»Ê[Âg²±—:i+Ô0:AÂd•±¥“J^Ù¥Â!„^±Å²ðÎ<‹ A÷,4Ïß$dOuC'}¦öìžÒPo)ÚmóØõÕœÙàUÍ õ2Ö`›5Ë\ „­¶H ÁkÙpõM#A(°v™ ÑHþÑq÷Ý÷:•ìpw ;TR™ßˆ/ Òƒ7¾‘?'þ”*;nùP ¨"¹@T]îùVXÜvLÚŸ—žÀæÄ‰é¬ë…/B·®Û}]FkìYÌÔ‡ìA=‰¥í…õñ°}ýy³F@â&NÍ’–à£S2C åṵ̂nt+çÔ¤£|aÄ¿yâ´5¸¼ç$8• ‚ýg=˜dNWØ/3G×sD©Õ(ÙÅMN¿‹É/{Œ2`ý£>…°/! ûÈøb?¬ý)‚.Ú_ÇXö‘þmä‚£â`G&x5Gƒ#DaF<è'ZL@dàãuBÞ©‚;¢Âh(>’wþ@ ¢‡HÄ"ñˆHL¢—ÈÄ@ÉB'›ÊtbŠò$/D¹ ŸÁ&& 9Á†Ý>"Œœx¢‡m CPN o¬‰y7蔂 Ì&•(Ê»¼¡˜¤ éÁÁNôF8z$‡ƒ #”¯ì#!øp€H4—5dd=*¤!=âmðä+—Ç2B…Hã#oPH&2¨Âcir“ØFÍÔ‘£`ò™J)6RÊ„ #…­üåøtdj7i$$3A(ä»Jˆ<Æè®QÒ…cú@_ МÌÂ$PGNà¡M+Â$ÁáÉ nˆÃL¶ÏfzùÀ;è>æD Gþ±MNæ1 Zó#äy%0mè¿w³.5ùGú6ÉÐIn¨¡ÝÖMꂈ2QNQ‰‡ ,DÄ£oª &GæJ´ Œ¨ÜH×Ôl”j`ÜJOãFlí¥8%H;TÌ”,*@ƒ*°“ӢĜxÁOKóN4ͨe;F–Ú¥¤ª9IÆF©z&€«YÆ2¹ .,#§ŸÀY‡–€OlNc]+Ö8 ¸%C¥r [¾ xÈ4¯óÀÛv ÀÊ:‰ay—;…øb±DôEBÞ·D®ç‡tÙAÚ!R%Z65˜¥‹ˆúslò³¨ m]Î!ŠBV‰!øþ"¾ä‚0¢©P(qt¶$  ‚,QŠU~è Â×%`¡–0Å*F‰?€jU"\À›/ ÒƒJ2j©âŽO1PòY6 `Y‡ÐØN¾¸ »{¡™pα<áPƒ¹9tÐÇlB ~”­ <'að›ß§|ƒrø‚è0ŠDB¥¨ÀCº‡N˜c'7h`B¸ˆ“v¼"fà‚òp qê„$QíÐ(ŽúÙÀ‰?€@\c€"F‰Ò¹’Ì'X¤ Kx“ÙÖp!Úx¡…‚|!ÄB‰ A%ºåž™0ÁS~ò’AÒ^l‚ùCæDóþ ‚A.×WÉ2t’¯Éæ¾¹š]æÙ—cÜJ7¹ƒsvg™ygVZh{N󈤬f9 x‡ƒ¦ïŸ:é¤%ze•ögžPf2zјŽ3“=­è\‰YÔd4”ÌÌç<ËѬf'ªC­à¯oÀ‘þ´©á\ë¨]š×a>3¨}kH+¤Íx>ô%ûüÚf;ûÙÐŽ¶´§Míj[ûÚØÎ¶¶·Íín{Ž`؉Ž"Öæä š†ŠŒBî=űæ]À¡“E ¥7 l½+ oDÆß¤̈3q"Œw}Ò $%þI…¸aƒ–Ï=aÐß…°#”q‚NP¥ë]sdF:è•B¤[ù—^ërŠŒ[Ÿ##ðT7 iw™6P±:8kb7€ñ€ÜU Ðy{«‚Qt s8¥æ~q<ñM²Æ€…WTÇC?@@u‘N81nDƒ7Ñ ¿åg·wJ ¤ÑoFg9µ‚sÑz27á”eu°V~§ç8!X,'w>BM0>õm£‘…^ˆ5Apy4†`“1 ¡Th¨4/pómÈ3pSÏ7Us¨,9`v:¡3y¨&‘#‹ô‡câRp³ þ_CˆZ2gu>ŸpƒŠˆ àVE%щ}auVo‰p!ʼn9Ñ àZ ˆ! |HŠmá Y°©x ’åŠPu±ÐM€ŠÕMб`n¸XŒ¡‹¼è‹ÔŒÂHŒÆUsS7Š˜7{óŒç‹²˜Šµx‹ÖS5‹"QSvØ8aŠÊŽB±Š­HŽq6ÿ‡ŽDÑ6ƒEŽže!ŠÝ˜Rö¨†È‰–¸s¡‰Xå5©cƒVXq1‰R Y%µ9ˆø™Áˆ~S5iZ7ƒ˜‘§Ñm¡Q¹%~8’ˆPñ4(I È´ý€þ‡-)#{¸5“Y‚Q8‡8©%uxGÓ“[Â46Á†B©%oxlGY; q†•¥j¿Ãld¡†4L„Z§ñjpÁ7!†H„•¦¡•iQ†±PW •E"–iaRÿÐ…M–¥¡–h†q’o‰–2"—h9E¸”a²…óä—dò.(˜br "Óuˆ1!ˆ0| ñ¥`ï¸ Ô°çÐ 8Œ‰$±˜¡éÁ`O“y QP€%á¡)…ÁŸÙ`Þ¥=@o<± -×Sàb;á˜Ð›³óh@ØE¸Á`+3×k|ñåÄÆsq€^OÑ ‰þˆš ÈÅYlÇy ´è{m18Ð~ÒÂqñ'°ŽOZW3öRÆflW3&x}йîùžìh}ik„k ·Á !g…k6 G7ùyR“àŸÁ6j9 J°q ãˆé€xµn“g@eq…q Qpƒ –ߘ|(8c91 $!…9± P…Ñ *Z,:ôà•wr¤·#/”’&ÑX &’ÿY"x‰{71'AË™gDkêk7‘ '¡ÏGy#¡¦›V¡ Q B(®&•Êò'2Ø Ñ êÙ-CJEŠnAÑþ>d§±òk'X¦dúƒ©fœ‚¦”„–ƒ•'©;ƒ¨ ¨¨>(‚€æ¨;Wqzê§‹:l ©Ÿú¤“z£§ä©¨ºl›¶0– …­j£YÊ?[ÚB‡¡Œ*«µ k¹š¨»š©JljlÈùœ˜J«ÉŠ£¿z©Á ¬¢Ú¨âù¨ÇÚ§’¢—à«”6«¶×«¡ªŪÞzªãZ©Ì×­ËÊ«éú­·ŠzÍ*¬ëªšª4Úª¬Ïê¬Ñº©ÓÚ©¤j­N6õŠ®÷ª®Ë®œÚ€žª«ùº­å «çŠƒ ëªÊ®)bg’Š­wú°K©»®+Ԯ˗°ÿ*¯Ã:ªÕ:²¥ú§Q¤È&þ° k¯/ˬ"‹¯ó ­5k«›‚ýzj㊱‡ª±äê±.{³© ²˰ë³—r´Ë­[°›³õ®6[²4kµPãY°µ\Ûµ\ëœ%!^;¶[kš&!¶dëµfK!iëµ$¡µmûµB¶q›k t·wk˜|Û·~û·€¸‚;¸„[¸†{¸ˆ›¸Š»¸ŒÛ¸Žû¸¹’;¹”[¹–›‡ :QüVÝ—U®É-‘˜E[„ ;+DtŠïð£C õ¯ Ñ Ga §k¬';Dì’öBÁ7±$kWG+`r¨›»CDôû°N&±Ö )qUµ6þq E È‹»«ŠD P 9áéIPsÔw™O«µyðH·;žÝ›DÆ—G0$¦Ù³<á¥A±‘R¤•ÒD$“È÷9  áÕ£¿<Bÿ›¼ñ«D67‘¢A9‘ëÕ§6±J(A¨̽áÚD0£7á(9¡ «¶€„1y(ш¡’”šL$@8ádA¥ ‘j÷‘¿& a„7µT{Dƒ˜l©ýÀûB*€—‚g® u°Ä\ÚÄGÄ9 Æ€äÀ¦â C7º%€ qµv:›ºpÚ'v9Ä "³[þ ‹Ƹ*ÆH´Ñpq€ü‚ Q¼!ÑšWËDÈîjÈIÔ `±5 Jb a #qdºÔ´ÜªÃ %.Pñ àéÉM ±¾!™áGA+´¨ÜPGȨ`ó"üëU.é³a<³ %ã ‹ìËÖÄ•áÀ2 Á~· µ!‹Ì›dlÇÁ§#m J6WÌD[ÈÚ GŸË ìÊ8”£(yjœ·ŽgÊåšË†„eÔðŒüO€`ÄÁ4³ÆŒÎÞ G@ZQa¥çzDÒ¾ZÌ`ˆÀ*}ΗœÎI„.ÂÍA8—¤{ ¢þqC«ÑÙ¼ÐKT81 QXßÌA"ðÇQŸñH‹ËâwD@Í6! ¼Ùr/Ì€ý—œc 1挵ËÑDÄ­­wм7¡(|üf5Ê¡~ QE=Íú|DI\§€Â6Ñpkœ¬<Œw×ÑÉiÐíÒEt9Ñ‘¡›‰híÁ$ÒÖ ñ 0 |J°jýÓA„ÅsdcÝйŸ ª!q 1{ qŸ}ÍÒkÝ%®9°¤7±#1 9¡2ÀÀ÷ÊPA Ö¯$\±e’óLK  <«{mðÙ1²‰;1» ÚðkPHþŠà˜zqÜ ±FIþ’ÆÆ©´ëðŽ–ÜÒ/5ÝgáåC pÆ8tA¡Á9QcÃËÛ‘};'ÏMq8…ÞfA><P7q6;ÐÍ’bû-O<Ûž-Ù~mÞ'åße=8dœ×0¡C1t:‘ÙWKÕAG½‘PßÐM­ç­¦rŽg±:! H®}ý™Ñ$¾—0¾Ò;~Ìý]±õ»s¹{!<¥…ä{AŒ,Éäpñ’œå ™ÕŠEå¸sKˆå[¡Y!\N”‘æZ¼¡€fn¯³W¾æGÄmçH:AÓt>ˆÅœ£“ç(:QáW~^‚ÕŸ8è ¡E²qWˆÞ{U6EÖèJ7p…èt•8bAçkÑ>iæmõR”å™cTbe¹fʼnS!¹]aŒZŸ^5 ‹c¸¡!U€kU´®>!‡BÉ‘—ë@™T#ÙTø ì<8[Š…caÆ^6;ÕShTCÕìFÕQñS*Á.2A;cmtk-3.0.0/Utilities/mxml/doc/schema.html0000644000177700000170000001632211747570117017350 0ustar torstenman

    DXML Schema

    This appendix provides the XML schema that is used for the XML files produced by mxmldoc. This schema is available on-line at:

        http://www.minixml.org/mxmldoc.xsd
    

    mxmldoc.xsd

    
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:annotation>
        <xsd:documentation xml:lang="en">
          Mini-XML 2.7 documentation schema for mxmldoc output.
          Copyright 2003-2011 by Michael Sweet.
        </xsd:documentation>
      </xsd:annotation>
    
      <!-- basic element definitions -->
      <xsd:element name="argument" type="argumentType"/>
      <xsd:element name="class" type="classType"/>
      <xsd:element name="constant" type="constantType"/>
      <xsd:element name="description" type="xsd:string"/>
      <xsd:element name="enumeration" type="enumerationType"/>
      <xsd:element name="function" type="functionType"/>
      <xsd:element name="mxmldoc" type="mxmldocType"/>
      <xsd:element name="namespace" type="namespaceType"/>
      <xsd:element name="returnvalue" type="returnvalueType"/>
      <xsd:element name="seealso" type="identifierList"/>
      <xsd:element name="struct" type="structType"/>
      <xsd:element name="typedef" type="typedefType"/>
      <xsd:element name="type" type="xsd:string"/>
      <xsd:element name="union" type="unionType"/>
      <xsd:element name="variable" type="variableType"/>
    
      <!-- descriptions of complex elements -->
      <xsd:complexType name="argumentType">
        <xsd:sequence>
          <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="default" type="xsd:string" use="optional"/>
        <xsd:attribute name="name" type="identifier" use="required"/>
        <xsd:attribute name="direction" type="direction" use="optional"
         default="I"/>
      </xsd:complexType>
    
      <xsd:complexType name="classType">
        <xsd:sequence>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
          <xsd:choice minOccurs="0" maxOccurs="unbounded">
    	<xsd:element ref="class"/>
    	<xsd:element ref="enumeration"/>
    	<xsd:element ref="function"/>
    	<xsd:element ref="struct"/>
    	<xsd:element ref="typedef"/>
    	<xsd:element ref="union"/>
    	<xsd:element ref="variable"/>
          </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
        <xsd:attribute name="parent" type="xsd:string" use="optional"/>
      </xsd:complexType>
    
      <xsd:complexType name="constantType">
        <xsd:sequence>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
      </xsd:complexType>
    
      <xsd:complexType name="enumerationType">
        <xsd:sequence>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
          <xsd:element ref="constant" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
      </xsd:complexType>
    
      <xsd:complexType name="functionType">
        <xsd:sequence>
          <xsd:element ref="returnvalue" minOccurs="0" maxOccurs="1"/>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
          <xsd:element ref="argument" minOccurs="1" maxOccurs="unbounded"/>
          <xsd:element ref="seealso" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
        <xsd:attribute name="scope" type="scope" use="optional"/>
      </xsd:complexType>
    
      <xsd:complexType name="mxmldocType">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
          <xsd:element ref="class"/>
          <xsd:element ref="enumeration"/>
          <xsd:element ref="function"/>
          <xsd:element ref="namespace"/>
          <xsd:element ref="struct"/>
          <xsd:element ref="typedef"/>
          <xsd:element ref="union"/>
          <xsd:element ref="variable"/>
        </xsd:choice>
      </xsd:complexType>
    
      <xsd:complexType name="namespaceType">
        <xsd:sequence>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
          <xsd:choice minOccurs="0" maxOccurs="unbounded">
    	<xsd:element ref="class"/>
    	<xsd:element ref="enumeration"/>
    	<xsd:element ref="function"/>
    	<xsd:element ref="struct"/>
    	<xsd:element ref="typedef"/>
    	<xsd:element ref="union"/>
    	<xsd:element ref="variable"/>
          </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
      </xsd:complexType>
    
      <xsd:complexType name="returnvalueType">
        <xsd:sequence>
          <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
      </xsd:complexType>
    
      <xsd:complexType name="structType">
        <xsd:sequence>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
          <xsd:choice minOccurs="0" maxOccurs="unbounded">
    	<xsd:element ref="variable"/>
    	<xsd:element ref="function"/>
          </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
      </xsd:complexType>
    
      <xsd:complexType name="typedefType">
        <xsd:sequence>
          <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
      </xsd:complexType>
    
      <xsd:complexType name="unionType">
        <xsd:sequence>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
          <xsd:element ref="variable" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
      </xsd:complexType>
    
      <xsd:complexType name="variableType">
        <xsd:sequence>
          <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
          <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="identifier" use="required"/>
      </xsd:complexType>
    
      <!-- data types -->
      <xsd:simpleType name="direction">
        <xsd:restriction base="xsd:string">
          <xsd:enumeration value="I"/>
          <xsd:enumeration value="O"/>
          <xsd:enumeration value="IO"/>
        </xsd:restriction>
      </xsd:simpleType>
    
      <xsd:simpleType name="identifier">
        <xsd:restriction base="xsd:string">
          <xsd:pattern value="[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*"/>
        </xsd:restriction>
      </xsd:simpleType>
    
      <xsd:simpleType name="identifierList">
        <xsd:list itemType="identifier"/>
      </xsd:simpleType>
    
      <xsd:simpleType name="scope">
        <xsd:restriction base="xsd:string">
          <xsd:enumeration value=""/>
          <xsd:enumeration value="private"/>
          <xsd:enumeration value="protected"/>
          <xsd:enumeration value="public"/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:schema>
    
    cmtk-3.0.0/Utilities/mxml/doc/reference.html0000644000177700000170000022200211747570117020040 0ustar torstenman Documentation

    CLibrary Reference

    Contents

    Functions

    mxmlAdd

    Add a node to a tree.

    void mxmlAdd (
        mxml_node_t *parent,
        int where,
        mxml_node_t *child,
        mxml_node_t *node
    );

    Parameters

    parent
    Parent node
    where
    Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER
    child
    Child node for where or MXML_ADD_TO_PARENT
    node
    Node to add

    Discussion

    Adds the specified node to the parent. If the child argument is not NULL, puts the new node before or after the specified child depending on the value of the where argument. If the child argument is NULL, puts the new node at the beginning of the child list (MXML_ADD_BEFORE) or at the end of the child list (MXML_ADD_AFTER). The constant MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.

    mxmlDelete

    Delete a node and all of its children.

    void mxmlDelete (
        mxml_node_t *node
    );

    Parameters

    node
    Node to delete

    Discussion

    If the specified node has a parent, this function first removes the node from its parent using the mxmlRemove() function.

     Mini-XML 2.4 mxmlElementDeleteAttr

    Delete an attribute.

    void mxmlElementDeleteAttr (
        mxml_node_t *node,
        const char *name
    );

    Parameters

    node
    Element
    name
    Attribute name

    mxmlElementGetAttr

    Get an attribute.

    const char *mxmlElementGetAttr (
        mxml_node_t *node,
        const char *name
    );

    Parameters

    node
    Element node
    name
    Name of attribute

    Return Value

    Attribute value or NULL

    Discussion

    This function returns NULL if the node is not an element or the named attribute does not exist.

    mxmlElementSetAttr

    Set an attribute.

    void mxmlElementSetAttr (
        mxml_node_t *node,
        const char *name,
        const char *value
    );

    Parameters

    node
    Element node
    name
    Name of attribute
    value
    Attribute value

    Discussion

    If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is copied into the element node. This function does nothing if the node is not an element.

     Mini-XML 2.3 mxmlElementSetAttrf

    Set an attribute with a formatted value.

    void mxmlElementSetAttrf (
        mxml_node_t *node,
        const char *name,
        const char *format,
        ...
    );

    Parameters

    node
    Element node
    name
    Name of attribute
    format
    Printf-style attribute value
    ...
    Additional arguments as needed

    Discussion

    If the named attribute already exists, the value of the attribute is replaced by the new formatted string. The formatted string value is copied into the element node. This function does nothing if the node is not an element.

    mxmlEntityAddCallback

    Add a callback to convert entities to Unicode.

    int mxmlEntityAddCallback (
        mxml_entity_cb_t cb
    );

    Parameters

    cb
    Callback function to add

    Return Value

    0 on success, -1 on failure

    mxmlEntityGetName

    Get the name that corresponds to the character value.

    const char *mxmlEntityGetName (
        int val
    );

    Parameters

    val
    Character value

    Return Value

    Entity name or NULL

    Discussion

    If val does not need to be represented by a named entity, NULL is returned.

    mxmlEntityGetValue

    Get the character corresponding to a named entity.

    int mxmlEntityGetValue (
        const char *name
    );

    Parameters

    name
    Entity name

    Return Value

    Character value or -1 on error

    Discussion

    The entity name can also be a numeric constant. -1 is returned if the name is not known.

    mxmlEntityRemoveCallback

    Remove a callback.

    void mxmlEntityRemoveCallback (
        mxml_entity_cb_t cb
    );

    Parameters

    cb
    Callback function to remove

    mxmlFindElement

    Find the named element.

    mxml_node_t *mxmlFindElement (
        mxml_node_t *node,
        mxml_node_t *top,
        const char *name,
        const char *attr,
        const char *value,
        int descend
    );

    Parameters

    node
    Current node
    top
    Top node
    name
    Element name or NULL for any
    attr
    Attribute name, or NULL for none
    value
    Attribute value, or NULL for any
    descend
    Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST

    Return Value

    Element node or NULL

    Discussion

    The search is constrained by the name, attribute name, and value; any NULL names or values are treated as wildcards, so different kinds of searches can be implemented by looking for all elements of a given name or all elements with a specific attribute. The descend argument determines whether the search descends into child nodes; normally you will use MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find additional direct descendents of the node. The top node argument constrains the search to a particular node's children.

     Mini-XML 2.7 mxmlFindPath

    Find a node with the given path.

    mxml_node_t *mxmlFindPath (
        mxml_node_t *top,
        const char *path
    );

    Parameters

    top
    Top node
    path
    Path to element

    Return Value

    Found node or NULL

    Discussion

    The "path" is a slash-separated list of element names. The name "*" is considered a wildcard for one or more levels of elements. For example, "foo/one/two", "bar/two/one", "*/one", and so forth.

    The first child node of the found node is returned if the given node has children and the first child is a value node.

     Mini-XML 2.7 mxmlGetCDATA

    Get the value for a CDATA node.

    const char *mxmlGetCDATA (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    CDATA value or NULL

    Discussion

    NULL is returned if the node is not a CDATA element.

     Mini-XML 2.7 mxmlGetCustom

    Get the value for a custom node.

    const void *mxmlGetCustom (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Custom value or NULL

    Discussion

    NULL is returned if the node (or its first child) is not a custom value node.

     Mini-XML 2.7 mxmlGetElement

    Get the name for an element node.

    const char *mxmlGetElement (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Element name or NULL

    Discussion

    NULL is returned if the node is not an element node.

     Mini-XML 2.7 mxmlGetFirstChild

    Get the first child of an element node.

    mxml_node_t *mxmlGetFirstChild (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    First child or NULL

    Discussion

    NULL is returned if the node is not an element node or if the node has no children.

     Mini-XML 2.7 mxmlGetInteger

    Get the integer value from the specified node or its first child.

    int mxmlGetInteger (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Integer value or 0

    Discussion

    0 is returned if the node (or its first child) is not an integer value node.

     Mini-XML 2.7 mxmlGetLastChild

    Get the last child of an element node.

    mxml_node_t *mxmlGetLastChild (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Last child or NULL

    Discussion

    NULL is returned if the node is not an element node or if the node has no children.

    mxmlGetNextSibling

    Return the node type...

    mxml_node_t *mxmlGetNextSibling (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Get the next node for the current parent.

    NULL is returned if this is the last child for the current parent.

     Mini-XML 2.7 mxmlGetOpaque

    Get an opaque string value for a node or its first child.

    const char *mxmlGetOpaque (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Opaque string or NULL

    Discussion

    NULL is returned if the node (or its first child) is not an opaque value node.

     Mini-XML 2.7 mxmlGetParent

    Get the parent node.

    mxml_node_t *mxmlGetParent (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Parent node or NULL

    Discussion

    NULL is returned for a root node.

     Mini-XML 2.7 mxmlGetPrevSibling

    Get the previous node for the current parent.

    mxml_node_t *mxmlGetPrevSibling (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Previous node or NULL

    Discussion

    NULL is returned if this is the first child for the current parent.

     Mini-XML 2.7 mxmlGetReal

    Get the real value for a node or its first child.

    double mxmlGetReal (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Real value or 0.0

    Discussion

    0.0 is returned if the node (or its first child) is not a real value node.

     Mini-XML 2.7 mxmlGetRefCount

    Get the current reference (use) count for a node.

    int mxmlGetRefCount (
        mxml_node_t *node
    );

    Parameters

    node
    Node

    Return Value

    Reference count

    Discussion

    The initial reference count of new nodes is 1. Use the mxmlRetain and mxmlRelease functions to increment and decrement a node's reference count. .

     Mini-XML 2.7 mxmlGetText

    Get the text value for a node or its first child.

    const char *mxmlGetText (
        mxml_node_t *node,
        int *whitespace
    );

    Parameters

    node
    Node to get
    whitespace
    1 if string is preceded by whitespace, 0 otherwise

    Return Value

    Text string or NULL

    Discussion

    NULL is returned if the node (or its first child) is not a text node. The "whitespace" argument can be NULL.

     Mini-XML 2.7 mxmlGetType

    Get the node type.

    mxml_type_t mxmlGetType (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    Type of node

    Discussion

    MXML_IGNORE is returned if "node" is NULL.

     Mini-XML 2.7 mxmlGetUserData

    Get the user data pointer for a node.

    void *mxmlGetUserData (
        mxml_node_t *node
    );

    Parameters

    node
    Node to get

    Return Value

    User data pointer

    mxmlIndexDelete

    Delete an index.

    void mxmlIndexDelete (
        mxml_index_t *ind
    );

    Parameters

    ind
    Index to delete

    mxmlIndexEnum

    Return the next node in the index.

    mxml_node_t *mxmlIndexEnum (
        mxml_index_t *ind
    );

    Parameters

    ind
    Index to enumerate

    Return Value

    Next node or NULL if there is none

    Discussion

    Nodes are returned in the sorted order of the index.

    mxmlIndexFind

    Find the next matching node.

    mxml_node_t *mxmlIndexFind (
        mxml_index_t *ind,
        const char *element,
        const char *value
    );

    Parameters

    ind
    Index to search
    element
    Element name to find, if any
    value
    Attribute value, if any

    Return Value

    Node or NULL if none found

    Discussion

    You should call mxmlIndexReset() prior to using this function for the first time with a particular set of "element" and "value" strings. Passing NULL for both "element" and "value" is equivalent to calling mxmlIndexEnum().

     Mini-XML 2.7 mxmlIndexGetCount

    Get the number of nodes in an index.

    int mxmlIndexGetCount (
        mxml_index_t *ind
    );

    Parameters

    ind
    Index of nodes

    Return Value

    Number of nodes in index

    mxmlIndexNew

    Create a new index.

    mxml_index_t *mxmlIndexNew (
        mxml_node_t *node,
        const char *element,
        const char *attr
    );

    Parameters

    node
    XML node tree
    element
    Element to index or NULL for all
    attr
    Attribute to index or NULL for none

    Return Value

    New index

    Discussion

    The index will contain all nodes that contain the named element and/or attribute. If both "element" and "attr" are NULL, then the index will contain a sorted list of the elements in the node tree. Nodes are sorted by element name and optionally by attribute value if the "attr" argument is not NULL.

    mxmlIndexReset

    Reset the enumeration/find pointer in the index and return the first node in the index.

    mxml_node_t *mxmlIndexReset (
        mxml_index_t *ind
    );

    Parameters

    ind
    Index to reset

    Return Value

    First node or NULL if there is none

    Discussion

    This function should be called prior to using mxmlIndexEnum() or mxmlIndexFind() for the first time.

    mxmlLoadFd

    Load a file descriptor into an XML node tree.

    mxml_node_t *mxmlLoadFd (
        mxml_node_t *top,
        int fd,
        mxml_load_cb_t cb
    );

    Parameters

    top
    Top node
    fd
    File descriptor to read from
    cb
    Callback function or MXML_NO_CALLBACK

    Return Value

    First node or NULL if the file could not be read.

    Discussion

    The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

    mxmlLoadFile

    Load a file into an XML node tree.

    mxml_node_t *mxmlLoadFile (
        mxml_node_t *top,
        FILE *fp,
        mxml_load_cb_t cb
    );

    Parameters

    top
    Top node
    fp
    File to read from
    cb
    Callback function or MXML_NO_CALLBACK

    Return Value

    First node or NULL if the file could not be read.

    Discussion

    The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

    mxmlLoadString

    Load a string into an XML node tree.

    mxml_node_t *mxmlLoadString (
        mxml_node_t *top,
        const char *s,
        mxml_load_cb_t cb
    );

    Parameters

    top
    Top node
    s
    String to load
    cb
    Callback function or MXML_NO_CALLBACK

    Return Value

    First node or NULL if the string has errors.

    Discussion

    The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

     Mini-XML 2.3 mxmlNewCDATA

    Create a new CDATA node.

    mxml_node_t *mxmlNewCDATA (
        mxml_node_t *parent,
        const char *data
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    data
    Data string

    Return Value

    New node

    Discussion

    The new CDATA node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new CDATA node has no parent. The data string must be nul-terminated and is copied into the new node. CDATA nodes use the MXML_ELEMENT type.

     Mini-XML 2.1 mxmlNewCustom

    Create a new custom data node.

    mxml_node_t *mxmlNewCustom (
        mxml_node_t *parent,
        void *data,
        mxml_custom_destroy_cb_t destroy
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    data
    Pointer to data
    destroy
    Function to destroy data

    Return Value

    New node

    Discussion

    The new custom node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent. NULL can be passed when the data in the node is not dynamically allocated or is separately managed.

    mxmlNewElement

    Create a new element node.

    mxml_node_t *mxmlNewElement (
        mxml_node_t *parent,
        const char *name
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    name
    Name of element

    Return Value

    New node

    Discussion

    The new element node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent.

    mxmlNewInteger

    Create a new integer node.

    mxml_node_t *mxmlNewInteger (
        mxml_node_t *parent,
        int integer
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    integer
    Integer value

    Return Value

    New node

    Discussion

    The new integer node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new integer node has no parent.

    mxmlNewOpaque

    Create a new opaque string.

    mxml_node_t *mxmlNewOpaque (
        mxml_node_t *parent,
        const char *opaque
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    opaque
    Opaque string

    Return Value

    New node

    Discussion

    The new opaque node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new opaque node has no parent. The opaque string must be nul-terminated and is copied into the new node.

    mxmlNewReal

    Create a new real number node.

    mxml_node_t *mxmlNewReal (
        mxml_node_t *parent,
        double real
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    real
    Real number value

    Return Value

    New node

    Discussion

    The new real number node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new real number node has no parent.

    mxmlNewText

    Create a new text fragment node.

    mxml_node_t *mxmlNewText (
        mxml_node_t *parent,
        int whitespace,
        const char *string
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    whitespace
    1 = leading whitespace, 0 = no whitespace
    string
    String

    Return Value

    New node

    Discussion

    The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The text string must be nul-terminated and is copied into the new node.

    mxmlNewTextf

    Create a new formatted text fragment node.

    mxml_node_t *mxmlNewTextf (
        mxml_node_t *parent,
        int whitespace,
        const char *format,
        ...
    );

    Parameters

    parent
    Parent node or MXML_NO_PARENT
    whitespace
    1 = leading whitespace, 0 = no whitespace
    format
    Printf-style frmat string
    ...
    Additional args as needed

    Return Value

    New node

    Discussion

    The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The format string must be nul-terminated and is formatted into the new node.

     Mini-XML 2.3 mxmlNewXML

    Create a new XML document tree.

    mxml_node_t *mxmlNewXML (
        const char *version
    );

    Parameters

    version
    Version number to use

    Return Value

    New ?xml node

    Discussion

    The "version" argument specifies the version number to put in the ?xml element node. If NULL, version 1.0 is assumed.

     Mini-XML 2.3 mxmlRelease

    Release a node.

    int mxmlRelease (
        mxml_node_t *node
    );

    Parameters

    node
    Node

    Return Value

    New reference count

    Discussion

    When the reference count reaches zero, the node (and any children) is deleted via mxmlDelete().

    mxmlRemove

    Remove a node from its parent.

    void mxmlRemove (
        mxml_node_t *node
    );

    Parameters

    node
    Node to remove

    Discussion

    Does not free memory used by the node - use mxmlDelete() for that. This function does nothing if the node has no parent.

     Mini-XML 2.3 mxmlRetain

    Retain a node.

    int mxmlRetain (
        mxml_node_t *node
    );

    Parameters

    node
    Node

    Return Value

    New reference count

     Mini-XML 2.3 mxmlSAXLoadFd

    Load a file descriptor into an XML node tree using a SAX callback.

    mxml_node_t *mxmlSAXLoadFd (
        mxml_node_t *top,
        int fd,
        mxml_load_cb_t cb,
        mxml_sax_cb_t sax_cb,
        void *sax_data
    );

    Parameters

    top
    Top node
    fd
    File descriptor to read from
    cb
    Callback function or MXML_NO_CALLBACK
    sax_cb
    SAX callback or MXML_NO_CALLBACK
    sax_data
    SAX user data

    Return Value

    First node or NULL if the file could not be read.

    Discussion

    The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

    The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node.

     Mini-XML 2.3 mxmlSAXLoadFile

    Load a file into an XML node tree using a SAX callback.

    mxml_node_t *mxmlSAXLoadFile (
        mxml_node_t *top,
        FILE *fp,
        mxml_load_cb_t cb,
        mxml_sax_cb_t sax_cb,
        void *sax_data
    );

    Parameters

    top
    Top node
    fp
    File to read from
    cb
    Callback function or MXML_NO_CALLBACK
    sax_cb
    SAX callback or MXML_NO_CALLBACK
    sax_data
    SAX user data

    Return Value

    First node or NULL if the file could not be read.

    Discussion

    The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

    The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node.

     Mini-XML 2.3 mxmlSAXLoadString

    Load a string into an XML node tree using a SAX callback.

    mxml_node_t *mxmlSAXLoadString (
        mxml_node_t *top,
        const char *s,
        mxml_load_cb_t cb,
        mxml_sax_cb_t sax_cb,
        void *sax_data
    );

    Parameters

    top
    Top node
    s
    String to load
    cb
    Callback function or MXML_NO_CALLBACK
    sax_cb
    SAX callback or MXML_NO_CALLBACK
    sax_data
    SAX user data

    Return Value

    First node or NULL if the string has errors.

    Discussion

    The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

    The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node.

    mxmlSaveAllocString

    Save an XML tree to an allocated string.

    char *mxmlSaveAllocString (
        mxml_node_t *node,
        mxml_save_cb_t cb
    );

    Parameters

    node
    Node to write
    cb
    Whitespace callback or MXML_NO_CALLBACK

    Return Value

    Allocated string or NULL

    Discussion

    This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed using the free() function when you are done with it. NULL is returned if the node would produce an empty string or if the string cannot be allocated.

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

    mxmlSaveFd

    Save an XML tree to a file descriptor.

    int mxmlSaveFd (
        mxml_node_t *node,
        int fd,
        mxml_save_cb_t cb
    );

    Parameters

    node
    Node to write
    fd
    File descriptor to write to
    cb
    Whitespace callback or MXML_NO_CALLBACK

    Return Value

    0 on success, -1 on error.

    Discussion

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

    mxmlSaveFile

    Save an XML tree to a file.

    int mxmlSaveFile (
        mxml_node_t *node,
        FILE *fp,
        mxml_save_cb_t cb
    );

    Parameters

    node
    Node to write
    fp
    File to write to
    cb
    Whitespace callback or MXML_NO_CALLBACK

    Return Value

    0 on success, -1 on error.

    Discussion

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

    mxmlSaveString

    Save an XML node tree to a string.

    int mxmlSaveString (
        mxml_node_t *node,
        char *buffer,
        int bufsize,
        mxml_save_cb_t cb
    );

    Parameters

    node
    Node to write
    buffer
    String buffer
    bufsize
    Size of string buffer
    cb
    Whitespace callback or MXML_NO_CALLBACK

    Return Value

    Size of string

    Discussion

    This function returns the total number of bytes that would be required for the string but only copies (bufsize - 1) characters into the specified buffer.

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

     Mini-XML 2.3 mxmlSetCDATA

    Set the element name of a CDATA node.

    int mxmlSetCDATA (
        mxml_node_t *node,
        const char *data
    );

    Parameters

    node
    Node to set
    data
    New data string

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it (or its first child) is not a CDATA element node.

     Mini-XML 2.1 mxmlSetCustom

    Set the data and destructor of a custom data node.

    int mxmlSetCustom (
        mxml_node_t *node,
        void *data,
        mxml_custom_destroy_cb_t destroy
    );

    Parameters

    node
    Node to set
    data
    New data pointer
    destroy
    New destructor function

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it (or its first child) is not a custom node.

    mxmlSetCustomHandlers

    Set the handling functions for custom data.

    void mxmlSetCustomHandlers (
        mxml_custom_load_cb_t load,
        mxml_custom_save_cb_t save
    );

    Parameters

    load
    Load function
    save
    Save function

    Discussion

    The load function accepts a node pointer and a data string and must return 0 on success and non-zero on error.

    The save function accepts a node pointer and must return a malloc'd string on success and NULL on error.

    mxmlSetElement

    Set the name of an element node.

    int mxmlSetElement (
        mxml_node_t *node,
        const char *name
    );

    Parameters

    node
    Node to set
    name
    New name string

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it is not an element node.

    mxmlSetErrorCallback

    Set the error message callback.

    void mxmlSetErrorCallback (
        mxml_error_cb_t cb
    );

    Parameters

    cb
    Error callback function

    mxmlSetInteger

    Set the value of an integer node.

    int mxmlSetInteger (
        mxml_node_t *node,
        int integer
    );

    Parameters

    node
    Node to set
    integer
    Integer value

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it (or its first child) is not an integer node.

    mxmlSetOpaque

    Set the value of an opaque node.

    int mxmlSetOpaque (
        mxml_node_t *node,
        const char *opaque
    );

    Parameters

    node
    Node to set
    opaque
    Opaque string

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it (or its first child) is not an opaque node.

    mxmlSetReal

    Set the value of a real number node.

    int mxmlSetReal (
        mxml_node_t *node,
        double real
    );

    Parameters

    node
    Node to set
    real
    Real number value

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it (or its first child) is not a real number node.

    mxmlSetText

    Set the value of a text node.

    int mxmlSetText (
        mxml_node_t *node,
        int whitespace,
        const char *string
    );

    Parameters

    node
    Node to set
    whitespace
    1 = leading whitespace, 0 = no whitespace
    string
    String

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it (or its first child) is not a text node.

    mxmlSetTextf

    Set the value of a text node to a formatted string.

    int mxmlSetTextf (
        mxml_node_t *node,
        int whitespace,
        const char *format,
        ...
    );

    Parameters

    node
    Node to set
    whitespace
    1 = leading whitespace, 0 = no whitespace
    format
    Printf-style format string
    ...
    Additional arguments as needed

    Return Value

    0 on success, -1 on failure

    Discussion

    The node is not changed if it (or its first child) is not a text node.

     Mini-XML 2.7 mxmlSetUserData

    Set the user data pointer for a node.

    int mxmlSetUserData (
        mxml_node_t *node,
        void *data
    );

    Parameters

    node
    Node to set
    data
    User data pointer

    Return Value

    0 on success, -1 on failure

     Mini-XML 2.3 mxmlSetWrapMargin

    Set the wrap margin when saving XML data.

    void mxmlSetWrapMargin (
        int column
    );

    Parameters

    column
    Column for wrapping, 0 to disable wrapping

    Discussion

    Wrapping is disabled when "column" is 0.

    mxmlWalkNext

    Walk to the next logical node in the tree.

    mxml_node_t *mxmlWalkNext (
        mxml_node_t *node,
        mxml_node_t *top,
        int descend
    );

    Parameters

    node
    Current node
    top
    Top node
    descend
    Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST

    Return Value

    Next node or NULL

    Discussion

    The descend argument controls whether the first child is considered to be the next node. The top node argument constrains the walk to the node's children.

    mxmlWalkPrev

    Walk to the previous logical node in the tree.

    mxml_node_t *mxmlWalkPrev (
        mxml_node_t *node,
        mxml_node_t *top,
        int descend
    );

    Parameters

    node
    Current node
    top
    Top node
    descend
    Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST

    Return Value

    Previous node or NULL

    Discussion

    The descend argument controls whether the previous node's last child is considered to be the previous node. The top node argument constrains the walk to the node's children.

    Data Types

    mxml_custom_destroy_cb_t

    Custom data destructor

    typedef void (*mxml_custom_destroy_cb_t)(void *);

    mxml_custom_load_cb_t

    Custom data load callback function

    typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);

    mxml_custom_save_cb_t

    Custom data save callback function

    typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *);

    mxml_entity_cb_t

    Entity callback function

    typedef int (*mxml_entity_cb_t)(const char *);

    mxml_error_cb_t

    Error callback function

    typedef void (*mxml_error_cb_t)(const char *);

    mxml_index_t

    An XML node index.

    typedef struct mxml_index_s mxml_index_t;

    mxml_load_cb_t

    Load callback function

    typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *);

    mxml_node_t

    An XML node.

    typedef struct mxml_node_s mxml_node_t;

    mxml_save_cb_t

    Save callback function

    typedef const char *(*mxml_save_cb_t)(mxml_node_t *, int);

    mxml_sax_cb_t

    SAX callback function

    typedef void (*mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *);

    mxml_sax_event_t

    SAX event type.

    typedef enum mxml_sax_event_e mxml_sax_event_t;

    mxml_type_t

    The XML node type.

    typedef enum mxml_type_e mxml_type_t;

    Constants

    mxml_sax_event_e

    SAX event type.

    Constants

    MXML_SAX_CDATA
    CDATA node
    MXML_SAX_COMMENT
    Comment node
    MXML_SAX_DATA
    Data node
    MXML_SAX_DIRECTIVE
    Processing directive node
    MXML_SAX_ELEMENT_CLOSE
    Element closed
    MXML_SAX_ELEMENT_OPEN
    Element opened

    mxml_type_e

    The XML node type.

    Constants

    MXML_CUSTOM  Mini-XML 2.1 
    Custom data
    MXML_ELEMENT
    XML element with attributes
    MXML_IGNORE  Mini-XML 2.3 
    Ignore/throw away node
    MXML_INTEGER
    Integer value
    MXML_OPAQUE
    Opaque string
    MXML_REAL
    Real value
    MXML_TEXT
    Text fragment
    cmtk-3.0.0/Utilities/mxml/doc/logo.xcf.gz0000644000177700000170000003314311210045173017263 0ustar torstenman‹äš xTE¶ÇÏíNÒ IY „¤“@ÈB‡„}Ç EAGBÂ#áãŒÁuÔ§8"¢>QŸ#Œ¨£‚Š".#âs@QÑÙ•}‰„¾Ugþ§ª3“D?}‹ŸAÍ÷üNÕ½·»êÔ©SçvÕ”²3ýs'NöO.›^JDÞ¬˜¿xˆãà_"$òœ;ˆDð— Irˆr_K ?;˜X1cFiy….ŠP s¥lFÉ”ÒÀ”Ye“BÈÜʪyÓKýeåU¥³*K'V•U”Wæ5Ëe6\ÏŸUZ>nÔHùº %•¥Ie³¬Ëù§WÍBåÿÙq¦Í®¬*›<Ï?±TüX¾±¬¼4Pç8âú=šP170£bR©Ò¼ò’eCU ºWϼnäï¸ÈÈzÈ&ȧ ï ß9ÁHF¤@r!=!ƒ —C¦BæBn†,,‡¼y ² ‚ç#ð¼Ïûð¼Ïûð¼Ïûð¼ÏG&@ÖBÞ…l‡ÓÝg+‚“áûcGÁ‘ÎF G”=q8œçsÄŒk‰Z%J{§ž$jƒÏNëEÔv QúÅD¸ß?Ÿ(ó>¢,LƒìÕDížÚ·‚ ¯9³‰:´‡|H”{#Q^7È^¢ü»!Bp>îËß Ù Áw„Cà­x®÷|@Ôq(Q r5Q!¼¿ðîí4òäY¢âeD]`×nhw÷D½#êó4Q??QÿŽD`°ÇY’gO#:7è¼|¢ ž#Œø6Saè5DÃ@– _Ht ¾ëÒîD£Î!úU¢ÑLj~qƒÙ8c0özH Ñ•˜ÙWN„¤Þ¿»bX -Á׺ˈÙË?C˃G‹ÆœY›¹=»íà „ëô~ž3ÙÝ:È¡Rý·q[vkf‡SRQwqVw¤ R\Naµ:Ž2ÑOÍɬžŒ lÒ•Ü’Õ3áÔŽ”ó$'²ÚK9¤RŽr<«#Ù”KzT=‰òHEà8VëÊ'}#7g¥;RéŽPõr Þα¬óE{cX¿B…¤§ˆ6F´s9šÕ‰f¢fAÕOS'Ò ¢M-B´,*"ÜuÈ1Ô/S±à6 ¢¡» ÖÔ‹jâ†ÞºŽ·Ýy¶—:S0ïê·‡³»çŽÎh…›2w¾Ý]?:q{?äìî˜,=wó_EßÝÏíŸTÑËœÊêµµ%7á~ ùnuµ&5rg°z«µ"Õü1Îbut0\NuÙÎíØÕsøœ*©å¬îòˆ£ynÆp©‡Â0XÊ·’;B÷ˆ{E¿( *î q¯â^Ñâ^*ØWœÊ·N¥ö¤ˆ+y‡+©gø’^ þ3®¤Ká>µ‡nåŠÿÜMmö‹ÿ¸Ös_ÖGá>)\sdõõãûeµŠñÂ[ƒÍïäÅgqP¯ìîÀ·;±z:ž`µk5'´ïå$´»€Õ¢0jAhûBs'eé[.«µað4ôogÞQ:°‚þçÈ'S{V§Ó õX¨+7ÃP? .²1 †z¥ J,Ú0è—Ž¡^{g‰‰Z7 ˆô*íq2Οróc/¾÷ùc§ô©Ã»·oÞ°òöÙ-žÚ“> ‡>ýÉc•b1–i<ýRyFÒÏî–kÛš ª§zÐ0LœOÆzÐþìnœI”~¾ÒýÌg·¶ÒÀ ¯ùaèØP¨•*Ã`±Z ‰áZæÁ("Ü Ì†YÆb<»²ªÉG¬ÀØmŠ„Ýî0~+z°Ú†ÑíɺÌ@}‡îÅúfu$£Ü›õ4µÍƒ Ñ‡õË ‚ÇðÒˆpá²Xb±×Cð•+ÿOŽ£è–¹'/yWKlZŒ¸Ic_”èõ.Úê¶»ßeøA0Jœ1÷/Ðu=s=s´DáâºCjàºú*@_+árl¢ÇжVÒ÷K8]MÅÉy¬7ÂgôdÑ>–ÈëÛ#‘w ««E;,ZÑjat½ Z’|ˆA©ÅÙ™ @KŒR}i –Ÿ)Þ’F6èõ|¤kMÝ¢G¿ÑólN³|Ñ8™Ü!'A¹ö(V~¤‘¿9¯Þ/ELNzÎ O¾p/ü«~Ø­ðyÄäĵĘ9Ÿ! cÝïúæ¢ò9lj±â÷—µ]–ûãˆÆXëG°ª#:§~ŒU>æ=d,ñÎãÇY+{3–ù~®DeJÜ#«º³Rbó8îÇúÒÐňE›ÿój<üàÆþјÒÝØÝuM&ÂCvß¹8 Ñ£˜Ý.µÁÚ V‡cj"mAZ+AéÙXµo÷Ú¨}›c£ö=¡¨½Ök£ö®dL4Ì·6h?h‚¶:œlƒ÷omð>oƒ÷BužÝmìžkÑÙ†ðc^Â_@°nžß¢ÝùC+î\¾vãίž¿>¸óãž^T5ªGªƒì£Öi7yé{§%Hxnþà–øœ`äEì@úÜ~{ÿ04PËÈ‰ð†œ«õ2å9@ïhu2©„ÕÈÈ„? GDæý#²ÑTd`ïÂC‘C¤CŽÖ†ôUÊûzžFú"åÙ„ £-éi*ñ4§s:ég-fX(ç ¼ Ò¯ZüÁbºÅ%½€†3æ™ÿÇ‹”NCrËjƒÄ ‰Þu" ²Á×êH-X4P†!#D¾8Á@}‰\1AÖ3Úì LdÝËb™ú:ÙY’d« TMu –¬/´øƒÅg@2ëVHR“åšÁÕOZ|´b-‰Pd1Ô¢ÌâF‹‡-ÖY¼c±Õâ3‹½G,jÎù†ÄrƒWMç²3àµòÇ‘ú~ÖÔ¯“M-õm&©“ywnÑÅ"Ý"É"ÚÂkÐåg/ _á²dÆ›„˜E±…MØu¢E´…× íg/õ Ô8ëý¥I}[4}zæäþ¿”¼ÿö>-o¦æ×„ÉçZäX´¶ˆ³3hó³—úÊ7j“¶´ˆµ·p?¥ÿb¤¾iš}K.÷K’†ykSç’M-?¥\¶:¢áF\ØÞ}OêרÅMi}·TG´ýIåb­Ûô«ô÷ä3Ú{¦ç4áßhqS/ñß-Õ ãYS¯ºß»*7²î™¾2ÇÚÿdVÏêðÙMø§qù»EßBúÙ°Z)»¤™5¢vƒªç‰¶V*#þµé³€hÒp±ü¤ßêq é2å}ÛüŒ«º(.俤ï2Pq²Gz´r^æŽÜ‚T‡Ó\Àñ¤¯7PQ²óž@z0Рu1g‘HýH½ë¡¾¤xþ»üq8õ!G^Djw3êMÖs ÔáxêE^Ö¿7P5­©'…ɶ©@¹í©¢Œ^DÈÏEÝk€†f¹•ô t´©°-†z²œOxH »}V’ÄL×Kí8©M«‘ÚuŽÔ>$ê©©î¬eú·¢:ë¤zk„Ü1Lžë#µáÛä†%%¿[ãúÞR÷•Ô^&µ7Kíjù\•qJöOú¥úrC¥hÝå†÷ÃÌW¼.7¨.äkÔŸù¤>‰² çþ /g?>]ö Ó -Ö¨Zµ¥ ù-Ú ÊâIµÏ¡4òËqƒ1‹-6(ÝœÚP¦lìT[¬1PGíVº°ñ^vôJc?·ày-‹\a±Èâ ®4Ô}9APe±ÈÃì6Ôm9Qp™Åí€\R¾ZC݃“3-–-T„ ñCHÃÏ]Jí9õÆ­àž?ˆ|WôI$ý„ÙêQmOØ]èJþÙøÑ}€dÒØíŸ¤ƒfûGO´»@ž7í.P¡kvômv3(v—Ù Ò—Ú=!çy»”}ÊnýÎnE~l7ƒé¤³Û>©GíËú ö>§aÙTÝå J&é{ d#¾5g‘¾Ò@9¯r*g“Êr ·#ý{½ƒ[q{Ù}j……L?Íɀʨá–Èsô\‰­Æ_y7ĵT«ÃÖ §(ï—Uü¹#é; $¶Æq€ôåÊy‰›s!©œZŽåN¤¯3PQŸr I4‹ábÒs4 ÒŽcéï,©¶‰£ðö {]å¸@$ °»‘ž` —ÇN—k°]´°ÖÎÞûœ³Oÿs¿þaªtÞ­h#3>,=4QÑ Eoe'®Y°[¢ºìl¶÷ÇÔ2ž%õ“ÓulOéfsÌõ%uûð4“×Ý*ÞÞA™×IýŒ20i²¨bt`ŽS6³(@ÝÁkðÁµ¤%õ1©y·=ŸË'õ7|÷ç~’å¼½…î$5×øÎ Êú®à·î)h@Bl‹?##D²>(&B=|–š|–êªT³=æ‹P›L„ºû,uy„jŽó(÷ ´³%Ý¥âÚ‘)Dë¿Î7/„‘x1ùmq¡ŒÛ‹þœQ>ȸ÷Ât„u`ŸõÙÁ´Y|vˆ ?i­l°‘é‹û‰ü ¼eJŒÛß”ça±äÿNþœ"ÂŽ%¢ Þ:¯Á[ãö Æ‚í§Ø³v£¿vã@žc‰¢U™~\0 óhØœØò[Ðk £"†j¯fà>} kú"ƒßÈÈÜa]—™§+ñÃI>BëšÀnú/ÙÁÜÂó›`yøù9Dü ÅÜhGa×\;»eöW°\°ùÝ)ȉþ-Œš4ûÛn+}­{’'KÚÊq¥Ûa¹Sa"9uÚHþ×i9…‹h¥9´MÄÐ6‘ÃO÷ñjì‡g†î?ѶÚN¹nMší{¿ †vx?&I§ì®Æofï à'ëc!HÍ {“fLû_ÑŒé4cHŒt0Zâlà0oz![©É–FA™œÍZgÖáѦæ.¦s³=?1&*˜žú7èqÖù"M0¶‚-øWüÀP³šòaÑÇÒîK³_¬`w¨éGŸë£¦¿‰†‘"ØhÐ?û‚8`ÆNf ½¸sL1ºïEcµ…®3ˆ®ß9®ì¡V@ŽÇ·Á‡ŸX8K}Ûë㨜DÇñÑ6â8~ ?}t}ŠÇ¸>¨ã…ê1nê®®â~uOUWñéê*~J]Å#ÅUL»„N (hâ˨cW@·©æZˆ-ò,ÐÙäDšv…°m`é9N?Mù…!()¿³4å÷«MùÝâ¥ü^«)¿‡“4å÷ç@0±iªïoZhŽï=^Žožfõ¾èƒ}vÉzúvëI”Ó¨tº´èTÚk™Öu”^mÏO k1E‡Ñbó:œ@’ç1Ü·h<¬!õ©ÿ$5wÓhod“ºŠ"‡|$ïçí>¸ƒÔ´e¢Ä¡0€· eµ 9_å“l9w) cx7…/O%%¦ï‡¼+þ‡U¤^$5•ï|I²'ì)3B¬ž)ÚßÞL˜Gj¯Ž4üÕ|ùCR<¹—¥Q/÷W:{;HGÉØÄƒÝ¼AÛáìJáy f‘Ú££2‰»éë>y…ú p®• \†7L¯³ð3’é| ¡»Ÿ·ÅEò8©IM#õ©ŠÄ‡ùò“Ê\Æ«/ò¾LÓù¤~Iê‡òòOø¤ÛŠOæð껼ÿcRÕ¤–‘ú{R2’ò(+óâSùOÊ2µž÷eὓ”8e†:È›‚|0ƒ_çÅkH-!UIêRµ¤Úóå-¸Ò¹ ¼ØŸךNêV¶lIeŒ ·ˆìp² ü-§¢ÀŸ;ZÀ*»˜á’EyÉ¢üîeH«AÆŸ¶qŒBŽ´ñ¶KJƒ`· &Eq ÂÀ½±®¾nÝ[lK6ÛŸŒ% £ŸWJPŸáU î—k¿0 œ/y(²ÿ‰Fç;|©Ñùuêr­ÞńջX)ŽDÚdmé4 Ô©Ópºø#?á³ê £^¿Äƒêõ«R?_8²oª/o†zï2O©÷n½:èÆbGÉÐ41À(¥N_¸½„™s±¾Ãvä~˜u 8ËèF˸î8›ÇpwËC‚Ýå¶3ƒáý]àT¿c»pce»2rKµ+wlß&ÛÛø56ŸÛ~«ß vWØîL¸àC‰Þc{PG™m{R­É9­Çw}[l/jKãmoª[I‡È. ÚVìê¡Þèwa´Æs (´æø¹žËs„>~ê@˜BmY‘£Í Æþæ²ÌÂ]ŒŠgõŽàGŒ^½›O_˜yVúð¿E+z$­èa´¢·INÍ&fÌ„h-w§ í> Ü­–Peë>¤Ÿb³Ü$2ÆßÓ:Ÿ'óx}üïìœÉuýz†@bX;B£x”~Ã¥oú9}1Ôa­WÀÆ•’'P ó$ꉦÎhd@öa“Fß~Gjí¥Xŧüÿ.0í¨VäXçãwÌêÉæÚAuggŸ” %ŸI7“ªN†u^õ™,fòt°î@–ÉùšAåµ /—³Hs ‰$czCÑ3XRäD*H§Å~«ç0l=£Ûù]$ã) VweòìÃ=#Ã?™AAÌó­¬û‚‘D–)ÉÞI¤ªÙ‹½ËôLHöN<•£öÌücI Ù;Aú8ŠØ;°|÷ÇÀÆEïÄÐRícÜîX ]>µõ/S[ƒÚúá|µõ«ÕÖ?•.Ø-Sßù$AMþ©jò¿%Ø-?ÀŠåß_Lþ§hÕ7u¤É_E[??ΩԢx’Õù,E«>ªÇU‡Ê Sú"òìœ/ˆ¡ÐN ‰â—t4홊@ÄÀi.§Oe0BĪÎþ º*“ fDŒ&K¢Ók~Mmš¦©M'ÚkõÑ\õ¦çZç£×-ä8!ͽÐhÜ ÆÊÒˆÛFŸÆØÆiŒíPK §­Ä`«„ÎöDKy ÷.­²q:Wªl0TË#Þ2Ê{HLš570|“å.ÑÊ{c¤ò†{Ÿà8Ós¦@²ØL!Ç(<Ž‚)çÐkõWÔ‘ªé´ªrJbòÒŸÇɇ«M=x“¯PÜ*Aξ"vmP&_¡xW‚œ}Et°ÄqòqÎeòáþ?Çì+¢”ÉW(î– g_‘x\beöÑëäìÃÕ/3¼œº":_‚œ}!ú_beò‰æ’_ä¿ò‹¤Òÿ*™W=õä=¬¦^¹Ï)š«h¨æcÁ*”|¬7-U4^Q{ têÑÌÑrŸP4MQoïøþ MÜz^Ñ}Š®Ð4®„°¦qéÑ~l™‚®UÔ+ë=î¿FÑ-Š ¼Ãÿ_j¾×VE¥Š†kö %‰˜½­èE?V”©)a nÍ ƒ>!¨HuRcu/*š¯èš5–èh”o·¢Š&(ÊÊ¥#Á§MWÔGÓË¢Ni˜q›¢ŠFh²Y+Wã”{­T4QQŽ&¢ùa?·ca„=“|“ž'+Ž‘Ÿ2Mèg’:|F’‡²ë…„“…¿‰Þè¨ÓÜ»~Ë¢3ö1îÍ!>ð°ðõäo!?ù¾à£lópc¶òÃNG+?Ïøó…;°XGÙðóX’%¾*Ü ¿øÅ®‡m±—„ÍS”¹é=J½Ì/]2ƒ…7‹;“ìùZVäs¿fmÑD¹Š†y¢´ÊÈ[º·< h‚¢l-6rȧ¹G5š*r‡¢þš‰ÔØB3‘^Ñ=k‘¢1ŠR5=éCMÇ]¥hª¢žš³$þu†ä¨'$‡nÉ`rZ vßÑ]óAEåJV{N²›ÖiFñ, KÖø%küâ²ÆKc†ž_¶$¦ÎôÖJ‡ÿйÍ''H 鲋•ÌëB)MËŒ“"-Üæ$Éá‰Ý~^­æÕᤑú•¨n¢º½yu¯>Ê«EûkÌ0¥‰¯þÙ/±´¬B´–äˆD‘DÙbŲ*â*¤eÅã,´ªx&•œg9%çYÆëyØQ¶4qÇ·*‹Þùv,H¢½•£jû/‰îZÕÞ'éZ] ÔéOÞKOÃZMHº]Q_Mþê©Léyôׂ˜î&9PïÂ`ûæ+Å ,y _Çhh­Z*劮V”®É¡ûÅšqW4 -ûÑw^]Kwç5è›_]êª×Ι#ј,MaJƒóí9ð¿ÏÇÞiÏV—xÀ«Žþ(`—G_¸Ñ£»B^õÈŸ6`iüø+&ßpëM3oŸ=]žô{Ÿ•ô#ÿ¾­’¾ÿ·'Wãsqò¯Ù¸ ðàiÀ–óŸ™r%àyµ1·Ll¼xð1àKcnÅ︵5`¼1·AvÆí€R@•1³Ó7æ𠳟<xðàÀcîÄÿåÎLcî9p°vì¼88•ïž5e~ 00ð€<°¿÷Ÿ;ó³_Ö^¼øð) É˜ûÑÎ÷·t Œü-àc¡«í|mÌbôÏâv€|@1`$``ànÀbÀC´Ýâ­È/†übÈ/†|äË _ù2È—A¾ òe/ƒ|äË _ù2È—A¾ òe/ƒ|9äË!_ùrÈ—C¾òå/‡|9äË!_ùrÈ—C¾òå/‡|ä+ _ù ÈW@¾ò¯€|ä+ _ù ÈW@¾ò¯€|%ä+!_ ùJÈWB¾ò•¯„|%ä+!_ ùJÈWB¾ò•¯„üÈ/üÈ/üÈ/üÈW¡ªÐGUè£*ôQú¨ }T…>ZŠ>ZŠ>ZŠ>ZŠ>ZŠ>ZŠ>ZŠ>ZvŸ1+Ñ÷+Ñ÷+Ñ÷+Ñ÷+Ñ÷+—VÖ0vVbì¬ÄØY‰±ósŒ_ÔóðýƬÂ4^…ɹêã«Vžlìüð;À)cÃy siÍAÀIcž óôÃÆÔ`üÕàjð 5ø†|C ¾¡ßPƒo¨Á7¬K5f=Þ¿í±í±í±í±aó`æÁ̃ ˜06`lÀ<ØØ€öÙˆöݸø[kìG¿d]Vòc‰TVúcõ?V^eIÖɤ,°t"ѽ”ó†Î(nxé²Ðs§äÿØËÙ0‹yþ8lX¨ímžœîå‰ï¶– +ÝMŠeZKO)Þʘ–¶P*ã%ØT6ˆ³}MÐ2çf€¨UѶ–Ô ˜bƒ/}ê÷õ©zÁ`žÞ`M±qn;`}LÕ›Zo<6afÞˆ—m ƒ<…ÏØ Ã:­—ÙxÆsf· àŒª³-²ÉZm“«™Ùh“œ)©µ) Ç*l*u›1û Ût2N|5¡ŽÆÛ`Û1ƵBc,Ã÷Ú :a@ÓÉ0Nþv›MOÏäF £@›”°I¨Îvb¼äÇæÑYµÌv‘ÀÈ6 ŒŒ8l»12]"!îrÛƒ‘¤Íù(xÏöbÈãG' ƒ$0˜/!Ž{õðrhŽAú›$-/øœ-M«Õ¢¥÷hÑÒõZ´4tд¥fºzžg÷²[YH‚]Énd÷±ëØm©6_º+Éö–.b÷°kØ-ì¿b\kJã¶›‹ê¥& M0ýMSþu ××c…LSIËwž‚•ÖË4%Z°õ8ÆK¾iN¿ümŒÎ¦9~tÕnÛc š³ ƒ!Ë4G©>€aÐÁ4'Oz†#é&ÜfÊôyª ÇOÚd;³dè˜5Íèæ$ÈUB'âÖ͵èÒx.~¨*}ãe'º±… g/<‚D‡ Zó窭¶Ø†Í¤:LO÷[7Ïržli«_›o¥ÌgÉÝJÆM¹kQõ“›wÔím8|ìdc3“0ætrh܌ʵµ ;Íó×ì: ‘¹{Åœc·\P¾¿‰ÅïÙa¾‰;ÚÏœæÆ“Ç7ì­Û±ùÉêEwMWÒ-ê\{º±¡vmåŒq¡d3‰¥»Úð–)m ôð¦IñŠ 7¯c¸Ü‡UàaÚ…koŽ—âæáÆ‡Š¥œ¹³s24hŒÊ# ³¡Ê±áÕƒ Su·bx¾dK£ w“ŒÞ!Ƀ¤UbÑ¥qxIÞÈl!k)ØQØRiøštì(¬oÄñ·DÂH9**†]1̺È0S1Rº,¢(reèežU#Š#!ÓæŠQ"#Š$¡¶bB¤O¤HS[ªÝD¸ô_þò_6nˆ9=Ò èXÏ=Íi{¬ÁZ=Òóœé~,'y–ë ž{õÏ=¹ó#=¹SpBOî$½§'w6kzØrM›®ia#4-,û°`w›f…-Ól°$Œ51$+¬N³ÁªµšËd­ß’ߨÉ`Û5 l& ×$°¨½š¶BO“ŽÕƒ£ñ šV­¹_cô8h`Ÿæ€UhîW‰ÆkkõˆçL=͙ը`«5ók”Œë4l†&€µ>~n˜[¨ëg4ýk„ƶ_–,0w‚FÃ÷hØT œ×k Ømb? ™`h- Ê7hØ4è¿TÀ}Ø ¨Ý´šgþÖ8Ž@ñõ§ø¨ü=…âc<4à(½#¶´¥û½k­’¿L>ºÕÚ;ŸÐ¸Ê6Šß˜j[SI¢Ñ®´êª!¢2¶ÆÄNëB«Dº "](ÅMÅ…SJ.,Åà"n…º.„Æ?YT£4‹2 ¨P,¦*¥¨¨Ì¢ä^ßó<ç¼÷i¢ñOJ¦ò>oó}¦æÎ§÷Ü3¿çÜÏý‚Ý“ùE»7ô)zôúУ¸xo =ºÉzôÁУ;íBŽÅÅü¦Ð£¸ ÷³Gqa =ª‹;ÖPèQôçmÖŸÛãÅ^.7ú(è½y‡õæQ`Ýe½y{XèKE¡)"o;ûrØúòV  X½Ý`Ý¿£67f±iKc>ývqÔÇÞ.T|ìí§Ÿw[¼ÛæÝ–¿Ùê“n ›}Òíc‰A$Á* ’ R1(lÛo‚1ÂÚ~¾ÏÚ¾ð¶Ù°õã[ "ƒ@ƒ•?æZòü6dÅI“”AÔ #Oäy_[®øc(êþŠg÷žsv¯9ììÞgvûÄ#®eù£ŽìÙàÈÞ;Žì=íÈ^£Ï?úšÉpMÌ÷ºý¾×iƒ·L•æUçØ{Õ%jóŽ2g#(ÕÇýƒ¿º Váz—nöÏýÞÎp•Îï÷ýŽ»ˆ}Ì™½/<cŸ‡^|“áúž¿ààÞ¢Ýæ/·—Ÿu•ûŠÓ{ »ùKᎱ]mâôñôßÂÓ3Oú¸É»“¸×ü?y€Zé3H¶Ø=r¥%OöF»ãØ}B­MvR®v72}Ät]ow(å‚EÔ¾zí¦u]gw4­«Çîp|u?&½ç“Wwäý)‹”Ëçœx÷hÉ÷ÜîÝæ¹“S¾]púý9 ¥ÌOŸyb廆À/÷5…Ñc-œ„¯XØeþ–o猋ZÑ‚cf/÷]vëxÒ)ƒî y”æ~ß>r?y°xÛ¤oÇö)ÈÓ¦íáOÝQ*aÛYŸ¯;±½æÛIŸïó¡ô'};êÛ×>$¾ÕçןñmÚ·¯|b|Àf܃`µí°os¾]²iò|ćâ'}›öí”o¿ú€ù°Ñ?ëÛ”oú¶èCç›mâ>üð¶í Ûµ¤ÿÎ×h°{Ù`÷±ÁÔ\éÃ*l.5ÖŽ¤±v&¥†M*m¦´‘Ú›(mžöÆ©¶4-¢ê ¥Ö»'ëÔÿå îA"áü“æ…]?!Ê¡þ97ÆÆé Æü±mNöOùvÁܲ ¬Œï?e.t>æOÝ|×´¦?.Ñ·gÅ|ê l;çæÚ^{"gPŠö`ÎË}þ`ÎIßN¸å6dO ÂѶ܀ô‡uNúvÜ,×ÜàÏìÜëÛŒogíisá¿oð|Í·“|˜¼ÏŸßù¤oG}ûÚ}ó­îå=ãÛ´o_ù3ê¬>nõ°Õ9«—ÌjA±ç N£œBù5(°¢¨egqѳbéÉÊuUþÅðw. ägQ¦P>DÁ„øoá:‚±»¬Ø¨íMµÊjÅ7Ù–¼ÓߺޮÇ|;íÛE 0´@—ŠÕ «¬±úÕ« «MXƒ8ÛQª((ûQ¢¼‰2ƒò>Ê,Ê&(‰ŽP"MP2 ^¡ìÓµ’w·’Ç·’Øî¶û‰©×ØîC¦eê]¦ž¦|ÎÔûL=Qù¤òMS/Uþ*¼Öîñ¯óã÷»Ðòž”w¨‡J³t;7òmNhé‹Nµx¦pPé§–îêt‹ó:⩤—Z<ÚÃ-þ-Ü\z»¥ÓKß.0=áÒ!¦_ÜçY¦'[œeøÌtKÚi7¨éW—î5¼l:Û¥Ï=äOŽ:áV¸;ânÓ/§{N/½tÖá³Óu¼[òtèé×Ó½§—Og¿ôùáúó3~"ÀÏ:~Uù§_o¨­&vµõd{?¦}ØÞƒiÿ¥½—šê¹ÔMÍRõ› ÕÔdU¯¡Ïº‡pMB²7§£å9B4z¢‡¯t š¨¥¥Jƒv븛¯¥Kc6-MÛÒÂ…¡K{·4{aýÊ ŽÆ°lb˜Æ´KCö2ÍfZÏr¢£1m65MëÒ†¡M{›f·¼ïh…›1N›œ¦9-ôÒPßæ–yÏ=÷q² Œøvû*]«8¾µìÛU¿åê|Ûf‹¦MvÈ d3’7gÙbô˜§¢ï<œ…o³«¡>‰¾•`ŠðAá„ … ?Ž(<0Œ°EaŒ€f„7 wú( ÀðH ’r„O¥°#¼¨%Ká—@1dͦ dè&à  œ@:v óò ôpÑî"ëÿz?~‡ˆ H ž@$“€&qM›D9 vó$ôI”@(ñP¢DG ’Š+%fJè”*Tñ©ÄU ¯e%Ø*ΕØ+!X1±Dd ÌŠŸ%NK¸–¨­È[‚¸Är éŠÙ%ÂK —x¯h_¿D 5,Š˜P1cÇÄ #M'©ü0Ée‚ÌN5W³¬Ò"¯úç’V;¯ñþâ׸œë“nݸˆ #(fP ¡˜B1†bѪbÅ&¢MÅ,ŠaD›ŠmD›Šyÿˆ‰')f- ŽRL%Zœ%xK±—à0Ác‚ËD{‚Ó¯)v'xNphÏîñ¯ïã'ÿ@‚lI ’”ä*IY’¹$I“t&YM’›ä8Iu’ñ$ñIþS8(éP²¢$GÉ‘ +%eJæ”*yTᩤUÉ® e%ÙJÎUØ+)X2±$dÌ’Ÿ%MK¶V¨-É[r¸¤ré’Ù%ÁKž—t¯`_Á¿dI“&5L†˜D±cÇ$ P¾bÆÊÿÊÓÊöø½–L'™J2Žp›$3Hæ ˜<2u$a$Yðþ—<,‘Á{\òC²ïeÉ È É H H ¼O!!  v›ÜÞP+º?{g~vŸmá ‹æ^4£É}Mòk²_“þšügcÀÈ%(Q@  `ü€Ò”NÀ°e(Ë€ÑJ:Pòƒ”‹ œå&(GA¹ ÊYPî‚r”Ë œå6(ÇA¹ÊyPîƒr Æ™ ±Ëc"ªˆŒ€!‚gHÛ;ï¼3ð®À;ï¼p…ÂÙÇgggggâggóZþÃAV@U¹ŠP¬@ÌPð@L"ˆÙ1­ æÄDƒ˜qPÆ”Q1¡ L(C’d…$o¡ÓÚ´¶ÅþÚÛ W +8S-*%  ×ÈÑW`ÿaŸÇHóùØüq¦?Nùǹÿ˜³ʸ€2B ¦ ”Aeø@’HäÔzj²e1ÊB”e(›Ö ¬@éFéD¼҄ЂҀÐÒ|ÒzÐxÒvx‰¤åðRA¿A»A·A¯A«A§a&Ëþ>Þ]tâÿà'Î ÜÏî òª¢¡öqθqæ]3ð‰ç€<Çå9<¯YzÍÖkÖž£÷Ä×\¾æô9¶¯)~MõsÈ_3ÿÊ`$€” % (a@‰J P" ”X %(á@‰J@P"‚”˜ *„ÛŒðÂf˜+ÄëŒ9C¼Öý»‹µýOÅãdžéå£YøÿVHøã¯áRAâ eÕß—<»<”ç >tƒ<[í÷{_3Þžj³züÍøÌ¿ýuÖD®MKý$ͱ¹kÕ¸ÜBÞŽo®XéwIòK̃©eŸþéëß_Ø? ­¿ôe¿~à¯\øõWö;||jžÁ²cmtk-3.0.0/Utilities/mxml/doc/reference.heading0000644000177700000170000000021611210045173020454 0ustar torstenman

    CLibrary Reference

    cmtk-3.0.0/Utilities/mxml/doc/F.gif0000644000177700000170000000120111210045173016044 0ustar torstenmanGIF89add¥  $'&&*)-100437:::=F *tœÄ¢ E"ÝVr)S”Nƒ}Œ*ê(Õ.D¯f¥º5jW§_—†E:¶hY¡g¦Í¸ÖbÛ‰o!Æm8Wa݃wi‹8"•¤MÕòä«”íàR}é¦F8°Åb‡±Z…;DÖU;¸r]¶c„Ôf4ªb~–jdtã=¦»hº)5Jb¹vâˆMëÙI`³±„{µ ܵšblâÉEgÆ=žW|ÊjEh<¢UŒÚCZDi(¦MOyÇ#Õ.V¯nɪ5 ×®O¾‚m"vì’²fçMMëmZ·f᎕ –nW»Zñ^ÕK•¯H¿¡~*¸ÊÍÂF#&¢x±ÆŽ!/¾#¤ckp¨hŒçñ¸É1[æÌŒØhÐo”‰ötÙs7Zlïìâ»jRµß¬b•û3íÞ¬­XÎEÓHÄ£P£(ùGl;W²œÍðéÆMp wîÝ·`§ÝÌtWÕì*O¤r*;cmtk-3.0.0/Utilities/mxml/doc/D.gif0000644000177700000170000000266711210045173016063 0ustar torstenmanGIF89addç        ! "! #"!$#"%$#&%#'&$'&$('%)(&*)'+*(,+)-,*.--10.21/320432653664776997::8;;9<<:=<=@?>A@?BA@CBADCBEDCFEDGFEHGFIHGJIHKJILKJMLKNMLONMPONQPORQPSRQTSRUTTVVUWWVXXWYYXZZY[[Z\\[]]\^^]___a``baacbbdcbedcfedgfehgfihgjihkjilkjmlknmlonmponqporqpsrqtsrttsuutvvuwwwyyxzzy{{z|||~~}~€€ƒƒ‚„ƒƒ…„…‡††ˆ‡‡‰ˆˆŠ‰‰‹ŠŠŒ‹‹ŒŒŽŽŽ‘’‘’“““”””•••––—˜˜™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¡£££¥¥¤¦¦¥§¦¦¨§§©¨¨ª©©«ªª¬««­¬¬®­­¯®®°¯¯±°°²±±²²³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËÊËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕ×××ÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞààààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîíîïîïðïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþ× H°`Á/*\Ȱ¡Ã‡#*üb°¢Å‹aIÜȱ£G°0мÈä£É“(™Œ\¹.Ê—0;Æay1¦Í›iœ„³§Ï„“t®ò³(Î!4S]j3ÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9VtéU¨ÙuäÆ`YðäÙ·5D-XÒ$Ü»ë -U9%^¼TŒÔèö/Þ¢!×½4ü7ÀO‹ã-à²_ɇ{®CxóÝžœ;{†Öáh¼J3==@?>A@?BA@CBADCBEDCFEDGFEHGFIHGJIHKJILKJMLKNMLONMPONQPQTSRUTSUUTVVUWWVXXWYYXZZY[[Z\\[]]\^^]__^``_a``baacbbdccfedgfehgfihgjihkjilkjmlknmlonmponqporqpsrqtsrttsuutvvuwwvxxwyyxzzy{{z||{}}|~~}~€€€‚‚ƒƒ‚„ƒƒ…„„†……‡†ˆŠ‰‰‹ŠŠŒ‹‹ŒŒŽŽŽ‘’‘‘“’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¡££¢¤¤£¥¥¤¦¦¥§¦¦¨§§©¨¨ª©©«ªª¬««­¬­¯®®°¯¯±°°²±±²²²³³³´´µ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËÊËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßààààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîíîïîïðïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþó H°`A2*\Ȱ¡Ã‡#*$c°¢Å‹wIÜȱ£G»0мå£É“(£Œ\™Ê—0;âay1¦Í›iô„³§Ï„žtæKò³(Î$4W]jsÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãV®ˆhvpµ¢K©<„üÂtfA©âÔb`´`É¥òä®$ëSåÀ¥¨ôÒ”÷s Æ¢‚Õšè2_Q$‰åë)ðgàÈrñá¬Ü³æÄ7ó!ÄéêsbÍ1Gß¼b:²³®´Æ öÃÈìè舰`Fv m3§wÊF:z…+, —ÃG(jù W›í¥Zå/„f‰)T¹Ð!¡iþæ±=Aç)Ê4mwï)(=lˆYÂÖC3UQcò»Â¯»²…~–Â,ÅÒ\µà#ÑÁÕ9*÷K‹88]~>¸R…°áÐ †R]ÂÒ2rEKZ„ˆÕ†& HaŠL¡Èba+¾ß…2ªHc3Ž„#‚:îã>ncÜ I¤uFyƒ+¡¤M‡°Ë“1à"•]‰%GZn)Mf0ÕÌJ·pEL—EŽô W   Kkü·Ò%6ŠäWûýÔH’KAÓ9Фž›±@¨OîäÞJÓLÈ!8ýB޲$„M>(Ú•l:‰Ó:aã Zè Ìz£ªUbG6ÈU!!®z%DÜ’†³a ‡¹Ç!s½^—b ÁêD‹5»Ò8©†ÓÊb”C³Ž­@ ·T8× „š¶Kµ­ ñ¶”ÁÞaTcÕFuBk/´8Ð]W­!ØvQùõ—mG#R((È9ÐY^ÞäÖ[/jPÂiVdÃ&iuTwD•HJU¼‘S,Q¬±C³ôðÇ IŒ*ÉDFpÅGFoÁú¶f.•ì*ëlÉ;cmtk-3.0.0/Utilities/mxml/doc/B.gif0000644000177700000170000000262311210045173016051 0ustar torstenmanGIF89addç        ! #"!$#"%$#&%#'&$'&%)(&*)'+*(,+)-,*.-+/.,0/-10.21/320431542653664775886997::8;;9<<:=<;>==@??BA@CBADCBEDCFEDGFFIHGJIHKJJMLKNMLONMPONQPORQPSRQTSRUTSUUTVVUWWVXXWYYXZZY[[Z\\[]]\^^]__^``_a`acbbdcbeddgfehggjihkjilkjmlknmlonmponqporqpsrqtssuutvvuwwvxxwyyxzzy{{z||{}}|~~}€‚‚ƒƒ‚„ƒƒ…„„†……‡†‡‰ˆˆŠ‰‰‹ŠŠŒ‹ŒŽŽ‘’‘‘“’’“““”””••–———˜˜˜™™š››œžžžŸŸ ¡¡¡¢¢¡££¢¤¤£¥¥¤¦¦¦¨§§©¨¨ª©©«ªª¬««­¬¬®­­¯®®°¯¯±°±²²²³³³´´´µµµ¶¶·¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉËÌËÌÍÌÍÎÍÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÜÜÜÝÝÝßßßààààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîíîïîïðïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþÑ H°`Á/*\Ȱ¡Ã‡#*üb°¢Å‹]IÜȱ£G®0мèä£É“(Œ\‰NÊ—0;Êay1¦Í›i”„³§Ï„’t¢#ò³(N"4S]j3ÅJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9VtiR¨Ù‚¤0YåÙ· -Xò$Ü»üT9ð%Þ¿ß~Ôèöïß=C¢ƒiØð…ž7þ»gd¿“ÿZFˆ93Þ›œ;{†Ë(lÃÑšM/Dw˜j…4?ÈÅÔÛ× cÃì!tnÝ1ƒéüͧ0঑ÇT–ùK>Å_;‘øJŸÑUO/<ÒzwÈ×¥þg¿9>ìv“nV’ó.üÈÊâÃÛ´UÞ|ý“¹XFÀ àüÆ49Ã_÷A4ÀMˆbÖ€²¶ ƒ>a„,Ià lŽtÄ…fø‡ zX æ&âEДxb{®(Ò º(ÒÊxTìÙhPüùç1ÔŽ„Úø64•“ã‡0 @Óñ}g™‘Rùè‘TFe¥G,uR¤|8y‘åR[r fWev4æ\kzu&WiŠõ&VqnÔ¦`wª9çUuFÄIžîI9åžU%}Ú”hC9ÐtÇ—‚Â4Êp²¢BE©£E2hº©AK~*P ¡ŠÚ£¨ žŠê@ð•jc z8…fתètëbÔmŠ®Ümª ž’é¨ ›„Í*ã K)ÆkY"~BŸÕU¢i|õ5mr‘u-Wlµµ-œ} ­EV‰k”V7š[U")¥.NN±„ã»S U.½&¡›)¾nÂ¥-¿u‹—´/TídŬ¬ƒ²nKÑY;cmtk-3.0.0/Utilities/mxml/doc/title.html0000644000177700000170000000164211747570117017230 0ustar torstenman Mini-XML Programmers Manual

    Mini-XML Programmers Manual
    Version 2.7

    MICHAEL R. SWEET

    Mini-XML Programmers Manual, Version 2.7

    Copyright © 2003-2011 by Michael R. Sweet

    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Library General Public License, Version 2. A copy of this license is included in Appendix A - Mini-XML License.

    cmtk-3.0.0/Utilities/mxml/doc/A.gif0000644000177700000170000000270611210045173016052 0ustar torstenmanGIF89addç       ! "! #""%$#&%$'&$('%)(&*)'+*)-,*.-,0/-10.21/320431542653664775887::8;;9<<:=<;>==@?>A@?BA@CBADCBEDCFEDGFEHGFIHGJIHKJJMLKNMLONMPONQPPSRQTSRUTSUUTVVUWWVXXWYYY[[Z\\]__^``_a``babdcbedehgfihhkjknmmponqporqqtstvvuwwvxxwyyxzzz|||~~}~€€€‚‚‚„ƒƒ…„„†……‡††ˆ‡‡‰ˆˆŠ‰‰‹ŠŠŒ‹ŒŽŽŽ‘’‘‘“’’“““”””•••–––———˜˜˜™™™ššš››œžŸŸŸ   ¡¡¡££¢¤¤£¥¥¤¦¦¦¨§§©¨ª¬««­¬­¯®®°¯¯±°°²±³´´µ¶¶¶···¸¸¸¹¹¹ºº»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÂÃÃÃÄÄÅÆÆÇÈÈÈÉÉÉÊÊËÌËÌÍÌÎÏÎÏÐÏÐÑÐÑÑÑÒÒÒÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßààààáááâââãããäääåååæææçççèèéêêêëëëìììíííîíïðïðððñññóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,ddþ¥ H°`Á+*\Ȱ¡Ã‡#*¼b°¢Å‹9IÜȱ£Gœ0м¨ä£É“(•Œ\)m Ê—0;Žay1¦Í›i4„³§Ï„†tJ ò³(Î 4K]j³ÄJ¢L£¾DŠ‘§Ô«'ƒÖÄÊõãÖ®`9VtÉU(×™»~Ú¢,Á’nÍbU9¬P]jäšè®´"\CJ³ëw°[Â~óÆÚª°4,eÆ-ÌU2VŽñ†½Ê,³46›¥zÖÚ¨ÓÑ¥—ŽH(uÑÕ¤]ß„{±l›µ¥]º}“e,–¼cÒY +ðà/YÀ²r”ǯ|nRñ„ÆW îQ¹B–¸þsÌ>r!¬ãâ#[ùj!y‘ÒGô¾¥3ù+ Wx~:þ†,¹ÒÐ{yðCô!¸ß<,¨Ð+ÊàC^Tà %`„Ü­åßC~ˆ_sUh‘jèMÿ!ÂáB®¼‰™XQ#®´ÜF,¦×˜ˆýX^z,±Ò‘Õ!f@JÔ#u5¤Œ©ù’)B T®ØeXOzÄÊ—ˆå&”'ÈÑffb3®é׎·¹é—-¼Í!'›²Ýé—qê)”1²Yç§\U*Ô©aihEѤ¶Þ¢: iR¡Q0)¡eŠ$€Oa*&%L4ýVƒ+íò“^EÓ¦?¥*™­^±DEW^°”‹QF¸ªK¬¾+n¿ÆºX¹¸.L©ùiD–uDœFé E&I‹M~Äúј+ÑÖn(ìHÐ—{mÄä¹=ÑIG‚ÙÑ2,Õ‚Uá~7\2EW]ý2eYÿ„VZ·jQÂí^dÃ0iuTŸD•HJUüÑiOiÜÑÅ,=ìñCc:r}™|òÁžñ[ñ¿µ¥[p¼w6+E~;cmtk-3.0.0/Utilities/mxml/doc/mxml.html0000644000177700000170000056122611747570117017075 0ustar torstenman Mini-XML Programmers Manual, Version 2.7

    Table of Contents



    Introduction Building, Installing, and Packaging Mini-XML Getting Started with Mini-XML More Mini-XML Programming Techniques Using the mxmldoc Utility Mini-XML License

    Release Notes
      Library Reference XML Schema

        0Introduction

        This programmers manual describes Mini-XML version 2.7, a small XML parsing library that you can use to read and write XML data files in your C and C++ applications.

        Mini-XML was initially developed for the Gutenprint project to replace the rather large and unwieldy libxml2 library with something substantially smaller and easier-to-use. It all began one morning in June of 2003 when Robert posted the following sentence to the developer's list:

        It's bad enough that we require libxml2, but rolling our own XML parser is a bit more than we can handle.

        I then replied with:

        Given the limited scope of what you use in XML, it should be trivial to code a mini-XML API in a few hundred lines of code.

        I took my own challenge and coded furiously for two days to produced the initial public release of Mini-XML, total lines of code: 696. Robert promptly integrated Mini-XML into Gutenprint and removed libxml2.

        Thanks to lots of feedback and support from various developers, Mini-XML has evolved since then to provide a more complete XML implementation and now stands at a whopping 3,965 lines of code, compared to 103,893 lines of code for libxml2 version 2.6.9.

        Aside from Gutenprint, Mini-XML is used for the following projects/software applications:

        Please email me (mxml @ easysw . com) if you would like your project added or removed from this list, or if you have any comments/quotes you would like me to publish about your experiences with Mini-XML.

        Organization of This Document

        This manual is organized into the following chapters and appendices:

        Notation Conventions

        Various font and syntax conventions are used in this guide. Examples and their meanings and uses are explained below:

        mxmldoc
        mxmldoc(1)
        The names of commands; the first mention of a command or function in a chapter is followed by a manual page section number.

        /var
        /etc/hosts
        File and directory names.

        Request ID is Printer-123
        Screen output.

        lp -d printer filename ENTER
        Literal user input; special keys like ENTER are in ALL CAPS.

        12.3
        Numbers in the text are written using the period (.) to indicate the decimal point.

        Abbreviations

        The following abbreviations are used throughout this manual:

        Gb
        Gigabytes, or 1073741824 bytes

        kb
        Kilobytes, or 1024 bytes

        Mb
        Megabytes, or 1048576 bytes

        UTF-8, UTF-16
        Unicode Transformation Format, 8-bit or 16-bit

        W3C
        World Wide Web Consortium

        XML
        Extensible Markup Language

        Other References

        The Unicode Standard, Version 4.0, Addison-Wesley, ISBN 0-321-18578-1
        The definition of the Unicode character set which is used for XML.

        Extensible Markup Language (XML) 1.0 (Third Edition)
        The XML specification from the World Wide Web Consortium (W3C)

        Legal Stuff

        The Mini-XML library is copyright 2003-2011 by Michael Sweet. License terms are described in Appendix A - Mini-XML License .


        1Building, Installing, and Packaging Mini-XML

        This chapter describes how to build, install, and package Mini-XML on your system from the source archive. You will need an ANSI/ISO-C compatible compiler to build Mini-XML - GCC works, as do most vendors' C compilers. If you are building Mini-XML on Windows, we recommend using the Visual C++ environment with the supplied solution file. For other operating systems, you'll need a POSIX-compatible shell and make program in addition to the C compiler.

        Compiling Mini-XML

        Mini-XML comes with both an autoconf-based configure script and a Visual C++ solution that can be used to compile the library and associated tools.

        Compiling with Visual C++

        Open the mxml.sln solution in the vcnet folder. Choose the desired build configuration, "Debug" (the default) or "Release", and then choose Build Solution from the Build menu.

        Compiling with Command-Line Tools

        Type the following command to configure the Mini-XML source code for your system:

            ./configure ENTER
        

        The default install prefix is /usr/local, which can be overridden using the --prefix option:

            ./configure --prefix=/foo ENTER
        

        Other configure options can be found using the --help option:

            ./configure --help ENTER
        

        Once you have configured the software, use the make(1) program to do the build and run the test program to verify that things are working, as follows:

            make ENTER
        

        Installing Mini-XML

        If you are using Visual C++, copy the mxml.lib and and mxml.h files to the Visual C++ lib and include directories, respectively.

        Otherwise, use the make command with the install target to install Mini-XML in the configured directories:

            make install ENTER
        

        Creating Mini-XML Packages

        Mini-XML includes two files that can be used to create binary packages. The first file is mxml.spec which is used by the rpmbuild(8) software to create Red Hat Package Manager ("RPM") packages which are commonly used on Linux. Since rpmbuild wants to compile the software on its own, you can provide it with the Mini-XML tar file to build the package:

            rpmbuild -ta mxml-version.tar.gz ENTER
        

        The second file is mxml.list which is used by the epm(1) program to create software packages in a variety of formats. The epm program is available from the following URL:

            http://www.epmhome.org/
        

        Use the make command with the epm target to create portable and native packages for your system:

            make epm ENTER
        

        The packages are stored in a subdirectory named dist for your convenience. The portable packages utilize scripts and tar files to install the software on the target system. After extracting the package archive, use the mxml.install script to install the software.

        The native packages will be in the local OS's native format: RPM for Red Hat Linux, DPKG for Debian Linux, PKG for Solaris, and so forth. Use the corresponding commands to install the native packages.


        2Getting Started with Mini-XML

        This chapter describes how to write programs that use Mini-XML to access data in an XML file. Mini-XML provides the following functionality:

        • Functions for creating and managing XML documents in memory.
        • Reading of UTF-8 and UTF-16 encoded XML files and strings.
        • Writing of UTF-8 encoded XML files and strings.
        • Support for arbitrary element names, attributes, and attribute values with no preset limits, just available memory.
        • Support for integer, real, opaque ("CDATA"), and text data types in "leaf" nodes.
        • "Find", "index", and "walk" functions for easily accessing data in an XML document.

        Mini-XML doesn't do validation or other types of processing on the data based upon schema files or other sources of definition information, nor does it support character entities other than those required by the XML specification.

        The Basics

        Mini-XML provides a single header file which you include:

            #include <mxml.h>
        

        The Mini-XML library is included with your program using the -lmxml option:

            gcc -o myprogram myprogram.c -lmxml ENTER
        

        If you have the pkg-config(1) software installed, you can use it to determine the proper compiler and linker options for your installation:

            pkg-config --cflags mxml ENTER
            pkg-config --libs mxml ENTER
        

        Nodes

        Every piece of information in an XML file is stored in memory in "nodes". Nodes are defined by the mxml_node_t structure. Each node has a typed value, optional user data, a parent node, sibling nodes (previous and next), and potentially child nodes.

        For example, if you have an XML file like the following:

            <?xml version="1.0" encoding="utf-8"?>
            <data>
                <node>val1</node>
                <node>val2</node>
                <node>val3</node>
                <group>
                    <node>val4</node>
                    <node>val5</node>
                    <node>val6</node>
                </group>
                <node>val7</node>
                <node>val8</node>
            </data>
        

        the node tree for the file would look like the following in memory:

            ?xml version="1.0" encoding="utf-8"?
              |
            data
              |
            node - node - node - group - node - node
              |      |      |      |       |      |
            val1   val2   val3     |     val7   val8
                                   |
                                 node - node - node
                                   |      |      |
                                 val4   val5   val6
        

        where "-" is a pointer to the sibling node and "|" is a pointer to the first child or parent node.

        The mxmlGetType function gets the type of a node, one of MXML_CUSTOM, MXML_ELEMENT, MXML_INTEGER, MXML_OPAQUE, MXML_REAL, or MXML_TEXT. The parent and sibling nodes are accessed using the mxmlGetParent, mxmlGetNext , and mxmlGetPrevious functions. The mxmlGetUserData function gets any user data associated with the node.

        CDATA Nodes

        CDATA (MXML_ELEMENT) nodes are created using the mxmlNewCDATA function. The mxmlGetCDATA function retrieves the CDATA string pointer for a node.

        Note:

        CDATA nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

        Custom Nodes

        Custom (MXML_CUSTOM) nodes are created using the mxmlNewCustom function or using a custom load callback specified using the mxmlSetCustomHandlers function. The mxmlGetCustom function retrieves the custom value pointer for a node.

        Comment Nodes

        Comment (MXML_ELEMENT) nodes are created using the mxmlNewElement function. The mxmlGetElement function retrieves the comment string pointer for a node, including the surrounding "!--" and "--" characters.

        Note:

        Comment nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

        Element Nodes

        Element (MXML_ELEMENT) nodes are created using the mxmlNewElement function. The mxmlGetElement function retrieves the element name, the mxmlElementGetAttr function retrieves the value string for a named attribute associated with the element, and the mxmlGetFirstChild and mxmlGetLastChild functions retrieve the first and last child nodes for the element, respectively.

        Integer Nodes

        Integer (MXML_INTEGER) nodes are created using the mxmlNewInteger function. The mxmlGetInteger function retrieves the integer value for a node.

        Opaque Nodes

        Opaque (MXML_OPAQUE) nodes are created using the mxmlNewOpaque function. The mxmlGetOpaque function retrieves the opaque string pointer for a node. Opaque nodes are like string nodes but preserve all whitespace between nodes.

        Text Nodes

        Text (MXML_TEXT) nodes are created using the mxmlNewText and mxmlNewTextf functions. Each text node consists of a text string and (leading) whitespace value - the mxmlGetText function retrieves the text string pointer and whitespace value for a node.

        Processing Instruction Nodes

        Processing instruction (MXML_ELEMENT) nodes are created using the mxmlNewElement function. The mxmlGetElement function retrieves the processing instruction string for a node, including the surrounding "?" characters.

        Note:

        Processing instruction nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

        Real Number Nodes

        Real number (MXML_REAL) nodes are created using the mxmlNewReal function. The mxmlGetReal function retrieves the CDATA string pointer for a node.

        XML Declaration Nodes

        XML declaration (MXML_ELEMENT) nodes are created using the mxmlNewXML function. The mxmlGetElement function retrieves the XML declaration string for a node, including the surrounding "?" characters.

        Note:

        XML declaration nodes are currently stored in memory as special elements. This will be changed in a future major release of Mini-XML.

        Creating XML Documents

        You can create and update XML documents in memory using the various mxmlNew functions. The following code will create the XML document described in the previous section:

            mxml_node_t *xml;    /* <?xml ... ?> */
            mxml_node_t *data;   /* <data> */
            mxml_node_t *node;   /* <node> */
            mxml_node_t *group;  /* <group> */
        
            xml = mxmlNewXML("1.0");
        
            data = mxmlNewElement(xml, "data");
        
                node = mxmlNewElement(data, "node");
                mxmlNewText(node, 0, "val1");
                node = mxmlNewElement(data, "node");
                mxmlNewText(node, 0, "val2");
                node = mxmlNewElement(data, "node");
                mxmlNewText(node, 0, "val3");
        
                group = mxmlNewElement(data, "group");
        
                    node = mxmlNewElement(group, "node");
                    mxmlNewText(node, 0, "val4");
                    node = mxmlNewElement(group, "node");
                    mxmlNewText(node, 0, "val5");
                    node = mxmlNewElement(group, "node");
                    mxmlNewText(node, 0, "val6");
        
                node = mxmlNewElement(data, "node");
                mxmlNewText(node, 0, "val7");
                node = mxmlNewElement(data, "node");
                mxmlNewText(node, 0, "val8");
        

        We start by creating the declaration node common to all XML files using the mxmlNewXML function:

            xml = mxmlNewXML("1.0");
        

        We then create the <data> node used for this document using the mxmlNewElement function. The first argument specifies the parent node (xml) while the second specifies the element name (data):

            data = mxmlNewElement(xml, "data");
        

        Each <node>...</node> in the file is created using the mxmlNewElement and mxmlNewText functions. The first argument of mxmlNewText specifies the parent node (node). The second argument specifies whether whitespace appears before the text - 0 or false in this case. The last argument specifies the actual text to add:

            node = mxmlNewElement(data, "node");
            mxmlNewText(node, 0, "val1");
        

        The resulting in-memory XML document can then be saved or processed just like one loaded from disk or a string.

        Loading XML

        You load an XML file using the mxmlLoadFile function:

            FILE *fp;
            mxml_node_t *tree;
        
            fp = fopen("filename.xml", "r");
            tree = mxmlLoadFile(NULL, fp,
                                MXML_TEXT_CALLBACK);
            fclose(fp);
        

        The first argument specifies an existing XML parent node, if any. Normally you will pass NULL for this argument unless you are combining multiple XML sources. The XML file must contain a complete XML document including the ?xml element if the parent node is NULL.

        The second argument specifies the stdio file to read from, as opened by fopen() or popen(). You can also use stdin if you are implementing an XML filter program.

        The third argument specifies a callback function which returns the value type of the immediate children for a new element node: MXML_CUSTOM, MXML_IGNORE, MXML_INTEGER, MXML_OPAQUE, MXML_REAL, or MXML_TEXT. Load callbacks are described in detail in Chapter 3. The example code uses the MXML_TEXT_CALLBACK constant which specifies that all data nodes in the document contain whitespace-separated text values. Other standard callbacks include MXML_IGNORE_CALLBACK, MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, and MXML_REAL_CALLBACK.

        The mxmlLoadString function loads XML node trees from a string:

            char buffer[8192];
            mxml_node_t *tree;
        
            ...
            tree = mxmlLoadString(NULL, buffer,
                                  MXML_TEXT_CALLBACK);
        

        The first and third arguments are the same as used for mxmlLoadFile(). The second argument specifies the string or character buffer to load and must be a complete XML document including the ?xml element if the parent node is NULL.

        Saving XML

        You save an XML file using the mxmlSaveFile function:

            FILE *fp;
            mxml_node_t *tree;
        
            fp = fopen("filename.xml", "w");
            mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
            fclose(fp);
        

        The first argument is the XML node tree to save. It should normally be a pointer to the top-level ?xml node in your XML document.

        The second argument is the stdio file to write to, as opened by fopen() or popen(). You can also use stdout if you are implementing an XML filter program.

        The third argument is the whitespace callback to use when saving the file. Whitespace callbacks are covered in detail in Chapter 3. The previous example code uses the MXML_NO_CALLBACK constant to specify that no special whitespace handling is required.

        The mxmlSaveAllocString, and mxmlSaveString functions save XML node trees to strings:

            char buffer[8192];
            char *ptr;
            mxml_node_t *tree;
        
            ...
            mxmlSaveString(tree, buffer, sizeof(buffer),
                           MXML_NO_CALLBACK);
        
            ...
            ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK);
        

        The first and last arguments are the same as used for mxmlSaveFile(). The mxmlSaveString function takes pointer and size arguments for saving the XML document to a fixed-size buffer, while mxmlSaveAllocString() returns a string buffer that was allocated using malloc().

        Controlling Line Wrapping

        When saving XML documents, Mini-XML normally wraps output lines at column 75 so that the text is readable in terminal windows. The mxmlSetWrapMargin function overrides the default wrap margin:

            /* Set the margin to 132 columns */
            mxmlSetWrapMargin(132);
        
            /* Disable wrapping */
            mxmlSetWrapMargin(0);
        

        Memory Management

        Once you are done with the XML data, use the mxmlDelete function to recursively free the memory that is used for a particular node or the entire tree:

            mxmlDelete(tree);
        

        You can also use reference counting to manage memory usage. The mxmlRetain and mxmlRelease functions increment and decrement a node's use count, respectively. When the use count goes to 0, mxmlRelease will automatically call mxmlDelete to actually free the memory used by the node tree. New nodes automatically start with a use count of 1.

        Finding and Iterating Nodes

        The mxmlWalkPrev and mxmlWalkNextfunctions can be used to iterate through the XML node tree:

            mxml_node_t *node;
            
            node = mxmlWalkPrev(current, tree,
                                MXML_DESCEND);
        
            node = mxmlWalkNext(current, tree,
                                MXML_DESCEND);
        

        In addition, you can find a named element/node using the mxmlFindElement function:

            mxml_node_t *node;
            
            node = mxmlFindElement(tree, tree, "name",
                                   "attr", "value",
                                   MXML_DESCEND);
        

        The name, attr, and value arguments can be passed as NULL to act as wildcards, e.g.:

            /* Find the first "a" element */
            node = mxmlFindElement(tree, tree, "a",
                                   NULL, NULL,
                                   MXML_DESCEND);
        
            /* Find the first "a" element with "href"
               attribute */
            node = mxmlFindElement(tree, tree, "a",
                                   "href", NULL,
                                   MXML_DESCEND);
        
            /* Find the first "a" element with "href"
               to a URL */
            node = mxmlFindElement(tree, tree, "a",
                                   "href",
                                   "http://www.easysw.com/",
                                   MXML_DESCEND);
        
            /* Find the first element with a "src"
               attribute */
            node = mxmlFindElement(tree, tree, NULL,
                                   "src", NULL,
                                   MXML_DESCEND);
        
            /* Find the first element with a "src"
               = "foo.jpg" */
            node = mxmlFindElement(tree, tree, NULL,
                                   "src", "foo.jpg",
                                   MXML_DESCEND);
        

        You can also iterate with the same function:

            mxml_node_t *node;
        
            for (node = mxmlFindElement(tree, tree,
                                        "name",
                                        NULL, NULL,
                                        MXML_DESCEND);
                 node != NULL;
                 node = mxmlFindElement(node, tree,
                                        "name",
                                        NULL, NULL,
                                        MXML_DESCEND))
            {
              ... do something ...
            }
        

        The MXML_DESCEND argument can actually be one of three constants:

        • MXML_NO_DESCEND means to not to look at any child nodes in the element hierarchy, just look at siblings at the same level or parent nodes until the top node or top-of-tree is reached.

          The previous node from "group" would be the "node" element to the left, while the next node from "group" would be the "node" element to the right.

        • MXML_DESCEND_FIRST means that it is OK to descend to the first child of a node, but not to descend further when searching. You'll normally use this when iterating through direct children of a parent node, e.g. all of the "node" and "group" elements under the "?xml" parent node in the example above.

          This mode is only applicable to the search function; the walk functions treat this as MXML_DESCEND since every call is a first time.

        • MXML_DESCEND means to keep descending until you hit the bottom of the tree. The previous node from "group" would be the "val3" node and the next node would be the first node element under "group".

          If you were to walk from the root node "?xml" to the end of the tree with mxmlWalkNext(), the order would be:

          ?xml data node val1 node val2 node val3 group node val4 node val5 node val6 node val7 node val8

          If you started at "val8" and walked using mxmlWalkPrev(), the order would be reversed, ending at "?xml".

        Finding Specific Nodes

        You can find specific nodes in the tree using the mxmlFindPath, for example:

            mxml_node_t *value;
        
            value = mxmlFindPath(tree, "path/to/*/foo/bar");
        

        The second argument is a "path" to the parent node. Each component of the path is separated by a slash (/) and represents a named element in the document tree or a wildcard (*) path representing 0 or more intervening nodes.


        3More Mini-XML Programming Techniques

        This chapter shows additional ways to use the Mini-XML library in your programs.

        Load Callbacks

        Chapter 2 introduced the mxmlLoadFile() and mxmlLoadString() functions. The last argument to these functions is a callback function which is used to determine the value type of each data node in an XML document.

        Mini-XML defines several standard callbacks for simple XML data files:

        • MXML_INTEGER_CALLBACK - All data nodes contain whitespace-separated integers.
        • MXML_OPAQUE_CALLBACK - All data nodes contain opaque strings ("CDATA").
        • MXML_REAL_CALLBACK - All data nodes contain whitespace-separated floating-point numbers.
        • MXML_TEXT_CALLBACK - All data nodes contain whitespace-separated strings.

        You can provide your own callback functions for more complex XML documents. Your callback function will receive a pointer to the current element node and must return the value type of the immediate children for that element node: MXML_INTEGER, MXML_OPAQUE, MXML_REAL, or MXML_TEXT. The function is called after the element and its attributes have been read, so you can look at the element name, attributes, and attribute values to determine the proper value type to return.

        The following callback function looks for an attribute named "type" or the element name to determine the value type for its child nodes:

            mxml_type_t
            type_cb(mxml_node_t *node)
            {
              const char *type;
        
             /*
              * You can lookup attributes and/or use the
              * element name, hierarchy, etc...
              */
        
              type = mxmlElementGetAttr(node, "type");
              if (type == NULL)
        	type = mxmlGetElement(node);
        
              if (!strcmp(type, "integer"))
        	return (MXML_INTEGER);
              else if (!strcmp(type, "opaque"))
        	return (MXML_OPAQUE);
              else if (!strcmp(type, "real"))
        	return (MXML_REAL);
              else
        	return (MXML_TEXT);
            }
        

        To use this callback function, simply use the name when you call any of the load functions:

            FILE *fp;
            mxml_node_t *tree;
        
            fp = fopen("filename.xml", "r");
            tree = mxmlLoadFile(NULL, fp, type_cb);
            fclose(fp);
        

        Save Callbacks

        Chapter 2 also introduced the mxmlSaveFile(), mxmlSaveString(), and mxmlSaveAllocString() functions. The last argument to these functions is a callback function which is used to automatically insert whitespace in an XML document.

        Your callback function will be called up to four times for each element node with a pointer to the node and a "where" value of MXML_WS_BEFORE_OPEN, MXML_WS_AFTER_OPEN, MXML_WS_BEFORE_CLOSE, or MXML_WS_AFTER_CLOSE. The callback function should return NULL if no whitespace should be added and the string to insert (spaces, tabs, carriage returns, and newlines) otherwise.

        The following whitespace callback can be used to add whitespace to XHTML output to make it more readable in a standard text editor:

            const char *
            whitespace_cb(mxml_node_t *node,
                          int where)
            {
              const char *name;
        
             /*
              * We can conditionally break to a new line
              * before or after any element. These are
              * just common HTML elements...
              */
        
              name = mxmlGetElement(node);
        
              if (!strcmp(name, "html") ||
                  !strcmp(name, "head") ||
                  !strcmp(name, "body") ||
        	  !strcmp(name, "pre") ||
                  !strcmp(name, "p") ||
        	  !strcmp(name, "h1") ||
                  !strcmp(name, "h2") ||
                  !strcmp(name, "h3") ||
        	  !strcmp(name, "h4") ||
                  !strcmp(name, "h5") ||
                  !strcmp(name, "h6"))
              {
               /*
        	* Newlines before open and after
                * close...
        	*/
        
        	if (where == MXML_WS_BEFORE_OPEN ||
                    where == MXML_WS_AFTER_CLOSE)
        	  return ("\n");
              }
              else if (!strcmp(name, "dl") ||
                       !strcmp(name, "ol") ||
                       !strcmp(name, "ul"))
              {
               /*
        	* Put a newline before and after list
                * elements...
        	*/
        
        	return ("\n");
              }
              else if (!strcmp(name, "dd") ||
                       !strcmp(name, "dt") ||
                       !strcmp(name, "li"))
              {
               /*
        	* Put a tab before <li>'s, * <dd>'s,
                * and <dt>'s, and a newline after them...
        	*/
        
        	if (where == MXML_WS_BEFORE_OPEN)
        	  return ("\t");
        	else if (where == MXML_WS_AFTER_CLOSE)
        	  return ("\n");
              }
        
             /*
              * Return NULL for no added whitespace...
              */
        
              return (NULL);
            }
        

        To use this callback function, simply use the name when you call any of the save functions:

            FILE *fp;
            mxml_node_t *tree;
        
            fp = fopen("filename.xml", "w");
            mxmlSaveFile(tree, fp, whitespace_cb);
            fclose(fp);
        

        Custom Data Types

        Mini-XML supports custom data types via global load and save callbacks. Only a single set of callbacks can be active at any time, however your callbacks can store additional information in order to support multiple custom data types as needed. The MXML_CUSTOM node type identifies custom data nodes.

        The load callback receives a pointer to the current data node and a string of opaque character data from the XML source with character entities converted to the corresponding UTF-8 characters. For example, if we wanted to support a custom date/time type whose value is encoded as "yyyy-mm-ddThh:mm:ssZ" (ISO format), the load callback would look like the following:

            typedef struct
            {
              unsigned      year,    /* Year */
                            month,   /* Month */
                            day,     /* Day */
                            hour,    /* Hour */
                            minute,  /* Minute */
                            second;  /* Second */
              time_t        unix;    /* UNIX time */
            } iso_date_time_t;
        
            int
            load_custom(mxml_node_t *node,
                        const char *data)
            {
              iso_date_time_t *dt;
              struct tm tmdata;
        
             /*
              * Allocate data structure...
              */
        
              dt = calloc(1, sizeof(iso_date_time_t));
        
             /*
              * Try reading 6 unsigned integers from the
              * data string...
              */
        
              if (sscanf(data, "%u-%u-%uT%u:%u:%uZ",
                         &(dt->year), &(dt->month),
                         &(dt->day), &(dt->hour),
                         &(dt->minute),
                         &(dt->second)) != 6)
              {
               /*
                * Unable to read numbers, free the data
                * structure and return an error...
                */
        
                free(dt);
        
                return (-1);
              }
        
             /*
              * Range check values...
              */
        
              if (dt->month <1 || dt->month > 12 ||
                  dt->day  <1 || dt->day > 31 ||
                  dt->hour  <0 || dt->hour > 23 ||
                  dt->minute  <0 || dt->minute > 59 ||
                  dt->second  <0 || dt->second > 59)
              {
               /*
                * Date information is out of range...
                */
        
                free(dt);
        
                return (-1);
              }
        
             /*
              * Convert ISO time to UNIX time in
              * seconds...
              */
        
              tmdata.tm_year = dt->year - 1900;
              tmdata.tm_mon  = dt->month - 1;
              tmdata.tm_day  = dt->day;
              tmdata.tm_hour = dt->hour;
              tmdata.tm_min  = dt->minute;
              tmdata.tm_sec  = dt->second;
        
              dt->unix = gmtime(&tmdata);
        
             /*
              * Assign custom node data and destroy
              * function pointers...
              */
        
              mxmlSetCustom(node, data, destroy);
        
             /*
              * Return with no errors...
              */
        
              return (0);
            }
        

        The function itself can return 0 on success or -1 if it is unable to decode the custom data or the data contains an error. Custom data nodes contain a void pointer to the allocated custom data for the node and a pointer to a destructor function which will free the custom data when the node is deleted.

        The save callback receives the node pointer and returns an allocated string containing the custom data value. The following save callback could be used for our ISO date/time type:

            char *
            save_custom(mxml_node_t *node)
            {
              char data[255];
              iso_date_time_t *dt;
        
        
              dt = (iso_date_time_t *)mxmlGetCustom(node);
        
              snprintf(data, sizeof(data),
                       "%04u-%02u-%02uT%02u:%02u:%02uZ",
                       dt->year, dt->month, dt->day,
                       dt->hour, dt->minute, dt->second);
        
              return (strdup(data));
            }
        

        You register the callback functions using the mxmlSetCustomHandlers() function:

            mxmlSetCustomHandlers(load_custom,
                                  save_custom);
        

        Changing Node Values

        All of the examples so far have concentrated on creating and loading new XML data nodes. Many applications, however, need to manipulate or change the nodes during their operation, so Mini-XML provides functions to change node values safely and without leaking memory.

        Existing nodes can be changed using the mxmlSetElement(), mxmlSetInteger(), mxmlSetOpaque() , mxmlSetReal(), mxmlSetText(), and mxmlSetTextf() functions. For example, use the following function call to change a text node to contain the text "new" with leading whitespace:

            mxml_node_t *node;
        
            mxmlSetText(node, 1, "new");
        

        Formatted Text

        The mxmlNewTextf() and mxmlSetTextf() functions create and change text nodes, respectively, using printf-style format strings and arguments. For example, use the following function call to create a new text node containing a constructed filename:

            mxml_node_t *node;
        
            node = mxmlNewTextf(node, 1, "%s/%s",
                                path, filename);
        

        Indexing

        Mini-XML provides functions for managing indices of nodes. The current implementation provides the same functionality as mxmlFindElement(). The advantage of using an index is that searching and enumeration of elements is significantly faster. The only disadvantage is that each index is a static snapshot of the XML document, so indices are not well suited to XML data that is updated more often than it is searched. The overhead of creating an index is approximately equal to walking the XML document tree. Nodes in the index are sorted by element name and attribute value.

        Indices are stored in mxml_index_t structures. The mxmlIndexNew() function creates a new index:

            mxml_node_t *tree;
            mxml_index_t *ind;
        
            ind = mxmlIndexNew(tree, "element",
                               "attribute");
        

        The first argument is the XML node tree to index. Normally this will be a pointer to the ?xml element.

        The second argument contains the element to index; passing NULL indexes all element nodes alphabetically.

        The third argument contains the attribute to index; passing NULL causes only the element name to be indexed.

        Once the index is created, the mxmlIndexEnum(), mxmlIndexFind() , and mxmlIndexReset() functions are used to access the nodes in the index. The mxmlIndexReset() function resets the "current" node pointer in the index, allowing you to do new searches and enumerations on the same index. Typically you will call this function prior to your calls to mxmlIndexEnum() and mxmlIndexFind().

        The mxmlIndexEnum() function enumerates each of the nodes in the index and can be used in a loop as follows:

            mxml_node_t *node;
        
            mxmlIndexReset(ind);
        
            while ((node = mxmlIndexEnum(ind)) != NULL)
            {
              // do something with node
            }
        

        The mxmlIndexFind() function locates the next occurrence of the named element and attribute value in the index. It can be used to find all matching elements in an index, as follows:

            mxml_node_t *node;
        
            mxmlIndexReset(ind);
        
            while ((node = mxmlIndexFind(ind, "element",
                                         "attr-value"))
                        != NULL)
            {
              // do something with node
            }
        

        The second and third arguments represent the element name and attribute value, respectively. A NULL pointer is used to return all elements or attributes in the index. Passing NULL for both the element name and attribute value is equivalent to calling mxmlIndexEnum.

        When you are done using the index, delete it using the mxmlIndexDelete() function:

            mxmlIndexDelete(ind);
        

        SAX (Stream) Loading of Documents

        Mini-XML supports an implementation of the Simple API for XML (SAX) which allows you to load and process an XML document as a stream of nodes. Aside from allowing you to process XML documents of any size, the Mini-XML implementation also allows you to retain portions of the document in memory for later processing.

        The mxmlSAXLoadFd, mxmlSAXLoadFile, and mxmlSAXLoadString functions provide the SAX loading APIs. Each function works like the corresponding mxmlLoad function but uses a callback to process each node as it is read.

        The callback function receives the node, an event code, and a user data pointer you supply:

            void
            sax_cb(mxml_node_t *node,
                   mxml_sax_event_t event,
                   void *data)
            {
              ... do something ...
            }
        

        The event will be one of the following:

        • MXML_SAX_CDATA - CDATA was just read
        • MXML_SAX_COMMENT - A comment was just read
        • MXML_SAX_DATA - Data (custom, integer, opaque, real, or text) was just read
        • MXML_SAX_DIRECTIVE - A processing directive was just read
        • MXML_SAX_ELEMENT_CLOSE - A close element was just read ( </element>)
        • MXML_SAX_ELEMENT_OPEN - An open element was just read ( <element>)

        Elements are released after the close element is processed. All other nodes are released after they are processed. The SAX callback can retain the node using the mxmlRetain function. For example, the following SAX callback will retain all nodes, effectively simulating a normal in-memory load:

            void
            sax_cb(mxml_node_t *node,
                   mxml_sax_event_t event,
                   void *data)
            {
              if (event != MXML_SAX_ELEMENT_CLOSE)
                mxmlRetain(node);
            }
        

        More typically the SAX callback will only retain a small portion of the document that is needed for post-processing. For example, the following SAX callback will retain the title and headings in an XHTML file. It also retains the (parent) elements like <html>, <head>, and <body>, and processing directives like <?xml ... ?> and <!DOCTYPE ... >:

            void
            sax_cb(mxml_node_t *node,
                   mxml_sax_event_t event,
                   void *data)
            {
              if (event == MXML_SAX_ELEMENT_OPEN)
              {
               /*
                * Retain headings and titles...
                */
        
                char *name = mxmlGetElement(node);
        
                if (!strcmp(name, "html") ||
                    !strcmp(name, "head") ||
                    !strcmp(name, "title") ||
                    !strcmp(name, "body") ||
                    !strcmp(name, "h1") ||
                    !strcmp(name, "h2") ||
                    !strcmp(name, "h3") ||
                    !strcmp(name, "h4") ||
                    !strcmp(name, "h5") ||
                    !strcmp(name, "h6"))
                  mxmlRetain(node);
              }
              else if (event == MXML_SAX_DIRECTIVE)
                mxmlRetain(node);
              else if (event == MXML_SAX_DATA)
              {
                if (mxmlGetRefCount(mxmlGetParent(node)) > 1)
                {
                 /*
                  * If the parent was retained, then retain
                  * this data node as well.
                  */
        
                  mxmlRetain(node);
                }
              }
            }
        

        The resulting skeleton document tree can then be searched just like one loaded using the mxmlLoad functions. For example, a filter that reads an XHTML document from stdin and then shows the title and headings in the document would look like:

            mxml_node_t *doc, *title, *body, *heading;
        
            doc = mxmlSAXLoadFd(NULL, 0,
                                MXML_TEXT_CALLBACK,
                                sax_cb, NULL);
        
            title = mxmlFindElement(doc, doc, "title",
                                    NULL, NULL,
                                    MXML_DESCEND);
        
            if (title)
              print_children(title);
        
            body = mxmlFindElement(doc, doc, "body",
                                   NULL, NULL,
                                   MXML_DESCEND);
        
            if (body)
            {
              for (heading = mxmlGetFirstChild(body);
                   heading;
                   heading = mxmlGetNextSibling(heading))
                print_children(heading);
            }
        

        4Using the mxmldoc Utility

        This chapter describes how to use mxmldoc(1) program to automatically generate documentation from C and C++ source files.

        The Basics

        Originally developed to generate the Mini-XML and CUPS API documentation, mxmldoc is now a general-purpose utility which scans C and C++ source files to produce HTML and man page documentation along with an XML file representing the functions, types, and definitions in those source files. Unlike popular documentation generators like Doxygen or Javadoc, mxmldoc uses in-line comments rather than comment headers, allowing for more "natural" code documentation.

        By default, mxmldoc produces HTML documentation. For example, the following command will scan all of the C source and header files in the current directory and produce a HTML documentation file called filename.html:

            mxmldoc *.h *.c >filename.html ENTER
        

        You can also specify an XML file to create which contains all of the information from the source files. For example, the following command creates an XML file called filename.xml in addition to the HTML file:

            mxmldoc filename.xml *.h *.c >filename.html ENTER
        

        The --no-output option disables the normal HTML output:

            mxmldoc --no-output filename.xml *.h *.c ENTER
        

        You can then run mxmldoc again with the XML file alone to generate the HTML documentation:

            mxmldoc filename.xml >filename.html ENTER
        

        Creating Man Pages

        The --man filename option tells mxmldoc to create a man page instead of HTML documentation, for example:

            mxmldoc --man filename filename.xml \
                >filename.man ENTER
        
            mxmldoc --man filename *.h *.c \
                >filename.man ENTER
        

        Creating Xcode Documentation Sets

        The --docset directory.docset option tells mxmldoc to create an Xcode documentation set containing the HTML documentation, for example:

            mxmldoc --docset foo.docset *.h *.c foo.xml ENTER
        

        Xcode documentation sets can only be built on Mac OS X with Xcode 3.0 or higher installed.

        Commenting Your Code

        As noted previously, mxmldoc looks for in-line comments to describe the functions, types, and constants in your code. Mxmldoc will document all public names it finds in your source files - any names starting with the underscore character (_) or names that are documented with the @private@ directive are treated as private and are not documented.

        Comments appearing directly before a function or type definition are used to document that function or type. Comments appearing after argument, definition, return type, or variable declarations are used to document that argument, definition, return type, or variable. For example, the following code excerpt defines a key/value structure and a function that creates a new instance of that structure:

            /* A key/value pair. This is used with the
               dictionary structure. */
        
            struct keyval
            {
              char *key; /* Key string */
              char *val; /* Value string */
            };
        
            /* Create a new key/value pair. */
        
            struct keyval * /* New key/value pair */
            new_keyval(
                const char *key, /* Key string */
        	const char *val) /* Value string */
            {
              ...
            }
        

        Mxmldoc also knows to remove extra asterisks (*) from the comment string, so the comment string:

            /*
             * Compute the value of PI.
             *
             * The function connects to an Internet server
             * that streams audio of mathematical monks
             * chanting the first 100 digits of PI.
             */
        

        will be shown as:

            Compute the value of PI.
        
            The function connects to an Internet server
            that streams audio of mathematical monks
            chanting the first 100 digits of PI.
        

        Comments can also include the following special @name ...@ directive strings:

        • @deprecated@ - flags the item as deprecated to discourage its use
        • @private@ - flags the item as private so it will not be included in the documentation
        • @since ...@ - flags the item as new since a particular release. The text following the @since up to the closing @ is highlighted in the generated documentation, e.g. @since Mini-XML 2.7@.

        Titles, Sections, and Introductions

        Mxmldoc also provides options to set the title, section, and introduction text for the generated documentation. The --title text option specifies the title for the documentation. The title string is usually put in quotes:

            mxmldoc filename.xml \
                --title "My Famous Documentation" \
                >filename.html ENTER
        

        The --section name option specifies the section for the documentation. For HTML documentation, the name is placed in a HTML comment such as:

            <!-- SECTION: name -->
        

        For man pages, the section name is usually just a number ("3"), or a number followed by a vendor name ("3acme"). The section name is used in the .TH directive in the man page:

            .TH mylibrary 3acme "My Title" ...
        

        The default section name for man page output is "3". There is no default section name for HTML output.

        Finally, the --intro filename option specifies a file to embed after the title and section but before the generated documentation. For HTML documentation, the file must consist of valid HTML without the usual DOCTYPE, html, and body elements. For man page documentation, the file must consist of valid nroff(1) text.


        AMini-XML License

        The Mini-XML library and included programs are provided under the terms of the GNU Library General Public License version 2 (LGPL2) with the following exceptions:

        1. Static linking of applications to the Mini-XML library does not constitute a derivative work and does not require the author to provide source code for the application, use the shared Mini-XML libraries, or link their applications against a user-supplied version of Mini-XML.

        If you link the application to a modified version of Mini-XML, then the changes to Mini-XML must be provided under the terms of the LGPL2 in sections 1, 2, and 4.

        2. You do not have to provide a copy of the Mini-XML license with programs that are linked to the Mini-XML library, nor do you have to identify the Mini-XML license in your program or documentation as required by section 6 of the LGPL2.

         

        GNU LIBRARY GENERAL PUBLIC LICENSE

        Version 2, June 1991
        Copyright (C) 1991 Free Software Foundation, Inc.
        59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
        Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
        [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.]

        Preamble

        The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.

        This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too.

        When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

        To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it.

        For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights.

        Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library.

        Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations.

        Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

        Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license.

        The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such.

        Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better.

        However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries.

        The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the libary" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library.

        Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one.

        TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

        0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you".

        A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.

        The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)

        "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.

        Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.

        1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.

        You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

        2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

          a) The modified work must itself be a software library.

          b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.

          c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.

          d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.

          (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)

        These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

        Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.

        In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

        3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.

        Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.

        This option is useful when you wish to copy part of the code of the Library into a program that is not a library.

        4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.

        If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.

        5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.

        However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.

        When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.

        If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)

        Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.

        6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.

        You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:

          a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)

          b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.

          c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.

          d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.

        For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

        It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.

        7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:

          a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.

          b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

        8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

        9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.

        10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

        11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.

        If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.

        It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

        This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

        12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

        13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

        Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.

        14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

        NO WARRANTY

        15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

        16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

        END OF TERMS AND CONDITIONS

        How to Apply These Terms to Your New Libraries

        If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).

        To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

          one line to give the library's name and an idea of what it does.
          Copyright (C) year name of author

          This library 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 2.1 of the License, or (at your option) any later version.

          This library 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 Lesser General Public License for more details.

          You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

        Also add information on how to contact you by electronic and paper mail.

        You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:

          Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker.

          signature of Ty Coon, 1 April 1990 Ty Coon, President of Vice

        That's all there is to it!


        BRelease Notes

        Changes in Mini-XML 2.7

        • Added 64-bit configurations to the VC++ project files (STR #129)
        • Fixed conformance of mxmldoc's HTML and CSS output.
        • Added data accessor ("get") functions and made the mxml_node_t and mxml_index_t structures private but still available in the Mini-XML header to preserve source compatibility (STR #118)
        • Updated the source headers to reference the Mini-XML license and its exceptions to the LGPL2 (STR #108)
        • Added a new mxmlFindPath() function to find the value node of a named element (STR #110)
        • Building a static version of the library did not work on Windows (STR #112)
        • The shared library did not include a destructor for the thread- specific data key on UNIX-based operating systems (STR #103)
        • mxmlLoad* did not error out on XML with multiple root nodes (STR #101)
        • Fixed an issue with the _mxml_vstrdupf function (STR #107)
        • mxmlSave* no longer write all siblings of the passed node, just that node and its children (STR #109)

        Changes in Mini-XML 2.6

        • Documentation fixes (STR #91, STR #92)
        • The mxmldoc program did not handle typedef comments properly (STR #72)
        • Added support for "long long" printf formats.
        • The XML parser now ignores BOMs in UTF-8 XML files (STR #89)
        • The mxmldoc program now supports generating Xcode documentation sets.
        • mxmlSave*() did not output UTF-8 correctly on some platforms.
        • mxmlNewXML() now adds encoding="utf-8" in the ?xml directive to avoid problems with non-conformant XML parsers that assume something other than UTF-8 as the default encoding.
        • Wrapping was not disabled when mxmlSetWrapMargin(0) was called, and "<?xml ... ?>" was always followed by a newline (STR #76)
        • The mxml.pc.in file was broken (STR #79)
        • The mxmldoc program now handles "typedef enum name {} name" correctly (STR #72)

        Changes in Mini-XML 2.5

        • The mxmldoc program now makes greater use of CSS and supports a --css option to embed an alternate stylesheet.
        • The mxmldoc program now supports --header and --footer options to insert documentation content before and after the generated content.
        • The mxmldoc program now supports a --framed option to generate framed HTML output.
        • The mxmldoc program now creates a table of contents including any headings in the --intro file when generating HTML output.
        • The man pages and man page output from mxmldoc did not use "\-" for dashes (STR #68)
        • The debug version of the Mini-XML DLL could not be built (STR #65)
        • Processing instructions and directives did not work when not at the top level of a document (STR #67)
        • Spaces around the "=" in attributes were not supported (STR #67)

        Changes in Mini-XML 2.4

        • Fixed shared library build problems on HP-UX and Mac OS X.
        • The mxmldoc program did not output argument descriptions for functions properly.
        • All global settings (custom, error, and entity callbacks and the wrap margin) are now managed separately for each thread.
        • Added mxmlElementDeleteAttr() function (STR #59)
        • mxmlElementSetAttrf() did not work (STR #57)
        • mxmlLoad*() incorrectly treated declarations as parent elements (STR #56)
        • mxmlLoad*() incorrectly allowed attributes without values (STR #47)
        • Fixed Visual C++ build problems (STR #49)
        • mxmlLoad*() did not return NULL when an element contained an error (STR #46)
        • Added support for the apos character entity (STR #54)
        • Fixed whitespace detection with Unicode characters (STR #48)
        • mxmlWalkNext() and mxmlWalkPrev() did not work correctly when called with a node with no children as the top node (STR #53)

        Changes in Mini-XML 2.3

        • Added two exceptions to the LGPL to support static linking of applications against Mini-XML
        • The mxmldoc utility can now generate man pages, too.
        • Added a mxmlNewXML() function
        • Added a mxmlElementSetAttrf() function (STR #43)
        • Added a snprintf() emulation function for the test program (STR #32)
        • Added the _CRT_SECURE_NO_DEPRECATE definition when building on VC++ 2005 (STR #36)
        • mxmlLoad*() did not detect missing > characters in elements (STR #41)
        • mxmlLoad*() did not detect missing close tags at the end of an XML document (STR #45)
        • Added user_data and ref_count members to mxml_node_t structure
        • Added mxmlReleaseNode() and mxmlRetainNode() APIs for reference-counted nodes
        • Added mxmlSetWrapMargin() to control the wrapping of XML output
        • Added conditional check for EINTR error code for certain Windows compilers that do not define it (STR #33)
        • The mxmldoc program now generates correct HTML 4.0 output - previously it generated invalid XHTML
        • The mxmldoc program now supports "@deprecated@, "@private@", and "@since version@" comments
        • Fixed function and enumeration type bugs in mxmldoc
        • Fixed the XML schema for mxmldoc
        • The mxmldoc program now supports --intro, --section, and --title options
        • The mxmlLoad*() functions could leak a node on an error (STR #27)
        • The mxml_vsnprintf() function could get in an infinite loop on a buffer overflow (STR #25)
        • Added new mxmlNewCDATA() and mxmlSetCDATA() functions to create and set CDATA nodes, which are really just special element nodes
        • Added new MXML_IGNORE type and MXML_IGNORE_CB callback to ignore non-element nodes, e.g. whitespace
        • mxmlLoad*() did not treat custom data as opaque, so whitespace characters would be lost

        Changes in Mini-XML 2.2.2

        • mxmlLoad*() did not treat custom data as opaque, so whitespace characters would be lost.

        Changes in Mini-XML 2.2.1

        • mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now correctly return NULL on error (STR #21)
        • mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), and mxmlNewTextf() incorrectly required a parent node (STR #22)
        • Fixed an XML output bug in mxmldoc.
        • The "make install" target now uses the install command to set the proper permissions on UNIX/Linux/OSX.
        • Fixed a MingW/Cygwin compilation problem (STR #18)

        Changes in Mini-XML 2.2

        • Added shared library support (STR #17)
        • mxmlLoad*() now returns an error when an XML stream contains illegal control characters (STR #10)
        • mxmlLoad*() now returns an error when an element contains two attributes with the same name in conformance with the XML spec (STR #16)
        • Added support for CDATA (STR #14, STR #15)
        • Updated comment and processing instruction handling - no entity support per XML specification.
        • Added checking for invalid comment termination ("--->" is not allowed)

        Changes in Mini-XML 2.1

        • Added support for custom data nodes (STR #6)
        • Now treat UTF-8 sequences which are longer than necessary as an error (STR #4)
        • Fixed entity number support (STR #8)
        • Fixed mxmlLoadString() bug with UTF-8 (STR #7)
        • Fixed entity lookup bug (STR #5)
        • Added mxmlLoadFd() and mxmlSaveFd() functions.
        • Fixed multi-word UTF-16 handling.

        Changes in Mini-XML 2.0

        • New programmers manual.
        • Added Visual C++ project files for Microsoft Windows users.
        • Added optimizations to mxmldoc, mxmlSaveFile(), and mxmlIndexNew() (STR #2)
        • mxmlEntityAddCallback() now returns an integer status (STR #2)
        • Added UTF-16 support (input only; all output is UTF-8)
        • Added index functions to build a searchable index of XML nodes.
        • Added character entity callback interface to support additional character entities beyond those defined in the XHTML specification.
        • Added support for XHTML character entities.
        • The mxmldoc utility now produces XML output which conforms to an updated XML schema, described in the file "doc/mxmldoc.xsd".
        • Changed the whitespace callback interface to return strings instead of a single character, allowing for greater control over the formatting of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.
        • The mxmldoc utility now produces XML output which conforms to an updated XML schema, described in the file "doc/mxmldoc.xsd".
        • Changed the whitespace callback interface to return strings instead of a single character, allowing for greater control over the formatting of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.
        • The mxmldoc utility is now capable of documenting C++ classes, functions, and structures, and correctly handles C++ comments.
        • Added new modular tests for mxmldoc.
        • Updated the mxmldoc output to be more compatible with embedding in manuals produced with HTMLDOC.
        • The makefile incorrectly included a "/" separator between the destination path and install path. This caused problems when building and installing with MingW.

        Changes in Mini-XML 1.3

        • Fixes for mxmldoc.
        • Added support for reading standard HTML entity names.
        • mxmlLoadString/File() did not decode character entities in element names, attribute names, or attribute values.
        • mxmlLoadString/File() would crash when loading non- conformant XML data under an existing parent (top) node.
        • Fixed several bugs in the mxmldoc utility.
        • Added new error callback function to catch a variety of errors and log them to someplace other than stderr.
        • The mxmlElementSetAttr() function now allows for NULL attribute values.
        • The load and save functions now properly handle quoted element and attribute name strings properly, e.g. for !DOCTYPE declarations.

        Changes in Mini-XML 1.2

        • Added new "set" methods to set the value of a node.
        • Added new formatted text methods mxmlNewTextf() and mxmlSetTextf() to create/set a text node value using printf-style formats.
        • Added new standard callbacks for use with the mxmlLoad functions.
        • Updated the HTML documentation to include examples of the walk and load function output.
        • Added --with/without-ansi configure option to control the strdup() function check.
        • Added --with/without-snprintf configure option to control the snprintf() and vsnprintf() function checks.

        Changes in Mini-XML 1.1.2

        • The mxml(3) man page wasn't updated for the string functions.
        • mxmlSaveString() returned the wrong number of characters.
        • mxml_add_char() updated the buffer pointer in the wrong place.

        Changes in Mini-XML 1.1.1

        • The private mxml_add_ch() function did not update the start-of-buffer pointer which could cause a crash when using mxmlSaveString().
        • The private mxml_write_ws() function called putc() instead of using the proper callback which could cause a crash when using mxmlSaveString().
        • Added a mxmlSaveAllocString() convenience function for saving an XML node tree to an allocated string.

        Changes in Mini-XML 1.1

        • The mxmlLoadFile() function now uses dynamically allocated string buffers for element names, attribute names, and attribute values. Previously they were capped at 16383, 255, and 255 bytes, respectively.
        • Added a new mxmlLoadString() function for loading an XML node tree from a string.
        • Added a new mxmlSaveString() function for saving an XML node tree to a string.
        • Add emulation of strdup() if the local platform does not provide the function.

        Changes in Mini-XML 1.0

        • The mxmldoc program now handles function arguments, structures, unions, enumerations, classes, and typedefs properly.
        • Documentation provided via mxmldoc and more in-line comments in the code.
        • Added man pages and packaging files.

        Changes in Mini-XML 0.93

        • New mxmldoc example program that is also used to create and update code documentation using XML and produce HTML reference pages.
        • Added mxmlAdd() and mxmlRemove() functions to add and remove nodes from a tree. This provides more flexibility over where the nodes are inserted and allows nodes to be moved within the tree as needed.
        • mxmlLoadFile() now correctly handles comments.
        • mxmlLoadFile() now supports the required "gt", "quot", and "nbsp" character entities.
        • mxmlSaveFile() now uses newlines as whitespace when valid to do so.
        • mxmlFindElement() now also takes attribute name and attribute value string arguments to limit the search to specific elements with attributes and/or values.
        • NULL pointers can be used as "wildcards".
        • Added uninstall target to makefile, and auto-reconfig if Makefile.in or configure.in are changed.
        • mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev() now all provide "descend" arguments to control whether they descend into child nodes in the tree.
        • Fixed some whitespace issues in mxmlLoadFile().
        • Fixed Unicode output and whitespace issues in mxmlSaveFile().
        • mxmlSaveFile() now supports a whitespace callback to provide more human-readable XML output under program control.

        Changes in Mini-XML 0.92

        • mxmlSaveFile() didn't return a value on success.

        Changes in Mini-XML 0.91

        • mxmlWalkNext() would go into an infinite loop.

        Changes in Mini-XML 0.9

        • Initial public release.

        CLibrary Reference

        Contents

        Functions

        mxmlAdd

        Add a node to a tree.

        void mxmlAdd (
            mxml_node_t *parent,
            int where,
            mxml_node_t *child,
            mxml_node_t *node
        );

        Parameters

        parent
        Parent node
        where
        Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER
        child
        Child node for where or MXML_ADD_TO_PARENT
        node
        Node to add

        Discussion

        Adds the specified node to the parent. If the child argument is not NULL, puts the new node before or after the specified child depending on the value of the where argument. If the child argument is NULL, puts the new node at the beginning of the child list (MXML_ADD_BEFORE) or at the end of the child list (MXML_ADD_AFTER). The constant MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.

        mxmlDelete

        Delete a node and all of its children.

        void mxmlDelete (
            mxml_node_t *node
        );

        Parameters

        node
        Node to delete

        Discussion

        If the specified node has a parent, this function first removes the node from its parent using the mxmlRemove() function.

         Mini-XML 2.4 mxmlElementDeleteAttr

        Delete an attribute.

        void mxmlElementDeleteAttr (
            mxml_node_t *node,
            const char *name
        );

        Parameters

        node
        Element
        name
        Attribute name

        mxmlElementGetAttr

        Get an attribute.

        const char *mxmlElementGetAttr (
            mxml_node_t *node,
            const char *name
        );

        Parameters

        node
        Element node
        name
        Name of attribute

        Return Value

        Attribute value or NULL

        Discussion

        This function returns NULL if the node is not an element or the named attribute does not exist.

        mxmlElementSetAttr

        Set an attribute.

        void mxmlElementSetAttr (
            mxml_node_t *node,
            const char *name,
            const char *value
        );

        Parameters

        node
        Element node
        name
        Name of attribute
        value
        Attribute value

        Discussion

        If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is copied into the element node. This function does nothing if the node is not an element.

         Mini-XML 2.3 mxmlElementSetAttrf

        Set an attribute with a formatted value.

        void mxmlElementSetAttrf (
            mxml_node_t *node,
            const char *name,
            const char *format,
            ...
        );

        Parameters

        node
        Element node
        name
        Name of attribute
        format
        Printf-style attribute value
        ...
        Additional arguments as needed

        Discussion

        If the named attribute already exists, the value of the attribute is replaced by the new formatted string. The formatted string value is copied into the element node. This function does nothing if the node is not an element.

        mxmlEntityAddCallback

        Add a callback to convert entities to Unicode.

        int mxmlEntityAddCallback (
            mxml_entity_cb_t cb
        );

        Parameters

        cb
        Callback function to add

        Return Value

        0 on success, -1 on failure

        mxmlEntityGetName

        Get the name that corresponds to the character value.

        const char *mxmlEntityGetName (
            int val
        );

        Parameters

        val
        Character value

        Return Value

        Entity name or NULL

        Discussion

        If val does not need to be represented by a named entity, NULL is returned.

        mxmlEntityGetValue

        Get the character corresponding to a named entity.

        int mxmlEntityGetValue (
            const char *name
        );

        Parameters

        name
        Entity name

        Return Value

        Character value or -1 on error

        Discussion

        The entity name can also be a numeric constant. -1 is returned if the name is not known.

        mxmlEntityRemoveCallback

        Remove a callback.

        void mxmlEntityRemoveCallback (
            mxml_entity_cb_t cb
        );

        Parameters

        cb
        Callback function to remove

        mxmlFindElement

        Find the named element.

        mxml_node_t *mxmlFindElement (
            mxml_node_t *node,
            mxml_node_t *top,
            const char *name,
            const char *attr,
            const char *value,
            int descend
        );

        Parameters

        node
        Current node
        top
        Top node
        name
        Element name or NULL for any
        attr
        Attribute name, or NULL for none
        value
        Attribute value, or NULL for any
        descend
        Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST

        Return Value

        Element node or NULL

        Discussion

        The search is constrained by the name, attribute name, and value; any NULL names or values are treated as wildcards, so different kinds of searches can be implemented by looking for all elements of a given name or all elements with a specific attribute. The descend argument determines whether the search descends into child nodes; normally you will use MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find additional direct descendents of the node. The top node argument constrains the search to a particular node's children.

         Mini-XML 2.7 mxmlFindPath

        Find a node with the given path.

        mxml_node_t *mxmlFindPath (
            mxml_node_t *top,
            const char *path
        );

        Parameters

        top
        Top node
        path
        Path to element

        Return Value

        Found node or NULL

        Discussion

        The "path" is a slash-separated list of element names. The name "*" is considered a wildcard for one or more levels of elements. For example, "foo/one/two", "bar/two/one", "*/one", and so forth.

        The first child node of the found node is returned if the given node has children and the first child is a value node.

         Mini-XML 2.7 mxmlGetCDATA

        Get the value for a CDATA node.

        const char *mxmlGetCDATA (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        CDATA value or NULL

        Discussion

        NULL is returned if the node is not a CDATA element.

         Mini-XML 2.7 mxmlGetCustom

        Get the value for a custom node.

        const void *mxmlGetCustom (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Custom value or NULL

        Discussion

        NULL is returned if the node (or its first child) is not a custom value node.

         Mini-XML 2.7 mxmlGetElement

        Get the name for an element node.

        const char *mxmlGetElement (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Element name or NULL

        Discussion

        NULL is returned if the node is not an element node.

         Mini-XML 2.7 mxmlGetFirstChild

        Get the first child of an element node.

        mxml_node_t *mxmlGetFirstChild (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        First child or NULL

        Discussion

        NULL is returned if the node is not an element node or if the node has no children.

         Mini-XML 2.7 mxmlGetInteger

        Get the integer value from the specified node or its first child.

        int mxmlGetInteger (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Integer value or 0

        Discussion

        0 is returned if the node (or its first child) is not an integer value node.

         Mini-XML 2.7 mxmlGetLastChild

        Get the last child of an element node.

        mxml_node_t *mxmlGetLastChild (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Last child or NULL

        Discussion

        NULL is returned if the node is not an element node or if the node has no children.

        mxmlGetNextSibling

        Return the node type...

        mxml_node_t *mxmlGetNextSibling (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Get the next node for the current parent.

        NULL is returned if this is the last child for the current parent.

         Mini-XML 2.7 mxmlGetOpaque

        Get an opaque string value for a node or its first child.

        const char *mxmlGetOpaque (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Opaque string or NULL

        Discussion

        NULL is returned if the node (or its first child) is not an opaque value node.

         Mini-XML 2.7 mxmlGetParent

        Get the parent node.

        mxml_node_t *mxmlGetParent (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Parent node or NULL

        Discussion

        NULL is returned for a root node.

         Mini-XML 2.7 mxmlGetPrevSibling

        Get the previous node for the current parent.

        mxml_node_t *mxmlGetPrevSibling (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Previous node or NULL

        Discussion

        NULL is returned if this is the first child for the current parent.

         Mini-XML 2.7 mxmlGetReal

        Get the real value for a node or its first child.

        double mxmlGetReal (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Real value or 0.0

        Discussion

        0.0 is returned if the node (or its first child) is not a real value node.

         Mini-XML 2.7 mxmlGetRefCount

        Get the current reference (use) count for a node.

        int mxmlGetRefCount (
            mxml_node_t *node
        );

        Parameters

        node
        Node

        Return Value

        Reference count

        Discussion

        The initial reference count of new nodes is 1. Use the mxmlRetain and mxmlRelease functions to increment and decrement a node's reference count. .

         Mini-XML 2.7 mxmlGetText

        Get the text value for a node or its first child.

        const char *mxmlGetText (
            mxml_node_t *node,
            int *whitespace
        );

        Parameters

        node
        Node to get
        whitespace
        1 if string is preceded by whitespace, 0 otherwise

        Return Value

        Text string or NULL

        Discussion

        NULL is returned if the node (or its first child) is not a text node. The "whitespace" argument can be NULL.

         Mini-XML 2.7 mxmlGetType

        Get the node type.

        mxml_type_t mxmlGetType (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        Type of node

        Discussion

        MXML_IGNORE is returned if "node" is NULL.

         Mini-XML 2.7 mxmlGetUserData

        Get the user data pointer for a node.

        void *mxmlGetUserData (
            mxml_node_t *node
        );

        Parameters

        node
        Node to get

        Return Value

        User data pointer

        mxmlIndexDelete

        Delete an index.

        void mxmlIndexDelete (
            mxml_index_t *ind
        );

        Parameters

        ind
        Index to delete

        mxmlIndexEnum

        Return the next node in the index.

        mxml_node_t *mxmlIndexEnum (
            mxml_index_t *ind
        );

        Parameters

        ind
        Index to enumerate

        Return Value

        Next node or NULL if there is none

        Discussion

        Nodes are returned in the sorted order of the index.

        mxmlIndexFind

        Find the next matching node.

        mxml_node_t *mxmlIndexFind (
            mxml_index_t *ind,
            const char *element,
            const char *value
        );

        Parameters

        ind
        Index to search
        element
        Element name to find, if any
        value
        Attribute value, if any

        Return Value

        Node or NULL if none found

        Discussion

        You should call mxmlIndexReset() prior to using this function for the first time with a particular set of "element" and "value" strings. Passing NULL for both "element" and "value" is equivalent to calling mxmlIndexEnum().

         Mini-XML 2.7 mxmlIndexGetCount

        Get the number of nodes in an index.

        int mxmlIndexGetCount (
            mxml_index_t *ind
        );

        Parameters

        ind
        Index of nodes

        Return Value

        Number of nodes in index

        mxmlIndexNew

        Create a new index.

        mxml_index_t *mxmlIndexNew (
            mxml_node_t *node,
            const char *element,
            const char *attr
        );

        Parameters

        node
        XML node tree
        element
        Element to index or NULL for all
        attr
        Attribute to index or NULL for none

        Return Value

        New index

        Discussion

        The index will contain all nodes that contain the named element and/or attribute. If both "element" and "attr" are NULL, then the index will contain a sorted list of the elements in the node tree. Nodes are sorted by element name and optionally by attribute value if the "attr" argument is not NULL.

        mxmlIndexReset

        Reset the enumeration/find pointer in the index and return the first node in the index.

        mxml_node_t *mxmlIndexReset (
            mxml_index_t *ind
        );

        Parameters

        ind
        Index to reset

        Return Value

        First node or NULL if there is none

        Discussion

        This function should be called prior to using mxmlIndexEnum() or mxmlIndexFind() for the first time.

        mxmlLoadFd

        Load a file descriptor into an XML node tree.

        mxml_node_t *mxmlLoadFd (
            mxml_node_t *top,
            int fd,
            mxml_load_cb_t cb
        );

        Parameters

        top
        Top node
        fd
        File descriptor to read from
        cb
        Callback function or MXML_NO_CALLBACK

        Return Value

        First node or NULL if the file could not be read.

        Discussion

        The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

        The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

        mxmlLoadFile

        Load a file into an XML node tree.

        mxml_node_t *mxmlLoadFile (
            mxml_node_t *top,
            FILE *fp,
            mxml_load_cb_t cb
        );

        Parameters

        top
        Top node
        fp
        File to read from
        cb
        Callback function or MXML_NO_CALLBACK

        Return Value

        First node or NULL if the file could not be read.

        Discussion

        The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

        The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

        mxmlLoadString

        Load a string into an XML node tree.

        mxml_node_t *mxmlLoadString (
            mxml_node_t *top,
            const char *s,
            mxml_load_cb_t cb
        );

        Parameters

        top
        Top node
        s
        String to load
        cb
        Callback function or MXML_NO_CALLBACK

        Return Value

        First node or NULL if the string has errors.

        Discussion

        The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

        The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

         Mini-XML 2.3 mxmlNewCDATA

        Create a new CDATA node.

        mxml_node_t *mxmlNewCDATA (
            mxml_node_t *parent,
            const char *data
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        data
        Data string

        Return Value

        New node

        Discussion

        The new CDATA node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new CDATA node has no parent. The data string must be nul-terminated and is copied into the new node. CDATA nodes use the MXML_ELEMENT type.

         Mini-XML 2.1 mxmlNewCustom

        Create a new custom data node.

        mxml_node_t *mxmlNewCustom (
            mxml_node_t *parent,
            void *data,
            mxml_custom_destroy_cb_t destroy
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        data
        Pointer to data
        destroy
        Function to destroy data

        Return Value

        New node

        Discussion

        The new custom node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent. NULL can be passed when the data in the node is not dynamically allocated or is separately managed.

        mxmlNewElement

        Create a new element node.

        mxml_node_t *mxmlNewElement (
            mxml_node_t *parent,
            const char *name
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        name
        Name of element

        Return Value

        New node

        Discussion

        The new element node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent.

        mxmlNewInteger

        Create a new integer node.

        mxml_node_t *mxmlNewInteger (
            mxml_node_t *parent,
            int integer
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        integer
        Integer value

        Return Value

        New node

        Discussion

        The new integer node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new integer node has no parent.

        mxmlNewOpaque

        Create a new opaque string.

        mxml_node_t *mxmlNewOpaque (
            mxml_node_t *parent,
            const char *opaque
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        opaque
        Opaque string

        Return Value

        New node

        Discussion

        The new opaque node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new opaque node has no parent. The opaque string must be nul-terminated and is copied into the new node.

        mxmlNewReal

        Create a new real number node.

        mxml_node_t *mxmlNewReal (
            mxml_node_t *parent,
            double real
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        real
        Real number value

        Return Value

        New node

        Discussion

        The new real number node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new real number node has no parent.

        mxmlNewText

        Create a new text fragment node.

        mxml_node_t *mxmlNewText (
            mxml_node_t *parent,
            int whitespace,
            const char *string
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        whitespace
        1 = leading whitespace, 0 = no whitespace
        string
        String

        Return Value

        New node

        Discussion

        The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The text string must be nul-terminated and is copied into the new node.

        mxmlNewTextf

        Create a new formatted text fragment node.

        mxml_node_t *mxmlNewTextf (
            mxml_node_t *parent,
            int whitespace,
            const char *format,
            ...
        );

        Parameters

        parent
        Parent node or MXML_NO_PARENT
        whitespace
        1 = leading whitespace, 0 = no whitespace
        format
        Printf-style frmat string
        ...
        Additional args as needed

        Return Value

        New node

        Discussion

        The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The format string must be nul-terminated and is formatted into the new node.

         Mini-XML 2.3 mxmlNewXML

        Create a new XML document tree.

        mxml_node_t *mxmlNewXML (
            const char *version
        );

        Parameters

        version
        Version number to use

        Return Value

        New ?xml node

        Discussion

        The "version" argument specifies the version number to put in the ?xml element node. If NULL, version 1.0 is assumed.

         Mini-XML 2.3 mxmlRelease

        Release a node.

        int mxmlRelease (
            mxml_node_t *node
        );

        Parameters

        node
        Node

        Return Value

        New reference count

        Discussion

        When the reference count reaches zero, the node (and any children) is deleted via mxmlDelete().

        mxmlRemove

        Remove a node from its parent.

        void mxmlRemove (
            mxml_node_t *node
        );

        Parameters

        node
        Node to remove

        Discussion

        Does not free memory used by the node - use mxmlDelete() for that. This function does nothing if the node has no parent.

         Mini-XML 2.3 mxmlRetain

        Retain a node.

        int mxmlRetain (
            mxml_node_t *node
        );

        Parameters

        node
        Node

        Return Value

        New reference count

         Mini-XML 2.3 mxmlSAXLoadFd

        Load a file descriptor into an XML node tree using a SAX callback.

        mxml_node_t *mxmlSAXLoadFd (
            mxml_node_t *top,
            int fd,
            mxml_load_cb_t cb,
            mxml_sax_cb_t sax_cb,
            void *sax_data
        );

        Parameters

        top
        Top node
        fd
        File descriptor to read from
        cb
        Callback function or MXML_NO_CALLBACK
        sax_cb
        SAX callback or MXML_NO_CALLBACK
        sax_data
        SAX user data

        Return Value

        First node or NULL if the file could not be read.

        Discussion

        The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

        The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

        The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node.

         Mini-XML 2.3 mxmlSAXLoadFile

        Load a file into an XML node tree using a SAX callback.

        mxml_node_t *mxmlSAXLoadFile (
            mxml_node_t *top,
            FILE *fp,
            mxml_load_cb_t cb,
            mxml_sax_cb_t sax_cb,
            void *sax_data
        );

        Parameters

        top
        Top node
        fp
        File to read from
        cb
        Callback function or MXML_NO_CALLBACK
        sax_cb
        SAX callback or MXML_NO_CALLBACK
        sax_data
        SAX user data

        Return Value

        First node or NULL if the file could not be read.

        Discussion

        The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

        The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

        The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node.

         Mini-XML 2.3 mxmlSAXLoadString

        Load a string into an XML node tree using a SAX callback.

        mxml_node_t *mxmlSAXLoadString (
            mxml_node_t *top,
            const char *s,
            mxml_load_cb_t cb,
            mxml_sax_cb_t sax_cb,
            void *sax_data
        );

        Parameters

        top
        Top node
        s
        String to load
        cb
        Callback function or MXML_NO_CALLBACK
        sax_cb
        SAX callback or MXML_NO_CALLBACK
        sax_data
        SAX user data

        Return Value

        First node or NULL if the string has errors.

        Discussion

        The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

        The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

        The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node.

        mxmlSaveAllocString

        Save an XML tree to an allocated string.

        char *mxmlSaveAllocString (
            mxml_node_t *node,
            mxml_save_cb_t cb
        );

        Parameters

        node
        Node to write
        cb
        Whitespace callback or MXML_NO_CALLBACK

        Return Value

        Allocated string or NULL

        Discussion

        This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed using the free() function when you are done with it. NULL is returned if the node would produce an empty string or if the string cannot be allocated.

        The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

        mxmlSaveFd

        Save an XML tree to a file descriptor.

        int mxmlSaveFd (
            mxml_node_t *node,
            int fd,
            mxml_save_cb_t cb
        );

        Parameters

        node
        Node to write
        fd
        File descriptor to write to
        cb
        Whitespace callback or MXML_NO_CALLBACK

        Return Value

        0 on success, -1 on error.

        Discussion

        The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

        mxmlSaveFile

        Save an XML tree to a file.

        int mxmlSaveFile (
            mxml_node_t *node,
            FILE *fp,
            mxml_save_cb_t cb
        );

        Parameters

        node
        Node to write
        fp
        File to write to
        cb
        Whitespace callback or MXML_NO_CALLBACK

        Return Value

        0 on success, -1 on error.

        Discussion

        The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

        mxmlSaveString

        Save an XML node tree to a string.

        int mxmlSaveString (
            mxml_node_t *node,
            char *buffer,
            int bufsize,
            mxml_save_cb_t cb
        );

        Parameters

        node
        Node to write
        buffer
        String buffer
        bufsize
        Size of string buffer
        cb
        Whitespace callback or MXML_NO_CALLBACK

        Return Value

        Size of string

        Discussion

        This function returns the total number of bytes that would be required for the string but only copies (bufsize - 1) characters into the specified buffer.

        The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags.

         Mini-XML 2.3 mxmlSetCDATA

        Set the element name of a CDATA node.

        int mxmlSetCDATA (
            mxml_node_t *node,
            const char *data
        );

        Parameters

        node
        Node to set
        data
        New data string

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it (or its first child) is not a CDATA element node.

         Mini-XML 2.1 mxmlSetCustom

        Set the data and destructor of a custom data node.

        int mxmlSetCustom (
            mxml_node_t *node,
            void *data,
            mxml_custom_destroy_cb_t destroy
        );

        Parameters

        node
        Node to set
        data
        New data pointer
        destroy
        New destructor function

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it (or its first child) is not a custom node.

        mxmlSetCustomHandlers

        Set the handling functions for custom data.

        void mxmlSetCustomHandlers (
            mxml_custom_load_cb_t load,
            mxml_custom_save_cb_t save
        );

        Parameters

        load
        Load function
        save
        Save function

        Discussion

        The load function accepts a node pointer and a data string and must return 0 on success and non-zero on error.

        The save function accepts a node pointer and must return a malloc'd string on success and NULL on error.

        mxmlSetElement

        Set the name of an element node.

        int mxmlSetElement (
            mxml_node_t *node,
            const char *name
        );

        Parameters

        node
        Node to set
        name
        New name string

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it is not an element node.

        mxmlSetErrorCallback

        Set the error message callback.

        void mxmlSetErrorCallback (
            mxml_error_cb_t cb
        );

        Parameters

        cb
        Error callback function

        mxmlSetInteger

        Set the value of an integer node.

        int mxmlSetInteger (
            mxml_node_t *node,
            int integer
        );

        Parameters

        node
        Node to set
        integer
        Integer value

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it (or its first child) is not an integer node.

        mxmlSetOpaque

        Set the value of an opaque node.

        int mxmlSetOpaque (
            mxml_node_t *node,
            const char *opaque
        );

        Parameters

        node
        Node to set
        opaque
        Opaque string

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it (or its first child) is not an opaque node.

        mxmlSetReal

        Set the value of a real number node.

        int mxmlSetReal (
            mxml_node_t *node,
            double real
        );

        Parameters

        node
        Node to set
        real
        Real number value

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it (or its first child) is not a real number node.

        mxmlSetText

        Set the value of a text node.

        int mxmlSetText (
            mxml_node_t *node,
            int whitespace,
            const char *string
        );

        Parameters

        node
        Node to set
        whitespace
        1 = leading whitespace, 0 = no whitespace
        string
        String

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it (or its first child) is not a text node.

        mxmlSetTextf

        Set the value of a text node to a formatted string.

        int mxmlSetTextf (
            mxml_node_t *node,
            int whitespace,
            const char *format,
            ...
        );

        Parameters

        node
        Node to set
        whitespace
        1 = leading whitespace, 0 = no whitespace
        format
        Printf-style format string
        ...
        Additional arguments as needed

        Return Value

        0 on success, -1 on failure

        Discussion

        The node is not changed if it (or its first child) is not a text node.

         Mini-XML 2.7 mxmlSetUserData

        Set the user data pointer for a node.

        int mxmlSetUserData (
            mxml_node_t *node,
            void *data
        );

        Parameters

        node
        Node to set
        data
        User data pointer

        Return Value

        0 on success, -1 on failure

         Mini-XML 2.3 mxmlSetWrapMargin

        Set the wrap margin when saving XML data.

        void mxmlSetWrapMargin (
            int column
        );

        Parameters

        column
        Column for wrapping, 0 to disable wrapping

        Discussion

        Wrapping is disabled when "column" is 0.

        mxmlWalkNext

        Walk to the next logical node in the tree.

        mxml_node_t *mxmlWalkNext (
            mxml_node_t *node,
            mxml_node_t *top,
            int descend
        );

        Parameters

        node
        Current node
        top
        Top node
        descend
        Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST

        Return Value

        Next node or NULL

        Discussion

        The descend argument controls whether the first child is considered to be the next node. The top node argument constrains the walk to the node's children.

        mxmlWalkPrev

        Walk to the previous logical node in the tree.

        mxml_node_t *mxmlWalkPrev (
            mxml_node_t *node,
            mxml_node_t *top,
            int descend
        );

        Parameters

        node
        Current node
        top
        Top node
        descend
        Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST

        Return Value

        Previous node or NULL

        Discussion

        The descend argument controls whether the previous node's last child is considered to be the previous node. The top node argument constrains the walk to the node's children.

        Data Types

        mxml_custom_destroy_cb_t

        Custom data destructor

        typedef void (*mxml_custom_destroy_cb_t)(void *);

        mxml_custom_load_cb_t

        Custom data load callback function

        typedef int (*mxml_custom_load_cb_t)( mxml_node_t *, const char *);

        mxml_custom_save_cb_t

        Custom data save callback function

        typedef char *(*mxml_custom_save_cb_t)( mxml_node_t *);

        mxml_entity_cb_t

        Entity callback function

        typedef int (*mxml_entity_cb_t)(const char *);

        mxml_error_cb_t

        Error callback function

        typedef void (*mxml_error_cb_t)(const char *);

        mxml_index_t

        An XML node index.

        typedef struct mxml_index_s mxml_index_t;

        mxml_load_cb_t

        Load callback function

        typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *);

        mxml_node_t

        An XML node.

        typedef struct mxml_node_s mxml_node_t;

        mxml_save_cb_t

        Save callback function

        typedef const char *(*mxml_save_cb_t)( mxml_node_t *, int);

        mxml_sax_cb_t

        SAX callback function

        typedef void (*mxml_sax_cb_t)( mxml_node_t *, mxml_sax_event_t, void *);

        mxml_sax_event_t

        SAX event type.

        typedef enum mxml_sax_event_e mxml_sax_event_t;

        mxml_type_t

        The XML node type.

        typedef enum mxml_type_e mxml_type_t;

        Constants

        mxml_sax_event_e

        SAX event type.

        Constants

        MXML_SAX_CDATA
        CDATA node
        MXML_SAX_COMMENT
        Comment node
        MXML_SAX_DATA
        Data node
        MXML_SAX_DIRECTIVE
        Processing directive node
        MXML_SAX_ELEMENT_CLOSE
        Element closed
        MXML_SAX_ELEMENT_OPEN
        Element opened

        mxml_type_e

        The XML node type.

        Constants

        MXML_CUSTOM  Mini-XML 2.1 
        Custom data
        MXML_ELEMENT
        XML element with attributes
        MXML_IGNORE  Mini-XML 2.3 
        Ignore/throw away node
        MXML_INTEGER
        Integer value
        MXML_OPAQUE
        Opaque string
        MXML_REAL
        Real value
        MXML_TEXT
        Text fragment

        DXML Schema

        This appendix provides the XML schema that is used for the XML files produced by mxmldoc. This schema is available on-line at:

            http://www.minixml.org/mxmldoc.xsd
        

        mxmldoc.xsd

        
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              Mini-XML 2.7 documentation schema for mxmldoc output.
              Copyright 2003-2011 by Michael Sweet.
            </xsd:documentation>
          </xsd:annotation>
        
          <!-- basic element definitions -->
          <xsd:element name="argument" type="argumentType"/>
          <xsd:element name="class" type="classType"/>
          <xsd:element name="constant" type="constantType"/>
          <xsd:element name="description" type="xsd:string"/>
          <xsd:element name="enumeration" type="enumerationType"/>
          <xsd:element name="function" type="functionType"/>
          <xsd:element name="mxmldoc" type="mxmldocType"/>
          <xsd:element name="namespace" type="namespaceType"/>
          <xsd:element name="returnvalue" type="returnvalueType"/>
          <xsd:element name="seealso" type="identifierList"/>
          <xsd:element name="struct" type="structType"/>
          <xsd:element name="typedef" type="typedefType"/>
          <xsd:element name="type" type="xsd:string"/>
          <xsd:element name="union" type="unionType"/>
          <xsd:element name="variable" type="variableType"/>
        
          <!-- descriptions of complex elements -->
          <xsd:complexType name="argumentType">
            <xsd:sequence>
              <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="default" type="xsd:string" use="optional"/>
            <xsd:attribute name="name" type="identifier" use="required"/>
            <xsd:attribute name="direction" type="direction" use="optional"
             default="I"/>
          </xsd:complexType>
        
          <xsd:complexType name="classType">
            <xsd:sequence>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
              <xsd:choice minOccurs="0" maxOccurs="unbounded">
        	<xsd:element ref="class"/>
        	<xsd:element ref="enumeration"/>
        	<xsd:element ref="function"/>
        	<xsd:element ref="struct"/>
        	<xsd:element ref="typedef"/>
        	<xsd:element ref="union"/>
        	<xsd:element ref="variable"/>
              </xsd:choice>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
            <xsd:attribute name="parent" type="xsd:string" use="optional"/>
          </xsd:complexType>
        
          <xsd:complexType name="constantType">
            <xsd:sequence>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
          </xsd:complexType>
        
          <xsd:complexType name="enumerationType">
            <xsd:sequence>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
              <xsd:element ref="constant" minOccurs="1" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
          </xsd:complexType>
        
          <xsd:complexType name="functionType">
            <xsd:sequence>
              <xsd:element ref="returnvalue" minOccurs="0" maxOccurs="1"/>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
              <xsd:element ref="argument" minOccurs="1" maxOccurs="unbounded"/>
              <xsd:element ref="seealso" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
            <xsd:attribute name="scope" type="scope" use="optional"/>
          </xsd:complexType>
        
          <xsd:complexType name="mxmldocType">
            <xsd:choice minOccurs="0" maxOccurs="unbounded">
              <xsd:element ref="class"/>
              <xsd:element ref="enumeration"/>
              <xsd:element ref="function"/>
              <xsd:element ref="namespace"/>
              <xsd:element ref="struct"/>
              <xsd:element ref="typedef"/>
              <xsd:element ref="union"/>
              <xsd:element ref="variable"/>
            </xsd:choice>
          </xsd:complexType>
        
          <xsd:complexType name="namespaceType">
            <xsd:sequence>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
              <xsd:choice minOccurs="0" maxOccurs="unbounded">
        	<xsd:element ref="class"/>
        	<xsd:element ref="enumeration"/>
        	<xsd:element ref="function"/>
        	<xsd:element ref="struct"/>
        	<xsd:element ref="typedef"/>
        	<xsd:element ref="union"/>
        	<xsd:element ref="variable"/>
              </xsd:choice>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
          </xsd:complexType>
        
          <xsd:complexType name="returnvalueType">
            <xsd:sequence>
              <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
          </xsd:complexType>
        
          <xsd:complexType name="structType">
            <xsd:sequence>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
              <xsd:choice minOccurs="0" maxOccurs="unbounded">
        	<xsd:element ref="variable"/>
        	<xsd:element ref="function"/>
              </xsd:choice>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
          </xsd:complexType>
        
          <xsd:complexType name="typedefType">
            <xsd:sequence>
              <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
          </xsd:complexType>
        
          <xsd:complexType name="unionType">
            <xsd:sequence>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
              <xsd:element ref="variable" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
          </xsd:complexType>
        
          <xsd:complexType name="variableType">
            <xsd:sequence>
              <xsd:element ref="type" minOccurs="1" maxOccurs="1"/>
              <xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
            <xsd:attribute name="name" type="identifier" use="required"/>
          </xsd:complexType>
        
          <!-- data types -->
          <xsd:simpleType name="direction">
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="I"/>
              <xsd:enumeration value="O"/>
              <xsd:enumeration value="IO"/>
            </xsd:restriction>
          </xsd:simpleType>
        
          <xsd:simpleType name="identifier">
            <xsd:restriction base="xsd:string">
              <xsd:pattern value="[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*"/>
            </xsd:restriction>
          </xsd:simpleType>
        
          <xsd:simpleType name="identifierList">
            <xsd:list itemType="identifier"/>
          </xsd:simpleType>
        
          <xsd:simpleType name="scope">
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value=""/>
              <xsd:enumeration value="private"/>
              <xsd:enumeration value="protected"/>
              <xsd:enumeration value="public"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:schema>
        
        cmtk-3.0.0/Utilities/mxml/cmtk_mxml_mangle.h0000644000177700000170000001061011747570117020136 0ustar torstenman#ifndef cmtk_mxml_mangle_h #define cmtk_mxml_mangle_h /* This header file mangles all symbols exported from the mxml library. It is included in all files while building the mxml library. Due to namespace pollution, no mxml headers should be included in .h files in CMTK. The following command was used to obtain the symbol list: nm libcmtkMxml.so |grep " [TRD] " This is the way to recreate the whole list: nm libcmtkMxml.so |grep " [TRD] " | awk '{ print "#define "$3" cmtk_"$3 }' REMOVE the "_init" and "_fini" entries. */ #define cmtk__mxml_entity_cb cmtk_cmtk__mxml_entity_cb #define cmtk__mxml_global cmtk_cmtk__mxml_global #define cmtk__mxml_strdupf cmtk_cmtk__mxml_strdupf #define cmtk__mxml_vstrdupf cmtk_cmtk__mxml_vstrdupf #define cmtk_mxmlAdd cmtk_cmtk_mxmlAdd #define cmtk_mxmlDelete cmtk_cmtk_mxmlDelete #define cmtk_mxmlElementDeleteAttr cmtk_cmtk_mxmlElementDeleteAttr #define cmtk_mxmlElementGetAttr cmtk_cmtk_mxmlElementGetAttr #define cmtk_mxmlElementSetAttr cmtk_cmtk_mxmlElementSetAttr #define cmtk_mxmlElementSetAttrf cmtk_cmtk_mxmlElementSetAttrf #define cmtk_mxmlEntityAddCallback cmtk_cmtk_mxmlEntityAddCallback #define cmtk_mxmlEntityGetName cmtk_cmtk_mxmlEntityGetName #define cmtk_mxmlEntityGetValue cmtk_cmtk_mxmlEntityGetValue #define cmtk_mxmlEntityRemoveCallback cmtk_cmtk_mxmlEntityRemoveCallback #define cmtk_mxmlFindElement cmtk_cmtk_mxmlFindElement #define cmtk_mxmlIndexDelete cmtk_cmtk_mxmlIndexDelete #define cmtk_mxmlIndexEnum cmtk_cmtk_mxmlIndexEnum #define cmtk_mxmlIndexFind cmtk_cmtk_mxmlIndexFind #define cmtk_mxmlIndexNew cmtk_cmtk_mxmlIndexNew #define cmtk_mxmlIndexReset cmtk_cmtk_mxmlIndexReset #define cmtk_mxmlLoadFd cmtk_cmtk_mxmlLoadFd #define cmtk_mxmlLoadFile cmtk_cmtk_mxmlLoadFile #define cmtk_mxmlLoadString cmtk_cmtk_mxmlLoadString #define cmtk_mxmlNewCDATA cmtk_cmtk_mxmlNewCDATA #define cmtk_mxmlNewCustom cmtk_cmtk_mxmlNewCustom #define cmtk_mxmlNewElement cmtk_cmtk_mxmlNewElement #define cmtk_mxmlNewInteger cmtk_cmtk_mxmlNewInteger #define cmtk_mxmlNewOpaque cmtk_cmtk_mxmlNewOpaque #define cmtk_mxmlNewReal cmtk_cmtk_mxmlNewReal #define cmtk_mxmlNewText cmtk_cmtk_mxmlNewText #define cmtk_mxmlNewTextf cmtk_cmtk_mxmlNewTextf #define cmtk_mxmlNewXML cmtk_cmtk_mxmlNewXML #define cmtk_mxmlRelease cmtk_cmtk_mxmlRelease #define cmtk_mxmlRemove cmtk_cmtk_mxmlRemove #define cmtk_mxmlRetain cmtk_cmtk_mxmlRetain #define cmtk_mxmlSAXLoadFd cmtk_cmtk_mxmlSAXLoadFd #define cmtk_mxmlSAXLoadFile cmtk_cmtk_mxmlSAXLoadFile #define cmtk_mxmlSAXLoadString cmtk_cmtk_mxmlSAXLoadString #define cmtk_mxmlSaveAllocString cmtk_cmtk_mxmlSaveAllocString #define cmtk_mxmlSaveFd cmtk_cmtk_mxmlSaveFd #define cmtk_mxmlSaveFile cmtk_cmtk_mxmlSaveFile #define cmtk_mxmlSaveString cmtk_cmtk_mxmlSaveString #define cmtk_mxmlSetCDATA cmtk_cmtk_mxmlSetCDATA #define cmtk_mxmlSetCustom cmtk_cmtk_mxmlSetCustom #define cmtk_mxmlSetCustomHandlers cmtk_cmtk_mxmlSetCustomHandlers #define cmtk_mxmlSetElement cmtk_cmtk_mxmlSetElement #define cmtk_mxmlSetErrorCallback cmtk_cmtk_mxmlSetErrorCallback #define cmtk_mxmlSetInteger cmtk_cmtk_mxmlSetInteger #define cmtk_mxmlSetOpaque cmtk_cmtk_mxmlSetOpaque #define cmtk_mxmlSetReal cmtk_cmtk_mxmlSetReal #define cmtk_mxmlSetText cmtk_cmtk_mxmlSetText #define cmtk_mxmlSetTextf cmtk_cmtk_mxmlSetTextf #define cmtk_mxmlSetWrapMargin cmtk_cmtk_mxmlSetWrapMargin #define cmtk_mxmlWalkNext cmtk_cmtk_mxmlWalkNext #define cmtk_mxmlWalkPrev cmtk_cmtk_mxmlWalkPrev #define cmtk_mxml_error cmtk_cmtk_mxml_error #define cmtk_mxml_ignore_cb cmtk_cmtk_mxml_ignore_cb #define cmtk_mxml_integer_cb cmtk_cmtk_mxml_integer_cb #define cmtk_mxml_opaque_cb cmtk_cmtk_mxml_opaque_cb #define cmtk_mxml_real_cb cmtk_cmtk_mxml_real_cb #define mxmlFindPath cmtk_mxmlFindPath #define mxmlGetCDATA cmtk_mxmlGetCDATA #define mxmlGetCustom cmtk_mxmlGetCustom #define mxmlGetElement cmtk_mxmlGetElement #define mxmlGetFirstChild cmtk_mxmlGetFirstChild #define mxmlGetInteger cmtk_mxmlGetInteger #define mxmlGetLastChild cmtk_mxmlGetLastChild #define mxmlGetNextSibling cmtk_mxmlGetNextSibling #define mxmlGetOpaque cmtk_mxmlGetOpaque #define mxmlGetParent cmtk_mxmlGetParent #define mxmlGetPrevSibling cmtk_mxmlGetPrevSibling #define mxmlGetReal cmtk_mxmlGetReal #define mxmlGetRefCount cmtk_mxmlGetRefCount #define mxmlGetText cmtk_mxmlGetText #define mxmlGetType cmtk_mxmlGetType #define mxmlGetUserData cmtk_mxmlGetUserData #define mxmlIndexGetCount cmtk_mxmlIndexGetCount #define mxmlSetUserData cmtk_mxmlSetUserData #endif cmtk-3.0.0/Utilities/mxml/mxml-index.c0000644000177700000170000003264611747570117016712 0ustar torstenman/* * "$Id: mxml-index.c 426 2011-01-01 23:42:17Z mike $" * * Index support code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Sort functions... */ static int index_compare(mxml_index_t *ind, mxml_node_t *first, mxml_node_t *second); static int index_find(mxml_index_t *ind, const char *element, const char *value, mxml_node_t *node); static void index_sort(mxml_index_t *ind, int left, int right); /* * 'mxmlIndexDelete()' - Delete an index. */ void mxmlIndexDelete(mxml_index_t *ind) /* I - Index to delete */ { /* * Range check input.. */ if (!ind) return; /* * Free memory... */ if (ind->attr) free(ind->attr); if (ind->alloc_nodes) free(ind->nodes); free(ind); } /* * 'mxmlIndexEnum()' - Return the next node in the index. * * Nodes are returned in the sorted order of the index. */ mxml_node_t * /* O - Next node or NULL if there is none */ mxmlIndexEnum(mxml_index_t *ind) /* I - Index to enumerate */ { /* * Range check input... */ if (!ind) return (NULL); /* * Return the next node... */ if (ind->cur_node < ind->num_nodes) return (ind->nodes[ind->cur_node ++]); else return (NULL); } /* * 'mxmlIndexFind()' - Find the next matching node. * * You should call mxmlIndexReset() prior to using this function for * the first time with a particular set of "element" and "value" * strings. Passing NULL for both "element" and "value" is equivalent * to calling mxmlIndexEnum(). */ mxml_node_t * /* O - Node or NULL if none found */ mxmlIndexFind(mxml_index_t *ind, /* I - Index to search */ const char *element, /* I - Element name to find, if any */ const char *value) /* I - Attribute value, if any */ { int diff, /* Difference between names */ current, /* Current entity in search */ first, /* First entity in search */ last; /* Last entity in search */ #ifdef DEBUG printf("mxmlIndexFind(ind=%p, element=\"%s\", value=\"%s\")\n", ind, element ? element : "(null)", value ? value : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!ind || (!ind->attr && value)) { #ifdef DEBUG puts(" returning NULL..."); printf(" ind->attr=\"%s\"\n", ind->attr ? ind->attr : "(null)"); #endif /* DEBUG */ return (NULL); } /* * If both element and value are NULL, just enumerate the nodes in the * index... */ if (!element && !value) return (mxmlIndexEnum(ind)); /* * If there are no nodes in the index, return NULL... */ if (!ind->num_nodes) { #ifdef DEBUG puts(" returning NULL..."); puts(" no nodes!"); #endif /* DEBUG */ return (NULL); } /* * If cur_node == 0, then find the first matching node... */ if (ind->cur_node == 0) { /* * Find the first node using a modified binary search algorithm... */ first = 0; last = ind->num_nodes - 1; #ifdef DEBUG printf(" find first time, num_nodes=%d...\n", ind->num_nodes); #endif /* DEBUG */ while ((last - first) > 1) { current = (first + last) / 2; #ifdef DEBUG printf(" first=%d, last=%d, current=%d\n", first, last, current); #endif /* DEBUG */ if ((diff = index_find(ind, element, value, ind->nodes[current])) == 0) { /* * Found a match, move back to find the first... */ #ifdef DEBUG puts(" match!"); #endif /* DEBUG */ while (current > 0 && !index_find(ind, element, value, ind->nodes[current - 1])) current --; #ifdef DEBUG printf(" returning first match=%d\n", current); #endif /* DEBUG */ /* * Return the first match and save the index to the next... */ ind->cur_node = current + 1; return (ind->nodes[current]); } else if (diff < 0) last = current; else first = current; #ifdef DEBUG printf(" diff=%d\n", diff); #endif /* DEBUG */ } /* * If we get this far, then we found exactly 0 or 1 matches... */ for (current = first; current <= last; current ++) if (!index_find(ind, element, value, ind->nodes[current])) { /* * Found exactly one (or possibly two) match... */ #ifdef DEBUG printf(" returning only match %d...\n", current); #endif /* DEBUG */ ind->cur_node = current + 1; return (ind->nodes[current]); } /* * No matches... */ ind->cur_node = ind->num_nodes; #ifdef DEBUG puts(" returning NULL..."); #endif /* DEBUG */ return (NULL); } else if (ind->cur_node < ind->num_nodes && !index_find(ind, element, value, ind->nodes[ind->cur_node])) { /* * Return the next matching node... */ #ifdef DEBUG printf(" returning next match %d...\n", ind->cur_node); #endif /* DEBUG */ return (ind->nodes[ind->cur_node ++]); } /* * If we get this far, then we have no matches... */ ind->cur_node = ind->num_nodes; #ifdef DEBUG puts(" returning NULL..."); #endif /* DEBUG */ return (NULL); } /* * 'mxmlIndexGetCount()' - Get the number of nodes in an index. * * @since Mini-XML 2.7@ */ int /* I - Number of nodes in index */ mxmlIndexGetCount(mxml_index_t *ind) /* I - Index of nodes */ { /* * Range check input... */ if (!ind) return (0); /* * Return the number of nodes in the index... */ return (ind->num_nodes); } /* * 'mxmlIndexNew()' - Create a new index. * * The index will contain all nodes that contain the named element and/or * attribute. If both "element" and "attr" are NULL, then the index will * contain a sorted list of the elements in the node tree. Nodes are * sorted by element name and optionally by attribute value if the "attr" * argument is not NULL. */ mxml_index_t * /* O - New index */ mxmlIndexNew(mxml_node_t *node, /* I - XML node tree */ const char *element, /* I - Element to index or NULL for all */ const char *attr) /* I - Attribute to index or NULL for none */ { mxml_index_t *ind; /* New index */ mxml_node_t *current, /* Current node in index */ **temp; /* Temporary node pointer array */ /* * Range check input... */ #ifdef DEBUG printf("mxmlIndexNew(node=%p, element=\"%s\", attr=\"%s\")\n", node, element ? element : "(null)", attr ? attr : "(null)"); #endif /* DEBUG */ if (!node) return (NULL); /* * Create a new index... */ if ((ind = calloc(1, sizeof(mxml_index_t))) == NULL) { mxml_error("Unable to allocate %d bytes for index - %s", sizeof(mxml_index_t), strerror(errno)); return (NULL); } if (attr) ind->attr = strdup(attr); if (!element && !attr) current = node; else current = mxmlFindElement(node, node, element, attr, NULL, MXML_DESCEND); while (current) { if (ind->num_nodes >= ind->alloc_nodes) { if (!ind->alloc_nodes) temp = malloc(64 * sizeof(mxml_node_t *)); else temp = realloc(ind->nodes, (ind->alloc_nodes + 64) * sizeof(mxml_node_t *)); if (!temp) { /* * Unable to allocate memory for the index, so abort... */ mxml_error("Unable to allocate %d bytes for index: %s", (ind->alloc_nodes + 64) * sizeof(mxml_node_t *), strerror(errno)); mxmlIndexDelete(ind); return (NULL); } ind->nodes = temp; ind->alloc_nodes += 64; } ind->nodes[ind->num_nodes ++] = current; current = mxmlFindElement(current, node, element, attr, NULL, MXML_DESCEND); } /* * Sort nodes based upon the search criteria... */ #ifdef DEBUG { int i; /* Looping var */ printf("%d node(s) in index.\n\n", ind->num_nodes); if (attr) { printf("Node Address Element %s\n", attr); puts("-------- -------- -------------- ------------------------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %-14.14s %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name, mxmlElementGetAttr(ind->nodes[i], attr)); } else { puts("Node Address Element"); puts("-------- -------- --------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name); } putchar('\n'); } #endif /* DEBUG */ if (ind->num_nodes > 1) index_sort(ind, 0, ind->num_nodes - 1); #ifdef DEBUG { int i; /* Looping var */ puts("After sorting:\n"); if (attr) { printf("Node Address Element %s\n", attr); puts("-------- -------- -------------- ------------------------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %-14.14s %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name, mxmlElementGetAttr(ind->nodes[i], attr)); } else { puts("Node Address Element"); puts("-------- -------- --------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name); } putchar('\n'); } #endif /* DEBUG */ /* * Return the new index... */ return (ind); } /* * 'mxmlIndexReset()' - Reset the enumeration/find pointer in the index and * return the first node in the index. * * This function should be called prior to using mxmlIndexEnum() or * mxmlIndexFind() for the first time. */ mxml_node_t * /* O - First node or NULL if there is none */ mxmlIndexReset(mxml_index_t *ind) /* I - Index to reset */ { #ifdef DEBUG printf("mxmlIndexReset(ind=%p)\n", ind); #endif /* DEBUG */ /* * Range check input... */ if (!ind) return (NULL); /* * Set the index to the first element... */ ind->cur_node = 0; /* * Return the first node... */ if (ind->num_nodes) return (ind->nodes[0]); else return (NULL); } /* * 'index_compare()' - Compare two nodes. */ static int /* O - Result of comparison */ index_compare(mxml_index_t *ind, /* I - Index */ mxml_node_t *first, /* I - First node */ mxml_node_t *second) /* I - Second node */ { int diff; /* Difference */ /* * Check the element name... */ if ((diff = strcmp(first->value.element.name, second->value.element.name)) != 0) return (diff); /* * Check the attribute value... */ if (ind->attr) { if ((diff = strcmp(mxmlElementGetAttr(first, ind->attr), mxmlElementGetAttr(second, ind->attr))) != 0) return (diff); } /* * No difference, return 0... */ return (0); } /* * 'index_find()' - Compare a node with index values. */ static int /* O - Result of comparison */ index_find(mxml_index_t *ind, /* I - Index */ const char *element, /* I - Element name or NULL */ const char *value, /* I - Attribute value or NULL */ mxml_node_t *node) /* I - Node */ { int diff; /* Difference */ /* * Check the element name... */ if (element) { if ((diff = strcmp(element, node->value.element.name)) != 0) return (diff); } /* * Check the attribute value... */ if (value) { if ((diff = strcmp(value, mxmlElementGetAttr(node, ind->attr))) != 0) return (diff); } /* * No difference, return 0... */ return (0); } /* * 'index_sort()' - Sort the nodes in the index... * * This function implements the classic quicksort algorithm... */ static void index_sort(mxml_index_t *ind, /* I - Index to sort */ int left, /* I - Left node in partition */ int right) /* I - Right node in partition */ { mxml_node_t *pivot, /* Pivot node */ *temp; /* Swap node */ int templ, /* Temporary left node */ tempr; /* Temporary right node */ /* * Loop until we have sorted all the way to the right... */ do { /* * Sort the pivot in the current partition... */ pivot = ind->nodes[left]; for (templ = left, tempr = right; templ < tempr;) { /* * Move left while left node <= pivot node... */ while ((templ < right) && index_compare(ind, ind->nodes[templ], pivot) <= 0) templ ++; /* * Move right while right node > pivot node... */ while ((tempr > left) && index_compare(ind, ind->nodes[tempr], pivot) > 0) tempr --; /* * Swap nodes if needed... */ if (templ < tempr) { temp = ind->nodes[templ]; ind->nodes[templ] = ind->nodes[tempr]; ind->nodes[tempr] = temp; } } /* * When we get here, the right (tempr) node is the new position for the * pivot node... */ if (index_compare(ind, pivot, ind->nodes[tempr]) > 0) { ind->nodes[left] = ind->nodes[tempr]; ind->nodes[tempr] = pivot; } /* * Recursively sort the left partition as needed... */ if (left < (tempr - 1)) index_sort(ind, left, tempr - 1); } while (right > (left = tempr + 1)); } /* * End of "$Id: mxml-index.c 426 2011-01-01 23:42:17Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml.h0000644000177700000170000002761611747570117015613 0ustar torstenman/* * "$Id: mxml.h 427 2011-01-03 02:03:29Z mike $" * * Header file for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ */ /* * Prevent multiple inclusion... */ #ifndef _mxml_h_ # define _mxml_h_ /* * add "cmtk_" prefix to exported symbols - we are building this library bundled with CMTK */ #include /* * Include necessary headers... */ # include # include # include # include # include /* * Constants... */ # define MXML_TAB 8 /* Tabs every N columns */ # define MXML_NO_CALLBACK 0 /* Don't use a type callback */ # define MXML_INTEGER_CALLBACK mxml_integer_cb /* Treat all data as integers */ # define MXML_OPAQUE_CALLBACK mxml_opaque_cb /* Treat all data as opaque */ # define MXML_REAL_CALLBACK mxml_real_cb /* Treat all data as real numbers */ # define MXML_TEXT_CALLBACK 0 /* Treat all data as text */ # define MXML_IGNORE_CALLBACK mxml_ignore_cb /* Ignore all non-element content */ # define MXML_NO_PARENT 0 /* No parent for the node */ # define MXML_DESCEND 1 /* Descend when finding/walking */ # define MXML_NO_DESCEND 0 /* Don't descend when finding/walking */ # define MXML_DESCEND_FIRST -1 /* Descend for first find */ # define MXML_WS_BEFORE_OPEN 0 /* Callback for before open tag */ # define MXML_WS_AFTER_OPEN 1 /* Callback for after open tag */ # define MXML_WS_BEFORE_CLOSE 2 /* Callback for before close tag */ # define MXML_WS_AFTER_CLOSE 3 /* Callback for after close tag */ # define MXML_ADD_BEFORE 0 /* Add node before specified node */ # define MXML_ADD_AFTER 1 /* Add node after specified node */ # define MXML_ADD_TO_PARENT NULL /* Add node relative to parent */ /* * Data types... */ typedef enum mxml_sax_event_e /**** SAX event type. ****/ { MXML_SAX_CDATA, /* CDATA node */ MXML_SAX_COMMENT, /* Comment node */ MXML_SAX_DATA, /* Data node */ MXML_SAX_DIRECTIVE, /* Processing directive node */ MXML_SAX_ELEMENT_CLOSE, /* Element closed */ MXML_SAX_ELEMENT_OPEN /* Element opened */ } mxml_sax_event_t; typedef enum mxml_type_e /**** The XML node type. ****/ { MXML_IGNORE = -1, /* Ignore/throw away node @since Mini-XML 2.3@ */ MXML_ELEMENT, /* XML element with attributes */ MXML_INTEGER, /* Integer value */ MXML_OPAQUE, /* Opaque string */ MXML_REAL, /* Real value */ MXML_TEXT, /* Text fragment */ MXML_CUSTOM /* Custom data @since Mini-XML 2.1@ */ } mxml_type_t; typedef void (*mxml_custom_destroy_cb_t)(void *); /**** Custom data destructor ****/ typedef void (*mxml_error_cb_t)(const char *); /**** Error callback function ****/ typedef struct mxml_attr_s /**** An XML element attribute value. @private@ ****/ { char *name; /* Attribute name */ char *value; /* Attribute value */ } mxml_attr_t; typedef struct mxml_element_s /**** An XML element value. @private@ ****/ { char *name; /* Name of element */ int num_attrs; /* Number of attributes */ mxml_attr_t *attrs; /* Attributes */ } mxml_element_t; typedef struct mxml_text_s /**** An XML text value. @private@ ****/ { int whitespace; /* Leading whitespace? */ char *string; /* Fragment string */ } mxml_text_t; typedef struct mxml_custom_s /**** An XML custom value. @private@ ****/ { void *data; /* Pointer to (allocated) custom data */ mxml_custom_destroy_cb_t destroy; /* Pointer to destructor function */ } mxml_custom_t; typedef union mxml_value_u /**** An XML node value. @private@ ****/ { mxml_element_t element; /* Element */ int integer; /* Integer number */ char *opaque; /* Opaque string */ double real; /* Real number */ mxml_text_t text; /* Text fragment */ mxml_custom_t custom; /* Custom data @since Mini-XML 2.1@ */ } mxml_value_t; struct mxml_node_s /**** An XML node. @private@ ****/ { mxml_type_t type; /* Node type */ struct mxml_node_s *next; /* Next node under same parent */ struct mxml_node_s *prev; /* Previous node under same parent */ struct mxml_node_s *parent; /* Parent node */ struct mxml_node_s *child; /* First child node */ struct mxml_node_s *last_child; /* Last child node */ mxml_value_t value; /* Node value */ int ref_count; /* Use count */ void *user_data; /* User data */ }; typedef struct mxml_node_s mxml_node_t; /**** An XML node. ****/ struct mxml_index_s /**** An XML node index. @private@ ****/ { char *attr; /* Attribute used for indexing or NULL */ int num_nodes; /* Number of nodes in index */ int alloc_nodes; /* Allocated nodes in index */ int cur_node; /* Current node */ mxml_node_t **nodes; /* Node array */ }; typedef struct mxml_index_s mxml_index_t; /**** An XML node index. ****/ typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); /**** Custom data load callback function ****/ typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *); /**** Custom data save callback function ****/ typedef int (*mxml_entity_cb_t)(const char *); /**** Entity callback function */ typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *); /**** Load callback function ****/ typedef const char *(*mxml_save_cb_t)(mxml_node_t *, int); /**** Save callback function ****/ typedef void (*mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *); /**** SAX callback function ****/ /* * C++ support... */ # ifdef __cplusplus extern "C" { # endif /* __cplusplus */ /* * Prototypes... */ extern void mxmlAdd(mxml_node_t *parent, int where, mxml_node_t *child, mxml_node_t *node); extern void mxmlDelete(mxml_node_t *node); extern void mxmlElementDeleteAttr(mxml_node_t *node, const char *name); extern const char *mxmlElementGetAttr(mxml_node_t *node, const char *name); extern void mxmlElementSetAttr(mxml_node_t *node, const char *name, const char *value); extern void mxmlElementSetAttrf(mxml_node_t *node, const char *name, const char *format, ...) # ifdef __GNUC__ __attribute__ ((__format__ (__printf__, 3, 4))) # endif /* __GNUC__ */ ; extern int mxmlEntityAddCallback(mxml_entity_cb_t cb); extern const char *mxmlEntityGetName(int val); extern int mxmlEntityGetValue(const char *name); extern void mxmlEntityRemoveCallback(mxml_entity_cb_t cb); extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top, const char *name, const char *attr, const char *value, int descend); extern mxml_node_t *mxmlFindPath(mxml_node_t *node, const char *path); extern const char *mxmlGetCDATA(mxml_node_t *node); extern const void *mxmlGetCustom(mxml_node_t *node); extern const char *mxmlGetElement(mxml_node_t *node); extern mxml_node_t *mxmlGetFirstChild(mxml_node_t *node); extern int mxmlGetInteger(mxml_node_t *node); extern mxml_node_t *mxmlGetLastChild(mxml_node_t *node); extern mxml_node_t *mxmlGetNextSibling(mxml_node_t *node); extern const char *mxmlGetOpaque(mxml_node_t *node); extern mxml_node_t *mxmlGetParent(mxml_node_t *node); extern mxml_node_t *mxmlGetPrevSibling(mxml_node_t *node); extern double mxmlGetReal(mxml_node_t *node); extern int mxmlGetRefCount(mxml_node_t *node); extern const char *mxmlGetText(mxml_node_t *node, int *whitespace); extern mxml_type_t mxmlGetType(mxml_node_t *node); extern void *mxmlGetUserData(mxml_node_t *node); extern void mxmlIndexDelete(mxml_index_t *ind); extern mxml_node_t *mxmlIndexEnum(mxml_index_t *ind); extern mxml_node_t *mxmlIndexFind(mxml_index_t *ind, const char *element, const char *value); extern int mxmlIndexGetCount(mxml_index_t *ind); extern mxml_index_t *mxmlIndexNew(mxml_node_t *node, const char *element, const char *attr); extern mxml_node_t *mxmlIndexReset(mxml_index_t *ind); extern mxml_node_t *mxmlLoadFd(mxml_node_t *top, int fd, mxml_type_t (*cb)(mxml_node_t *)); extern mxml_node_t *mxmlLoadFile(mxml_node_t *top, FILE *fp, mxml_type_t (*cb)(mxml_node_t *)); extern mxml_node_t *mxmlLoadString(mxml_node_t *top, const char *s, mxml_type_t (*cb)(mxml_node_t *)); extern mxml_node_t *mxmlNewCDATA(mxml_node_t *parent, const char *string); extern mxml_node_t *mxmlNewCustom(mxml_node_t *parent, void *data, mxml_custom_destroy_cb_t destroy); extern mxml_node_t *mxmlNewElement(mxml_node_t *parent, const char *name); extern mxml_node_t *mxmlNewInteger(mxml_node_t *parent, int integer); extern mxml_node_t *mxmlNewOpaque(mxml_node_t *parent, const char *opaque); extern mxml_node_t *mxmlNewReal(mxml_node_t *parent, double real); extern mxml_node_t *mxmlNewText(mxml_node_t *parent, int whitespace, const char *string); extern mxml_node_t *mxmlNewTextf(mxml_node_t *parent, int whitespace, const char *format, ...) # ifdef __GNUC__ __attribute__ ((__format__ (__printf__, 3, 4))) # endif /* __GNUC__ */ ; extern mxml_node_t *mxmlNewXML(const char *version); extern int mxmlRelease(mxml_node_t *node); extern void mxmlRemove(mxml_node_t *node); extern int mxmlRetain(mxml_node_t *node); extern char *mxmlSaveAllocString(mxml_node_t *node, mxml_save_cb_t cb); extern int mxmlSaveFd(mxml_node_t *node, int fd, mxml_save_cb_t cb); extern int mxmlSaveFile(mxml_node_t *node, FILE *fp, mxml_save_cb_t cb); extern int mxmlSaveString(mxml_node_t *node, char *buffer, int bufsize, mxml_save_cb_t cb); extern mxml_node_t *mxmlSAXLoadFd(mxml_node_t *top, int fd, mxml_type_t (*cb)(mxml_node_t *), mxml_sax_cb_t sax, void *sax_data); extern mxml_node_t *mxmlSAXLoadFile(mxml_node_t *top, FILE *fp, mxml_type_t (*cb)(mxml_node_t *), mxml_sax_cb_t sax, void *sax_data); extern mxml_node_t *mxmlSAXLoadString(mxml_node_t *top, const char *s, mxml_type_t (*cb)(mxml_node_t *), mxml_sax_cb_t sax, void *sax_data); extern int mxmlSetCDATA(mxml_node_t *node, const char *data); extern int mxmlSetCustom(mxml_node_t *node, void *data, mxml_custom_destroy_cb_t destroy); extern void mxmlSetCustomHandlers(mxml_custom_load_cb_t load, mxml_custom_save_cb_t save); extern int mxmlSetElement(mxml_node_t *node, const char *name); extern void mxmlSetErrorCallback(mxml_error_cb_t cb); extern int mxmlSetInteger(mxml_node_t *node, int integer); extern int mxmlSetOpaque(mxml_node_t *node, const char *opaque); extern int mxmlSetReal(mxml_node_t *node, double real); extern int mxmlSetText(mxml_node_t *node, int whitespace, const char *string); extern int mxmlSetTextf(mxml_node_t *node, int whitespace, const char *format, ...) # ifdef __GNUC__ __attribute__ ((__format__ (__printf__, 3, 4))) # endif /* __GNUC__ */ ; extern int mxmlSetUserData(mxml_node_t *node, void *data); extern void mxmlSetWrapMargin(int column); extern mxml_node_t *mxmlWalkNext(mxml_node_t *node, mxml_node_t *top, int descend); extern mxml_node_t *mxmlWalkPrev(mxml_node_t *node, mxml_node_t *top, int descend); /* * Semi-private functions... */ extern void mxml_error(const char *format, ...); extern mxml_type_t mxml_ignore_cb(mxml_node_t *node); extern mxml_type_t mxml_integer_cb(mxml_node_t *node); extern mxml_type_t mxml_opaque_cb(mxml_node_t *node); extern mxml_type_t mxml_real_cb(mxml_node_t *node); /* * C++ support... */ # ifdef __cplusplus } # endif /* __cplusplus */ #endif /* !_mxml_h_ */ /* * End of "$Id: mxml.h 427 2011-01-03 02:03:29Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml-search.c0000644000177700000170000001560411747570117017043 0ustar torstenman/* * "$Id: mxml-search.c 427 2011-01-03 02:03:29Z mike $" * * Search/navigation functions for Mini-XML, a small XML-like file * parsing library. * * Copyright 2003-2010 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxmlFindElement() - Find the named element. * mxmlFindValue() - Find a value with the given path. * mxmlWalkNext() - Walk to the next logical node in the tree. * mxmlWalkPrev() - Walk to the previous logical node in the tree. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * 'mxmlFindElement()' - Find the named element. * * The search is constrained by the name, attribute name, and value; any * NULL names or values are treated as wildcards, so different kinds of * searches can be implemented by looking for all elements of a given name * or all elements with a specific attribute. The descend argument determines * whether the search descends into child nodes; normally you will use * MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find * additional direct descendents of the node. The top node argument * constrains the search to a particular node's children. */ mxml_node_t * /* O - Element node or NULL */ mxmlFindElement(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ const char *name, /* I - Element name or NULL for any */ const char *attr, /* I - Attribute name, or NULL for none */ const char *value, /* I - Attribute value, or NULL for any */ int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ { const char *temp; /* Current attribute value */ /* * Range check input... */ if (!node || !top || (!attr && value)) return (NULL); /* * Start with the next node... */ node = mxmlWalkNext(node, top, descend); /* * Loop until we find a matching element... */ while (node != NULL) { /* * See if this node matches... */ if (node->type == MXML_ELEMENT && node->value.element.name && (!name || !strcmp(node->value.element.name, name))) { /* * See if we need to check for an attribute... */ if (!attr) return (node); /* No attribute search, return it... */ /* * Check for the attribute... */ if ((temp = mxmlElementGetAttr(node, attr)) != NULL) { /* * OK, we have the attribute, does it match? */ if (!value || !strcmp(value, temp)) return (node); /* Yes, return it... */ } } /* * No match, move on to the next node... */ if (descend == MXML_DESCEND) node = mxmlWalkNext(node, top, MXML_DESCEND); else node = node->next; } return (NULL); } /* * 'mxmlFindPath()' - Find a node with the given path. * * The "path" is a slash-separated list of element names. The name "*" is * considered a wildcard for one or more levels of elements. For example, * "foo/one/two", "bar/two/one", "*\/one", and so forth. * * The first child node of the found node is returned if the given node has * children and the first child is a value node. * * @since Mini-XML 2.7@ */ mxml_node_t * /* O - Found node or NULL */ mxmlFindPath(mxml_node_t *top, /* I - Top node */ const char *path) /* I - Path to element */ { mxml_node_t *node; /* Current node */ char element[256]; /* Current element name */ const char *pathsep; /* Separator in path */ int descend; /* mxmlFindElement option */ /* * Range check input... */ if (!top || !path || !*path) return (NULL); /* * Search each element in the path... */ node = top; while (*path) { /* * Handle wildcards... */ if (!strncmp(path, "*/", 2)) { path += 2; descend = MXML_DESCEND; } else descend = MXML_DESCEND_FIRST; /* * Get the next element in the path... */ if ((pathsep = strchr(path, '/')) == NULL) pathsep = path + strlen(path); if (pathsep == path || (pathsep - path) >= sizeof(element)) return (NULL); memcpy(element, path, pathsep - path); element[pathsep - path] = '\0'; if (*pathsep) path = pathsep + 1; else path = pathsep; /* * Search for the element... */ if ((node = mxmlFindElement(node, node, element, NULL, NULL, descend)) == NULL) return (NULL); } /* * If we get this far, return the node or its first child... */ if (node->child && node->child->type != MXML_ELEMENT) return (node->child); else return (node); } /* * 'mxmlWalkNext()' - Walk to the next logical node in the tree. * * The descend argument controls whether the first child is considered * to be the next node. The top node argument constrains the walk to * the node's children. */ mxml_node_t * /* O - Next node or NULL */ mxmlWalkNext(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ { if (!node) return (NULL); else if (node->child && descend) return (node->child); else if (node == top) return (NULL); else if (node->next) return (node->next); else if (node->parent && node->parent != top) { node = node->parent; while (!node->next) if (node->parent == top || !node->parent) return (NULL); else node = node->parent; return (node->next); } else return (NULL); } /* * 'mxmlWalkPrev()' - Walk to the previous logical node in the tree. * * The descend argument controls whether the previous node's last child * is considered to be the previous node. The top node argument constrains * the walk to the node's children. */ mxml_node_t * /* O - Previous node or NULL */ mxmlWalkPrev(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ { if (!node || node == top) return (NULL); else if (node->prev) { if (node->prev->last_child && descend) { /* * Find the last child under the previous node... */ node = node->prev->last_child; while (node->last_child) node = node->last_child; return (node); } else return (node->prev); } else if (node->parent != top) return (node->parent); else return (NULL); } /* * End of "$Id: mxml-search.c 427 2011-01-03 02:03:29Z mike $". */ cmtk-3.0.0/Utilities/mxml/ANNOUNCEMENT0000644000177700000170000000120111747570117016260 0ustar torstenmanMini-XML 2.7 is now available for download from: http://www.minixml.org/software.php Mini-XML 2.7 fixes some minor platform and XML issues. Changes include: - Updated the source headers to reference the Mini-XML license and its exceptions to the LGPL2 (STR #108) - The shared library did not include a destructor for the thread- specific data key on UNIX-based operating systems (STR #103) - mxmlLoad* did not error out on XML with multiple root nodes (STR #101) - Fixed an issue with the _mxml_vstrdupf function (STR #107) - mxmlSave* no longer write all siblings of the passed node, just that node and its children (STR #109) cmtk-3.0.0/Utilities/mxml/mxml-set.c0000644000177700000170000001761011747570117016370 0ustar torstenman/* * "$Id: mxml-set.c 441 2011-12-09 23:49:00Z mike $" * * Node set functions for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2011 by Michael R Sweet. * * These coded instructions, statements, and computer programs are the * property of Michael R Sweet and are protected by Federal copyright * law. Distribution and use rights are outlined in the file "COPYING" * which should have been included with this file. If this file is * missing or damaged, see the license at: * * http://www.minixml.org/ * * Contents: * * mxmlSetCDATA() - Set the element name of a CDATA node. * mxmlSetCustom() - Set the data and destructor of a custom data node. * mxmlSetElement() - Set the name of an element node. * mxmlSetInteger() - Set the value of an integer node. * mxmlSetOpaque() - Set the value of an opaque node. * mxmlSetReal() - Set the value of a real number node. * mxmlSetText() - Set the value of a text node. * mxmlSetTextf() - Set the value of a text node to a formatted string. * mxmlSetUserData() - Set the user data pointer for a node. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * 'mxmlSetCDATA()' - Set the element name of a CDATA node. * * The node is not changed if it (or its first child) is not a CDATA element node. * * @since Mini-XML 2.3@ */ int /* O - 0 on success, -1 on failure */ mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */ const char *data) /* I - New data string */ { /* * Range check input... */ if (node && node->type == MXML_ELEMENT && strncmp(node->value.element.name, "![CDATA[", 8) && node->child && node->child->type == MXML_ELEMENT && !strncmp(node->child->value.element.name, "![CDATA[", 8)) node = node->child; if (!node || node->type != MXML_ELEMENT || !data || strncmp(node->value.element.name, "![CDATA[", 8)) return (-1); /* * Free any old element value and set the new value... */ if (node->value.element.name) free(node->value.element.name); node->value.element.name = _mxml_strdupf("![CDATA[%s]]", data); return (0); } /* * 'mxmlSetCustom()' - Set the data and destructor of a custom data node. * * The node is not changed if it (or its first child) is not a custom node. * * @since Mini-XML 2.1@ */ int /* O - 0 on success, -1 on failure */ mxmlSetCustom( mxml_node_t *node, /* I - Node to set */ void *data, /* I - New data pointer */ mxml_custom_destroy_cb_t destroy) /* I - New destructor function */ { /* * Range check input... */ if (node && node->type == MXML_ELEMENT && node->child && node->child->type == MXML_CUSTOM) node = node->child; if (!node || node->type != MXML_CUSTOM) return (-1); /* * Free any old element value and set the new value... */ if (node->value.custom.data && node->value.custom.destroy) (*(node->value.custom.destroy))(node->value.custom.data); node->value.custom.data = data; node->value.custom.destroy = destroy; return (0); } /* * 'mxmlSetElement()' - Set the name of an element node. * * The node is not changed if it is not an element node. */ int /* O - 0 on success, -1 on failure */ mxmlSetElement(mxml_node_t *node, /* I - Node to set */ const char *name) /* I - New name string */ { /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name) return (-1); /* * Free any old element value and set the new value... */ if (node->value.element.name) free(node->value.element.name); node->value.element.name = strdup(name); return (0); } /* * 'mxmlSetInteger()' - Set the value of an integer node. * * The node is not changed if it (or its first child) is not an integer node. */ int /* O - 0 on success, -1 on failure */ mxmlSetInteger(mxml_node_t *node, /* I - Node to set */ int integer) /* I - Integer value */ { /* * Range check input... */ if (node && node->type == MXML_ELEMENT && node->child && node->child->type == MXML_INTEGER) node = node->child; if (!node || node->type != MXML_INTEGER) return (-1); /* * Set the new value and return... */ node->value.integer = integer; return (0); } /* * 'mxmlSetOpaque()' - Set the value of an opaque node. * * The node is not changed if it (or its first child) is not an opaque node. */ int /* O - 0 on success, -1 on failure */ mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */ const char *opaque) /* I - Opaque string */ { /* * Range check input... */ if (node && node->type == MXML_ELEMENT && node->child && node->child->type == MXML_OPAQUE) node = node->child; if (!node || node->type != MXML_OPAQUE || !opaque) return (-1); /* * Free any old opaque value and set the new value... */ if (node->value.opaque) free(node->value.opaque); node->value.opaque = strdup(opaque); return (0); } /* * 'mxmlSetReal()' - Set the value of a real number node. * * The node is not changed if it (or its first child) is not a real number node. */ int /* O - 0 on success, -1 on failure */ mxmlSetReal(mxml_node_t *node, /* I - Node to set */ double real) /* I - Real number value */ { /* * Range check input... */ if (node && node->type == MXML_ELEMENT && node->child && node->child->type == MXML_REAL) node = node->child; if (!node || node->type != MXML_REAL) return (-1); /* * Set the new value and return... */ node->value.real = real; return (0); } /* * 'mxmlSetText()' - Set the value of a text node. * * The node is not changed if it (or its first child) is not a text node. */ int /* O - 0 on success, -1 on failure */ mxmlSetText(mxml_node_t *node, /* I - Node to set */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *string) /* I - String */ { /* * Range check input... */ if (node && node->type == MXML_ELEMENT && node->child && node->child->type == MXML_TEXT) node = node->child; if (!node || node->type != MXML_TEXT || !string) return (-1); /* * Free any old string value and set the new value... */ if (node->value.text.string) free(node->value.text.string); node->value.text.whitespace = whitespace; node->value.text.string = strdup(string); return (0); } /* * 'mxmlSetTextf()' - Set the value of a text node to a formatted string. * * The node is not changed if it (or its first child) is not a text node. */ int /* O - 0 on success, -1 on failure */ mxmlSetTextf(mxml_node_t *node, /* I - Node to set */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *format, /* I - Printf-style format string */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Pointer to arguments */ /* * Range check input... */ if (node && node->type == MXML_ELEMENT && node->child && node->child->type == MXML_TEXT) node = node->child; if (!node || node->type != MXML_TEXT || !format) return (-1); /* * Free any old string value and set the new value... */ if (node->value.text.string) free(node->value.text.string); va_start(ap, format); node->value.text.whitespace = whitespace; node->value.text.string = _mxml_strdupf(format, ap); va_end(ap); return (0); } /* * 'mxmlSetUserData()' - Set the user data pointer for a node. * * @since Mini-XML 2.7@ */ int /* O - 0 on success, -1 on failure */ mxmlSetUserData(mxml_node_t *node, /* I - Node to set */ void *data) /* I - User data pointer */ { /* * Range check input... */ if (!node) return (-1); /* * Set the user data pointer and return... */ node->user_data = data; return (0); } /* * End of "$Id: mxml-set.c 441 2011-12-09 23:49:00Z mike $". */ cmtk-3.0.0/Utilities/mxml/mxml.pc.in0000644000177700000170000000034511210045173016341 0ustar torstenmanprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Mini-XML Description: Lightweight XML support library Version: @VERSION@ Libs: @PC_LIBS@ @PTHREAD_LIBS@ Cflags: @PC_CFLAGS@ @PTHREAD_FLAGS@ cmtk-3.0.0/Utilities/mxml/Makefile.in0000644000177700000170000002425111747570117016522 0ustar torstenman# # "$Id: Makefile.in 439 2011-04-13 15:43:32Z mike $" # # Makefile for Mini-XML, a small XML-like file parsing library. # # Copyright 2003-2011 by Michael R Sweet. # # These coded instructions, statements, and computer programs are the # property of Michael R Sweet and are protected by Federal copyright # law. Distribution and use rights are outlined in the file "COPYING" # which should have been included with this file. If this file is # missing or damaged, see the license at: # # http://www.minixml.org/ # # # Compiler tools definitions... # AR = @AR@ ARFLAGS = @ARFLAGS@ ARCHFLAGS = @ARCHFLAGS@ CC = @CC@ CFLAGS = $(OPTIM) $(ARCHFLAGS) @CFLAGS@ @CPPFLAGS@ @PTHREAD_FLAGS@ CP = @CP@ DSO = @DSO@ DSOFLAGS = @DSOFLAGS@ LDFLAGS = $(OPTIM) $(ARCHFLAGS) @LDFLAGS@ INSTALL = @INSTALL@ LIBMXML = @LIBMXML@ LIBS = @LIBS@ @PTHREAD_LIBS@ LN = @LN@ -s MKDIR = @MKDIR@ OPTIM = @OPTIM@ RANLIB = @RANLIB@ RM = @RM@ -f SHELL = /bin/sh # # Configured directories... # prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ datarootdir = @datarootdir@ includedir = @includedir@ libdir = @libdir@ mandir = @mandir@ docdir = @docdir@ BUILDROOT = $(DSTROOT) # # Install commands... # INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755 -s INSTALL_DATA = $(INSTALL) -m 644 INSTALL_DIR = $(INSTALL) -d INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755 INSTALL_MAN = $(INSTALL) -m 644 INSTALL_SCRIPT = $(INSTALL) -m 755 # # Rules... # .SILENT: .SUFFIXES: .c .man .o .c.o: echo Compiling $< $(CC) $(CFLAGS) -c -o $@ $< # # Targets... # DOCFILES = doc/0.gif doc/1.gif doc/2.gif doc/3.gif doc/4.gif \ doc/A.gif doc/B.gif doc/C.gif doc/D.gif \ doc/mxml.html doc/mxmldoc.xsd \ README COPYING CHANGES PUBLIBOBJS = mxml-attr.o mxml-entity.o mxml-file.o mxml-get.o \ mxml-index.o mxml-node.o mxml-search.o mxml-set.o LIBOBJS = $(PUBLIBOBJS) mxml-private.o mxml-string.o OBJS = mxmldoc.o testmxml.o $(LIBOBJS) TARGETS = $(LIBMXML) mxmldoc testmxml mxml.xml doc/mxml.man # # Make everything... # all: Makefile config.h $(TARGETS) # # Clean everything... # clean: echo Cleaning build files... $(RM) $(OBJS) $(TARGETS) $(RM) mxmldoc-static libmxml.a libmxml.so.1.5 libmxml.sl.1 libmxml.1.dylib # # Really clean everything... # distclean: clean echo Cleaning distribution files... $(RM) config.cache config.log config.status $(RM) Makefile config.h $(RM) -r autom4te*.cache $(RM) *.bck *.bak $(RM) -r clang # # Run the clang.llvm.org static code analysis tool on the C sources. # .PHONY: clang clang-changes clang: echo Doing static code analysis of all code using CLANG... $(RM) -r clang scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) clean all clang-changes: echo Doing static code analysis of changed code using CLANG... scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all # # Install everything... # install: $(TARGETS) install-$(LIBMXML) install-libmxml.a echo Installing mxmldoc in $(BUILDROOT)$(bindir)... $(INSTALL_DIR) $(BUILDROOT)$(bindir) $(INSTALL_BIN) mxmldoc $(BUILDROOT)$(bindir) echo Installing documentation in $(BUILDROOT)$(docdir)... $(INSTALL_DIR) $(BUILDROOT)$(docdir) for file in $(DOCFILES); do \ $(INSTALL_MAN) $$file $(BUILDROOT)$(docdir); \ done echo Installing header files in $(BUILDROOT)$(includedir)... $(INSTALL_DIR) $(BUILDROOT)$(includedir) $(INSTALL_DATA) mxml.h $(BUILDROOT)$(includedir) echo Installing pkgconfig files in $(BUILDROOT)$(libdir)/pkgconfig... $(INSTALL_DIR) $(BUILDROOT)$(libdir)/pkgconfig $(INSTALL_DATA) mxml.pc $(BUILDROOT)$(libdir)/pkgconfig echo Installing man pages in $(BUILDROOT)$(mandir)... $(INSTALL_DIR) $(BUILDROOT)$(mandir)/man1 $(INSTALL_MAN) doc/mxmldoc.man $(BUILDROOT)$(mandir)/man1/mxmldoc.1 $(INSTALL_DIR) $(BUILDROOT)$(mandir)/man3 $(INSTALL_MAN) doc/mxml.man $(BUILDROOT)$(mandir)/man3/mxml.3 install-libmxml.a: echo Installing libmxml.a to $(BUILDROOT)$(libdir)... $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.a $(BUILDROOT)$(libdir) $(RANLIB) $(BUILDROOT)$(libdir)/libmxml.a install-libmxml.so.1.5: echo Installing libmxml.so to $(BUILDROOT)$(libdir)... $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.so.1.5 $(BUILDROOT)$(libdir) $(RM) $(BUILDROOT)$(libdir)/libmxml.so $(LN) libmxml.so.1.5 $(BUILDROOT)$(libdir)/libmxml.so $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1 $(LN) libmxml.so.1.5 $(BUILDROOT)$(libdir)/libmxml.so.1 install-libmxml.sl.1: echo Installing libmxml.sl to $(BUILDROOT)$(libdir)... $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.sl.1 $(BUILDROOT)$(libdir) $(RM) $(BUILDROOT)$(libdir)/libmxml.so $(LN) libmxml.sl.1 $(BUILDROOT)$(libdir)/libmxml.sl install-libmxml.1.dylib: echo Installing libmxml.dylib to $(BUILDROOT)$(libdir)... $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.1.dylib $(BUILDROOT)$(libdir) $(RM) $(BUILDROOT)$(libdir)/libmxml.dylib $(LN) libmxml.1.dylib $(BUILDROOT)$(libdir)/libmxml.dylib # # Uninstall everything... # uninstall: uninstall-$(LIBMXML) uninstall-libmxml.a echo Uninstalling mxmldoc from $(BUILDROOT)$(bindir)... $(RM) $(BUILDROOT)$(bindir)/mxmldoc echo Uninstalling documentation from $(BUILDROOT)$(docdir)... $(RM) -r $(BUILDROOT)$(docdir) echo Uninstalling headers from $(BUILDROOT)$(includedir)... $(RM) $(BUILDROOT)$(includedir)/mxml.h echo Uninstalling pkgconfig files from $(BUILDROOT)$(libdir)/pkgconfig... $(RM) $(BUILDROOT)$(libdir)/pkgconfig/mxml.pc echo Uninstalling man pages from $(BUILDROOT)$(mandir)... $(RM) $(BUILDROOT)$(mandir)/man1/mxmldoc.1 $(RM) $(BUILDROOT)$(mandir)/man3/mxml.3 uninstall-libmxml.a: echo Uninstalling libmxml.a from $(BUILDROOT)$(libdir)... $(RM) $(BUILDROOT)$(libdir)/libmxml.a uninstall-libmxml.so.1.5: echo Uninstalling libmxml.so from $(BUILDROOT)$(libdir)... $(RM) $(BUILDROOT)$(libdir)/libmxml.so $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1 $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1.4 uninstall-libmxml.sl.1: echo Uninstalling libmxml.sl from $(BUILDROOT)$(libdir)... $(RM) $(BUILDROOT)$(libdir)/libmxml.sl $(RM) $(BUILDROOT)$(libdir)/libmxml.sl.1 uninstall-libmxml.1.dylib: echo Uninstalling libmxml.dylib from $(BUILDROOT)$(libdir)... $(RM) $(BUILDROOT)$(libdir)/libmxml.dylib $(RM) $(BUILDROOT)$(libdir)/libmxml.1.dylib # # Make packages using EPM (http://www.epmhome.org/) # epm: all echo Creating distribution packages... epm --output-dir dist -v -f native mxml epm --output-dir dist -v -f portable mxml # # autoconf stuff... # Makefile: configure Makefile.in echo Updating makefile... if test -f config.status; then \ ./config.status --recheck; \ ./config.status; \ else \ ./configure; \ fi touch config.h config.h: configure config.h.in echo Updating config.h... autoconf if test -f config.status; then \ ./config.status --recheck; \ ./config.status; \ else \ ./configure; \ fi touch config.h # # Figure out lines-of-code... # .PHONY: sloc sloc: echo "libmxml: \c" sloccount $(LIBOBJS:.o=.c) mxml-private.c mxml.h 2>/dev/null | \ grep "Total Physical" | awk '{print $$9}' # # libmxml.a # libmxml.a: $(LIBOBJS) echo Creating $@... $(RM) $@ $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(RANLIB) $@ $(LIBOBJS): mxml.h mxml-entity.o mxml-file.o mxml-private.o: mxml-private.h # # libmxml.so.1.5 # libmxml.so.1.5: $(LIBOBJS) echo Creating $@... $(DSO) $(DSOFLAGS) -o libmxml.so.1.5 $(LIBOBJS) $(RM) libmxml.so libmxml.so.1 $(LN) libmxml.so.1.5 libmxml.so $(LN) libmxml.so.1.5 libmxml.so.1 # # libmxml.sl.1 # libmxml.sl.1: $(LIBOBJS) echo Creating $@... $(DSO) $(DSOFLAGS) -o libmxml.sl.1 $(LIBOBJS) $(RM) libmxml.sl $(LN) libmxml.sl.1 libmxml.sl # # libmxml.1.dylib # libmxml.1.dylib: $(LIBOBJS) echo Creating $@... $(DSO) $(DSOFLAGS) -o libmxml.1.dylib \ -install_name $(libdir)/libmxml.dylib \ -current_version 1.5.0 \ -compatibility_version 1.0.0 \ $(LIBOBJS) $(RM) libmxml.dylib $(LN) libmxml.1.dylib libmxml.dylib # # mxmldoc # mxmldoc: $(LIBMXML) mxmldoc.o echo Linking $@... $(CC) -L. $(LDFLAGS) -o $@ mxmldoc.o -lmxml $(LIBS) mxmldoc-static: libmxml.a mxmldoc.o echo Linking $@... $(CC) $(LDFLAGS) -o $@ mxmldoc.o libmxml.a $(LIBS) mxmldoc.o: mxml.h # # testmxml # testmxml: libmxml.a testmxml.o echo Linking $@... $(CC) $(LDFLAGS) -o $@ testmxml.o libmxml.a $(LIBS) @echo Testing library... ./testmxml test.xml >temp1.xml 2>temp1s.xml ./testmxml temp1.xml >temp2.xml 2>temp2s.xml @if cmp temp1.xml temp2.xml; then \ echo Stdio file test passed!; \ $(RM) temp2.xml temp2s.xml; \ else \ echo Stdio file test failed!; \ fi @if cmp temp1.xml temp1s.xml; then \ echo String test passed!; \ $(RM) temp1.xml temp1s.xml; \ else \ echo String test failed!; \ fi @if cmp test.xml test.xmlfd; then \ echo File descriptor test passed!; \ $(RM) test.xmlfd; \ else \ echo File descriptor test failed!; \ fi testmxml-vg: $(LIBOBJS) testmxml.o echo Linking $@... $(CC) $(LDFLAGS) -o $@ testmxml.o $(LIBOBJS) $(LIBS) testmxml.o: mxml.h # # mxml.xml # mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c) echo Generating API documentation... $(RM) mxml.xml ./mxmldoc-static --header doc/reference.heading mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html if test "x`uname`" = xDarwin; then \ ./mxmldoc-static --docset org.minixml.docset \ --docversion @VERSION@ --feedname minixml.org \ --feedurl http://www.minixml.org/org.minixml.atom \ --header doc/docset.header --intro doc/docset.intro \ --css doc/docset.css --title "Mini-XML API Reference" \ mxml.xml || exit 1; \ $(RM) org.minixml.atom; \ /Developer/usr/bin/docsetutil package --output org.minixml.xar \ --atom org.minixml.atom \ --download-url http://www.minixml.org/org.minixml.xar \ org.minixml.docset || exit 1; \ fi valgrind: mxmldoc-static echo Doing dynamic code analysis using Valgrind... $(RM) valgrind.xml valgrind --tool=memcheck --leak-check=yes ./mxmldoc-static \ valgrind.xml mxml.h $(PUBLIBOBJS:.o=.c) \ >valgrind.html 2>valgrind.out # # doc/mxml.man # doc/mxml.man: mxmldoc-static mxml.xml echo "Generating mxml(3) man page..." $(RM) doc/mxml.man ./mxmldoc-static --man mxml --title "Mini-XML API" \ --intro doc/intro.man --footer doc/footer.man \ mxml.xml >doc/mxml.man # # All object files depend on the makefile... # $(OBJS): Makefile config.h # # End of "$Id: Makefile.in 439 2011-04-13 15:43:32Z mike $". # cmtk-3.0.0/Utilities/mxml/configure0000755000177700000170000047745611747570117016407 0ustar torstenman#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="mxml.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias VERSION LDFLAGS OPTIM ARCHFLAGS CC CFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB AR CP LN MKDIR RM ARFLAGS CPP GREP EGREP PTHREAD_FLAGS PTHREAD_LIBS DSO DSOFLAGS LIBMXML PICFLAG PC_CFLAGS PC_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug turn on debugging, default=no --enable-threads enable multi-threading support --enable-shared turn on shared libraries, default=no Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ansi set full ANSI C mode, default=no --with-archflags set additional architecture flags, default=none --with-docdir set directory for documentation, default=${prefix}/share/doc/mxml --with-vsnprintf use vsnprintf emulation functions, default=auto Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" VERSION=2.7 cat >>confdefs.h <<_ACEOF #define MXML_VERSION "Mini-XML v$VERSION" _ACEOF CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" LDFLAGS="${LDFLAGS:=}" OPTIM="" # Check whether --with-ansi was given. if test "${with_ansi+set}" = set; then withval=$with_ansi; use_ansi="$withval" else use_ansi="no" fi # Check whether --with-archflags was given. if test "${with_archflags+set}" = set; then withval=$with_archflags; ARCHFLAGS="$withval" else ARCHFLAGS="" fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; if eval "test x$enable_debug = xyes"; then OPTIM="-g" fi fi # Check whether --with-docdir was given. if test "${with_docdir+set}" = set; then withval=$with_docdir; docdir="$withval" else docdir="NONE" fi # Check whether --with-vsnprintf was given. if test "${with_vsnprintf+set}" = set; then withval=$with_vsnprintf; use_vsnprintf="$withval" else use_vsnprintf="no" fi uname=`uname` uversion=`uname -r | sed -e '1,$s/[^0-9]//g'` if test x$uname = xIRIX64; then uname="IRIX" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test "$INSTALL" = "$ac_install_sh"; then # Use full path to install-sh script... INSTALL="`pwd`/install-sh -c" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $AR in [\\/]* | ?:[\\/]*) ac_cv_path_AR="$AR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi AR=$ac_cv_path_AR if test -n "$AR"; then { echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_CP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CP in [\\/]* | ?:[\\/]*) ac_cv_path_CP="$CP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi CP=$ac_cv_path_CP if test -n "$CP"; then { echo "$as_me:$LINENO: result: $CP" >&5 echo "${ECHO_T}$CP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "ln", so it can be a program name with args. set dummy ln; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_LN+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $LN in [\\/]* | ?:[\\/]*) ac_cv_path_LN="$LN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi LN=$ac_cv_path_LN if test -n "$LN"; then { echo "$as_me:$LINENO: result: $LN" >&5 echo "${ECHO_T}$LN" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_MKDIR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MKDIR in [\\/]* | ?:[\\/]*) ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi MKDIR=$ac_cv_path_MKDIR if test -n "$MKDIR"; then { echo "$as_me:$LINENO: result: $MKDIR" >&5 echo "${ECHO_T}$MKDIR" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_RM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $RM in [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi RM=$ac_cv_path_RM if test -n "$RM"; then { echo "$as_me:$LINENO: result: $RM" >&5 echo "${ECHO_T}$RM" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi case "$uname" in Darwin* | *BSD*) ARFLAGS="-rcv" ;; *) ARFLAGS="crvs" ;; esac { echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6; } if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_inline=$ac_kw else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac if test "x$use_ansi" != xyes; then for ac_func in strdup do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi if test "x$use_vsnprintf" != xyes; then for ac_func in snprintf vsnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi { echo "$as_me:$LINENO: checking for long long int" >&5 echo $ECHO_N "checking for long long int... $ECHO_C" >&6; } if test "${ac_cv_c_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$GCC" = yes; then ac_cv_c_long_long=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { long long int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_long_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5 echo "${ECHO_T}$ac_cv_c_long_long" >&6; } if test $ac_cv_c_long_long = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LONG_LONG 1 _ACEOF fi # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then enableval=$enable_threads; fi have_pthread=no PTHREAD_FLAGS="" PTHREAD_LIBS="" if test "x$enable_threads" != xno; then ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f -r conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f -r conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "${ac_cv_header_pthread_h+set}" = set; then { echo "$as_me:$LINENO: checking for pthread.h" >&5 echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; } if test "${ac_cv_header_pthread_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking pthread.h usability" >&5 echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking pthread.h presence" >&5 echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for pthread.h" >&5 echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; } if test "${ac_cv_header_pthread_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_pthread_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; } fi if test $ac_cv_header_pthread_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_PTHREAD_H 1 _ACEOF fi if test x$ac_cv_header_pthread_h = xyes; then for flag in -lpthreads -lpthread -pthread; do { echo "$as_me:$LINENO: checking for pthread_create using $flag" >&5 echo $ECHO_N "checking for pthread_create using $flag... $ECHO_C" >&6; } SAVELIBS="$LIBS" LIBS="$flag $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { pthread_create(0, 0, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then have_pthread=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext { echo "$as_me:$LINENO: result: $have_pthread" >&5 echo "${ECHO_T}$have_pthread" >&6; } LIBS="$SAVELIBS" if test $have_pthread = yes; then PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT" PTHREAD_LIBS="$flag" # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to # be POSIX-compliant... :( if test $uname = SunOS; then PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" fi break fi done fi fi DSO="${DSO:=:}" DSOFLAGS="${DSOFLAGS:=}" # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then enableval=$enable_shared; fi if test x$enable_shared != xno; then { echo "$as_me:$LINENO: checking for shared library support" >&5 echo $ECHO_N "checking for shared library support... $ECHO_C" >&6; } PICFLAG=1 case "$uname" in SunOS* | UNIX_S*) { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)" LDFLAGS="$LDFLAGS -R\$(libdir)" ;; HP-UX*) { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } LIBMXML="libmxml.sl.1" DSO="ld" DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)" LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)" ;; IRIX) { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)" ;; OSF1* | Linux | GNU) { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)" LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)" ;; *BSD*) { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } LIBMXML="libmxml.so.1.5" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)" LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)" ;; Darwin*) { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } LIBMXML="libmxml.1.dylib" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -lc" ;; *) { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } { echo "$as_me:$LINENO: WARNING: shared libraries not supported on this platform." >&5 echo "$as_me: WARNING: shared libraries not supported on this platform." >&2;} PICFLAG=0 LIBMXML="libmxml.a" ;; esac else PICFLAG=0 LIBMXML="libmxml.a" fi if test -n "$GCC"; then CFLAGS="-Wall $CFLAGS" if test "x$OPTIM" = x; then OPTIM="-Os -g" fi if test "x$use_ansi" = xyes; then CFLAGS="-ansi -pedantic $CFLAGS" fi if test $PICFLAG = 1 -a $uname != AIX; then OPTIM="-fPIC $OPTIM" fi else case $uname in HP-UX*) CFLAGS="-Ae $CFLAGS" if test "x$OPTIM" = x; then OPTIM="-O" fi OPTIM="+DAportable $OPTIM" if test $PICFLAG = 1; then OPTIM="+z $OPTIM" fi ;; UNIX_SVR* | SunOS*) if test "x$OPTIM" = x; then OPTIM="-O" fi if test $PICFLAG = 1; then OPTIM="-KPIC $OPTIM" fi ;; *) if test "x$OPTIM" = x; then OPTIM="-O" fi ;; esac fi if test "$prefix" = "NONE"; then prefix="/usr/local" fi if test "$exec_prefix" = "NONE"; then exec_prefix="$prefix" fi if test "$docdir" = "NONE"; then docdir="$datadir/doc/mxml" fi if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then case "$uname" in *BSD* | Darwin* | Linux*) # BSD, Darwin (MacOS X), and Linux mandir="/usr/share/man" ;; IRIX*) # SGI IRIX mandir="/usr/share/catman/u_man" ;; *) # All others mandir="/usr/man" ;; esac fi if test "$includedir" != /usr/include; then PC_CFLAGS="-I$includedir" else PC_CFLAGS="" fi if test "$libdir" != /usr/lib; then PC_LIBS="-L$libdir -lmxml" else PC_LIBS="-lmxml" fi ac_config_files="$ac_config_files Makefile mxml.list mxml.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "mxml.list") CONFIG_FILES="$CONFIG_FILES mxml.list" ;; "mxml.pc") CONFIG_FILES="$CONFIG_FILES mxml.pc" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim VERSION!$VERSION$ac_delim LDFLAGS!$LDFLAGS$ac_delim OPTIM!$OPTIM$ac_delim ARCHFLAGS!$ARCHFLAGS$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim RANLIB!$RANLIB$ac_delim AR!$AR$ac_delim CP!$CP$ac_delim LN!$LN$ac_delim MKDIR!$MKDIR$ac_delim RM!$RM$ac_delim ARFLAGS!$ARFLAGS$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim PTHREAD_FLAGS!$PTHREAD_FLAGS$ac_delim PTHREAD_LIBS!$PTHREAD_LIBS$ac_delim DSO!$DSO$ac_delim DSOFLAGS!$DSOFLAGS$ac_delim LIBMXML!$LIBMXML$ac_delim PICFLAG!$PICFLAG$ac_delim PC_CFLAGS!$PC_CFLAGS$ac_delim PC_LIBS!$PC_LIBS$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi cmtk-3.0.0/Utilities/mxml/CMake/0000755000177700000170000000000012263615445015427 5ustar torstenmancmtk-3.0.0/Utilities/mxml/CMake/CheckCInline.cmake0000644000177700000170000000114611454674210020706 0ustar torstenman# This handy test is from Jack Kelly on the cmake email list. # http://www.cmake.org/Wiki/CMakeTestInline # Inspired from /usr/share/autoconf/autoconf/c.m4 FOREACH(KEYWORD "inline" "__inline__" "__inline") IF(NOT DEFINED C_INLINE) TRY_COMPILE(C_HAS_KEYWORD "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckCInline.c" COMPILE_DEFINITIONS "-Dinline=${KEYWORD}") IF(C_HAS_KEYWORD) SET(C_INLINE ${KEYWORD} CACHE STRING "C compiler keyword for inline functions") MARK_AS_ADVANCED(C_INLINE) ENDIF(C_HAS_KEYWORD) ENDIF(NOT DEFINED C_INLINE) ENDFOREACH(KEYWORD) cmtk-3.0.0/Utilities/mxml/CMake/CheckCInline.c0000644000177700000170000000030211210045173020027 0ustar torstenman/* Test source lifted from /usr/share/autoconf/autoconf/c.m4 */ typedef int foo_t; static inline foo_t static_foo(){return 0;} foo_t foo(){return 0;} int main(int argc, char *argv[]){return 0;} cmtk-3.0.0/Utilities/NrrdIO/0000755000177700000170000000000012263615445014627 5ustar torstenmancmtk-3.0.0/Utilities/NrrdIO/biffbiff.c0000644000177700000170000002421112041601331016507 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateBiff.h" /* ** Until Teem has its own printf implementation, this will have to do; ** it is imperfect because these are not functionally identical. */ #if defined(WIN32) || defined(_WIN32) # define snprintf _snprintf #endif static biffMsg ** _bmsg=NULL; /* master array of biffMsg pointers */ static unsigned int _bmsgNum=0; /* length of _biffErr == # keys maintained */ static airArray * _bmsgArr=NULL; /* air array of _biffErr and _biffNum */ #define __INCR 2 typedef union { biffMsg ***b; void **v; } _beu; /* ** _bmsgStart() ** ** allocates data structers needed by biff. Panics if ** anything goes wrong. ** ** NOTE: Can be harmlessly called multiple times. */ static void _bmsgStart(void) { static const char me[]="[biff] _bmsgStart"; _beu uu; if (_bmsgArr) { /* its non-NULL, must have been called already */ return; } uu.b = &_bmsg; _bmsgArr = airArrayNew(uu.v, &_bmsgNum, sizeof(biffMsg*), __INCR); if (!_bmsgArr) { fprintf(stderr, "%s: PANIC: couldn't allocate internal data\n", me); /* exit(1); */ } /* airArrayPointerCB(_bmsgArr, NULL, (airMopper)biffMsgNix);*/ return; } static void _bmsgFinish(void) { if (_bmsgArr) { /* setting _bmsgArr to NULL is needed to put biff back in initial state so that next calls to biff re-trigger _bmsgStart() */ _bmsgArr = airArrayNuke(_bmsgArr); } return; } /* ** _bmsgFind() ** ** returns the biffMsg (in _bmsg) of the entry with the given key, or ** NULL if it was not found */ static biffMsg * _bmsgFind(const char *key) { static const char me[]="[biff] _bmsgFind"; biffMsg *msg; unsigned int ii; if (!key) { fprintf(stderr, "%s: PANIC got NULL key", me); return NULL; /* exit(1); */ } msg = NULL; if (_bmsgNum) { for (ii=0; ii<_bmsgNum; ii++) { if (!strcmp(_bmsg[ii]->key, key)) { msg = _bmsg[ii]; break; } } } return msg; } /* ** assumes that msg really is in _bmsg[] */ static unsigned int _bmsgFindIdx(biffMsg *msg) { unsigned int ii; for (ii=0; ii<_bmsgNum; ii++) { if (msg == _bmsg[ii]) { break; } } return ii; } /* ** _bmsgAdd() ** ** if given key already has a biffMsg in _bmsg, returns that. ** otherise, adds a new biffMsg for given key to _bmsg, and returns it ** panics if there is a problem */ static biffMsg * _bmsgAdd(const char *key) { static const char me[]="[biff] _bmsgAdd"; unsigned int ii; biffMsg *msg; msg = NULL; /* find if key exists already */ for (ii=0; ii<_bmsgNum; ii++) { if (!strcmp(key, _bmsg[ii]->key)) { msg = _bmsg[ii]; break; } } if (!msg) { /* have to add new biffMsg */ ii = airArrayLenIncr(_bmsgArr, 1); if (!_bmsg) { fprintf(stderr, "%s: PANIC: couldn't accommodate one more key\n", me); return NULL; /* exit(1); */ } msg = _bmsg[ii] = biffMsgNew(key); } return msg; } /***********************************************************************/ /***********************************************************************/ /* ******** biffAdd() ** ** Adds string "err" at key "key", whether or not there are any ** existing messages there. Since biffSet() was killed ** Wed Apr 20 11:11:51 EDT 2005, this has become the main biff ** function. */ void biffAdd(const char *key, const char *err) { biffMsg *msg; _bmsgStart(); msg = _bmsgAdd(key); biffMsgAdd(msg, err); return; } static void _biffAddVL(const char *key, const char *errfmt, va_list args) { biffMsg *msg; _bmsgStart(); msg = _bmsgAdd(key); _biffMsgAddVL(msg, errfmt, args); return; } /* ******** biffAddf() ** ** Adds string "err" at key "key", whether or not there are any ** existing messages there. This version accepts a printf style ** format string as input. */ void biffAddf(const char *key, const char *errfmt, ...) { va_list args; va_start(args, errfmt); _biffAddVL(key, errfmt, args); va_end(args); return; } #if 0 /* ******** biffAddf_e ** ** calls (eventually) biffMsgAdd if msg is non-NULL, otherwise calls ** biffAdd if msg is NULL. */ void biffAddf_e(biffMsg *msg, const char *key, const char *errfmt, ...) { va_list args; va_start(args, errfmt); if (msg) { _biffMsgAddVL(msg, errfmt, args); } else { _biffAddVL(key, errfmt, args); } va_end(args); return; } #endif /* ******** biffMaybeAdd() ** ** wrapper around biffAdd() but doesn't actually do anything if !useBiff */ void biffMaybeAdd(const char *key, const char *err, int useBiff) { if (useBiff) { biffAdd(key, err); } return; } void biffMaybeAddf(int useBiff, const char *key, const char *errfmt, ...) { va_list args; va_start(args, errfmt); if (useBiff) { _biffAddVL(key, errfmt, args); } va_end(args); return; } /* ******** biffGet() ** ** creates a string which records all the errors at given key and ** returns it. Returns NULL in case of error. This function should ** be considered a glorified strdup(): it is the callers responsibility ** to free() this string later */ char * /*Teem: allocates char* */ /* this comment is an experiment */ biffGet(const char *key) { static const char me[]="biffGet"; char *ret; biffMsg *msg; _bmsgStart(); msg = _bmsgFind(key); if (!msg) { static const char err[]="[%s] No information for this key!"; size_t errlen; fprintf(stderr, "%s: WARNING: no information for key \"%s\"\n", me, key); errlen = strlen(err)+strlen(key)+1; ret = AIR_CALLOC(errlen, char); if (!ret) { fprintf(stderr, "%s: PANIC: unable to allocate buffer\n", me); return NULL; /* exit(1); */ } snprintf(ret, errlen, err, key); return ret; } ret = AIR_CALLOC(biffMsgStrlen(msg)+1, char); if (!ret) { fprintf(stderr, "%s: PANIC: unable to allocate buffer\n", me); return NULL; /* exit(1); */ } biffMsgStrSet(ret, msg); return ret; } /* ******** biffGetStrlen() ** ** for when you want to allocate the buffer for the biff string, this is ** how you learn its length */ unsigned int biffGetStrlen(const char *key) { static const char me[]="biffGetStrlen"; biffMsg *msg; unsigned int len; _bmsgStart(); msg = _bmsgFind(key); if (!msg) { fprintf(stderr, "%s: WARNING: no information for key \"%s\"\n", me, key); return 0; } len = biffMsgStrlen(msg); len += 1; /* GLK forgets if the convention is that the caller allocates for one more to include '\0'; this is safer */ return len; } /* ******** biffSetStr() ** ** for when you want to allocate the buffer for the biff string, this is ** how you get the error message itself */ void biffSetStr(char *str, const char *key) { static const char me[]="biffSetStr"; biffMsg *msg; if (!str) { fprintf(stderr, "%s: ERROR: got NULL buffer for \"%s\"\n", me, key); return; } _bmsgStart(); msg = _bmsgFind(key); if (!msg) { fprintf(stderr, "%s: WARNING: no information for key \"%s\"\n", me, key); return; } biffMsgStrSet(str, msg); return; } /* ******** biffCheck() ** ** sees how many messages there are for a given key; ** Note that this is just a simple wrapper around biffMsgErrNum */ unsigned int biffCheck(const char *key) { _bmsgStart(); return biffMsgErrNum(_bmsgFind(key)); } /* ******** biffDone() ** ** frees everything associated with given key, and shrinks list of keys, ** and calls _bmsgFinish() if there are no keys left */ void biffDone(const char *key) { static const char me[]="biffDone"; unsigned int idx; biffMsg *msg; _bmsgStart(); msg = _bmsgFind(key); if (!msg) { fprintf(stderr, "%s: WARNING: no information for key \"%s\"\n", me, key); return; } idx = _bmsgFindIdx(msg); biffMsgNix(msg); if (_bmsgNum > 1) { /* if we have more than one key in action, move the last biffMsg to the position that was just cleared up */ _bmsg[idx] = _bmsg[_bmsgNum-1]; } airArrayLenIncr(_bmsgArr, -1); /* if that was the last key, close shop */ if (!_bmsgArr->len) { _bmsgFinish(); } return; } void biffMove(const char *destKey, const char *err, const char *srcKey) { static const char me[]="biffMove"; biffMsg *dest, *src; _bmsgStart(); dest = _bmsgAdd(destKey); src = _bmsgFind(srcKey); if (!src) { fprintf(stderr, "%s: WARNING: key \"%s\" unknown\n", me, srcKey); return; } biffMsgMove(dest, src, err); return; } static void _biffMoveVL(const char *destKey, const char *srcKey, const char *errfmt, va_list args) { static const char me[]="biffMovev"; biffMsg *dest, *src; _bmsgStart(); dest = _bmsgAdd(destKey); src = _bmsgFind(srcKey); if (!src) { fprintf(stderr, "%s: WARNING: key \"%s\" unknown\n", me, srcKey); return; } _biffMsgMoveVL(dest, src, errfmt, args); return; } void biffMovef(const char *destKey, const char *srcKey, const char *errfmt, ...) { va_list args; va_start(args, errfmt); _biffMoveVL(destKey, srcKey, errfmt, args); va_end(args); return; } char * biffGetDone(const char *key) { char *ret; _bmsgStart(); ret = biffGet(key); biffDone(key); /* will call _bmsgFinish if this is the last key */ return ret; } /* this is the end */ cmtk-3.0.0/Utilities/NrrdIO/encodingBzip2.c0000644000177700000170000000461512041601331017455 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" int _nrrdEncodingBzip2_available(void) { return AIR_FALSE; } int _nrrdEncodingBzip2_read(FILE *file, void *data, size_t elementNum, Nrrd *nrrd, struct NrrdIoState_t *nio) { char me[]="_nrrdEncodingBzip2_read", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(data); AIR_UNUSED(elementNum); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s encoding not available in NrrdIO", me, nrrdEncodingBzip2->name); biffAdd(NRRD, err); return 1; } int _nrrdEncodingBzip2_write(FILE *file, const void *data, size_t elementNum, const Nrrd *nrrd, struct NrrdIoState_t *nio) { char me[]="_nrrdEncodingBzip2_write", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(data); AIR_UNUSED(elementNum); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s encoding not available in NrrdIO", me, nrrdEncodingBzip2->name); biffAdd(NRRD, err); return 1; } const NrrdEncoding _nrrdEncodingBzip2 = { "bzip2", /* name */ "raw.bz2", /* suffix */ AIR_TRUE, /* endianMatters */ AIR_TRUE, /* isCompression */ _nrrdEncodingBzip2_available, _nrrdEncodingBzip2_read, _nrrdEncodingBzip2_write }; const NrrdEncoding *const nrrdEncodingBzip2 = &_nrrdEncodingBzip2; cmtk-3.0.0/Utilities/NrrdIO/formatPNG.c0000644000177700000170000000542512041601331016615 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" int _nrrdFormatPNG_available(void) { return AIR_FALSE; } int _nrrdFormatPNG_nameLooksLike(const char *filename) { return airEndsWith(filename, NRRD_EXT_PNG); } int _nrrdFormatPNG_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatPNG_fitsInto", err[AIR_STRLEN_MED]; AIR_UNUSED(nrrd); AIR_UNUSED(encoding); AIR_UNUSED(useBiff); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatPNG->name); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; } int _nrrdFormatPNG_contentStartsLike(NrrdIoState *nio) { AIR_UNUSED(nio); return AIR_FALSE; } int _nrrdFormatPNG_read(FILE *file, Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdReadPNG", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatPNG->name); biffAdd(NRRD, err); return 1; } int _nrrdFormatPNG_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdFormatPNG_write", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatPNG->name); biffAdd(NRRD, err); return 1; } const NrrdFormat _nrrdFormatPNG = { "PNG", AIR_FALSE, /* isImage */ AIR_FALSE, /* readable */ AIR_FALSE, /* usesDIO */ _nrrdFormatPNG_available, _nrrdFormatPNG_nameLooksLike, _nrrdFormatPNG_fitsInto, _nrrdFormatPNG_contentStartsLike, _nrrdFormatPNG_read, _nrrdFormatPNG_write }; const NrrdFormat *const nrrdFormatPNG = &_nrrdFormatPNG; cmtk-3.0.0/Utilities/NrrdIO/teemDio.h0000644000177700000170000000265312041601331016353 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* ** the end result of this is that the source file which includes ** this can be sure that TEEM_DIO is set, and can be sure that ** it is set to either 0 or 1 */ #ifndef TEEM_DIO # error TEEM_DIO not defined #elif TEEM_DIO == 1 # /* okay, its 1 */ #elif TEEM_DIO == 0 # /* okay, its 0 */ #else # error TEEM_DIO not set to 1 or 0 #endif cmtk-3.0.0/Utilities/NrrdIO/mop.c0000644000177700000170000001720512041601331015552 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" /* learned: using these functions correctly to manage even simple memory usage can be very tricky. problem 0: even trying to write airMopPrint, I foolishly thought: "print the string, then free it". But the print callback clobbered the free callback, because of the semantics of airMopAdd(). So, I had to add _airMopAdd(). problem 1: debugging hest with purify, on case of hitting error after parsing multiple variable parameter option of strings: so, I allocated an array of strings (arrays), and registered all the strings with airMopMem(), and registered the array itself also with airMopMem(). Again, got clobbered. airSetNull(&((*vP)[0])) clobbered airFree(*vP). So, I gave up on using airMopMem() for the individual elements, and am using simply airMopAdd(airFree). The alternative was to change the airMopAdd()s in airMopMem() to _airMopAdd()s, but I didn't feel confident that this would be safe. ----------- SO: as a result of all that: airMopAdd() will no longer over-write a callback based on the pointer It will only over-write the "when" of a (pointer,callback) pair, so that you can't register multiple copies of a (pointer,callback) pair (regardless of differences, if any, in "when"). Therefore, there will be AT MOST ONE instance of a (pointer,callback) pair in a mop. _airMopAdd() was nixed. airMopSub() and airMopUnMem were created */ #define AIR_MOP_INCR 10 airArray * airMopNew() { return airArrayNew(NULL, NULL, sizeof(airMop), AIR_MOP_INCR); } /* ** except for allocation error, this always returns 0, ** to facilitate this weird idiom: ** ** if (!(nmeasr = nrrdNew()) ** || airMopAdd(mop, nmeasr, (airMopper)nrrdNuke, airMopAlways) ** || !(nsize = nrrdNew()) ** || airMopAdd(mop, nsize, (airMopper)nrrdNuke, airMopAlways) ** || !(pair = AIR_CAST(ccpair *, calloc(pctx->CCNum, sizeof(ccpair)))) ** || airMopAdd(mop, pair, airFree, airMopAlways)) { ** ** GLK may regret this. */ int airMopAdd(airArray *arr, void *ptr, airMopper mop, int when) { static const char me[]="airMopAdd"; airMop *mops; unsigned int ii; if (!arr) { return 0; } mops = (airMop *)arr->data; /* first see if this is something we already set a callback for */ for (ii=0; iilen; ii++) { if (mops[ii].ptr == ptr && mops[ii].mop == mop) { mops[ii].when = when; /* we're done */ return 0; } } /* this is a new ptr */ ii = airArrayLenIncr(arr, 1); if (!arr->data) { fprintf(stderr, "%s: PANIC: can't re-allocate mop array\n", me); return 1; } mops = (airMop *)arr->data; mops[ii].ptr = ptr; mops[ii].mop = mop; mops[ii].when = when; return 0; } void airMopSub(airArray *arr, void *ptr, airMopper mop) { airMop *mops; unsigned int ii; if (!arr) { return; } mops = (airMop *)arr->data; /* first see if this is something we already set a callback for */ for (ii=0; iilen; ii++) { if (mops[ii].ptr == ptr && mops[ii].mop == mop) { mops[ii].ptr = NULL; mops[ii].mop = NULL; mops[ii].when = airMopNever; return; } } /* else we've never seen this before, user is a moron */ return; } void airMopMem(airArray *arr, void *_ptrP, int when) { void **ptrP; if (!(arr && _ptrP)) { return; } ptrP = (void **)_ptrP; airMopAdd(arr, ptrP, (airMopper)airSetNull, when); airMopAdd(arr, *ptrP, airFree, when); /* printf("airMopMem(0x%p): will free() 0x%p\n", (void*)arr, (void*)(*ptrP)); printf("airMopMem(0x%p): will set 0x%p to NULL\n", (void*)arr, (void*)ptrP); */ return; } void airMopUnMem(airArray *arr, void *_ptrP) { void **ptrP; if (!(arr && _ptrP)) { return; } ptrP = (void **)_ptrP; airMopSub(arr, ptrP, (airMopper)airSetNull); airMopSub(arr, *ptrP, airFree); return; } static void * _airMopPrint(void *_str) { char *str; str = (char *)_str; if (str) { printf("%s\n", str); } return NULL; } void airMopPrint(airArray *arr, const void *_str, int when) { char *copy; if (!(arr && _str)) return; copy = airStrdup(AIR_CAST(const char*, _str)); airMopAdd(arr, copy, airFree, airMopAlways); airMopAdd(arr, copy, _airMopPrint, when); return; } static const char _airMopWhenStr[4][128] = { " never", " error", " okay", "always", }; /* ** This is to overcome the warning about ** "ISO C forbids conversion of function pointer to object pointer type"; ** the result here is thus implementation-dependent */ typedef union { airMopper m; void *v; } mvunion; void airMopDebug(airArray *arr) { airMop *mops; unsigned int ii; mvunion mvu; if (!arr) return; mops = (airMop *)arr->data; printf("airMopDebug: _________________________ mop stack for 0x%p:\n", AIR_VOIDP(arr)); if (arr->len) { ii = arr->len; do { ii--; printf("%4u: ", ii); if (NULL == mops[ii].mop && NULL == mops[ii].ptr && airMopNever == mops[ii].when) { printf("no-op\n"); continue; } /* else */ printf("%s: ", _airMopWhenStr[mops[ii].when]); if (airFree == mops[ii].mop) { printf("airFree(0x%p)\n", AIR_VOIDP(mops[ii].ptr)); continue; } if ((airMopper)airSetNull == mops[ii].mop) { printf("airSetNull(0x%p)\n", AIR_VOIDP(mops[ii].ptr)); continue; } if (_airMopPrint == mops[ii].mop) { printf("_airMopPrint(\"%s\" == 0x%p)\n", AIR_CAST(char*, mops[ii].ptr), AIR_VOIDP(mops[ii].ptr)); continue; } if ((airMopper)airFclose == mops[ii].mop) { printf("airFclose(0x%p)\n", AIR_VOIDP(mops[ii].ptr)); continue; } /* else */ mvu.m = mops[ii].mop; printf("0x%p(0x%p)\n", AIR_VOIDP(mvu.v), AIR_VOIDP(mops[ii].ptr)); } while (ii); } printf("airMopDebug: ^^^^^^^^^^^^^^^^^^^^^^^^^\n"); } void airMopDone(airArray *arr, int error) { airMop *mops; unsigned int ii; /* printf("airMopDone(%p): hello, %s\n", (void*)arr, error ? "error" : "okay"); */ if (arr) { mops = (airMop *)arr->data; if (arr->len) { ii = arr->len; do { ii--; if (mops[ii].ptr && (airMopAlways == mops[ii].when || (airMopOnError == mops[ii].when && error) || (airMopOnOkay == mops[ii].when && !error))) { mops[ii].mop(mops[ii].ptr); } } while (ii); } airArrayNuke(arr); /* printf("airMopDone(%p): done!\n", (void*)arr); */ } return; } void airMopError(airArray *arr) { airMopDone(arr, AIR_TRUE); } void airMopOkay(airArray *arr) { airMopDone(arr, AIR_FALSE); } cmtk-3.0.0/Utilities/NrrdIO/encodingHex.c0000644000177700000170000001150112041601331017203 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" static const int _nrrdWriteHexTable[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; /* ** -2: not allowed, error ** -1: whitespace ** [0,15]: values */ static const int _nrrdReadHexTable[128] = { /* 0 1 2 3 4 5 6 7 8 9 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, /* 0 */ -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, /* 10 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 20 */ -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, /* 30 */ -2, -2, -2, -2, -2, -2, -2, -2, 0, 1, /* 40 */ 2, 3, 4, 5, 6, 7, 8, 9, -2, -2, /* 50 */ -2, -2, -2, -2, -2, 10, 11, 12, 13, 14, /* 60 */ 15, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 70 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 80 */ -2, -2, -2, -2, -2, -2, -2, 10, 11, 12, /* 90 */ 13, 14, 15, -2, -2, -2, -2, -2, -2, -2, /* 100 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 110 */ -2, -2, -2, -2, -2, -2, -2, -2 /* 120 */ }; static int _nrrdEncodingHex_available(void) { return AIR_TRUE; } static int _nrrdEncodingHex_read(FILE *file, void *_data, size_t elNum, Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdEncodingHex_read"; size_t nibIdx, nibNum; unsigned char *data; int car=0, nib; AIR_UNUSED(nio); data = AIR_CAST(unsigned char *, _data); nibIdx = 0; nibNum = 2*elNum*nrrdElementSize(nrrd); if (nibNum/elNum != 2*nrrdElementSize(nrrd)) { biffAddf(NRRD, "%s: size_t can't hold 2*(#bytes in array)\n", me); return 1; } while (nibIdx < nibNum) { unsigned char nibshift; car = fgetc(file); if (EOF == car) break; nib = _nrrdReadHexTable[car & 127]; if (-2 == nib) { /* not a valid hex character */ break; } if (-1 == nib) { /* its white space */ continue; } /* else it is a valid character, representing a value from 0 to 15 */ nibshift = AIR_CAST(unsigned char, nib << (4*(1-(nibIdx & 1)))); /* HEY not sure why the cast is needed with gcc v4.8 -Wconversion */ *data = AIR_CAST(unsigned char, *data + nibshift); data += nibIdx & 1; nibIdx++; } if (nibIdx != nibNum) { char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL]; if (EOF == car) { biffAddf(NRRD, "%s: hit EOF getting byte %s of %s", me, airSprintSize_t(stmp1, nibIdx/2), airSprintSize_t(stmp2, nibNum/2)); } else { biffAddf(NRRD, "%s: hit invalid character ('%c') getting " "byte %s of %s", me, car, airSprintSize_t(stmp1, nibIdx/2), airSprintSize_t(stmp2, nibNum/2)); } return 1; } return 0; } static int _nrrdEncodingHex_write(FILE *file, const void *_data, size_t elNum, const Nrrd *nrrd, NrrdIoState *nio) { /* static const char me[]="_nrrdEncodingHex_write"; */ const unsigned char *data; size_t byteIdx, byteNum; unsigned int bytesPerLine; bytesPerLine = AIR_MAX(1, nio->charsPerLine/2); data = AIR_CAST(const unsigned char*, _data); byteNum = elNum*nrrdElementSize(nrrd); for (byteIdx=0; byteIdx>4], _nrrdWriteHexTable[(*data)&15]); if (bytesPerLine-1 == byteIdx % bytesPerLine) { fprintf(file, "\n"); } data++; } /* just to be sure, we always end with a carraige return */ fprintf(file, "\n"); return 0; } const NrrdEncoding _nrrdEncodingHex = { "hex", /* name */ "hex", /* suffix */ AIR_TRUE, /* endianMatters */ AIR_FALSE, /* isCompression */ _nrrdEncodingHex_available, _nrrdEncodingHex_read, _nrrdEncodingHex_write }; const NrrdEncoding *const nrrdEncodingHex = &_nrrdEncodingHex; cmtk-3.0.0/Utilities/NrrdIO/write.c0000644000177700000170000010142112041601331016103 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* #include #include */ int nrrdIoStateSet(NrrdIoState *nio, int parm, int value) { static const char me[]="nrrdIoStateSet"; if (!nio) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!( AIR_IN_OP(nrrdIoStateUnknown, parm, nrrdIoStateLast) )) { biffAddf(NRRD, "%s: identifier %d not in valid range [%d,%d]", me, parm, nrrdIoStateUnknown+1, nrrdIoStateLast-1); return 1; } switch (parm) { case nrrdIoStateDetachedHeader: nio->detachedHeader = !!value; break; case nrrdIoStateBareText: nio->bareText = !!value; break; case nrrdIoStateCharsPerLine: if (value < 40) { biffAddf(NRRD, "%s: %d charsPerLine is awfully small", me, value); return 1; } /* cast won't lose info because "value" must be positive */ nio->charsPerLine = AIR_CAST(unsigned int, value); break; case nrrdIoStateValsPerLine: if (value < 4) { biffAddf(NRRD, "%s: %d valsPerLine is awfully small", me, value); return 1; } /* cast won't lose info because "value" must be positive */ nio->valsPerLine = AIR_CAST(unsigned int, value); break; case nrrdIoStateSkipData: nio->skipData = !!value; break; case nrrdIoStateKeepNrrdDataFileOpen: nio->keepNrrdDataFileOpen = !!value; break; case nrrdIoStateZlibLevel: if (!( AIR_IN_CL(-1, value, 9) )) { biffAddf(NRRD, "%s: zlibLevel %d invalid", me, value); return 1; } nio->zlibLevel = value; break; case nrrdIoStateZlibStrategy: if (!( AIR_IN_OP(nrrdZlibStrategyUnknown, value, nrrdZlibStrategyLast) )) { biffAddf(NRRD, "%s: zlibStrategy %d invalid", me, value); return 1; } nio->zlibStrategy = value; break; case nrrdIoStateBzip2BlockSize: if (!( AIR_IN_CL(-1, value, 9) )) { biffAddf(NRRD, "%s: bzip2BlockSize %d invalid", me, value); return 1; } nio->bzip2BlockSize = value; break; default: fprintf(stderr, "!%s: PANIC: didn't recognize parm %d\n", me, parm); return 1; } return 0; } int nrrdIoStateEncodingSet(NrrdIoState *nio, const NrrdEncoding *encoding) { static const char me[]="nrrdIoStateEncodingSet"; if (!( nio && encoding )) { if (nio) { nio->encoding = nrrdEncodingUnknown; } biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!encoding->available()) { nio->encoding = nrrdEncodingUnknown; biffAddf(NRRD, "%s: %s encoding isn't actually available", me, encoding->name); return 1; } nio->encoding = encoding; return 0; } int nrrdIoStateFormatSet(NrrdIoState *nio, const NrrdFormat *format) { static const char me[]="nrrdIoStateFormatSet"; if (!( nio && format )) { if (nio) { nio->format = nrrdFormatUnknown; } biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!format->available()) { nio->format = nrrdFormatUnknown; biffAddf(NRRD, "%s: %s format isn't actually available", me, format->name); return 1; } nio->format = format; return 0; } /* ** no biff */ int nrrdIoStateGet(NrrdIoState *nio, int parm) { static const char me[]="nrrdIoStateGet"; int value; if (!nio) { /* got NULL pointer */ return -1; } if (!( AIR_IN_OP(nrrdIoStateUnknown, parm, nrrdIoStateLast) )) { /* got bogus parameter identifier */ return -1; } switch (parm) { case nrrdIoStateDetachedHeader: value = !!nio->detachedHeader; break; case nrrdIoStateBareText: value = !!nio->bareText; break; case nrrdIoStateCharsPerLine: /* HEY: this cast is a bad because nio->charsPerLine is unsigned */ value = AIR_CAST(int, nio->charsPerLine); break; case nrrdIoStateValsPerLine: /* HEY: this cast is a bad because nio->valsPerLine is unsigned */ value = AIR_CAST(int, nio->valsPerLine); break; case nrrdIoStateSkipData: value = !!nio->skipData; break; case nrrdIoStateKeepNrrdDataFileOpen: value = !!nio->keepNrrdDataFileOpen; break; case nrrdIoStateZlibLevel: value = nio->zlibLevel; break; case nrrdIoStateZlibStrategy: value = nio->zlibStrategy; break; case nrrdIoStateBzip2BlockSize: value = nio->bzip2BlockSize; break; default: fprintf(stderr, "!%s: PANIC: didn't recognize parm %d\n", me, parm); return -1; } return value; } /* ** no biff */ const NrrdEncoding * nrrdIoStateEncodingGet(NrrdIoState *nio) { return nio ? nio->encoding : nrrdEncodingUnknown; } /* ** no biff */ const NrrdFormat * nrrdIoStateFormatGet(NrrdIoState *nio) { return nio ? nio->format : nrrdFormatUnknown; } void _nrrdStrcatSpaceVector(char *str, unsigned int spaceDim, const double val[NRRD_SPACE_DIM_MAX]) { char buff[AIR_STRLEN_MED]; /* bad Gordon */ unsigned int dd; if (AIR_EXISTS(val[0])) { strcat(str, "("); for (dd=0; dddim, NRRD_DIM_MAX) && nio && nio->encoding && AIR_IN_OP(nrrdField_unknown, field, nrrdField_last) )) { return 0; } ret = 0; switch (field) { case nrrdField_comment: /* comments and key/value pairs are always handled differently (by being printed explicity), so they are never "interesting" */ break; case nrrdField_content: ret = !!(airStrlen(nrrd->content)); break; case nrrdField_number: /* "number" is entirely redundant with "sizes", which is a required field. Absolutely nothing is lost in eliding "number" from the header, so "number" is NEVER interesting. Should this judgement later be found in error, this is the one place where the policy change can be implemented */ break; case nrrdField_type: /* this is vital */ ret = 1; break; case nrrdField_block_size: ret = (nrrdTypeBlock == nrrd->type); break; case nrrdField_dimension: /* this is vital */ ret = 1; break; case nrrdField_space: /* its interesting if its known */ ret = (nrrdSpaceUnknown != nrrd->space); break; case nrrdField_space_dimension: /* its interesting if its non-zero and if space is not known */ ret = (nrrd->spaceDim > 0 && nrrdSpaceUnknown == nrrd->space); break; case nrrdField_sizes: /* this is vital */ ret = 1; break; case nrrdField_spacings: for (ai=0; aidim; ai++) { ret |= AIR_EXISTS(nrrd->axis[ai].spacing); } break; case nrrdField_thicknesses: for (ai=0; aidim; ai++) { ret |= AIR_EXISTS(nrrd->axis[ai].thickness); } break; case nrrdField_axis_mins: for (ai=0; aidim; ai++) { ret |= AIR_EXISTS(nrrd->axis[ai].min); } break; case nrrdField_axis_maxs: for (ai=0; aidim; ai++) { ret |= AIR_EXISTS(nrrd->axis[ai].max); } break; case nrrdField_space_directions: ret = nrrd->spaceDim > 0; break; case nrrdField_centers: for (ai=0; aidim; ai++) { ret |= (nrrdCenterUnknown != nrrd->axis[ai].center); } break; case nrrdField_kinds: for (ai=0; aidim; ai++) { ret |= (nrrdKindUnknown != nrrd->axis[ai].kind); } break; case nrrdField_labels: for (ai=0; aidim; ai++) { ret |= !!(airStrlen(nrrd->axis[ai].label)); } break; case nrrdField_units: for (ai=0; aidim; ai++) { ret |= !!(airStrlen(nrrd->axis[ai].units)); } break; case nrrdField_min: case nrrdField_max: /* these no longer exist in the Nrrd struct; we never write them */ ret = AIR_FALSE; break; case nrrdField_old_min: ret = AIR_EXISTS(nrrd->oldMin); break; case nrrdField_old_max: ret = AIR_EXISTS(nrrd->oldMax); break; case nrrdField_endian: ret = nio->encoding->endianMatters && 1 < nrrdElementSize(nrrd); break; case nrrdField_encoding: /* this is vital */ ret = 1; break; case nrrdField_line_skip: ret = nio->lineSkip > 0; break; case nrrdField_byte_skip: ret = nio->byteSkip != 0; break; case nrrdField_keyvalue: /* comments and key/value pairs are always handled differently (by being printed explicity), so they are never "interesting" */ break; case nrrdField_sample_units: ret = !!airStrlen(nrrd->sampleUnits); break; case nrrdField_space_units: for (ai=0; aispaceDim; ai++) { ret |= !!(airStrlen(nrrd->spaceUnits[ai])); } break; case nrrdField_space_origin: /* we're trusting other validity checks to ensure that all the coeffs exist or not, together */ ret = (nrrd->spaceDim > 0 && AIR_EXISTS(nrrd->spaceOrigin[0])); break; case nrrdField_measurement_frame: /* we're trusting other validity checks to ensure that all the coeffs exist or not, together */ ret = (nrrd->spaceDim > 0 && AIR_EXISTS(nrrd->measurementFrame[0][0])); break; case nrrdField_data_file: /* detached header was either requested or is required */ ret = (nio->detachedHeader || nio->dataFNFormat || nio->dataFNArr->len > 1); break; } return ret; } /* ** _nrrdSprintFieldInfo ** ** this prints ": " into *strP (after allocating it for ** big enough, usually with a stupidly big margin of error), in a form ** suitable to be written to NRRD or other image headers. This will always ** print something (for valid inputs), even stupid s like ** "(unknown endian)". It is up to the caller to decide which fields ** are worth writing, via _nrrdFieldInteresting(). ** ** NOTE: some of these fields make sense in non-NRRD files (e.g. all ** the per-axis information), but many only make sense in NRRD files. ** This is just one example of NRRD-format-specific stuff that is not ** in formatNRRD.c */ void _nrrdSprintFieldInfo(char **strP, const char *prefix, const Nrrd *nrrd, NrrdIoState *nio, int field) { static const char me[]="_nrrdSprintFieldInfo"; char buff[AIR_STRLEN_MED], *fnb, stmp[AIR_STRLEN_SMALL], *strtmp=NULL; double colvec[NRRD_SPACE_DIM_MAX]; const char *fs; unsigned int ii, dd, uintStrlen = 11, size_tStrlen = 33, doubleStrlen = 513; size_t fslen, fdlen, maxl; int endi; if (!( strP && prefix && nrrd && AIR_IN_CL(1, nrrd->dim, NRRD_DIM_MAX) && AIR_IN_OP(nrrdField_unknown, field, nrrdField_last) )) { return; } if (!_nrrdFieldInteresting(nrrd, nio, field)) { *strP = airStrdup(""); } fs = airEnumStr(nrrdField, field); fslen = strlen(prefix) + strlen(fs) + strlen(": ") + 1; switch (field) { case nrrdField_comment: case nrrdField_keyvalue: fprintf(stderr, "%s: CONFUSION: why are you calling me on \"%s\"?\n", me, airEnumStr(nrrdField, nrrdField_comment)); *strP = airStrdup(""); break; case nrrdField_content: strtmp = airOneLinify(airStrdup(nrrd->content)); *strP = AIR_CALLOC(fslen + strlen(strtmp), char); sprintf(*strP, "%s%s: %s", prefix, fs, strtmp); airFree(strtmp); strtmp = NULL; break; case nrrdField_number: *strP = AIR_CALLOC(fslen + size_tStrlen, char); sprintf(*strP, "%s%s: %s", prefix, fs, airSprintSize_t(stmp, nrrdElementNumber(nrrd))); break; case nrrdField_type: *strP = AIR_CALLOC(fslen + strlen(airEnumStr(nrrdType, nrrd->type)), char); sprintf(*strP, "%s%s: %s", prefix, fs, airEnumStr(nrrdType, nrrd->type)); break; case nrrdField_block_size: *strP = AIR_CALLOC(fslen + size_tStrlen, char); sprintf(*strP, "%s%s: %s", prefix, fs, airSprintSize_t(stmp, nrrd->blockSize)); break; case nrrdField_dimension: *strP = AIR_CALLOC(fslen + uintStrlen, char); sprintf(*strP, "%s%s: %d", prefix, fs, nrrd->dim); break; case nrrdField_space: *strP = AIR_CALLOC(fslen + strlen(airEnumStr(nrrdSpace, nrrd->space)), char); sprintf(*strP, "%s%s: %s", prefix, fs, airEnumStr(nrrdSpace, nrrd->space)); break; case nrrdField_space_dimension: *strP = AIR_CALLOC(fslen + uintStrlen, char); sprintf(*strP, "%s%s: %d", prefix, fs, nrrd->spaceDim); break; /* ---- begin per-axis fields ---- */ case nrrdField_sizes: *strP = AIR_CALLOC(fslen + nrrd->dim*(size_tStrlen + 1), char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { sprintf(buff, " %s", airSprintSize_t(stmp, nrrd->axis[ii].size)); strcat(*strP, buff); } break; case nrrdField_spacings: *strP = AIR_CALLOC(fslen + nrrd->dim*(doubleStrlen + 1), char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { airSinglePrintf(NULL, buff, " %.17g", nrrd->axis[ii].spacing); strcat(*strP, buff); } break; case nrrdField_thicknesses: *strP = AIR_CALLOC(fslen + nrrd->dim*(doubleStrlen + 1), char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { airSinglePrintf(NULL, buff, " %.17g", nrrd->axis[ii].thickness); strcat(*strP, buff); } break; case nrrdField_axis_mins: *strP = AIR_CALLOC(fslen + nrrd->dim*(doubleStrlen + 1), char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { airSinglePrintf(NULL, buff, " %.17g", nrrd->axis[ii].min); strcat(*strP, buff); } break; case nrrdField_axis_maxs: *strP = AIR_CALLOC(fslen + nrrd->dim*(doubleStrlen + 1), char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { airSinglePrintf(NULL, buff, " %.17g", nrrd->axis[ii].max); strcat(*strP, buff); } break; case nrrdField_space_directions: *strP = AIR_CALLOC(fslen + nrrd->dim*nrrd->spaceDim*(doubleStrlen + strlen("(,) ")), char); sprintf(*strP, "%s%s: ", prefix, fs); for (ii=0; iidim; ii++) { _nrrdStrcatSpaceVector(*strP, nrrd->spaceDim, nrrd->axis[ii].spaceDirection); if (ii < nrrd->dim-1) { strcat(*strP, " "); } } break; case nrrdField_centers: fdlen = 0; for (ii=0; iidim; ii++) { fdlen += 1 + airStrlen(nrrd->axis[ii].center ? airEnumStr(nrrdCenter, nrrd->axis[ii].center) : NRRD_UNKNOWN); } *strP = AIR_CALLOC(fslen + fdlen, char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { sprintf(buff, " %s", (nrrd->axis[ii].center ? airEnumStr(nrrdCenter, nrrd->axis[ii].center) : NRRD_UNKNOWN)); strcat(*strP, buff); } break; case nrrdField_kinds: fdlen = 0; for (ii=0; iidim; ii++) { fdlen += 1 + airStrlen(nrrd->axis[ii].kind ? airEnumStr(nrrdKind, nrrd->axis[ii].kind) : NRRD_UNKNOWN); } *strP = AIR_CALLOC(fslen + fdlen, char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { sprintf(buff, " %s", (nrrd->axis[ii].kind ? airEnumStr(nrrdKind, nrrd->axis[ii].kind) : NRRD_UNKNOWN)); strcat(*strP, buff); } break; case nrrdField_labels: case nrrdField_units: #define LABEL_OR_UNITS (nrrdField_labels == field \ ? nrrd->axis[ii].label \ : nrrd->axis[ii].units) fdlen = 0; for (ii=0; iidim; ii++) { /* The "2*" is because at worst every character needs escaping. The "+ 3" for the |" "| between each part */ fdlen += 2*airStrlen(LABEL_OR_UNITS) + 3; } fdlen += 1; /* for '\0' */ *strP = AIR_CALLOC(fslen + fdlen, char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iidim; ii++) { strcat(*strP, " \""); if (airStrlen(nrrd->axis[ii].label)) { _nrrdWriteEscaped(NULL, *strP, LABEL_OR_UNITS, "\"", _NRRD_WHITESPACE_NOTAB); } strcat(*strP, "\""); } #undef LABEL_OR_UNITS break; /* ---- end per-axis fields ---- */ case nrrdField_min: case nrrdField_max: /* we're basically a no-op, now that these fields became meaningless */ *strP = AIR_CALLOC(fslen + doubleStrlen, char); sprintf(*strP, "%s%s: 0.0", prefix, fs); strcat(*strP, buff); break; case nrrdField_old_min: *strP = AIR_CALLOC(fslen + doubleStrlen, char); sprintf(*strP, "%s%s: ", prefix, fs); airSinglePrintf(NULL, buff, "%.17g", nrrd->oldMin); strcat(*strP, buff); break; case nrrdField_old_max: *strP = AIR_CALLOC(fslen + doubleStrlen, char); sprintf(*strP, "%s%s: ", prefix, fs); airSinglePrintf(NULL, buff, "%.17g", nrrd->oldMax); strcat(*strP, buff); break; case nrrdField_endian: if (airEndianUnknown != nio->endian) { /* we know a specific endianness because either it was recorded as part of "unu make -h", or it was set (and data was possibly altered) as part of "unu save" */ endi = nio->endian; } else { /* we record our current architecture's endian because we're going to writing out data */ endi = airMyEndian(); } *strP = AIR_CALLOC(fslen + strlen(airEnumStr(airEndian, endi)), char); sprintf(*strP, "%s%s: %s", prefix, fs, airEnumStr(airEndian, endi)); break; case nrrdField_encoding: *strP = AIR_CALLOC(fslen + strlen(nio->encoding->name), char); sprintf(*strP, "%s%s: %s", prefix, fs, nio->encoding->name); break; case nrrdField_line_skip: *strP = AIR_CALLOC(fslen + uintStrlen, char); sprintf(*strP, "%s%s: %d", prefix, fs, nio->lineSkip); break; case nrrdField_byte_skip: *strP = AIR_CALLOC(fslen + uintStrlen, char); sprintf(*strP, "%s%s: %ld", prefix, fs, nio->byteSkip); break; case nrrdField_sample_units: strtmp = airOneLinify(airStrdup(nrrd->sampleUnits)); *strP = AIR_CALLOC(fslen + strlen(strtmp), char); sprintf(*strP, "%s%s: \"%s\"", prefix, fs, strtmp); airFree(strtmp); strtmp = NULL; break; case nrrdField_space_units: fdlen = 0; for (ii=0; iispaceDim; ii++) { /* The "2*" is because at worst every character needs escaping. See note in formatNRRD.c about how even though its not part of the format, we have worst-case scenario of having to escape a space units which is nothing but ". The "+ 3" for the |" "| between each part */ fdlen += 2*airStrlen(nrrd->spaceUnits[ii]) + 3; } fdlen += 1; /* for '\0' */ *strP = AIR_CALLOC(fslen + fdlen, char); sprintf(*strP, "%s%s:", prefix, fs); for (ii=0; iispaceDim; ii++) { strcat(*strP, " \""); if (airStrlen(nrrd->spaceUnits[ii])) { _nrrdWriteEscaped(NULL, *strP, nrrd->spaceUnits[ii], "\"", _NRRD_WHITESPACE_NOTAB); } strcat(*strP, "\""); } break; case nrrdField_space_origin: *strP = AIR_CALLOC(fslen + nrrd->spaceDim*(doubleStrlen + strlen("(,) ")), char); sprintf(*strP, "%s%s: ", prefix, fs); _nrrdStrcatSpaceVector(*strP, nrrd->spaceDim, nrrd->spaceOrigin); break; case nrrdField_measurement_frame: *strP = AIR_CALLOC(fslen + (nrrd->spaceDim* nrrd->spaceDim*(doubleStrlen + strlen("(,) "))), char); sprintf(*strP, "%s%s: ", prefix, fs); for (dd=0; ddspaceDim; dd++) { for (ii=0; iispaceDim; ii++) { colvec[ii] = nrrd->measurementFrame[dd][ii]; } _nrrdStrcatSpaceVector(*strP, nrrd->spaceDim, colvec); if (dd < nrrd->spaceDim-1) { strcat(*strP, " "); } } break; case nrrdField_data_file: /* NOTE: this comes last (nrrdField_data_file is the highest-valued member of the nrrdField* enum) because the "LIST" form of the data file specification requires that the following lines be the filenames */ /* error checking elsewhere: assumes there is data file info */ if (nio->dataFNFormat) { *strP = AIR_CALLOC(fslen + strlen(nio->dataFNFormat) + 4*uintStrlen, char); if (nio->dataFileDim == nrrd->dim-1) { sprintf(*strP, "%s%s: %s %d %d %d", prefix, fs, nio->dataFNFormat, nio->dataFNMin, nio->dataFNMax, nio->dataFNStep); } else { sprintf(*strP, "%s%s: %s %d %d %d %u", prefix, fs, nio->dataFNFormat, nio->dataFNMin, nio->dataFNMax, nio->dataFNStep, nio->dataFileDim); } } else if (nio->dataFNArr->len > 1) { maxl = 0; for (ii=0; iidataFNArr->len; ii++) { maxl = AIR_MAX(maxl, strlen(nio->dataFN[ii])); } *strP = AIR_CALLOC(fslen + strlen(NRRD_LIST_FLAG) + uintStrlen + nio->dataFNArr->len * (maxl + 1), char); fnb = AIR_CALLOC(fslen + strlen(NRRD_LIST_FLAG) + uintStrlen + maxl + 1, char); if (nio->dataFileDim == nrrd->dim-1) { sprintf(*strP, "%s%s: LIST\n", prefix, fs); } else { sprintf(*strP, "%s%s: LIST %u\n", prefix, fs, nio->dataFileDim); } for (ii=0; iidataFNArr->len; ii++) { sprintf(fnb, "%s%s", nio->dataFN[ii], iidataFNArr->len-1 ? "\n" : ""); strcat(*strP, fnb); } free(fnb); } else { /* there is some ambiguity between a "LIST" of length one, and a single explicit data filename, but that's harmless */ *strP = AIR_CALLOC(fslen + strlen("./") + strlen(nio->dataFN[0]) + 1, char); sprintf(*strP, "%s%s: %s%s", prefix, fs, /* this is a favor to older readers that can deal with this NRRD file because its being saved in a NRRD0003 (or below) version, so we don't want to confuse them by not having the old explicit header-relative flag */ (_nrrdFormatNRRD_whichVersion(nrrd, nio) < 4 ? "./" : ""), nio->dataFN[0]); } break; default: fprintf(stderr, "%s: CONFUSION: field %d unrecognized\n", me, field); break; } return; } /* ** _nrrdFprintFieldInfo ** ** convenience wrapper around _nrrdSprintFieldInfo, for writing into ** a file. Same caveats here: use _nrrdFieldInteresting */ void _nrrdFprintFieldInfo(FILE *file, const char *prefix, const Nrrd *nrrd, NrrdIoState *nio, int field) { char *line=NULL; _nrrdSprintFieldInfo(&line, prefix, nrrd, nio, field); if (line) { fprintf(file, "%s\n", line); free(line); } return; } int _nrrdEncodingMaybeSet(NrrdIoState *nio) { static const char me[]="_nrrdEncodingMaybeSet"; if (!nio) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!nio->encoding) { biffAddf(NRRD, "%s: invalid (NULL) encoding", me); return 1; } if (nrrdEncodingUnknown == nio->encoding) { nio->encoding = nrrdEncodingArray[nrrdDefaultWriteEncodingType]; } if (!nio->encoding->available()) { biffAddf(NRRD, "%s: %s encoding not available in this Teem build", me, nio->encoding->name); return 1; } return 0; } /* ** we can assume (via action of caller nrrdSave) that nio->encoding ** has been set ** ** we must set nio->format to something useful/non-trivial */ int _nrrdFormatMaybeGuess(const Nrrd *nrrd, NrrdIoState *nio, const char *filename) { static const char me[]="_nrrdFormatMaybeGuess"; char mesg[AIR_STRLEN_MED]; int fi, guessed, available, fits; if (!nio->format) { biffAddf(NRRD, "%s: got invalid (NULL) format", me); return 1; } if (nrrdFormatUnknown == nio->format) { for (fi = nrrdFormatTypeUnknown+1; fi < nrrdFormatTypeLast; fi++) { if (nrrdFormatArray[fi]->nameLooksLike(filename)) { nio->format = nrrdFormatArray[fi]; break; } } if (nrrdFormatUnknown == nio->format) { /* no nameLooksLike() returned non-zero, punt */ nio->format = nrrdFormatNRRD; } guessed = AIR_TRUE; } else { guessed = AIR_FALSE; } available = nio->format->available(); fits = nio->format->fitsInto(nrrd, nio->encoding, AIR_FALSE); /* !available ==> !fits, by the nature of fitsInto() */ if (!( available && fits )) { sprintf(mesg, "can not use %s format: %s", nio->format->name, (!available ? "not available in this Teem build" : "array doesn\'t fit")); if (guessed) { if (1 <= nrrdStateVerboseIO) { fprintf(stderr, "(%s: %s --> saving to NRRD format)\n", me, mesg); } nio->format = nrrdFormatNRRD; } else { /* problem: this was the format someone explicitly requested */ biffAddf(NRRD, "%s: %s", me, mesg); return 1; } } return 0; } int _nrrdFormatMaybeSet(NrrdIoState *nio) { static const char me[]="_nrrdFormatMaybeSet"; if (!nio->format) { biffAddf(NRRD, "%s: invalid (NULL) format", me); return 1; } if (nrrdFormatUnknown == nio->format) { nio->format = nrrdFormatNRRD; } if (!nio->format->available()) { biffAddf(NRRD, "%s: %s format not available in this Teem build", me, nio->format->name); return 1; } return 0; } /* ** _nrrdWrite ** ** Write a nrrd to given file or string (allocated by nrrd), using the ** format and and encoding indicated in nio. Cleverness should be ** isolated and collected here: by the time nio->format->write() is ** called, all writing parameters must be given explicitly, and their ** appropriateness is explicitly tested */ int _nrrdWrite(FILE *file, char **stringP, const Nrrd *nrrd, NrrdIoState *_nio) { static const char me[]="_nrrdWrite"; NrrdIoState *nio; airArray *mop; if (!((file || stringP) && nrrd)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (file && stringP) { biffAddf(NRRD, "%s: can't write to both file and string", me); return 1; } if (nrrdCheck(nrrd)) { biffAddf(NRRD, "%s:", me); return 1; } mop = airMopNew(); if (_nio) { nio = _nio; } else { nio = nrrdIoStateNew(); if (!nio) { biffAddf(NRRD, "%s: couldn't alloc local NrrdIoState", me); airMopError(mop); return 1; } airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways); } if (_nrrdEncodingMaybeSet(nio) || _nrrdFormatMaybeSet(nio)) { biffAddf(NRRD, "%s: ", me); airMopError(mop); return 1; } if (nio->byteSkip || nio->lineSkip) { /* NOTE: unu make bypasses this by calling nrrdFormatNRRD->write() directly */ biffAddf(NRRD, "%s: can't generate line or byte skips on data write", me); airMopError(mop); return 1; } if (stringP) { if (nrrdFormatNRRD != nio->format) { biffAddf(NRRD, "%s: sorry, can only write %s files to strings (not %s)", me, nrrdFormatNRRD->name, nio->format->name); airMopError(mop); return 1; } /* we do this in two passes; first see how much room is needed for the header, then allocate, then write the header */ nio->learningHeaderStrlen = AIR_TRUE; if (nio->format->write(NULL, nrrd, nio)) { biffAddf(NRRD, "%s:", me); airMopError(mop); return 1; } *stringP = AIR_MALLOC(nio->headerStrlen + 1, char); if (!*stringP) { biffAddf(NRRD, "%s: couldn't allocate header string (%u len )", me, nio->headerStrlen); airMopError(mop); return 1; } nio->learningHeaderStrlen = AIR_FALSE; nio->headerStringWrite = *stringP; if (nio->format->write(NULL, nrrd, nio)) { biffAddf(NRRD, "%s:", me); airMopError(mop); return 1; } } else { /* call the writer appropriate for the format */ if (nio->format->write(file, nrrd, nio)) { biffAddf(NRRD, "%s:", me); airMopError(mop); return 1; } } airMopOkay(mop); return 0; } /* ******** nrrdWrite ** ** wrapper around _nrrdWrite; writes to a FILE* */ int nrrdWrite(FILE *file, const Nrrd *nrrd, NrrdIoState *_nio) { static const char me[]="nrrdWrite"; if (_nrrdWrite(file, NULL, nrrd, _nio)) { biffAddf(NRRD, "%s: trouble", me); return 1; } return 0; } /* ******** nrrdStringWrite ** ** wrapper around _nrrdWrite; *allocates* and writes to a string */ int nrrdStringWrite(char **stringP, const Nrrd *nrrd, NrrdIoState *_nio) { static const char me[]="nrrdStringWrite"; if (_nrrdWrite(NULL, stringP, nrrd, _nio)) { biffAddf(NRRD, "%s: trouble", me); return 1; } return 0; } /* ******** nrrdSave ** ** save a given nrrd to a given filename, with cleverness to guess ** format if not specified by the caller ** ** currently, for NRRD format files, we play the detached header game ** whenever the filename ends in NRRD_EXT_NHDR, and when we play this ** game, the data file is ALWAYS header relative. */ int nrrdSave(const char *filename, const Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="nrrdSave"; FILE *file; airArray *mop; if (!(nrrd && filename)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } mop = airMopNew(); if (!nio) { nio = nrrdIoStateNew(); if (!nio) { biffAddf(NRRD, "%s: couldn't alloc local NrrdIoState", me); return 1; } airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways); } if (_nrrdEncodingMaybeSet(nio) || _nrrdFormatMaybeGuess(nrrd, nio, filename)) { biffAddf(NRRD, "%s: ", me); airMopError(mop); return 1; } if (nrrdFormatNRRD == nio->format && airEndsWith(filename, NRRD_EXT_NHDR)) { nio->detachedHeader = AIR_TRUE; _nrrdSplitName(&(nio->path), &(nio->base), filename); /* nix the ".nhdr" suffix */ nio->base[strlen(nio->base) - strlen(NRRD_EXT_NHDR)] = 0; /* nrrdFormatNRRD->write will do the rest */ } else { nio->detachedHeader = AIR_FALSE; } if (!( file = airFopen(filename, stdout, "wb") )) { biffAddf(NRRD, "%s: couldn't fopen(\"%s\",\"wb\"): %s", me, filename, strerror(errno)); airMopError(mop); return 1; } airMopAdd(mop, file, (airMopper)airFclose, airMopAlways); if (nrrdWrite(file, nrrd, nio)) { biffAddf(NRRD, "%s:", me); airMopError(mop); return 1; } airMopOkay(mop); return 0; } int nrrdSaveMulti(const char *fnameFormat, const Nrrd *const *nin, unsigned int ninLen, unsigned int numStart, NrrdIoState *nio) { static const char me[]="nrrdSaveMulti"; char *fname; airArray *mop; unsigned int nii; if (!( fnameFormat && nin )) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!( _nrrdContainsPercentThisAndMore(fnameFormat, 'u') )) { biffAddf(NRRD, "%s: given format \"%s\" doesn't seem to " "have the \"%%u\" conversion specification to sprintf " "an unsigned int\n", me, fnameFormat); return 1; } mop = airMopNew(); /* should be big enough for the number replacing the format sequence */ fname = AIR_CALLOC(strlen(fnameFormat) + 128, char); if (!(fname)) { biffAddf(NRRD, "%s: couldn't allocate local fname buffer", me); airMopError(mop); return 1; } airMopAdd(mop, fname, airFree, airMopAlways); for (nii=0; niipath = (char *)airFree(nio->path); nio->base = (char *)airFree(nio->base); nio->line = (char *)airFree(nio->line); nio->dataFNFormat = (char *)airFree(nio->dataFNFormat); /* the way IO to/from strings works, I don't think this should be freed */ nio->headerStringRead = NULL; nio->headerStringWrite = NULL; airArrayLenSet(nio->dataFNArr, 0); /* closing this is always someone else's responsibility */ nio->headerFile = NULL; nio->dataFile = NULL; nio->dataFileDim = 0; nio->dataFNMin = 0; nio->dataFNMax = 0; nio->dataFNStep = 0; nio->dataFNIndex = 0; nio->lineLen = 0; nio->pos = 0; nio->endian = airEndianUnknown; nio->lineSkip = 0; nio->headerStrlen = 0; nio->headerStrpos = 0; nio->byteSkip = 0; memset(nio->seen, 0, (NRRD_FIELD_MAX+1)*sizeof(int)); nio->detachedHeader = AIR_FALSE; nio->bareText = nrrdDefaultWriteBareText; nio->charsPerLine = nrrdDefaultWriteCharsPerLine; nio->valsPerLine = nrrdDefaultWriteValsPerLine; nio->skipData = AIR_FALSE; nio->skipFormatURL = AIR_FALSE; nio->keepNrrdDataFileOpen = AIR_FALSE; nio->zlibLevel = -1; nio->zlibStrategy = nrrdZlibStrategyDefault; nio->bzip2BlockSize = -1; nio->learningHeaderStrlen = AIR_FALSE; nio->oldData = NULL; nio->oldDataSize = 0; nio->format = nrrdFormatUnknown; nio->encoding = nrrdEncodingUnknown; } return; } NrrdIoState * nrrdIoStateNew(void) { NrrdIoState *nio; nio = (NrrdIoState *)calloc(1, sizeof(NrrdIoState)); if (nio) { airPtrPtrUnion appu; nio->path = NULL; nio->base = NULL; nio->line = NULL; nio->dataFNFormat = NULL; nio->dataFN = NULL; nio->headerStringRead = NULL; nio->headerStringWrite = NULL; appu.cp = &(nio->dataFN); nio->dataFNArr = airArrayNew(appu.v, NULL, sizeof(char *), NRRD_FILENAME_INCR); airArrayPointerCB(nio->dataFNArr, airNull, airFree); nio->format = nrrdFormatUnknown; nio->encoding = nrrdEncodingUnknown; nrrdIoStateInit(nio); } return nio; } NrrdIoState * nrrdIoStateNix(NrrdIoState *nio) { nio->path = (char *)airFree(nio->path); nio->base = (char *)airFree(nio->base); nio->line = (char *)airFree(nio->line); nio->dataFNFormat = (char *)airFree(nio->dataFNFormat); nio->dataFNArr = airArrayNuke(nio->dataFNArr); /* the NrrdIoState never owned nio->oldData; we don't free it */ airFree(nio); /* no NULL assignment, else compile warnings */ return NULL; } /* ------------------------------------------------------------ */ /* see axis.c for axis-specific "methods" */ /* ------------------------------------------------------------ */ /* ******** nrrdBasicInfoInit ** ** resets "basic" (per-array) information ** formerly nrrdPeripheralInit ** ** the bitflag communicates which fields should *not* be initialized */ void nrrdBasicInfoInit(Nrrd *nrrd, int bitflag) { int dd, ee; if (!nrrd) { return; } if (!(NRRD_BASIC_INFO_DATA_BIT & bitflag)) { nrrd->data = airFree(nrrd->data); } if (!(NRRD_BASIC_INFO_TYPE_BIT & bitflag)) { nrrd->type = nrrdTypeUnknown; } if (!(NRRD_BASIC_INFO_BLOCKSIZE_BIT & bitflag)) { nrrd->blockSize = 0; } if (!(NRRD_BASIC_INFO_DIMENSION_BIT & bitflag)) { nrrd->dim = 0; } if (!(NRRD_BASIC_INFO_CONTENT_BIT & bitflag)) { nrrd->content = (char *)airFree(nrrd->content); } if (!(NRRD_BASIC_INFO_SAMPLEUNITS_BIT & bitflag)) { nrrd->sampleUnits = (char *)airFree(nrrd->sampleUnits); } if (!(NRRD_BASIC_INFO_SPACE_BIT & bitflag)) { nrrd->space = nrrdSpaceUnknown; nrrd->spaceDim = 0; } if (!(NRRD_BASIC_INFO_SPACEDIMENSION_BIT & bitflag)) { nrrd->space = nrrdSpaceUnknown; nrrd->spaceDim = 0; } if (!(NRRD_BASIC_INFO_SPACEUNITS_BIT & bitflag)) { for (dd=0; ddspaceUnits[dd] = (char *)airFree(nrrd->spaceUnits[dd]); } } if (!(NRRD_BASIC_INFO_SPACEORIGIN_BIT & bitflag)) { for (dd=0; ddspaceOrigin[dd] = AIR_NAN; } } if (!(NRRD_BASIC_INFO_MEASUREMENTFRAME_BIT & bitflag)) { for (dd=0; ddmeasurementFrame[dd][ee] = AIR_NAN; } } } if (!(NRRD_BASIC_INFO_OLDMIN_BIT & bitflag)) { nrrd->oldMin = AIR_NAN; } if (!(NRRD_BASIC_INFO_OLDMAX_BIT & bitflag)) { nrrd->oldMax = AIR_NAN; } if (!(NRRD_BASIC_INFO_COMMENTS_BIT & bitflag)) { nrrdCommentClear(nrrd); } if (!(NRRD_BASIC_INFO_KEYVALUEPAIRS_BIT & bitflag)) { nrrdKeyValueClear(nrrd); } return; } /* ******** nrrdBasicInfoCopy ** ** copies "basic" (per-array) information ** formerly known as nrrdPeripheralCopy, which was not used consistently ** ** the bitflag communicates which fields should *not* be copied */ int nrrdBasicInfoCopy(Nrrd *dest, const Nrrd *src, int bitflag) { static const char me[]="nrrdBasicInfoCopy"; unsigned int dd, ee; if (!( dest && src )) return 0; if (dest == src) { /* nothing to do */ return 0; } if (!(NRRD_BASIC_INFO_DATA_BIT & bitflag)) { dest->data = src->data; } if (!(NRRD_BASIC_INFO_TYPE_BIT & bitflag)) { dest->type = src->type; } if (!(NRRD_BASIC_INFO_BLOCKSIZE_BIT & bitflag)) { dest->blockSize = src->blockSize; } if (!(NRRD_BASIC_INFO_DIMENSION_BIT & bitflag)) { dest->dim = src->dim; } if (!(NRRD_BASIC_INFO_CONTENT_BIT & bitflag)) { dest->content = (char *)airFree(dest->content); dest->content = airStrdup(src->content); if (src->content && !dest->content) { biffAddf(NRRD, "%s: couldn't copy content", me); return 1; } } if (!(NRRD_BASIC_INFO_SAMPLEUNITS_BIT & bitflag)) { dest->sampleUnits = (char *)airFree(dest->sampleUnits); dest->sampleUnits = airStrdup(src->sampleUnits); if (src->sampleUnits && !dest->sampleUnits) { biffAddf(NRRD, "%s: couldn't copy sampleUnits", me); return 1; } } if (!(NRRD_BASIC_INFO_SPACE_BIT & bitflag)) { dest->space = src->space; } if (!(NRRD_BASIC_INFO_SPACEDIMENSION_BIT & bitflag)) { dest->spaceDim = src->spaceDim; } if (!(NRRD_BASIC_INFO_SPACEUNITS_BIT & bitflag)) { for (dd=0; ddspaceDim; dd++) { dest->spaceUnits[dd] = (char *)airFree(dest->spaceUnits[dd]); dest->spaceUnits[dd] = airStrdup(src->spaceUnits[dd]); if (src->spaceUnits[dd] && !dest->spaceUnits[dd]) { biffAddf(NRRD, "%s: couldn't copy spaceUnits[%d]", me, dd); return 1; } } for (dd=src->spaceDim; ddspaceUnits[dd] = (char *)airFree(dest->spaceUnits[dd]); } } if (!(NRRD_BASIC_INFO_SPACEORIGIN_BIT & bitflag)) { for (dd=0; ddspaceDim-1) { dest->spaceOrigin[dd] = src->spaceOrigin[dd]; } else { dest->spaceOrigin[dd] = AIR_NAN; } } } if (!(NRRD_BASIC_INFO_MEASUREMENTFRAME_BIT & bitflag)) { for (dd=0; ddspaceDim-1 && ee <= src->spaceDim-1) { dest->measurementFrame[dd][ee] = src->measurementFrame[dd][ee]; } else { dest->measurementFrame[dd][ee] = AIR_NAN; } } } for (dd=src->spaceDim; ddspaceOrigin[dd] = AIR_NAN; } } if (!(NRRD_BASIC_INFO_OLDMIN_BIT & bitflag)) { dest->oldMin = src->oldMin; } if (!(NRRD_BASIC_INFO_OLDMAX_BIT & bitflag)) { dest->oldMax = src->oldMax; } if (!(NRRD_BASIC_INFO_COMMENTS_BIT & bitflag)) { if (nrrdCommentCopy(dest, src)) { biffAddf(NRRD, "%s: trouble copying comments", me); return 1; } } if (!(NRRD_BASIC_INFO_KEYVALUEPAIRS_BIT & bitflag)) { if (nrrdKeyValueCopy(dest, src)) { biffAddf(NRRD, "%s: trouble copying key/value pairs", me); return 1; } } return 0; } /* ******* nrrdInit ** ** initializes a nrrd to default state. All nrrd functions in the ** business of initializing a nrrd struct use this function. Mostly ** just sets values to 0, NaN, "", NULL, or Unknown */ void nrrdInit(Nrrd *nrrd) { int ii; if (nrrd) { nrrdBasicInfoInit(nrrd, NRRD_BASIC_INFO_NONE); for (ii=0; iiaxis + ii); } } return; } /* ******** nrrdNew() ** ** creates and initializes a Nrrd ** ** this does NOT use biff */ Nrrd * nrrdNew(void) { int ii; Nrrd *nrrd; airPtrPtrUnion appu; nrrd = (Nrrd*)(calloc(1, sizeof(Nrrd))); if (!nrrd) { return NULL; } /* explicitly set pointers to NULL, since calloc isn't officially guaranteed to do that. */ nrrd->data = NULL; for (ii=0; iiaxis + ii); } for (ii=0; iispaceUnits[ii] = NULL; } nrrd->content = NULL; nrrd->sampleUnits = NULL; /* create comment airArray (even though it starts empty) */ nrrd->cmt = NULL; appu.cp = &(nrrd->cmt); nrrd->cmtArr = airArrayNew(appu.v, NULL, sizeof(char *), NRRD_COMMENT_INCR); if (!nrrd->cmtArr) { return NULL; } airArrayPointerCB(nrrd->cmtArr, airNull, airFree); /* create key/value airArray (even thought it starts empty) */ nrrd->kvp = NULL; appu.cp = &(nrrd->kvp); nrrd->kvpArr = airArrayNew(appu.v, NULL, 2*sizeof(char *), NRRD_KEYVALUE_INCR); if (!nrrd->kvpArr) { return NULL; } /* key/value airArray uses no callbacks for now */ /* finish initializations */ nrrdInit(nrrd); return nrrd; } /* ******** nrrdNix() ** ** does nothing with the array data inside, just does whatever is needed ** to free the nrrd itself ** ** returns NULL ** ** this does NOT use biff */ Nrrd * nrrdNix(Nrrd *nrrd) { int ii; if (nrrd) { for (ii=0; iiaxis[ii])); } for (ii=0; iispaceUnits[ii] = (char *)airFree(nrrd->spaceUnits[ii]); } nrrd->content = (char *)airFree(nrrd->content); nrrd->sampleUnits = (char *)airFree(nrrd->sampleUnits); nrrdCommentClear(nrrd); nrrd->cmtArr = airArrayNix(nrrd->cmtArr); nrrdKeyValueClear(nrrd); nrrd->kvpArr = airArrayNix(nrrd->kvpArr); airFree(nrrd); } return NULL; } /* ******** nrrdEmpty() ** ** frees data inside nrrd AND resets all its state, so its the ** same as what comes from nrrdNew(). This includes free()ing ** any comments. */ Nrrd * nrrdEmpty(Nrrd *nrrd) { if (nrrd) { nrrd->data = airFree(nrrd->data); nrrdInit(nrrd); } return nrrd; } /* ******** nrrdNuke() ** ** blows away the nrrd and everything inside ** ** always returns NULL */ Nrrd * nrrdNuke(Nrrd *nrrd) { if (nrrd) { nrrdEmpty(nrrd); nrrdNix(nrrd); } return NULL; } /* ------------------------------------------------------------ */ int _nrrdSizeCheck(const size_t *size, unsigned int dim, int useBiff) { static const char me[]="_nrrdSizeCheck"; size_t num, pre; unsigned int ai; pre = num = 1; for (ai=0; aiblockSize at some other time. */ int nrrdWrap_nva(Nrrd *nrrd, void *data, int type, unsigned int dim, const size_t *size) { static const char me[]="nrrdWrap_nva"; if (!(nrrd && size)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } nrrd->data = data; nrrd->type = type; nrrd->dim = dim; if (_nrrdSizeCheck(size, dim, AIR_TRUE)) { biffAddf(NRRD, "%s:", me); return 1; } nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoSize, size); return 0; } /* ******** nrrdWrap_va() ** ** Minimal var args wrapper around nrrdWrap_nva, with the advantage of ** taking all the axes sizes as the var args. ** ** This is THE BEST WAY to wrap a nrrd around existing raster data, ** assuming that the dimension is known at compile time. ** ** If successful, returns 0, otherwise, 1. ** This does use biff. */ int nrrdWrap_va(Nrrd *nrrd, void *data, int type, unsigned int dim, ...) { static const char me[]="nrrdWrap_va"; va_list ap; size_t size[NRRD_DIM_MAX]; unsigned int ai; if (!(nrrd && data)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } va_start(ap, dim); for (ai=0; aidata; for (I=0; Idata) { if (nrrdMaybeAlloc_nva(nout, nin->type, nin->dim, size)) { biffAddf(NRRD, "%s: couldn't allocate data", me); return 1; } memcpy(nout->data, nin->data, nrrdElementNumber(nin)*nrrdElementSize(nin)); } else { /* someone is trying to copy structs without data, fine fine fine */ if (nrrdWrap_nva(nout, NULL, nin->type, nin->dim, size)) { biffAddf(NRRD, "%s: couldn't allocate data", me); return 1; } } nrrdAxisInfoCopy(nout, nin, NULL, NRRD_AXIS_INFO_SIZE_BIT); /* if nin->data non-NULL (second branch above), this will harmlessly unset and set type and dim */ nrrdBasicInfoInit(nout, NRRD_BASIC_INFO_DATA_BIT | bitflag); if (nrrdBasicInfoCopy(nout, nin, NRRD_BASIC_INFO_DATA_BIT | bitflag)) { biffAddf(NRRD, "%s: trouble copying basic info", me); return 1; } return 0; } /* ******** nrrdCopy ** ** copy method for nrrds. nout will end up as an "exact" copy of nin. ** New space for data is allocated here, and output nrrd points to it. ** Comments from old are added to comments for new, so these are also ** newly allocated. nout->ptr is not set, nin->ptr is not read. */ int nrrdCopy(Nrrd *nout, const Nrrd *nin) { static const char me[]="nrrdCopy"; if (_nrrdCopy(nout, nin, NRRD_BASIC_INFO_NONE)) { biffAddf(NRRD, "%s:", me); return 1; } return 0; } /* ******** nrrdAlloc_nva() ** ** allocates data array and sets information. If this is a block type ** nrrd, it is necessary to set nrrd->blockSize PRIOR to calling ** this function. ** ** This function will always allocate more memory (via calloc), but ** it will free() nrrd->data if it is non-NULL when passed in. ** ** This function takes the same "don't mess with peripheral information" ** attitude as nrrdWrap(). ** ** Note to Gordon: don't get clever and change ANY axis-specific ** information here. It may be very convenient to set that before ** nrrdAlloc or nrrdMaybeAlloc ** ** Note: This function DOES use biff */ int nrrdAlloc_nva(Nrrd *nrrd, int type, unsigned int dim, const size_t *size) { static const char me[]="nrrdAlloc_nva"; size_t num, esize; char stmp[2][AIR_STRLEN_SMALL]; if (!(nrrd && size)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (airEnumValCheck(nrrdType, type)) { biffAddf(NRRD, "%s: type (%d) is invalid", me, type); return 1; } if (nrrdTypeBlock == type) { if (!(0 < nrrd->blockSize)) { biffAddf(NRRD, "%s: given nrrd->blockSize %s invalid", me, airSprintSize_t(stmp[0], nrrd->blockSize)); return 1; } } if (!AIR_IN_CL(1, dim, NRRD_DIM_MAX)) { biffAddf(NRRD, "%s: dim (%d) not in valid range [1,%d]", me, dim, NRRD_DIM_MAX); return 1; } nrrd->data = airFree(nrrd->data); if (nrrdWrap_nva(nrrd, NULL, type, dim, size)) { biffAddf(NRRD, "%s:", me); return 1 ; } num = nrrdElementNumber(nrrd); esize = nrrdElementSize(nrrd); nrrd->data = calloc(num, esize); if (!(nrrd->data)) { biffAddf(NRRD, "%s: calloc(%s,%s) failed", me, airSprintSize_t(stmp[0], num), airSprintSize_t(stmp[1], esize)); return 1 ; } return 0; } /* ******** nrrdAlloc_va() ** ** Handy wrapper around nrrdAlloc_nva, which takes, as its vararg list, ** all the axes sizes. */ int nrrdAlloc_va(Nrrd *nrrd, int type, unsigned int dim, ...) { static const char me[]="nrrdAlloc_va"; size_t size[NRRD_DIM_MAX]; unsigned int ai; va_list ap; if (!nrrd) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } va_start(ap, dim); for (ai=0; aitype) { biffAddf(NRRD, "%s: can't change from one block nrrd to another", me); return 1; } if (!(0 < nrrd->blockSize)) { char stmp[AIR_STRLEN_SMALL]; biffAddf(NRRD, "%s: given nrrd->blockSize %s invalid", me, airSprintSize_t(stmp, nrrd->blockSize)); return 1; } elementSizeWant = nrrd->blockSize; } else { elementSizeWant = nrrdTypeSize[type]; } if (_nrrdSizeCheck(size, dim, AIR_TRUE)) { biffAddf(NRRD, "%s:", me); return 1; } if (!(nrrd->data)) { need = 1; } else { numWant = 1; for (ai=0; aidata, type, dim, size)) { biffAddf(NRRD, "%s:", me); return 1; } /* but we may have to initialize memory */ if (zeroWhenNoAlloc) { memset(nrrd->data, 0, nrrdElementNumber(nrrd)*nrrdElementSize(nrrd)); } } return 0; } /* ******** nrrdMaybeAlloc_nva ** ** NOTE: this is now just a wrapper around _nrrdMaybeAllocMaybeZero_nva; ** below info referred to original implementation. ** ** calls nrrdAlloc_nva if the requested space is different than ** what is currently held ** ** also subscribes to the "don't mess with peripheral information" philosophy */ int nrrdMaybeAlloc_nva(Nrrd *nrrd, int type, unsigned int dim, const size_t *size) { static const char me[]="nrrdMaybeAlloc_nva"; int ret; ret = _nrrdMaybeAllocMaybeZero_nva(nrrd, type, dim, size, AIR_TRUE); if (ret) { biffAddf(NRRD, "%s: trouble", me); } return ret; } /* ******** nrrdMaybeAlloc_va() ** ** Handy wrapper around nrrdAlloc, which takes, as its vararg list ** all the axes sizes, thereby calculating the total number. */ int nrrdMaybeAlloc_va(Nrrd *nrrd, int type, unsigned int dim, ...) { static const char me[]="nrrdMaybeAlloc_va"; size_t size[NRRD_DIM_MAX]; unsigned int ai; va_list ap; if (!nrrd) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } va_start(ap, dim); for (ai=0; aiformat has been set to you already ** -- for read(): that nio->path has been set to the path of the file being ** read in, if the information was ever available ** -- for contentStartsLike() and read(): that nio->line contains the ** first line of of the file, in order to determine the file type ** ** what a NrrdFormat has to do: ** -- respect nio->skipData to whatever extent makes sense on top of how the ** NrrdEncoding respects it (by making read and write no-ops). ** nrrdFormatNRRD, for instance, won't create empty detached data files ** if nio->skipData. ** -- determine what NrrdEncoding to use, if there's a choice ** -- respect nrrdStateVerboseIO with messages to stderr, if possible ** ** The "unknown" format is intended as a template for writing new formats. */ static int _nrrdFormatUnknown_available(void) { /* insert code here */ return AIR_FALSE; } static int _nrrdFormatUnknown_nameLooksLike(const char *filename) { /* insert code here */ AIR_UNUSED(filename); return AIR_FALSE; } static int _nrrdFormatUnknown_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { static const char me[]="_nrrdFormatUnknown_fitsInto"; if (!(nrrd && encoding)) { biffMaybeAddf(useBiff, NRRD, "%s: got NULL nrrd (%p) or encoding (%p)", me, AIR_CVOIDP(nrrd), AIR_CVOIDP(encoding)); return AIR_FALSE; } /* insert code here */ return AIR_FALSE; } static int _nrrdFormatUnknown_contentStartsLike(NrrdIoState *nio) { /* insert code here */ AIR_UNUSED(nio); return AIR_FALSE; } static int _nrrdFormatUnknown_read(FILE *file, Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdFormatUnknown_read"; /* insert code here, and remove error handling below */ AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); biffAddf(NRRD, "%s: ERROR!!! trying to read unknown format", me); return 1; } static int _nrrdFormatUnknown_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdFormatUnknown_write"; /* insert code here, and remove error handling below */ AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); biffAddf(NRRD, "%s: ERROR!!! trying to write unknown format", me); return 1; } static const NrrdFormat _nrrdFormatUnknown = { "unknown", AIR_FALSE, /* isImage */ AIR_TRUE, /* readable */ AIR_FALSE, /* usesDIO */ _nrrdFormatUnknown_available, _nrrdFormatUnknown_nameLooksLike, _nrrdFormatUnknown_fitsInto, _nrrdFormatUnknown_contentStartsLike, _nrrdFormatUnknown_read, _nrrdFormatUnknown_write }; const NrrdFormat *const nrrdFormatUnknown = &_nrrdFormatUnknown; const NrrdFormat *const nrrdFormatArray[NRRD_FORMAT_TYPE_MAX+1] = { &_nrrdFormatUnknown, &_nrrdFormatNRRD, &_nrrdFormatPNM, &_nrrdFormatPNG, &_nrrdFormatVTK, &_nrrdFormatText, &_nrrdFormatEPS }; cmtk-3.0.0/Utilities/NrrdIO/miscAir.c0000644000177700000170000001656612041601331016357 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateAir.h" /* timer functions */ #ifdef _WIN32 #include #include #include #else #include #endif /* ******** airTeemVersion ******** airTeemReleaseDate ** ** updated with each release to contain a string representation of ** the Teem version number and release date. Originated in version 1.5; ** use of TEEM_VERSION #defines started in 1.9 */ const char * airTeemVersion = TEEM_VERSION_STRING; const char * airTeemReleaseDate = "19 Dec 2012"; double _airSanityHelper(double val) { return val*val*val; } /* ******** airNull() ** ** returns NULL */ void * airNull(void) { return NULL; } /* ******** airSetNull ** ** dereferences and sets to NULL, returns NULL */ void * airSetNull(void **ptrP) { if (ptrP) { *ptrP = NULL; } return NULL; } /* ******** airFree() ** ** to facilitate setting a newly free()'d pointer; always returns NULL. ** also makes sure that NULL is not passed to free(). */ void * airFree(void *ptr) { if (ptr) { free(ptr); } return NULL; } /* ******** airFopen() ** ** encapsulates that idea that "-" is either standard in or stardard ** out, and does McRosopht stuff required to make piping work ** ** Does not error checking. If fopen fails, then C' errno and strerror are ** left untouched for the caller to access. */ FILE * airFopen(const char *name, FILE *std, const char *mode) { FILE *ret; if (!strcmp(name, "-")) { ret = std; #ifdef _WIN32 if (strchr(mode, 'b')) { _setmode(_fileno(ret), _O_BINARY); } #endif } else { ret = fopen(name, mode); } return ret; } /* ******** airFclose() ** ** just to facilitate setting a newly fclose()'d file pointer to NULL ** also makes sure that NULL is not passed to fclose(), and won't close ** stdin, stdout, or stderr (its up to the user to open these correctly) */ FILE * airFclose(FILE *file) { if (file) { if (!( stdin == file || stdout == file || stderr == file )) { fclose(file); } } return NULL; } /* ******** airSinglePrintf ** ** a complete stand-in for {f|s}printf(), as long as the given format ** string contains exactly one conversion sequence. The utility of ** this is to standardize the printing of IEEE 754 special values: ** QNAN, SNAN -> "NaN" ** POS_INF -> "+inf" ** NEG_INF -> "-inf" ** The format string can contain other things besides just the ** conversion sequence: airSingleFprintf(f, " (%f)\n", AIR_NAN) ** will be the same as fprintf(f, " (%s)\n", "NaN"); ** ** To get fprintf behavior, pass "str" as NULL ** to get sprintf bahavior, pass "file" as NULL ** ** Finding a complete {f|s|}printf replacement is a priority for Teem 2.0 */ int airSinglePrintf(FILE *file, char *str, const char *_fmt, ...) { char *fmt, buff[AIR_STRLEN_LARGE]; double val=0, gVal, fVal; int ret, isF, isD, cls; char *conv=NULL, *p0, *p1, *p2, *p3, *p4, *p5; va_list ap; va_start(ap, _fmt); fmt = airStrdup(_fmt); /* this is needlessly complicated; the "l" modifier is a no-op */ p0 = strstr(fmt, "%e"); p1 = strstr(fmt, "%f"); p2 = strstr(fmt, "%g"); p3 = strstr(fmt, "%le"); p4 = strstr(fmt, "%lf"); p5 = strstr(fmt, "%lg"); isF = p0 || p1 || p2; isD = p3 || p4 || p5; /* the code here says "isF" and "isD" as if it means "is float" or "is double". It really should be "is2" or "is3", as in, "is 2-character conv. seq., or "is 3-character conv. seq." */ if (isF) { conv = p0 ? p0 : (p1 ? p1 : p2); } if (isD) { conv = p3 ? p3 : (p4 ? p4 : p5); } if (isF || isD) { /* use "double" instead of "float" because var args are _always_ subject to old-style C type promotions: float promotes to double */ val = va_arg(ap, double); cls = airFPClass_d(val); switch (cls) { case airFP_SNAN: case airFP_QNAN: case airFP_POS_INF: case airFP_NEG_INF: if (isF) { memcpy(conv, "%s", 2); } else { /* this sneakiness allows us to replace a 3-character conversion sequence for a double (such as %lg) with a 3-character conversion for a string, which we know has at most 4 characters */ memcpy(conv, "%4s", 3); } break; } #define PRINT(F, S, C, V) ((F) ? fprintf((F),(C),(V)) : sprintf((S),(C),(V))) switch (cls) { case airFP_SNAN: case airFP_QNAN: ret = PRINT(file, str, fmt, "NaN"); break; case airFP_POS_INF: ret = PRINT(file, str, fmt, "+inf"); break; case airFP_NEG_INF: ret = PRINT(file, str, fmt, "-inf"); break; default: if (p2 || p5) { /* got "%g" or "%lg", see if it would be better to use "%f" */ sprintf(buff, "%f", val); sscanf(buff, "%lf", &fVal); sprintf(buff, "%g", val); sscanf(buff, "%lf", &gVal); if (fVal != gVal) { /* using %g (or %lg) lost precision!! Use %f (or %lf) instead */ if (p2) { memcpy(conv, "%f", 2); } else { memcpy(conv, "%lf", 3); } } } ret = PRINT(file, str, fmt, val); break; } } else { /* conversion sequence is neither for float nor double */ ret = file ? vfprintf(file, fmt, ap) : vsprintf(str, fmt, ap); } va_end(ap); free(fmt); return ret; } /* ******** airSprintSize_t ** ** sprints a single size_t to a given string, side-stepping ** non-standardized format specifier confusion with printf */ char * airSprintSize_t(char _str[AIR_STRLEN_SMALL], size_t val) { char str[AIR_STRLEN_SMALL]; unsigned int si; if (!_str) { return NULL; } si = AIR_STRLEN_SMALL-1; str[si] = '\0'; do { str[--si] = AIR_CAST(char, (val % 10) + '0'); val /= 10; } while (val); strcpy(_str, str + si); return _str; } /* ******** airSprintPtrdiff_t ** ** sprints a single ptrdiff_t to a given string, side-stepping ** non-standardized format specifier confusion with printf */ char * airSprintPtrdiff_t(char _str[AIR_STRLEN_SMALL], ptrdiff_t val) { char str[AIR_STRLEN_SMALL]; unsigned int si; int sign; if (!_str) { return NULL; } si = AIR_STRLEN_SMALL-1; str[si] = '\0'; sign = (val < 0 ? -1 : 1); do { ptrdiff_t dig; dig = val % 10; str[--si] = AIR_CAST(char, dig > 0 ? dig + '0' : -dig + '0'); val /= 10; } while (val); if (-1 == sign) { str[--si] = '-'; } strcpy(_str, str + si); return _str; } cmtk-3.0.0/Utilities/NrrdIO/arraysNrrd.c0000644000177700000170000002442412041601331017107 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* learned: /usr/bin/c++ on mac (at least) won't actually put a const int blah[] array in an object file if it hasn't been declared as "extern" */ const char nrrdTypePrintfStr[NRRD_TYPE_MAX+1][AIR_STRLEN_SMALL] = { "%*d", /* nrrdTypeUnknown: what else? the effect will be "skip" for sscanf, and "minimum precision" for printf */ "%d", /* nrrdTypeChar: char */ "%u", /* nrrdTypeUChar: unsigned char */ "%hd", /* nrrdTypeShort: short */ "%hu", /* nrrdTypeUShort: unsigned short */ "%d", /* nrrdTypeInt: int */ "%u", /* nrrdTypeUInt: unsigned int */ AIR_LLONG_FMT, /* nrrdTypeLLong: long long */ AIR_ULLONG_FMT, /* nrrdTypeULLong: unsigned long long */ "%f", /* nrrdTypeFloat: float */ "%lf", /* nrrdTypeDouble: double */ "%*d" /* nrrdTypeBlock: what else? */ }; /* ** the setting of NRRD_TYPE_BIGGEST has to be in accordance with this */ const size_t nrrdTypeSize[NRRD_TYPE_MAX+1] = { 0, /* nrrdTypeUnknown: unknown */ 1, /* nrrdTypeChar: char */ 1, /* nrrdTypeUChar: unsigned char */ 2, /* nrrdTypeShort: short */ 2, /* nrrdTypeUShort: unsigned short */ 4, /* nrrdTypeInt: int */ 4, /* nrrdTypeUInt: unsigned int */ 8, /* nrrdTypeLLong: long long */ 8, /* nrrdTypeULLong: unsigned long long */ 4, /* nrrdTypeFloat: float */ 8, /* nrrdTypeDouble: double */ 0 /* nrrdTypeBlock: effectively unknown; user has to set explicitly */ }; const int nrrdTypeIsIntegral[NRRD_TYPE_MAX+1] = { 0, /* nrrdTypeUnknown: unknown */ 1, /* nrrdTypeChar: char */ 1, /* nrrdTypeUChar: unsigned char */ 1, /* nrrdTypeShort: short */ 1, /* nrrdTypeUShort: unsigned short */ 1, /* nrrdTypeInt: int */ 1, /* nrrdTypeUInt: unsigned int */ 1, /* nrrdTypeLLong: long long */ 1, /* nrrdTypeULLong: unsigned long long */ 0, /* nrrdTypeFloat: float */ 0, /* nrrdTypeDouble: double */ 1 /* nrrdTypeBlock: for some reason we pretend that blocks are integers */ }; const int nrrdTypeIsUnsigned[NRRD_TYPE_MAX+1] = { 0, /* nrrdTypeUnknown: unknown */ 0, /* nrrdTypeChar: char */ 1, /* nrrdTypeUChar: unsigned char */ 0, /* nrrdTypeShort: short */ 1, /* nrrdTypeUShort: unsigned short */ 0, /* nrrdTypeInt: int */ 1, /* nrrdTypeUInt: unsigned int */ 0, /* nrrdTypeLLong: long long */ 1, /* nrrdTypeULLong: unsigned long long */ 0, /* nrrdTypeFloat: float */ 0, /* nrrdTypeDouble: double */ 0 /* nrrdTypeBlock: for some reason we pretend that blocks are signed */ }; /* ******** nrrdTypeMin[] ******** nrrdTypeMax[] ** ** only intended for small (<= 32 bits) integral types, ** so that we know how to "unquantize" integral values. ** A 64-bit double can correctly store the 32-bit integral ** mins and maxs, but gets the last few places wrong in the ** 64-bit mins and max. */ const double nrrdTypeMin[NRRD_TYPE_MAX+1] = { 0, /* nrrdTypeUnknown: unknown */ SCHAR_MIN, /* nrrdTypeChar: char */ 0, /* nrrdTypeUChar: unsigned char */ SHRT_MIN, /* nrrdTypeShort: short */ 0, /* nrrdTypeUShort: unsigned short */ INT_MIN, /* nrrdTypeInt: int */ 0, /* nrrdTypeUInt: unsigned int */ (double)NRRD_LLONG_MIN, /* nrrdTypeLLong: long long */ 0, /* nrrdTypeULLong: unsigned long long */ 0, /* nrrdTypeFloat: float */ 0, /* nrrdTypeDouble: double */ 0 /* nrrdTypeBlock: punt */ }, nrrdTypeMax[NRRD_TYPE_MAX+1] = { 0, /* nrrdTypeUnknown: unknown */ SCHAR_MAX, /* nrrdTypeChar: char */ UCHAR_MAX, /* nrrdTypeUChar: unsigned char */ SHRT_MAX, /* nrrdTypeShort: short */ USHRT_MAX, /* nrrdTypeUShort: unsigned short */ INT_MAX, /* nrrdTypeInt: int */ UINT_MAX, /* nrrdTypeUInt: unsigned int */ (double)NRRD_LLONG_MAX, /* nrrdTypeLLong: long long */ (double)NRRD_ULLONG_MAX, /* nrrdTypeULLong: unsigned long long */ 0, /* nrrdTypeFloat: float */ 0, /* nrrdTypeDouble: double */ 0 /* nrrdTypeBlock: punt */ }; /* ** _nrrdFieldValidInImage[] ** ** these fields are valid embedded in PNM and PNG comments ** This does NOT include the fields who's values are constrained ** by the image format (and in the case of PNM, magic) itself. */ const int _nrrdFieldValidInImage[NRRD_FIELD_MAX+1] = { 0, /* nrrdField_unknown */ 1, /* nrrdField_comment */ 1, /* nrrdField_content */ 0, /* nrrdField_number */ 0, /* nrrdField_type */ 0, /* nrrdField_block_size */ 0, /* nrrdField_dimension */ 1, /* nrrdField_space */ 1, /* nrrdField_space_dimension */ 0, /* nrrdField_sizes */ 1, /* nrrdField_spacings */ 1, /* nrrdField_thicknesses */ 1, /* nrrdField_axis_mins */ 1, /* nrrdField_axis_maxs */ 1, /* nrrdField_space_directions */ 1, /* nrrdField_centers */ 1, /* nrrdField_kinds */ 1, /* nrrdField_labels */ 1, /* nrrdField_units */ 0, /* nrrdField_min */ 0, /* nrrdField_max */ 1, /* nrrdField_old_min */ 1, /* nrrdField_old_max */ 0, /* nrrdField_endian */ 0, /* nrrdField_encoding */ 0, /* nrrdField_line_skip */ 0, /* nrrdField_byte_skip */ 1, /* nrrdField_keyvalue */ 1, /* nrrdField_sample_units */ 1, /* nrrdField_space_units */ 1, /* nrrdField_space_origin */ 1, /* nrrdField_measurement_frame */ 0 /* nrrdField_data_file */ }; /* ** _nrrdFieldOnePerAxis ** ** whether or not you need one value per axis, like labels and spacings */ const int _nrrdFieldOnePerAxis[NRRD_FIELD_MAX+1] = { 0, /* nrrdField_unknown */ 0, /* nrrdField_comment */ 0, /* nrrdField_content */ 0, /* nrrdField_number */ 0, /* nrrdField_type */ 0, /* nrrdField_block_size */ 0, /* nrrdField_dimension */ 0, /* nrrdField_space */ 0, /* nrrdField_space_dimension */ 1, /* nrrdField_sizes */ 1, /* nrrdField_spacings */ 1, /* nrrdField_thicknesses */ 1, /* nrrdField_axis_mins */ 1, /* nrrdField_axis_maxs */ 1, /* nrrdField_space_directions */ 1, /* nrrdField_centers */ 1, /* nrrdField_kinds */ 1, /* nrrdField_labels */ 1, /* nrrdField_units */ 0, /* nrrdField_min */ 0, /* nrrdField_max */ 0, /* nrrdField_old_min */ 0, /* nrrdField_old_max */ 0, /* nrrdField_endian */ 0, /* nrrdField_encoding */ 0, /* nrrdField_line_skip */ 0, /* nrrdField_byte_skip */ 0, /* nrrdField_keyvalue */ 0, /* nrrdField_sample_units */ 0, /* nrrdField_space_units */ 0, /* nrrdField_space_origin */ 0, /* nrrdField_measurement_frame */ 0 /* nrrdField_data_file */ }; /* ** _nrrdFieldValidInText[] ** ** these fields are valid embedded in plain text comments ** This does NOT include the fields who's values are constrained ** the plain text format itself. */ const int _nrrdFieldValidInText[NRRD_FIELD_MAX+1] = { 0, /* nrrdField_unknown */ 1, /* nrrdField_comment */ 1, /* nrrdField_content */ 0, /* nrrdField_number */ 0, /* nrrdField_type: decided AGAINST plain text holding general type (but I forget why ...) */ 0, /* nrrdField_block_size */ 1, /* nrrdField_dimension: but can only be 1 or 2 */ 0, /* nrrdField_space */ 0, /* nrrdField_space_dimension */ 0, /* nrrdField_sizes */ 1, /* nrrdField_spacings */ 1, /* nrrdField_thicknesses */ 1, /* nrrdField_axis_mins */ 1, /* nrrdField_axis_maxs */ 1, /* nrrdField_space_directions */ 1, /* nrrdField_centers */ 1, /* nrrdField_kinds */ 1, /* nrrdField_labels */ 1, /* nrrdField_units */ 0, /* nrrdField_min */ 0, /* nrrdField_max */ 1, /* nrrdField_old_min */ 1, /* nrrdField_old_max */ 0, /* nrrdField_endian */ 0, /* nrrdField_encoding */ 0, /* nrrdField_line_skip */ 0, /* nrrdField_byte_skip */ 0, /* nrrdField_keyvalue */ 0, /* nrrdField_sample_units */ 0, /* nrrdField_space_units */ 0, /* nrrdField_space_origin */ 0, /* nrrdField_measurement_frame */ 0 /* nrrdField_data_file */ }; /* ** _nrrdFieldRequired[] ** ** regardless of whether its a nrrd, PNM, or plain text, these things ** need to be conveyed, either explicity or implicitly */ const int _nrrdFieldRequired[NRRD_FIELD_MAX+1] = { 0, /* "Ernesto \"Che\" Guevara" */ 0, /* "#" */ 0, /* nrrdField_content */ 0, /* nrrdField_number */ 1, /* nrrdField_type */ 0, /* nrrdField_block size */ 1, /* nrrdField_dimension */ 0, /* nrrdField_space */ 0, /* nrrdField_space_dimension */ 1, /* nrrdField_sizes */ 0, /* nrrdField_spacings */ 0, /* nrrdField_thicknesses */ 0, /* nrrdField_axis mins */ 0, /* nrrdField_axis maxs */ 0, /* nrrdField_space_directions */ 0, /* nrrdField_centers */ 0, /* nrrdField_kinds */ 0, /* nrrdField_labels */ 0, /* nrrdField_units */ 0, /* nrrdField_min */ 0, /* nrrdField_max */ 0, /* nrrdField_old min */ 0, /* nrrdField_old max */ 0, /* nrrdField_endian */ 1, /* nrrdField_encoding */ 0, /* nrrdField_line_skip */ 0, /* nrrdField_byte_skip */ 0, /* nrrdField_keyvalue */ 0, /* nrrdField_sample_units */ 0, /* nrrdField_space_units */ 0, /* nrrdField_space_origin */ 0, /* nrrdField_measurement_frame */ 0 /* nrrdField_data file */ }; cmtk-3.0.0/Utilities/NrrdIO/000-README.txt0000644000177700000170000001353012041601331016603 0ustar torstenman--------------------------------------------------------------------------- License ------------------------------------------------------------------- --------------------------------------------------------------------------- NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. --------------------------------------------------------------------------- General information ------------------------------------------------------- --------------------------------------------------------------------------- ** NOTE: These source files have been copied and/or modified from Teem, ** . Teem is licensed under a weakened GNU Lesser Public ** License (the weakening is to remove burdens on those releasing binaries ** that statically link against Teem) . The non-reciprocal licensing defined ** above applies to only the source files in the NrrdIO distribution, and not ** to Teem. NrrdIO is a modified and highly abbreviated version of the Teem. NrrdIO contains only the source files (or portions thereof) required for creating and destroying nrrds, and for getting them into and out of files. The NrrdIO sources are created from the Teem sources by using GNU Make (pre-GNUmakefile in the NrrdIO distribution). NrrdIO makes it very easy to add support for the NRRD file format to your program, which is a good thing considering and design and flexibility of the NRRD file format, and the existence of the "unu" command-line tool for operating on nrrds. Using NrrdIO requires exactly one header file, "NrrdIO.h", and exactly one library, libNrrdIO. Currently, the API presented by NrrdIO is a strict subset of the Teem API. There is no additional encapsulation or abstraction. This could be annoying in the sense that you still have to deal with the biff (for error messages) and the air (for utilities) library function calls. Or it could be good and sane in the sense that code which uses NrrdIO can be painlessly "upgraded" to use more of Teem. Also, the API documentation for the same functionality in Teem will apply directly to NrrdIO. NrrdIO was originally created with the help of Josh Cates in order to add support for the NRRD file format to the Insight Toolkit (ITK). --------------------------------------------------------------------------- NrrdIO API crash course --------------------------------------------------- --------------------------------------------------------------------------- Please read . The functions that are explained in detail are all present in NrrdIO. Be aware, however, that NrrdIO currently supports ONLY the NRRD file format, and not: PNG, PNM, VTK, or EPS. The functionality in Teem's nrrd library which is NOT in NrrdIO is basically all those non-trivial manipulations of the values in the nrrd, or their ordering in memory. Still, NrrdIO can do a fair amount, namely all the functions listed in these sections of the "Overview of rest of API" in the above web page: - Basic "methods" - Manipulation of per-axis meta-information - Utility functions - Comments in nrrd - Key/value pairs - Endianness (byte ordering) - Getting/Setting values (crude!) - Input from, Output to files --------------------------------------------------------------------------- Files comprising NrrdIO --------------------------------------------------- --------------------------------------------------------------------------- NrrdIO.h: The single header file that declares all the functions and variables that NrrdIO provides. sampleIO.c: Tiny little command-line program demonstrating the basic NrrdIO API. Read this for examples of how NrrdIO is used to read and write NRRD files. CMakeLists.txt: to build NrrdIO with CMake pre-GNUmakefile: how NrrdIO sources are created from the Teem sources. Requires that TEEM_SRC_ROOT be set, and uses the following two files. tail.pl, unteem.pl: used to make small modifications to the source files to convert them from Teem to NrrdIO sources mangle.pl: used to generate a #include file for name-mangling the external symbols in the NrrdIO library, to avoid possible problems with programs that link with both NrrdIO and the rest of Teem. preamble.c: the preamble describing the non-copyleft licensing of NrrdIO. qnanhibit.c: discover a variable which, like endianness, is architecture dependent and which is required for building NrrdIO (as well as Teem), but unlike endianness, is completely obscure and unheard of. encodingBzip2.c, formatEPS.c, formatPNG.c, formatPNM.c, formatText.c, formatVTK.c: These files create stubs for functionality which is fully present in Teem, but which has been removed from NrrdIO in the interest of simplicity. The filenames are in fact unfortunately misleading, but they should be understood as listing the functionality that is MISSING in NrrdIO. All other files: copied/modified from the air, biff, and nrrd libraries of Teem. cmtk-3.0.0/Utilities/NrrdIO/keyvalue.c0000644000177700000170000002113212041601331016576 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /*** **** NONE of the nrrdKeyValue functions use biff. **** They don't use them now, and they never should. **** Unless I change my mind. ***/ /* ******** nrrdKeyValueSize ** ** returns the number of key/value pairs in a nrrd */ unsigned int nrrdKeyValueSize(const Nrrd *nrrd) { if (!nrrd) { return 0; } return nrrd->kvpArr->len; } /* ******** nrrdKeyValueIndex ** ** given an int in [0 .. #key/value pairs - 1], sets *keyP and *valueP ** to put to the corresponding key and value. ** ** NOTE: whether or not *keyP and *valueP are set to pointers to memory ** "inside" the nrrd struct (pointers which you had better not free()!) ** is controlled by nrrdStateKeyValueReturnInternalPointers, which defaults ** to AIR_FALSE */ void nrrdKeyValueIndex(const Nrrd *nrrd, char **keyP, char **valueP, unsigned int ki) { if (!( nrrd && keyP && valueP && ki < nrrd->kvpArr->len )) { if (keyP) { *keyP = NULL; } if (valueP) { *valueP = NULL; } return; } if (nrrdStateKeyValueReturnInternalPointers) { *keyP = nrrd->kvp[0 + 2*ki]; *valueP = nrrd->kvp[1 + 2*ki]; } else { *keyP = airStrdup(nrrd->kvp[0 + 2*ki]); *valueP = airStrdup(nrrd->kvp[1 + 2*ki]); } return; } static unsigned int _kvpIdxFind(const Nrrd *nrrd, const char *key, int *found) { unsigned int nk, ki, ret; nk = nrrd->kvpArr->len; for (ki=0; kikvp[0 + 2*ki], key)) { break; } } if (kikvpArr->len; for (ki=0; kikvp[0 + 2*ki] = (char *)airFree(nrrd->kvp[0 + 2*ki]); nrrd->kvp[1 + 2*ki] = (char *)airFree(nrrd->kvp[1 + 2*ki]); } airArrayLenSet(nrrd->kvpArr, 0); return; } int nrrdKeyValueErase(Nrrd *nrrd, const char *key) { unsigned int nk, ki; int found; if (!( nrrd && key )) { /* got NULL pointer */ return 1; } ki = _kvpIdxFind(nrrd, key, &found); if (!found) { return 0; } nrrd->kvp[0 + 2*ki] = (char *)airFree(nrrd->kvp[0 + 2*ki]); nrrd->kvp[1 + 2*ki] = (char *)airFree(nrrd->kvp[1 + 2*ki]); nk = nrrd->kvpArr->len; for (; kikvp[0 + 2*ki] = nrrd->kvp[0 + 2*(ki+1)]; nrrd->kvp[1 + 2*ki] = nrrd->kvp[1 + 2*(ki+1)]; } airArrayLenIncr(nrrd->kvpArr, -1); return 0; } /* ******** nrrdKeyValueAdd ** ** This will COPY the given strings, and so does not depend on ** them existing past the return of this function ** ** NOTE: Despite what might be most logical, there is no effort made ** here to cleanup key or value, including any escaping or filtering ** that might be warranted for white space other than \n ** ** does NOT use BIFF */ int nrrdKeyValueAdd(Nrrd *nrrd, const char *key, const char *value) { unsigned int ki; int found; if (!( nrrd && key && value )) { /* got NULL pointer */ return 1; } if (!strlen(key)) { /* reject empty keys */ return 1; } ki = _kvpIdxFind(nrrd, key, &found); if (found) { /* over-writing value for an existing key, so have to free old value */ airFree(nrrd->kvp[1 + 2*ki]); nrrd->kvp[1 + 2*ki] = airStrdup(value); } else { /* adding value for a new key */ ki = airArrayLenIncr(nrrd->kvpArr, 1); nrrd->kvp[0 + 2*ki] = airStrdup(key); nrrd->kvp[1 + 2*ki] = airStrdup(value); } return 0; } /* ******** nrrdKeyValueGet ** ** NOTE: whether or not *keyP and *valueP are set to pointers to memory ** "inside" the nrrd struct (pointers which you had better not free()!) ** is controlled by nrrdStateKeyValueReturnInternalPointers, which defaults ** to AIR_FALSE ** ** does NOT use BIFF */ char * nrrdKeyValueGet(const Nrrd *nrrd, const char *key) { char *ret; unsigned int ki; int found; if (!( nrrd && key )) { /* got NULL pointer */ return NULL; } ki = _kvpIdxFind(nrrd, key, &found); if (found) { if (nrrdStateKeyValueReturnInternalPointers) { ret = nrrd->kvp[1 + 2*ki]; } else { ret = airStrdup(nrrd->kvp[1 + 2*ki]); } } else { ret = NULL; } return ret; } /* ** Does the escaping of special characters in a string that ** is being written either to "FILE *file" or "char *dst" ** (WHICH IS ASSUMED to be allocated to be big enough!) ** Which characters to escape should be put in string "toescape" ** currently supported: \n \ " ** Also, converts characters in "tospace" to a space. Being in ** toescape trumps being in tospace, so tospace can be harmlessly ** set to, say, AIR_WHITESPACE. ** ** accident of history that this function is in this file */ void _nrrdWriteEscaped(FILE *file, char *dst, const char *str, const char *toescape, const char *tospace) { /* static const char me[]="_nrrdWriteEscaped"; */ size_t ci, gslen; /* given strlen */ gslen = strlen(str); for (ci=0; cikvpArr->len; ki++) { key = nin->kvp[0 + 2*ki]; value = nin->kvp[1 + 2*ki]; if (nrrdKeyValueAdd(nout, key, value)) { return 3; } } return 0; } cmtk-3.0.0/Utilities/NrrdIO/accessors.c0000644000177700000170000001650412041601331016745 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" #include "float.h" /* ** making these typedefs here allows us to used one token for both ** constructing function names, and for specifying argument types */ typedef signed char CH; typedef unsigned char UC; typedef signed short SH; typedef unsigned short US; /* Microsoft apparently uses 'IN' as a keyword, so we changed 'IN' to 'JN'. */ typedef signed int JN; typedef unsigned int UI; typedef airLLong LL; /* ui64 to double conversion is not implemented, sorry */ #if _MSC_VER < 1300 typedef airLLong UL; #else typedef airULLong UL; #endif typedef float FL; typedef double DB; #define MAP(F, A) \ F(A, CH) \ F(A, UC) \ F(A, SH) \ F(A, US) \ F(A, JN) \ F(A, UI) \ F(A, LL) \ F(A, UL) \ F(A, FL) \ F(A, DB) /* ** _nrrdLoad( *v) ** ** Dereferences v as TB*, casts it to TA, returns it. */ #define LOAD_DEF(TA, TB) \ static TA \ _nrrdLoad##TA##TB(TB *v) { \ return (TA)(*v); \ } #define LOAD_LIST(TA, TB) \ (TA (*)(const void *))_nrrdLoad##TA##TB, MAP(LOAD_DEF, UI) MAP(LOAD_DEF, JN) MAP(LOAD_DEF, FL) MAP(LOAD_DEF, DB) unsigned int (* nrrdUILoad[NRRD_TYPE_MAX+1])(const void*) = { NULL, MAP(LOAD_LIST, UI) NULL }; int (* nrrdILoad[NRRD_TYPE_MAX+1])(const void*) = { NULL, MAP(LOAD_LIST, JN) NULL }; float (* nrrdFLoad[NRRD_TYPE_MAX+1])(const void*) = { NULL, MAP(LOAD_LIST, FL) NULL }; double (* nrrdDLoad[NRRD_TYPE_MAX+1])(const void*) = { NULL, MAP(LOAD_LIST, DB) NULL }; /* ** _nrrdStore( *v, j) ** ** Takes a TA j, and stores it in *v, thereby implicitly casting it to TB. ** Returns the result of the assignment, which may not be the same as ** the value that was passed in. */ #define STORE_DEF(TA, TB) \ static TA \ _nrrdStore##TA##TB(TB *v, TA j) { \ return (TA)(*v = (TB)j); \ } #define STORE_LIST(TA, TB) \ (TA (*)(void *, TA))_nrrdStore##TA##TB, MAP(STORE_DEF, UI) MAP(STORE_DEF, JN) MAP(STORE_DEF, FL) MAP(STORE_DEF, DB) unsigned int (* nrrdUIStore[NRRD_TYPE_MAX+1])(void *, unsigned int) = { NULL, MAP(STORE_LIST, UI) NULL }; int (* nrrdIStore[NRRD_TYPE_MAX+1])(void *, int) = { NULL, MAP(STORE_LIST, JN) NULL }; float (* nrrdFStore[NRRD_TYPE_MAX+1])(void *, float) = { NULL, MAP(STORE_LIST, FL) NULL }; double (* nrrdDStore[NRRD_TYPE_MAX+1])(void *, double) = { NULL, MAP(STORE_LIST, DB) NULL }; /* ** _nrrdLookup( *v, size_t I) ** ** Looks up element I of TB array v, and returns it cast to a TA. */ #define LOOKUP_DEF(TA, TB) \ static TA \ _nrrdLookup##TA##TB(TB *v, size_t I) { \ return (TA)v[I]; \ } #define LOOKUP_LIST(TA, TB) \ (TA (*)(const void*, size_t))_nrrdLookup##TA##TB, MAP(LOOKUP_DEF, UI) MAP(LOOKUP_DEF, JN) MAP(LOOKUP_DEF, FL) MAP(LOOKUP_DEF, DB) unsigned int (* nrrdUILookup[NRRD_TYPE_MAX+1])(const void *, size_t) = { NULL, MAP(LOOKUP_LIST, UI) NULL }; int (* nrrdILookup[NRRD_TYPE_MAX+1])(const void *, size_t) = { NULL, MAP(LOOKUP_LIST, JN) NULL }; float (* nrrdFLookup[NRRD_TYPE_MAX+1])(const void *, size_t) = { NULL, MAP(LOOKUP_LIST, FL) NULL }; double (* nrrdDLookup[NRRD_TYPE_MAX+1])(const void *, size_t) = { NULL, MAP(LOOKUP_LIST, DB) NULL }; /* ** _nrrdInsert( *v, size_t I, j) ** ** Given TA j, stores it in v[i] (implicitly casting to TB). ** Returns the result of the assignment, which may not be the same as ** the value that was passed in. */ #define INSERT_DEF(TA, TB) \ static TA \ _nrrdInsert##TA##TB(TB *v, size_t I, TA j) { \ return (TA)(v[I] = (TB)j); \ } #define INSERT_LIST(TA, TB) \ (TA (*)(void*, size_t, TA))_nrrdInsert##TA##TB, MAP(INSERT_DEF, UI) MAP(INSERT_DEF, JN) MAP(INSERT_DEF, FL) MAP(INSERT_DEF, DB) unsigned int (* nrrdUIInsert[NRRD_TYPE_MAX+1])(void *, size_t, unsigned int) = { NULL, MAP(INSERT_LIST, UI) NULL }; int (* nrrdIInsert[NRRD_TYPE_MAX+1])(void *, size_t, int) = { NULL, MAP(INSERT_LIST, JN) NULL }; float (* nrrdFInsert[NRRD_TYPE_MAX+1])(void *, size_t, float) = { NULL, MAP(INSERT_LIST, FL) NULL }; double (* nrrdDInsert[NRRD_TYPE_MAX+1])(void *, size_t, double) = { NULL, MAP(INSERT_LIST, DB) NULL }; /* ******** nrrdSprint ** ** Dereferences pointer v and sprintf()s that value into given string s, ** returns the result of sprintf() ** ** There is obviously no provision for ensuring that the sprint'ing ** doesn't overflow the buffer, which is unfortunate... */ static int _nrrdSprintCH(char *s, const CH *v) { return sprintf(s, "%d", *v); } static int _nrrdSprintUC(char *s, const UC *v) { return sprintf(s, "%u", *v); } static int _nrrdSprintSH(char *s, const SH *v) { return sprintf(s, "%d", *v); } static int _nrrdSprintUS(char *s, const US *v) { return sprintf(s, "%u", *v); } static int _nrrdSprintIN(char *s, const JN *v) { return sprintf(s, "%d", *v); } static int _nrrdSprintUI(char *s, const UI *v) { return sprintf(s, "%u", *v); } static int _nrrdSprintLL(char *s, const LL *v) { return sprintf(s, AIR_LLONG_FMT, *v); } static int _nrrdSprintUL(char *s, const UL *v) { return sprintf(s, AIR_ULLONG_FMT, *v); } /* HEY: sizeof(float) and sizeof(double) assumed here, since we're basing "8" and "17" on 6 == FLT_DIG and 15 == DBL_DIG, which are digits of precision for floats and doubles, respectively */ static int _nrrdSprintFL(char *s, const FL *v) { return airSinglePrintf(NULL, s, "%.8g", (double)(*v)); } static int _nrrdSprintDB(char *s, const DB *v) { return airSinglePrintf(NULL, s, "%.17g", *v); } int (* nrrdSprint[NRRD_TYPE_MAX+1])(char *, const void *) = { NULL, (int (*)(char *, const void *))_nrrdSprintCH, (int (*)(char *, const void *))_nrrdSprintUC, (int (*)(char *, const void *))_nrrdSprintSH, (int (*)(char *, const void *))_nrrdSprintUS, (int (*)(char *, const void *))_nrrdSprintIN, (int (*)(char *, const void *))_nrrdSprintUI, (int (*)(char *, const void *))_nrrdSprintLL, (int (*)(char *, const void *))_nrrdSprintUL, (int (*)(char *, const void *))_nrrdSprintFL, (int (*)(char *, const void *))_nrrdSprintDB, NULL}; cmtk-3.0.0/Utilities/NrrdIO/NrrdConfigure.h.in0000644000177700000170000000232411550636332020151 0ustar torstenman// Configure compile time dependent code // BUG: 0005904 shows that special action must be taken for Mac 64 bit systems. // See: http://public.kitware.com/Bug/view.php?id=5904 /* 32 or 64 bits. */ /* All compilers that support Mac OS X define __LP64__ if the architecture is 64 bits. */ #define CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@ #if !defined(__APPLE__) #if CMAKE_SIZEOF_VOID_P == 8 #define TEEM_32BIT 0 #else #define TEEM_32BIT 1 #endif #elif defined(__LP64__) && __LP64__ #define TEEM_32BIT 0 #else #define TEEM_32BIT 1 #endif /* what byte order */ /* All compilers that support Mac OS X define either __BIG_ENDIAN__ or __LITTLE_ENDIAN__ to match the endianness of the architecture being compiled for. This is not necessarily the same as the architecture of the machine doing the building. In order to support Universal Binaries on Mac OS X, we prefer those defines to decide the endianness. On other platform, we use the result of the TRY_RUN. */ #if !defined(__APPLE__) #if @CMAKE_WORDS_BIGENDIAN@ #define TEEM_ENDIAN 4321 #else #define TEEM_ENDIAN 1234 #endif #else #if defined(__BIG_ENDIAN__) #define TEEM_ENDIAN 4321 #else #define TEEM_ENDIAN 1234 #endif #endif cmtk-3.0.0/Utilities/NrrdIO/encodingGzip.c0000644000177700000170000002542312041601331017400 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" static int _nrrdEncodingGzip_available(void) { #if TEEM_ZLIB return AIR_TRUE; #else return AIR_FALSE; #endif } /* ** Maximum size that allow zlib to try to read or write at once. ** The real limit is UINT_MAX, but a smaller value here permits ** exercising the multi-chunk capability of the code below. */ static unsigned int _nrrdZlibMaxChunk = UINT_MAX; /* ** nio->byteSkip < 0 functionality contributed by Katharina Quintus */ static int _nrrdEncodingGzip_read(FILE *file, void *_data, size_t elNum, Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdEncodingGzip_read"; #if TEEM_ZLIB size_t sizeData, sizeRed; int error; long int bi; unsigned int didread, sizeChunk, maxChunk; char *data; gzFile gzfin; airPtrPtrUnion appu; sizeData = nrrdElementSize(nrrd)*elNum; /* Create the gzFile for reading in the gzipped data. */ if ((gzfin = _nrrdGzOpen(file, "rb")) == Z_NULL) { /* there was a problem */ biffAddf(NRRD, "%s: error opening gzFile", me); return 1; } /* keeps track of how many bytes have been successfully read in */ sizeRed = 0; /* zlib can only handle data sizes up to UINT_MAX ==> if there's more than UINT_MAX bytes to read in, we read in in chunks. However, we wrap a value _nrrdZlibMaxChunk around UINT_MAX for testing purposes. Given how sizeChunk is used below, we also cap chunk size at _nrrdZlibMaxChunk/2 to prevent overflow. */ maxChunk = _nrrdZlibMaxChunk/2; sizeChunk = AIR_CAST(unsigned int, AIR_MIN(sizeData, maxChunk)); if (nio->byteSkip < 0) { /* We don't know the size of the size to skip before the data, so decompress the data first into a temporary memory buffer. Then the byteskipping is then just memcpy-ing the appropriate region of memory from "buff" into the given "_data" pointer */ char *buff; airArray *buffArr; long backwards; /* setting the airArray increment to twice the chunk size means that for headers that are small compared to the data, the airArray never actually has to reallocate. The unit is 1 because we are managing the reading in terms of bytes (sizeof(char)==1 by definition) */ buff = NULL; appu.c = &buff; buffArr = airArrayNew(appu.v, NULL, 1, 2*sizeChunk); airArrayLenSet(buffArr, sizeChunk); if (!( buffArr && buffArr->data )) { biffAddf(NRRD, "%s: couldn't initialize airArray\n", me); return 1; } /* we keep reading in chunks as long as there hasn't been an error, and we haven't hit EOF (EOF signified by read == 0). Unlike the code below (for positive byteskip), we are obligated to read until the bitter end, and can't update sizeChunk to encompass only the required data. */ while (!(error = _nrrdGzRead(gzfin, buff + sizeRed, sizeChunk, &didread)) && didread > 0) { sizeRed += didread; if (didread >= sizeChunk) { /* we were able to read as much data as we requested, maybe there is more, so we need to make our temp buffer bigger */ unsigned int newlen = buffArr->len + sizeChunk; if (newlen < buffArr->len) { biffAddf(NRRD, "%s: array size will exceed uint capacity", me); return 1; } airArrayLenSet(buffArr, newlen); if (!buffArr->data) { biffAddf(NRRD, "%s: couldn't re-allocate data buffer", me); return 1; } } } if (error) { biffAddf(NRRD, "%s: error reading from gzFile", me); return 1; } /* backwards is (positive) number of bytes AFTER data that we ignore */ backwards = -nio->byteSkip - 1; if (sizeRed < sizeData + AIR_CAST(size_t, backwards)) { char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL]; biffAddf(NRRD, "%s: expected %s bytes but received only %s", me, airSprintSize_t(stmp1, sizeData + AIR_CAST(size_t, backwards)), airSprintSize_t(stmp2, sizeRed)); return 1; } /* also handles nio->byteSkip == -N-1 signifying extra N bytes at end */ memcpy(_data, buff + sizeRed - sizeData - backwards, sizeData); airArrayNuke(buffArr); } else { /* no negative byteskip: after byteskipping, we can read directly into given data buffer */ if (nio->byteSkip > 0) { for (bi=0; bibyteSkip; bi++) { unsigned char b; /* Check to see if a single byte was able to be read. */ if (_nrrdGzRead(gzfin, &b, 1, &didread) != 0 || didread != 1) { biffAddf(NRRD, "%s: hit an error skipping byte %ld of %ld", me, bi, nio->byteSkip); return 1; } } } /* Pointer to chunks as we read them. */ data = AIR_CAST(char *, _data); while (!(error = _nrrdGzRead(gzfin, data, sizeChunk, &didread)) && didread > 0) { /* Increment the data pointer to the next available chunk. */ data += didread; sizeRed += didread; /* We only want to read as much data as we need, so we need to check to make sure that we don't request data that might be there but that we don't want. This will reduce sizeChunk when we get to the last block (which may be smaller than the original sizeChunk). */ if (sizeData >= sizeRed && sizeData - sizeRed < sizeChunk) { sizeChunk = AIR_CAST(unsigned int, sizeData - sizeRed); } } if (error) { biffAddf(NRRD, "%s: error reading from gzFile", me); return 1; } /* Check to see if we got out as much as we thought we should. */ if (sizeRed != sizeData) { char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL]; biffAddf(NRRD, "%s: expected %s bytes but received %s", me, airSprintSize_t(stmp1, sizeData), airSprintSize_t(stmp2, sizeRed)); return 1; } } /* Close the gzFile. Since _nrrdGzClose does not close the FILE* we will not encounter problems when dataFile is closed later. */ if (_nrrdGzClose(gzfin)) { biffAddf(NRRD, "%s: error closing gzFile", me); return 1; } return 0; #else AIR_UNUSED(file); AIR_UNUSED(_data); AIR_UNUSED(elNum); AIR_UNUSED(nrrd); AIR_UNUSED(nio); biffAddf(NRRD, "%s: sorry, this nrrd not compiled with gzip enabled", me); return 1; #endif } static int _nrrdEncodingGzip_write(FILE *file, const void *_data, size_t elNum, const Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdEncodingGzip_write"; #if TEEM_ZLIB size_t sizeData, sizeWrit; int fmt_i=0, error; const char *data; char fmt[4]; gzFile gzfout; unsigned int wrote, sizeChunk; sizeData = nrrdElementSize(nrrd)*elNum; /* Set format string based on the NrrdIoState parameters. */ fmt[fmt_i++] = 'w'; if (0 <= nio->zlibLevel && nio->zlibLevel <= 9) fmt[fmt_i++] = AIR_CAST(char, '0' + nio->zlibLevel); switch (nio->zlibStrategy) { case nrrdZlibStrategyHuffman: fmt[fmt_i++] = 'h'; break; case nrrdZlibStrategyFiltered: fmt[fmt_i++] = 'f'; break; case nrrdZlibStrategyDefault: default: break; } fmt[fmt_i] = 0; /* Create the gzFile for writing in the gzipped data. */ if ((gzfout = _nrrdGzOpen(file, fmt)) == Z_NULL) { /* there was a problem */ biffAddf(NRRD, "%s: error opening gzFile", me); return 1; } /* zlib can only handle data sizes up to UINT_MAX ==> if there's more than UINT_MAX bytes to write out, we write out in chunks. As above, we wrap _nrrdZlibMaxChunk around UINT_MAX for testing purposes. */ sizeChunk = AIR_CAST(unsigned int, AIR_MIN(sizeData, _nrrdZlibMaxChunk)); /* keeps track of what how much has been successfully written */ sizeWrit = 0; /* Pointer to the chunks as we write them. */ data = AIR_CAST(const char *, _data); /* Ok, now we can begin writing. */ while ((error = _nrrdGzWrite(gzfout, AIR_CVOIDP(data), sizeChunk, &wrote)) == 0 && wrote > 0) { /* Increment the data pointer to the next available spot. */ data += wrote; sizeWrit += wrote; /* We only want to write as much data as we need, so we need to check to make sure that we don't write more data than is there. This will reduce sizeChunk when we get to the last block (which may be smaller than the original sizeChunk). */ if (sizeData >= sizeWrit && sizeData - sizeWrit < sizeChunk) sizeChunk = AIR_CAST(unsigned int, sizeData - sizeWrit); } if (error) { biffAddf(NRRD, "%s: error writing to gzFile", me); return 1; } /* Check to see if we wrote out as much as we thought we should. */ if (sizeWrit != sizeData) { char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL]; biffAddf(NRRD, "%s: expected to write %s bytes, but only wrote %s", me, airSprintSize_t(stmp1, sizeData), airSprintSize_t(stmp2, sizeWrit)); return 1; } /* Close the gzFile. Since _nrrdGzClose does not close the FILE* we will not encounter problems when dataFile is closed later. */ if (_nrrdGzClose(gzfout)) { biffAddf(NRRD, "%s: error closing gzFile", me); return 1; } return 0; #else AIR_UNUSED(file); AIR_UNUSED(_data); AIR_UNUSED(elNum); AIR_UNUSED(nrrd); AIR_UNUSED(nio); biffAddf(NRRD, "%s: sorry, this nrrd not compiled with zlib " "(needed for gzip) enabled", me); return 1; #endif } const NrrdEncoding _nrrdEncodingGzip = { "gzip", /* name */ "raw.gz", /* suffix */ AIR_TRUE, /* endianMatters */ AIR_TRUE, /* isCompression */ _nrrdEncodingGzip_available, _nrrdEncodingGzip_read, _nrrdEncodingGzip_write }; const NrrdEncoding *const nrrdEncodingGzip = &_nrrdEncodingGzip; cmtk-3.0.0/Utilities/NrrdIO/teemEndian.h0000644000177700000170000000311211550636332017042 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* ** the end result of this is that the source file which includes ** this can be sure that TEEM_ENDIAN is set, and can be sure that ** it is set to either 1234 or 4321 */ #ifndef TEEM_ENDIAN # error TEEM_ENDIAN not defined, see architecture-specific .mk file or check compilation options #elif TEEM_ENDIAN == 1234 # /* okay, its little endian */ #elif TEEM_ENDIAN == 4321 # /* okay, its big endian */ #else # error TEEM_ENDIAN not set to 1234 (little endian) or 4321 (big endian), see architecture-specific .mk file or check compilation options #endif cmtk-3.0.0/Utilities/NrrdIO/formatNRRD.c0000644000177700000170000007130612041601331016737 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /*** **** Info about string handling for fields The Nrrd format can include strings in different fields, with different rules for each one; see http://teem.sourceforge.net/nrrd/format.html Below is some documentation of how the strings are handled, which is mostly a documentation of old (long-established) code, the gathering of which uncovered some problems and led to some new code (as of Thu Aug 23 09:32:11 CDT 2012). Conceptual inconsistencies in the different handlings of strings merit further review, including updating the file format spec (e.g. what non-ASCII characters can be allowed where? Unicode? what encoding? etc). This all also highlights the need for having a completely uniform way of setting these fields at one-time via the nrrd library (e.g. can use nrrdAxisInfoSet for "units" but there is no API for setting "space units"). Should that API flag as error if you try to include characters that can't be losslessly saved, or should it silently transform things? ** Comments: On disk, delimited by the NRRD_COMMENT_CHAR ('#') and the end of the line, but the format spec doesn't address any escaping. Input comments processed via: nrrd/formatNrrd.c/_nrrdFormatNRRD_read() --> nrrd/parseNrrd.c/_nrrdReadNrrdParse_comment() --> nrrd/comment.c/nrrdCommentAdd() --> air/string.c/airOneLinify() On write, output comments processed via: nrrd/formatNrrd.c/_nrrdFormatNRRD_write() --> air/string.c/airOneLinify() ==> There is no escaping of anything: white-space is compressed into a single ' '. Probably justified justified given format spec. ** Content: On disk, finished with the end of line. No mention of escaping in the format spec. Input content processed via: nrrd/formatNrrd.c/_nrrdFormatNRRD_read() --> nrrd/parseNrrd.c/_nrrdReadNrrdParse_content() which does NO processing, just airStrdup On write, output content processed via: nrrd/formatNrrd.c/_nrrdFormatNRRD_write() --> nrrd/write.c/_nrrdSprintFieldInfo() (maybe via _nrrdFprintFieldInfo()) --> air/string.c/airOneLinify() ==> not only is there no escaping, but there's some assymmetry in the use of airOneLinify. If information is being encoded in the number of contiguous spaces in the content, its preserved on input but not on output. Still, there's no chance of writing a broken file. ** key/value pairs: The keys and values are separated by ":=", and the format spec says (string) "\n" means (character) '\n' and "\\" means '\\'. On input, both keys and values processed via: nrrd/formatNrrd.c/_nrrdFormatNRRD_read() --> nrrd/parseNrrd.c/_nrrdReadNrrdParse_keyvalue() --> air/string.c/airUnescape(), which deals with "\n" and "\\" ONLY (not quotes, not other whitespace), and then --> nrrd/keyvalue.c/nrrdKeyValueAdd(), which only does an airStrdup On output, keys and values processed via nrrd/formatNrrd.c/_nrrdFormatNRRD_write() --> nrrd/keyvalue.c/_nrrdKeyValueWrite() --> nrrd/keyvalue.c/_nrrdWriteEscaped() which is invoked to escape \n and \, and (NOTE!) to convert all other whitespace to ' ' Aside from the file format spec, the nrrd *library* does not really have any strictures about the characters that are allowed at run-time in key/values (and indeed nrrdKeyValueAdd just does an airStrdup). But without converting or escaping, say, '\r', you'll generate a broken NRRD file, hence the new handling of converting other whitespace to ' '. ** labels and units: A "-delimited string per axis. Format spec is very specific for labels, and implies units are the same: "Within each label, double quotes may be included by escaping them (\"), but no other form of escaping is supported". On input: nrrd/formatNrrd.c/_nrrdFormatNRRD_read() --> nrrd/parseNrrd.c/_nrrdReadNrrdParse_labels() or _nrrdReadNrrdParse_units() --> nrrd/parseNrrd.c/_nrrdGetQuotedString() which does the work of unescaping \" On output: nrrd/formatNrrd.c/_nrrdFormatNRRD_write() --> nrrd/write.c/_nrrdSprintFieldInfo() (maybe via _nrrdFprintFieldInfo()) --> nrrd/keyvalue.c/_nrrdWriteEscaped() which is invoked to escape ", and (NOTE!) to convert all other whitespace to ' ' Same concern above about characters that when written would generate a bad NRRD file, but which are not documented as escape-able in label or unit ** space units: A "-delimited string per axis of *world-space* (NOT the same a per-axis field, like units). Format is sadly silent on issue of escaping for these; so we might as well treat them like labels & units units. On input: nrrd/formatNrrd.c/_nrrdFormatNRRD_read() --> nrrd/parseNrrd.c/_nrrdReadNrrdParse_space_units --> nrrd/parseNrrd.c/_nrrdGetQuotedString() which does the work of unescaping \" On output: nrrd/formatNrrd.c/_nrrdFormatNRRD_write() --> nrrd/write.c/_nrrdSprintFieldInfo() (maybe via _nrrdFprintFieldInfo()) --> nrrd/keyvalue.c/_nrrdWriteEscaped() which is invoked to escape ", and (NOTE!) to convert all other whitespace to ' ' ** sample units: like content and comments, not a quoted string. On input: nrrd/formatNrrd.c/_nrrdFormatNRRD_read() --> nrrd/parseNrrd.c/_nrrdReadNrrdParse_sample_units() which does nothing except a strdup On output: nrrd/formatNrrd.c/_nrrdFormatNRRD_write() --> nrrd/write.c/_nrrdSprintFieldInfo() (maybe via _nrrdFprintFieldInfo()) --> air/string.c/airOneLinify() **** ***/ #define MAGIC "NRRD" #define MAGIC0 "NRRD00.01" #define MAGIC1 "NRRD0001" #define MAGIC2 "NRRD0002" #define MAGIC3 "NRRD0003" #define MAGIC4 "NRRD0004" #define MAGIC5 "NRRD0005" const char * _nrrdFormatURLLine0 = "Complete NRRD file format specification at:"; const char * _nrrdFormatURLLine1 = "http://teem.sourceforge.net/nrrd/format.html"; void nrrdIoStateDataFileIterBegin(NrrdIoState *nio) { nio->dataFNIndex = 0; return; } /* this macro suggested by Bryan Worthen */ /* if str = '-', strcmp() is 0, && short circuits, return false ** else str != '-' ** if str[1] = ':', its probably a windows full path, != is 0, return false ** else str[1] != ':' ** if str[0] = '/', its a normal full path, return false */ #define _NEED_PATH(str) (strcmp("-", (str)) \ && ':' != (str)[1] \ && '/' != (str)[0]) /* ** this is responsible for the header-relative path processing ** ** NOTE: if the filename is "-", then because it does not start with '/', ** it would normally be prefixed by nio->path, so it needs special handling ** ** NOTE: this should work okay with nio->headerStringRead, I think ... */ int nrrdIoStateDataFileIterNext(FILE **fileP, NrrdIoState *nio, int reading) { static const char me[]="nrrdIoStateDataFileIterNext"; char *fname=NULL; int ii, needPath; unsigned int num, fi; size_t maxl; airArray *mop; mop = airMopNew(); airMopAdd(mop, (void*)fileP, (airMopper)airSetNull, airMopOnError); if (!fileP) { biffAddf(NRRD, "%s: got NULL pointer", me); airMopError(mop); return 1; } if (!_nrrdDataFNNumber(nio)) { biffAddf(NRRD, "%s: there appear to be zero datafiles!", me); airMopError(mop); return 1; } if (nio->dataFNIndex >= _nrrdDataFNNumber(nio)) { /* there is no next data file, but we don't make that an error (though as of Tue Oct 2 22:53:14 CDT 2012, GLK can't remember why this condition would ever occur) */ nio->dataFNIndex = _nrrdDataFNNumber(nio); airMopOkay(mop); *fileP = NULL; return 0; } /* HEY: some of this error checking is done far more often than needed */ if (nio->dataFNFormat || nio->dataFNArr->len) { needPath = AIR_FALSE; maxl = 0; if (nio->dataFNFormat) { needPath = _NEED_PATH(nio->dataFNFormat); /* assuming 10-digit integers is plenty big */ maxl = 10 + strlen(nio->dataFNFormat); } else { for (fi=0; fidataFNArr->len; fi++) { needPath |= _NEED_PATH(nio->dataFN[fi]); maxl = AIR_MAX(maxl, strlen(nio->dataFN[fi])); } } if (needPath && !airStrlen(nio->path)) { biffAddf(NRRD, "%s: need nio->path for header-relative datafiles", me); airMopError(mop); return 1; } fname = (char*)malloc(airStrlen(nio->path) + strlen("/") + maxl + 1); if (!fname) { biffAddf(NRRD, "%s: couldn't allocate filename buffer", me); airMopError(mop); return 1; } airMopAdd(mop, fname, airFree, airMopAlways); } if (nio->dataFNFormat) { /* ---------------------------------------------------------- */ /* --------- base.%d [] ------------- */ /* ---------------------------------------------------------- */ num = 0; for (ii = nio->dataFNMin; ((nio->dataFNStep > 0 && ii <= nio->dataFNMax) || (nio->dataFNStep < 0 && ii >= nio->dataFNMax)); ii += nio->dataFNStep) { if (num == nio->dataFNIndex) { break; } num += 1; } if (_NEED_PATH(nio->dataFNFormat)) { strcpy(fname, nio->path); strcat(fname, "/"); sprintf(fname + strlen(nio->path) + strlen("/"), nio->dataFNFormat, ii); } else { sprintf(fname, nio->dataFNFormat, ii); } } else if (nio->dataFNArr->len) { /* ---------------------------------------------------------- */ /* ------------------- LIST or single ----------------------- */ /* ---------------------------------------------------------- */ if (_NEED_PATH(nio->dataFN[nio->dataFNIndex])) { sprintf(fname, "%s/%s", nio->path, nio->dataFN[nio->dataFNIndex]); } else { strcpy(fname, nio->dataFN[nio->dataFNIndex]); } } /* else data file is attached */ if (nio->dataFNFormat || nio->dataFNArr->len) { *fileP = airFopen(fname, reading ? stdin : stdout, reading ? "rb" : "wb"); if (!(*fileP)) { biffAddf(NRRD, "%s: couldn't open \"%s\" (data file %u of %u) for %s", me, fname, nio->dataFNIndex+1, _nrrdDataFNNumber(nio), reading ? "reading" : "writing"); airMopError(mop); return 1; } } else { /* data file is attached */ if (nio->headerStringRead) { /* except we were never reading from a file to begin with, but this isn't an error */ *fileP = NULL; } else { *fileP = nio->headerFile; } } nio->dataFNIndex++; airMopOkay(mop); return 0; } /* ** we try to use the oldest format that will hold the nrrd */ int _nrrdFormatNRRD_whichVersion(const Nrrd *nrrd, NrrdIoState *nio) { int ret; if (_nrrdFieldInteresting(nrrd, nio, nrrdField_measurement_frame)) { ret = 5; } else if (_nrrdFieldInteresting(nrrd, nio, nrrdField_thicknesses) || _nrrdFieldInteresting(nrrd, nio, nrrdField_space) || _nrrdFieldInteresting(nrrd, nio, nrrdField_space_dimension) || _nrrdFieldInteresting(nrrd, nio, nrrdField_sample_units) || airStrlen(nio->dataFNFormat) || nio->dataFNArr->len > 1) { ret = 4; } else if (_nrrdFieldInteresting(nrrd, nio, nrrdField_kinds)) { ret = 3; } else if (nrrdKeyValueSize(nrrd)) { ret = 2; } else { ret = 1; } return ret; } static int _nrrdFormatNRRD_available(void) { return AIR_TRUE; } static int _nrrdFormatNRRD_nameLooksLike(const char *filename) { return (airEndsWith(filename, NRRD_EXT_NRRD) || airEndsWith(filename, NRRD_EXT_NHDR)); } static int _nrrdFormatNRRD_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { static const char me[]="_nrrdFormatNRRD_fitsInto"; if (!( nrrd && encoding )) { biffMaybeAddf(useBiff, NRRD, "%s: got NULL nrrd (%p) or encoding (%p)", me, AIR_CVOIDP(nrrd), AIR_CVOIDP(encoding)); return AIR_FALSE; } /* everything fits in a nrrd */ return AIR_TRUE; } static int _nrrdFormatNRRD_contentStartsLike(NrrdIoState *nio) { return (!strcmp(MAGIC0, nio->line) || !strcmp(MAGIC1, nio->line) || !strcmp(MAGIC2, nio->line) || !strcmp(MAGIC3, nio->line) || !strcmp(MAGIC4, nio->line) || !strcmp(MAGIC5, nio->line) ); } /* ** _nrrdHeaderCheck() ** ** minimal consistency checks on relationship between fields of nrrd, ** only to be used after the headers is parsed, and before the data is ** read, to make sure that information required for reading data is in ** fact known. ** ** NOTE: this is not the place to do the sort of checking done by ** nrrdCheck(), because it includes I/O-specific stuff ** */ int _nrrdHeaderCheck(Nrrd *nrrd, NrrdIoState *nio, int checkSeen) { static const char me[]="_nrrdHeaderCheck"; int i; if (checkSeen) { for (i=1; i<=NRRD_FIELD_MAX; i++) { if (_nrrdFieldRequired[i] && !nio->seen[i]) { biffAddf(NRRD, "%s: didn't see required field: %s", me, airEnumStr(nrrdField, i)); return 1; } } } if (nrrdTypeBlock == nrrd->type && !nrrd->blockSize) { biffAddf(NRRD, "%s: type is %s, but missing field: %s", me, airEnumStr(nrrdType, nrrdTypeBlock), airEnumStr(nrrdField, nrrdField_block_size)); return 1; } if (!nrrdElementSize(nrrd)) { biffAddf(NRRD, "%s: nrrd reports zero element size!", me); return 1; } /* _nrrdReadNrrdParse_sizes() checks axis[i].size, which completely determines the return of nrrdElementNumber() */ if (airEndianUnknown == nio->endian && nio->encoding->endianMatters && 1 != nrrdElementSize(nrrd)) { biffAddf(NRRD, "%s: type (%s) and encoding (%s) require %s info", me, airEnumStr(nrrdType, nrrd->type), nio->encoding->name, airEnumStr(nrrdField, nrrdField_endian)); return 1; } /* we don't really try to enforce consistency with the min/max/center/size information on each axis, other than the value checking done by the _nrrdReadNrrdParse_* functions, because we only really care that we know each axis size. Past that, if the user messes it up, its not really our problem ... */ return 0; } /* ** NOTE: currently, this will read, without complaints or errors, ** newer NRRD format features from older NRRD files (as indicated by ** magic), such as key/value pairs from a NRRD0001 file, even though ** strictly speaking these are violations of the format. ** ** NOTE: by giving a NULL "file", you can make this function basically ** do the work of reading in datafiles, without any header parsing */ static int _nrrdFormatNRRD_read(FILE *file, Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdFormatNRRD_read"; /* Dynamically allocated for space reasons. */ /* MWC: These strlen usages look really unsafe. */ int ret; unsigned int llen; size_t valsPerPiece; char *data; FILE *dataFile=NULL; /* record where the header is being read from for the sake of nrrdIoStateDataFileIterNext() */ nio->headerFile = file; /* GLK forgets the context in which file might be reasonably NULL but on Fri Sep 23 09:48:41 EDT 2005 this was "if (file) { ..." */ /* nio->headerStringRead is NULL whenever IO from string is not being done */ if (file || nio->headerStringRead) { if (!_nrrdFormatNRRD_contentStartsLike(nio)) { biffAddf(NRRD, "%s: this doesn't look like a %s file", me, nrrdFormatNRRD->name); return 1; } /* parse all the header lines */ do { nio->pos = 0; if (_nrrdOneLine(&llen, nio, file)) { biffAddf(NRRD, "%s: trouble getting line of header", me); return 1; } if (llen > 1) { ret = _nrrdReadNrrdParseField(nio, AIR_TRUE); if (!ret) { biffAddf(NRRD, "%s: trouble parsing NRRD field identifier from " "in \"%s\"", me, nio->line); return 1; } /* comments and key/values are allowed multiple times */ if (nio->seen[ret] && !(ret == nrrdField_comment || ret == nrrdField_keyvalue)) { biffAddf(NRRD, "%s: already set field %s", me, airEnumStr(nrrdField, ret)); return 1; } if (nrrdFieldInfoParse[ret](file, nrrd, nio, AIR_TRUE)) { biffAddf(NRRD, "%s: trouble parsing %s info |%s|", me, airEnumStr(nrrdField, ret), nio->line + nio->pos); return 1; } nio->seen[ret] = AIR_TRUE; } } while (llen > 1); /* either 0 == llen: we're at EOF (or end of nio->headerStringRead), or 1 == llen: we just read the empty line separating header from data */ if (0 == llen && !nio->headerStringRead && !nio->dataFNFormat && 0 == nio->dataFNArr->len) { /* we're at EOF, we're not reading from a string, but there's apparently no separate data file */ biffAddf(NRRD, "%s: hit end of header, but no \"%s\" given", me, airEnumStr(nrrdField, nrrdField_data_file)); return 1; } } if (_nrrdHeaderCheck(nrrd, nio, !!file)) { biffAddf(NRRD, "%s: %s", me, (llen ? "finished reading header, but there were problems" : "hit EOF before seeing a complete valid header")); return 1; } /* we seemed to have read in a valid header; now allocate the memory. For directIO-compatible allocation we need to get the first datafile */ nrrdIoStateDataFileIterBegin(nio); /* NOTE: if nio->headerStringRead, this may set dataFile to NULL */ if (nrrdIoStateDataFileIterNext(&dataFile, nio, AIR_TRUE)) { biffAddf(NRRD, "%s: couldn't open the first datafile", me); return 1; } if (nio->skipData) { nrrd->data = NULL; data = NULL; } else { if (_nrrdCalloc(nrrd, nio, dataFile)) { biffAddf(NRRD, "%s: couldn't allocate memory for data", me); return 1; } data = (char*)nrrd->data; } /* iterate through datafiles and read them in */ /* NOTE: you have to open dataFile even in the case of skipData, because caller might have set keepNrrdDataFileOpen, in which case you need to do any line or byte skipping if it is specified */ valsPerPiece = nrrdElementNumber(nrrd)/_nrrdDataFNNumber(nio); while (dataFile) { /* ---------------- skip, if need be */ if (nrrdLineSkip(dataFile, nio)) { biffAddf(NRRD, "%s: couldn't skip lines", me); return 1; } if (!nio->encoding->isCompression) { /* bytes are skipped here for non-compression encodings, but are skipped within the decompressed stream for compression encodings */ if (nrrdByteSkip(dataFile, nrrd, nio)) { biffAddf(NRRD, "%s: couldn't skip bytes", me); return 1; } } /* ---------------- read the data itself */ if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "(%s: reading %s data ... ", me, nio->encoding->name); fflush(stderr); } if (!nio->skipData) { if (nio->encoding->read(dataFile, data, valsPerPiece, nrrd, nio)) { if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "error!\n"); } biffAddf(NRRD, "%s:", me); return 1; } } if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "done)\n"); } /* ---------------- go to next data file */ if (nio->keepNrrdDataFileOpen && _nrrdDataFNNumber(nio) == 1) { nio->dataFile = dataFile; } else { if (dataFile != nio->headerFile) { dataFile = airFclose(dataFile); } } data += valsPerPiece*nrrdElementSize(nrrd); if (nrrdIoStateDataFileIterNext(&dataFile, nio, AIR_TRUE)) { biffAddf(NRRD, "%s: couldn't get the next datafile", me); return 1; } } if (airEndianUnknown != nio->endian && nrrd->data) { /* we positively know the endianness of data just read */ if (1 < nrrdElementSize(nrrd) && nio->encoding->endianMatters && nio->endian != airMyEndian()) { /* endianness exposed in encoding, and its wrong */ if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "(%s: fixing endianness ... ", me); fflush(stderr); } nrrdSwapEndian(nrrd); if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "done)\n"); fflush(stderr); } } } return 0; } static int _nrrdFormatNRRD_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdFormatNRRD_write"; char strbuf[AIR_STRLEN_MED], *strptr, *tmp; int ii; unsigned int jj; airArray *mop; FILE *dataFile=NULL; size_t valsPerPiece; char *data; mop = airMopNew(); if (!(file || nio->headerStringWrite || nio->learningHeaderStrlen)) { biffAddf(NRRD, "%s: have no file or string to write to, nor are " "learning header string length", me); airMopError(mop); return 1; } if (nrrdTypeBlock == nrrd->type && nrrdEncodingAscii == nio->encoding) { biffAddf(NRRD, "%s: can't write nrrd type %s with %s encoding", me, airEnumStr(nrrdType, nrrdTypeBlock), nrrdEncodingAscii->name); airMopError(mop); return 1; } /* record where the header is being written to for the sake of nrrdIoStateDataFileIterNext(). This may be NULL if nio->headerStringWrite is non-NULL */ nio->headerFile = file; /* we have to make sure that the data filename information is set (if needed), so that it can be printed by _nrrdFprintFieldInfo */ if (nio->detachedHeader && !nio->dataFNFormat && 0 == nio->dataFNArr->len) { /* NOTE: this means someone requested a detached header, but we don't already have implicit (via dataFNFormat) or explicit (via dataFN[]) information about the data file */ /* NOTE: whether or not nio->skipData, we have to contrive a filename to say in the "data file" field, which is stored in nio->dataFN[0], because the data filename will be "interesting", according to _nrrdFieldInteresting() */ /* NOTE: Fri Feb 4 01:42:20 EST 2005 the way this is now set up, having a name in dataFN[0] will trump the name implied by nio->{path,base}, which is a useful way for the user to explicitly set the output data filename (as with unu make -od) */ if (!( !!airStrlen(nio->path) && !!airStrlen(nio->base) )) { biffAddf(NRRD, "%s: can't create data file name: nio's " "path and base empty", me); airMopError(mop); return 1; } tmp = (char*)malloc(strlen(nio->base) + strlen(".") + strlen(nio->encoding->suffix) + 1); if (!tmp) { biffAddf(NRRD, "%s: couldn't allocate data filename", me); airMopError(mop); return 1; } airMopAdd(mop, tmp, airFree, airMopOnError); sprintf(tmp, "%s.%s", nio->base, nio->encoding->suffix); jj = airArrayLenIncr(nio->dataFNArr, 1); if (!nio->dataFNArr->data) { biffAddf(NRRD, "%s: can't increase dataFNArr storage", me); airMopError(mop); return 1; } nio->dataFN[jj] = tmp; } /* the magic is in fact the first thing to be written */ if (file) { fprintf(file, "%s%04d\n", MAGIC, _nrrdFormatNRRD_whichVersion(nrrd, nio)); } else if (nio->headerStringWrite) { sprintf(nio->headerStringWrite, "%s%04d\n", MAGIC, _nrrdFormatNRRD_whichVersion(nrrd, nio)); } else { nio->headerStrlen = AIR_CAST(unsigned int, strlen(MAGIC) + strlen("0000")) + 1; } /* write the advertisement about where to get the file format */ if (!nio->skipFormatURL) { if (file) { fprintf(file, "# %s\n", _nrrdFormatURLLine0); fprintf(file, "# %s\n", _nrrdFormatURLLine1); } else if (nio->headerStringWrite) { sprintf(strbuf, "# %s\n", _nrrdFormatURLLine0); strcat(nio->headerStringWrite, strbuf); sprintf(strbuf, "# %s\n", _nrrdFormatURLLine1); strcat(nio->headerStringWrite, strbuf); } else { nio->headerStrlen += sprintf(strbuf, "# %s\n", _nrrdFormatURLLine0); nio->headerStrlen += sprintf(strbuf, "# %s\n", _nrrdFormatURLLine1); } } /* this is where the majority of the header printing happens */ for (ii=1; ii<=NRRD_FIELD_MAX; ii++) { if (_nrrdFieldInteresting(nrrd, nio, ii)) { if (file) { _nrrdFprintFieldInfo (file, "", nrrd, nio, ii); } else if (nio->headerStringWrite) { _nrrdSprintFieldInfo(&strptr, "", nrrd, nio, ii); if (strptr) { strcat(nio->headerStringWrite, strptr); strcat(nio->headerStringWrite, "\n"); free(strptr); strptr = NULL; } } else { _nrrdSprintFieldInfo(&strptr, "", nrrd, nio, ii); if (strptr) { nio->headerStrlen += AIR_CAST(unsigned int, strlen(strptr)); nio->headerStrlen += AIR_CAST(unsigned int, strlen("\n")); free(strptr); strptr = NULL; } } } } /* comments and key/value pairs handled differently */ for (jj=0; jjcmtArr->len; jj++) { char *strtmp; strtmp = airOneLinify(airStrdup(nrrd->cmt[jj])); if (file) { fprintf(file, "%c %s\n", NRRD_COMMENT_CHAR, strtmp); } else if (nio->headerStringWrite) { strptr = (char*)malloc(1 + strlen(" ") + strlen(strtmp) + strlen("\n") + 1); sprintf(strptr, "%c %s\n", NRRD_COMMENT_CHAR, strtmp); strcat(nio->headerStringWrite, strptr); free(strptr); strptr = NULL; } else { nio->headerStrlen += (1 + AIR_CAST(unsigned int, strlen(" ") + strlen(strtmp) + strlen("\n")) + 1); } airFree(strtmp); } for (jj=0; jjkvpArr->len; jj++) { if (file) { _nrrdKeyValueWrite(file, NULL, NULL, nrrd->kvp[0 + 2*jj], nrrd->kvp[1 + 2*jj]); } else if (nio->headerStringWrite) { _nrrdKeyValueWrite(NULL, &strptr, NULL, nrrd->kvp[0 + 2*jj], nrrd->kvp[1 + 2*jj]); if (strptr) { strcat(nio->headerStringWrite, strptr); free(strptr); strptr = NULL; } } else { _nrrdKeyValueWrite(NULL, &strptr, NULL, nrrd->kvp[0 + 2*jj], nrrd->kvp[1 + 2*jj]); if (strptr) { nio->headerStrlen += AIR_CAST(unsigned int, strlen(strptr)); free(strptr); strptr = NULL; } } } if (file) { if (!( nio->detachedHeader || _nrrdDataFNNumber(nio) > 1 )) { fprintf(file, "\n"); } } if (file && !nio->skipData) { nrrdIoStateDataFileIterBegin(nio); if (nrrdIoStateDataFileIterNext(&dataFile, nio, AIR_FALSE)) { biffAddf(NRRD, "%s: couldn't write the first datafile", me); airMopError(mop); return 1; } valsPerPiece = nrrdElementNumber(nrrd)/_nrrdDataFNNumber(nio); data = (char*)nrrd->data; do { /* ---------------- write data */ if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "(%s: writing %s data ", me, nio->encoding->name); fflush(stderr); } if (nio->encoding->write(dataFile, data, valsPerPiece, nrrd, nio)) { if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "error!\n"); } biffAddf(NRRD, "%s: couldn't write %s data", me, nio->encoding->name); airMopError(mop); return 1; } if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "done)\n"); } /* ---------------- go to next data file */ if (dataFile != nio->headerFile) { dataFile = airFclose(dataFile); } data += valsPerPiece*nrrdElementSize(nrrd); if (nrrdIoStateDataFileIterNext(&dataFile, nio, AIR_TRUE)) { biffAddf(NRRD, "%s: couldn't get the next datafile", me); airMopError(mop); return 1; } } while (dataFile); } airMopOkay(mop); return 0; } const NrrdFormat _nrrdFormatNRRD = { "NRRD", AIR_FALSE, /* isImage */ AIR_TRUE, /* readable */ AIR_TRUE, /* usesDIO */ _nrrdFormatNRRD_available, _nrrdFormatNRRD_nameLooksLike, _nrrdFormatNRRD_fitsInto, _nrrdFormatNRRD_contentStartsLike, _nrrdFormatNRRD_read, _nrrdFormatNRRD_write }; const NrrdFormat *const nrrdFormatNRRD = &_nrrdFormatNRRD; cmtk-3.0.0/Utilities/NrrdIO/biffmsg.c0000644000177700000170000001706212041601331016375 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateBiff.h" /* ** with the Nov'09 re-write of biff, this sourcefile becomes the only ** place where a static buffer is used for message handling; this ** should eventually be avoided by using things like asprintf and ** vasprintf which allocated the string as needed */ #define _HACK_STRLEN AIR_STRLEN_HUGE #define _MSG_INCR 2 biffMsg * biffMsgNew(const char *key) { static const char me[]="biffMsgNew"; biffMsg *msg; if (!key) { fprintf(stderr, "%s: PANIC got NULL key\n", me); return NULL; /* exit(1); */ } msg = AIR_CALLOC(1, biffMsg); if (msg) { airPtrPtrUnion appu; msg->key = airStrdup(key); msg->err = NULL; msg->errNum = 0; appu.cp = &(msg->err); msg->errArr = airArrayNew(appu.v, &(msg->errNum), sizeof(char*), _MSG_INCR); if (msg->errArr) { airArrayPointerCB(msg->errArr, NULL, airFree); } } if (!( msg && msg->key && msg->errArr )) { fprintf(stderr, "%s: PANIC couldn't calloc new msg\n", me); return NULL; /* exit(1); */ } return msg; } biffMsg * biffMsgNix(biffMsg *msg) { if (msg && msg != biffMsgNoop) { airFree(msg->key); airArrayLenSet(msg->errArr, 0); /* frees all msg->err[i] */ airArrayNuke(msg->errArr); airFree(msg); } return NULL; } /* ** adds a given message to the given entry. The message is processed to ** convert all whitespace into ' ', and to eliminate whitespace at the ** end of the message. */ void biffMsgAdd(biffMsg *msg, const char *err) { static const char me[]="biffMsgAdd"; unsigned int idx; if (biffMsgNoop == msg) { return; } if (!( msg && err )) { fprintf(stderr, "%s: PANIC got NULL msg (%p) or err (%p)\n", me, AIR_VOIDP(msg), AIR_CVOIDP(err)); /* exit(1); */ } idx = airArrayLenIncr(msg->errArr, 1); if (!msg->err) { fprintf(stderr, "%s: PANIC: couldn't add message to %s\n", me, msg->key); /* exit(1); */ } if (!( msg->err[idx] = airOneLinify(airStrdup(err)) )) { fprintf(stderr, "%s: PANIC: couldn't alloc message to %s\n", me, msg->key); /* exit(1); */ } return; } void _biffMsgAddVL(biffMsg *msg, const char *errfmt, va_list args) { char errstr[_HACK_STRLEN]; vsprintf(errstr, errfmt, args); biffMsgAdd(msg, errstr); return; } void biffMsgClear(biffMsg *msg) { if (biffMsgNoop == msg) { return; } airArrayLenSet(msg->errArr, 0); /* frees all msg->err[i] */ /* but msg->key stays allocated */ return; } /* ** max length of line formatted "[] \n" */ unsigned int biffMsgLineLenMax(const biffMsg *msg) { unsigned int ii, len, maxlen; if (biffMsgNoop == msg) { return 0; } maxlen = 0; for (ii=0; iierrNum; ii++) { len = AIR_UINT(strlen(msg->err[ii]) + strlen(msg->key) + strlen("[] \n")); maxlen = AIR_MAX(maxlen, len); } return maxlen; } /* ******** biffMsgMove ** ** "src" is not const because we clear it after moving things out */ void biffMsgMove(biffMsg *dest, biffMsg *src, const char *err) { static const char me[]="biffMsgMove"; unsigned int ii; char *buff; if (biffMsgNoop == dest || biffMsgNoop == src) { return; } if (!( dest && src )) { fprintf(stderr, "%s: PANIC got NULL msg (%p %p)\n", me, AIR_VOIDP(dest), AIR_VOIDP(src)); /* exit(1); */ } /* if src and dest are same, this degenerates to biffMsgAdd */ if (dest == src && airStrlen(err)) { biffMsgAdd(dest, err); return; } buff = AIR_CALLOC(biffMsgLineLenMax(src)+1, char); if (!buff) { fprintf(stderr, "%s: PANIC: can't allocate buffer\n", me); /* exit(1); */ } for (ii=0; iierrNum; ii++) { sprintf(buff, "[%s] %s", src->key, src->err[ii]); biffMsgAdd(dest, buff); } free(buff); biffMsgClear(src); if (airStrlen(err)) { biffMsgAdd(dest, err); } return; } void _biffMsgMoveVL(biffMsg *dest, biffMsg *src, const char *errfmt, va_list args) { char errstr[_HACK_STRLEN]; vsprintf(errstr, errfmt, args); biffMsgMove(dest, src, errstr); return; } void biffMsgMovef(biffMsg *dest, biffMsg *src, const char *errfmt, ...) { va_list args; va_start(args, errfmt); _biffMsgMoveVL(dest, src, errfmt, args); va_end(args); return; } /* ******** biffMsgErrNum ** ** returns number of errors in a message */ unsigned int biffMsgErrNum(const biffMsg *msg) { if (biffMsgNoop == msg) { return 0; } if (!msg) { return 0; } return msg->errNum; } /* ******** biffMsgStrlen ** ** returns length of string (not including null termination, as usual) ** of the error message that will be generated by biffMsgStrSet */ unsigned int biffMsgStrlen(const biffMsg *msg) { static const char me[]="biffMsgStrlen"; unsigned int ii, len; if (biffMsgNoop == msg) { return 0; } if (!( msg )) { fprintf(stderr, "%s: PANIC got NULL msg %p\n", me, AIR_CVOIDP(msg)); return 0; /* exit(1); */ } len = 0; for (ii=0; iierrNum; ii++) { len += AIR_UINT(strlen(msg->key) + strlen(msg->err[ii]) + strlen("[] \n")); } return len+1; } char * biffMsgStrAlloc(const biffMsg *msg) { static const char me[]="biffMsgStrAlloc"; char *ret; unsigned int len; if (biffMsgNoop == msg) { return NULL; } len = biffMsgStrlen(msg); ret = AIR_CALLOC(len+1, char); if (!ret) { fprintf(stderr, "%s: PANIC couldn't alloc string", me); return NULL; /* exit(1); */ } return ret; } /* ** ret is assumed to be allocated for biffMsgStrlen()+1, or is the ** the return from biffMsgStrAlloc */ void biffMsgStrSet(char *ret, const biffMsg *msg) { static const char me[]="biffMsgStrSet"; char *buff; unsigned int ii; if (biffMsgNoop == msg) { return; } buff = AIR_CALLOC(biffMsgLineLenMax(msg)+1, char); if (!buff) { fprintf(stderr, "%s: PANIC couldn't alloc buffer", me); /* exit(1); */ } strcpy(ret, ""); for (ii=msg->errNum; ii>0; ii--) { sprintf(buff, "[%s] %s\n", msg->key, msg->err[ii-1]); strcat(ret, buff); } free(buff); } char * biffMsgStrGet(const biffMsg *msg) { char *ret; if (biffMsgNoop == msg) { return NULL; } ret = biffMsgStrAlloc(msg); biffMsgStrSet(ret, msg); return ret; } biffMsg _biffMsgNoop = { NULL, NULL, 0, NULL }; /* ******** biffMsgNoop ** ** pass this instead of a real biffMsg (allocated by biffMsgNew) as a ** flag to say, "don't bother, really". This turns all the biffMsg ** functions into no-ops (except that var-args are still consumed ** where they are used) */ biffMsg * biffMsgNoop = &_biffMsgNoop; cmtk-3.0.0/Utilities/NrrdIO/enumsNrrd.c0000644000177700000170000005706112041601331016740 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" /* ** Rules of thumb for editing these things. The airEnum definitions are ** unfortunately EXTREMELY sensitive to small typo errors, and there is ** no good way to detect the errors. So: ** ** 1) Be awake and undistracted. Turn down the music. ** 2) When editing the char arrays, make sure that you put commas ** where you mean them to be. C's automatic string concatenation ** is not your friend here. In fact, EXPLOIT the fact that you can have ** a comma after the last element of a list (of strings)- it decreases ** the chances that adding a new element at the end will be thwarted by ** the lack of a comma at the end of the previous (and previously last) ** string. ** 3) When editing the *StrEqv and *ValEqv arrays, make absolutely ** sure that both are changed in parallel. Use only one enum value ** per line; putting all equivalents on that line, and make sure that ** there is one line in both *StrEqv and *ValEqv for all the possible ** enum values, and that there are as many elements in each line. ** 4) Make sure that additions here are reflected in nrrdEnums.h and ** vice versa. */ /* ------------------------ nrrdFormat ------------------------- */ static const char * _nrrdFormatTypeStr[NRRD_FORMAT_TYPE_MAX+1] = { "(unknown_format)", "nrrd", "pnm", "png", "vtk", "text", "eps", }; static const char * _nrrdFormatTypeDesc[NRRD_FORMAT_TYPE_MAX+1] = { "unknown_format", "native format for nearly raw raster data", "Portable aNy Map: includes PGM for grayscale and PPM for color", "Portable Network Graphics: lossless compression of 8- and 16-bit data", "Visualization ToolKit STRUCTURED_POINTS data", "white-space-delimited plain text encoding of 2-D float array", "Encapsulated PostScript images", }; static const char * _nrrdFormatTypeStrEqv[] = { "nrrd", "pnm", "png", "vtk", "table", "text", "txt", "eps", "" }; static const int _nrrdFormatTypeValEqv[] = { nrrdFormatTypeNRRD, nrrdFormatTypePNM, nrrdFormatTypePNG, nrrdFormatTypeVTK, nrrdFormatTypeText, nrrdFormatTypeText, nrrdFormatTypeText, nrrdFormatTypeEPS, }; airEnum _nrrdFormatType = { "format", NRRD_FORMAT_TYPE_MAX, _nrrdFormatTypeStr, NULL, _nrrdFormatTypeDesc, _nrrdFormatTypeStrEqv, _nrrdFormatTypeValEqv, AIR_FALSE }; const airEnum *const nrrdFormatType = &_nrrdFormatType; /* ------------------------ nrrdType ------------------------- */ static const char * _nrrdTypeStr[NRRD_TYPE_MAX+1] = { "(unknown_type)", "signed char", "unsigned char", "short", "unsigned short", "int", "unsigned int", "long long int", "unsigned long long int", "float", "double", "block", }; static const char * _nrrdTypeDesc[NRRD_TYPE_MAX+1] = { "unknown type", "signed 1-byte integer", "unsigned 1-byte integer", "signed 2-byte integer", "unsigned 2-byte integer", "signed 4-byte integer", "unsigned 4-byte integer", "signed 8-byte integer", "unsigned 8-byte integer", "4-byte floating point", "8-byte floating point", "size user-defined at run-time", }; #define ntCH nrrdTypeChar #define ntUC nrrdTypeUChar #define ntSH nrrdTypeShort #define ntUS nrrdTypeUShort #define ntIN nrrdTypeInt #define ntUI nrrdTypeUInt #define ntLL nrrdTypeLLong #define ntUL nrrdTypeULLong #define ntFL nrrdTypeFloat #define ntDB nrrdTypeDouble #define ntBL nrrdTypeBlock static const char * _nrrdTypeStrEqv[] = { "signed char", /* but NOT just "char" */ "int8", "int8_t", "uchar", "unsigned char", "uint8", "uint8_t", "short", "short int", "signed short", "signed short int", "int16", "int16_t", "ushort", "unsigned short", "unsigned short int", "uint16", "uint16_t", "int", "signed int", "int32", "int32_t", "uint", "unsigned int", "uint32", "uint32_t", "longlong", "long long", "long long int", "signed long long", "signed long long int", "int64", "int64_t", "ulonglong", "unsigned long long", "unsigned long long int", "uint64", "uint64_t", "float", "double", "block", "" }; static const int _nrrdTypeValEqv[] = { ntCH, ntCH, ntCH, ntUC, ntUC, ntUC, ntUC, ntSH, ntSH, ntSH, ntSH, ntSH, ntSH, ntUS, ntUS, ntUS, ntUS, ntUS, ntIN, ntIN, ntIN, ntIN, ntUI, ntUI, ntUI, ntUI, ntLL, ntLL, ntLL, ntLL, ntLL, ntLL, ntLL, ntUL, ntUL, ntUL, ntUL, ntUL, ntFL, ntDB, ntBL, }; airEnum _nrrdType = { "type", NRRD_TYPE_MAX, _nrrdTypeStr, NULL, _nrrdTypeDesc, _nrrdTypeStrEqv, _nrrdTypeValEqv, AIR_FALSE }; const airEnum *const nrrdType = &_nrrdType; /* ------------------------ nrrdEncodingType ------------------------- */ static const char * _nrrdEncodingTypeStr[NRRD_ENCODING_TYPE_MAX+1] = { "(unknown_encoding)", "raw", "ascii", "hex", "gz", "bz2", }; static const char * _nrrdEncodingTypeDesc[NRRD_ENCODING_TYPE_MAX+1] = { "unknown encoding", "file is byte-for-byte same as memory representation", "values written out in ASCII", "case-insenstive hexadecimal encoding (2 chars / byte)", "gzip compression of binary encoding", "bzip2 compression of binary encoding", }; static const char * _nrrdEncodingTypeStrEqv[] = { "raw", "txt", "text", "ascii", "hex", "gz", "gzip", "bz2", "bzip2", "" }; static const int _nrrdEncodingTypeValEqv[] = { nrrdEncodingTypeRaw, nrrdEncodingTypeAscii, nrrdEncodingTypeAscii, nrrdEncodingTypeAscii, nrrdEncodingTypeHex, nrrdEncodingTypeGzip, nrrdEncodingTypeGzip, nrrdEncodingTypeBzip2, nrrdEncodingTypeBzip2, }; airEnum _nrrdEncodingType = { "encoding", NRRD_ENCODING_TYPE_MAX, _nrrdEncodingTypeStr, NULL, _nrrdEncodingTypeDesc, _nrrdEncodingTypeStrEqv, _nrrdEncodingTypeValEqv, AIR_FALSE }; const airEnum *const nrrdEncodingType = &_nrrdEncodingType; /* ------------------------ nrrdCenter ------------------------- */ static const char * _nrrdCenterStr[NRRD_CENTER_MAX+1] = { "(unknown_center)", "node", "cell", }; static const char * _nrrdCenterDesc[NRRD_CENTER_MAX+1] = { "unknown centering", "samples are at boundaries between elements along axis", "samples are at centers of elements along axis", }; static const airEnum _nrrdCenter_enum = { "centering", NRRD_CENTER_MAX, _nrrdCenterStr, NULL, _nrrdCenterDesc, NULL, NULL, AIR_FALSE }; const airEnum *const nrrdCenter = &_nrrdCenter_enum; /* ------------------------ nrrdKind ------------------------- */ /* nrrdKindUnknown, nrrdKindDomain, * 1: any image domain * nrrdKindSpace, * 2: a spatial domain * nrrdKindTime, * 3: a temporal domain * * -------------------------- end domain kinds * * -------------------------- begin range kinds * nrrdKindList, * 4: any list of values, non-resample-able * nrrdKindPoint, * 5: coords of a point * nrrdKindVector, * 6: coeffs of (contravariant) vector * nrrdKindCovariantVector, * 7: coeffs of covariant vector (eg gradient) * nrrdKindNormal, * 8: coeffs of unit-length covariant vector * * -------------------------- end arbitrary size kinds * * -------------------------- begin size-specific kinds * nrrdKindStub, * 9: axis with one sample (a placeholder) * nrrdKindScalar, * 10: effectively, same as a stub * nrrdKindComplex, * 11: real and imaginary components * nrrdKind2Vector, * 12: 2 component vector * nrrdKind3Color, * 13: ANY 3-component color value * nrrdKindRGBColor, * 14: RGB, no colorimetry * nrrdKindHSVColor, * 15: HSV, no colorimetry * nrrdKindXYZColor, * 16: perceptual primary colors * nrrdKind4Color, * 17: ANY 4-component color value * nrrdKindRGBAColor, * 18: RGBA, no colorimetry * nrrdKind3Vector, * 19: 3-component vector * nrrdKind3Gradient, * 20: 3-component covariant vector * nrrdKind3Normal, * 21: 3-component covector, assumed normalized * nrrdKind4Vector, * 22: 4-component vector * nrrdKindQuaternion, * 23: (w,x,y,z), not necessarily normalized * nrrdKind2DSymMatrix, * 24: Mxx Mxy Myy * nrrdKind2DMaskedSymMatrix, * 25: mask Mxx Mxy Myy * nrrdKind2DMatrix, * 26: Mxx Mxy Myx Myy * nrrdKind2DMaskedMatrix, * 27: mask Mxx Mxy Myx Myy * nrrdKind3DSymMatrix, * 28: Mxx Mxy Mxz Myy Myz Mzz * nrrdKind3DMaskedSymMatrix, * 29: mask Mxx Mxy Mxz Myy Myz Mzz * nrrdKind3DMatrix, * 30: Mxx Mxy Mxz Myx Myy Myz Mzx Mzy Mzz * nrrdKind3DMaskedMatrix, * 31: mask Mxx Mxy Mxz Myx Myy Myz Mzx Mzy Mzz * */ static const char * _nrrdKindStr[NRRD_KIND_MAX+1] = { "(unknown_kind)", "domain", "space", "time", "list", "point", "vector", "covariant-vector", "normal", "stub", "scalar", "complex", "2-vector", "3-color", "RGB-color", "HSV-color", "XYZ-color", "4-color", "RGBA-color", "3-vector", "3-gradient", "3-normal", "4-vector", "quaternion", "2D-symmetric-matrix", "2D-masked-symmetric-matrix", "2D-matrix", "2D-masked-matrix", "3D-symmetric-matrix", "3D-masked-symmetric-matrix", "3D-matrix", "3D-masked-matrix", }; static const char * _nrrdKindDesc[NRRD_KIND_MAX+1] = { "unknown kind", "a domain variable of the function which the nrrd samples", "a spatial domain, like the axes of a measured volume image", "a temporal domain, as from time-varying measurements", "some list of attributes; it makes no sense to resample along these", "coordinates of a point", "coefficients of a (contravariant) vector", "coefficients of a covariant vector, such as a gradient", "coefficients of a normalized covariant vector", "a place-holder axis with a single sample", "axis used to indicate that the nrrd contains a scalar value", "real and imaginary parts of a value", "a 2-component vector", "any 3-component color value", "red-green-blue color", "hue-saturation-value single hexcone color", "perceptual primaries color", "any 4-component color value", "red-green-blue-alpha color", "a 3-element (contravariant) vector", "a 3-element gradient (covariant) vector", "a 3-element (covariant) vector which is assumed normalized", "a 4-element (contravariant) vector", "quaternion: x y z w", "3 elements of 2D symmetric matrix: Mxx Mxy Myy", "mask plus 3 elements of 2D symmetric matrix: mask Mxx Mxy Myy", "4 elements of general 2D matrix: Mxx Mxy Myx Myy", "mask plus 4 elements of general 2D matrix: mask Mxx Mxy Myx Myy", "6 elements of 3D symmetric matrix: Mxx Mxy Mxz Myy Myz Mzz", "mask plus 6 elements of 3D symmetric matrix: mask Mxx Mxy Mxz Myy Myz Mzz", "9 elements of general 3D matrix: Mxx Mxy Mxz Myx Myy Myz Mzx Mzy Mzz", "mask plus 9 elements of general 3D matrix: mask Mxx Mxy Mxz Myx Myy Myz Mzx Mzy Mzz", }; static const char * _nrrdKindStr_Eqv[] = { "domain", "space", "time", "list", "point", "vector", "contravariant-vector", "covariant-vector", "normal", "stub", "scalar", "complex", "2-vector", "3-color", "RGB-color", "RGBcolor", "RGB", "HSV-color", "HSVcolor", "HSV", "XYZ-color", "4-color", "RGBA-color", "RGBAcolor", "RGBA", "3-vector", "3-gradient", "3-normal", "4-vector", "quaternion", "2D-symmetric-matrix", "2D-sym-matrix", "2D-symmetric-tensor", "2D-sym-tensor", "2D-masked-symmetric-matrix", "2D-masked-sym-matrix", "2D-masked-symmetric-tensor", "2D-masked-sym-tensor", "2D-matrix", "2D-tensor", "2D-masked-matrix", "2D-masked-tensor", "3D-symmetric-matrix", "3D-sym-matrix", "3D-symmetric-tensor", "3D-sym-tensor", "3D-masked-symmetric-matrix", "3D-masked-sym-matrix", "3D-masked-symmetric-tensor", "3D-masked-sym-tensor", "3D-matrix", "3D-tensor", "3D-masked-matrix", "3D-masked-tensor", "" }; static int _nrrdKindVal_Eqv[] = { nrrdKindDomain, nrrdKindSpace, nrrdKindTime, nrrdKindList, nrrdKindPoint, nrrdKindVector, nrrdKindVector, nrrdKindCovariantVector, nrrdKindNormal, nrrdKindStub, nrrdKindScalar, nrrdKindComplex, nrrdKind2Vector, nrrdKind3Color, nrrdKindRGBColor, nrrdKindRGBColor, nrrdKindRGBColor, nrrdKindHSVColor, nrrdKindHSVColor, nrrdKindHSVColor, nrrdKindXYZColor, nrrdKind4Color, nrrdKindRGBAColor, nrrdKindRGBAColor, nrrdKindRGBAColor, nrrdKind3Vector, nrrdKind3Gradient, nrrdKind3Normal, nrrdKind4Vector, nrrdKindQuaternion, nrrdKind2DSymMatrix, nrrdKind2DSymMatrix, nrrdKind2DSymMatrix, nrrdKind2DSymMatrix, nrrdKind2DMaskedSymMatrix, nrrdKind2DMaskedSymMatrix, nrrdKind2DMaskedSymMatrix, nrrdKind2DMaskedSymMatrix, nrrdKind2DMatrix, nrrdKind2DMatrix, nrrdKind2DMaskedMatrix, nrrdKind2DMaskedMatrix, nrrdKind3DSymMatrix, nrrdKind3DSymMatrix, nrrdKind3DSymMatrix, nrrdKind3DSymMatrix, nrrdKind3DMaskedSymMatrix, nrrdKind3DMaskedSymMatrix, nrrdKind3DMaskedSymMatrix, nrrdKind3DMaskedSymMatrix, nrrdKind3DMatrix, nrrdKind3DMatrix, nrrdKind3DMaskedMatrix, nrrdKind3DMaskedMatrix, }; static const airEnum _nrrdKind_enum = { "kind", NRRD_KIND_MAX, _nrrdKindStr, NULL, _nrrdKindDesc, _nrrdKindStr_Eqv, _nrrdKindVal_Eqv, AIR_FALSE }; const airEnum *const nrrdKind = &_nrrdKind_enum; /* ------------------------ nrrdField ------------------------- */ static const char * _nrrdFieldStr[NRRD_FIELD_MAX+1] = { "Ernesto \"Che\" Guevara", "#", "content", "number", "type", "block size", "dimension", "space", "space dimension", "sizes", "spacings", "thicknesses", "axis mins", "axis maxs", "space directions", "centerings", "kinds", "labels", "units", "min", "max", "old min", "old max", "endian", "encoding", "line skip", "byte skip", "key/value", /* this is the one field for which the canonical string here is totally different from the field identifier in the NRRD file format (":="). We include nrrdField_keyvalue in the enum because it is very useful to have a consistent way of identifying lines in the format */ "sample units", "space units", "space origin", "measurement frame", "data file", }; static const char * _nrrdFieldDesc[NRRD_FIELD_MAX+1] = { "unknown field identifier", "comment", "short description of whole array and/or its provenance", "total number of samples in array", "type of sample value", "number of bytes in one block (for block-type)", "number of axes in array", "identifier for space in which array grid lies", "dimension of space in which array grid lies", "list of number of samples along each axis, aka \"dimensions\" of the array", "list of sample spacings along each axis", "list of sample thicknesses along each axis", "list of minimum positions associated with each axis", "list of maximum positions associated with each axis", "list of direction inter-sample vectors for each axis", "list of sample centerings for each axis", "list of kinds for each axis", "list of short descriptions for each axis", "list of units in which each axes' spacing and thickness is measured", "supposed minimum array value", "supposed maximum array value", "minimum array value prior to quantization", "maximum array value prior to quantization", "endiannes of data as written in file", "encoding of data written in file", "number of lines to skip prior to byte skip and reading data", "number of bytes to skip after line skip and prior to reading data", "string-based key/value pairs", "units of measurement of (scalar) values inside array itself", "list of units for measuring origin and direct vectors' coefficients", "location in space of center of first (lowest memory address) sample", "maps coords of (non-scalar) values to coords of surrounding space", "with detached headers, where is data to be found", }; static const char * _nrrdFieldStrEqv[] = { "#", "content", "number", "type", "block size", "blocksize", "dimension", "space", "space dimension", "spacedimension", "sizes", "spacings", "thicknesses", "axis mins", "axismins", "axis maxs", "axismaxs", "space directions", "spacedirections", "centers", "centerings", "kinds", "labels", "units", "min", "max", "old min", "oldmin", "old max", "oldmax", "endian", "encoding", "line skip", "lineskip", "byte skip", "byteskip", "key/value", /* bogus, here to keep the airEnum complete */ "sample units", "sampleunits", "space units", "spaceunits", "space origin", "spaceorigin", "measurement frame", "measurementframe", "data file", "datafile", "" }; static const int _nrrdFieldValEqv[] = { nrrdField_comment, nrrdField_content, nrrdField_number, nrrdField_type, nrrdField_block_size, nrrdField_block_size, nrrdField_dimension, nrrdField_space, nrrdField_space_dimension, nrrdField_space_dimension, nrrdField_sizes, nrrdField_spacings, nrrdField_thicknesses, nrrdField_axis_mins, nrrdField_axis_mins, nrrdField_axis_maxs, nrrdField_axis_maxs, nrrdField_space_directions, nrrdField_space_directions, nrrdField_centers, nrrdField_centers, nrrdField_kinds, nrrdField_labels, nrrdField_units, nrrdField_min, nrrdField_max, nrrdField_old_min, nrrdField_old_min, nrrdField_old_max, nrrdField_old_max, nrrdField_endian, nrrdField_encoding, nrrdField_line_skip, nrrdField_line_skip, nrrdField_byte_skip, nrrdField_byte_skip, nrrdField_keyvalue, nrrdField_sample_units, nrrdField_sample_units, nrrdField_space_units, nrrdField_space_units, nrrdField_space_origin, nrrdField_space_origin, nrrdField_measurement_frame, nrrdField_measurement_frame, nrrdField_data_file, nrrdField_data_file, }; static const airEnum _nrrdField = { "nrrd_field", NRRD_FIELD_MAX, _nrrdFieldStr, NULL, _nrrdFieldDesc, _nrrdFieldStrEqv, _nrrdFieldValEqv, AIR_FALSE /* field identifiers not case sensitive */ }; const airEnum *const nrrdField = &_nrrdField; /* ------------------------ nrrdSpace ------------------------- */ /* nrrdSpaceUnknown, nrrdSpaceRightAnteriorSuperior, * 1: NIFTI-1 (right-handed) * nrrdSpaceLeftAnteriorSuperior, * 2: standard Analyze (left-handed) * nrrdSpaceLeftPosteriorSuperior, * 3: DICOM 3.0 (right-handed) * nrrdSpaceRightAnteriorSuperiorTime, * 4: * nrrdSpaceLeftAnteriorSuperiorTime, * 5: * nrrdSpaceLeftPosteriorSuperiorTime, * 6: * nrrdSpaceScannerXYZ, * 7: ACR/NEMA 2.0 (pre-DICOM 3.0) * nrrdSpaceScannerXYZTime, * 8: * nrrdSpace3DRightHanded, * 9: * nrrdSpace3DLeftHanded, * 10: * nrrdSpace3DRightHandedTime, * 11: * nrrdSpace3DLeftHandedTime, * 12: * nrrdSpaceLast */ static const char * _nrrdSpaceStr[NRRD_SPACE_MAX+1] = { "(unknown_space)", "right-anterior-superior", "left-anterior-superior", "left-posterior-superior", "right-anterior-superior-time", "left-anterior-superior-time", "left-posterior-superior-time", "scanner-xyz", "scanner-xyz-time", "3D-right-handed", "3D-left-handed", "3D-right-handed-time", "3D-left-handed-time", }; static const char * _nrrdSpaceDesc[NRRD_SPACE_MAX+1] = { "unknown space", "right-anterior-superior (used in NIFTI-1 and SPL's 3D Slicer)", "left-anterior-superior (used in Analyze 7.5)", "left-posterior-superior (used in DICOM 3)", "right-anterior-superior-time", "left-anterior-superior-time", "left-posterior-superior-time", "scanner-xyz (used in ACR/NEMA 2.0)", "scanner-xyz-time", "3D-right-handed", "3D-left-handed", "3D-right-handed-time", "3D-left-handed-time", }; static const char * _nrrdSpaceStrEqv[] = { "right-anterior-superior", "right anterior superior", "rightanteriorsuperior", "RAS", "left-anterior-superior", "left anterior superior", "leftanteriorsuperior", "LAS", "left-posterior-superior", "left posterior superior", "leftposteriorsuperior", "LPS", "right-anterior-superior-time", "right anterior superior time", "rightanteriorsuperiortime", "RAST", "left-anterior-superior-time", "left anterior superior time", "leftanteriorsuperiortime", "LAST", "left-posterior-superior-time", "left posterior superior time", "leftposteriorsuperiortime", "LPST", "scanner-xyz", "scanner-xyz-time", "scanner-xyzt", "3D-right-handed", "3D right handed", "3Drighthanded", "3D-left-handed", "3D left handed", "3Dlefthanded", "3D-right-handed-time", "3D right handed time", "3Drighthandedtime", "3D-left-handed-time", "3D left handed time", "3Dlefthandedtime", "" }; static const int _nrrdSpaceValEqv[] = { nrrdSpaceRightAnteriorSuperior, nrrdSpaceRightAnteriorSuperior, nrrdSpaceRightAnteriorSuperior, nrrdSpaceRightAnteriorSuperior, nrrdSpaceLeftAnteriorSuperior, nrrdSpaceLeftAnteriorSuperior, nrrdSpaceLeftAnteriorSuperior, nrrdSpaceLeftAnteriorSuperior, nrrdSpaceLeftPosteriorSuperior, nrrdSpaceLeftPosteriorSuperior, nrrdSpaceLeftPosteriorSuperior, nrrdSpaceLeftPosteriorSuperior, nrrdSpaceRightAnteriorSuperiorTime, nrrdSpaceRightAnteriorSuperiorTime, nrrdSpaceRightAnteriorSuperiorTime, nrrdSpaceRightAnteriorSuperiorTime, nrrdSpaceLeftAnteriorSuperiorTime, nrrdSpaceLeftAnteriorSuperiorTime, nrrdSpaceLeftAnteriorSuperiorTime, nrrdSpaceLeftAnteriorSuperiorTime, nrrdSpaceLeftPosteriorSuperiorTime, nrrdSpaceLeftPosteriorSuperiorTime, nrrdSpaceLeftPosteriorSuperiorTime, nrrdSpaceLeftPosteriorSuperiorTime, nrrdSpaceScannerXYZ, nrrdSpaceScannerXYZTime, nrrdSpaceScannerXYZTime, nrrdSpace3DRightHanded, nrrdSpace3DRightHanded, nrrdSpace3DRightHanded, nrrdSpace3DLeftHanded, nrrdSpace3DLeftHanded, nrrdSpace3DLeftHanded, nrrdSpace3DRightHandedTime, nrrdSpace3DRightHandedTime, nrrdSpace3DRightHandedTime, nrrdSpace3DLeftHandedTime, nrrdSpace3DLeftHandedTime, nrrdSpace3DLeftHandedTime }; static const airEnum _nrrdSpace = { "space", NRRD_SPACE_MAX, _nrrdSpaceStr, NULL, _nrrdSpaceDesc, _nrrdSpaceStrEqv, _nrrdSpaceValEqv, AIR_FALSE }; const airEnum *const nrrdSpace = &_nrrdSpace; /* ------------------------ nrrdSpacingStatus ------------------------- */ static const char * _nrrdSpacingStatusStr[NRRD_SPACING_STATUS_MAX+1] = { "(unknown_status)", "none", "scalarNoSpace", "scalarWithSpace", "direction", }; static const char * _nrrdSpacingStatusDesc[NRRD_BOUNDARY_MAX+1] = { "unknown spacing status behavior", "neither axis->spacing nor axis->spaceDirection set", "axis->spacing set normally", "axis->spacing set, with surround space (?)", "axis->spaceDirection set normally", }; static const airEnum _nrrdSpacingStatus = { "spacing status", NRRD_SPACING_STATUS_MAX, _nrrdSpacingStatusStr, NULL, _nrrdSpacingStatusDesc, NULL, NULL, AIR_FALSE }; const airEnum *const nrrdSpacingStatus = &_nrrdSpacingStatus; cmtk-3.0.0/Utilities/NrrdIO/privateAir.h0000644000177700000170000000222012041601331017061 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* miscAir.c */ extern double _airSanityHelper(double val); cmtk-3.0.0/Utilities/NrrdIO/dio.c0000644000177700000170000002236312041601331015533 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "teemDio.h" #if TEEM_DIO == 0 #else /* HEY: these may be SGI-specific */ #include #include #include #endif #if TEEM_DIO == 0 const int airMyDio = 0; #else const int airMyDio = 1; #endif int airDisableDio = AIR_FALSE; static const char _airNoDioErr[AIR_NODIO_MAX+2][AIR_STRLEN_SMALL] = { "(invalid noDio value)", "CAN TOO do direct I/O!", "direct I/O apparently not available on this architecture", "direct I/O apparently not suitable for given file format", "won't do direct I/O on std{in|out|err}", "got -1 as file descriptor", "fcntl(F_DIOINFO) to learn direct I/O specifics failed", "requested transfer size is too small", "requested transfer size not a multiple of d_miniosz", "data memory address not multiple of d_mem", "current file position not multiple of d_miniosz", "fcntl(F_SETFL, FDIRECT) to turn on direct I/O failed", "memalign() test (on a small chuck of memory) failed", "direct I/O (in air library) has been disabled with airDisableDio" }; const char * airNoDioErr(int noDio) { if (AIR_IN_CL(0, noDio, AIR_NODIO_MAX)) { return _airNoDioErr[noDio+1]; } else { return _airNoDioErr[0]; } } /* ******** airDioTest ** ** does everything necessary to assess whether direct IO can be used ** to read a data segment of a given size, from a given file ** descriptor, into a given pointer. The given pointer ptr can be ** NULL, and/or the size can be 0, in order to test the other aspects ** of direct IO. The return value of this is from the airNoDio_* enum. ** Note that airNoDio_okay means, "actually, direct IO *does* seem to ** be possible here". */ #if TEEM_DIO == 0 int airDioTest(int fd, const void *ptr, size_t size) { AIR_UNUSED(fd); AIR_UNUSED(ptr); AIR_UNUSED(size); /* Teem makefiles think no direct IO is possible on this architecture */ return airNoDio_arch; } #else int airDioTest(int fd, const void *ptr, size_t size) { struct dioattr dioinfo; void *tmp; int flags; if (airDisableDio) { /* user turned direct I/O off */ return airNoDio_disable; } if (0 == fd || 1 == fd || 2 == fd) { /* This was added because I was noticing a problem with piping between unrrdu programs- sometimes the fread() of the receiving data through a unix pipe ("|") failed to read all the data. If the body of this function was bypassed (with "return airNoDio_disable;", for instance), then the problem went away. The problematic call seemed to be the fflush() below (Tue Feb 1 06:47:33 EST 2005: which has since been removed with the change of this function's argument from a FILE * to an integral file descriptor). I don't think direct I/O is possible on stdin, stdout, or stdout, since the fcntl() call below fails on stdin and stdout. However, something about making that fcntl() call changes something which means that about half the time, the read() on a piped stdin fails (on an irix6.n32 O2, at least). So, seems to be safest to just explicitly say that direct I/O is unavailable, based solely on the file descriptor number (0, 1, 2). */ return airNoDio_std; } if (-1 == fd) { /* caller probably couldn't get the underlying file descriptor */ return airNoDio_fd; } if (0 != fcntl(fd, F_DIOINFO, &dioinfo)) { /* couldn't learn direct I/O specifics */ return airNoDio_dioinfo; } if (size) { /* ** direct I/O requirements: ** 1) xfer size between d_miniosz and d_maxiosz ** 2) xfer size a multiple of d_miniosz ** 3) memory buffer on d_mem-byte boundary ** 4) file position on d_miniosz-byte boundary ** ** As long as xfer size is >= d_miniosz and meets req. #2, then ** we can break the xfer into d_maxiosz-size pieces of need be. ** We can test #3 here if we're given non-NULL ptr ** We can always test #4 */ if (size < dioinfo.d_miniosz) { /* fails req. #1 above */ return airNoDio_small; } /* we don't actually check for being too large, since we can always do IO on d_maxiosz-sized pieces */ if (size % dioinfo.d_miniosz) { /* fails req. #2 above */ return airNoDio_size; } } if (ptr) { if ((unsigned long)(ptr) % dioinfo.d_mem) { /* fails req. #3 above */ return airNoDio_ptr; } } else { tmp = memalign(dioinfo.d_mem, dioinfo.d_miniosz); if (!tmp) { /* couldn't even alloc (via memalign) the minimum size */ return airNoDio_test; } free(tmp); } if (lseek(fd, 0, SEEK_CUR) % dioinfo.d_miniosz) { /* fails req. #4 above */ return airNoDio_fpos; } flags = fcntl(fd, F_GETFL); if (-1 == fcntl(fd, F_SETFL, flags | FDIRECT)) { /* couln't turn on direct I/O */ return airNoDio_setfl; } /* put things back the way they were */ fcntl(fd, F_SETFL, flags); /* as far as we know, direct I/O seems workable */ return airNoDio_okay; } #endif /* ******** airDioInfo ** ** does the fcntl stuff to learn the direct IO parameters: ** align: required alignment of memory (pointer must be multiple of this) ** min: minimum size of dio transfer ** max: maximum size of dio transfer ** ** NOTE: this does not try to do any error checking, because it assumes ** that you've already called airDioTest without incident. */ #if TEEM_DIO == 0 void airDioInfo(int *align, int *min, int *max, int fd) { AIR_UNUSED(align); AIR_UNUSED(min); AIR_UNUSED(max); AIR_UNUSED(fd); return; } #else void airDioInfo(int *align, int *min, int *max, int fd) { struct dioattr dioinfo; if (align && min && max && !fcntl(fd, F_DIOINFO, &dioinfo)) { *align = dioinfo.d_mem; *min = dioinfo.d_miniosz; *max = dioinfo.d_maxiosz; } return; } #endif /* ******** airDioMalloc ** ** does direct IO compatible memory allocation. ** ** NOTE: like airDioInfo, this assumes that you've called airDioTest ** without incident */ #if TEEM_DIO == 0 void * airDioMalloc(size_t size, int fd) { AIR_UNUSED(size); AIR_UNUSED(fd); return NULL; } #else void * airDioMalloc(size_t size, int fd) { int align, min, max; airDioInfo(&align, &min, &max, fd); return memalign(align, size); } #endif /* ******** airDioRead ** ** like read(), but for direct IO. The idea is that you call this on as ** big a chunk of memory as possible. ** ** NOTE: like airDioInfo, this assumes that you've called airDioTest ** without incident */ #if TEEM_DIO == 0 size_t airDioRead(int fd, void *_ptr, size_t size) { AIR_UNUSED(fd); AIR_UNUSED(_ptr); AIR_UNUSED(size); return 0; } #else size_t airDioRead(int fd, void *_ptr, size_t size) { size_t red, totalred; int align, min, max, flags; size_t remain, part; char *ptr; if (!( _ptr && airNoDio_okay == airDioTest(fd, _ptr, size) )) { return 0; } flags = fcntl(fd, F_GETFL); fcntl(fd, F_SETFL, flags | FDIRECT); airDioInfo(&align, &min, &max, fd); remain = size; totalred = 0; ptr = (char*)_ptr; do { part = AIR_MIN(remain, max); red = read(fd, ptr, part); totalred += red; if (red != part) { break; } ptr += red; remain -= red; } while (remain); fcntl(fd, F_SETFL, flags); return totalred; } #endif /* ******** airDioWrite ** ** like write(), but for direct IO. The idea is that you call this on as ** big a chunk of memory as possible. ** ** NOTE: like airDioInfo, this assumes that you've called airDioTest ** without incident */ #if TEEM_DIO == 0 size_t airDioWrite(int fd, const void *_ptr, size_t size) { AIR_UNUSED(fd); AIR_UNUSED(_ptr); AIR_UNUSED(size); return 0; } #else size_t airDioWrite(int fd, const void *_ptr, size_t size) { size_t rit, totalrit; int align, min, max, flags; size_t remain, part; char *ptr; if (!( _ptr && (airNoDio_okay == airDioTest(fd, _ptr, size)) )) { return 0; } flags = fcntl(fd, F_GETFL); fcntl(fd, F_SETFL, flags | FDIRECT); airDioInfo(&align, &min, &max, fd); remain = size; totalrit = 0; ptr = (char*)_ptr; do { part = AIR_MIN(remain, max); rit = write(fd, ptr, part); totalrit += rit; if (rit != part) { break; } ptr += rit; remain -= rit; } while (remain); fcntl(fd, F_SETFL, flags); return totalrit; } #endif cmtk-3.0.0/Utilities/NrrdIO/subset.c0000644000177700000170000003271212041601331016264 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* ******** nrrdSlice() ** ** slices a nrrd along a given axis, at a given position. ** ** This is a newer version of the procedure, which is simpler, faster, ** and requires less memory overhead than the first one. It is based ** on the observation that any slice is a periodic square-wave pattern ** in the original data (viewed as a one- dimensional array). The ** characteristics of that periodic pattern are how far from the ** beginning it starts (offset), the length of the "on" part (length), ** the period (period), and the number of periods (numper). */ int nrrdSlice(Nrrd *nout, const Nrrd *cnin, unsigned int saxi, size_t pos) { static const char me[]="nrrdSlice", func[]="slice"; size_t I, rowLen, /* length of segment */ colStep, /* distance between start of each segment */ colLen, /* number of periods */ szOut[NRRD_DIM_MAX]; unsigned int ai, outdim; int map[NRRD_DIM_MAX]; const char *src; char *dest, stmp[2][AIR_STRLEN_SMALL]; airArray *mop; Nrrd *nin; if (!(cnin && nout)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (nout == cnin) { biffAddf(NRRD, "%s: nout==nin disallowed", me); return 1; } if (1 == cnin->dim) { if (0 != saxi) { biffAddf(NRRD, "%s: slice axis must be 0, not %u, for 1-D array", me, saxi); return 1; } } else { if (!( saxi < cnin->dim )) { biffAddf(NRRD, "%s: slice axis %d out of bounds (0 to %d)", me, saxi, cnin->dim-1); return 1; } } if (!( pos < cnin->axis[saxi].size )) { biffAddf(NRRD, "%s: position %s out of bounds (0 to %s)", me, airSprintSize_t(stmp[0], pos), airSprintSize_t(stmp[1], cnin->axis[saxi].size-1)); return 1; } /* this shouldn't actually be necessary .. */ if (!nrrdElementSize(cnin)) { biffAddf(NRRD, "%s: nrrd reports zero element size!", me); return 1; } /* HEY: copy and paste from measure.c/nrrdProject */ mop = airMopNew(); if (1 == cnin->dim) { /* There are more efficient ways of dealing with this case; this way is easy to implement because it leaves most of the established code below only superficially changed; uniformly replacing nin with (nin ? nin : cnin), even if pointlessly so; this expression that can't be assigned to a new variable because of the difference in const. */ nin = nrrdNew(); airMopAdd(mop, nin, (airMopper)nrrdNuke, airMopAlways); if (nrrdAxesInsert(nin, cnin, 1)) { biffAddf(NRRD, "%s: trouble inserting axis on 1-D array", me); airMopError(mop); return 1; } } else { nin = NULL; } /* set up control variables */ rowLen = colLen = 1; for (ai=0; ai<(nin ? nin : cnin)->dim; ai++) { if (ai < saxi) { rowLen *= (nin ? nin : cnin)->axis[ai].size; } else if (ai > saxi) { colLen *= (nin ? nin : cnin)->axis[ai].size; } } rowLen *= nrrdElementSize(nin ? nin : cnin); colStep = rowLen*(nin ? nin : cnin)->axis[saxi].size; outdim = (nin ? nin : cnin)->dim-1; for (ai=0; ai= saxi); szOut[ai] = (nin ? nin : cnin)->axis[map[ai]].size; } nout->blockSize = (nin ? nin : cnin)->blockSize; if (nrrdMaybeAlloc_nva(nout, (nin ? nin : cnin)->type, outdim, szOut)) { biffAddf(NRRD, "%s: failed to create slice", me); airMopError(mop); return 1; } /* the skinny */ src = AIR_CAST(const char *, (nin ? nin : cnin)->data); dest = AIR_CAST(char *, nout->data); src += rowLen*pos; for (I=0; Iaxis[saxi].spaceDirection[0])) { nrrdSpaceVecScaleAdd2(nout->spaceOrigin, 1.0, (nin ? nin : cnin)->spaceOrigin, AIR_CAST(double, pos), (nin ? nin : cnin)->axis[saxi].spaceDirection); } else { nrrdSpaceVecCopy(nout->spaceOrigin, (nin ? nin : cnin)->spaceOrigin); } airMopOkay(mop); return 0; } /* ******** nrrdCrop() ** ** select some sub-volume inside a given nrrd, producing an output ** nrrd with the same dimensions, but with equal or smaller sizes ** along each axis. */ int nrrdCrop(Nrrd *nout, const Nrrd *nin, size_t *min, size_t *max) { static const char me[]="nrrdCrop", func[] = "crop"; char buff1[NRRD_DIM_MAX*30], buff2[AIR_STRLEN_SMALL]; unsigned int ai; size_t I, lineSize, /* #bytes in one scanline to be copied */ typeSize, /* size of data type */ cIn[NRRD_DIM_MAX], /* coords for line start, in input */ cOut[NRRD_DIM_MAX], /* coords for line start, in output */ szIn[NRRD_DIM_MAX], szOut[NRRD_DIM_MAX], idxIn, idxOut, /* linear indices for input and output */ numLines; /* number of scanlines in output nrrd */ char *dataIn, *dataOut, stmp[3][AIR_STRLEN_SMALL]; /* errors */ if (!(nout && nin && min && max)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (nout == nin) { biffAddf(NRRD, "%s: nout==nin disallowed", me); return 1; } for (ai=0; aidim; ai++) { if (!(min[ai] <= max[ai])) { biffAddf(NRRD, "%s: axis %d min (%s) not <= max (%s)", me, ai, airSprintSize_t(stmp[0], min[ai]), airSprintSize_t(stmp[1], max[ai])); return 1; } if (!( min[ai] < nin->axis[ai].size && max[ai] < nin->axis[ai].size )) { biffAddf(NRRD, "%s: axis %d min (%s) or max (%s) out of bounds [0,%s]", me, ai, airSprintSize_t(stmp[0], min[ai]), airSprintSize_t(stmp[1], max[ai]), airSprintSize_t(stmp[2], nin->axis[ai].size-1)); return 1; } } /* this shouldn't actually be necessary .. */ if (!nrrdElementSize(nin)) { biffAddf(NRRD, "%s: nrrd reports zero element size!", me); return 1; } /* allocate */ nrrdAxisInfoGet_nva(nin, nrrdAxisInfoSize, szIn); numLines = 1; for (ai=0; aidim; ai++) { szOut[ai] = max[ai] - min[ai] + 1; if (ai) { numLines *= szOut[ai]; } } nout->blockSize = nin->blockSize; if (nrrdMaybeAlloc_nva(nout, nin->type, nin->dim, szOut)) { biffAddf(NRRD, "%s:", me); return 1; } lineSize = szOut[0]*nrrdElementSize(nin); /* the skinny */ typeSize = nrrdElementSize(nin); dataIn = (char *)nin->data; dataOut = (char *)nout->data; memset(cOut, 0, NRRD_DIM_MAX*sizeof(*cOut)); /* printf("!%s: nin->dim = %d\n", me, nin->dim); printf("!%s: min = %d %d %d\n", me, min[0], min[1], min[2]); printf("!%s: szIn = %d %d %d\n", me, szIn[0], szIn[1], szIn[2]); printf("!%s: szOut = %d %d %d\n", me, szOut[0], szOut[1], szOut[2]); printf("!%s: lineSize = %d\n", me, lineSize); printf("!%s: typeSize = %d\n", me, typeSize); printf("!%s: numLines = %d\n", me, (int)numLines); */ for (I=0; Idim; ai++) { cIn[ai] = cOut[ai] + min[ai]; } NRRD_INDEX_GEN(idxOut, cOut, szOut, nin->dim); NRRD_INDEX_GEN(idxIn, cIn, szIn, nin->dim); /* printf("!%s: %5d: cOut=(%3d,%3d,%3d) --> idxOut = %5d\n", me, (int)I, cOut[0], cOut[1], cOut[2], (int)idxOut); printf("!%s: %5d: cIn=(%3d,%3d,%3d) --> idxIn = %5d\n", me, (int)I, cIn[0], cIn[1], cIn[2], (int)idxIn); */ memcpy(dataOut + idxOut*typeSize, dataIn + idxIn*typeSize, lineSize); /* the lowest coordinate in cOut[] will stay zero, since we are copying one (1-D) scanline at a time */ NRRD_COORD_INCR(cOut, szOut, nin->dim, 1); } if (nrrdAxisInfoCopy(nout, nin, NULL, (NRRD_AXIS_INFO_SIZE_BIT | NRRD_AXIS_INFO_MIN_BIT | NRRD_AXIS_INFO_MAX_BIT ))) { biffAddf(NRRD, "%s:", me); return 1; } for (ai=0; aidim; ai++) { nrrdAxisInfoPosRange(&(nout->axis[ai].min), &(nout->axis[ai].max), nin, ai, AIR_CAST(double, min[ai]), AIR_CAST(double, max[ai])); /* do the safe thing first */ nout->axis[ai].kind = _nrrdKindAltered(nin->axis[ai].kind, AIR_FALSE); /* try cleverness */ if (!nrrdStateKindNoop) { if (nout->axis[ai].size == nin->axis[ai].size) { /* we can safely copy kind; the samples didn't change */ nout->axis[ai].kind = nin->axis[ai].kind; } else if (nrrdKind4Color == nin->axis[ai].kind && 3 == szOut[ai]) { nout->axis[ai].kind = nrrdKind3Color; } else if (nrrdKind4Vector == nin->axis[ai].kind && 3 == szOut[ai]) { nout->axis[ai].kind = nrrdKind3Vector; } else if ((nrrdKind4Vector == nin->axis[ai].kind || nrrdKind3Vector == nin->axis[ai].kind) && 2 == szOut[ai]) { nout->axis[ai].kind = nrrdKind2Vector; } else if (nrrdKindRGBAColor == nin->axis[ai].kind && 0 == min[ai] && 2 == max[ai]) { nout->axis[ai].kind = nrrdKindRGBColor; } else if (nrrdKind2DMaskedSymMatrix == nin->axis[ai].kind && 1 == min[ai] && max[ai] == szIn[ai]-1) { nout->axis[ai].kind = nrrdKind2DSymMatrix; } else if (nrrdKind2DMaskedMatrix == nin->axis[ai].kind && 1 == min[ai] && max[ai] == szIn[ai]-1) { nout->axis[ai].kind = nrrdKind2DMatrix; } else if (nrrdKind3DMaskedSymMatrix == nin->axis[ai].kind && 1 == min[ai] && max[ai] == szIn[ai]-1) { nout->axis[ai].kind = nrrdKind3DSymMatrix; } else if (nrrdKind3DMaskedMatrix == nin->axis[ai].kind && 1 == min[ai] && max[ai] == szIn[ai]-1) { nout->axis[ai].kind = nrrdKind3DMatrix; } } } strcpy(buff1, ""); for (ai=0; aidim; ai++) { sprintf(buff2, "%s[%s,%s]", (ai ? "x" : ""), airSprintSize_t(stmp[0], min[ai]), airSprintSize_t(stmp[1], max[ai])); strcat(buff1, buff2); } if (nrrdContentSet_va(nout, func, nin, "%s", buff1)) { biffAddf(NRRD, "%s:", me); return 1; } if (nrrdBasicInfoCopy(nout, nin, NRRD_BASIC_INFO_DATA_BIT | NRRD_BASIC_INFO_TYPE_BIT | NRRD_BASIC_INFO_BLOCKSIZE_BIT | NRRD_BASIC_INFO_DIMENSION_BIT | NRRD_BASIC_INFO_SPACEORIGIN_BIT | NRRD_BASIC_INFO_CONTENT_BIT | NRRD_BASIC_INFO_COMMENTS_BIT | (nrrdStateKeyValuePairsPropagate ? 0 : NRRD_BASIC_INFO_KEYVALUEPAIRS_BIT))) { biffAddf(NRRD, "%s:", me); return 1; } /* copy origin, then shift it along the spatial axes */ nrrdSpaceVecCopy(nout->spaceOrigin, nin->spaceOrigin); for (ai=0; aidim; ai++) { if (AIR_EXISTS(nin->axis[ai].spaceDirection[0])) { nrrdSpaceVecScaleAdd2(nout->spaceOrigin, 1.0, nout->spaceOrigin, AIR_CAST(double, min[ai]), nin->axis[ai].spaceDirection); } } return 0; } cmtk-3.0.0/Utilities/NrrdIO/privateNrrd.h0000644000177700000170000001465012041611274017274 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* * Modified 23-Oct-2012 by Torsten Rohlfing for CMTK, * (C) 2012 SRI International */ #ifdef _WIN32 #include #include #endif #ifdef __cplusplus extern "C" { #endif #define _NRRD_TEXT_INCR 1024 #define _NRRD_LLONG_MAX_HELP AIR_LLONG(2305843009213693951) #define _NRRD_LLONG_MIN_HELP AIR_LLONG(-2305843009213693952) #define _NRRD_WHITESPACE_NOTAB " \n\r\v\f" /* K+R pg. 157 */ /* ** _NRRD_SPACING ** ** returns nrrdDefSpacing if the argument doesn't exist, otherwise ** returns the argument */ #define _NRRD_SPACING(spc) (AIR_EXISTS(spc) ? spc: nrrdDefSpacing) typedef union { char **CP; int *I; unsigned int *UI; size_t *ST; double *D; const void *P; double (*V)[NRRD_SPACE_DIM_MAX]; } _nrrdAxisInfoSetPtrs; typedef union { char **CP; int *I; unsigned int *UI; size_t *ST; double *D; void *P; double (*V)[NRRD_SPACE_DIM_MAX]; } _nrrdAxisInfoGetPtrs; /* defaultsNrrd.c */ extern airLLong _nrrdLLongMaxHelp(airLLong val); extern airLLong _nrrdLLongMinHelp(airLLong val); extern airULLong _nrrdULLongMaxHelp(airULLong val); /* keyvalue.c */ extern void _nrrdWriteEscaped(FILE *file, char *dst, const char *str, const char *toescape, const char *tospace); extern int _nrrdKeyValueWrite(FILE *file, char **stringP, const char *prefix, const char *key, const char *value); /* formatXXX.c */ extern const char *_nrrdFormatURLLine0; extern const char *_nrrdFormatURLLine1; extern const NrrdFormat _nrrdFormatNRRD; extern const NrrdFormat _nrrdFormatPNM; extern const NrrdFormat _nrrdFormatPNG; extern const NrrdFormat _nrrdFormatVTK; extern const NrrdFormat _nrrdFormatText; extern const NrrdFormat _nrrdFormatEPS; extern int _nrrdHeaderCheck(Nrrd *nrrd, NrrdIoState *nio, int checkSeen); extern int _nrrdFormatNRRD_whichVersion(const Nrrd *nrrd, NrrdIoState *nio); /* encodingXXX.c */ extern const NrrdEncoding _nrrdEncodingRaw; extern const NrrdEncoding _nrrdEncodingAscii; extern const NrrdEncoding _nrrdEncodingHex; extern const NrrdEncoding _nrrdEncodingGzip; extern const NrrdEncoding _nrrdEncodingBzip2; /* read.c */ extern int _nrrdCalloc(Nrrd *nrrd, NrrdIoState *nio, FILE *file); extern char _nrrdFieldSep[]; /* arrays.c */ extern const int _nrrdFieldValidInImage[NRRD_FIELD_MAX+1]; extern const int _nrrdFieldValidInText[NRRD_FIELD_MAX+1]; extern const int _nrrdFieldOnePerAxis[NRRD_FIELD_MAX+1]; extern const char _nrrdEnumFieldStr[NRRD_FIELD_MAX+1][AIR_STRLEN_SMALL]; extern const int _nrrdFieldRequired[NRRD_FIELD_MAX+1]; /* simple.c */ extern char *_nrrdContentGet(const Nrrd *nin); extern int _nrrdContentSet_nva(Nrrd *nout, const char *func, char *content, const char *format, va_list arg); extern int _nrrdContentSet_va(Nrrd *nout, const char *func, char *content, const char *format, ...); extern int (*_nrrdFieldCheck[NRRD_FIELD_MAX+1])(const Nrrd *nrrd, int useBiff); extern void _nrrdSplitSizes(size_t *pieceSize, size_t *pieceNum, Nrrd *nrrd, unsigned int listDim); /* axis.c */ extern int _nrrdKindAltered(int kindIn, int resampling); extern void _nrrdAxisInfoCopy(NrrdAxisInfo *dest, const NrrdAxisInfo *src, int bitflag); extern void _nrrdAxisInfoInit(NrrdAxisInfo *axis); extern void _nrrdAxisInfoNewInit(NrrdAxisInfo *axis); extern int _nrrdCenter(int center); extern int _nrrdCenter2(int center, int def); /* convert.c */ extern void (*_nrrdConv[][NRRD_TYPE_MAX+1])(void *, const void *, size_t); extern void (*_nrrdClampConv[][NRRD_TYPE_MAX+1])(void *, const void *, size_t); /* read.c */ extern char _nrrdFieldStr[NRRD_FIELD_MAX+1][AIR_STRLEN_SMALL]; extern char _nrrdRelativePathFlag[]; extern char _nrrdFieldSep[]; extern char _nrrdNoSpaceVector[]; extern char _nrrdTextSep[]; extern void _nrrdSplitName(char **dirP, char **baseP, const char *name); /* write.c */ extern int _nrrdFieldInteresting(const Nrrd *nrrd, NrrdIoState *nio, int field); extern void _nrrdSprintFieldInfo(char **strP, const char *prefix, const Nrrd *nrrd, NrrdIoState *nio, int field); extern void _nrrdFprintFieldInfo(FILE *file, const char *prefix, const Nrrd *nrrd, NrrdIoState *nio, int field); /* parseNrrd.c */ extern int _nrrdReadNrrdParseField(NrrdIoState *nio, int useBiff); /* methodsNrrd.c */ extern void nrrdPeripheralInit(Nrrd *nrrd); extern int nrrdPeripheralCopy(Nrrd *nout, const Nrrd *nin); extern int _nrrdCopy(Nrrd *nout, const Nrrd *nin, int bitflag); extern int _nrrdSizeCheck(const size_t *size, unsigned int dim, int useBiff); extern void _nrrdTraverse(Nrrd *nrrd); extern int _nrrdMaybeAllocMaybeZero_nva(Nrrd *nrrd, int type, unsigned int dim, const size_t *size, int zeroWhenNoAlloc); #if TEEM_ZLIB #include "zlib.h" /* gzio.c */ extern gzFile _nrrdGzOpen(FILE* fd, const char *mode); extern int _nrrdGzClose(gzFile file); extern int _nrrdGzRead(gzFile file, void* buf, unsigned int len, unsigned int* read); extern int _nrrdGzWrite(gzFile file, const void* buf, unsigned int len, unsigned int* written); #endif #ifdef __cplusplus } #endif cmtk-3.0.0/Utilities/NrrdIO/teemPng.h0000644000177700000170000000271412041601331016362 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* ** the end result of this is that the source file which includes ** this can be sure that TEEM_ZLIB is set, so that the required ** compression library is always built in when PNG support is requested */ #ifdef TEEM_PNG # ifndef TEEM_ZLIB # error TEEM_PNG set, but TEEM_ZLIB not set # endif #endif #if TEEM_PNG && TEEM_VTK_MANGLE #include "vtk_png_mangle.h" #endif cmtk-3.0.0/Utilities/NrrdIO/cmtk_NrrdIO_mangle.h0000644000177700000170000012411311550636332020474 0ustar torstenman#ifndef __cmtk_NrrdIO_mangle_h #define __cmtk_NrrdIO_mangle_h /* This header file mangles all symbols exported from the NrrdIO library. It is included in all files while building the NrrdIO library. Due to namespace pollution, no NrrdIO headers should be included in .h files in CMTK. This file was created via the mangle.pl script in the NrrdIO distribution: perl mangle.pl cmtk > cmtk_NrrdIO_mangle.h This uses nm to list all text (T), data (D) symbols, as well read-only (R) things (seen on Linux) and "other" (S) things (seen on Mac). On Macs, the preceeding underscore is removed. */ /* * Modified 11-Apr-2011 by Torsten Rohlfing for CMTK, * (C) 2011 SRI International */ #define airExists cmtk_airExists #define airFPClass_d cmtk_airFPClass_d #define airFPClass_f cmtk_airFPClass_f #define airFPFprintf_d cmtk_airFPFprintf_d #define airFPFprintf_f cmtk_airFPFprintf_f #define airFPGen_d cmtk_airFPGen_d #define airFPGen_f cmtk_airFPGen_f #define airFPPartsToVal_d cmtk_airFPPartsToVal_d #define airFPPartsToVal_f cmtk_airFPPartsToVal_f #define airFPValToParts_d cmtk_airFPValToParts_d #define airFPValToParts_f cmtk_airFPValToParts_f #define airFloatNegInf cmtk_airFloatNegInf #define airFloatPosInf cmtk_airFloatPosInf #define airFloatQNaN cmtk_airFloatQNaN #define airFloatSNaN cmtk_airFloatSNaN #define airIsInf_d cmtk_airIsInf_d #define airIsInf_f cmtk_airIsInf_f #define airIsNaN cmtk_airIsNaN #define airMyQNaNHiBit cmtk_airMyQNaNHiBit #define airNaN cmtk_airNaN #define _airMopPrint cmtk__airMopPrint #define _airMopWhenStr cmtk__airMopWhenStr #define airMopAdd cmtk_airMopAdd #define airMopDebug cmtk_airMopDebug #define airMopDone cmtk_airMopDone #define airMopError cmtk_airMopError #define airMopMem cmtk_airMopMem #define airMopNew cmtk_airMopNew #define airMopOkay cmtk_airMopOkay #define airMopPrint cmtk_airMopPrint #define airMopSub cmtk_airMopSub #define airMopUnMem cmtk_airMopUnMem #define _airLenSet cmtk__airLenSet #define _airSetData cmtk__airSetData #define airArrayLenIncr cmtk_airArrayLenIncr #define airArrayLenPreSet cmtk_airArrayLenPreSet #define airArrayLenSet cmtk_airArrayLenSet #define airArrayNew cmtk_airArrayNew #define airArrayNix cmtk_airArrayNix #define airArrayNuke cmtk_airArrayNuke #define airArrayPointerCB cmtk_airArrayPointerCB #define airArrayStructCB cmtk_airArrayStructCB #define _airBool cmtk__airBool #define _airBoolDesc cmtk__airBoolDesc #define _airBoolStr cmtk__airBoolStr #define _airBoolStrEqv cmtk__airBoolStrEqv #define _airBoolVal cmtk__airBoolVal #define _airBoolValEqv cmtk__airBoolValEqv #define airAtod cmtk_airAtod #define airBool cmtk_airBool #define airParseStr cmtk_airParseStr #define airParseStrB cmtk_airParseStrB #define airParseStrC cmtk_airParseStrC #define airParseStrD cmtk_airParseStrD #define airParseStrE cmtk_airParseStrE #define airParseStrF cmtk_airParseStrF #define airParseStrI cmtk_airParseStrI #define airParseStrLI cmtk_airParseStrLI #define airParseStrS cmtk_airParseStrS #define airParseStrUI cmtk_airParseStrUI #define airParseStrZ cmtk_airParseStrZ #define airSingleSscanf cmtk_airSingleSscanf #define _airNoDioErr cmtk__airNoDioErr #define airDioInfo cmtk_airDioInfo #define airDioMalloc cmtk_airDioMalloc #define airDioRead cmtk_airDioRead #define airDioTest cmtk_airDioTest #define airDioWrite cmtk_airDioWrite #define airDisableDio cmtk_airDisableDio #define airMyDio cmtk_airMyDio #define airNoDioErr cmtk_airNoDioErr #define _airBadInsane cmtk__airBadInsane #define _airInsaneErr cmtk__airInsaneErr #define airInsaneErr cmtk_airInsaneErr #define airSanity cmtk_airSanity #define _airEndian cmtk__airEndian #define _airEndianDesc cmtk__airEndianDesc #define _airEndianStr cmtk__airEndianStr #define _airEndianVal cmtk__airEndianVal #define airEndian cmtk_airEndian #define airMyEndian cmtk_airMyEndian #define airEndsWith cmtk_airEndsWith #define airOneLine cmtk_airOneLine #define airOneLinify cmtk_airOneLinify #define airStrdup cmtk_airStrdup #define airStrlen cmtk_airStrlen #define airStrntok cmtk_airStrntok #define airStrtok cmtk_airStrtok #define airStrtokQuoting cmtk_airStrtokQuoting #define airStrtrans cmtk_airStrtrans #define airToLower cmtk_airToLower #define airToUpper cmtk_airToUpper #define airUnescape cmtk_airUnescape #define _airEnumIndex cmtk__airEnumIndex #define _enumPrintVal cmtk__enumPrintVal #define airEnumDesc cmtk_airEnumDesc #define airEnumFmtDesc cmtk_airEnumFmtDesc #define airEnumLast cmtk_airEnumLast #define airEnumPrint cmtk_airEnumPrint #define airEnumStr cmtk_airEnumStr #define airEnumUnknown cmtk_airEnumUnknown #define airEnumVal cmtk_airEnumVal #define airEnumValCheck cmtk_airEnumValCheck #define _airSanityHelper cmtk__airSanityHelper #define airFclose cmtk_airFclose #define airFopen cmtk_airFopen #define airFree cmtk_airFree #define airMy32Bit cmtk_airMy32Bit #define airNull cmtk_airNull #define airSetNull cmtk_airSetNull #define airSinglePrintf cmtk_airSinglePrintf #define airTeemReleaseDate cmtk_airTeemReleaseDate #define airTeemVersion cmtk_airTeemVersion #define _bmsg cmtk__bmsg #define _bmsgAdd cmtk__bmsgAdd #define _bmsgArr cmtk__bmsgArr #define _bmsgFind cmtk__bmsgFind #define _bmsgFindIdx cmtk__bmsgFindIdx #define _bmsgFinish cmtk__bmsgFinish #define _bmsgNum cmtk__bmsgNum #define _bmsgStart cmtk__bmsgStart #define biffAdd cmtk_biffAdd #define biffAddVL cmtk_biffAddVL #define biffAddf cmtk_biffAddf #define biffCheck cmtk_biffCheck #define biffDone cmtk_biffDone #define biffGet cmtk_biffGet #define biffGetDone cmtk_biffGetDone #define biffGetStrlen cmtk_biffGetStrlen #define biffMaybeAdd cmtk_biffMaybeAdd #define biffMaybeAddf cmtk_biffMaybeAddf #define biffMove cmtk_biffMove #define biffMoveVL cmtk_biffMoveVL #define biffMovef cmtk_biffMovef #define biffSetStr cmtk_biffSetStr #define biffSetStrDone cmtk_biffSetStrDone #define _biffMsgNoop cmtk__biffMsgNoop #define biffMsgAdd cmtk_biffMsgAdd #define biffMsgAddVL cmtk_biffMsgAddVL #define biffMsgAddf cmtk_biffMsgAddf #define biffMsgClear cmtk_biffMsgClear #define biffMsgLineLenMax cmtk_biffMsgLineLenMax #define biffMsgMove cmtk_biffMsgMove #define biffMsgMoveVL cmtk_biffMsgMoveVL #define biffMsgMovef cmtk_biffMsgMovef #define biffMsgNew cmtk_biffMsgNew #define biffMsgNix cmtk_biffMsgNix #define biffMsgNoop cmtk_biffMsgNoop #define biffMsgStrAlloc cmtk_biffMsgStrAlloc #define biffMsgStrGet cmtk_biffMsgStrGet #define biffMsgStrSet cmtk_biffMsgStrSet #define biffMsgStrlen cmtk_biffMsgStrlen #define _nrrdInsertDBCH cmtk__nrrdInsertDBCH #define _nrrdInsertDBDB cmtk__nrrdInsertDBDB #define _nrrdInsertDBFL cmtk__nrrdInsertDBFL #define _nrrdInsertDBJN cmtk__nrrdInsertDBJN #define _nrrdInsertDBLL cmtk__nrrdInsertDBLL #define _nrrdInsertDBSH cmtk__nrrdInsertDBSH #define _nrrdInsertDBUC cmtk__nrrdInsertDBUC #define _nrrdInsertDBUI cmtk__nrrdInsertDBUI #define _nrrdInsertDBUL cmtk__nrrdInsertDBUL #define _nrrdInsertDBUS cmtk__nrrdInsertDBUS #define _nrrdInsertFLCH cmtk__nrrdInsertFLCH #define _nrrdInsertFLDB cmtk__nrrdInsertFLDB #define _nrrdInsertFLFL cmtk__nrrdInsertFLFL #define _nrrdInsertFLJN cmtk__nrrdInsertFLJN #define _nrrdInsertFLLL cmtk__nrrdInsertFLLL #define _nrrdInsertFLSH cmtk__nrrdInsertFLSH #define _nrrdInsertFLUC cmtk__nrrdInsertFLUC #define _nrrdInsertFLUI cmtk__nrrdInsertFLUI #define _nrrdInsertFLUL cmtk__nrrdInsertFLUL #define _nrrdInsertFLUS cmtk__nrrdInsertFLUS #define _nrrdInsertJNCH cmtk__nrrdInsertJNCH #define _nrrdInsertJNDB cmtk__nrrdInsertJNDB #define _nrrdInsertJNFL cmtk__nrrdInsertJNFL #define _nrrdInsertJNJN cmtk__nrrdInsertJNJN #define _nrrdInsertJNLL cmtk__nrrdInsertJNLL #define _nrrdInsertJNSH cmtk__nrrdInsertJNSH #define _nrrdInsertJNUC cmtk__nrrdInsertJNUC #define _nrrdInsertJNUI cmtk__nrrdInsertJNUI #define _nrrdInsertJNUL cmtk__nrrdInsertJNUL #define _nrrdInsertJNUS cmtk__nrrdInsertJNUS #define _nrrdInsertUICH cmtk__nrrdInsertUICH #define _nrrdInsertUIDB cmtk__nrrdInsertUIDB #define _nrrdInsertUIFL cmtk__nrrdInsertUIFL #define _nrrdInsertUIJN cmtk__nrrdInsertUIJN #define _nrrdInsertUILL cmtk__nrrdInsertUILL #define _nrrdInsertUISH cmtk__nrrdInsertUISH #define _nrrdInsertUIUC cmtk__nrrdInsertUIUC #define _nrrdInsertUIUI cmtk__nrrdInsertUIUI #define _nrrdInsertUIUL cmtk__nrrdInsertUIUL #define _nrrdInsertUIUS cmtk__nrrdInsertUIUS #define _nrrdLoadDBCH cmtk__nrrdLoadDBCH #define _nrrdLoadDBDB cmtk__nrrdLoadDBDB #define _nrrdLoadDBFL cmtk__nrrdLoadDBFL #define _nrrdLoadDBJN cmtk__nrrdLoadDBJN #define _nrrdLoadDBLL cmtk__nrrdLoadDBLL #define _nrrdLoadDBSH cmtk__nrrdLoadDBSH #define _nrrdLoadDBUC cmtk__nrrdLoadDBUC #define _nrrdLoadDBUI cmtk__nrrdLoadDBUI #define _nrrdLoadDBUL cmtk__nrrdLoadDBUL #define _nrrdLoadDBUS cmtk__nrrdLoadDBUS #define _nrrdLoadFLCH cmtk__nrrdLoadFLCH #define _nrrdLoadFLDB cmtk__nrrdLoadFLDB #define _nrrdLoadFLFL cmtk__nrrdLoadFLFL #define _nrrdLoadFLJN cmtk__nrrdLoadFLJN #define _nrrdLoadFLLL cmtk__nrrdLoadFLLL #define _nrrdLoadFLSH cmtk__nrrdLoadFLSH #define _nrrdLoadFLUC cmtk__nrrdLoadFLUC #define _nrrdLoadFLUI cmtk__nrrdLoadFLUI #define _nrrdLoadFLUL cmtk__nrrdLoadFLUL #define _nrrdLoadFLUS cmtk__nrrdLoadFLUS #define _nrrdLoadJNCH cmtk__nrrdLoadJNCH #define _nrrdLoadJNDB cmtk__nrrdLoadJNDB #define _nrrdLoadJNFL cmtk__nrrdLoadJNFL #define _nrrdLoadJNJN cmtk__nrrdLoadJNJN #define _nrrdLoadJNLL cmtk__nrrdLoadJNLL #define _nrrdLoadJNSH cmtk__nrrdLoadJNSH #define _nrrdLoadJNUC cmtk__nrrdLoadJNUC #define _nrrdLoadJNUI cmtk__nrrdLoadJNUI #define _nrrdLoadJNUL cmtk__nrrdLoadJNUL #define _nrrdLoadJNUS cmtk__nrrdLoadJNUS #define _nrrdLoadUICH cmtk__nrrdLoadUICH #define _nrrdLoadUIDB cmtk__nrrdLoadUIDB #define _nrrdLoadUIFL cmtk__nrrdLoadUIFL #define _nrrdLoadUIJN cmtk__nrrdLoadUIJN #define _nrrdLoadUILL cmtk__nrrdLoadUILL #define _nrrdLoadUISH cmtk__nrrdLoadUISH #define _nrrdLoadUIUC cmtk__nrrdLoadUIUC #define _nrrdLoadUIUI cmtk__nrrdLoadUIUI #define _nrrdLoadUIUL cmtk__nrrdLoadUIUL #define _nrrdLoadUIUS cmtk__nrrdLoadUIUS #define _nrrdLookupDBCH cmtk__nrrdLookupDBCH #define _nrrdLookupDBDB cmtk__nrrdLookupDBDB #define _nrrdLookupDBFL cmtk__nrrdLookupDBFL #define _nrrdLookupDBJN cmtk__nrrdLookupDBJN #define _nrrdLookupDBLL cmtk__nrrdLookupDBLL #define _nrrdLookupDBSH cmtk__nrrdLookupDBSH #define _nrrdLookupDBUC cmtk__nrrdLookupDBUC #define _nrrdLookupDBUI cmtk__nrrdLookupDBUI #define _nrrdLookupDBUL cmtk__nrrdLookupDBUL #define _nrrdLookupDBUS cmtk__nrrdLookupDBUS #define _nrrdLookupFLCH cmtk__nrrdLookupFLCH #define _nrrdLookupFLDB cmtk__nrrdLookupFLDB #define _nrrdLookupFLFL cmtk__nrrdLookupFLFL #define _nrrdLookupFLJN cmtk__nrrdLookupFLJN #define _nrrdLookupFLLL cmtk__nrrdLookupFLLL #define _nrrdLookupFLSH cmtk__nrrdLookupFLSH #define _nrrdLookupFLUC cmtk__nrrdLookupFLUC #define _nrrdLookupFLUI cmtk__nrrdLookupFLUI #define _nrrdLookupFLUL cmtk__nrrdLookupFLUL #define _nrrdLookupFLUS cmtk__nrrdLookupFLUS #define _nrrdLookupJNCH cmtk__nrrdLookupJNCH #define _nrrdLookupJNDB cmtk__nrrdLookupJNDB #define _nrrdLookupJNFL cmtk__nrrdLookupJNFL #define _nrrdLookupJNJN cmtk__nrrdLookupJNJN #define _nrrdLookupJNLL cmtk__nrrdLookupJNLL #define _nrrdLookupJNSH cmtk__nrrdLookupJNSH #define _nrrdLookupJNUC cmtk__nrrdLookupJNUC #define _nrrdLookupJNUI cmtk__nrrdLookupJNUI #define _nrrdLookupJNUL cmtk__nrrdLookupJNUL #define _nrrdLookupJNUS cmtk__nrrdLookupJNUS #define _nrrdLookupUICH cmtk__nrrdLookupUICH #define _nrrdLookupUIDB cmtk__nrrdLookupUIDB #define _nrrdLookupUIFL cmtk__nrrdLookupUIFL #define _nrrdLookupUIJN cmtk__nrrdLookupUIJN #define _nrrdLookupUILL cmtk__nrrdLookupUILL #define _nrrdLookupUISH cmtk__nrrdLookupUISH #define _nrrdLookupUIUC cmtk__nrrdLookupUIUC #define _nrrdLookupUIUI cmtk__nrrdLookupUIUI #define _nrrdLookupUIUL cmtk__nrrdLookupUIUL #define _nrrdLookupUIUS cmtk__nrrdLookupUIUS #define _nrrdSprintCH cmtk__nrrdSprintCH #define _nrrdSprintDB cmtk__nrrdSprintDB #define _nrrdSprintFL cmtk__nrrdSprintFL #define _nrrdSprintIN cmtk__nrrdSprintIN #define _nrrdSprintLL cmtk__nrrdSprintLL #define _nrrdSprintSH cmtk__nrrdSprintSH #define _nrrdSprintUC cmtk__nrrdSprintUC #define _nrrdSprintUI cmtk__nrrdSprintUI #define _nrrdSprintUL cmtk__nrrdSprintUL #define _nrrdSprintUS cmtk__nrrdSprintUS #define _nrrdStoreDBCH cmtk__nrrdStoreDBCH #define _nrrdStoreDBDB cmtk__nrrdStoreDBDB #define _nrrdStoreDBFL cmtk__nrrdStoreDBFL #define _nrrdStoreDBJN cmtk__nrrdStoreDBJN #define _nrrdStoreDBLL cmtk__nrrdStoreDBLL #define _nrrdStoreDBSH cmtk__nrrdStoreDBSH #define _nrrdStoreDBUC cmtk__nrrdStoreDBUC #define _nrrdStoreDBUI cmtk__nrrdStoreDBUI #define _nrrdStoreDBUL cmtk__nrrdStoreDBUL #define _nrrdStoreDBUS cmtk__nrrdStoreDBUS #define _nrrdStoreFLCH cmtk__nrrdStoreFLCH #define _nrrdStoreFLDB cmtk__nrrdStoreFLDB #define _nrrdStoreFLFL cmtk__nrrdStoreFLFL #define _nrrdStoreFLJN cmtk__nrrdStoreFLJN #define _nrrdStoreFLLL cmtk__nrrdStoreFLLL #define _nrrdStoreFLSH cmtk__nrrdStoreFLSH #define _nrrdStoreFLUC cmtk__nrrdStoreFLUC #define _nrrdStoreFLUI cmtk__nrrdStoreFLUI #define _nrrdStoreFLUL cmtk__nrrdStoreFLUL #define _nrrdStoreFLUS cmtk__nrrdStoreFLUS #define _nrrdStoreJNCH cmtk__nrrdStoreJNCH #define _nrrdStoreJNDB cmtk__nrrdStoreJNDB #define _nrrdStoreJNFL cmtk__nrrdStoreJNFL #define _nrrdStoreJNJN cmtk__nrrdStoreJNJN #define _nrrdStoreJNLL cmtk__nrrdStoreJNLL #define _nrrdStoreJNSH cmtk__nrrdStoreJNSH #define _nrrdStoreJNUC cmtk__nrrdStoreJNUC #define _nrrdStoreJNUI cmtk__nrrdStoreJNUI #define _nrrdStoreJNUL cmtk__nrrdStoreJNUL #define _nrrdStoreJNUS cmtk__nrrdStoreJNUS #define _nrrdStoreUICH cmtk__nrrdStoreUICH #define _nrrdStoreUIDB cmtk__nrrdStoreUIDB #define _nrrdStoreUIFL cmtk__nrrdStoreUIFL #define _nrrdStoreUIJN cmtk__nrrdStoreUIJN #define _nrrdStoreUILL cmtk__nrrdStoreUILL #define _nrrdStoreUISH cmtk__nrrdStoreUISH #define _nrrdStoreUIUC cmtk__nrrdStoreUIUC #define _nrrdStoreUIUI cmtk__nrrdStoreUIUI #define _nrrdStoreUIUL cmtk__nrrdStoreUIUL #define _nrrdStoreUIUS cmtk__nrrdStoreUIUS #define nrrdDInsert cmtk_nrrdDInsert #define nrrdDLoad cmtk_nrrdDLoad #define nrrdDLookup cmtk_nrrdDLookup #define nrrdDStore cmtk_nrrdDStore #define nrrdFInsert cmtk_nrrdFInsert #define nrrdFLoad cmtk_nrrdFLoad #define nrrdFLookup cmtk_nrrdFLookup #define nrrdFStore cmtk_nrrdFStore #define nrrdIInsert cmtk_nrrdIInsert #define nrrdILoad cmtk_nrrdILoad #define nrrdILookup cmtk_nrrdILookup #define nrrdIStore cmtk_nrrdIStore #define nrrdSprint cmtk_nrrdSprint #define nrrdUIInsert cmtk_nrrdUIInsert #define nrrdUILoad cmtk_nrrdUILoad #define nrrdUILookup cmtk_nrrdUILookup #define nrrdUIStore cmtk_nrrdUIStore #define nrrdDefaultCenter cmtk_nrrdDefaultCenter #define nrrdDefaultSpacing cmtk_nrrdDefaultSpacing #define nrrdDefaultWriteBareText cmtk_nrrdDefaultWriteBareText #define nrrdDefaultWriteCharsPerLine cmtk_nrrdDefaultWriteCharsPerLine #define nrrdDefaultWriteEncodingType cmtk_nrrdDefaultWriteEncodingType #define nrrdDefaultWriteValsPerLine cmtk_nrrdDefaultWriteValsPerLine #define nrrdStateAlwaysSetContent cmtk_nrrdStateAlwaysSetContent #define nrrdStateDisableContent cmtk_nrrdStateDisableContent #define nrrdStateGrayscaleImage3D cmtk_nrrdStateGrayscaleImage3D #define nrrdStateKeyValuePairsPropagate cmtk_nrrdStateKeyValuePairsPropagate #define nrrdStateKeyValueReturnInternalPointers cmtk_nrrdStateKeyValueReturnInternalPointers #define nrrdStateKindNoop cmtk_nrrdStateKindNoop #define nrrdStateUnknownContent cmtk_nrrdStateUnknownContent #define nrrdStateVerboseIO cmtk_nrrdStateVerboseIO #define _nrrdCenterDesc cmtk__nrrdCenterDesc #define _nrrdCenterStr cmtk__nrrdCenterStr #define _nrrdCenter_enum cmtk__nrrdCenter_enum #define _nrrdEncodingType cmtk__nrrdEncodingType #define _nrrdEncodingTypeDesc cmtk__nrrdEncodingTypeDesc #define _nrrdEncodingTypeStr cmtk__nrrdEncodingTypeStr #define _nrrdEncodingTypeStrEqv cmtk__nrrdEncodingTypeStrEqv #define _nrrdEncodingTypeValEqv cmtk__nrrdEncodingTypeValEqv #define _nrrdField cmtk__nrrdField #define _nrrdFieldDesc cmtk__nrrdFieldDesc #define _nrrdFieldStr cmtk__nrrdFieldStr #define _nrrdFieldStrEqv cmtk__nrrdFieldStrEqv #define _nrrdFieldValEqv cmtk__nrrdFieldValEqv #define _nrrdFormatType cmtk__nrrdFormatType #define _nrrdFormatTypeDesc cmtk__nrrdFormatTypeDesc #define _nrrdFormatTypeStr cmtk__nrrdFormatTypeStr #define _nrrdFormatTypeStrEqv cmtk__nrrdFormatTypeStrEqv #define _nrrdFormatTypeValEqv cmtk__nrrdFormatTypeValEqv #define _nrrdKindDesc cmtk__nrrdKindDesc #define _nrrdKindStr cmtk__nrrdKindStr #define _nrrdKindStr_Eqv cmtk__nrrdKindStr_Eqv #define _nrrdKindVal_Eqv cmtk__nrrdKindVal_Eqv #define _nrrdKind_enum cmtk__nrrdKind_enum #define _nrrdSpace cmtk__nrrdSpace #define _nrrdSpaceDesc cmtk__nrrdSpaceDesc #define _nrrdSpaceStr cmtk__nrrdSpaceStr #define _nrrdSpaceStrEqv cmtk__nrrdSpaceStrEqv #define _nrrdSpaceValEqv cmtk__nrrdSpaceValEqv #define _nrrdSpacingStatus cmtk__nrrdSpacingStatus #define _nrrdSpacingStatusDesc cmtk__nrrdSpacingStatusDesc #define _nrrdSpacingStatusStr cmtk__nrrdSpacingStatusStr #define _nrrdType cmtk__nrrdType #define _nrrdTypeDesc cmtk__nrrdTypeDesc #define _nrrdTypeStr cmtk__nrrdTypeStr #define _nrrdTypeStrEqv cmtk__nrrdTypeStrEqv #define _nrrdTypeValEqv cmtk__nrrdTypeValEqv #define nrrdCenter cmtk_nrrdCenter #define nrrdEncodingType cmtk_nrrdEncodingType #define nrrdField cmtk_nrrdField #define nrrdFormatType cmtk_nrrdFormatType #define nrrdKind cmtk_nrrdKind #define nrrdSpace cmtk_nrrdSpace #define nrrdSpacingStatus cmtk_nrrdSpacingStatus #define nrrdType cmtk_nrrdType #define _nrrdFieldOnePerAxis cmtk__nrrdFieldOnePerAxis #define _nrrdFieldRequired cmtk__nrrdFieldRequired #define _nrrdFieldValidInImage cmtk__nrrdFieldValidInImage #define _nrrdFieldValidInText cmtk__nrrdFieldValidInText #define nrrdTypeIsIntegral cmtk_nrrdTypeIsIntegral #define nrrdTypeIsUnsigned cmtk_nrrdTypeIsUnsigned #define nrrdTypeMax cmtk_nrrdTypeMax #define nrrdTypeMin cmtk_nrrdTypeMin #define nrrdTypeNumberOfValues cmtk_nrrdTypeNumberOfValues #define nrrdTypePrintfStr cmtk_nrrdTypePrintfStr #define nrrdTypeSize cmtk_nrrdTypeSize #define _nrrdAxisInfoInit cmtk__nrrdAxisInfoInit #define _nrrdAxisInfoNewInit cmtk__nrrdAxisInfoNewInit #define _nrrdCopy cmtk__nrrdCopy #define _nrrdSizeCheck cmtk__nrrdSizeCheck #define nrrdAlloc_nva cmtk_nrrdAlloc_nva #define nrrdAlloc_va cmtk_nrrdAlloc_va #define nrrdAxisInfoCopy cmtk_nrrdAxisInfoCopy #define nrrdAxisInfoGet_nva cmtk_nrrdAxisInfoGet_nva #define nrrdAxisInfoSet_nva cmtk_nrrdAxisInfoSet_nva #define nrrdBasicInfoCopy cmtk_nrrdBasicInfoCopy #define nrrdBasicInfoInit cmtk_nrrdBasicInfoInit #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdCommentClear cmtk_nrrdCommentClear #define nrrdCommentCopy cmtk_nrrdCommentCopy #define nrrdCopy cmtk_nrrdCopy #define nrrdDefaultWriteBareText cmtk_nrrdDefaultWriteBareText #define nrrdDefaultWriteCharsPerLine cmtk_nrrdDefaultWriteCharsPerLine #define nrrdDefaultWriteValsPerLine cmtk_nrrdDefaultWriteValsPerLine #define nrrdElementNumber cmtk_nrrdElementNumber #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEmpty cmtk_nrrdEmpty #define nrrdEncodingUnknown cmtk_nrrdEncodingUnknown #define nrrdFormatUnknown cmtk_nrrdFormatUnknown #define nrrdInit cmtk_nrrdInit #define nrrdIoStateInit cmtk_nrrdIoStateInit #define nrrdIoStateNew cmtk_nrrdIoStateNew #define nrrdIoStateNix cmtk_nrrdIoStateNix #define nrrdKeyValueClear cmtk_nrrdKeyValueClear #define nrrdKeyValueCopy cmtk_nrrdKeyValueCopy #define nrrdMaybeAlloc_nva cmtk_nrrdMaybeAlloc_nva #define nrrdMaybeAlloc_va cmtk_nrrdMaybeAlloc_va #define nrrdNew cmtk_nrrdNew #define nrrdNix cmtk_nrrdNix #define nrrdNuke cmtk_nrrdNuke #define nrrdPGM cmtk_nrrdPGM #define nrrdPPM cmtk_nrrdPPM #define nrrdType cmtk_nrrdType #define nrrdTypeSize cmtk_nrrdTypeSize #define nrrdWrap_nva cmtk_nrrdWrap_nva #define nrrdWrap_va cmtk_nrrdWrap_va #define _nrrdAxisInfoCopy cmtk__nrrdAxisInfoCopy #define _nrrdAxisInfoInit cmtk__nrrdAxisInfoInit #define _nrrdCopy cmtk__nrrdCopy #define _nrrdKindAltered cmtk__nrrdKindAltered #define nrrdAxesInsert cmtk_nrrdAxesInsert #define nrrdAxesPermute cmtk_nrrdAxesPermute #define nrrdAxisInfoCopy cmtk_nrrdAxisInfoCopy #define nrrdAxisInfoGet_nva cmtk_nrrdAxisInfoGet_nva #define nrrdBasicInfoCopy cmtk_nrrdBasicInfoCopy #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdContentSet_va cmtk_nrrdContentSet_va #define nrrdCopy cmtk_nrrdCopy #define nrrdElementNumber cmtk_nrrdElementNumber #define nrrdElementSize cmtk_nrrdElementSize #define nrrdInvertPerm cmtk_nrrdInvertPerm #define nrrdKindSize cmtk_nrrdKindSize #define nrrdMaybeAlloc_nva cmtk_nrrdMaybeAlloc_nva #define nrrdShuffle cmtk_nrrdShuffle #define nrrdStateKeyValuePairsPropagate cmtk_nrrdStateKeyValuePairsPropagate #define nrrdStateKindNoop cmtk_nrrdStateKindNoop #define _nrrdAxisInfoCopy cmtk__nrrdAxisInfoCopy #define _nrrdAxisInfoInit cmtk__nrrdAxisInfoInit #define _nrrdAxisInfoNewInit cmtk__nrrdAxisInfoNewInit #define _nrrdCenter cmtk__nrrdCenter #define _nrrdCenter2 cmtk__nrrdCenter2 #define _nrrdCheck cmtk__nrrdCheck #define _nrrdKindAltered cmtk__nrrdKindAltered #define _nrrdSpaceVecExists cmtk__nrrdSpaceVecExists #define nrrdAxisInfoCopy cmtk_nrrdAxisInfoCopy #define nrrdAxisInfoGet_nva cmtk_nrrdAxisInfoGet_nva #define nrrdAxisInfoGet_va cmtk_nrrdAxisInfoGet_va #define nrrdAxisInfoIdx cmtk_nrrdAxisInfoIdx #define nrrdAxisInfoIdxRange cmtk_nrrdAxisInfoIdxRange #define nrrdAxisInfoMinMaxSet cmtk_nrrdAxisInfoMinMaxSet #define nrrdAxisInfoPos cmtk_nrrdAxisInfoPos #define nrrdAxisInfoPosRange cmtk_nrrdAxisInfoPosRange #define nrrdAxisInfoSet_nva cmtk_nrrdAxisInfoSet_nva #define nrrdAxisInfoSet_va cmtk_nrrdAxisInfoSet_va #define nrrdAxisInfoSpacingSet cmtk_nrrdAxisInfoSpacingSet #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdCopy cmtk_nrrdCopy #define nrrdDefaultCenter cmtk_nrrdDefaultCenter #define nrrdDefaultSpacing cmtk_nrrdDefaultSpacing #define nrrdDomainAxesGet cmtk_nrrdDomainAxesGet #define nrrdKindIsDomain cmtk_nrrdKindIsDomain #define nrrdKindSize cmtk_nrrdKindSize #define nrrdNonSpatialAxesGet cmtk_nrrdNonSpatialAxesGet #define nrrdOrientationReduce cmtk_nrrdOrientationReduce #define nrrdRangeAxesGet cmtk_nrrdRangeAxesGet #define nrrdSpaceSet cmtk_nrrdSpaceSet #define nrrdSpaceVecNorm cmtk_nrrdSpaceVecNorm #define nrrdSpaceVecScale cmtk_nrrdSpaceVecScale #define nrrdSpaceVecSetNaN cmtk_nrrdSpaceVecSetNaN #define nrrdSpacingCalculate cmtk_nrrdSpacingCalculate #define nrrdSpatialAxesGet cmtk_nrrdSpatialAxesGet #define nrrdStateKindNoop cmtk_nrrdStateKindNoop #define _nrrdCheck cmtk__nrrdCheck #define _nrrdCheckEnums cmtk__nrrdCheckEnums #define _nrrdContentGet cmtk__nrrdContentGet #define _nrrdContentSet_nva cmtk__nrrdContentSet_nva #define _nrrdContentSet_va cmtk__nrrdContentSet_va #define _nrrdFieldCheck cmtk__nrrdFieldCheck #define _nrrdFieldCheckSpaceInfo cmtk__nrrdFieldCheckSpaceInfo #define _nrrdFieldCheck_axis_maxs cmtk__nrrdFieldCheck_axis_maxs #define _nrrdFieldCheck_axis_mins cmtk__nrrdFieldCheck_axis_mins #define _nrrdFieldCheck_block_size cmtk__nrrdFieldCheck_block_size #define _nrrdFieldCheck_centers cmtk__nrrdFieldCheck_centers #define _nrrdFieldCheck_dimension cmtk__nrrdFieldCheck_dimension #define _nrrdFieldCheck_keyvalue cmtk__nrrdFieldCheck_keyvalue #define _nrrdFieldCheck_kinds cmtk__nrrdFieldCheck_kinds #define _nrrdFieldCheck_labels cmtk__nrrdFieldCheck_labels #define _nrrdFieldCheck_measurement_frame cmtk__nrrdFieldCheck_measurement_frame #define _nrrdFieldCheck_noop cmtk__nrrdFieldCheck_noop #define _nrrdFieldCheck_old_max cmtk__nrrdFieldCheck_old_max #define _nrrdFieldCheck_old_min cmtk__nrrdFieldCheck_old_min #define _nrrdFieldCheck_sizes cmtk__nrrdFieldCheck_sizes #define _nrrdFieldCheck_space cmtk__nrrdFieldCheck_space #define _nrrdFieldCheck_space_dimension cmtk__nrrdFieldCheck_space_dimension #define _nrrdFieldCheck_space_directions cmtk__nrrdFieldCheck_space_directions #define _nrrdFieldCheck_space_origin cmtk__nrrdFieldCheck_space_origin #define _nrrdFieldCheck_space_units cmtk__nrrdFieldCheck_space_units #define _nrrdFieldCheck_spacings cmtk__nrrdFieldCheck_spacings #define _nrrdFieldCheck_thicknesses cmtk__nrrdFieldCheck_thicknesses #define _nrrdFieldCheck_type cmtk__nrrdFieldCheck_type #define _nrrdFieldCheck_units cmtk__nrrdFieldCheck_units #define _nrrdSizeCheck cmtk__nrrdSizeCheck #define _nrrdSplitSizes cmtk__nrrdSplitSizes #define nrrdAxisInfoGet_nva cmtk_nrrdAxisInfoGet_nva #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdCenter cmtk_nrrdCenter #define nrrdCheck cmtk_nrrdCheck #define nrrdContentSet_va cmtk_nrrdContentSet_va #define nrrdDefaultCenter cmtk_nrrdDefaultCenter #define nrrdDefaultWriteEncodingType cmtk_nrrdDefaultWriteEncodingType #define nrrdDescribe cmtk_nrrdDescribe #define nrrdElementNumber cmtk_nrrdElementNumber #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingType cmtk_nrrdEncodingType #define nrrdField cmtk_nrrdField #define nrrdKind cmtk_nrrdKind #define nrrdKindSize cmtk_nrrdKindSize #define nrrdOriginCalculate cmtk_nrrdOriginCalculate #define nrrdSameSize cmtk_nrrdSameSize #define nrrdSanity cmtk_nrrdSanity #define nrrdSpace cmtk_nrrdSpace #define nrrdSpaceDimension cmtk_nrrdSpaceDimension #define nrrdSpaceDimensionSet cmtk_nrrdSpaceDimensionSet #define nrrdSpaceOriginGet cmtk_nrrdSpaceOriginGet #define nrrdSpaceOriginSet cmtk_nrrdSpaceOriginSet #define nrrdSpaceSet cmtk_nrrdSpaceSet #define nrrdSpaceVecCopy cmtk_nrrdSpaceVecCopy #define nrrdSpaceVecNorm cmtk_nrrdSpaceVecNorm #define nrrdSpaceVecScale cmtk_nrrdSpaceVecScale #define nrrdSpaceVecScaleAdd2 cmtk_nrrdSpaceVecScaleAdd2 #define nrrdSpaceVecSetNaN cmtk_nrrdSpaceVecSetNaN #define nrrdStateAlwaysSetContent cmtk_nrrdStateAlwaysSetContent #define nrrdStateDisableContent cmtk_nrrdStateDisableContent #define nrrdStateUnknownContent cmtk_nrrdStateUnknownContent #define nrrdType cmtk_nrrdType #define nrrdTypeIsIntegral cmtk_nrrdTypeIsIntegral #define nrrdTypeSize cmtk_nrrdTypeSize #define _nrrdFormatURLLine0 cmtk__nrrdFormatURLLine0 #define _nrrdFormatURLLine1 cmtk__nrrdFormatURLLine1 #define nrrdCommentAdd cmtk_nrrdCommentAdd #define nrrdCommentClear cmtk_nrrdCommentClear #define nrrdCommentCopy cmtk_nrrdCommentCopy #define _nrrdKeyValueIdxFind cmtk__nrrdKeyValueIdxFind #define _nrrdKeyValueWrite cmtk__nrrdKeyValueWrite #define _nrrdWriteEscaped cmtk__nrrdWriteEscaped #define nrrdKeyValueAdd cmtk_nrrdKeyValueAdd #define nrrdKeyValueClear cmtk_nrrdKeyValueClear #define nrrdKeyValueCopy cmtk_nrrdKeyValueCopy #define nrrdKeyValueErase cmtk_nrrdKeyValueErase #define nrrdKeyValueGet cmtk_nrrdKeyValueGet #define nrrdKeyValueIndex cmtk_nrrdKeyValueIndex #define nrrdKeyValueSize cmtk_nrrdKeyValueSize #define nrrdStateKeyValueReturnInternalPointers cmtk_nrrdStateKeyValueReturnInternalPointers #define _nrrdBlockEndian cmtk__nrrdBlockEndian #define _nrrdNoopEndian cmtk__nrrdNoopEndian #define _nrrdSwap16Endian cmtk__nrrdSwap16Endian #define _nrrdSwap32Endian cmtk__nrrdSwap32Endian #define _nrrdSwap64Endian cmtk__nrrdSwap64Endian #define _nrrdSwapEndian cmtk__nrrdSwapEndian #define nrrdElementNumber cmtk_nrrdElementNumber #define nrrdSwapEndian cmtk_nrrdSwapEndian #define nrrdType cmtk_nrrdType #define _nrrdContainsPercentThisAndMore cmtk__nrrdContainsPercentThisAndMore #define _nrrdDataFNCheck cmtk__nrrdDataFNCheck #define _nrrdDataFNNumber cmtk__nrrdDataFNNumber #define _nrrdFieldCheck cmtk__nrrdFieldCheck #define _nrrdFieldSep cmtk__nrrdFieldSep #define _nrrdGetQuotedString cmtk__nrrdGetQuotedString #define _nrrdHeaderCheck cmtk__nrrdHeaderCheck #define _nrrdNoSpaceVector cmtk__nrrdNoSpaceVector #define _nrrdOneLine cmtk__nrrdOneLine #define _nrrdReadNrrdParseField cmtk__nrrdReadNrrdParseField #define _nrrdReadNrrdParse_axis_maxs cmtk__nrrdReadNrrdParse_axis_maxs #define _nrrdReadNrrdParse_axis_mins cmtk__nrrdReadNrrdParse_axis_mins #define _nrrdReadNrrdParse_block_size cmtk__nrrdReadNrrdParse_block_size #define _nrrdReadNrrdParse_byte_skip cmtk__nrrdReadNrrdParse_byte_skip #define _nrrdReadNrrdParse_centers cmtk__nrrdReadNrrdParse_centers #define _nrrdReadNrrdParse_comment cmtk__nrrdReadNrrdParse_comment #define _nrrdReadNrrdParse_content cmtk__nrrdReadNrrdParse_content #define _nrrdReadNrrdParse_data_file cmtk__nrrdReadNrrdParse_data_file #define _nrrdReadNrrdParse_dimension cmtk__nrrdReadNrrdParse_dimension #define _nrrdReadNrrdParse_encoding cmtk__nrrdReadNrrdParse_encoding #define _nrrdReadNrrdParse_endian cmtk__nrrdReadNrrdParse_endian #define _nrrdReadNrrdParse_keyvalue cmtk__nrrdReadNrrdParse_keyvalue #define _nrrdReadNrrdParse_kinds cmtk__nrrdReadNrrdParse_kinds #define _nrrdReadNrrdParse_labels cmtk__nrrdReadNrrdParse_labels #define _nrrdReadNrrdParse_line_skip cmtk__nrrdReadNrrdParse_line_skip #define _nrrdReadNrrdParse_max cmtk__nrrdReadNrrdParse_max #define _nrrdReadNrrdParse_measurement_frame cmtk__nrrdReadNrrdParse_measurement_frame #define _nrrdReadNrrdParse_min cmtk__nrrdReadNrrdParse_min #define _nrrdReadNrrdParse_nonfield cmtk__nrrdReadNrrdParse_nonfield #define _nrrdReadNrrdParse_number cmtk__nrrdReadNrrdParse_number #define _nrrdReadNrrdParse_old_max cmtk__nrrdReadNrrdParse_old_max #define _nrrdReadNrrdParse_old_min cmtk__nrrdReadNrrdParse_old_min #define _nrrdReadNrrdParse_sample_units cmtk__nrrdReadNrrdParse_sample_units #define _nrrdReadNrrdParse_sizes cmtk__nrrdReadNrrdParse_sizes #define _nrrdReadNrrdParse_space cmtk__nrrdReadNrrdParse_space #define _nrrdReadNrrdParse_space_dimension cmtk__nrrdReadNrrdParse_space_dimension #define _nrrdReadNrrdParse_space_directions cmtk__nrrdReadNrrdParse_space_directions #define _nrrdReadNrrdParse_space_origin cmtk__nrrdReadNrrdParse_space_origin #define _nrrdReadNrrdParse_space_units cmtk__nrrdReadNrrdParse_space_units #define _nrrdReadNrrdParse_spacings cmtk__nrrdReadNrrdParse_spacings #define _nrrdReadNrrdParse_thicknesses cmtk__nrrdReadNrrdParse_thicknesses #define _nrrdReadNrrdParse_type cmtk__nrrdReadNrrdParse_type #define _nrrdReadNrrdParse_units cmtk__nrrdReadNrrdParse_units #define _nrrdSpaceVectorParse cmtk__nrrdSpaceVectorParse #define _nrrdSplitSizes cmtk__nrrdSplitSizes #define nrrdAxisInfoSet_nva cmtk_nrrdAxisInfoSet_nva #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdCenter cmtk_nrrdCenter #define nrrdCommentAdd cmtk_nrrdCommentAdd #define nrrdEncodingArray cmtk_nrrdEncodingArray #define nrrdEncodingType cmtk_nrrdEncodingType #define nrrdField cmtk_nrrdField #define nrrdFieldInfoParse cmtk_nrrdFieldInfoParse #define nrrdKeyValueAdd cmtk_nrrdKeyValueAdd #define nrrdKind cmtk_nrrdKind #define nrrdSpace cmtk_nrrdSpace #define nrrdSpaceSet cmtk_nrrdSpaceSet #define nrrdType cmtk_nrrdType #define _nrrdGzCheckHeader cmtk__nrrdGzCheckHeader #define _nrrdGzClose cmtk__nrrdGzClose #define _nrrdGzDestroy cmtk__nrrdGzDestroy #define _nrrdGzDummySymbol cmtk__nrrdGzDummySymbol #define _nrrdGzErrMsg cmtk__nrrdGzErrMsg #define _nrrdGzGetByte cmtk__nrrdGzGetByte #define _nrrdGzOpen cmtk__nrrdGzOpen #define _nrrdGzRead cmtk__nrrdGzRead #define _nrrdGzWrite cmtk__nrrdGzWrite #define nrrdBiffKey cmtk_nrrdBiffKey #define _nrrdCalloc cmtk__nrrdCalloc #define _nrrdCheck cmtk__nrrdCheck #define _nrrdContainsPercentThisAndMore cmtk__nrrdContainsPercentThisAndMore #define _nrrdDataFNNumber cmtk__nrrdDataFNNumber #define _nrrdFieldSep cmtk__nrrdFieldSep #define _nrrdHeaderStringOneLine cmtk__nrrdHeaderStringOneLine #define _nrrdHeaderStringOneLineStrlen cmtk__nrrdHeaderStringOneLineStrlen #define _nrrdLineSep cmtk__nrrdLineSep #define _nrrdNoSpaceVector cmtk__nrrdNoSpaceVector #define _nrrdOneLine cmtk__nrrdOneLine #define _nrrdRead cmtk__nrrdRead #define _nrrdRelativePathFlag cmtk__nrrdRelativePathFlag #define _nrrdSplitName cmtk__nrrdSplitName #define _nrrdTextSep cmtk__nrrdTextSep #define nrrdAxesInsert cmtk_nrrdAxesInsert #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdByteSkip cmtk_nrrdByteSkip #define nrrdElementNumber cmtk_nrrdElementNumber #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingRaw cmtk_nrrdEncodingRaw #define nrrdFormatArray cmtk_nrrdFormatArray #define nrrdFormatNRRD cmtk_nrrdFormatNRRD #define nrrdFormatUnknown cmtk_nrrdFormatUnknown #define nrrdInit cmtk_nrrdInit #define nrrdIoStateNew cmtk_nrrdIoStateNew #define nrrdIoStateNix cmtk_nrrdIoStateNix #define nrrdLineSkip cmtk_nrrdLineSkip #define nrrdLoad cmtk_nrrdLoad #define nrrdLoadMulti cmtk_nrrdLoadMulti #define nrrdRead cmtk_nrrdRead #define nrrdSanity cmtk_nrrdSanity #define nrrdStateGrayscaleImage3D cmtk_nrrdStateGrayscaleImage3D #define nrrdStateVerboseIO cmtk_nrrdStateVerboseIO #define nrrdStringRead cmtk_nrrdStringRead #define _nrrdContainsPercentThisAndMore cmtk__nrrdContainsPercentThisAndMore #define _nrrdEncodingMaybeSet cmtk__nrrdEncodingMaybeSet #define _nrrdFieldInteresting cmtk__nrrdFieldInteresting #define _nrrdFormatMaybeGuess cmtk__nrrdFormatMaybeGuess #define _nrrdFormatMaybeSet cmtk__nrrdFormatMaybeSet #define _nrrdFormatNRRD_whichVersion cmtk__nrrdFormatNRRD_whichVersion #define _nrrdFprintFieldInfo cmtk__nrrdFprintFieldInfo #define _nrrdNoSpaceVector cmtk__nrrdNoSpaceVector #define _nrrdSplitName cmtk__nrrdSplitName #define _nrrdSprintFieldInfo cmtk__nrrdSprintFieldInfo #define _nrrdStrcatSpaceVector cmtk__nrrdStrcatSpaceVector #define _nrrdWrite cmtk__nrrdWrite #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdCenter cmtk_nrrdCenter #define nrrdCheck cmtk_nrrdCheck #define nrrdDefaultWriteEncodingType cmtk_nrrdDefaultWriteEncodingType #define nrrdElementNumber cmtk_nrrdElementNumber #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingArray cmtk_nrrdEncodingArray #define nrrdEncodingUnknown cmtk_nrrdEncodingUnknown #define nrrdField cmtk_nrrdField #define nrrdFormatArray cmtk_nrrdFormatArray #define nrrdFormatNRRD cmtk_nrrdFormatNRRD #define nrrdFormatUnknown cmtk_nrrdFormatUnknown #define nrrdIoStateEncodingGet cmtk_nrrdIoStateEncodingGet #define nrrdIoStateEncodingSet cmtk_nrrdIoStateEncodingSet #define nrrdIoStateFormatGet cmtk_nrrdIoStateFormatGet #define nrrdIoStateFormatSet cmtk_nrrdIoStateFormatSet #define nrrdIoStateGet cmtk_nrrdIoStateGet #define nrrdIoStateNew cmtk_nrrdIoStateNew #define nrrdIoStateNix cmtk_nrrdIoStateNix #define nrrdIoStateSet cmtk_nrrdIoStateSet #define nrrdKind cmtk_nrrdKind #define nrrdSave cmtk_nrrdSave #define nrrdSaveMulti cmtk_nrrdSaveMulti #define nrrdSpace cmtk_nrrdSpace #define nrrdStateVerboseIO cmtk_nrrdStateVerboseIO #define nrrdStringWrite cmtk_nrrdStringWrite #define nrrdType cmtk_nrrdType #define nrrdWrite cmtk_nrrdWrite #define _nrrdFormatEPS cmtk__nrrdFormatEPS #define _nrrdFormatNRRD cmtk__nrrdFormatNRRD #define _nrrdFormatPNG cmtk__nrrdFormatPNG #define _nrrdFormatPNM cmtk__nrrdFormatPNM #define _nrrdFormatText cmtk__nrrdFormatText #define _nrrdFormatUnknown cmtk__nrrdFormatUnknown #define _nrrdFormatUnknown_available cmtk__nrrdFormatUnknown_available #define _nrrdFormatUnknown_contentStartsLike cmtk__nrrdFormatUnknown_contentStartsLike #define _nrrdFormatUnknown_fitsInto cmtk__nrrdFormatUnknown_fitsInto #define _nrrdFormatUnknown_nameLooksLike cmtk__nrrdFormatUnknown_nameLooksLike #define _nrrdFormatUnknown_read cmtk__nrrdFormatUnknown_read #define _nrrdFormatUnknown_write cmtk__nrrdFormatUnknown_write #define _nrrdFormatVTK cmtk__nrrdFormatVTK #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdFormatArray cmtk_nrrdFormatArray #define nrrdFormatUnknown cmtk_nrrdFormatUnknown #define _nrrdCalloc cmtk__nrrdCalloc #define _nrrdDataFNNumber cmtk__nrrdDataFNNumber #define _nrrdFieldInteresting cmtk__nrrdFieldInteresting #define _nrrdFieldRequired cmtk__nrrdFieldRequired #define _nrrdFormatNRRD cmtk__nrrdFormatNRRD #define _nrrdFormatNRRD_available cmtk__nrrdFormatNRRD_available #define _nrrdFormatNRRD_contentStartsLike cmtk__nrrdFormatNRRD_contentStartsLike #define _nrrdFormatNRRD_fitsInto cmtk__nrrdFormatNRRD_fitsInto #define _nrrdFormatNRRD_nameLooksLike cmtk__nrrdFormatNRRD_nameLooksLike #define _nrrdFormatNRRD_read cmtk__nrrdFormatNRRD_read #define _nrrdFormatNRRD_whichVersion cmtk__nrrdFormatNRRD_whichVersion #define _nrrdFormatNRRD_write cmtk__nrrdFormatNRRD_write #define _nrrdFormatURLLine0 cmtk__nrrdFormatURLLine0 #define _nrrdFormatURLLine1 cmtk__nrrdFormatURLLine1 #define _nrrdFprintFieldInfo cmtk__nrrdFprintFieldInfo #define _nrrdHeaderCheck cmtk__nrrdHeaderCheck #define _nrrdKeyValueWrite cmtk__nrrdKeyValueWrite #define _nrrdOneLine cmtk__nrrdOneLine #define _nrrdReadNrrdParseField cmtk__nrrdReadNrrdParseField #define _nrrdSprintFieldInfo cmtk__nrrdSprintFieldInfo #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdByteSkip cmtk_nrrdByteSkip #define nrrdElementNumber cmtk_nrrdElementNumber #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingAscii cmtk_nrrdEncodingAscii #define nrrdField cmtk_nrrdField #define nrrdFieldInfoParse cmtk_nrrdFieldInfoParse #define nrrdFormatNRRD cmtk_nrrdFormatNRRD #define nrrdIoStateDataFileIterBegin cmtk_nrrdIoStateDataFileIterBegin #define nrrdIoStateDataFileIterNext cmtk_nrrdIoStateDataFileIterNext #define nrrdKeyValueSize cmtk_nrrdKeyValueSize #define nrrdLineSkip cmtk_nrrdLineSkip #define nrrdStateVerboseIO cmtk_nrrdStateVerboseIO #define nrrdSwapEndian cmtk_nrrdSwapEndian #define nrrdType cmtk_nrrdType #define _nrrdEncodingAscii cmtk__nrrdEncodingAscii #define _nrrdEncodingBzip2 cmtk__nrrdEncodingBzip2 #define _nrrdEncodingGzip cmtk__nrrdEncodingGzip #define _nrrdEncodingHex cmtk__nrrdEncodingHex #define _nrrdEncodingRaw cmtk__nrrdEncodingRaw #define _nrrdEncodingUnknown cmtk__nrrdEncodingUnknown #define _nrrdEncodingUnknown_available cmtk__nrrdEncodingUnknown_available #define _nrrdEncodingUnknown_read cmtk__nrrdEncodingUnknown_read #define _nrrdEncodingUnknown_write cmtk__nrrdEncodingUnknown_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdEncodingArray cmtk_nrrdEncodingArray #define nrrdEncodingUnknown cmtk_nrrdEncodingUnknown #define _nrrdEncodingRaw cmtk__nrrdEncodingRaw #define _nrrdEncodingRaw_available cmtk__nrrdEncodingRaw_available #define _nrrdEncodingRaw_read cmtk__nrrdEncodingRaw_read #define _nrrdEncodingRaw_write cmtk__nrrdEncodingRaw_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingRaw cmtk_nrrdEncodingRaw #define nrrdStateVerboseIO cmtk_nrrdStateVerboseIO #define _nrrdEncodingAscii cmtk__nrrdEncodingAscii #define _nrrdEncodingAscii_available cmtk__nrrdEncodingAscii_available #define _nrrdEncodingAscii_read cmtk__nrrdEncodingAscii_read #define _nrrdEncodingAscii_write cmtk__nrrdEncodingAscii_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingAscii cmtk_nrrdEncodingAscii #define nrrdIInsert cmtk_nrrdIInsert #define nrrdSprint cmtk_nrrdSprint #define nrrdType cmtk_nrrdType #define nrrdTypePrintfStr cmtk_nrrdTypePrintfStr #define _nrrdEncodingHex cmtk__nrrdEncodingHex #define _nrrdEncodingHex_available cmtk__nrrdEncodingHex_available #define _nrrdEncodingHex_read cmtk__nrrdEncodingHex_read #define _nrrdEncodingHex_write cmtk__nrrdEncodingHex_write #define _nrrdReadHexTable cmtk__nrrdReadHexTable #define _nrrdWriteHexTable cmtk__nrrdWriteHexTable #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingHex cmtk_nrrdEncodingHex #define _nrrdEncodingGzip cmtk__nrrdEncodingGzip #define _nrrdEncodingGzip_available cmtk__nrrdEncodingGzip_available #define _nrrdEncodingGzip_read cmtk__nrrdEncodingGzip_read #define _nrrdEncodingGzip_write cmtk__nrrdEncodingGzip_write #define _nrrdGzClose cmtk__nrrdGzClose #define _nrrdGzOpen cmtk__nrrdGzOpen #define _nrrdGzRead cmtk__nrrdGzRead #define _nrrdGzWrite cmtk__nrrdGzWrite #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdElementSize cmtk_nrrdElementSize #define nrrdEncodingGzip cmtk_nrrdEncodingGzip #define _nrrdKindAltered cmtk__nrrdKindAltered #define nrrdAxisInfoCopy cmtk_nrrdAxisInfoCopy #define nrrdAxisInfoGet_nva cmtk_nrrdAxisInfoGet_nva #define nrrdAxisInfoPosRange cmtk_nrrdAxisInfoPosRange #define nrrdBasicInfoCopy cmtk_nrrdBasicInfoCopy #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdContentSet_va cmtk_nrrdContentSet_va #define nrrdCrop cmtk_nrrdCrop #define nrrdElementSize cmtk_nrrdElementSize #define nrrdMaybeAlloc_nva cmtk_nrrdMaybeAlloc_nva #define nrrdSlice cmtk_nrrdSlice #define nrrdSpaceVecCopy cmtk_nrrdSpaceVecCopy #define nrrdSpaceVecScaleAdd2 cmtk_nrrdSpaceVecScaleAdd2 #define nrrdStateKeyValuePairsPropagate cmtk_nrrdStateKeyValuePairsPropagate #define nrrdStateKindNoop cmtk_nrrdStateKindNoop #define _nrrdEncodingBzip2 cmtk__nrrdEncodingBzip2 #define _nrrdEncodingBzip2_available cmtk__nrrdEncodingBzip2_available #define _nrrdEncodingBzip2_read cmtk__nrrdEncodingBzip2_read #define _nrrdEncodingBzip2_write cmtk__nrrdEncodingBzip2_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdEncodingBzip2 cmtk_nrrdEncodingBzip2 #define _nrrdFormatEPS cmtk__nrrdFormatEPS #define _nrrdFormatEPS_available cmtk__nrrdFormatEPS_available #define _nrrdFormatEPS_contentStartsLike cmtk__nrrdFormatEPS_contentStartsLike #define _nrrdFormatEPS_fitsInto cmtk__nrrdFormatEPS_fitsInto #define _nrrdFormatEPS_nameLooksLike cmtk__nrrdFormatEPS_nameLooksLike #define _nrrdFormatEPS_read cmtk__nrrdFormatEPS_read #define _nrrdFormatEPS_write cmtk__nrrdFormatEPS_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdFormatEPS cmtk_nrrdFormatEPS #define _nrrdFormatPNG cmtk__nrrdFormatPNG #define _nrrdFormatPNG_available cmtk__nrrdFormatPNG_available #define _nrrdFormatPNG_contentStartsLike cmtk__nrrdFormatPNG_contentStartsLike #define _nrrdFormatPNG_fitsInto cmtk__nrrdFormatPNG_fitsInto #define _nrrdFormatPNG_nameLooksLike cmtk__nrrdFormatPNG_nameLooksLike #define _nrrdFormatPNG_read cmtk__nrrdFormatPNG_read #define _nrrdFormatPNG_write cmtk__nrrdFormatPNG_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdFormatPNG cmtk_nrrdFormatPNG #define _nrrdFormatPNM cmtk__nrrdFormatPNM #define _nrrdFormatPNM_available cmtk__nrrdFormatPNM_available #define _nrrdFormatPNM_contentStartsLike cmtk__nrrdFormatPNM_contentStartsLike #define _nrrdFormatPNM_fitsInto cmtk__nrrdFormatPNM_fitsInto #define _nrrdFormatPNM_nameLooksLike cmtk__nrrdFormatPNM_nameLooksLike #define _nrrdFormatPNM_read cmtk__nrrdFormatPNM_read #define _nrrdFormatPNM_write cmtk__nrrdFormatPNM_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdFormatPNM cmtk_nrrdFormatPNM #define _nrrdFormatText cmtk__nrrdFormatText #define _nrrdFormatText_available cmtk__nrrdFormatText_available #define _nrrdFormatText_contentStartsLike cmtk__nrrdFormatText_contentStartsLike #define _nrrdFormatText_fitsInto cmtk__nrrdFormatText_fitsInto #define _nrrdFormatText_nameLooksLike cmtk__nrrdFormatText_nameLooksLike #define _nrrdFormatText_read cmtk__nrrdFormatText_read #define _nrrdFormatText_write cmtk__nrrdFormatText_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdFormatText cmtk_nrrdFormatText #define _nrrdFormatVTK cmtk__nrrdFormatVTK #define _nrrdFormatVTK_available cmtk__nrrdFormatVTK_available #define _nrrdFormatVTK_contentStartsLike cmtk__nrrdFormatVTK_contentStartsLike #define _nrrdFormatVTK_fitsInto cmtk__nrrdFormatVTK_fitsInto #define _nrrdFormatVTK_nameLooksLike cmtk__nrrdFormatVTK_nameLooksLike #define _nrrdFormatVTK_read cmtk__nrrdFormatVTK_read #define _nrrdFormatVTK_write cmtk__nrrdFormatVTK_write #define nrrdBiffKey cmtk_nrrdBiffKey #define nrrdFormatVTK cmtk_nrrdFormatVTK #endif /* __cmtk_NrrdIO_mangle_h */ cmtk-3.0.0/Utilities/NrrdIO/NrrdIO.h0000644000177700000170000027566612043600504016145 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* * Modified 23-Oct-2010 by Torsten Rohlfing for CMTK, * (C) 2012 SRI International */ #include "NrrdConfigure.h" #include #include #include #include #include #include #include /* ******** TEEM_VERSION ** ** TEEM_VERSION is a single (decimal) number that will always increase ** monotically, and the _MAJOR, _MINOR, _PATCH are also numbers that ** can be used to implement pre-processor logic about specifc ** versions. The TEEM_VERSION_STRING is used in the (existing) char ** *airTeemVersion (added in version 1.9.0). Yes, keeping these in ** sync is currently a manual operation. ** ** NOTE: Significant API changes (aside from API additions) should NOT ** occur with changes in patch level, only with major or minor version ** changes. ** ** NOTE: ../../CMakeLists.txt's Teem_VERSION variables must be in sync */ #define TEEM_VERSION_MAJOR 1 /* must be 1 digit */ #define TEEM_VERSION_MINOR 11 /* 1 or 2 digits */ #define TEEM_VERSION_PATCH 00 /* 1 or 2 digits */ #define TEEM_VERSION 11100 /* must be 5 digits, to facilitate easy numerical comparison */ #define TEEM_VERSION_STRING "1.11.0" /* cannot be so easily compared */ /* THE FOLLOWING INCLUDE IS ONLY FOR THE CMTK DISTRIBUTION. This header mangles the symbols in the NrrdIO library, preventing conflicts in applications linked against two versions of NrrdIO. */ #include "cmtk_NrrdIO_mangle.h" #ifdef __cplusplus extern "C" { #endif #define TEEM_BUILD 1 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(TEEM_STATIC) # if defined(TEEM_BUILD) || defined(air_EXPORTS) || defined(teem_EXPORTS) # define NRRDIO_EXPORT extern __declspec(dllexport) # else # define NRRDIO_EXPORT extern __declspec(dllimport) # endif #else /* TEEM_STATIC || UNIX */ # define NRRDIO_EXPORT extern #endif #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__) typedef signed __int64 airLLong; typedef unsigned __int64 airULLong; # define AIR_LLONG_FMT "%I64d" # define AIR_ULLONG_FMT "%I64u" # define AIR_LLONG(x) x##i64 # define AIR_ULLONG(x) x##ui64 #else typedef signed long long airLLong; typedef unsigned long long airULLong; # define AIR_LLONG_FMT "%lld" # define AIR_ULLONG_FMT "%llu" # define AIR_LLONG(x) x##ll # define AIR_ULLONG(x) x##ull #endif /* ** These serve as conservative estimates on how large various strings ** might end up being. It would be theoretically better to completely ** avoid the use of fixed-size buffers, but in many contexts the ** implementation complexity of handling them reliably is distracts ** from more urgent implementation goals. In the mean time, these can ** be used safely as long as the lengths are used consistently. ** ** The possibly unfortunate convention that has become established in ** Teem is code using these tends to NOT add the "+1", to explicitly ** indicate the space for 0-termination, and instead assumes it is ** part of the numbers below, even though this is at the cost of ** confusion about how the maximal strlen() will be less than each of ** these numbers. This will be addressed in Teem 2.0. */ #define AIR_STRLEN_SMALL (128+1) /* has to be big enough to hold: - printed value of size_t and ptrdiff_t, - line of text that should contain file format "magic" */ #define AIR_STRLEN_MED (256+1) #define AIR_STRLEN_LARGE (512+1) #define AIR_STRLEN_HUGE (1024+1) /* has to be big enough to hold a biff error message (one line of it) */ /* ******** airPtrPtrUnion ** ** union of addresses of pointers to various types, to deal with strict ** aliasing warnings, especially with the first argument to airArrayNew(). ** Unfortunately this can't meet the needs of all such cases because some ** libraries need to manage addresses of arrays of other kinds of ** library-specific objects (about which air is ignorant). */ typedef union { unsigned char **uc; signed char **sc; char **c; char ***cp; unsigned short **us; short **s; unsigned int **ui; int **i; float **f; double **d; void **v; } airPtrPtrUnion; /* ******** airEnum struct ** ** The airEnum provides the basic mechanism of mapping from a ** string to an int enum value, and back. */ typedef struct { const char *name; /* what are these things? */ unsigned int M; /* str[0]: string for the unknown/invalid value; * str[1] .. str[M]: canonical strings for the enum values; * "val" NULL: unknown/invalid = 0; * valid values are 1 .. M * "val" non-NULL: unknown/invalid = val[0]; * valid are val[1].. val[M] */ const char **str; /* see above */ const int *val; /* see above */ const char **desc; /* desc[i] is a short description of the enum values represented by str[i] (thereby starting with the unknown value), to be used to by things like hest */ const char **strEqv; /* If non-NULL, all the variations in strings recognized in mapping from string to value (the values in valEqv). This **MUST** be terminated by a zero-length string ("") so as to signify the end of the list. This should *not* contain the string for unknown/invalid. If "strEqv" is NULL, then mapping from string to value is done only by traversing "str", and "valEqv" is ignored. */ const int *valEqv; /* If strEqv non-NULL, valEqv holds the values corresponding to the strings in strEqv, with one integer for each non-zero-length string in strEqv: strEqv[i] is a valid string representation for value valEqv[i]. This should *not* contain the value for unknown/invalid. This "valEqv" is ignored if "strEqv" is NULL. */ int sense; /* require case matching on strings */ } airEnum; NRRDIO_EXPORT int airEnumUnknown(const airEnum *enm); NRRDIO_EXPORT int airEnumValCheck(const airEnum *enm, int val); NRRDIO_EXPORT const char *airEnumStr(const airEnum *enm, int val); NRRDIO_EXPORT const char *airEnumDesc(const airEnum *enm, int val); NRRDIO_EXPORT int airEnumVal(const airEnum *enm, const char *str); NRRDIO_EXPORT char *airEnumFmtDesc(const airEnum *enm, int val, int canon, const char *fmt); NRRDIO_EXPORT void airEnumPrint(FILE *file, const airEnum *enm); /* ******** airEndian enum ** ** for identifying how a file was written to disk, for those encodings ** where the raw data on disk is dependent on the endianness of the ** architecture. */ enum { airEndianUnknown, /* 0: nobody knows */ airEndianLittle = 1234, /* 1234: Intel and friends */ airEndianBig = 4321, /* 4321: the rest */ airEndianLast }; /* endianAir.c */ NRRDIO_EXPORT const airEnum *const airEndian; NRRDIO_EXPORT int airMyEndian(void); /* array.c: poor-man's dynamically resizable arrays */ typedef struct { void *data, /* where the data is */ **dataP; /* (possibly NULL) address of user's data variable, kept in sync with internal "data" variable */ unsigned int len, /* length of array: # units for which there is considered to be data (which is <= total # units allocated). The # bytes which contain data is len*unit. Always updated (unlike "*lenP") */ *lenP, /* (possibly NULL) address of user's length variable, kept in sync with internal "len" variable */ incr, /* the granularity of the changes in amount of space allocated: when the length reaches a multiple of "incr", then the array is resized */ size; /* array is allocated to have "size" increments, or, size*incr elements, or, size*incr*unit bytes */ size_t unit; /* the size in bytes of one element in the array */ int noReallocWhenSmaller; /* as it says */ /* the following are all callbacks useful for maintaining either an array of pointers (allocCB and freeCB) or array of structs (initCB and doneCB). allocCB or initCB is called when the array length increases, and freeCB or doneCB when it decreases. Any of them can be NULL if no such activity is desired. allocCB sets values in the array (as in storing the return from malloc(); freeCB is called on values in the array (as in calling free()), and the values are cast to void*. allocCB and freeCB don't care about the value of "unit" (though perhaps they should). initCB and doneCB are called on the _addresses_ of elements in the array. allocCB and initCB are called for the elements in ascending order in the array, and freeCB and doneCB are called in descending order. allocCB and initCB are mutually exclusive- they can't both be non-NULL. Same goes for freeCB and doneCB */ void *(*allocCB)(void); /* values of new elements set to return of this */ void *(*freeCB)(void *); /* called on the values of invalidated elements */ void (*initCB)(void *); /* called on addresses of new elements */ void (*doneCB)(void *); /* called on addresses of invalidated elements */ } airArray; NRRDIO_EXPORT airArray *airArrayNew(void **dataP, unsigned int *lenP, size_t unit, unsigned int incr); NRRDIO_EXPORT void airArrayStructCB(airArray *a, void (*initCB)(void *), void (*doneCB)(void *)); NRRDIO_EXPORT void airArrayPointerCB(airArray *a, void *(*allocCB)(void), void *(*freeCB)(void *)); NRRDIO_EXPORT void airArrayLenSet(airArray *a, unsigned int newlen); NRRDIO_EXPORT unsigned int airArrayLenIncr(airArray *a, int delta); NRRDIO_EXPORT airArray *airArrayNix(airArray *a); NRRDIO_EXPORT airArray *airArrayNuke(airArray *a); /* ******** airFP enum ** ** the different kinds of floating point number afforded by IEEE 754, ** and the values returned by airFPClass_f(). ** ** The values probably won't agree with those in #include's like ** ieee.h, ieeefp.h, fp_class.h. This is because IEEE 754 hasn't ** defined standard values for these, so everyone does it differently. ** ** This enum uses underscores (against Teem convention) to help ** legibility while also conforming to the spirit of the somewhat ** standard naming conventions */ enum { airFP_Unknown, /* 0: nobody knows */ airFP_SNAN, /* 1: signalling NaN */ airFP_QNAN, /* 2: quiet NaN */ airFP_POS_INF, /* 3: positive infinity */ airFP_NEG_INF, /* 4: negative infinity */ airFP_POS_NORM, /* 5: positive normalized non-zero */ airFP_NEG_NORM, /* 6: negative normalized non-zero */ airFP_POS_DENORM, /* 7: positive denormalized non-zero */ airFP_NEG_DENORM, /* 8: negative denormalized non-zero */ airFP_POS_ZERO, /* 9: +0.0, positive zero */ airFP_NEG_ZERO, /* 10: -0.0, negative zero */ airFP_Last /* after the last valid one */ }; /* 754.c: IEEE-754 related stuff values */ typedef union { unsigned int i; float f; } airFloat; typedef union { airULLong i; double d; } airDouble; NRRDIO_EXPORT const int airMyQNaNHiBit; NRRDIO_EXPORT float airFPPartsToVal_f(unsigned int sign, unsigned int expo, unsigned int mant); NRRDIO_EXPORT void airFPValToParts_f(unsigned int *signP, unsigned int *expoP, unsigned int *mantP, float v); NRRDIO_EXPORT double airFPPartsToVal_d(unsigned int sign, unsigned int expo, unsigned int mant0, unsigned int mant1); NRRDIO_EXPORT void airFPValToParts_d(unsigned int *signP, unsigned int *expoP, unsigned int *mant0P, unsigned int *mant1P, double v); NRRDIO_EXPORT float airFPGen_f(int cls); NRRDIO_EXPORT double airFPGen_d(int cls); NRRDIO_EXPORT int airFPClass_f(float val); NRRDIO_EXPORT int airFPClass_d(double val); NRRDIO_EXPORT void airFPFprintf_f(FILE *file, float val); NRRDIO_EXPORT void airFPFprintf_d(FILE *file, double val); NRRDIO_EXPORT const airFloat airFloatQNaN; NRRDIO_EXPORT const airFloat airFloatSNaN; NRRDIO_EXPORT const airFloat airFloatPosInf; NRRDIO_EXPORT const airFloat airFloatNegInf; NRRDIO_EXPORT float airNaN(void); NRRDIO_EXPORT int airIsNaN(double d); NRRDIO_EXPORT int airIsInf_f(float f); NRRDIO_EXPORT int airIsInf_d(double d); NRRDIO_EXPORT int airExists(double d); /* ******** airType ** ** Different types which air cares about. ** Currently only used in the command-line parsing, but perhaps will ** be used elsewhere in air later */ enum { airTypeUnknown, /* 0 */ airTypeBool, /* 1 */ airTypeInt, /* 2 */ airTypeUInt, /* 3 */ airTypeLongInt, /* 4 */ airTypeULongInt, /* 5 */ airTypeSize_t, /* 6 */ airTypeFloat, /* 7 */ airTypeDouble, /* 8 */ airTypeChar, /* 9 */ airTypeString, /* 10 */ airTypeEnum, /* 11 */ airTypeOther, /* 12 */ airTypeLast }; #define AIR_TYPE_MAX 12 /* parseAir.c */ NRRDIO_EXPORT double airAtod(const char *str); NRRDIO_EXPORT int airSingleSscanf(const char *str, const char *fmt, void *ptr); NRRDIO_EXPORT const airEnum *const airBool; NRRDIO_EXPORT unsigned int airParseStrB(int *out, const char *s, const char *ct, unsigned int n, ... /* (nothing used) */); NRRDIO_EXPORT unsigned int airParseStrI(int *out, const char *s, const char *ct, unsigned int n, ... /* (nothing used) */); NRRDIO_EXPORT unsigned int airParseStrUI(unsigned int *out, const char *s, const char *ct, unsigned int n, ... /* (nothing used) */); NRRDIO_EXPORT unsigned int airParseStrZ(size_t *out, const char *s, const char *ct, unsigned int n, ... /* (nothing used) */); NRRDIO_EXPORT unsigned int airParseStrF(float *out, const char *s, const char *ct, unsigned int n, ... /* (nothing used) */); NRRDIO_EXPORT unsigned int airParseStrD(double *out, const char *s, const char *ct, unsigned int n, ... /* (nothing used) */); NRRDIO_EXPORT unsigned int airParseStrC(char *out, const char *s, const char *ct, unsigned int n, ... /* (nothing used) */); NRRDIO_EXPORT unsigned int airParseStrS(char **out, const char *s, const char *ct, unsigned int n, ... /* REQ'D even if n>1: int greedy */); NRRDIO_EXPORT unsigned int airParseStrE(int *out, const char *s, const char *ct, unsigned int n, ... /* REQUIRED: airEnum *e */); NRRDIO_EXPORT unsigned int (*airParseStr[AIR_TYPE_MAX+1])(void *, const char *, const char *, unsigned int, ...); /* string.c */ NRRDIO_EXPORT char *airStrdup(const char *s); NRRDIO_EXPORT size_t airStrlen(const char *s); NRRDIO_EXPORT int airStrtokQuoting; NRRDIO_EXPORT char *airStrtok(char *s, const char *ct, char **last); NRRDIO_EXPORT unsigned int airStrntok(const char *s, const char *ct); NRRDIO_EXPORT char *airStrtrans(char *s, char from, char to); NRRDIO_EXPORT char *airStrcpy(char *dst, size_t dstSize, const char *src); NRRDIO_EXPORT int airEndsWith(const char *s, const char *suff); NRRDIO_EXPORT char *airUnescape(char *s); NRRDIO_EXPORT char *airOneLinify(char *s); NRRDIO_EXPORT char *airToLower(char *str); NRRDIO_EXPORT char *airToUpper(char *str); NRRDIO_EXPORT unsigned int airOneLine(FILE *file, char *line, unsigned int size); /* sane.c */ /* ******** airInsane enum ** ** reasons for why airSanity() failed (specifically, the possible ** return values for airSanity() */ enum { airInsane_not, /* 0: actually, all sanity checks passed */ airInsane_endian, /* 1: airMyEndian is wrong */ airInsane_pInfExists, /* 2: AIR_EXISTS(positive infinity) was true */ airInsane_nInfExists, /* 3: AIR_EXISTS(negative infinity) was true */ airInsane_NaNExists, /* 4: AIR_EXISTS(NaN) was true */ airInsane_FltDblFPClass, /* 5: double -> float assignment messed up the airFPClass_f() of the value */ airInsane_QNaNHiBit, /* 6: airMyQNaNHiBit is wrong */ airInsane_AIR_NAN, /* 7: airFPClass_f(AIR_QNAN) wrong (no longer checking on problematic SNAN) */ airInsane_dio, /* 8: airMyDio set to something invalid */ airInsane_UCSize, /* 9: unsigned char isn't 8 bits */ airInsane_FISize, /* 10: sizeof(float), sizeof(int) not 4 */ airInsane_DLSize /* 11: sizeof(double), sizeof(airLLong) not 8 */ }; #define AIR_INSANE_MAX 11 NRRDIO_EXPORT const char *airInsaneErr(int insane); NRRDIO_EXPORT int airSanity(void); /* miscAir.c */ NRRDIO_EXPORT const char *airTeemVersion; NRRDIO_EXPORT const char *airTeemReleaseDate; NRRDIO_EXPORT void *airNull(void); NRRDIO_EXPORT void *airSetNull(void **ptrP); NRRDIO_EXPORT void *airFree(void *ptr); NRRDIO_EXPORT FILE *airFopen(const char *name, FILE *std, const char *mode); NRRDIO_EXPORT FILE *airFclose(FILE *file); NRRDIO_EXPORT int airSinglePrintf(FILE *file, char *str, const char *fmt, ...); NRRDIO_EXPORT char *airSprintSize_t(char str[AIR_STRLEN_SMALL], size_t val); /* dio.c */ /* ******** airNoDio enum ** ** reasons for why direct I/O won't be used with a particular ** file/pointer combination */ enum { airNoDio_okay, /* 0: actually, you CAN do direct I/O */ airNoDio_arch, /* 1: Teem thinks this architecture can't do it */ airNoDio_format, /* 2: Teem thinks given data file format can't use it */ airNoDio_std, /* 3: DIO isn't possible for std{in|out|err} */ airNoDio_fd, /* 4: couldn't get underlying file descriptor */ airNoDio_dioinfo, /* 5: calling fcntl() to get direct I/O info failed */ airNoDio_small, /* 6: requested size is too small */ airNoDio_size, /* 7: requested size not a multiple of d_miniosz */ airNoDio_ptr, /* 8: pointer not multiple of d_mem */ airNoDio_fpos, /* 9: current file position not multiple of d_miniosz */ airNoDio_setfl, /* 10: fcntl(fd, SETFL, FDIRECT) failed */ airNoDio_test, /* 11: couldn't memalign() even a small bit of memory */ airNoDio_disable /* 12: someone disabled it with airDisableDio */ }; #define AIR_NODIO_MAX 12 NRRDIO_EXPORT const char *airNoDioErr(int noDio); NRRDIO_EXPORT const int airMyDio; NRRDIO_EXPORT int airDisableDio; NRRDIO_EXPORT void airDioInfo(int *align, int *min, int *max, int fd); NRRDIO_EXPORT int airDioTest(int fd, const void *ptr, size_t size); NRRDIO_EXPORT void *airDioMalloc(size_t size, int fd); NRRDIO_EXPORT size_t airDioRead(int fd, void *ptr, size_t size); NRRDIO_EXPORT size_t airDioWrite(int fd, const void *ptr, size_t size); /* mop.c: clean-up utilities */ enum { airMopNever, airMopOnError, airMopOnOkay, airMopAlways }; typedef void *(*airMopper)(void *); typedef struct { void *ptr; /* the thing to be processed */ airMopper mop; /* the function to which does the processing */ int when; /* from the airMopWhen enum */ } airMop; NRRDIO_EXPORT airArray *airMopNew(void); NRRDIO_EXPORT int airMopAdd(airArray *arr, void *ptr, airMopper mop, int when); NRRDIO_EXPORT void airMopSub(airArray *arr, void *ptr, airMopper mop); NRRDIO_EXPORT void airMopMem(airArray *arr, void *_ptrP, int when); NRRDIO_EXPORT void airMopUnMem(airArray *arr, void *_ptrP); NRRDIO_EXPORT void airMopPrint(airArray *arr, const void *_str, int when); NRRDIO_EXPORT void airMopDone(airArray *arr, int error); NRRDIO_EXPORT void airMopError(airArray *arr); NRRDIO_EXPORT void airMopOkay(airArray *arr); NRRDIO_EXPORT void airMopDebug(airArray *arr); /******* the interminable sea of defines and macros *******/ #define AIR_TRUE 1 #define AIR_FALSE 0 #define AIR_WHITESPACE " \t\n\r\v\f" /* K+R pg. 157 */ /* ******** AIR_UNUSED ** ** one way of reconciling "warning: unused parameter" with ** C's "error: parameter name omitted" */ #define AIR_UNUSED(x) (void)(x) /* ******** AIR_CAST, AIR_UINT, AIR_INT ** ** just casts, but with the added ability to grep for them more easily, ** since casts should probably always be revisited and reconsidered. */ #define AIR_CAST(t, v) ((t)(v)) #define AIR_UINT(x) AIR_CAST(unsigned int, x) #define AIR_INT(x) AIR_CAST(int, x) /* ******** AIR_VOIDP, AIR_CVOIDP ** ** explicit casting to "void *" (and "const void *") from non-void* pointers ** is strictly speaking needed for the %p format specifier in printf-like ** functions; this is a slightly more convenient form */ #define AIR_VOIDP(x) AIR_CAST(void *, x) #define AIR_CVOIDP(x) AIR_CAST(const void *, x) /* ******** AIR_MALLOC, AIR_CALLOC ** ** slightly simpler wrapper around cast and malloc/calloc ** ** HEY note that "T" is not guarded by parentheses in its first usage, ** as arguments in Teem macros normally are */ #define AIR_MALLOC(N, T) (T*)(malloc((N)*sizeof(T))) #define AIR_CALLOC(N, T) (T*)(calloc((N), sizeof(T))) /* ******** AIR_ENDIAN, AIR_QNANHIBIT, AIR_DIO ** ** These reflect particulars of hardware which we're running on. The ** difference from the things starting with TEEM_ is that the TEEM_ ** values are for passing architecture-specific to compilation of source ** files, and thes AIR_ variables are for advertising that information ** to anyone linking against air (or Teem) and including air.h. */ #define AIR_ENDIAN (airMyEndian()) #define AIR_QNANHIBIT (airMyQNaNHiBit) #define AIR_DIO (airMyDio) /* ******** AIR_NAN, AIR_QNAN, AIR_SNAN, AIR_POS_INF, AIR_NEG_INF ** ** its nice to have these values available without the cost of a ** function call. ** ** NOTE: AIR_POS_INF and AIR_NEG_INF correspond to the _unique_ ** bit-patterns which signify positive and negative infinity. With ** the NaNs, however, they are only one of many possible ** representations. */ #define AIR_NAN (airFloatQNaN.f) #define AIR_QNAN (airFloatQNaN.f) #define AIR_SNAN (airFloatSNaN.f) #define AIR_POS_INF (airFloatPosInf.f) #define AIR_NEG_INF (airFloatNegInf.f) /* ******** AIR_EXISTS ** ** is non-zero (true) only for values which are not NaN or +/-infinity ** ** You'd think that (x == x) might work, but no no no, some optimizing ** compilers (e.g. SGI's cc) say "well of course they're equal, for all ** possible values". Bastards! ** ** One of the benefits of IEEE 754 floating point numbers is that ** gradual underflow means that x = y <==> x - y = 0 for any (positive ** or negative) normalized or denormalized float. Otherwise this ** macro could not be valid; some floating point conventions say that ** a zero-valued exponent means zero, regardless of the mantissa. ** ** However, there MAY be problems on machines which use extended ** (80-bit) floating point registers, such as Intel chips- where the ** same initial value 1) directly read from the register, versus 2) ** saved to memory and loaded back, may end up being different. I ** have yet to produce this behavior, or convince myself it can't happen. ** ** The reason to #define AIR_EXISTS as airExists is that on some ** optimizing compilers, the !((x) - (x)) doesn't work. This has been ** the case on Windows and 64-bit irix6 (64 bit) with -Ofast. If ** airSanity fails because a special value "exists", then use the ** first version of AIR_EXISTS. ** ** There is a performance consequence of using airExists(x), in that it ** is a function call, although (HEY) we should facilitate inline'ing it ** for compilers that know how to. ** ** gcc 4.5.3 -std=c89, at least on cygwin, has problems with ** the type of "!((x) - (x))" when used with bit-wise xor ^, saying ** "invalid operands to binary ^ (have ‘int’ and ‘int’)" but these ** problems oddly went away with the explicit cast to int. */ #if 1 #define AIR_EXISTS(x) (airExists(x)) #else #define AIR_EXISTS(x) (AIR_CAST(int, !((x) - (x)))) #endif /* ******** AIR_MAX(a,b), AIR_MIN(a,b), AIR_ABS(a) ** ** the usual */ #define AIR_MAX(a,b) ((a) > (b) ? (a) : (b)) #define AIR_MIN(a,b) ((a) < (b) ? (a) : (b)) #define AIR_ABS(a) ((a) > 0.0f ? (a) : -(a)) /* ******** AIR_COMPARE(a,b) ** ** the sort of compare that qsort() wants for ascending sort */ #define AIR_COMPARE(a,b) ((a) < (b) \ ? -1 \ : ((a) > (b) \ ? 1 \ : 0)) /* ******** AIR_IN_OP(a,b,c), AIR_IN_CL(a,b,c) ** ** is true if the middle argument is in the open/closed interval ** defined by the first and third arguments ** ** AIR_IN_OP is new name for old AIR_BETWEEN ** AIR_IN_CL is new name for old AIR_INSIDE */ #define AIR_IN_OP(a,b,c) ((a) < (b) && (b) < (c)) /* closed interval */ #define AIR_IN_CL(a,b,c) ((a) <= (b) && (b) <= (c)) /* open interval */ /* ******** AIR_CLAMP(a,b,c) ** ** returns the middle argument, after being clamped to the closed ** interval defined by the first and third arguments */ #define AIR_CLAMP(a,b,c) ((b) < (a) \ ? (a) \ : ((b) > (c) \ ? (c) \ : (b))) /* ******** AIR_MOD(i, N) ** ** returns that integer in [0, N-1] which is i plus a multiple of N. It ** may be unfortunate that the expression (i)%(N) appears three times; ** this should be inlined. Or perhaps the compiler's optimizations ** (common sub-expression elimination) will save us. ** ** Note: integer divisions are not very fast on some modern chips; ** don't go silly using this one. */ #define AIR_MOD(i, N) ((i)%(N) >= 0 ? (i)%(N) : N + (i)%(N)) /* ******** AIR_LERP(w, a, b) ** ** returns a when w=0, and b when w=1, and linearly varies in between */ #define AIR_LERP(w, a, b) ((w)*((b) - (a)) + (a)) /* ******** AIR_AFFINE(i,x,I,o,O) ** ** given intervals [i,I], [o,O] and a value x which may or may not be ** inside [i,I], return the value y such that y stands in the same ** relationship to [o,O] that x does with [i,I]. Or: ** ** y - o x - i ** ------- = ------- ** O - o I - i ** ** It is the callers responsibility to make sure I-i and O-o are ** both non-zero. Strictly speaking, real problems arise only when ** when I-i is zero: division by zero generates either NaN or infinity ** ** NOTE that "x" is evaluated only once (which makes this more useful), ** as is "I" and "O" (usually not so important); "i" and "o" are each ** evaluated twice */ #define AIR_AFFINE(i,x,I,o,O) ( \ ((double)(O)-(o))*((double)(x)-(i)) / ((double)(I)-(i)) + (o)) /* ******** AIR_DELTA(i,x,I,o,O) ** ** given intervals [i,I] and [o,O], calculates the number y such that ** a change of x within [i,I] is proportional to a change of y within ** [o,O]. Or: ** ** y x ** ------- = ------- ** O - o I - i ** ** It is the callers responsibility to make sure I-i and O-o are ** both non-zero ** ** NOTE that all arguments are evaluated only once */ #define AIR_DELTA(i,x,I,o,O) ( \ ((double)(O)-(o))*((double)(x)) / ((double)(I)-(i)) ) /* ******** AIR_ROUNDUP, AIR_ROUNDDOWN ** ** rounds integers up or down; just wrappers around floor and ceil */ #define AIR_ROUNDUP(x) ((int)(floor((x)+0.5))) #define AIR_ROUNDDOWN(x) ((int)(ceil((x)-0.5))) #define AIR_ROUNDUP_UI(x) ((unsigned int)(floor((x)+0.5))) #define AIR_ROUNDDOWN_UI(x) ((unsigned int)(ceil((x)-0.5))) #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" { #endif /* ** biffMsg struct ** ** externally usable thing for holding error messages */ typedef struct { char *key; /* string for identifying the general source of the error message; set once, at time of biffMsg creation */ char **err; /* array of error strings; the err array itself is NOT null-terminated */ unsigned int errNum; /* length of "err" == # strings stored */ airArray *errArr; /* air array for err and num */ } biffMsg; /* biffmsg.c */ NRRDIO_EXPORT biffMsg *biffMsgNew(const char *key); NRRDIO_EXPORT biffMsg *biffMsgNix(biffMsg *msg); NRRDIO_EXPORT void biffMsgAdd(biffMsg *msg, const char *err); NRRDIO_EXPORT void biffMsgClear(biffMsg *msg); NRRDIO_EXPORT unsigned int biffMsgLineLenMax(const biffMsg *msg); NRRDIO_EXPORT void biffMsgMove(biffMsg *dest, biffMsg *src, const char *err); NRRDIO_EXPORT unsigned int biffMsgErrNum(const biffMsg *msg); NRRDIO_EXPORT unsigned int biffMsgStrlen(const biffMsg *msg); NRRDIO_EXPORT void biffMsgStrSet(char *ret, const biffMsg *msg); NRRDIO_EXPORT biffMsg *biffMsgNoop; /* biffbiff.c */ NRRDIO_EXPORT void biffAdd(const char *key, const char *err); NRRDIO_EXPORT void biffAddf(const char *key, const char *errfmt, ...) #ifdef __GNUC__ __attribute__ ((format(printf,2,3))) #endif ; NRRDIO_EXPORT void biffMaybeAdd(const char *key, const char *err, int useBiff); NRRDIO_EXPORT void biffMaybeAddf(int useBiff, const char *key, const char *errfmt, ... ) #ifdef __GNUC__ __attribute__ ((format(printf,3,4))) #endif ; NRRDIO_EXPORT char *biffGet(const char *key); NRRDIO_EXPORT unsigned int biffGetStrlen(const char *key); NRRDIO_EXPORT void biffSetStr(char *str, const char *key); NRRDIO_EXPORT void biffDone(const char *key); NRRDIO_EXPORT char *biffGetDone(const char *key); #ifdef __cplusplus } #endif #include #ifdef __cplusplus extern "C" { #endif /* feel free to set these to higher values and recompile */ #define NRRD_DIM_MAX 16 /* Max array dimension (nrrd->dim) */ #define NRRD_SPACE_DIM_MAX 8 /* Max dimension of "space" around array (nrrd->spaceDim) */ #define NRRD_EXT_NRRD ".nrrd" #define NRRD_EXT_NHDR ".nhdr" #define NRRD_EXT_PGM ".pgm" #define NRRD_EXT_PPM ".ppm" #define NRRD_EXT_PNG ".png" #define NRRD_EXT_VTK ".vtk" #define NRRD_EXT_TEXT ".txt" #define NRRD_EXT_EPS ".eps" /* HEY: should this be renamed -> MAXNUM ? Would be more consistent with other Teem pound-define names */ #define NRRD_KERNEL_PARMS_NUM 8 /* max # arguments to a kernel- this is weird: it isn't the max of any of the NrrdKernels defined by the nrrd library (that is more like 3), but is the max number of parms of any NrrdKernel used by anyone using Teem, such as in gage. Enforcing one global max simplifies implementation. */ /* ** For the 64-bit integer types (not standard except in C99), we used ** to try to use the names for the _MIN and _MAX values which are used ** in C99 (as well as gcc) such as LLONG_MAX, or those used on SGI ** such as LONGLONG_MAX. However, since the tests (in nrrdSanity) ** were re-written to detect overflow based on manipulation of ** specific values, we might as well also define the _MIN and _MAX in ** terms of explicit values (which agree with those defined by C99). */ #define NRRD_LLONG_MAX AIR_LLONG(9223372036854775807) #define NRRD_LLONG_MIN (-NRRD_LLONG_MAX-AIR_LLONG(1)) #define NRRD_ULLONG_MAX AIR_ULLONG(18446744073709551615) /* ** Chances are, you shouldn't mess with these */ #define NRRD_COMMENT_CHAR '#' #define NRRD_FILENAME_INCR 32 #define NRRD_COMMENT_INCR 16 #define NRRD_KEYVALUE_INCR 32 #define NRRD_LIST_FLAG "LIST" #define NRRD_PNM_COMMENT "# NRRD>" /* this is designed to be robust against the mungling that xv does, but no promises for any other image programs */ #define NRRD_PNG_FIELD_KEY "NRRD" /* this is the key used for getting nrrd fields into/out of png comments */ #define NRRD_PNG_COMMENT_KEY "NRRD#" /* this is the key used for getting nrrd comments into/out of png comments */ #define NRRD_UNKNOWN "???" /* how to represent something unknown in a field of the nrrd header, when it being unknown is not an error */ #define NRRD_NONE "none" /* like NRRD_UNKNOWN, but with an air of certainty */ #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" { #endif /******* ******** NONE of these enums should have values set explicitly in their ******** definition. The values should simply start at 0 (for Unknown) ******** and increase one integer per value. The _nrrdCheckEnums() ******** sanity check assumes this, and there is no reason to use ******** explicit values for any of the enums. *******/ /* ******** nrrdIoState* enum ** ** the various things it makes sense to get and set in nrrdIoState struct ** via nrrdIoStateGet and nrrdIoStateSet */ enum { nrrdIoStateUnknown, nrrdIoStateDetachedHeader, nrrdIoStateBareText, nrrdIoStateCharsPerLine, nrrdIoStateValsPerLine, nrrdIoStateSkipData, nrrdIoStateKeepNrrdDataFileOpen, nrrdIoStateZlibLevel, nrrdIoStateZlibStrategy, nrrdIoStateBzip2BlockSize, nrrdIoStateLast }; /* ******** nrrdFormatType* enum ** ** the different file formats which nrrd supports */ enum { nrrdFormatTypeUnknown, nrrdFormatTypeNRRD, /* 1: basic nrrd format (associated with any of the magics starting with "NRRD") */ nrrdFormatTypePNM, /* 2: PNM image */ nrrdFormatTypePNG, /* 3: PNG image */ nrrdFormatTypeVTK, /* 4: VTK Structured Points datasets (v1.0 and 2.0) */ nrrdFormatTypeText, /* 5: bare ASCII text for 2D arrays */ nrrdFormatTypeEPS, /* 6: Encapsulated PostScript (write-only) */ nrrdFormatTypeLast }; #define NRRD_FORMAT_TYPE_MAX 6 /* ******** nrrdBoundary* enum ** ** when resampling, how to deal with the ends of a scanline */ enum { nrrdBoundaryUnknown, nrrdBoundaryPad, /* 1: fill with some user-specified value */ nrrdBoundaryBleed, /* 2: copy the last/first value out as needed */ nrrdBoundaryWrap, /* 3: wrap-around */ nrrdBoundaryWeight, /* 4: normalize the weighting on the existing samples; ONLY sensible for a strictly positive kernel which integrates to unity (as in blurring) */ nrrdBoundaryMirror, /* 5: mirror folding */ nrrdBoundaryLast }; #define NRRD_BOUNDARY_MAX 5 /* ******** nrrdType* enum ** ** all the different types, identified by integer ** ** 18 July 03: After some consternation, GLK decided to set ** nrrdTypeUnknown and nrrdTypeDefault to the same thing, with the ** reasoning that the only times that nrrdTypeDefault is used is when ** controlling an *output* type (the type of "nout"), or rather, ** choosing not to control an output type. As output types must be ** known, there is no confusion between being unset/unknown (invalid) ** and being simply default. */ enum { nrrdTypeUnknown=0, /* 0: signifies "type is unset/unknown" */ nrrdTypeDefault=0, /* 0: signifies "determine output type for me" */ nrrdTypeChar, /* 1: signed 1-byte integer */ nrrdTypeUChar, /* 2: unsigned 1-byte integer */ nrrdTypeShort, /* 3: signed 2-byte integer */ nrrdTypeUShort, /* 4: unsigned 2-byte integer */ nrrdTypeInt, /* 5: signed 4-byte integer */ nrrdTypeUInt, /* 6: unsigned 4-byte integer */ nrrdTypeLLong, /* 7: signed 8-byte integer */ nrrdTypeULLong, /* 8: unsigned 8-byte integer */ nrrdTypeFloat, /* 9: 4-byte floating point */ nrrdTypeDouble, /* 10: 8-byte floating point */ nrrdTypeBlock, /* 11: size user defined at run time; MUST BE LAST */ nrrdTypeLast }; #define NRRD_TYPE_MAX 11 #define NRRD_TYPE_SIZE_MAX 8 /* max(sizeof()) over all scalar types */ #define NRRD_TYPE_BIGGEST double /* this should be a basic C type which requires for storage the maximum size of all the basic C types */ /* ******** nrrdEncodingType enum ** ** how data might be encoded into a bytestream */ enum { nrrdEncodingTypeUnknown, nrrdEncodingTypeRaw, /* 1: same as memory layout (modulo endianness) */ nrrdEncodingTypeAscii, /* 2: decimal values are spelled out in ascii */ nrrdEncodingTypeHex, /* 3: hexidecimal (two chars per byte) */ nrrdEncodingTypeGzip, /* 4: gzip'ed raw data */ nrrdEncodingTypeBzip2, /* 5: bzip2'ed raw data */ nrrdEncodingTypeLast }; #define NRRD_ENCODING_TYPE_MAX 5 /* ******** nrrdZlibStrategy enum ** ** how gzipped data is compressed */ enum { nrrdZlibStrategyUnknown, nrrdZlibStrategyDefault, /* 1: default (Huffman + string match) */ nrrdZlibStrategyHuffman, /* 2: Huffman only */ nrrdZlibStrategyFiltered, /* 3: specialized for filtered data */ nrrdZlibStrategyLast }; #define NRRD_ZLIB_STRATEGY_MAX 3 /* ******** nrrdCenter enum ** ** node-centered vs. cell-centered */ enum { nrrdCenterUnknown, /* 0: no centering known for this axis */ nrrdCenterNode, /* 1: samples at corners of things (how "voxels" are usually imagined) |\______/|\______/|\______/| X X X X */ nrrdCenterCell, /* 2: samples at middles of things (characteristic of histogram bins) \___|___/\___|___/\___|___/ X X X */ nrrdCenterLast }; #define NRRD_CENTER_MAX 2 /* ******** nrrdKind enum ** ** For describing the information along one axis of an array. This is ** most important for clarifying the representation of non-scalar ** data, in order to distinguish between axes that are genuine image ** domain axes, and axes that exist just to store the multiple ** attributes per sample. One could argue that this information ** should be per-array and not per-axis, but you still have to ** indicate which one of the axes is the attribute axis. And, if you ** have, say, the gradient of RGB colors, you want the per-pixel 3x3 ** array to have those two attribute axes tagged accordingly. ** ** More of these may be added in the future, such as when nrrd ** supports bricking. Since nrrd is never going to be in the business ** of manipulating the kind information or supporting kind-specific ** semantics, there can be proliferation of nrrdKinds, provided ** pointless redundancy is avoided. ** ** There is a relationship between some of these (nrrdKindSpace is a ** specific nrrdKindDomain), but currently there is no effort to ** record this meta-kind information. ** ** Keep in sync: ** enumsNrrd.c: nrrdKind airEnum ** axis.c: nrrdKindSize() ** axis.c: _nrrdKindAltered() ** ** NOTE: The nrrdKindSize() function returns the valid size for these. ** */ enum { nrrdKindUnknown, nrrdKindDomain, /* 1: any image domain */ nrrdKindSpace, /* 2: a spatial domain */ nrrdKindTime, /* 3: a temporal domain */ /* -------------------------- end domain kinds */ /* -------------------------- begin range kinds */ nrrdKindList, /* 4: any list of values, non-resample-able */ nrrdKindPoint, /* 5: coords of a point */ nrrdKindVector, /* 6: coeffs of (contravariant) vector */ nrrdKindCovariantVector, /* 7: coeffs of covariant vector (eg gradient) */ nrrdKindNormal, /* 8: coeffs of unit-length covariant vector */ /* -------------------------- end arbitrary size kinds */ /* -------------------------- begin size-specific kinds */ nrrdKindStub, /* 9: axis with one sample (a placeholder) */ nrrdKindScalar, /* 10: effectively, same as a stub */ nrrdKindComplex, /* 11: real and imaginary components */ nrrdKind2Vector, /* 12: 2 component vector */ nrrdKind3Color, /* 13: ANY 3-component color value */ nrrdKindRGBColor, /* 14: RGB, no colorimetry */ nrrdKindHSVColor, /* 15: HSV, no colorimetry */ nrrdKindXYZColor, /* 16: perceptual primary colors */ nrrdKind4Color, /* 17: ANY 4-component color value */ nrrdKindRGBAColor, /* 18: RGBA, no colorimetry */ nrrdKind3Vector, /* 19: 3-component vector */ nrrdKind3Gradient, /* 20: 3-component covariant vector */ nrrdKind3Normal, /* 21: 3-component covector, assumed normalized */ nrrdKind4Vector, /* 22: 4-component vector */ nrrdKindQuaternion, /* 23: (w,x,y,z), not necessarily normalized */ nrrdKind2DSymMatrix, /* 24: Mxx Mxy Myy */ nrrdKind2DMaskedSymMatrix, /* 25: mask Mxx Mxy Myy */ nrrdKind2DMatrix, /* 26: Mxx Mxy Myx Myy */ nrrdKind2DMaskedMatrix, /* 27: mask Mxx Mxy Myx Myy */ nrrdKind3DSymMatrix, /* 28: Mxx Mxy Mxz Myy Myz Mzz */ nrrdKind3DMaskedSymMatrix, /* 29: mask Mxx Mxy Mxz Myy Myz Mzz */ nrrdKind3DMatrix, /* 30: Mxx Mxy Mxz Myx Myy Myz Mzx Mzy Mzz */ nrrdKind3DMaskedMatrix, /* 31: mask Mxx Mxy Mxz Myx Myy Myz Mzx Mzy Mzz */ nrrdKindLast }; #define NRRD_KIND_MAX 31 /* ******** nrrdAxisInfo enum ** ** the different pieces of per-axis information recorded in a nrrd */ enum { nrrdAxisInfoUnknown, nrrdAxisInfoSize, /* 1: number of samples along axis */ #define NRRD_AXIS_INFO_SIZE_BIT (1<< 1) nrrdAxisInfoSpacing, /* 2: spacing between samples */ #define NRRD_AXIS_INFO_SPACING_BIT (1<< 2) nrrdAxisInfoThickness, /* 3: thickness of sample region */ #define NRRD_AXIS_INFO_THICKNESS_BIT (1<< 3) nrrdAxisInfoMin, /* 4: min pos. assoc. w/ 1st sample */ #define NRRD_AXIS_INFO_MIN_BIT (1<< 4) nrrdAxisInfoMax, /* 5: max pos. assoc. w/ last sample */ #define NRRD_AXIS_INFO_MAX_BIT (1<< 5) nrrdAxisInfoSpaceDirection, /* 6: inter-sample vector in "space" */ #define NRRD_AXIS_INFO_SPACEDIRECTION_BIT (1<< 6) nrrdAxisInfoCenter, /* 7: cell vs. node */ #define NRRD_AXIS_INFO_CENTER_BIT (1<< 7) nrrdAxisInfoKind, /* 8: from the nrrdKind* enum */ #define NRRD_AXIS_INFO_KIND_BIT (1<< 8) nrrdAxisInfoLabel, /* 9: string describing the axis */ #define NRRD_AXIS_INFO_LABEL_BIT (1<< 9) nrrdAxisInfoUnits, /* 10: from the nrrdUnit* enum */ #define NRRD_AXIS_INFO_UNITS_BIT (1<<10) nrrdAxisInfoLast }; #define NRRD_AXIS_INFO_MAX 10 #define NRRD_AXIS_INFO_ALL \ ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)|(1<<10)) #define NRRD_AXIS_INFO_NONE 0 /* ******** nrrdBasicInfo enum ** ** the non-per-axis (or per-array) pieces of information that could ** meaningfully be copied between nrrds (hence the void *data is not ** included). ** ** "Basic" is named after the "basic field specifications" described ** in the NRRD file format definition */ enum { nrrdBasicInfoUnknown, nrrdBasicInfoData, /* 1 */ #define NRRD_BASIC_INFO_DATA_BIT (1<< 1) nrrdBasicInfoType, /* 2 */ #define NRRD_BASIC_INFO_TYPE_BIT (1<< 2) nrrdBasicInfoBlocksize, /* 3 */ #define NRRD_BASIC_INFO_BLOCKSIZE_BIT (1<< 3) nrrdBasicInfoDimension, /* 4 */ #define NRRD_BASIC_INFO_DIMENSION_BIT (1<< 4) nrrdBasicInfoContent, /* 5 */ #define NRRD_BASIC_INFO_CONTENT_BIT (1<< 5) nrrdBasicInfoSampleUnits, /* 6 */ #define NRRD_BASIC_INFO_SAMPLEUNITS_BIT (1<< 6) nrrdBasicInfoSpace, /* 7 */ #define NRRD_BASIC_INFO_SPACE_BIT (1<< 7) nrrdBasicInfoSpaceDimension, /* 8 */ #define NRRD_BASIC_INFO_SPACEDIMENSION_BIT (1<< 8) nrrdBasicInfoSpaceUnits, /* 9 */ #define NRRD_BASIC_INFO_SPACEUNITS_BIT (1<< 9) nrrdBasicInfoSpaceOrigin, /* 10 */ #define NRRD_BASIC_INFO_SPACEORIGIN_BIT (1<<10) nrrdBasicInfoMeasurementFrame, /* 11 */ #define NRRD_BASIC_INFO_MEASUREMENTFRAME_BIT (1<<11) nrrdBasicInfoOldMin, /* 12 */ #define NRRD_BASIC_INFO_OLDMIN_BIT (1<<12) nrrdBasicInfoOldMax, /* 13 */ #define NRRD_BASIC_INFO_OLDMAX_BIT (1<<13) nrrdBasicInfoComments, /* 14 */ #define NRRD_BASIC_INFO_COMMENTS_BIT (1<<14) nrrdBasicInfoKeyValuePairs, /* 15 */ #define NRRD_BASIC_INFO_KEYVALUEPAIRS_BIT (1<<15) nrrdBasicInfoLast }; #define NRRD_BASIC_INFO_MAX 15 #define NRRD_BASIC_INFO_ALL \ ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)|(1<<10)\ |(1<<11)|(1<<12)|(1<<13)|(1<<14)|(1<<15)) #define NRRD_BASIC_INFO_SPACE (NRRD_BASIC_INFO_SPACE_BIT \ | NRRD_BASIC_INFO_SPACEDIMENSION_BIT \ | NRRD_BASIC_INFO_SPACEUNITS_BIT \ | NRRD_BASIC_INFO_SPACEORIGIN_BIT \ | NRRD_BASIC_INFO_MEASUREMENTFRAME_BIT) #define NRRD_BASIC_INFO_NONE 0 /* ******** nrrdField enum ** ** the various fields we can parse in a NRRD header ** ** other things which must be kept in sync: ** arraysNrrd.c: ** _nrrdFieldValidInImage[] ** _nrrdFieldOnePerAxis[] ** _nrrdFieldValidInText[] ** _nrrdFieldRequired[] ** parseNrrd.c: ** _nrrdReadNrrdParseInfo[] ** enumsNrrd.c: ** nrrdField definition ** simple.c: ** _nrrdFieldCheck[] ** write.c: ** _nrrdFieldInteresting() ** _nrrdSprintFieldInfo() ** to some extent, in this file: ** nrrdAxisInfo and nrrdBasicInfo enums ** axis.c (for per-axis info): ** _nrrdAxisInfoCopy() ** methodsNrrd.c: ** lots of functions, but you knew that . . . */ enum { nrrdField_unknown, nrrdField_comment, /* 1 */ nrrdField_content, /* 2 */ nrrdField_number, /* 3 */ nrrdField_type, /* 4 */ nrrdField_block_size, /* 5 */ nrrdField_dimension, /* 6 */ nrrdField_space, /* 7 */ nrrdField_space_dimension, /* 8 */ nrrdField_sizes, /* 9 ----- begin per-axis ----- */ nrrdField_spacings, /* 10 */ nrrdField_thicknesses, /* 11 */ nrrdField_axis_mins, /* 12 */ nrrdField_axis_maxs, /* 13 */ nrrdField_space_directions, /* 14 */ nrrdField_centers, /* 15 */ nrrdField_kinds, /* 16 */ nrrdField_labels, /* 17 */ nrrdField_units, /* 18 ------ end per-axis ------ */ nrrdField_min, /* 19 */ nrrdField_max, /* 20 */ nrrdField_old_min, /* 21 */ nrrdField_old_max, /* 22 */ nrrdField_endian, /* 23 */ nrrdField_encoding, /* 24 */ nrrdField_line_skip, /* 25 */ nrrdField_byte_skip, /* 26 */ nrrdField_keyvalue, /* 27 */ nrrdField_sample_units, /* 28 */ nrrdField_space_units, /* 29 */ nrrdField_space_origin, /* 30 */ nrrdField_measurement_frame, /* 31 */ nrrdField_data_file, /* 32 */ nrrdField_last }; #define NRRD_FIELD_MAX 32 /* ******** nrrdHasNonExist* enum ** ** oh look, I'm violating my rules outline above for how the enum values ** should be ordered. The reason for this is that its just too bizarro to ** have the logical value of both nrrdHasNonExistFalse and nrrdHasNonExistTrue ** to be (in C) true. For instance, nrrdHasNonExist() should be able to ** return a value from this enum which also functions in a C expressions as ** the expected boolean value. If for some reason (outide the action of ** nrrdHasNonExist(), nrrdHasNonExistUnknown is interpreted as true, that's ** probably harmlessly conservative. Time will tell. */ enum { nrrdHasNonExistFalse, /* 0: no non-existent values were seen */ nrrdHasNonExistTrue, /* 1: some non-existent values were seen */ nrrdHasNonExistOnly, /* 2: NOTHING BUT non-existent values were seen */ nrrdHasNonExistUnknown, /* 3 */ nrrdHasNonExistLast }; #define NRRD_HAS_NON_EXIST_MAX 3 /* ******** nrrdSpace* enum ** ** Identifies the space in which which the origin and direction ** vectors have their coordinates measured. When a direction is named ** here (like "Left" or "Anterior"), that implies a basis vector that ** points in that direction, along which that coordinate becomes *larger* ** (this is the opposite of MetaIO, for example). ** ** All of these spaces have a well-defined expected dimension, as ** determined by nrrdSpaceDimension(), and setting a nrrd to be in ** such a space, by nrrdSpaceSet(), will automatically set nrrd->spaceDim. ** ** The first six spaces here are PATIENT-ORIENTED spaces, which are ** properly speaking aligned with the patient, and not the scanner ** itself. But nrrdSpaceScannerXYZ and nrrdSpaceScannerXYZTime are ** DEVICE-ORIENTED spaces, irrespective of the patient, used in a ** previous version of the DICOM standard. When the two spaces are ** lined up with normal patient orientation in the scanner, ** nrrdSpaceScannerXYZ is the same as nrrdSpaceLeftPosteriorSuperior. ** To quote Part 3 (Information Object Definitions) of the DICOM spec ** (page 275): "If a patient lies parallel to the ground, face-up on ** the table, with his feet-to-head direction same as the ** front-to-back direction of the imaging equipment, the direction of ** the axes of this patient based coordinate system and the equipment ** based coordinate system in previous versions of this Standard will ** coincide." ** ** Keep in sync: ** enumsNrrd.c: nrrdSpace airEnum ** simple.c: int nrrdSpaceDimension(int space) */ enum { nrrdSpaceUnknown, nrrdSpaceRightAnteriorSuperior, /* 1: NIFTI-1 (right-handed) */ nrrdSpaceLeftAnteriorSuperior, /* 2: standard Analyze (left-handed) */ nrrdSpaceLeftPosteriorSuperior, /* 3: DICOM 3.0 (right-handed) */ nrrdSpaceRightAnteriorSuperiorTime, /* 4: */ nrrdSpaceLeftAnteriorSuperiorTime, /* 5: */ nrrdSpaceLeftPosteriorSuperiorTime, /* 6: */ nrrdSpaceScannerXYZ, /* 7: ACR/NEMA 2.0 (pre-DICOM 3.0) */ nrrdSpaceScannerXYZTime, /* 8: */ nrrdSpace3DRightHanded, /* 9: */ nrrdSpace3DLeftHanded, /* 10: */ nrrdSpace3DRightHandedTime, /* 11: */ nrrdSpace3DLeftHandedTime, /* 12: */ nrrdSpaceLast }; #define NRRD_SPACE_MAX 12 /* ******** nrrdSpacingStatus* enum ** ** a way of describing how spacing information is known or not known for a ** given axis, as determined by nrrdSpacingCalculate */ enum { nrrdSpacingStatusUnknown, /* 0: nobody knows, or invalid axis choice */ nrrdSpacingStatusNone, /* 1: neither axis->spacing nor axis->spaceDirection is set */ nrrdSpacingStatusScalarNoSpace, /* 2: axis->spacing set, w/out space info */ nrrdSpacingStatusScalarWithSpace, /* 3: axis->spacing set, but there *is* space info, which means the spacing does *not* live in the surrounding space */ nrrdSpacingStatusDirection, /* 4: axis->spaceDirection set, and measured according to surrounding space */ nrrdSpacingStatusLast }; #define NRRD_SPACING_STATUS_MAX 4 /* ******** nrrdOriginStatus* enum ** ** how origin information was or was not computed by nrrdOriginCalculate */ enum { nrrdOriginStatusUnknown, /* 0: nobody knows, or invalid parms */ nrrdOriginStatusDirection, /* 1: chosen axes have spaceDirections */ nrrdOriginStatusNoMin, /* 2: axis->min doesn't exist */ nrrdOriginStatusNoMaxOrSpacing, /* 3: axis->max or ->spacing doesn't exist */ nrrdOriginStatusOkay, /* 4: all is well */ nrrdOriginStatusLast }; #ifdef __cplusplus } #endif #ifdef __cplusplus extern "C" { #endif /* ******** NRRD_CELL_POS, NRRD_NODE_POS, NRRD_POS ******** NRRD_CELL_IDX, NRRD_NODE_IDX, NRRD_IDX ** ** the guts of nrrdAxisPos() and nrrdAxisIdx(), for converting ** between "index space" location and "position" or "world space" location, ** given the centering, min and max "position", and number of samples. ** ** Unlike nrrdAxisPos() and nrrdAxisIdx(), this assumes that center ** is either nrrdCenterCell or nrrdCenterNode, but not nrrdCenterUnknown. */ /* index to position, cell centering */ #define NRRD_CELL_POS(min, max, size, idx) \ AIR_AFFINE(0, (idx) + 0.5, (size), (min), (max)) /* index to position, node centering */ #define NRRD_NODE_POS(min, max, size, idx) \ AIR_AFFINE(0, (idx), (size)-1, (min), (max)) /* index to position, either centering */ #define NRRD_POS(center, min, max, size, idx) \ (nrrdCenterCell == (center) \ ? NRRD_CELL_POS((min), (max), (size), (idx)) \ : NRRD_NODE_POS((min), (max), (size), (idx))) /* position to index, cell centering */ #define NRRD_CELL_IDX(min, max, size, pos) \ (AIR_AFFINE((min), (pos), (max), 0, (size)) - 0.5) /* position to index, node centering */ #define NRRD_NODE_IDX(min, max, size, pos) \ AIR_AFFINE((min), (pos), (max), 0, (size)-1) /* position to index, either centering */ #define NRRD_IDX(center, min, max, size, pos) \ (nrrdCenterCell == (center) \ ? NRRD_CELL_IDX((min), (max), (size), (pos)) \ : NRRD_NODE_IDX((min), (max), (size), (pos))) /* ******** NRRD_SPACING ** ** the guts of nrrdAxisSpacing(), determines the inter-sample ** spacing, given centering, min and max "position", and number of samples ** ** Unlike nrrdAxisSpacing, this assumes that center is either ** nrrdCenterCell or nrrdCenterNode, but not nrrdCenterUnknown. */ #define NRRD_SPACING(center, min, max, size) \ (nrrdCenterCell == center \ ? ((max) - (min))/AIR_CAST(double, size) \ : ((max) - (min))/(AIR_CAST(double, (size)- 1))) \ /* ******** NRRD_COORD_UPDATE ** ** This is for doing the "carrying" associated with gradually incrementing an ** array of coordinates. Assuming that the given coordinate array "coord" has ** been incremented by adding 1 to coord[0], this macro will propagating the ** change up to higher axes (when the coordinate has reached the size on a ** lower axis.) In addition, the final statement of the macro prevents the ** last index from going past a valid value. ** ** Assumptions: ** -- coord[] and size[] should both be arrays of unsigned integral values, ** presumably size_t ** -- size[i] is >= 1 for all i= (size)[ddd]; \ ddd++) { \ (coord)[ddd] = 0; \ (coord)[ddd+1]++; \ } \ if (dim) { \ (coord)[(dim)-1] = AIR_MIN((coord)[(dim)-1], (size)[(dim)-1]-1); \ } \ } /* ******** NRRD_COORD_INCR ** ** increments coord[idx] (by one) and then calls NRRD_COORD_UPDATE to ** propagate this change as necessary to higher numbered axes. Does ** nothing if idx>=dim, since that would be an invalid index into ** coord[] and size[] */ #define NRRD_COORD_INCR(coord, size, dim, idx) \ if ((idx) < (dim)) { \ (coord)[(idx)]++; \ NRRD_COORD_UPDATE((coord)+(idx), (size)+(idx), (dim)-(idx)); \ } /* ******** NRRD_INDEX_GEN ** ** Given array coordinates "coord" and sizes "size", both of length "dim", ** this calculates the linear index represented by coord (assuming lower ** coordinates are for *faster* axes), and stores it in "I". Has the same ** assumptions as NRRD_COORD_UPDATE. */ #define NRRD_INDEX_GEN(I, coord, size, dim) \ { \ unsigned int ddd = (dim); \ (I) = 0; \ while (ddd) { \ ddd--; \ (I) = (coord)[ddd] + (size)[ddd]*(I); \ } \ } /* ******** NRRD_COORD_GEN ** ** opposite of NRRD_INDEX_GEN: going from linear index "I" to ** coordinate array "coord". */ #define NRRD_COORD_GEN(coord, size, dim, I) \ { \ unsigned int ddd; \ size_t myI = (I); \ for (ddd=0; ddd<(dim); ddd++) { \ (coord)[ddd] = myI % (size)[ddd]; \ myI /= (size)[ddd]; \ } \ } #ifdef __cplusplus } #endif #include #include /* for ptrdiff_t */ #ifdef __cplusplus extern "C" { #endif #define NRRD nrrdBiffKey /* ******** NrrdAxisInfo struct ** ** all the information which can sensibly be associated with ** one axis of a nrrd. The only member which MUST be explicitly ** set to something meaningful is "size". ** ** If an axis lies conceptually along some direction in an enclosing ** space of dimension nrrd->spaceDim, then the first nrrd->spaceDim ** entries of spaceDirection[] must be non-NaN, and min, max, spacing, ** and units must NOT be set; thickness, center, and label can still ** be used. The mutual exclusion between axis-aligned and general ** direction information is enforced per-axis, not per-array. ** ** The min and max values give the range of positions "represented" ** by the samples along this axis. In node-centering, "min" IS the ** position at the lowest index. In cell-centering, the position at ** the lowest index is between min and max (a touch bigger than min, ** assuming min < max). ** ** There needs to be a one-to-one correspondence between these variables ** and the nrrdAxisInfo* enum (nrrdEnums.h), the per-axis header fields ** (see nrrdField* enum in nrrdEnums.h), and the various methods in axis.c */ typedef struct { size_t size; /* number of elements along each axis */ double spacing; /* if non-NaN, distance between samples */ double thickness; /* if non-NaN, nominal thickness of region represented by one sample along the axis. No semantics relative to spacing are assumed or imposed, and unlike spacing, there is no sensible way to alter thickness- it is either copied (as with cropping and slicing) or set to NaN (when resampled). */ double min, max; /* if non-NaN, range of positions spanned by the samples on this axis. Obviously, one can set "spacing" to something incompatible with min and max: the idea is that only one (min and max, or spacing) should be taken to be significant at any time. */ double spaceDirection[NRRD_SPACE_DIM_MAX]; /* the vector, in "space" (as described by nrrd->space and/or nrrd->spaceDim), from one sample to the next sample along this axis. It is the column vector of the transform from index space to "space" space */ int center; /* cell vs. node centering (value should be one of nrrdCenter{Unknown,Node,Cell} */ int kind; /* what kind of information is along this axis (from the nrrdKind* enum) */ char *label, /* short info string for each axis */ *units; /* string identifying the unit */ } NrrdAxisInfo; /* ******** Nrrd struct ** ** The struct used to wrap around the raw data array */ typedef struct { /* ** NECESSARY information describing the main array. This is ** generally set at the same time that either the nrrd is created, ** or at the time that the nrrd is wrapped around an existing array */ void *data; /* the data in memory */ int type; /* a value from the nrrdType enum */ unsigned int dim; /* the dimension (rank) of the array */ /* ** All per-axis specific information */ NrrdAxisInfo axis[NRRD_DIM_MAX]; /* axis[0] is the fastest axis in the scan- line ordering, the one who's coordinates change the fastest as the elements are accessed in the order in which they appear in memory */ /* ** Optional information descriptive of whole array, some of which is ** meaningfuly for only some uses of a nrrd */ char *content; /* brief account of what this data is */ char *sampleUnits; /* units of measurement of the values stored in the array itself (not the array axes and not space coordinates). The logical name might be "dataUnits", but that's perhaps ambiguous. Note that these units may apply to non-scalar kinds (e.g. coefficients of a vector have the same units) */ int space; /* from nrrdSpace* enum, and often implies the value of spaceDim */ unsigned int spaceDim; /* if non-zero, the dimension of the space in which the regular sampling grid conceptually lies. This is a separate variable because this dimension can be different than the array dimension. The non-zero-ness of this value is in fact the primary indicator that space and orientation information is set. This identifies the number of entries in "origin" and the per-axis "direction" vectors that are taken as meaningful */ char *spaceUnits[NRRD_SPACE_DIM_MAX]; /* units for coordinates of space */ double spaceOrigin[NRRD_SPACE_DIM_MAX]; /* the location of the center the first (lowest memory address) array sample, regardless of node-vs-cell centering */ double measurementFrame[NRRD_SPACE_DIM_MAX][NRRD_SPACE_DIM_MAX]; /* if spaceDim is non-zero, this may store a spaceDim-by-spaceDim matrix which transforms vector/matrix coefficients in the "measurement frame" to those in the world space described by spaceDim (and hopefully space). Coeff [i][j] is *column* i & *row* j, which is probably the *transpose* of what you expect. There are no semantics linking this to the "kind" of any axis, for a variety of reasons */ size_t blockSize; /* for nrrdTypeBlock, block byte size */ double oldMin, oldMax; /* if non-NaN, and if nrrd is of integral type, extremal values for the array BEFORE it was quantized */ void *ptr; /* never read or set by nrrd; use/abuse as you see fit */ /* ** Comments. Read from, and written to, header. ** The comment array "cmt" is NOT NULL-terminated. ** The number of comments is cmtArr->len. */ char **cmt; airArray *cmtArr; /* ** Key-value pairs. */ char **kvp; airArray *kvpArr; } Nrrd; struct NrrdIoState_t; struct NrrdEncoding_t; /* ******** NrrdFormat ** ** All information and behavior relevent to one datafile format */ typedef struct { char name[AIR_STRLEN_SMALL]; /* short identifying string */ int isImage, /* this format is intended solely for "2D" images, which controls the invocation of _nrrdReshapeUpGrayscale() if nrrdStateGrayscaleImage3D */ readable, /* we can read as well as write this format */ usesDIO; /* this format can use Direct IO */ /* tests if this format is currently available in this build */ int (*available)(void); /* (for writing) returns non-zero if a given filename could likely be represented by this format */ int (*nameLooksLike)(const char *filename); /* (for writing) returns non-zero if a given nrrd/encoding pair will fit in this format */ int (*fitsInto)(const Nrrd *nrrd, const struct NrrdEncoding_t *encoding, int useBiff); /* (for reading) returns non-zero if what has been read in so far is recognized as the beginning of this format */ int (*contentStartsLike)(struct NrrdIoState_t *nio); /* reader and writer */ int (*read)(FILE *file, Nrrd *nrrd, struct NrrdIoState_t *nio); int (*write)(FILE *file, const Nrrd *nrrd, struct NrrdIoState_t *nio); } NrrdFormat; /* ******** NrrdEncoding ** ** All information and behavior relevent to one way of encoding data ** ** The data readers are responsible for memory allocation. ** This is necessitated by the memory restrictions of direct I/O */ typedef struct NrrdEncoding_t { char name[AIR_STRLEN_SMALL], /* short identifying string */ suffix[AIR_STRLEN_SMALL]; /* costumary filename suffix */ int endianMatters, isCompression; int (*available)(void); /* The "data" and "elementNum" values have to be passed explicitly to read/wrote because they will be different from nrrd->data and nrrdElementNumber(nrrd) in the case of multiple data files. You might think that the only other thing required to be passed is nrrdElementSize(nrrd), but no, it is in fact best to pass the whole Nrrd, instead of just certain attributes. The stupid details: nrrd->dim: needed to know whether to put one value per line in case of 1-D nrrdEncodingAscii nrrd->axis[0].size: need for proper formatting of nrrdEncodingAscii nrrd->type: needed for nrrdEncodingAscii, since its action is entirely parameterized by type nrrd->blockSize: needed for nrrdElementSize in case of nrrdTypeBlock */ int (*read)(FILE *file, void *data, size_t elementNum, Nrrd *nrrd, struct NrrdIoState_t *nio); int (*write)(FILE *file, const void *data, size_t elementNum, const Nrrd *nrrd, struct NrrdIoState_t *nio); } NrrdEncoding; /* ******** NrrdIoState struct ** ** Everything relating to how the nrrd is read and written. ** Multiple parameters for writing are set here (like format, encoding, ** zlib parameters). Also, this is the place where those few parameters ** of reading are stored (like skipData and keepNrrdDataFileOpen). Also, ** after the nrrd has been read, it is a potentially useful record of what ** it took to read it in. */ typedef struct NrrdIoState_t { char *path, /* allows us to remember the directory from whence this nrrd was "load"ed, or to whence this nrrd is "save"ed, MINUS the trailing "/", so as to facilitate games with header-relative data files */ *base, /* when "save"ing a nrrd into separate header and data, the name of the header file (e.g. "output.nhdr") MINUS the ".nhdr". This is massaged to produce a header- relative data filename. */ *line, /* buffer for saving one line from file */ *dataFNFormat, /* if non-NULL, the format string (containing something like "%d" as a substring) to be used to identify multiple detached datafiles. NB: This is "format" in the sense of a printf- style format string, not in the sense of a file format. This may need header-relative path processing. */ **dataFN, /* ON READ + WRITE: array of data filenames. These are not passed directly to fopen, they may need header-relative path processing. Like the cmtArr in the Nrrd, this array is not NULL- terminated */ *headerStringWrite; /* ON WRITE: string from to which the header can be written. On write, it is assumed allocated for as long as it needs to be (probably via a first pass with learningHeaderStrlen). NOTE: It is the non-NULL-ity of this which signifies the intent to do string-based writing */ const char *headerStringRead; /* ON READ: like headerStringWrite, but for reading the header from. NOTE: It is the non-NULL-ity of this which signifies the intent to do string-based reading */ airArray *dataFNArr; /* for managing the above */ FILE *headerFile, /* if non-NULL, the file from which the NRRD header is being read */ *dataFile; /* this used to be a central part of how the I/O code worked, but now it is simply the place to store the dataFile in the case of keepNrrdDataFileOpen */ unsigned int dataFileDim, /* The dimension of the data in each data file. Together with dataFNArr->len, this determines how many bytes should be in each data file */ lineLen, /* allocated size of line, including the last character for \0 */ charsPerLine, /* when writing ASCII data in which we intend only to write a huge long list of numbers whose text formatting implies nothing, then how many characters do we limit ourselves to per line */ valsPerLine, /* when writing ASCII data in which we DO intend to sigify (or at least hint at) something with the formatting, then what is the max number of values to write on a line */ lineSkip, /* if dataFile non-NULL, the number of lines in dataFile that should be skipped over (so as to bypass another form of ASCII header preceeding raw data) */ headerStrlen, /* ON WRITE, for NRRDs, if learningHeaderStrlen, the learned strlen of the header so far */ headerStrpos; /* ON READ, for NRRDs, if headerStringRead is non-NULL, the current location of reading in the header */ long int byteSkip; /* exactly like lineSkip, but bytes instead of lines. First the lines are skipped, then the bytes */ /* Note that the NRRD0004 and NRRD0005 file formats indicate that a numbered sequence of data filenames should be indexed via a "%d" format specification, and that the format doc says nothing about the "min" and "max" fields of "data file" being only positive. So the following three dataFN* fields are appropriately (signed) ints, even if all normal usage could also be represented with unsigned ints. Nonetheless, the return from _nrrdDataFNNumber(), which gives the total number of file names, is still appropriately an unsigned int. This may be revisited if the file format itself is adjusted. */ int dataFNMin, /* used with dataFNFormat to identify .. */ dataFNMax, /* .. all the multiple detached datafiles */ dataFNStep; /* how to step from max to min */ /* On the other hand, dataFNIndex ranges from 0 to (#datafiles-1), and not dataFNMin to dataFNMax, so it really should be unsigned */ unsigned int dataFNIndex; /* which of the data files are being read */ int pos, /* line[pos] is beginning of stuff which still has yet to be parsed */ endian, /* endian-ness of the data in file, for those encoding/type combinations for which it matters (from nrrdEndian) */ seen[NRRD_FIELD_MAX+1], /* for error checking in header parsing */ detachedHeader, /* ON WRITE: request for file (NRRD format only) to be split into distinct header and data. This only has an effect if detaching the header is not already necessary, as it is with multiple data files */ bareText, /* when writing a plain text file, is there any effort made to record the nrrd struct info in the text file */ skipData, /* if non-zero (all formats): ON READ: don't allocate memory for, and don't read in, the data portion of the file (but we do verify that for nrrds, detached datafiles can be opened). Note: Does NOT imply keepNrrdDataFileOpen. Warning: resulting nrrd struct will have "data" pointer NULL. ON WRITE: don't write data portion of file (for nrrds, don't even try to open detached datafiles). Warning: can result in broken noncomformant files. (be careful with this) */ skipFormatURL, /* if non-zero for NRRD format ON WRITE: skip the comment lines that document where to find the NRRD file format specs */ keepNrrdDataFileOpen, /* ON READ: when there is only a single dataFile, don't close nio->dataFile when you otherwise would, when reading the nrrd format. Probably used in conjunction with skipData. (currently for "unu data") ON WRITE: no semantics */ zlibLevel, /* zlib compression level (0-9, -1 for default[6], 0 for no compression). */ zlibStrategy, /* zlib compression strategy, can be one of the nrrdZlibStrategy enums, default is nrrdZlibStrategyDefault. */ bzip2BlockSize, /* block size used for compression, roughly equivalent to better but slower (1-9, -1 for default[9]). */ learningHeaderStrlen; /* ON WRITE, for nrrds, learn and save the total length of header into headerStrlen. This is used to allocate a buffer for header */ void *oldData; /* ON READ: if non-NULL, pointer to space that has already been allocated for oldDataSize */ size_t oldDataSize; /* ON READ: size of mem pointed to by oldData */ /* The format and encoding. These are initialized to nrrdFormatUnknown and nrrdEncodingUnknown, respectively. USE THESE VALUES for any kind of initialization or flagging; DO NOT USE NULL */ const NrrdFormat *format; const NrrdEncoding *encoding; } NrrdIoState; /******** defaults (nrrdDefault..) and state (nrrdState..) */ /* defaultsNrrd.c */ NRRDIO_EXPORT int nrrdDefaultWriteEncodingType; NRRDIO_EXPORT int nrrdDefaultWriteBareText; NRRDIO_EXPORT unsigned int nrrdDefaultWriteCharsPerLine; NRRDIO_EXPORT unsigned int nrrdDefaultWriteValsPerLine; NRRDIO_EXPORT int nrrdDefaultCenter; NRRDIO_EXPORT double nrrdDefaultSpacing; NRRDIO_EXPORT int nrrdStateVerboseIO; NRRDIO_EXPORT int nrrdStateKeyValuePairsPropagate; NRRDIO_EXPORT int nrrdStateAlwaysSetContent; NRRDIO_EXPORT int nrrdStateDisableContent; NRRDIO_EXPORT const char *nrrdStateUnknownContent; NRRDIO_EXPORT int nrrdStateGrayscaleImage3D; NRRDIO_EXPORT int nrrdStateKeyValueReturnInternalPointers; NRRDIO_EXPORT int nrrdStateKindNoop; /******** all the airEnums used through-out nrrd */ /* ** the actual C enums are in nrrdEnums.h; experience has shown that it ** is not particularly useful to name those enums, since the shortest ** name is best used for the airEnums here */ /* enumsNrrd.c */ NRRDIO_EXPORT const airEnum *const nrrdFormatType; NRRDIO_EXPORT const airEnum *const nrrdType; NRRDIO_EXPORT const airEnum *const nrrdEncodingType; NRRDIO_EXPORT const airEnum *const nrrdCenter; NRRDIO_EXPORT const airEnum *const nrrdKind; NRRDIO_EXPORT const airEnum *const nrrdField; NRRDIO_EXPORT const airEnum *const nrrdSpace; NRRDIO_EXPORT const airEnum *const nrrdSpacingStatus; /******** arrays of things (poor-man's functions/predicates) */ /* arraysNrrd.c */ NRRDIO_EXPORT const char nrrdTypePrintfStr[NRRD_TYPE_MAX+1][AIR_STRLEN_SMALL]; NRRDIO_EXPORT const size_t nrrdTypeSize[NRRD_TYPE_MAX+1]; NRRDIO_EXPORT const double nrrdTypeMin[NRRD_TYPE_MAX+1]; NRRDIO_EXPORT const double nrrdTypeMax[NRRD_TYPE_MAX+1]; NRRDIO_EXPORT const int nrrdTypeIsIntegral[NRRD_TYPE_MAX+1]; NRRDIO_EXPORT const int nrrdTypeIsUnsigned[NRRD_TYPE_MAX+1]; /******** pseudo-constructors, pseudo-destructors, and such */ /* methodsNrrd.c */ NRRDIO_EXPORT NrrdIoState *nrrdIoStateNew(void); NRRDIO_EXPORT void nrrdIoStateInit(NrrdIoState *nio); NRRDIO_EXPORT NrrdIoState *nrrdIoStateNix(NrrdIoState *nio); NRRDIO_EXPORT void nrrdInit(Nrrd *nrrd); NRRDIO_EXPORT Nrrd *nrrdNew(void); NRRDIO_EXPORT Nrrd *nrrdNix(Nrrd *nrrd); NRRDIO_EXPORT Nrrd *nrrdEmpty(Nrrd *nrrd); NRRDIO_EXPORT Nrrd *nrrdNuke(Nrrd *nrrd); NRRDIO_EXPORT int nrrdWrap_nva(Nrrd *nrrd, void *data, int type, unsigned int dim, const size_t *size); NRRDIO_EXPORT int nrrdWrap_va(Nrrd *nrrd, void *data, int type, unsigned int dim, ... /* size_t sx, sy, .., axis(dim-1) size */); NRRDIO_EXPORT void nrrdBasicInfoInit(Nrrd *nrrd, int excludeBitflag); NRRDIO_EXPORT int nrrdBasicInfoCopy(Nrrd *nout, const Nrrd *nin, int excludeBitflag); NRRDIO_EXPORT int nrrdCopy(Nrrd *nout, const Nrrd *nin); NRRDIO_EXPORT int nrrdAlloc_nva(Nrrd *nrrd, int type, unsigned int dim, const size_t *size); NRRDIO_EXPORT int nrrdAlloc_va(Nrrd *nrrd, int type, unsigned int dim, ... /* size_t sx, sy, .., axis(dim-1) size */); NRRDIO_EXPORT int nrrdMaybeAlloc_nva(Nrrd *nrrd, int type, unsigned int dim, const size_t *size); NRRDIO_EXPORT int nrrdMaybeAlloc_va(Nrrd *nrrd, int type, unsigned int dim, ... /* size_t sx, sy, .., ax(dim-1) size */); /******** axis info related */ /* axis.c */ NRRDIO_EXPORT int nrrdKindIsDomain(int kind); NRRDIO_EXPORT unsigned int nrrdKindSize(int kind); NRRDIO_EXPORT int nrrdAxisInfoCopy(Nrrd *nout, const Nrrd *nin, const int *axmap, int excludeBitflag); NRRDIO_EXPORT void nrrdAxisInfoSet_nva(Nrrd *nin, int axInfo, const void *info); NRRDIO_EXPORT void nrrdAxisInfoSet_va(Nrrd *nin, int axInfo, ... /* const void* */); NRRDIO_EXPORT void nrrdAxisInfoGet_nva(const Nrrd *nrrd, int axInfo, void *info); NRRDIO_EXPORT void nrrdAxisInfoGet_va(const Nrrd *nrrd, int axInfo, ... /* ??? */); NRRDIO_EXPORT double nrrdAxisInfoPos(const Nrrd *nrrd, unsigned int ax, double idx); NRRDIO_EXPORT double nrrdAxisInfoIdx(const Nrrd *nrrd, unsigned int ax, double pos); NRRDIO_EXPORT void nrrdAxisInfoPosRange(double *loP, double *hiP, const Nrrd *nrrd, unsigned int ax, double loIdx, double hiIdx); NRRDIO_EXPORT void nrrdAxisInfoIdxRange(double *loP, double *hiP, const Nrrd *nrrd, unsigned int ax, double loPos, double hiPos); NRRDIO_EXPORT void nrrdAxisInfoSpacingSet(Nrrd *nrrd, unsigned int ax); NRRDIO_EXPORT void nrrdAxisInfoMinMaxSet(Nrrd *nrrd, unsigned int ax, int defCenter); NRRDIO_EXPORT unsigned int nrrdDomainAxesGet(const Nrrd *nrrd, unsigned int axisIdx[NRRD_DIM_MAX]); NRRDIO_EXPORT unsigned int nrrdRangeAxesGet(const Nrrd *nrrd, unsigned int axisIdx[NRRD_DIM_MAX]); NRRDIO_EXPORT unsigned int nrrdSpatialAxesGet(const Nrrd *nrrd, unsigned int axisIdx[NRRD_DIM_MAX]); NRRDIO_EXPORT unsigned int nrrdNonSpatialAxesGet(const Nrrd *nrrd, unsigned int axisIdx[NRRD_DIM_MAX]); NRRDIO_EXPORT int nrrdSpacingCalculate(const Nrrd *nrrd, unsigned int ax, double *spacing, double vector[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT int nrrdOrientationReduce(Nrrd *nout, const Nrrd *nin, int setMinsFromOrigin); /******** simple things */ /* simple.c */ NRRDIO_EXPORT const char *nrrdBiffKey; NRRDIO_EXPORT unsigned int nrrdSpaceDimension(int space); NRRDIO_EXPORT int nrrdSpaceSet(Nrrd *nrrd, int space); NRRDIO_EXPORT int nrrdSpaceDimensionSet(Nrrd *nrrd, unsigned int spaceDim); NRRDIO_EXPORT unsigned int nrrdSpaceOriginGet(const Nrrd *nrrd, double vector[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT int nrrdSpaceOriginSet(Nrrd *nrrd, double vector[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT int nrrdOriginCalculate(const Nrrd *nrrd, unsigned int *axisIdx, unsigned int axisIdxNum, int defaultCenter, double *origin); NRRDIO_EXPORT int nrrdContentSet_va(Nrrd *nout, const char *func, const Nrrd *nin, const char *format, ... /* printf-style arg list */ ); NRRDIO_EXPORT void nrrdDescribe(FILE *file, const Nrrd *nrrd); NRRDIO_EXPORT int nrrdCheck(const Nrrd *nrrd); NRRDIO_EXPORT int _nrrdCheck(const Nrrd *nrrd, int checkData, int useBiff); NRRDIO_EXPORT size_t nrrdElementSize(const Nrrd *nrrd); NRRDIO_EXPORT size_t nrrdElementNumber(const Nrrd *nrrd); NRRDIO_EXPORT int nrrdSanity(void); NRRDIO_EXPORT int nrrdSameSize(const Nrrd *n1, const Nrrd *n2, int useBiff); NRRDIO_EXPORT void nrrdSpaceVecCopy(double dst[NRRD_SPACE_DIM_MAX], const double src[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT void nrrdSpaceVecScaleAdd2(double sum[NRRD_SPACE_DIM_MAX], double sclA, const double vecA[NRRD_SPACE_DIM_MAX], double sclB, const double vecB[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT void nrrdSpaceVecScale(double out[NRRD_SPACE_DIM_MAX], double scl, const double vec[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT double nrrdSpaceVecNorm(unsigned int sdim, const double vec[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT int nrrdSpaceVecExists(unsigned int sdim, double vec[NRRD_SPACE_DIM_MAX]); NRRDIO_EXPORT void nrrdSpaceVecSetNaN(double vec[NRRD_SPACE_DIM_MAX]); /******** comments related */ /* comment.c */ NRRDIO_EXPORT int nrrdCommentAdd(Nrrd *nrrd, const char *str); NRRDIO_EXPORT void nrrdCommentClear(Nrrd *nrrd); NRRDIO_EXPORT int nrrdCommentCopy(Nrrd *nout, const Nrrd *nin); /******** key/value pairs */ /* keyvalue.c */ NRRDIO_EXPORT unsigned int nrrdKeyValueSize(const Nrrd *nrrd); NRRDIO_EXPORT int nrrdKeyValueAdd(Nrrd *nrrd, const char *key, const char *value); NRRDIO_EXPORT char *nrrdKeyValueGet(const Nrrd *nrrd, const char *key); NRRDIO_EXPORT void nrrdKeyValueIndex(const Nrrd *nrrd, char **keyP, char **valueP, unsigned int ki); NRRDIO_EXPORT int nrrdKeyValueErase(Nrrd *nrrd, const char *key); NRRDIO_EXPORT void nrrdKeyValueClear(Nrrd *nrrd); NRRDIO_EXPORT int nrrdKeyValueCopy(Nrrd *nout, const Nrrd *nin); /******** endian related */ /* endianNrrd.c */ NRRDIO_EXPORT void nrrdSwapEndian(Nrrd *nrrd); /******** getting information to and from files */ /* formatXXX.c */ NRRDIO_EXPORT const NrrdFormat *const nrrdFormatNRRD; NRRDIO_EXPORT const NrrdFormat *const nrrdFormatPNM; NRRDIO_EXPORT const NrrdFormat *const nrrdFormatPNG; NRRDIO_EXPORT const NrrdFormat *const nrrdFormatVTK; NRRDIO_EXPORT const NrrdFormat *const nrrdFormatText; NRRDIO_EXPORT const NrrdFormat *const nrrdFormatEPS; /* format.c */ NRRDIO_EXPORT const NrrdFormat *const nrrdFormatUnknown; NRRDIO_EXPORT const NrrdFormat * const nrrdFormatArray[NRRD_FORMAT_TYPE_MAX+1]; /* encodingXXX.c */ NRRDIO_EXPORT const NrrdEncoding *const nrrdEncodingRaw; NRRDIO_EXPORT const NrrdEncoding *const nrrdEncodingAscii; NRRDIO_EXPORT const NrrdEncoding *const nrrdEncodingHex; NRRDIO_EXPORT const NrrdEncoding *const nrrdEncodingGzip; NRRDIO_EXPORT const NrrdEncoding *const nrrdEncodingBzip2; /* encoding.c */ NRRDIO_EXPORT const NrrdEncoding *const nrrdEncodingUnknown; NRRDIO_EXPORT const NrrdEncoding * const nrrdEncodingArray[NRRD_ENCODING_TYPE_MAX+1]; /* parseNrrd.c */ /* this needs the "FILE *file" first arg for the sole reason that parsing a "data file: " field which identifies a LIST must then read in all the data filenames from the same file */ NRRDIO_EXPORT int (*nrrdFieldInfoParse[NRRD_FIELD_MAX+1])(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff); NRRDIO_EXPORT unsigned int _nrrdDataFNNumber(NrrdIoState *nio); NRRDIO_EXPORT int _nrrdContainsPercentThisAndMore(const char *str, char thss); NRRDIO_EXPORT int _nrrdDataFNCheck(NrrdIoState *nio, Nrrd *nrrd, int useBiff); /* read.c */ NRRDIO_EXPORT int _nrrdOneLine(unsigned int *lenP, NrrdIoState *nio, FILE *file); NRRDIO_EXPORT int nrrdLineSkip(FILE *dataFile, NrrdIoState *nio); NRRDIO_EXPORT int nrrdByteSkip(FILE *dataFile, Nrrd *nrrd, NrrdIoState *nio); NRRDIO_EXPORT int nrrdLoad(Nrrd *nrrd, const char *filename, NrrdIoState *nio); NRRDIO_EXPORT int nrrdLoadMulti(Nrrd *const *nin, unsigned int ninLen, const char *fnameFormat, unsigned int numStart, NrrdIoState *nio); NRRDIO_EXPORT int nrrdRead(Nrrd *nrrd, FILE *file, NrrdIoState *nio); NRRDIO_EXPORT int nrrdStringRead(Nrrd *nrrd, const char *string, NrrdIoState *nio); /* write.c */ NRRDIO_EXPORT int nrrdIoStateSet(NrrdIoState *nio, int parm, int value); NRRDIO_EXPORT int nrrdIoStateEncodingSet(NrrdIoState *nio, const NrrdEncoding *encoding); NRRDIO_EXPORT int nrrdIoStateFormatSet(NrrdIoState *nio, const NrrdFormat *format); NRRDIO_EXPORT int nrrdIoStateGet(NrrdIoState *nio, int parm); NRRDIO_EXPORT const NrrdEncoding *nrrdIoStateEncodingGet(NrrdIoState *nio); NRRDIO_EXPORT const NrrdFormat *nrrdIoStateFormatGet(NrrdIoState *nio); NRRDIO_EXPORT int nrrdSave(const char *filename, const Nrrd *nrrd, NrrdIoState *nio); NRRDIO_EXPORT int nrrdSaveMulti(const char *fnameFormat, const Nrrd *const *nin, unsigned int ninLen, unsigned int numStart, NrrdIoState *nio); NRRDIO_EXPORT int nrrdWrite(FILE *file, const Nrrd *nrrd, NrrdIoState *nio); NRRDIO_EXPORT int nrrdStringWrite(char **stringP, const Nrrd *nrrd, NrrdIoState *nio); /******** getting value into and out of an array of general type, and all other simplistic functionality pseudo-parameterized by type */ /* accessors.c */ NRRDIO_EXPORT double (*nrrdDLoad[NRRD_TYPE_MAX+1])(const void *v); NRRDIO_EXPORT float (*nrrdFLoad[NRRD_TYPE_MAX+1])(const void *v); NRRDIO_EXPORT int (*nrrdILoad[NRRD_TYPE_MAX+1])(const void *v); NRRDIO_EXPORT unsigned int (*nrrdUILoad[NRRD_TYPE_MAX+1])(const void *v); NRRDIO_EXPORT double (*nrrdDStore[NRRD_TYPE_MAX+1])(void *v, double d); NRRDIO_EXPORT float (*nrrdFStore[NRRD_TYPE_MAX+1])(void *v, float f); NRRDIO_EXPORT int (*nrrdIStore[NRRD_TYPE_MAX+1])(void *v, int j); NRRDIO_EXPORT unsigned int (*nrrdUIStore[NRRD_TYPE_MAX+1])(void *v, unsigned int j); NRRDIO_EXPORT double (*nrrdDLookup[NRRD_TYPE_MAX+1])(const void *v, size_t I); NRRDIO_EXPORT float (*nrrdFLookup[NRRD_TYPE_MAX+1])(const void *v, size_t I); NRRDIO_EXPORT int (*nrrdILookup[NRRD_TYPE_MAX+1])(const void *v, size_t I); NRRDIO_EXPORT unsigned int (*nrrdUILookup[NRRD_TYPE_MAX+1])(const void *v, size_t I); NRRDIO_EXPORT double (*nrrdDInsert[NRRD_TYPE_MAX+1])(void *v, size_t I, double d); NRRDIO_EXPORT float (*nrrdFInsert[NRRD_TYPE_MAX+1])(void *v, size_t I, float f); NRRDIO_EXPORT int (*nrrdIInsert[NRRD_TYPE_MAX+1])(void *v, size_t I, int j); NRRDIO_EXPORT unsigned int (*nrrdUIInsert[NRRD_TYPE_MAX+1])(void *v, size_t I, unsigned int j); NRRDIO_EXPORT int (*nrrdSprint[NRRD_TYPE_MAX+1])(char *, const void *); /******** permuting, shuffling, and all flavors of reshaping */ /* reorder.c */ NRRDIO_EXPORT int nrrdAxesInsert(Nrrd *nout, const Nrrd *nin, unsigned int ax); NRRDIO_EXPORT int nrrdInvertPerm(unsigned int *invp, const unsigned int *perm, unsigned int n); NRRDIO_EXPORT int nrrdAxesPermute(Nrrd *nout, const Nrrd *nin, const unsigned int *axes); NRRDIO_EXPORT int nrrdShuffle(Nrrd *nout, const Nrrd *nin, unsigned int axis, const size_t *perm); /******** sampling, slicing, cropping */ /* subset.c */ NRRDIO_EXPORT int nrrdSlice(Nrrd *nout, const Nrrd *nin, unsigned int axis, size_t pos); NRRDIO_EXPORT int nrrdCrop(Nrrd *nout, const Nrrd *nin, size_t *min, size_t *max); #ifdef __cplusplus } #endif cmtk-3.0.0/Utilities/NrrdIO/encodingAscii.c0000644000177700000170000001303012041601331017506 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" static FILE *_fileSave = NULL; static int _nrrdEncodingAscii_available(void) { return AIR_TRUE; } static int _nrrdEncodingAscii_read(FILE *file, void *_data, size_t elNum, Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdEncodingAscii_read"; char numbStr[AIR_STRLEN_HUGE]; /* HEY: fix this */ char *nstr; size_t I; char *data; int tmp; AIR_UNUSED(nio); _fileSave = file; if (nrrdTypeBlock == nrrd->type) { biffAddf(NRRD, "%s: can't read nrrd type %s from %s", me, airEnumStr(nrrdType, nrrdTypeBlock), nrrdEncodingAscii->name); return 1; } data = (char*)_data; I = 0; while (I < elNum) { char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL]; /* HEY: we can easily suffer here from a standard buffer overflow problem; this was a source of a mysterious unu crash: echo "0 0 0 0 1 0 0 0 0" \ | unu reshape -s 9 1 1 \ | unu pad -min 0 0 0 -max 8 8 8 \ | unu make -s 9 9 9 -t float -e ascii -ls 9 \ -spc LPS -orig "(0,0,0)" -dirs "(1,0,0) (0,1,0) (0,0,1)" This particular case is resolved by changing AIR_STRLEN_HUGE to AIR_STRLEN_HUGE*100, but the general problem remains. This motivated adding the memory corruption test */ if (1 != fscanf(file, "%s", numbStr)) { biffAddf(NRRD, "%s: couldn't parse element %s of %s", me, airSprintSize_t(stmp1, I+1), airSprintSize_t(stmp2, elNum)); return 1; } if (file != _fileSave) { fprintf(stderr, "%s: PANIC memory corruption detected\n", me); /* this may crash, hence the fprintf above to help debug */ biffAddf(NRRD, "%s: PANIC memory corruption detected", me); return 1; } if (!strcmp(",", numbStr)) { /* its an isolated comma, not a value, pass over this */ continue; } /* get past any commas prefixing a number (without space) */ nstr = numbStr + strspn(numbStr, ","); if (nrrd->type >= nrrdTypeInt) { /* sscanf supports putting value directly into this type */ if (1 != airSingleSscanf(nstr, nrrdTypePrintfStr[nrrd->type], (void*)(data + I*nrrdElementSize(nrrd)))) { biffAddf(NRRD, "%s: couldn't parse %s %s of %s (\"%s\")", me, airEnumStr(nrrdType, nrrd->type), airSprintSize_t(stmp1, I+1), airSprintSize_t(stmp2, elNum), nstr); return 1; } } else { /* sscanf value into an int first */ if (1 != airSingleSscanf(nstr, "%d", &tmp)) { biffAddf(NRRD, "%s: couldn't parse element %s of %s (\"%s\")", me, airSprintSize_t(stmp1, I+1), airSprintSize_t(stmp2, elNum), nstr); return 1; } nrrdIInsert[nrrd->type](data, I, tmp); } I++; } return 0; } static int _nrrdEncodingAscii_write(FILE *file, const void *_data, size_t elNum, const Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdEncodingAscii_write"; char buff[AIR_STRLEN_MED]; size_t bufflen, linelen; const char *data; size_t I; if (nrrdTypeBlock == nrrd->type) { biffAddf(NRRD, "%s: can't write nrrd type %s to %s", me, airEnumStr(nrrdType, nrrdTypeBlock), nrrdEncodingAscii->name); return 1; } data = AIR_CAST(const char*, _data); linelen = 0; for (I=0; Itype](buff, data); if (1 == nrrd->dim) { fprintf(file, "%s\n", buff); } else if (nrrd->dim == 2 && nrrd->axis[0].size <= nio->valsPerLine) { fprintf(file, "%s%c", buff, (I+1)%(nrrd->axis[0].size) ? ' ' : '\n'); } else { bufflen = strlen(buff); if (linelen+bufflen+1 <= nio->charsPerLine) { fprintf(file, "%s%s", I ? " " : "", buff); linelen += (I ? 1 : 0) + bufflen; } else { fprintf(file, "\n%s", buff); linelen = bufflen; } } data += nrrdElementSize(nrrd); } /* just to be sure, we always end with a carraige return */ fprintf(file, "\n"); return 0; } const NrrdEncoding _nrrdEncodingAscii = { "ASCII", /* name */ "ascii", /* suffix */ AIR_FALSE, /* endianMatters */ AIR_FALSE, /* isCompression */ _nrrdEncodingAscii_available, _nrrdEncodingAscii_read, _nrrdEncodingAscii_write }; const NrrdEncoding *const nrrdEncodingAscii = &_nrrdEncodingAscii; cmtk-3.0.0/Utilities/NrrdIO/defaultsNrrd.c0000644000177700000170000000660512041601331017416 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* ** these aren't "const"s because the user should be able to change ** default behavior- until a more sophisticated mechanism for this ** kind of control is developed, it seems simple and usable enough to ** have this be global state which we agree to treat nicely, as in, ** threads shouldn't be changing these willy-nilly. ** ** What IS a "default"? A default is the assertion of a certain ** choice in situations where the user hasn't set it explicitly, but ** COULD. The pad value in resampling is a good example: it is set by ** a constructor to nrrdDefaultResamplePadValue, but the user can also set it ** explicitly. */ int nrrdDefaultWriteEncodingType = nrrdEncodingTypeRaw; int nrrdDefaultWriteBareText = AIR_TRUE; unsigned int nrrdDefaultWriteCharsPerLine = 75; unsigned int nrrdDefaultWriteValsPerLine = 8; int nrrdDefaultCenter = nrrdCenterCell; double nrrdDefaultSpacing = 1.0; /* these aren't really "defaults" because there's no other channel for specifying this information. It is just global state. Obviously, like defaults, they are not thread-safe if different threads ever set them differently. */ int nrrdStateVerboseIO = 0; int nrrdStateKeyValuePairsPropagate = AIR_FALSE; int nrrdStateAlwaysSetContent = AIR_TRUE; int nrrdStateDisableContent = AIR_FALSE; const char *nrrdStateUnknownContent = NRRD_UNKNOWN; int nrrdStateGrayscaleImage3D = AIR_FALSE; /* there is no sane reason to change this initialization */ int nrrdStateKeyValueReturnInternalPointers = AIR_FALSE; /* Making the default for this be AIR_TRUE means that nrrd is not only completely conservative about updating kind, but purposely stupid. Nrrd is only going to implement the most converative kind of logic anyway, based on existing sementics nailed down by the format spec. */ int nrrdStateKindNoop = AIR_FALSE; /* these are helper functions for min/max testing */ airLLong _nrrdLLongMaxHelp(airLLong val) { return val*2 + 1; } airLLong _nrrdLLongMinHelp(airLLong val) { return val*2; } airULLong _nrrdULLongMaxHelp(airULLong val) { return val + 1; } /* should the acceptance (or not) of malformed NRRD header fields embedded in PNM or text comments be controlled here? */ /* Are there other assumptions currently built into nrrd which could stand to be user-controllable? */ cmtk-3.0.0/Utilities/NrrdIO/formatText.c0000644000177700000170000000557312041601331017121 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" int _nrrdFormatText_available(void) { return AIR_FALSE; } int _nrrdFormatText_nameLooksLike(const char *fname) { return (airEndsWith(fname, NRRD_EXT_TEXT) || airEndsWith(fname, ".text") || airEndsWith(fname, ".ascii")); } int _nrrdFormatText_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatText_fitsInto", err[AIR_STRLEN_MED]; AIR_UNUSED(nrrd); AIR_UNUSED(encoding); AIR_UNUSED(useBiff); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatText->name); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; } int _nrrdFormatText_contentStartsLike(NrrdIoState *nio) { AIR_UNUSED(nio); return AIR_FALSE; } int _nrrdFormatText_read(FILE *file, Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdReadText", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatText->name); biffAdd(NRRD, err); return 1; } int _nrrdFormatText_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdFormatText_write", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatText->name); biffAdd(NRRD, err); return 1; } const NrrdFormat _nrrdFormatText = { "text", AIR_FALSE, /* isImage */ AIR_FALSE, /* readable */ AIR_FALSE, /* usesDIO */ _nrrdFormatText_available, _nrrdFormatText_nameLooksLike, _nrrdFormatText_fitsInto, _nrrdFormatText_contentStartsLike, _nrrdFormatText_read, _nrrdFormatText_write }; const NrrdFormat *const nrrdFormatText = &_nrrdFormatText; cmtk-3.0.0/Utilities/NrrdIO/teemQnanhibit.h0000644000177700000170000000271712041601331017556 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* ** the end result of this is that the source file which includes ** this can be sure that TEEM_QNANHIBIT is set, and can be sure that ** it is set to either 0 or 1 */ #ifndef TEEM_QNANHIBIT # error TEEM_QNANHIBIT not defined #elif TEEM_QNANHIBIT == 1 # /* okay, its 1 */ #elif TEEM_QNANHIBIT == 0 # /* okay, its 0 */ #else # error TEEM_QNANHIBIT not set to 0 or 1 #endif cmtk-3.0.0/Utilities/NrrdIO/CMakeLists.txt0000644000177700000170000000711312041612531017354 0ustar torstenman# # NrrdIO: stand-alone code for basic nrrd functionality # Copyright (C) 2011, 2010, 2009 University of Chicago # Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann # Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any # damages arising from the use of this software. # # Permission is granted to anyone to use this software for any # purpose, including commercial applications, and to alter it and # redistribute it freely, subject to the following restrictions: # # 1. The origin of this software must not be misrepresented; you must # not claim that you wrote the original software. If you use this # software in a product, an acknowledgment in the product # documentation would be appreciated but is not required. # # 2. Altered source versions must be plainly marked as such, and must # not be misrepresented as being the original software. # # 3. This notice may not be removed or altered from any source distribution. # # # Modified 23-Oct-2012 by Torsten Rohlfing for CMTK, # (C) 2012 SRI International # CMAKE_MINIMUM_REQUIRED(VERSION 2.4) PROJECT(NrrdIO) INCLUDE_REGULAR_EXPRESSION("^.*.h$") # # This CMake file configures the NrrdIO library build. NrrdIO # is used by Insight/Code/IO/itkNrrdIO for reading/writing # "Nearly Raw Raster Data" within the open-source Teem software # package. See http://teem.sourceforge.net for more information. # SET(nrrdio_SRCS comment.c enumsNrrd.c mop.c string.c 754.c defaultsNrrd.c parseAir.c dio.c format.c parseNrrd.c formatEPS.c encoding.c formatNRRD.c encodingAscii.c formatPNG.c encodingBzip2.c formatPNM.c accessors.c encodingGzip.c formatText.c array.c encodingHex.c formatVTK.c read.c arraysNrrd.c encodingRaw.c gzio.c reorder.c write.c axis.c endianAir.c keyvalue.c biffbiff.c biffmsg.c endianNrrd.c methodsNrrd.c sane.c enum.c miscAir.c simple.c ) # Turn on TEEM_BUILD so that the proper dll export def's are # used on windows builds. ADD_DEFINITIONS(-DTEEM_BUILD=1) # Configure files with settings for use by the build. CONFIGURE_FILE(${NrrdIO_SOURCE_DIR}/NrrdConfigure.h.in ${NrrdIO_BINARY_DIR}/NrrdConfigure.h) # Need to be able to find NrrdConfig.h INCLUDE_DIRECTORIES(${NrrdIO_BINARY_DIR}) #The QNANHIBIT variable is configured by the root level CMakeLists.txt IF(QNANHIBIT) ADD_DEFINITIONS(-DTEEM_QNANHIBIT=1) ELSE(QNANHIBIT) ADD_DEFINITIONS(-DTEEM_QNANHIBIT=0) ENDIF(QNANHIBIT) #DirectIO is the fast way to do multi-gigabyte I/O and currently only available #for SGI platforms. Use of DirectIO is enabled manually for now. #OPTION(USE_DIRECTIO "Use DirectIO for Nrrd file IO. Only valid on SGI systems." 0) #MARK_AS_ADVANCED(USE_DIRECTIO) #IF(USE_DIRECTIO) # ADD_DEFINITIONS(-DTEEM_DIO=1) #ELSE(USE_DIRECTIO) ADD_DEFINITIONS(-DTEEM_DIO=0) #ENDIF(USE_DIRECTIO) # Possibly turn on usage of zlib compression (requires linking with libz) # (i.e., programs compiled with ITKNrrdIO must also be compiled with zlib) ADD_DEFINITIONS(-DTEEM_ZLIB=1) ## ## CMTK-speficic add-ons ## INCLUDE_DIRECTORIES(BEFORE ${ZCONF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) ADD_LIBRARY(NrrdIO ${nrrdio_SRCS} ) TARGET_LINK_LIBRARIES(NrrdIO ${ZLIB_LIBRARIES}) INSTALL(TARGETS NrrdIO RUNTIME DESTINATION ${CMTK_INSTALL_BIN_DIR} COMPONENT runtime LIBRARY DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT runtime ARCHIVE DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT libraries) FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") INSTALL(FILES ${files} DESTINATION ${CMTK_INSTALL_INCLUDE_DIR} COMPONENT headers) cmtk-3.0.0/Utilities/NrrdIO/endianAir.c0000644000177700000170000000444112041601331016647 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" /* ******** airMyEndian() ** ** determine at run-time if we are little (1234) or big (4321) endian */ int airMyEndian(void) { int tmpI, ret; char leastbyte; /* set int to 1: least signficant byte will be 1, most signficant byte will be 0 */ tmpI = 1; /* cast address of (4-byte) int to char*, and dereference, which retrieves the byte at the low-address-end of int (the "first" byte in memory ordering). On big endian, we're getting the most significant byte (0); on little endian, we're getting least significant byte (1) */ leastbyte = *(AIR_CAST(char*, &tmpI)); if (leastbyte) { ret = airEndianLittle; } else { ret = airEndianBig; } return ret; } static const char * _airEndianStr[] = { "(unknown endian)", "little", "big" }; static const char * _airEndianDesc[] = { "unknown endianness", "Intel and compatible", "Everyone besides Intel and compatible" }; static const int _airEndianVal[] = { airEndianUnknown, airEndianLittle, airEndianBig, }; static const airEnum _airEndian = { "endian", 2, _airEndianStr, _airEndianVal, _airEndianDesc, NULL, NULL, AIR_FALSE }; const airEnum *const airEndian = &_airEndian; cmtk-3.0.0/Utilities/NrrdIO/simple.c0000644000177700000170000013205512041601331016251 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" #include /* The "/ *Teem:" (without space) comments in here are an experiment */ const char * nrrdBiffKey = "nrrd"; /* ******** nrrdSpaceDimension ** ** returns expected dimension of given space (from nrrdSpace* enum), or, ** 0 if there is no expected dimension. ** ** The expected behavior here is to return 0 for nrrdSpaceUnknown, because ** that is the right answer, not because its an error of any kind. */ unsigned int nrrdSpaceDimension(int space) { static const char me[]="nrrdSpaceDimension"; unsigned int ret; if (!( AIR_IN_OP(nrrdSpaceUnknown, space, nrrdSpaceLast) )) { /* they gave us invalid or unknown space */ return 0; } switch (space) { case nrrdSpaceRightAnteriorSuperior: case nrrdSpaceLeftAnteriorSuperior: case nrrdSpaceLeftPosteriorSuperior: case nrrdSpaceScannerXYZ: case nrrdSpace3DRightHanded: case nrrdSpace3DLeftHanded: ret = 3; break; case nrrdSpaceRightAnteriorSuperiorTime: case nrrdSpaceLeftAnteriorSuperiorTime: case nrrdSpaceLeftPosteriorSuperiorTime: case nrrdSpaceScannerXYZTime: case nrrdSpace3DRightHandedTime: case nrrdSpace3DLeftHandedTime: ret = 4; break; default: fprintf(stderr, "%s: PANIC: nrrdSpace %d not implemented!\n", me, space); ret = UINT_MAX; /* exit(1); */ break; } return ret; } /* ******** nrrdSpaceSet ** ** What to use to set space, when a value from nrrdSpace enum is known, ** or, to nullify all space-related information when passed nrrdSpaceUnknown */ int nrrdSpaceSet(Nrrd *nrrd, int space) { static const char me[]="nrrdSpaceSet"; unsigned axi, saxi; if (!nrrd) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (nrrdSpaceUnknown == space) { nrrd->space = nrrdSpaceUnknown; nrrd->spaceDim = 0; for (axi=0; axiaxis[axi].spaceDirection); } for (saxi=0; saxispaceUnits[saxi]); nrrd->spaceUnits[saxi] = NULL; } nrrdSpaceVecSetNaN(nrrd->spaceOrigin); } else { if (airEnumValCheck(nrrdSpace, space)) { biffAddf(NRRD, "%s: given space (%d) not valid", me, space); return 1; } nrrd->space = space; nrrd->spaceDim = nrrdSpaceDimension(space); } return 0; } /* ******** nrrdSpaceDimensionSet ** ** What to use to set space, based on spaceDim alone (nrrd->space set to ** nrrdSpaceUnknown) */ int nrrdSpaceDimensionSet(Nrrd *nrrd, unsigned int spaceDim) { static const char me[]="nrrdSpaceDimensionSet"; if (!nrrd) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!( spaceDim <= NRRD_SPACE_DIM_MAX )) { biffAddf(NRRD, "%s: given spaceDim (%u) not valid", me, spaceDim); return 1; } nrrd->space = nrrdSpaceUnknown; nrrd->spaceDim = spaceDim; return 0; } /* ******** nrrdSpaceOriginGet ** ** retrieves the spaceOrigin from given nrrd, and returns spaceDim ** Indices 0 through spaceDim-1 are set in given vector[] to coords ** of space origin, and all further indices are set to NaN */ unsigned int nrrdSpaceOriginGet(const Nrrd *nrrd, double vector[NRRD_SPACE_DIM_MAX]) { unsigned int sdi, ret; if (nrrd && vector) { for (sdi=0; sdispaceDim; sdi++) { vector[sdi] = nrrd->spaceOrigin[sdi]; } for (sdi=nrrd->spaceDim; sdispaceDim; } else { ret = 0; } return ret; } /* ******** nrrdSpaceOriginSet ** ** convenience function for setting spaceOrigin. ** Note: space (or spaceDim) must be already set ** ** returns 1 if there were problems, 0 otherwise */ int nrrdSpaceOriginSet(Nrrd *nrrd, double vector[NRRD_SPACE_DIM_MAX]) { static const char me[]="nrrdSpaceOriginSet"; unsigned int sdi; if (!( nrrd && vector )) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!( 0 < nrrd->spaceDim && nrrd->spaceDim <= NRRD_SPACE_DIM_MAX )) { biffAddf(NRRD, "%s: set spaceDim %d not valid", me, nrrd->spaceDim); return 1; } for (sdi=0; sdispaceDim; sdi++) { nrrd->spaceOrigin[sdi] = vector[sdi]; } for (sdi=nrrd->spaceDim; sdispaceOrigin[sdi] = AIR_NAN; } return 0; } /* ******** nrrdOriginCalculate ** ** makes an effort to calculate something like an "origin" (as in ** nrrd->spaceOrigin) from the per-axis min, max, or spacing, when ** there is no real space information. Like the spaceOrigin, this ** location is supposed to be THE CENTER of the first sample. To ** avoid making assumptions about the nrrd or the caller, a default ** sample centering (defaultCenter) has to be provided (use either ** nrrdCenterNode or nrrdCenterCell). The axes that are used ** for the origin calculation have to be given explicitly- but they ** are likely the return of nrrdDomainAxesGet ** ** The computed origin is put into the given vector (origin). The return ** value takes on values from the nrrdOriginStatus* enum: ** ** nrrdOriginStatusUnknown: invalid arguments (e.g. NULL pointer, or ** axis values out of range) ** ** nrrdOriginStatusDirection: the chosen axes have spaceDirection set, ** which means caller should instead be using ** nrrdSpaceOriginGet ** ** nrrdOriginStatusNoMin: can't compute "origin" without axis->min ** ** nrrdOriginStatusNoMaxOrSpacing: can't compute origin without (axis->min ** and) either axis->max or axis->spacing ** ** nrrdOriginStatusOkay: all is well */ int nrrdOriginCalculate(const Nrrd *nrrd, unsigned int *axisIdx, unsigned int axisIdxNum, int defaultCenter, double *origin) { const NrrdAxisInfo *axis[NRRD_SPACE_DIM_MAX]; int center, okay, gotSpace, gotMin, gotMaxOrSpacing; unsigned int ai; double min, spacing; #define ERROR \ if (origin) { \ for (ai=0; aidim; } if (!okay) { ERROR; return nrrdOriginStatusUnknown; } /* learn axisInfo pointers */ for (ai=0; aiaxis + axisIdx[ai]; } gotSpace = AIR_FALSE; for (ai=0; aispaceDirection[0]); } if (nrrd->spaceDim > 0 && gotSpace) { ERROR; return nrrdOriginStatusDirection; } gotMin = AIR_TRUE; for (ai=0; aimin); } if (!gotMin) { ERROR; return nrrdOriginStatusNoMin; } gotMaxOrSpacing = AIR_TRUE; for (ai=0; aimax) || AIR_EXISTS(axis[ai]->spacing)); } if (!gotMaxOrSpacing) { ERROR; return nrrdOriginStatusNoMaxOrSpacing; } for (ai=0; aisize; min = axis[ai]->min; center = (nrrdCenterUnknown != axis[ai]->center ? axis[ai]->center : defaultCenter); denom = AIR_CAST(double, nrrdCenterCell == center ? size : size-1); spacing = (AIR_EXISTS(axis[ai]->spacing) ? axis[ai]->spacing : (axis[ai]->max - min)/denom); origin[ai] = min + (nrrdCenterCell == center ? spacing/2 : 0); } return nrrdOriginStatusOkay; } void nrrdSpaceVecCopy(double dst[NRRD_SPACE_DIM_MAX], const double src[NRRD_SPACE_DIM_MAX]) { unsigned int ii; for (ii=0; iispaceOrigin, nin->spaceOrigin); ** for (ai=0; aidim; ai++) { ** _nrrdSpaceVecScaleAdd2(nout->spaceOrigin, ** 1.0, nout->spaceOrigin, ** min[ai], nin->axis[ai].spaceDirection); ** } ** ** but the problem with this is that non-spatial axes end up clobbering ** the existance of otherwise existing spaceOrigin and spaceDirections. ** It was decided, however, that this logic should be outside the ** arithmetic functions below, not inside. NOTE: the old functionality ** is stuck in ITK 2.2, via NrrdIO. */ void nrrdSpaceVecScaleAdd2(double sum[NRRD_SPACE_DIM_MAX], double sclA, const double vecA[NRRD_SPACE_DIM_MAX], double sclB, const double vecB[NRRD_SPACE_DIM_MAX]) { unsigned int ii; for (ii=0; iicontent) ? airStrdup(nin->content) : airStrdup(nrrdStateUnknownContent)); if (!ret) { fprintf(stderr, "%s: PANIC: content strdup failed!\n", me); return NULL; } return ret; } int _nrrdContentSet_nva(Nrrd *nout, const char *func, char *content, const char *format, va_list arg) { static const char me[]="_nrrdContentSet_nva"; char *buff; if (nrrdStateDisableContent) { /* we kill content always */ nout->content = (char *)airFree(nout->content); return 0; } buff = (char *)malloc(128*AIR_STRLEN_HUGE); if (!buff) { biffAddf(NRRD, "%s: couln't alloc buffer!", me); return 1; } nout->content = (char *)airFree(nout->content); /* we are currently praying that this won't overflow the "buff" array */ /* HEY: replace with vsnprintf or whatever when its available */ vsprintf(buff, format, arg); nout->content = (char *)calloc(strlen("(,)") + airStrlen(func) + 1 /* '(' */ + airStrlen(content) + 1 /* ',' */ + airStrlen(buff) + 1 /* ')' */ + 1, sizeof(char)); /* '\0' */ if (!nout->content) { biffAddf(NRRD, "%s: couln't alloc output content!", me); airFree(buff); return 1; } sprintf(nout->content, "%s(%s%s%s)", func, content, airStrlen(buff) ? "," : "", buff); airFree(buff); /* no NULL assignment, else compile warnings */ return 0; } int _nrrdContentSet_va(Nrrd *nout, const char *func, char *content, const char *format, ...) { static const char me[]="_nrrdContentSet_va"; va_list ap; va_start(ap, format); if (_nrrdContentSet_nva(nout, func, content, format, ap)) { biffAddf(NRRD, "%s:", me); free(content); return 1; } va_end(ap); /* free(content); */ return 0; } /* ******** nrrdContentSet ** ** Kind of like sprintf, but for the content string of the nrrd. ** ** Whether or not we write a new content for an old nrrd ("nin") with ** NULL content is decided here, according to ** nrrdStateAlwaysSetContent. ** ** Does the string allocation and some attempts at error detection. ** Does allow nout==nin, which requires some care. */ int nrrdContentSet_va(Nrrd *nout, const char *func, const Nrrd *nin, const char *format, ...) { static const char me[]="nrrdContentSet_va"; va_list ap; char *content; if (!(nout && func && nin && format)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (nrrdStateDisableContent) { /* we kill content always */ nout->content = (char *)airFree(nout->content); return 0; } if (!nin->content && !nrrdStateAlwaysSetContent) { /* there's no input content, and we're not supposed to invent any content, so after freeing nout's content we're done */ nout->content = (char *)airFree(nout->content); return 0; } /* we copy the input nrrd content first, before blowing away the output content, in case nout == nin */ content = _nrrdContentGet(nin); va_start(ap, format); if (_nrrdContentSet_nva(nout, func, content, format, ap)) { biffAddf(NRRD, "%s:", me); va_end(ap); free(content); return 1; } va_end(ap); free(content); return 0; } /* ******** nrrdDescribe ** ** writes verbose description of nrrd to given file */ void nrrdDescribe(FILE *file, const Nrrd *nrrd) { unsigned int ai; char stmp[AIR_STRLEN_SMALL]; if (file && nrrd) { fprintf(file, "Nrrd at 0x%p:\n", AIR_CVOIDP(nrrd)); fprintf(file, "Data at 0x%p is %s elements of type %s.\n", nrrd->data, airSprintSize_t(stmp, nrrdElementNumber(nrrd)), airEnumStr(nrrdType, nrrd->type)); if (nrrdTypeBlock == nrrd->type) { fprintf(file, "The blocks have size %s\n", airSprintSize_t(stmp, nrrd->blockSize)); } if (airStrlen(nrrd->content)) { fprintf(file, "Content = \"%s\"\n", nrrd->content); } fprintf(file, "%d-dimensional array, with axes:\n", nrrd->dim); for (ai=0; aidim; ai++) { if (airStrlen(nrrd->axis[ai].label)) { fprintf(file, "%d: (\"%s\") ", ai, nrrd->axis[ai].label); } else { fprintf(file, "%d: ", ai); } fprintf(file, "%s-centered, size=%s, ", airEnumStr(nrrdCenter, nrrd->axis[ai].center), airSprintSize_t(stmp, nrrd->axis[ai].size)); airSinglePrintf(file, NULL, "spacing=%lg, \n", nrrd->axis[ai].spacing); airSinglePrintf(file, NULL, "thickness=%lg, \n", nrrd->axis[ai].thickness); airSinglePrintf(file, NULL, " axis(Min,Max) = (%lg,", nrrd->axis[ai].min); airSinglePrintf(file, NULL, "%lg)\n", nrrd->axis[ai].max); if (airStrlen(nrrd->axis[ai].units)) { fprintf(file, "units=%s, \n", nrrd->axis[ai].units); } } /* airSinglePrintf(file, NULL, "The min, max values are %lg", nrrd->min); airSinglePrintf(file, NULL, ", %lg\n", nrrd->max); */ airSinglePrintf(file, NULL, "The old min, old max values are %lg", nrrd->oldMin); airSinglePrintf(file, NULL, ", %lg\n", nrrd->oldMax); /* fprintf(file, "hasNonExist = %d\n", nrrd->hasNonExist); */ if (nrrd->cmtArr->len) { fprintf(file, "Comments:\n"); for (ai=0; aicmtArr->len; ai++) { fprintf(file, "%s\n", nrrd->cmt[ai]); } } fprintf(file, "\n"); } } int nrrdSpaceVecExists(unsigned int sdim, double vec[NRRD_SPACE_DIM_MAX]) { int exists; unsigned int ii; exists = AIR_EXISTS(vec[0]); for (ii=1; iispace || !airEnumValCheck(nrrdSpace, nrrd->space) )) { biffMaybeAddf(useBiff, NRRD, "%s: space %d invalid", me, nrrd->space); return 1; } if (!( nrrd->spaceDim <= NRRD_SPACE_DIM_MAX )) { biffMaybeAddf(useBiff, NRRD, "%s: space dimension %d is outside " "valid range [0,NRRD_SPACE_DIM_MAX] = [0,%d]", me, nrrd->dim, NRRD_SPACE_DIM_MAX); return 1; } if (nrrd->spaceDim) { if (nrrd->space) { if (nrrdSpaceDimension(nrrd->space) != nrrd->spaceDim) { biffMaybeAddf(useBiff, NRRD, "%s: space %s has dimension %d but spaceDim is %d", me, airEnumStr(nrrdSpace, nrrd->space), nrrdSpaceDimension(nrrd->space), nrrd->spaceDim); return 1; } } /* check that all coeffs of spaceOrigin have consistent existance */ exists = AIR_EXISTS(nrrd->spaceOrigin[0]); for (ii=0; iispaceDim; ii++) { if (exists ^ AIR_EXISTS(nrrd->spaceOrigin[ii])) { biffMaybeAddf(useBiff, NRRD, "%s: existance of space origin coefficients must " "be consistent (val[0] not like val[%d])", me, ii); return 1; } } /* check that all coeffs of measurementFrame have consistent existance */ exists = AIR_EXISTS(nrrd->measurementFrame[0][0]); for (dd=0; ddspaceDim; dd++) { for (ii=0; iispaceDim; ii++) { if (exists ^ AIR_EXISTS(nrrd->measurementFrame[dd][ii])) { biffMaybeAddf(useBiff, NRRD, "%s: existance of measurement frame coefficients " "must be consistent: [col][row] [%d][%d] not " "like [0][0])", me, dd, ii); return 1; } } } /* check on space directions */ for (dd=0; dddim; dd++) { exists = AIR_EXISTS(nrrd->axis[dd].spaceDirection[0]); for (ii=1; iispaceDim; ii++) { if (exists ^ AIR_EXISTS(nrrd->axis[dd].spaceDirection[ii])) { biffMaybeAddf(useBiff, NRRD, "%s: existance of space direction %d coefficients " "must be consistent (val[0] not like val[%d])", me, dd, ii); return 1; } } if (exists) { if (AIR_EXISTS(nrrd->axis[dd].min) || AIR_EXISTS(nrrd->axis[dd].max) || AIR_EXISTS(nrrd->axis[dd].spacing) || !!airStrlen(nrrd->axis[dd].units)) { biffMaybeAddf(useBiff, NRRD, "%s: axis[%d] has a direction vector, and so can't " "have min, max, spacing, or units set", me, dd); return 1; } } } } else { /* else there's not supposed to be anything in "space" */ if (nrrd->space) { biffMaybeAddf(useBiff, NRRD, "%s: space %s can't be set with spaceDim %d", me, airEnumStr(nrrdSpace, nrrd->space), nrrd->spaceDim); return 1; } /* -------- */ exists = AIR_FALSE; for (dd=0; ddspaceUnits[dd]); } if (exists) { biffMaybeAddf(useBiff, NRRD, "%s: spaceDim is 0, but space units is set", me); return 1; } /* -------- */ exists = AIR_FALSE; for (dd=0; ddspaceOrigin[dd]); } if (exists) { biffMaybeAddf(useBiff, NRRD, "%s: spaceDim is 0, but space origin is set", me); return 1; } /* -------- */ exists = AIR_FALSE; for (dd=0; ddaxis[ii].spaceDirection[dd]); } } if (exists) { biffMaybeAddf(useBiff, NRRD, "%s: spaceDim is 0, but space directions are set", me); return 1; } } return 0; } /* --------------------- per-field checks ---------------- ** ** Strictly speacking, these checks only apply to the nrrd itself, not ** to a potentially incomplete nrrd in the process of being read, so ** the NrrdIoState stuff is not an issue. This limits the utility of ** these to the field parsers for handling the more complex state ** involved in parsing some of the NRRD fields (like units). ** ** return 0 if it is valid, and 1 if there is an error */ static int _nrrdFieldCheck_noop(const Nrrd *nrrd, int useBiff) { AIR_UNUSED(nrrd); AIR_UNUSED(useBiff); return 0; } static int _nrrdFieldCheck_type(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_type"; if (airEnumValCheck(nrrdType, nrrd->type)) { biffMaybeAddf(useBiff, NRRD, "%s: type (%d) is not valid", me, nrrd->type); return 1; } return 0; } static int _nrrdFieldCheck_block_size(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_block_size"; char stmp[AIR_STRLEN_SMALL]; if (nrrdTypeBlock == nrrd->type && (!(0 < nrrd->blockSize)) ) { biffMaybeAddf(useBiff, NRRD, "%s: type is %s but nrrd->blockSize (%s) invalid", me, airEnumStr(nrrdType, nrrdTypeBlock), airSprintSize_t(stmp, nrrd->blockSize)); return 1; } if (nrrdTypeBlock != nrrd->type && (0 < nrrd->blockSize)) { biffMaybeAddf(useBiff, NRRD, "%s: type is %s (not block) but blockSize is %s", me, airEnumStr(nrrdType, nrrd->type), airSprintSize_t(stmp, nrrd->blockSize)); return 1; } return 0; } static int _nrrdFieldCheck_dimension(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_dimension"; if (!AIR_IN_CL(1, nrrd->dim, NRRD_DIM_MAX)) { biffMaybeAddf(useBiff, NRRD, "%s: dimension %u is outside valid range [1,%d]", me, nrrd->dim, NRRD_DIM_MAX); return 1; } return 0; } static int _nrrdFieldCheck_space(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_space"; if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdFieldCheck_space_dimension(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_space_dimension"; if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdFieldCheck_sizes(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_sizes"; size_t size[NRRD_DIM_MAX]; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoSize, size); if (_nrrdSizeCheck(size, nrrd->dim, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble with array sizes", me); return 1; } return 0; } static int _nrrdFieldCheck_spacings(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_spacings"; double val[NRRD_DIM_MAX]; unsigned int ai; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoSpacing, val); for (ai=0; aidim; ai++) { if (!( !airIsInf_d(val[ai]) && (airIsNaN(val[ai]) || (0 != val[ai])) )) { biffMaybeAddf(useBiff, NRRD, "%s: axis %d spacing (%g) invalid", me, ai, val[ai]); return 1; } } if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdFieldCheck_thicknesses(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_thicknesses"; double val[NRRD_DIM_MAX]; unsigned int ai; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoThickness, val); for (ai=0; aidim; ai++) { /* note that unlike spacing, we allow zero thickness, but it makes no sense to be negative */ if (!( !airIsInf_d(val[ai]) && (airIsNaN(val[ai]) || (0 <= val[ai])) )) { biffMaybeAddf(useBiff, NRRD, "%s: axis %d thickness (%g) invalid", me, ai, val[ai]); return 1; } } return 0; } static int _nrrdFieldCheck_axis_mins(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_axis_mins"; double val[NRRD_DIM_MAX]; unsigned int ai; int ret; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoMin, val); for (ai=0; aidim; ai++) { if ((ret=airIsInf_d(val[ai]))) { biffMaybeAddf(useBiff, NRRD, "%s: axis %d min %sinf invalid", me, ai, 1==ret ? "+" : "-"); return 1; } } if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } /* HEY: contemplate checking min != max, but what about stub axes ... */ return 0; } static int _nrrdFieldCheck_axis_maxs(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_axis_maxs"; double val[NRRD_DIM_MAX]; unsigned int ai; int ret; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoMax, val); for (ai=0; aidim; ai++) { if ((ret=airIsInf_d(val[ai]))) { biffMaybeAddf(useBiff, NRRD, "%s: axis %d max %sinf invalid", me, ai, 1==ret ? "+" : "-"); return 1; } } if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } /* HEY: contemplate checking min != max, but what about stub axes ... */ return 0; } static int _nrrdFieldCheck_space_directions(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_space_directions"; if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: space info problem", me); return 1; } return 0; } static int _nrrdFieldCheck_centers(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_centers"; unsigned int ai; int val[NRRD_DIM_MAX]; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoCenter, val); for (ai=0; aidim; ai++) { if (!( nrrdCenterUnknown == val[ai] || !airEnumValCheck(nrrdCenter, val[ai]) )) { biffMaybeAddf(useBiff, NRRD, "%s: axis %d center %d invalid", me, ai, val[ai]); return 1; } } return 0; } static int _nrrdFieldCheck_kinds(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_kinds"; int val[NRRD_DIM_MAX]; unsigned int wantLen, ai; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoKind, val); for (ai=0; aidim; ai++) { if (!( nrrdKindUnknown == val[ai] || !airEnumValCheck(nrrdKind, val[ai]) )) { biffMaybeAddf(useBiff, NRRD, "%s: axis %d kind %d invalid", me, ai, val[ai]); return 1; } wantLen = nrrdKindSize(val[ai]); if (wantLen && wantLen != nrrd->axis[ai].size) { char stmp[AIR_STRLEN_SMALL]; biffMaybeAddf(useBiff, NRRD, "%s: axis %d kind %s requires size %u, but have %s", me, ai, airEnumStr(nrrdKind, val[ai]), wantLen, airSprintSize_t(stmp, nrrd->axis[ai].size)); return 1; } } return 0; } static int _nrrdFieldCheck_labels(const Nrrd *nrrd, int useBiff) { /* char me[]="_nrrdFieldCheck_labels"; */ AIR_UNUSED(nrrd); AIR_UNUSED(useBiff); /* don't think there's anything to do here: the label strings are either NULL (which is okay) or non-NULL, but we have no restrictions on the validity of the strings */ return 0; } static int _nrrdFieldCheck_units(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_units"; /* as with labels- the strings themselves don't need checking themselves */ /* but per-axis units cannot be set for axes with space directions ... */ if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: space info problem", me); return 1; } return 0; } static int _nrrdFieldCheck_old_min(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_old_min"; int ret; if ((ret=airIsInf_d(nrrd->oldMin))) { biffMaybeAddf(useBiff, NRRD, "%s: old min %sinf invalid", me, 1==ret ? "+" : "-"); return 1; } /* oldMin == oldMax is perfectly valid */ return 0; } static int _nrrdFieldCheck_old_max(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_old_max"; int ret; if ((ret=airIsInf_d(nrrd->oldMax))) { biffMaybeAddf(useBiff, NRRD, "%s: old max %sinf invalid", me, 1==ret ? "+" : "-"); return 1; } /* oldMin == oldMax is perfectly valid */ return 0; } static int _nrrdFieldCheck_keyvalue(const Nrrd *nrrd, int useBiff) { /* char me[]="_nrrdFieldCheck_keyvalue"; */ AIR_UNUSED(nrrd); AIR_UNUSED(useBiff); /* nrrdKeyValueAdd() ensures that keys aren't repeated, not sure what other kind of checking can be done */ return 0; } static int _nrrdFieldCheck_space_units(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_space_units"; /* not sure if there's anything to specifically check for the space units themselves ... */ if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: space info problem", me); return 1; } return 0; } static int _nrrdFieldCheck_space_origin(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_space_origin"; /* pre-Fri Feb 11 04:25:36 EST 2005, I thought that the spaceOrigin must be known to describe the space/orientation stuff, but that's too restrictive, which is why below says AIR_FALSE instead of AIR_TRUE */ if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: space info problem", me); return 1; } return 0; } static int _nrrdFieldCheck_measurement_frame(const Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdFieldCheck_measurement_frame"; if (_nrrdFieldCheckSpaceInfo(nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: space info problem", me); return 1; } return 0; } int (*_nrrdFieldCheck[NRRD_FIELD_MAX+1])(const Nrrd *, int useBiff) = { _nrrdFieldCheck_noop, /* nonfield */ _nrrdFieldCheck_noop, /* comment */ _nrrdFieldCheck_noop, /* content */ _nrrdFieldCheck_noop, /* number */ _nrrdFieldCheck_type, _nrrdFieldCheck_block_size, _nrrdFieldCheck_dimension, _nrrdFieldCheck_space, _nrrdFieldCheck_space_dimension, _nrrdFieldCheck_sizes, _nrrdFieldCheck_spacings, _nrrdFieldCheck_thicknesses, _nrrdFieldCheck_axis_mins, _nrrdFieldCheck_axis_maxs, _nrrdFieldCheck_space_directions, _nrrdFieldCheck_centers, _nrrdFieldCheck_kinds, _nrrdFieldCheck_labels, _nrrdFieldCheck_units, _nrrdFieldCheck_noop, /* min */ _nrrdFieldCheck_noop, /* max */ _nrrdFieldCheck_old_min, _nrrdFieldCheck_old_max, _nrrdFieldCheck_noop, /* endian */ _nrrdFieldCheck_noop, /* encoding */ _nrrdFieldCheck_noop, /* line_skip */ _nrrdFieldCheck_noop, /* byte_skip */ _nrrdFieldCheck_keyvalue, _nrrdFieldCheck_noop, /* sample units */ _nrrdFieldCheck_space_units, _nrrdFieldCheck_space_origin, _nrrdFieldCheck_measurement_frame, _nrrdFieldCheck_noop, /* data_file */ }; int _nrrdCheck(const Nrrd *nrrd, int checkData, int useBiff) { static const char me[]="_nrrdCheck"; int fi; if (!nrrd) { biffMaybeAddf(useBiff, NRRD, "%s: got NULL pointer", me); return 1; } if (checkData) { if (!(nrrd->data)) { biffMaybeAddf(useBiff, NRRD, "%s: nrrd %p has NULL data pointer", me, AIR_CVOIDP(nrrd)); return 1; } } for (fi=nrrdField_unknown+1; fidim != n2->dim) { biffMaybeAddf(useBiff, NRRD, "%s: n1->dim (%u) != n2->dim (%u)", me, n1->dim, n2->dim); return 0; } for (ai=0; aidim; ai++) { if (n1->axis[ai].size != n2->axis[ai].size) { biffMaybeAddf(useBiff, NRRD, "%s: n1->axis[%d].size (%s) " "!= n2->axis[%d].size (%s)", me, ai, airSprintSize_t(stmp[0], n1->axis[ai].size), ai, airSprintSize_t(stmp[1], n2->axis[ai].size)); return 0; } } return 1; } /* ******** nrrdElementSize() ** ** So just how many bytes long is one element in this nrrd? This is ** needed (over the simple nrrdTypeSize[] array) because some nrrds ** may be of "block" type, and because it does bounds checking on ** nrrd->type. Returns 0 if given a bogus nrrd->type, or if the block ** size isn't greater than zero (in which case it sets nrrd->blockSize ** to 0, just out of spite). This function never returns a negative ** value; using (!nrrdElementSize(nrrd)) is a sufficient check for ** invalidity. ** ** Besides learning how many bytes long one element is, this function ** is useful as a way of detecting an invalid blocksize on a block nrrd. */ size_t nrrdElementSize (const Nrrd *nrrd) { if (!( nrrd && !airEnumValCheck(nrrdType, nrrd->type) )) { return 0; } if (nrrdTypeBlock != nrrd->type) { return nrrdTypeSize[nrrd->type]; } /* else its block type */ if (nrrd->blockSize > 0) { return nrrd->blockSize; } /* else we got an invalid block size */ /* nrrd->blockSize = 0; */ return 0; } /* ******** nrrdElementNumber() ** ** takes the place of old "nrrd->num": the number of elements in the ** nrrd, which is just the product of the axis sizes. A return of 0 ** means there's a problem. Negative numbers are never returned. ** ** does NOT use biff */ size_t nrrdElementNumber (const Nrrd *nrrd) { size_t num, size[NRRD_DIM_MAX]; unsigned int ai; if (!nrrd) { return 0; } /* else */ nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoSize, size); if (_nrrdSizeCheck(size, nrrd->dim, AIR_FALSE)) { /* the nrrd's size information is invalid, can't proceed */ return 0; } num = 1; for (ai=0; aidim; ai++) { /* negative numbers and overflow were caught by _nrrdSizeCheck() */ num *= size[ai]; } return num; } /* ** obviously, this requires that the per-axis size fields have been set */ void _nrrdSplitSizes(size_t *pieceSize, size_t *pieceNum, Nrrd *nrrd, unsigned int split) { unsigned int ai; size_t size[NRRD_DIM_MAX]; nrrdAxisInfoGet_nva(nrrd, nrrdAxisInfoSize, size); *pieceSize = 1; for (ai=0; aidim; ai++) { *pieceNum *= size[ai]; } return; } /* ******** nrrdHasNonExistSet() ** ** This function will always (assuming type is valid) set the value of ** nrrd->hasNonExist to either nrrdNonExistTrue or nrrdNonExistFalse, ** and it will return that value. For lack of a more sophisticated ** policy, blocks are currently always considered to be existent ** values (because nrrdTypeIsIntegral[nrrdTypeBlock] is currently true). ** This function will ALWAYS determine the correct answer and set the ** value of nrrd->hasNonExist: it ignores the value of ** nrrd->hasNonExist on the input nrrd. Exception: if nrrd is null or ** type is bogus, no action is taken and nrrdNonExistUnknown is ** returned. ** ** Because this will return either nrrdNonExistTrue or nrrdNonExistFalse, ** and because the C boolean value of these are true and false (respectively), ** it is possible (and encouraged) to use the return of this function ** as the expression of a conditional: ** ** if (nrrdHasNonExistSet(nrrd)) { ** ... handle existance of non-existent values ... ** } */ /* int nrrdHasNonExistSet(Nrrd *nrrd) { size_t I, N; float val; if (!( nrrd && !airEnumValCheck(nrrdType, nrrd->type) )) return nrrdNonExistUnknown; if (nrrdTypeIsIntegral[nrrd->type]) { nrrd->hasNonExist = nrrdNonExistFalse; } else { nrrd->hasNonExist = nrrdNonExistFalse; N = nrrdElementNumber(nrrd); for (I=0; Itype](nrrd->data, I); if (!AIR_EXISTS(val)) { nrrd->hasNonExist = nrrdNonExistTrue; break; } } } return nrrd->hasNonExist; } */ static int _nrrdCheckEnums(void) { static const char me[]="_nrrdCheckEnums"; char which[AIR_STRLEN_SMALL]; if (nrrdFormatTypeLast-1 != NRRD_FORMAT_TYPE_MAX) { strcpy(which, "nrrdFormat"); goto err; } if (nrrdTypeLast-1 != NRRD_TYPE_MAX) { strcpy(which, "nrrdType"); goto err; } if (nrrdEncodingTypeLast-1 != NRRD_ENCODING_TYPE_MAX) { strcpy(which, "nrrdEncodingType"); goto err; } if (nrrdCenterLast-1 != NRRD_CENTER_MAX) { strcpy(which, "nrrdCenter"); goto err; } if (nrrdAxisInfoLast-1 != NRRD_AXIS_INFO_MAX) { strcpy(which, "nrrdAxisInfo"); goto err; } /* can't really check on endian enum */ if (nrrdField_last-1 != NRRD_FIELD_MAX) { strcpy(which, "nrrdField"); goto err; } if (nrrdHasNonExistLast-1 != NRRD_HAS_NON_EXIST_MAX) { strcpy(which, "nrrdHasNonExist"); goto err; } /* no errors so far */ return 0; err: biffAddf(NRRD, "%s: Last vs. MAX incompatibility for %s enum", me, which); return 1; } /* ****** nrrdSanity ** ** makes sure that all the basic assumptions of nrrd hold for ** the architecture/etc which we're currently running on. ** ** returns 1 if all is okay, 0 if there is a problem */ int /*Teem: biff if (!ret) */ nrrdSanity(void) { static const char me[]="nrrdSanity"; int aret, type; size_t maxsize; airLLong tmpLLI; airULLong tmpULLI; static int _nrrdSanity = 0; if (_nrrdSanity) { /* we've been through this once before and things looked okay ... */ /* Is this thread-safe? I think so. If we assume that any two threads are going to compute the same value, isn't it the case that, at worse, both of them will go through all the tests and then set _nrrdSanity to the same thing? */ return 1; } aret = airSanity(); if (aret != airInsane_not) { biffAddf(NRRD, "%s: airSanity() failed: %s", me, airInsaneErr(aret)); return 0; } if (airEnumValCheck(nrrdEncodingType, nrrdDefaultWriteEncodingType)) { biffAddf(NRRD, "%s: nrrdDefaultWriteEncodingType (%d) not in valid " "range [%d,%d]", me, nrrdDefaultWriteEncodingType, nrrdEncodingTypeUnknown+1, nrrdEncodingTypeLast-1); return 0; } if (airEnumValCheck(nrrdCenter, nrrdDefaultCenter)) { biffAddf(NRRD, "%s: nrrdDefaultCenter (%d) not in valid range [%d,%d]", me, nrrdDefaultCenter, nrrdCenterUnknown+1, nrrdCenterLast-1); return 0; } if (!( nrrdTypeSize[nrrdTypeChar] == sizeof(char) && nrrdTypeSize[nrrdTypeUChar] == sizeof(unsigned char) && nrrdTypeSize[nrrdTypeShort] == sizeof(short) && nrrdTypeSize[nrrdTypeUShort] == sizeof(unsigned short) && nrrdTypeSize[nrrdTypeInt] == sizeof(int) && nrrdTypeSize[nrrdTypeUInt] == sizeof(unsigned int) && nrrdTypeSize[nrrdTypeLLong] == sizeof(airLLong) && nrrdTypeSize[nrrdTypeULLong] == sizeof(airULLong) && nrrdTypeSize[nrrdTypeFloat] == sizeof(float) && nrrdTypeSize[nrrdTypeDouble] == sizeof(double) )) { biffAddf(NRRD, "%s: sizeof() for nrrd types has problem: " "expected (%u,%u,%u,%u,%u,%u,%u,%u,%u,%u) " "but got (%u,%u,%u,%u,%u,%u,%u,%u,%u,%u)", me, AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeChar]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeUChar]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeShort]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeUShort]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeInt]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeUInt]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeLLong]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeULLong]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeFloat]), AIR_CAST(unsigned int, nrrdTypeSize[nrrdTypeDouble]), AIR_CAST(unsigned int, sizeof(char)), AIR_CAST(unsigned int, sizeof(unsigned char)), AIR_CAST(unsigned int, sizeof(short)), AIR_CAST(unsigned int, sizeof(unsigned short)), AIR_CAST(unsigned int, sizeof(int)), AIR_CAST(unsigned int, sizeof(unsigned int)), AIR_CAST(unsigned int, sizeof(airLLong)), AIR_CAST(unsigned int, sizeof(airULLong)), AIR_CAST(unsigned int, sizeof(float)), AIR_CAST(unsigned int, sizeof(double))); return 0; } /* check on NRRD_TYPE_SIZE_MAX */ maxsize = 0; for (type=nrrdTypeUnknown+1; type<=nrrdTypeLast-2; type++) { maxsize = AIR_MAX(maxsize, nrrdTypeSize[type]); } if (maxsize != NRRD_TYPE_SIZE_MAX) { biffAddf(NRRD, "%s: actual max type size is %u != %u == NRRD_TYPE_SIZE_MAX", me, AIR_CAST(unsigned int, maxsize), NRRD_TYPE_SIZE_MAX); return 0; } /* check on NRRD_TYPE_BIGGEST */ if (maxsize != sizeof(NRRD_TYPE_BIGGEST)) { biffAddf(NRRD, "%s: actual max type size is %u != " "%u == sizeof(NRRD_TYPE_BIGGEST)", me, AIR_CAST(unsigned int, maxsize), AIR_CAST(unsigned int, sizeof(NRRD_TYPE_BIGGEST))); return 0; } /* nrrd-defined min/max values for 64-bit integral types */ /* NOTE: because signed integral overflow is undefined in C, the tests for signed long long no longer use overflow (and an assumption of two's complement representation) to assess the correctness of NRRD_LLONG_MAX and NRRD_LLONG_MIN. We merely test that these values can be stored, which we do via indirect (perhaps needlessly so) means. (h/t Sean McBride for pointing this out) */ tmpLLI = _nrrdLLongMaxHelp(_nrrdLLongMaxHelp(_NRRD_LLONG_MAX_HELP)); if (!( tmpLLI > 0 && NRRD_LLONG_MAX == tmpLLI )) { biffAddf(NRRD, "%s: long long int can't hold NRRD_LLONG_MAX (" AIR_LLONG_FMT ")", me, NRRD_LLONG_MAX); return 0; } tmpLLI = _nrrdLLongMinHelp(_nrrdLLongMinHelp(_NRRD_LLONG_MIN_HELP)); if (!( tmpLLI < 0 && NRRD_LLONG_MIN == tmpLLI )) { biffAddf(NRRD, "%s: long long int can't hold NRRD_LLONG_MIN (" AIR_LLONG_FMT ")", me, NRRD_LLONG_MIN); return 0; } tmpULLI = _nrrdULLongMaxHelp(NRRD_ULLONG_MAX); if (tmpULLI != 0) { biffAddf(NRRD, "%s: unsigned long long int max (" AIR_ULLONG_FMT ") incorrect", me, NRRD_ULLONG_MAX); return 0; } if (_nrrdCheckEnums()) { biffAddf(NRRD, "%s: problem with enum definition", me); return 0; } if (!( NRRD_DIM_MAX >= 3 )) { biffAddf(NRRD, "%s: NRRD_DIM_MAX == %u seems awfully small, doesn't it?", me, NRRD_DIM_MAX); return 0; } if (!nrrdTypeIsIntegral[nrrdTypeBlock]) { biffAddf(NRRD, "%s: nrrdTypeInteger[nrrdTypeBlock] is not true, things " "could get wacky", me); return 0; } /* HEY: any other assumptions built into Teem? */ _nrrdSanity = 1; return 1; } cmtk-3.0.0/Utilities/NrrdIO/001-README.txt0000644000177700000170000000041011550636332016612 0ustar torstenmanThis version of NrrdIO has been adapted by Torsten Rohlfing for inclusion in CMTK, The Computational Morphometry Toolkit. All modifiations are (C) SRI International, but are licensed under the same terms as the original NrrdIO code taken from the Insight Toolkit. cmtk-3.0.0/Utilities/NrrdIO/preamble.c0000644000177700000170000000212212041601331016536 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ cmtk-3.0.0/Utilities/NrrdIO/encoding.c0000644000177700000170000000662512041601331016551 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* ** what a NrrdEncoding can assume: ** -- the given nrrd struct has been filled out for the sake of knowing ** nrrd->dim, nrrd->axis[0].size, nrrd->type, and nrrd->blockSize ** AND NOTHING ELSE. See nrrd.h for why those fields, of all things ** are needed for {en/de}coding ** ** what a NrrdEncoding has to do: ** -- read data from file into the "data" argument (BUT NOT nrrd->data!!), ** or vice versa. ** -- respect nrrdStateVerboseIO with messages to stderr, if possible ** -- in case of error, put text error messages into biff via ** biffAddf(NRRD, ...) ** ** The "unknown" encoding below is intended to serve as a template for ** any new encodings being developed. */ static int _nrrdEncodingUnknown_available(void) { /* insert code here */ return AIR_FALSE; } static int _nrrdEncodingUnknown_read(FILE *file, void *data, size_t elementNum, Nrrd *nrrd, struct NrrdIoState_t *nio) { static const char me[]="_nrrdEncodingUnknown_read"; /* insert code here, and remove error handling below */ AIR_UNUSED(file); AIR_UNUSED(data); AIR_UNUSED(elementNum); AIR_UNUSED(nrrd); AIR_UNUSED(nio); biffAddf(NRRD, "%s: ERROR!!! trying to read unknown encoding", me); return 1; } static int _nrrdEncodingUnknown_write(FILE *file, const void *data, size_t elementNum, const Nrrd *nrrd, struct NrrdIoState_t *nio) { static const char me[]="_nrrdEncodingUnknown_write"; /* insert code here, and remove error handling below */ AIR_UNUSED(file); AIR_UNUSED(data); AIR_UNUSED(elementNum); AIR_UNUSED(nrrd); AIR_UNUSED(nio); biffAddf(NRRD, "%s: ERROR!!! trying to write unknown encoding", me); return 1; } const NrrdEncoding _nrrdEncodingUnknown = { "unknown", /* name */ "unknown", /* suffix */ AIR_FALSE, /* endianMatters */ AIR_FALSE, /* isCompression */ _nrrdEncodingUnknown_available, _nrrdEncodingUnknown_read, _nrrdEncodingUnknown_write }; const NrrdEncoding *const nrrdEncodingUnknown = &_nrrdEncodingUnknown; const NrrdEncoding *const nrrdEncodingArray[NRRD_ENCODING_TYPE_MAX+1] = { &_nrrdEncodingUnknown, &_nrrdEncodingRaw, &_nrrdEncodingAscii, &_nrrdEncodingHex, &_nrrdEncodingGzip, &_nrrdEncodingBzip2 }; cmtk-3.0.0/Utilities/NrrdIO/sane.c0000644000177700000170000001324512041601331015705 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateAir.h" /* ******** airSanity() ** ** Does run-time checks to see if the compile-time constants are correct. ** Returns a value from the airInsane* enum; airInsane_not means all ** the checks came back without detecting any problems. */ int airSanity(void) { double nanValue, pinf, ninf; float nanF, pinfF, ninfF; unsigned int sign, expvalue, mant; int tmpI; char endian; unsigned char uc0, uc1; static int _airSanity=0; if (_airSanity) { return airInsane_not; } /* now that there is no more compile-time endian info, this is merely double checking that airMyEndian() works, and returns the constants (either 1234, pronounced "little endian", or 4321, "big endian") that are defined in air.h */ tmpI = 1; endian = !(*((char*)(&tmpI))); if (endian) { /* big endian */ if (4321 != airMyEndian()) { return airInsane_endian; } } else { if (1234 != airMyEndian()) { return airInsane_endian; } } /* checks on sizes of uchar, float, int, double, airLLong */ uc0 = 255; uc1 = AIR_CAST(unsigned char, AIR_INT(uc0) + 1); /* want to overflow */ if (!( 255 == uc0 && 0 == uc1 )) { return airInsane_UCSize; } /* these justify the AIR_EXISTS_F and AIR_EXISTS_D macros */ if (!( (sizeof(float) == sizeof(int)) && (4 == sizeof(int)) )) { return airInsane_FISize; } if (!( (sizeof(double) == sizeof(airLLong)) && (8 == sizeof(airLLong)) )) { return airInsane_DLSize; } /* run-time NaN checks */ pinf = DBL_MAX; pinf = _airSanityHelper(pinf); pinf = _airSanityHelper(pinf); pinf = _airSanityHelper(pinf); if (AIR_EXISTS(pinf)) { return airInsane_pInfExists; } ninf = -pinf; if (AIR_EXISTS(ninf)) { return airInsane_nInfExists; } nanValue = pinf / pinf; if (AIR_EXISTS(nanValue)) { return airInsane_NaNExists; } nanF = (float)nanValue; pinfF = (float)pinf; ninfF = (float)ninf; airFPValToParts_f(&sign, &expvalue, &mant, nanF); mant >>= 22; if (AIR_QNANHIBIT != (int)mant) { return airInsane_QNaNHiBit; } if (!( airFP_QNAN == airFPClass_f(AIR_NAN) && airFP_QNAN == airFPClass_f(AIR_QNAN) /* As of July 4 2012 GLK decides that the signalling NaN tests are more trouble than they're worth: the signal-ness of the NaN is not preserved in double-float conversion for some platforms (so airFP_SNAN == airFPClass_d(AIR_SNAN) has never been enforced), and there are more platforms for which (apparently) passing AIR_SNAN to airFPClass_d changes it to a quiet NaN, which defeats the purpose of the test. To summarize, given that: ** AIR_NAN and AIR_QNAN are checked here to be quiet NaN, after casting to both float and double, ** quiet NaN "hi bit" is tested above, and that ** quiet and signalling NaN are mutually exclusive, skipping the signalling NaN tests is unlikely to undermine knowing the correctness of the compile-time representation of NaNs. So the following line is now commented out for all platforms. */ /* && airFP_SNAN == airFPClass_f(AIR_SNAN) */ && airFP_QNAN == airFPClass_d(AIR_NAN) && airFP_QNAN == airFPClass_d(AIR_QNAN) )) { return airInsane_AIR_NAN; } if (!(airFP_QNAN == airFPClass_f(nanF) && airFP_POS_INF == airFPClass_f(pinfF) && airFP_NEG_INF == airFPClass_f(ninfF))) { /* really, this is verifying that assigning from a double to a float maintains the FPClass for non-existent values */ return airInsane_FltDblFPClass; } /* just make sure AIR_DIO is reasonably set (actually, this should be done by include/teemDio.h) */ switch (AIR_DIO) { case 0: break; case 1: break; default: return airInsane_dio; } _airSanity = 1; return airInsane_not; } static const char _airInsaneErr[AIR_INSANE_MAX+1][AIR_STRLEN_MED] = { "sanity checked PASSED!", "airMyEndian() is wrong", "AIR_EXISTS(+inf) was true", "AIR_EXISTS(-inf) was true", "AIR_EXISTS(NaN) was true", "air_FPClass_f() wrong after double->float assignment", "TEEM_QNANHIBIT is wrong", "airFPClass(AIR_QNAN) wrong", "TEEM_DIO has invalid value", "unsigned char isn't 8 bits", "sizeof(float), sizeof(int) not both == 4", "sizeof(double), sizeof(airLLong) not both == 8", }; static const char _airBadInsane[] = "(invalid insane value)"; const char * airInsaneErr(int insane) { if (AIR_IN_CL(0, insane, AIR_INSANE_MAX)) { return _airInsaneErr[insane]; } else { return _airBadInsane; } } cmtk-3.0.0/Utilities/NrrdIO/endianNrrd.c0000644000177700000170000000770112041601331017043 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" static void _nrrdSwap16Endian(void *_data, size_t N) { unsigned short *data, dd, fix, mask; size_t I; if (!_data) { return; } data = AIR_CAST(unsigned short *, _data); mask = AIR_CAST(unsigned short, 0x00FFu); for (I=0; I>= 0x08; fix = (dd & mask) | AIR_CAST(unsigned short, fix << 0x08); data[I] = fix; } } static void _nrrdSwap32Endian(void *_data, size_t N) { unsigned int *data, dd, fix, mask; size_t I; if (!_data) { return; } data = AIR_CAST(unsigned int *, _data); mask = 0x000000FFu; for (I=0; I>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); data[I] = fix; } } static void _nrrdSwap64Endian(void *_data, size_t N) { airULLong *data, dd, fix, mask; size_t I; if (!_data) { return; } data = AIR_CAST(airULLong *, _data); mask = AIR_ULLONG(0x00000000000000FF); for (I=0; I>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); dd >>= 0x08; fix = (dd & mask) | (fix << 0x08); data[I] = fix; } } static void _nrrdNoopEndian(void *data, size_t N) { AIR_UNUSED(data); AIR_UNUSED(N); return; } static void _nrrdBlockEndian(void *data, size_t N) { char me[]="_nrrdBlockEndian"; AIR_UNUSED(data); AIR_UNUSED(N); fprintf(stderr, "%s: WARNING: can't fix endiannes of nrrd type %s\n", me, airEnumStr(nrrdType, nrrdTypeBlock)); } static void (*_nrrdSwapEndian[])(void *, size_t) = { _nrrdNoopEndian, /* 0: nobody knows! */ _nrrdNoopEndian, /* 1: signed 1-byte integer */ _nrrdNoopEndian, /* 2: unsigned 1-byte integer */ _nrrdSwap16Endian, /* 3: signed 2-byte integer */ _nrrdSwap16Endian, /* 4: unsigned 2-byte integer */ _nrrdSwap32Endian, /* 5: signed 4-byte integer */ _nrrdSwap32Endian, /* 6: unsigned 4-byte integer */ _nrrdSwap64Endian, /* 7: signed 8-byte integer */ _nrrdSwap64Endian, /* 8: unsigned 8-byte integer */ _nrrdSwap32Endian, /* 9: 4-byte floating point */ _nrrdSwap64Endian, /* 10: 8-byte floating point */ _nrrdBlockEndian /* 11: size user defined at run time */ }; void nrrdSwapEndian(Nrrd *nrrd) { if (nrrd && nrrd->data && !airEnumValCheck(nrrdType, nrrd->type)) { _nrrdSwapEndian[nrrd->type](nrrd->data, nrrdElementNumber(nrrd)); } return; } cmtk-3.0.0/Utilities/NrrdIO/NrrdIO_Srcs.txt0000644000177700000170000000067112041601331017502 0ustar torstenman754.c mop.c array.c parseAir.c dio.c sane.c endianAir.c string.c enum.c miscAir.c biffbiff.c biffmsg.c accessors.c defaultsNrrd.c enumsNrrd.c arraysNrrd.c methodsNrrd.c reorder.c axis.c simple.c comment.c keyvalue.c endianNrrd.c parseNrrd.c gzio.c read.c write.c format.c formatNRRD.c encoding.c encodingRaw.c encodingAscii.c encodingHex.c encodingGzip.c subset.c encodingBzip2.c formatEPS.c formatPNG.c formatPNM.c formatText.c formatVTK.c cmtk-3.0.0/Utilities/NrrdIO/754.c0000644000177700000170000004332712041601331015302 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateAir.h" #include "teemQnanhibit.h" /* ** all this is based on a reading of ** Hennessy + Patterson "Computer Architecture, A Quantitative Approach" ** pages A-13 - A-17 ** ** and some assorted web pages, such as: ** http://en.wikipedia.org/wiki/NaN#Encoding ** which explains what Teem calls qnanhibit, and ** http://grouper.ieee.org/groups/754/email/msg04192.html ** which includes some discussion on signal-vs-quiet nan */ /* ** _airFloatEndian{Little,Big}, _airDoubleEndian{Little,Big} ** ** these unions facilitate converting amongst ** i: unsigned integral type ** c: (sign,exp,frac) triples of unsigned integral components ** v: the floating point numbers these bit-patterns represent */ typedef union { unsigned int i; struct { unsigned int mant : 23; unsigned int expo : 8; unsigned int sign : 1; } c; float v; } _airFloatEndianLittle; /* HEY COPY AND PASTE */ typedef union { unsigned int i; struct { unsigned int sign : 1; unsigned int expo : 8; unsigned int mant : 23; } c; float v; } _airFloatEndianBig; typedef union { airULLong i; /* these next two members are used for printing in airFPFprintf_d */ struct { /* access to whole double as two unsigned ints */ unsigned int half0 : 32; unsigned int half1 : 32; } h; struct { /* access to fraction with two unsigned ints */ unsigned int mant1 : 32; unsigned int mant0 : 20; unsigned int expo : 11; unsigned int sign : 1; } c; double v; } _airDoubleEndianLittle; /* HEY COPY AND PASTE */ typedef union { airULLong i; /* these next two members are used for printing in airFPFprintf_d */ struct { /* access to whole double as two unsigned ints */ unsigned int half1 : 32; unsigned int half0 : 32; } h; struct { /* access to fraction with two unsigned ints */ unsigned int sign : 1; unsigned int expo : 11; unsigned int mant0 : 20; unsigned int mant1 : 32; } c; double v; } _airDoubleEndianBig; /* ** The hex numbers in braces are examples of C's "initial member of a union" ** aggregate initialization. */ #if TEEM_QNANHIBIT == 1 const int airMyQNaNHiBit = 1; const airFloat airFloatQNaN = {0x7fffffff}; const airFloat airFloatSNaN = {0x7fbfffff}; #else const int airMyQNaNHiBit = 0; const airFloat airFloatQNaN = {0x7fbfffff}; const airFloat airFloatSNaN = {0x7fffffff}; #endif const airFloat airFloatPosInf = {0x7f800000}; const airFloat airFloatNegInf = {0xff800000}; /* why does solaris whine? */ /* ** these shouldn't be needed, but here they are if need be: in this file: const airFloat airFloatMax = {0x7f7fffff}; const airFloat airFloatMin = {0x00800000}; const airDouble airDoubleMax = {AIR_ULLONG(0x7fefffffffffffff)}; const airDouble airDoubleMin = {AIR_ULLONG(0x0010000000000000)}; in air.h: extern air_export const airFloat airFloatMax; extern air_export const airFloat airFloatMin; extern air_export const airDouble airDoubleMax; extern air_export const airDouble airDoubleMin; #define AIR_FLT_MIN (airFloatMin.f) #define AIR_FLT_MAX (airFloatMax.f) #define AIR_DBL_MIN (airDoubleMin.d) #define AIR_DBL_MAX (airDoubleMax.d) */ /* the bit-masking done here quiets gcc -Wconversion warnings */ #define FP_SET_F(flit, fbig, s, e, m) \ flit.c.sign = 1u & (s); \ flit.c.expo = ((1u<8)-1) & (e); \ flit.c.mant = ((1u<23)-1) & (m); \ fbig.c.sign = 1u & (s); \ fbig.c.expo = ((1u<8)-1) & (e); \ fbig.c.mant = ((1u<23)-1) & (m) #define FP_GET_F(s, e, m, flit, fbig) \ if (airEndianLittle == airMyEndian()) { \ (s) = flit.c.sign; \ (e) = flit.c.expo; \ (m) = flit.c.mant; \ } else { \ (s) = fbig.c.sign; \ (e) = fbig.c.expo; \ (m) = fbig.c.mant; \ } #define FP_SET_D(dlit, dbig, s, e, m0, m1) \ dlit.c.sign = 1u & (s); \ dlit.c.expo = ((1u<<11)-1) & (e); \ dlit.c.mant0 = ((1u<<20)-1) & (m0); \ dlit.c.mant1 = (m1); \ dbig.c.sign = 1u & (s); \ dbig.c.expo = ((1u<<11)-1) & (e); \ dbig.c.mant0 = ((1u<<20)-1) & (m0); \ dbig.c.mant1 = (m1) #define FP_GET_D(s, e, m0, m1, dlit, dbig) \ if (airEndianLittle == airMyEndian()) { \ (s) = dlit.c.sign; \ (e) = dlit.c.expo; \ (m0) = dlit.c.mant0; \ (m1) = dlit.c.mant1; \ } else { \ (s) = dbig.c.sign; \ (e) = dbig.c.expo; \ (m0) = dbig.c.mant0; \ (m1) = dbig.c.mant1; \ } float airFPPartsToVal_f(unsigned int sign, unsigned int expo, unsigned int mant) { _airFloatEndianLittle flit; _airFloatEndianBig fbig; FP_SET_F(flit, fbig, sign, expo, mant); return (airEndianLittle == airMyEndian() ? flit.v : fbig.v); } void airFPValToParts_f(unsigned int *signP, unsigned int *expoP, unsigned int *mantP, float v) { _airFloatEndianLittle flit; _airFloatEndianBig fbig; flit.v = fbig.v = v; FP_GET_F(*signP, *expoP, *mantP, flit, fbig); } double airFPPartsToVal_d(unsigned int sign, unsigned int expo, unsigned int mant0, unsigned int mant1) { _airDoubleEndianLittle dlit; _airDoubleEndianBig dbig; FP_SET_D(dlit, dbig, sign, expo, mant0, mant1); return (airEndianLittle == airMyEndian() ? dlit.v : dbig.v); } /* ** Disable the 'local variable used without having been initialized' ** warning produced by the MSVC compiler */ #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4700) #endif void airFPValToParts_d(unsigned int *signP, unsigned int *expoP, unsigned int *mant0P, unsigned int *mant1P, double v) { _airDoubleEndianLittle dlit; _airDoubleEndianBig dbig; dlit.v = dbig.v = v; FP_GET_D(*signP, *expoP, *mant0P, *mant1P, dlit, dbig); } #ifdef _MSC_VER #pragma warning(pop) #endif /* ******** airFPGen_f() ** ** generates a floating point value which is a member of the given class */ float airFPGen_f(int cls) { _airFloatEndianLittle flit; _airFloatEndianBig fbig; switch(cls) { case airFP_SNAN: /* sgn: anything, mant: anything non-zero with high bit !TEEM_QNANHIBIT */ FP_SET_F(flit, fbig, 0, 0xff, (!TEEM_QNANHIBIT << 22) | 0x3fffff); break; case airFP_QNAN: /* sgn: anything, mant: anything non-zero with high bit TEEM_QNANHIBIT */ FP_SET_F(flit, fbig, 0, 0xff, (TEEM_QNANHIBIT << 22) | 0x3fffff); break; case airFP_POS_INF: FP_SET_F(flit, fbig, 0, 0xff, 0); break; case airFP_NEG_INF: FP_SET_F(flit, fbig, 1, 0xff, 0); break; case airFP_POS_NORM: /* exp: anything non-zero but < 0xff, mant: anything */ FP_SET_F(flit, fbig, 0, 0x80, 0x7ff000); break; case airFP_NEG_NORM: /* exp: anything non-zero but < 0xff, mant: anything */ FP_SET_F(flit, fbig, 1, 0x80, 0x7ff000); break; case airFP_POS_DENORM: /* mant: anything non-zero */ FP_SET_F(flit, fbig, 0, 0, 0xff); break; case airFP_NEG_DENORM: /* mant: anything non-zero */ FP_SET_F(flit, fbig, 1, 0, 0xff); break; case airFP_NEG_ZERO: FP_SET_F(flit, fbig, 1, 0, 0); break; case airFP_POS_ZERO: default: FP_SET_F(flit, fbig, 0, 0, 0); break; } return (airEndianLittle == airMyEndian() ? flit.v : fbig.v); } /* ******** airFPGen_d() ** ** generates a floating point value which is a member of the given class */ double airFPGen_d(int cls) { _airDoubleEndianLittle dlit; _airDoubleEndianBig dbig; switch(cls) { case airFP_SNAN: /* sgn: anything, mant: anything non-zero with high bit !TEEM_QNANHIBIT */ FP_SET_D(dlit, dbig, 0, 0x7ff, (!TEEM_QNANHIBIT << 19) | 0x7ffff, 0xffffffff); break; case airFP_QNAN: /* sgn: anything, mant anything non-zero with high bit TEEM_QNANHIBIT */ FP_SET_D(dlit, dbig, 0, 0x7ff, (TEEM_QNANHIBIT << 19) | 0x7ffff, 0xffffffff); break; case airFP_POS_INF: FP_SET_D(dlit, dbig, 0, 0x7ff, 0, 0); break; case airFP_NEG_INF: FP_SET_D(dlit, dbig, 1, 0x7ff, 0, 0); break; case airFP_POS_NORM: /* exp: anything non-zero but < 0xff, mant: anything */ FP_SET_D(dlit, dbig, 0, 0x400, 0x0ff00, 0); break; case airFP_NEG_NORM: /* exp: anything non-zero but < 0xff, mant: anything */ FP_SET_D(dlit, dbig, 1, 0x400, 0x0ff00, 0); break; case airFP_POS_DENORM: /* mant: anything non-zero */ FP_SET_D(dlit, dbig, 0, 0, 0xff, 0); break; case airFP_NEG_DENORM: /* mant: anything non-zero */ FP_SET_D(dlit, dbig, 1, 0, 0xff, 0); break; case airFP_NEG_ZERO: FP_SET_D(dlit, dbig, 1, 0, 0, 0); break; case airFP_POS_ZERO: default: FP_SET_D(dlit, dbig, 0, 0, 0, 0); break; } return (airEndianLittle == airMyEndian() ? dlit.v : dbig.v); } /* ******** airFPClass_f() ** ** given a floating point number, tells which class its in */ int airFPClass_f(float val) { _airFloatEndianLittle flit; _airFloatEndianBig fbig; unsigned int sign, expv, mant; int indexv, ret = 0; flit.v = fbig.v = val; FP_GET_F(sign, expv, mant, flit, fbig); indexv = ((!!sign) << 2) | ((!!expv) << 1) | (!!mant); switch(indexv) { case 0: /* all fields are zero */ ret = airFP_POS_ZERO; break; case 1: /* only mantissa is non-zero */ ret = airFP_POS_DENORM; break; case 2: /* only exponent field is non-zero */ if (0xff == expv) { ret = airFP_POS_INF; } else { ret = airFP_POS_NORM; } break; case 3: /* exponent and mantissa fields are non-zero */ if (0xff == expv) { if (TEEM_QNANHIBIT == mant >> 22) { ret = airFP_QNAN; } else { ret = airFP_SNAN; } } else { ret = airFP_POS_NORM; } break; case 4: /* only sign field is non-zero */ ret = airFP_NEG_ZERO; break; case 5: /* sign and mantissa fields are non-zero */ ret = airFP_NEG_DENORM; break; case 6: /* sign and exponent fields are non-zero */ if (0xff > expv) { ret = airFP_NEG_NORM; } else { ret = airFP_NEG_INF; } break; case 7: /* all fields are non-zero */ if (0xff > expv) { ret = airFP_NEG_NORM; } else { if (TEEM_QNANHIBIT == mant >> 22) { ret = airFP_QNAN; } else { ret = airFP_SNAN; } } break; } return ret; } /* ** Disable the 'local variable used without having been initialized' ** warning produced by the MSVC compiler */ #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4700) #endif /* ******** airFPClass_d() ** ** given a double, tells which class its in */ int airFPClass_d(double val) { _airDoubleEndianLittle dlit; _airDoubleEndianBig dbig; unsigned int sign, expo, mant0, mant1; int indexv, ret=0; unsigned char hibit; dlit.v = dbig.v = val; /* "expo = d.c.expo" had been annotated with: "this seems to be a WIN32 bug: on a quiet-NaN, d.c.exp should be non-zero, but it was completely zero, so that this function returned airFP_NEG_DENORM instead of airFP_QNAN" */ FP_GET_D(sign, expo, mant0, mant1, dlit, dbig); hibit = AIR_CAST(unsigned char, mant0 >> 19); /* mant0 20 bits wide: ok */ indexv = ((!!sign) << 2) | ((!!expo) << 1) | (!!mant0 || !!mant1); switch(indexv) { case 0: /* all fields are zero */ ret = airFP_POS_ZERO; break; case 1: /* only fractional field is non-zero */ ret = airFP_POS_DENORM; break; case 2: /* only exponent field is non-zero */ if (0x7ff > expo) { ret = airFP_POS_NORM; } else { ret = airFP_POS_INF; } break; case 3: /* exponent and fractional fields are non-zero */ if (0x7ff > expo) { ret = airFP_POS_NORM; } else { if (TEEM_QNANHIBIT == hibit) { ret = airFP_QNAN; } else { ret = airFP_SNAN; } } break; case 4: /* only sign field is non-zero */ ret = airFP_NEG_ZERO; break; case 5: /* sign and fractional fields are non-zero */ ret = airFP_NEG_DENORM; break; case 6: /* sign and exponent fields are non-zero */ if (0x7ff > expo) { ret = airFP_NEG_NORM; } else { ret = airFP_NEG_INF; } break; case 7: /* all fields are non-zero */ if (0x7ff > expo) ret = airFP_NEG_NORM; else { if (TEEM_QNANHIBIT == hibit) { ret = airFP_QNAN; } else { ret = airFP_SNAN; } } break; } return ret; } #ifdef _MSC_VER #pragma warning(pop) #endif /* ******** airIsNaN() ** ** returns 1 if input is either kind of NaN, 0 otherwise. It is okay ** to only have a double version of this function, as opposed to ** having one for float and one for double, because Section 6.2 of the ** 754 spec tells us that that NaN is to be preserved across precision ** changes (and airSanity() explicitly checks for this). */ int airIsNaN(double g) { _airFloatEndianLittle flit; _airFloatEndianBig fbig; unsigned int sign, expo, mant; flit.v = fbig.v = AIR_CAST(float, g); FP_GET_F(sign, expo, mant, flit, fbig); AIR_UNUSED(sign); return (0xff == expo && mant); } /* ******** airIsInf_f(), airIsInf_d() ** ** returns 1 if input is positive infinity, ** -1 if negative infinity, ** or 0 otherwise (including NaN) ** ** thus the non-zero-ness of the return is an easy way to do a ** boolean check of whether the value is infinite */ int airIsInf_f(float f) { int c, ret; c = airFPClass_f(f); if (airFP_POS_INF == c) { ret = 1; } else if (airFP_NEG_INF == c) { ret = -1; } else { ret = 0; } return ret; } int airIsInf_d(double d) { int c, ret; c = airFPClass_d(d); if (airFP_POS_INF == c) { ret = 1; } else if (airFP_NEG_INF == c) { ret = -1; } else { ret = 0; } return ret; } /* airExists_f() airExists_d() were nixed because they weren't used- you can just use AIR_EXISTS_F and AIR_EXISTS_D directly */ /* ******** airExists() ** ** an optimization-proof alternative to AIR_EXISTS */ int airExists(double val) { _airDoubleEndianLittle dlit; _airDoubleEndianBig dbig; dbig.v = dlit.v = val; return (airEndianLittle == airMyEndian() ? 0x7ff != dlit.c.expo : 0x7ff != dbig.c.expo); } /* ******** airNaN() ** ** returns a float quiet NaN */ float airNaN(void) { return airFPGen_f(airFP_QNAN); } /* ******** airFPFprintf_f() ** ** prints out the bits of a "float", indicating the three different fields */ void airFPFprintf_f(FILE *file, float val) { int i; unsigned int sign, expo, mant; _airFloatEndianLittle flit; _airFloatEndianBig fbig; if (file) { flit.v = fbig.v = val; FP_GET_F(sign, expo, mant, flit, fbig); fprintf(file, "%f: class %d; 0x%08x = ",val, airFPClass_f(val), airEndianLittle == airMyEndian() ? flit.i : fbig.i); fprintf(file, "sign:0x%x, expo:0x%02x, mant:0x%06x = \n", sign, expo, mant); fprintf(file, " S [ . . Exp . . ] " "[ . . . . . . . . . Mant. . . . . . . . . . ]\n"); fprintf(file, " %d ", sign); for (i=7; i>=0; i--) { fprintf(file, "%d ", (expo >> i) & 1); } for (i=22; i>=0; i--) { fprintf(file, "%d ", (mant >> i) & 1); } fprintf(file, "\n"); } } /* ******** airFPFprintf_d() ** ** prints out the bits of a "double", indicating the three different fields */ void airFPFprintf_d(FILE *file, double val) { int i; _airDoubleEndianLittle dlit; _airDoubleEndianBig dbig; unsigned int sign, expo, mant0, mant1; if (file) { dlit.v = dbig.v = val; fprintf(file, "%f: class %d; 0x%08x %08x = \n", val, airFPClass_d(val), (airEndianLittle == airMyEndian() ? dlit.h.half1 : dbig.h.half1), (airEndianLittle == airMyEndian() ? dlit.h.half0 : dbig.h.half0)); FP_GET_D(sign, expo, mant0, mant1, dlit, dbig); fprintf(file, "sign:0x%x, expo:0x%03x, mant:0x%05x %08x = \n", sign, expo, mant0, mant1); fprintf(file, "S[...Exp...][.......................Mant.......................]\n"); fprintf(file, "%d", sign); for (i=10; i>=0; i--) { fprintf(file, "%d", (expo >> i) & 1); } for (i=19; i>=0; i--) { fprintf(file, "%d", (mant0 >> i) & 1); } for (i=31; i>=0; i--) { fprintf(file, "%d", (mant1 >> i) & 1); } fprintf(file, "\n"); } } cmtk-3.0.0/Utilities/NrrdIO/array.c0000644000177700000170000001710512041601331016074 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" static void _airLenSet(airArray *a, unsigned int len) { a->len = len; /* printf(" HEY: len = %d\n", a->len); */ if (a->lenP) { *(a->lenP) = len; /* printf(" HEY: *(a->lenP) = *(%lu) = %d\n", (unsigned long)a->lenP, *(a->lenP)); */ } } static void _airSetData(airArray *a, void *data) { a->data = data; if (a->dataP) { *(a->dataP) = data; } } /* ******** airArrayNew() ** ** creates a new airArray struct and returns a pointer to it. ** dataP is a pointer to the user's data pointer ** lenP is a pointer to the user's array length variable (optional) ** unit is the size (in bytes) of one element in the array ** incr is the number of units by which the array will grow or shrink ** ** returns NULL on error, or the new airArray pointer if okay ** errors: bogus arguments, or couldn't alloc airArray struct ** ** --> The user CAN NOT change the pointer variable (of which *dataP ** is the address) after this is called, or else everything will ** get all bolloxed up. The same goes for the array length ** variable, if its address is passed- though in that case the ** correct value will over-write any other. */ airArray * airArrayNew(void **dataP, unsigned int *lenP, size_t unit, unsigned int incr) { airArray *a; if (unit<=0 || incr<=0) { return NULL; } a = AIR_CALLOC(1, airArray); if (!a) { return NULL; } a->dataP = dataP; _airSetData(a, NULL); a->lenP = lenP; _airLenSet(a, 0); a->incr = incr; a->unit = unit; a->noReallocWhenSmaller = AIR_FALSE; a->allocCB = NULL; a->freeCB = NULL; a->initCB = NULL; a->doneCB = NULL; return a; } /* ******** airArrayStructCB() ** ** set callbacks to maintain array of structs */ void airArrayStructCB(airArray *a, void (*initCB)(void *), void (*doneCB)(void *)) { if (a) { a->initCB = initCB; a->doneCB = doneCB; a->allocCB = NULL; a->freeCB = NULL; } } /* ******** airArrayPointerCB() ** ** set callbacks to maintain array of pointers */ void airArrayPointerCB(airArray *a, void *(*allocCB)(void), void *(*freeCB)(void *)) { if (a) { a->initCB = NULL; a->doneCB = NULL; a->allocCB = allocCB; a->freeCB = freeCB; } } /* ******** airArrayLenSet() ** ** Set the length of the array, allocating or freeing as needed ** ** returns 1 on error, otherwise 0 if okay ** possible errors: bogus arguments, or couldn't allocate new memory segment ** ** In case we can't allocate the new space, the old space is left untouched, ** however if the new length is smaller, the free/done callbacks will ** have been called on invalidated elements ** ** NB: this used to have a "boolean" return to indicate allocation ** error, but almost nothing in Teem actually did the error checking. ** Now conscientious users can look at NULL-ity of a->data to detect ** such an error. */ void airArrayLenSet(airArray *a, unsigned int newlen) { /* char me[]="airArrayLenSet"; */ unsigned int ii, newsize; void *addr, *newdata; if (!a) { /* user is a moron, what can you do */ return; } if (newlen == a->len) { /* nothing to do */ return; } /* call freeCB/doneCB on all the elements which are going bye-bye */ /* Wed Sep 12 14:40:45 EDT 2007: the order in which these called is now ascending, instead of descending (as was the way before) */ if (newlen < a->len && (a->freeCB || a->doneCB)) { for (ii=newlen; iilen; ii++) { addr = (char*)(a->data) + ii*a->unit; if (a->freeCB) { (a->freeCB)(*((void**)addr)); } else { (a->doneCB)(addr); } } } newsize = newlen ? (newlen-1)/a->incr + 1 : 0; if (newsize != a->size) { /* we have to change the size of the array */ if (newsize) { /* array should be bigger or smaller, but not zero-length */ if (newsize > a->size || (newsize < a->size && !(a->noReallocWhenSmaller)) ) { newdata = calloc(newsize*a->incr, a->unit); if (!newdata) { free(a->data); _airSetData(a, NULL); return; } memcpy(newdata, a->data, AIR_MIN(a->len*a->unit, newsize*a->incr*a->unit)); free(a->data); _airSetData(a, newdata); a->size = newsize; } } else { /* array should be zero-length */ free(a->data); _airSetData(a, NULL); a->size = newsize; } } /* else new size is still within current allocated length, and neither "size" nor "data" need to change */ /* call allocCB/initCB on newly created elements */ if (newlen > a->len && (a->allocCB || a->initCB)) { for (ii=a->len; iidata) + ii*a->unit; if (a->allocCB) { *((void**)addr) = (a->allocCB)(); } else { (a->initCB)(addr); } } } _airLenSet(a, newlen); return; } /* ******** airArrayLenIncr() ** ** Like airArrayLenSet, but works with an increment instead of an ** absolute length. Return value is different: ** got NULL: return 0 ** allocation error: return 0, and a->data set to NULL ** no error, delta > 0: return index of 1st element in newly allocated ** segment (a->len before length was increased) ** no error, delta <= 0: return 0, and a->data unchanged ** ** HEY: it is apparently not clear how to do error checking (aside from ** looking at a->data) when there was NO data previously allocated, and the ** first index of the newly allocated data is zero. */ unsigned int airArrayLenIncr(airArray *a, int delta) { /* char me[]="airArrayLenIncr"; */ unsigned int oldlen, ret, negdel; if (!a) { return 0; } negdel = (delta < 0 ? AIR_UINT(-delta) : 0); if (delta < 0 && negdel > a->len) { /* error: asked for newlength to be negative */ airArrayLenSet(a, 0); return 0; } oldlen = a->len; airArrayLenSet(a, (delta >= 0 ? oldlen + AIR_UINT(delta) : oldlen - negdel)); if (!a->data) { /* allocation error */ ret = 0; } else { ret = (delta <= 0 ? 0 : oldlen); } return ret; } /* ******** airArrayNuke() ** ** free both the memory pointed to by the struct and the struct itself */ airArray * airArrayNuke(airArray *a) { if (a) { airArrayLenSet(a, 0); free(a); } return NULL; } /* ******** airArrayNix() ** ** frees just the struct, leaving the memory it points to untouched */ airArray * airArrayNix(airArray *a) { if (a) { free(a); } return NULL; } cmtk-3.0.0/Utilities/NrrdIO/qnanhibit.c0000644000177700000170000000310212041601331016723 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include #include int main(int argc, char *argv[]) { char *me; float pinf, qnan; int i; me = argv[0]; if (sizeof(float) != sizeof(int)) { fprintf(stderr, "%s: MADNESS: sizeof(float)=%d != sizeof(int)=%d\n", me, (int)sizeof(float), (int)sizeof(int)); return -1; } pinf = FLT_MAX; pinf = pinf*pinf; qnan = pinf/pinf; i = *(int*)(&qnan); printf("-DTEEM_QNANHIBIT=%d\n", (i >> 22) & 1); return (int)((i >> 22) & 1); } cmtk-3.0.0/Utilities/NrrdIO/formatVTK.c0000644000177700000170000000551212041601331016632 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" int _nrrdFormatVTK_available(void) { return AIR_FALSE; } int _nrrdFormatVTK_nameLooksLike(const char *fname) { return airEndsWith(fname, NRRD_EXT_VTK); } int _nrrdFormatVTK_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatVTK_fitsInto", err[AIR_STRLEN_MED]; AIR_UNUSED(nrrd); AIR_UNUSED(encoding); AIR_UNUSED(useBiff); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatVTK->name); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; } int _nrrdFormatVTK_contentStartsLike(NrrdIoState *nio) { AIR_UNUSED(nio); return AIR_FALSE; } int _nrrdFormatVTK_read(FILE *file, Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdReadVTK", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatVTK->name); biffAdd(NRRD, err); return 1; } /* this strongly assumes that nrrdFitsInFormat() was true */ int _nrrdFormatVTK_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdFormatVTK_write", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatVTK->name); biffAdd(NRRD, err); return 1; } const NrrdFormat _nrrdFormatVTK = { "VTK", AIR_FALSE, /* isImage */ AIR_FALSE, /* readable */ AIR_FALSE, /* usesDIO */ _nrrdFormatVTK_available, _nrrdFormatVTK_nameLooksLike, _nrrdFormatVTK_fitsInto, _nrrdFormatVTK_contentStartsLike, _nrrdFormatVTK_read, _nrrdFormatVTK_write }; const NrrdFormat *const nrrdFormatVTK = &_nrrdFormatVTK; cmtk-3.0.0/Utilities/NrrdIO/read.c0000644000177700000170000005311112041601331015666 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" #if TEEM_BZIP2 #include #endif /* The "/ *Teem:" (without space) comments in here are an experiment */ char _nrrdRelativePathFlag[] = "./"; char _nrrdFieldSep[] = " \t"; char _nrrdLineSep[] = "\r\n"; char _nrrdNoSpaceVector[] = "none"; char _nrrdTextSep[] = " ,\t"; /* ** return length of next "line" in nio->headerStringRead */ unsigned int _nrrdHeaderStringOneLineStrlen(NrrdIoState *nio) { return AIR_CAST(unsigned int, strcspn(nio->headerStringRead + nio->headerStrpos, _nrrdLineSep)); } /* ** read next "line" in nio->headerStringRead */ unsigned int _nrrdHeaderStringOneLine(NrrdIoState *nio) { unsigned int len1, len2; len1 = _nrrdHeaderStringOneLineStrlen(nio); strncpy(nio->line, nio->headerStringRead + nio->headerStrpos, len1); nio->line[len1] = '\0'; nio->headerStrpos += len1; len2 = AIR_CAST(unsigned int, strspn(nio->headerStringRead + nio->headerStrpos, _nrrdLineSep)); nio->headerStrpos += len2; return len1; } /* ** _nrrdOneLine ** ** wrapper around airOneLine; does re-allocation of line buffer ** ("line") in the NrrdIoState if needed. The return value semantics ** are similar, except that what airOneLine would return, we put ** in *lenP. If there is an error (airOneLine returned 0, ** something couldn't be allocated), *lenP is set to 0, and ** we return 1. HITTING EOF IS NOT ACTUALLY AN ERROR, see code ** below. Otherwise we return 0. ** ** Does use biff */ int _nrrdOneLine(unsigned int *lenP, NrrdIoState *nio, FILE *file) { static const char me[]="_nrrdOneLine"; char **line; airArray *mop, *lineArr; airPtrPtrUnion appu; unsigned int lineIdx, len, needLen; if (!( lenP && nio && (file || nio->headerStringRead))) { biffAddf(NRRD, "%s: got NULL pointer (%p, %p, %p/%p)", me, AIR_CAST(void*, lenP), AIR_CAST(void*, nio), AIR_CAST(void*, file), nio->headerStringRead); return 1; } if (0 == nio->lineLen) { /* nio->line hasn't been allocated for anything */ nio->lineLen = 3; nio->line = (char*)malloc(nio->lineLen); if (!nio->line) { biffAddf(NRRD, "%s: couldn't alloc %d-char line\n", me, nio->lineLen); *lenP = 0; return 1; } } if (file) { len = airOneLine(file, nio->line, nio->lineLen); } else { /* NOTE: NULL-ity error check above makes this safe */ needLen = _nrrdHeaderStringOneLineStrlen(nio); if (needLen+1 > nio->lineLen) { nio->lineLen = needLen+1; airFree(nio->line); /* lose previous allocated line */ nio->line = (char*)malloc(nio->lineLen); if (!nio->line) { biffAddf(NRRD, "%s: couldn't alloc %d-char line\n", me, nio->lineLen); *lenP = 0; return 1; } } len = _nrrdHeaderStringOneLine(nio); } if (len <= nio->lineLen) { /* otherwise we hit EOF (or end of nio->headerStringRead) before a newline, or the line (possibly empty) fit within the nio->line, neither of which is an error here */ *lenP = len; } else { /* line didn't fit in buffer, so we have to increase line buffer size and put the line together in pieces */ /* NOTE: this will never happen when reading from nio->headerStringRead */ appu.cp = &line; lineArr = airArrayNew(appu.v, NULL, sizeof(char *), 1); if (!lineArr) { biffAddf(NRRD, "%s: couldn't allocate airArray", me); *lenP = 0; return 1; } airArrayPointerCB(lineArr, airNull, airFree); mop = airMopNew(); airMopAdd(mop, lineArr, (airMopper)airArrayNuke, airMopAlways); while (len == nio->lineLen+1) { lineIdx = airArrayLenIncr(lineArr, 1); if (!lineArr->data) { biffAddf(NRRD, "%s: couldn't increment line buffer array", me); *lenP = 0; airMopError(mop); return 1; } line[lineIdx] = nio->line; nio->lineLen *= 2; nio->line = (char*)malloc(nio->lineLen); if (!nio->line) { biffAddf(NRRD, "%s: couldn't alloc %d-char line\n", me, nio->lineLen); *lenP = 0; airMopError(mop); return 1; } len = airOneLine(file, nio->line, nio->lineLen); } /* last part did fit in nio->line buffer, also save this into line[] */ lineIdx = airArrayLenIncr(lineArr, 1); if (!lineArr->data) { biffAddf(NRRD, "%s: couldn't increment line buffer array", me); *lenP = 0; airMopError(mop); return 1; } line[lineIdx] = nio->line; nio->lineLen *= 3; /* for good measure */ nio->line = (char*)malloc(nio->lineLen); if (!nio->line) { biffAddf(NRRD, "%s: couldn't alloc %d-char line\n", me, nio->lineLen); *lenP = 0; airMopError(mop); return 1; } /* now concatenate everything into a new nio->line */ strcpy(nio->line, ""); for (lineIdx=0; lineIdxlen; lineIdx++) { strcat(nio->line, line[lineIdx]); } /* HEY: API is bad: *lenP should be a size_t pointer! */ *lenP = AIR_UINT(strlen(nio->line)) + 1; airMopError(mop); } return 0; } /* ** _nrrdCalloc() ** ** allocates the data for the array, but only if necessary (as informed by ** nio->oldData and nio->oldDataSize). ** ** as a recent feature, this will handle the extra work of allocating ** memory in the special way required for direct IO, if possible. For ** this to work, though, the FILE *file has to be passed. Since file ** is not otherwise needed, it can be passed as NULL for non-direct-IO ** situations. In any case, if the directIO-compatible allocation fails ** its not error, and we revert to regular allocation. ** ** NOTE: this assumes the checking that is done by _nrrdHeaderCheck */ int _nrrdCalloc(Nrrd *nrrd, NrrdIoState *nio, FILE *file) { static const char me[]="_nrrdCalloc"; size_t needDataSize; int fd; needDataSize = nrrdElementNumber(nrrd)*nrrdElementSize(nrrd); if (nio->oldData && needDataSize == nio->oldDataSize) { /* re-use old data */ nrrd->data = nio->oldData; /* its not an error to have a directIO-incompatible pointer, so there's no other error checking to do here */ } else { nrrd->data = airFree(nrrd->data); fd = file ? fileno(file) : -1; if (nrrdEncodingRaw == nio->encoding && -1 != fd && airNoDio_okay == airDioTest(fd, NULL, needDataSize)) { nrrd->data = airDioMalloc(needDataSize, fd); } if (!nrrd->data) { /* directIO-compatible allocation wasn't tried, or it failed */ nrrd->data = malloc(needDataSize); } if (!nrrd->data) { char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL]; biffAddf(NRRD, "%s: couldn't allocate %s things of size %s", me, airSprintSize_t(stmp1, nrrdElementNumber(nrrd)), airSprintSize_t(stmp2, nrrdElementSize(nrrd))); return 1; } } /* make it look like it came from calloc(), as used by nrrdNew() */ memset(nrrd->data, 0, needDataSize); return 0; } /* ******** nrrdLineSkip ** ** public for the sake of things like "unu make" ** uses the NrrdIoState for its line buffer (used by _nrrdOneLine) */ int nrrdLineSkip(FILE *dataFile, NrrdIoState *nio) { static const char me[]="nrrdLineSkip"; unsigned int lsi, skipRet; /* For compressed data: If you don't actually have ascii headers on top of your gzipped data then you will potentially huge lines while _nrrdOneLine looks for line terminations. Quoting Gordon: "Garbage in, Garbage out." */ if (!( dataFile && nio )) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } for (lsi=0; lsilineSkip; lsi++) { if (_nrrdOneLine(&skipRet, nio, dataFile)) { biffAddf(NRRD, "%s: error skipping line %u of %u", me, lsi+1, nio->lineSkip); return 1; } if (!skipRet) { biffAddf(NRRD, "%s: hit EOF skipping line %u of %u", me, lsi+1, nio->lineSkip); return 1; } } return 0; } /* ******** nrrdByteSkip ** ** public for the sake of things like "unu make" ** uses nio for information about how much data should actually be skipped ** with negative byteSkip */ int nrrdByteSkip(FILE *dataFile, Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="nrrdByteSkip"; int skipRet; size_t bsize; if (!( dataFile && nrrd && nio )) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (nio->encoding->isCompression) { biffAddf(NRRD, "%s: this function can't work with compressed " "encoding %s", me, nio->encoding->name); return 1; } if (nio->byteSkip < 0) { long backwards; if (nrrdEncodingRaw != nio->encoding) { biffAddf(NRRD, "%s: this function can do backwards byte skip only " "in %s encoding, not %s", me, nrrdEncodingRaw->name, nio->encoding->name); return 1; } if (stdin == dataFile) { biffAddf(NRRD, "%s: can't fseek on stdin", me); return 1; } bsize = nrrdElementNumber(nrrd)/_nrrdDataFNNumber(nio); bsize *= nrrdElementSize(nrrd); /* backwards is (positive) number of bytes AFTER data that we ignore */ backwards = -nio->byteSkip - 1; /* HEY what if bsize fits in size_t but not in (signed) long? */ if (fseek(dataFile, -AIR_CAST(long, bsize) - backwards, SEEK_END)) { char stmp[AIR_STRLEN_SMALL]; biffAddf(NRRD, "%s: failed to fseek(dataFile, %s, SEEK_END)", me, airSprintSize_t(stmp, bsize)); return 1; } if (nrrdStateVerboseIO >= 2) { fprintf(stderr, "(%s: actually skipped %d bytes)\n", me, (int)ftell(dataFile)); } } else { if ((stdin == dataFile) || (-1==fseek(dataFile, nio->byteSkip, SEEK_CUR))) { long skipi; /* fseek failed, perhaps because we're reading stdin, so we revert to consuming the input one byte at a time */ for (skipi=0; skipibyteSkip; skipi++) { skipRet = fgetc(dataFile); if (EOF == skipRet) { biffAddf(NRRD, "%s: hit EOF skipping byte %ld of %ld", me, skipi, nio->byteSkip); return 1; } } } } return 0; } /* ** _nrrdRead() ** ** read in nrrd from a given file *OR* given string. The main job of ** this function is to start reading the file/string, to determine the ** format, and then call the appropriate format's reader. This means ** that the various encoding (data) readers can assume that ** nio->format is usefully set. ** ** If (file), the only input information that nio is used for is ** nio->path, so that detached header-relative data files can be ** found. If (string), the headerStr-related fields in the _nio will ** be set/used */ int _nrrdRead(Nrrd *nrrd, FILE *file, const char *string, NrrdIoState *_nio) { static const char me[]="_nrrdRead"; unsigned int llen; NrrdIoState *nio; int nfi; airArray *mop; /* sanity check, for good measure */ if (!nrrdSanity()) { biffAddf(NRRD, "%s: sanity check FAILED: have to fix and re-compile", me); return 1; } if (!((file || string) && nrrd)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (file && string) { biffAddf(NRRD, "%s: can't read from both file and string", me); return 1; } mop = airMopNew(); if (_nio) { nio = _nio; } else { nio = nrrdIoStateNew(); if (!nio) { biffAddf(NRRD, "%s: couldn't alloc I/O struct", me); return 1; } airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways); } /* remember old data pointer and allocated size. Whether or not to free() this memory will be decided later */ nio->oldData = nrrd->data; nio->oldDataSize = (nio->oldData ? nrrdElementNumber(nrrd)*nrrdElementSize(nrrd) : 0); /* fprintf(stderr, "!%s: nio->oldData = %p, oldDataSize = %d\n", me, nio->oldData, (int)(nio->oldDataSize)); */ nrrd->data = NULL; /* initialize given nrrd (but we have thwarted freeing existing memory) */ nrrdInit(nrrd); /* tell the nio where to find the string to read from */ nio->headerStringRead = string; if (_nrrdOneLine(&llen, nio, file)) { biffAddf(NRRD, "%s: error getting first line (containing \"magic\")", me); airMopError(mop); return 1; } if (!llen) { biffAddf(NRRD, "%s: immediately hit EOF", me); airMopError(mop); return 1; } nio->format = nrrdFormatUnknown; for (nfi = nrrdFormatTypeUnknown+1; nfi < nrrdFormatTypeLast; nfi++) { if (nrrdFormatArray[nfi]->contentStartsLike(nio)) { nio->format = nrrdFormatArray[nfi]; break; } } if (nrrdFormatUnknown == nio->format) { char linestart[AIR_STRLEN_SMALL], stmp[AIR_STRLEN_SMALL]; airStrcpy(linestart, AIR_STRLEN_SMALL, nio->line); if (strlen(linestart) != strlen(nio->line)) { biffAddf(NRRD, "%s: couldn't parse (length %s) line starting " "with \"%s\" as magic or beginning of any recognized format", me, airSprintSize_t(stmp, strlen(nio->line)), linestart); } else { biffAddf(NRRD, "%s: couldn't parse \"%s\" as magic or beginning " "of any recognized format", me, nio->line); } airMopError(mop); return 1; } if (string && nrrdFormatNRRD != nio->format) { biffAddf(NRRD, "%s: sorry, can only read %s files from strings (not %s)", me, nrrdFormatNRRD->name, nio->format->name); airMopError(mop); return 1; } /* try to read the file */ if (nio->format->read(file, nrrd, nio)) { biffAddf(NRRD, "%s: trouble reading %s file", me, nio->format->name); airMopError(mop); return 1; } /* reshape up grayscale images, if desired */ if (nio->format->isImage && 2 == nrrd->dim && nrrdStateGrayscaleImage3D) { if (nrrdAxesInsert(nrrd, nrrd, 0)) { biffAddf(NRRD, "%s:", me); return 1; } } /* free prior memory if we didn't end up using it */ /* HEY: could actually do a check on the nio to refine this */ if (nio->oldData != nrrd->data) { nio->oldData = airFree(nio->oldData); nio->oldDataSize = 0; } /* finally, make sure that what we're returning isn't malformed somehow, except that we (probably stupidly) allow nrrd->data to be NULL, given the possibility of using nio->skipData */ if (_nrrdCheck(nrrd, AIR_FALSE, AIR_TRUE)) { biffAddf(NRRD, "%s: problem with nrrd after reading", me); return 1; } airMopOkay(mop); return 0; } /* ******** nrrdRead() ** ** now just a wrapper around _nrrdRead(); reads a NRRD from a FILE * */ int nrrdRead(Nrrd *nrrd, FILE *file, NrrdIoState *_nio) { static const char me[]="nrrdRead"; if (_nrrdRead(nrrd, file, NULL, _nio)) { biffAddf(NRRD, "%s: trouble", me); return 1; } return 0; } /* ******** nrrdStringRead() ** ** also a wrapper around _nrrdRead(); reads a NRRD from a char *. ** ** Because the same underlying _nrrdRead() is used, the same semantics ** about using existing nrrd->data when possible applies, as does the ** action of nrrdStateGrayscaleImage3D */ int nrrdStringRead(Nrrd *nrrd, const char *string, NrrdIoState *_nio) { static const char me[]="nrrdRead"; if (_nrrdRead(nrrd, NULL, string, _nio)) { biffAddf(NRRD, "%s: trouble", me); return 1; } return 0; } /* ** _nrrdSplitName() ** ** splits a file name into a path and a base filename. The path ** separator is '/', but there is a hack (thanks Torsten Rohlfing) ** which allows '\' to work on Windows. The division between the path ** and the base is the last path separator in the file name. The path ** is everything prior to this, and base is everything after (so the ** base does NOT start with the path separator). If there is not a ** '/' in the name, or if a path separator appears as the last ** character, then the path is set to ".", and the name is copied into ** base. */ void _nrrdSplitName(char **dirP, char **baseP, const char *name) { char *where; if (dirP) { *dirP = (char *)airFree(*dirP); } if (baseP) { *baseP = (char *)airFree(*baseP); } where = strrchr(name, '/'); #ifdef _WIN32 /* Deal with Windows "\" path separators; thanks to Torsten Rohlfing */ if ( !where || (strrchr(name, '\\') > where) ) { where = strrchr(name, '\\'); } #endif /* we found a valid break if the last directory character is somewhere in the string except the last character */ if (where && airStrlen(where) > 1) { if (dirP) { *dirP = airStrdup(name); (*dirP)[where - name] = 0; } if (baseP) { *baseP = airStrdup(where + 1); } } else { /* if the name had no slash, its in the current directory, which means that we need to explicitly store "." as the header directory in case we have header-relative data. */ if (dirP) { *dirP = airStrdup("."); } if (baseP) { *baseP = airStrdup(name); } } return; } /* ******** nrrdLoad() ** ** ** ** call tree for this, to help figure out what's going on ** ** read.c/nrrdLoad ** | read.c/_nrrdSplitName ** | read.c/nrrdRead ** | nio->format->read ** = formatNRRD.c/_nrrdFormatNRRD_read: ** | read.c/_nrrdOneLine ** | parseNrrd.c/_nrrdReadNrrdParseField ** | parseNrrd.c/nrrdFieldInfoParse[] ** = parseNrrd.c/_nrrdReadNrrdParse_data_file ** | fopen(dataName) ** | formatNRRD.c/_nrrdHeaderCheck ** | read.c/nrrdLineSkip ** | read.c/nrrdByteSkip ** | nio->encoding->read ** = encodingRaw.c/_nrrdEncodingRaw_read ** | read.c/_nrrdCalloc ** | formatNRRD.c/nrrdSwapEndian ** | miscAir.c/airFclose ** ** (more documentation here) ** ** sneakiness: returns 2 if the reason for problem was a failed fopen(). ** */ int /*Teem: biff if (ret) */ nrrdLoad(Nrrd *nrrd, const char *filename, NrrdIoState *nio) { static const char me[]="nrrdLoad"; FILE *file; airArray *mop; if (!(nrrd && filename)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } mop = airMopNew(); if (!nio) { nio = nrrdIoStateNew(); if (!nio) { biffAddf(NRRD, "%s: couldn't alloc I/O struct", me); return 1; } airMopAdd(mop, nio, (airMopper)nrrdIoStateNix, airMopAlways); } /* we save the directory of the filename given to us so that if it turns out that this is a detached header with a header-relative data file, then we will know how to find the data file */ _nrrdSplitName(&(nio->path), NULL, filename); /* printf("!%s: |%s|%s|\n", me, nio->dir, nio->base); */ if (!( file = airFopen(filename, stdin, "rb") )) { biffAddf(NRRD, "%s: fopen(\"%s\",\"rb\") failed: %s", me, filename, strerror(errno)); airMopError(mop); return 2; } airMopAdd(mop, file, (airMopper)airFclose, airMopOnError); /* non-error exiting is handled below */ if (nrrdRead(nrrd, file, nio)) { biffAddf(NRRD, "%s: trouble reading \"%s\"", me, filename); airMopError(mop); return 1; } if (nrrdFormatNRRD == nio->format && nio->keepNrrdDataFileOpen && file == nio->dataFile ) { /* we have to keep the datafile open. If was attached, we can't close file, because that is the datafile. If was detached, file != nio->dataFile, so we can close file. */ } else { /* always close non-NRRD files */ airFclose(file); } airMopOkay(mop); return 0; } int nrrdLoadMulti(Nrrd *const *nin, unsigned int ninLen, const char *fnameFormat, unsigned int numStart, NrrdIoState *nio) { static const char me[]="nrrdLoadMulti"; char *fname; airArray *mop; unsigned int nii; if (!(nin && fnameFormat)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (!( _nrrdContainsPercentThisAndMore(fnameFormat, 'u') )) { biffAddf(NRRD, "%s: given format \"%s\" doesn't seem to " "have the \"%%u\" conversion specification to sprintf " "an unsigned int\n", me, fnameFormat); return 1; } mop = airMopNew(); /* should be big enough for the number replacing the format sequence */ fname = AIR_CAST(char *, malloc(strlen(fnameFormat) + 128)); if (!(fname)) { biffAddf(NRRD, "%s: couldn't allocate local fname buffer", me); airMopError(mop); return 1; } airMopAdd(mop, fname, airFree, airMopAlways); for (nii=0; nii= 8 # define _NRRD_DEF_MEM_LEVEL 8 #else # define _NRRD_DEF_MEM_LEVEL MAX_MEM_LEVEL #endif /* stream buffer size */ #define _NRRD_Z_BUFSIZE 16 * 1024 /* gzip flag byte */ #define _NRRD_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ #define _NRRD_HEAD_CRC 0x02 /* bit 1 set: header CRC present */ #define _NRRD_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ #define _NRRD_ORIG_NAME 0x08 /* bit 3 set: original file name present */ #define _NRRD_COMMENT 0x10 /* bit 4 set: file comment present */ #define _NRRD_RESERVED 0xE0 /* bits 5..7: reserved */ typedef struct _NrrdGzStream { z_stream stream; int z_err; /* error code for last stream operation */ int z_eof; /* set if end of input file */ FILE *file; /* .gz file */ Byte *inbuf; /* input buffer */ Byte *outbuf; /* output buffer */ uLong crc; /* crc32 of uncompressed data */ char *msg; /* error message */ int transparent; /* 1 if input file is not a .gz file */ char mode; /* 'w' or 'r' */ long startpos; /* start of compressed data in file (header skipped) */ } _NrrdGzStream; static int _nrrdGzMagic[2] = {0x1f, 0x8b}; /* gzip magic header */ /* zlib error messages */ static const char *_nrrdGzErrMsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ "incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; #define _NRRD_GZ_ERR_MSG(err) _nrrdGzErrMsg[Z_NEED_DICT-(err)] /* some forward declarations for things in this file */ static void _nrrdGzCheckHeader(_NrrdGzStream *s); static int _nrrdGzDestroy(_NrrdGzStream *s); static int _nrrdGzDoFlush(gzFile file, int flush); static void _nrrdGzPutLong(FILE *file, uLong x); static uLong _nrrdGzGetLong(_NrrdGzStream *s); /* ** _nrrdGzOpen() ** ** Opens a gzip (.gz) file for reading or writing. The mode parameter ** is like in fopen ("rb" or "wb"). The file represented by the FILE* pointer ** should be open already with the same mode. The mode parameter can also be ** used to specify the compression level "[0-9]" and strategy "[f|h]". ** ** The compression level must be between 0 and 9: 1 gives best speed, ** 9 gives best compression, 0 gives no compression at all (the input data ** is simply copied a block at a time). The default level is 6. ** ** The strategy parameter is used to tune the compression algorithm. Use ** "f" for data produced by a filter (or predictor), or "h" to force Huffman ** encoding only (no string match). Filtered data consists mostly of small ** values with a somewhat random distribution. In this case, the compression ** algorithm is tuned to compress them better. The effect of "f" is to force ** more Huffman coding and less string matching; it is somewhat intermediate ** between the default and Huffman. The strategy parameter only affects the ** compression ratio but not the correctness of the compressed output even ** if it is not set appropriately. ** ** The complete syntax for the mode parameter is: "(r|w[a])[0-9][f|h]". ** ** Returns Z_NULL if the file could not be opened or if there was ** insufficient memory to allocate the (de)compression state; errno ** can be checked to distinguish the two cases (if errno is zero, the ** zlib error is Z_MEM_ERROR). */ gzFile _nrrdGzOpen(FILE* fd, const char* mode) { static const char me[]="_nrrdGzOpen"; int error; int level = Z_DEFAULT_COMPRESSION; /* compression level */ int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ const char *p = mode; _NrrdGzStream *s; char fmode[AIR_STRLEN_MED]; /* copy of mode, without the compression level */ char *m = fmode; if (!mode) { biffAddf(NRRD, "%s: no file mode specified", me); return Z_NULL; } /* allocate stream struct */ s = (_NrrdGzStream *)calloc(1, sizeof(_NrrdGzStream)); if (!s) { biffAddf(NRRD, "%s: failed to allocate stream buffer", me); return Z_NULL; } /* initialize stream struct */ s->stream.zalloc = (alloc_func)0; s->stream.zfree = (free_func)0; s->stream.opaque = (voidpf)0; s->stream.next_in = s->inbuf = Z_NULL; s->stream.next_out = s->outbuf = Z_NULL; s->stream.avail_in = s->stream.avail_out = 0; s->file = NULL; s->z_err = Z_OK; s->z_eof = 0; s->crc = crc32(0L, Z_NULL, 0); s->msg = NULL; s->transparent = 0; /* parse mode flag */ s->mode = '\0'; do { if (*p == 'r') s->mode = 'r'; if (*p == 'w' || *p == 'a') s->mode = 'w'; if (*p >= '0' && *p <= '9') { level = *p - '0'; } else if (*p == 'f') { strategy = Z_FILTERED; } else if (*p == 'h') { strategy = Z_HUFFMAN_ONLY; } else { *m++ = *p; /* copy the mode */ } } while (*p++ && m != fmode + sizeof(fmode)); if (s->mode == '\0') { biffAddf(NRRD, "%s: invalid file mode", me); return _nrrdGzDestroy(s), (gzFile)Z_NULL; } if (s->mode == 'w') { error = deflateInit2(&(s->stream), level, Z_DEFLATED, -MAX_WBITS, _NRRD_DEF_MEM_LEVEL, strategy); /* windowBits is passed < 0 to suppress zlib header */ s->stream.next_out = s->outbuf = (Byte*)calloc(1, _NRRD_Z_BUFSIZE); if (error != Z_OK || s->outbuf == Z_NULL) { biffAddf(NRRD, "%s: stream init failed", me); return _nrrdGzDestroy(s), (gzFile)Z_NULL; } } else { s->stream.next_in = s->inbuf = (Byte*)calloc(1, _NRRD_Z_BUFSIZE); error = inflateInit2(&(s->stream), -MAX_WBITS); /* windowBits is passed < 0 to tell that there is no zlib header. * Note that in this case inflate *requires* an extra "dummy" byte * after the compressed stream in order to complete decompression and * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are * present after the compressed stream. */ if (error != Z_OK || s->inbuf == Z_NULL) { biffAddf(NRRD, "%s: stream init failed", me); return _nrrdGzDestroy(s), (gzFile)Z_NULL; } } s->stream.avail_out = _NRRD_Z_BUFSIZE; errno = 0; s->file = fd; if (s->file == NULL) { biffAddf(NRRD, "%s: null file pointer", me); return _nrrdGzDestroy(s), (gzFile)Z_NULL; } if (s->mode == 'w') { /* Write a very simple .gz header: */ fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", _nrrdGzMagic[0], _nrrdGzMagic[1], Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, _NRRD_OS_CODE); s->startpos = 10L; /* We use 10L instead of ftell(s->file) to because ftell causes an * fflush on some systems. This version of the library doesn't use * startpos anyway in write mode, so this initialization is not * necessary. */ } else { _nrrdGzCheckHeader(s); /* skip the .gz header */ s->startpos = (ftell(s->file) - s->stream.avail_in); } return (gzFile)s; } /* ** _nrrdGzClose() ** ** Flushes all pending output if necessary, closes the compressed file ** and deallocates the (de)compression state. */ int _nrrdGzClose (gzFile file) { static const char me[]="_nrrdGzClose"; int error; _NrrdGzStream *s = (_NrrdGzStream*)file; if (s == NULL) { biffAddf(NRRD, "%s: invalid stream", me); return 1; } if (s->mode == 'w') { error = _nrrdGzDoFlush(file, Z_FINISH); if (error != Z_OK) { biffAddf(NRRD, "%s: failed to flush pending data", me); return _nrrdGzDestroy((_NrrdGzStream*)file); } _nrrdGzPutLong(s->file, s->crc); _nrrdGzPutLong(s->file, s->stream.total_in); } return _nrrdGzDestroy((_NrrdGzStream*)file); } /* ** _nrrdGzRead() ** ** Reads the given number of uncompressed bytes from the compressed file. ** Returns the number of bytes actually read (0 for end of file). */ int _nrrdGzRead(gzFile file, void* buf, unsigned int len, unsigned int* didread) { static const char me[]="_nrrdGzRead"; _NrrdGzStream *s = (_NrrdGzStream*)file; Bytef *start = (Bytef*)buf; /* starting point for crc computation */ Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ if (s == NULL || s->mode != 'r') { biffAddf(NRRD, "%s: invalid stream or file mode", me); *didread = 0; return 1; } if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) { biffAddf(NRRD, "%s: data read error", me); *didread = 0; return 1; } if (s->z_err == Z_STREAM_END) { *didread = 0; return 0; /* EOF */ } next_out = (Byte*)buf; s->stream.next_out = (Bytef*)buf; s->stream.avail_out = len; while (s->stream.avail_out != 0) { if (s->transparent) { /* Copy first the lookahead bytes: */ uInt n = s->stream.avail_in; if (n > s->stream.avail_out) n = s->stream.avail_out; if (n > 0) { memcpy(s->stream.next_out, s->stream.next_in, n); next_out += n; s->stream.next_out = next_out; s->stream.next_in += n; s->stream.avail_out -= n; s->stream.avail_in -= n; } if (s->stream.avail_out > 0) { s->stream.avail_out -= (uInt)fread(next_out, 1, s->stream.avail_out, s->file); } len -= s->stream.avail_out; s->stream.total_in += len; s->stream.total_out += len; if (len == 0) s->z_eof = 1; *didread = len; return 0; } if (s->stream.avail_in == 0 && !s->z_eof) { errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, _NRRD_Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; if (ferror(s->file)) { s->z_err = Z_ERRNO; break; } } s->stream.next_in = s->inbuf; } s->z_err = inflate(&(s->stream), Z_NO_FLUSH); if (s->z_err == Z_STREAM_END) { /* Check CRC and original size */ s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); start = s->stream.next_out; if (_nrrdGzGetLong(s) != s->crc) { s->z_err = Z_DATA_ERROR; } else { (void)_nrrdGzGetLong(s); /* The uncompressed length returned by above getlong() may * be different from s->stream.total_out) in case of * concatenated .gz files. Check for such files: */ _nrrdGzCheckHeader(s); if (s->z_err == Z_OK) { uLong total_in = s->stream.total_in; uLong total_out = s->stream.total_out; inflateReset(&(s->stream)); s->stream.total_in = total_in; s->stream.total_out = total_out; s->crc = crc32(0L, Z_NULL, 0); } } } if (s->z_err != Z_OK || s->z_eof) break; } s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); *didread = len - s->stream.avail_out; return 0; } /* ** _nrrdGzWrite() ** ** Writes the given number of uncompressed bytes into the compressed file. ** Returns the number of bytes actually written (0 in case of error). */ int _nrrdGzWrite(gzFile file, const void* buf, unsigned int len, unsigned int* written) { static const char me[]="_nrrdGzWrite"; _NrrdGzStream *s = (_NrrdGzStream*)file; void *nonconstbuf; if (s == NULL || s->mode != 'w') { biffAddf(NRRD, "%s: invalid stream or file mode", me); *written = 0; return 1; } /* If you google for "const correct zlib" or "zlib.h is not const-correct" you'll find zlib mailing list discussions of how zlib doesn't have all the consts that it should, and various code examples of using multiple casts to hide the problem. Here's a slow way that doesn't use mere casting to make the const go away */ memcpy(&nonconstbuf, &buf, sizeof(void*)); s->stream.next_in = (Bytef*)nonconstbuf; s->stream.avail_in = len; while (s->stream.avail_in != 0) { if (s->stream.avail_out == 0) { s->stream.next_out = s->outbuf; if (fwrite(s->outbuf, 1, _NRRD_Z_BUFSIZE, s->file) != _NRRD_Z_BUFSIZE) { s->z_err = Z_ERRNO; biffAddf(NRRD, "%s: failed to write to file", me); break; } s->stream.avail_out = _NRRD_Z_BUFSIZE; } s->z_err = deflate(&(s->stream), Z_NO_FLUSH); if (s->z_err != Z_OK) break; } s->crc = crc32(s->crc, (const Bytef *)buf, len); *written = len - s->stream.avail_in; return 0; } /* ** _nrrdGzGetByte() ** ** Reads a byte from a _NrrdGzStream. Updates next_in and avail_in. ** Returns EOF for end of file. ** IN assertion: the stream s has been sucessfully opened for reading. */ static int _nrrdGzGetByte(_NrrdGzStream *s) { static const char me[]="_nrrdGzGetByte"; if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, _NRRD_Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { s->z_eof = 1; if (ferror(s->file)) { biffAddf(NRRD, "%s: failed to read from file", me); s->z_err = Z_ERRNO; } return EOF; } s->stream.next_in = s->inbuf; } s->stream.avail_in--; return *(s->stream.next_in)++; } /* ******** _nrrdGzCheckHeader() ** ** Checks the gzip header of a _NrrdGzStream opened for reading. Sets ** the stream mode to transparent if the gzip magic header is not ** present; sets s->err to Z_DATA_ERROR if the magic header is present ** but the rest of the header is incorrect. ** IN assertion: the stream s has already been created sucessfully; ** s->stream.avail_in is zero for the first time, but may be non-zero ** for concatenated .gz files. */ static void _nrrdGzCheckHeader(_NrrdGzStream *s) { static const char me[]="_nrrdGzCheckHeader"; int method; /* method byte */ int flags; /* flags byte */ uInt len; int c; /* Check the gzip magic header */ for (len = 0; len < 2; len++) { c = _nrrdGzGetByte(s); if (c != _nrrdGzMagic[len]) { if (len != 0) s->stream.avail_in++, s->stream.next_in--; if (c != EOF) { s->stream.avail_in++, s->stream.next_in--; s->transparent = 1; } s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END; return; } } method = _nrrdGzGetByte(s); flags = _nrrdGzGetByte(s); if (method != Z_DEFLATED || (flags & _NRRD_RESERVED) != 0) { biffAddf(NRRD, "%s: gzip compression method is not deflate", me); s->z_err = Z_DATA_ERROR; return; } /* Discard time, xflags and OS code: */ for (len = 0; len < 6; len++) (void)_nrrdGzGetByte(s); if ((flags & _NRRD_EXTRA_FIELD) != 0) { /* skip the extra field */ len = (uInt)_nrrdGzGetByte(s); len += ((uInt)_nrrdGzGetByte(s))<<8; /* len is garbage if EOF but the loop below will quit anyway */ while (len-- != 0 && _nrrdGzGetByte(s) != EOF) ; } if ((flags & _NRRD_ORIG_NAME) != 0) { /* skip the original file name */ while ((c = _nrrdGzGetByte(s)) != 0 && c != EOF) ; } if ((flags & _NRRD_COMMENT) != 0) { /* skip the .gz file comment */ while ((c = _nrrdGzGetByte(s)) != 0 && c != EOF) ; } if ((flags & _NRRD_HEAD_CRC) != 0) { /* skip the header crc */ for (len = 0; len < 2; len++) (void)_nrrdGzGetByte(s); } s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; } /* ** _nrrdGzDestroy() ** ** Cleans up then free the given _NrrdGzStream. Returns a zlib error code. ** Try freeing in the reverse order of allocations. FILE* s->file is not ** closed. Because we didn't allocate it, we shouldn't delete it. */ static int _nrrdGzDestroy(_NrrdGzStream *s) { static const char me[]="_nrrdGzDestroy"; int error = Z_OK; if (s == NULL) { biffAddf(NRRD, "%s: invalid stream", me); return 1; } s->msg = (char *)airFree(s->msg); if (s->stream.state != NULL) { if (s->mode == 'w') { error = deflateEnd(&(s->stream)); } else if (s->mode == 'r') { error = inflateEnd(&(s->stream)); } } if (error != Z_OK) { biffAddf(NRRD, "%s: %s", me, _NRRD_GZ_ERR_MSG(error)); } if (s->z_err < 0) error = s->z_err; if (error != Z_OK) { biffAddf(NRRD, "%s: %s", me, _NRRD_GZ_ERR_MSG(error)); } s->inbuf = (Byte *)airFree(s->inbuf); s->outbuf = (Byte *)airFree(s->outbuf); airFree(s); /* avoiding unused value warnings, no NULL set */ return error != Z_OK; } /* ** _nrrdGzDoFlush() ** ** Flushes all pending output into the compressed file. The parameter ** flush is the same as in the deflate() function. */ static int _nrrdGzDoFlush(gzFile file, int flush) { static const char me[]="_nrrdGzDoFlush"; uInt len; int done = 0; _NrrdGzStream *s = (_NrrdGzStream*)file; if (s == NULL || s->mode != 'w') { biffAddf(NRRD, "%s: invalid stream or file mode", me); return Z_STREAM_ERROR; } s->stream.avail_in = 0; /* should be zero already anyway */ for (;;) { len = _NRRD_Z_BUFSIZE - s->stream.avail_out; if (len != 0) { if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { s->z_err = Z_ERRNO; return Z_ERRNO; } s->stream.next_out = s->outbuf; s->stream.avail_out = _NRRD_Z_BUFSIZE; } if (done) break; s->z_err = deflate(&(s->stream), flush); /* Ignore the second of two consecutive flushes: */ if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; /* deflate has finished flushing only when it hasn't used up * all the available space in the output buffer: */ done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; } return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; } /* ** _nrrdGzPutLong() ** ** Outputs a long in LSB order to the given file. */ static void _nrrdGzPutLong(FILE* file, uLong x) { int n; for (n = 0; n < 4; n++) { fputc((int)(x & 0xff), file); x >>= 8; } } /* ** _nrrdGzGetLong() ** ** Reads a long in LSB order from the given _NrrdGzStream. ** Sets z_err in case of error. */ static uLong _nrrdGzGetLong(_NrrdGzStream *s) { uLong x = (uLong)_nrrdGzGetByte(s); int c; x += ((uLong)_nrrdGzGetByte(s))<<8; x += ((uLong)_nrrdGzGetByte(s))<<16; c = _nrrdGzGetByte(s); if (c == EOF) s->z_err = Z_DATA_ERROR; x += ((uLong)c)<<24; return x; } #endif /* TEEM_ZLIB */ /* ** random symbol to have in object file, even when Zlib not enabled */ int _nrrdGzDummySymbol(void) { return 42; } cmtk-3.0.0/Utilities/NrrdIO/string.c0000644000177700000170000002501012041601331016256 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" /* this has to default to false in order for airStrtok to be a functional substitute for strtok() */ int airStrtokQuoting = AIR_FALSE; /* ******** airStrdup() ** ** because they didn't put strdup() in ANSI. ** This will return NULL if given NULL. */ char * airStrdup(const char *s) { char *ret; if (!s) { ret = NULL; } else { ret = (char *)malloc(strlen(s)+1); if (ret) { strcpy(ret, s); } } return ret; } /* ******** airStrlen() ** ** just like strlen, but safe to call on NULL (for which return is 0) */ size_t airStrlen(const char *s) { size_t ret; if (!s) { ret = 0; } else { ret = strlen(s); } return ret; } /* ******** airStrtok() ** ** thread-safe strtok() replacement. Use just like strtok(), but on ** each call to parse a given string, pass as the last argument the ** address of a char*, to be used for saving state while the string is ** traversed. Like strtok(), this will alter the "s" array passed to ** it on the first call, and like strtok(), this returns pointers into ** this string (rather than allocating new strings for each token). */ char * airStrtok(char *s, const char *ct, char **last) { char *h, *e, *q; if (!(ct && last)) { /* can't do any work, bail */ return NULL; } h = s ? s : *last; if (!airStrlen(h)) return NULL; h += strspn(h, ct); if ('\"' == *h && airStrtokQuoting) { /* something is trying to be quoted, and, we'll respect that */ /* have to find the next un-escaped '\"' */ h++; q = h; while (*q && !('\"' == *q && '\\' != q[-1])) { q++; } if (*q) { /* we found an unescaped '\"' */ e = q; } else { /* give up; pretend we never tried to do this quoting stuff */ e = h + strcspn(h, ct); } } else { e = h + strcspn(h, ct); } if ('\0' == *e) { *last = e; } else { *e = '\0'; *last = e + 1; } return h; } /* ******** airStrntok() ** ** returns the number of tokens parsable by airStrtok(), but does ** NOT alter the given string */ unsigned int airStrntok(const char *_s, const char *ct) { char *s, *t, *l=NULL; unsigned int n = 0; if (_s && ct) { s = airStrdup(_s); t = airStrtok(s, ct, &l); while (t) { n++; t = airStrtok(NULL, ct, &l); } airFree(s); /* no NULL assignment to s, else compile warnings */ } return n; } char * airStrtrans(char *s, char from, char to) { size_t i, l; if (s) { l = strlen(s); for (i=0; i 0)) { return NULL; } srcLen = airStrlen(src); if (1 == dstSize || !srcLen) { dst[0] = '\0'; return dst; } /* else dstSize > 1 AND src is a non-empy string */ copyLen = AIR_MIN(dstSize-1, srcLen); for (ii=0; ii= strlen(suff))) return 0; if (!strncmp(s + strlen(s) - strlen(suff), suff, strlen(suff))) return 1; else return 0; } /* ******** airUnescape() ** ** unescapes \\ and \n in place in a given string. ** Always returns the same pointer as given */ char * airUnescape(char *s) { size_t i, j, len; int found=0; len = airStrlen(s); if (!len) return s; for (i=1, j=0; i= 3 /* need room for a character and a Windows newline */ && line && file)) { return 0; } /* c is always set at least once, but not so for any char in line[] */ for (ii=0; (ii <= size-2 /* room for line[ii] and \0 after that */ && EOF != (cc=getc(file)) /* didn't hit EOF trying to read char */ && cc != '\n' /* char isn't newline */ && cc != '\r'); /* char isn't carriage return */ ++ii) { line[ii] = AIR_CAST(char, cc); } if (EOF == cc) { /* for-loop terminated because we hit EOF */ line[0] = '\0'; return 0; } else if ('\r' == cc || '\n' == cc) { /* for-loop terminated because we hit '\n' or '\r' */ /* if it was '\r', see if next character is '\n' */ if ('\r' == cc) { cc = getc(file); if (EOF != cc && '\n' != cc) { /* oops, we got something, and it was not a '\n'; put it back */ ungetc(cc, file); } } line[ii] = '\0'; return ii+1; } else { /* for-loop terminated because we got to end of buffer (ii == size-1) */ cc = getc(file); /* but see if we were about to get '\r', "\r\n", or '\n' */ if ('\r' == cc) { int dd; dd = getc(file); if (EOF != dd && '\n' != dd) { /* oops, put it back */ ungetc(dd, file); } line[ii] = '\0'; return ii+1; } else if ('\n' == cc) { line[ii] = '\0'; return ii+1; } else { /* weren't about to get a line termination, we really did run out of buffer */ if (EOF != cc) { ungetc(cc, file); /* we're allowed one ungetc on ANY stream */ } line[size-1] = '\0'; return size+1; } } } cmtk-3.0.0/Utilities/NrrdIO/privateBiff.h0000644000177700000170000000335512041601331017226 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifdef __cplusplus extern "C" { #endif /* ** This private header exists because these functions are used in ** the biff sources, but no where else. Also, they take a va_list, ** which is unusual, and (currently) used for no other public functions ** in Teem. Use of va_list args complicates python wrapping (at least ** with the current ctypeslib mechanism), so these functions are being ** taken out of the public API. */ /* biffmsg.c */ extern void _biffMsgAddVL(biffMsg *msg, const char *errfmt, va_list args); extern void _biffMsgMoveVL(biffMsg *dest, biffMsg *src, const char *errfmt, va_list args); #ifdef __cplusplus } #endif cmtk-3.0.0/Utilities/NrrdIO/parseAir.c0000644000177700000170000002455412041601331016532 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" static const char * _airBoolStr[] = { "(unknown bool)", "false", "true" }; static const char * _airBoolDesc[] = { "unknown boolean", "false", "true" }; static const int _airBoolVal[] = { -1, AIR_FALSE, AIR_TRUE }; static const char * _airBoolStrEqv[] = { "0", "no", "n", "false", "f", "off", "nope", "1", "yes", "y", "true", "t", "on", "yea", "" }; static const int _airBoolValEqv[] = { AIR_FALSE, AIR_FALSE, AIR_FALSE, AIR_FALSE, AIR_FALSE, AIR_FALSE, AIR_FALSE, AIR_TRUE, AIR_TRUE, AIR_TRUE, AIR_TRUE, AIR_TRUE, AIR_TRUE, AIR_TRUE }; static const airEnum _airBool = { "boolean", 2, _airBoolStr, _airBoolVal, _airBoolDesc, _airBoolStrEqv, _airBoolValEqv, AIR_FALSE }; const airEnum *const airBool = &_airBool; double airAtod(const char *str) { double val = 0.0; airSingleSscanf(str, "%lf", &val); return val; } int airSingleSscanf(const char *str, const char *fmt, void *ptr) { char *tmp; double val; int ret; if (!strcmp(fmt, "%e") || !strcmp(fmt, "%f") || !strcmp(fmt, "%g") || !strcmp(fmt, "%le") || !strcmp(fmt, "%lf") || !strcmp(fmt, "%lg")) { tmp = airStrdup(str); if (!tmp) { return 0; } airToLower(tmp); if (strstr(tmp, "nan")) { val = AIR_NAN; } else if (strstr(tmp, "-inf")) { val = AIR_NEG_INF; } else if (strstr(tmp, "inf")) { val = AIR_POS_INF; } else { /* nothing special matched; pass it off to sscanf() */ ret = sscanf(str, fmt, ptr); free(tmp); return ret; } /* else we matched "nan", "-inf", or "inf", and set val accordingly */ if (!strncmp(fmt, "%l", 2)) { /* we were given a double pointer */ *((double *)(ptr)) = val; } else { /* we were given a float pointer */ *((float *)(ptr)) = AIR_CAST(float, val); } free(tmp); return 1; } else if (!strcmp(fmt, "%z")) { /* its a size_t */ size_t tsz = 0; /* tmp size_t */ const char *chh = str; /* char here */ while (chh) { int dig; dig = AIR_CAST(int, *chh - '0'); if (AIR_IN_CL(0, dig, 9)) { tsz = 10*tsz + AIR_CAST(size_t, dig); } else { break; } chh++; } *((size_t *)(ptr)) = tsz; return 1; } else { /* not a float, double, or size_t, let sscanf handle it */ return sscanf(str, fmt, ptr); } } #define _PARSE_STR_ARGS(type) type *out, const char *_s, \ const char *ct, unsigned int n, ... #define _PARSE_STR_BODY(format) \ unsigned int i; \ char *tmp, *s, *last; \ \ /* if we got NULL, there's nothing to do */ \ if (!(out && _s && ct)) \ return 0; \ \ /* copy the input so that we don't change it */ \ s = airStrdup(_s); \ \ /* keep calling airStrtok() until we have everything */ \ for (i=0; i 1 || !greedy) { tmp = airStrtok(i ? NULL : s, ct, &last); } else { tmp = s; } if (!tmp) { airMopError(mop); return i; } out[i] = airStrdup(tmp); if (!out[i]) { airMopError(mop); return i; } airMopMem(mop, out+i, airMopOnError); } airMopOkay(mop); return n; } unsigned int airParseStrE(int *out, const char *_s, const char *ct, unsigned int n, ...) { unsigned int i; char *tmp, *s, *last; airArray *mop; va_list ap; airEnum *enm; /* grab the enum every time, prior to error checking */ va_start(ap, n); enm = va_arg(ap, airEnum *); va_end(ap); /* if we got NULL, there's nothing to do */ if (!(out && _s && ct)) { return 0; } mop = airMopNew(); /* copy the input so that we don't change it */ s = airStrdup(_s); airMopMem(mop, &s, airMopAlways); if (1 == n) { /* Because it should be permissible to have spaces in what is intended to be only a single string from an airEnum, we treat 1==n differently, and do NOT use airStrtok to tokenize the input string s into spaces. We check the whole s string */ out[0] = airEnumVal(enm, s); if (airEnumUnknown(enm) == out[0]) { airMopError(mop); return 0; } } else { /* keep calling airStrtok() until we have everything */ for (i=0; istr[0])) { airMopError(mop); return i; } } } airMopOkay(mop); return n; } unsigned int (*airParseStr[AIR_TYPE_MAX+1])(void *, const char *, const char *, unsigned int, ...) = { NULL, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrB, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrI, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrUI, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrLI, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrULI, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrZ, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrF, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrD, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrC, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrS, (unsigned int (*)(void *, const char *, const char *, unsigned int, ...))airParseStrE, NULL /* no standard way of parsing type "other" */ }; cmtk-3.0.0/Utilities/NrrdIO/axis.c0000644000177700000170000007675712041601331015744 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* ------------------------------------------------------------ */ void _nrrdAxisInfoInit(NrrdAxisInfo *axis) { int dd; if (axis) { axis->size = 0; axis->spacing = axis->thickness = AIR_NAN; axis->min = axis->max = AIR_NAN; for (dd=0; ddspaceDirection[dd] = AIR_NAN; } axis->center = nrrdCenterUnknown; axis->kind = nrrdKindUnknown; axis->label = (char *)airFree(axis->label); axis->units = (char *)airFree(axis->units); } } void _nrrdAxisInfoNewInit(NrrdAxisInfo *axis) { if (axis) { axis->label = NULL; axis->units = NULL; _nrrdAxisInfoInit(axis); } } /* ------------------------------------------------------------ */ /* ******** nrrdKindIsDomain ** ** returns non-zero for kinds (from nrrdKind* enum) that are domain ** axes, or independent variable axes, or resample-able axes, all ** different ways of describing the same thing */ int nrrdKindIsDomain(int kind) { return (nrrdKindDomain == kind || nrrdKindSpace == kind || nrrdKindTime == kind); } /* ******** nrrdKindSize ** ** returns suggested size (length) of an axis with the given kind, or, ** 0 if either (1) there is no suggested size because the axis is the ** kind of an independent or domain variable or (2) the kind is invalid */ unsigned int nrrdKindSize(int kind) { static const char me[]="nrrdKindSize"; unsigned int ret; if (!( AIR_IN_OP(nrrdKindUnknown, kind, nrrdKindLast) )) { /* they gave us invalid or unknown kind */ return 0; } switch (kind) { case nrrdKindDomain: case nrrdKindSpace: case nrrdKindTime: case nrrdKindList: case nrrdKindPoint: case nrrdKindVector: case nrrdKindCovariantVector: case nrrdKindNormal: ret = 0; break; case nrrdKindStub: case nrrdKindScalar: ret = 1; break; case nrrdKindComplex: case nrrdKind2Vector: ret = 2; break; case nrrdKind3Color: case nrrdKindRGBColor: case nrrdKindHSVColor: case nrrdKindXYZColor: ret = 3; break; case nrrdKind4Color: case nrrdKindRGBAColor: ret = 4; break; case nrrdKind3Vector: case nrrdKind3Normal: ret = 3; break; case nrrdKind4Vector: case nrrdKindQuaternion: ret = 4; break; case nrrdKind2DSymMatrix: ret = 3; break; case nrrdKind2DMaskedSymMatrix: ret = 4; break; case nrrdKind2DMatrix: ret = 4; break; case nrrdKind2DMaskedMatrix: ret = 5; break; case nrrdKind3DSymMatrix: ret = 6; break; case nrrdKind3DMaskedSymMatrix: ret = 7; break; case nrrdKind3DMatrix: ret = 9; break; case nrrdKind3DMaskedMatrix: ret = 10; break; default: fprintf(stderr, "%s: PANIC: nrrdKind %d not implemented!\n", me, kind); ret = UINT_MAX; } return ret; } /* ** _nrrdKindAltered: ** ** implements logic for how kind should be updated when samples ** along the axis are altered */ int _nrrdKindAltered(int kindIn, int resampling) { int kindOut; if (nrrdStateKindNoop) { kindOut = nrrdKindUnknown; /* HEY: setting the kindOut to unknown is arguably not a no-op. It is more like pointedly and stubbornly simplistic. So maybe nrrdStateKindNoop could be renamed .. */ } else { if (nrrdKindIsDomain(kindIn) || (0 == nrrdKindSize(kindIn) && !resampling)) { kindOut = kindIn; } else { kindOut = nrrdKindUnknown; } } return kindOut; } /* ** _nrrdAxisInfoCopy ** ** HEY: we have a void return even though this function potentially ** involves calling airStrdup!! */ void _nrrdAxisInfoCopy(NrrdAxisInfo *dest, const NrrdAxisInfo *src, int bitflag) { int ii; if (!(NRRD_AXIS_INFO_SIZE_BIT & bitflag)) { dest->size = src->size; } if (!(NRRD_AXIS_INFO_SPACING_BIT & bitflag)) { dest->spacing = src->spacing; } if (!(NRRD_AXIS_INFO_THICKNESS_BIT & bitflag)) { dest->thickness = src->thickness; } if (!(NRRD_AXIS_INFO_MIN_BIT & bitflag)) { dest->min = src->min; } if (!(NRRD_AXIS_INFO_MAX_BIT & bitflag)) { dest->max = src->max; } if (!(NRRD_AXIS_INFO_SPACEDIRECTION_BIT & bitflag)) { for (ii=0; iispaceDirection[ii] = src->spaceDirection[ii]; } } if (!(NRRD_AXIS_INFO_CENTER_BIT & bitflag)) { dest->center = src->center; } if (!(NRRD_AXIS_INFO_KIND_BIT & bitflag)) { dest->kind = src->kind; } if (!(NRRD_AXIS_INFO_LABEL_BIT & bitflag)) { if (dest->label != src->label) { dest->label = (char *)airFree(dest->label); dest->label = (char *)airStrdup(src->label); } } if (!(NRRD_AXIS_INFO_UNITS_BIT & bitflag)) { if (dest->units != src->units) { dest->units = (char *)airFree(dest->units); dest->units = (char *)airStrdup(src->units); } } return; } /* ******** nrrdAxisInfoCopy() ** ** For copying all the per-axis peripheral information. Takes a ** permutation "map"; map[d] tells from which axis in input should the ** output axis d copy its information. The length of this permutation ** array is nout->dim. If map is NULL, the identity permutation is ** assumed. If map[i]==-1 for any i in [0,dim-1], then nothing is ** copied into axis i of output. The "bitflag" field controls which ** per-axis fields will NOT be copied; if bitflag==0, then all fields ** are copied. The value of bitflag should be |'s of NRRD_AXIS_INFO_* ** defines. ** ** Decided to Not use Biff, since many times map will be NULL, in ** which case the only error is getting a NULL nrrd, or an invalid map ** permutation, which will probably be unlikely given the contexts in ** which this is called. For the paranoid, the integer return value ** indicates error. ** ** Sun Feb 27 21:12:57 EST 2005: decided to allow nout==nin, so now ** use a local array of NrrdAxisInfo as buffer. */ int nrrdAxisInfoCopy(Nrrd *nout, const Nrrd *nin, const int *axmap, int bitflag) { NrrdAxisInfo axisBuffer[NRRD_DIM_MAX]; const NrrdAxisInfo *axis; unsigned int from, axi; if (!(nout && nin)) { return 1; } if (axmap) { for (axi=0; axidim; axi++) { if (-1 == axmap[axi]) { continue; } if (!AIR_IN_CL(0, axmap[axi], (int)nin->dim-1)) { return 3; } } } if (nout == nin) { /* copy axis info to local buffer */ for (axi=0; axidim; axi++) { _nrrdAxisInfoNewInit(axisBuffer + axi); _nrrdAxisInfoCopy(axisBuffer + axi, nin->axis + axi, bitflag); } axis = axisBuffer; } else { axis = nin->axis; } for (axi=0; axidim; axi++) { if (axmap && -1 == axmap[axi]) { /* for this axis, we don't touch a thing */ continue; } from = axmap ? (unsigned int)axmap[axi] : axi; _nrrdAxisInfoCopy(nout->axis + axi, axis + from, bitflag); } if (nout == nin) { /* free dynamically allocated stuff */ for (axi=0; axidim; axi++) { _nrrdAxisInfoInit(axisBuffer + axi); } } return 0; } /* ******** nrrdAxisInfoSet_nva() ** ** Simple means of setting fields of the axis array in the nrrd. ** ** type to pass for third argument: ** nrrdAxisInfoSize: size_t* ** nrrdAxisInfoSpacing: double* ** nrrdAxisInfoThickness: double* ** nrrdAxisInfoMin: double* ** nrrdAxisInfoMax: double* ** nrrdAxisInfoSpaceDirection: double (*var)[NRRD_SPACE_DIM_MAX] ** nrrdAxisInfoCenter: int* ** nrrdAxisInfoKind: int* ** nrrdAxisInfoLabel: char** ** nrrdAxisInfoUnits: char** */ void nrrdAxisInfoSet_nva(Nrrd *nrrd, int axInfo, const void *_info) { _nrrdAxisInfoSetPtrs info; int exists; unsigned int ai, si, minsi; if (!( nrrd && AIR_IN_CL(1, nrrd->dim, NRRD_DIM_MAX) && AIR_IN_OP(nrrdAxisInfoUnknown, axInfo, nrrdAxisInfoLast) && _info )) { return; } info.P = _info; for (ai=0; aidim; ai++) { switch (axInfo) { case nrrdAxisInfoSize: nrrd->axis[ai].size = info.ST[ai]; break; case nrrdAxisInfoSpacing: nrrd->axis[ai].spacing = info.D[ai]; break; case nrrdAxisInfoThickness: nrrd->axis[ai].thickness = info.D[ai]; break; case nrrdAxisInfoMin: nrrd->axis[ai].min = info.D[ai]; break; case nrrdAxisInfoMax: nrrd->axis[ai].max = info.D[ai]; break; case nrrdAxisInfoSpaceDirection: /* we won't allow setting an invalid direction */ exists = AIR_EXISTS(info.V[ai][0]); minsi = nrrd->spaceDim; for (si=0; sispaceDim; si++) { nrrd->axis[ai].spaceDirection[si] = info.V[ai][si]; if (exists ^ AIR_EXISTS(info.V[ai][si])) { minsi = 0; break; } } for (si=minsi; siaxis[ai].spaceDirection[si] = AIR_NAN; } break; case nrrdAxisInfoCenter: nrrd->axis[ai].center = info.I[ai]; break; case nrrdAxisInfoKind: nrrd->axis[ai].kind = info.I[ai]; break; case nrrdAxisInfoLabel: nrrd->axis[ai].label = (char *)airFree(nrrd->axis[ai].label); nrrd->axis[ai].label = (char *)airStrdup(info.CP[ai]); break; case nrrdAxisInfoUnits: nrrd->axis[ai].units = (char *)airFree(nrrd->axis[ai].units); nrrd->axis[ai].units = (char *)airStrdup(info.CP[ai]); break; } } if (nrrdAxisInfoSpaceDirection == axInfo) { for (ai=nrrd->dim; aiaxis[ai].spaceDirection[si] = AIR_NAN; } } } return; } /* ******** nrrdAxisInfoSet_va() ** ** var args front-end for nrrdAxisInfoSet_nva ** ** types to pass, one for each dimension: ** nrrdAxisInfoSize: size_t ** nrrdAxisInfoSpacing: double ** nrrdAxisInfoThickness: double ** nrrdAxisInfoMin: double ** nrrdAxisInfoMax: double ** nrrdAxisInfoSpaceDirection: double* ** nrrdAxisInfoCenter: int ** nrrdAxisInfoKind: int ** nrrdAxisInfoLabel: char* ** nrrdAxisInfoUnits: char* */ void nrrdAxisInfoSet_va(Nrrd *nrrd, int axInfo, ...) { NRRD_TYPE_BIGGEST *buffer[NRRD_DIM_MAX]; _nrrdAxisInfoSetPtrs info; unsigned int ai, si; va_list ap; double *dp, svec[NRRD_DIM_MAX][NRRD_SPACE_DIM_MAX]; if (!( nrrd && AIR_IN_CL(1, nrrd->dim, NRRD_DIM_MAX) && AIR_IN_OP(nrrdAxisInfoUnknown, axInfo, nrrdAxisInfoLast) )) { return; } info.P = buffer; va_start(ap, axInfo); for (ai=0; aidim; ai++) { switch (axInfo) { case nrrdAxisInfoSize: info.ST[ai] = va_arg(ap, size_t); /* printf("!%s: got int[%d] = %d\n", "nrrdAxisInfoSet", d, info.I[ai]); */ break; case nrrdAxisInfoSpaceDirection: dp = va_arg(ap, double*); /* punting on using info enum */ /* printf("!%s: got dp = %lu\n", "nrrdAxisInfoSet", (unsigned long)(dp)); */ for (si=0; sispaceDim; si++) { /* nrrd->axis[ai].spaceDirection[si] = dp[si]; */ svec[ai][si] = dp[si]; } for (si=nrrd->spaceDim; siaxis[ai].spaceDirection[si] = AIR_NAN; */ svec[ai][si] = dp[si]; } break; case nrrdAxisInfoCenter: case nrrdAxisInfoKind: info.I[ai] = va_arg(ap, int); /* printf("!%s: got int[%d] = %d\n", "nrrdAxisInfoSet", d, info.I[ai]); */ break; case nrrdAxisInfoSpacing: case nrrdAxisInfoThickness: case nrrdAxisInfoMin: case nrrdAxisInfoMax: info.D[ai] = va_arg(ap, double); /* printf("!%s: got double[%d] = %g\n", "nrrdAxisInfoSet", d, info.D[ai]); */ break; case nrrdAxisInfoLabel: /* we DO NOT do the airStrdup() here because this pointer value is just going to be handed to nrrdAxisInfoSet_nva(), which WILL do the airStrdup(); we're not violating the rules for axis labels */ info.CP[ai] = va_arg(ap, char *); /* printf("!%s: got char*[%d] = |%s|\n", "nrrdAxisInfoSet", d, info.CP[ai]); */ break; case nrrdAxisInfoUnits: /* see not above */ info.CP[ai] = va_arg(ap, char *); break; } } va_end(ap); if (nrrdAxisInfoSpaceDirection != axInfo) { /* now set the quantities which we've gotten from the var args */ nrrdAxisInfoSet_nva(nrrd, axInfo, info.P); } else { nrrdAxisInfoSet_nva(nrrd, axInfo, svec); } return; } /* ******** nrrdAxisInfoGet_nva() ** ** get any of the axis fields into an array ** ** Note that getting axes labels involves implicitly allocating space ** for them, due to the action of airStrdup(). The user is ** responsible for free()ing these strings when done with them. ** ** type to pass for third argument: ** nrrdAxisInfoSize: size_t* ** nrrdAxisInfoSpacing: double* ** nrrdAxisInfoThickness: double* ** nrrdAxisInfoMin: double* ** nrrdAxisInfoMax: double* ** nrrdAxisInfoSpaceDirection: double (*var)[NRRD_SPACE_DIM_MAX] ** nrrdAxisInfoCenter: int* ** nrrdAxisInfoKind: int* ** nrrdAxisInfoLabel: char** ** nrrdAxisInfoUnits: char** */ void nrrdAxisInfoGet_nva(const Nrrd *nrrd, int axInfo, void *_info) { _nrrdAxisInfoGetPtrs info; unsigned int ai, si; if (!( nrrd && AIR_IN_CL(1, nrrd->dim, NRRD_DIM_MAX) && AIR_IN_OP(nrrdAxisInfoUnknown, axInfo, nrrdAxisInfoLast) )) { return; } info.P = _info; for (ai=0; aidim; ai++) { switch (axInfo) { case nrrdAxisInfoSize: info.ST[ai] = nrrd->axis[ai].size; break; case nrrdAxisInfoSpacing: info.D[ai] = nrrd->axis[ai].spacing; break; case nrrdAxisInfoThickness: info.D[ai] = nrrd->axis[ai].thickness; break; case nrrdAxisInfoMin: info.D[ai] = nrrd->axis[ai].min; break; case nrrdAxisInfoMax: info.D[ai] = nrrd->axis[ai].max; break; case nrrdAxisInfoSpaceDirection: for (si=0; sispaceDim; si++) { info.V[ai][si] = nrrd->axis[ai].spaceDirection[si]; } for (si=nrrd->spaceDim; siaxis[ai].center; break; case nrrdAxisInfoKind: info.I[ai] = nrrd->axis[ai].kind; break; case nrrdAxisInfoLabel: /* note airStrdup()! */ info.CP[ai] = airStrdup(nrrd->axis[ai].label); break; case nrrdAxisInfoUnits: /* note airStrdup()! */ info.CP[ai] = airStrdup(nrrd->axis[ai].units); break; } } if (nrrdAxisInfoSpaceDirection == axInfo) { for (ai=nrrd->dim; aidim, NRRD_DIM_MAX) && AIR_IN_OP(nrrdAxisInfoUnknown, axInfo, nrrdAxisInfoLast) )) { return; } if (nrrdAxisInfoSpaceDirection != axInfo) { info.P = buffer; nrrdAxisInfoGet_nva(nrrd, axInfo, info.P); } else { nrrdAxisInfoGet_nva(nrrd, axInfo, svec); } va_start(ap, axInfo); for (ai=0; aidim; ai++) { ptr = va_arg(ap, void*); /* printf("!%s(%d): ptr = %lu\n", "nrrdAxisInfoGet", d, (unsigned long)ptr); */ switch (axInfo) { case nrrdAxisInfoSize: *((size_t*)ptr) = info.ST[ai]; break; case nrrdAxisInfoSpacing: case nrrdAxisInfoThickness: case nrrdAxisInfoMin: case nrrdAxisInfoMax: *((double*)ptr) = info.D[ai]; /* printf("!%s: got double[%d] = %lg\n", "nrrdAxisInfoGet", d, *((double*)ptr)); */ break; case nrrdAxisInfoSpaceDirection: for (si=0; sispaceDim; si++) { ((double*)ptr)[si] = svec[ai][si]; } for (si=nrrd->spaceDim; sidim-1 )) { return AIR_NAN; } center = _nrrdCenter(nrrd->axis[ax].center); min = nrrd->axis[ax].min; max = nrrd->axis[ax].max; size = nrrd->axis[ax].size; return NRRD_POS(center, min, max, size, idx); } /* ******** nrrdAxisInfoIdx() ** ** given a nrrd, an axis, and a (floating point) world space position, ** return the index implied the axis's min, max, and center. ** Does the opposite of nrrdAxisPos(). ** ** does not use biff */ double nrrdAxisInfoIdx(const Nrrd *nrrd, unsigned int ax, double pos) { int center; size_t size; double min, max; if (!( nrrd && ax <= nrrd->dim-1 )) { return AIR_NAN; } center = _nrrdCenter(nrrd->axis[ax].center); min = nrrd->axis[ax].min; max = nrrd->axis[ax].max; size = nrrd->axis[ax].size; return NRRD_IDX(center, min, max, size, pos); } /* ******** nrrdAxisInfoPosRange() ** ** given a nrrd, an axis, and two (floating point) index space positions, ** return the range of positions implied the axis's min, max, and center ** The opposite of nrrdAxisIdxRange() */ void nrrdAxisInfoPosRange(double *loP, double *hiP, const Nrrd *nrrd, unsigned int ax, double loIdx, double hiIdx) { int center, flip = 0; size_t size; double min, max, tmp; if (!( loP && hiP && nrrd && ax <= nrrd->dim-1 )) { *loP = *hiP = AIR_NAN; return; } center = _nrrdCenter(nrrd->axis[ax].center); min = nrrd->axis[ax].min; max = nrrd->axis[ax].max; size = nrrd->axis[ax].size; if (loIdx > hiIdx) { flip = 1; tmp = loIdx; loIdx = hiIdx; hiIdx = tmp; } if (nrrdCenterCell == center) { *loP = AIR_AFFINE(0, loIdx, size, min, max); *hiP = AIR_AFFINE(0, hiIdx+1, size, min, max); } else { *loP = AIR_AFFINE(0, loIdx, size-1, min, max); *hiP = AIR_AFFINE(0, hiIdx, size-1, min, max); } if (flip) { tmp = *loP; *loP = *hiP; *hiP = tmp; } return; } /* ******** nrrdAxisInfoIdxRange() ** ** given a nrrd, an axis, and two (floating point) world space positions, ** return the range of index space implied the axis's min, max, and center ** The opposite of nrrdAxisPosRange(). ** ** Actually- there are situations where sending an interval through ** nrrdAxisIdxRange -> nrrdAxisPosRange -> nrrdAxisIdxRange ** such as in cell centering, when the range of positions given does ** not even span one sample. Such as: ** axis->size = 4, axis->min = -4, axis->max = 4, loPos = 0, hiPos = 1 ** --> nrrdAxisIdxRange == (2, 1.5) --> nrrdAxisPosRange == (2, -1) ** The basic problem is that because of the 0.5 offset inherent in ** cell centering, there are situations where (in terms of the arguments ** to nrrdAxisIdxRange()) loPos < hiPos, but *loP > *hiP. */ void nrrdAxisInfoIdxRange(double *loP, double *hiP, const Nrrd *nrrd, unsigned int ax, double loPos, double hiPos) { int center, flip = 0; size_t size; double min, max, tmp; if (!( loP && hiP && nrrd && ax <= nrrd->dim-1 )) { *loP = *hiP = AIR_NAN; return; } center = _nrrdCenter(nrrd->axis[ax].center); min = nrrd->axis[ax].min; max = nrrd->axis[ax].max; size = nrrd->axis[ax].size; if (loPos > hiPos) { flip = 1; tmp = loPos; loPos = hiPos; hiPos = tmp; } if (nrrdCenterCell == center) { if (min < max) { *loP = AIR_AFFINE(min, loPos, max, 0, size); *hiP = AIR_AFFINE(min, hiPos, max, -1, size-1); } else { *loP = AIR_AFFINE(min, loPos, max, -1, size-1); *hiP = AIR_AFFINE(min, hiPos, max, 0, size); } } else { *loP = AIR_AFFINE(min, loPos, max, 0, size-1); *hiP = AIR_AFFINE(min, hiPos, max, 0, size-1); } if (flip) { tmp = *loP; *loP = *hiP; *hiP = tmp; } return; } void nrrdAxisInfoSpacingSet(Nrrd *nrrd, unsigned int ax) { int sign; double min, max, tmp; if (!( nrrd && ax <= nrrd->dim-1 )) { return; } min = nrrd->axis[ax].min; max = nrrd->axis[ax].max; if (!( AIR_EXISTS(min) && AIR_EXISTS(max) )) { /* there's no actual basis on which to set the spacing information, but we have to set it something, so here goes .. */ nrrd->axis[ax].spacing = nrrdDefaultSpacing; return; } if (min > max) { tmp = min; min = max; max = tmp; sign = -1; } else { sign = 1; } /* the skinny */ nrrd->axis[ax].spacing = NRRD_SPACING(_nrrdCenter(nrrd->axis[ax].center), min, max, nrrd->axis[ax].size); nrrd->axis[ax].spacing *= sign; return; } void nrrdAxisInfoMinMaxSet(Nrrd *nrrd, unsigned int ax, int defCenter) { int center; double spacing; if (!( nrrd && ax <= nrrd->dim-1 )) { return; } center = _nrrdCenter2(nrrd->axis[ax].center, defCenter); spacing = nrrd->axis[ax].spacing; if (!AIR_EXISTS(spacing)) spacing = nrrdDefaultSpacing; if (nrrdCenterCell == center) { nrrd->axis[ax].min = 0; nrrd->axis[ax].max = spacing*AIR_CAST(double, nrrd->axis[ax].size); } else { nrrd->axis[ax].min = 0; nrrd->axis[ax].max = spacing*AIR_CAST(double, nrrd->axis[ax].size - 1); } return; } /* ******** nrrdDomainAxesGet ** ** Based on the per-axis "kind" field, learns which are the domain ** (resample-able) axes of an image, in other words, the axes which ** correspond to independent variables. The return value is the ** number of domain axes, and that many values are set in the given ** axisIdx[] array ** ** NOTE: this takes a wild guess that an unset (nrrdKindUnknown) kind ** is a domain axis. */ unsigned int nrrdDomainAxesGet(const Nrrd *nrrd, unsigned int axisIdx[NRRD_DIM_MAX]) { unsigned int domAxi, axi; if (!( nrrd && axisIdx )) { return 0; } domAxi = 0; for (axi=0; axidim; axi++) { if (nrrdKindUnknown == nrrd->axis[axi].kind || nrrdKindIsDomain(nrrd->axis[axi].kind)) { axisIdx[domAxi++] = axi; } } return domAxi; } int _nrrdSpaceVecExists(const Nrrd *nrrd, unsigned int axi) { unsigned int sai; int ret; if (!( nrrd && axi < nrrd->dim && nrrd->spaceDim )) { ret = AIR_FALSE; } else { ret = AIR_TRUE; for (sai=0; saispaceDim; sai++) { ret &= AIR_EXISTS(nrrd->axis[axi].spaceDirection[sai]); } } return ret; } unsigned int nrrdSpatialAxesGet(const Nrrd *nrrd, unsigned int axisIdx[NRRD_DIM_MAX]) { unsigned int spcAxi, axi; if (!( nrrd && axisIdx && nrrd->spaceDim)) { return 0; } spcAxi = 0; for (axi=0; axidim; axi++) { if (_nrrdSpaceVecExists(nrrd, axi)) { axisIdx[spcAxi++] = axi; } } return spcAxi; } /* ******** nrrdRangeAxesGet ** ** Based on the per-axis "kind" field, learns which are the range ** (non-resample-able) axes of an image, in other words, the axes ** which correspond to dependent variables. The return value is the ** number of range axes; that number of values are set in the given ** axisIdx[] array ** ** Note: this really is as simple as returning the complement of the ** axis selected by nrrdDomainAxesGet() */ unsigned int nrrdRangeAxesGet(const Nrrd *nrrd, unsigned int axisIdx[NRRD_DIM_MAX]) { unsigned int domNum, domIdx[NRRD_DIM_MAX], rngAxi, axi, ii, isDom; if (!( nrrd && axisIdx )) { return 0; } domNum = nrrdDomainAxesGet(nrrd, domIdx); rngAxi = 0; for (axi=0; axidim; axi++) { isDom = AIR_FALSE; for (ii=0; iidim; axi++) { isSpc = AIR_FALSE; for (ii=0; iispacing, ** vector = all NaNs ** ** nrrdSpacingStatusScalarWithSpace There *is* a surrounding space, but the ** given axis does not live in that space, ** because it has no space direction. Caller ** may want to think about what's going on. ** *spacing = axis->spacing, ** vector = all NaNs ** ** nrrdSpacingStatusDirection There is a surrounding space, in which ** this axis has a direction V: ** *spacing = |V| (length of direction), ** vector = V/|V| (normalized direction) ** NOTE: it is still possible for both ** *spacing and vector to be all NaNs!! */ int nrrdSpacingCalculate(const Nrrd *nrrd, unsigned int ax, double *spacing, double vector[NRRD_SPACE_DIM_MAX]) { int ret; if (!( nrrd && spacing && vector && ax <= nrrd->dim-1 && !_nrrdCheck(nrrd, AIR_FALSE, AIR_FALSE) )) { /* there's a problem with the arguments. Note: the _nrrdCheck() call does not check on non-NULL-ity of nrrd->data */ ret = nrrdSpacingStatusUnknown; if (spacing) { *spacing = AIR_NAN; } if (vector) { nrrdSpaceVecSetNaN(vector); } } else { if (AIR_EXISTS(nrrd->axis[ax].spacing)) { if (nrrd->spaceDim > 0) { ret = nrrdSpacingStatusScalarWithSpace; } else { ret = nrrdSpacingStatusScalarNoSpace; } *spacing = nrrd->axis[ax].spacing; nrrdSpaceVecSetNaN(vector); } else { if (nrrd->spaceDim > 0 && _nrrdSpaceVecExists(nrrd, ax)) { ret = nrrdSpacingStatusDirection; *spacing = nrrdSpaceVecNorm(nrrd->spaceDim, nrrd->axis[ax].spaceDirection); nrrdSpaceVecScale(vector, 1.0/(*spacing), nrrd->axis[ax].spaceDirection); } else { ret = nrrdSpacingStatusNone; *spacing = AIR_NAN; nrrdSpaceVecSetNaN(vector); } } } return ret; } int nrrdOrientationReduce(Nrrd *nout, const Nrrd *nin, int setMinsFromOrigin) { static const char me[]="nrrdOrientationReduce"; unsigned int spatialAxisNum, spatialAxisIdx[NRRD_DIM_MAX], saxii; NrrdAxisInfo *axis; if (!(nout && nin)) { biffAddf(NRRD, "%s: got NULL spacing", me); return 1; } if (nout != nin) { if (nrrdCopy(nout, nin)) { biffAddf(NRRD, "%s: trouble doing initial copying", me); return 1; } } if (!nout->spaceDim) { /* we're done! */ return 0; } spatialAxisNum = nrrdSpatialAxesGet(nout, spatialAxisIdx); for (saxii=0; saxiiaxis + spatialAxisIdx[saxii]; axis->spacing = nrrdSpaceVecNorm(nout->spaceDim, axis->spaceDirection); if (setMinsFromOrigin) { axis->min = (saxii < nout->spaceDim ? nout->spaceOrigin[saxii] : AIR_NAN); } } nrrdSpaceSet(nout, nrrdSpaceUnknown); return 0; } cmtk-3.0.0/Utilities/NrrdIO/enum.c0000644000177700000170000001607212041601331015724 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" /* ** Until Teem has its own printf implementation, this will have to do; ** it is imperfect because these are not functionally identical. */ #if defined(WIN32) || defined(_WIN32) # define snprintf _snprintf #endif /* ******** airEnumUnknown ** ** return the value representing "unknown" in an enum */ int airEnumUnknown(const airEnum *enm) { if (enm && enm->val) { return enm->val[0]; } else { return 0; } } /* ** _airEnumIndex() ** ** given an enum "enm" and value "val", return the index into enm->str[] ** and enm->desc[] which correspond to that value. To be safe, when ** given an invalid enum value, we return zero. */ static unsigned int _airEnumIndex(const airEnum *enm, int val) { unsigned int ii, ret; ret = 0; if (enm->val) { for (ii=1; ii<=enm->M; ii++) { if (val == enm->val[ii]) { ret = ii; break; } } } else { unsigned int uval; uval = AIR_UINT(val); ret = (0 <= val && uval <= enm->M) ? uval : 0; } return ret; } /* ** returns non-zero if there is an error: given "val" is *not* ** a valid value of the airEnum "enm" */ int airEnumValCheck(const airEnum *enm, int val) { return (0 == _airEnumIndex(enm, val)); } const char * airEnumStr(const airEnum *enm, int val) { unsigned int idx; idx = _airEnumIndex(enm, val); return enm->str[idx]; } const char * airEnumDesc(const airEnum *enm, int val) { unsigned int idx; idx = _airEnumIndex(enm, val); return enm->desc[idx]; } int airEnumVal(const airEnum *enm, const char *str) { char *strCpy, test[AIR_STRLEN_SMALL]; unsigned int ii; if (!str) { return airEnumUnknown(enm); } strCpy = airStrdup(str); if (!enm->sense) { airToLower(strCpy); } if (enm->strEqv) { /* want strlen and not airStrlen here because the strEqv array should be terminated by a non-null empty string */ for (ii=0; strlen(enm->strEqv[ii]); ii++) { airStrcpy(test, AIR_STRLEN_SMALL, enm->strEqv[ii]); if (!enm->sense) { airToLower(test); } if (!strcmp(test, strCpy)) { free(strCpy); return enm->valEqv[ii]; } } } else { /* enm->strEqv NULL */ for (ii=1; ii<=enm->M; ii++) { airStrcpy(test, AIR_STRLEN_SMALL, enm->str[ii]); if (!enm->sense) { airToLower(test); } if (!strcmp(test, strCpy)) { free(strCpy); return enm->val ? enm->val[ii] : (int)ii; /* HEY scrutinize cast */ } } } /* else we never matched a string */ free(strCpy); return airEnumUnknown(enm); } /* ******** airEnumFmtDesc() ** ** Formats a description line for one element "val" of airEnum "enm", ** and puts the result in a NEWLY ALLOCATED string which is the return ** of this function. The formatting is done via sprintf(), as governed ** by "fmt", which should contain to "%s" conversion sequences, the ** first for the string version "val", and the second for the ** description If "canon", then the canonical string representation ** will be used (the one in enm->str[]), otherwise the shortest string ** representation will be used (which differs from the canonical one ** when there is a strEqv[]/valEqv[] pair defining a shorter string) */ char * airEnumFmtDesc(const airEnum *enm, int val, int canon, const char *fmt) { const char *desc; char *buff, ident[AIR_STRLEN_SMALL]; const char *_ident; int i; size_t len; if (!(enm && enm->desc && fmt)) { return airStrdup("(airEnumDesc: invalid args)"); } if (airEnumValCheck(enm, val)) { val = airEnumUnknown(enm); } _ident = airEnumStr(enm, val); if (!canon && enm->strEqv) { len = airStrlen(_ident); for (i=0; airStrlen(enm->strEqv[i]); i++) { if (val != enm->valEqv[i]) { /* this isn't a string representing the value we care about */ continue; } if (airStrlen(enm->strEqv[i]) < len) { /* this one is shorter */ len = airStrlen(enm->strEqv[i]); _ident = enm->strEqv[i]; } } } airStrcpy(ident, AIR_STRLEN_SMALL, _ident); if (!enm->sense) { airToLower(ident); } desc = enm->desc[_airEnumIndex(enm, val)]; buff = AIR_CALLOC(airStrlen(fmt) + airStrlen(ident) + airStrlen(desc) + 1, char); if (buff) { sprintf(buff, fmt, ident, desc); } return buff; } static void _enumPrintVal(FILE *file, const airEnum *enm, int ii) { if (enm->desc) { fprintf(file, "desc: %s\n", enm->desc[ii]); } if (enm->strEqv) { unsigned int jj; fprintf(file, "eqv:"); fflush(file); jj = 0; while (airStrlen(enm->strEqv[jj])) { if (enm->valEqv[jj] == (enm->val ? enm->val[ii] : ii)) { fprintf(file, " \"%s\"", enm->strEqv[jj]); } jj++; } fprintf(file, "\n"); } } void airEnumPrint(FILE *file, const airEnum *enm) { int ii; /* this should arguable be unsigned int, but airEnum values were kept as "int", even after the great unsigned conversion */ if (!(file && enm)) { return; } if (airStrlen(enm->name)) { fprintf(file, "airEnum \"%s\":\n", enm->name); } else { fprintf(file, "airEnum (NO NAME!):\n"); } fprintf(file, "(%s case sensitive)\n", (enm->sense ? "yes, is" : "is not")); if (enm->val) { fprintf(file, "Values (%u valid) given explicitly\n", enm->M); fprintf(file, "--- (0) %d: \"%s\"\n", enm->val[0], enm->str[0]); for (ii=1; ii<=AIR_CAST(int, enm->M); ii++) { fprintf(file, "--- (%d) %d: \"%s\" == \"%s\"\n", ii, enm->val[ii], enm->str[ii], airEnumStr(enm, enm->val[ii])); _enumPrintVal(file, enm, ii); } } else { /* enm->val NULL */ fprintf(file, "Values implicit; [1,%u] valid\n", enm->M); fprintf(file, "--- 0: \"%s\"\n", enm->str[0]); for (ii=1; ii<=AIR_CAST(int, enm->M); ii++) { fprintf(file, "--- %d: %s == %s\n", ii, enm->str[ii], airEnumStr(enm, ii)); _enumPrintVal(file, enm, ii); } } return; } /* this is the end */ cmtk-3.0.0/Utilities/NrrdIO/teem32bit.h0000644000177700000170000000300011550636332016563 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* ** the end result of this is that the source file which includes ** this can be sure that TEEM_32BIT is set, and can be sure that ** it is set to either 0 or 1 */ #ifndef TEEM_32BIT # error TEEM_32BIT not defined, see architecture-specific .mk file or check compilation options #elif TEEM_32BIT == 1 # /* okay, its 1 */ #elif TEEM_32BIT == 0 # /* okay, its 0 */ #else # error TEEM_32BIT not set to 0 or 1, see architecture-specific .mk file or check compilation options #endif cmtk-3.0.0/Utilities/NrrdIO/formatPNM.c0000644000177700000170000000551012041601331016616 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" int _nrrdFormatPNM_available(void) { return AIR_FALSE; } int _nrrdFormatPNM_nameLooksLike(const char *filename) { return (airEndsWith(filename, NRRD_EXT_PGM) || airEndsWith(filename, NRRD_EXT_PPM)); } int _nrrdFormatPNM_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatPNM_fitsInto", err[AIR_STRLEN_MED]; AIR_UNUSED(nrrd); AIR_UNUSED(encoding); AIR_UNUSED(useBiff); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatPNM->name); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; } int _nrrdFormatPNM_contentStartsLike(NrrdIoState *nio) { AIR_UNUSED(nio); return AIR_FALSE; } int _nrrdFormatPNM_read(FILE *file, Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdReadPNM", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatPNM->name); biffAdd(NRRD, err); return 1; } int _nrrdFormatPNM_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdFormatPNM_write", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatPNM->name); biffAdd(NRRD, err); return 1; } const NrrdFormat _nrrdFormatPNM = { "PNM", AIR_FALSE, /* isImage */ AIR_FALSE, /* readable */ AIR_FALSE, /* usesDIO */ _nrrdFormatPNM_available, _nrrdFormatPNM_nameLooksLike, _nrrdFormatPNM_fitsInto, _nrrdFormatPNM_contentStartsLike, _nrrdFormatPNM_read, _nrrdFormatPNM_write }; const NrrdFormat *const nrrdFormatPNM = &_nrrdFormatPNM; cmtk-3.0.0/Utilities/NrrdIO/reorder.c0000644000177700000170000003771212041601331016426 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* ******** nrrdInvertPerm() ** ** given an array (p) which represents a permutation of n elements, ** compute the inverse permutation ip. The value of this function ** is not its core functionality, but all the error checking it ** provides. */ int nrrdInvertPerm(unsigned int *invp, const unsigned int *pp, unsigned int nn) { static const char me[]="nrrdInvertPerm"; int problem; unsigned int ii; if (!(invp && pp && nn > 0)) { biffAddf(NRRD, "%s: got NULL pointer or non-positive nn (%d)", me, nn); return 1; } /* use the given array "invp" as a temp buffer for validity checking */ memset(invp, 0, nn*sizeof(unsigned int)); for (ii=0; iidim )) { biffAddf(NRRD, "%s: given axis (%d) outside valid range [0, %d]", me, axis, nin->dim); return 1; } if (NRRD_DIM_MAX == nin->dim) { biffAddf(NRRD, "%s: given nrrd already at NRRD_DIM_MAX (%d)", me, NRRD_DIM_MAX); return 1; } if (nout != nin) { if (_nrrdCopy(nout, nin, (NRRD_BASIC_INFO_COMMENTS_BIT | (nrrdStateKeyValuePairsPropagate ? 0 : NRRD_BASIC_INFO_KEYVALUEPAIRS_BIT)))) { biffAddf(NRRD, "%s:", me); return 1; } } nout->dim = 1 + nin->dim; for (ai=nin->dim; ai>axis; ai--) { _nrrdAxisInfoCopy(&(nout->axis[ai]), &(nin->axis[ai-1]), NRRD_AXIS_INFO_NONE); } /* the ONLY thing we can say about the new axis is its size */ _nrrdAxisInfoInit(&(nout->axis[axis])); if (!nrrdStateKindNoop) { /* except maybe the kind */ nout->axis[axis].kind = nrrdKindStub; } nout->axis[axis].size = 1; if (nrrdContentSet_va(nout, func, nin, "%d", axis)) { biffAddf(NRRD, "%s:", me); return 1; } /* all basic info has already been copied by nrrdCopy() above */ return 0; } /* ******** nrrdAxesPermute ** ** changes the scanline ordering of the data in a nrrd ** ** The basic means by which data is moved around is with memcpy(). ** The goal is to call memcpy() as few times as possible, on memory ** segments as large as possible. Currently, this is done by ** detecting how many of the low-index axes are left untouched by ** the permutation- this constitutes a "scanline" which can be ** copied around as a unit. For permuting the y and z axes of a ** matrix-x-y-z order matrix volume, this optimization produced a ** factor of 5 speed up (exhaustive multi-platform tests, of course). ** ** The axes[] array determines the permutation of the axes. ** axis[i] = j means: axis i in the output will be the input's axis j ** (axis[i] answers: "what do I put here", from the standpoint of the output, ** not "where do I put this", from the standpoint of the input) */ int nrrdAxesPermute(Nrrd *nout, const Nrrd *nin, const unsigned int *axes) { static const char me[]="nrrdAxesPermute", func[]="permute"; char buff1[NRRD_DIM_MAX*30], buff2[AIR_STRLEN_SMALL]; size_t idxOut, idxIn, /* indices for input and output scanlines */ lineSize, /* size of block of memory which can be moved contiguously from input to output, thought of as a "scanline" */ numLines, /* how many "scanlines" there are to permute */ szIn[NRRD_DIM_MAX], *lszIn, szOut[NRRD_DIM_MAX], *lszOut, cIn[NRRD_DIM_MAX], cOut[NRRD_DIM_MAX]; char *dataIn, *dataOut; int axmap[NRRD_DIM_MAX]; unsigned int ai, /* running index along dimensions */ lowPax, /* lowest axis which is "p"ermutated */ ldim, /* nin->dim - lowPax */ ip[NRRD_DIM_MAX+1], /* inverse of permutation in "axes" */ laxes[NRRD_DIM_MAX+1]; /* copy of axes[], but shifted down by lowPax elements, to remove i such that i == axes[i] */ airArray *mop; mop = airMopNew(); if (!(nin && nout && axes)) { biffAddf(NRRD, "%s: got NULL pointer", me); airMopError(mop); return 1; } /* we don't actually need ip[], computing it is for error checking */ if (nrrdInvertPerm(ip, axes, nin->dim)) { biffAddf(NRRD, "%s: couldn't compute axis permutation inverse", me); airMopError(mop); return 1; } /* this shouldn't actually be necessary .. */ if (!nrrdElementSize(nin)) { biffAddf(NRRD, "%s: nrrd reports zero element size!", me); airMopError(mop); return 1; } for (ai=0; aidim && axes[ai] == ai; ai++) ; lowPax = ai; /* allocate output by initial copy */ if (nout != nin) { if (nrrdCopy(nout, nin)) { biffAddf(NRRD, "%s: trouble copying input", me); airMopError(mop); return 1; } dataIn = (char*)nin->data; } else { dataIn = (char*)calloc(nrrdElementNumber(nin), nrrdElementSize(nin)); if (!dataIn) { biffAddf(NRRD, "%s: couldn't create local copy of data", me); airMopError(mop); return 1; } airMopAdd(mop, dataIn, airFree, airMopAlways); memcpy(dataIn, nin->data, nrrdElementNumber(nin)*nrrdElementSize(nin)); } if (lowPax < nin->dim) { /* if lowPax == nin->dim, then we were given the identity permutation, so there's nothing to do other than the copy already done. Otherwise, here we are (actually, lowPax < nin->dim-1) */ for (ai=0; aidim; ai++) { axmap[ai] = AIR_INT(axes[ai]); } nrrdAxisInfoGet_nva(nin, nrrdAxisInfoSize, szIn); if (nrrdAxisInfoCopy(nout, nin, axmap, NRRD_AXIS_INFO_NONE)) { biffAddf(NRRD, "%s:", me); airMopError(mop); return 1; } nrrdAxisInfoGet_nva(nout, nrrdAxisInfoSize, szOut); /* the skinny */ lineSize = 1; for (ai=0; aidim - lowPax; memset(laxes, 0, sizeof(laxes)); for (ai=0; aidata); memset(cIn, 0, sizeof(cIn)); memset(cOut, 0, sizeof(cOut)); for (idxOut=0; idxOutdim; ai++) { sprintf(buff2, "%s%d", (ai ? "," : ""), axes[ai]); strcat(buff1, buff2); } if (nrrdContentSet_va(nout, func, nin, "%s", buff1)) { biffAddf(NRRD, "%s:", me); airMopError(mop); return 1; } if (nout != nin) { if (nrrdBasicInfoCopy(nout, nin, NRRD_BASIC_INFO_DATA_BIT | NRRD_BASIC_INFO_TYPE_BIT | NRRD_BASIC_INFO_BLOCKSIZE_BIT | NRRD_BASIC_INFO_DIMENSION_BIT | NRRD_BASIC_INFO_CONTENT_BIT | NRRD_BASIC_INFO_COMMENTS_BIT | (nrrdStateKeyValuePairsPropagate ? 0 : NRRD_BASIC_INFO_KEYVALUEPAIRS_BIT))) { biffAddf(NRRD, "%s:", me); airMopError(mop); return 1; } } } airMopOkay(mop); return 0; } /* ******** nrrdShuffle ** ** rearranges hyperslices of a nrrd along a given axis according to ** given permutation. This could be used to on a 4D array, ** representing a 3D volume of vectors, to re-order the vector ** components. ** ** the given permutation array must allocated for at least as long as ** the input nrrd along the chosen axis. perm[j] = i means that the ** value at position j in the _new_ array should come from position i ** in the _old_array. The standpoint is from the new, looking at ** where to find the values amid the old array (perm answers "what do ** I put here", not "where do I put this"). This allows multiple ** positions in the new array to copy from the same old position, and ** insures that there is an source for all positions along the new ** array. */ int nrrdShuffle(Nrrd *nout, const Nrrd *nin, unsigned int axis, const size_t *perm) { static const char me[]="nrrdShuffle", func[]="shuffle"; char buff2[AIR_STRLEN_SMALL]; /* Sun Feb 8 13:13:58 CST 2009: There was a memory bug here caused by using the same buff1[NRRD_DIM_MAX*30] declaration that had worked fine for nrrdAxesPermute and nrrdReshape, but does NOT work here because now samples along an axes are re-ordered, not axes, so its often not allocated for long enough to hold the string that's printed to it. Ideally there'd be another argument that says whether to document the shuffle in the content string, which would mean an API change. Or, we can use a secret heuristic (or maybe later a nrrdState variable) for determining when an axis is short enough to make documenting the shuffle interesting. This is useful since functions like nrrdFlip() probably do *not* need the shuffle (the sample reversal) to be documented for long axes */ #define LONGEST_INTERESTING_AXIS 42 char buff1[LONGEST_INTERESTING_AXIS*30]; unsigned int ai, ldim, len; size_t idxIn, idxOut, lineSize, numLines, size[NRRD_DIM_MAX], *lsize, cIn[NRRD_DIM_MAX+1], cOut[NRRD_DIM_MAX+1]; char *dataIn, *dataOut; if (!(nin && nout && perm)) { biffAddf(NRRD, "%s: got NULL pointer", me); return 1; } if (nout == nin) { biffAddf(NRRD, "%s: nout==nin disallowed", me); return 1; } if (!( axis < nin->dim )) { biffAddf(NRRD, "%s: axis %d outside valid range [0,%d]", me, axis, nin->dim-1); return 1; } len = AIR_CAST(unsigned int, nin->axis[axis].size); for (ai=0; aiblockSize = nin->blockSize; nrrdAxisInfoGet_nva(nin, nrrdAxisInfoSize, size); if (nrrdMaybeAlloc_nva(nout, nin->type, nin->dim, size)) { biffAddf(NRRD, "%s: failed to allocate output", me); return 1; } if (nrrdAxisInfoCopy(nout, nin, NULL, NRRD_AXIS_INFO_NONE)) { biffAddf(NRRD, "%s:", me); return 1; } /* the min and max along the shuffled axis are now meaningless */ nout->axis[axis].min = nout->axis[axis].max = AIR_NAN; /* do the safe thing first */ nout->axis[axis].kind = _nrrdKindAltered(nin->axis[axis].kind, AIR_FALSE); /* try cleverness */ if (!nrrdStateKindNoop) { if (0 == nrrdKindSize(nin->axis[axis].kind) || nrrdKindStub == nin->axis[axis].kind || nrrdKindScalar == nin->axis[axis].kind || nrrdKind2Vector == nin->axis[axis].kind || nrrdKind3Color == nin->axis[axis].kind || nrrdKind4Color == nin->axis[axis].kind || nrrdKind3Vector == nin->axis[axis].kind || nrrdKind3Gradient == nin->axis[axis].kind || nrrdKind3Normal == nin->axis[axis].kind || nrrdKind4Vector == nin->axis[axis].kind) { /* these kinds have no intrinsic ordering */ nout->axis[axis].kind = nin->axis[axis].kind; } } /* the skinny */ lineSize = 1; for (ai=0; aiaxis[ai].size; } numLines = nrrdElementNumber(nin)/lineSize; lineSize *= nrrdElementSize(nin); lsize = size + axis; ldim = nin->dim - axis; dataIn = AIR_CAST(char *, nin->data); dataOut = AIR_CAST(char *, nout->data); memset(cIn, 0, sizeof(cIn)); memset(cOut, 0, sizeof(cOut)); for (idxOut=0; idxOutcmtArr, 1); if (!nrrd->cmtArr->data) { /* sprintf(err, "%s: couldn't lengthen comment array", me); biffMaybeAdd(NRRD, err, useBiff); */ return 1; } nrrd->cmt[ii] = str; return 0; } /* ******** nrrdCommentClear() ** ** blows away comments, but does not blow away the comment airArray */ void nrrdCommentClear(Nrrd *nrrd) { if (nrrd) { airArrayLenSet(nrrd->cmtArr, 0); } } /* ******** nrrdCommentCopy() ** ** copies comments from one nrrd to another ** Existing comments in nout are blown away ** ** This does NOT use biff. */ int nrrdCommentCopy(Nrrd *nout, const Nrrd *nin) { /* static const char me[]="nrrdCommentCopy"; */ int E; unsigned int numc, ii; if (!(nout && nin)) { /* sprintf(err, "%s: got NULL pointer", me); biffMaybeAdd(NRRD, err, useBiff); */ return 1; } if (nout == nin) { /* can't satisfy semantics of copying with nout==nin */ return 2; } nrrdCommentClear(nout); numc = nin->cmtArr->len; E = 0; for (ii=0; iicmt[ii]); } if (E) { /* sprintf(err, "%s: couldn't add all comments", me); biffMaybeAdd(NRRD, err, useBiff); */ return 3; } return 0; } cmtk-3.0.0/Utilities/NrrdIO/parseNrrd.c0000644000177700000170000013112212041601331016712 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" /* ** _nrrdReadNrrdParseField() ** ** This is for parsing the stuff BEFORE the colon */ int _nrrdReadNrrdParseField(NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParseField"; char *next, *buff, *colon, *keysep; int ret, fld=nrrdField_unknown, noField, badField=AIR_FALSE; next = nio->line + nio->pos; /* determining if the line is a comment is simple */ if (NRRD_COMMENT_CHAR == next[0]) { return nrrdField_comment; } if (!( buff = airStrdup(next) )) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't allocate buffer!", me); return nrrdField_unknown; } /* #1: "...if you see a colon, then look for an equal sign..." */ /* Look for colon: if no colon, or failed to parse as a field, look for * equal sign, if that failed then error */ /* Let the separator be := */ /* Escape \n */ colon = strstr(buff, ": "); noField = !colon; if (colon) { *colon = '\0'; badField = ( nrrdField_unknown == (fld = airEnumVal(nrrdField, buff)) ); } if (noField || badField) { keysep = strstr(buff, ":="); if (!keysep) { if (noField) { biffMaybeAddf(useBiff, NRRD, "%s: didn't see \": \" or \":=\" in line", me); } else { biffMaybeAddf(useBiff, NRRD, "%s: failed to parse \"%s\" as field identifier", me, buff); } free(buff); return nrrdField_unknown; } free(buff); ret = nrrdField_keyvalue; } else { /* *colon = '\0'; */ /* else we successfully parsed a field identifier */ next += strlen(buff) + 2; free(buff); /* skip whitespace prior to start of first field descriptor */ next += strspn(next, _nrrdFieldSep); nio->pos = AIR_CAST(int, next - nio->line); ret = fld; } return ret; } /* ** NOTE: it is a common but unfortunate property of these parsers that ** they set values in the nrrd first, and then check their validity ** later. The reason for this is mostly the desire to centralize ** validity checking in one place, and right now that's in the ** _nrrdFieldCheck[] array of checkers */ static int _nrrdReadNrrdParse_nonfield(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); AIR_UNUSED(useBiff); /* char c; c= 10; write(2,&c,1); c= 69; write(2,&c,1); c=108; write(2,&c,1); c= 32; write(2,&c,1); c= 67; write(2,&c,1); c=104; write(2,&c,1); c=101; write(2,&c,1); c= 32; write(2,&c,1); c= 86; write(2,&c,1); c=105; write(2,&c,1); c=118; write(2,&c,1); c=101; write(2,&c,1); c= 33; write(2,&c,1); c= 10; write(2,&c,1); c= 10; write(2,&c,1); */ return 0; } static int _nrrdReadNrrdParse_comment(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_comment"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; /* this skips the '#' at nio->line[nio->pos] and any other ' ' and '#' */ if (nrrdCommentAdd(nrrd, info)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble adding comment", me); return 1; } return 0; } static int _nrrdReadNrrdParse_content(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_content"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (strlen(info) && !(nrrd->content = airStrdup(info))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't strdup() content", me); return 1; } return 0; } static int _nrrdReadNrrdParse_number(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { /* static const char me[]="_nrrdReadNrrdParse_number"; char *info; info = nio->line + nio->pos; if (1 != sscanf(info, NRRD_BIG_INT_PRINTF, &(nrrd->num))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse number \"%s\"", me, info); return 1; } */ AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); AIR_UNUSED(useBiff); /* It was decided to just completely ignore this field. "number" is ** entirely redundant with the (required) sizes field, and there is no ** need to save it to, or learn it from, the header. In fact the "num" ** field was eliminated from the Nrrd struct some time ago, in favor of ** the nrrdElementNumber() function. It may seem odd or unfortunate that ** ** number: Hank Hill sells propane and propane accessories ** ** is a valid field specification, but at least Peggy is proud ... */ return 0; } static int _nrrdReadNrrdParse_type(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_type"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (!(nrrd->type = airEnumVal(nrrdType, info))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse type \"%s\"", me, info); return 1; } if (_nrrdFieldCheck[nrrdField_type](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } #define _PARSE_ONE_VAL(FIELD, CONV, TYPE) \ if (1 != sscanf(info, CONV, &(FIELD))) { \ biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse " TYPE \ " from \"%s\"", me, info); \ return 1; \ } static int _nrrdReadNrrdParse_block_size(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_block_size"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (1 != airSingleSscanf(info, "%z", &(nrrd->blockSize))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse size_t" " from \"%s\"", me, info); } /* because blockSize and type fields may appear in any order, we can't use _nrrdFieldCheck[] */ return 0; } static int _nrrdReadNrrdParse_dimension(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_dimension"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _PARSE_ONE_VAL(nrrd->dim, "%u", "unsigned int"); if (_nrrdFieldCheck[nrrdField_dimension](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } /* ** checking nrrd->dim against zero is valid because it is initialized ** to zero, and, _nrrdReadNrrdParse_dimension() won't allow it to be ** set to anything outside the range [1, NRRD_DIM_MAX] */ #define _CHECK_HAVE_DIM \ if (0 == nrrd->dim) { \ biffMaybeAddf(useBiff, NRRD, \ "%s: don't yet have a valid dimension", me); \ return 1; \ } #define _CHECK_HAVE_SPACE_DIM \ if (0 == nrrd->spaceDim) { \ biffMaybeAddf(useBiff, NRRD, \ "%s: don't yet have a valid space dimension", me); \ return 1; \ } #define _CHECK_GOT_ALL_VALUES \ if (nrrd->dim != ret) { \ biffMaybeAddf(useBiff, NRRD, \ "%s: parsed %d values, but dimension is %d", \ me, ret, nrrd->dim); \ return 1; \ } static int _nrrdReadNrrdParse_sizes(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_sizes"; unsigned int ret; size_t val[NRRD_DIM_MAX]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; ret = airParseStrZ(val, info, _nrrdFieldSep, nrrd->dim); _CHECK_GOT_ALL_VALUES; nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoSize, val); /* HEY: this is a very imperfect check of excess info */ if (nrrd->dim+1 == airParseStrZ(val, info, _nrrdFieldSep, nrrd->dim+1)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d sizes", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_sizes](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_spacings(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_spacings"; unsigned int ret; double val[NRRD_DIM_MAX]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; ret = airParseStrD(val, info, _nrrdFieldSep, nrrd->dim); _CHECK_GOT_ALL_VALUES; nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoSpacing, val); /* HEY: this is a very imperfect check of excess info */ if (nrrd->dim+1 == airParseStrD(val, info, _nrrdFieldSep, nrrd->dim+1)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d spacings", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_spacings](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_thicknesses(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_thicknesses"; unsigned int ret; double val[NRRD_DIM_MAX]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; ret = airParseStrD(val, info, _nrrdFieldSep, nrrd->dim); _CHECK_GOT_ALL_VALUES; nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoThickness, val); /* HEY: this is a very imperfect check of excess info */ if (nrrd->dim+1 == airParseStrD(val, info, _nrrdFieldSep, nrrd->dim+1)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d thicknesses", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_thicknesses](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_axis_mins(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_axis_mins"; unsigned int ret; double val[NRRD_DIM_MAX]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; ret = airParseStrD(val, info, _nrrdFieldSep, nrrd->dim); _CHECK_GOT_ALL_VALUES; nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoMin, val); /* HEY: this is a very imperfect check of excess info */ if (nrrd->dim+1 == airParseStrD(val, info, _nrrdFieldSep, nrrd->dim+1)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d axis mins", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_axis_mins](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_axis_maxs(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_axis_maxs"; unsigned int ret; double val[NRRD_DIM_MAX]; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_DIM; ret = airParseStrD(val, info, _nrrdFieldSep, nrrd->dim); _CHECK_GOT_ALL_VALUES; nrrdAxisInfoSet_nva(nrrd, nrrdAxisInfoMax, val); /* HEY: this is a very imperfect check of excess info */ if (nrrd->dim+1 == airParseStrD(val, info, _nrrdFieldSep, nrrd->dim+1)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d axis maxs", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_axis_maxs](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } int _nrrdSpaceVectorParse(double val[NRRD_SPACE_DIM_MAX], char **hhP, unsigned int spaceDim, int useBiff) { static const char me[]="_nrrdSpaceVectorParse"; char *hh, *buff, sep[]=",)"; airArray *mop; unsigned int ret, dd; size_t length; mop = airMopNew(); hh = *hhP; /* skip past space */ length = strspn(hh, _nrrdFieldSep); hh += length; /* make sure we have something */ if (!*hh) { biffMaybeAddf(useBiff, NRRD, "%s: hit end of string before seeing (", me); airMopError(mop); return 1; } /* first, see if we're getting the non-vector */ if ( (strstr(hh, _nrrdNoSpaceVector) == hh) ) { if (!hh[strlen(_nrrdNoSpaceVector)] || strchr(_nrrdFieldSep, hh[strlen(_nrrdNoSpaceVector)])) { /* yes, we got the non-vector */ for (dd=0; dd spaceDim) { biffMaybeAddf(useBiff, NRRD, "%s: space dimension is %d, but seem to have %d " "coefficients", me, spaceDim, ret); airMopError(mop); return 1; } /* try to parse the values */ ret = airParseStrD(val, buff+1, ",", spaceDim); if (spaceDim != ret) { biffMaybeAddf(useBiff, NRRD, "%s: parsed %d values, but space dimension is %d", me, ret, spaceDim); airMopError(mop); return 1; } } /* probably not useful */ for (dd=spaceDim; ddline + nio->pos; _CHECK_HAVE_DIM; _CHECK_HAVE_SPACE_DIM; for (dd=0; dddim; dd++) { if (_nrrdSpaceVectorParse(nrrd->axis[dd].spaceDirection, &info, nrrd->spaceDim, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble getting space vector %d of %d", me, dd+1, nrrd->dim); return 1; } } if (strlen(info) != strspn(info, _nrrdFieldSep)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d directions", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_space_directions](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_centers(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_centers"; unsigned int ai; char *tok, *info, *last; airArray *mop; AIR_UNUSED(file); mop = airMopNew(); info = airStrdup(nio->line + nio->pos); airMopAdd(mop, info, airFree, airMopAlways); _CHECK_HAVE_DIM; for (ai=0; aidim; ai++) { tok = airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last); if (!tok) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't extract string for center %d of %d", me, ai+1, nrrd->dim); airMopError(mop); return 1; } if (!strcmp(tok, NRRD_UNKNOWN)) { nrrd->axis[ai].center = nrrdCenterUnknown; continue; } if (!strcmp(tok, NRRD_NONE)) { nrrd->axis[ai].center = nrrdCenterUnknown; continue; } if (!(nrrd->axis[ai].center = airEnumVal(nrrdCenter, tok))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse center \"%s\" for axis %d", me, tok, ai); airMopError(mop); return 1; } } if (airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d centers", me, nrrd->dim); airMopError(mop); return 1; } if (_nrrdFieldCheck[nrrdField_centers](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); airMopError(mop); return 1; } airMopOkay(mop); return 0; } static int _nrrdReadNrrdParse_kinds(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_kinds"; unsigned int ai; char *info, *tok, *last; airArray *mop; AIR_UNUSED(file); mop = airMopNew(); info = airStrdup(nio->line + nio->pos); airMopAdd(mop, info, airFree, airMopAlways); _CHECK_HAVE_DIM; for (ai=0; aidim; ai++) { tok = airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last); if (!tok) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't extract string for kind %d of %d", me, ai+1, nrrd->dim); airMopError(mop); return 1; } if (!strcmp(tok, NRRD_UNKNOWN)) { nrrd->axis[ai].kind = nrrdKindUnknown; continue; } if (!strcmp(tok, NRRD_NONE)) { nrrd->axis[ai].center = nrrdKindUnknown; continue; } if (!(nrrd->axis[ai].kind = airEnumVal(nrrdKind, tok))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse \"%s\" kind %d of %d", me, tok, ai+1, nrrd->dim); airMopError(mop); return 1; } } if (airStrtok(!ai ? info : NULL, _nrrdFieldSep, &last)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d kinds", me, nrrd->dim); airMopError(mop); return 1; } /* can't run this now because kinds can come before sizes, in which case the kind/size check in _nrrdFieldCheck_kinds will incorrectly flag an error ... if (_nrrdFieldCheck[nrrdField_kinds](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); airMopError(mop); return 1; } */ airMopOkay(mop); return 0; } static char * _nrrdGetQuotedString(char **hP, int useBiff) { static const char me[]="_nrrdGetQuotedString"; char *h, *buff, *ret; airArray *buffArr; unsigned int pos; airPtrPtrUnion appu; h = *hP; /* skip past space */ /* printf("!%s: h |%s|\n", me, h);*/ h += strspn(h, _nrrdFieldSep); /* printf("!%s: h |%s|\n", me, h);*/ /* make sure we have something */ if (!*h) { biffMaybeAddf(useBiff, NRRD, "%s: hit end of string before seeing opening \"", me); return NULL; } /* make sure we have a starting quote */ if ('"' != *h) { biffMaybeAddf(useBiff, NRRD, "%s: didn't start with \"", me); return NULL; } h++; /* parse string until end quote */ buff = NULL; appu.c = &buff; buffArr = airArrayNew(appu.v, NULL, sizeof(char), 2); if (!buffArr) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't create airArray", me); return NULL; } pos = airArrayLenIncr(buffArr, 1); /* pos should get 0 */ while (h[pos]) { /* printf("!%s: h+%d |%s|\n", me, pos, h+pos); */ if ('\"' == h[pos]) { break; } if ('\\' == h[pos] && '\"' == h[pos+1]) { h += 1; } buff[pos] = h[pos]; pos = airArrayLenIncr(buffArr, 1); } if ('\"' != h[pos]) { biffMaybeAddf(useBiff, NRRD, "%s: didn't see ending \" soon enough", me); return NULL; } h += pos + 1; buff[pos] = 0; ret = airStrdup(buff); airArrayNuke(buffArr); *hP = h; return ret; } static int _nrrdReadNrrdParse_labels(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_labels"; char *h; /* this is the "here" pointer which gradually progresses through all the labels (for all axes) */ unsigned int ai; char *info; AIR_UNUSED(file); /* because we have to correctly interpret quote marks, we can't simply rely on airParseStrS */ info = nio->line + nio->pos; /* printf("!%s: info |%s|\n", me, info); */ _CHECK_HAVE_DIM; h = info; for (ai=0; aidim; ai++) { if (!( nrrd->axis[ai].label = _nrrdGetQuotedString(&h, useBiff) )) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't get get label %d of %d\n", me, ai+1, nrrd->dim); return 1; } } if (strlen(h) != strspn(h, _nrrdFieldSep)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d labels", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_labels](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_units(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_units"; char *h; /* this is the "here" pointer which gradually progresses through all the units (for all axes) */ unsigned int ai; char *info; AIR_UNUSED(file); /* because we have to correctly interpret quote marks, we can't simply rely on airParseStrS */ info = nio->line + nio->pos; /* printf("!%s: info |%s|\n", me, info); */ _CHECK_HAVE_DIM; h = info; for (ai=0; aidim; ai++) { if (!( nrrd->axis[ai].units = _nrrdGetQuotedString(&h, useBiff) )) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't get get unit %d of %d\n", me, ai+1, nrrd->dim); return 1; } } if (strlen(h) != strspn(h, _nrrdFieldSep)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d units", me, nrrd->dim); return 1; } if (_nrrdFieldCheck[nrrdField_units](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_min(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); AIR_UNUSED(useBiff); /* This field is no longer assumed to be anything meaningful, because nrrd->min no longer exists with the advent of NrrdRange. But, having the field is not an error, to not trip on older NRRD00.01 and NRRD0001 files which (legitimately) used it */ return 0; } static int _nrrdReadNrrdParse_max(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); AIR_UNUSED(useBiff); /* nrrd->max no longer exists, see above */ return 0; } static int _nrrdReadNrrdParse_old_min(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_old_min"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _PARSE_ONE_VAL(nrrd->oldMin, "%lg", "double"); if (_nrrdFieldCheck[nrrdField_old_min](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_old_max(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_old_max"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _PARSE_ONE_VAL(nrrd->oldMax, "%lg", "double"); if (_nrrdFieldCheck[nrrdField_old_max](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_endian(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_endian"; char *info; AIR_UNUSED(file); AIR_UNUSED(nrrd); info = nio->line + nio->pos; if (!(nio->endian = airEnumVal(airEndian, info))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse endian \"%s\"", me, info); return 1; } return 0; } static int _nrrdReadNrrdParse_encoding(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_encoding"; char *info; int etype; AIR_UNUSED(file); AIR_UNUSED(nrrd); info = nio->line + nio->pos; if (!(etype = airEnumVal(nrrdEncodingType, info))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse encoding \"%s\"", me, info); return 1; } nio->encoding = nrrdEncodingArray[etype]; return 0; } static int _nrrdReadNrrdParse_line_skip(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_line_skip"; char *info; AIR_UNUSED(file); AIR_UNUSED(nrrd); info = nio->line + nio->pos; _PARSE_ONE_VAL(nio->lineSkip, "%u", "unsigned int"); /* now that its unsigned, what error checking can I do? if (!(0 <= nio->lineSkip)) { biffMaybeAddf(useBiff, NRRD, "%s: lineSkip value %d invalid", me, nio->lineSkip); return 1; } */ return 0; } static int _nrrdReadNrrdParse_byte_skip(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_byte_skip"; char *info; AIR_UNUSED(file); AIR_UNUSED(nrrd); info = nio->line + nio->pos; _PARSE_ONE_VAL(nio->byteSkip, "%ld", "long int"); /* this check is being removed to enable the undocumented (in the file format spec) ability to say "byte skip: -N-1" in order to skip backwards from EOF by N bytes ** if (!(-1 <= nio->byteSkip)) { ** biffMaybeAddf(useBiff, NRRD, ** "%s: byteSkip value %ld invalid", me, nio->byteSkip); ** return 1; ** } */ return 0; } static int _nrrdReadNrrdParse_keyvalue(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_keyvalue"; char *keysep, *line, *key, *value; AIR_UNUSED(file); /* we know this will find something */ line = airStrdup(nio->line); if (!line) { biffMaybeAddf(useBiff, NRRD, "%s: can't allocate parse line", me); return 1; } keysep = strstr(line, ":="); if (!keysep) { biffMaybeAddf(useBiff, NRRD, "%s: didn't see \":=\" key/value delimiter in \"%s\"", me, line); free(line); return 1; } keysep[0] = 0; keysep[1] = 0; key = line; value = keysep+2; /* convert escape sequences */ airUnescape(key); airUnescape(value); nrrdKeyValueAdd(nrrd, key, value); free(line); return 0; } static int _nrrdReadNrrdParse_sample_units(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_sample_units"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (strlen(info) && !(nrrd->sampleUnits = airStrdup(info))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't strdup() sampleUnits", me); return 1; } if (_nrrdFieldCheck[nrrdField_sample_units](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_space(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_space"; char *info; int space; AIR_UNUSED(file); info = nio->line + nio->pos; if (nio->seen[nrrdField_space_dimension]) { biffMaybeAddf(useBiff, NRRD, "%s: can't specify space after specifying " "space dimension (%d)", me, nrrd->spaceDim); return 1; } if (!(space = airEnumVal(nrrdSpace, info))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse space \"%s\"", me, info); return 1; } if (nrrdSpaceSet(nrrd, space)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } if (_nrrdFieldCheck[nrrdField_space](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_space_dimension(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_space_dimension"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (nio->seen[nrrdField_space]) { biffMaybeAddf(useBiff, NRRD, "%s: can't specify space dimension after specifying " "space (%s)", me, airEnumStr(nrrdSpace, nrrd->space)); return 1; } _PARSE_ONE_VAL(nrrd->spaceDim, "%u", "unsigned int"); if (_nrrdFieldCheck[nrrdField_space_dimension](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_space_units(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_space_units"; char *h; /* this is the "here" pointer which gradually progresses through all the units (for all axes) */ unsigned int ai; char *info; AIR_UNUSED(file); /* because we have to correctly interpret quote marks, we can't simply rely on airParseStrS */ info = nio->line + nio->pos; /* printf("!%s: info |%s|\n", me, info); */ _CHECK_HAVE_SPACE_DIM; h = info; for (ai=0; aispaceDim; ai++) { if (!( nrrd->spaceUnits[ai] = _nrrdGetQuotedString(&h, useBiff) )) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't get get space unit %d of %d", me, ai+1, nrrd->spaceDim); return 1; } } if (_nrrdGetQuotedString(&h, AIR_FALSE)) { biffMaybeAddf(useBiff, NRRD, "%s: seemed to have more than expected %d space units", me, nrrd->spaceDim); return 1; } if (_nrrdFieldCheck[nrrdField_space_units](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_space_origin(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_space_origin"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_SPACE_DIM; if (_nrrdSpaceVectorParse(nrrd->spaceOrigin, &info, nrrd->spaceDim, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse origin \"%s\"", me, info); return 1; } if (_nrrdFieldCheck[nrrdField_space_origin](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } static int _nrrdReadNrrdParse_measurement_frame(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_measurement_frame"; double colvec[NRRD_SPACE_DIM_MAX]; unsigned int dd, ii; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; _CHECK_HAVE_SPACE_DIM; for (dd=0; ddspaceDim; dd++) { /* we are going through the *columns* of the mf matrix */ if (_nrrdSpaceVectorParse(colvec, &info, nrrd->spaceDim, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble getting space vector %d of %d", me, dd+1, nrrd->spaceDim); return 1; } for (ii=0; iimeasurementFrame[dd][ii] = (ii < nrrd->spaceDim ? colvec[ii] : AIR_NAN); } } if (strlen(info) != strspn(info, _nrrdFieldSep)) { biffMaybeAddf(useBiff, NRRD, "%s: seem to have more than expected %d directions", me, nrrd->spaceDim); return 1; } for (dd=nrrd->spaceDim; ddmeasurementFrame[dd][ii] = AIR_NAN; } } if (_nrrdFieldCheck[nrrdField_measurement_frame](nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble", me); return 1; } return 0; } int _nrrdContainsPercentThisAndMore(const char *str, char thss) { const char *hh, *tmp; tmp = str; do { hh = strchr(tmp, '%'); if (!( hh && hh[1] )) { return 0; } if ('%' == hh[1]) { /* its an escaped % */ tmp = hh + 2; } else { break; } } while (tmp[0]); hh++; hh += strspn(hh, "0123456789"); if (!( hh[0] == thss )) { return 0; } hh += strcspn(hh, _nrrdFieldSep); return !!hh; } unsigned int _nrrdDataFNNumber(NrrdIoState *nio) { unsigned int ret; int ii; if (nio->dataFNFormat) { /* datafiles given in iterator form; count number of values */ ret = 0; for (ii = nio->dataFNMin; ((nio->dataFNStep > 0 && ii <= nio->dataFNMax) || (nio->dataFNStep < 0 && ii >= nio->dataFNMax)); ii += nio->dataFNStep) { ret += 1; } } else if (nio->dataFNArr->len) { /* datafiles given as an explicit list, or as a single file name, and in either case, nrrdDataFNAdd() is used to add them to the dataFNArr */ ret = nio->dataFNArr->len; } else { /* datafile is same as (attached) header file */ ret = 1; } return ret; } /* ** this always requires that the per-axis size fields have been set */ int _nrrdDataFNCheck(NrrdIoState *nio, Nrrd *nrrd, int useBiff) { static const char me[]="_nrrdDataFNCheck"; size_t pieceSize, pieceNum; char stmp[AIR_STRLEN_SMALL]; if (!nio->seen[nrrdField_sizes]) { biffMaybeAddf(useBiff, NRRD, "%s: sorry, currently can't handle " "multiple detached data files without first knowing " "the \"%s\" field", me, airEnumStr(nrrdField, nrrdField_sizes)); return 1; } if (nio->dataFileDim < nrrd->dim) { /* this requires that the per-axis size fields have been set */ _nrrdSplitSizes(&pieceSize, &pieceNum, nrrd, nio->dataFileDim); if (pieceNum != _nrrdDataFNNumber(nio)) { biffMaybeAddf(useBiff, NRRD, "%s: expected %s filenames (of %u-D pieces) " "but got %u", me, airSprintSize_t(stmp, pieceNum), nio->dataFileDim, _nrrdDataFNNumber(nio)); return 1; } } else { /* we're getting data in "slabs" with the same dimension as the nrrd, so for simplicity we assume that they're all equal size */ if (_nrrdDataFNNumber(nio) > nrrd->axis[nrrd->dim-1].size) { biffMaybeAddf(useBiff, NRRD, "%s: can't have more pieces (%u) than axis %u " "slices (%s) when nrrd dimension and " "datafile dimension are both %u", me, _nrrdDataFNNumber(nio), nrrd->dim-1, airSprintSize_t(stmp, nrrd->axis[nrrd->dim-1].size), nrrd->dim); return 1; } if ((double)nrrd->axis[nrrd->dim-1].size/_nrrdDataFNNumber(nio) != nrrd->axis[nrrd->dim-1].size/_nrrdDataFNNumber(nio)) { biffMaybeAddf(useBiff, NRRD, "%s: number of datafiles (%d) doesn't divide into " "number of axis %u slices (%s)", me, (int)_nrrdDataFNNumber(nio), nrrd->dim-1, airSprintSize_t(stmp, nrrd->axis[nrrd->dim-1].size)); return 1; } } return 0; } /* ** Sat Jan 29 16:44:50 EST 2005: this used to "open the separate ** datafile, and set the FILE* in nio->dataFile, which otherwise will ** stay NULL", but now we support multiple detached data files. So. ** ** The job of this function is to map the "data file" specification to ** one or more filenames that can be passed direction to fopen for ** reading in the data. This involves parsing the various formats for ** identifying multiple data files, and possibly prefixing them with ** nio->path. */ static int _nrrdReadNrrdParse_data_file(FILE *ffile, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_data_file"; char *info, *nums; unsigned int linelen, tmp; airArray *mop; mop = airMopNew(); info = airStrdup(nio->line + nio->pos); if (!info) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't copy line!", me); return 1; } airMopAdd(mop, info, airFree, airMopAlways); /* HEY: this change should be made someday if (_nrrdContainsPercentThisAndMore(info, 'd') || _nrrdContainsPercentThisAndMore(info, 'u')) { */ if (_nrrdContainsPercentThisAndMore(info, 'd')) { /* ---------------------------------------------------------- */ /* --------- format.%d [] ----------- */ /* ---------------------------------------------------------- */ size_t sspn; _CHECK_HAVE_DIM; nums = info + strcspn(info, _nrrdFieldSep); sspn = strspn(nums, _nrrdFieldSep); nums[0] = 0; /* terminate so that format is now in info */ nums += sspn; if (!( 3 == sscanf(nums, "%d %d %d",&(nio->dataFNMin), &(nio->dataFNMax), &(nio->dataFNStep)) )) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse three ints (min, max, step) after " "data filename template", me); airMopError(mop); return 1; } if ( 4 == sscanf(nums, "%d %d %d %u", &(nio->dataFNMin), &(nio->dataFNMax), &(nio->dataFNStep), &(nio->dataFileDim)) ) { if (!AIR_IN_CL(1, nio->dataFileDim, nrrd->dim)) { biffMaybeAddf(useBiff, NRRD, "%s: datafile dimension %u outside valid range [1,%u]", me, nio->dataFileDim, nrrd->dim); airMopError(mop); return 1; } } else { nio->dataFileDim = nrrd->dim-1; } if (0 == nio->dataFNStep) { biffMaybeAddf(useBiff, NRRD, "%s: file number step must be non-zero", me); airMopError(mop); return 1; } if ((nio->dataFNMax - nio->dataFNMin)*(nio->dataFNStep) < 0) { biffMaybeAddf(useBiff, NRRD, "%s: file number max %d not approached from min %d " "by step %d", me, nio->dataFNMax, nio->dataFNMin, nio->dataFNStep); airMopError(mop); return 1; } if (!( nio->dataFNFormat = airStrdup(info) )) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't copy data filename format", me); airMopError(mop); return 1; } if (_nrrdDataFNCheck(nio, nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble with number of datafiles", me); airMopError(mop); return 1; } } else if (!strncmp(info, NRRD_LIST_FLAG, strlen(NRRD_LIST_FLAG))) { /* ---------------------------------------------------------- */ /* ------------------------- LIST --------------------------- */ /* ---------------------------------------------------------- */ _CHECK_HAVE_DIM; if (_nrrdHeaderCheck(nrrd, nio, AIR_TRUE)) { biffMaybeAddf(useBiff, NRRD, "%s: NRRD header is incomplete. \"" NRRD_LIST_FLAG "\" data file specification must be " "contiguous with end of header!", me); airMopError(mop); return 1; } info += strlen(NRRD_LIST_FLAG); if (info[0]) { if (1 == sscanf(info, "%u", &(nio->dataFileDim))) { if (!AIR_IN_CL(1, nio->dataFileDim, nrrd->dim)) { biffMaybeAddf(useBiff, NRRD, "%s: datafile dimension %u outside " "valid range [1,%u]", me, nio->dataFileDim, nrrd->dim); airMopError(mop); return 1; } } else { biffMaybeAddf(useBiff, NRRD, "%s: couldn't parse info after \"" NRRD_LIST_FLAG "\" as an int", me); airMopError(mop); return 1; } } else { /* nothing after NRRD_LIST_FLAG, so dataFileDim is implicit */ nio->dataFileDim = nrrd->dim-1; } /* read in all the datafile names */ do { /* yes, nio->line is re-used/over-written here, but I don't think that's a problem */ if (_nrrdOneLine(&linelen, nio, ffile)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble getting file name line", me); airMopError(mop); return 1; } if (linelen > 0) { tmp = airArrayLenIncr(nio->dataFNArr, 1); nio->dataFN[tmp] = airStrdup(nio->line); } } while (linelen > 0); if (_nrrdDataFNCheck(nio, nrrd, useBiff)) { biffMaybeAddf(useBiff, NRRD, "%s: trouble with number of datafiles", me); airMopError(mop); return 1; } } else { /* ---------------------------------------------------------- */ /* -------------------- (single filename) ------------------- */ /* ---------------------------------------------------------- */ /* there is apparently only a single detached data file; for this its okay to not yet know nrrd->dim */ tmp = airArrayLenIncr(nio->dataFNArr, 1); nio->dataFN[tmp] = airStrdup(info); nio->dataFileDim = 0; } airMopOkay(mop); return 0; } /* ******** nrrdFieldInfoParse[NRRD_FIELD_MAX+1]() ** ** These are all for parsing the stuff AFTER the colon */ int (*nrrdFieldInfoParse[NRRD_FIELD_MAX+1])(FILE *, Nrrd *, NrrdIoState *, int) = { _nrrdReadNrrdParse_nonfield, _nrrdReadNrrdParse_comment, _nrrdReadNrrdParse_content, _nrrdReadNrrdParse_number, _nrrdReadNrrdParse_type, _nrrdReadNrrdParse_block_size, _nrrdReadNrrdParse_dimension, _nrrdReadNrrdParse_space, _nrrdReadNrrdParse_space_dimension, _nrrdReadNrrdParse_sizes, _nrrdReadNrrdParse_spacings, _nrrdReadNrrdParse_thicknesses, _nrrdReadNrrdParse_axis_mins, _nrrdReadNrrdParse_axis_maxs, _nrrdReadNrrdParse_space_directions, _nrrdReadNrrdParse_centers, _nrrdReadNrrdParse_kinds, _nrrdReadNrrdParse_labels, _nrrdReadNrrdParse_units, _nrrdReadNrrdParse_min, _nrrdReadNrrdParse_max, _nrrdReadNrrdParse_old_min, _nrrdReadNrrdParse_old_max, _nrrdReadNrrdParse_endian, _nrrdReadNrrdParse_encoding, _nrrdReadNrrdParse_line_skip, _nrrdReadNrrdParse_byte_skip, _nrrdReadNrrdParse_keyvalue, _nrrdReadNrrdParse_sample_units, _nrrdReadNrrdParse_space_units, _nrrdReadNrrdParse_space_origin, _nrrdReadNrrdParse_measurement_frame, _nrrdReadNrrdParse_data_file }; /* kernel parsing is all in kernel.c */ cmtk-3.0.0/Utilities/NrrdIO/encodingRaw.c0000644000177700000170000001616212041601331017220 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" static int _nrrdEncodingRaw_available(void) { return AIR_TRUE; } static int _nrrdEncodingRaw_read(FILE *file, void *data, size_t elementNum, Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdEncodingRaw_read"; size_t ret, bsize; int fd, dio, car; long savePos; char *data_c; size_t elementSize, maxChunkSize, remainderValue, chunkSize; size_t retTmp; char stmp[3][AIR_STRLEN_SMALL]; bsize = nrrdElementSize(nrrd)*elementNum; if (nio->format->usesDIO) { fd = fileno(file); dio = airDioTest(fd, data, bsize); } else { fd = -1; dio = airNoDio_format; } if (airNoDio_okay == dio) { if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "with direct I/O ... "); } ret = airDioRead(fd, data, bsize); if (ret != bsize) { biffAddf(NRRD, "%s: airDioRead got read only %s of %sbytes " "(%g%% of expected)", me, airSprintSize_t(stmp[0], ret), airSprintSize_t(stmp[1], bsize), 100.0*AIR_CAST(double, ret)/AIR_CAST(double, bsize)); return 1; } } else { if (2 <= nrrdStateVerboseIO) { if (AIR_DIO && nio->format->usesDIO) { fprintf(stderr, "with fread(), not DIO: %s ...", airNoDioErr(dio)); } } /* HEY: There's a bug in fread/fwrite in gcc 4.2.1 (with SnowLeopard). When it reads/writes a >=2GB data array, it pretends to succeed (i.e. the return value is the right number) but it hasn't actually read/written the data. The work-around is to loop over the data, reading/writing 1GB (or smaller) chunks. */ ret = 0; data_c = (char *)data; elementSize = nrrdElementSize(nrrd); maxChunkSize = 1024 * 1024 * 1024 / elementSize; while(ret < elementNum) { remainderValue = elementNum-ret; if (remainderValue < maxChunkSize) { chunkSize = remainderValue; } else { chunkSize = maxChunkSize; } retTmp = fread(&(data_c[ret*elementSize]), elementSize, chunkSize, file); ret += retTmp; if (retTmp != chunkSize) { biffAddf(NRRD, "%s: fread got only %s %s-sized things, not %s " "(%g%% of expected)", me, airSprintSize_t(stmp[0], ret), airSprintSize_t(stmp[1], nrrdElementSize(nrrd)), airSprintSize_t(stmp[2], elementNum), 100.0*AIR_CAST(double, ret)/AIR_CAST(double, elementNum)); return 1; } } car = fgetc(file); if (EOF != car) { if (1 <= nrrdStateVerboseIO) { fprintf(stderr, "%s: WARNING: finished reading raw data, " "but file not at EOF\n", me); } ungetc(car, file); } if (2 <= nrrdStateVerboseIO && nio->byteSkip && stdin != file) { savePos = ftell(file); if (!fseek(file, 0, SEEK_END)) { double frac = (AIR_CAST(double, bsize) /AIR_CAST(double, ftell(file) + 1)); fprintf(stderr, "(%s: used %g%% of file for nrrd data)\n", me, 100.0*frac); fseek(file, savePos, SEEK_SET); } } } return 0; } static int _nrrdEncodingRaw_write(FILE *file, const void *data, size_t elementNum, const Nrrd *nrrd, NrrdIoState *nio) { static const char me[]="_nrrdEncodingRaw_write"; int fd, dio; size_t ret, bsize; const char *data_c; size_t elementSize, maxChunkSize, remainderValue, chunkSize; size_t retTmp; char stmp[3][AIR_STRLEN_SMALL]; bsize = nrrdElementSize(nrrd)*elementNum; if (nio->format->usesDIO) { fd = fileno(file); dio = airDioTest(fd, data, bsize); } else { fd = -1; dio = airNoDio_format; } if (airNoDio_okay == dio) { if (2 <= nrrdStateVerboseIO) { fprintf(stderr, "with direct I/O ... "); } ret = airDioWrite(fd, data, bsize); if (ret != bsize) { biffAddf(NRRD, "%s: airDioWrite wrote only %s of %s bytes " "(%g%% of expected)", me, airSprintSize_t(stmp[0], ret), airSprintSize_t(stmp[1], bsize), 100.0*AIR_CAST(double, ret)/AIR_CAST(double, bsize)); return 1; } } else { if (2 <= nrrdStateVerboseIO) { if (AIR_DIO && nio->format->usesDIO) { fprintf(stderr, "with fread(), not DIO: %s ...", airNoDioErr(dio)); } } /* HEY: There's a bug in fread/fwrite in gcc 4.2.1 (with SnowLeopard). When it reads/writes a >=2GB data array, it pretends to succeed (i.e. the return value is the right number) but it hasn't actually read/written the data. The work-around is to loop over the data, reading/writing 1GB (or smaller) chunks. */ ret = 0; data_c = AIR_CAST(const char *, data); elementSize = nrrdElementSize(nrrd); maxChunkSize = 1024 * 1024 * 1024 / elementSize; while(ret < elementNum) { remainderValue = elementNum-ret; if (remainderValue < maxChunkSize) { chunkSize = remainderValue; } else { chunkSize = maxChunkSize; } retTmp = fwrite(&(data_c[ret*elementSize]), elementSize, chunkSize, file); ret += retTmp; if (retTmp != chunkSize) { biffAddf(NRRD, "%s: fwrite wrote only %s %s-sized things, not %s " "(%g%% of expected)", me, airSprintSize_t(stmp[0], ret), airSprintSize_t(stmp[1], nrrdElementSize(nrrd)), airSprintSize_t(stmp[2], elementNum), 100.0*AIR_CAST(double, ret)/AIR_CAST(double, elementNum)); return 1; } } fflush(file); /* if (ferror(file)) { biffAddf(NRRD, "%s: ferror returned non-zero", me); return 1; } */ } return 0; } const NrrdEncoding _nrrdEncodingRaw = { "raw", /* name */ "raw", /* suffix */ AIR_TRUE, /* endianMatters */ AIR_FALSE, /* isCompression */ _nrrdEncodingRaw_available, _nrrdEncodingRaw_read, _nrrdEncodingRaw_write }; const NrrdEncoding *const nrrdEncodingRaw = &_nrrdEncodingRaw; cmtk-3.0.0/Utilities/NrrdIO/formatEPS.c0000644000177700000170000000542512041601331016620 0ustar torstenman/* NrrdIO: stand-alone code for basic nrrd functionality Copyright (C) 2012, 2011, 2010, 2009 University of Chicago Copyright (C) 2008, 2007, 2006, 2005 Gordon Kindlmann Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NrrdIO.h" #include "privateNrrd.h" int _nrrdFormatEPS_available(void) { return AIR_FALSE; } int _nrrdFormatEPS_nameLooksLike(const char *filename) { return airEndsWith(filename, NRRD_EXT_EPS); } int _nrrdFormatEPS_fitsInto(const Nrrd *nrrd, const NrrdEncoding *encoding, int useBiff) { char me[]="_nrrdFormatEPS_fitsInto", err[AIR_STRLEN_MED]; AIR_UNUSED(nrrd); AIR_UNUSED(encoding); AIR_UNUSED(useBiff); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatEPS->name); biffMaybeAdd(NRRD, err, useBiff); return AIR_FALSE; } int _nrrdFormatEPS_contentStartsLike(NrrdIoState *nio) { AIR_UNUSED(nio); return AIR_FALSE; } int _nrrdFormatEPS_read(FILE *file, Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdReadEPS", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatEPS->name); biffAdd(NRRD, err); return 1; } int _nrrdFormatEPS_write(FILE *file, const Nrrd *nrrd, NrrdIoState *nio) { char me[]="_nrrdFormatEPS_write", err[AIR_STRLEN_MED]; AIR_UNUSED(file); AIR_UNUSED(nrrd); AIR_UNUSED(nio); sprintf(err, "%s: Sorry, %s format not available in NrrdIO", me, nrrdFormatEPS->name); biffAdd(NRRD, err); return 1; } const NrrdFormat _nrrdFormatEPS = { "EPS", AIR_FALSE, /* isImage */ AIR_FALSE, /* readable */ AIR_FALSE, /* usesDIO */ _nrrdFormatEPS_available, _nrrdFormatEPS_nameLooksLike, _nrrdFormatEPS_fitsInto, _nrrdFormatEPS_contentStartsLike, _nrrdFormatEPS_read, _nrrdFormatEPS_write }; const NrrdFormat *const nrrdFormatEPS = &_nrrdFormatEPS; cmtk-3.0.0/Utilities/CMakeLists.txt0000644000177700000170000000472711672737433016251 0ustar torstenman## ## Copyright 1997-2009 Torsten Rohlfing ## ## Copyright 2004-2011 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 3631 $ ## ## $LastChangedDate: 2011-12-16 13:58:51 -0800 (Fri, 16 Dec 2011) $ ## ## $LastChangedBy: torstenrohlfing $ ## # turn off Windows security warnings for bundled code IF(${CMAKE_SYSTEM_NAME} MATCHES "Windows") ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows") IF(CMTK_BUILD_ZLIB) SUBDIRS(zlib) ENDIF(CMTK_BUILD_ZLIB) IF(CMTK_BUILD_NRRD) SUBDIRS(NrrdIO) ENDIF(CMTK_BUILD_NRRD) IF(CMTK_BUILD_DCMTK) SUBDIRS(dcmtk) ENDIF(CMTK_BUILD_DCMTK) IF(CMTK_BUILD_MXML) SUBDIRS(mxml) ENDIF(CMTK_BUILD_MXML) IF(CMTK_BUILD_SQLITE) SUBDIRS(sqlite3) ENDIF(CMTK_BUILD_SQLITE) # # If building test code, we need numdiff to tolerantly compare numerical results against baselines # IF(BUILD_TESTING) # Tets whether numdiff is already available FIND_PROGRAM(NUMDIFF_EXECUTABLE_SYSTEM numdiff PATHS /usr/bin /usr/local/bin /opt/local/bin ENV PATH) # If not available, build our own IF(EXISTS ${NUMDIFF_EXECUTABLE_SYSTEM}) MESSAGE(STATUS "Found numdiff executable at ${NUMDIFF_EXECUTABLE_SYSTEM}") SET(NUMDIFF_EXECUTABLE ${NUMDIFF_EXECUTABLE_SYSTEM} CACHE PATH "Path to numdiff executable" FORCE) ELSE(EXISTS ${NUMDIFF_EXECUTABLE_SYSTEM}) MESSAGE(STATUS "BUILD_TESTING is active - building numdiff for tolerant numerical comparisons") SUBDIRS(numdiff-5.2.1) SET(NUMDIFF_EXECUTABLE ${CMAKE_BINARY_DIR}/bin/numdiff CACHE PATH "Path to numdiff executable" FORCE) ENDIF(EXISTS ${NUMDIFF_EXECUTABLE_SYSTEM}) MARK_AS_ADVANCED(NUMDIFF_EXECUTABLE NUMDIFF_EXECUTABLE_SYSTEM) ENDIF(BUILD_TESTING) cmtk-3.0.0/Utilities/numdiff-5.2.1/0000755000177700000170000000000012263615445015563 5ustar torstenmancmtk-3.0.0/Utilities/numdiff-5.2.1/numutil.c0000644000177700000170000005207511666247630017440 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include "numdiff.h" #include #include /* for exit() */ #include #if defined(HAVE_LOCALECONV) && defined(USE_GMP) #include #endif /* HAVE_LOCALECONV and USE_GMP */ /* The following structure is used to store the canonical form of a real number. The canonical form corresponding to zero is .sgn = 0 .ipart = NULL .dpart = NULL .expn = 0 . If X is a non-null number with sign S (either + or -), integer part II...II (each I is a digit but the digits have not to be necessarily all equal), decimal part DD...DD (each D is a digit but the digits have not to be necessarily all equal) and exponent N, i.e. X = SII...II(decimal point)DD...DD * 10^N, then the canonical form of X is given by: .sgn = S .ipart = "II...II" .dpart = "DD...DD" and, denoted by NI the number of digits of the integer part and by NN the number of null digits after the decimal point (NN can be zero, for instance if the first digit of the decimal part is not null), +---- N + NI - 1, if NI > 0 | .expn = < | +---- N - NN - 1, if NI == 0 The exponent stored in the canonical form is then equal to the one that you would find in the scientific representation of the number. If the integer (decimal) part of X is zero, then .ipart (.dpart respectively) is the empty string. The string that one obtains by appending the decimal part to the integer part is what I call mantissa. Given two non-null numbers X and Y both in canonical form, they are equal if and only if they have the same sign, the same exponents and the same mantissa. */ struct canform { unsigned char sgn; char *ipart, *dpart; long expn; }; struct canform null = { 0, NULL, NULL, 0}; static char* anum (const char *str, const struct numfmt* pnf) { char *ptr; long digits, strscale; ptr = (char*)str; digits = 0; strscale = 0; if ( (*ptr == pnf->pos_sign) || (*ptr == pnf->neg_sign) ) move_ahead(ptr); if (pnf->grouping > 0) { while ( (is_digit((int)*ptr)) || *ptr == pnf->thsep ) { int first_sep = 1; if (*ptr == pnf->thsep) { unsigned long i; char* ptr2; if ((first_sep)) { for (ptr2 = ptr; ptr2 > str && (is_digit ((int)*(ptr2-1))); ptr2--); if ((i=ptr-ptr2) == 0 || i > pnf->grouping) { return (char*) str; } first_sep = 0; } for (ptr2 = ptr + 1; (is_digit((int)*ptr2)); ptr2++); if ((i=ptr2-ptr-1) != pnf->grouping) { return (char*) str; } ptr++; } else { move_ahead(ptr), digits++; } } } else { while ( (is_digit((int)*ptr)) ) { move_ahead(ptr), digits++; } } if (*ptr == pnf->dp) move_ahead(ptr); while ( (is_digit((int)*ptr)) ) move_ahead(ptr), strscale++; if (digits+strscale == 0) return (char*)str; if (TOLOWER(*ptr) == TOLOWER(pnf->ech) && !is_space (*(ptr+1))) { char *tail; long expn; expn = strtol (ptr + 1, &tail, 10); if (expn < MIN_EXPN && tail != ptr + 1) { fprintf (stderr, _("%s: a number with a too small exponent has been found,\nnamely \"%s\".\n"), PACKAGE, str); fprintf (stderr, _("Exponents smaller than %ld are not accepted,\n"), MIN_EXPN); fprintf (stderr, _("the execution of the program ends now\n")); exit (EXIT_TROUBLE); } if (expn > MAX_EXPN && tail != ptr + 1) { fprintf (stderr, _("%s: a number with a too large exponent has been found,\nnamely \"%s\".\n"), PACKAGE, str); fprintf (stderr, _("Exponents larger than %ld are not accepted,\n"), MAX_EXPN); fprintf (stderr, _("the execution of the program ends now\n")); exit (EXIT_TROUBLE); } return (tail != ptr + 1 ? tail : ptr); } else return ptr; } /* This function is going to be used in inout.c and util.c */ char* acxnum (const char *str, const struct numfmt* pnf) { char *ptr, *endrp, *ptr2; endrp = ptr = anum (str, pnf); if (ptr != str) { if (*ptr == pnf->iu) { return ptr + 1; } else { while (is_space (*ptr)) ptr++; if (*ptr == POS_SIGN || *ptr == NEG_SIGN) { ptr2 = anum (ptr, pnf); return (*ptr2 != pnf->iu ? endrp : ptr2 + 1); } else return endrp; } } else return ptr; } static char* snum (const char *str, const struct numfmt* pnf, struct canform* pcform) { char *ptr = (char*)str; char *it = pcform->ipart; int nonnull_digit_found = 0; long digits, strscale, nzeros, expn; char* tail; digits = strscale = 0; if ( (*ptr == pnf->pos_sign) ) { pcform->sgn = POS_SIGN; move_ahead(ptr); } else if ( (*ptr == pnf->neg_sign) ) { pcform->sgn = NEG_SIGN; move_ahead(ptr); } if (pnf->grouping > 0) { while ( (is_digit((int)*ptr)) || *ptr == pnf->thsep ) { int first_sep = 1; if (*ptr == pnf->thsep) { unsigned long i; char* ptr2; if ((first_sep)) { for (ptr2 = ptr; ptr2 > str && (is_digit ((int)*(ptr2-1))); ptr2--); if ((i=ptr-ptr2) == 0 || i > pnf->grouping) { return (char*) str; } first_sep = 0; } for (ptr2 = ptr + 1; (is_digit((int)*ptr2)); ptr2++); if ((i=ptr2-ptr-1) != pnf->grouping) { return (char*) str; } ptr++; } else { if ((nonnull_digit_found |= *ptr > CHAR_ZERO)) *it++ = *ptr; move_ahead(ptr), digits++; } } } else { while ( (is_digit((int)*ptr)) ) { if ((nonnull_digit_found |= *ptr > CHAR_ZERO)) *it++ = *ptr; move_ahead(ptr), digits++; } } if (*ptr == pnf->dp) { it = pcform->dpart; move_ahead(ptr); } while ( (is_digit((int)*ptr)) ) { for (nzeros = 0; *ptr == CHAR_ZERO; nzeros++, move_ahead(ptr)); strscale += nzeros; if ( (is_digit((int)*ptr)) ) { nonnull_digit_found = 1; for (; nzeros > 0; nzeros--) *it++ = CHAR_ZERO; *it++ = *ptr; move_ahead(ptr), strscale++; } } if (digits+strscale == 0) return (char*)str; if (!nonnull_digit_found) { free((void*)pcform->ipart); free((void*)pcform->dpart); pcform->ipart = pcform->dpart = NULL; pcform->sgn = 0; } if (TOLOWER(*ptr) == TOLOWER(pnf->ech) && !is_space (*(ptr+1))) { expn = strtol (ptr + 1, &tail, 10); if (tail != ptr + 1) { if (expn < MIN_EXPN) { fprintf (stderr, _("%s: a number with a too small exponent has been found,\nnamely \"%s\".\n"), PACKAGE, str); fprintf (stderr, _("Exponents smaller than %ld are not accepted,\n"), MIN_EXPN); fprintf (stderr, _("the execution of the program ends now\n")); exit (EXIT_TROUBLE); } if (expn > MAX_EXPN) { fprintf (stderr, _("%s: a number with a too large exponent has been found,\nnamely \"%s\".\n"), PACKAGE, str); fprintf (stderr, _("Exponents larger than %ld are not accepted,\n"), MAX_EXPN); fprintf (stderr, _("the execution of the program ends now\n")); exit (EXIT_TROUBLE); } pcform->expn = (nonnull_digit_found) ? expn : 0; return tail; } else { pcform->expn = 0; return ptr; } } else return ptr; } static int inc_with_check (long* pl, unsigned long r) { long l = *pl; unsigned long L; if (r == 0) return 0; else if (r > LONG_MAX) return -1; /* After this we are sure that 1 <= r <= LONG_MAX */ else if ( (long)r >= -l ) /* This is surely the case if l >= 0 */ { L = l + r; if (L > LONG_MAX) return -1; else { *pl = L; return 0; } } else { /* r < -l ==> l < r+l < 0 */ *pl = l + (long)r; return 0; } } static int dec_with_check (long* pl, unsigned long r) { long l = *pl; unsigned long L; if (r == 0) return 0; else if (r > LONG_MAX) return -1; /* After this we are sure that 1 <= r <= LONG_MAX */ else if ( (long)r >= l ) /* This is surely the case if l <= 0 */ { L = r - l; if (L > LONG_MAX) return -1; else { /* 0 <= r - l <= LONG_MAX ==> LONG_MIN <= -LONG_MAX <= l - r <= 0 */ *pl = -(long)L; return 0; } } else { /* r < l ==> 0 < l-r < l */ *pl = l - (long)r; return 0; } } static void msg_and_abort (const char* progname) { fprintf (stderr, "%s: number with too big mantissa or\nwith exponent out of the allowed range\n", progname); exit (EXIT_TROUBLE); } static void normalize (struct canform* pnum) { size_t lip, lnullprefix; char *ptr; if (!pnum || !pnum->ipart || !pnum->dpart) return; if (pnum->sgn == 0) pnum->sgn = POS_SIGN; if ( (lip = strlen (pnum->ipart)) > ULONG_MAX ) msg_and_abort (PACKAGE); if (lip != 0) { if ( inc_with_check (&pnum->expn, lip-1) != 0 ) msg_and_abort (PACKAGE); if ( *pnum->dpart == '\0' ) for (ptr = pnum->ipart + lip - 1; *ptr == CHAR_ZERO; *ptr-- = '\0'); } else { /* The integer part has zero length ==> decimal part with positive length */ for (lnullprefix = 0, ptr = pnum->dpart; *ptr == CHAR_ZERO; lnullprefix++, ptr++); if ( lnullprefix > ULONG_MAX ) msg_and_abort (PACKAGE); if ( dec_with_check (&pnum->expn, lnullprefix+1) != 0 ) msg_and_abort (PACKAGE); if ((lnullprefix)) { for (ptr = pnum->dpart + lnullprefix; *ptr != '\0'; ptr++) *(ptr-lnullprefix) = *ptr; *(ptr-lnullprefix) = '\0'; } } } static char* scxnum (const char *str, const struct numfmt* pnf, struct canform* pre, struct canform* pim) { char *ptr, *endrp, *ptr2; struct canform cform1, cform2; size_t slen = strlen (str); cform1.sgn = 0; cform1.ipart = stralloc (slen); cform1.dpart = stralloc (slen); cform1.expn = 0; endrp = ptr = snum (str, pnf, &cform1); #ifdef _SCXNUM_DEBUG_ fprintf (stderr, "%s -->\n sign = \'%c\'\n ip = \"%s\"\n dp = \"%s\"\n expn = %ld, tail = \"%s\n", str, cform1.sgn, cform1.ipart, cform1.dpart, cform1.expn, endrp); #endif if (ptr != str) { normalize (&cform1); #ifdef _SCXNUM_DEBUG_ fprintf (stderr, "After normalization:\n"); fprintf (stderr, "%s -->\n sign = \'%c\'\n ip = \"%s\"\n dp = \"%s\"\n expn = %ld, tail = \"%s\n", str, cform1.sgn, cform1.ipart, cform1.dpart, cform1.expn, endrp); #endif if (*ptr == pnf->iu) { /* We have read a pure imaginary number. */ *pre = null; *pim = cform1; return ptr + 1; } else { /* We have to check if we have read a pure real number or if we can read a full complex number. */ *pre = cform1; while (is_space (*ptr)) ptr++; if (*ptr == POS_SIGN || *ptr == NEG_SIGN) { cform2.sgn = 0; cform2.ipart = stralloc (slen); cform2.dpart = stralloc (slen); cform2.expn = 0; ptr2 = snum (ptr, pnf, &cform2); #ifdef _SCXNUM_DEBUG_ fprintf (stderr, "%s -->\n sign = \'%c\'\n ip = \"%s\"\n dp = \"%s\"\n expn = %ld, tail = \"%s\n", ptr, cform2.sgn, cform2.ipart, cform2.dpart, cform2.expn, ptr2); #endif if (*ptr2 == pnf->iu) { /* We have read a full complex number. */ normalize (&cform2); #ifdef _SCXNUM_DEBUG_ fprintf (stderr, "After normalization:\n"); fprintf (stderr, "%s -->\n sign = \'%c\'\n ip = \"%s\"\n dp = \"%s\"\n expn = %ld, tail = \"%s\n", ptr, cform2.sgn, cform2.ipart, cform2.dpart, cform2.expn, ptr2); #endif *pim = cform2; return ptr2 + 1; } else { /* We have read a pure real number. */ free ((void*) cform2.ipart); free ((void*) cform2.dpart); *pim = null; return endrp; } } else { /* We have read a pure real number. */ *pim = null; return endrp; } } } else { /* We have read no valid number, clean and return. */ free ((void*) cform1.ipart); free ((void*) cform1.dpart); *pre = *pim = null; return ptr; } } /* The following function compares two canonic forms of numerical values. It returns 0 if they are equal, 1 if they differ. */ static int compare_canonic_forms (struct canform x, struct canform y) { char *px, *py; int ppx, ppy; if (!x.ipart && !x.dpart) { /* If `x' is zero, then */ return ((y.ipart) || (y.dpart) ? 1 : 0); /* return 1 if `y' is not zero, */ /* 0 if also `y' is zero */ } else { /* If `x' is not zero, then */ if (!y.ipart && !y.dpart) return 1; /* return 1 if `y' is zero */ /* If both `x' and `y' are not zero */ /* we need a detailed comparison */ if (x.sgn != y.sgn) return 1; if (x.expn != y.expn) return 1; /* After comparing signs and exponents */ /* we compare the mantissas */ ppx = ppy = 0; px = x.ipart; py = y.ipart; /* Explanation about the meaning of `ppx' and `ppy': `ppx' (`ppy') is 0 as long as `px' (`py') points to a character in the string `x.ipart' (`y.ipart'), `ppx' (`ppy') is 1 when `px' (`py') points to a character in the string `x.dpart' (`y.dpart'), and becomes 2 after that both `x.ipart' and `x.dpart' (`y.ipart' and `y.dpart') have been scanned */ do { for ( ; *px != '\0' && *py != '\0' && *px == *py; px++, py++); if (*px == '\0') { ppx++; if (ppx == 1) px = x.dpart; } if (*py == '\0') { ppy++; if (ppy == 1) py = y.dpart; } } while (*px == *py && ppx < 2 && ppy < 2); return (*px != *py); } } /* The following function compares `str1' and `str2' assuming that they both contain a valid (possibly complex) number and neglecting differences in the numeric format. To be sure that the contents of `str1' and `str2' correspond to valid numbers, call before acxnum() on `str1' and `str2'. This function returns !0 to mean that the numeric contents of `str1' and `str2' differ, else 0. This function is going to be used in util.c */ int compare_numeric_strings (const char *str1, const struct numfmt* pnf1, const char *str2, const struct numfmt* pnf2) { struct canform re1, im1, re2, im2; int re_differ, im_differ; scxnum (str1, pnf1, &re1, &im1); scxnum (str2, pnf2, &re2, &im2); re_differ = compare_canonic_forms (re1, re2); im_differ = compare_canonic_forms (im1, im2); /* Clean the memory before returning the result of the comparison */ if ((re1.ipart)) free ((void*)re1.ipart); if ((re1.dpart)) free ((void*)re1.dpart); if ((im1.ipart)) free ((void*)im1.ipart); if ((im1.dpart)) free ((void*)im1.dpart); if ((re2.ipart)) free ((void*)re2.ipart); if ((re2.dpart)) free ((void*)re2.dpart); if ((im2.ipart)) free ((void*)im2.ipart); if ((im2.dpart)) free ((void*)im2.dpart); return (re_differ || im_differ); } #define HNDDULONG 80 static void hash_canonic_form (struct canform num, int pos_flag, hash_value* ph) { char *ptr, exp_ch[HNDDULONG+1]; size_t li, ld, le; int s_exp = (num.expn >= 0) ? 1 : -1; unsigned long abs_exp = num.expn * s_exp; li = (num.ipart) ? strlen(num.ipart) : 0; ld = (num.dpart) ? strlen(num.dpart) : 0; exp_ch[HNDDULONG] = '\0'; for (le = 0; abs_exp != 0; le++, abs_exp /= 10) exp_ch[HNDDULONG-1-le] = (char)(abs_exp % 10) + CHAR_ZERO; if (le > 0) exp_ch[HNDDULONG-1-le] = (s_exp < 0) ? NEG_SIGN : POS_SIGN; else exp_ch[HNDDULONG-1] = CHAR_ZERO; s_exp = HNDDULONG-2-le; exp_ch[s_exp] = ECH; if (li == 0 && ld == 0) { *ph = HASH (*ph, (unsigned char) CHAR_ZERO); *ph = HASH (*ph, (unsigned char) ECH); *ph = HASH (*ph, (unsigned char) CHAR_ZERO); } else { if (num.sgn == NEG_SIGN) *ph = HASH (*ph, (unsigned char) NEG_SIGN); else { if ((pos_flag)) *ph = HASH (*ph, (unsigned char) POS_SIGN); } if (li > 0) { *ph = HASH (*ph, (unsigned char) *num.ipart); if (li > 1 || ld > 0) *ph = HASH (*ph, (unsigned char) DP); for (ptr = num.ipart+1; *ptr != '\0'; ptr++) *ph = HASH (*ph, (unsigned char) *ptr); if (ld > 0) { for (ptr = num.dpart; *ptr != '\0'; ptr++) *ph = HASH (*ph, (unsigned char) *ptr); } } else /* li == 0 but ld > 0 */ { *ph = HASH (*ph, (unsigned char) *num.dpart); if (ld > 1) { *ph = HASH (*ph, (unsigned char) DP); for (ptr = num.dpart+1; *ptr != '\0'; ptr++) *ph = HASH (*ph, (unsigned char) *ptr); } } for (ptr = exp_ch + s_exp; *ptr != '\0'; ptr++) *ph = HASH (*ph, (unsigned char) *ptr); } } /* This function is going to be used in inout.c */ char* hcxnum (const char *str, const struct numfmt* pnf, hash_value *ph) { struct canform re, im; char *endptr; endptr = scxnum (str, pnf, &re, &im); if (endptr != str) { if ((im.ipart == NULL && im.dpart == NULL)) /* If the imaginary part is zero, hash only the real part */ hash_canonic_form (re, 0, ph); else { /* If the imaginary part is not zero but the real part is null, then hash only the imaginary part */ if ((re.ipart == NULL && re.dpart == NULL)) hash_canonic_form (im, 0, ph); else { /* If both real and imaginary part are not zero, hash both of them. The imaginary part must always be hashed with its sign */ hash_canonic_form (re, 0, ph); hash_canonic_form (im, 1, ph); } *ph = HASH (*ph, IU); } } /* Clean the memory and return */ if ((re.ipart)) free ((void*)re.ipart); if ((re.dpart)) free ((void*)re.dpart); if ((im.ipart)) free ((void*)im.ipart); if ((im.dpart)) free ((void*)im.dpart); return endptr; } #ifdef USE_GMP int mpf_a2num (Real* pr, const char *q, char** endptr, const struct numfmt* pnf) { struct canform cform; size_t slen = strlen (q); cform.sgn = 0; cform.ipart = stralloc (slen); cform.dpart = stralloc (slen); cform.expn = 0; *endptr = snum (q, pnf, &cform); if (*endptr != q) { char *ptr, *str; long e; size_t len, explen; #ifdef HAVE_LOCALECONV struct lconv *plconv = localeconv(); char* dec_point = plconv->decimal_point; #else /* not HAVE_LOCALECONV */ char* dec_point = "."; #endif /* not HAVE_LOCALECONV */ if (cform.ipart == NULL || cform.dpart == NULL) { /* The number contained in the string Q is zero */ mpf_set_ui (*pr, 0); return 0; } normalize (&cform); e = cform.expn >= 0 ? cform.expn : -cform.expn; for (len = 0; e != 0; len++, e /= 10); explen = len; if (cform.expn < 0) /* We need space for the minus sign in front of the exponent */ len++; if (cform.sgn == NEG_SIGN) /* We need space for the minus sign in front of the whole number */ len++; /* We need space also for the decimal point and the exponent letter */ len += strlen (cform.ipart) + strlen (cform.dpart) + strlen(dec_point) + 1; ptr = str = stralloc (len); if (cform.sgn == NEG_SIGN) { *ptr = NEG_SIGN; ptr++; } if (*cform.ipart != '\0') { *ptr = *cform.ipart; strcat (str, dec_point); strcat (str, cform.ipart+1); strcat (str, cform.dpart); } else { *ptr = *cform.dpart; strcat (str, dec_point); strcat (str, cform.dpart+1); } if (explen > 0) { for (ptr++; *ptr != '\0'; ptr++); *ptr = ECH; if (cform.expn < 0) { ptr++; *ptr = NEG_SIGN; } ptr += explen; for (e = cform.expn >= 0 ? cform.expn : -cform.expn; e != 0; ptr--, e /= 10) *ptr = CHAR_ZERO + e % 10; } if ( mpf_set_str (*pr, str, 10) == -1 ) { /* This should never happen. If mpf_set_str() returns -1, then */ /* there is something wrong with the code above. */ fprintf (stderr, _("The string \"%s\"\nis not a valid number, the execution of the program ends now\n"), str); free ((void*) cform.ipart); free ((void*) cform.dpart); free ((void*) str); exit (EXIT_TROUBLE); } else { free ((void*) cform.ipart); free ((void*) cform.dpart); free ((void*) str); return 0; } } /* *endptr != q */ else { /* We have read no valid number, then free the previously allocated memory, set the value pointed to by PR to zero and return -1 */ free ((void*) cform.ipart); free ((void*) cform.dpart); mpf_set_ui (*pr, 0); return -1; } /* *endptr == q */ } #endif /* USE_GMP */ cmtk-3.0.0/Utilities/numdiff-5.2.1/aclocal.m40000644000177700000170000000121711666247630017427 0ustar torstenman# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([m4/setmode.m4]) m4_include([m4/st_mtim.m4]) cmtk-3.0.0/Utilities/numdiff-5.2.1/flags.c0000644000177700000170000001337411666247630017036 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include"numdiff.h" #include /* Constants and default values */ #define CHUNK_ALLOC 20480 static flg_array internal_table; /* `table' must be the address of a `flg_array' structure. */ static int init_flg_array (flg_array* table) { if ((table)) { table->ptr = NULL; table->size = table->len = 0; return 0; } else return -1; } int init_flags (void) { return init_flg_array (&internal_table); } /* `table' must be the address of a `flg_array' structure. */ static int print_flg_array (FILE* fp, const flg_array* table) { size_t n; unsigned short i; unsigned char byte, elem; if (!table || !table->ptr) return (fputs (_("\n"), fp) == EOF); else { int outerror = 0; for (n = 0; !outerror && n < table->len; n += 4U) { byte = table->ptr[n/4U]; for (i = 0; i < 4U; i++) { if ( (elem = (byte & 0x03 << 2*i) >> 2 * i) ) { if ( fprintf (fp, "%u", elem) < 0 ) { outerror = 1; break; } } else break; } } if (!outerror) outerror = (fputc ('\n', fp) == EOF); return outerror; } } int print_flags (FILE* fp) { return print_flg_array (fp, &internal_table); } /* array must be the address of a `flg_array' structure. */ static void addnewelem (flg_array* array, unsigned char elem) { if (!array) return; if ( !array->ptr ) { array->ptr = xcalloc (CHUNK_ALLOC, sizeof (unsigned char)); array->size = CHUNK_ALLOC; array->ptr[0] = elem; array->len = 1; #ifdef __MEMDEBUG__ fprintf (stderr, "size = %6zu, len = %6zu, string:", array->size, array->len); print_flg_array (stderr, array); #endif } else { if (array->len == 4 * array->size - 1) { unsigned char* p; array->ptr = xrealloc (array->ptr, array->size + CHUNK_ALLOC); array->size += CHUNK_ALLOC; array->ptr[array->len / 4U] |= elem << 2 * (array->len % 4U); array->len++; /* Now array->len == 4 * array->"old"size */ for (p = array->ptr + array->len / 4; p < array->ptr + array->size; *p = 0, p++); #ifdef __MEMDEBUG__ fprintf (stderr, "size = %6zu, len = %6zu, string:", array->size, array->len); print_flg_array (stderr, array); #endif } else { array->ptr[array->len / 4U] |= elem << 2 * (array->len % 4U); array->len++; #ifdef __MEMDEBUG__ fprintf (stderr, "size = %6zu, len = %6zu, string:", array->size, array->len); print_flg_array (stderr, array); #endif } } } flg_array copy_of_intflagtab (void) { return internal_table; } /* array must be the address of a `flg_array' structure. */ static void destroy_flg_array (flg_array* array) { if ((array) && (array->ptr)) { free ((void*)array->ptr); array->ptr = NULL; array->size = array->len = 0; } } void erase_flags (void) { destroy_flg_array (&internal_table); } static void notedown_sdiff_common_lines (lin, lin); static void notedown_sdiff_hunk (struct change *); /* Next line number to be printed in the two input files. */ static lin next0, next1; /* * Note down the edit-script SCRIPT in the INTERNAL_TABLE. */ void notedown_sdiff_script (struct change *script) { next0 = next1 = - files[0].prefix_lines; print_script (script, notedown_sdiff_hunk); notedown_sdiff_common_lines (files[0].valid_lines, files[1].valid_lines); } /* Print lines common to both files in side-by-side format. */ static void notedown_sdiff_common_lines (lin limit0, lin limit1) { lin i0 = next0, i1 = next1; if (i0 != limit0 || i1 != limit1) { for (; i0 != limit0 && i1 != limit1; i0++, i1++) addnewelem (&internal_table, 3); for (; i1 != limit1; i1++) addnewelem (&internal_table, 2); for (; i0 != limit0; i0++) addnewelem (&internal_table, 1); } next0 = limit0; next1 = limit1; } /* Note down a hunk of an sdiff diff. This is a contiguous portion of a complete edit script, describing changes in consecutive lines. */ static void notedown_sdiff_hunk (struct change *hunk) { lin first0, last0, first1, last1; register lin i, j; /* Determine range of line numbers involved in each file. */ enum changes changes = analyze_hunk (hunk, &first0, &last0, &first1, &last1); if (!changes) return; /* Note down lines up to this change. */ notedown_sdiff_common_lines (first0, first1); /* Note down ``xxx | xxx '' lines */ if (changes == CHANGED) { for (i = first0, j = first1; i <= last0 && j <= last1; i++, j++) addnewelem (&internal_table, 3); changes = (i <= last0 ? OLD : 0) + (j <= last1 ? NEW : 0); next0 = first0 = i; next1 = first1 = j; } /* Note down `` > xxx '' lines */ if (changes & NEW) { for (j = first1; j <= last1; ++j) addnewelem (&internal_table, 2); next1 = j; } /* Note down ``xxx < '' lines */ if (changes & OLD) { for (i = first0; i <= last0; ++i) addnewelem (&internal_table, 1); next0 = i; } } cmtk-3.0.0/Utilities/numdiff-5.2.1/options.c0000644000177700000170000006547111666247630017442 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #define GDIFF_OPTIONS 1 /* Leave this inclusion at the begin, otherwise problems */ /* with the symbol __USE_FILE_OFFSET64 */ #include"numdiff.h" #include #include #include #include #include #include"getopt.h" #include"error.h" #include"xalloc.h" #ifdef _DMALLOC_ #include /* Useful only for the debugging */ #endif void print_version (const char* progname) { printf ("%s %s\n", progname, VERSION); printf ("Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 %s \n", /* TRANSLATORS: This is a proper name. See the gettext manual, section Names. Pronounciation is like "evaa-no pree-me". */ _("Ivano Primi")); printf (_("\ License GPLv3+: GNU GPL version 3 or later,\n\ see .\n\ This is free software: you are free to change and redistribute it.\n\ There is NO WARRANTY, to the extent permitted by law.\n")); #ifdef USE_GMP printf ("\n%s %s.\n", _("The software has been linked against\n\ the GNU Multiple Precision Arithmetic Library,\n\ version number"), gmp_version); #else /* not USE_GMP */ printf ("\n%s.\n", _("The software has been built with\n\ its own internal support for multiple precision arithmetic")); #endif /* not USE_GMP */ } void print_help (const char* progname) { puts (_("Usage:")); printf ("%s -h|--help|-v|--version %s\n\n", progname, _("or")); printf ("%s %s\n", progname, "[-s IFS][-a MAXERR][-r MAXERR][-2][-# PREC][-P][-N][-I][-d C1C2][-t C1C2][-g N1N2][-p C1C2][-n C1C2][-e C1C2][-i C1C2][-X 1:INT][-X 2:INT][-E][-D][-b][-V][-q][-S][-z 1:INT][-z 2:INT][-Z 1:INT][-Z 2:INT][-m][-H][-f[NUM]][-T][-l PATH][-o PATH] FILE1 FILE2"); printf (_("\nINT stays for a positive integer value or for a range of integer values,\nlike 1-, 3-5 or -7\n")); /* %%% */ printf (_("\nCompare putatively similar files line by line and field by field,\nignoring small numeric differences or/and different numeric formats\n\n")); printf ("-s, --separator=IFS\n %s\n %s\n", _("Specify the set of characters to use\n to split the input lines into fields"), _("(The default set of characters is space, tab and newline)")); printf ("-a, --absolute-tolerance=MAXERR\n %s\n %s\n", _("Specify the maximum absolute difference permitted\n before that two numeric fields are regarded as different"), _("(The default value is zero)")); printf ("-r, --relative-tolerance=MAXERR\n %s\n %s\n", _("Specify the maximum relative difference permitted\n before that two numeric fields are regarded as different"), _("(The default value is zero)")); printf ("-2, --strict\n %s\n", _("Order that two numerical values are regarded as equal only if\n both absolute and relative difference do not exceed\n the corresponding tolerance threshold")); printf ("-#, --digits=PREC\n %s\n", _("Specify the number of digits in the significands\n used in multiple precision arithmetic")); printf ("-P, --positive-differences\n %s\n", _("Ignore all differences due to numeric fields of the second file that\n are less than the corresponding numeric fields in the first file")); printf ("-N, --negative-differences\n %s\n", _("Ignore all differences due to numeric fields of the second file that\n are greater than the corresponding numeric fields in the first file")); printf ("-I, --ignore-case\n %s\n", _("Ignore changes in case while doing literal comparisons")); printf ("-d, --decimal-point=C1C2\n %s\n", _("Specify the characters representing the decimal point\n in the two files to compare")); printf ("-t, --thousands-separator=C1C2\n %s\n", _("Specify the characters representing the thousands separator\n in the two files to compare")); printf ("-g, --group-length=N1N2\n %s\n", _("Specify the number of digits forming each group of thousands\n in the two files to compare")); printf ("-p, --plus-prefix=C1C2\n %s\n", _("Specify the (optional) prefixes for positive values\n used in the two files to compare")); printf ("-n, --minus-prefix=C1C2\n %s\n", _("Specify the prefixes for negative values\n used in the two files to compare")); printf ("-e, --exponent-letter=C1C2\n %s\n", _("Specify the exponent letters\n used in the two files to compare")); printf ("-i, --imaginary-unit=C1C2\n %s\n", _("Specify the characters representing the imaginary unit\n in the two files to compare")); printf ("-X, --exclude=1:INT\n %s\n", _("Select the fields of the first file that have to be ignored")); printf ("-X, --exclude=2:INT\n %s\n", _("Select the fields of the second file that have to be ignored")); printf ("-E, --essential\n %s\n", _("While printing the differences between the two compared files\n show only the numerical ones")); printf ("-D, --dummy\n %s\n", _("While printing the differences between the two compared files\n neglect all the numerical ones (dummy mode)")); printf ("-b, --brief\n %s\n", _("Suppress all messages concerning the differences discovered\n in the structures of the two files")); printf ("-V, --verbose\n %s\n", _("For every couple of lines which differ in at least one field print\n an header to show how these lines appear in the two compared files")); printf ("-q, --quiet, --silent\n %s\n", _("Suppress all the standard output")); printf ("-S, --statistics\n %s\n", _("Add some statistics to the standard output")); printf ("-z, --blur-if-numerical=1:INT\n %s\n", _("Select the fields of the first file that have to be\n blurred during the synchronization procedure\n only if they turn out to be numeric")); printf ("-z, --blur-if-numerical=2:INT\n %s\n", _("Select the fields of the second file that have to be\n blurred during the synchronization procedure\n only if they turn out to be numeric")); printf ("-Z, --blur-unconditionally=1:INT\n %s\n", _("Select the fields of the first file that have to be\n unconditionally blurred during the synchronization procedure")); printf ("-Z, --blur-unconditionally=2:INT\n %s\n", _("Select the fields of the second file that have to be\n unconditionally blurred during the synchronization procedure")); printf ("-m, --minimal\n %s\n", _("During synchronization try hard to find a smaller set of changes")); printf ("-H, --speed-large-files\n %s\n", _("During synchronization assume large files and\n many scattered small changes")); printf ("-f, --test-filter[=NUM]\n %s\n %s\n %s\n %s\n", _("Run only the filter and then show the results of its\n attempt to synchronize the two files."), _("If \'NUM\' is zero or is not specified, output at most 130 columns per line."), _("If \'NUM\' is a positive number, output at most\n \'NUM\' columns per line."), _("If \'NUM\' is a negative number, do not output common lines\n and display at most -\'NUM\' columns per line.")); printf ("-T, --expand-tabs\n %s\n", _("Expand tabs to spaces in output while displaying the results of the\n synchronization procedure (meaningful only together with option -f)")); printf ("-l, --warnings-to=PATH\n %s\n", _("Redirect warning and error messages from stderr to the indicated file")); printf ("-o, --output=PATH\n %s\n", _("Redirect output from stdout to the indicated file")); printf ("-h, --help\n %s\n", _("Show help message and predefined settings")); printf ("-v, --version\n %s\n", _("Show version number, Copyright, Distribution Terms and NO-Warranty")); printf ("\n%s\n%s\n%s\n%s\n", _("The two arguments after the options are the names of the files to compare."), _("The complete paths of the files should be given,\na directory name is not accepted."), _("They cannot refer to the same file but one of them can be \"-\",\nwhich refers to stdin."), _("Exit status: 1 if files differ, 0 if they are equal, -1 (255) in case of error")); /* %%% */ puts (_("\n Default numeric format (for both files to compare):\n")); printf (_("Decimal point = `%c\'\n"), DP); printf (_("Thousands separator = `%c\'\n"), THSEP); printf (_("Number of digits in each thousands group = %u\n"), GROUPING); printf (_("Leading positive sign = `%c\'\n"), POS_SIGN); printf (_("Leading negative sign = `%c\'\n"), NEG_SIGN); printf (_("Prefix for decimal exponent = `%c\'\n"), ECH); printf (_("Symbol used to denote the imaginary unit = `%c\'\n\n"), IU); } static char* return_ifs (const char* optarg) { char *s = (char*) malloc ((strlen(optarg) + 1) * sizeof(char)); if(!s) return NULL; else { char *t, *u; strcpy (s, optarg); for (t = s; *t != '\0'; t++) { if (*t == '\\') { switch (*(t+1)) { case 'f': *t = '\f'; break; case 'n': *t = '\n'; break; case 'r': *t = '\r'; break; case 't': *t = '\t'; break; case 'v': *t = '\v'; break; default: *t = *(t+1); } for (u = t+1; *u != '\0'; *u = *(u+1), u++); } } return s; } } static int nfset (int opt_ch, const char* opt_arg, argslist* arg_list) { if (strlen(opt_arg) <= 2) { char _1st = *opt_arg, _2nd = *(opt_arg+1); switch (opt_ch) { case 'd': if ( (is_punct(_1st)) && (_2nd == '\0' || is_punct(_2nd)) ) { arg_list->optmask |= _D_MASK; arg_list->nf1.dp = _1st; arg_list->nf2.dp = (_2nd) ? _2nd : _1st; return 0; } break; case 't': if ( (is_punct(_1st)) && (_2nd == '\0' || is_punct(_2nd)) ) { arg_list->optmask |= _T_MASK; arg_list->nf1.thsep = _1st; arg_list->nf2.thsep = (_2nd) ? _2nd : _1st; return 0; } break; case 'e': if ( is_print(_1st) && (_2nd == '\0' || is_print(_2nd)) ) { arg_list->optmask |= _E_MASK; arg_list->nf1.ech = _1st; arg_list->nf2.ech = (_2nd) ? _2nd : _1st; return 0; } break; case 'n': if ( is_print(_1st) && (_2nd == '\0' || is_print(_2nd)) ) { arg_list->optmask |= _N_MASK; arg_list->nf1.neg_sign = _1st; arg_list->nf2.neg_sign = (_2nd) ? _2nd : _1st; return 0; } break; case 'i': if ( is_print(_1st) && (_2nd == '\0' || is_print(_2nd)) ) { arg_list->optmask |= _I_MASK; arg_list->nf1.iu = _1st; arg_list->nf2.iu = (_2nd) ? _2nd : _1st; return 0; } break; case 'p': if ( is_print(_1st) && (_2nd == '\0' || is_print(_2nd)) ) { arg_list->optmask |= _P_MASK; arg_list->nf1.pos_sign = _1st; arg_list->nf2.pos_sign = (_2nd) ? _2nd : _1st; return 0; } break; case 'g': if ( (is_digit(_1st)) && (_2nd == '\0' || is_digit(_2nd)) ) { arg_list->optmask |= _G_MASK; arg_list->nf1.grouping = _1st - '0'; arg_list->nf2.grouping = (_2nd) ? _2nd - '0': _1st - '0'; return 0; } break; } } return -1; } static int fselect (const char* str, unsigned char* mask, int mask_size) { long beg, end; unsigned long n; char *ptr, *endptr; beg = end = -1; if (!str || !*str) return 0; /* no field selected */ /* If we arrive here we are sure that *str != '\0' ! */ if ( strcmp (str, "@") == 0 ) { /* select all fields */ for (mask_size /= 8; mask_size > 0; mask_size--, mask[mask_size] = 0xFF); return 1; } if ((beg = strtol (str, &endptr, 10)) == 0 || beg > mask_size || beg < -mask_size) return -1; /* illegal input */ else if (beg < 0) { if (*endptr == '\0') { end = -beg; beg = 1; } else return -1; } else if (*endptr == '\0') end = beg; else if (*endptr == '-') { if (*(ptr = endptr + 1) == '\0') end = mask_size; else { if ((end = strtol (ptr, &endptr, 10)) <= 0 || *endptr != '\0' || end > mask_size) return -1; /* illegal input */ } } if (beg > end) return -1; else { for (n = beg - 1; n <= end - 1; n++) mask[n >> 3] |= 0x80 >> (n & 0x7); return 1; } } static int valid_numfmt (const struct numfmt* pnf) { char store[NUMFMT_CHARS]; int i, j; store[0] = pnf->dp; store[1] = pnf->thsep; store[2] = pnf->pos_sign; store[3] = pnf->neg_sign; store[4] = pnf->ech; store[5] = pnf->iu; for (i=0; i < NUMFMT_CHARS; i++) { for (j = i+1; j < NUMFMT_CHARS; j++) if (store[i] == store[j]) return 0; } return 1; } extern int optind; int setargs (int argc, char* argv[], argslist *list) { const char *optstring = "h2bVqDESIPNz:Z:mHT#:s:a:r:d:t:g:p:n:e:i:f::X:l:o:v"; struct option long_options[] = { {"help", 0, NULL, 'h'}, {"strict", 0, NULL, '2'}, {"brief", 0, NULL, 'b'}, {"verbose", 0, NULL, 'V'}, {"quiet", 0, NULL, 'q'}, {"silent", 0, NULL, 'q'}, {"dummy", 0, NULL, 'D'}, {"essential", 0, NULL, 'E'}, {"statistics", 0, NULL, 'S'}, {"ignore-case", 0, NULL, 'I'}, {"positive-differences", 0, NULL, 'P'}, {"negative-differences", 0, NULL, 'N'}, {"blur-if-numerical", 1, NULL, 'z'}, {"blur-unconditionally", 1, NULL, 'Z'}, {"minimal", 0, NULL, 'm'}, {"speed-large-files", 0, NULL, 'H'}, {"expand-tabs", 0, NULL, 'T'}, {"digits", 1, NULL, '#'}, {"separator", 1, NULL, 's'}, {"absolute-tolerance", 1, NULL, 'a'}, {"relative-tolerance", 1, NULL, 'r'}, {"decimal-point", 1, NULL, 'd'}, {"thousands-separator", 1, NULL, 't'}, {"group-length", 1, NULL, 'g'}, {"plus-prefix", 1, NULL, 'p'}, {"minus-prefix", 1, NULL, 'n'}, {"exponent-letter", 1, NULL, 'e'}, {"imaginary-unit", 1, NULL, 'i'}, {"test-filter", 2, NULL, 'f'}, {"exclude", 1, NULL, 'X'}, {"warnings-to", 1, NULL, 'l'}, {"output", 1, NULL, 'o'}, {"version", 0, NULL, 'v'}, {0, 0, 0, 0} }; int option_index=0; char *tail; int i, optch, off; unsigned int t; long w; unsigned char *bitmask; struct numfmt defaults; /* We start by loading the default values for the user settable options. The initialization of these variables: list->maxrelerr, list->maxabserr, list->Labserr, list->Crelerr, list->Lrelerr, list->Cabserr, list->N1abserr, list->N1disperr, list->N2abserr, list->N2disperr to Zero is done within main() through init_mpa_support() . */ suppress_common_lines = 0; ignore_white_space = IGNORE_NO_WHITE_SPACE; expand_tabs = 0; w = DEF_ATMOST_NCOLS; speed_large_files = 0; program_name = PACKAGE; list->optmask = 0x0; list->output_mode = OUTMODE_NORMAL; for (i=0; i < FIELDMASK_SIZE; list->ghostmask1[i] = list->ghostmask2[i] = list->tblurmask1[i] = list->tblurmask2[i] = list->pblurmask1[i] = list->pblurmask2[i] = 0x0, i++); list->relerr_formula = CLASSIC_FORMULA; list->Nentries = list->Ndisperr = 0; list->flag = 0; list->ifs1 = list->ifs2 = NULL; list->iscale = ISCALE; list->nf1.dp = DP; list->nf1.thsep = THSEP; list->nf1.grouping = GROUPING; list->nf1.pos_sign = POS_SIGN; list->nf1.neg_sign = NEG_SIGN; list->nf1.ech = ECH; list->nf1.iu = IU; list->file1 = list->file2 = NULL; defaults = list->nf2 = list->nf1; /* defaults.dp == DP defaults.thsep == THSEP; defaults.grouping == GROUPING; defaults.pos_sign == POS_SIGN; defaults.neg_sign == NEG_SIGN; defaults.ech == ECH; defaults.iu == IU; Since 'defaults' is not modified in the following we are sure that it will always contain these default values. */ while ( (optch = getopt_long (argc, argv, optstring, long_options, &option_index)) != -1 ) { switch (optch) { case 'h': list->optmask |= _H_MASK; break; case '2': list->optmask |= _2_MASK; break; case 'b': list->optmask |= _B_MASK; break; case 'V': list->optmask |= _SV_MASK; break; case 'q': list->optmask |= _Q_MASK; break; case 'D': list->optmask |= _SD_MASK; break; case 'E': list->optmask |= _SE_MASK; break; case 'S': list->optmask |= _SS_MASK; break; case 'I': list->optmask |= _SI_MASK; break; case 'P': list->optmask |= _SP_MASK; list->flag = 1; break; case 'N': list->optmask |= _SN_MASK; list->flag = -1; break; case 'z': if ( (i = strncmp (optarg, "1:", 2)) && (strncmp (optarg, "2:", 2)) ) { /* None of the prefixes 1: and 2: has been used, then we have to select fields for both files */ if (fselect (optarg, list->pblurmask1, FIELDMASK_SIZE*8) <= 0) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else { fselect (optarg, list->pblurmask2, FIELDMASK_SIZE*8); list->optmask |= _Z_MASK; } } else { bitmask = i == 0 ? list->pblurmask1 : list->pblurmask2; if (fselect (optarg+2, bitmask, FIELDMASK_SIZE*8) <= 0) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else list->optmask |= _Z_MASK; } break; case 'Z': if ( (i = strncmp (optarg, "1:", 2)) && (strncmp (optarg, "2:", 2)) ) { /* None of the prefixes 1: and 2: has been used, then we have to select fields for both files */ if (fselect (optarg, list->tblurmask1, FIELDMASK_SIZE*8) <= 0) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else { fselect (optarg, list->tblurmask2, FIELDMASK_SIZE*8); list->optmask |= _SZ_MASK; } } else { bitmask = i == 0 ? list->tblurmask1 : list->tblurmask2; if (fselect (optarg+2, bitmask, FIELDMASK_SIZE*8) <= 0) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else list->optmask |= _SZ_MASK; } break; case 'm': list->optmask |= _M_MASK; break; case 'H': list->optmask |= _SH_MASK; speed_large_files = 1; break; case 'T': expand_tabs = 1; break; case '#': list->iscale = strtol (optarg, &tail, 10); if (*tail != '\0' || list->iscale < 0 || list->iscale > MAX_ISCALE) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else list->optmask |= _X_MASK; break; case 's': if (*optarg == '1' && *(optarg+1) == ':') { if ((list->ifs1)) { free((void*)list->ifs1); list->ifs1 = NULL; } list->ifs1 = return_ifs (optarg+2); } else if (*optarg == '2' && *(optarg+1) == ':') { if ((list->ifs2)) { free((void*)list->ifs2); list->ifs2 = NULL; } list->ifs2 = return_ifs (optarg+2); } else { if ((list->ifs1)) { free((void*)list->ifs1); list->ifs1 = NULL; } if ((list->ifs2)) { free((void*)list->ifs2); list->ifs2 = NULL; } list->ifs1 = return_ifs (optarg); list->ifs2 = return_ifs (optarg); } if ( ((list->ifs1) && !strchr(list->ifs1, NEWLINE)) || ((list->ifs2) && !strchr(list->ifs2, NEWLINE)) ) { fprintf (stderr, _("%s: invalid argument after `-%c\' option:\n"), PACKAGE, optch); fprintf (stderr, _(" A list of field delimiters can not be empty and\n must always include the newline character (\'\\n\')\n")); return -1; } else list->optmask |= _S_MASK; break; case 'a': #ifndef USE_GMP delR (&list->maxabserr); /* To avoid unpleasant memory leaks */ #endif /* not USE_GMP */ str2R (optarg, &tail, ISCALE, &defaults, &list->maxabserr); if (*tail != '\0') { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else list->optmask |= _A_MASK; break; case 'r': #ifndef USE_GMP delR (&list->maxrelerr); /* To avoid unpleasant memory leaks */ #endif /* not USE_GMP */ if (*optarg == '1' && *(optarg+1) ==':') { list->relerr_formula = WR_TO_FIRST_FILE; str2R (optarg+2, &tail, ISCALE, &defaults, &list->maxrelerr); } else if (*optarg == '2' && *(optarg+1) ==':') { list->relerr_formula = WR_TO_SECOND_FILE; str2R (optarg+2, &tail, ISCALE, &defaults, &list->maxrelerr); } else str2R (optarg, &tail, ISCALE, &defaults, &list->maxrelerr); if (*tail != '\0') { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else list->optmask |= _R_MASK; break; case 'd': case 't': case 'g': case 'p': case 'n': case 'e': case 'i': if (nfset (optch, optarg, list) < 0) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } break; case 'f': if(!optarg) { /* There is no optional argument, then set */ /* 'w' to 'DEF_ATMOST_NCOLS'. */ list->optmask |= _F_MASK; w = DEF_ATMOST_NCOLS; } else { /* An argument follows */ w = strtol (optarg, &tail, 10); /* If the argument of the option is not a valid number, */ /* then exit after printing a suitable error message. */ if (*tail != '\0') { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else list->optmask |= _F_MASK; /* Otherwise you have to set 'w' appropriately. */ /* If the given argument is less than -MAX_ATMOST_NCOLS */ /* then set 'w' to 'DEF_ATMOST_NCOLS' and 'suppress_common_lines' to 'TRUE'. */ if (w < -MAX_ATMOST_NCOLS) { w = DEF_ATMOST_NCOLS; suppress_common_lines = 1; } /* If the argument were negative, then remove the sign */ /* and set 'suppress_common_lines' to 'TRUE'. */ if (w < 0) { w *= -1; suppress_common_lines = 1; } /* If the given argument is too small or too big in absolute value, */ /* then set 'w' to 'DEF_ATMOST_NCOLS'. */ if (w < MIN_ATMOST_NCOLS || w > MAX_ATMOST_NCOLS) w = DEF_ATMOST_NCOLS; /* Otherwise leave 'w' set to the value of the argument. */ } /* end optarg != 0 */ break; case 'X': if ( (i = strncmp (optarg, "1:", 2)) && (strncmp (optarg, "2:", 2)) ) { /* None of the prefixes 1: and 2: has been used, then we have to select fields for both files */ if (fselect (optarg, list->ghostmask1, FIELDMASK_SIZE*8) <= 0) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else { fselect (optarg, list->ghostmask2, FIELDMASK_SIZE*8); list->optmask |= _SX_MASK; } } else { bitmask = i == 0 ? list->ghostmask1 : list->ghostmask2; if (fselect (optarg+2, bitmask, FIELDMASK_SIZE*8) <= 0) { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE, optch); return -1; } else list->optmask |= _SX_MASK; } break; case 'l': if (!freopen (optarg, "w", stderr)) { fprintf (stderr, _("%s: cannot open file \"%s\":\n"), PACKAGE, optarg); perror(0); return -1; } break; case 'o': if (!freopen (optarg, "w", stdout)) { fprintf (stderr, _("%s: cannot open file \"%s\":\n"), PACKAGE, optarg); perror(0); return -1; } break; case 'v': list->optmask |= _V_MASK; break; default: /* fprintf (stderr, _("%s: unrecognized option `-%c\' \n"), PACKAGE, optch); */ return -1; } } t = expand_tabs ? 1 : TAB_WIDTH; off = (w + t + 3) / (2 * t) * t; sdiff_half_width = MAX (0, MIN (off - 3, w - off)), sdiff_column2_offset = sdiff_half_width ? off : w; if ( list->optmask & _SV_MASK ) list->output_mode = OUTMODE_VERBOSE; if ( list->optmask & _B_MASK ) list->output_mode = OUTMODE_BRIEF; if (list->optmask & _B_MASK && list->optmask & _SV_MASK) list->output_mode = OUTMODE_COINCISE; if ( list->optmask & _Q_MASK ) list->output_mode = OUTMODE_QUIET; if (!(list->optmask & (_H_MASK | _V_MASK)) && argc - optind != 2) { print_help (PACKAGE); return -1; } else if ( !valid_numfmt(&list->nf1) ) { fprintf (stderr, _("The numeric format specified for the first file is illegal,\n")); fprintf (stderr, _("the following symbols should be all different\nwhile two or more of them are actually equal:\n")); fprintf (stderr, _("\nDecimal point = `%c\'\n"), list->nf1.dp); fprintf (stderr, _("Thousands separator = `%c\'\n"), list->nf1.thsep); fprintf (stderr, _("Leading positive sign = `%c\'\n"), list->nf1.pos_sign); fprintf (stderr, _("Leading negative sign = `%c\'\n"), list->nf1.neg_sign); fprintf (stderr, _("Prefix for decimal exponent = `%c\'\n"), list->nf1.ech); fprintf (stderr, _("Symbol used to denote the imaginary unit = `%c\'\n\n"), list->nf1.iu); return -1; } else if ( !valid_numfmt(&list->nf2) ) { fprintf (stderr, _("The numeric format specified for the second file is illegal,\n")); fprintf (stderr, _("the following symbols should be all different\nwhile two or more of them are actually equal:\n")); fprintf (stderr, _("\nDecimal point = `%c\'\n"), list->nf2.dp); fprintf (stderr, _("Thousands separator = `%c\'\n"), list->nf2.thsep); fprintf (stderr, _("Leading positive sign = `%c\'\n"), list->nf2.pos_sign); fprintf (stderr, _("Leading negative sign = `%c\'\n"), list->nf2.neg_sign); fprintf (stderr, _("Prefix for decimal exponent = `%c\'\n"), list->nf2.ech); fprintf (stderr, _("Symbol used to denote the imaginary unit = `%c\'\n\n"), list->nf2.iu); return -1; } else { if( !(list->optmask & (_H_MASK | _V_MASK)) ) { list->file1 = (const char*) argv[optind]; list->file2 = (const char*) argv[optind+1]; } return 0; } } cmtk-3.0.0/Utilities/numdiff-5.2.1/new.c0000644000177700000170000002115611666247630016530 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include #include /* for isspace() */ #include #include"number.h" #include"numdiff.h" #ifdef _DMALLOC_ #include /* Useful only for debugging */ #endif #ifdef BC_A2NUM_DEBUG #define move_ahead(ptr) out_char_stderr(*ptr), ptr++ #define set(endptr,str) *endptr = (char*)str, fprintf (stderr, "tail: \"%s\"\n", *endptr) #else #define move_ahead(ptr) ptr++ #define set(endptr,str) *endptr = (char*)str #endif static bc_num bc_10_raised_to (long expn, int add_d_dig) { bc_num pw; if (expn >= 0) { pw = bc_new_num (1 + expn, 0); pw->n_value[0] = 1; } else { pw = bc_new_num (1, -expn + add_d_dig); pw->n_value[-expn] = 1; } #ifdef BC_10_DEBUG fprintf (stderr, "10^%ld = ", expn); pn_stderr (pw); #endif return pw; } static int bc_a2num (bc_num *num, const char *str, char **endptr, int scale, const struct numfmt* pnf) { char *ptr, *nptr; int digits, strscale; long expn; char zero_int; #ifdef BC_A2NUM_DEBUG fprintf (stderr, "\n\"%s\"\n", str); #endif /* Check for valid number and count digits. */ ptr = (char*)str; digits = 0; strscale = 0; zero_int = FALSE; if ( (*ptr == pnf->pos_sign) || (*ptr == pnf->neg_sign) ) move_ahead(ptr); /* Sign */ if (pnf->grouping > 0) { while ( (is_digit((int)*ptr)) || *ptr == pnf->thsep ) { int first_sep = 1; if (*ptr == pnf->thsep) { unsigned i; char* ptr2; if ((first_sep)) { /* We have to check that before the separator there is */ /* at least one digit but no more than 'pnf->grouping' */ for (i=0, ptr2 = ptr; ptr2 > str && (is_digit ((int)*(ptr2-1))); i++, ptr2--); if (i == 0 || i > pnf->grouping) { if ((endptr)) set(endptr,str); return -1; } first_sep = 0; } /* We have to check that after the separator */ /* there are exactly 'pnf->grouping' digits */ for (i = 0, ptr2 = ptr + 1; (is_digit((int)*ptr2)); i++, ptr2++); if (i != pnf->grouping) { if ((endptr)) set(endptr,str); return -1; } ptr++; } else /* We have just found a new digit */ move_ahead(ptr), digits++; } } else /* pnf->grouping == 0 */ { while ( (is_digit((int)*ptr)) ) move_ahead(ptr), digits++; /* digits */ } /* OLD CODE */ /* while ( (is_digit((int)*ptr)) ) */ /* ptr++, digits++; */ if (*ptr == pnf->dp) move_ahead(ptr); /* decimal point */ while (is_digit((int)*ptr)) move_ahead(ptr), strscale++; /* digits */ if (digits+strscale == 0) { if ((endptr)) set(endptr,str); *num = bc_copy_num (_zero_); return -1; } if (TOLOWER(*ptr) == TOLOWER(pnf->ech) && !is_space (*(ptr+1))) { char *tail; expn = strtol (ptr + 1, &tail, 10); if (expn < MIN_EXPN && tail != ptr + 1) { fprintf (stderr, _("%s: a number with a too small exponent has been found,\nnamely \"%s\".\n"), PACKAGE, str); fprintf (stderr, _("Exponents smaller than %ld are not accepted,\n"), MIN_EXPN); fprintf (stderr, _("the execution of the program ends now\n")); exit (EXIT_TROUBLE); } if (expn > MAX_EXPN && tail != ptr + 1) { fprintf (stderr, _("%s: a number with a too large exponent has been found,\nnamely \"%s\".\n"), PACKAGE, str); fprintf (stderr, _("Exponents larger than %ld are not accepted,\n"), MAX_EXPN); fprintf (stderr, _("the execution of the program ends now\n")); exit (EXIT_TROUBLE); } if ((endptr)) *endptr = tail != ptr + 1 ? tail : ptr; } else { expn = 0; if ((endptr)) *endptr = ptr; } #ifdef BC_A2NUM_DEBUG fprintf (stderr, "%c%ld\n", pnf->ech, expn); #endif /* Adjust numbers and allocate storage and initialize fields. */ strscale = MIN(strscale, scale); if (digits == 0) { zero_int = TRUE; digits = 1; } *num = bc_new_num (digits, strscale); /* Build the whole number. */ ptr = (char*)str; if (*ptr == pnf->neg_sign) { (*num)->n_sign = MINUS; ptr++; } else { (*num)->n_sign = PLUS; if (*ptr == pnf->pos_sign) ptr++; } nptr = (*num)->n_value; if ((zero_int)) { *nptr++ = 0; digits = 0; } for (; digits > 0; ptr++) { /* We have to take into account the presence of the thousands separator ! */ if (*ptr != pnf->thsep) { /* *ptr is a digit! */ *nptr++ = CH_VAL(*ptr); digits--; } } /* OLD CODE (to build the integer part) for (;digits > 0; digits--) *nptr++ = CH_VAL(*ptr++); */ /* Build the fractional part. */ if (strscale > 0) { ptr++; /* skip the decimal point! */ for (;strscale > 0; strscale--) *nptr++ = CH_VAL(*ptr++); } /* Take into account the exponent */ if((expn)) { bc_num Factor, Prod; bc_init_num (&Prod); Factor = expn > 0 ? bc_10_raised_to (expn, 0) : bc_10_raised_to (expn, scale); bc_multiply (*num, Factor, &Prod, strscale); *num = bc_copy_num (Prod); bc_free_num (&Factor); bc_free_num (&Prod); } #ifdef BC_A2NUM_DEBUG pn_stderr (*num); if((endptr)) fprintf (stderr, "tail: \"%s\"\n", *endptr); #endif return 0; } #define DIM 50 static void bc_print_num (bc_num num, void (* out_char)(int), int prec) { /* The negative sign if needed. */ if (num->n_sign == MINUS) (*out_char) ('-'); /* Output the number. */ if (num->n_value[0] == 10) { (*out_char) ('I'); (*out_char) ('n'); (*out_char) ('f'); } else if (bc_is_zero (num)) { (*out_char) ('0'); (*out_char) ('.'); for (; prec > 0; prec--) (*out_char) ('0'); } else { char *nptr; int index, ndig; signed char dig_list[DIM], *buffer, *p; long expn; assert ((buffer = calloc (prec + 1, sizeof (signed char)))); nptr = num->n_value; #ifdef __DEBUG__ pv ("nptr", nptr, num->n_len + num->n_scale); (*out_char)('\n'); #endif for (expn = num->n_len; expn > 0 && !*nptr; nptr++, expn--); /* Now expn == number of non-null digits */ /* in the integer part of the number */ if (expn == 0) { /* Now nptr points to the first digit */ /* of the fractional part. */ for (index = num->n_scale, expn = -1; !*nptr; index--, expn--, nptr++); /* Now expn is the exponent of the number */ /* in base 10. */ } else { expn--; /* Now expn is the exponent of the number */ /* in base 10. */ for (index = num->n_len + num->n_scale, nptr = num->n_value; !*nptr; index--, nptr++); } /* First we print the mantissa */ for (p = buffer, ndig = prec + 1; ndig > 0 && index > 0; ndig--, index--, p++, nptr++) *p = *nptr; if (ndig == 0 && index > 0) { /* Rounding */ if (*nptr >= 5) { for (--p; p > buffer && *p == 9; *p = 0, p--); if (p == buffer) { if (*p == 9) { *p = 1; expn++; } else (*p)++; } else (*p)++; } } (*out_char)(BCD_CHAR(*buffer)); (*out_char)('.'); for (index = 1; index <= prec; index++) (*out_char)(BCD_CHAR(buffer[index])); free((void*)buffer); /* Now it is the moment to print the exponent... */ (*out_char)('e'); if (expn < 0) { (*out_char) ('-'); expn = -expn; } else (*out_char) ('+'); for (index = 0; index < DIM; dig_list[index] = -1, index++); index = 0; do { dig_list[index] = expn % 10; expn /= 10; index++; } while ((expn)); for (index = 0; dig_list[index] >= 0; index++); for (--index; index >= 0; index--) (*out_char)(BCD_CHAR(dig_list[index])); /* .. done ! */ } /* End of num != 0 */ } cmtk-3.0.0/Utilities/numdiff-5.2.1/gettext.h0000644000177700000170000000653511666247630017434 0ustar torstenman/* Convenience header for conditional use of GNU . Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 /* NLS can be disabled through the configure --disable-nls option. */ #if ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include #else /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. We don't include as well because people using "gettext.h" will not include , and also including would fail on SunOS 4, whereas is OK. */ #if defined(__sun) # include #endif /* Many header files from the libstdc++ coming with g++ 3.3 or newer include , which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include # if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif /* Disabled NLS. The casts to 'const char *' serve the purpose of producing warnings for invalid uses of the value returned from these functions. On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # define gettext(Msgid) ((const char *) (Msgid)) # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define dngettext(Domainname, Msgid1, Msgid2, N) \ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) # define textdomain(Domainname) ((const char *) (Domainname)) # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) #endif /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. The argument, String, should be a literal string. Concatenated strings and other string expressions won't work. The macro's expansion is not parenthesized, so that it is suitable as initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String #endif /* _LIBGETTEXT_H */ cmtk-3.0.0/Utilities/numdiff-5.2.1/config.h.cmake0000644000177700000170000003070211726560156020263 0ustar torstenman/* // Copyright 2011, 2012 SRI International // // This file is part of the Computational Morphometry Toolkit. // // http://www.nitrc.org/projects/cmtk/ // // The Computational Morphometry Toolkit is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // The Computational Morphometry Toolkit 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 General Public License along // with the Computational Morphometry Toolkit. If not, see // . // // $Revision: 4001 $ // // $LastChangedDate: 2012-03-09 21:02:38 -0800 (Fri, 09 Mar 2012) $ // // $LastChangedBy: torsten_at_home $ */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #cmakedefine CRAY_STACKSEG_END 1 /* Define to 1 if using `alloca.c'. */ #cmakedefine C_ALLOCA 1 /* Define to 1 if you have `alloca', as a function or macro. */ #cmakedefine HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ #cmakedefine HAVE_ALLOCA_H 1 /* Define to 1 if you have the `bcopy' function. */ #cmakedefine HAVE_BCOPY 1 /* Define to 1 if you have the `btowc' function. */ #cmakedefine HAVE_BTOWC 1 /* Define to 1 if you have the `bzero' function. */ #cmakedefine HAVE_BZERO 1 /* Define to 1 if you have the `clock_gettime' function. */ #cmakedefine HAVE_CLOCK_GETTIME 1 /* Define to 1 if C supports variable-length arrays. */ #cmakedefine HAVE_C_VARARRAYS 1 /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_CLEARERR_UNLOCKED 1 /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FEOF_UNLOCKED 1 /* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FERROR_UNLOCKED 1 /* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FFLUSH_UNLOCKED 1 /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FGETS_UNLOCKED 1 /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FPUTC_UNLOCKED 1 /* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FPUTS_UNLOCKED 1 /* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FREAD_UNLOCKED 1 /* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_FWRITE_UNLOCKED 1 /* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_GETCHAR_UNLOCKED 1 /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_GETC_UNLOCKED 1 /* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_PUTCHAR_UNLOCKED 1 /* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you don't. */ #cmakedefine HAVE_DECL_PUTC_UNLOCKED 1 /* Define to 1 if you have the declaration of `strerror', and to 0 if you don't. */ #cmakedefine HAVE_DECL_STRERROR 1 /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #cmakedefine HAVE_DECL_STRERROR_R 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_DIRENT_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_FCNTL_H 1 /* Define to 1 if you have the `fork' function. */ #cmakedefine HAVE_FORK 1 /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIBINTL_H 1 /* Define to 1 if you have the `isascii' function. */ #cmakedefine HAVE_ISASCII 1 /* Define to 1 if you have the `gmp' library (-lgmp). */ #cmakedefine HAVE_LIBGMP 1 /* Define to 1 if you have the `localeconv' function. */ #cmakedefine HAVE_LOCALECONV 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LOCALE_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MEMORY_H 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_NDIR_H 1 /* Define to 1 if you have the `setlocale' function. */ #cmakedefine HAVE_SETLOCALE 1 /* Define to 1 if you have the DOS-style `setmode' function. */ #cmakedefine HAVE_SETMODE_DOS 1 /* Define to 1 if stdbool.h conforms to C99. */ #cmakedefine HAVE_STDBOOL_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDDEF_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDLIB_H 1 /* Define to 1 if you have the `strchr' function. */ #cmakedefine HAVE_STRCHR 1 /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R 1 /* Define to 1 if you have the `strftime' function. */ #cmakedefine HAVE_STRFTIME 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRING_H 1 /* Define to 1 if `st_blksize' is member of `struct stat'. */ #cmakedefine HAVE_STRUCT_STAT_ST_BLKSIZE 1 /* Define to 1 if `st_rdev' is member of `struct stat'. */ #cmakedefine HAVE_STRUCT_STAT_ST_RDEV 1 /* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ #cmakedefine HAVE_ST_BLKSIZE 1 /* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV' instead. */ #cmakedefine HAVE_ST_RDEV 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_SYS_DIR_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_FILE_H 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_SYS_NDIR_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TYPES_H 1 /* Define to 1 if you have that is POSIX.1 compatible. */ #cmakedefine HAVE_SYS_WAIT_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_TIME_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H 1 /* Define to 1 if you have the `vfork' function. */ #cmakedefine HAVE_VFORK 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_VFORK_H 1 /* Define to 1 if you have the `waitpid' function. */ #cmakedefine HAVE_WAITPID 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_WCHAR_H 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_WCTYPE_H 1 /* Define to 1 if `fork' works. */ #cmakedefine HAVE_WORKING_FORK 1 /* Define to 1 if `vfork' works. */ #cmakedefine HAVE_WORKING_VFORK 1 /* Define to 1 if the system has the type `_Bool'. */ #cmakedefine HAVE__BOOL 1 /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #cmakedefine NO_MINUS_C_MINUS_O 1 /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "@CMAKE_CONFIG_PACKAGE_BUGREPORT@" /* Define to the full name of this package. */ #define PACKAGE_NAME "@CMAKE_CONFIG_PACKAGE_NAME@" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "@CMAKE_CONFIG_PACKAGE_STRING@" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "@CMAKE_CONFIG_PACKAGE_TARNAME@" /* Define to the version of this package. */ #define PACKAGE_VERSION "@CMAKE_CONFIG_PACKAGE_VERSION@" /* Define to 1 if the `S_IS*' macros in do not work properly. */ #cmakedefine STAT_MACROS_BROKEN 1 /* Define to 1 if you have the ANSI C header files. */ #cmakedefine STDC_HEADERS 1 /* Define to 1 if strerror_r returns char *. */ #cmakedefine STRERROR_R_CHAR_P 1 /* Define to be the nanoseconds member of struct stat's st_mtim, if it exists. */ #cmakedefine ST_MTIM_NSEC 1 /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Define to 1 if you want getc etc. to use unlocked I/O if available. Unlocked I/O can improve performance in unithreaded apps, but it is not safe for multithreaded apps. */ #cmakedefine USE_UNLOCKED_IO 1 /* Number of bits in a file offset, on hosts where this is settable. */ #cmakedefine _FILE_OFFSET_BITS 1 /* Define for large files, on AIX-style hosts. */ #cmakedefine _LARGE_FILES 1 /* Define to 1 if on MINIX. */ #cmakedefine _MINIX 1 /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #cmakedefine _POSIX_1_SOURCE 1 /* Define to 1 if you need to in order for `stat' and other things to work. */ #cmakedefine _POSIX_SOURCE 1 /* Define to empty if `const' does not conform to ANSI C. */ #define const @CMAKE_CONFIG_CONST@ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #define inline @CMAKE_CONFIG_INLINE@ #endif /* Define to `int' if does not define. */ #define pid_t @CMAKE_CONFIG_PID_T@ /* Define to `int' if does not define. */ #define ptrdiff_t @CMAKE_CONFIG_PTRDIFF_T@ /* Define to `unsigned int' if does not define. */ #define size_t @CMAKE_CONFIG_SIZE_T@ /* Define to `int' if does not define. */ #define ssize_t @CMAKE_CONFIG_SSIZE_T@ /* Define as `fork' if `vfork' does not work. */ #define vfork @CMAKE_CONFIG_VFORK@ /* Version + Release number */ #define VERSION "5.2.1" /* Number of decimal digits used in displaying the values */ /* for absolute and relative error. */ #define DEF_LIM 10 /* Size of the input buffer (used to read from file) */ #define BUFF_SIZE 1024 /* Size of the mask of fields. FIELDMASK_SIZE * 8 gives the */ /* largest index of field which can be passed to the -F option */ /* on the command line. */ #define FIELDMASK_SIZE 4096 #define HAVE_LONG_LONG 1 /* Line separator (output) */ #define LINE_SEP "----------------" /* End-of-File indicator */ #define EOF_INDICATOR "<<*>>" /* Hyphenation character */ #define HYPHEN '-' /* Special arrangements for Visual C++ */ #ifdef _MSC_VER /* From missing stdint.h */ typedef unsigned long long int uint64_t; typedef uint64_t uintmax_t; #endif // #ifdef _MSC_VER cmtk-3.0.0/Utilities/numdiff-5.2.1/xalloc.h0000644000177700000170000001721211666247630017224 0ustar torstenman/* xalloc.h -- malloc with out-of-memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef XALLOC_H_ # define XALLOC_H_ # include # ifdef __cplusplus extern "C" { # endif # ifndef __attribute__ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ # define __attribute__(x) # endif # endif # ifndef ATTRIBUTE_NORETURN # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) # endif /* This function is always triggered when memory is exhausted. It must be defined by the application, either explicitly or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ extern void xalloc_die (void) ATTRIBUTE_NORETURN; void *xmalloc (size_t s); void *xzalloc (size_t s); void *xcalloc (size_t n, size_t s); void *xrealloc (void *p, size_t s); void *x2realloc (void *p, size_t *pn); void *xmemdup (void const *p, size_t s); char *xstrdup (char const *str); /* Return 1 if an array of N objects, each of size S, cannot exist due to size arithmetic overflow. S must be positive and N must be nonnegative. This is a macro, not an inline function, so that it works correctly even when SIZE_MAX < N. By gnulib convention, SIZE_MAX represents overflow in size calculations, so the conservative dividend to use here is SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. However, malloc (SIZE_MAX) fails on all known hosts where sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for exactly-SIZE_MAX allocations on such hosts; this avoids a test and branch when S is known to be 1. */ # define xalloc_oversized(n, s) \ ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) /* In the following macros, T must be an elementary or structure/union or typedef'ed type, or a pointer to such a type. To apply one of the following macros to a function pointer or array type, you need to typedef it first and use the typedef name. */ /* Allocate an object of type T dynamically, with error checking. */ /* extern t *XMALLOC (typename t); */ # define XMALLOC(t) ((t *) xmalloc (sizeof (t))) /* Allocate memory for N elements of type T, with error checking. */ /* extern t *XNMALLOC (size_t n, typename t); */ # define XNMALLOC(n, t) \ ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t)))) /* Allocate an object of type T dynamically, with error checking, and zero it. */ /* extern t *XZALLOC (typename t); */ # define XZALLOC(t) ((t *) xzalloc (sizeof (t))) /* Allocate memory for N elements of type T, with error checking, and zero it. */ /* extern t *XCALLOC (size_t n, typename t); */ # define XCALLOC(n, t) \ ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t)))) # if HAVE_INLINE # define static_inline static inline # else void *xnmalloc (size_t n, size_t s); void *xnrealloc (void *p, size_t n, size_t s); void *x2nrealloc (void *p, size_t *pn, size_t s); char *xcharalloc (size_t n); # endif # ifdef static_inline /* Allocate an array of N objects, each with S bytes of memory, dynamically, with error checking. S must be nonzero. */ static_inline void * xnmalloc (size_t n, size_t s) { if (xalloc_oversized (n, s)) xalloc_die (); return xmalloc (n * s); } /* Change the size of an allocated block of memory P to an array of N objects each of S bytes, with error checking. S must be nonzero. */ static_inline void * xnrealloc (void *p, size_t n, size_t s) { if (xalloc_oversized (n, s)) xalloc_die (); return xrealloc (p, n * s); } /* If P is null, allocate a block of at least *PN such objects; otherwise, reallocate P so that it contains more than *PN objects each of S bytes. *PN must be nonzero unless P is null, and S must be nonzero. Set *PN to the new number of objects, and return the pointer to the new block. *PN is never set to zero, and the returned pointer is never null. Repeated reallocations are guaranteed to make progress, either by allocating an initial block with a nonzero size, or by allocating a larger block. In the following implementation, nonzero sizes are increased by a factor of approximately 1.5 so that repeated reallocations have O(N) overall cost rather than O(N**2) cost, but the specification for this function does not guarantee that rate. Here is an example of use: int *p = NULL; size_t used = 0; size_t allocated = 0; void append_int (int value) { if (used == allocated) p = x2nrealloc (p, &allocated, sizeof *p); p[used++] = value; } This causes x2nrealloc to allocate a block of some nonzero size the first time it is called. To have finer-grained control over the initial size, set *PN to a nonzero value before calling this function with P == NULL. For example: int *p = NULL; size_t used = 0; size_t allocated = 0; size_t allocated1 = 1000; void append_int (int value) { if (used == allocated) { p = x2nrealloc (p, &allocated1, sizeof *p); allocated = allocated1; } p[used++] = value; } */ static_inline void * x2nrealloc (void *p, size_t *pn, size_t s) { size_t n = *pn; if (! p) { if (! n) { /* The approximate size to use for initial small allocation requests, when the invoking code specifies an old size of zero. 64 bytes is the largest "small" request for the GNU C library malloc. */ enum { DEFAULT_MXFAST = 64 }; n = DEFAULT_MXFAST / s; n += !n; } } else { /* Set N = ceil (1.5 * N) so that progress is made if N == 1. Check for overflow, so that N * S stays in size_t range. The check is slightly conservative, but an exact check isn't worth the trouble. */ if ((size_t) -1 / 3 * 2 / s <= n) xalloc_die (); n += (n + 1) / 2; } *pn = n; return xrealloc (p, n * s); } /* Return a pointer to a new buffer of N bytes. This is like xmalloc, except it returns char *. */ static_inline char * xcharalloc (size_t n) { return XNMALLOC (n, char); } # endif # ifdef __cplusplus } /* C++ does not allow conversions from void * to other pointer types without a cast. Use templates to work around the problem when possible. */ template inline T * xrealloc (T *p, size_t s) { return (T *) xrealloc ((void *) p, s); } template inline T * xnrealloc (T *p, size_t n, size_t s) { return (T *) xnrealloc ((void *) p, n, s); } template inline T * x2realloc (T *p, size_t *pn) { return (T *) x2realloc ((void *) p, pn); } template inline T * x2nrealloc (T *p, size_t *pn, size_t s) { return (T *) x2nrealloc ((void *) p, pn, s); } template inline T * xmemdup (T const *p, size_t s) { return (T *) xmemdup ((void const *) p, s); } # endif #endif /* !XALLOC_H_ */ cmtk-3.0.0/Utilities/numdiff-5.2.1/cmpfns.c0000644000177700000170000003641511666247630017231 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include #include #include #include #include"numdiff.h" /* See io.c */ extern char* read_line (FILE* pf, int* errcode); extern void print_lines (const char* line1, const char* line2, unsigned long lineno1, unsigned long lineno2, int delimiter_only); extern void print_fields (const char* field1, const char* field2, size_t l1, size_t l2, unsigned long lineno1, unsigned long lineno2, unsigned long fieldno1, unsigned long fieldno2); extern void print_errors (Real abserr, Real relerr); extern void print_separator (void); static void field2cx (const char* field, size_t length, char** tail, int iscale, const struct numfmt* pnf, Complex* pz) { char* ptr = (char*) field; char ch; ch = ptr[length]; ptr[length] = '\0'; str2C (ptr, tail, iscale, pnf, pz); ptr[length] = ch; } /* Be careful ! strNcmp() and strNcasecmp() are only used when n <= strlen (s) == strlen (t). */ static int strNcmp (const char* s, const char* t, size_t n) { const char *p, *q; for (p = s, q = t; p < s + n && *p == *q; p++, q++); return p < s + n; } static int strNcasecmp (const char* s, const char* t, size_t n) { const char *p, *q; for (p = s, q = t; p < s + n && TOLOWER(*p) == TOLOWER(*q); p++, q++); return p < s + n; } static int cmp_fields (const char* field1, const char* field2, size_t l1, size_t l2, argslist* argl, Real* abserr, Real* relerr) { char *tail1, *tail2; Complex z1, z2; field2cx (field1, l1, &tail1, argl->iscale, &argl->nf1, &z1); field2cx (field2, l2, &tail2, argl->iscale, &argl->nf2, &z2); #ifdef __DEBUG__ fprintf (stderr, "l1 = %zu, tail1 - field1 = %zu\n", l1, tail1 - field1); fprintf (stderr, "l2 = %zu, tail2 - field2 = %zu\n", l2, tail2 - field2); #endif if (tail1 - field1 == l1 && tail2 - field2 == l2) { /* This second test manages the options -P and -N . If neither of them has been set, then the condition is always TRUE. */ if ( (smart_cmp (&z2, &z1, argl->flag)) ) { int exit_code; /* Numeric comparison */ Complex w; Real x1, x2; int iscale = argl->iscale; initC (&w); initR (&x1); initR (&x2); Csub (z1, z2, &w, iscale); Cabs (w, abserr, iscale); #ifdef _MPA_DEBUG fputs ("*** MPA Debug output\n", stderr); fputs ("1st number= ( ", stderr); debug_printno (z1.re, 20); fputs (", ", stderr); debug_printno (z1.im, 20); fputs (" )\n", stderr); fputs ("2nd number= ( ", stderr); debug_printno (z2.re, 20); fputs (", ", stderr); debug_printno (z2.im, 20); fputs (" )\n", stderr); fputs ("abs. err= ", stderr); debug_printno (*abserr, 20); fputs ("\n*** *** ***\n", stderr); #endif if (argl->relerr_formula == CLASSIC_FORMULA) { Cabs (z1, &x1, iscale); Cabs (z2, &x2, iscale); if ( cmp (x1, x2) > 0 ) copyR (&x1, x2); if ( (is0(x1)) ) (is0(*abserr)) ? copyR(relerr, Zero) : copyR(relerr, Inf); else divide (*abserr, x1, relerr, iscale); } else if (argl->relerr_formula == WR_TO_FIRST_FILE) { Cabs (z1, &x1, iscale); if ( (is0(x1)) ) (is0(*abserr)) ? copyR(relerr, Zero) : copyR(relerr, Inf); else divide (*abserr, x1, relerr, iscale); } else if (argl->relerr_formula == WR_TO_SECOND_FILE) { Cabs (z2, &x2, iscale); if ( (is0(x2)) ) (is0(*abserr)) ? copyR(relerr, Zero) : copyR(relerr, Inf); else divide (*abserr, x2, relerr, iscale); } delR (&x2); delR (&x1); delC (&w); delC (&z2); delC (&z1); if (!(argl->optmask & _2_MASK)) exit_code = cmp (*relerr, argl->maxrelerr) > 0 && cmp (*abserr, argl->maxabserr) > 0 ? 2:0; else exit_code = cmp (*relerr, argl->maxrelerr) > 0 || cmp (*abserr, argl->maxabserr) > 0 ? 2:0; if ((argl->optmask & _SS_MASK)) { argl->Nentries++; initR (&x1); initR (&x2); /* To compute the 1-norm of all errors */ add (*abserr, argl->N1abserr, &x1, iscale); copyR (&argl->N1abserr, x1); /* To compute the 2-norm of all errors */ square (*abserr, &x1, iscale); add (x1, argl->N2abserr, &x2, iscale); copyR (&argl->N2abserr, x2); if ((exit_code)) { int test; argl->Ndisperr++; /* To compute the 1-norm of the displayed errors */ add (*abserr, argl->N1disperr, &x1, iscale); copyR (&argl->N1disperr, x1); /* To compute the 2-norm of the displayed errors */ square (*abserr, &x1, iscale); add (x1, argl->N2disperr, &x2, iscale); copyR (&argl->N2disperr, x2); if ((test = cmp (*abserr, argl->Labserr)) > 0) { copyR (&argl->Labserr, *abserr); copyR (&argl->Crelerr, *relerr); } else if (test == 0 && cmp (*relerr, argl->Crelerr) > 0) copyR (&argl->Crelerr, *relerr); if ((test = cmp (*relerr, argl->Lrelerr)) > 0) { copyR (&argl->Lrelerr, *relerr); copyR (&argl->Cabserr, *abserr); } else if (test == 0 && cmp (*abserr, argl->Cabserr) > 0) copyR (&argl->Cabserr, *abserr); } delR (&x2); delR (&x1); } return exit_code; } else return 0; } else { delC (&z2); delC (&z1); /* Byte by byte comparison */ if ((argl->optmask & _SI_MASK)) return (l1 != l2 || strNcasecmp (field1, field2, l1) != 0 ? 1 : 0); else return (l1 != l2 || strNcmp (field1, field2, l1) != 0 ? 1 : 0); } } static int cmp_lines (const char* line1, const char* line2, unsigned long lineno1, unsigned long lineno2, char* ifs1, char* ifs2, int output_mode, argslist* argl) { if (!line1 && !line2) return 0; else if (!line1) { if (output_mode >= OUTMODE_NORMAL) print_lines (line1, line2, lineno1, lineno2, 0); return 1; } else if (!line2) { if (output_mode >= OUTMODE_NORMAL) print_lines (line1, line2, lineno1, lineno2, 0); return 1; } else { const char *field1, *field2; size_t l1, l2; unsigned long fieldno1, fieldno2; Real abserr, relerr; int rv, lines_differ = 0, _1sttime = 1; initR (&abserr); initR (&relerr); field1 = line1 + strspn (line1, ifs1); field2 = line2 + strspn (line2, ifs2); fieldno1 = fieldno2 = 0; while (*field1 != '\0' && *field2 != '\0') { /* Ignore the fields selected through the option -X 1: */ while ( *field1 != '\0' && fieldno1 < 8*FIELDMASK_SIZE && (argl->ghostmask1[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) ) { l1 = strcspn (field1, ifs1); field1 += l1 + strspn (field1 + l1, ifs1); fieldno1++; } if ( fieldno1 >= 8*FIELDMASK_SIZE ) { printf (_("@ Line %lu in file \"%s\" contains too many fields!\n"), lineno1, argl->file1); exit (EXIT_TROUBLE); } /* Ignore the fields selected through the option -X 2: */ while ( *field2 != '\0' && fieldno2 < 8*FIELDMASK_SIZE && (argl->ghostmask2[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) ) { l2 = strcspn (field2, ifs2); field2 += l2 + strspn (field2 + l2, ifs2); fieldno2++; } if ( fieldno2 >= 8*FIELDMASK_SIZE ) { printf (_("@ Line %lu in file \"%s\" contains too many fields!\n"), lineno2, argl->file2); exit (EXIT_TROUBLE); } if (*field1 != '\0' && *field2 != '\0') { l1 = strcspn (field1, ifs1); l2 = strcspn (field2, ifs2); rv = cmp_fields (field1, field2, l1, l2, argl, &abserr, &relerr); if ( rv >= 1 ) { if ( (output_mode > OUTMODE_QUIET) && !(rv == 1 && argl->optmask & _SE_MASK) && !(rv == 2 && argl->optmask & _SD_MASK)) { if ((_1sttime)) { print_lines (line1, line2, lineno1, lineno2, output_mode != OUTMODE_VERBOSE && output_mode != OUTMODE_COINCISE); _1sttime = 0; } print_fields (field1, field2, l1, l2, lineno1, lineno2, fieldno1, fieldno2); if ( rv == 2 ) print_errors (abserr, relerr); else print_separator (); } lines_differ = 1; } field1 += l1 + strspn (field1 + l1, ifs1); fieldno1++; field2 += l2 + strspn (field2 + l2, ifs2); fieldno2++; } } /* end while (*field1 != '\0' && *field2 != '\0') */ delR (&abserr); delR (&relerr); /* Ignore the fields selected through the option -X 1: */ while ( *field1 != '\0' && fieldno1 < 8*FIELDMASK_SIZE && (argl->ghostmask1[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) ) { l1 = strcspn (field1, ifs1); field1 += l1 + strspn (field1 + l1, ifs1); fieldno1++; } if ( fieldno1 >= 8*FIELDMASK_SIZE ) { printf (_("@ Line %lu in file \"%s\" contains too many fields!\n"), lineno1, argl->file1); exit (EXIT_TROUBLE); } /* Ignore the fields selected through the option -X 2: */ while ( *field2 != '\0' && fieldno2 < 8*FIELDMASK_SIZE && (argl->ghostmask2[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) ) { l2 = strcspn (field2, ifs2); field2 += l2 + strspn (field2 + l2, ifs2); fieldno2++; } if ( fieldno2 >= 8*FIELDMASK_SIZE ) { printf (_("@ Line %lu in file \"%s\" contains too many fields!\n"), lineno2, argl->file2); exit (EXIT_TROUBLE); } if (*field1 != '\0') { if (output_mode >= OUTMODE_NORMAL) { if ((_1sttime)) { print_lines (line1, line2, lineno1, lineno2, output_mode < OUTMODE_VERBOSE); _1sttime = 0; } print_fields (field1, field2, 0, 0, lineno1, lineno2, fieldno1, fieldno2); printf (_("@ Line %lu in file \"%s\" is shorter than expected!\n"), lineno2, argl->file2); } return 1; } else if (*field2 != '\0') { if (output_mode >= OUTMODE_NORMAL) { if ((_1sttime)) { print_lines (line1, line2, lineno1, lineno2, output_mode < OUTMODE_VERBOSE); _1sttime = 0; } print_fields (field1, field2, 0, 0, lineno1, lineno2, fieldno1, fieldno2); printf (_("@ Line %lu in file \"%s\" is shorter than expected!\n"), lineno1, argl->file1); } return 1; } else return lines_differ; } } int cmp_files (FILE* pf1, FILE* pf2, argslist* argl) { char *line1, *line2, *ifs1, *ifs2; int err1, err2, files_differ = 0; unsigned long lineno1 = 1, lineno2 = 1; size_t n; unsigned short i; unsigned char byte, elem; flg_array table = copy_of_intflagtab(); ifs1 = (!argl->ifs1) ? IFS : argl->ifs1; ifs2 = (!argl->ifs2) ? IFS : argl->ifs2; if ( (table.ptr) ) { /* Filter on */ for (n = 0, err1 = err2 = OK; n < table.len; n += 4U) { byte = table.ptr[n/4U]; for (i = 0; i < 4U; i++) { elem = (byte & 0x03 << 2*i) >> 2 * i; switch (elem) { case 1: line1 = read_line (pf1, &err1); line2 = NULL; break; case 2: line1 = NULL; line2 = read_line (pf2, &err2); break; case 3: line1 = read_line (pf1, &err1); line2 = read_line (pf2, &err2); break; case 0: break; } if (!elem || !(err1 == OK && err2 == OK)) goto catch_error; if ( (cmp_lines (line1, line2, lineno1, lineno2, ifs1, ifs2, argl->output_mode, argl)) ) files_differ = 1; if ((line1)) { lineno1++; free ((void*)line1); } if ((line2)) { lineno2++; free ((void*)line2); } } } } /* end of `if ( (table.ptr) )'*/ else { /* Filter off */ do { line1 = read_line (pf1, &err1); line2 = read_line (pf2, &err2); if ( (cmp_lines (line1, line2, lineno1, lineno2, ifs1, ifs2, argl->output_mode, argl)) ) files_differ = 1; if ((line1)) free ((void*)line1); if ((line2)) free ((void*)line2); lineno1++, lineno2++; } while (err1 == OK && err2 == OK); } catch_error: /* * If we arrive here, then * * either ist n == table.len, * or elem == 0, * or either err1 or err2 is different from OK. */ fflush (stdout); if ( (table.ptr) ) { if (n >= table.len || !elem) return files_differ; } if (err1 == OK) { switch (err2) { case READING_ERROR: fprintf (stderr, _("\n*** Error in reading from file \"%s\"\n"), argl->file2); return READING_ERROR; case OUT_OF_MEMORY: fprintf (stderr, _("\n*** Out of memory while reading from file \"%s\"\n"), argl->file2); return OUT_OF_MEMORY; case LINE_INTERR: if (getc (pf1) == EOF) break; /* default == EOF_REACHED */ default: fprintf (stderr, _("\n*** End of file \"%s\" reached\n"), argl->file2); fprintf (stderr, _(" Likely the files \"%s\" and \"%s\" do not have the same number of lines !\n"), argl->file1, argl->file2); } return files_differ; } else if (err1 == LINE_INTERR) { switch (err2) { case READING_ERROR: fprintf (stderr, _("\n*** Error in reading from file \"%s\"\n"), argl->file2); return READING_ERROR; case OUT_OF_MEMORY: fprintf (stderr, _("\n*** Out of memory while reading from file \"%s\"\n"), argl->file2); return OUT_OF_MEMORY; case OK: if (getc (pf2) != EOF) { fprintf (stderr, _("\n*** End of file \"%s\" reached\n"), argl->file1); fprintf (stderr, _(" Likely the files \"%s\" and \"%s\" do not have the same number of lines !\n"), argl->file1, argl->file2); } break; case EOF_REACHED: fprintf (stderr, _("\n*** End of file \"%s\" reached\n"), argl->file2); fprintf (stderr, _(" Likely the files \"%s\" and \"%s\" do not have the same number of lines !\n"), argl->file1, argl->file2); /* No particular action to do if err2 == LINE_INTERR */ } return files_differ; } else if (err1 == EOF_REACHED) { switch (err2) { case READING_ERROR: fprintf (stderr, _("\n*** Error in reading from file \"%s\"\n"), argl->file2); return READING_ERROR; case OUT_OF_MEMORY: fprintf (stderr, _("\n*** Out of memory while reading from file \"%s\"\n"), argl->file2); return OUT_OF_MEMORY; case OK: case LINE_INTERR: fprintf (stderr, _("\n*** End of file \"%s\" reached\n"), argl->file1); fprintf (stderr, _(" Likely the files \"%s\" and \"%s\" do not have the same number of lines !\n"), argl->file1, argl->file2); } return files_differ; } else if (err1 == READING_ERROR) { fprintf (stderr, _("\n*** Error in reading from file \"%s\"\n"), argl->file1); return READING_ERROR; } else /* err1 == OUT_OF_MEMORY */ { fprintf (stderr, _("\n*** Out of memory while reading from file \"%s\"\n"), argl->file1); return OUT_OF_MEMORY; } } cmtk-3.0.0/Utilities/numdiff-5.2.1/main.c0000644000177700000170000003324111666247630016661 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ /* Leave this inclusion at the begin, otherwise problems */ /* with the symbol __USE_FILE_OFFSET64 */ #include"numdiff.h" #include #include /* for free() */ #include #if HAVE_GETTIMEOFDAY #include #endif #ifdef ENABLE_NLS #include #endif /* See cmpfns.c */ extern int cmp_files (FILE* pf1, FILE* pf2, argslist* argl); /* See options.c */ extern void print_version (const char* progname); extern void print_help (const char* progname); extern int setargs (int argc, char* argv[], argslist *list); static void init_mpa_support (argslist* list) { init_mpa(list->iscale); initR (&list->maxabserr); initR (&list->maxrelerr); initR (&list->Labserr); initR (&list->Crelerr); initR (&list->Lrelerr); initR (&list->Cabserr); initR (&list->N1abserr); initR (&list->N1disperr); initR (&list->N2abserr); initR (&list->N2disperr); } static void dismiss_mpa_support (argslist* list) { delR (&list->maxabserr); delR (&list->maxrelerr); delR (&list->Labserr); delR (&list->Crelerr); delR (&list->Lrelerr); delR (&list->Cabserr); delR (&list->N1abserr); delR (&list->N1disperr); delR (&list->N2abserr); delR (&list->N2disperr); end_mpa(); } static void set_mtime_to_now (struct stat *st) { #ifdef ST_MTIM_NSEC # if HAVE_CLOCK_GETTIME && defined CLOCK_REALTIME if (clock_gettime (CLOCK_REALTIME, &st->st_mtim) == 0) return; # endif # if HAVE_GETTIMEOFDAY { struct timeval timeval; if (gettimeofday (&timeval, NULL) == 0) { st->st_mtime = timeval.tv_sec; st->st_mtim.ST_MTIM_NSEC = timeval.tv_usec * 1000; return; } } # endif #endif /* ST_MTIM_NSEC */ time (&st->st_mtime); } /* cmp.file[f].desc markers */ #define NONEXISTENT (-1) /* nonexistent file */ #define UNOPENED (-2) /* unopened file (e.g. directory) */ #define ERRNO_ENCODE(errno) (-3 - (errno)) /* encoded errno value */ #define ERRNO_DECODE(desc) (-3 - (desc)) /* inverse of ERRNO_ENCODE */ #define DIR_P(f) (S_ISDIR (files[f].stat.st_mode) != 0) static int open_files (const char* name0, const char* name1) { register int f; int status = EXIT_SUCCESS; bool same_files; if (!name0 || !name1) return EXIT_TROUBLE; memset (files, 0, sizeof files); files[0].desc = UNOPENED; files[1].desc = UNOPENED; files[0].name = name0; files[1].name = name1; /* Stat the files. */ for (f = 0; f < 2; f++) { if ((f) && file_name_cmp (files[f].name, files[0].name) == 0) { files[f].desc = files[0].desc; files[f].stat = files[0].stat; } else if (strcmp (files[f].name, "-") == 0) { files[f].desc = STDIN_FILENO; if (fstat (STDIN_FILENO, &files[f].stat) != 0) files[f].desc = ERRNO_ENCODE (errno); else { if (S_ISREG (files[f].stat.st_mode)) { off_t pos = lseek (STDIN_FILENO, (off_t) 0, SEEK_CUR); if (pos < 0) files[f].desc = ERRNO_ENCODE (errno); else files[f].stat.st_size = MAX (0, files[f].stat.st_size - pos); } /* POSIX 1003.1-2001 requires current time for stdin. */ set_mtime_to_now (&files[f].stat); } } else if (stat (files[f].name, &files[f].stat) != 0) files[f].desc = ERRNO_ENCODE (errno); } for (f = 0; f < 2; f++) { int e = ERRNO_DECODE (files[f].desc); if (0 <= e) { errno = e; perror_with_name (files[f].name); status = EXIT_TROUBLE; } } if (status != EXIT_SUCCESS) /* One of the files should exist but does not. */ return status; else if (DIR_P (0) | DIR_P (1)) return EXIT_TROUBLE; else { /* Both exist and neither is a directory. */ /* Are they the same file ? */ same_files = (files[0].desc != NONEXISTENT && files[1].desc != NONEXISTENT && 0 < same_file (&files[0].stat, &files[1].stat) && same_file_attributes (&files[0].stat, &files[1].stat)); /* Open the files and record their descriptors. */ if (files[0].desc == UNOPENED) if ((files[0].desc = open (files[0].name, O_RDONLY, 0)) < 0) { perror_with_name (files[0].name); status = EXIT_TROUBLE; } if (files[1].desc == UNOPENED) { if ((same_files)) files[1].desc = files[0].desc; else if ((files[1].desc = open (files[1].name, O_RDONLY, 0)) < 0) { perror_with_name (files[1].name); status = EXIT_TROUBLE; } } #if HAVE_SETMODE_DOS if (binary) for (f = 0; f < 2; f++) if (0 <= files[f].desc) set_binary_mode (files[f].desc, 1); #endif return status; } } static int compare_files (argslist* list, int* is_same_physical_file) { if ((files[0].desc != NONEXISTENT && files[1].desc != NONEXISTENT && 0 < same_file (&files[0].stat, &files[1].stat) && same_file_attributes (&files[0].stat, &files[1].stat))) { /* The two named files are actually the same physical file. We know they are identical without actually reading them. */ *is_same_physical_file = 1; return 0; } else { int status = diff_2_files (files, list); putc ('\n', stdout); *is_same_physical_file = 0; return status; } } static int rewind_files (void) { off_t pos0, pos1; int status = EXIT_SUCCESS; if ((pos0 = lseek(files[0].desc, (off_t) 0, SEEK_SET)) < 0) { perror_with_name (files[0].name); status = EXIT_TROUBLE; } if ((pos1 = lseek(files[1].desc, (off_t) 0, SEEK_SET)) < 0) { perror_with_name (files[1].name); status = EXIT_TROUBLE; } return status; } static int set_file_pointers (FILE** fpp1, FILE** fpp2) { int status = EXIT_SUCCESS; if ( !(*fpp1 = fdopen (files[0].desc, "r")) ) { perror_with_name (files[0].name); status = EXIT_TROUBLE; } if ( !(*fpp2 = fdopen (files[1].desc, "r")) ) { perror_with_name (files[1].name); status = EXIT_TROUBLE; } return status; } static int close_files (void) { /* Close the file descriptors. */ if (0 <= files[0].desc && close (files[0].desc) != 0) { perror_with_name (files[0].name); return EXIT_TROUBLE; } if (0 <= files[1].desc && files[0].desc != files[1].desc && close (files[1].desc) != 0) { perror_with_name (files[1].name); return EXIT_TROUBLE; } return EXIT_SUCCESS; } static void print_statistics (argslist* list) { Real qm_abserr, qm_relerr; #ifdef USE_GMP initR (&qm_abserr); initR (&qm_relerr); #endif /* USE_GMP */ if (list->flag > 0) { fputs (_("\n In the computation of the following quantities\n only the errors with positive sign are considered:\n"), stdout); fputs (_(" differences due to numeric fields of the second file that are\n less than the corresponding fields in the first file are neglected\n\n"), stdout); } if (list->flag < 0) { fputs (_("\n In the computation of the following quantities\n only the errors with negative sign are considered:\n"), stdout); fputs (_(" differences due to numeric fields of the second file that are\n greater than the corresponding fields in the first file are neglected\n\n"), stdout); } if ( list->Ndisperr == 0 ) { if ( list->Nentries == 0 ) fputs (_("\nNo numeric comparison has been done\n"), stdout); else printf(ngettext ( "\nOne numeric comparison has been done and\nthe resulting numeric difference is negligible\n", "\n%d numeric comparisons have been done and\nthe resulting numeric differences are all negligible\n", list->Nentries), list->Nentries); } else if ( list->Ndisperr == list->Nentries ) { printf(ngettext ( "\nOne numeric comparison has been done and\nhas produced an outcome beyond the tolerance threshold\n", "\n%d numeric comparisons have been done, all of them\nhave produced an outcome beyond the tolerance threshold\n", list->Nentries), list->Nentries); } else { /* Case 0 < LIST->NDISPERR < LIST->NENTRIES */ printf (ngettext ( "\nOne numeric comparison has been done,\n", "\n%d numeric comparisons have been done,\n", list->Nentries), list->Nentries); printf (ngettext ( "only one numeric comparison has produced an outcome\nbeyond the tolerance threshold\n", "%d numeric comparisons have produced an outcome\nbeyond the tolerance threshold\n", list->Ndisperr), list->Ndisperr); } fputs (_("\nLargest absolute error in the set of relevant numerical differences:\n"), stdout); printno (list->Labserr, DEF_LIM); fputs (_("\nCorresponding relative error:\n"), stdout); printno (list->Crelerr, DEF_LIM); fputs (_("\nLargest relative error in the set of relevant numerical differences:\n"), stdout); printno (list->Lrelerr, DEF_LIM); fputs (_("\nCorresponding absolute error:\n"), stdout); printno (list->Cabserr, DEF_LIM); putchar ('\n'); fputs (_("\nSum of all absolute errors:\n"), stdout); printno (list->N1abserr, DEF_LIM); fputs (_("\nSum of the relevant absolute errors:\n"), stdout); printno (list->N1disperr, DEF_LIM); /* Arithmetic means */ divide_by_int (&list->N1abserr, list->Nentries, list->iscale); divide_by_int (&list->N1disperr, list->Ndisperr, list->iscale); fputs (_("\nArithmetic mean of all absolute errors:\n"), stdout); printno (list->N1abserr, DEF_LIM); fputs (_("\nArithmetic mean of the relevant absolute errors:\n"), stdout); printno (list->N1disperr, DEF_LIM); /* 2-norms and quadratic means of the errors */ copyR (&qm_abserr, list->N2abserr); divide_by_int (&qm_abserr, list->Nentries, list->iscale); square_root (&qm_abserr, list->iscale); square_root (&list->N2abserr, list->iscale); fputs (_("\nSquare root of the sum of the squares of all absolute errors:\n"), stdout); printno (list->N2abserr, DEF_LIM); fputs (_("\nQuadratic mean of all absolute errors:\n"), stdout); printno (qm_abserr, DEF_LIM); copyR (&qm_relerr, list->N2disperr); divide_by_int (&qm_relerr, list->Ndisperr, list->iscale); square_root (&qm_relerr, list->iscale); square_root (&list->N2disperr, list->iscale); fputs (_("\nSquare root of the sum of the squares\nof the relevant absolute errors:\n"), stdout); printno (list->N2disperr, DEF_LIM); fputs (_("\nQuadratic mean of the relevant absolute errors:\n"), stdout); printno (qm_relerr, DEF_LIM); putchar ('\n'); delR (&qm_relerr); delR (&qm_abserr); } int main (int argc, char* argv[]) { argslist list; #ifdef ENABLE_NLS setlocale (LC_CTYPE, ""); setlocale (LC_MESSAGES, ""); #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); /* This code was used to discover the reason of a bug */ /* #ifdef __USE_FILE_OFFSET64 printf ("\n %s: FILE OFFSET 64 in use, sizeof (struct stat) = %u\n", __FILE__, sizeof (struct stat)); #else printf ("\n %s: FILE OFFSET 64 NOT in use, sizeof (struct stat) = %u\n", __FILE__, sizeof (struct stat)); #endif */ init_mpa_support (&list); init_flags (); if ( setargs (argc, argv, &list) != 0 ) { dismiss_mpa_support (&list); if ((list.ifs1)) free ((void*)list.ifs1); if ((list.ifs2)) free ((void*)list.ifs2); return -1; } else if ( (list.optmask & (_H_MASK | _V_MASK)) ) { if ((list.optmask & _V_MASK)) print_version(PACKAGE); if ((list.optmask & _H_MASK)) print_help(PACKAGE); dismiss_mpa_support (&list); if ((list.ifs1)) free ((void*)list.ifs1); if ((list.ifs2)) free ((void*)list.ifs2); if (argc > 2) return -1; else return 0; } else { int test = -1, ident_files = 0; FILE *fp1, *fp2; int qm = list.optmask & _Q_MASK; struct numfmt defaults; defaults.dp = DP; defaults.thsep = THSEP; defaults.grouping = GROUPING; defaults.pos_sign = POS_SIGN; defaults.neg_sign = NEG_SIGN; defaults.ech = ECH; defaults.iu = IU; if ( open_files (list.file1, list.file2) != EXIT_SUCCESS ) return EXIT_TROUBLE; if ( list.optmask & (_F_MASK | _Z_MASK | _SZ_MASK) ) test = compare_files (&list, &ident_files); if ( !(list.optmask & _F_MASK) && !ident_files ) { if ( rewind_files () != EXIT_SUCCESS || set_file_pointers (&fp1, &fp2) != EXIT_SUCCESS ) return EXIT_TROUBLE; test = cmp_files (fp1, fp2, &list); if ((list.optmask & _SS_MASK) && test <= 1) print_statistics (&list); } if (test == 0 && !qm) { if ((list.optmask & _F_MASK)) printf (_("\n+++ Files \"%s\" and \"%s\" have the same structure\n"), list.file1, list.file2); else printf (_("\n+++ Files \"%s\" and \"%s\" are equal\n"), list.file1, list.file2); } if (test == 1 && !qm) printf (_("\n+++ File \"%s\" differs from file \"%s\"\n"), list.file1, list.file2); erase_flags (); dismiss_mpa_support (&list); if ((list.ifs1)) free ((void*)list.ifs1); if ((list.ifs2)) free ((void*)list.ifs2); close_files (); return test; } } cmtk-3.0.0/Utilities/numdiff-5.2.1/TODO0000644000177700000170000000037011666247630016256 0ustar torstenman* At the moment Numdiff manages perfectly only text files with an 8-bit encoding (ASCII and ISO 8859-* text files). The use of Numdiff with UTF-8 text files has some restrictions. Sooner or later Numdiff should fully support UTF-8 encoding. cmtk-3.0.0/Utilities/numdiff-5.2.1/config.h.in0000644000177700000170000002436511666247630017623 0ustar torstenman/* config.h.in. Generated from configure.ac by autoheader. */ /* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the `bcopy' function. */ #undef HAVE_BCOPY /* Define to 1 if you have the `btowc' function. */ #undef HAVE_BTOWC /* Define to 1 if you have the `bzero' function. */ #undef HAVE_BZERO /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if C supports variable-length arrays. */ #undef HAVE_C_VARARRAYS /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_CLEARERR_UNLOCKED /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FEOF_UNLOCKED /* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FERROR_UNLOCKED /* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FFLUSH_UNLOCKED /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FGETS_UNLOCKED /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTC_UNLOCKED /* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTS_UNLOCKED /* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FREAD_UNLOCKED /* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FWRITE_UNLOCKED /* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETCHAR_UNLOCKED /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETC_UNLOCKED /* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_PUTCHAR_UNLOCKED /* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_PUTC_UNLOCKED /* Define to 1 if you have the declaration of `strerror', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `isascii' function. */ #undef HAVE_ISASCII /* Define to 1 if you have the `gmp' library (-lgmp). */ #undef HAVE_LIBGMP /* Define to 1 if you have the `localeconv' function. */ #undef HAVE_LOCALECONV /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the DOS-style `setmode' function. */ #undef HAVE_SETMODE_DOS /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if `st_blksize' is member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if `st_rdev' is member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_RDEV /* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ #undef HAVE_ST_BLKSIZE /* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV' instead. */ #undef HAVE_ST_RDEV /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `waitpid' function. */ #undef HAVE_WAITPID /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H /* Define to 1 if you have the header file. */ #undef HAVE_WCTYPE_H /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P /* Define to be the nanoseconds member of struct stat's st_mtim, if it exists. */ #undef ST_MTIM_NSEC /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Define to 1 if you want getc etc. to use unlocked I/O if available. Unlocked I/O can improve performance in unithreaded apps, but it is not safe for multithreaded apps. */ #undef USE_UNLOCKED_IO /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef pid_t /* Define to `int' if does not define. */ #undef ptrdiff_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define as `fork' if `vfork' does not work. */ #undef vfork /* Version + Release number */ #define VERSION "5.2.1" /* Number of decimal digits used in displaying the values */ /* for absolute and relative error. */ #define DEF_LIM 10 /* Size of the input buffer (used to read from file) */ #define BUFF_SIZE 1024 /* Size of the mask of fields. FIELDMASK_SIZE * 8 gives the */ /* largest index of field which can be passed to the -F option */ /* on the command line. */ #define FIELDMASK_SIZE 4096 #define HAVE_LONG_LONG 1 /* Line separator (output) */ #define LINE_SEP "----------------" /* End-of-File indicator */ #define EOF_INDICATOR "<<*>>" /* Hyphenation character */ #define HYPHEN '-' cmtk-3.0.0/Utilities/numdiff-5.2.1/README0000644000177700000170000000274511666247630016456 0ustar torstenman Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. *********************************************************************************** Numdiff ~~~~~~~ This README file is distributed together with the source code of Numdiff, a program which compares putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. Numdiff is Copyright (C) of Ivano Primi , which is also its author. Numdiff (also written numdiff) is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Numdiff 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 General Public License along with this program in a file called COPYING. If not, see . Detailed instructions on how to install Numdiff can be found in the file INSTALL. The full documentation of Numdiff can be found in the directory ./docs . cmtk-3.0.0/Utilities/numdiff-5.2.1/arith.c0000644000177700000170000003142711666247630017050 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include #include"numdiff.h" #ifdef USE_GMP #include Real Zero, Ten, Inf; void init_mpa(int iscale) { char tmpbuff[1024]; /* Hopefully the highest possible number of digits for a LONG will never become larger than 1000!! :) */ sprintf (tmpbuff, "1e%ld", LONG_MAX); mpf_set_default_prec ((iscale * 32) / 10); mpf_init (Zero); mpf_init_set_ui (Ten, 10); mpf_init_set_str (Inf, tmpbuff, 10); } void initR (Real* px) { mpf_init (*px); } void initC (Complex* pz) { mpf_init (pz->re); mpf_init (pz->im); } void copyR (Real* dst, Real src) { mpf_set (*dst, src); } void copyC (Complex* dst, Complex src) { mpf_set (dst->re, src.re); mpf_set (dst->im, src.im); } void str2R (const char *q, char **endptr, int iscale, const struct numfmt* pnf, Real* pr) { mpf_a2num (pr, q, endptr, pnf); } void str2C (const char *q, char **endptr, int iscale, const struct numfmt* pnf, Complex* pc) { char *ptr, *ptr2; mpf_init (pc->re); mpf_init (pc->im); mpf_a2num (&pc->re, q, &ptr, pnf); if ((endptr)) *endptr = ptr; if (ptr != q) { if (*ptr == pnf->iu) { mpf_set (pc->im, pc->re); mpf_set (pc->re, Zero); if ((endptr)) *endptr = ptr + 1; } else { while (is_space (*ptr)) ptr++; if (*ptr == POS_SIGN || *ptr == NEG_SIGN) { mpf_a2num (&pc->im, ptr, &ptr2, pnf); if (*ptr2 != pnf->iu) mpf_set (pc->im, Zero); else { if ((endptr)) *endptr = ptr2 + 1; } } /* else : we have successfully read a real number but there is no another number after it. : So, we leave pc->im set to zero. */ } } else /* : q does not contain any valid number ==> pc->re is 0. Then we set pc->im to 0. We remark that, if endptr is not NULL, then *endptr == q. */ mpf_set (pc->im, Zero); } void add (Real s, Real t, Real* q, int iscale) { mpf_add (*q, s, t); } void square (Real s, Real* q, int iscale) { mpf_pow_ui (*q, s, 2); } void divide (Real s, Real t, Real* q, int iscale) { mpf_div (*q, s, t); } void divide_by_int (Real* q, int d, int iscale) { Real div; if (d == 0) mpf_set (*q, Zero); else { mpf_init_set_si (div, d); mpf_div (*q, *q, div); mpf_clear (div); } } void square_root (Real* q, int iscale) { mpf_sqrt (*q, *q); } void Cabs (Complex z, Real* pm, int iscale) { mpf_t a, b, q; if ( mpf_sgn (z.re) >= 0 ) mpf_init_set (a, z.re); else { mpf_init (a); mpf_sub (a, Zero, z.re); } if ( (mpf_sgn(z.im) == 0) ) { mpf_set (*pm, a); mpf_clear (a); return; } else if ( (mpf_sgn(z.im) > 0) ) mpf_init_set (b, z.im); else { mpf_init (b); mpf_sub (b, Zero, z.im); } mpf_init (q); if ( mpf_cmp (b, a) > 0 ) { mpf_div (q, a, b); mpf_mul (a, q, q); mpf_add_ui (q, a, 1); mpf_sqrt (q, q); mpf_mul (*pm, b, q); } else { /* a >= b ===> a > 0 */ mpf_div (q, b, a); mpf_mul (b, q, q); mpf_add_ui (q, b, 1); mpf_sqrt (q, q); mpf_mul (*pm, a, q); } mpf_clear (q); mpf_clear (b); mpf_clear (a); } void Csub (Complex z1, Complex z2, Complex* pw, int iscale) { mpf_sub (pw->re, z1.re, z2.re); mpf_sub (pw->im, z1.im, z2.im); } int cmp (Real p, Real q) { return mpf_cmp (p, q); } int is0 (Real u) { return (mpf_cmp (u, Zero) == 0 ? 1 : 0); } int smart_cmp (const Complex* pz1, const Complex* pz2, int flag) { if (flag == 0) return 1; else if (flag > 0) return (mpf_cmp (pz1->re, pz2->re) >= 0 && mpf_cmp (pz1->im, pz2->im) >= 0); else /* flag < 0 */ return (mpf_cmp (pz1->re, pz2->re) <= 0 && mpf_cmp (pz1->im, pz2->im) <= 0); } static int round_far_from_zero (char* mantissa, int prec) { size_t length; char *ptr, *abs_mantissa; /* abs_mantissa is a pointer to the absolute value of MANTISSA. If MANTISSA starts with a minus sign, then abs_mantissa has to point to the digit immediately after this sign. */ if (*mantissa == NEG_SIGN) abs_mantissa = mantissa + 1; else abs_mantissa = mantissa; length = strlen (abs_mantissa); /* If the length of the string ABS_MANTISSA is less or equal than PREC+1, then no rounding is required and zero has to be returned. */ if (length <= prec + 1) return 0; else { /* If length > prec + 1, then the character of ABS_MANTISSA in the position PREC+1 is non-null. If this character is a number between 0 and 4, then the rounding procedure ends hier. */ ptr = abs_mantissa + (prec + 1); if ((*ptr - CHAR_ZERO) >= 5) { /* Otherwise we have to "increment" the previous character by 1, taking into account each time the amount to be carried. */ for (ptr--; ptr > abs_mantissa && *ptr == CHAR_NINE; *ptr = CHAR_ZERO, ptr--); if (ptr == abs_mantissa) { /* If the first PREC+1 digits of ABS_MANTISSA were all equal to 9, then the rounding procedure has to set all of them to zero and return 1, i.e. the last carried amount. */ if (*ptr == CHAR_NINE) { *ptr = CHAR_ZERO; return 1; } /* If the first digit of ABS_MANTISSA is less than 9, then the rounding procedure ends by incrementing this digit by 1 and returning 0. */ else *ptr = *ptr + 1; } /* If at least one of the first PREC+1 digits of ABS_MANTISSA is less than 9, then the rounding procedure ends by incrementing this digit by 1 and returning 0. */ else *ptr = *ptr + 1; } return 0; } /* LENGTH > PREC + 1 */ } static void fprintno (FILE *fp, Real u, int prec) { if (mpf_cmp (u, Inf) == 0) printf ("Inf"); else { char *ptr, *mantissa; mp_exp_t expn; ptr = mantissa = mpf_get_str (NULL, &expn, 10, 0, u); if (*mantissa == '\0') { /* If MANTISSA is the empty string, then print 0 with the required number of decimal digits. */ fputc (CHAR_ZERO, fp); fputc (DP, fp); for (; prec > 0; prec--) fputc (CHAR_ZERO, fp); fputc (ECH, fp); fputc (POS_SIGN, fp); fputc (CHAR_ZERO, fp); } else { int amount_to_carry = round_far_from_zero (mantissa, prec); if (*ptr == NEG_SIGN) { /* Print a minus sign if the number is negative */ fputc (NEG_SIGN, fp); ptr++; } /* The mantissa has been already rounded to the given precision PREC. If MANTISSA before the rounding was "99...9", then now it is given by "00...0" but there is a leading 1 which has to be carried. */ if (amount_to_carry) { fputc (CHAR_ONE, fp); expn++; } else { fputc (*ptr, fp); ptr++; } /* We print now the decimal point */ fputc (DP, fp); /* and the remaining digits of the mantissa. After the decimal point has been printed, one must print no more than PREC digits. */ for (; *ptr != '\0' && prec > 0; ptr++, prec--) fputc (*ptr, fp); /* If the remaining digits of the mantissa are less than PREC, then fill up with zeros. */ if (*ptr == '\0') { for (; prec > 0; prec--) fputc (CHAR_ZERO, fp); } /* Finally we print the exponent with its sign */ fprintf (fp, "%c%+ld", ECH, expn - 1); } free ((void*) mantissa); } /* u != Inf */ } void printno (Real u, int m) { fprintno (stdout, u, m); } #ifdef _MPA_DEBUG void debug_printno (Real u, int m) { fprintno (stderr, u, m); } #endif void delR (Real* px) { mpf_clear (*px); } void delC (Complex* pz) { mpf_clear (pz->re); mpf_clear (pz->im); } void end_mpa(void) { mpf_clear (Inf); mpf_clear (Ten); mpf_clear (Zero); } #else /* not USE_GMP */ #include"number.c" #include"errors.c" #include"new.c" Real Zero, Inf; void init_mpa(int iscale) { bc_init_numbers(); bc_init_num(&Zero); Inf = bc_new_num (1,0); Inf->n_value[0] = 10; } void initR (Real* px) { bc_init_num (px); } void initC (Complex* pz) { bc_init_num (&pz->re); bc_init_num (&pz->im); } void copyR (Real* dst, Real src) { *dst = bc_copy_num (src); } void copyC (Complex* dst, Complex src) { dst->re = bc_copy_num (src.re); dst->im = bc_copy_num (src.im); } void str2R (const char *q, char **endptr, int iscale, const struct numfmt* pnf, Real* pr) { bc_a2num (pr, q, endptr, iscale, pnf); } void str2C (const char *q, char **endptr, int iscale, const struct numfmt* pnf, Complex* pc) { char *ptr, *ptr2; bc_init_num (&pc->re); bc_init_num (&pc->im); bc_a2num (&pc->re, q, &ptr, iscale, pnf); if ((endptr)) *endptr = ptr; if (ptr != q) { if (*ptr == pnf->iu) { pc->im = bc_copy_num (pc->re); pc->re = bc_copy_num (_zero_); if ((endptr)) *endptr = ptr + 1; } else { while (is_space (*ptr)) ptr++; if (*ptr == POS_SIGN || *ptr == NEG_SIGN) { bc_a2num (&pc->im, ptr, &ptr2, iscale, pnf); if (*ptr2 != pnf->iu) pc->im = bc_copy_num (_zero_); else { if ((endptr)) *endptr = ptr2 + 1; } } /* else : we have successfully read a real number but there is no another number after it. : So, we leave pc->im set to zero. */ } } else /* : q does not contain any valid number ==> pc->re is 0. Then we set pc->im to 0. We remark that, if endptr is not NULL, then *endptr == q. */ pc->im = bc_copy_num (_zero_); } void add (Real s, Real t, Real* q, int iscale) { bc_add (s, t, q, iscale); } void square (Real s, Real* q, int iscale) { bc_multiply (s, s, q, iscale); } void divide (Real s, Real t, Real* q, int iscale) { bc_divide (s, t, q, iscale); } void divide_by_int (Real* q, int d, int iscale) { Real num, div; if (d == 0) { bc_free_num (q); bc_init_num (q); } else { bc_init_num (&div); bc_int2num (&div, d); num = bc_copy_num (*q); bc_divide (num, div, q, iscale); bc_free_num (&num); bc_free_num (&div); } } void square_root (Real* q, int iscale) { bc_sqrt (q, iscale); } void Cabs (Complex z, Real* pm, int iscale) { bc_num a, b, q; if ( z.re->n_sign == PLUS ) a = bc_copy_num (z.re); else { bc_init_num (&a); bc_sub (Zero, z.re, &a, iscale); } if ( (bc_is_zero(z.im)) ) { *pm = a; return; } else if ( z.im->n_sign == PLUS ) b = bc_copy_num (z.im); else { bc_init_num (&b); bc_sub (Zero, z.im, &b, iscale); } bc_init_num (&q); if ( bc_compare (b, a) > 0 ) { bc_divide (a, b, &q, iscale); bc_multiply (q, q, &a, iscale); bc_add (a, _one_, &q, iscale); bc_sqrt (&q, iscale); bc_multiply (b, q, pm, iscale); } else { /* a >= b ===> a > 0 */ bc_divide (b, a, &q, iscale); bc_multiply (q, q, &b, iscale); bc_add (b, _one_, &q, iscale); bc_sqrt (&q, iscale); bc_multiply (a, q, pm, iscale); } bc_free_num (&q); bc_free_num (&b); bc_free_num (&a); } void Csub (Complex z1, Complex z2, Complex* pw, int iscale) { bc_sub (z1.re, z2.re, &pw->re, iscale); bc_sub (z1.im, z2.im, &pw->im, iscale); } int cmp (Real p, Real q) { return bc_compare (p, q); } int is0 (Real u) { return bc_is_zero (u); } int smart_cmp (const Complex* pz1, const Complex* pz2, int flag) { if (flag == 0) return 1; else if (flag > 0) return (bc_compare (pz1->re, pz2->re) >= 0 && bc_compare (pz1->im, pz2->im) >= 0); else /* flag < 0 */ return (bc_compare (pz1->re, pz2->re) <= 0 && bc_compare (pz1->im, pz2->im) <= 0); } void printno (Real u, int m) { bc_print_num (u, out_char, m); } #ifdef _MPA_DEBUG void debug_printno (Real u, int m) { bc_print_num (u, out_char_stderr, m); } #endif void delR (Real* px) { bc_free_num (px); } void delC (Complex* pz) { bc_free_num (&pz->re); bc_free_num (&pz->im); } void end_mpa(void) { bc_free_num (&Inf); bc_free_num (&Zero); bc_end(); } #endif /* not USE_GMP */ cmtk-3.0.0/Utilities/numdiff-5.2.1/ndselect.h0000644000177700000170000000423111666247630017540 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #ifndef _NDSELECT_H_ #define _NDSELECT_H_ #include"config.h" /* Error codes */ #define OPEN_ERROR -1 #define READ_ERROR -2 #define CLOSE_ERROR -3 typedef struct { /* Mask of the options */ unsigned long optmask; /* Begin, end, step */ unsigned long begin_line, end_line, step; /* File to handle */ const char *file; } Argslist ; /* A structure of this type is used to store the options */ /* set by the user */ #define ___H_MASK 0x00000001 /* -h option, used to recall help */ #define ___B_MASK 0x00000002 /* -b option, used to set the start line */ #define ___E_MASK 0x00000004 /* -e option, used to set the end line */ #define ___S_MASK 0x00000008 /* -s option, used to explicitly set the step */ #define ___V_MASK 0x00000010 /* -v option, used to show version number, Copyright and No-Warranty */ /* I18N and L10N support */ #ifdef ENABLE_NLS #include #define _(String) gettext (String) #define gettext_noop(String) String #define N_(String) gettext_noop (String) #else #define _(String) (String) #define N_(String) String #define textdomain(Domain) #define bindtextdomain(Package, Directory) #endif #ifndef PACKAGE2 #define PACKAGE2 "ndselect" #endif #ifndef LOCALEDIR #define LOCALEDIR "/usr/local/share/locale/" #endif #endif /* _NDSELECT_H_ */ cmtk-3.0.0/Utilities/numdiff-5.2.1/ChangeLog0000644000177700000170000001610011666247630017336 0ustar torstenman2010-01-24 Ivano Primi Version 5.2.1 released. 2010-01-24 Ivano Primi * Makefile.in: VERSION changed to 5.2.1. * config.h.in: (VERSION): From 5.2.0 to 5.2.1. * NEWS: Added news for version 5.2.1. * system.h: [!ENABLE_NLS] (ngettext): Macro definition. 2010-01-07 Ivano Primi Version 5.2.0 released. 2010-01-07 Ivano Primi * util.c: Doc fixes. * util.c: New file. * side.c: Doc fixes. * side.c: New file. * inout.c: Doc fixes. * inout.c: New file. * analyze.c: Doc fixes. * analyze.c: New file. * number.c: Doc fixes. * options.c: (print_version) [!USE_GMP]: Message string fixed. (print_help): Message string fixed. 2010-01-06 Ivano Primi * NEWS, INSTALL: Doc fixes. 2010-01-05 Ivano Primi * ndselect.c (print_selversion): Fixed Copyright string. * read_line.c: Doc fixes. * options.c: Doc fixes. (print_version): Fixed Copyright string. * numutil.c, numdiff.h, number.c: Doc fixes. * number.c: New file. * new.c, ndselect.h: Doc fixes. * ndselect.h: New file. * ndselect.c, main.c, io.c, flags.c: Doc fixes. * flags.c: New file. * errors.c, configure.ac, config.h.in, cmpfns.c, arith.c, README: Doc fixes. * README: New file. * Makefile.in, INSTALL: Doc fixes. * INSTALL, BUGS: New file. * AUTHORS: Doc fixes. * AUTHORS: New file. 2010-01-03 Ivano Primi * ndselect.c: [USE_GMP]: Removed zalloc. string.h and numutil.c are not anymore included. Removed declaration of read_line. Include read_line.c. * Makefile.in (SOURCESONE): Added $(srcdir)/read_line.c. (OBJECTSTWO): Removed ./arith.o and ./io.o. (SOURCESTWO): Removed $(srcdir)/arith.c and $(srcdir)/io.c. Added $(srcdir)/read_line.c. (copy): Added instruction to copy read_line.c from source directory to tarball directory. * io.c: Doc-fixes: Removed unuseful comments. (read_line): Moved to file read_line.c. Added instruction to include read_line.c. * read_line.c, io.c: New file. * arith.c: [USE_GMP] (str2C): Replaced isspace by is_space. Replaced '+' by POS_SIGN and '-' by NEG_SIGN. [!USE_GMP] (str2C): Replaced isspace by is_space. Replaced '+' by POS_SIGN and '-' by NEG_SIGN. * ndselect.c (setargs): Replaced isspace by is_space. * numdiff.h (is_digit, is_punct, is_print): Macro re-definition. (is_space): Macro definition. The macro isspace has been replaced everywhere by is_space. * system.h: New file. * numutil.c (anum, snum): Replaced toupper by TOLOWER. (anum, acxnum, snum, scxnum): Replaced isspace by is_space. * cmpfns.c (strNcasecmp): Replaced tolower by TOLOWER. * new.c (bc_a2num): Replaced toupper by TOLOWER. Replaced isspace by is_space. * new.c: New file. 2009-12-30 Ivano Primi * NEWS: Added news for version 5.2.0. * NEWS: New file. * configure.ac: New option --enable-gmp / --disable-gmp. Usage of GNU MP is enabled by default. * arith.c: HAVE_LIBGMP has been replaced by USE_GMP. (Epsilon, MEpsilon): Removed. (mpa_define_epsilon, mpa_undef_epsilon): Removed. [USE_GMP] (init_mpa): Signature and definition (argument iscale is used in place of MAX_ISCALE) changed. All callers in other files changed. [!USE_GMP] (init_mpa): Signature changed. All callers in other files changed. (copyR, copyC): Signature and definition changed. All callers in other files changed. [USE_GMP] (str2R, str2C): Calls to mpf_a2num() changed. (cmp, is0): Signature and definition changed. All callers in other files changed. [USE_GMP] (fprintno): Test (u == Inf) has been correctly rewritten. [USE_GMP] (end_mpa): Variable Inf is also cleared now. * main.c (init_mpa_support): Call to init_mpa() changed. (print_statistics) [USE_GMP]: Added code to initialize qm_abserr and qm_relerr. (print_statistics): Removed commented out old code. (print_statistics): Changed calls to copyR(). (main): Removed calls to mpa_define_epsilon() and mpa_undef_epsilon(). * ndselect.c: [USE_GMP] (zalloc): New function. [USE_GMP]: Include numutil.c. * options.c: (print_version) [USE_GMP]: Added statement on the way the program has been built. (print_version) [!USE_GMP]: Modified statement on the way the program has been built. (set_args) [!USE_GMP]: Removed code to avoid memory leak (not needed in this case and even dangerous). * errors.c (out_of_memory): Added missing argument in the call to fprintf(). * numutil.c: HAVE_LIBGMP has been replaced by USE_GMP. [USE_GMP](mpf_a2num): The case when the number returned by snum() is zero is now correctly handled. * cmpfns.c (cmp, is0, copyR): Calls changed. * numdiff.h (USE_GMP): New Macro. HAVE_LIBGMP has been replaced by USE_GMP. (MAX_EPXN, MIN_EXPN): They are now constant values of 'long int' type. (cmp, is0, init_mpa, copyR, copyC): Redefinition of signature. All callers changed. (mpa_define_epsilon, mpa_undef_epsilon): Removed. * errors.c, options.c, ndselect.c, main.c, cmpfns.c: New file. 2009-12-29 Ivano Primi * configure.ac: AC_INIT(...): From version 5.0 to 5.2. * config.h.in (HAVE_LIBGMP): New Macro. (HAVE_LOCALECONV): New Macro. (VERSION): From 5.0.0 to 5.2.0. * Makefile.in: VERSION changed to 5.2.0. * config.h.in: New file. * numutil.c: [HAVE_LIBGMP] (mpf_a2num): Bug fixes after running a text program. * numutil.c: [HAVE_LIBGMP] (mpf_a2num): Removed memory leak + Doc fixes. * arith.c: [HAVE_LIBGMP] (fprintno): Memory leak removed 2009-12-28 Ivano Primi * numutil.c: [HAVE_LOCALECONV && HAVE_LIBGMP]: Include locale.h. [HAVE_LIBGMP] (mpf_a2num): New function. * numutil.c: New file. * configure.ac: AC_CHECK_FUNCS(...): Check for localeconv added. * numdiff.h (CHAR_ONE CHAR_NINE): Macro definition. [HAVE_LIBGMP] (mpf_a2num): Declaration. * arith.c: [HAVE_LIBGMP] (round_far_from_zero fprintno): New functions. [HAVE_LIBGMP] (printno, debug_printno): Transformed into wrappers of the function fprintno. [HAVE_LIBGMP] (str2R): Call to mpf_a2num changed in view of the actual definition of this function. * arith.c: [HAVE_LIBGMP] (Zero, Ten, Inf, Epsilon, MEpsilon): Definition of variables. [HAVE_LIBGMP] (init_mpa, mpa_define_epsilon, initR, initC, copyR, copyC) (str2R, str2C, add, square, divide, divide_by_int, square_root) (Cabs, Csub, cmp, is0, smart_cmp, printno, debug_printno) (delR, delC, mpa_undef_epsilon, end_mpa): New functions. [!HAVE_LIBGMP] (copyR, copyC): Re-definition according to the new signature. * numdiff.h (copyR copyC): Redefinition of signature. All callers changed. 2009-12-13 Ivano Primi * Makefile.in: Added createdirs, copy and tarball targets. Target dist rewritten. * Makefile.in, arith.c: New file. 2009-12-12 Ivano Primi * numdiff.h: [HAVE_LIBGMP] (Real Complex): Definition of types. * numdiff.h: New file. * configure.ac: AC_CHECK_LIB(gmp, __gmpz_init): Check for GNUMP added. * configure.ac: New file. 2009-11-31 Ivano Primi Version 5.0.0 released. cmtk-3.0.0/Utilities/numdiff-5.2.1/ndselect.c0000644000177700000170000002073611666247630017543 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include #include #include #include #ifdef ENABLE_NLS #include #endif #include"getopt.h" #include"numdiff.h" /* Only for LINE_INTERR definition */ #include"ndselect.h" #include"read_line.c" static int scan_file (const Argslist* data) { FILE *fp; char *line_buffer; unsigned long lineno; int errcode; if (!data->file || !*data->file) fp = stdin; else { if ( !(fp = fopen (data->file, "r")) ) return OPEN_ERROR; } if (!data->end_line) { for (lineno = 1; (line_buffer = read_line(fp, &errcode), errcode <= LINE_INTERR); lineno++) { if (lineno >= data->begin_line && (lineno - data->begin_line) % data->step == 0) fputs (line_buffer, stdout); free ((void*)line_buffer); } } else { for (lineno = 1; lineno <= data->end_line && (line_buffer = read_line(fp, &errcode), errcode <= LINE_INTERR); lineno++) { if (lineno >= data->begin_line && (lineno - data->begin_line) % data->step == 0) fputs (line_buffer, stdout); free ((void*)line_buffer); } } if (errcode <= EOF_REACHED) { if (fp == stdin) return OK; else return fclose (fp) == EOF ? CLOSE_ERROR : OK; } else { if((line_buffer)) free ((void*)line_buffer); if (fp != stdin) fclose (fp); return READ_ERROR; } } static void print_selversion (const char* progname) { printf ("%s %s\n", progname, VERSION); printf ("Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 %s \n", /* TRANSLATORS: This is a proper name. See the gettext manual, section Names. Pronounciation is like "evaa-no pree-me". */ _("Ivano Primi")); printf (_("\ License GPLv3+: GNU GPL version 3 or later,\n\ see .\n\ This is free software: you are free to change and redistribute it.\n\ There is NO WARRANTY, to the extent permitted by law.\n")); } static void print_selhelp (const char* progname) { puts (_("Usage:")); printf ("%s -h|--help|-v|--version %s\n\n", progname, _("or")); printf ("%s %s\n", progname, "[-b FIRST][-e LAST][-s STEP][-l PATH][-o PATH] [FILE]"); /* %%% */ printf(_("\n\ For a given range of line numbers and a given step\n\ print on the standard output all lines of a file,\n\ starting with the first line of the range and ending within\n\ its last line, whose line number is such that the difference\n\ between it and the start point is an integer multiple\n\ of the given step\n\n")); printf ("-b, --beginning, --start=FIRST\n %s\n %s\n", _("Specify the first line to print"), _("(The default behavior is to start with line number 1)")); printf ("-e, --end=LAST\n %s\n %s\n", _("Specify the last line that can be printed"), _("(The default behavior is to arrive till to the end of the file)")); printf ("-s, --step=STEP\n %s\n %s\n", _("Specify the step to use when selecting the lines to print"), _("(The default value for the step is 1)")); printf ("-l, --warnings-to=PATH\n %s\n", _("Redirect warning and error messages from stderr to the indicated file")); printf ("-o, --output=PATH\n %s\n", _("Redirect output from stdout to the indicated file")); printf ("-h, --help\n %s\n", _("Show this help message")); printf ("-v, --version\n %s\n", _("Show version number, Copyright, Distribution Terms and NO-Warranty")); printf ("\n%s\n%s\n%s\n%s\n\n", _("The argument after the options is the name of the file to scan."), _("The complete path of the file should be given,\na directory name is not accepted."), _("If no input file is specified, the program reads from the standard input."), _("Exit status: 0 in case of normal termination, -1 (255) in case of error")); } extern int errno; extern char *optarg; extern int optind; static int set_args (int argc, char* argv[], Argslist *list) { const char *optstring = "hb:e:s:l:o:v"; struct option long_options[] = { {"help", 0, NULL, 'h'}, {"beginning", 1, NULL, 'b'}, {"start", 1, NULL, 'b'}, {"end", 1, NULL, 'e'}, {"step", 1, NULL, 's'}, {"warnings-to", 1, NULL, 'l'}, {"output", 1, NULL, 'o'}, {"version", 0, NULL, 'v'}, {0, 0, 0, 0} }; int option_index=0; char *endptr; int optch; /* We start by loading the default values for the user settable options. */ list->optmask = 0x0; list->begin_line=1; list->end_line=0; list->step=1; list->file=NULL; while ( (optch = getopt_long (argc, argv, optstring, long_options, &option_index)) != -1 ) { switch (optch) { case 'h': list->optmask |= ___H_MASK; break; case 'b': list->optmask |= ___B_MASK; errno = 0; for (endptr = optarg; is_space (*endptr) != 0; endptr++); if (*endptr == '-' || (list->begin_line = strtoul (optarg, &endptr, 10), errno == ERANGE) || list->begin_line == 0 || *endptr != '\0') { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE2, optch); return -1; } break; case 'e': list->optmask |= ___E_MASK; errno = 0; for (endptr = optarg; is_space (*endptr) != 0; endptr++); if (*endptr == '-' || (list->end_line = strtoul (optarg, &endptr, 10), errno == ERANGE) || *endptr != '\0') { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE2, optch); return -1; } break; case 's': list->optmask |= ___S_MASK; errno = 0; for (endptr = optarg; is_space (*endptr) != 0; endptr++); if (*endptr == '-' || (list->step = strtoul (optarg, &endptr, 10), errno == ERANGE) || list->step == 0 || *endptr != '\0') { fprintf (stderr, _("%s: invalid argument after `-%c\' option\n"), PACKAGE2, optch); return -1; } break; case 'l': if (!freopen (optarg, "w", stderr)) { fprintf (stderr, _("%s: cannot open file \"%s\":\n"), PACKAGE2, optarg); perror(0); return -1; } break; case 'o': if (!freopen (optarg, "w", stdout)) { fprintf (stderr, _("%s: cannot open file \"%s\":\n"), PACKAGE2, optarg); perror(0); return -1; } break; case 'v': list->optmask |= ___V_MASK; break; default: /* fprintf (stderr, */ /* _("%s: unrecognized option `-%c\' \n"), PACKAGE2, optch); */ return -1; } } if (!(list->optmask & (___H_MASK | ___V_MASK)) && argc - optind > 1) { print_selhelp (PACKAGE2); return -1; } else { if( !(list->optmask & (___H_MASK | ___V_MASK)) ) list->file = (const char*) argv[optind]; return 0; } } int main (int argc, char** argv) { Argslist arg_list; #ifdef ENABLE_NLS setlocale (LC_CTYPE, ""); setlocale (LC_MESSAGES, ""); #endif bindtextdomain (PACKAGE2, LOCALEDIR); textdomain (PACKAGE2); if ( set_args (argc, argv, &arg_list) != 0 ) return -1; else if ( (arg_list.optmask & (___H_MASK | ___V_MASK)) ) { if ((arg_list.optmask & ___V_MASK)) print_selversion(PACKAGE2); if ((arg_list.optmask & ___H_MASK)) print_selhelp(PACKAGE2); if (argc > 2) return -1; else return 0; } else { switch (scan_file (&arg_list)) { case OPEN_ERROR: fprintf (stderr, _("%s: cannot open file \"%s\":\n"), PACKAGE2, arg_list.file); perror(0); return -1; case CLOSE_ERROR: fprintf (stderr, _("%s: cannot close file \"%s\":\n"), PACKAGE2, arg_list.file); perror(0); return -1; case READ_ERROR: fprintf (stderr, _("%s: Error occurred while reading from file \"%s\"\n\n"), PACKAGE2, arg_list.file); return -1; default: return 0; } } } cmtk-3.0.0/Utilities/numdiff-5.2.1/inout.c0000644000177700000170000005645711666247630017111 0ustar torstenman/* File I/O for GNU DIFF. Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU DIFF. GNU DIFF is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU DIFF 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file, coming from the source code of GNU DIFF, has been modified by Ivano Primi so that it could be merged into the source code of Numdiff. Numdiff is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Numdiff 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. */ #include "numdiff.h" #include #include #include /* Lines are put into equivalence classes of lines that match in lines_differ. Each equivalence class is represented by one of these structures, but only while the classes are being computed. Afterward, each class is represented by a number. */ struct equivclass { lin next; /* Next item in this bucket. */ hash_value hash; /* Hash of lines in this class. */ char const *line; /* A line that fits this class. */ size_t length; /* That line's length, not counting its newline. */ short file; /* That line's file, 0 --> filevec[0].name, 1 --> filevec[1].name */ }; /* Hash-table: array of buckets, each being a chain of equivalence classes. buckets[-1] is reserved for incomplete lines. */ static lin *buckets; /* Number of buckets in the hash table array, not counting buckets[-1]. */ static size_t nbuckets; /* Array in which the equivalence classes are allocated. The bucket-chains go through the elements in this array. The number of an equivalence class is its index in this array. */ static struct equivclass *equivs; /* Index of first free element in the array `equivs'. */ static lin equivs_index; /* Number of elements allocated in the array `equivs'. */ static lin equivs_alloc; /* Read a block of data into a file buffer, checking for EOF and error. */ static void file_block_read (struct file_data *current, size_t size) { if (size && ! current->eof) { size_t s = block_read (current->desc, FILE_BUFFER (current) + current->buffered, size); if (s == SIZE_MAX) pfatal_with_name (current->name); current->buffered += s; current->eof = s < size; } } /* Check for binary files and compare them for exact identity. */ /* Return 1 if BUF contains a non text character. SIZE is the number of characters in BUF. */ #define binary_file_p(buf, size) (memchr (buf, 0, size) != 0) /* Get ready to read the current file. Return nonzero if SKIP_TEST is zero, and if it appears to be a binary file. */ static bool sip (struct file_data *current, bool skip_test) { /* If we have a nonexistent file at this stage, treat it as empty. */ if (current->desc < 0) { /* Leave room for a sentinel. */ current->bufsize = sizeof (word); current->buffer = xmalloc (current->bufsize); } else { current->bufsize = buffer_lcm (sizeof (word), STAT_BLOCKSIZE (current->stat), PTRDIFF_MAX - 2 * sizeof (word)); current->buffer = xmalloc (current->bufsize); if (! skip_test) { /* Check first part of file to see if it's a binary file. */ bool was_binary = set_binary_mode (current->desc, 1); off_t buffered; file_block_read (current, current->bufsize); buffered = current->buffered; if (! was_binary) { /* Revert to text mode and seek back to the beginning to reread the file. Use relative seek, since file descriptors like stdin might not start at offset zero. */ if (lseek (current->desc, - buffered, SEEK_CUR) == -1) pfatal_with_name (current->name); set_binary_mode (current->desc, 0); current->buffered = 0; current->eof = 0; } return binary_file_p (current->buffer, buffered); } } current->buffered = 0; current->eof = 0; return 0; } /* Slurp the rest of the current file completely into memory. */ static void slurp (struct file_data *current) { size_t cc; if (current->desc < 0) { /* The file is nonexistent. */ return; } if (S_ISREG (current->stat.st_mode)) { /* It's a regular file; slurp in the rest all at once. */ /* Get the size out of the stat block. Allocate just enough room for appended newline plus word sentinel, plus word-alignment since we want the buffer word-aligned. */ size_t file_size = current->stat.st_size; cc = file_size + 2 * sizeof (word) - file_size % sizeof (word); if (file_size != current->stat.st_size || cc < file_size || PTRDIFF_MAX <= cc) xalloc_die (); if (current->bufsize < cc) { current->bufsize = cc; current->buffer = xrealloc (current->buffer, cc); } /* Try to read at least 1 more byte than the size indicates, to detect whether the file is growing. This is a nicety for users who run 'diff' on files while they are changing. */ if (current->buffered <= file_size) { file_block_read (current, file_size + 1 - current->buffered); if (current->buffered <= file_size) return; } } /* It's not a regular file, or it's a growing regular file; read it, growing the buffer as needed. */ file_block_read (current, current->bufsize - current->buffered); if (current->buffered) { while (current->buffered == current->bufsize) { if (PTRDIFF_MAX / 2 - sizeof (word) < current->bufsize) xalloc_die (); current->bufsize *= 2; current->buffer = xrealloc (current->buffer, current->bufsize); file_block_read (current, current->bufsize - current->buffered); } /* Allocate just enough room for appended newline plus word sentinel, plus word-alignment. */ cc = current->buffered + 2 * sizeof (word); current->bufsize = cc - cc % sizeof (word); current->buffer = xrealloc (current->buffer, current->bufsize); } } /* Split the file into lines, simultaneously computing the equivalence class for each line. */ static void find_and_hash_each_line (struct file_data *current, char* ifs, int index, argslist *argl) { hash_value h; unsigned char const *p = (unsigned char const *) current->prefix_end; unsigned char *eof, c; lin i, *bucket; size_t length; /* Cache often-used quantities in local variables to help the compiler. */ int ignore_case = argl->optmask & _SI_MASK; const struct numfmt* pnf = (index) ? &argl->nf2 : &argl->nf1; unsigned char* ghostmask = (index) ? argl->ghostmask2 : argl->ghostmask1; unsigned char* pblurmask = (index) ? argl->pblurmask2 : argl->pblurmask1; unsigned char* tblurmask = (index) ? argl->tblurmask2 : argl->tblurmask1; char const **linbuf = current->linbuf; lin alloc_lines = current->alloc_lines; lin line = 0; lin linbuf_base = current->linbuf_base; lin *cureqs = xmalloc (alloc_lines * sizeof *cureqs); struct equivclass *eqs = equivs; lin eqs_index = equivs_index; lin eqs_alloc = equivs_alloc; char const *suffix_begin = current->suffix_begin; char const *bufend = FILE_BUFFER (current) + current->buffered; while ((char const *) p < suffix_begin) { char const *ip = (char const *) p; unsigned long fieldno; hash_value htmp; /* Hash this line until we find a newline. */ /* First we have to initialize `p' so that it points */ /* to the first character of the first field */ for (h = 0; *p != '\n' && (strchr (ifs, *p)); p++); for (fieldno = 0; *p != '\n'; fieldno++) { /* The first time we enter in this cycle we have *p != '\n' && strchr (ifs, *p) == NULL But (see the last line of the cycle) this is true also later */ for (eof = (unsigned char*)p + 1; *eof != '\n' && !strchr (ifs, *eof); eof++); /* We have to mark the end of the field before calling hcxnum() or acxnum(). But before doing this, we save the original character placed just after the field. */ c = *eof; *eof = '\0'; if ( (ghostmask[fieldno >> 3] & 0x80 >> (fieldno & 0x7)) ) { /* If the field lies in the ranges specified by the option -X, then it must be ignored. */ p = (unsigned char const *) eof; } else if ( (tblurmask[fieldno >> 3] & 0x80 >> (fieldno & 0x7)) ) { /* If the field lies in the ranges specified by the option -Z, then it must be always blurred, even if it is not numeric. */ h = HASH (h, NEWLINE); p = (unsigned char const *) eof; } else if ( (pblurmask[fieldno >> 3] & 0x80 >> (fieldno & 0x7)) ) { if ((unsigned char*) acxnum ((char*)p, pnf) < eof) { /* If the field is not numeric, then it must be hashed byte by byte, even if it lies in the ranges specified by the option -z. */ if ((ignore_case)) for(; (unsigned char*)p < eof; h = HASH (h, TOLOWER (*p)), p++); else for(; (unsigned char*)p < eof; h = HASH (h, *p), p++); } else { /* If the field is numeric AND lies in the ranges specified by -z, then this field has to be hashed as a special symbol. */ h = HASH (h, NEWLINE); p = (unsigned char const *) eof; } } else { /* If the field does not lie in the ranges specified by -z, -X and -Z, then this field must be always hashed byte by byte (particular numerical formats are converted before to the standard one). */ htmp = h; if ((unsigned char*) hcxnum ((char*)p, pnf, &htmp) < eof) { if ((ignore_case)) for(; (unsigned char*)p < eof; h = HASH (h, TOLOWER (*p)), p++); else for(; (unsigned char*)p < eof; h = HASH (h, *p), p++); } else { h = htmp; p = (unsigned char const *) eof; } } /* Now `p' points to the end of the field */ for (*eof = c; *p != '\n' && (strchr (ifs, *p)); p++); /* And now to the begin of the next field */ } p++; /* hashing_done:; */ bucket = &buckets[h % nbuckets]; length = (char const *) p - ip - 1; #ifdef _DEBUG_ fprintf (stderr, "File: \"%s\"\nLine: \"%.*s\"\nHash: %u\n", current->name, length, ip, h); #endif /* _DEBUG_ */ if ((char const *) p == bufend && current->missing_newline) { /* This line is incomplete. If this is significant, put the line into buckets[-1]. */ if (ignore_white_space < IGNORE_SPACE_CHANGE) bucket = &buckets[-1]; /* Omit the inserted newline when computing linbuf later. */ p--; bufend = suffix_begin = (char const *) p; } for (i = *bucket; ; i = eqs[i].next) if (!i) { /* Create a new equivalence class in this bucket. */ i = eqs_index++; if (i == eqs_alloc) { if (PTRDIFF_MAX / (2 * sizeof *eqs) <= eqs_alloc) xalloc_die (); eqs_alloc *= 2; eqs = xrealloc (eqs, eqs_alloc * sizeof *eqs); } eqs[i].next = *bucket; eqs[i].hash = h; eqs[i].line = ip; eqs[i].length = length; eqs[i].file = index; *bucket = i; break; } else if (eqs[i].hash == h) { char const *eqline = eqs[i].line; /* Reuse existing class if lines_differ reports the lines equal. */ if (eqs[i].length == length) { /* Reuse existing equivalence class if the lines are identical. This detects the common case of exact identity faster than lines_differ would. */ if (memcmp (eqline, ip, length) == 0) break; } if (! lines_differ (eqline, ip, eqs[i].file, index, argl) ) break; } /* Maybe increase the size of the line table. */ if (line == alloc_lines) { /* Double (alloc_lines - linbuf_base) by adding to alloc_lines. */ if (PTRDIFF_MAX / 3 <= alloc_lines || PTRDIFF_MAX / sizeof *cureqs <= 2 * alloc_lines - linbuf_base || PTRDIFF_MAX / sizeof *linbuf <= alloc_lines - linbuf_base) xalloc_die (); alloc_lines = 2 * alloc_lines - linbuf_base; cureqs = xrealloc (cureqs, alloc_lines * sizeof *cureqs); linbuf += linbuf_base; linbuf = xrealloc (linbuf, (alloc_lines - linbuf_base) * sizeof *linbuf); linbuf -= linbuf_base; } linbuf[line] = ip; cureqs[line] = i; ++line; } current->buffered_lines = line; for (i = 0; ; i++) { /* Record the line start for lines in the suffix that we care about. Record one more line start than lines, so that we can compute the length of any buffered line. */ if (line == alloc_lines) { /* Double (alloc_lines - linbuf_base) by adding to alloc_lines. */ if (PTRDIFF_MAX / 3 <= alloc_lines || PTRDIFF_MAX / sizeof *cureqs <= 2 * alloc_lines - linbuf_base || PTRDIFF_MAX / sizeof *linbuf <= alloc_lines - linbuf_base) xalloc_die (); alloc_lines = 2 * alloc_lines - linbuf_base; linbuf += linbuf_base; linbuf = xrealloc (linbuf, (alloc_lines - linbuf_base) * sizeof *linbuf); linbuf -= linbuf_base; } linbuf[line] = (char const *) p; if ((char const *) p == bufend) break; if ((suppress_common_lines)) break; line++; while (*p++ != '\n') continue; } /* Done with cache in local variables. */ current->linbuf = linbuf; current->valid_lines = line; current->alloc_lines = alloc_lines; current->equivs = cureqs; equivs = eqs; equivs_alloc = eqs_alloc; equivs_index = eqs_index; } /* Prepare the text. Make sure the text end is initialized. Make sure text ends in a newline, but remember that we had to add one. */ static void prepare_text (struct file_data *current) { size_t buffered = current->buffered; char *p = FILE_BUFFER (current); if (buffered == 0 || p[buffered - 1] == '\n') current->missing_newline = 0; else { p[buffered++] = '\n'; current->missing_newline = 1; } if (!p) return; /* Don't use uninitialized storage when planting or using sentinels. */ memset (p + buffered, 0, sizeof (word)); current->buffered = buffered; } /* We have found N lines in a buffer of size S; guess the proportionate number of lines that will be found in a buffer of size T. However, do not guess a number of lines so large that the resulting line table might cause overflow in size calculations. */ static lin guess_lines (lin n, size_t s, size_t t) { size_t guessed_bytes_per_line = n < 10 ? 32 : s / (n - 1); lin guessed_lines = MAX (1, t / guessed_bytes_per_line); return MIN (guessed_lines, PTRDIFF_MAX / (2 * sizeof (char *) + 1) - 5) + 5; } /* Given a vector of two file_data objects, find the identical prefixes and suffixes of each object. */ static void find_identical_ends (struct file_data filevec[]) { word *w0, *w1; char *p0, *p1, *buffer0, *buffer1; char const *end0, *beg0; char const **linbuf0, **linbuf1; lin i, lines; size_t n0, n1; lin alloc_lines0, alloc_lines1; lin buffered_prefix, prefix_count, prefix_mask; lin middle_guess, suffix_guess; slurp (&filevec[0]); prepare_text (&filevec[0]); if (filevec[0].desc != filevec[1].desc) { slurp (&filevec[1]); prepare_text (&filevec[1]); } else { filevec[1].buffer = filevec[0].buffer; filevec[1].bufsize = filevec[0].bufsize; filevec[1].buffered = filevec[0].buffered; filevec[1].missing_newline = filevec[0].missing_newline; } /* Find identical prefix. */ w0 = filevec[0].buffer; w1 = filevec[1].buffer; p0 = buffer0 = (char *) w0; p1 = buffer1 = (char *) w1; n0 = filevec[0].buffered; n1 = filevec[1].buffered; if (p0 == p1) /* The buffers are the same; sentinels won't work. */ p0 = p1 += n1; else { /* Insert end sentinels, in this case characters that are guaranteed to make the equality test false, and thus terminate the loop. */ if (n0 < n1) p0[n0] = ~p1[n0]; else p1[n1] = ~p0[n1]; /* Loop until first mismatch, or to the sentinel characters. */ /* Compare a word at a time for speed. */ while (*w0 == *w1) w0++, w1++; /* Do the last few bytes of comparison a byte at a time. */ p0 = (char *) w0; p1 = (char *) w1; while (*p0 == *p1) p0++, p1++; /* Don't mistakenly count missing newline as part of prefix. */ if ((buffer0 + n0 - filevec[0].missing_newline < p0) != (buffer1 + n1 - filevec[1].missing_newline < p1)) p0--, p1--; } /* Now P0 and P1 point at the first nonmatching characters. */ /* Skip back to last line-beginning in the prefix */ while (p0 != buffer0 && p0[-1] != '\n') p0--, p1--; /* Record the prefix. */ filevec[0].prefix_end = p0; filevec[1].prefix_end = p1; /* Find identical suffix. */ /* P0 and P1 point beyond the last chars not yet compared. */ p0 = buffer0 + n0; p1 = buffer1 + n1; if (filevec[0].missing_newline == filevec[1].missing_newline) { end0 = p0; /* Addr of last char in file 0. */ /* Get value of P0 at which we should stop scanning backward: this is when either P0 or P1 points just past the last char of the identical prefix. */ beg0 = filevec[0].prefix_end + (n0 < n1 ? 0 : n0 - n1); /* Scan back until chars don't match or we reach that point. */ for (; p0 != beg0; p0--, p1--) if (*p0 != *p1) { /* Point at the first char of the matching suffix. */ beg0 = p0; break; } /* Are we at a line-beginning in both files? If not, add the rest of this line to the main body. Discard one line, because shift_boundaries may need it. */ i = !((buffer0 == p0 || p0[-1] == '\n') && (buffer1 == p1 || p1[-1] == '\n')); while (i-- && p0 != end0) while (*p0++ != '\n') continue; p1 += p0 - beg0; } /* Record the suffix. */ filevec[0].suffix_begin = p0; filevec[1].suffix_begin = p1; /* Calculate number of lines of prefix to save. prefix_count == 0 means save the whole prefix; we need this for options that output the whole file. Otherwise, prefix_count == 1 and the prefix is not saved. */ if (suppress_common_lines && 0 < n0) { middle_guess = guess_lines (0, 0, p0 - filevec[0].prefix_end); suffix_guess = guess_lines (0, 0, buffer0 + n0 - p0); prefix_count = 1; alloc_lines0 = (prefix_count + middle_guess); } else { prefix_count = 0; alloc_lines0 = guess_lines (0, 0, n0); } prefix_mask = prefix_count - 1; lines = 0; linbuf0 = xmalloc (alloc_lines0 * sizeof *linbuf0); p0 = buffer0; /* If the prefix is needed, find the prefix lines. */ if (! (suppress_common_lines && filevec[0].prefix_end == p0 && filevec[1].prefix_end == p1)) { end0 = filevec[0].prefix_end; while (p0 != end0) { lin l = lines++ & prefix_mask; if (l == alloc_lines0) { if (PTRDIFF_MAX / (2 * sizeof *linbuf0) <= alloc_lines0) xalloc_die (); alloc_lines0 *= 2; linbuf0 = xrealloc (linbuf0, alloc_lines0 * sizeof *linbuf0); } linbuf0[l] = p0; while (*p0++ != '\n') continue; } } /* buffered_prefix = prefix_count && 0 < lines ? 0 : lines; */ buffered_prefix = (prefix_count) ? 0 : lines; /* Allocate line buffer 1. */ middle_guess = guess_lines (lines, p0 - buffer0, p1 - filevec[1].prefix_end); suffix_guess = guess_lines (lines, p0 - buffer0, buffer1 + n1 - p1); alloc_lines1 = buffered_prefix + middle_guess; if (alloc_lines1 < buffered_prefix || PTRDIFF_MAX / sizeof *linbuf1 <= alloc_lines1) xalloc_die (); linbuf1 = xmalloc (alloc_lines1 * sizeof *linbuf1); /* Initialize line buffer 1 from line buffer 0. */ for (i = 0; i < buffered_prefix; i++) linbuf1[i] = linbuf0[i] - buffer0 + buffer1; /* Record the line buffer, adjusted so that linbuf[0] points at the first differing line. */ filevec[0].linbuf = linbuf0 + buffered_prefix; filevec[1].linbuf = linbuf1 + buffered_prefix; filevec[0].linbuf_base = filevec[1].linbuf_base = - buffered_prefix; filevec[0].alloc_lines = alloc_lines0 - buffered_prefix; filevec[1].alloc_lines = alloc_lines1 - buffered_prefix; filevec[0].prefix_lines = filevec[1].prefix_lines = lines; } /* If 1 < k, then (2**k - prime_offset[k]) is the largest prime less than 2**k. This table is derived from Chris K. Caldwell's list . */ static unsigned char const prime_offset[] = { 0, 0, 1, 1, 3, 1, 3, 1, 5, 3, 3, 9, 3, 1, 3, 19, 15, 1, 5, 1, 3, 9, 3, 15, 3, 39, 5, 39, 57, 3, 35, 1, 5, 9, 41, 31, 5, 25, 45, 7, 87, 21, 11, 57, 17, 55, 21, 115, 59, 81, 27, 129, 47, 111, 33, 55, 5, 13, 27, 55, 93, 1, 57, 25 }; /* Verify that this host's size_t is not too wide for the above table. */ verify (enough_prime_offsets, sizeof (size_t) * CHAR_BIT <= sizeof prime_offset); /* Given a vector of two file_data objects, read the file associated with each one, and build the table of equivalence classes. Return nonzero if either file appears to be a binary file. */ bool read_files (struct file_data filevec[], argslist* argl) { int i; bool appears_binary = sip (&filevec[0], 0); char *ifs1, *ifs2; ifs1 = (!argl->ifs1) ? IFS : argl->ifs1; ifs2 = (!argl->ifs2) ? IFS : argl->ifs2; if (filevec[0].desc != filevec[1].desc) appears_binary |= sip (&filevec[1], appears_binary); /*# skip test if appears_binary is already !0 #*/ /* else */ /* { */ /* filevec[1].buffer = filevec[0].buffer; */ /* filevec[1].bufsize = filevec[0].bufsize; */ /* filevec[1].buffered = filevec[0].buffered; */ /* } */ if (appears_binary) return 1; find_identical_ends (filevec); equivs_alloc = filevec[0].alloc_lines + filevec[1].alloc_lines + 1; if (PTRDIFF_MAX / sizeof *equivs <= equivs_alloc) xalloc_die (); equivs = xmalloc (equivs_alloc * sizeof *equivs); /* Equivalence class 0 is permanently safe for lines that were not hashed. Real equivalence classes start at 1. */ equivs_index = 1; /* Allocate (one plus) a prime number of hash buckets. Use a prime number between 1/3 and 2/3 of the value of equiv_allocs, approximately. */ for (i = 9; (size_t) 1 << i < equivs_alloc / 3; i++) continue; nbuckets = ((size_t) 1 << i) - prime_offset[i]; if (PTRDIFF_MAX / sizeof *buckets <= nbuckets) xalloc_die (); buckets = zalloc ((nbuckets + 1) * sizeof *buckets); buckets++; find_and_hash_each_line (&filevec[0], ifs1, 0, argl); find_and_hash_each_line (&filevec[1], ifs2, 1, argl); filevec[0].equiv_max = filevec[1].equiv_max = equivs_index; free (equivs); free (buckets - 1); return 0; } cmtk-3.0.0/Utilities/numdiff-5.2.1/error.h0000644000177700000170000000465711666247630017104 0ustar torstenman/* Declaration for error-reporting function Copyright (C) 1995, 1996, 1997, 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _ERROR_H #define _ERROR_H 1 #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ # define __attribute__(Spec) /* empty */ # endif /* The __-protected variants of `format' and `printf' attributes are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) # define __format__ format # define __printf__ printf # endif #endif #ifdef __cplusplus extern "C" { #endif /* Print a message with `fprintf (stderr, FORMAT, ...)'; if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) __attribute__ ((__format__ (__printf__, 5, 6))); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ extern void (*error_print_progname) (void); /* This variable is incremented each time `error' is called. */ extern unsigned int error_message_count; /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ extern int error_one_per_line; #ifdef __cplusplus } #endif #endif /* error.h */ cmtk-3.0.0/Utilities/numdiff-5.2.1/po/0000755000177700000170000000000012263615445016201 5ustar torstenmancmtk-3.0.0/Utilities/numdiff-5.2.1/po/numdiff/0000755000177700000170000000000012263615445017631 5ustar torstenmancmtk-3.0.0/Utilities/numdiff-5.2.1/po/numdiff/numdiff.pot0000644000177700000170000003742611765475736022036 0ustar torstenman# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: numdiff 5.2.0\n" "Report-Msgid-Bugs-To: ivprimi@libero.it\n" "POT-Creation-Date: 2010-01-07 17:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #: cmpfns.c:270 cmpfns.c:286 cmpfns.c:338 cmpfns.c:354 #, c-format msgid "@ Line %lu in file \"%s\" contains too many fields!\n" msgstr "" #: cmpfns.c:370 cmpfns.c:386 #, c-format msgid "@ Line %lu in file \"%s\" is shorter than expected!\n" msgstr "" #: cmpfns.c:491 cmpfns.c:512 cmpfns.c:540 cmpfns.c:555 #, c-format msgid "" "\n" "*** Error in reading from file \"%s\"\n" msgstr "" #: cmpfns.c:494 cmpfns.c:515 cmpfns.c:543 cmpfns.c:560 #, c-format msgid "" "\n" "*** Out of memory while reading from file \"%s\"\n" msgstr "" #: cmpfns.c:501 cmpfns.c:520 cmpfns.c:526 cmpfns.c:547 #, c-format msgid "" "\n" "*** End of file \"%s\" reached\n" msgstr "" #: cmpfns.c:502 cmpfns.c:521 cmpfns.c:527 cmpfns.c:548 #, c-format msgid "" " Likely the files \"%s\" and \"%s\" do not have the same number of " "lines !\n" msgstr "" #: error.c:125 msgid "Unknown system error" msgstr "" #: errors.c:43 #, c-format msgid "" "%s: insufficient memory for new allocation,\n" "the execution of the program ends now\n" msgstr "" #: errors.c:76 #, c-format msgid "Runtime error: %s\n" msgstr "" #: errors.c:110 #, c-format msgid "Runtime warning: %s\n" msgstr "" #: flags.c:58 msgid "\n" msgstr "" #: getopt.c:551 getopt.c:570 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: getopt.c:603 getopt.c:607 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: getopt.c:616 getopt.c:621 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: getopt.c:667 getopt.c:689 getopt.c:1020 getopt.c:1042 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "" #: getopt.c:727 getopt.c:730 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #: getopt.c:738 getopt.c:741 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #: getopt.c:796 getopt.c:799 #, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: getopt.c:805 getopt.c:808 #, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: getopt.c:863 getopt.c:882 getopt.c:1095 getopt.c:1116 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "" #: getopt.c:935 getopt.c:954 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "" #: getopt.c:978 getopt.c:999 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "" #: io.c:127 msgid "@ Absolute error = " msgstr "" #: io.c:129 msgid ", Relative error = " msgstr "" #: main.c:307 msgid "" "\n" " In the computation of the following quantities\n" " only the errors with positive sign are considered:\n" msgstr "" #: main.c:309 msgid "" " differences due to numeric fields of the second file that are\n" " less than the corresponding fields in the first file are neglected\n" "\n" msgstr "" #: main.c:314 msgid "" "\n" " In the computation of the following quantities\n" " only the errors with negative sign are considered:\n" msgstr "" #: main.c:316 msgid "" " differences due to numeric fields of the second file that are\n" " greater than the corresponding fields in the first file are neglected\n" "\n" msgstr "" #: main.c:322 msgid "" "\n" "No numeric comparison has been done\n" msgstr "" #: main.c:326 #, c-format msgid "" "\n" "One numeric comparison has been done and\n" "the resulting numeric difference is negligible\n" msgid_plural "" "\n" "%d numeric comparisons have been done and\n" "the resulting numeric differences are all negligible\n" msgstr[0] "" msgstr[1] "" #: main.c:333 #, c-format msgid "" "\n" "One numeric comparison has been done and\n" "has produced an outcome beyond the tolerance threshold\n" msgid_plural "" "\n" "%d numeric comparisons have been done, all of them\n" "have produced an outcome beyond the tolerance threshold\n" msgstr[0] "" msgstr[1] "" #: main.c:341 #, c-format msgid "" "\n" "One numeric comparison has been done,\n" msgid_plural "" "\n" "%d numeric comparisons have been done,\n" msgstr[0] "" msgstr[1] "" #: main.c:346 #, c-format msgid "" "only one numeric comparison has produced an outcome\n" "beyond the tolerance threshold\n" msgid_plural "" "%d numeric comparisons have produced an outcome\n" "beyond the tolerance threshold\n" msgstr[0] "" msgstr[1] "" #: main.c:351 msgid "" "\n" "Largest absolute error in the set of relevant numerical differences:\n" msgstr "" #: main.c:354 msgid "" "\n" "Corresponding relative error:\n" msgstr "" #: main.c:357 msgid "" "\n" "Largest relative error in the set of relevant numerical differences:\n" msgstr "" #: main.c:360 msgid "" "\n" "Corresponding absolute error:\n" msgstr "" #: main.c:364 msgid "" "\n" "Sum of all absolute errors:\n" msgstr "" #: main.c:367 msgid "" "\n" "Sum of the relevant absolute errors:\n" msgstr "" #: main.c:373 msgid "" "\n" "Arithmetic mean of all absolute errors:\n" msgstr "" #: main.c:376 msgid "" "\n" "Arithmetic mean of the relevant absolute errors:\n" msgstr "" #: main.c:385 msgid "" "\n" "Square root of the sum of the squares of all absolute errors:\n" msgstr "" #: main.c:388 msgid "" "\n" "Quadratic mean of all absolute errors:\n" msgstr "" #: main.c:396 msgid "" "\n" "Square root of the sum of the squares\n" "of the relevant absolute errors:\n" msgstr "" #: main.c:399 msgid "" "\n" "Quadratic mean of the relevant absolute errors:\n" msgstr "" #: main.c:488 #, c-format msgid "" "\n" "+++ Files \"%s\" and \"%s\" have the same structure\n" msgstr "" #: main.c:491 #, c-format msgid "" "\n" "+++ Files \"%s\" and \"%s\" are equal\n" msgstr "" #: main.c:495 #, c-format msgid "" "\n" "+++ File \"%s\" differs from file \"%s\"\n" msgstr "" #: new.c:147 numutil.c:152 numutil.c:303 #, c-format msgid "" "%s: a number with a too small exponent has been found,\n" "namely \"%s\".\n" msgstr "" #: new.c:148 numutil.c:153 numutil.c:304 #, c-format msgid "Exponents smaller than %ld are not accepted,\n" msgstr "" #: new.c:149 new.c:156 numutil.c:154 numutil.c:161 numutil.c:305 numutil.c:312 #, c-format msgid "the execution of the program ends now\n" msgstr "" #: new.c:154 numutil.c:159 numutil.c:310 #, c-format msgid "" "%s: a number with a too large exponent has been found,\n" "namely \"%s\".\n" msgstr "" #: new.c:155 numutil.c:160 numutil.c:311 #, c-format msgid "Exponents larger than %ld are not accepted,\n" msgstr "" #: number.c:1228 msgid "power with non integral base" msgstr "" #: number.c:1234 number.c:1285 msgid "power with non integral exponent" msgstr "" #: number.c:1241 msgid "modulus is not an integral value" msgstr "" #: number.c:1289 msgid "exponent too large in raise" msgstr "" #: numutil.c:854 #, c-format msgid "" "The string \"%s\"\n" "is not a valid number, the execution of the program ends now\n" msgstr "" #: options.c:45 msgid "Ivano Primi" msgstr "" #: options.c:46 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later,\n" "see .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #: options.c:52 msgid "" "The software has been linked against\n" "the GNU Multiple Precision Arithmetic Library,\n" "version number" msgstr "" #: options.c:56 msgid "" "The software has been built with\n" "its own internal support for multiple precision arithmetic" msgstr "" #: options.c:63 msgid "Usage:" msgstr "" #: options.c:64 msgid "or" msgstr "" #: options.c:66 #, c-format msgid "" "\n" "INT stays for a positive integer value or for a range of integer values,\n" "like 1-, 3-5 or -7\n" msgstr "" #: options.c:68 #, c-format msgid "" "\n" "Compare putatively similar files line by line and field by field,\n" "ignoring small numeric differences or/and different numeric formats\n" "\n" msgstr "" #: options.c:70 msgid "" "Specify the set of characters to use\n" " to split the input lines into fields" msgstr "" #: options.c:71 msgid "(The default set of characters is space, tab and newline)" msgstr "" #: options.c:73 msgid "" "Specify the maximum absolute difference permitted\n" " before that two numeric fields are regarded as different" msgstr "" #: options.c:74 options.c:77 msgid "(The default value is zero)" msgstr "" #: options.c:76 msgid "" "Specify the maximum relative difference permitted\n" " before that two numeric fields are regarded as different" msgstr "" #: options.c:79 msgid "" "Order that two numerical values are regarded as equal only if\n" " both absolute and relative difference do not exceed\n" " the corresponding tolerance threshold" msgstr "" #: options.c:81 msgid "" "Specify the number of digits in the significands\n" " used in multiple precision arithmetic" msgstr "" #: options.c:83 msgid "" "Ignore all differences due to numeric fields of the second file that\n" " are less than the corresponding numeric fields in the first file" msgstr "" #: options.c:85 msgid "" "Ignore all differences due to numeric fields of the second file that\n" " are greater than the corresponding numeric fields in the first file" msgstr "" #: options.c:87 msgid "Ignore changes in case while doing literal comparisons" msgstr "" #: options.c:89 msgid "" "Specify the characters representing the decimal point\n" " in the two files to compare" msgstr "" #: options.c:91 msgid "" "Specify the characters representing the thousands separator\n" " in the two files to compare" msgstr "" #: options.c:93 msgid "" "Specify the number of digits forming each group of thousands\n" " in the two files to compare" msgstr "" #: options.c:95 msgid "" "Specify the (optional) prefixes for positive values\n" " used in the two files to compare" msgstr "" #: options.c:97 msgid "" "Specify the prefixes for negative values\n" " used in the two files to compare" msgstr "" #: options.c:99 msgid "" "Specify the exponent letters\n" " used in the two files to compare" msgstr "" #: options.c:101 msgid "" "Specify the characters representing the imaginary unit\n" " in the two files to compare" msgstr "" #: options.c:103 msgid "Select the fields of the first file that have to be ignored" msgstr "" #: options.c:105 msgid "Select the fields of the second file that have to be ignored" msgstr "" #: options.c:107 msgid "" "While printing the differences between the two compared files\n" " show only the numerical ones" msgstr "" #: options.c:109 msgid "" "While printing the differences between the two compared files\n" " neglect all the numerical ones (dummy mode)" msgstr "" #: options.c:111 msgid "" "Suppress all messages concerning the differences discovered\n" " in the structures of the two files" msgstr "" #: options.c:113 msgid "" "For every couple of lines which differ in at least one field print\n" " an header to show how these lines appear in the two compared files" msgstr "" #: options.c:115 msgid "Suppress all the standard output" msgstr "" #: options.c:117 msgid "Add some statistics to the standard output" msgstr "" #: options.c:119 msgid "" "Select the fields of the first file that have to be\n" " blurred during the synchronization procedure\n" " only if they turn out to be numeric" msgstr "" #: options.c:121 msgid "" "Select the fields of the second file that have to be\n" " blurred during the synchronization procedure\n" " only if they turn out to be numeric" msgstr "" #: options.c:123 msgid "" "Select the fields of the first file that have to be\n" " unconditionally blurred during the synchronization procedure" msgstr "" #: options.c:125 msgid "" "Select the fields of the second file that have to be\n" " unconditionally blurred during the synchronization procedure" msgstr "" #: options.c:127 msgid "During synchronization try hard to find a smaller set of changes" msgstr "" #: options.c:129 msgid "" "During synchronization assume large files and\n" " many scattered small changes" msgstr "" #: options.c:131 msgid "" "Run only the filter and then show the results of its\n" " attempt to synchronize the two files." msgstr "" #: options.c:132 msgid "" "If 'NUM' is zero or is not specified, output at most 130 columns per line." msgstr "" #: options.c:133 msgid "" "If 'NUM' is a positive number, output at most\n" " 'NUM' columns per line." msgstr "" #: options.c:134 msgid "" "If 'NUM' is a negative number, do not output common lines\n" " and display at most -'NUM' columns per line." msgstr "" #: options.c:136 msgid "" "Expand tabs to spaces in output while displaying the results of the\n" " synchronization procedure (meaningful only together with option -f)" msgstr "" #: options.c:138 msgid "Redirect warning and error messages from stderr to the indicated file" msgstr "" #: options.c:140 msgid "Redirect output from stdout to the indicated file" msgstr "" #: options.c:141 msgid "Show help message and predefined settings" msgstr "" #: options.c:142 msgid "Show version number, Copyright, Distribution Terms and NO-Warranty" msgstr "" #: options.c:144 msgid "" "The two arguments after the options are the names of the files to compare." msgstr "" #: options.c:145 msgid "" "The complete paths of the files should be given,\n" "a directory name is not accepted." msgstr "" #: options.c:146 msgid "" "They cannot refer to the same file but one of them can be \"-\",\n" "which refers to stdin." msgstr "" #: options.c:147 msgid "" "Exit status: 1 if files differ, 0 if they are equal, -1 (255) in case of " "error" msgstr "" #: options.c:149 msgid "" "\n" " Default numeric format (for both files to compare):\n" msgstr "" #: options.c:150 #, c-format msgid "Decimal point = `%c'\n" msgstr "" #: options.c:152 options.c:814 options.c:831 #, c-format msgid "Thousands separator = `%c'\n" msgstr "" #: options.c:153 #, c-format msgid "Number of digits in each thousands group = %u\n" msgstr "" #: options.c:155 options.c:815 options.c:832 #, c-format msgid "Leading positive sign = `%c'\n" msgstr "" #: options.c:156 options.c:816 options.c:833 #, c-format msgid "Leading negative sign = `%c'\n" msgstr "" #: options.c:157 options.c:817 options.c:834 #, c-format msgid "Prefix for decimal exponent = `%c'\n" msgstr "" #: options.c:158 options.c:820 options.c:837 #, c-format msgid "" "Symbol used to denote the imaginary unit = `%c'\n" "\n" msgstr "" #: options.c:506 options.c:521 options.c:538 options.c:553 options.c:575 #: options.c:635 options.c:661 options.c:677 options.c:698 options.c:735 #: options.c:750 #, c-format msgid "%s: invalid argument after `-%c' option\n" msgstr "" #: options.c:619 #, c-format msgid "%s: invalid argument after `-%c' option:\n" msgstr "" #: options.c:621 #, c-format msgid "" " A list of field delimiters can not be empty and\n" " must always include the newline character ('\\n')\n" msgstr "" #: options.c:761 options.c:770 #, c-format msgid "%s: cannot open file \"%s\":\n" msgstr "" #: options.c:810 #, c-format msgid "The numeric format specified for the first file is illegal,\n" msgstr "" #: options.c:812 options.c:829 #, c-format msgid "" "the following symbols should be all different\n" "while two or more of them are actually equal:\n" msgstr "" #: options.c:813 options.c:830 #, c-format msgid "" "\n" "Decimal point = `%c'\n" msgstr "" #: options.c:827 #, c-format msgid "The numeric format specified for the second file is illegal,\n" msgstr "" #: util.c:117 util.c:130 util.c:238 util.c:252 #, c-format msgid "" "Line \"%s\"\n" "contains too many fields!\n" msgstr "" #: xalloc-die.c:35 msgid "memory exhausted" msgstr "" cmtk-3.0.0/Utilities/numdiff-5.2.1/po/numdiff/it.po0000644000177700000170000006331611765475736020633 0ustar torstenman# Italian messages for numdiff # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi # This file is distributed under the same license as the Numdiff program. # Ivano Primi , 2010. # msgid "" msgstr "" "Project-Id-Version: numdiff 5.2.0\n" "Report-Msgid-Bugs-To: ivprimi@libero.it\n" "POT-Creation-Date: 2010-01-07 17:05+0100\n" "PO-Revision-Date: 2010-01-07 17:30+0100\n" "Last-Translator: Ivano Primi \n" "Language-Team: ITALIAN \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1 ? 1 : 0;\n" #: cmpfns.c:270 cmpfns.c:286 cmpfns.c:338 cmpfns.c:354 #, c-format msgid "@ Line %lu in file \"%s\" contains too many fields!\n" msgstr "@ La linea %lu nel file \"%s\" contiene troppi campi!\n" #: cmpfns.c:370 cmpfns.c:386 #, c-format msgid "@ Line %lu in file \"%s\" is shorter than expected!\n" msgstr "@ La linea %lu nel file \"%s\" è più corta del previsto!\n" #: cmpfns.c:491 cmpfns.c:512 cmpfns.c:540 cmpfns.c:555 #, c-format msgid "" "\n" "*** Error in reading from file \"%s\"\n" msgstr "" "\n" "*** Errore in lettura dal file \"%s\"\n" #: cmpfns.c:494 cmpfns.c:515 cmpfns.c:543 cmpfns.c:560 #, c-format msgid "" "\n" "*** Out of memory while reading from file \"%s\"\n" msgstr "" "\n" "*** Esaurimento di memoria durante la lettura del file \"%s\"\n" #: cmpfns.c:501 cmpfns.c:520 cmpfns.c:526 cmpfns.c:547 #, c-format msgid "" "\n" "*** End of file \"%s\" reached\n" msgstr "" "\n" "*** Raggiunta la fine del file \"%s\"\n" #: cmpfns.c:502 cmpfns.c:521 cmpfns.c:527 cmpfns.c:548 #, c-format msgid "" " Likely the files \"%s\" and \"%s\" do not have the same number of " "lines !\n" msgstr "" " Probabilmente i file \"%s\" e \"%s\" non hanno lo stesso numero di " "linee !\n" #: error.c:125 msgid "Unknown system error" msgstr "Errore di sistema sconosciuto" #: errors.c:43 #, c-format msgid "" "%s: insufficient memory for new allocation,\n" "the execution of the program ends now\n" msgstr "" "%s: memoria insufficiente per nuova assegnazione,\n" "l'esecuzione del programma finisce qui\n" #: errors.c:76 #, c-format msgid "Runtime error: %s\n" msgstr "Errore durante l'esecuzione del programma: %s\n" #: errors.c:110 #, c-format msgid "Runtime warning: %s\n" msgstr "Avvertimento lanciato durante l'esecuzione del programma:\n" "%s\n" #: flags.c:58 msgid "\n" msgstr "\n" #: getopt.c:551 getopt.c:570 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: l'opzione `%s' è ambigua\n" #: getopt.c:603 getopt.c:607 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: l'opzione `--%s' non vuole argomenti\n" #: getopt.c:616 getopt.c:621 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: l'opzione `%c%s' non vuole argomenti\n" #: getopt.c:667 getopt.c:689 getopt.c:1020 getopt.c:1042 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: l'opzione `%s' ha bisogno di un argomento\n" #: getopt.c:727 getopt.c:730 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: l'opzione `--%s' risulta sconosciuta\n" #: getopt.c:738 getopt.c:741 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: l'opzione `%c%s' risulta sconosciuta\n" #: getopt.c:796 getopt.c:799 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opzione inammissibile -- %c\n" #: getopt.c:805 getopt.c:808 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opzione non valida -- %c\n" #: getopt.c:863 getopt.c:882 getopt.c:1095 getopt.c:1116 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: opzione con argomento obbligatorio -- %c\n" #: getopt.c:935 getopt.c:954 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: l'opzione `-W %s' è ambigua\n" #: getopt.c:978 getopt.c:999 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: l'opzione `-W %s' non vuole argomenti\n" #: io.c:127 msgid "@ Absolute error = " msgstr "@ Errore assoluto = " #: io.c:129 msgid ", Relative error = " msgstr ", Errore relativo = " #: main.c:307 msgid "" "\n" " In the computation of the following quantities\n" " only the errors with positive sign are considered:\n" msgstr "" "\n" " Nel calcolo dei seguenti valori vengono considerati\n" " solo gli errori con segno positivo:\n" #: main.c:309 msgid "" " differences due to numeric fields of the second file that are\n" " less than the corresponding fields in the first file are neglected\n" "\n" msgstr "" " le differenze dovute a campi numerici del secondo file\n" " che risultano essere minori dei corrispondenti campi\n" " del primo file sono state tralasciate\n" "\n" #: main.c:314 msgid "" "\n" " In the computation of the following quantities\n" " only the errors with negative sign are considered:\n" msgstr "" "\n" " Nel calcolo dei seguenti valori vengono considerati\n" " solo gli errori con segno negativo:\n" #: main.c:316 msgid "" " differences due to numeric fields of the second file that are\n" " greater than the corresponding fields in the first file are neglected\n" "\n" msgstr "" " le differenze dovute a campi numerici del secondo file\n" " che risultano essere maggiori dei corrispondenti campi\n" " del primo file sono state tralasciate\n" "\n" #: main.c:322 msgid "" "\n" "No numeric comparison has been done\n" msgstr "" "\n" "Non è stato effettuato alcun confronto numerico\n" #: main.c:326 #, c-format msgid "" "\n" "One numeric comparison has been done and\n" "the resulting numeric difference is negligible\n" msgid_plural "" "\n" "%d numeric comparisons have been done and\n" "the resulting numeric differences are all negligible\n" msgstr[0] "" "\n" "È stato effettuato un solo confronto numerico e\n" "la differenza numerica rilevata è trascurabile\n" msgstr[1] "" "\n" "Sono stati effettuati %d confronti numerici e\n" "le differenze numeriche rilevate sono tutte trascurabili\n" #: main.c:333 #, c-format msgid "" "\n" "One numeric comparison has been done and\n" "has produced an outcome beyond the tolerance threshold\n" msgid_plural "" "\n" "%d numeric comparisons have been done, all of them\n" "have produced an outcome beyond the tolerance threshold\n" msgstr[0] "" "\n" "È stato effettuato un solo confronto numerico e\n" "ha prodotto un risultato oltre la soglia di tolleranza\n" msgstr[1] "" "\n" "Sono stati effettuati %d confronti numerici e tutti\n" "hanno prodotto un risultato oltre la soglia di tolleranza\n" #: main.c:341 #, c-format msgid "" "\n" "One numeric comparison has been done,\n" msgid_plural "" "\n" "%d numeric comparisons have been done,\n" msgstr[0] "" "\n" "È stato effettuato un solo confronto numerico,\n" msgstr[1] "" "\n" "Sono stati effettuati %d confronti numerici,\n" #: main.c:346 #, c-format msgid "" "only one numeric comparison has produced an outcome\n" "beyond the tolerance threshold\n" msgid_plural "" "%d numeric comparisons have produced an outcome\n" "beyond the tolerance threshold\n" msgstr[0] "" "un solo confronto numerico ha prodotto un risultato\n" "oltre la soglia di tolleranza\n" msgstr[1] "" "%d confronti numerici hanno prodotto un risultato\n" "oltre la soglia di tolleranza\n" #: main.c:351 msgid "" "\n" "Largest absolute error in the set of relevant numerical differences:\n" msgstr "" "\n" "Massimo errore assoluto nell'insieme delle differenze numeriche rilevanti:\n" #: main.c:354 msgid "" "\n" "Corresponding relative error:\n" msgstr "" "\n" "Corrispondente errore relativo:\n" #: main.c:357 msgid "" "\n" "Largest relative error in the set of relevant numerical differences:\n" msgstr "" "\n" "Massimo errore relativo nell'insieme delle differenze numeriche rilevanti:\n" #: main.c:360 msgid "" "\n" "Corresponding absolute error:\n" msgstr "" "\n" "Corrispondente errore assoluto:\n" #: main.c:364 msgid "" "\n" "Sum of all absolute errors:\n" msgstr "" "\n" "Somma degli errori assoluti:\n" #: main.c:367 msgid "" "\n" "Sum of the relevant absolute errors:\n" msgstr "" "\n" "Somma degli errori assoluti non trascurabili:\n" #: main.c:373 msgid "" "\n" "Arithmetic mean of all absolute errors:\n" msgstr "" "\n" "Media aritmetica degli errori assoluti:\n" #: main.c:376 msgid "" "\n" "Arithmetic mean of the relevant absolute errors:\n" msgstr "" "\n" "Media aritmetica degli errori assoluti non trascurabili:\n" #: main.c:385 msgid "" "\n" "Square root of the sum of the squares of all absolute errors:\n" msgstr "" "\n" "Radice quadrata della somma dei quadrati\n" "di tutti gli errori assoluti:\n" #: main.c:388 msgid "" "\n" "Quadratic mean of all absolute errors:\n" msgstr "" "\n" "Media quadratica degli errori assoluti:\n" #: main.c:396 msgid "" "\n" "Square root of the sum of the squares\n" "of the relevant absolute errors:\n" msgstr "" "\n" "Radice quadrata della somma dei quadrati\n" "di tutti gli errori assoluti non trascurabili:\n" #: main.c:399 msgid "" "\n" "Quadratic mean of the relevant absolute errors:\n" msgstr "" "\n" "Media quadratica degli errori assoluti non trascurabili:\n" #: main.c:488 #, c-format msgid "" "\n" "+++ Files \"%s\" and \"%s\" have the same structure\n" msgstr "" "\n" "+++ I file \"%s\" e \"%s\" hanno la stessa struttura\n" #: main.c:491 #, c-format msgid "" "\n" "+++ Files \"%s\" and \"%s\" are equal\n" msgstr "" "\n" "+++ I file \"%s\" e \"%s\" sono uguali\n" #: main.c:495 #, c-format msgid "" "\n" "+++ File \"%s\" differs from file \"%s\"\n" msgstr "" "\n" "+++ Il file \"%s\" differisce dal file \"%s\"\n" #: new.c:147 numutil.c:152 numutil.c:303 #, c-format msgid "" "%s: a number with a too small exponent has been found,\n" "namely \"%s\".\n" msgstr "" "%s: è stato trovato un numero con un esponente troppo basso,\n" "precisamente \"%s\".\n" #: new.c:148 numutil.c:153 numutil.c:304 #, c-format msgid "Exponents smaller than %ld are not accepted,\n" msgstr "Esponenti inferiori a %ld non sono accettati,\n" #: new.c:149 new.c:156 numutil.c:154 numutil.c:161 numutil.c:305 numutil.c:312 #, c-format msgid "the execution of the program ends now\n" msgstr "l'esecuzione del programma finisce qui\n" #: new.c:154 numutil.c:159 numutil.c:310 #, c-format msgid "" "%s: a number with a too large exponent has been found,\n" "namely \"%s\".\n" msgstr "" "%s: è stato trovato un numero con un esponente troppo alto,\n" "precisamente \"%s\".\n" #: new.c:155 numutil.c:160 numutil.c:311 #, c-format msgid "Exponents larger than %ld are not accepted,\n" msgstr "Esponenti superiori a %ld non sono accettati,\n" #: number.c:1228 msgid "power with non integral base" msgstr "potenza con base non intera" #: number.c:1234 number.c:1285 msgid "power with non integral exponent" msgstr "potenza con esponente non intero" #: number.c:1241 msgid "modulus is not an integral value" msgstr "il modulo non è un valore intero" #: number.c:1289 msgid "exponent too large in raise" msgstr "potenza con esponente troppo grande" #: numutil.c:854 #, c-format msgid "" "The string \"%s\"\n" "is not a valid number, the execution of the program ends now\n" msgstr "" "La stringa \"%s\"\n" "non è un numero valido, l'esecuzione del programma finisce qui\n" #: options.c:45 msgid "Ivano Primi" msgstr "Ivano Primi" #: options.c:46 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later,\n" "see .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licenza GPLv3+: GNU GPL version 3 o successiva,\n" "vedi .\n" "Questo è software libero: sei libero di modificarlo e redistribuirlo.\n" "NON c'è NESSUNA GARANZIA, per quanto consentito dalle vigenti normative.\n" #: options.c:52 msgid "" "The software has been linked against\n" "the GNU Multiple Precision Arithmetic Library,\n" "version number" msgstr "" "Il software è stato linkato alla libreria\n" "GNU per l'aritmetica a precisione multipla (GNU MP),\n" "numero di versione" #: options.c:56 msgid "" "The software has been built with\n" "its own internal support for multiple precision arithmetic" msgstr "" "Il software è stato compilato attivando\n" "il suo supporto interno per l'aritmetica a precisione multipla" #: options.c:63 msgid "Usage:" msgstr "Uso:" #: options.c:64 msgid "or" msgstr "oppure" #: options.c:66 #, c-format msgid "" "\n" "INT stays for a positive integer value or for a range of integer values,\n" "like 1-, 3-5 or -7\n" msgstr "" "\n" "INT sta per un valore intero positivo oppure per un intervallo di valori\n" "interi, per esempio 1-, 3-5 or -7\n" #: options.c:68 #, c-format msgid "" "\n" "Compare putatively similar files line by line and field by field,\n" "ignoring small numeric differences or/and different numeric formats\n" "\n" msgstr "" "\n" "Confronta file grossolanamente simili linea per linea e campo per campo,\n" "ignorando piccole differenze numeriche o/e formati numerici differenti\n" "\n" #: options.c:70 msgid "" "Specify the set of characters to use\n" " to split the input lines into fields" msgstr "" "Specifica l'insieme dei caratteri che separano\n" " i campi nelle linee di input" #: options.c:71 msgid "(The default set of characters is space, tab and newline)" msgstr "(L'insieme predefinito è spazio bianco, tabulazione e nuova linea)" #: options.c:73 msgid "" "Specify the maximum absolute difference permitted\n" " before that two numeric fields are regarded as different" msgstr "" "Specifica la massima differenza assoluta consentita\n" " prima che due campi numerici siano considerati diversi" #: options.c:74 options.c:77 msgid "(The default value is zero)" msgstr "(Il valore predefinito è zero)" #: options.c:76 msgid "" "Specify the maximum relative difference permitted\n" " before that two numeric fields are regarded as different" msgstr "" "Specifica la massima differenza relativa consentita\n" " prima che due campi numerici siano considerati diversi" #: options.c:79 msgid "" "Order that two numerical values are regarded as equal only if\n" " both absolute and relative difference do not exceed\n" " the corresponding tolerance threshold" msgstr "" "Ordina che due campi numerici siano considerati uguali solo se la\n" " differenza assoluta e quella relativa sono entrambe dentro la\n" " corrispondente soglia di tolleranza" #: options.c:81 msgid "" "Specify the number of digits in the significands\n" " used in multiple precision arithmetic" msgstr "" "Specifica il numero di cifre significative\n" " usate nell'aritmetica a precisione multipla" #: options.c:83 msgid "" "Ignore all differences due to numeric fields of the second file that\n" " are less than the corresponding numeric fields in the first file" msgstr "" "Ignora tutte le differenze dovute a campi numerici del secondo file\n" " che sono minori dei corrispondenti campi numerici nel primo file" #: options.c:85 msgid "" "Ignore all differences due to numeric fields of the second file that\n" " are greater than the corresponding numeric fields in the first file" msgstr "" "Ignora tutte le differenze dovute a campi numerici del secondo file\n" " che sono maggiori dei corrispondenti campi numerici nel primo file" #: options.c:87 msgid "Ignore changes in case while doing literal comparisons" msgstr "Nel fare confronti letterali\n" " ignora le differenze del tipo maiuscolo/minuscolo" #: options.c:89 msgid "" "Specify the characters representing the decimal point\n" " in the two files to compare" msgstr "" "Specifica i caratteri rappresentanti il punto decimale\n" " nei due file da confrontare" #: options.c:91 msgid "" "Specify the characters representing the thousands separator\n" " in the two files to compare" msgstr "" "Specifica i caratteri rappresentanti il separatore delle migliaia\n" " nei due file da confrontare" #: options.c:93 msgid "" "Specify the number of digits forming each group of thousands\n" " in the two files to compare" msgstr "" "Specifica il numero di cifre che formano ogni gruppo di migliaia\n" " nei due file da confrontare" #: options.c:95 msgid "" "Specify the (optional) prefixes for positive values\n" " used in the two files to compare" msgstr "" "Specifica i prefissi (opzionali) per valori positivi\n" " usati nei due file da confrontare" #: options.c:97 msgid "" "Specify the prefixes for negative values\n" " used in the two files to compare" msgstr "" "Specifica i prefissi per valori negativi\n" " usati nei due file da confrontare" #: options.c:99 msgid "" "Specify the exponent letters\n" " used in the two files to compare" msgstr "" "Specifica i simboli che precedono l'esponente decimale\n" " nei due file da confrontare" #: options.c:101 msgid "" "Specify the characters representing the imaginary unit\n" " in the two files to compare" msgstr "" "Specifica i caratteri rappresentanti l' unità immaginaria\n" " nei due file da confrontare" #: options.c:103 msgid "Select the fields of the first file that have to be ignored" msgstr "Seleziona i campi del primo file che devono essere ignorati" #: options.c:105 msgid "Select the fields of the second file that have to be ignored" msgstr "Seleziona i campi del secondo file che devono essere ignorati" #: options.c:107 msgid "" "While printing the differences between the two compared files\n" " show only the numerical ones" msgstr "" "Nello stampare le differenze tra i due file confrontati\n" " mostra solo quelle di tipo numerico" #: options.c:109 msgid "" "While printing the differences between the two compared files\n" " neglect all the numerical ones (dummy mode)" msgstr "" "Nello stampare le differenze tra i due file confrontati\n" " trascura tutte quelle di tipo numerico (stupido)" #: options.c:111 msgid "" "Suppress all messages concerning the differences discovered\n" " in the structures of the two files" msgstr "" "Sopprimi tutti i messaggi relativi alle differenze scoperte\n" " nella struttura dei due file" #: options.c:113 msgid "" "For every couple of lines which differ in at least one field print\n" " an header to show how these lines appear in the two compared files" msgstr "" "Per ogni coppia di linee che differiscono in almeno un campo stampa una\n" " intestazione per mostrare come esse appaiono nei due file confrontati" #: options.c:115 msgid "Suppress all the standard output" msgstr "Sopprimi completamente l'output standard del programma" #: options.c:117 msgid "Add some statistics to the standard output" msgstr "Aggiungi alcune informazioni di tipo statistico all'output standard" #: options.c:119 msgid "" "Select the fields of the first file that have to be\n" " blurred during the synchronization procedure\n" " only if they turn out to be numeric" msgstr "" "Seleziona i campi del primo file che devono essere\n" " offuscati durante la procedura di sincronizzazione\n" " solo se risultano essere di tipo numerico" #: options.c:121 msgid "" "Select the fields of the second file that have to be\n" " blurred during the synchronization procedure\n" " only if they turn out to be numeric" msgstr "" "Seleziona i campi del secondo file che devono essere\n" " offuscati durante la procedura di sincronizzazione\n" " solo se risultano essere di tipo numerico" #: options.c:123 msgid "" "Select the fields of the first file that have to be\n" " unconditionally blurred during the synchronization procedure" msgstr "" "Seleziona i campi del primo file che devono essere\n" " offuscati incondizionatamente durante la\n" " procedura di sincronizzazione" #: options.c:125 msgid "" "Select the fields of the second file that have to be\n" " unconditionally blurred during the synchronization procedure" msgstr "" "Seleziona i campi del secondo file che devono essere\n" " offuscati incondizionatamente durante la\n" " procedura di sincronizzazione" #: options.c:127 msgid "During synchronization try hard to find a smaller set of changes" msgstr "Durante la sincronizzazione cerca ad ogni costo di trovare\n" " una catena minimale di modifiche" #: options.c:129 msgid "" "During synchronization assume large files and\n" " many scattered small changes" msgstr "" "Durante la sincronizzazione assumi di lavorare su file grandi\n" " con tante piccole differenze sparpagliate" #: options.c:131 msgid "" "Run only the filter and then show the results of its\n" " attempt to synchronize the two files." msgstr "" "Esegui solo il filtraggio e quindi mostra i risultati del\n" " suo tentativo di sincronizzare i due file." #: options.c:132 msgid "" "If 'NUM' is zero or is not specified, output at most 130 columns per line." msgstr "" "Se 'NUM' è zero o non è specificato, visualizza al più\n" " 130 colonne per linea." #: options.c:133 msgid "" "If 'NUM' is a positive number, output at most\n" " 'NUM' columns per line." msgstr "" "Se 'NUM' è un numero positivo, visualizza al più\n" " 'NUM' colonne per linea." #: options.c:134 msgid "" "If 'NUM' is a negative number, do not output common lines\n" " and display at most -'NUM' columns per line." msgstr "" "Se 'NUM' è un numero negativo, non stampare le linee comuni\n" " ai due file e visualizza al più -'NUM' colonne per linea." #: options.c:136 msgid "" "Expand tabs to spaces in output while displaying the results of the\n" " synchronization procedure (meaningful only together with option -f)" msgstr "" "Espandi le tabulazioni a spazi bianchi mente stampi i risultati della\n" " procedura di sincronizzazione (utile solo con l'opzione -f)" #: options.c:138 msgid "Redirect warning and error messages from stderr to the indicated file" msgstr "Reindirizza avvertimenti e messaggi di errore\n" " dallo schermo al file indicato" #: options.c:140 msgid "Redirect output from stdout to the indicated file" msgstr "Reindirizza l'output dallo schermo al file indicato" #: options.c:141 msgid "Show help message and predefined settings" msgstr "Mostra questo messaggio di aiuto e le impostazioni predefinite" #: options.c:142 msgid "Show version number, Copyright, Distribution Terms and NO-Warranty" msgstr "Mostra numero di versione, Copyright,\n" " termini di distribuzione e NON-Garanzia" #: options.c:144 msgid "" "The two arguments after the options are the names of the files to compare." msgstr "" "I due argomenti dopo le opzioni sono i nomi dei file da confrontare." #: options.c:145 msgid "" "The complete paths of the files should be given,\n" "a directory name is not accepted." msgstr "" "È bene fornire i percorsi completi dei file,\n" "un nome di cartella non viene accettato." #: options.c:146 msgid "" "They cannot refer to the same file but one of them can be \"-\",\n" "which refers to stdin." msgstr "" "I file non possono coincidere ma uno di loro può essere \"-\",\n" "che si riferisce allo standard input." #: options.c:147 msgid "" "Exit status: 1 if files differ, 0 if they are equal, -1 (255) in case of " "error" msgstr "" "Codice di uscita: 1 se i file sono diversi, 0 se uguali, -1 (255) su errore" #: options.c:149 msgid "" "\n" " Default numeric format (for both files to compare):\n" msgstr "" "\n" " Formato numerico predefinito (per entrambi i file da confrontare):\n" #: options.c:150 #, c-format msgid "Decimal point = `%c'\n" msgstr "Punto decimale = `%c'\n" #: options.c:152 options.c:814 options.c:831 #, c-format msgid "Thousands separator = `%c'\n" msgstr "Separatore delle migliaia = `%c'\n" #: options.c:153 #, c-format msgid "Number of digits in each thousands group = %u\n" msgstr "Numero di cifre in ogni gruppo di migliaia = %u\n" #: options.c:155 options.c:815 options.c:832 #, c-format msgid "Leading positive sign = `%c'\n" msgstr "Segno iniziale per numeri positivi = `%c'\n" #: options.c:156 options.c:816 options.c:833 #, c-format msgid "Leading negative sign = `%c'\n" msgstr "Segno iniziale per numeri negativi = `%c'\n" #: options.c:157 options.c:817 options.c:834 #, c-format msgid "Prefix for decimal exponent = `%c'\n" msgstr "Prefisso per esponente decimale = `%c'\n" #: options.c:158 options.c:820 options.c:837 #, c-format msgid "" "Symbol used to denote the imaginary unit = `%c'\n" "\n" msgstr "" "Simbolo usato per indicare l'unità immaginaria = `%c'\n" "\n" #: options.c:506 options.c:521 options.c:538 options.c:553 options.c:575 #: options.c:635 options.c:661 options.c:677 options.c:698 options.c:735 #: options.c:750 #, c-format msgid "%s: invalid argument after `-%c' option\n" msgstr "%s: un argomento non valido segue l'opzione `-%c'\n" #: options.c:619 #, c-format msgid "%s: invalid argument after `-%c' option:\n" msgstr "%s: un argomento non valido segue l'opzione `-%c':\n" #: options.c:621 #, c-format msgid "" " A list of field delimiters can not be empty and\n" " must always include the newline character ('\\n')\n" msgstr "" " Una lista di separatori di campo non può essere vuota\n" " e deve sempre includere il carattere di nuova linea ('\\n')\n" #: options.c:761 options.c:770 #, c-format msgid "%s: cannot open file \"%s\":\n" msgstr "%s: impossibile aprire il file \"%s\":\n" #: options.c:810 #, c-format msgid "The numeric format specified for the first file is illegal,\n" msgstr "Il formato numerico specificato per il primo file è inaccettabile,\n" #: options.c:812 options.c:829 #, c-format msgid "" "the following symbols should be all different\n" "while two or more of them are actually equal:\n" msgstr "" "i simboli seguenti dovrebbero essere tutti diversi\n" "mentre due o più di essi sono in realtà uguali:\n" #: options.c:813 options.c:830 #, c-format msgid "" "\n" "Decimal point = `%c'\n" msgstr "" "\n" "Punto decimale = `%c'\n" #: options.c:827 #, c-format msgid "The numeric format specified for the second file is illegal,\n" msgstr "Il formato numerico specificato per il secondo file è inaccettabile,\n" #: util.c:117 util.c:130 util.c:238 util.c:252 #, c-format msgid "" "Line \"%s\"\n" "contains too many fields!\n" msgstr "" "La linea \"%s\"\n" "contiene troppi campi!\n" #: xalloc-die.c:35 msgid "memory exhausted" msgstr "memoria esaurita" cmtk-3.0.0/Utilities/numdiff-5.2.1/po/numdiff/it.mo0000644000177700000170000005143011765475736020622 0ustar torstenmanÞ•$­,à 7á g g é & 10 'b $Š 2¯ )â 2 ˆ? È è ]F}FÄ% Î1ºP»( 15Hg?°ð&K5e‰ç†qDøD=‚žR¸( )4^,x¥%Ã,é- D&eŒ¬9Ì"6L2`2“*ÆñN@VN—‹æ,r-Ÿ‰ÍjWIÂJ ŒW‰ä6n ¥±ÏÍí$».àŸ#¯1ÓE^Kª½ŒÒt_ ;Ô !už!<")Q"B{"X¾"U#Vm#[Ä#A $nb$nÑ$\@%Z%Mø%MF&b”& ÷&1'RJ'<'=Ú'[(bt(M×(J%)Up)Æ)â)÷)mþ)^l*Ë*ç* ø*£+½+À+ Ý+&þ+\%,‡‚,F .]Q.]¯.& /&4/>[/,š/%Ç/3í/)!0:K0’†0!1!;1]1lu1Lâ1L/21|2Ø®2ɇ3_Q4)±4:Û4Y5Hp5¹5/Ø5L6uU6›Ë6™g7O8PQ8%¢8 È8Yé82C93v9ª9)È9ò9.:)?:*i: ”:-µ:)ã:) ;B7;z;™;®;Á;4Ö;7 <CC<‡<kž<_ =Kj=…¶=.<>.k>‘š>y,?M¦?Qô?ŠF@ˆÑ@RZA ­A*¹A*äAèB%øB0C«OC'ûC3#DPWDh¨D.E=@E—~EF;˜F™ÔFƒnG=òG>0HQoHZÁHVIYsIaÍIV/Jn†JnõJ`dKZÅKN LOoL\¿L6M7SMU‹MCáME%NfkNqÒNODOD”ObÙO!G €A#&DhmR~l eSW1_jO5%VX{PK(@] 8B,: Y0=yfu9/kM2wz3Q<\4 |HC c"[Tv'qU!JZ.+b-r$aN;xsg7`6*)}^ Default numeric format (for both files to compare): In the computation of the following quantities only the errors with negative sign are considered: In the computation of the following quantities only the errors with positive sign are considered: *** End of file "%s" reached *** Error in reading from file "%s" *** Out of memory while reading from file "%s" +++ File "%s" differs from file "%s" +++ Files "%s" and "%s" are equal +++ Files "%s" and "%s" have the same structure Arithmetic mean of all absolute errors: Arithmetic mean of the relevant absolute errors: Compare putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats Corresponding absolute error: Corresponding relative error: Decimal point = `%c' INT stays for a positive integer value or for a range of integer values, like 1-, 3-5 or -7 Largest absolute error in the set of relevant numerical differences: Largest relative error in the set of relevant numerical differences: No numeric comparison has been done One numeric comparison has been done and has produced an outcome beyond the tolerance threshold %d numeric comparisons have been done, all of them have produced an outcome beyond the tolerance threshold One numeric comparison has been done and the resulting numeric difference is negligible %d numeric comparisons have been done and the resulting numeric differences are all negligible One numeric comparison has been done, %d numeric comparisons have been done, Quadratic mean of all absolute errors: Quadratic mean of the relevant absolute errors: Square root of the sum of the squares of the relevant absolute errors: Square root of the sum of the squares of all absolute errors: Sum of all absolute errors: Sum of the relevant absolute errors: Likely the files "%s" and "%s" do not have the same number of lines ! A list of field delimiters can not be empty and must always include the newline character ('\n') differences due to numeric fields of the second file that are greater than the corresponding fields in the first file are neglected differences due to numeric fields of the second file that are less than the corresponding fields in the first file are neglected %s: a number with a too large exponent has been found, namely "%s". %s: a number with a too small exponent has been found, namely "%s". %s: cannot open file "%s": %s: illegal option -- %c %s: insufficient memory for new allocation, the execution of the program ends now %s: invalid argument after `-%c' option %s: invalid argument after `-%c' option: %s: invalid option -- %c %s: option `%c%s' doesn't allow an argument %s: option `%s' is ambiguous %s: option `%s' requires an argument %s: option `--%s' doesn't allow an argument %s: option `-W %s' doesn't allow an argument %s: option `-W %s' is ambiguous %s: option requires an argument -- %c %s: unrecognized option `%c%s' %s: unrecognized option `--%s' (The default set of characters is space, tab and newline)(The default value is zero), Relative error = @ Absolute error = @ Line %lu in file "%s" contains too many fields! @ Line %lu in file "%s" is shorter than expected! Add some statistics to the standard outputDecimal point = `%c' During synchronization assume large files and many scattered small changesDuring synchronization try hard to find a smaller set of changesExit status: 1 if files differ, 0 if they are equal, -1 (255) in case of errorExpand tabs to spaces in output while displaying the results of the synchronization procedure (meaningful only together with option -f)Exponents larger than %ld are not accepted, Exponents smaller than %ld are not accepted, For every couple of lines which differ in at least one field print an header to show how these lines appear in the two compared filesIf 'NUM' is a negative number, do not output common lines and display at most -'NUM' columns per line.If 'NUM' is a positive number, output at most 'NUM' columns per line.If 'NUM' is zero or is not specified, output at most 130 columns per line.Ignore all differences due to numeric fields of the second file that are greater than the corresponding numeric fields in the first fileIgnore all differences due to numeric fields of the second file that are less than the corresponding numeric fields in the first fileIgnore changes in case while doing literal comparisonsIvano PrimiLeading negative sign = `%c' Leading positive sign = `%c' License GPLv3+: GNU GPL version 3 or later, see . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Line "%s" contains too many fields! Number of digits in each thousands group = %u Order that two numerical values are regarded as equal only if both absolute and relative difference do not exceed the corresponding tolerance thresholdPrefix for decimal exponent = `%c' Redirect output from stdout to the indicated fileRedirect warning and error messages from stderr to the indicated fileRun only the filter and then show the results of its attempt to synchronize the two files.Runtime error: %s Runtime warning: %s Select the fields of the first file that have to be blurred during the synchronization procedure only if they turn out to be numericSelect the fields of the first file that have to be unconditionally blurred during the synchronization procedureSelect the fields of the first file that have to be ignoredSelect the fields of the second file that have to be blurred during the synchronization procedure only if they turn out to be numericSelect the fields of the second file that have to be unconditionally blurred during the synchronization procedureSelect the fields of the second file that have to be ignoredShow help message and predefined settingsShow version number, Copyright, Distribution Terms and NO-WarrantySpecify the (optional) prefixes for positive values used in the two files to compareSpecify the characters representing the decimal point in the two files to compareSpecify the characters representing the imaginary unit in the two files to compareSpecify the characters representing the thousands separator in the two files to compareSpecify the exponent letters used in the two files to compareSpecify the maximum absolute difference permitted before that two numeric fields are regarded as differentSpecify the maximum relative difference permitted before that two numeric fields are regarded as differentSpecify the number of digits forming each group of thousands in the two files to compareSpecify the number of digits in the significands used in multiple precision arithmeticSpecify the prefixes for negative values used in the two files to compareSpecify the set of characters to use to split the input lines into fieldsSuppress all messages concerning the differences discovered in the structures of the two filesSuppress all the standard outputSymbol used to denote the imaginary unit = `%c' The complete paths of the files should be given, a directory name is not accepted.The numeric format specified for the first file is illegal, The numeric format specified for the second file is illegal, The software has been built with its own internal support for multiple precision arithmeticThe software has been linked against the GNU Multiple Precision Arithmetic Library, version numberThe string "%s" is not a valid number, the execution of the program ends now The two arguments after the options are the names of the files to compare.They cannot refer to the same file but one of them can be "-", which refers to stdin.Thousands separator = `%c' Unknown system errorUsage:While printing the differences between the two compared files neglect all the numerical ones (dummy mode)While printing the differences between the two compared files show only the numerical onesexponent too large in raisememory exhaustedmodulus is not an integral valueonly one numeric comparison has produced an outcome beyond the tolerance threshold %d numeric comparisons have produced an outcome beyond the tolerance threshold orpower with non integral basepower with non integral exponentthe execution of the program ends now the following symbols should be all different while two or more of them are actually equal: Project-Id-Version: numdiff 5.2.0 Report-Msgid-Bugs-To: ivprimi@libero.it POT-Creation-Date: 2010-01-07 17:05+0100 PO-Revision-Date: 2010-01-07 17:30+0100 Last-Translator: Ivano Primi Language-Team: ITALIAN MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=n != 1 ? 1 : 0; Formato numerico predefinito (per entrambi i file da confrontare): Nel calcolo dei seguenti valori vengono considerati solo gli errori con segno negativo: Nel calcolo dei seguenti valori vengono considerati solo gli errori con segno positivo: *** Raggiunta la fine del file "%s" *** Errore in lettura dal file "%s" *** Esaurimento di memoria durante la lettura del file "%s" +++ Il file "%s" differisce dal file "%s" +++ I file "%s" e "%s" sono uguali +++ I file "%s" e "%s" hanno la stessa struttura Media aritmetica degli errori assoluti: Media aritmetica degli errori assoluti non trascurabili: Confronta file grossolanamente simili linea per linea e campo per campo, ignorando piccole differenze numeriche o/e formati numerici differenti Corrispondente errore assoluto: Corrispondente errore relativo: Punto decimale = `%c' INT sta per un valore intero positivo oppure per un intervallo di valori interi, per esempio 1-, 3-5 or -7 Massimo errore assoluto nell'insieme delle differenze numeriche rilevanti: Massimo errore relativo nell'insieme delle differenze numeriche rilevanti: Non è stato effettuato alcun confronto numerico È stato effettuato un solo confronto numerico e ha prodotto un risultato oltre la soglia di tolleranza Sono stati effettuati %d confronti numerici e tutti hanno prodotto un risultato oltre la soglia di tolleranza È stato effettuato un solo confronto numerico e la differenza numerica rilevata è trascurabile Sono stati effettuati %d confronti numerici e le differenze numeriche rilevate sono tutte trascurabili È stato effettuato un solo confronto numerico, Sono stati effettuati %d confronti numerici, Media quadratica degli errori assoluti: Media quadratica degli errori assoluti non trascurabili: Radice quadrata della somma dei quadrati di tutti gli errori assoluti non trascurabili: Radice quadrata della somma dei quadrati di tutti gli errori assoluti: Somma degli errori assoluti: Somma degli errori assoluti non trascurabili: Probabilmente i file "%s" e "%s" non hanno lo stesso numero di linee ! Una lista di separatori di campo non può essere vuota e deve sempre includere il carattere di nuova linea ('\n') le differenze dovute a campi numerici del secondo file che risultano essere maggiori dei corrispondenti campi del primo file sono state tralasciate le differenze dovute a campi numerici del secondo file che risultano essere minori dei corrispondenti campi del primo file sono state tralasciate %s: è stato trovato un numero con un esponente troppo alto, precisamente "%s". %s: è stato trovato un numero con un esponente troppo basso, precisamente "%s". %s: impossibile aprire il file "%s": %s: opzione inammissibile -- %c %s: memoria insufficiente per nuova assegnazione, l'esecuzione del programma finisce qui %s: un argomento non valido segue l'opzione `-%c' %s: un argomento non valido segue l'opzione `-%c': %s: opzione non valida -- %c %s: l'opzione `%c%s' non vuole argomenti %s: l'opzione `%s' è ambigua %s: l'opzione `%s' ha bisogno di un argomento %s: l'opzione `--%s' non vuole argomenti %s: l'opzione `-W %s' non vuole argomenti %s: l'opzione `-W %s' è ambigua %s: opzione con argomento obbligatorio -- %c %s: l'opzione `%c%s' risulta sconosciuta %s: l'opzione `--%s' risulta sconosciuta (L'insieme predefinito è spazio bianco, tabulazione e nuova linea)(Il valore predefinito è zero), Errore relativo = @ Errore assoluto = @ La linea %lu nel file "%s" contiene troppi campi! @ La linea %lu nel file "%s" è più corta del previsto! Aggiungi alcune informazioni di tipo statistico all'output standardPunto decimale = `%c' Durante la sincronizzazione assumi di lavorare su file grandi con tante piccole differenze sparpagliateDurante la sincronizzazione cerca ad ogni costo di trovare una catena minimale di modificheCodice di uscita: 1 se i file sono diversi, 0 se uguali, -1 (255) su erroreEspandi le tabulazioni a spazi bianchi mente stampi i risultati della procedura di sincronizzazione (utile solo con l'opzione -f)Esponenti superiori a %ld non sono accettati, Esponenti inferiori a %ld non sono accettati, Per ogni coppia di linee che differiscono in almeno un campo stampa una intestazione per mostrare come esse appaiono nei due file confrontatiSe 'NUM' è un numero negativo, non stampare le linee comuni ai due file e visualizza al più -'NUM' colonne per linea.Se 'NUM' è un numero positivo, visualizza al più 'NUM' colonne per linea.Se 'NUM' è zero o non è specificato, visualizza al più 130 colonne per linea.Ignora tutte le differenze dovute a campi numerici del secondo file che sono maggiori dei corrispondenti campi numerici nel primo fileIgnora tutte le differenze dovute a campi numerici del secondo file che sono minori dei corrispondenti campi numerici nel primo fileNel fare confronti letterali ignora le differenze del tipo maiuscolo/minuscoloIvano PrimiSegno iniziale per numeri negativi = `%c' Segno iniziale per numeri positivi = `%c' Licenza GPLv3+: GNU GPL version 3 o successiva, vedi . Questo è software libero: sei libero di modificarlo e redistribuirlo. NON c'è NESSUNA GARANZIA, per quanto consentito dalle vigenti normative. La linea "%s" contiene troppi campi! Numero di cifre in ogni gruppo di migliaia = %u Ordina che due campi numerici siano considerati uguali solo se la differenza assoluta e quella relativa sono entrambe dentro la corrispondente soglia di tolleranzaPrefisso per esponente decimale = `%c' Reindirizza l'output dallo schermo al file indicatoReindirizza avvertimenti e messaggi di errore dallo schermo al file indicatoEsegui solo il filtraggio e quindi mostra i risultati del suo tentativo di sincronizzare i due file.Errore durante l'esecuzione del programma: %s Avvertimento lanciato durante l'esecuzione del programma: %s Seleziona i campi del primo file che devono essere offuscati durante la procedura di sincronizzazione solo se risultano essere di tipo numericoSeleziona i campi del primo file che devono essere offuscati incondizionatamente durante la procedura di sincronizzazioneSeleziona i campi del primo file che devono essere ignoratiSeleziona i campi del secondo file che devono essere offuscati durante la procedura di sincronizzazione solo se risultano essere di tipo numericoSeleziona i campi del secondo file che devono essere offuscati incondizionatamente durante la procedura di sincronizzazioneSeleziona i campi del secondo file che devono essere ignoratiMostra questo messaggio di aiuto e le impostazioni predefiniteMostra numero di versione, Copyright, termini di distribuzione e NON-GaranziaSpecifica i prefissi (opzionali) per valori positivi usati nei due file da confrontareSpecifica i caratteri rappresentanti il punto decimale nei due file da confrontareSpecifica i caratteri rappresentanti l' unità immaginaria nei due file da confrontareSpecifica i caratteri rappresentanti il separatore delle migliaia nei due file da confrontareSpecifica i simboli che precedono l'esponente decimale nei due file da confrontareSpecifica la massima differenza assoluta consentita prima che due campi numerici siano considerati diversiSpecifica la massima differenza relativa consentita prima che due campi numerici siano considerati diversiSpecifica il numero di cifre che formano ogni gruppo di migliaia nei due file da confrontareSpecifica il numero di cifre significative usate nell'aritmetica a precisione multiplaSpecifica i prefissi per valori negativi usati nei due file da confrontareSpecifica l'insieme dei caratteri che separano i campi nelle linee di inputSopprimi tutti i messaggi relativi alle differenze scoperte nella struttura dei due fileSopprimi completamente l'output standard del programmaSimbolo usato per indicare l'unità immaginaria = `%c' È bene fornire i percorsi completi dei file, un nome di cartella non viene accettato.Il formato numerico specificato per il primo file è inaccettabile, Il formato numerico specificato per il secondo file è inaccettabile, Il software è stato compilato attivando il suo supporto interno per l'aritmetica a precisione multiplaIl software è stato linkato alla libreria GNU per l'aritmetica a precisione multipla (GNU MP), numero di versioneLa stringa "%s" non è un numero valido, l'esecuzione del programma finisce qui I due argomenti dopo le opzioni sono i nomi dei file da confrontare.I file non possono coincidere ma uno di loro può essere "-", che si riferisce allo standard input.Separatore delle migliaia = `%c' Errore di sistema sconosciutoUso:Nello stampare le differenze tra i due file confrontati trascura tutte quelle di tipo numerico (stupido)Nello stampare le differenze tra i due file confrontati mostra solo quelle di tipo numericopotenza con esponente troppo grandememoria esauritail modulo non è un valore interoun solo confronto numerico ha prodotto un risultato oltre la soglia di tolleranza %d confronti numerici hanno prodotto un risultato oltre la soglia di tolleranza oppurepotenza con base non interapotenza con esponente non interol'esecuzione del programma finisce qui i simboli seguenti dovrebbero essere tutti diversi mentre due o più di essi sono in realtà uguali: cmtk-3.0.0/Utilities/numdiff-5.2.1/po/ndselect/0000755000177700000170000000000012263615445020002 5ustar torstenmancmtk-3.0.0/Utilities/numdiff-5.2.1/po/ndselect/it.po0000644000177700000170000001446211765475736021002 0ustar torstenman# Italian messages for ndselect # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi # This file is distributed under the same license as the Numdiff program. # Ivano Primi , 2010. # msgid "" msgstr "" "Project-Id-Version: numdiff 5.2.0 (ndselect 5.2.0)\n" "Report-Msgid-Bugs-To: ivprimi@libero.it\n" "POT-Creation-Date: 2010-01-06 23:20+0100\n" "PO-Revision-Date: 2010-01-07 17:00+0100\n" "Last-Translator: Ivano Primi \n" "Language-Team: ITALIAN \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1 ? 1 : 0;\n" #: getopt.c:551 getopt.c:570 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: l'opzione `%s' è ambigua\n" #: getopt.c:603 getopt.c:607 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: l'opzione `--%s' non vuole argomenti\n" #: getopt.c:616 getopt.c:621 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: l'opzione `%c%s' non vuole argomenti\n" #: getopt.c:667 getopt.c:689 getopt.c:1020 getopt.c:1042 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: l'opzione `%s' ha bisogno di un argomento\n" #: getopt.c:727 getopt.c:730 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: l'opzione `--%s' risulta sconosciuta\n" #: getopt.c:738 getopt.c:741 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: l'opzione `%c%s' risulta sconosciuta\n" #: getopt.c:796 getopt.c:799 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opzione inammissibile -- %c\n" #: getopt.c:805 getopt.c:808 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opzione non valida -- %c\n" #: getopt.c:863 getopt.c:882 getopt.c:1095 getopt.c:1116 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: opzione con argomento obbligatorio -- %c\n" #: getopt.c:935 getopt.c:954 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: l'opzione `-W %s' è ambigua\n" #: getopt.c:978 getopt.c:999 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: l'opzione `-W %s' non vuole argomenti\n" #: ndselect.c:96 msgid "Ivano Primi" msgstr "Ivano Primi" #: ndselect.c:97 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later,\n" "see .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" "Licenza GPLv3+: GNU GPL version 3 o successiva,\n" "vedi .\n" "Questo è software libero: sei libero di modificarlo e redistribuirlo.\n" "NON c'è NESSUNA GARANZIA, per quanto consentito dalle vigenti normative.\n" #: ndselect.c:106 msgid "Usage:" msgstr "Uso:" #: ndselect.c:107 msgid "or" msgstr "oppure" #: ndselect.c:110 #, c-format msgid "" "\n" "For a given range of line numbers and a given step\n" "print on the standard output all lines of a file,\n" "starting with the first line of the range and ending within\n" "its last line, whose line number is such that the difference\n" "between it and the start point is an integer multiple\n" "of the given step\n" "\n" msgstr "" "\n" "Dato un intervallo di numeri di linea e un certo passo,\n" "stampa sullo schermo, cominciando dalla prima linea dello\n" "intervallo e terminando entro l'ultima linea dello stesso,\n" "tutte le linee di un file il cui numero di linea è tale che\n" "la differenza tra esso e il punto di partenza dell'intervallo\n" "è un multiplo intero del passo specificato\n" "\n" #: ndselect.c:118 msgid "Specify the first line to print" msgstr "Specifica la prima linea da stampare" #: ndselect.c:119 msgid "(The default behavior is to start with line number 1)" msgstr "(L'azione predefinita è di stampare dalla prima linea)" #: ndselect.c:121 msgid "Specify the last line that can be printed" msgstr "Specifica l'ultima linea stampabile" #: ndselect.c:122 msgid "(The default behavior is to arrive till to the end of the file)" msgstr "(L'azione predefinita è di arrivare fino alla fine del file)" #: ndselect.c:124 msgid "Specify the step to use when selecting the lines to print" msgstr "Specifica il passo con cui selezionare le linee da stampare" #: ndselect.c:125 msgid "(The default value for the step is 1)" msgstr "(Il valore predefinito per il passo è 1)" #: ndselect.c:127 msgid "Redirect warning and error messages from stderr to the indicated file" msgstr "Reindirizza avvertimenti e messaggi di errore\n" " dallo schermo al file indicato" #: ndselect.c:129 msgid "Redirect output from stdout to the indicated file" msgstr "Reindirizza l'output dallo schermo al file indicato" #: ndselect.c:130 msgid "Show this help message" msgstr "Mostra questo messaggio di aiuto" #: ndselect.c:131 msgid "Show version number, Copyright, Distribution Terms and NO-Warranty" msgstr "Mostra numero di versione, Copyright,\n" " termini di distribuzione e NON-Garanzia" #: ndselect.c:133 msgid "The argument after the options is the name of the file to scan." msgstr "L'argomento dopo le opzioni è il nome del file da scorrere." #: ndselect.c:134 msgid "" "The complete path of the file should be given,\n" "a directory name is not accepted." msgstr "" "È bene fornire il percorso completo del file,\n" "un nome di cartella non viene accettato." #: ndselect.c:135 msgid "" "If no input file is specified, the program reads from the standard input." msgstr "" "Se non si specifica il file da scorrere, il programma prende i dati\n" "dallo standard input." #: ndselect.c:136 msgid "Exit status: 0 in case of normal termination, -1 (255) in case of error" msgstr "Codice di uscita: 0 in caso di conclusione regolare, -1 (255) su errore" #: ndselect.c:187 ndselect.c:201 ndselect.c:215 #, c-format msgid "%s: invalid argument after `-%c' option\n" msgstr "%s: un argomento non valido segue l'opzione `-%c'\n" #: ndselect.c:223 ndselect.c:232 ndselect.c:288 #, c-format msgid "%s: cannot open file \"%s\":\n" msgstr "%s: impossibile aprire il file \"%s\":\n" #: ndselect.c:292 #, c-format msgid "%s: cannot close file \"%s\":\n" msgstr "%s: è stato impossibile chiudere il file \"%s\":\n" #: ndselect.c:296 #, c-format msgid "" "%s: Error occurred while reading from file \"%s\"\n" "\n" msgstr "" "%s: Errore di lettura dal file \"%s\"\n" "\n" cmtk-3.0.0/Utilities/numdiff-5.2.1/po/ndselect/it.mo0000644000177700000170000001174211765475736020775 0ustar torstenmanÞ•#4/L( 12d(·à,ú'%E,k-˜ Æ&ç.?N5Ž%ÄGêI2 |͈1VEˆÎBå( )H 9r ?¬ Pì = D ˜G Tà %5 /[ %‹ ± 2Ò )#M.k)š*Ä ï-)>)h<’6Ï(G/Yw ÑèÝ3ÆPú KQl$¾#ã;;CVÖÛ  #!    " For a given range of line numbers and a given step print on the standard output all lines of a file, starting with the first line of the range and ending within its last line, whose line number is such that the difference between it and the start point is an integer multiple of the given step %s: Error occurred while reading from file "%s" %s: cannot close file "%s": %s: cannot open file "%s": %s: illegal option -- %c %s: invalid argument after `-%c' option %s: invalid option -- %c %s: option `%c%s' doesn't allow an argument %s: option `%s' is ambiguous %s: option `%s' requires an argument %s: option `--%s' doesn't allow an argument %s: option `-W %s' doesn't allow an argument %s: option `-W %s' is ambiguous %s: option requires an argument -- %c %s: unrecognized option `%c%s' %s: unrecognized option `--%s' (The default behavior is to arrive till to the end of the file)(The default behavior is to start with line number 1)(The default value for the step is 1)Exit status: 0 in case of normal termination, -1 (255) in case of errorIf no input file is specified, the program reads from the standard input.Ivano PrimiLicense GPLv3+: GNU GPL version 3 or later, see . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Redirect output from stdout to the indicated fileRedirect warning and error messages from stderr to the indicated fileShow this help messageShow version number, Copyright, Distribution Terms and NO-WarrantySpecify the first line to printSpecify the last line that can be printedSpecify the step to use when selecting the lines to printThe argument after the options is the name of the file to scan.The complete path of the file should be given, a directory name is not accepted.Usage:orProject-Id-Version: numdiff 5.2.0 (ndselect 5.2.0) Report-Msgid-Bugs-To: ivprimi@libero.it POT-Creation-Date: 2010-01-06 23:20+0100 PO-Revision-Date: 2010-01-07 17:00+0100 Last-Translator: Ivano Primi Language-Team: ITALIAN MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=n != 1 ? 1 : 0; Dato un intervallo di numeri di linea e un certo passo, stampa sullo schermo, cominciando dalla prima linea dello intervallo e terminando entro l'ultima linea dello stesso, tutte le linee di un file il cui numero di linea è tale che la differenza tra esso e il punto di partenza dell'intervallo è un multiplo intero del passo specificato %s: Errore di lettura dal file "%s" %s: è stato impossibile chiudere il file "%s": %s: impossibile aprire il file "%s": %s: opzione inammissibile -- %c %s: un argomento non valido segue l'opzione `-%c' %s: opzione non valida -- %c %s: l'opzione `%c%s' non vuole argomenti %s: l'opzione `%s' è ambigua %s: l'opzione `%s' ha bisogno di un argomento %s: l'opzione `--%s' non vuole argomenti %s: l'opzione `-W %s' non vuole argomenti %s: l'opzione `-W %s' è ambigua %s: opzione con argomento obbligatorio -- %c %s: l'opzione `%c%s' risulta sconosciuta %s: l'opzione `--%s' risulta sconosciuta (L'azione predefinita è di arrivare fino alla fine del file)(L'azione predefinita è di stampare dalla prima linea)(Il valore predefinito per il passo è 1)Codice di uscita: 0 in caso di conclusione regolare, -1 (255) su erroreSe non si specifica il file da scorrere, il programma prende i dati dallo standard input.Ivano PrimiLicenza GPLv3+: GNU GPL version 3 o successiva, vedi . Questo è software libero: sei libero di modificarlo e redistribuirlo. NON c'è NESSUNA GARANZIA, per quanto consentito dalle vigenti normative. Reindirizza l'output dallo schermo al file indicatoReindirizza avvertimenti e messaggi di errore dallo schermo al file indicatoMostra questo messaggio di aiutoMostra numero di versione, Copyright, termini di distribuzione e NON-GaranziaSpecifica la prima linea da stampareSpecifica l'ultima linea stampabileSpecifica il passo con cui selezionare le linee da stampareL'argomento dopo le opzioni è il nome del file da scorrere.È bene fornire il percorso completo del file, un nome di cartella non viene accettato.Uso:oppurecmtk-3.0.0/Utilities/numdiff-5.2.1/po/ndselect/ndselect.pot0000644000177700000170000001017411765475736022347 0ustar torstenman# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: ndselect 5.2.0\n" "Report-Msgid-Bugs-To: ivprimi@libero.it\n" "POT-Creation-Date: 2010-01-06 23:20+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: getopt.c:551 getopt.c:570 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: getopt.c:603 getopt.c:607 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: getopt.c:616 getopt.c:621 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: getopt.c:667 getopt.c:689 getopt.c:1020 getopt.c:1042 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "" #: getopt.c:727 getopt.c:730 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #: getopt.c:738 getopt.c:741 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #: getopt.c:796 getopt.c:799 #, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: getopt.c:805 getopt.c:808 #, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: getopt.c:863 getopt.c:882 getopt.c:1095 getopt.c:1116 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "" #: getopt.c:935 getopt.c:954 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "" #: getopt.c:978 getopt.c:999 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "" #: ndselect.c:96 msgid "Ivano Primi" msgstr "" #: ndselect.c:97 #, c-format msgid "" "License GPLv3+: GNU GPL version 3 or later,\n" "see .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" msgstr "" #: ndselect.c:106 msgid "Usage:" msgstr "" #: ndselect.c:107 msgid "or" msgstr "" #: ndselect.c:110 #, c-format msgid "" "\n" "For a given range of line numbers and a given step\n" "print on the standard output all lines of a file,\n" "starting with the first line of the range and ending within\n" "its last line, whose line number is such that the difference\n" "between it and the start point is an integer multiple\n" "of the given step\n" "\n" msgstr "" #: ndselect.c:118 msgid "Specify the first line to print" msgstr "" #: ndselect.c:119 msgid "(The default behavior is to start with line number 1)" msgstr "" #: ndselect.c:121 msgid "Specify the last line that can be printed" msgstr "" #: ndselect.c:122 msgid "(The default behavior is to arrive till to the end of the file)" msgstr "" #: ndselect.c:124 msgid "Specify the step to use when selecting the lines to print" msgstr "" #: ndselect.c:125 msgid "(The default value for the step is 1)" msgstr "" #: ndselect.c:127 msgid "Redirect warning and error messages from stderr to the indicated file" msgstr "" #: ndselect.c:129 msgid "Redirect output from stdout to the indicated file" msgstr "" #: ndselect.c:130 msgid "Show this help message" msgstr "" #: ndselect.c:131 msgid "Show version number, Copyright, Distribution Terms and NO-Warranty" msgstr "" #: ndselect.c:133 msgid "The argument after the options is the name of the file to scan." msgstr "" #: ndselect.c:134 msgid "" "The complete path of the file should be given,\n" "a directory name is not accepted." msgstr "" #: ndselect.c:135 msgid "" "If no input file is specified, the program reads from the standard input." msgstr "" #: ndselect.c:136 msgid "Exit status: 0 in case of normal termination, -1 (255) in case of error" msgstr "" #: ndselect.c:187 ndselect.c:201 ndselect.c:215 #, c-format msgid "%s: invalid argument after `-%c' option\n" msgstr "" #: ndselect.c:223 ndselect.c:232 ndselect.c:288 #, c-format msgid "%s: cannot open file \"%s\":\n" msgstr "" #: ndselect.c:292 #, c-format msgid "%s: cannot close file \"%s\":\n" msgstr "" #: ndselect.c:296 #, c-format msgid "" "%s: Error occurred while reading from file \"%s\"\n" "\n" msgstr "" cmtk-3.0.0/Utilities/numdiff-5.2.1/numdiff.h0000644000177700000170000004677011666247630017405 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #ifndef _NUMDIFF_H_ #define _NUMDIFF_H_ #include "system.h" #if defined(HAVE_LIBGMP) && !defined(DISABLE_GMP) #define USE_GMP 1 #endif /* defined(HAVE_LIBGMP) && !defined(DISABLE_GMP) */ /* The type of a hash value. */ typedef size_t hash_value; verify (hash_value_is_unsigned, ! TYPE_SIGNED (hash_value)); /* Rotate an unsigned value to the left. */ #define ROL(v, n) ((v) << (n) | (v) >> (sizeof (v) * CHAR_BIT - (n))) /* Given a hash value and a new character, return a new hash value. */ #ifdef _DEBUG_ #define HASH(h, c) (putc((c), stderr), (c) + ROL (h, 7)) #else #define HASH(h, c) ((c) + ROL (h, 7)) #endif /* Error codes */ #define OK 0 #define LINE_INTERR 1 #define EOF_REACHED 2 #define READING_ERROR 3 #define OUT_OF_MEMORY 4 /* *** */ #define OPEN_FAILED 5 #define WRONG_USAGE 6 /* Begin section -- Math types */ #include"number.h" #ifdef USE_GMP #include typedef mpf_t Real; typedef struct { mpf_t re, im; } Complex; #else /* not USE_GMP */ typedef bc_num Real; typedef struct { bc_num re, im; } Complex; #endif /* USE_GMP */ /* End section -- Math types */ struct numfmt { char dp; /* decimal point */ char thsep; /* thousands separator */ unsigned grouping; /* Number of digits in each group */ char pos_sign; /* positive sign */ char neg_sign; /* negative sign */ char ech; /* prefix for decimal exponent */ char iu; /* symbol of the imaginary unit */ }; /* A structure of this type is used to store */ /* information about the legal format for the */ /* numbers in input. */ /* This is the number of the fields in the 'numftm' structure having "char" type. They must have all different values (see the code of the function valid_numfmt() in the file options.c) . */ #define NUMFMT_CHARS 6 typedef struct { unsigned char* ptr; size_t len, size; } flg_array; /* A structure of this type is used to store the information retrieved from the execution of a diff command */ typedef struct { /* Mask of the options */ unsigned long optmask; /* Output mode. This field can take any of the values */ /* OUTMODE_* (see below) */ int output_mode; /* This is a mask of bits specifying the fields of the first file which must be ignored. */ unsigned char ghostmask1[FIELDMASK_SIZE]; /* This is a mask of bits specifying the fields of the second file which must be ignored. */ unsigned char ghostmask2[FIELDMASK_SIZE]; /* This is a mask of bits specifying the fields in the first file for which partial blurring must be enabled during the filtering procedure. */ unsigned char pblurmask1[FIELDMASK_SIZE]; /* This is a mask of bits specifying the fields in the second file for which partial blurring must be enabled during the filtering procedure. */ unsigned char pblurmask2[FIELDMASK_SIZE]; /* This is a mask of bits specifying the fields in the first file for which total blurring must be enabled during the filtering procedure. */ unsigned char tblurmask1[FIELDMASK_SIZE]; /* This is a mask of bits specifying the fields in the second file for which total blurring must be enabled during the filtering procedure. */ unsigned char tblurmask2[FIELDMASK_SIZE]; /* This parameter specifies how the relative errors */ /* have to be computed. It may have one of the */ /* following values: */ /* CLASSIC_FORMULA 0 (the default one) */ /* WR_TO_FIRST_FILE 1 */ /* WR_TO_SECOND_FILE 2 */ int relerr_formula; /* Tolerance for absolute and relative errors */ Real maxabserr, maxrelerr; /* These variables are used to print statistics */ Real Labserr, Crelerr, Lrelerr, Cabserr, N1abserr, N1disperr, N2abserr, N2disperr; int Nentries, Ndisperr; /* Flag > 0 --> If a numeric field in the first file is greater than the */ /* corresponding numeric field in the second file, then the */ /* related difference is ignored, i.e. it is never output */ /* Flag < 0 --> If a numeric field in the first file is less than the */ /* corresponding numeric field in the second file, then the */ /* related difference is ignored, i.e. it is never output */ /* Flag = 0 --> Standard behavior: the difference between 2 corresponding */ /* numeric fields (one in the first file, the other one in */ /* the second file) is always considered and it is output */ /* whenever its absolute value is greater than the given */ /* tolerance thresholds for the absolute and relative errors.*/ signed char flag; /* Internal scale (number of digits of accuracy) */ int iscale; /* Files to be compared */ const char *file1, *file2; /* Internal fields separators (IFS) for file1 and file2 */ char *ifs1, *ifs2; /* Numeric conventions for file1 (.nf1) and file2 (.nf2) */ struct numfmt nf1, nf2; } argslist ; /* A structure of this type is used to store the options */ /* set by the user */ #define _H_MASK 0x00000001 /* -h option, used to recall help */ #define _A_MASK 0x00000002 /* -a option, used to set tolerance for abs. error */ #define _R_MASK 0x00000004 /* -r option, used to set tolerance for rel. error */ #define _2_MASK 0x00000008 /* -2 option, used to enable the "flexible" control */ #define _S_MASK 0x00000010 /* -s option, used to explicitly set IFS */ #define _B_MASK 0x00000020 /* -b option, used to enable the "brief" mode */ #define _F_MASK 0x00000040 /* -f option, used to enable the "filter-only" mode */ #define _Q_MASK 0x00000080 /* -q option, used to enable "quiet" mode */ #define _X_MASK 0x00000100 /* -# option, used to set the precision */ #define _D_MASK 0x00000200 /* -d option, used to set the decimal point */ #define _T_MASK 0x00000400 /* -t option, used to set the thousands separator */ #define _G_MASK 0x00000800 /* -g option, used to set the 'grouping' */ #define _P_MASK 0x00001000 /* -p option, used to set the character 'positive sign' */ #define _N_MASK 0x00002000 /* -n option, used to set the character 'negative sign' */ #define _E_MASK 0x00004000 /* -e option, used to set prefix for decimal exponent */ #define _I_MASK 0x00008000 /* -i option, used to set the symbol of the imaginary unit */ #define _L_MASK 0x00010000 /* -l option, used to redirect the standard error on a file */ #define _O_MASK 0x00020000 /* -o option, used to redirect the standard output on a file */ #define _Z_MASK 0x00040000 /* -z option, used to activate the filter (normal mode) */ #define _SZ_MASK 0x00080000 /* -Z option, used to activate the filter (alternative mode) */ #define _SX_MASK 0x00100000 /* -X option, used to select which fields in the lines of the files must be ignored */ #define _SP_MASK 0x00200000 /* -P option, used to ignore negative errors */ #define _SN_MASK 0x00400000 /* -N option, used to ignore positive errors */ #define _SD_MASK 0x00800000 /* -D option, used to enable the "dummy" mode */ #define _SE_MASK 0x01000000 /* -E option, used to enable the "essential" mode */ #define _SV_MASK 0x02000000 /* -V option, used to enable the "verbose" mode */ #define _SS_MASK 0x04000000 /* -S option, used to print statistics */ #define _SI_MASK 0x08000000 /* -I option, used to ignore case while comparing non numerical fields */ #define _SH_MASK 0x10000000 /* -H option, by filtering assume large files and many scattered small changes */ #define _M_MASK 0x20000000 /* -m option, by filtering try hard to find a smaller set of changes */ #define _V_MASK 0x40000000 /* -v option, used to show version number, Copyright and No-Warrany */ /* Output modes: verbose, normal, brief, and quiet. */ /* Do not change the relative order of the values of */ /* these macros, the code in cmp_lines() (see file */ /* cmpfns.c) relies on the fact that: */ /* OUTMODE_VERBOSE > OUTMODE_NORMAL > OUTMODE_COINCISE */ /* > OUTMODE_BRIEF > OUTMODE_QUIET . */ #define OUTMODE_VERBOSE 4 #define OUTMODE_NORMAL 3 #define OUTMODE_COINCISE 2 #define OUTMODE_BRIEF 1 #define OUTMODE_QUIET 0 /* Methods to compute the relative differences */ #define CLASSIC_FORMULA 0 #define WR_TO_FIRST_FILE 1 #define WR_TO_SECOND_FILE 2 #ifndef PACKAGE #define PACKAGE "numdiff" #endif #ifndef LOCALEDIR #define LOCALEDIR "/usr/local/share/locale/" #endif /* The character representing the number zero */ #define CHAR_ZERO '0' /* The character representing the number one */ #define CHAR_ONE '1' /* The character representing the number nine */ #define CHAR_NINE '9' /* newline character */ #define NEWLINE '\n' /* Predefined values for .nf*.dp (decimal point) .nf*.thsep (thousands separator) .nf*.grouping (number of digits in each thousands group) .nf*.pos_sign (positive sign) .nf*.neg_sign (negative sign) .nf*.ech (prefix for decimal exponent) .nf*.iu (symbol of the imaginary unit) .iscale (decimal digits of accuracy) .ifs (internal fields separator) */ #define DP '.' #define THSEP ',' #define GROUPING 3 #define POS_SIGN '+' #define NEG_SIGN '-' #define ECH 'e' #define IU 'i' #define ISCALE 35 #define IFS " \t\n" /* Largest possible value for .iscale */ #define MAX_ISCALE 180 /* Largest possible exponent accepted by Numdiff when a number is written in scientific notation */ #define MAX_EXPN +1073741824L /* Lowest possible exponent accepted by Numdiff when a number is written in scientific notation */ #define MIN_EXPN -1073741824L /* Macro to move ahead a pointer */ #define move_ahead(ptr) ptr++ /* Character classification macros. The macro CTYPE_DOMAIN is defined in "system.h". */ #define is_digit(c) ((unsigned int) (c) - '0' <= 9 ? 1 : 0) #define is_punct(c) (CTYPE_DOMAIN((unsigned char)(c)) && ispunct((unsigned char)(c))) #define is_print(c) (CTYPE_DOMAIN((unsigned char)(c)) && isgraph((unsigned char)(c)) && ((unsigned int) (c) - '0' > 9)) #define is_space(c) (CTYPE_DOMAIN((unsigned char)(c)) && isspace((unsigned char)(c))) /* Mathematical functions */ int cmp (Real p, Real q); int is0 (Real u); int smart_cmp (const Complex* pz1, const Complex* pz2, int flag); void printno (Real u, int m); extern Real Zero, Inf; void init_mpa(int iscale); void initR (Real* px); void initC (Complex* pz); void copyR (Real* dst, Real src); void copyC (Complex* dst, Complex src); #ifdef _MPA_DEBUG void debug_printno (Real u, int m); #endif /* _MPA_DEBUG */ void str2R (const char *q, char **endptr, int iscale, const struct numfmt* pnf, Real* pr); void str2C (const char *q, char **endptr, int iscale, const struct numfmt* pnf, Complex* pc); void add (Real s, Real t, Real* q, int iscale); void square (Real s, Real* q, int iscale); void divide (Real s, Real t, Real* q, int iscale); void divide_by_int (Real* q, int d, int iscale); void square_root (Real* q, int iscale); void Cabs (Complex z, Real* pm, int iscale); void Csub (Complex z1, Complex z2, Complex* pw, int iscale); void delR (Real* px); void delC (Complex* pz); void end_mpa(void); /* Shared definitions coming from GNU DIFF Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU DIFF. GNU DIFF is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU DIFF 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #define TAB_WIDTH 8 /* Added by Ivano Primi, July 31 2008 */ #define MIN_ATMOST_NCOLS 16 #define DEF_ATMOST_NCOLS 130 #define MAX_ATMOST_NCOLS 512 /* What kind of changes a hunk contains. */ enum changes { /* No changes: lines common to both files. */ UNCHANGED, /* Deletes only: lines taken from just the first file. */ OLD, /* Inserts only: lines taken from just the second file. */ NEW, /* Both deletes and inserts: a hunk containing both old and new lines. */ CHANGED }; /* Variables for command line options */ #ifndef GDIFF_OPTIONS # define XTERN extern #else # define XTERN #endif /* The significance of white space during comparisons. */ XTERN enum { /* All white space is significant (the default). */ IGNORE_NO_WHITE_SPACE, /* Ignore changes due to tab expansion. */ IGNORE_TAB_EXPANSION, /* Ignore changes in horizontal white space. */ IGNORE_SPACE_CHANGE, /* Ignore all horizontal white space. */ IGNORE_ALL_SPACE } ignore_white_space; /* Nonzero means to not show common lines. */ XTERN bool suppress_common_lines; /* Expand tabs in the output so the text lines up properly despite the characters added to the front of each line (-T). */ XTERN bool expand_tabs; /* The half line width and column 2 offset for OUTPUT_SDIFF. */ XTERN unsigned int sdiff_half_width; XTERN unsigned int sdiff_column2_offset; /* Use heuristics for better speed with large files with a small density of changes. */ XTERN bool speed_large_files; /* Name of program the user invoked (for error messages). */ XTERN char *program_name; /* The result of comparison is an "edit script": a chain of `struct change'. Each `struct change' represents one place where some lines are deleted and some are inserted. LINE0 and LINE1 are the first affected lines in the two files (origin 0). DELETED is the number of lines deleted here from file 0. INSERTED is the number of lines inserted here in file 1. If DELETED is 0 then LINE0 is the number of the line before which the insertion was done; vice versa for INSERTED and LINE1. */ struct change { struct change *link; /* Previous or next edit command */ lin inserted; /* # lines of file 1 changed here. */ lin deleted; /* # lines of file 0 changed here. */ lin line0; /* Line number of 1st deleted line. */ lin line1; /* Line number of 1st inserted line. */ bool ignore; /* Flag used in context.c. */ }; /* Structures that describe the input files. */ /* Data on one input file being compared. */ struct file_data { int desc; /* File descriptor */ char const *name; /* File name */ struct stat stat; /* File status */ /* Buffer in which text of file is read. */ word *buffer; /* Allocated size of buffer, in bytes. Always a multiple of sizeof *buffer. */ size_t bufsize; /* Number of valid bytes now in the buffer. */ size_t buffered; /* Array of pointers to lines in the file. */ char const **linbuf; /* linbuf_base <= buffered_lines <= valid_lines <= alloc_lines. linebuf[linbuf_base ... buffered_lines - 1] are possibly differing. linebuf[linbuf_base ... valid_lines - 1] contain valid data. linebuf[linbuf_base ... alloc_lines - 1] are allocated. */ lin linbuf_base, buffered_lines, valid_lines, alloc_lines; /* Pointer to end of prefix of this file to ignore when hashing. */ char const *prefix_end; /* Count of lines in the prefix. There are this many lines in the file before linbuf[0]. */ lin prefix_lines; /* Pointer to start of suffix of this file to ignore when hashing. */ char const *suffix_begin; /* Vector, indexed by line number, containing an equivalence code for each line. It is this vector that is actually compared with that of another file to generate differences. */ lin *equivs; /* Vector, like the previous one except that the elements for discarded lines have been squeezed out. */ lin *undiscarded; /* Vector mapping virtual line numbers (not counting discarded lines) to real ones (counting those lines). Both are origin-0. */ lin *realindexes; /* Total number of nondiscarded lines. */ lin nondiscarded_lines; /* Vector, indexed by real origin-0 line number, containing TRUE for a line that is an insertion or a deletion. The results of comparison are stored here. */ bool *changed; /* 1 if file ends in a line with no final newline. */ bool missing_newline; /* 1 if at end of file. */ bool eof; /* 1 more than the maximum equivalence value used for this or its sibling file. */ lin equiv_max; }; /* The file buffer, considered as an array of bytes rather than as an array of words. */ #define FILE_BUFFER(f) ((char *) (f)->buffer) /* Describe the two files currently being compared. */ XTERN struct file_data files[2]; /* Stdio stream to output diffs to. */ #define outfile stdout /* Declare various functions. */ /* analyze.c */ int diff_2_files (struct file_data[], argslist*); /* inout.c */ bool read_files (struct file_data[], argslist*); /* numutil.c */ char* acxnum (const char *str, const struct numfmt* pnf); int compare_numeric_strings (const char *str1, const struct numfmt* pnf1, const char *str2, const struct numfmt* pnf2); char* hcxnum (const char *str, const struct numfmt* pnf, hash_value *ph); #ifdef USE_GMP int mpf_a2num (Real* pr, const char *q, char** endptr, const struct numfmt* pnf); #endif /* USE_GMP */ /* side.c */ void print_sdiff_script (struct change *); /* util.c */ bool lines_differ (char const *, char const *, int, int, argslist*); void *zalloc (size_t); #define stralloc(length) zalloc ((length)+1) enum changes analyze_hunk (struct change *, lin *, lin *, lin *, lin *); #ifdef _DEBUG_SCRIPT_ void debug_script (struct change *); #endif void perror_with_name (char const *); void pfatal_with_name (char const *) __attribute__((noreturn)); void print_script (struct change *, void (*) (struct change *)); /* flags.c */ /* This functions were added by Ivano Primi, 14-02-08 */ int init_flags (void); int print_flags (FILE* fp); flg_array copy_of_intflagtab (void); void erase_flags (void); void notedown_sdiff_script (struct change *script); /* End Section "Shared definitions coming from GNU DIFF" */ #endif /* _NUMDIFF_H_ */ cmtk-3.0.0/Utilities/numdiff-5.2.1/number.h0000644000177700000170000001044011666247630017226 0ustar torstenman/* number.h: Arbitrary precision numbers header file. */ /* Copyright (C) 1991, 1992, 1993, 1994, 1997, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License along with this program; see the file COPYING. If not, write to: The Free Software Foundation, Inc. 59 Temple Place, Suite 330 Boston, MA 02111-1307 USA. You may contact the author by: e-mail: philnelson@acm.org us-mail: Philip A. Nelson Computer Science Department, 9062 Western Washington University Bellingham, WA 98226-9062 *************************************************************************/ #ifndef _NUMBER_H_ #define _NUMBER_H_ typedef enum {PLUS, MINUS} sign; typedef struct bc_struct *bc_num; typedef struct bc_struct { sign n_sign; int n_len; /* The number of digits before the decimal point. */ int n_scale; /* The number of digits after the decimal point. */ int n_refs; /* The number of pointers to this number. */ bc_num n_next; /* Linked list for available list. */ char *n_ptr; /* The pointer to the actual storage. If NULL, n_value points to the inside of another number (bc_multiply...) and should not be "freed." */ char *n_value; /* The number. Not zero char terminated. May not point to the same place as n_ptr as in the case of leading zeros generated. */ } bc_struct; /* The base used in storing the numbers in n_value above. Currently this MUST be 10. */ #define BASE 10 /* Some useful macros and constants. */ #define CH_VAL(c) (c - '0') #define BCD_CHAR(d) (d + '0') #ifdef MIN #undef MIN #undef MAX #endif #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)>(b)?(b):(a)) #define ODD(a) ((a)&1) #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #ifndef LONG_MAX #define LONG_MAX 0x7ffffff #endif /* Global numbers. */ extern bc_num _zero_; extern bc_num _one_; extern bc_num _two_; /* Function Prototypes */ /* Define the _PROTOTYPE macro if it is needed. */ #ifndef _PROTOTYPE #ifdef __STDC__ #define _PROTOTYPE(func, args) func args #else #define _PROTOTYPE(func, args) func() #endif #endif _PROTOTYPE(void bc_init_numbers, (void)); _PROTOTYPE(void bc_end, (void)); /* Added by Ivano Primi, 30/12/2002. */ _PROTOTYPE(bc_num bc_new_num, (int length, int scale)); _PROTOTYPE(void bc_free_num, (bc_num *num)); _PROTOTYPE(bc_num bc_copy_num, (bc_num num)); _PROTOTYPE(void bc_init_num, (bc_num *num)); _PROTOTYPE(void bc_str2num, (bc_num *num, char *str, int scale)); _PROTOTYPE(char *bc_num2str, (bc_num num)); _PROTOTYPE(void bc_int2num, (bc_num *num, int val)); _PROTOTYPE(long bc_num2long, (bc_num num)); _PROTOTYPE(int bc_compare, (bc_num n1, bc_num n2)); _PROTOTYPE(char bc_is_zero, (bc_num num)); _PROTOTYPE(char bc_is_near_zero, (bc_num num, int scale)); _PROTOTYPE(char bc_is_neg, (bc_num num)); _PROTOTYPE(void bc_add, (bc_num n1, bc_num n2, bc_num *result, int scale_min)); _PROTOTYPE(void bc_sub, (bc_num n1, bc_num n2, bc_num *result, int scale_min)); _PROTOTYPE(void bc_multiply, (bc_num n1, bc_num n2, bc_num *prod, int scale)); _PROTOTYPE(int bc_divide, (bc_num n1, bc_num n2, bc_num *quot, int scale)); _PROTOTYPE(int bc_modulo, (bc_num num1, bc_num num2, bc_num *result, int scale)); _PROTOTYPE(int bc_divmod, (bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale)); _PROTOTYPE(int bc_raisemod, (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)); _PROTOTYPE(void bc_raise, (bc_num num1, bc_num num2, bc_num *result, int scale)); _PROTOTYPE(int bc_sqrt, (bc_num *num, int scale)); _PROTOTYPE(void bc_out_num, (bc_num num, int o_base, void (* out_char)(int), int leading_zero)); #endif cmtk-3.0.0/Utilities/numdiff-5.2.1/CMakeLists.txt0000644000177700000170000002245211775360374020335 0ustar torstenman## ## Copyright 2011, 2012 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 4444 $ ## ## $LastChangedDate: 2012-07-05 11:46:20 -0700 (Thu, 05 Jul 2012) $ ## ## $LastChangedBy: torstenrohlfing $ ## # ########## Project setup ########## PROJECT(numdiff-5.2.1) CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) IF(COMMAND cmake_policy) cmake_policy(SET CMP0005 OLD) ## explicit escaping of compiler definition strings ENDIF(COMMAND cmake_policy) SET(CMAKE_CONFIG_PACKAGE_BUGREPORT "") SET(CMAKE_CONFIG_PACKAGE_NAME "Numdiff") SET(CMAKE_CONFIG_PACKAGE_STRING "Numdiff 5.2") SET(CMAKE_CONFIG_PACKAGE_TARNAME "numdiff") SET(CMAKE_CONFIG_PACKAGE_VERSION "5.2") ADD_DEFINITIONS(-DPACKAGE=\\\"numdiff\\\") # ######### General setup ########## INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) # ########## numdiff-5.2.1 executable ########## # Sources: SET(numdiff_SRCS analyze.c arith.c cmpbuf.c cmpfns.c error.c exitfail.c flags.c getopt.c getopt1.c inout.c io.c main.c numutil.c options.c setmode.c side.c util.c xalloc-die.c xmalloc.c) INCLUDE(FindCygwin) SET(POSSIBLE_BIN_PATHS ${CYGWIN_INSTALL_PATH}/bin) FIND_PROGRAM(FIND_EXECUTABLE NAMES find PATHS ${POSSIBLE_BIN_PATHS}) #----------------------------------------------------------------------------- # Check for system headers. INCLUDE (CheckIncludeFiles) CHECK_INCLUDE_FILES(float.h HAVE_FLOAT_H) CHECK_INCLUDE_FILES(stdarg.h HAVE_STDARG_H) CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H) CHECK_INCLUDE_FILES(string.h HAVE_STRING_H) # see https://www.gnu.org/s/hello/manual/autoconf/Particular-Headers.html IF(HAVE_FLOAT_H AND HAVE_STDARG_H AND HAVE_STDLIB_H AND HAVE_STRING_H) SET(STDC_HEADERS 1) ADD_DEFINITIONS(-DSTDC_HEADERS) ENDIF(HAVE_FLOAT_H AND HAVE_STDARG_H AND HAVE_STDLIB_H AND HAVE_STRING_H) CHECK_INCLUDE_FILES(dirent.h HAVE_DIRENT_H) CHECK_INCLUDE_FILES(stat.h HAVE_STAT_H) CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H) CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H) CHECK_INCLUDE_FILES(locale.h HAVE_LOCALE_H) CHECK_INCLUDE_FILES(memory.h HAVE_MEMORY_H) CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H) CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) CHECK_INCLUDE_FILES(stddef.h HAVE_STDDEF_H) CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H) CHECK_INCLUDE_FILES(time.h HAVE_TIME_H) CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H) CHECK_INCLUDE_FILES(vfork.h HAVE_VFORK_H) CHECK_INCLUDE_FILES(wchar.h HAVE_WCHAR_H) CHECK_INCLUDE_FILES(wctype.h HAVE_WCTYPE_H) CHECK_INCLUDE_FILES (sys/dir.h HAVE_SYS_DIR_H) CHECK_INCLUDE_FILES (sys/file.h HAVE_SYS_FILE_H) CHECK_INCLUDE_FILES (sys/file.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILES (sys/wait.h HAVE_SYS_WAIT_H) #AC_C_CONST -- obsolete according to https://www.gnu.org/software/hello/manual/autoconf/C-Compiler.html#index-AC_005fC_005fCONST-885 SET(CMAKE_CONFIG_CONST "const") #AC_C_INLINE SET(CMAKE_CONFIG_INLINE "${C_INLINE}") # Check for variable arrays support in C compiler INCLUDE(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES("int main() { int size = 10; char array[size]; }" HAVE_C_VARARRAYS) # Check for types and substitute replacement types if they don't exist INCLUDE(CheckTypeSize) CHECK_TYPE_SIZE(pid_t PID_T_SIZE) IF(PID_T_SIZE) SET(CMAKE_CONFIG_PID_T pid_t) ELSE(PID_T_SIZE) SET(CMAKE_CONFIG_PID_T int) ENDIF(PID_T_SIZE) CHECK_TYPE_SIZE(ptrdiff_t PTRDIFF_T_SIZE) IF(PTRDIFF_T_SIZE) SET(CMAKE_CONFIG_PTRDIFF_T ptrdiff_t) ELSE(PTRDIFF_T_SIZE) SET(CMAKE_CONFIG_PTRDIFF_T int) ENDIF(PTRDIFF_T_SIZE) CHECK_TYPE_SIZE(ssize_t SSIZE_T_SIZE) IF(SSIZE_T_SIZE) SET(CMAKE_CONFIG_SSIZE_T ssize_t) ELSE(SSIZE_T_SIZE) SET(CMAKE_CONFIG_SSIZE_T int) ENDIF(SSIZE_T_SIZE) CHECK_TYPE_SIZE(size_t SIZE_T_SIZE) IF(SIZE_T_SIZE) SET(CMAKE_CONFIG_SIZE_T size_t) ELSE(SIZE_T_SIZE) SET(CMAKE_CONFIG_SIZE_T unsigned int) ENDIF(SIZE_T_SIZE) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckStructMember.cmake) CHECK_STRUCT_MEMBER("struct stat" st_blksize "sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE) CHECK_STRUCT_MEMBER("struct stat" st_rdev "sys/stat.h" HAVE_STRUCT_STAT_ST_RDEV) CHECK_STRUCT_MEMBER("struct stat" st_mtim_nsed "sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_NSEC) # -------------------------------------- # Checks for libraries # -------------------------------------- INCLUDE(CheckLibraryExists) CHECK_INCLUDE_FILES(gmp.h HAVE_GMP_H) CHECK_LIBRARY_EXISTS(gmp __gmpz_init "" HAVE_LIBGMP) # -------------------------------------- # Checks for library functions # -------------------------------------- INCLUDE(CheckFunctionExists) CHECK_FUNCTION_EXISTS(vsprintf HAVE_VSPRINTF) IF(NOT HAVE_VSPRINTF) MESSAGE(FATAL_ERROR "Declaration of vsprintf() not present!") ENDIF(NOT HAVE_VSPRINTF) CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET) IF(NOT HAVE_MEMSET) MESSAGE(FATAL_ERROR "Declaration of memset() not present!") ENDIF(NOT HAVE_MEMSET) CHECK_FUNCTION_EXISTS(memchr HAVE_MEMCHR) IF(NOT HAVE_MEMCHR) MESSAGE(FATAL_ERROR "Declaration of memchr() not present!") ENDIF(NOT HAVE_MEMCHR) CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR) IF(NOT HAVE_STRERROR) MESSAGE(FATAL_ERROR "Declaration of strerror() not present!") ENDIF(NOT HAVE_STRERROR) CHECK_FUNCTION_EXISTS(strspn HAVE_STRSPN) IF(NOT HAVE_STRSPN) MESSAGE(FATAL_ERROR "Declaration of strspn() not present!") ENDIF(NOT HAVE_STRSPN) CHECK_FUNCTION_EXISTS(strcspn HAVE_STRCSPN) IF(NOT HAVE_STRCSPN) MESSAGE(FATAL_ERROR "Declaration of strcspn() not present!") ENDIF(NOT HAVE_STRCSPN) CHECK_FUNCTION_EXISTS(fork HAVE_FORK) IF(HAVE_FORK) SET(HAVE_WORKING_FORK 1) SET(CMAKE_CONFIG_VFORK fork) ENDIF(HAVE_FORK) CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) CHECK_FUNCTION_EXISTS(localeconv HAVE_LOCALECONV) CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) CHECK_FUNCTION_EXISTS(isascii HAVE_ISASCII) CHECK_FUNCTION_EXISTS(setlocale HAVE_SETLOCALE) CHECK_FUNCTION_EXISTS(strchr HAVE_STRCHR) CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) CHECK_FUNCTION_EXISTS(waitpid HAVE_WAITPID) CHECK_INCLUDE_FILES (alloca.h HAVE_ALLOCA_H) CHECK_FUNCTION_EXISTS(alloca HAVE_ALLOCA) CHECK_FUNCTION_EXISTS(bcopy HAVE_BCOPY) CHECK_FUNCTION_EXISTS(btowc HAVE_BTOWC) CHECK_FUNCTION_EXISTS(bzero HAVE_BZERO) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) # setmode DOS ? ##AC_FUNC_SETMODE_DOS ## Check for clock_gettime and its library. Solaris puts it in -lrt or ## -lposix4, but we don't want to link that library unless we have to. #diff_saved_libs=$LIBS #AC_SEARCH_LIBS(clock_gettime, [rt posix4]) #case $ac_cv_search_clock_gettime in #no | 'none required') # LIB_CLOCK_GETTIME=;; #*) # LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;; #esac #AC_SUBST([LIB_CLOCK_GETTIME]) OPTION(NUMDIFF_USE_UNLOCKED_IO "Define if you want getc etc. to use unlocked I/O if available. Unlocked I/O can improve performance in unithreaded apps, but it is not safe for multithreaded apps." ON ) CHECK_FUNCTION_EXISTS(clearerr_unlocked HAVE_DECL_CLEARERR_UNLOCKED) CHECK_FUNCTION_EXISTS(feof_unlocked HAVE_DECL_FEOF_UNLOCKED) CHECK_FUNCTION_EXISTS(ferror_unlocked HAVE_DECL_FERROR_UNLOCKED) CHECK_FUNCTION_EXISTS(fflush_unlocked HAVE_DECL_FFLUSH_UNLOCKED) CHECK_FUNCTION_EXISTS(fgets_unlocked HAVE_DECL_FGETS_UNLOCKED) CHECK_FUNCTION_EXISTS(fputc_unlocked HAVE_DECL_FPUTC_UNLOCKED) CHECK_FUNCTION_EXISTS(fputs_unlocked HAVE_DECL_FPUTS_UNLOCKED) CHECK_FUNCTION_EXISTS(fread_unlocked HAVE_DECL_FREAD_UNLOCKED) CHECK_FUNCTION_EXISTS(fwrite_unlocked HAVE_DECL_FWRITE_UNLOCKED) CHECK_FUNCTION_EXISTS(getc_unlocked HAVE_DECL_GETC_UNLOCKED) CHECK_FUNCTION_EXISTS(getchar_unlocked HAVE_DECL_GETCHAR_UNLOCKED) CHECK_FUNCTION_EXISTS(putc_unlocked HAVE_DECL_PUTC_UNLOCKED) CHECK_FUNCTION_EXISTS(putchar_unlocked HAVE_DECL_PUTCHAR_UNLOCKED) CHECK_FUNCTION_EXISTS(strerror HAVE_DECL_STRERROR) ## ## Find libintl/gettext and configure NLS if available ## INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindLibintlGettext.cmake) IF(GETTEXT_FOUND) OPTION(NUMDIFF_USE_NLS "Turn on Natural Language Support" ON) IF(NUMDIFF_USE_NLS) ADD_DEFINITIONS(-DENABLE_NLS) ENDIF(NUMDIFF_USE_NLS) ENDIF(GETTEXT_FOUND) ## ## Configure GMP support ## IF(HAVE_GMP_H AND HAVE_LIBGMP) OPTION(NUMDIFF_USE_GMP "Turn on use of GNU MP" ON) IF(NUMDIFF_USE_GMP) FIND_LIBRARY(LIBGMP_LIBRARY gmp) ELSE(NUMDIFF_USE_GMP) ADD_DEFINITIONS(-DDISABLE_GMP) ENDIF(NUMDIFF_USE_GMP) ELSE(HAVE_GMP_H AND HAVE_LIBGMP) ADD_DEFINITIONS(-DDISABLE_GMP) ENDIF(HAVE_GMP_H AND HAVE_LIBGMP) CONFIGURE_FILE(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) ADD_DEFINITIONS(-DHAVE_CONFIG_H) # actual target: ADD_EXECUTABLE(numdiff ${numdiff_SRCS}) TARGET_LINK_LIBRARIES(numdiff ${LIBGMP_LIBRARY} ${GETTEXT_LIBRARIES}) # add install target: #INSTALL(TARGETS numdiff DESTINATION bin) cmtk-3.0.0/Utilities/numdiff-5.2.1/NEWS0000644000177700000170000001243411666247630016271 0ustar torstenman5.2.0 --> 5.2.1 (Ivano Primi ) : * Corrected a bug which prevented Numdiff to be built on MacOS X(R). Thanks to Antoine Dechaume for the report. 5.0.0 --> 5.2.0 (Ivano Primi ) : * Numdiff uses now the GNU Multiple Precision Arithmetic Library (also called GNU MP or GMP) if this library is available at build-time. The old internal support for multiple precision arithmetic is a fall-back in case GNU MP is absent. However it is possible to use the internal support for multiple precision arithmetic even when GNU MP is available: it is sufficient to pass the option --disable-gmp (or --enable-gmp=no) to the configure script before building the program. After building and installing Numdiff, it is possible to know whether it has been linked against GNU MP or not just by calling the program with the option -v. In case of link against GMP the program tells also which version of GNU MP it uses to perform its computations. 5.0.0 beta4 --> 5.0.0 (Ivano Primi ) : * The filter has been improved, now it gets no more confused if the same value is represented in scientific notation in one file and in common decimal notation in the other file. * The Makefile.in (and consequently the Makefile) has been modified to conform to the GNU Coding Standards. * Now numdiff and ndselect accept long options too (for instance --separator='\n\t %' instead of -s '\n\t %'). * The option -r accepts now an additional parameter which tells to compute the relative differences always with respect to the values in one file, instead of using the classic formula for the relative error. * The argument of the option -f has been made optional. * Documentation, i18n and italian l10n have been updated. 5.0.0 beta1 --> 5.0.0 beta4 (Ivano Primi ) : * Added additional information to the report printed by the option -S. * Now the program can accept the options with argument -z INT, -Z INT, -X INT as short equivalent forms of -z 1:INT -z 2:INT, -Z 1:INT -Z 2:INT and -X 1:INT -X 2:INT respectively. * The option -R has been removed since not useful. * The option -s has now an extended syntax allowing to specify different sets of field delimiters for the two files to compare. * Adoption of the version 1.3 of the GNU Free Documentation License for the TeXinfo documentation. * Now the test programs are not anymore distributed together with the source code of Numdiff. 4.2.0 --> 5.0.0 beta1 (Ivano Primi ) : * Removed the support for double, long double and high precision arithmetic. Now only multiple precision arithmetic is available (but it is not a limitation :) ). * Removed the option -L, since the tool ndselect made it obsolete. * Implemented a synchronization procedure to detect insertions/deletions of lines. To accomplish this, source code from GNU diff (diffutils 2.8.1) has been used (with the necessary modifications). Added the options -f, -z, -Z, -R, -m, -H, -T. * Removed the option -F, -X is now used in place of it. * Added new entries to the help which explain how to use the new options. * The output format has been slightly changed. * Makefile and configuration scripts have been changed, since the code has become much more complex than it was. * Added more tests to check that the new features are correctly working. * Change of the license: from GPL version 2 or later to GPL version 3 or later. The copyright statement of my files has been consequently updated. Also the message shown by 'numdiff -v'. 4.0.0 --> 4.2.0 (Ivano Primi ) : * Changed the way the options -V and -b interact when they are both set. * Added new tests. * Now, when the options -v and -h are both set, Numdiff displays before the information about version, Copyright and NO-Warranty and then the help message. * The Copyright has been updated. * Added the tools `ndfilter' and `ndselect'. * i18n and italian l10n updated. * The documentation has been consequently updated. 3.0.2 --> 4.0.0 (Ivano Primi ) : * New output format. At the same time the code printing the output has been cleaned. * Added the -V option for the "verbose" mode. * Better handling of the last line of a file. * i18n, l10n and documentation have been consequently updated. 3.0.1 --> 3.0.2 (Ivano Primi ) : * The code of the function Cabs() has been improved for both double and long-double precision. * Fixed a compilation error which occurred when one chose to activate the double, the long-double or the high precision instead of the multiple precision arithmetic. This compilation error was introduced just before releasing the version 3.0 of Numdiff . 3.0 --> 3.0.1 (Ivano Primi ) : * The code of the function Cabs() has been modified in order to speed up the execution when working with real numbers (the change concerned only the code for multiple precision arithmetic). 3.0 (Ivano Primi ) : * First public release cmtk-3.0.0/Utilities/numdiff-5.2.1/system.h0000644000177700000170000002515011666247630017266 0ustar torstenman/* System dependent declarations. Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU DIFF. GNU DIFF is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU DIFF 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include /* Don't bother to support K&R C compilers any more; it's not worth the trouble. These macros prevent some library modules from being compiled in K&R C mode. */ #define PARAMS(Args) Args #define PROTOTYPES 1 /* Define `__attribute__' and `volatile' first so that they're used consistently in all system includes. */ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || __STRICT_ANSI__ # define __attribute__(x) #endif #if defined const && !defined volatile # define volatile #endif /* Verify a requirement at compile-time (unlike assert, which is runtime). */ #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; } /* Determine whether an integer type is signed, and its bounds. This code assumes two's (or one's!) complement with no holes. */ /* The extra casts work around common compiler bugs, e.g. Cray C 5.0.3.0 when t == time_t. */ #ifndef TYPE_SIGNED # define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) #endif #ifndef TYPE_MINIMUM # define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \ : (t) 0)) #endif #ifndef TYPE_MAXIMUM # define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) #endif #include #include #if STAT_MACROS_BROKEN # undef S_ISBLK # undef S_ISCHR # undef S_ISDIR # undef S_ISFIFO # undef S_ISREG # undef S_ISSOCK #endif #ifndef S_ISDIR # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif #ifndef S_ISREG # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) #endif #if !defined S_ISBLK && defined S_IFBLK # define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) #endif #if !defined S_ISCHR && defined S_IFCHR # define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) #endif #if !defined S_ISFIFO && defined S_IFFIFO # define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO) #endif #if !defined S_ISSOCK && defined S_IFSOCK # define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) #endif #ifndef S_IXUSR # define S_IXUSR 0100 #endif #ifndef S_IXGRP # define S_IXGRP 0010 #endif #ifndef S_IXOTH # define S_IXOTH 0001 #endif #if HAVE_UNISTD_H # include #endif #ifndef SEEK_SET # define SEEK_SET 0 #endif #ifndef SEEK_CUR # define SEEK_CUR 1 #endif #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif #ifndef STDOUT_FILENO # define STDOUT_FILENO 1 #endif #ifndef STDERR_FILENO # define STDERR_FILENO 2 #endif #if HAVE_TIME_H # include #else # include #endif #if HAVE_FCNTL_H # include #else # if HAVE_SYS_FILE_H # include # endif #endif /* Commented out by Ivano Primi, 03.14.2009 */ /* #if !HAVE_DUP2 */ /* # define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t)) */ /* #endif */ #ifndef O_RDONLY # define O_RDONLY 0 #endif #ifndef O_RDWR # define O_RDWR 2 #endif #ifndef S_IRUSR # define S_IRUSR 0400 #endif #ifndef S_IWUSR # define S_IWUSR 0200 #endif #if HAVE_SYS_WAIT_H # include #endif #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif #ifndef STAT_BLOCKSIZE # if HAVE_STRUCT_STAT_ST_BLKSIZE # define STAT_BLOCKSIZE(s) ((s).st_blksize) # else # define STAT_BLOCKSIZE(s) (8 * 1024) # endif #endif #if HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen ((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) ((dirent)->d_namlen) # if HAVE_SYS_NDIR_H # include # endif # if HAVE_SYS_DIR_H # include # endif # if HAVE_NDIR_H # include # endif #endif #if HAVE_STDLIB_H # include #else # ifndef getenv char *getenv (); # endif #endif #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 #endif #if !EXIT_FAILURE # undef EXIT_FAILURE /* Sony NEWS-OS 4.0C defines EXIT_FAILURE to 0. */ # define EXIT_FAILURE 1 #endif #define EXIT_TROUBLE -1 #include #ifndef SSIZE_MAX # define SSIZE_MAX TYPE_MAXIMUM (ssize_t) #endif #if HAVE_INTTYPES_H # include #endif #ifndef PTRDIFF_MAX # define PTRDIFF_MAX TYPE_MAXIMUM (ptrdiff_t) #endif #ifndef SIZE_MAX # define SIZE_MAX TYPE_MAXIMUM (size_t) #endif #ifndef UINTMAX_MAX # define UINTMAX_MAX TYPE_MAXIMUM (uintmax_t) #endif /* Commented out by Ivano Primi, 03.14.2009 */ /* #if ! HAVE_STRTOUMAX && ! defined strtoumax */ /* uintmax_t strtoumax (char const *, char **, int); */ /* #endif */ #include #if STDC_HEADERS || HAVE_STRING_H # include #else # if !HAVE_STRCHR # define strchr index # define strrchr rindex # endif char *strchr (), *strrchr (); # if !HAVE_MEMCHR # define memcmp(s1, s2, n) bcmp (s1, s2, n) # define memcpy(d, s, n) bcopy (s, d, n) void *memchr (); # endif #endif #if HAVE_LOCALE_H # include #else # define setlocale(category, locale) #endif /* Commented out by Ivano Primi, 03.23.2008 #include #define _(msgid) gettext (msgid) #define N_(msgid) msgid */ /* Added by Ivano Primi, 03.23.2008 */ /* This code was part of the file "numdiff.h" */ /* I18N and L10N support */ #ifdef ENABLE_NLS #include #define _(String) gettext (String) #define gettext_noop(String) String #define N_(String) gettext_noop (String) #else #define _(String) (String) #define N_(String) String # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) #define textdomain(Domain) #define bindtextdomain(Package, Directory) #endif /* End added code */ #include /* CTYPE_DOMAIN (C) is nonzero if the unsigned char C can safely be given as an argument to macros like `isspace'. */ #if STDC_HEADERS # define CTYPE_DOMAIN(c) 1 #else # define CTYPE_DOMAIN(c) ((unsigned int) (c) <= 0177) #endif #define ISPRINT(c) (CTYPE_DOMAIN (c) && isprint (c)) #define ISSPACE(c) (CTYPE_DOMAIN (c) && isspace (c)) #if STDC_HEADERS # define TOLOWER(c) tolower (c) #else # ifndef _tolower # define _tolower(c) tolower (c) # endif # define TOLOWER(c) (CTYPE_DOMAIN (c) && isupper (c) ? _tolower (c) : (c)) #endif /* ISDIGIT differs from isdigit, as follows: - Its arg may be any int or unsigned int; it need not be an unsigned char. - It's guaranteed to evaluate its argument exactly once. - It's typically faster. POSIX 1003.1-2001 says that only '0' through '9' are digits. Prefer ISDIGIT to isdigit unless it's important to use the locale's definition of `digit' even when the host does not conform to POSIX. */ #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) #include #if !STDC_HEADERS extern int errno; #endif #include #ifndef SA_RESTART # ifdef SA_INTERRUPT /* e.g. SunOS 4.1.x */ # define SA_RESTART SA_INTERRUPT # else # define SA_RESTART 0 # endif #endif #if !defined SIGCHLD && defined SIGCLD # define SIGCHLD SIGCLD #endif #undef MIN #undef MAX #define MIN(a, b) ((a) <= (b) ? (a) : (b)) #define MAX(a, b) ((a) >= (b) ? (a) : (b)) #if HAVE_STDBOOL_H # include #else # define bool unsigned char #endif #if HAVE_VFORK_H # include #endif #if ! HAVE_WORKING_VFORK # define vfork fork #endif /* Type used for fast comparison of several bytes at a time. */ #ifndef word # define word uintmax_t #endif /* The integer type of a line number. Since files are read into main memory, ptrdiff_t should be wide enough. */ typedef ptrdiff_t lin; #define LIN_MAX PTRDIFF_MAX verify (lin_is_signed, TYPE_SIGNED (lin)); verify (lin_is_wide_enough, sizeof (ptrdiff_t) <= sizeof (lin)); verify (lin_is_printable_as_long, sizeof (lin) <= sizeof (long)); /* This section contains POSIX-compliant defaults for macros that are meant to be overridden by hand in config.h as needed. */ #ifndef file_name_cmp # define file_name_cmp strcmp #endif #ifndef initialize_main # define initialize_main(argcp, argvp) #endif #ifndef NULL_DEVICE # define NULL_DEVICE "/dev/null" #endif /* Do struct stat *S, *T describe the same special file? */ #ifndef same_special_file # if HAVE_ST_RDEV && defined S_ISBLK && defined S_ISCHR # define same_special_file(s, t) \ (((S_ISBLK ((s)->st_mode) && S_ISBLK ((t)->st_mode)) \ || (S_ISCHR ((s)->st_mode) && S_ISCHR ((t)->st_mode))) \ && (s)->st_rdev == (t)->st_rdev) # else # define same_special_file(s, t) 0 # endif #endif /* Do struct stat *S, *T describe the same file? Answer -1 if unknown. */ #ifndef same_file # define same_file(s, t) \ ((((s)->st_ino == (t)->st_ino) && ((s)->st_dev == (t)->st_dev)) \ || same_special_file (s, t)) #endif /* Do struct stat *S, *T have the same file attributes? POSIX says that two files are identical if st_ino and st_dev are the same, but many filesystems incorrectly assign the same (device, inode) pair to two distinct files, including: - GNU/Linux NFS servers that export all local filesystems as a single NFS filesystem, if a local device number (st_dev) exceeds 255, or if a local inode number (st_ino) exceeds 16777215. - Network Appliance NFS servers in snapshot directories; see Network Appliance bug #195. - ClearCase MVFS; see bug id ATRia04618. Check whether two files that purport to be the same have the same attributes, to work around instances of this common bug. Do not inspect all attributes, only attributes useful in checking for this bug. It's possible for two distinct files on a buggy filesystem to have the same attributes, but it's not worth slowing down all implementations (or complicating the configuration) to cater to these rare cases in buggy implementations. */ #ifndef same_file_attributes # define same_file_attributes(s, t) \ ((s)->st_mode == (t)->st_mode \ && (s)->st_nlink == (t)->st_nlink \ && (s)->st_uid == (t)->st_uid \ && (s)->st_gid == (t)->st_gid \ && (s)->st_size == (t)->st_size \ && (s)->st_mtime == (t)->st_mtime \ && (s)->st_ctime == (t)->st_ctime) #endif cmtk-3.0.0/Utilities/numdiff-5.2.1/error.c0000644000177700000170000001757211666247630017077 0ustar torstenman/* Error handler for noninteractive utilities Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by David MacKenzie . */ #if !_LIBC # include #endif #include "error.h" #include #include #include #include #if !_LIBC && ENABLE_NLS # include "gettext.h" #endif #ifdef _LIBC # include # include # include # include # define mbsrtowcs __mbsrtowcs #endif #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif #ifndef _ # define _(String) String #endif /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ void (*error_print_progname) (void); /* This variable is incremented each time `error' is called. */ unsigned int error_message_count; #ifdef _LIBC /* In the GNU C library, there is a predefined variable for this. */ # define program_name program_invocation_name # include # include # include /* In GNU libc we want do not want to use the common name `error' directly. Instead make it a weak alias. */ extern void __error (int status, int errnum, const char *message, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) __attribute__ ((__format__ (__printf__, 5, 6)));; # define error __error # define error_at_line __error_at_line # include # define fflush(s) INTUSE(_IO_fflush) (s) # undef putc # define putc(c, fp) INTUSE(_IO_putc) (c, fp) # include #else /* not _LIBC */ # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif char *strerror_r (); # endif /* The calling program should define program_name and set it to the name of the executing program. */ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r # endif /* HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ static void print_errno_message (int errnum) { char const *s; #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; # if STRERROR_R_CHAR_P || _LIBC s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; else s = 0; # endif #else s = strerror (errnum); #endif #if !_LIBC if (! s) s = _("Unknown system error"); #endif #if _LIBC __fxprintf (NULL, ": %s", s); #else fprintf (stderr, ": %s", s); #endif } static void error_tail (int status, int errnum, const char *message, va_list args) { #if _LIBC if (_IO_fwide (stderr, 0) > 0) { # define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; size_t res; const char *tmp; bool use_malloc = false; while (1) { if (__libc_use_alloca (len * sizeof (wchar_t))) wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); else { if (!use_malloc) wmessage = NULL; wchar_t *p = (wchar_t *) realloc (wmessage, len * sizeof (wchar_t)); if (p == NULL) { free (wmessage); fputws_unlocked (L"out of memory\n", stderr); return; } wmessage = p; use_malloc = true; } memset (&st, '\0', sizeof (st)); tmp = message; res = mbsrtowcs (wmessage, &tmp, len, &st); if (res != len) break; if (__builtin_expect (len >= SIZE_MAX / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; break; } len *= 2; } if (res == (size_t) -1) { /* The string cannot be converted. */ if (use_malloc) { free (wmessage); use_malloc = false; } wmessage = (wchar_t *) L"???"; } __vfwprintf (stderr, wmessage, args); if (use_malloc) free (wmessage); } else #endif vfprintf (stderr, message, args); va_end (args); ++error_message_count; if (errnum) print_errno_message (errnum); #if _LIBC __fxprintf (NULL, "\n"); #else putc ('\n', stderr); #endif fflush (stderr); if (status) exit (status); } /* Print the program name and error message MESSAGE, which is a printf-style format string with optional args. If ERRNUM is nonzero, print its corresponding system error message. Exit with status STATUS if it is nonzero. */ void error (int status, int errnum, const char *message, ...) { va_list args; #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 0); #endif fflush (stdout); #ifdef _LIBC _IO_flockfile (stderr); #endif if (error_print_progname) (*error_print_progname) (); else { #if _LIBC __fxprintf (NULL, "%s: ", program_name); #else fprintf (stderr, "%s: ", program_name); #endif } va_start (args, message); error_tail (status, errnum, message, args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); # endif #endif } /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ int error_one_per_line; void error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) { va_list args; if (error_one_per_line) { static const char *old_file_name; static unsigned int old_line_number; if (old_line_number == line_number && (file_name == old_file_name || strcmp (old_file_name, file_name) == 0)) /* Simply return and print nothing. */ return; old_file_name = file_name; old_line_number = line_number; } #if defined _LIBC && defined __libc_ptf_call /* We do not want this call to be cut short by a thread cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 0); #endif fflush (stdout); #ifdef _LIBC _IO_flockfile (stderr); #endif if (error_print_progname) (*error_print_progname) (); else { #if _LIBC __fxprintf (NULL, "%s:", program_name); #else fprintf (stderr, "%s:", program_name); #endif } #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", file_name, line_number); #endif va_start (args, message); error_tail (status, errnum, message, args); #ifdef _LIBC _IO_funlockfile (stderr); # ifdef __libc_ptf_call __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); # endif #endif } #ifdef _LIBC /* Make the weak alias. */ # undef error # undef error_at_line weak_alias (__error, error) weak_alias (__error_at_line, error_at_line) #endif cmtk-3.0.0/Utilities/numdiff-5.2.1/number.c0000644000177700000170000012437411666247630017235 0ustar torstenman/* number.c: Implements arbitrary precision numbers. */ /* Copyright (C) 1991, 1992, 1993, 1994, 1997, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 General Public License along with this program; see the file COPYING. If not, write to: The Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA You may contact the author by: e-mail: philnelson@acm.org us-mail: Philip A. Nelson Computer Science Department, 9062 Western Washington University Bellingham, WA 98226-9062 *************************************************************************/ /* This file, coming from the source code of GNU BC, has been modified by Ivano Primi so that it could be merged into the source code of Numdiff. Numdiff is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Numdiff 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. */ #include /* #include */ #include #include #ifdef __STDC__ #include #endif /* #include */ #include "numdiff.h" #include "number.h" /* Prototypes needed for external utility routines. */ #ifdef _DMALLOC_ #include /* Useful only for the debugging */ #endif #define bc_rt_warn rt_warn #define bc_rt_error rt_error #define bc_out_of_memory out_of_memory _PROTOTYPE(void rt_warn, (char *mesg ,...)); _PROTOTYPE(void rt_error, (char *mesg ,...)); _PROTOTYPE(void out_of_memory, (void)); /* Storage used for special numbers. */ bc_num _zero_; bc_num _one_; bc_num _two_; static bc_num _bc_Free_list = NULL; /* new_num allocates a number and sets fields to known values. */ bc_num bc_new_num (length, scale) int length, scale; { bc_num temp; if (_bc_Free_list != NULL) { temp = _bc_Free_list; _bc_Free_list = temp->n_next; } else { temp = (bc_num) malloc (sizeof(bc_struct)); if (temp == NULL) bc_out_of_memory (); } temp->n_sign = PLUS; temp->n_len = length; temp->n_scale = scale; temp->n_refs = 1; temp->n_ptr = (char *) malloc (length+scale); if (temp->n_ptr == NULL) bc_out_of_memory(); temp->n_value = temp->n_ptr; memset (temp->n_ptr, 0, length+scale); return temp; } /* "Frees" a bc_num NUM. Actually decreases reference count and only frees the storage if reference count is zero. */ void bc_free_num (num) bc_num *num; { if (*num == NULL) return; (*num)->n_refs--; if ((*num)->n_refs == 0) { if ((*num)->n_ptr) free ((*num)->n_ptr); (*num)->n_next = _bc_Free_list; _bc_Free_list = *num; } *num = NULL; } /* Initialize the number package! */ void bc_init_numbers () { _zero_ = bc_new_num (1,0); _one_ = bc_new_num (1,0); _one_->n_value[0] = 1; _two_ = bc_new_num (1,0); _two_->n_value[0] = 2; } /* Free the memory associated to _two_, _one_ and _zero_ . */ void bc_end () { bc_free_num (&_two_); bc_free_num (&_one_); bc_free_num (&_zero_); } /* This routine has been added by Ivano Primi to avoid some memory leaks. */ /* 30/12/2002 */ /* Make a copy of a number! Just increments the reference count! */ bc_num bc_copy_num (num) bc_num num; { num->n_refs++; return num; } /* Initialize a number NUM by making it a copy of zero. */ void bc_init_num (num) bc_num *num; { *num = bc_copy_num (_zero_); } /* For many things, we may have leading zeros in a number NUM. _bc_rm_leading_zeros just moves the data "value" pointer to the correct place and adjusts the length. */ static void _bc_rm_leading_zeros (num) bc_num num; { /* We can move n_value to point to the first non zero digit! */ while (*num->n_value == 0 && num->n_len > 1) { num->n_value++; num->n_len--; } } /* Compare two bc numbers. Return value is 0 if equal, -1 if N1 is less than N2 and +1 if N1 is greater than N2. If USE_SIGN is false, just compare the magnitudes. */ static int _bc_do_compare (n1, n2, use_sign, ignore_last) bc_num n1, n2; int use_sign; int ignore_last; { char *n1ptr, *n2ptr; int count; /* First, compare signs. */ if (use_sign && n1->n_sign != n2->n_sign) { if (n1->n_sign == PLUS) return (1); /* Positive N1 > Negative N2 */ else return (-1); /* Negative N1 < Positive N1 */ } /* Now compare the magnitude. */ if (n1->n_len != n2->n_len) { if (n1->n_len > n2->n_len) { /* Magnitude of n1 > n2. */ if (!use_sign || n1->n_sign == PLUS) return (1); else return (-1); } else { /* Magnitude of n1 < n2. */ if (!use_sign || n1->n_sign == PLUS) return (-1); else return (1); } } /* If we get here, they have the same number of integer digits. check the integer part and the equal length part of the fraction. */ count = n1->n_len + MIN (n1->n_scale, n2->n_scale); n1ptr = n1->n_value; n2ptr = n2->n_value; while ((count > 0) && (*n1ptr == *n2ptr)) { n1ptr++; n2ptr++; count--; } if (ignore_last && count == 1 && n1->n_scale == n2->n_scale) return (0); if (count != 0) { if (*n1ptr > *n2ptr) { /* Magnitude of n1 > n2. */ if (!use_sign || n1->n_sign == PLUS) return (1); else return (-1); } else { /* Magnitude of n1 < n2. */ if (!use_sign || n1->n_sign == PLUS) return (-1); else return (1); } } /* They are equal up to the last part of the equal part of the fraction. */ if (n1->n_scale != n2->n_scale) { if (n1->n_scale > n2->n_scale) { for (count = n1->n_scale-n2->n_scale; count>0; count--) if (*n1ptr++ != 0) { /* Magnitude of n1 > n2. */ if (!use_sign || n1->n_sign == PLUS) return (1); else return (-1); } } else { for (count = n2->n_scale-n1->n_scale; count>0; count--) if (*n2ptr++ != 0) { /* Magnitude of n1 < n2. */ if (!use_sign || n1->n_sign == PLUS) return (-1); else return (1); } } } /* They must be equal! */ return (0); } /* This is the "user callable" routine to compare numbers N1 and N2. */ int bc_compare (n1, n2) bc_num n1, n2; { return _bc_do_compare (n1, n2, TRUE, FALSE); } /* In some places we need to check if the number is negative. */ char bc_is_neg (num) bc_num num; { return num->n_sign == MINUS; } /* In some places we need to check if the number NUM is zero. */ char bc_is_zero (num) bc_num num; { int count; char *nptr; /* Quick check. */ if (num == _zero_) return TRUE; /* Initialize */ count = num->n_len + num->n_scale; nptr = num->n_value; /* The check */ while ((count > 0) && (*nptr++ == 0)) count--; if (count != 0) return FALSE; else return TRUE; } /* In some places we need to check if the number NUM is almost zero. Specifically, all but the last digit is 0 and the last digit is 1. Last digit is defined by scale. */ char bc_is_near_zero (num, scale) bc_num num; int scale; { int count; char *nptr; /* Error checking */ if (scale > num->n_scale) scale = num->n_scale; /* Initialize */ count = num->n_len + scale; nptr = num->n_value; /* The check */ while ((count > 0) && (*nptr++ == 0)) count--; if (count != 0 && (count != 1 || *--nptr != 1)) return FALSE; else return TRUE; } /* Perform addition: N1 is added to N2 and the value is returned. The signs of N1 and N2 are ignored. SCALE_MIN is to set the minimum scale of the result. */ static bc_num _bc_do_add (n1, n2, scale_min) bc_num n1, n2; int scale_min; { bc_num sum; int sum_scale, sum_digits; char *n1ptr, *n2ptr, *sumptr; int carry, n1bytes, n2bytes; int count; /* Prepare sum. */ sum_scale = MAX (n1->n_scale, n2->n_scale); sum_digits = MAX (n1->n_len, n2->n_len) + 1; sum = bc_new_num (sum_digits, MAX(sum_scale, scale_min)); /* Zero extra digits made by scale_min. */ if (scale_min > sum_scale) { sumptr = (char *) (sum->n_value + sum_scale + sum_digits); for (count = scale_min - sum_scale; count > 0; count--) *sumptr++ = 0; } /* Start with the fraction part. Initialize the pointers. */ n1bytes = n1->n_scale; n2bytes = n2->n_scale; n1ptr = (char *) (n1->n_value + n1->n_len + n1bytes - 1); n2ptr = (char *) (n2->n_value + n2->n_len + n2bytes - 1); sumptr = (char *) (sum->n_value + sum_scale + sum_digits - 1); /* Add the fraction part. First copy the longer fraction.*/ if (n1bytes != n2bytes) { if (n1bytes > n2bytes) while (n1bytes>n2bytes) { *sumptr-- = *n1ptr--; n1bytes--;} else while (n2bytes>n1bytes) { *sumptr-- = *n2ptr--; n2bytes--;} } /* Now add the remaining fraction part and equal size integer parts. */ n1bytes += n1->n_len; n2bytes += n2->n_len; carry = 0; while ((n1bytes > 0) && (n2bytes > 0)) { *sumptr = *n1ptr-- + *n2ptr-- + carry; if (*sumptr > (BASE-1)) { carry = 1; *sumptr -= BASE; } else carry = 0; sumptr--; n1bytes--; n2bytes--; } /* Now add carry the longer integer part. */ if (n1bytes == 0) { n1bytes = n2bytes; n1ptr = n2ptr; } while (n1bytes-- > 0) { *sumptr = *n1ptr-- + carry; if (*sumptr > (BASE-1)) { carry = 1; *sumptr -= BASE; } else carry = 0; sumptr--; } /* Set final carry. */ if (carry == 1) *sumptr += 1; /* Adjust sum and return. */ _bc_rm_leading_zeros (sum); return sum; } /* Perform subtraction: N2 is subtracted from N1 and the value is returned. The signs of N1 and N2 are ignored. Also, N1 is assumed to be larger than N2. SCALE_MIN is the minimum scale of the result. */ static bc_num _bc_do_sub (n1, n2, scale_min) bc_num n1, n2; int scale_min; { bc_num diff; int diff_scale, diff_len; int min_scale, min_len; char *n1ptr, *n2ptr, *diffptr; int borrow, count, val; /* Allocate temporary storage. */ diff_len = MAX (n1->n_len, n2->n_len); diff_scale = MAX (n1->n_scale, n2->n_scale); min_len = MIN (n1->n_len, n2->n_len); min_scale = MIN (n1->n_scale, n2->n_scale); diff = bc_new_num (diff_len, MAX(diff_scale, scale_min)); /* Zero extra digits made by scale_min. */ if (scale_min > diff_scale) { diffptr = (char *) (diff->n_value + diff_len + diff_scale); for (count = scale_min - diff_scale; count > 0; count--) *diffptr++ = 0; } /* Initialize the subtract. */ n1ptr = (char *) (n1->n_value + n1->n_len + n1->n_scale -1); n2ptr = (char *) (n2->n_value + n2->n_len + n2->n_scale -1); diffptr = (char *) (diff->n_value + diff_len + diff_scale -1); /* Subtract the numbers. */ borrow = 0; /* Take care of the longer scaled number. */ if (n1->n_scale != min_scale) { /* n1 has the longer scale */ for (count = n1->n_scale - min_scale; count > 0; count--) *diffptr-- = *n1ptr--; } else { /* n2 has the longer scale */ for (count = n2->n_scale - min_scale; count > 0; count--) { val = - *n2ptr-- - borrow; if (val < 0) { val += BASE; borrow = 1; } else borrow = 0; *diffptr-- = val; } } /* Now do the equal length scale and integer parts. */ for (count = 0; count < min_len + min_scale; count++) { val = *n1ptr-- - *n2ptr-- - borrow; if (val < 0) { val += BASE; borrow = 1; } else borrow = 0; *diffptr-- = val; } /* If n1 has more digits then n2, we now do that subtract. */ if (diff_len != min_len) { for (count = diff_len - min_len; count > 0; count--) { val = *n1ptr-- - borrow; if (val < 0) { val += BASE; borrow = 1; } else borrow = 0; *diffptr-- = val; } } /* Clean up and return. */ _bc_rm_leading_zeros (diff); return diff; } /* Here is the full subtract routine that takes care of negative numbers. N2 is subtracted from N1 and the result placed in RESULT. SCALE_MIN is the minimum scale for the result. */ void bc_sub (n1, n2, result, scale_min) bc_num n1, n2, *result; int scale_min; { bc_num diff = NULL; int cmp_res; int res_scale; if (n1->n_sign != n2->n_sign) { diff = _bc_do_add (n1, n2, scale_min); diff->n_sign = n1->n_sign; } else { /* subtraction must be done. */ /* Compare magnitudes. */ cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE); switch (cmp_res) { case -1: /* n1 is less than n2, subtract n1 from n2. */ diff = _bc_do_sub (n2, n1, scale_min); diff->n_sign = (n2->n_sign == PLUS ? MINUS : PLUS); break; case 0: /* They are equal! return zero! */ res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale)); diff = bc_new_num (1, res_scale); memset (diff->n_value, 0, res_scale+1); break; case 1: /* n2 is less than n1, subtract n2 from n1. */ diff = _bc_do_sub (n1, n2, scale_min); diff->n_sign = n1->n_sign; break; } } /* Clean up and return. */ bc_free_num (result); *result = diff; } /* Here is the full add routine that takes care of negative numbers. N1 is added to N2 and the result placed into RESULT. SCALE_MIN is the minimum scale for the result. */ void bc_add (n1, n2, result, scale_min) bc_num n1, n2, *result; int scale_min; { bc_num sum = NULL; int cmp_res; int res_scale; if (n1->n_sign == n2->n_sign) { sum = _bc_do_add (n1, n2, scale_min); sum->n_sign = n1->n_sign; } else { /* subtraction must be done. */ cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE); /* Compare magnitudes. */ switch (cmp_res) { case -1: /* n1 is less than n2, subtract n1 from n2. */ sum = _bc_do_sub (n2, n1, scale_min); sum->n_sign = n2->n_sign; break; case 0: /* They are equal! return zero with the correct scale! */ res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale)); sum = bc_new_num (1, res_scale); memset (sum->n_value, 0, res_scale+1); break; case 1: /* n2 is less than n1, subtract n2 from n1. */ sum = _bc_do_sub (n1, n2, scale_min); sum->n_sign = n1->n_sign; } } /* Clean up and return. */ bc_free_num (result); *result = sum; } /* Recursive vs non-recursive multiply crossover ranges. */ #if defined(MULDIGITS) #include "muldigits.h" #else #define MUL_BASE_DIGITS 80 #endif int mul_base_digits = MUL_BASE_DIGITS; #define MUL_SMALL_DIGITS mul_base_digits/4 /* Multiply utility routines */ static bc_num new_sub_num (length, scale, value) int length, scale; char *value; { bc_num temp; if (_bc_Free_list != NULL) { temp = _bc_Free_list; _bc_Free_list = temp->n_next; } else { temp = (bc_num) malloc (sizeof(bc_struct)); if (temp == NULL) bc_out_of_memory (); } temp->n_sign = PLUS; temp->n_len = length; temp->n_scale = scale; temp->n_refs = 1; temp->n_ptr = NULL; temp->n_value = value; return temp; } static void _bc_simp_mul (bc_num n1, int n1len, bc_num n2, int n2len, bc_num *prod, int full_scale) { char *n1ptr, *n2ptr, *pvptr; char *n1end, *n2end; /* To the end of n1 and n2. */ int indx, sum, prodlen; prodlen = n1len+n2len+1; *prod = bc_new_num (prodlen, 0); n1end = (char *) (n1->n_value + n1len - 1); n2end = (char *) (n2->n_value + n2len - 1); pvptr = (char *) ((*prod)->n_value + prodlen - 1); sum = 0; /* Here is the loop... */ for (indx = 0; indx < prodlen-1; indx++) { n1ptr = (char *) (n1end - MAX(0, indx-n2len+1)); n2ptr = (char *) (n2end - MIN(indx, n2len-1)); while ((n1ptr >= n1->n_value) && (n2ptr <= n2end)) sum += *n1ptr-- * *n2ptr++; *pvptr-- = sum % BASE; sum = sum / BASE; } *pvptr = sum; } /* A special adder/subtractor for the recursive divide and conquer multiply algorithm. Note: if sub is called, accum must be larger that what is being subtracted. Also, accum and val must have n_scale = 0. (e.g. they must look like integers. *) */ static void _bc_shift_addsub (bc_num accum, bc_num val, int shift, int sub) { signed char *accp, *valp; int count, carry; count = val->n_len; if (val->n_value[0] == 0) count--; assert (accum->n_len+accum->n_scale >= shift+count); /* Set up pointers and others */ accp = (signed char *)(accum->n_value + accum->n_len + accum->n_scale - shift - 1); valp = (signed char *)(val->n_value + val->n_len - 1); carry = 0; if (sub) { /* Subtraction, carry is really borrow. */ while (count--) { *accp -= *valp-- + carry; if (*accp < 0) { carry = 1; *accp-- += BASE; } else { carry = 0; accp--; } } while (carry) { *accp -= carry; if (*accp < 0) *accp-- += BASE; else carry = 0; } } else { /* Addition */ while (count--) { *accp += *valp-- + carry; if (*accp > (BASE-1)) { carry = 1; *accp-- -= BASE; } else { carry = 0; accp--; } } while (carry) { *accp += carry; if (*accp > (BASE-1)) *accp-- -= BASE; else carry = 0; } } } /* Recursive divide and conquer multiply algorithm. Based on Let u = u0 + u1*(b^n) Let v = v0 + v1*(b^n) Then uv = (B^2n+B^n)*u1*v1 + B^n*(u1-u0)*(v0-v1) + (B^n+1)*u0*v0 B is the base of storage, number of digits in u1,u0 close to equal. */ static void _bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod, int full_scale) { bc_num u0, u1, v0, v1; int u0len, v0len; bc_num m1, m2, m3, d1, d2; int n, prodlen, m1zero; int d1len, d2len; /* Base case? */ if ((ulen+vlen) < mul_base_digits || ulen < MUL_SMALL_DIGITS || vlen < MUL_SMALL_DIGITS ) { _bc_simp_mul (u, ulen, v, vlen, prod, full_scale); return; } /* Calculate n -- the u and v split point in digits. */ n = (MAX(ulen, vlen)+1) / 2; /* Split u and v. */ if (ulen < n) { u1 = bc_copy_num (_zero_); u0 = new_sub_num (ulen,0, u->n_value); } else { u1 = new_sub_num (ulen-n, 0, u->n_value); u0 = new_sub_num (n, 0, u->n_value+ulen-n); } if (vlen < n) { v1 = bc_copy_num (_zero_); v0 = new_sub_num (vlen,0, v->n_value); } else { v1 = new_sub_num (vlen-n, 0, v->n_value); v0 = new_sub_num (n, 0, v->n_value+vlen-n); } _bc_rm_leading_zeros (u1); _bc_rm_leading_zeros (u0); u0len = u0->n_len; _bc_rm_leading_zeros (v1); _bc_rm_leading_zeros (v0); v0len = v0->n_len; m1zero = bc_is_zero(u1) || bc_is_zero(v1); /* Calculate sub results ... */ bc_init_num(&d1); bc_init_num(&d2); bc_sub (u1, u0, &d1, 0); d1len = d1->n_len; bc_sub (v0, v1, &d2, 0); d2len = d2->n_len; /* Do recursive multiplies and shifted adds. */ if (m1zero) m1 = bc_copy_num (_zero_); else _bc_rec_mul (u1, u1->n_len, v1, v1->n_len, &m1, 0); if (bc_is_zero(d1) || bc_is_zero(d2)) m2 = bc_copy_num (_zero_); else _bc_rec_mul (d1, d1len, d2, d2len, &m2, 0); if (bc_is_zero(u0) || bc_is_zero(v0)) m3 = bc_copy_num (_zero_); else _bc_rec_mul (u0, u0->n_len, v0, v0->n_len, &m3, 0); /* Initialize product */ prodlen = ulen+vlen+1; *prod = bc_new_num(prodlen, 0); if (!m1zero) { _bc_shift_addsub (*prod, m1, 2*n, 0); _bc_shift_addsub (*prod, m1, n, 0); } _bc_shift_addsub (*prod, m3, n, 0); _bc_shift_addsub (*prod, m3, 0, 0); _bc_shift_addsub (*prod, m2, n, d1->n_sign != d2->n_sign); /* Now clean up! */ bc_free_num (&u1); bc_free_num (&u0); bc_free_num (&v1); bc_free_num (&m1); bc_free_num (&v0); bc_free_num (&m2); bc_free_num (&m3); bc_free_num (&d1); bc_free_num (&d2); } /* The multiply routine. N2 times N1 is put int PROD with the scale of the result being MIN(N2 scale+N1 scale, MAX (SCALE, N2 scale, N1 scale)). */ void bc_multiply (n1, n2, prod, scale) bc_num n1, n2, *prod; int scale; { bc_num pval; int len1, len2; int full_scale, prod_scale; /* Initialize things. */ len1 = n1->n_len + n1->n_scale; len2 = n2->n_len + n2->n_scale; full_scale = n1->n_scale + n2->n_scale; prod_scale = MIN(full_scale,MAX(scale,MAX(n1->n_scale,n2->n_scale))); /* Do the multiply */ _bc_rec_mul (n1, len1, n2, len2, &pval, full_scale); /* Assign to prod and clean up the number. */ pval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS ); pval->n_value = pval->n_ptr; pval->n_len = len2 + len1 + 1 - full_scale; pval->n_scale = prod_scale; _bc_rm_leading_zeros (pval); if (bc_is_zero (pval)) pval->n_sign = PLUS; bc_free_num (prod); *prod = pval; } /* Some utility routines for the divide: First a one digit multiply. NUM (with SIZE digits) is multiplied by DIGIT and the result is placed into RESULT. It is written so that NUM and RESULT can be the same pointers. */ static void _one_mult (num, size, digit, result) unsigned char *num; int size, digit; unsigned char *result; { int carry, value; unsigned char *nptr, *rptr; if (digit == 0) memset (result, 0, size); else { if (digit == 1) memcpy (result, num, size); else { /* Initialize */ nptr = (unsigned char *) (num+size-1); rptr = (unsigned char *) (result+size-1); carry = 0; while (size-- > 0) { value = *nptr-- * digit + carry; *rptr-- = value % BASE; carry = value / BASE; } if (carry != 0) *rptr = carry; } } } /* The full division routine. This computes N1 / N2. It returns 0 if the division is ok and the result is in QUOT. The number of digits after the decimal point is SCALE. It returns -1 if division by zero is tried. The algorithm is found in Knuth Vol 2. p237. */ int bc_divide (n1, n2, quot, scale) bc_num n1, n2, *quot; int scale; { bc_num qval; unsigned char *num1, *num2; unsigned char *ptr1, *ptr2, *n2ptr, *qptr; int scale1, val; unsigned int len1, len2, scale2, qdigits, extra, count; unsigned int qdig, qguess, borrow, carry; unsigned char *mval; char zero; unsigned int norm; /* Test for divide by zero. */ if (bc_is_zero (n2)) return -1; /* Test for divide by 1. If it is we must truncate. */ if (n2->n_scale == 0) { if (n2->n_len == 1 && *n2->n_value == 1) { qval = bc_new_num (n1->n_len, scale); qval->n_sign = (n1->n_sign == n2->n_sign ? PLUS : MINUS); memset (&qval->n_value[n1->n_len],0,scale); memcpy (qval->n_value, n1->n_value, n1->n_len + MIN(n1->n_scale,scale)); bc_free_num (quot); *quot = qval; } } /* Set up the divide. Move the decimal point on n1 by n2's scale. Remember, zeros on the end of num2 are wasted effort for dividing. */ scale2 = n2->n_scale; n2ptr = (unsigned char *) n2->n_value+n2->n_len+scale2-1; while ((scale2 > 0) && (*n2ptr-- == 0)) scale2--; len1 = n1->n_len + scale2; scale1 = n1->n_scale - scale2; if (scale1 < scale) extra = scale - scale1; else extra = 0; num1 = (unsigned char *) malloc (n1->n_len+n1->n_scale+extra+2); if (num1 == NULL) bc_out_of_memory(); memset (num1, 0, n1->n_len+n1->n_scale+extra+2); memcpy (num1+1, n1->n_value, n1->n_len+n1->n_scale); len2 = n2->n_len + scale2; num2 = (unsigned char *) malloc (len2+1); if (num2 == NULL) bc_out_of_memory(); memcpy (num2, n2->n_value, len2); *(num2+len2) = 0; n2ptr = num2; while (*n2ptr == 0) { n2ptr++; len2--; } /* Calculate the number of quotient digits. */ if (len2 > len1+scale) { qdigits = scale+1; zero = TRUE; } else { zero = FALSE; if (len2>len1) qdigits = scale+1; /* One for the zero integer part. */ else qdigits = len1-len2+scale+1; } /* Allocate and zero the storage for the quotient. */ qval = bc_new_num (qdigits-scale,scale); memset (qval->n_value, 0, qdigits); /* Allocate storage for the temporary storage mval. */ mval = (unsigned char *) malloc (len2+1); if (mval == NULL) bc_out_of_memory (); /* Now for the full divide algorithm. */ if (!zero) { /* Normalize */ norm = 10 / ((int)*n2ptr + 1); if (norm != 1) { _one_mult (num1, len1+scale1+extra+1, norm, num1); _one_mult (n2ptr, len2, norm, n2ptr); } /* Initialize divide loop. */ qdig = 0; if (len2 > len1) qptr = (unsigned char *) qval->n_value+len2-len1; else qptr = (unsigned char *) qval->n_value; /* Loop */ while (qdig <= len1+scale-len2) { /* Calculate the quotient digit guess. */ if (*n2ptr == num1[qdig]) qguess = 9; else qguess = (num1[qdig]*10 + num1[qdig+1]) / *n2ptr; /* Test qguess. */ if (n2ptr[1]*qguess > (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10 + num1[qdig+2]) { qguess--; /* And again. */ if (n2ptr[1]*qguess > (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10 + num1[qdig+2]) qguess--; } /* Multiply and subtract. */ borrow = 0; if (qguess != 0) { *mval = 0; _one_mult (n2ptr, len2, qguess, mval+1); ptr1 = (unsigned char *) num1+qdig+len2; ptr2 = (unsigned char *) mval+len2; for (count = 0; count < len2+1; count++) { val = (int) *ptr1 - (int) *ptr2-- - borrow; if (val < 0) { val += 10; borrow = 1; } else borrow = 0; *ptr1-- = val; } } /* Test for negative result. */ if (borrow == 1) { qguess--; ptr1 = (unsigned char *) num1+qdig+len2; ptr2 = (unsigned char *) n2ptr+len2-1; carry = 0; for (count = 0; count < len2; count++) { val = (int) *ptr1 + (int) *ptr2-- + carry; if (val > 9) { val -= 10; carry = 1; } else carry = 0; *ptr1-- = val; } if (carry == 1) *ptr1 = (*ptr1 + 1) % 10; } /* We now know the quotient digit. */ *qptr++ = qguess; qdig++; } } /* Clean up and return the number. */ qval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS ); if (bc_is_zero (qval)) qval->n_sign = PLUS; _bc_rm_leading_zeros (qval); bc_free_num (quot); *quot = qval; /* Clean up temporary storage. */ free (mval); free (num1); free (num2); return 0; /* Everything is OK. */ } /* Division *and* modulo for numbers. This computes both NUM1 / NUM2 and NUM1 % NUM2 and puts the results in QUOT and REM, except that if QUOT is NULL then that store will be omitted. */ int bc_divmod (num1, num2, quot, rem, scale) bc_num num1, num2, *quot, *rem; int scale; { bc_num quotient = NULL; bc_num temp; int rscale; /* Check for correct numbers. */ if (bc_is_zero (num2)) return -1; /* Calculate final scale. */ rscale = MAX (num1->n_scale, num2->n_scale+scale); bc_init_num(&temp); /* Calculate it. */ bc_divide (num1, num2, &temp, scale); if (quot) quotient = bc_copy_num (temp); bc_multiply (temp, num2, &temp, rscale); bc_sub (num1, temp, rem, rscale); bc_free_num (&temp); if (quot) { bc_free_num (quot); *quot = quotient; } return 0; /* Everything is OK. */ } /* Modulo for numbers. This computes NUM1 % NUM2 and puts the result in RESULT. */ int bc_modulo (num1, num2, result, scale) bc_num num1, num2, *result; int scale; { return bc_divmod (num1, num2, NULL, result, scale); } /* Raise BASE to the EXPO power, reduced modulo MOD. The result is placed in RESULT. If a EXPO is not an integer, only the integer part is used. */ int bc_raisemod (base, expo, mod, result, scale) bc_num base, expo, mod, *result; int scale; { bc_num power, exponent, parity, temp; int rscale; /* Check for correct numbers. */ if (bc_is_zero(mod)) return -1; if (bc_is_neg(expo)) return -1; /* Set initial values. */ power = bc_copy_num (base); exponent = bc_copy_num (expo); temp = bc_copy_num (_one_); bc_init_num(&parity); /* Check the base for scale digits. */ if (base->n_scale != 0) bc_rt_warn (_("power with non integral base")); /* bc_rt_warn (_("non-zero scale in base")); */ /* Check the exponent for scale digits. */ if (exponent->n_scale != 0) { bc_rt_warn (_("power with non integral exponent")); /* bc_rt_warn (_("non-zero scale in exponent")); */ bc_divide (exponent, _one_, &exponent, 0); /*truncate */ } /* Check the modulus for scale digits. */ if (mod->n_scale != 0) bc_rt_warn (_("modulus is not an integral value")); /* bc_rt_warn (_("non-zero scale in modulus")); */ /* Do the calculation. */ rscale = MAX(scale, base->n_scale); while ( !bc_is_zero(exponent) ) { (void) bc_divmod (exponent, _two_, &exponent, &parity, 0); if ( !bc_is_zero(parity) ) { bc_multiply (temp, power, &temp, rscale); (void) bc_modulo (temp, mod, &temp, scale); } bc_multiply (power, power, &power, rscale); (void) bc_modulo (power, mod, &power, scale); } /* Assign the value. */ bc_free_num (&power); bc_free_num (&exponent); bc_free_num (result); *result = temp; return 0; /* Everything is OK. */ } /* Raise NUM1 to the NUM2 power. The result is placed in RESULT. Maximum exponent is LONG_MAX. If a NUM2 is not an integer, only the integer part is used. */ void bc_raise (num1, num2, result, scale) bc_num num1, num2, *result; int scale; { bc_num temp, power; long exponent; int rscale; int pwrscale; int calcscale; char neg; /* Check the exponent for scale digits and convert to a long. */ if (num2->n_scale != 0) bc_rt_warn (_("power with non integral exponent")); /* bc_rt_warn (_("non-zero scale in exponent")); */ exponent = bc_num2long (num2); if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0)) bc_rt_error (_("exponent too large in raise")); /* Special case if exponent is a zero. */ if (exponent == 0) { bc_free_num (result); *result = bc_copy_num (_one_); return; } /* Other initializations. */ if (exponent < 0) { neg = TRUE; exponent = -exponent; rscale = scale; } else { neg = FALSE; rscale = MIN (num1->n_scale*exponent, MAX(scale, num1->n_scale)); } /* Set initial value of temp. */ power = bc_copy_num (num1); pwrscale = num1->n_scale; while ((exponent & 1) == 0) { pwrscale = 2*pwrscale; bc_multiply (power, power, &power, pwrscale); exponent = exponent >> 1; } temp = bc_copy_num (power); calcscale = pwrscale; exponent = exponent >> 1; /* Do the calculation. */ while (exponent > 0) { pwrscale = 2*pwrscale; bc_multiply (power, power, &power, pwrscale); if ((exponent & 1) == 1) { calcscale = pwrscale + calcscale; bc_multiply (temp, power, &temp, calcscale); } exponent = exponent >> 1; } /* Assign the value. */ if (neg) { bc_divide (_one_, temp, result, rscale); bc_free_num (&temp); } else { bc_free_num (result); *result = temp; if ((*result)->n_scale > rscale) (*result)->n_scale = rscale; } bc_free_num (&power); } /* Take the square root NUM and return it in NUM with SCALE digits after the decimal place. */ int bc_sqrt (num, scale) bc_num *num; int scale; { int rscale, cmp_res, done; int cscale; bc_num guess, guess1, point5, diff; /* Initial checks. */ cmp_res = bc_compare (*num, _zero_); if (cmp_res < 0) return -1; /* error */ else { if (cmp_res == 0) { bc_free_num (num); *num = bc_copy_num (_zero_); return 0; } } cmp_res = bc_compare (*num, _one_); if (cmp_res == 0) { bc_free_num (num); *num = bc_copy_num (_one_); return 0; } /* Initialize the variables. */ rscale = MAX (scale, (*num)->n_scale); /* bc_init_num(&guess); */ /* Moved at the line 1386 by Ivano Primi */ bc_init_num(&guess1); bc_init_num(&diff); point5 = bc_new_num (1,1); point5->n_value[1] = 5; /* Calculate the initial guess. */ if (cmp_res < 0) { /* The number is between 0 and 1. Guess should start at 1. */ guess = bc_copy_num (_one_); cscale = (*num)->n_scale; } else { /* The number is greater than 1. Guess should start at 10^(exp/2). */ bc_init_num(&guess); bc_int2num (&guess,10); bc_int2num (&guess1,(*num)->n_len); bc_multiply (guess1, point5, &guess1, 0); guess1->n_scale = 0; bc_raise (guess, guess1, &guess, 0); bc_free_num (&guess1); cscale = 3; } /* Find the square root using Newton's algorithm. */ done = FALSE; while (!done) { bc_free_num (&guess1); guess1 = bc_copy_num (guess); bc_divide (*num, guess, &guess, cscale); bc_add (guess, guess1, &guess, 0); bc_multiply (guess, point5, &guess, cscale); bc_sub (guess, guess1, &diff, cscale+1); if (bc_is_near_zero (diff, cscale)) { if (cscale < rscale+1) cscale = MIN (cscale*3, rscale+1); else done = TRUE; } } /* Assign the number and clean up. */ bc_free_num (num); bc_divide (guess,_one_,num,rscale); bc_free_num (&guess); bc_free_num (&guess1); bc_free_num (&point5); bc_free_num (&diff); return 0; } /* The following routines provide output for bcd numbers package using the rules of POSIX bc for output. */ /* This structure is used for saving digits in the conversion process. */ typedef struct stk_rec { long digit; struct stk_rec *next; } stk_rec; /* The reference string for digits. */ static char ref_str[] = "0123456789ABCDEF"; /* A special output routine for "multi-character digits." Exactly SIZE characters must be output for the value VAL. If SPACE is non-zero, we must output one space before the number. OUT_CHAR is the actual routine for writing the characters. */ void bc_out_long (val, size, space, out_char) long val; int size, space; #ifdef __STDC__ void (*out_char)(int); #else void (*out_char)(); #endif { char digits[40]; int len, ix; if (space) (*out_char) (' '); sprintf (digits, "%ld", val); len = strlen (digits); while (size > len) { (*out_char) ('0'); size--; } for (ix=0; ix < len; ix++) (*out_char) (digits[ix]); } /* Output of a bcd number. NUM is written in base O_BASE using OUT_CHAR as the routine to do the actual output of the characters. */ void bc_out_num (num, o_base, out_char, leading_zero) bc_num num; int o_base; #ifdef __STDC__ void (*out_char)(int); #else void (*out_char)(); #endif int leading_zero; { char *nptr; int index, fdigit, pre_space; stk_rec *digits, *temp; bc_num int_part, frac_part, base, cur_dig, t_num, max_o_digit; /* The negative sign if needed. */ if (num->n_sign == MINUS) (*out_char) ('-'); /* Output the number. */ if (bc_is_zero (num)) (*out_char) ('0'); else if (o_base == 10) { /* The number is in base 10, do it the fast way. */ nptr = num->n_value; if (num->n_len > 1 || *nptr != 0) for (index=num->n_len; index>0; index--) (*out_char) (BCD_CHAR(*nptr++)); else nptr++; if (leading_zero && bc_is_zero (num)) (*out_char) ('0'); /* Now the fraction. */ if (num->n_scale > 0) { (*out_char) ('.'); for (index=0; indexn_scale; index++) (*out_char) (BCD_CHAR(*nptr++)); } } else { /* special case ... */ if (leading_zero && bc_is_zero (num)) (*out_char) ('0'); /* The number is some other base. */ digits = NULL; bc_init_num (&int_part); bc_divide (num, _one_, &int_part, 0); bc_init_num (&frac_part); bc_init_num (&cur_dig); bc_init_num (&base); bc_sub (num, int_part, &frac_part, 0); /* Make the INT_PART and FRAC_PART positive. */ int_part->n_sign = PLUS; frac_part->n_sign = PLUS; bc_int2num (&base, o_base); bc_init_num (&max_o_digit); bc_int2num (&max_o_digit, o_base-1); /* Get the digits of the integer part and push them on a stack. */ while (!bc_is_zero (int_part)) { bc_modulo (int_part, base, &cur_dig, 0); temp = (stk_rec *) malloc (sizeof(stk_rec)); if (temp == NULL) bc_out_of_memory(); temp->digit = bc_num2long (cur_dig); temp->next = digits; digits = temp; bc_divide (int_part, base, &int_part, 0); } /* Print the digits on the stack. */ if (digits != NULL) { /* Output the digits. */ while (digits != NULL) { temp = digits; digits = digits->next; if (o_base <= 16) (*out_char) (ref_str[ (int) temp->digit]); else bc_out_long (temp->digit, max_o_digit->n_len, 1, out_char); free (temp); } } /* Get and print the digits of the fraction part. */ if (num->n_scale > 0) { (*out_char) ('.'); pre_space = 0; t_num = bc_copy_num (_one_); while (t_num->n_len <= num->n_scale) { bc_multiply (frac_part, base, &frac_part, num->n_scale); fdigit = bc_num2long (frac_part); bc_int2num (&int_part, fdigit); bc_sub (frac_part, int_part, &frac_part, 0); if (o_base <= 16) (*out_char) (ref_str[fdigit]); else { bc_out_long (fdigit, max_o_digit->n_len, pre_space, out_char); pre_space = 1; } bc_multiply (t_num, base, &t_num, 0); } bc_free_num (&t_num); } /* Clean up. */ bc_free_num (&int_part); bc_free_num (&frac_part); bc_free_num (&base); bc_free_num (&cur_dig); bc_free_num (&max_o_digit); } } /* Convert a number NUM to a long. The function returns only the integer part of the number. For numbers that are too large to represent as a long, this function returns a zero. This can be detected by checking the NUM for zero after having a zero returned. */ long bc_num2long (num) bc_num num; { long val; char *nptr; int index; /* Extract the int value, ignore the fraction. */ val = 0; nptr = num->n_value; for (index=num->n_len; (index>0) && (val<=(LONG_MAX/BASE)); index--) val = val*BASE + *nptr++; /* Check for overflow. If overflow, return zero. */ if (index>0) val = 0; if (val < 0) val = 0; /* Return the value. */ if (num->n_sign == PLUS) return (val); else return (-val); } /* Convert an integer VAL to a bc number NUM. */ void bc_int2num (num, val) bc_num *num; int val; { char buffer[30]; char *bptr, *vptr; int ix = 1; char neg = 0; /* Sign. */ if (val < 0) { neg = 1; val = -val; } /* Get things going. */ bptr = buffer; *bptr++ = val % BASE; val = val / BASE; /* Extract remaining digits. */ while (val != 0) { *bptr++ = val % BASE; val = val / BASE; ix++; /* Count the digits. */ } /* Make the number. */ bc_free_num (num); *num = bc_new_num (ix, 0); if (neg) (*num)->n_sign = MINUS; /* Assign the digits. */ vptr = (*num)->n_value; while (ix-- > 0) *vptr++ = *--bptr; } /* Convert a numbers to a string. Base 10 only.*/ char * bc_num2str (num) bc_num num; { char *str, *sptr; char *nptr; int index, signch; /* Allocate the string memory. */ signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */ if (num->n_scale > 0) str = (char *) malloc (num->n_len + num->n_scale + 2 + signch); else str = (char *) malloc (num->n_len + 1 + signch); if (str == NULL) bc_out_of_memory(); /* The negative sign if needed. */ sptr = str; if (signch) *sptr++ = '-'; /* Load the whole number. */ nptr = num->n_value; for (index=num->n_len; index>0; index--) *sptr++ = BCD_CHAR(*nptr++); /* Now the fraction. */ if (num->n_scale > 0) { *sptr++ = '.'; for (index=0; indexn_scale; index++) *sptr++ = BCD_CHAR(*nptr++); } /* Terminate the string and return it! */ *sptr = '\0'; return (str); } /* Convert strings to bc numbers. Base 10 only.*/ void bc_str2num (num, str, scale) bc_num *num; char *str; int scale; { int digits, strscale; char *ptr, *nptr; char zero_int; /* Prepare num. */ bc_free_num (num); /* Check for valid number and count digits. */ ptr = str; digits = 0; strscale = 0; zero_int = FALSE; if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */ while (*ptr == '0') ptr++; /* Skip leading zeros. */ while (is_digit((int)*ptr)) ptr++, digits++; /* digits */ if (*ptr == '.') ptr++; /* decimal point */ while (is_digit((int)*ptr)) ptr++, strscale++; /* digits */ if ((*ptr != '\0') || (digits+strscale == 0)) { *num = bc_copy_num (_zero_); return; } /* Adjust numbers and allocate storage and initialize fields. */ strscale = MIN(strscale, scale); if (digits == 0) { zero_int = TRUE; digits = 1; } *num = bc_new_num (digits, strscale); /* Build the whole number. */ ptr = str; if (*ptr == '-') { (*num)->n_sign = MINUS; ptr++; } else { (*num)->n_sign = PLUS; if (*ptr == '+') ptr++; } while (*ptr == '0') ptr++; /* Skip leading zeros. */ nptr = (*num)->n_value; if (zero_int) { *nptr++ = 0; digits = 0; } for (;digits > 0; digits--) *nptr++ = CH_VAL(*ptr++); /* Build the fractional part. */ if (strscale > 0) { ptr++; /* skip the decimal point! */ for (;strscale > 0; strscale--) *nptr++ = CH_VAL(*ptr++); } } void out_char (int c) { putchar(c); } void out_char_stderr (int c) { fputc (c, stderr); } /* pn prints the number NUM in base 10. */ void pn (num) bc_num num; { bc_out_num (num, 10, out_char, 0); out_char ('\n'); } /* pn_stderr prints the number NUM in base 10 on stderr. */ void pn_stderr (num) bc_num num; { bc_out_num (num, 10, out_char_stderr, 0); out_char_stderr ('\n'); } /* pv prints a character array as if it was a string of bcd digits. */ void pv (name, num, len) char *name; unsigned char *num; int len; { int i; printf ("%s=", name); for (i=0; i Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . cmtk-3.0.0/Utilities/numdiff-5.2.1/shtool0000755000177700000170000042514611666247630017040 0ustar torstenman#!/bin/sh ## ## GNU shtool -- The GNU Portable Shell Tool ## Copyright (c) 1994-2008 Ralf S. Engelschall ## ## See http://www.gnu.org/software/shtool/ for more information. ## See ftp://ftp.gnu.org/gnu/shtool/ for latest version. ## ## Version: 2.0.8 (18-Jul-2008) ## Contents: all available modules ## ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 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 General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## USA, or contact Ralf S. Engelschall . ## ## NOTICE: Given that you include this file verbatim into your own ## source tree, you are justified in saying that it remains separate ## from your package, and that this way you are simply just using GNU ## shtool. So, in this situation, there is no requirement that your ## package itself is licensed under the GNU General Public License in ## order to take advantage of GNU shtool. ## ## ## Usage: shtool [] [ [] []] ## ## Available commands: ## echo Print string with optional construct expansion ## mdate Pretty-print modification time of a file or dir ## table Pretty-print a field-separated list as a table ## prop Display progress with a running propeller ## move Move files with simultaneous substitution ## install Install a program, script or datafile ## mkdir Make one or more directories ## mkln Make link with calculation of relative paths ## mkshadow Make a shadow tree through symbolic links ## fixperm Fix file permissions inside a source tree ## rotate Logfile rotation ## tarball Roll distribution tarballs ## subst Apply sed(1) substitution operations ## platform Platform Identification Utility ## arx Extended archive command ## slo Separate linker options by library class ## scpp Sharing C Pre-Processor ## version Maintain a version information file ## path Deal with program paths ## # maximum Bourne-Shell compatibility if [ ".$ZSH_VERSION" != . ] && (emulate sh) >/dev/null 2>&1; then # reconfigure zsh(1) emulate sh NULLCMD=: alias -g '${1+"$@"}'='"$@"' elif [ ".$BASH_VERSION" != . ] && (set -o posix) >/dev/null 2>&1; then # reconfigure bash(1) set -o posix fi # maximum independence of NLS nuisances for var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $var=C; export $var) 2>&1`"); then eval $var=C; export $var else unset $var fi done # initial command line handling if [ $# -eq 0 ]; then echo "$0:Error: invalid command line" 1>&2 echo "$0:Hint: run \`$0 -h' for usage" 1>&2 exit 1 fi if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then echo "This is GNU shtool, version 2.0.8 (18-Jul-2008)" echo 'Copyright (c) 1994-2008 Ralf S. Engelschall ' echo 'Report bugs to ' echo '' echo 'Usage: shtool [] [ [] []]' echo '' echo 'Available global :' echo ' -v, --version display shtool version information' echo ' -h, --help display shtool usage help page (this one)' echo ' -d, --debug display shell trace information' echo ' -r, --recreate recreate this shtool script via shtoolize' echo '' echo 'Available [] []:' echo ' echo [-n|--newline] [-e|--expand] [ ...]' echo ' mdate [-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits]' echo ' [-f|--field-sep ] [-o|--order ] ' echo ' table [-F|--field-sep ] [-w|--width ] [-c|--columns' echo ' ] [-s|--strip ] ...' echo ' prop [-p|--prefix ]' echo ' move [-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve]' echo ' ' echo ' install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]' echo ' [-C|--compare-copy] [-s|--strip] [-m|--mode ]' echo ' [-o|--owner ] [-g|--group ] [-e|--exec' echo ' ] [ ...] ' echo ' mkdir [-t|--trace] [-f|--force] [-p|--parents] [-m|--mode' echo ' ] [-o|--owner ] [-g|--group ] ' echo ' [ ...]' echo ' mkln [-t|--trace] [-f|--force] [-s|--symbolic] ' echo ' [ ...] ' echo ' mkshadow [-v|--verbose] [-t|--trace] [-a|--all] ' echo ' fixperm [-v|--verbose] [-t|--trace] [ ...]' echo ' rotate [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files' echo ' ] [-s|--size ] [-c|--copy] [-r|--remove]' echo ' [-a|--archive-dir ] [-z|--compress [:]]' echo ' [-b|--background] [-d|--delay] [-p|--pad ] [-m|--mode' echo ' ] [-o|--owner ] [-g|--group ] [-M|--migrate' echo ' ] [-P|--prolog ] [-E|--epilog ] [...]' echo ' tarball [-t|--trace] [-v|--verbose] [-o|--output ]' echo ' [-c|--compress ] [-d|--directory ] [-u|--user' echo ' ] [-g|--group ] [-e|--exclude ]' echo ' [ ...]' echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning]' echo ' [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup' echo ' ] [-e|--exec ] [-f|--file ] []' echo ' [...]' echo ' platform [-F|--format ] [-S|--sep ] [-C|--conc' echo ' ] [-L|--lower] [-U|--upper] [-v|--verbose]' echo ' [-c|--concise] [-n|--no-newline] [-t|--type ]' echo ' [-V|--version] [-h|--help]' echo ' arx [-t|--trace] [-C|--command ] [' echo ' ...]' echo ' slo [-p|--prefix ] -- -L -l [-L -l' echo ' ...]' echo ' scpp [-v|--verbose] [-p|--preserve] [-f|--filter ]' echo ' [-o|--output ] [-t|--template ] [-M|--mark' echo ' ] [-D|--define ] [-C|--class ]' echo ' [ ...]' echo ' version [-l|--language ] [-n|--name ] [-p|--prefix' echo ' ] [-s|--set ] [-e|--edit] [-i|--increase' echo ' ] [-d|--display ] ' echo ' path [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename]' echo ' [-m|--magic] [-p|--path ] [ ...]' echo '' exit 0 fi if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then echo "GNU shtool 2.0.8 (18-Jul-2008)" exit 0 fi if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then shtoolize -oshtool all exit 0 fi if [ ".$1" = ".-d" ] || [ ".$1" = ".--debug" ]; then shift set -x fi name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'` case "$name" in echo|mdate|table|prop|move|install|mkdir|mkln|mkshadow|fixperm|rotate|tarball|subst|platform|arx|slo|scpp|version|path ) # implicit tool command selection tool="$name" ;; * ) # explicit tool command selection tool="$1" shift ;; esac arg_spec="" opt_spec="" gen_tmpfile=no ## ## DISPATCH INTO SCRIPT PROLOG ## case $tool in echo ) str_tool="echo" str_usage="[-n|--newline] [-e|--expand] [ ...]" arg_spec="0+" opt_spec="n.e." opt_alias="n:newline,e:expand" opt_n=no opt_e=no ;; mdate ) str_tool="mdate" str_usage="[-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits] [-f|--field-sep ] [-o|--order ] " arg_spec="1=" opt_spec="n.z.s.d.f:o:" opt_alias="n:newline,z:zero,s:shorten,d:digits,f:field-sep,o:order" opt_n=no opt_z=no opt_s=no opt_d=no opt_f=" " opt_o="dmy" ;; table ) str_tool="table" str_usage="[-F|--field-sep ] [-w|--width ] [-c|--columns ] [-s|--strip ] ..." arg_spec="1+" opt_spec="F:w:c:s:" opt_alias="F:field-sep,w:width,c:columns,s:strip" opt_F=":" opt_w=15 opt_c=3 opt_s=79 ;; prop ) str_tool="prop" str_usage="[-p|--prefix ]" arg_spec="0=" opt_spec="p:" opt_alias="p:prefix" opt_p="" ;; move ) str_tool="move" str_usage="[-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve] " arg_spec="2=" opt_spec="v.t.e.p." opt_alias="v:verbose,t:trace,e:expand,p:preserve" opt_v=no opt_t=no opt_e=no opt_p=no ;; install ) str_tool="install" str_usage="[-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode ] [-o|--owner ] [-g|--group ] [-e|--exec ] [ ...] " arg_spec="1+" opt_spec="v.t.d.c.C.s.m:o:g:e+" opt_alias="v:verbose,t:trace,d:mkdir,c:copy,C:compare-copy,s:strip,m:mode,o:owner,g:group,e:exec" opt_v=no opt_t=no opt_d=no opt_c=no opt_C=no opt_s=no opt_m="0755" opt_o="" opt_g="" opt_e="" ;; mkdir ) str_tool="mkdir" str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode ] [-o|--owner ] [-g|--group ] [ ...]" arg_spec="1+" opt_spec="t.f.p.m:o:g:" opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group" opt_t=no opt_f=no opt_p=no opt_m="" opt_o="" opt_g="" ;; mkln ) str_tool="mkln" str_usage="[-t|--trace] [-f|--force] [-s|--symbolic] [ ...] " arg_spec="2+" opt_spec="t.f.s." opt_alias="t:trace,f:force,s:symbolic" opt_t=no opt_f=no opt_s=no ;; mkshadow ) str_tool="mkshadow" str_usage="[-v|--verbose] [-t|--trace] [-a|--all] " arg_spec="2=" opt_spec="v.t.a." opt_alias="v:verbose,t:trace,a:all" opt_v=no opt_t=no opt_a=no ;; fixperm ) str_tool="fixperm" str_usage="[-v|--verbose] [-t|--trace] [ ...]" arg_spec="1+" opt_spec="v.t." opt_alias="v:verbose,t:trace" opt_v=no opt_t=no ;; rotate ) str_tool="rotate" str_usage="[-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files ] [-s|--size ] [-c|--copy] [-r|--remove] [-a|--archive-dir ] [-z|--compress [:]] [-b|--background] [-d|--delay] [-p|--pad ] [-m|--mode ] [-o|--owner ] [-g|--group ] [-M|--migrate ] [-P|--prolog ] [-E|--epilog ] [...]" arg_spec="1+" opt_spec="v.t.f.n:s:c.r.a:z:b.d.p:o:g:m:M:P:E:" opt_alias="v:verbose,t:trace,f:force,n:num-files,s:size,c:copy,r:remove,a:archive-dir,z:compress,b:background,d:delay,p:pad,o:owner,g:group,m:mode,M:migrate,P:prolog,E:epilog" opt_v=no opt_t=no opt_f=no opt_n=10 opt_s="" opt_c=no opt_r=no opt_a="" opt_z="" opt_b=no opt_d=no opt_p=1 opt_o="" opt_g="" opt_m="" opt_M="" opt_P="" opt_E="" ;; tarball ) str_tool="tarball" str_usage="[-t|--trace] [-v|--verbose] [-o|--output ] [-c|--compress ] [-d|--directory ] [-u|--user ] [-g|--group ] [-e|--exclude ] [ ...]" gen_tmpfile=yes arg_spec="1+" opt_spec="t.v.o:c:d:u:g:e:" opt_alias="t:trace,v:verbose,o:output,c:compress,d:directory,u:user,g:group,e:exclude" opt_t=no opt_v=no opt_o="" opt_c="" opt_d="" opt_u="" opt_g="" opt_e="CVS,\\.cvsignore,\\.svn,\\.[oa]\$" ;; subst ) str_tool="subst" str_usage="[-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ] [-e|--exec ] [-f|--file ] [] [...]" gen_tmpfile=yes arg_spec="0+" opt_spec="v.t.n.w.q.s.i.b:e+f:" opt_alias="v:verbose,t:trace,n:nop,w:warning,q:quiet,s:stealth,i:interactive,b:backup,e:exec,f:file" opt_v=no opt_t=no opt_n=no opt_w=no opt_q=no opt_s=no opt_i=no opt_b="" opt_e="" opt_f="" ;; platform ) str_tool="platform" str_usage="[-F|--format ] [-S|--sep ] [-C|--conc ] [-L|--lower] [-U|--upper] [-v|--verbose] [-c|--concise] [-n|--no-newline] [-t|--type ] [-V|--version] [-h|--help]" arg_spec="0=" opt_spec="F:S:C:L.U.v.c.n.t:d.V.h." opt_alias="F:format,S:sep,C:conc,L:lower,U:upper,v:verbose,c:consise,t:type,n:no-newline,V:version,h:help" opt_F="%{sp} (%{ap})" opt_S=" " opt_C="/" opt_L=no opt_U=no opt_t="" opt_v=no opt_c=no opt_n=no opt_V=no opt_h=no ;; arx ) str_tool="arx" str_usage="[-t|--trace] [-C|--command ] [ ...]" arg_spec="2+" opt_spec="t.C:" opt_alias="t:trace,C:command" opt_t=no opt_C="ar" ;; slo ) str_tool="slo" str_usage="[-p|--prefix ] -- -L -l [-L -l ...]" arg_spec="1+" opt_spec="p:" opt_alias="p:prefix" opt_p="SLO_" ;; scpp ) str_tool="scpp" str_usage="[-v|--verbose] [-p|--preserve] [-f|--filter ] [-o|--output ] [-t|--template ] [-M|--mark ] [-D|--define ] [-C|--class ] [ ...]" gen_tmpfile=yes arg_spec="1+" opt_spec="v.p.f+o:t:M:D:C:" opt_alias="v:verbose,p:preserve,f:filter,o:output,t:template,M:mark,D:define,C:class" opt_v=no opt_p=no opt_f="" opt_o="lib.h" opt_t="lib.h.in" opt_M="%%MARK%%" opt_D="cpp" opt_C="intern" ;; version ) str_tool="version" str_usage="[-l|--language ] [-n|--name ] [-p|--prefix ] [-s|--set ] [-e|--edit] [-i|--increase ] [-d|--display ] " arg_spec="1=" opt_spec="l:n:p:s:i:e.d:" opt_alias="l:language,n:name,p:prefix,s:set,e:edit,i:increase,d:display" opt_l="txt" opt_n="unknown" opt_p="" opt_s="" opt_e="no" opt_i="" opt_d="short" ;; path ) str_tool="path" str_usage="[-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path ] [ ...]" gen_tmpfile=yes arg_spec="1+" opt_spec="s.r.d.b.m.p:" opt_alias="s:suppress,r:reverse,d:dirname,b:basename,m:magic,p:path" opt_s=no opt_r=no opt_d=no opt_b=no opt_m=no opt_p="$PATH" ;; -* ) echo "$0:Error: unknown option \`$tool'" 2>&1 echo "$0:Hint: run \`$0 -h' for usage" 2>&1 exit 1 ;; * ) echo "$0:Error: unknown command \`$tool'" 2>&1 echo "$0:Hint: run \`$0 -h' for usage" 2>&1 exit 1 ;; esac ## ## COMMON UTILITY CODE ## # commonly used ASCII values ASC_TAB=" " ASC_NL=" " # determine name of tool if [ ".$tool" != . ]; then # used inside shtool script toolcmd="$0 $tool" toolcmdhelp="shtool $tool" msgprefix="shtool:$tool" else # used as standalone script toolcmd="$0" toolcmdhelp="sh $0" msgprefix="$str_tool" fi # parse argument specification string eval `echo $arg_spec |\ sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'` # parse option specification string eval `echo h.$opt_spec |\ sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'` # parse option alias string eval `echo h:help,$opt_alias |\ sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'` # interate over argument line opt_PREV='' while [ $# -gt 0 ]; do # special option stops processing if [ ".$1" = ".--" ]; then shift break fi # determine option and argument opt_ARG_OK=no if [ ".$opt_PREV" != . ]; then # merge previous seen option with argument opt_OPT="$opt_PREV" opt_ARG="$1" opt_ARG_OK=yes opt_PREV='' else # split argument into option and argument case "$1" in --[a-zA-Z0-9]*=*) eval `echo "x$1" |\ sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'` opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'` eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}" ;; --[a-zA-Z0-9]*) opt_OPT=`echo "x$1" | cut -c4-` opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'` eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}" opt_ARG='' ;; -[a-zA-Z0-9]*) eval `echo "x$1" |\ sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \ -e 's/";\(.*\)$/"; opt_ARG="\1"/'` ;; -[a-zA-Z0-9]) opt_OPT=`echo "x$1" | cut -c3-` opt_ARG='' ;; *) break ;; esac fi # eat up option shift # determine whether option needs an argument eval "opt_MODE=\$opt_MODE_${opt_OPT}" if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then opt_PREV="$opt_OPT" continue fi fi # process option case $opt_MODE in '.' ) # boolean option eval "opt_${opt_OPT}=yes" ;; ':' ) # option with argument (multiple occurances override) eval "opt_${opt_OPT}=\"\$opt_ARG\"" ;; '+' ) # option with argument (multiple occurances append) eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\"" ;; * ) echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2 echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2 exit 1 ;; esac done if [ ".$opt_PREV" != . ]; then echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2 echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2 exit 1 fi # process help option if [ ".$opt_h" = .yes ]; then echo "Usage: $toolcmdhelp $str_usage" exit 0 fi # complain about incorrect number of arguments case $arg_MODE in '=' ) if [ $# -ne $arg_NUMS ]; then echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2 echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 exit 1 fi ;; '+' ) if [ $# -lt $arg_NUMS ]; then echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2 echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 exit 1 fi ;; esac # establish a temporary file on request if [ ".$gen_tmpfile" = .yes ]; then # create (explicitly) secure temporary directory if [ ".$TMPDIR" != . ]; then tmpdir="$TMPDIR" elif [ ".$TEMPDIR" != . ]; then tmpdir="$TEMPDIR" else tmpdir="/tmp" fi tmpdir="$tmpdir/.shtool.$$" ( umask 077 rm -rf "$tmpdir" >/dev/null 2>&1 || true mkdir "$tmpdir" >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "$msgprefix:Error: failed to create temporary directory \`$tmpdir'" 1>&2 exit 1 fi ) # create (implicitly) secure temporary file tmpfile="$tmpdir/shtool.tmp" touch "$tmpfile" fi # utility function: map string to lower case util_lower () { echo "$1" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' } # utility function: map string to upper case util_upper () { echo "$1" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' } # cleanup procedure shtool_exit () { rc="$1" if [ ".$gen_tmpfile" = .yes ]; then rm -rf "$tmpdir" >/dev/null 2>&1 || true fi exit $rc } ## ## DISPATCH INTO SCRIPT BODY ## case $tool in echo ) ## ## echo -- Print string with optional construct expansion ## Copyright (c) 1998-2008 Ralf S. Engelschall ## text="$*" # check for broken escape sequence expansion seo='' bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'` if [ ".$bytes" != .3 ]; then bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'` if [ ".$bytes" = .3 ]; then seo='-E' fi fi # check for existing -n option (to suppress newline) minusn='' bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'` if [ ".$bytes" = .3 ]; then minusn='-n' fi # determine terminal bold sequence term_bold='' term_norm='' if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[Bb]'`" != . ]; then case $TERM in # for the most important terminal types we directly know the sequences xterm|xterm*|vt220|vt220*) term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' /dev/null` term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' /dev/null` ;; vt100|vt100*|cygwin) term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' /dev/null` term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' /dev/null` ;; # for all others, we try to use a possibly existing `tput' or `tcout' utility * ) paths=`echo $PATH | sed -e 's/:/ /g'` for tool in tput tcout; do for dir in $paths; do if [ -r "$dir/$tool" ]; then for seq in bold md smso; do # 'smso' is last bold="`$dir/$tool $seq 2>/dev/null`" if [ ".$bold" != . ]; then term_bold="$bold" break fi done if [ ".$term_bold" != . ]; then for seq in sgr0 me rmso init reset; do # 'reset' is last norm="`$dir/$tool $seq 2>/dev/null`" if [ ".$norm" != . ]; then term_norm="$norm" break fi done fi break fi done if [ ".$term_bold" != . ] && [ ".$term_norm" != . ]; then break; fi done ;; esac if [ ".$term_bold" = . ] || [ ".$term_norm" = . ]; then echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2 term_bold='' term_norm='' fi fi # determine user name username='' if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[uUgG]'`" != . ]; then username="`(id -un) 2>/dev/null`" if [ ".$username" = . ]; then str="`(id) 2>/dev/null`" if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then username=`echo $str | sed -e 's/^uid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'` fi if [ ".$username" = . ]; then username="$LOGNAME" if [ ".$username" = . ]; then username="$USER" if [ ".$username" = . ]; then username="`(whoami) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$username" = . ]; then username="`(who am i) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$username" = . ]; then username='unknown' fi fi fi fi fi fi fi # determine user id userid='' if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%U'`" != . ]; then userid="`(id -u) 2>/dev/null`" if [ ".$userid" = . ]; then userid="`(id -u ${username}) 2>/dev/null`" if [ ".$userid" = . ]; then str="`(id) 2>/dev/null`" if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*$//'` fi if [ ".$userid" = . ]; then userid=`(getent passwd ${username}) 2>/dev/null | \ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \ sed -e 'q' | sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid='?' fi fi fi fi fi fi fi fi # determine (primary) group id groupid='' if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[gG]'`" != . ]; then groupid="`(id -g ${username}) 2>/dev/null`" if [ ".$groupid" = . ]; then str="`(id) 2>/dev/null`" if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then groupid=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*//' -e 's/(.*$//'` fi if [ ".$groupid" = . ]; then groupid=`(getent passwd ${username}) 2>/dev/null | \ sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$groupid" = . ]; then groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \ sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$groupid" = . ]; then groupid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \ sed -e 'q' | sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$groupid" = . ]; then groupid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \ sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$groupid" = . ]; then groupid='?' fi fi fi fi fi fi fi # determine (primary) group name groupname='' if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%g'`" != . ]; then groupname="`(id -gn ${username}) 2>/dev/null`" if [ ".$groupname" = . ]; then str="`(id) 2>/dev/null`" if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then groupname=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'` fi if [ ".$groupname" = . ]; then groupname=`(getent group) 2>/dev/null | \ grep "^[^:]*:[^:]*:${groupid}:" | \ sed -e 's/:.*$//'` if [ ".$groupname" = . ]; then groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \ sed -e 's/:.*$//'` if [ ".$groupname" = . ]; then groupname=`(ypcat group; niscat group) 2>/dev/null | \ sed -e 'q' | grep "^[^:]*:[^:]*:${groupid}:" | \ sed -e 's/:.*$//'` if [ ".$groupname" = . ]; then groupname=`(nidump group .) 2>/dev/null | \ grep "^[^:]*:[^:]*:${groupid}:" | \ sed -e 's/:.*$//'` if [ ".$groupname" = . ]; then groupname='?' fi fi fi fi fi fi fi # determine host and domain name hostname='' domainname='' if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%h'`" != . ]; then hostname="`(uname -n) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$hostname" = . ]; then hostname="`(hostname) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$hostname" = . ]; then hostname='unknown' fi fi case $hostname in *.* ) domainname=".`echo $hostname | cut -d. -f2-`" hostname="`echo $hostname | cut -d. -f1`" ;; esac fi if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%d'`" != . ]; then if [ ".$domainname" = . ]; then if [ -f /etc/resolv.conf ]; then domainname="`grep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\ sed -e 's/.*domain//' \ -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ -e 's/^\.//' -e 's/^/./' |\ awk '{ printf("%s", $1); }'`" if [ ".$domainname" = . ]; then domainname="`grep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\ sed -e 's/.*search//' \ -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ -e 's/ .*//' -e 's/ .*//' \ -e 's/^\.//' -e 's/^/./' |\ awk '{ printf("%s", $1); }'`" fi fi fi fi # determine current time time_day='' time_month='' time_year='' time_monthname='' if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[DMYm]'`" != . ]; then time_day=`date '+%d'` time_month=`date '+%m'` time_year=`date '+%Y' 2>/dev/null` if [ ".$time_year" = . ]; then time_year=`date '+%y'` case $time_year in [5-9][0-9]) time_year="19$time_year" ;; [0-4][0-9]) time_year="20$time_year" ;; esac fi case $time_month in 1|01) time_monthname='Jan' ;; 2|02) time_monthname='Feb' ;; 3|03) time_monthname='Mar' ;; 4|04) time_monthname='Apr' ;; 5|05) time_monthname='May' ;; 6|06) time_monthname='Jun' ;; 7|07) time_monthname='Jul' ;; 8|08) time_monthname='Aug' ;; 9|09) time_monthname='Sep' ;; 10) time_monthname='Oct' ;; 11) time_monthname='Nov' ;; 12) time_monthname='Dec' ;; esac fi # expand special ``%x'' constructs if [ ".$opt_e" = .yes ]; then text=`echo $seo "$text" |\ sed -e "s/%B/${term_bold}/g" \ -e "s/%b/${term_norm}/g" \ -e "s/%u/${username}/g" \ -e "s/%U/${userid}/g" \ -e "s/%g/${groupname}/g" \ -e "s/%G/${groupid}/g" \ -e "s/%h/${hostname}/g" \ -e "s/%d/${domainname}/g" \ -e "s/%D/${time_day}/g" \ -e "s/%M/${time_month}/g" \ -e "s/%Y/${time_year}/g" \ -e "s/%m/${time_monthname}/g" 2>/dev/null` fi # create output if [ .$opt_n = .no ]; then echo $seo "$text" else # the harder part: echo -n is best, because # awk may complain about some \xx sequences. if [ ".$minusn" != . ]; then echo $seo $minusn "$text" else echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text" fi fi shtool_exit 0 ;; mdate ) ## ## mdate -- Pretty-print modification time of a file or dir ## Copyright (c) 1995-1997 Free Software Foundation, Inc. ## Copyright (c) 1998-2008 Ralf S. Engelschall ## fod="$1" case "$opt_o" in [dmy][dmy][dmy] ) ;; * ) echo "$msgprefix:Error: invalid argument to option \`-o': $opt_o" 1>&2 shtool_exit 1 ;; esac if [ ! -r "$fod" ]; then echo "$msgprefix:Error: file or directory not found: $fod" 1>&2 shtool_exit 1 fi # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume "unset" works, revert this # variable to its documented default. if [ ".$TIME_STYLE" != . ]; then TIME_STYLE=posix-long-iso export TIME_STYLE fi # get the extended ls output of the file or directory. if /bin/ls -L /dev/null >/dev/null 2>&1; then set - x`/bin/ls -L -l -d $fod` else set - x`/bin/ls -l -d $fod` fi # The month is at least the fourth argument # (3 shifts here, the next inside the loop). shift; shift; shift # Find the month. Next argument is day, followed by the year or time. month="" while [ ".$month" = . ]; do shift case $1 in Jan) month=January; nummonth=1 ;; Feb) month=February; nummonth=2 ;; Mar) month=March; nummonth=3 ;; Apr) month=April; nummonth=4 ;; May) month=May; nummonth=5 ;; Jun) month=June; nummonth=6 ;; Jul) month=July; nummonth=7 ;; Aug) month=August; nummonth=8 ;; Sep) month=September; nummonth=9 ;; Oct) month=October; nummonth=10 ;; Nov) month=November; nummonth=11 ;; Dec) month=December; nummonth=12 ;; esac done day="$2" year="$3" # We finally have to deal with the problem that the "ls" output # gives either the time of the day or the year. case $year in *:*) this_year=`date '+%Y' 2>/dev/null` if [ ".$this_year" = . ]; then this_year=`date '+%y'` case $this_year in [5-9][0-9]) this_year="19$this_year" ;; [0-4][0-9]) this_year="20$this_year" ;; esac fi # for the following months of the last year the time notation # is usually also used for files modified in the last year. this_month=`date '+%m'` if (expr $nummonth \> $this_month) >/dev/null; then this_year=`expr $this_year - 1` fi year="$this_year" ;; esac # Optionally fill day and month with leeding zeros if [ ".$opt_z" = .yes ]; then case $day in [0-9][0-9] ) ;; [0-9] ) day="0$day" ;; esac case $nummonth in [0-9][0-9] ) ;; [0-9] ) nummonth="0$nummonth" ;; esac fi # Optionally use digits for month if [ ".$opt_d" = .yes ]; then month="$nummonth" fi # Optionally shorten the month name to three characters if [ ".$opt_s" = .yes ]; then month=`echo $month | cut -c1-3` fi # Output the resulting date string echo dummy | awk '{ for (i = 0; i < 3; i++) { now = substr(order, 1, 1); order = substr(order, 2); if (now == "d") out = day; else if (now == "m") out = month; else if (now == "y") out = year; if (i < 2) printf("%s%s", out, field); else printf("%s", out); } if (newline != "yes") printf("\n"); }' "day=$day" "month=$month" "year=$year" \ "field=$opt_f" "order=$opt_o" "newline=$opt_n" shtool_exit 0 ;; table ) ## ## table -- Pretty-print a field-separated list as a table ## Copyright (c) 1998-2008 Ralf S. Engelschall ## if [ $opt_c -gt 4 ]; then echo "$msgprefix:Error: Invalid number of colums (1..4 allowed only)" 1>&2 shtool_exit 1 fi case "x$opt_F" in x? ) ;; * ) echo "$msgprefix:Error: Invalid separator (one char allowed only)" 1>&2; shtool_exit 1 ;; esac # split the list into a table list=` IFS="$opt_F" for entry in $*; do if [ ".$entry" != . ]; then echo "$entry" fi done |\ awk " BEGIN { list = \"\"; n = 0; } { list = list \\$1; n = n + 1; if (n < $opt_c) { list = list \":\"; } if (n == $opt_c) { list = list \"\\n\"; n = 0; } } END { print list; } " ` # format table cells and make sure table # doesn't exceed maximum width OIFS="$IFS" IFS=' ' for entry in $list; do case $opt_c in 1 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s\\n\", \$1); }'" ;; 2 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s\\n\", \$1, \$2); }'" ;; 3 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3); }'" ;; 4 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3, \$4); }'" ;; esac done |\ awk "{ if (length(\$0) > $opt_s) { printf(\"%s\\n\", substr(\$0, 0, $opt_s-1)); } else { print \$0; } }" IFS="$OIFS" shtool_exit 0 ;; prop ) ## ## prop -- Display progress with a running propeller ## Copyright (c) 1998-2008 Ralf S. Engelschall ## perl='' for dir in `echo $PATH | sed -e 's/:/ /g'` .; do if [ -f "$dir/perl" ]; then perl="$dir/perl" break fi done if [ ".$perl" != . ]; then # Perl is preferred because writing to STDERR in # Perl really writes immediately as one would expect $perl -e ' @p = ("|","/","-","\\"); $i = 0; while () { printf(STDERR "\r%s...%s\b", $ARGV[0], $p[$i++]); $i = 0 if ($i > 3); } printf(STDERR "\r%s \n", $ARGV[0]); ' "$opt_p" else # But if Perl doesn't exists we use Awk even # some Awk's buffer even the /dev/stderr writing :-( awk ' BEGIN { split("|#/#-#\\", p, "#"); i = 1; } { printf("\r%s%c\b", prefix, p[i++]) > "/dev/stderr"; if (i > 4) { i = 1; } } END { printf("\r%s \n", prefix) > "/dev/stderr"; } ' "prefix=$opt_p" fi shtool_exit 0 ;; move ) ## ## move -- Move files with simultaneous substitution ## Copyright (c) 1999-2008 Ralf S. Engelschall ## src="$1" dst="$2" # consistency checks if [ ".$src" = . ] || [ ".$dst" = . ]; then echo "$msgprefix:Error: Invalid arguments" 1>&2 shtool_exit 1 fi if [ ".$src" = ".$dst" ]; then echo "$msgprefix:Error: Source and destination files are the same" 1>&2 shtool_exit 1 fi expsrc="$src" if [ ".$opt_e" = .yes ]; then expsrc="`echo $expsrc`" fi if [ ".$opt_e" = .yes ]; then if [ ".`echo "$src" | sed -e 's;^.*\\*.*$;;'`" = ".$src" ]; then echo "$msgprefix:Error: Source doesn't contain wildcard ('*'): $dst" 1>&2 shtool_exit 1 fi if [ ".`echo "$dst" | sed -e 's;^.*%[1-9].*$;;'`" = ".$dst" ]; then echo "$msgprefix:Error: Destination doesn't contain substitution ('%N'): $dst" 1>&2 shtool_exit 1 fi if [ ".$expsrc" = ".$src" ]; then echo "$msgprefix:Error: Sources not found or no asterisk : $src" 1>&2 shtool_exit 1 fi else if [ ! -r "$src" ]; then echo "$msgprefix:Error: Source not found: $src" 1>&2 shtool_exit 1 fi fi # determine substitution patterns if [ ".$opt_e" = .yes ]; then srcpat=`echo "$src" | sed -e 's/\\./\\\\./g' -e 's/;/\\;/g' -e 's;\\*;\\\\(.*\\\\);g'` dstpat=`echo "$dst" | sed -e 's;%\([1-9]\);\\\\\1;g'` fi # iterate over source(s) for onesrc in $expsrc; do if [ .$opt_e = .yes ]; then onedst=`echo $onesrc | sed -e "s;$srcpat;$dstpat;"` else onedst="$dst" fi errorstatus=0 if [ ".$opt_v" = .yes ]; then echo "$onesrc -> $onedst" fi if [ ".$opt_p" = .yes ]; then if [ -r $onedst ]; then if cmp -s $onesrc $onedst; then if [ ".$opt_t" = .yes ]; then echo "rm -f $onesrc" 1>&2 fi rm -f $onesrc || errorstatus=$? else if [ ".$opt_t" = .yes ]; then echo "mv -f $onesrc $onedst" 1>&2 fi mv -f $onesrc $onedst || errorstatus=$? fi else if [ ".$opt_t" = .yes ]; then echo "mv -f $onesrc $onedst" 1>&2 fi mv -f $onesrc $onedst || errorstatus=$? fi else if [ ".$opt_t" = .yes ]; then echo "mv -f $onesrc $onedst" 1>&2 fi mv -f $onesrc $onedst || errorstatus=$? fi if [ $errorstatus -ne 0 ]; then break; fi done shtool_exit $errorstatus ;; install ) ## ## install -- Install a program, script or datafile ## Copyright (c) 1997-2008 Ralf S. Engelschall ## # special case: "shtool install -d [...]" internally # maps to "shtool mkdir -f -p -m 755 [...]" if [ "$opt_d" = yes ]; then cmd="$0 mkdir -f -p -m 755" if [ ".$opt_o" != . ]; then cmd="$cmd -o '$opt_o'" fi if [ ".$opt_g" != . ]; then cmd="$cmd -g '$opt_g'" fi if [ ".$opt_v" = .yes ]; then cmd="$cmd -v" fi if [ ".$opt_t" = .yes ]; then cmd="$cmd -t" fi for dir in "$@"; do eval "$cmd $dir" || shtool_exit $? done shtool_exit 0 fi # determine source(s) and destination argc=$# srcs="" while [ $# -gt 1 ]; do srcs="$srcs $1" shift done dstpath="$1" # type check for destination dstisdir=0 if [ -d $dstpath ]; then dstpath=`echo "$dstpath" | sed -e 's:/$::'` dstisdir=1 fi # consistency check for destination if [ $argc -gt 2 ] && [ $dstisdir = 0 ]; then echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2 shtool_exit 1 fi # iterate over all source(s) for src in $srcs; do dst=$dstpath # if destination is a directory, append the input filename if [ $dstisdir = 1 ]; then dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'` dst="$dst/$dstfile" fi # check for correct arguments if [ ".$src" = ".$dst" ]; then echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2 continue fi if [ -d "$src" ]; then echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2 continue fi # make a temp file name in the destination directory dsttmp=`echo $dst |\ sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \ -e "s;\$;/#INST@$$#;"` # verbosity if [ ".$opt_v" = .yes ]; then echo "$src -> $dst" 1>&2 fi # copy or move the file name to the temp name # (because we might be not allowed to change the source) if [ ".$opt_C" = .yes ]; then opt_c=yes fi if [ ".$opt_c" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "cp $src $dsttmp" 1>&2 fi cp "$src" "$dsttmp" || shtool_exit $? else if [ ".$opt_t" = .yes ]; then echo "mv $src $dsttmp" 1>&2 fi mv "$src" "$dsttmp" || shtool_exit $? fi # adjust the target file if [ ".$opt_e" != . ]; then sed='sed' OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS" for e do sed="$sed -e '$e'" done cp "$dsttmp" "$dsttmp.old" chmod u+w $dsttmp eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $? rm -f $dsttmp.old fi if [ ".$opt_s" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "strip $dsttmp" 1>&2 fi strip $dsttmp || shtool_exit $? fi if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o $dsttmp" 1>&2 fi chown $opt_o $dsttmp || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g $dsttmp" 1>&2 fi chgrp $opt_g $dsttmp || shtool_exit $? fi if [ ".$opt_m" != ".-" ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $dsttmp" 1>&2 fi chmod $opt_m $dsttmp || shtool_exit $? fi # determine whether to do a quick install # (has to be done _after_ the strip was already done) quick=no if [ ".$opt_C" = .yes ]; then if [ -r $dst ]; then if cmp -s "$src" "$dst"; then quick=yes fi fi fi # finally, install the file to the real destination if [ $quick = yes ]; then if [ ".$opt_t" = .yes ]; then echo "rm -f $dsttmp" 1>&2 fi rm -f $dsttmp else if [ ".$opt_t" = .yes ]; then echo "rm -f $dst && mv $dsttmp $dst" 1>&2 fi rm -f $dst && mv $dsttmp $dst fi done shtool_exit 0 ;; mkdir ) ## ## mkdir -- Make one or more directories ## Copyright (c) 1996-2008 Ralf S. Engelschall ## errstatus=0 for p in ${1+"$@"}; do # if the directory already exists... if [ -d "$p" ]; then if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then echo "$msgprefix:Error: directory already exists: $p" 1>&2 errstatus=1 break else continue fi fi # if the directory has to be created... if [ ".$opt_p" = .no ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $p" 1>&2 fi mkdir $p || errstatus=$? if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o $p" 1>&2 fi chown $opt_o $p || errstatus=$? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g $p" 1>&2 fi chgrp $opt_g $p || errstatus=$? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $p" 1>&2 fi chmod $opt_m $p || errstatus=$? fi else # the smart situation set fnord `echo ":$p" |\ sed -e 's/^:\//%/' \ -e 's/^://' \ -e 's/\// /g' \ -e 's/^%/\//'` shift pathcomp='' for d in ${1+"$@"}; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp="./$pathcomp" ;; esac if [ ! -d "$pathcomp" ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $pathcomp" 1>&2 fi mkdir $pathcomp || errstatus=$? if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o $pathcomp" 1>&2 fi chown $opt_o $pathcomp || errstatus=$? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g $pathcomp" 1>&2 fi chgrp $opt_g $pathcomp || errstatus=$? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $pathcomp" 1>&2 fi chmod $opt_m $pathcomp || errstatus=$? fi fi pathcomp="$pathcomp/" done fi done shtool_exit $errstatus ;; mkln ) ## ## mkln -- Make link with calculation of relative paths ## Copyright (c) 1998-2008 Ralf S. Engelschall ## # determine source(s) and destination args=$# srcs="" while [ $# -gt 1 ]; do srcs="$srcs $1" shift done dst="$1" if [ ! -d $dst ]; then if [ $args -gt 2 ]; then echo "$msgprefix:Error: multiple sources not allowed when target isn't a directory" 1>&2 shtool_exit 1 fi fi # determine link options lnopt="" if [ ".$opt_f" = .yes ]; then lnopt="$lnopt -f" fi if [ ".$opt_s" = .yes ]; then lnopt="$lnopt -s" fi # iterate over sources for src in $srcs; do # determine if one of the paths is an absolute path, # because then we _have_ to use an absolute symlink oneisabs=0 srcisabs=0 dstisabs=0 case $src in /* ) oneisabs=1; srcisabs=1 ;; esac case $dst in /* ) oneisabs=1; dstisabs=1 ;; esac # split source and destination into dir and base name if [ -d $src ]; then srcdir=`echo $src | sed -e 's;/*$;;'` srcbase="" else srcdir=`echo $src | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'` srcbase=`echo $src | sed -e 's;.*/\([^/]*\)$;\1;'` fi if [ -d $dst ]; then dstdir=`echo $dst | sed -e 's;/*$;;'` dstbase="" else dstdir=`echo $dst | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'` dstbase=`echo $dst | sed -e 's;.*/\([^/]*\)$;\1;'` fi # consistency check if [ ".$dstdir" != . ]; then if [ ! -d $dstdir ]; then echo "$msgprefix:Error: destination directory not found: $dstdir" 1>&2 shtool_exit 1 fi fi # make sure the source is reachable from the destination if [ $dstisabs = 1 ]; then if [ $srcisabs = 0 ]; then if [ ".$srcdir" = . ]; then srcdir="`pwd | sed -e 's;/*$;;'`" srcisabs=1 oneisabs=1 elif [ -d $srcdir ]; then srcdir="`cd $srcdir; pwd | sed -e 's;/*$;;'`" srcisabs=1 oneisabs=1 fi fi fi # split away a common prefix prefix="" if [ ".$srcdir" = ".$dstdir" ] && [ ".$srcdir" != . ]; then prefix="$srcdir/" srcdir="" dstdir="" else while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'` predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'` if [ ".$presrc" != ".$predst" ]; then break fi prefix="$prefix$presrc/" srcdir=`echo $srcdir | sed -e 's;^[^/]*/*;;'` dstdir=`echo $dstdir | sed -e 's;^[^/]*/*;;'` done fi # destination prefix is just the common prefix dstpre="$prefix" # determine source prefix which is the reverse directory # step-up corresponding to the destination directory srcpre="" allow_relative_srcpre=no if [ ".$prefix" != . ] && [ ".$prefix" != ./ ]; then allow_relative_srcpre=yes fi if [ $oneisabs = 0 ]; then allow_relative_srcpre=yes fi if [ ".$opt_s" != .yes ]; then allow_relative_srcpre=no fi if [ ".$allow_relative_srcpre" = .yes ]; then pl="$dstdir/" OIFS="$IFS"; IFS='/' for pe in $pl; do [ ".$pe" = . ] && continue [ ".$pe" = .. ] && continue srcpre="../$srcpre" done IFS="$OIFS" else if [ $srcisabs = 1 ]; then srcpre="$prefix" fi fi # determine destination symlink name if [ ".$dstbase" = . ]; then if [ ".$srcbase" != . ]; then dstbase="$srcbase" else dstbase=`echo "$prefix$srcdir" | sed -e 's;/*$;;' -e 's;.*/\([^/]*\)$;\1;'` fi fi # now finalize source and destination directory paths srcdir=`echo $srcdir | sed -e 's;\([^/]\)$;\1/;'` dstdir=`echo $dstdir | sed -e 's;\([^/]\)$;\1/;'` # run the final link command if [ ".$opt_t" = .yes ]; then echo "ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase" fi eval ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase done shtool_exit 0 ;; mkshadow ) ## ## mkshadow -- Make a shadow tree through symbolic links ## Copyright (c) 1998-2008 Ralf S. Engelschall ## # source and destination directory src=`echo "$1" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'` dst=`echo "$2" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'` # check whether source exists if [ ! -d $src ]; then echo "$msgprefix:Error: source directory not found: \`$src'" 1>&2 shtool_exit 1 fi # determine if one of the paths is an absolute path, # because then we have to use an absolute symlink oneisabs=0 case $src in /* ) oneisabs=1 ;; esac case $dst in /* ) oneisabs=1 ;; esac # determine reverse directory for destination directory dstrevdir='' if [ $oneisabs = 0 ]; then # derive reverse path from forward path pwd=`pwd` OIFS="$IFS"; IFS='/' for pe in $dst; do if [ "x$pe" = "x.." ]; then OIFS2="$IFS"; IFS="$DIFS" eval `echo "$pwd" |\ sed -e 's:\([^/]*\)$:; dir="\1":' \ -e 's:^\(.*\)/[^/]*;:pwd="\1";:'\ -e 's:^;:pwd="";:'` dstrevdir="$dir/$dstrevdir" IFS="$OIFS2" else dstrevdir="../$dstrevdir" fi done IFS="$OIFS" else src="`cd $src; pwd`"; fi # create directory tree at destination if [ ! -d $dst ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $dst" 1>&2 fi mkdir $dst fi if [ ".$opt_a" = .yes ]; then DIRS=`cd $src; find . -type d -print |\ sed -e '/^\.$/d' -e 's:^\./::'` else DIRS=`cd $src; find . -type d -print |\ sed -e '/\/CVS/d' -e '/^\.$/d' -e 's:^\./::'` fi for dir in $DIRS; do if [ ".$opt_t" = .yes ]; then echo "mkdir $dst/$dir" 1>&2 fi mkdir $dst/$dir done # fill directory tree with symlinks to files if [ ".$opt_a" = .yes ]; then FILES="`cd $src; find . -depth -print |\ sed -e 's/^\.\///'`" else FILES="`cd $src; find . -depth -print |\ sed -e '/\.o$/d' -e '/\.a$/d' -e '/\.so$/d' \ -e '/\.cvsignore$/d' -e '/\/CVS/d' \ -e '/\/\.#/d' -e '/\.orig$/d' \ -e 's/^\.\///'`" fi for file in $FILES; do # don't use `-type f' above for find because of symlinks if [ -d "$src/$file" ]; then continue fi basename=`echo $file | sed -e 's:^.*/::'` dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'` from=`echo "$src/$file" | sed -e 's/^\.\///'` to="$dst/$dir$basename" if [ $oneisabs = 0 ]; then if [ ".$dir" != . ]; then subdir=`echo $dir | sed -e 's:/$::'` # derive reverse path from forward path revdir='' OIFS="$IFS"; IFS='/' for pe in $subdir; do revdir="../$revdir" done IFS="$OIFS" # finalize from from="$revdir$from" fi from="$dstrevdir$from" fi if [ ".$opt_v" = .yes ]; then echo " $to" 1>&2 fi if [ ".$opt_t" = .yes ]; then echo "ln -s $from $to" 1>&2 fi ln -s $from $to done shtool_exit 0 ;; fixperm ) ## ## fixperm -- Fix file permissions inside a source tree ## Copyright (c) 1996-2008 Ralf S. Engelschall ## paths="$*" # check whether the test command supports the -x option if [ -x /bin/sh ] 2>/dev/null; then minusx="-x" else minusx="-r" fi # iterate over paths for p in $paths; do for file in `find $p -depth -print`; do if [ -f $file ]; then if [ $minusx $file ]; then if [ ".$opt_v" = .yes ]; then echo "-rwxr-xr-x $file" 2>&1 fi if [ ".$opt_t" = .yes ]; then echo "chmod 755 $file" 2>&1 fi chmod 755 $file else if [ ".$opt_v" = .yes ]; then echo "-rw-r--r-- $file" 2>&1 fi if [ ".$opt_t" = .yes ]; then echo "chmod 644 $file" 2>&1 fi chmod 644 $file fi continue fi if [ -d $file ]; then if [ ".$opt_v" = .yes ]; then echo "drwxr-xr-x $file" 2>&1 fi if [ ".$opt_t" = .yes ]; then echo "chmod 755 $file" 2>&1 fi chmod 755 $file continue fi if [ ".$opt_v" = .yes ]; then echo "?????????? $file" 2>&1 fi done done shtool_exit 0 ;; rotate ) ## ## rotate -- Logfile rotation ## Copyright (c) 2001-2008 Ralf S. Engelschall ## # make sure we have at least one file to rotate if [ ".$opt_n" = .0 ]; then echo "$msgprefix:Error: invalid argument \`$opt_n' to option -n." 1>&2 shtool_exit 1 fi # canonicalize -s option argument if [ ".$opt_s" != . ]; then if [ ".`expr $opt_s : '[0-9]*$'`" != .0 ]; then : elif [ ".`expr $opt_s : '[0-9]*[Kk]$'`" != .0 ]; then opt_s=`expr $opt_s : '\([0-9]*\)[Kk]$'` opt_s=`expr $opt_s \* 1024` elif [ ".`expr $opt_s : '[0-9]*[Mm]$'`" != .0 ]; then opt_s=`expr $opt_s : '\([0-9]*\)[Mm]$'` opt_s=`expr $opt_s \* 1048576` # 1024*1024 elif [ ".`expr $opt_s : '[0-9]*[Gg]$'`" != .0 ]; then opt_s=`expr $opt_s : '\([0-9]*\)[Gg]$'` opt_s=`expr $opt_s \* 1073741824` # 1024*1024*1024 else echo "$msgprefix:Error: invalid argument \`$opt_s' to option -s." 1>&2 shtool_exit 1 fi fi # option -d/-z consistency if [ ".$opt_d" = .yes ] && [ ".$opt_z" = . ]; then echo "$msgprefix:Error: option -d requires option -z." 1>&2 shtool_exit 1 fi # make sure target directory exists if [ ".$opt_a" != . ]; then if [ ! -d $opt_a ]; then if [ ".$opt_f" = .no ]; then echo "$msgprefix:Error: archive directory \`$opt_a' does not exist." 1>&2 shtool_exit 1 fi mkdir $opt_a || shtool_exit $? chmod 755 $opt_a fi if [ ! -w $opt_a ]; then echo "$msgprefix:Error: archive directory \`$opt_a' not writable." 1>&2 shtool_exit 1 fi fi # determine compression approach if [ ".$opt_z" != . ]; then comp_lvl="$opt_z" comp_prg="" case $comp_lvl in *:* ) eval `echo $comp_lvl |\ sed -e 's%^\(.*\):\(.*\)$%comp_prg="\1"; comp_lvl="\2"%'` ;; esac # compression level consistency case $comp_lvl in [0-9] ) ;; * ) echo "$msgprefix:Error: invalid compression level \`$comp_lvl'" 1>&2 shtool_exit 1 ;; esac # determine a suitable compression tool if [ ".$comp_prg" = . ]; then # check whether the test command supports the -x option if [ -x /bin/sh ] 2>/dev/null; then minusx="-x" else minusx="-r" fi # search for tools in $PATH paths="`echo $PATH |\ sed -e 's%/*:%:%g' -e 's%/*$%%' \ -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ -e 's/:/ /g'`" for prg in bzip2 gzip compress; do for path in $paths; do if [ $minusx "$path/$prg" ] && [ ! -d "$path/$prg" ]; then comp_prg="$prg" break fi done if [ ".$comp_prg" != . ]; then break fi done if [ ".$comp_prg" = . ]; then echo "$msgprefix:Error: no suitable compression tool found in \$PATH" 1>&2 shtool_exit 1 fi fi # determine standard compression extension # and make sure it is a known tool case $comp_prg in */bzip2 | bzip2 ) comp_ext="bz2" comp_lvl="-$comp_lvl" ;; */gzip | gzip ) comp_ext="gz" comp_lvl="-$comp_lvl" ;; */compress | compress ) comp_ext="Z"; comp_lvl="" ;; * ) echo "$msgprefix:Error: tool \`$comp_prg' is not a known compression tool" 1>&2 shtool_exit 1 ;; esac comp_suf=".$comp_ext" fi # iterate over all given logfile arguments for file in $*; do # make sure the logfile exists if [ ! -f $file ]; then if [ ".$opt_f" = .yes ]; then continue fi echo "$msgprefix:Error: logfile \`$file' not found" 1>&2 shtool_exit 1 fi # determine log directory (where original logfile is placed) ldir="." case $file in */* ) eval `echo $file | sed -e 's%^\(.*\)/\([^/]*\)$%ldir="\1"; file="\2";%'` ;; esac # determine archive directory (where rotated logfiles are placed) adir="$ldir" if [ ".$opt_a" != . ]; then case "$opt_a" in /* | ./* ) adir="$opt_a" ;; * ) adir="$ldir/$opt_a" ;; esac fi # optionally take logfile size into account if [ ".$opt_s" != . ]; then # determine size of logfile set -- `env -i /bin/ls -l "$ldir/$file" | sed -e "s;$ldir/$file;;" |\ sed -e 's; -> .*$;;' -e 's;[ ][ ]*; ;g'` n=`expr $# - 3` eval "size=\`echo \${$n}\`" # skip logfile if size is still too small if [ $size -lt $opt_s ]; then if [ ".$opt_v" = .yes ]; then echo "$ldir/$file: still too small in size -- skipping" fi continue fi fi # verbosity if [ ".$opt_v" = .yes ]; then echo "rotating $ldir/$file" fi # execute prolog if [ ".$opt_P" != . ]; then if [ ".$opt_t" = .yes ]; then echo "$opt_P" fi eval $opt_P [ $? -ne 0 ] && shtool_exit $? fi # kick away out-rotated logfile n=`expr $opt_n - 1` n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n` if [ -f "${adir}/${file}.${n}${comp_suf}" ]; then # optionally migrate away the out-rotated logfile if [ ".$opt_M" != . ]; then if [ ".$opt_t" = .yes ]; then echo "$opt_M ${adir}/${file}.${n}${comp_suf}" fi eval "$opt_M ${adir}/${file}.${n}${comp_suf}" [ $? -ne 0 ] && shtool_exit $? fi # finally get rid of the out-rotated logfile if [ ".$opt_t" = .yes ]; then echo "rm -f ${adir}/${file}.${n}${comp_suf}" fi rm -f ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi # rotate already archived logfiles while [ $n -gt 0 ]; do m=$n n=`expr $n - 1` n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n` if [ $n -eq 0 ] && [ ".$opt_d" = .yes ]; then # special case: first rotation file under delayed compression situation if [ ! -f "${adir}/${file}.${n}" ]; then continue fi # compress file (delayed) if [ ".$opt_b" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "mv ${adir}/${file}.${n} ${adir}/${file}.${m}" fi mv ${adir}/${file}.${n} ${adir}/${file}.${m} || shtool_exit $? if [ ".$opt_t" = .yes ]; then echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${m} >${adir}/${file}.${m}${comp_suf}; rm -f ${adir}/${file}.${m}) &" fi ( ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${m} \ >${adir}/${file}.${m}${comp_suf} || shtool_exit $? rm -f ${adir}/${file}.${m} || shtool_exit $? ) /dev/null 2>&1 & else if [ ".$opt_t" = .yes ]; then echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${m}${comp_suf}" fi ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${n} \ >${adir}/${file}.${m}${comp_suf} || shtool_exit $? if [ ".$opt_t" = .yes ]; then echo "rm -f ${adir}/${file}.${n}" fi rm -f ${adir}/${file}.${n} || shtool_exit $? fi # fix file attributes if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o ${adir}/${file}.${m}${comp_suf}" fi chown $opt_o ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g ${adir}/${file}.${m}${comp_suf}" fi chgrp $opt_g ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m ${adir}/${file}.${m}${comp_suf}" fi chmod $opt_m ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi else # standard case: second and following rotation file if [ ! -f "${adir}/${file}.${n}${comp_suf}" ]; then continue fi if [ ".$opt_t" = .yes ]; then echo "mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf}" fi mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi done # move away current logfile if [ ".$opt_c" = .yes ]; then # approach: copy[+truncate] if [ ".$opt_t" = .yes ]; then echo "cp -p ${ldir}/${file} ${adir}/${file}.${n}" fi cp -p ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $? if [ ".$opt_r" = .no ]; then if [ ".$opt_t" = .yes ]; then echo "cp /dev/null ${ldir}/${file}" fi cp /dev/null ${ldir}/${file} || shtool_exit $? fi else # approach: move[+touch] if [ ".$opt_t" = .yes ]; then echo "mv ${ldir}/${file} ${adir}/${file}.${n}" fi mv ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $? if [ ".$opt_r" = .no ]; then if [ ".$opt_t" = .yes ]; then echo "touch ${ldir}/${file}" fi touch ${ldir}/${file} || shtool_exit $? # fix file attributes if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o ${ldir}/${file}" fi chown $opt_o ${ldir}/${file} || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g ${ldir}/${file}" fi chgrp $opt_g ${ldir}/${file} || shtool_exit $? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m ${ldir}/${file}" fi chmod $opt_m ${ldir}/${file} || shtool_exit $? fi fi fi # regular compression step if [ ".$opt_z" != . ] && [ ".$opt_d" = .no ]; then # compress file if [ ".$opt_b" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}; rm -f ${adir}/${file}.${n}) &" fi ( ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${n} \ >${adir}/${file}.${n}${comp_suf} || shtool_exit $? rm -f ${adir}/${file}.${n} || shtool_exit $? ) /dev/null 2>&1 & else if [ ".$opt_t" = .yes ]; then echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}" fi ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${n} \ >${adir}/${file}.${n}${comp_suf} || shtool_exit $? if [ ".$opt_t" = .yes ]; then echo "rm -f ${opt_a}${file}.${n}" fi rm -f ${adir}/${file}.${n} || shtool_exit $? fi # fix file attributes if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o ${adir}/${file}.${n}${comp_suf}" fi chown $opt_o ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g ${adir}/${file}.${n}${comp_suf}" fi chgrp $opt_g ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m ${adir}/${file}.${n}${comp_suf}" fi chmod $opt_m ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi fi # execute epilog if [ ".$opt_E" != . ]; then if [ ".$opt_t" = .yes ]; then echo "$opt_E" fi eval $opt_E [ $? -ne 0 ] && shtool_exit $? fi done shtool_exit 0 ;; tarball ) ## ## tarball -- Roll distribution tarballs ## Copyright (c) 1999-2008 Ralf S. Engelschall ## srcs="$*" # check whether the test command supports the -x option if [ -x /bin/sh ] 2>/dev/null; then minusx="-x" else minusx="-r" fi # find the tools paths="`echo $PATH |\ sed -e 's%/*:%:%g' -e 's%/*$%%' \ -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ -e 's/:/ /g'`" for spec in find:gfind,find tar:gtar,tar tardy:tardy,tarcust; do prg=`echo $spec | sed -e 's/:.*$//'` tools=`echo $spec | sed -e 's/^.*://'` eval "prg_${prg}=''" # iterate over tools for tool in `echo $tools | sed -e 's/,/ /g'`; do # iterate over paths for path in $paths; do if [ $minusx "$path/$tool" ] && [ ! -d "$path/$tool" ]; then eval "prg_${prg}=\"$path/$tool\"" break fi done eval "val=\$prg_${prg}" if [ ".$val" != . ]; then break fi done done # expand source paths exclude='' for pat in `echo $opt_e | sed 's/,/ /g'`; do exclude="$exclude | grep -v '$pat'" done if [ ".$opt_t" = .yes ]; then echo "cp /dev/null $tmpfile.lst" 1>&2 fi cp /dev/null $tmpfile.lst for src in $srcs; do if [ -d $src ]; then if [ ".$opt_t" = .yes ]; then echo "(cd $src && $prg_find . -type f -depth -print) | sed -e 's:^\\.\$::' -e 's:^\\./::' | cat $exclude >>$tmpfile.lst" 1>&2 fi (cd $src && $prg_find . -type f -depth -print) |\ sed -e 's:^\.$::' -e 's:^\./::' | eval cat $exclude >>$tmpfile.lst else if [ ".$opt_t" = .yes ]; then echo "echo $src >>$tmpfile.lst" 1>&2 fi echo $src >>$tmpfile.lst fi done sort <$tmpfile.lst >$tmpfile.lst.n mv $tmpfile.lst.n $tmpfile.lst if [ ".$opt_v" = .yes ]; then cat $tmpfile.lst | sed -e 's/^/ /' 1>&2 fi # determine tarball file and directory name if [ ".$opt_o" != . ]; then tarfile="$opt_o" if [ ".$opt_d" != . ]; then tarname="$opt_d" else tarname=`echo $tarfile | sed -e 's/\.tar.*$//' -e 's;.*/\([^/]*\)$;\1;'` fi else if [ ".$opt_d" != . ]; then tarname="$opt_d" elif [ -d "$from" ]; then tarname=`echo $from | sed -e 's;.*/\([^/]*\)$;\1;'` else tarname="out" fi tarfile="$tarname.tar" fi # roll the tarball compress='' if [ ".$opt_c" != . ]; then compress="| $opt_c" fi if [ ".$prg_tardy" != . ]; then # the elegant hackers way tardy_opt="--prefix=$tarname" tardy_opt="$tardy_opt --user_number=0 --group_number=0" # security! if [ ".$opt_u" != . ]; then tardy_opt="$tardy_opt --user_name=$opt_u" fi if [ ".$opt_g" != . ]; then tardy_opt="$tardy_opt --group_name=$opt_g" fi if [ ".$opt_t" = .yes ]; then echo "cat $tmpfile.lst | xargs $prg_tar cf - | $prg_tardy $tardy_opt | cat $compress >$tmpfile.out" 1>&2 fi cat $tmpfile.lst |\ xargs $prg_tar cf - |\ $prg_tardy $tardy_opt |\ eval cat $compress >$tmpfile.out if [ ".$opt_t" = .yes ]; then echo "cp $tmpfile.out $tarfile" 1>&2 fi cp $tmpfile.out $tarfile else # the portable standard way if [ ".$opt_t" = .yes ]; then echo "mkdir $tmpdir/$tarname" 1>&2 fi mkdir $tmpdir/$tarname || shtool_exit 1 if [ ".$opt_t" = .yes ]; then echo "cat $tmpfile.lst | xargs $prg_tar cf - | (cd $tmpdir/$tarname && $prg_tar xf -)" 1>&2 fi cat $tmpfile.lst |\ xargs $prg_tar cf - |\ (cd $tmpdir/$tarname && $prg_tar xf -) if [ ".$opt_u" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1" 2>&1 fi chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1 ||\ echo "$msgprefix:Warning: cannot set user name \`$opt_u' (would require root privileges)" fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1" 2>&1 fi chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1 ||\ echo "$msgprefix:Warning: cannot set group name \`$opt_g' (would require root privileges)" fi if [ ".$opt_t" = .yes ]; then echo "(cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) | cat $compress >$tmpfile.out" 1>&2 fi (cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) |\ eval cat $compress >$tmpfile.out if [ ".$opt_t" = .yes ]; then echo "cp $tmpfile.out $tarfile" 1>&2 fi cp $tmpfile.out $tarfile if [ ".$opt_t" = .yes ]; then echo "rm -rf $tmpdir/$tarname" 1>&2 fi rm -rf $tmpdir/$tarname fi # cleanup if [ ".$opt_t" = .yes ]; then echo "rm -f $tmpfile.lst $tmpfile.out" 1>&2 fi rm -f $tmpfile.lst $tmpfile.out shtool_exit 0 ;; subst ) ## ## subst -- Apply sed(1) substitution operations ## Copyright (c) 2001-2008 Ralf S. Engelschall ## # remember optional list of file(s) files="$*" files_num="$#" # parameter consistency check if [ $# -eq 0 ] && [ ".$opt_b" != . ]; then echo "$msgprefix:Error: option -b cannot be applied to stdin" 1>&2 shtool_exit 1 fi if [ $# -eq 0 ] && [ ".$opt_s" = .yes ]; then echo "$msgprefix:Error: option -s cannot be applied to stdin" 1>&2 shtool_exit 1 fi # build underlying sed(1) command sedcmd='sed' if [ ".$opt_e" != . ]; then OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS" for e do sedcmd="$sedcmd -e '$e'" done elif [ ".$opt_f" != . ]; then if [ ! -f $opt_f ]; then echo "$msgprefix:Error: command file \`$opt_f' not found or not a regular file" 1>&2 shtool_exit 1 fi sedcmd="$sedcmd -f '$opt_f'" else echo "$msgprefix:Error: either -e option(s) or -f option required" 1>&2 shtool_exit 1 fi # determine extension for original file orig=".orig" if [ ".$opt_b" != . ]; then orig="$opt_b" fi # apply sed(1) operation(s) if [ ".$files" != . ]; then # apply operation(s) to files substdone=no for file in $files; do test ".$file" = . && continue if [ ! -f $file ]; then echo "$msgprefix:Warning: file \`$file' not found or not a regular file" 1>&2 continue fi # handle interactive mode if [ ".$opt_i" = .yes ]; then eval "$sedcmd <$file >$file.new" skip=no if cmp $file $file.new >/dev/null 2>&1; then rm -f $file.new skip=yes else (diff -U1 $file $file.new >$tmpfile) 2>/dev/null if [ ".`cat $tmpfile`" = . ]; then (diff -C1 $file $file.new >$tmpfile) 2>/dev/null if [ ".`cat $tmpfile`" = . ]; then echo "$msgprefix:Warning: unable to show difference for file \`$file'" 1>&2 cp /dev/null $tmpfile fi fi rm -f $file.new cat $tmpfile echo dummy | awk '{ printf("%s", TEXT); }' TEXT=">>> Apply [Y/n]: " read input if [ ".$input" != .Y ] &&\ [ ".$input" != .y ] &&\ [ ".$input" != . ]; then skip=yes fi fi if [ ".$skip" = .yes ]; then if [ ".$opt_v" = .yes ]; then echo "file \`$file' -- skipped" 1>&2 fi continue fi fi # apply sed(1) operation(s) if [ ".$opt_v" = .yes ]; then echo "patching \`$file'" 1>&2 fi if [ ".$opt_t" = .yes ]; then echo "\$ cp -p $file $file$orig" echo "\$ chmod u+w $file" echo "\$ $sedcmd <$file$orig >$file" fi if [ ".$opt_n" = .no ]; then cp -p $file $file$orig chmod u+w $file >/dev/null 2>&1 || true eval "$sedcmd <$file$orig >$file" fi # optionally fix timestamp if [ ".$opt_s" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "\$ touch -r $file$orig $file" fi if [ ".$opt_n" = .no ]; then touch -r $file$orig $file fi fi # optionally check whether any content change actually occurred if [ ".$opt_q" = .no ]; then if cmp $file$orig $file >/dev/null 2>&1; then if [ ".$opt_w" = .yes ]; then echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2 fi else substdone=yes fi fi # optionally remove preserved original file if [ ".$opt_b" = . ]; then if [ ".$opt_t" = .yes ]; then echo "\$ rm -f $file$orig" fi if [ ".$opt_n" = .no ]; then rm -f $file$orig fi fi done if [ ".$opt_q" = .no ] && [ ".$opt_w" = .no ]; then if [ ".$substdone" = .no ]; then if [ ".$files_num" = .1 ]; then echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2 else echo "$msgprefix:Warning: substitution resulted in no content change on any file" 1>&2 fi fi fi else # apply operation(s) to stdin/stdout if [ ".$opt_v" = .yes ]; then echo "patching " 1>&2 fi if [ ".$opt_t" = .yes ]; then echo "\$ $sedcmd" fi if [ ".$opt_n" = .no ]; then eval "$sedcmd" fi fi shtool_exit 0 ;; platform ) ## ## platform -- Platform Identification Utility ## Copyright (c) 2003-2008 Ralf S. Engelschall ## # option post-processing if [ ".$opt_t" != . ]; then case "$opt_t" in binary ) # binary package id (OpenPKG RPM) opt_F="%-%" opt_L=yes opt_S="" opt_C="+" ;; build ) # build time checking (OpenPKG RPM) opt_F="%-%" opt_L=yes opt_S="" opt_C="+" ;; gnu ) # GNU config.guess style -- opt_F="%-unknown-%" opt_L=yes opt_S="" opt_C="+" ;; web ) # non-whitespace HTTP Server-header id opt_F="%-%" opt_S="/" opt_C="+" ;; summary) # human readable verbose summary information opt_F="Class: %[sc] (%[ac])\\nProduct: %[sp] (%[ap])\\nTechnology: %[st] (%[at])" opt_S=" " opt_C="/" ;; all-in-one ) # full-table all-in-one information opt_F="" opt_F="${opt_F}concise architecture class: %\\n" opt_F="${opt_F}regular architecture class: %{ac}\\n" opt_F="${opt_F}verbose architecture class: %[ac]\\n" opt_F="${opt_F}concise architecture product: %\\n" opt_F="${opt_F}regular architecture product: %{ap}\\n" opt_F="${opt_F}verbose architecture product: %[ap]\\n" opt_F="${opt_F}concise architecture technology: %\\n" opt_F="${opt_F}regular architecture technology: %{at}\\n" opt_F="${opt_F}verbose architecture technology: %[at]\\n" opt_F="${opt_F}concise system class: %\\n" opt_F="${opt_F}regular system class: %{sc}\\n" opt_F="${opt_F}verbose system class: %[sc]\\n" opt_F="${opt_F}concise system product: %\\n" opt_F="${opt_F}regular system product: %{sp}\\n" opt_F="${opt_F}verbose system product: %[sp]\\n" opt_F="${opt_F}concise system technology: %\\n" opt_F="${opt_F}regular system technology: %{st}\\n" opt_F="${opt_F}verbose system technology: %[st]" ;; * ) echo "$msgprefix:Error: invalid type \`$opt_t'" 1>&2 exit 1 ;; esac fi # assemble initial platform information UNAME_MACHINE=`(uname -m) 2>/dev/null` ||\ UNAME_MACHINE=`(uname -p) 2>/dev/null` ||\ UNAME_MACHINE='unknown' UNAME_SYSTEM=`(uname -s) 2>/dev/null` ||\ UNAME_SYSTEM='unknown' UNAME_RELEASE=`(uname -r) 2>/dev/null` ||\ UNAME_RELEASE=`(uname -v) 2>/dev/null` ||\ UNAME_RELEASE='unknown' UNAME="${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}" AC=""; AP=""; AT="" SC=""; SP=""; ST="" # dispatch into platform specific sections case "${UNAME}" in # FreeBSD *:FreeBSD:* ) # determine architecture AC="${UNAME_MACHINE}" case "${AC}" in i386 ) AC="iX86" ;; esac AP="${AC}" AT="${AP}" if [ ".${AT}" = ".iX86" ]; then case "`(/sbin/sysctl -n hw.model) 2>&1`" in *"Xeon"* | *"Pentium Pro"* | *"Cyrix 6x86MX"* | *"Pentium II"* | *"Pentium III"* | *"Pentium 4"* | *"Celeron"* ) AT="i686" ;; *"Pentium"* ) AT="i586" ;; *"i486[SD]X"* | *"Cyrix 486"* | *"Cyrix [56]x86"* | *"Blue Lightning" | *"Cyrix 486S/DX" ) AT="i486" ;; *"i386[SD]X"* | *"NexGen 586"* ) AT="i386" ;; esac fi # determine system r=`echo "${UNAME_RELEASE}" |\ sed -e 's;[()];;' -e 's/\(-.*\)$/[\1]/'` ST="FreeBSD ${r}" SP="${ST}" case "${r}" in 1.* ) SC="4.3BSD" ;; * ) SC="4.4BSD" ;; esac ;; # NetBSD *:NetBSD:* ) # determine architecture AT="${UNAME_MACHINE}" AP="${AT}" case "${AP}" in i[3-6]86 ) AP="iX86" ;; esac AC="${AP}" # determine system r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'` ST="NetBSD ${r}" SP="${ST}" case "${r}" in 0.* ) SC="4.3BSD" ;; * ) SC="4.4BSD" ;; esac ;; # OpenBSD *:OpenBSD:* ) # determine architecture AT="${UNAME_MACHINE}" AP="${AT}" case "${AP}" in i[3-6]86 ) AP="iX86" ;; esac AC="${AP}" # determine system r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'` ST="OpenBSD ${r}" SP="${ST}" SC="4.4BSD" ;; # DragonFly BSD *:DragonFly:* ) # determine architecture AT="${UNAME_MACHINE}" AP="${AT}" case "${AP}" in i[3-6]86 ) AP="iX86" ;; esac AC="${AP}" # determine system r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'` ST="DragonFly ${r}" SP="${ST}" SC="4.4BSD" ;; # GNU/Linux *:Linux:* ) # determine architecture AT="${UNAME_MACHINE}" case "${AT}" in ia64 ) AT="IA64" ;; x86_64 ) AT='AMD64' ;; parisc ) AT="HPPA32" ;; parisc64 ) AT="HPPA64" ;; esac AP="${AT}" case "${AP}" in i[3-6]86 ) AP='iX86' ;; esac AC="${AP}" # determine system v_kern=`echo "${UNAME_RELEASE}" |\ sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'` v_libc=`(strings /lib/libc.so.* | grep '^GLIBC_' | sed -e 's/^GLIBC_//' |\ env -i sort -n | sed -n -e '$p' | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') 2>/dev/null` ST="GNU/${v_libc}/<${v_kern}>" if [ -f /etc/lsb-release ]; then eval `( . /etc/lsb-release echo "SC=\"LSB${LSB_VERSION}\"" if [ ".${DISTRIB_ID}" != . -a ".${DISTRIB_RELEASE}" != . ]; then echo "SP=\"${DISTRIB_ID} ${DISTRIB_RELEASE}\"" fi ) 2>/dev/null` fi if [ ".$SP" = . ]; then for tagfile in x \ `cd /etc && \ /bin/ls *[_-]release *[_-]version 2>/dev/null | env -i sort | \ sed -e '/^redhat-release$/d' -e '/^lsb-release$/d'; \ echo redhat-release lsb-release` do [ ".${tagfile}" = .x ] && continue [ ! -f "/etc/${tagfile}" ] && continue n=`echo ${tagfile} | sed -e 's/[_-]release$//' -e 's/[_-]version$//'` v=`(grep VERSION /etc/${tagfile}; cat /etc/${tagfile}) | grep '[0-9]' | sed -e 'q' |\ sed -e 's/^/#/' \ -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \ -e 's/^#.*$//'` case "`util_lower ${n}`" in redhat ) if [ ".`egrep '(Red Hat Enterprise Linux|CentOS)' /etc/${tagfile}`" != . ]; then n="ed at nterprise inux" else n="ed at inux" fi ;; debian ) n="Debian[ GNU/Linux]" ;; ubuntu ) n="Ubuntu[ GNU/Linux]" ;; fedora ) n=" Core[ GNU/Linux]" ;; suse ) n="[Novell ]SUSE[ Linux]" ;; mandrake*|mandriva ) n="Mandriva[ Linux]" ;; gentoo ) n="Gentoo[ GNU/Linux]" ;; slackware ) n="Slackware[ Linux]" ;; turbolinux ) n="TurboLinux" ;; unitedlinux ) n="UnitedLinux" ;; * ) n="${n}[ GNU/Linux]" ;; esac case "$n" in *"<"*">"* ) SP="$n <$v>" ;; * ) SP="$n $v" ;; esac break done fi [ ".$SP" = . ] && SP="${ST}" [ ".$SC" = . ] && SC="LSB" ;; # Sun Solaris *:SunOS:* ) # determine architecture AT="${UNAME_MACHINE}" case "${AT}" in i86pc ) AT="iX86" case "`(/bin/isainfo -k) 2>&1`" in amd64 ) AT="AMD64" ;; esac ;; esac AP="${AT}" case "${AP}" in sun4[cdm] ) AP="SPARC32" ;; sun4[uv] ) AP="SPARC64" ;; sun4* ) AP="SPARC" ;; esac AC="${AP}" case "${AC}" in SPARC* ) AC="SPARC" ;; esac # determine system ST="[Sun ]SunOS ${UNAME_RELEASE}" v=`echo "${UNAME_RELEASE}" |\ sed -e 's;^4\.;1.;' \ -e 's;^5\.\([0-6]\)[^0-9]*$;2.\1;' \ -e 's;^5\.\([0-9][0-9]*\).*;\1;'` SP="[Sun ]Solaris $v" case "${UNAME_RELEASE}" in 4.* ) SC="4.3BSD" ;; 5.* ) SC="SVR4" ;; esac ;; # SCO UnixWare *:UnixWare:* ) # determine architecture AT="${UNAME_MACHINE}" case "${AT}" in i[3-6]86 | ix86at ) AT="iX86" ;; esac AP="${AT}" # determine system v=`/sbin/uname -v` ST="[SCO ]UnixWare ${v}" SP="${ST}" SC="SVR${UNAME_RELEASE}" ;; # QNX *:QNX:* ) # determine architecture AT="${UNAME_MACHINE}" case "${AT}" in x86pc ) AT="iX86" ;; esac AP="${AT}" # determine system v="${UNAME_RELEASE}" ST="QNX[ Neutrino RTOS] ${v}" v=`echo "${v}" | sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;'` SP="QNX[ Neutrino RTOS] ${v}" SC="QNX" ;; # SGI IRIX *:IRIX*:* ) # determine architecture AT="${UNAME_MACHINE}" AP="${AT}" case "${AP}:${UNAME_SYSTEM}" in IP*:IRIX64 ) AP="MIPS64" ;; IP*:* ) AP="MIPS" ;; esac AC="${AP}" # determine system v=`(/bin/uname -R || /bin/uname -r) 2>/dev/null | sed -e 's;[0-9.]* ;;'` ST="[SGI ]IRIX ${v}" v="${UNAME_RELEASE}" SP="[SGI ]IRIX ${v}" SC="4.2BSD/SVR3" ;; # HP HP-UX *:HP-UX:* ) # determine architecture AT="${UNAME_MACHINE}" case "${AT}" in ia64 ) AT="IA64" ;; 9000/[34]?? ) AT=M68K ;; 9000/[678][0-9][0-9]) sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523 ) AT="HPPA1.0" ;; 528 ) AT="HPPA1.1" ;; 532 ) AT="HPPA2.0" case "${sc_kernel_bits}" in 32 ) AT="${AT}n" ;; 64 ) AT="${AT}w" ;; esac ;; esac ;; esac AP="${AT}" case "${AP}" in HPPA* ) AP="HPPA" ;; esac AC="${AP}" # determine system v=`echo "${UNAME_RELEASE}" | sed -e 's;^[^0-9]*;;'` ST="[HP ]-" SP="${ST}" case "${v}" in 10.* ) SC="SVR4.2" ;; [7-9]* ) SC="SVR4" ;; esac ;; # HP Tru64 (OSF1) *:OSF1:* ) # determine architecture AP="${UNAME_MACHINE}" case "${AP}" in alpha ) AP="Alpha" ;; esac alpha_type=`(/usr/sbin/psrinfo -v) 2>/dev/null |\ sed -n -e 's/^.*The alpha \([^ ][^ ]*\).*processor.*$/\1/p' | sed -e 'q'` AT="${AP}${alpha_type}" AC="${AP}" # determine system v=`echo "${UNAME_RELEASE}" | sed -e 's;^[VTX];;'` ST="[HP ]Tru64 ${v}" SP="${ST}" SC="OSF1" ;; # IBM AIX *:AIX:* ) # determine architecture cpu_arch=RS6000 if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then cpu_id=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if [ ".`/usr/sbin/lsattr -El ${cpu_id} | grep -i powerpc`" != . ]; then cpu_arch=PPC fi elif [ -d /QOpenSys ]; then # IBM i5/OS (aka OS/400) with PASE (Portable Application Solutions Environment) cpu_arch=PPC fi if [ -x /usr/bin/oslevel ]; then os_level=`/usr/bin/oslevel` else os_level="`uname -v`.`uname -r`" fi os_level=`echo "${os_level}" |\ sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(\.[0-9][0-9]*\)\(.*\)$;<\1>\2[\3];' \ -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(.*\)$;<\1>\2;'` AT="${cpu_arch}" AP="${AT}" AC="${AP}" # determine system ST="[IBM ]${os_level}" SP="${ST}" case "${os_level}" in [12]* ) SC="SVR2" ;; * ) SC="SVR4" ;; esac ;; # Apple Mac OS X (Darwin) *:Darwin:* ) # determine architecture AT="`uname -p`" case "${AT}" in powerpc ) AT="PPC" ;; esac AP="${AT}" case "${AP}" in i?86 ) AP="iX86" ;; esac AC="${AP}" # determine system unset v1; unset v2; unset v3 eval `echo "${UNAME_RELEASE}" |\ sed -e 's/^/#/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \ -e 's/^#.*$/v1="0"/'` ST="[Apple ]<${UNAME_SYSTEM} ${v1}>${v2+.$v2}${v3+[.$v3]}" SP="$ST" v="`(sw_vers) 2>/dev/null | grep 'ProductVersion:' | sed -e 's/^ProductVersion:[^0-9]*\([0-9][0-9.]*\).*$/\1/'`" if [ ".$v" = . ]; then for name in System Server; do if [ -f /System/Library/CoreServices/${name}Version.plist ]; then v=`(defaults read "/System/Library/CoreServices/${name}Version" "ProductVersion") 2>/dev/null` [ ".$v" != . ] && break fi done fi if [ ".$v" != . ]; then unset v1; unset v2; unset v3 eval `echo "${v}" |\ sed -e 's/^/#/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \ -e 's/^#.*$/v1="0"/'` SP="[Apple ]Mac OS X ${v1}${v2+.$v2}${v3+[.$v3]}" fi SC="4.4BSD/Mach3.0" ;; # Windows/Cygwin *:CYGWIN*:* ) # determine architecture AT="`uname -m`" AP="${AT}" case "${AP}" in i?86 ) AP="iX86" ;; esac AC="${AP}" # determine system unset v1; unset v2; unset v3 eval `echo "${UNAME_RELEASE}" |\ sed -e 's/^/#/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \ -e 's/^#.*$/v1="0"/'` ST="Cygwin ${v1}${v2+.$v2}${v3+[.$v3]}" SP="$ST" SC="Windows" v=`echo "${UNAME_SYSTEM}" | sed -e 's/^CYGWIN_NT-//' |\ sed -e 's/^/#/' -e 's/^#\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' -e 's/^#.*$//'` case "$v" in 4.0 ) SC="$SC[ NT]" ;; 5.0 ) SC="$SC[ 2000]" ;; 5.1 ) SC="$SC[ XP]" ;; 6.0 ) SC="$SC[ Vista]" ;; esac ;; # TODO ...ADD YOUR NEW PLATFORM CHECK HERE... TODO # *:XXX:* ) # ... # ;; # ...A STILL UNKNOWN PLATFORM... * ) AT=`echo "${UNAME_MACHINE}" | sed -e "s; ;${opt_C};g"` AP="${AT}" AC="${AP}" v=`echo "${UNAME_RELEASE}" |\ sed -e 's/^/#/' \ -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \ -e 's/^#.*$/?/'` ST="${UNAME_SYSTEM} ${v}" SP="${ST}" SC="${SP}" ;; esac # provide fallback values [ ".$AT" = . ] && AT="${AP:-${AC}}" [ ".$AP" = . ] && AP="${AT:-${AC}}" [ ".$AC" = . ] && AC="${AP:-${AT}}" [ ".$ST" = . ] && ST="${SP:-${SC}}" [ ".$SP" = . ] && SP="${ST:-${SC}}" [ ".$SC" = . ] && SC="${SP:-${ST}}" # support explicit enforced verbose/concise output if [ ".$opt_v" = .yes ]; then opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%[\1]/g'` elif [ ".$opt_c" = .yes ]; then opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%<\1>/g'` fi # provide verbose and concise variants AC_V=""; AC_N=""; AC_C="" AP_V=""; AP_N=""; AP_C="" AT_V=""; AT_N=""; AT_C="" SC_V=""; SC_N=""; SC_C="" SP_V=""; SP_N=""; SP_C="" ST_V=""; ST_N=""; ST_C="" for var_lc in at ap ac st sp sc; do case "$opt_F" in *"%[${val_lc}]"* | *"%{${val_lc}}"* | *"%${val_lc}"* | *"%<${val_lc}>"* ) var_uc=`util_upper "$var_lc"` eval "val=\"\$${var_uc}\"" val_V=""; val_N=""; val_C="" case "$opt_F" in *"%[${var_lc}]"* ) val_V=`echo ":$val" | \ sed -e 's/^://' \ -e 's;\[\([^]]*\)\];\1;g' \ -e 's;<\([^>]*\)>;\1;g' \ -e "s; ;§§;g" \ -e "s;/;%%;g" \ -e "s;§§;${opt_S};g" \ -e "s;%%;${opt_C};g"` eval "${var_uc}_V=\"\${val_V}\"" ;; esac case "$opt_F" in *"%{${var_lc}}"* | *"%${var_lc}"* ) val_N=`echo ":$val" | \ sed -e 's/^://' \ -e 's;\[\([^]]*\)\];;g' \ -e 's;<\([^>]*\)>;\1;g' \ -e "s; ;§§;g" \ -e "s;/;%%;g" \ -e "s;§§;${opt_S};g" \ -e "s;%%;${opt_C};g"` eval "${var_uc}_N=\"\${val_N}\"" ;; esac case "$opt_F" in *"%<${var_lc}>"* ) val_C=`echo ":$val" | \ sed -e 's/^://' \ -e 's;\[\([^]]*\)\];;g' \ -e 's;[^<]*<\([^>]*\)>[^<]*;\1;g' \ -e "s; ;§§;g" \ -e "s;/;%%;g" \ -e "s;§§;${opt_S};g" \ -e "s;%%;${opt_C};g"` eval "${var_uc}_C=\"\${val_C}\"" ;; esac ;; esac done # create output string output=`echo ":$opt_F" |\ sed -e "s/^://" \ -e "s;%\\[ac\\];${AC_V};g" \ -e "s;%{ac};${AC_N};g" \ -e "s;%ac;${AC_N};g" \ -e "s;%;${AC_C};g" \ -e "s;%\\[ap\\];${AP_V};g" \ -e "s;%{ap};${AP_N};g" \ -e "s;%ap;${AP_N};g" \ -e "s;%;${AP_C};g" \ -e "s;%\\[at\\];${AT_V};g" \ -e "s;%{at};${AT_N};g" \ -e "s;%at;${AT_N};g" \ -e "s;%;${AT_C};g" \ -e "s;%\\[sc\\];${SC_V};g" \ -e "s;%{sc};${SC_N};g" \ -e "s;%sc;${SC_N};g" \ -e "s;%;${SC_C};g" \ -e "s;%\\[sp\\];${SP_V};g" \ -e "s;%{sp};${SP_N};g" \ -e "s;%sp;${SP_N};g" \ -e "s;%;${SP_C};g" \ -e "s;%\\[st\\];${ST_V};g" \ -e "s;%{st};${ST_N};g" \ -e "s;%st;${ST_N};g" \ -e "s;%;${ST_C};g" \ -e 's/\\\\n/^/g' |\ tr '^' '\012'` # support lower/upper-case mapping if [ ".$opt_L" = .yes ]; then output=`util_lower "$output"` elif [ ".$opt_U" = .yes ]; then output=`util_upper "$output"` fi # display output string if [ ".$opt_n" = .yes ]; then echo . | awk '{ printf("%s", output); }' output="$output" else echo "$output" fi shtool_exit 0 ;; arx ) ## ## arx -- Extended archive command ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ar_prg="$opt_C" ar_cmd="$1"; shift archive="$1"; shift files="$*" # walk through the file list and expand archives members ar_tmpdir=`echo $archive | sed -e 's;[^/]*$;.arx;'` nfiles='' if [ ".$files" != . ]; then for file in $files; do if [ ! -f $file ]; then echo "$msgprefix:Error: input file not found: $file" 1>&2 shtool_exit 1 fi case $file in *.a ) if [ ! -d $ar_tmpdir ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $ar_tmpdir" 1>&2 fi mkdir $ar_tmpdir fi case $ar_tmpdir in .arx ) from="../$file" ;; * ) dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'` base=`echo $file | sed -e 's;.*/\([^/]*\)$;\1;'` from="`cd $dir; pwd`/$base" ;; esac if [ ".$opt_t" = .yes ]; then echo "(cd $ar_tmpdir && $ar_prg x $from)" 1>&2 fi (cd $ar_tmpdir && eval $ar_prg x $from) if [ $? -ne 0 ]; then echo "$msgprefix:Error: member extraction failed for archive: $file" 1>&2 shtool_exit 1 fi for member in - `eval $ar_prg t $file | sed -e '/_\.SYMDEF/d'`; do [ ".$member" = .- ] && continue nfiles="$nfiles $ar_tmpdir/$member" done ;; * ) nfiles="$nfiles $file" ;; esac done fi # run the final archive command if [ ".$opt_t" = .yes ]; then echo "$ar_prg $ar_cmd $archive $nfiles" 1>&2 fi eval $ar_prg $ar_cmd $archive $nfiles if [ $? -ne 0 ]; then echo "$msgprefix:Error: archive command failed" 1>&2 shtool_exit $? fi # cleanup and die gracefully if [ -d $ar_tmpdir ]; then if [ ".$opt_t" = .yes ]; then echo "rm -rf $ar_tmpdir" 1>&2 fi rm -rf $ar_tmpdir fi shtool_exit 0 ;; slo ) ## ## slo -- Separate linker options by library class ## Copyright (c) 1998-2008 Ralf S. Engelschall ## DIFS="$IFS" # parse out -L and -l options from command line DIRS='' LIBS='' ARGV='' optprev='' for opt do # concatenate with previous option if exists if [ ".$optprev" != . ]; then opt="${optprev}${opt}"; optprev='' fi # remember options for arg if used stand-alone if [ ".$opt" = ".-L" ] || [ ".$opt" = ".-l" ]; then optprev="$opt" continue; fi # split argument into option plus option argument arg="`echo $opt | cut -c3-`" opt="`echo $opt | cut -c1-2`" # store into containers case $opt in -L) DIRS="$DIRS:$arg" ;; -l) LIBS="$LIBS:$arg" ;; *) ARGV="$ARGV $opt" ;; esac done # set linker default directories DIRS_DEFAULT='/lib:/usr/lib' if [ ".$LD_LIBRARY_PATH" != . ]; then DIRS_DEFAULT="$DIRS_DEFAULT:$LD_LIBRARY_PATH" fi # sort options by class DIRS_OBJ='' LIBS_OBJ='' DIRS_PIC='' LIBS_PIC='' DIRS_DSO='' LIBS_DSO='' # for each library... OIFS="$IFS"; IFS=':' for lib in $LIBS; do [ ".$lib" = . ] && continue found='no' found_indefdir='no' found_type='' found_dir='' # for each directory... OIFS2="$IFS"; IFS=":$DIFS" for dir in ${DIRS} switch-to-defdirs ${DIRS_DEFAULT}; do [ ".$dir" = . ] && continue [ ".$dir" = .switch-to-defdirs ] && found_indefdir=yes [ ! -d $dir ] && continue # search the file OIFS3="$IFS"; IFS="$DIFS" for file in '' `cd $dir && env -i /bin/ls lib${lib}.* 2>/dev/null`; do [ ".$file" = . ] && continue case $file in *.so|*.so.[0-9]*|*.sl|*.sl.[0-9]* ) found=yes; found_type=DSO; break ;; *.lo|*.la ) found=yes; found_type=PIC ;; *.a ) if [ ".$found_type" = . ]; then found=yes found_type=OBJ fi ;; esac done IFS="$OIFS3" if [ ".$found" = .yes ]; then found_dir="$dir" break fi done IFS="$OIFS2" if [ ".$found" = .yes ]; then if [ ".$found_indefdir" != .yes ]; then eval "dirlist=\"\${DIRS_${found_type}}:\"" case "$dirlist" in *:$found_dir:* ) ;; * ) eval "DIRS_${found_type}=\"\$DIRS_${found_type}:${found_dir}\"" ;; esac eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\"" else eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\"" fi else LIBS_OBJ="$LIBS_OBJ:$lib" #dirlist="`echo $DIRS $DIRS_DEFAULT | sed -e 's/:/ /g'`" #echo "slo:Warning: library \"$lib\" not found in any of the following dirs:" 2>&1 #echo "slo:Warning: $dirlist" 1>&1 fi done IFS="$OIFS" # also pass-through unused dirs even if it's useless OIFS="$IFS"; IFS=':' for dir in $DIRS; do dirlist="${DIRS_OBJ}:${DIRS_PIC}:${DIRS_DSO}:" case "$dirlist" in *:$dir:* ) ;; * ) DIRS_OBJ="$DIRS_OBJ:$dir" ;; esac done IFS="$OIFS" # reassemble the options but separated by type for type in OBJ PIC DSO; do OIFS="$IFS"; IFS=':' eval "libs=\"\$LIBS_${type}\"" opts='' for lib in $libs; do [ ".$lib" = . ] && continue opts="$opts -l$lib" done eval "LIBS_${type}=\"$opts\"" eval "dirs=\"\$DIRS_${type}\"" opts='' for dir in $dirs; do [ ".$dir" = . ] && continue opts="$opts -L$dir" done eval "DIRS_${type}=\"$opts\"" IFS="$OIFS" done # give back results for var in ARGV DIRS_OBJ LIBS_OBJ DIRS_PIC LIBS_PIC DIRS_DSO LIBS_DSO; do eval "val=\"\$${var}\"" val="`echo $val | sed -e 's/^ *//'`" echo "${opt_p}${var}=\"${val}\"" done shtool_exit 0 ;; scpp ) ## ## scpp -- Sharing C Pre-Processor ## Copyright (c) 1999-2008 Ralf S. Engelschall ## srcs="$*" output="${opt_o}.n" # find a reasonable Awk awk='' paths=`echo $PATH |\ sed -e 's%/*:%:%g' -e 's%/$%%' \ -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ -e 's/:/ /g'` for name in gawk nawk awk; do for path in $paths; do if [ -r "$path/$name" ]; then awk="$path/$name" break fi done if [ ".$awk" != . ]; then break fi done if [ ".$awk" = . ]; then echo "$msgprefix:Error: cannot find a reasonable Awk" 1>&2 shtool_exit 1 fi # parse source file(s) if [ ".$opt_v" = .yes ]; then echo "Parsing:" | $awk '{ printf("%s", $0); }' 1>&2 fi for src in $srcs; do if [ ".$opt_v" = .yes ]; then echo $src | $awk '{ printf(" %s", $0); }' 1>&2 fi if [ ".$opt_f" != . ]; then inputcmd="sed" OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_f; IFS="$OIFS" for e do inputcmd="$inputcmd -e '$e'" done inputcmd="$inputcmd '$src'" else inputcmd="cat '$src'" fi eval $inputcmd |\ $awk ' BEGIN { ln = 0; fln = 0; level = 0; mode = ""; store = ""; } { ln++; } /^#if.*/ { level++; } /^#if [a-zA-Z_][a-zA-Z0-9_]* *$/ { if ($2 == define) { mode = "D"; printf("D:#line %d \"%s\"\n", ln, src); next; } } /^#endif.*/ { level--; if (mode == "D" && level == 0) { mode = ""; next; } } /^[a-zA-Z_][a-zA-Z0-9_].*;.*/ { if ($1 == class) { printf("V:#line %d \"%s\"\n", ln, src); printf("V:%s\n", $0); printf("J:%s\n", $0); next; } } /^[a-zA-Z_][a-zA-Z0-9_].*=.*/ { if ($1 == class) { printf("V:#line %d \"%s\"\n", ln, src); printf("V:%s\n", $0); printf("J:%s\n", $0); next; } } /^[a-zA-Z_][a-zA-Z0-9_]*/ { if ($1 == class) { fln = ln; store = $0; mode = "F"; next; } } /^\{ *$/ { if (mode == "F") { printf("F:#line %d \"%s\"\n", fln, src); printf("F:%s;\n", store); printf("I:%s;\n", store); store = ""; mode = ""; next; } } { if (mode == "D") printf("D:%s\n", $0); else if (mode == "F") store = store " " $0; } ' "src=$src" "define=$opt_D" "class=$opt_C" >>$tmpfile done if [ ".$opt_v" = .yes ]; then echo "" 1>&2 fi # start generating output header echo "/* $opt_o -- autogenerated from $opt_t, DO NOT EDIT! */" >$output echo "#line 1 \"$opt_t\"" >>$output sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd' |\ sed -e "/^${opt_M} *\$/d" >>$output # merge in the define blocks grep '^D:' $tmpfile | sed -e 's/^D://' >>$output # generate standard prolog echo "#line 1 \"_ON_THE_FLY_\"" >>$output echo "" >>$output echo "/* make sure the scpp source extensions are skipped */" >>$output echo "#define $opt_D 0" >>$output echo "#define $opt_C /**/" >>$output # generate namespace hiding for variables echo "" >>$output echo "/* move intern variables to hidden namespace */" >>$output grep '^J:' $tmpfile | sed >>$output \ -e 's/^J://' \ -e 's/ */ /g' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\];.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\] =.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\);.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\) =.*$/#define \1 __\1/' # generate namespace hiding for functions echo "" >>$output echo "/* move intern functions to hidden namespace */" >>$output grep '^I:' $tmpfile | sed >>$output \ -e 's/^I://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e 's/^[^(]*[ *]\([a-zA-Z0-9_]*\)(.*$/#define \1 __\1/' # generate prototypes for variables echo "" >>$output echo "/* prototypes for intern variables */" >>$output grep '^V:' $tmpfile | sed >>$output \ -e 's/^V://' \ -e 's/ */ /g' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\) =.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\) =.*$/\1;/' \ -e 's/ ;/;/g' \ -e "s/^$opt_C /extern /" # generate prototypes for functions echo "" >>$output echo "/* prototypes for intern functions */" >>$output grep '^F:' $tmpfile | sed >>$output \ -e 's/^F://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e 's/\([* ]\)[a-zA-Z0-9_]*,/\1,/g' \ -e 's/\([* ]\)[a-zA-Z0-9_]*);/\1);/g' \ -e 's/(\*[a-zA-Z0-9_]*)(/(*)(/g' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e "s/^$opt_C /extern /" # finish generating output header n=`(echo ''; sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd') |\ wc -l | sed -e 's;^ *\([0-9]*\) *$;\1;'` echo "#line $n \"$opt_t\"" >>$output sed <$opt_t -e "/^${opt_M} *\$/,\$p" -e 'd' |\ sed -e "/^${opt_M} *\$/d" >>$output # create final output file if [ -f $opt_o ]; then if [ ".$opt_p" = .yes ]; then grep -v '^#line' $opt_o >$tmpfile.o grep -v '^#line' $output >$tmpfile.n out_old="$tmpfile.o" out_new="$tmpfile.n" else out_old="$opt_o" out_new="$output" fi if cmp -s $out_old $out_new; then : else cp $output $opt_o fi else cp $output $opt_o fi rm -f $output rm -f $tmpfile $tmpfile.* >/dev/null 2>&1 shtool_exit 0 ;; version ) ## ## version -- Maintain a version information file ## Copyright (c) 1994-2008 Ralf S. Engelschall ## file="$1" # determine prefix and name name="$opt_n" prefix="$opt_p" # determine current version triple="$opt_s" if [ ".$triple" != . ]; then # use given triple if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then echo "$msgprefix:Error: invalid argument to option \`-s': \`$opt_s'" 1>&2 shtool_exit 1 fi eval `echo $triple |\ sed -e 's%\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*%\ ver="\1";rev="\2";typ="\3";lev="\4"%'` tim=calc elif [ -r $file ]; then # determine triple from given file eval `grep 'Version [0-9]*.[0-9]*[sabp.][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $file |\ sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\ ver="\1";rev="\2";typ="\3";lev="\4";tim="\5"%' -e 'q'` else # intialise to first version ver=0 rev=1 typ=. lev=0 tim=calc fi # determine new version in batch if [ ".$opt_i" != . ]; then case $opt_i in v ) ver=`expr $ver + 1` rev=0 lev=0 ;; r ) rev=`expr $rev + 1` lev=0 ;; l ) lev=`expr $lev + 1` ;; * ) echo "$msgprefix:Error: invalid argument to option \`-i': \`$opt_i'" 1>&2 shtool_exit 1 ;; esac tim=calc fi # determine new version interactively if [ ".$opt_e" = .yes ]; then echo "old version: ${ver}.${rev}${typ}${lev}" while [ 1 ]; do echo dummy | awk '{ printf("new version: "); }' read triple case $triple in [0-9]*.[0-9]*[sabp.][0-9]* ) ;; * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2 continue ;; esac break done eval `echo $triple |\ sed -e 's%^\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\)$%\ ver="\1";rev="\2";typ="\3";lev="\4"%'` tim=calc fi # determine hexadecimal and libtool value of version case $typ in a ) typnum=0; levnum=$lev ;; b ) typnum=1; levnum=$lev ;; p | . ) typnum=2; levnum=$lev ;; s ) typnum=15; levnum=255 ;; # snapshots are special esac hex=`echo "$ver:$rev:$typnum:$levnum" |\ awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\ tr 'abcdef' 'ABCDEF'` ltv=`echo "$ver:$rev:$typnum:$levnum" |\ awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'` # determine date if [ ".$tim" = .calc ]; then day=`date '+%d'` month=`date '+%m'` year=`date '+%Y' 2>/dev/null` if [ ".$time_year" = . ]; then year=`date '+%y'` case $year in [5-9][0-9]) year="19$year" ;; [0-4][0-9]) year="20$year" ;; esac fi case $month in 1|01) month='Jan' ;; 2|02) month='Feb' ;; 3|03) month='Mar' ;; 4|04) month='Apr' ;; 5|05) month='May' ;; 6|06) month='Jun' ;; 7|07) month='Jul' ;; 8|08) month='Aug' ;; 9|09) month='Sep' ;; 10) month='Oct' ;; 11) month='Nov' ;; 12) month='Dec' ;; esac tim="${day}-${month}-${year}" fi # perform result actions mode=show if [ ".$opt_i" != . ]; then mode=edit elif [ ".$opt_e" = .yes ]; then mode=edit elif [ ".$opt_s" != . ]; then mode=edit fi if [ ".$mode" = .show ]; then # just display the current version case $opt_d in short ) echo "${ver}.${rev}${typ}${lev}" ;; long ) echo "${ver}.${rev}${typ}${lev} ($tim)" ;; libtool ) echo "${ltv}" ;; hex ) echo "${hex}" ;; * ) echo "$msgprefix:Error: invalid argument to option \`-d': \`$opt_d'" 1>&2 shtool_exit 1 ;; esac else # update the version file # pre-generate various strings triple="${ver}.${rev}${typ}${lev}" vHex="$hex" vShort="${triple}" vLong="${triple} (${tim})" vTeX="This is ${name}, Version ${triple} (${tim})" vGNU="${name} ${triple} (${tim})" vWeb="${name}/${triple}" vSCCS="@(#)${name} ${triple} (${tim})" vRCS="\$Id: ${name} ${triple} (${tim}) \$" # determine string out of filename # (do NOT try to optimize this in any way because of portability) filestr=`util_upper "$file" | tr './%+' '____' | sed -e 's/-/_/g'` # generate uppercase prefix prefixupper=`util_upper "$prefix"` # create the version file according the the selected language echo "new version: ${vLong}" cp /dev/null $file case $opt_l in txt ) echo >>$file "" echo >>$file " ${file} -- Version Information for ${name} (syntax: Text)" echo >>$file " [automatically generated and maintained by GNU shtool]" echo >>$file "" echo >>$file " $vTeX" echo >>$file "" ;; c ) echo >>$file "/*" echo >>$file "** ${file} -- Version Information for ${name} (syntax: C/C++)" echo >>$file "** [automatically generated and maintained by GNU shtool]" echo >>$file "*/" echo >>$file "" echo >>$file "#ifdef _${filestr}_AS_HEADER_" echo >>$file "" echo >>$file "#ifndef _${filestr}_" echo >>$file "#define _${filestr}_" echo >>$file "" echo >>$file "#define ${prefixupper}VERSION ${vHex}" echo >>$file "" echo >>$file "typedef struct {" echo >>$file " const int v_hex;" echo >>$file " const char *v_short;" echo >>$file " const char *v_long;" echo >>$file " const char *v_tex;" echo >>$file " const char *v_gnu;" echo >>$file " const char *v_web;" echo >>$file " const char *v_sccs;" echo >>$file " const char *v_rcs;" echo >>$file "} ${prefix}version_t;" echo >>$file "" echo >>$file "extern ${prefix}version_t ${prefix}version;" echo >>$file "" echo >>$file "#endif /* _${filestr}_ */" echo >>$file "" echo >>$file "#else /* _${filestr}_AS_HEADER_ */" echo >>$file "" echo >>$file "#define _${filestr}_AS_HEADER_" echo >>$file "#include \"${file}\"" echo >>$file "#undef _${filestr}_AS_HEADER_" echo >>$file "" echo >>$file "${prefix}version_t ${prefix}version = {" echo >>$file " ${vHex}," echo >>$file " \"${vShort}\"," echo >>$file " \"${vLong}\"," echo >>$file " \"${vTeX}\"," echo >>$file " \"${vGNU}\"," echo >>$file " \"${vWeb}\"," echo >>$file " \"${vSCCS}\"," echo >>$file " \"${vRCS}\"" echo >>$file "};" echo >>$file "" echo >>$file "#endif /* _${filestr}_AS_HEADER_ */" echo >>$file "" ;; m4 ) echo >>$file "##" echo >>$file "## ${file} -- Version Information for ${name} (syntax: M4)" echo >>$file "## [automatically generated and maintained by GNU shtool]" echo >>$file "##" echo >>$file "" echo >>$file "m4_define([v_hex], [${vHex}])" echo >>$file "m4_define([v_short], [${vShort}])" echo >>$file "m4_define([v_long], [${vLong}])" echo >>$file "m4_define([v_tex], [${vTeX}])" echo >>$file "m4_define([v_gnu], [${vGNU}])" echo >>$file "m4_define([v_web], [${vWeb}])" echo >>$file "m4_define([v_sccs], [${vSCCS}])" echo >>$file "m4_define([v_rcs], [${vRCS}])" echo >>$file "" ;; perl ) echo >>$file "##" echo >>$file "## ${file} -- Version Information for ${name} (syntax: Perl)" echo >>$file "## [automatically generated and maintained by GNU shtool]" echo >>$file "##" echo >>$file "" echo >>$file "our \$${prefix}version = {" echo >>$file " 'v_hex' => ${vHex}," echo >>$file " 'v_short' => \"${vShort}\"," echo >>$file " 'v_long' => \"${vLong}\"," echo >>$file " 'v_tex' => \"${vTeX}\"," echo >>$file " 'v_gnu' => \"${vGNU}\"," echo >>$file " 'v_web' => \"${vWeb}\"," echo >>$file " 'v_sccs' => \"${vSCCS}\"," echo >>$file " 'v_rcs' => \"\\${vRCS}/\"" echo >>$file "};" echo >>$file "" echo >>$file "1;" echo >>$file "" ;; python ) echo >>$file "##" echo >>$file "## ${file} -- Version Information for ${name} (syntax: Python)" echo >>$file "## [automatically generated and maintained by GNU shtool]" echo >>$file "##" echo >>$file "" echo >>$file "class ${prefix}version:" echo >>$file " v_hex = ${vHex}" echo >>$file " v_short = \"${vShort}\"" echo >>$file " v_long = \"${vLong}\"" echo >>$file " v_tex = \"${vTeX}\"" echo >>$file " v_gnu = \"${vGNU}\"" echo >>$file " v_web = \"${vWeb}\"" echo >>$file " v_sccs = \"${vSCCS}\"" echo >>$file " v_rcs = \"${vRCS}\"" echo >>$file "" ;; * ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2 shtool_exit 1 ;; esac fi shtool_exit 0 ;; path ) ## ## path -- Deal with program paths ## Copyright (c) 1998-2008 Ralf S. Engelschall ## namelist="$*" # check whether the test command supports the -x option if [ -x /bin/sh ] 2>/dev/null; then minusx="-x" else minusx="-r" fi # split path string paths="`echo $opt_p |\ sed -e 's/^:/.:/' \ -e 's/::/:.:/g' \ -e 's/:$/:./' \ -e 's/:/ /g'`" # SPECIAL REQUEST # translate forward to reverse path if [ ".$opt_r" = .yes ]; then if [ "x$namelist" = "x." ]; then rp='.' else rp='' for pe in `IFS="$IFS/"; echo $namelist`; do rp="../$rp" done fi echo $rp | sed -e 's:/$::' shtool_exit 0 fi # SPECIAL REQUEST # strip out directory or base name if [ ".$opt_d" = .yes ]; then echo "$namelist" |\ sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' shtool_exit 0 fi if [ ".$opt_b" = .yes ]; then echo "$namelist" |\ sed -e 's;.*/\([^/]*\)$;\1;' shtool_exit 0 fi # MAGIC SITUATION # Perl Interpreter (perl) if [ ".$opt_m" = .yes ] && [ ".$namelist" = .perl ]; then rm -f $tmpfile >/dev/null 2>&1 touch $tmpfile found=0 pc=99 for dir in $paths; do dir=`echo $dir | sed -e 's;/*$;;'` nc=99 for name in perl perl5 miniperl; do if [ $minusx "$dir/$name" ] && [ ! -d "$dir/$name" ]; then perl="$dir/$name" pv=`$perl -e 'printf("%.3f", $]);'` echo "$pv:$pc:$nc:$perl" >>$tmpfile found=1 fi nc=`expr $nc - 1` done pc=`expr $pc - 1` done if [ $found = 1 ]; then perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`" rm -f $tmpfile >/dev/null 2>&1 echo "$perl" shtool_exit 0 fi rm -f $tmpfile >/dev/null 2>&1 shtool_exit 1 fi # MAGIC SITUATION # C pre-processor (cpp) if [ ".$opt_m" = .yes ] && [ ".$namelist" = .cpp ]; then echo >$tmpfile.c "#include " echo >>$tmpfile.c "Syntax Error" # 1. try the standard cc -E approach cpp="${CC-cc} -E" (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out my_error=`grep -v '^ *+' $tmpfile.out` if [ ".$my_error" != . ]; then # 2. try the cc -E approach and GCC's -traditional-ccp option cpp="${CC-cc} -E -traditional-cpp" (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out my_error=`grep -v '^ *+' $tmpfile.out` if [ ".$my_error" != . ]; then # 3. try a standalone cpp command in path and lib dirs for path in $paths /lib /usr/lib /usr/local/lib; do path=`echo $path | sed -e 's;/*$;;'` if [ $minusx "$path/cpp" ] && [ ! -d "$path/cpp" ]; then cpp="$path/cpp" break fi done if [ ".$cpp" != . ]; then (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out my_error=`grep -v '^ *+' $tmpfile.out` if [ ".$my_error" != . ]; then # ok, we gave up... cpp='' fi fi fi fi rm -f $tmpfile >/dev/null 2>&1 rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1 if [ ".$cpp" != . ]; then echo "$cpp" shtool_exit 0 fi shtool_exit 1 fi # STANDARD SITUATION # iterate over names for name in $namelist; do # iterate over paths for path in $paths; do path=`echo $path | sed -e 's;/*$;;'` if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then if [ ".$opt_s" != .yes ]; then echo "$path/$name" fi shtool_exit 0 fi done done shtool_exit 1 ;; esac shtool_exit 0 cmtk-3.0.0/Utilities/numdiff-5.2.1/INSTALL0000644000177700000170000003463611666247630016633 0ustar torstenman Copyright (C) 2005, 2006, 2007, 2008, 2009 Ivano Primi Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. *********************************************************************************** How to build and install Numdiff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To successfully compile, build and install Numdiff some tools are required. The first one is an ANSI C compiler. This compiler should at least accept the option `-o' to write its output to a specified file, the option `-D' for macros pre-definition, the option `-l' to search for a specified library, and the options `-I' and `-L' to add a given directory to the search path for include and library files respectively. Numdiff has been successfully compiled and tested on Slackware(R) GNU/Linux 10.2 with the version 3.3.6 of the GNU C Compiler (GCC), on Slackware GNU/Linux 11 with GCC 3.4.6, on Slackware GNU/Linux 12.2 with GCC 4.2.4, on Slackware GNU/Linux 13 with GCC 4.3.3, on Debian(R) GNU/Linux 4.0 with GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21), on SunOS(R) 5.8 with GCC 2.95.3, and on SunOS 5.10 (i386) with the version 5.9 of the Sun C compiler. Moreover, you need a POSIX implementation of the `make' utility (I used both GNU make and smake by Joerg Schilling to compile Numdiff) and a POSIX implementation of the commands `rm' and `find'. At last, you need a proper installation of GNU Texinfo (in order to install the info documentation) and a shell sh-compatible. Configuration, building and installation of Numdiff can be performed through the standard three steps: ./configure make make install If you leave enabled the Natural Language Support and you also want to install the localization files (at the moment only the Italian localization is supplied), then, after `make', you will have to type and run make install-nls By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/info' etc. You can specify an installation prefix other than `/usr/local' using the option `--prefix' in the `configure' step, for instance `--prefix=$HOME': ./configure --prefix=$HOME For better control, you can use the options `--bindir', `--infodir', and so on. Type `./configure --help' to obtain the complete list of all the available options. Anyway, the documentation files, including a full User Manual available in several formats (HTML, PDF and plain ASCII text), will always be put in `DOCDIR/numdiff', where `DOCDIR' is the path specified by the option `--docdir' or, if this option has not been given to `configure', `PREFIX/share/doc'. Here `PREFIX' is the installation prefix specified by the option `--prefix' or the default `/usr/local'. Once Numdiff has been installed you can remove all the files previously installed by a simple `make uninstall'. If you have also installed the localization files trough `make install-nls', then, in order to remove also these ones, use `make uninstall-nls' in place of `make uninstall'. Between the options accepted by `configure' there are `--enable-debug', `--enable-optimization', `--enable-nls' and `--enable-gmp'. The option `--enable-debug' turns on debugging when compiling the source code. This is obtained by passing to the compiler the `-g' option, but you can change this default debugging flag (which could not even be recognized by your compiler) by setting the environment variable `DBGFLAGS' before calling `configure'. The option `--enable-optimization' turns on basic optimization when compiling the source code. This is obtained by passing to the compiler the `-O' option, but you can change this default flag (which could not even be recognized by your compiler) by setting the environment variable `OPTFLAGS' before calling `configure'. The option `--enable-nls' turns on Natural Language Support. But you do not need to use it explicitly, since Natural Language Support is enabled by default. However, you can disable it by using `--disable-nls'. Disabling Natural Language Support is suggested whenever you want to install Numdiff on a system where the GNU gettext library is not present. In this case the installation of Numdiff can be accomplished, for instance, through ./configure --disable-nls make make install Since version 5.2.0 Numdiff uses to perform all computations the GNU Multiple Precision Arithmetic Library (also called GNU MP or GMP), if this library is available at build-time. The old internal support for multiple precision arithmetic is a fall-back in case GNU MP is absent. However it is possible to use the internal support for multiple precision arithmetic even when GNU MP is available: it is sufficient to pass the option `--enable-gmp=no' or `--disable-gmp' to the configure script before building the program, like in ./configure --disable-gmp make make install Enabling the old internal support for multiple precision arithmetic is deprecated, I suggest to always link Numdiff against GNU MP. The latest version of GNU MP is available at ftp://ftp.gnu.org/gnu/gmp/. See the GNU MP web page at http://gmplib.org/ for up-to-date information on GNU MP. Below, I have attached the generic INSTALL instructions included in the autoconf distribution. ---------------------------------------------------------------------------- Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. cmtk-3.0.0/Utilities/numdiff-5.2.1/side.c0000644000177700000170000001672211666247630016666 0ustar torstenman/* sdiff-format output routines for GNU DIFF. Copyright (C) 1991, 1992, 1993, 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU DIFF. GNU DIFF is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU DIFF General Public License for full details. Everyone is granted permission to copy, modify and redistribute GNU DIFF, but only under the conditions described in the GNU DIFF General Public License. A copy of this license is supposed to have been given to you along with GNU DIFF so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ /* This file, coming from the source code of GNU DIFF, has been modified by Ivano Primi so that it could be merged into the source code of Numdiff. Numdiff is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Numdiff 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. */ #include "numdiff.h" static void print_sdiff_common_lines (lin, lin); static void print_sdiff_hunk (struct change *); /* Next line number to be printed in the two input files. */ static lin next0, next1; /* Print the edit-script SCRIPT as a sdiff style output. */ void print_sdiff_script (struct change *script) { next0 = next1 = - files[0].prefix_lines; print_script (script, print_sdiff_hunk); print_sdiff_common_lines (files[0].valid_lines, files[1].valid_lines); } /* Tab from column FROM to column TO, where FROM <= TO. Yield TO. */ static unsigned int tab_from_to (unsigned int from, unsigned int to) { FILE *out = outfile; unsigned int tab; if (!expand_tabs) for (tab = from + TAB_WIDTH - from % TAB_WIDTH; tab <= to; tab += TAB_WIDTH) { putc ('\t', out); from = tab; } while (from++ < to) putc (' ', out); return to; } /* * Print the text for half an sdiff line. This means truncate to width * observing tabs, and trim a trailing newline. Returns the last column * written (not the number of chars). */ static unsigned int print_half_line (char const *const *line, unsigned int indent, unsigned int out_bound) { FILE *out = outfile; register unsigned int in_position = 0; register unsigned int out_position = 0; register char const *text_pointer = line[0]; register char const *text_limit = line[1]; while (text_pointer < text_limit) { register unsigned char c = *text_pointer++; switch (c) { case '\t': { unsigned int spaces = TAB_WIDTH - in_position % TAB_WIDTH; if (in_position == out_position) { unsigned int tabstop = out_position + spaces; if ((expand_tabs)) { if (out_bound < tabstop) tabstop = out_bound; for (; out_position < tabstop; out_position++) putc (' ', out); } else if (tabstop < out_bound) { out_position = tabstop; putc (c, out); } } in_position += spaces; } break; case '\r': { putc (c, out); tab_from_to (0, indent); in_position = out_position = 0; } break; case '\b': if (in_position != 0 && --in_position < out_bound) { if (out_position <= in_position) /* Add spaces to make up for suppressed tab past out_bound. */ for (; out_position < in_position; out_position++) putc (' ', out); else { out_position = in_position; putc (c, out); } } break; case '\f': case '\v': control_char: if (in_position < out_bound) putc (c, out); break; default: if (! ISPRINT (c)) goto control_char; /* falls through */ case ' ': if (in_position++ < out_bound) { out_position = in_position; putc (c, out); } break; case '\n': return out_position; } } return out_position; } /* * Print side by side lines with a separator in the middle. * 0 parameters are taken to indicate white space text. * Blank lines that can easily be caught are reduced to a single newline. */ static void print_1sdiff_line (char const *const *left, char sep, char const *const *right) { FILE *out = outfile; unsigned int hw = sdiff_half_width, c2o = sdiff_column2_offset; unsigned int col = 0; bool put_newline = 0; if (left) { put_newline |= left[1][-1] == '\n'; col = print_half_line (left, 0, hw); } if (sep != ' ') { col = tab_from_to (col, (hw + c2o - 1) / 2) + 1; if (sep == '|' && put_newline != (right[1][-1] == '\n')) sep = put_newline ? '/' : '\\'; putc (sep, out); } if (right) { put_newline |= right[1][-1] == '\n'; if (**right != '\n') { col = tab_from_to (col, c2o); print_half_line (right, col, hw); } } if (put_newline) putc ('\n', out); } /* Print lines common to both files in side-by-side format. */ static void print_sdiff_common_lines (lin limit0, lin limit1) { lin i0 = next0, i1 = next1; /* long len0, len1; */ if (i0 != limit0 || i1 != limit1) { if (!suppress_common_lines) { while (i0 != limit0 && i1 != limit1) print_1sdiff_line (&files[0].linbuf[i0++], ' ', &files[1].linbuf[i1++]); while (i1 != limit1) print_1sdiff_line (0, ')', &files[1].linbuf[i1++]); while (i0 != limit0) print_1sdiff_line (&files[0].linbuf[i0++], '(', 0); } /* else */ /* { */ /* len0 = limit0 - i0; */ /* len1 = limit1 - i1; */ /* fprintf (outfile, "i%ld,%ld\n", len0, len1); */ /* } */ } next0 = limit0; next1 = limit1; } /* Print a hunk of an sdiff diff. This is a contiguous portion of a complete edit script, describing changes in consecutive lines. */ static void print_sdiff_hunk (struct change *hunk) { lin first0, last0, first1, last1; register lin i, j; /* Determine range of line numbers involved in each file. */ enum changes changes = analyze_hunk (hunk, &first0, &last0, &first1, &last1); if (!changes) return; /* Print out lines up to this change. */ print_sdiff_common_lines (first0, first1); /* if ((suppress_common_lines)) */ /* { */ /* long len0 = last0 - first0 + 1; */ /* long len1 = last1 - first1 + 1; */ /* fprintf (outfile, "c%ld,%ld\n", len0, len1); */ /* } */ /* Print ``xxx | xxx '' lines */ if (changes == CHANGED) { for (i = first0, j = first1; i <= last0 && j <= last1; i++, j++) print_1sdiff_line (&files[0].linbuf[i], '|', &files[1].linbuf[j]); changes = (i <= last0 ? OLD : 0) + (j <= last1 ? NEW : 0); next0 = first0 = i; next1 = first1 = j; } /* Print `` > xxx '' lines */ if (changes & NEW) { for (j = first1; j <= last1; ++j) print_1sdiff_line (0, '>', &files[1].linbuf[j]); next1 = j; } /* Print ``xxx < '' lines */ if (changes & OLD) { for (i = first0; i <= last0; ++i) print_1sdiff_line (&files[0].linbuf[i], '<', 0); next0 = i; } } cmtk-3.0.0/Utilities/numdiff-5.2.1/getopt1.c0000644000177700000170000000765211666247630017327 0ustar torstenman/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include #endif #ifdef _LIBC # include #else # include "getopt.h" #endif #include "getopt_int.h" #include /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 0, 0); } int _getopt_long_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 0, 0, d); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 1, 0); } int _getopt_long_only_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, 0, d); } #ifdef TEST #include int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ cmtk-3.0.0/Utilities/numdiff-5.2.1/configure.ac0000644000177700000170000001703411666247630020061 0ustar torstenmandnl dnl Autoconf configuration script for Numdiff - version 5.x . dnl dnl Copyright 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi . dnl dnl Permission is granted to use, copy, modify, and redistribute this file as dnl needed. dnl dnl Process this file with autoconf to produce a configure script. dnl dnl -------------------------------------- dnl Minimal required version of dnl autoconf dnl -------------------------------------- dnl AC_PREREQ(2.62) dnl -------------------------------------- dnl Initialization dnl -------------------------------------- dnl AC_INIT(Numdiff, 5.2, , numdiff) AC_CONFIG_SRCDIR(numdiff.h) AC_CONFIG_HEADER(config.h) dnl -------------------------------------- dnl My own flags dnl -------------------------------------- dnl if test "x$DBGFLAGS" = "x"; then DBGFLAGS="-g" fi if test "x$OPTFLAGS" = "x"; then OPTFLAGS="-O" fi dnl -------------------------------------- dnl Getting environment variables dnl -------------------------------------- dnl CPPFLAGS="${CPPFLAGS:=}" CFLAGS="${CFLAGS:=}" LDFLAGS="${LDFLAGS:=}" LIBS="${LIBS:=}" CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H" dnl -------------------------------------- dnl Check whether to add /usr/local or not dnl (this is somewhat a religious problem) dnl -------------------------------------- dnl if test "`$CPP -v < /dev/null 2>&1 | grep '/usr/local/include' 2>&1`" = ""; then CPPFLAGS="$CPPFLAGS -I/usr/local/include" LDFLAGS="$LDFLAGS -L/usr/local/lib" fi dnl -------------------------------------- dnl If possible, enable dnl extensions to C or Posix on hosts dnl that normally disable the extensions, dnl typically due to standards-conformance dnl namespace issues. This should be dnl called before any macros that run the dnl C compiler. dnl -------------------------------------- AC_USE_SYSTEM_EXTENSIONS dnl -------------------------------------- dnl Checks for programs dnl -------------------------------------- dnl AC_PROG_CC AC_PROG_CC_C_O AC_PROG_CPP dnl AC_PROG_INSTALL AC_PATH_PROG(FIND,find) dnl * Debian uses ginstall-info instead of install-info dnl * to install info files. AC_PATH_PROGS(INSTINFO,install-info ginstall-info) dnl -------------------------------------- dnl Checks for header files dnl -------------------------------------- dnl AC_HEADER_STDC if test $ac_cv_header_stdc = yes; then AC_MSG_RESULT(Ok! I have just found them.) else AC_MSG_ERROR(Cannot find ANSI C header files!) fi AC_HEADER_STDBOOL AC_CHECK_HEADERS(fcntl.h locale.h stddef.h \ stdlib.h string.h sys/file.h time.h unistd.h wchar.h wctype.h) AC_HEADER_DIRENT AC_HEADER_STAT AC_HEADER_SYS_WAIT dnl -------------------------------------- dnl Checks for typedefs, structures, and dnl compiler characteristics dnl -------------------------------------- dnl dnl AC__GNU_SOURCE dnl AC_DEFINE([__EXTENSIONS__], 1, [Enable Solaris extensions.]) AC_SYS_LARGEFILE AC_C_CONST AC_C_INLINE AC_C_VARARRAYS AC_TYPE_SIZE_T AC_TYPE_PID_T AC_CHECK_TYPE(ptrdiff_t, int) AC_CHECK_TYPE(ssize_t, int) AC_STRUCT_ST_BLKSIZE AC_STRUCT_ST_RDEV AC_STRUCT_ST_MTIM_NSEC dnl AC_TYPE_MODE_T dnl AC_STRUCT_ST_BLOCKS dnl -------------------------------------- dnl Checks for libraries dnl -------------------------------------- AC_CHECK_LIB(gmp, __gmpz_init) dnl AC_CHECK_HEADERS(gmp.h) dnl -------------------------------------- dnl Checks for library functions dnl -------------------------------------- dnl dnl HAVE_SNPRINTF=0 dnl AC_CHECK_FUNC(snprintf, HAVE_SNPRINTF=1) dnl if test $HAVE_SNPRINTF = 0; then dnl AC_MSG_ERROR(Declaration of snprintf() not present!) dnl else dnl AC_MSG_RESULT(Ok! snprintf() is declared.) dnl fi HAVE_VSPRINTF=0 AC_CHECK_FUNC(vsprintf, HAVE_VSPRINTF=1) if test $HAVE_VSPRINTF = 0; then AC_MSG_ERROR(Declaration of vsprintf() not present!) else AC_MSG_RESULT(Ok! vsprintf() is declared.) fi HAVE_MEMSET=0 AC_CHECK_FUNC(memset, HAVE_MEMSET=1) if test $HAVE_MEMSET = 0; then AC_MSG_ERROR(Declaration of memset() not present!) else AC_MSG_RESULT(Ok! memset() is declared.) fi HAVE_MEMCHR=0 AC_CHECK_FUNC(memchr, HAVE_MEMCHR=1) if test $HAVE_MEMCHR = 0; then AC_MSG_ERROR(Declaration of memchr() not present!) else AC_MSG_RESULT(Ok! memchr() is declared.) fi HAVE_STRERROR=0 AC_CHECK_FUNC(strerror, HAVE_STRERROR=1) if test $HAVE_STRERROR = 0; then AC_MSG_ERROR(Declaration of strerror() not present!) else AC_MSG_RESULT(Ok! strerror() is declared.) fi HAVE_STRSPN=0 AC_CHECK_FUNC(strspn, HAVE_STRSPN=1) if test $HAVE_STRSPN = 0; then AC_MSG_ERROR(Declaration of strspn() not present!) else AC_MSG_RESULT(Ok! strspn() is declared.) fi HAVE_STRCSPN=0 AC_CHECK_FUNC(strcspn, HAVE_STRCSPN=1) if test $HAVE_STRCSPN = 0; then AC_MSG_ERROR(Declaration of strcspn() not present!) else AC_MSG_RESULT(Ok! strcspn() is declared.) fi AC_FUNC_STRERROR_R AC_FUNC_FORK AC_CHECK_FUNCS(localeconv gettimeofday isascii setlocale strchr strftime waitpid) # setmode DOS ? AC_FUNC_SETMODE_DOS # Check for clock_gettime and its library. Solaris puts it in -lrt or # -lposix4, but we don't want to link that library unless we have to. diff_saved_libs=$LIBS AC_SEARCH_LIBS(clock_gettime, [rt posix4]) case $ac_cv_search_clock_gettime in no | 'none required') LIB_CLOCK_GETTIME=;; *) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;; esac AC_SUBST([LIB_CLOCK_GETTIME]) AC_CHECK_FUNCS(clock_gettime) LIBS=$diff_saved_libs dnl -------------------------------------- dnl Check for functions declarations dnl -------------------------------------- dnl AC_DEFINE([USE_UNLOCKED_IO], [1], [Define to 1 if you want getc etc. to use unlocked I/O if available. Unlocked I/O can improve performance in unithreaded apps, but it is not safe for multithreaded apps.]) AC_CHECK_DECLS( [clearerr_unlocked, feof_unlocked, ferror_unlocked, fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked, fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked, strerror]) dnl -------------------------------------- dnl Options dnl -------------------------------------- dnl AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], , enable_debug=no) AC_ARG_ENABLE(optimization, [ --enable-optimization turn on basic optimization [default=no]], , enable_optimization=no) AC_ARG_ENABLE(nls, [ --enable-nls turn on Natural Language Support [default=yes]], , enable_nls=yes) AC_ARG_ENABLE(gmp, [ --enable-gmp turn on use of GNU MP [default=yes]], , enable_gmp=yes) dnl -------------------------------------- dnl Optimization, debug, GNU MP and NLS dnl -------------------------------------- dnl if test "x$enable_gmp" = "xno"; then CPPFLAGS="$CPPFLAGS -DDISABLE_GMP " fi if test "x$enable_nls" = "xyes"; then CPPFLAGS="$CPPFLAGS -DENABLE_NLS " fi if test "x$enable_debug" = "xyes"; then CFLAGS="$CFLAGS $DBGFLAGS " fi if test "x$enable_optimization" = "xyes"; then CFLAGS="$CFLAGS $OPTFLAGS " fi dnl LIBS="$LIBS" dnl CPPFLAGS="$CPPFLAGS" dnl -------------------------------------- dnl Output the makefile dnl -------------------------------------- dnl AC_MSG_RESULT(Configuration terminated with success:) AC_MSG_RESULT(Preprocessor flags = "$CPPFLAGS") AC_MSG_RESULT(Compiler flags = "$CFLAGS") AC_MSG_RESULT(Linker flags = "$LDFLAGS") AC_MSG_RESULT(Libraries = "$LIBS") dnl Remember to include @SET_MAKE@ in Makefile.in !!! AC_PROG_MAKE_SET AC_OUTPUT(Makefile) dnl dnl -------------------------------------- dnl End of configure script. dnl -------------------------------------- cmtk-3.0.0/Utilities/numdiff-5.2.1/read_line.c0000644000177700000170000000311611666247630017655 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ char* read_line (FILE* pf, int* errcode) { char buffer[BUFF_SIZE]; char *ptr, *line = NULL; size_t lline = 0; while ((ptr = fgets (buffer, BUFF_SIZE,pf))) { lline += strlen (buffer); if (!line) ptr = (char*) calloc (lline + 1, sizeof(char)); else ptr = (char*) realloc ((void*)line, (lline + 1) * sizeof(char)); if (!ptr) { if ((line)) free ((void*)line); *errcode = OUT_OF_MEMORY; return NULL; } else { line = ptr; strcat (line, buffer); } if (lline > 0 && line[lline-1] == '\n') break; } if (!ptr) { if ( (ferror(pf)) ) *errcode = READING_ERROR; else if (lline > 0) *errcode = LINE_INTERR; else *errcode = EOF_REACHED; } else *errcode = OK; return line; } cmtk-3.0.0/Utilities/numdiff-5.2.1/getopt_int.h0000644000177700000170000001127411666247630020120 0ustar torstenman/* Internal declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 extern int _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument vectors at the same time. */ /* Data type for reentrant functions. */ struct _getopt_data { /* These have exactly the same meaning as the corresponding global variables, except that they are used for the reentrant versions of getopt. */ int optind; int opterr; int optopt; char *optarg; /* Internal members. */ /* True if the internal members have been initialized. */ int __initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ char *__nextchar; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters, or by calling getopt. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } __ordering; /* If the POSIXLY_CORRECT environment variable is set or getopt was called. */ int __posixly_correct; /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ int __first_nonopt; int __last_nonopt; #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; # endif }; /* The initializer is necessary to set OPTIND and OPTERR to their default values and to clear the initialization flag. */ #define _GETOPT_DATA_INITIALIZER { 1, 1 } extern int _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct, struct _getopt_data *__data); extern int _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); extern int _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); #endif /* getopt_int.h */ cmtk-3.0.0/Utilities/numdiff-5.2.1/cmpbuf.h0000644000177700000170000000161311666247630017214 0ustar torstenman/* Buffer primitives for comparison operations. Copyright (C) 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ size_t block_read (int, char *, size_t); size_t buffer_lcm (size_t, size_t, size_t); cmtk-3.0.0/Utilities/numdiff-5.2.1/xalloc-die.c0000644000177700000170000000254311666247630017757 0ustar torstenman/* Report a memory allocation failure and exit. Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "xalloc.h" #include #include "error.h" #include "exitfail.h" #include "gettext.h" #define _(msgid) gettext (msgid) void xalloc_die (void) { error (exit_failure, 0, "%s", _("memory exhausted")); /* The `noreturn' cannot be given to error, since it may return if its first argument is 0. To help compilers understand the xalloc_die does not return, call abort. Also, the abort is a safety feature if exit_failure is 0 (which shouldn't happen). */ abort (); } cmtk-3.0.0/Utilities/numdiff-5.2.1/BUGS0000644000177700000170000000043211666247630016250 0ustar torstenmanBug reports have to be sent to the address . Please, put Numdiff in the subject and indicate the version of Numdiff you are using, the version of the operating system you are running and, if you know it, the version of the compiler used to build Numdiff. cmtk-3.0.0/Utilities/numdiff-5.2.1/unlocked-io.h0000644000177700000170000000503711666247630020155 0ustar torstenman/* Copyright 1992, 1993, 1994, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef UNLOCKED_IO_H # define UNLOCKED_IO_H 1 # ifndef USE_UNLOCKED_IO # define USE_UNLOCKED_IO 1 # endif # if USE_UNLOCKED_IO /* These are wrappers for functions/macros from GNU libc. The standard I/O functions are thread-safe. These *_unlocked ones are more efficient but not thread-safe. That they're not thread-safe is fine since all of the applications in this package are single threaded. */ # if HAVE_DECL_CLEARERR_UNLOCKED # undef clearerr # define clearerr(x) clearerr_unlocked (x) # endif # if HAVE_DECL_FEOF_UNLOCKED # undef feof # define feof(x) feof_unlocked (x) # endif # if HAVE_DECL_FERROR_UNLOCKED # undef ferror # define ferror(x) ferror_unlocked (x) # endif # if HAVE_DECL_FFLUSH_UNLOCKED # undef fflush # define fflush(x) fflush_unlocked (x) # endif # if HAVE_DECL_FGETS_UNLOCKED # undef fgets # define fgets(x,y,z) fgets_unlocked (x,y,z) # endif # if HAVE_DECL_FPUTC_UNLOCKED # undef fputc # define fputc(x,y) fputc_unlocked (x,y) # endif # if HAVE_DECL_FPUTS_UNLOCKED # undef fputs # define fputs(x,y) fputs_unlocked (x,y) # endif # if HAVE_DECL_FREAD_UNLOCKED # undef fread # define fread(w,x,y,z) fread_unlocked (w,x,y,z) # endif # if HAVE_DECL_FWRITE_UNLOCKED # undef fwrite # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) # endif # if HAVE_DECL_GETC_UNLOCKED # undef getc # define getc(x) getc_unlocked (x) # endif # if HAVE_DECL_GETCHAR_UNLOCKED # undef getchar # define getchar() getchar_unlocked () # endif # if HAVE_DECL_PUTC_UNLOCKED # undef putc # define putc(x,y) putc_unlocked (x,y) # endif # if HAVE_DECL_PUTCHAR_UNLOCKED # undef putchar # define putchar(x) putchar_unlocked (x) # endif # endif /* USE_UNLOCKED_IO */ #endif /* UNLOCKED_IO_H */ cmtk-3.0.0/Utilities/numdiff-5.2.1/util.c0000644000177700000170000002544311666247630016717 0ustar torstenman/* Support routines for GNU DIFF. Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU DIFF. GNU DIFF is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU DIFF 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file, coming from the source code of GNU DIFF, has been modified by Ivano Primi so that it could be merged into the source code of Numdiff. Numdiff is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Numdiff 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. */ #include "numdiff.h" #include #include /* Use when a system call returns non-zero status. NAME should normally be the file name. */ void perror_with_name (char const *name) { error (0, errno, "%s", name); } /* Use when a system call returns non-zero status and that is fatal. */ void pfatal_with_name (char const *name) { int e = errno; error (EXIT_TROUBLE, e, "%s", name); abort (); } /* Compare two lines (typically one from each input file) according to the command line options. For efficiency, this is invoked only when the lines do not match exactly but an option like -i might cause us to ignore the difference. Return nonzero if the lines differ. */ /* * lines_differ() is used in "inout.c" to compare lines coming possibly * from the same file. */ bool lines_differ (char const *s1, char const *s2, int index1, int index2, argslist* argl) { register char const *f1 = s1; register char const *f2 = s2; char *e1, *e2, ch1, ch2; unsigned long fieldno1, fieldno2; int f1_is_num, f2_is_num, f1_is_blurred, f2_is_blurred; /* Cache often-used quantities in local variables to help the compiler. */ int ignore_case = argl->optmask & _SI_MASK; char* ifs = (index1) ? argl->ifs2 : argl->ifs1; const struct numfmt* pnf = (index1) ? &argl->nf2 : &argl->nf1; unsigned char* ghostmask = (index1) ? argl->ghostmask2 : argl->ghostmask1; unsigned char* pblurmask = (index1) ? argl->pblurmask2 : argl->pblurmask1; unsigned char* tblurmask = (index1) ? argl->tblurmask2 : argl->tblurmask1; /* s1 */ char* Ifs = (index2) ? argl->ifs2 : argl->ifs1; const struct numfmt* Pnf = (index2) ? &argl->nf2 : &argl->nf1; unsigned char* Ghostmask = (index2) ? argl->ghostmask2 : argl->ghostmask1; unsigned char* Pblurmask = (index2) ? argl->pblurmask2 : argl->pblurmask1; unsigned char* Tblurmask = (index2) ? argl->tblurmask2 : argl->tblurmask1; /* s2 */ ifs = (!ifs) ? IFS : ifs; Ifs = (!Ifs) ? IFS : Ifs; for (; *f1 != '\n' && (strchr (ifs, *f1)); f1++); for (; *f2 != '\n' && (strchr (Ifs, *f2)); f2++); fieldno1 = fieldno2 = 0; while (*f1 != '\n' && *f2 != '\n') { /* Ignore the fields selected through the option -X */ while ( *f1 != '\n' && fieldno1 < 8*FIELDMASK_SIZE && (ghostmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) ) { /* First move `f1' to the begin of the next field */ for (; *f1 != '\n' && !strchr (ifs, *f1); f1++); for (; *f1 != '\n' && (strchr (ifs, *f1)); f1++); /* and then increment the field index */ fieldno1++; } if ( fieldno1 >= 8*FIELDMASK_SIZE ) { printf (_("Line \"%s\"\ncontains too many fields!\n"), s1); exit (EXIT_TROUBLE); } while ( *f2 != '\n' && fieldno2 < 8*FIELDMASK_SIZE && (Ghostmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) ) { /* First move `f2' to the begin of the next field */ for (; *f2 != '\n' && !strchr (Ifs, *f2); f2++); for (; *f2 != '\n' && (strchr (Ifs, *f2)); f2++); /* and then increment the field index */ fieldno2++; } if ( fieldno2 >= 8*FIELDMASK_SIZE ) { printf (_("Line \"%s\"\ncontains too many fields!\n"), s2); exit (EXIT_TROUBLE); } if (*f1 != '\n' && *f2 != '\n') { /* Find the ends of the fields */ for (e1 = (char*)f1; *e1 != '\n' && !strchr (ifs, *e1); e1++); for (e2 = (char*)f2; *e2 != '\n' && !strchr (Ifs, *e2); e2++); /* Mark the ends of the fields before calling acxnum(). But before doing this, save the original characters placed just after the fields. */ ch1 = *e1; ch2 = *e2; *e1 = *e2 = '\0'; /* Determine the types of the fields */ f1_is_num = acxnum (f1, pnf) >= e1; f2_is_num = acxnum (f2, Pnf) >= e2; /* Determine whether the fields are blurred or not */ f1_is_blurred = (tblurmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) || ((pblurmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) && (f1_is_num)); f2_is_blurred = (Tblurmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) || ((Pblurmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) && (f2_is_num)); if (f1_is_blurred != f2_is_blurred) return 1; else if ((f1_is_blurred)) { /* `f1' and `f2' are both blurred */ *e1 = ch1; *e2 = ch2; f1 = e1; f2 = e2; } else { /* Neither `f1' nor `f2' is blurred */ if (f1_is_num != f2_is_num) /* If one field is numeric but the other one not, then the two lines are surely different :) */ return 1; else if ( (f1_is_num) ) { /* If both fields are numeric, then perform a reduction to a standard numerical format before the byte-by-byte comparison. */ if ( (compare_numeric_strings (f1, pnf, f2, Pnf)) ) return 1; else { *e1 = ch1; *e2 = ch2; f1 = e1; f2 = e2; } } else { /* If the fields are not numeric, then go on with byte-by-byte comparison, */ *e1 = ch1; *e2 = ch2; if ((ignore_case)) for (; f1 < e1 && f2 < e2 && TOLOWER(*f1) == TOLOWER(*f2); f1++, f2++); else for (; f1 < e1 && f2 < e2 && *f1 == *f2; f1++, f2++); if (f1 < e1 || f2 < e2) return 1; /* else: We have automatically f1 == e1 && f2 == e2 */ } } /* Move to the next field and increase the field number */ for (; *f1 != '\n' && (strchr (ifs, *f1)); f1++); fieldno1++; for (; *f2 != '\n' && (strchr (Ifs, *f2)); f2++); fieldno2++; } /* End else --> if (*f1 != '\n' && *f2!= '\n') */ } /* end while (*f1 != '\n' && *f2 != '\n') */ /* Ignore the fields selected through the option -X */ while ( *f1 != '\n' && fieldno1 < 8*FIELDMASK_SIZE && (ghostmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) ) { /* First move `f1' to the begin of the next field */ for (; *f1 != '\n' && !strchr (ifs, *f1); f1++); for (; *f1 != '\n' && (strchr (ifs, *f1)); f1++); /* and then increment the field index */ fieldno1++; } if ( fieldno1 >= 8*FIELDMASK_SIZE ) { printf (_("Line \"%s\"\ncontains too many fields!\n"), s1); exit (EXIT_TROUBLE); } while ( *f2 != '\n' && fieldno2 < 8*FIELDMASK_SIZE && (Ghostmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) ) { /* First move `f2' to the begin of the next field */ for (; *f2 != '\n' && !strchr (Ifs, *f2); f2++); for (; *f2 != '\n' && (strchr (Ifs, *f2)); f2++); /* and then increment the field index */ fieldno2++; } if ( fieldno2 >= 8*FIELDMASK_SIZE ) { printf (_("Line \"%s\"\ncontains too many fields!\n"), s2); exit (EXIT_TROUBLE); } return (*f1 != *f2); } /* Divide SCRIPT into pieces by calling HUNKFUN and print each piece with PRINTFUN. Both functions take one arg, an edit script. HUNKFUN is called with the tail of the script and returns the last link that belongs together with the start of the tail. PRINTFUN takes a subscript which belongs together (with a null link at the end) and prints it. */ void print_script (struct change *script, void (*printfun) (struct change *)) { struct change *next = script; struct change *this; while ((next)) { this = next; /* Disconnect them from the rest of the changes, making them a hunk, and remember the rest for next iteration. */ next = this->link; this->link = 0; #ifdef _DEBUG_SCRIPT_ debug_script (this); #endif /* Print this hunk. */ (*printfun) (this); /* Reconnect the script so it will all be freed properly. */ this->link = next; } } /* Look at a hunk of edit script and report the range of lines in each file that it applies to. HUNK is the start of the hunk, which is a chain of `struct change'. The first and last line numbers of file 0 are stored in *FIRST0 and *LAST0, and likewise for file 1 in *FIRST1 and *LAST1. Note that these are internal line numbers that count from 0. If no lines from file 0 are deleted, then FIRST0 is LAST0+1. Return UNCHANGED if only ignorable lines are inserted or deleted, OLD if lines of file 0 are deleted, NEW if lines of file 1 are inserted, and CHANGED if both kinds of changes are found. */ enum changes analyze_hunk (struct change *hunk, lin *first0, lin *last0, lin *first1, lin *last1) { struct change *next; lin l0, l1; lin show_from, show_to; show_from = show_to = 0; *first0 = hunk->line0; *first1 = hunk->line1; next = hunk; do { l0 = next->line0 + next->deleted - 1; l1 = next->line1 + next->inserted - 1; show_from += next->deleted; show_to += next->inserted; } while ((next = next->link) != 0); *last0 = l0; *last1 = l1; return (show_from ? OLD : UNCHANGED) | (show_to ? NEW : UNCHANGED); } /* Yield a new block of SIZE bytes, initialized to zero. */ void * zalloc (size_t size) { void *p = xmalloc (size); memset (p, 0, size); return p; } #ifdef _DEBUG_SCRIPT_ void debug_script (struct change *sp) { fflush (stdout); for (; sp; sp = sp->link) { long line0 = sp->line0; long line1 = sp->line1; long deleted = sp->deleted; long inserted = sp->inserted; fprintf (stderr, "%3ld %3ld delete %ld insert %ld\n", line0, line1, deleted, inserted); } fflush (stderr); } #endif cmtk-3.0.0/Utilities/numdiff-5.2.1/errors.c0000644000177700000170000000445311666247630017254 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include #include #include "number.h" #ifndef STDC_HEADERS #define VARARGS 1 #else #undef VARARGS #endif #ifndef VARARGS #include #else #include #endif /* Other things for number.c. */ /* int std_only; */ void out_of_memory() { fprintf (stderr, _("%s: insufficient memory for new allocation,\nthe execution of the program ends now\n"), PACKAGE); exit (EXIT_TROUBLE); } /* Runtime error will print a message and stop the machine. */ #ifndef VARARGS #ifdef __STDC__ void rt_error (char *mesg, ...) #else void rt_error (mesg) char *mesg; #endif #else void rt_error (mesg, va_alist) char *mesg; #endif { va_list args; char error_mesg [255]; #ifndef VARARGS va_start (args, mesg); #else va_start (args); #endif vsprintf (error_mesg, mesg, args); va_end (args); fprintf (stderr, _("Runtime error: %s\n"), error_mesg); exit (EXIT_TROUBLE); } /* A runtime warning tells of some action taken by the processor that may change the program execution but was not enough of a problem to stop the execution. */ #ifndef VARARGS #ifdef __STDC__ void rt_warn (char *mesg, ...) #else void rt_warn (mesg) char *mesg; #endif #else void rt_warn (mesg, va_alist) char *mesg; #endif { va_list args; char error_mesg [255]; #ifndef VARARGS va_start (args, mesg); #else va_start (args); #endif vsprintf (error_mesg, mesg, args); va_end (args); fprintf (stderr, _("Runtime warning: %s\n"), error_mesg); } cmtk-3.0.0/Utilities/numdiff-5.2.1/cmpbuf.c0000644000177700000170000000741611666247630017216 0ustar torstenman/* Buffer primitives for comparison operations. Copyright (C) 1993, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if HAVE_CONFIG_H # include #endif #include #include #include #ifndef SA_RESTART # ifdef SA_INTERRUPT /* e.g. SunOS 4.1.x */ # define SA_RESTART SA_INTERRUPT # else # define SA_RESTART 0 # endif #endif #if HAVE_UNISTD_H # include #endif #if HAVE_INTTYPES_H # include #endif #include #include "cmpbuf.h" /* Determine whether an integer type is signed, and its bounds. This code assumes two's (or one's!) complement with no holes. */ /* The extra casts work around common compiler bugs, e.g. Cray C 5.0.3.0 when t == time_t. */ #ifndef TYPE_SIGNED # define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) #endif #ifndef TYPE_MINIMUM # define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \ : (t) 0)) #endif #ifndef TYPE_MAXIMUM # define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) #endif #ifndef PTRDIFF_MAX # define PTRDIFF_MAX TYPE_MAXIMUM (ptrdiff_t) #endif #ifndef SIZE_MAX # define SIZE_MAX TYPE_MAXIMUM (size_t) #endif #ifndef SSIZE_MAX # define SSIZE_MAX TYPE_MAXIMUM (ssize_t) #endif #undef MIN #define MIN(a, b) ((a) <= (b) ? (a) : (b)) /* Read NBYTES bytes from descriptor FD into BUF. NBYTES must not be SIZE_MAX. Return the number of characters successfully read. On error, return SIZE_MAX, setting errno. The number returned is always NBYTES unless end-of-file or error. */ size_t block_read (int fd, char *buf, size_t nbytes) { char *bp = buf; char const *buflim = buf + nbytes; size_t readlim = SSIZE_MAX; do { size_t bytes_to_read = MIN (buflim - bp, readlim); ssize_t nread = read (fd, bp, bytes_to_read); if (nread <= 0) { if (nread == 0) break; /* Accommodate Tru64 5.1, which can't read more than INT_MAX bytes at a time. They call that a 64-bit OS? */ if (errno == EINVAL && INT_MAX < bytes_to_read) { readlim = INT_MAX; continue; } /* This is needed for programs that have signal handlers on older hosts without SA_RESTART. It also accommodates ancient AIX hosts that set errno to EINTR after uncaught SIGCONT. See (1993-04-22). */ if (! SA_RESTART && errno == EINTR) continue; return SIZE_MAX; } bp += nread; } while (bp < buflim); return bp - buf; } /* Least common multiple of two buffer sizes A and B. However, if either A or B is zero, or if the multiple is greater than LCM_MAX, return a reasonable buffer size. */ size_t buffer_lcm (size_t a, size_t b, size_t lcm_max) { size_t lcm, m, n, q, r; /* Yield reasonable values if buffer sizes are zero. */ if (!a) return b ? b : 8 * 1024; if (!b) return a; /* n = gcd (a, b) */ for (m = a, n = b; (r = m % n) != 0; m = n, n = r) continue; /* Yield a if there is an overflow. */ q = a / n; lcm = q * b; return lcm <= lcm_max && lcm / b == q ? lcm : a; } cmtk-3.0.0/Utilities/numdiff-5.2.1/exitfail.h0000644000177700000170000000150311666247630017543 0ustar torstenman/* Failure exit status Copyright (C) 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ extern int volatile exit_failure; cmtk-3.0.0/Utilities/numdiff-5.2.1/io.c0000644000177700000170000000670111666247630016345 0ustar torstenman/* Numdiff - compare putatively similar files, ignoring small numeric differences Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License along with this program. If not, see . */ #include #include #include #include"numdiff.h" #ifdef _DMALLOC_ #include /* Useful only for the debugging */ #endif #include"read_line.c" static void print_head (const char* str, size_t length) { const char* t; for (t = str; t - str < length; putchar(*t), t++); } static void print_ws (unsigned n) { while ((n--)) putchar (' '); } static void writeln (const char* line, int addemptyline) { const char *ptr; for (ptr = line; *ptr != '\0'; putchar(*ptr), ptr++); if (ptr == line || *(ptr-1) != '\n') puts (EOF_INDICATOR); if ((addemptyline)) putchar('\n'); } /* This function assumes that at least one between line1 and line2 is not empty (!NULL). */ void print_lines (const char* line1, const char* line2, unsigned long lineno1, unsigned long lineno2, int delimiter_only) { puts (LINE_SEP); if (!delimiter_only) { if (!line1) { printf (" <==\n##%-7lu ==> ", lineno2); writeln (line2, 1); } else if (!line2) { printf ("##%-7lu <== ", lineno1); writeln (line1, 0); printf (" ==>\n\n"); } else { printf ("##%-7lu <== ", lineno1); writeln (line1, 0); printf ("##%-7lu ==> ", lineno2); writeln (line2, 1); } } } /* This function assumes that at least one between field1 and field2 is not empty. */ void print_fields (const char* field1, const char* field2, size_t l1, size_t l2, unsigned long lineno1, unsigned long lineno2, unsigned long fieldno1, unsigned long fieldno2) { fieldno1++; /* The field number must start from 1, not from 0 */ fieldno2++; /* The field number must start from 1, not from 0 */ if (*field1 == '\0') { printf ("##%-7lu <==\n##%-7lu #>%-3lu ==> ", lineno1, lineno2, fieldno2); /* length(" #> ") + 3 = 7 white spaces before the arrow */ writeln (field2, 0); } else if (*field2 == '\0') { printf ("##%-7lu #>%-3lu <== ", lineno1, fieldno1); writeln (field1, 0); /* length(" #> ") + 3 = 7 white spaces before the arrow */ printf ("##%-7lu ==>\n", lineno2); } else { printf ("##%-7lu #:%-3lu <== ", lineno1, fieldno1); print_head (field1, l1); putchar ('\n'); printf ("##%-7lu #:%-3lu ==> ", lineno2, fieldno2); print_head (field2, l2); putchar ('\n'); } } void print_errors (Real abserr, Real relerr) { fputs (_("@ Absolute error = "), stdout); printno (abserr, DEF_LIM); fputs (_(", Relative error = "), stdout); printno (relerr, DEF_LIM); putchar ('\n'); } void print_separator (void) { putchar ('@'); print_ws (53); puts ("@@"); } cmtk-3.0.0/Utilities/numdiff-5.2.1/docs/0000755000177700000170000000000012263615445016513 5ustar torstenmancmtk-3.0.0/Utilities/numdiff-5.2.1/docs/fdl.texi0000644000177700000170000005601511666247630020165 0ustar torstenman@c The GNU Free Documentation License. @center Version 1.3, 3 November 2008 @c This file is intended to be included within another document, @c hence no sectioning command or @node. @display Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. @uref{http://fsf.org/} Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @end display @enumerate 0 @item PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document @dfn{free} in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of ``copyleft'', which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. @item APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The ``Document'', below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as ``you''. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A ``Modified Version'' of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A ``Secondary Section'' is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The ``Invariant Sections'' are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The ``Cover Texts'' are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A ``Transparent'' copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not ``Transparent'' is called ``Opaque''. Examples of suitable formats for Transparent copies include plain @sc{ascii} without markup, Texinfo input format, La@TeX{} input format, @acronym{SGML} or @acronym{XML} using a publicly available @acronym{DTD}, and standard-conforming simple @acronym{HTML}, PostScript or @acronym{PDF} designed for human modification. Examples of transparent image formats include @acronym{PNG}, @acronym{XCF} and @acronym{JPG}. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, @acronym{SGML} or @acronym{XML} for which the @acronym{DTD} and/or processing tools are not generally available, and the machine-generated @acronym{HTML}, PostScript or @acronym{PDF} produced by some word processors for output purposes only. The ``Title Page'' means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, ``Title Page'' means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The ``publisher'' means any person or entity that distributes copies of the Document to the public. A section ``Entitled XYZ'' means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as ``Acknowledgements'', ``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' of such a section when you modify the Document means that it remains a section ``Entitled XYZ'' according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. @item VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. @item COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. @item MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: @enumerate A @item Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. @item List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. @item State on the Title page the name of the publisher of the Modified Version, as the publisher. @item Preserve all the copyright notices of the Document. @item Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. @item Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. @item Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. @item Include an unaltered copy of this License. @item Preserve the section Entitled ``History'', Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled ``History'' in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. @item Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the ``History'' section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. @item For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. @item Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. @item Delete any section Entitled ``Endorsements''. Such a section may not be included in the Modified Version. @item Do not retitle any existing section to be Entitled ``Endorsements'' or to conflict in title with any Invariant Section. @item Preserve any Warranty Disclaimers. @end enumerate If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled ``Endorsements'', provided it contains nothing but endorsements of your Modified Version by various parties---for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. @item COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled ``History'' in the various original documents, forming one section Entitled ``History''; likewise combine any sections Entitled ``Acknowledgements'', and any sections Entitled ``Dedications''. You must delete all sections Entitled ``Endorsements.'' @item COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. @item AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an ``aggregate'' if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. @item TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled ``Acknowledgements'', ``Dedications'', or ``History'', the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. @item TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. @item FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See @uref{http://www.gnu.org/copyleft/}. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License ``or any later version'' applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. @item RELICENSING ``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A ``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the site means any set of copyrightable works thus published on the MMC site. ``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. ``Incorporate'' means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is ``eligible for relicensing'' if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. @end enumerate @page @heading ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: @smallexample @group Copyright (C) @var{year} @var{your name}. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end group @end smallexample If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the ``with@dots{}Texts.'' line with this: @smallexample @group with the Invariant Sections being @var{list their titles}, with the Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}. @end group @end smallexample If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. @c Local Variables: @c ispell-local-pdict: "ispell-dict" @c End: cmtk-3.0.0/Utilities/numdiff-5.2.1/docs/numdiff.txi0000644000177700000170000036437011666247630020711 0ustar torstenman\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename numdiff.info @settitle Numdiff Manual 5.2 @afourpaper @c %**end of header @dircategory Text creation and manipulation @direntry * Numdiff: (numdiff). Comparing files containing numeric fields (and not only) @end direntry @copying @emph{``...und der eignen Kraft vertrauend steigt ein frei Geschlecht empor!''} @sp 2 @noindent This manual describes how to install and use Numdiff, a program which compares putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. Copyright @copyright{} 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi @email{ivprimi(at)libero(dot)it} @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being "Numdiff User Manual, version 5.2", and with no Back-Cover Texts. A copy of the license is included in @ref{GNU Free Documentation License}. @end quotation @end copying @titlepage @title Numdiff User Manual, version 5.2 @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c Output the table of the contents at the beginning. @contents @ifnottex @node Top, Copying, (dir), (dir) @top Numdiff User Manual @insertcopying @end ifnottex @menu * Copying:: Numdiff Copying Conditions (GPL) * Acknowledgments:: Acknowledgments * Overview:: Introduction to numdiff * Installing:: How to install numdiff * Invoking numdiff:: How to use numdiff * ndselect:: (numdiff) ndselect. Selecting lines * Invoking ndselect:: How to use ndselect * Filtering:: How to use the filter of numdiff * Warnings:: Various recommendations * GNU Free Documentation License:: The license covering this document * Index:: Complete index @end menu @node Copying, Acknowledgments, Top, Top @chapter Copying @cindex Copying Conditions @cindex License @cindex GNU General Public License @cindex GPL Numdiff (also written numdiff) is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Numdiff 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 General Public License along with this program. If not, see @uref{http://www.gnu.org/licenses/}. @node Acknowledgments, Overview, Copying, Top @chapter Acknowledgments @cindex Acknowledgments @cindex Thanks I want to thank Mr. Norman Clerman @email{norm(dot)opcon(at)fuse(dot)net} for several suggestions he gave me to improve the readability and the effectiveness of the output produced by Numdiff. He also pointed out the need to implement a filter to resynchronize the lines between two files in case of addition or deletion of one or more lines. I have to give him credit for the urge to prepare the versions 4.x and 5.x of Numdiff. Moreover, I want to thank my friends Mariapia Palombaro, since she removed some errors while reviewing the first version of this document, and Paolo Caramanica, who suggested me to add more information to the output of the option @option{-S}. @node Overview, Installing, Acknowledgments, Top @chapter Overview @cindex Overview @cindex Usage of numdiff @cindex Purposes @cindex How to use numdiff Computer users often find occasion to ask how two files differ. Perhaps one file is a newer version of the other file. Or maybe the two files started out as identical copies but were changed by different people. There are several ways to think about the differences between two files. One way to think of the differences is as a series of lines that were deleted from, inserted in, or changed in one file to produce the other file. The well-known @command{diff} program compares two files line by line, finds groups of lines that differ, and reports each group of differing lines. Without particular options, the @command{diff} program considers any change in the amount or in the type of the characters as a relevant difference. However, trough some command line options it also provides ways to suppress certain kinds of differences that are not important to the user. For instance, @command{diff} provides ways to ignore differences in the amount of white space between words or lines, or differences in alphabetic case. Another way to think of the differences is as a series of words that were deleted from, inserted in, or changed in one file to produce the other file. Here ``word'' refers to a sequence of non white-space characters delimited by a couple of white-spaces, one before and the other one after the word. The less known @command{wdiff} program by Franc,ois Pinard @email{pinard(at)iro(dot)umontreal(dot)ca} compares words in two files and reports the differences. At last, one can think of the differences between two files as a sequence of pairs of bytes that can be either identical or different. The @command{cmp} program reports the differences between two files byte by byte, instead of line by line or word by word. As a result, it is often more useful than @command{diff} or @command{wdiff} for comparing binary files. However, none of these approaches turns out to be good when you want to compare a couple of text files composed partially or entirely by numerical fields. Indeed, when you compare a couple of such files, what you want to obtain usually is a list of the numerical fields in the second file which @strong{numerically} differ from the corresponding fields in the first file. But, as you probably knows, a same number can be written using different notations and programs like @command{diff} or @command{wdiff} can not recognize whether a difference between two numeric fields is only due to the notation or is actually a difference of numerical values. For instance, 11.23 and 11.2300000 are the same number but represented in different ways. While, if you are interested in the numerical values, it is obvious that the difference in the representation is not meaningful and then it should be ignored, however @command{diff} and @command{wdiff} consider the previous one as a relevant difference and there is no way for you to tell these programs to ignore it ! Another example of this type is given by 98765.4321 and 9.87654321E04 where the difference is only due to the use of the scientific notation in place of the ordinary decimal notation. Moreover, depending on your country you could stick to different conventions in writing numbers. For instance, the amount ``three hundred millions and fifty-two thousands of dollars and forty-six cents'' is usually written by an Italian accountant as 300.052.000,46$ while an American accountant would write 300,052,000.46$. Of course, 300.052.000,46$ and 300,052,000.46$ represent the same amount of money but @command{diff} and @command{wdiff} would report a difference, which probably is not what you want in a similar case. At last, sometimes you could want to ignore even differences in numerical values as long as they do not overcome a certain threshold. In other words, you could desire to suppress all ``small'' numerical differences too. For instance, it could happen that you want to ignore all numerical differences whose absolute value is not greater than 0.0001. If this is the case, then the numerical fields 33 and 33.00009 must be considered equal, while 33 and 33.00011 must be reported as different. However, @command{diff} and @command{wdiff} can not be used to ignore ``small'' numerical differences, since they do not even know what a numerical difference is. What I have been saying till now explains why I decided to implement a new program with the capability to ``appropriately'' compare files containing numerical fields. In writing this program I was inspired by @command{ndiff}, a GPL'ed software by Nelson H. Baabe of the Salt Lake City University. The author of @command{ndiff} had the same good reasons as me to write @command{ndiff}. @command{ndiff} is actually a good tool and I used it for a while. But I did not completely like the way it works and so @command{numdiff} was born. Although @command{ndiff} inspired @command{numdiff}, they are completely different from the viewpoint of the source code: @command{numdiff} has been entirely written from scratch with the addition of code coming from GNU bc, GNU diff and GNUlib. In addition, the last versions of Numdiff offer much more features than @command{ndiff} does. @command{numdiff} can be used to compare putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. @command{numdiff} takes two mandatory arguments, the paths of the two files to compare, and, after splitting them into lines and the lines into fields according to a given list of field delimiters, it compares every field of every line of the first file with the corresponding field of the second file. What @emph{corresponding} here exactly means depends on the options passed to the program on the command line. With no options, corresponding means the field of the second file at the same position, where position refers both to the line number and to the location within the line. If the compared fields are both legal numerical values, then @command{numdiff} performs a numerical comparison between them, else it performs a literal comparison, i.e. the usual byte by byte comparison. In case of literal comparison, two fields are regarded as equal if they are formed by the same sequence of characters. In case of numerical comparison and without specific command line options, two fields are regarded as equal if their numerical difference is zero. Be careful ! If you do not explicitly specify a list of field delimiters by the option @option{-s}, then @command{numdiff} takes as field delimiters the characters newline (@samp{\n}, ASCII code 0x0A), horizontal tabulation (@samp{\t}, ASCII code 0x09), and blank (@samp{ }, ASCII code 0x20). For instance, if the file @file{list1} contains the data @verbatim accident 123 23Joshua 34.55 +3+4i water dog -3455.321 cat 2.345678e-9 .0005-6.23e2i @end verbatim @noindent and file @file{list2} contains the data @verbatim Accident 123 23456 34.5500 +3.0001+4i dog -3455.320098 Cat +2.345678e-9 -6.23e2i $$$ A new line @end verbatim @noindent then the output of the command @samp{numdiff list1 list2} will be: @example ---------------- ##1 #:1 <== accident ##1 #:1 ==> Accident @@ @@@@ ##1 #:3 <== 23Joshua ##1 #:3 ==> 23456 @@ @@@@ ##1 #:5 <== +3+4i ##1 #:5 ==> +3.0001+4i @@ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5 ##1 #>6 <== water ##1 ==> @@ Line 1 in file "list2" is shorter than expected! ---------------- ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @@ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 ##2 #:3 <== cat ##2 #:3 ==> Cat @@ @@@@ ##2 #:5 <== .0005-6.23e2i ##2 #:5 ==> -6.23e2i @@ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7 ##2 <== ##2 #>6 ==> $$$ @@ Line 2 in file "list1" is shorter than expected! ---------------- ##3 <== ##3 #>1 ==> A new line @@ Line 3 in file "list1" is shorter than expected! ---------------- <== ##4 ==> +++ File "list1" differs from file "list2" @end example At the same time @command{numdiff} will print the following error message on stderr: @example *** End of file "list1" reached Likely the files "list1" and "list2" do not have the same number of lines ! @end example It is worth remarking that @command{numdiff} can recognize complex numbers, provided that they are written in the form @math{a+bi} or @math{a-bi} with no extra characters between the values @math{a}, @math{b} and the sign @math{+} or @math{-} (the symbol @math{i} used to represent the imaginary unit can be actually changed by a suitable command line option, @pxref{Invoking numdiff}). If you do not know what complex numbers are, do not worry! In this case probably you will never manage files containing complex numbers and so you can happily continue to ignore them. :) Let us consider now an example which shows how Numdiff can resynchronize the lines between two files in case of addition or deletion of one or more lines. The versions of Numdiff prior to 5 did not work well if one of the two files to compare contains in the middle some lines more or less than the other one. For instance, if you have one file that is 1000 lines long that you are comparing to a second file 1001 lines long, and except for that one extra line, located, let us say, at line 500, the files are identical, then @command{numdiff} version 4.x does @strong{not} show only the one line difference: once the files are out of synchronization @command{numdiff} 4.x reports every line as different. Since version 5 it is possible in such cases to activate a filter which handles additions and deletions of lines. There are several options ruling how the filter actually works and I will give later a detailed explanation on how to use them to obtain each time the wished result. The simplest way to activate the filter consists in using the option @option{-z @@}. If @file{bill1} and @file{bill2} are given by @verbatim Month Expenses ------------------------- Jan09 $ 233.56 Feb09 $ 850.77 Mar09 $ 12.55 Apr09 $ 524.00 May09 $ 78.25 Jun09 $ 230.00 Jul09 $ 443.10 Aug09 $ 67.65 Sep09 $ 10.00 Oct09 $ 201.45 Nov09 $ 110.00 Dec09 $ 200.27 ------------------------- Total $ 2961.60 @end verbatim @noindent and @verbatim Month Expenses Jan09 $ 234.00 Mar09 $ 13.00 May09 $ 78.25 Jul09 $ 443.10 Sep09 $ 10.00 Nov09 $ 110.00 Jan10 $ 200.00 ------------------------- Total $ 1088.35 @end verbatim @noindent respectively, then the differences between the two files are: @itemize @item the insertion of the separator @verb{|-------------------------|} in @file{bill1} before the list of the months, @item the deletion in @file{bill2} of the lines related to the expenses for the months February, April, June, August, October, December, @item small changes in @file{bill2} to the expenses of the months January (2009) and March, @item the presence in @file{bill2} of an entry for January 2010 just before the separator @verb{|-------------------------|}, @item the addition of an empty line to @file{bill2} after the separator @verb{|-------------------------|}, @item and the different values for the total sum of the expenses. @end itemize The output of the command @samp{numdiff -z @@ -V bill1 bill2} (I have added here the option @option{-V} to let Numdiff show which couples of lines it is comparing each time) is exactly then what you expect: @anchor{command} @example ---------------- ##2 <== ------------------------- ==> ---------------- ##3 <== Jan09 $ 233.56 ##2 ==> Jan09 $ 234.00 ##3 #:3 <== 233.56 ##2 #:3 ==> 234.00 @@ Absolute error = 4.4000000000e-1, Relative error = 1.8838842268e-3 ---------------- ##4 <== Feb09 $ 850.77 ==> ---------------- ##5 <== Mar09 $ 12.55 ##3 ==> Mar09 $ 13.00 ##5 #:3 <== 12.55 ##3 #:3 ==> 13.00 @@ Absolute error = 4.5000000000e-1, Relative error = 3.5856573705e-2 ---------------- ##6 <== Apr09 $ 524.00 ==> ---------------- ##8 <== Jun09 $ 230.00 ==> ---------------- ##10 <== Aug09 $ 67.65 ==> ---------------- ##12 <== Oct09 $ 201.45 ==> ---------------- ##14 <== Dec09 $ 200.27 ##8 ==> Jan10 $ 200.00 ##14 #:1 <== Dec09 ##8 #:1 ==> Jan10 @@ @@@@ ##14 #:3 <== 200.27 ##8 #:3 ==> 200.00 @@ Absolute error = 2.7000000000e-1, Relative error = 1.3500000000e-3 ---------------- <== ##10 ==> ---------------- ##16 <== Total $ 2961.60 ##11 ==> Total $ 1088.35 ##16 #:3 <== 2961.60 ##11 #:3 ==> 1088.35 @@ Absolute error = 1.8732500000e+3, Relative error = 1.7211834428e+0 +++ File "bill1" differs from file "bill2" @end example Numdiff has reported correctly the following differences: @itemize @item the second line of file @file{bill1}, i.e. the one containing the separator, has no correspondance, or, if you prefer, has been deleted from file @file{bill2}. @item The lines related to the months January 2009 and March have been slightly modified in @file{bill2}, namely the values of the expenses are slightly different. Notice that the line with the expenses for January 2009 is the third one in file @file{bill1} and the second one in file @file{bill2}. This information is printed by Numdiff in the form @example ##3 <== Jan09 $ 233.56 ##2 ==> Jan09 $ 234.00 @end example Analogously @example ##5 <== Mar09 $ 12.55 ##3 ==> Mar09 $ 13.00 @end example says that the line for March is the fifth one in @file{bill1} and the third one in @file{bill2}. @item The line related to the total amount of the expenses appears also differently in the two files, since the amount of the expenses is different. Notice that this line is the 16th one in file @file{bill1} and the 11th one in file @file{bill2}. @item The lines related to the months February, April, June, August and October, i.e. the lines no. 4, 6, 8, 10 and 12 of @file{bill1}, are not present in @file{bill2}. @item The line of @file{bill1} with the expenses for December 2009 is replaced in @file{bill2} by the line containing the value of the expenses for January 2010. @item The tenth line of @file{bill2}, i.e. the empty line after the separator, is not present in @file{bill1}. With respect to @file{bill1} this line represents then an addition. @end itemize However, if you compare @file{bill1} and @file{bill2} without using the option @option{-z @@}, the result is completely misleading. This is the output of @samp{numdiff -V bill1 bill2}: @example ---------------- ##2 <== ------------------------- ##2 ==> Jan09 $ 234.00 ##2 #:1 <== ------------------------- ##2 #:1 ==> Jan09 @@ @@@@ ##2 <== ##2 #>2 ==> $ 234.00 @@ Line 2 in file "bill1" is shorter than expected! ---------------- ##3 <== Jan09 $ 233.56 ##3 ==> Mar09 $ 13.00 ##3 #:1 <== Jan09 ##3 #:1 ==> Mar09 @@ @@@@ ##3 #:3 <== 233.56 ##3 #:3 ==> 13.00 @@ Absolute error = 2.2056000000e+2, Relative error = 1.6966153846e+1 ---------------- ##4 <== Feb09 $ 850.77 ##4 ==> May09 $ 78.25 ##4 #:1 <== Feb09 ##4 #:1 ==> May09 @@ @@@@ ##4 #:3 <== 850.77 ##4 #:3 ==> 78.25 @@ Absolute error = 7.7252000000e+2, Relative error = 9.8724600639e+0 ---------------- ##5 <== Mar09 $ 12.55 ##5 ==> Jul09 $ 443.10 ##5 #:1 <== Mar09 ##5 #:1 ==> Jul09 @@ @@@@ ##5 #:3 <== 12.55 ##5 #:3 ==> 443.10 @@ Absolute error = 4.3055000000e+2, Relative error = 3.4306772908e+1 ---------------- ##6 <== Apr09 $ 524.00 ##6 ==> Sep09 $ 10.00 ##6 #:1 <== Apr09 ##6 #:1 ==> Sep09 @@ @@@@ ##6 #:3 <== 524.00 ##6 #:3 ==> 10.00 @@ Absolute error = 5.1400000000e+2, Relative error = 5.1400000000e+1 ---------------- ##7 <== May09 $ 78.25 ##7 ==> Nov09 $ 110.00 ##7 #:1 <== May09 ##7 #:1 ==> Nov09 @@ @@@@ ##7 #:3 <== 78.25 ##7 #:3 ==> 110.00 @@ Absolute error = 3.1750000000e+1, Relative error = 4.0575079872e-1 ---------------- ##8 <== Jun09 $ 230.00 ##8 ==> Jan10 $ 200.00 ##8 #:1 <== Jun09 ##8 #:1 ==> Jan10 @@ @@@@ ##8 #:3 <== 230.00 ##8 #:3 ==> 200.00 @@ Absolute error = 3.0000000000e+1, Relative error = 1.5000000000e-1 ---------------- ##9 <== Jul09 $ 443.10 ##9 ==> ------------------------- ##9 #:1 <== Jul09 ##9 #:1 ==> ------------------------- @@ @@@@ ##9 #>2 <== $ 443.10 ##9 ==> @@ Line 9 in file "bill2" is shorter than expected! ---------------- ##10 <== Aug09 $ 67.65 ##10 ==> ##10 #>1 <== Aug09 $ 67.65 ##10 ==> @@ Line 10 in file "bill2" is shorter than expected! ---------------- ##11 <== Sep09 $ 10.00 ##11 ==> Total $ 1088.35 ##11 #:1 <== Sep09 ##11 #:1 ==> Total @@ @@@@ ##11 #:3 <== 10.00 ##11 #:3 ==> 1088.35 @@ Absolute error = 1.0783500000e+3, Relative error = 1.0783500000e+2 ---------------- ##12 <== Oct09 $ 201.45 ==> *** End of file "bill2" reached Likely the files "bill1" and "bill2" do not have the same number of lines ! +++ File "bill1" differs from file "bill2" @end example Numdiff compares now the first, second, third line of @file{bill1} with the first, second, third line of @file{bill2} and so on. But this is not probably what you want in such a case: what is reasonable here is to compare entries related to the same month and not lines having the same location (i.e. line number). Numdiff offers also an option to run just the filter and see how it resynchronizes the two given files without doing any comparison between corresponding lines. The output of @samp{numdiff -z @@ -f bill1 bill2} is @example Month Expenses Month Expenses ------------------------- < Jan09 $ 233.56 Jan09 $ 234.00 Feb09 $ 850.77 < Mar09 $ 12.55 Mar09 $ 13.00 Apr09 $ 524.00 < May09 $ 78.25 May09 $ 78.25 Jun09 $ 230.00 < Jul09 $ 443.10 Jul09 $ 443.10 Aug09 $ 67.65 < Sep09 $ 10.00 Sep09 $ 10.00 Oct09 $ 201.45 < Nov09 $ 110.00 Nov09 $ 110.00 Dec09 $ 200.27 | Jan10 $ 200.00 ------------------------- ------------------------- > Total $ 2961.60 Total $ 1088.35 +++ File "bill1" differs from file "bill2" @end example @noindent and shows that the filter is doing its job in the right way, associating the lines according to the month and not to the line number. Running just the filter is extremely useful in all situations when you are not sure if the filter is working as you wish. You have indeed to instruct the filter in the right way to let it work correctly, and this requires the use of different options depending on the structure of the files to compare. Since to guess the right options can be sometime tricky, running just the filter and see the result is the best way to be certain that you are setting up everything correctly. Later, @pxref{Filtering}, I will explain in detail @itemize @item what the filter does behind the scenes to understand if and how it has to resynchronize the files to compare, @item and how the related options affect the action of the filter. @end itemize By the way, it is even possible to use @option{-f} without any other additional option for the filter, like in @samp{numdiff -f bill1 bill2}, but the result is more or less the same you would obtain by performing a byte by byte comparison with removal of the field delimiters. The option @option{-f} can be followed by an argument in the form of an integer number whose meaning will be explained later, @pxref{Use of the option -f}. Even if the output of @command{numdiff} is self-explanatory, in the next section I will explain in details all you have to know about it. @menu * Output format:: How numdiff prints its reports on stdout @end menu @node Output format, , , Overview @section Output format @cindex Output format (numdiff) @cindex Format of the reports Let us go back to our first example. If the files @file{list1} and @file{list2} contain the data @verbatim accident 123 23Joshua 34.55 +3+4i water dog -3455.321 cat 2.345678e-9 .0005-6.23e2i @end verbatim @noindent and @verbatim Accident 123 23456 34.5500 +3.0001+4i dog -3455.320098 Cat +2.345678e-9 -6.23e2i $$$ A new line @end verbatim @noindent respectively, then the output of the command @samp{numdiff list1 list2} will be: @example ---------------- ##1 #:1 <== accident ##1 #:1 ==> Accident @@ @@@@ ##1 #:3 <== 23Joshua ##1 #:3 ==> 23456 @@ @@@@ ##1 #:5 <== +3+4i ##1 #:5 ==> +3.0001+4i @@ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5 ##1 #>6 <== water ##1 ==> @@ Line 1 in file "list2" is shorter than expected! ---------------- ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @@ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 ##2 #:3 <== cat ##2 #:3 ==> Cat @@ @@@@ ##2 #:5 <== .0005-6.23e2i ##2 #:5 ==> -6.23e2i @@ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7 ##2 <== ##2 #>6 ==> $$$ @@ Line 2 in file "list1" is shorter than expected! ---------------- ##3 <== ##3 #>1 ==> A new line @@ Line 3 in file "list1" is shorter than expected! ---------------- <== ##4 ==> +++ File "list1" differs from file "list2" @end example @command{numdiff} prints a report on the standard output for every field of the first file which differs from the corresponding field of the second one. First this report indicates the locations of the fields, namely the numbers of the lines where the fields appear and their positions within the line. The position in the line is ``1'' for the first field of a line, ``2'' for the second field, ``3'' for the third one and so on: fields are numerated starting from the left hand of the line and proceeding towards the right hand. For each report the line number is introduced by the symbol ``##'', while the field number by ``#:''. Then @command{numdiff} shows in what the difference consists. For instance, @example ##1 #:1 <== accident ##1 #:1 ==> Accident @@ @@@@ @end example @noindent means that the first field of the first line is ``accident'' in the first file, while in the second file it appears as ``Accident''. This difference could be then canceled by removing ``accident'' from the first file and inserting ``Accident'' in place of it. The arrows ``<=='' and ``==>'' try to visualize this idea. Analogously, @example ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @@ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 @end example @noindent means that the second field of the second line is ``-3455.321'' in the first file and ``-3455.320098'' in the second one. Since the contents of the field are numerical in both files, @command{numdiff} also prints the absolute and relative errors. The absolute error (or absolute difference) is given by the absolute value of the difference between the values appearing in the two files. The relative error (or relative difference) is actually defined in a more complicated way. If @emph{n1} is the value appearing in the first file and @emph{n2} is the value in the second file, then the absolute error is given by the formula @emph{A=|n1-n2|}, while the relative error @emph{R} is given by: @itemize @item @emph{R = 0} if @emph{n1} and @emph{n2} are equal, @item @emph{Inf} (infinity) if @emph{n2} differs from @emph{n1} and at least one of them is zero, @item @emph{R = A/ min(|n1|, |n2|)} if @emph{n1} and @emph{n2} are both non zero and @emph{n2} differs from @emph{n1}. @emph{min(|n1|, |n2|)} denotes the minimum between the absolute value of @emph{n1} and the absolute value of @emph{n2}. @end itemize @noindent With these definitions of absolute and relative error it turns out that @emph{A(n2, n1) = A(n1, n2)} and @emph{R(n2, n1) = R(n1, n2)}. In other words, the absolute/relative error does not change if you only change the order of the compared values. Since version 5 it is actually possible to let Numdiff compute the relative error always with respect to the value from the first file or always with respect to the value from the second file, instead of using the preceding formula. This can be done through the option @option{-r} by writing its argument in a special form, @pxref{Alternative formulas for the computation of the relative difference}. If at least one of the compared fields is not numerical, then the output line reporting absolute and relative errors is replaced by the separator: @verbatim @ @@ @end verbatim It can happen that a line in one of the two files to compare contains more fields than the corresponding line of the other file. When this is the case, @command{numdiff} reports this difference by telling that a certain line (identified by its line number) appears to be shorter than expected, just as in @example ##1 #>6 <== water ##1 ==> @@ Line 1 in file "list2" is shorter than expected! @end example or in @example ##3 <== ##3 #>1 ==> A new line @@ Line 3 in file "list1" is shorter than expected! @end example In addition, @command{numdiff} shows the @i{tail} of the longer line, using the notation ``#>@math{n}'' to indicate the number @math{n} of the first field of the longer line for which there is no corresponding field in the shorter line. For instance, @example ##1 #>6 <== water ##1 ==> @@ Line 1 in file "list2" is shorter than expected! @end example @noindent means that for none of the fields of the first line starting from the sixth one there exists a corresponding field in the second file (@file{list2}). In this context, the symbol @verb{|<<*>>|} (when it appears) is used to denote the End-Of-File, i.e. a line or the tail of a line which is located at the end of the corresponding file and does not have a terminating @emph{newline} character. It can also happen that one of the two files to compare has less lines than the other one. In this case, if no special option is passed to the program, @command{numdiff} prints the number of the first line which appears in only one of the two files. Moreover, it prints on the standard error a message telling in which of the two files the end has been prematurely reached: @example *** End of file "list1" reached Likely the files "list1" and "list2" do not have the same number of lines ! @end example Unless the option @option{-q} is used (@pxref{Invoking numdiff}), @command{numdiff} prints on standard output a message reporting the final status of the comparison. This message says either the two files are equal or they are different, just as in the example we are considering: @example +++ File "list1" differs from file "list2" @end example The output produced just by running the filter is a side by side difference listing of the two compared files, like the one displayed by GNU sdiff. The files are listed in two columns with a gutter between them. The gutter contains one of the following markers: @table @samp @item white space The corresponding lines are in common. That is, either the lines are identical, or the difference is ignored because of one of the options @option{-I}, @option{-X}, @option{-z} and @option{-Z}. @item | The corresponding lines differ, and they are either both complete or both incomplete. @item < @itemx ( The files differ and only the first file contains the line. @item > @itemx ) The files differ and only the second file contains the line. @item \ The corresponding lines differ, and only the first line is incomplete. @item / The corresponding lines differ, and only the second line is incomplete. @end table An input line is incomplete if its last character is not a newline. This can happen only if the line is the last one of its file. When an output line of the side by side difference listing represents two differing lines, one might be incomplete while the other is not. In this case the gutter is marked @samp{\} if the line from the first file is incomplete, @samp{/} if the line from the second file is. Side by side format is easy to read, but it has limitations. It generates much wider output than usual, and truncates lines that are too long to fit. Also, it relies on lining up output quite heavily, so its output looks particularly bad if you use varying width fonts, nonstandard tab stops, or nonprinting characters. The option @option{-f} can take an optional argument, which allows to set the width of the output and eventually to suppress common lines, @pxref{Invoking numdiff} and @ref{Use of the option -f}. More generally, the user can always make @command{numdiff} avoid to print, partially or totally, the messages that it would otherwise send to standard output. This can be achieved by some suitable command line options, @pxref{Invoking numdiff}. @node Installing, Invoking numdiff, Overview, Top @chapter Installing @cindex Install @cindex Compile @cindex Build To successfully compile, build and install Numdiff some tools are required. The first one is an ANSI C compiler. This compiler should at least accept the option @option{-o} to write its output to a specified file, the option @option{-D} for macros predefinition, the option @option{-l} to search for a specified library, and the options @option{-I} and @option{-L} to add a given directory to the search path for include and library files respectively. Numdiff has been successfully compiled and tested on Slackware@registeredsymbol{} GNU/Linux 10.2 with the version 3.3.6 of the GNU C Compiler (GCC), on Slackware GNU/Linux 11 with GCC 3.4.6, on Slackware GNU/Linux 12.2 with GCC 4.2.4, on Slackware GNU/Linux 13 with GCC 4.3.3, on Debian@registeredsymbol{} GNU/Linux 4.0 with GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21), on SunOS@registeredsymbol{} 5.8 with GCC 2.95.3, and on SunOS 5.10 (i386) with the version 5.9 of the Sun C compiler. Moreover, you need a POSIX implementation of the @command{make} utility (I used both GNU make and smake by Joerg Schilling to compile Numdiff) and a POSIX implementation of the commands @command{rm} and @command{find}. At last, you need a proper installation of GNU Texinfo (in order to install the info documentation) and a shell sh-compatible. Configuration, building and installation of Numdiff can be performed through the standard three steps: @example ./configure make make install @end example @noindent If you leave enabled the Natural Language Support and you also want to install the localization files (at the moment only the Italian localization is supplied), then, after @samp{make}, you will have to type and run @example make install-nls @end example By default, @samp{make install} will install all the files in @file{/usr/local/bin}, @file{/usr/local/info} etc. You can specify an installation prefix other than @file{/usr/local} using the option @option{--prefix} in the @command{configure} step, for instance @samp{--prefix=$HOME}: @example ./configure --prefix=$HOME @end example @noindent For better control, you can use the options @option{--bindir}, @option{--infodir}, and so on. Type @samp{./configure --help} to obtain the complete list of all the available options. Anyway, the documentation files, including a full User Manual available in several formats (HTML, PDF and plain ASCII text), will always be put in @file{@var{DOCDIR}/numdiff}, where @var{DOCDIR} is the path specified by the option @option{--docdir} or, if this option has not been given to @command{configure}, @file{@var{PREFIX}/local/doc}. Here @var{PREFIX} is the installation prefix specified by the option @option{--prefix} or the default @file{/usr/local}. Once Numdiff has been installed you can remove all the files previously installed by a simple @samp{make uninstall}. If you have also installed the localization files trough @samp{make install-nls}, then, in order to remove also these ones, use @samp{make uninstall-nls} in place of @samp{make uninstall}. Between the options accepted by @command{configure} there are @option{--enable-debug}, @option{--enable-optimization}, @option{--enable-nls} and @option{--enable-gmp}. The option @option{--enable-debug} turns on debugging when compiling the source code. This is obtained by passing to the compiler the @option{-g} option, but you can change this default debugging flag (which could not even be recognized by your compiler) by setting the environment variable @env{DBGFLAGS} before calling @command{configure}. The option @option{--enable-optimization} turns on basic optimization when compiling the source code. This is obtained by passing to the compiler the @option{-O} option, but you can change this default flag (which could not even be recognized by your compiler) by setting the environment variable @env{OPTFLAGS} before calling @command{configure}. The option @option{--enable-nls} turns on Natural Language Support. But you do not need to use it explicitly, since Natural Language Support is enabled by default. However, you can disable it by using @option{--disable-nls}. Disabling Natural Language Support is suggested whenever you want to install Numdiff on a system where the GNU gettext library is not present. In this case the installation of Numdiff can be accomplished, for instance, through @example ./configure --disable-nls make make install @end example @noindent Since version 5.2.0 Numdiff uses to perform all computations the GNU Multiple Precision Arithmetic Library (also called GNU MP or GMP), if this library is available at build-time. The old internal support for multiple precision arithmetic is a fall-back in case GNU MP is absent. However it is possible to use the internal support for multiple precision arithmetic even when GNU MP is available: it is sufficient to pass the option @option{--enable-gmp=no} or @option{--disable-gmp} to the configure script before building the program, like in @example ./configure --disable-gmp make make install @end example @noindent Enabling the old internal support for multiple precision arithmetic is deprecated, @pxref{with GNU MP is better}. The latest version of GNU MP is available at @uref{ftp://ftp.gnu.org/gnu/gmp/}. See the GNU MP web page at @uref{http://gmplib.org/} for up-to-date information on GNU MP. @node Invoking numdiff, ndselect, Installing, Top @chapter Invoking numdiff @cindex Invoking numdiff @cindex Options, command line (numdiff) @cindex Command line options for numdiff @cindex Synopsis (numdiff) @cindex Diagnostics (numdiff) @cindex Predefined settings of numdiff @strong{SYNOPSIS} @example numdiff -h|--help|-v|--version @end example or @example numdiff [-s IFS][-a MAXERR][-r MAXERR][-2][-# PREC][-P][-N][-I] [-d C1C2][-t C1C2][-g N1N2][-p C1C2][-n C1C2][-e C1C2][-i C1C2] [-X 1:INT][-X 2:INT][-E][-D][-b][-V][-q][-S][-z 1:INT][-z 2:INT] [-Z 1:INT][-Z 2:INT][-m][-H][-f[NUM]][-T][-l PATH][-o PATH] @var{file1} @var{file2} @end example @noindent where @var{file1} and @var{file2} are the names of the two files to compare and INT stays for a positive integer value or for a range of integer values, like 1-, 3-5 or -7. In the first case @command{numdiff} prints a short help (not so short actually :)) or/and version number, Copyright, License notice, NO-Warranty disclaimer and some information about the way it was built. In the second case @command{numdiff} compares the files specified by the two (mandatory) arguments which follow the list of the options. The complete path of a file should be given, a directory name is not accepted. Moreover, the two arguments cannot refer to the same file but one of them can be @verb{|-|}, which refers to stdin. @noindent @strong{OPTIONS} @table @option @item -s, --separator=IFS Specify the set of characters to use to split the input lines into fields (The default set of characters is space, tab and newline) @item -a, --absolute-tolerance=MAXERR Specify the maximum absolute difference permitted before that two numeric fields are regarded as different (The default value is zero) @item -r, --relative-tolerance=MAXERR Specify the maximum relative difference permitted before that two numeric fields are regarded as different (The default value is zero) @item -2, --strict Order that two numerical values are regarded as equal only if both absolute and relative difference do not exceed the corresponding tolerance threshold @item -#, --digits=PREC Specify the number of digits in the significands used in multiple precision arithmetic @item -P, --positive-differences Ignore all differences due to numeric fields of the second file that are less than the corresponding numeric fields in the first file @item -N, --negative-differences Ignore all differences due to numeric fields of the second file that are greater than the corresponding numeric fields in the first file @item -I, --ignore-case Ignore changes in case while doing literal comparisons @item -d, --decimal-point=C1C2 Specify the characters representing the decimal point in the two files to compare @item -t, --thousands-separator=C1C2 Specify the characters representing the thousands separator in the two files to compare @item -g, --group-length=N1N2 Specify the number of digits forming each group of thousands in the two files to compare @item -p, --plus-prefix=C1C2 Specify the (optional) prefixes for positive values used in the two files to compare @item -n, --minus-prefix=C1C2 Specify the prefixes for negative values used in the two files to compare @item -e, --exponent-letter=C1C2 Specify the exponent letters used in the two files to compare @item -i, --imaginary-unit=C1C2 Specify the characters representing the imaginary unit in the two files to compare @item -X, --exclude=1:INT Select the fields of the first file that have to be ignored @item -X, --exclude=2:INT Select the fields of the second file that have to be ignored @item -E, --essential While printing the differences between the two compared files show only the numerical ones @item -D, --dummy While printing the differences between the two compared files neglect all the numerical ones (dummy mode) @item -b, --brief Suppress all messages concerning the differences discovered in the structures of the two files @item -V, --verbose For every couple of lines which differ in at least one field print an header to show how these lines appear in the two compared files @item -q, --quiet, --silent Suppress all the standard output @item -S, --statistics Add some statistics to the standard output @item -z, --blur-if-numerical=1:INT Select the fields of the first file that have to be blurred during the synchronization procedure only if they turn out to be numeric @item -z, --blur-if-numerical=2:INT Select the fields of the second file that have to be blurred during the synchronization procedure only if they turn out to be numeric @item -Z, --blur-unconditionally=1:INT Select the fields of the first file that have to be unconditionally blurred during the synchronization procedure @item -Z, --blur-unconditionally=2:INT Select the fields of the second file that have to be unconditionally blurred during the synchronization procedure @item -m, --minimal During synchronization try hard to find a smaller set of changes @item -H, --speed-large-files During synchronization assume large files and many scattered small changes @item -f, --test-filter[=NUM] Run only the filter and then show the results of its attempt to synchronize the two files. If @var{NUM} is zero or is not specified, output at most 130 columns per line. If @var{NUM} is a positive number, output at most @var{NUM} columns per line. If @var{NUM} is a negative number, do not output common lines and display at most -@var{NUM} columns per line. @item -T, --expand-tabs Expand tabs to spaces in output while displaying the results of the synchronization procedure (meaningful only together with option -f) @item -l, --warnings-to=PATH Redirect warning and error messages from stderr to the indicated file @item -o, --output=PATH Redirect output from stdout to the indicated file @item -h, --help Show help message and predefined settings @item -v, --version Show version number, Copyright, Distribution Terms and NO-Warranty @end table @noindent @strong{DIAGNOSTICS} The exit status is 1 if the two given files differ, 0 if they are equal, -1 (255) in case of error. @noindent @strong{DEFAULT NUMERIC FORMAT (for both files to compare):} @anchor{Default Numeric Format} Decimal point = `.' @sp 1 Thousands separator = `,' @sp 1 Number of digits in each thousands group = 3 @sp 1 Leading positive sign = `+' @sp 1 Leading negative sign = `-' @sp 1 Prefix for decimal exponent = `e' @sp 1 Symbol used to denote the imaginary unit = `i' @noindent @strong{SOME EXPLANATIONS} The options @option{-D}, @option{-E}, @option{-b} and @option{-q} are used to hide part of the standard output of the program according to some rule. The option @option{-D} triggers the ``dummy mode''. In this mode @command{numdiff} does not print the numerical differences. A numerical difference occurs whenever the compared fields turn out to be both of numerical type, but the field from the second file has a value which differs from the one of the field from the first file. The ``dummy mode'' is so called since when it is active, @command{numdiff} does not perform the job for which I created it. The option @option{-E} triggers the ``essential mode''. In this mode @command{numdiff} only prints the numerical differences between the two files and, if there are some, the differences in the structure. The latter ones occur either when one of the compared files contains a line for which there is no corresponding line in the other file, or when, comparing two lines, it turns out that one of them contains a field for which there exists no corresponding field in the other one. If you are not running any filter or cutting out some fields through the option @option{-X}, then the differences in the structure simply consist either in a different number of lines in the two files, or in a different number of fields on a line. The option @option{-b} triggers the ``brief mode''. In this mode @command{numdiff} does not print the differences in the structure of the two files, see just above for an explanation on what they are. The option @option{-q} triggers the ``quiet mode''. When in this mode @command{numdiff} does not print anything on the standard output. The ``quiet mode'' is useful if you only want to know whether a couple of files are equal or not. This information can be obtained by looking at the exit status of the program. The option @option{-V} triggers the ``verbose mode''. In this mode @command{numdiff} produces a richer report by printing an header whenever the compared lines differ. The header shows how and where these lines appear in the compared files. For instance, if the files @file{data1} and @file{data2} contain the data @verbatim 12 33 22 44.5 0.008 1.002 221.12 -34.56 water 2101.21 boats @end verbatim @noindent and @verbatim 12 33 22.3 44.5 0.008 1.202 221.12 -34.56 2101.21 boats dogs @end verbatim @noindent respectively, then the command @samp{numdiff -V data1 data2} will print the following output: @example ---------------- ##2 <== 22 44.5 ##2 ==> 22.3 44.5 ##2 #:1 <== 22 ##2 #:1 ==> 22.3 @@ Absolute error = 3.0000000000e-1, Relative error = 1.3636363636e-2 ---------------- ##3 <== 0.008 1.002 ##3 ==> 0.008 1.202 ##3 #:2 <== 1.002 ##3 #:2 ==> 1.202 @@ Absolute error = 2.0000000000e-1, Relative error = 1.9960079840e-1 ---------------- ##4 <== 221.12 -34.56 water ##4 ==> 221.12 -34.56 ##4 #>3 <== water ##4 ==> @@ Line 4 in file "data2" is shorter than expected! ---------------- ##5 <== 2101.21 boats ##5 ==> 2101.21 boats dogs ##5 <== ##5 #>3 ==> dogs @@ Line 5 in file "data1" is shorter than expected! +++ File "data1" differs from file "data2" @end example You must care that the options @option{-b} and @option{-V} will be overridden if @option{-q} is also set. The amount of additional information printed by @option{-V} is trivially influenced by the options which alter the way @command{numdiff} performs the comparisons between fields (for instance @option{-a}, @option{-r}, @option{-2}, @option{-N}, @option{-P}, @option{-D}, @option{-E}, @option{-I}, @option{-X}). In the headers printed by @command{numdiff} when in ``verbose mode'' can also appear the symbol @verb{|<<*>>|}. This symbol, if present, is always located at the end of a line to mean that the line is at the end of the corresponding file and does not have a terminating @strong{newline} character. The option @option{-S} adds to the standard output of @command{numdiff} a statistical report with the following information: @itemize @item the number of numeric comparisons the program has done (this quantity, like the successive ones, is influenced by the options @option{-P} and @option{-N}) and the number of those comparisons whose outcome is a relevant numerical difference. @item the largest absolute error in the set of relevant numerical differences and the corresponding relative error, @item the largest relative error in the set of relevant numerical differences together with the corresponding absolute error, @item the sum and the arithmetic mean of all absolute errors, @item the sum and the arithmetic mean of the relevant absolute errors, @item the square root of the sum of the squares of all absolute errors, @item the square root of the sum of the squares of the relevant absolute errors, @item the quadratic mean of all absolute errors, and @item the quadratic mean of the relevant absolute errors. @end itemize By relevant numerical differences and relevant absolute errors I mean those ones appearing in the output of @command{numdiff} when the options @option{-D} and @option{-q} are not used. The information printed by @option{-S} is not removed when this option is used together with @option{-q}. The options @option{-a}, @option{-r}, @option{-2}, @option{-P} and @option{-N} affect the way @command{numdiff} performs the comparisons between numerical values. Without any of these options, @command{numdiff} considers two numerical fields as equal when their difference is zero. The option @option{-a} can be used to order that two numerical fields must be considered equal as long as their absolute difference does not exceed a certain threshold, which is specified by the argument that follows the @option{-a} option. The option @option{-r} can be used to order that two numerical fields must be considered equal as long as their relative difference does not exceed a certain threshold, which is specified by the argument that follows the @option{-r} option. The relative difference is normally defined in this way. If @emph{n1} is a value from the file specified as first on the command line and @emph{n2} is the corresponding value from the second file, then the absolute difference is given by the formula @emph{A=|n1-n2|}. The relative difference @emph{R} is given by: @itemize @item @emph{R = 0} if @emph{n1} and @emph{n2} are equal, @item @emph{Inf} (infinity) if @emph{n2} differs from @emph{n1} and at least one of them is zero, @item @emph{R = A/ min(|n1|, |n2|)} if @emph{n1} and @emph{n2} are both non zero and @emph{n2} differs from @emph{n1}. @emph{min(|n1|, |n2|)} denotes the minimum between the absolute value of @emph{n1} and the absolute value of @emph{n2}. @end itemize @noindent With this definition of relative difference it turns out that @emph{R(n2, n1) = R(n1, n2)}: the relative difference does not change if you only change the ordering of the compared files on the command line. @anchor{Alternative formulas for the computation of the relative difference} However there are cases when this default definition of relative error makes no sense. This can happen for instance when one of the files is a sample file containing a list of expected data, which could have been computed theoretically or come from experiments in a laboratory. In this case it is more natural to define the relative difference as the ratio between the absolute difference and the absolute value of the number coming from the sample file. If you put the prefix @samp{1:} (or @samp{2:}) in front of the argument passed to @option{-r}, then Numdiff always compute the relative difference as the ratio between the absolute difference and the absolute value of the number from the first file (the second file, respectively). More precisely, with the prefix @samp{1:} the relative difference @emph{R} is computed according to these rules: @itemize @item @emph{R = 0} if @emph{n1} and @emph{n2} are equal, @item @emph{Inf} (infinity) if @emph{n2} differs from @emph{n1} and @emph{n1} is zero, @item @emph{R = |n1-n2|/ |n1|} if @emph{n1} is not zero and @emph{n2} differs from @emph{n1}. @end itemize @noindent With the prefix @samp{2:} the rules become: @itemize @item @emph{R = 0} if @emph{n1} and @emph{n2} are equal, @item @emph{Inf} (infinity) if @emph{n2} differs from @emph{n1} and @emph{n2} is zero, @item @emph{R = |n1-n2|/ |n2|} if @emph{n2} is not zero and @emph{n2} differs from @emph{n1}. @end itemize @noindent With the last two sets of rules is not anymore true that @emph{R(n2, n1) = R(n1, n2)}: the relative difference changes, in the general case, together with the ordering of the files on the command line. If there is a prefix, the value after it is in any case interpreted as tolerance threshold for the relative difference, just as in the case when no prefix is given. You can use @samp{-r 1:0} or @samp{-r 2:0} if you just want to change the way the relative differences are computed and leave the tolerance threshold to its default value, i.e. zero. As a simple example, suppose that @var{file1} and @var{file2} contain @verbatim 1 9.9 0.5 440 @end verbatim @noindent and @verbatim 1.2 8 0.51 400 @end verbatim @noindent respectively. Then @samp{numdiff @var{file1} @var{file2}} displays @example ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 @ Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 @ Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 @ Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 @ Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1 +++ File "file1" differs from file "file2" @end example @noindent @samp{numdiff -r 1:0 @var{file1} @var{file2}} prints @example ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 @ Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 @ Absolute error = 1.9000000000e+0, Relative error = 1.9191919192e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 @ Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 @ Absolute error = 4.0000000000e+1, Relative error = 9.0909090909e-2 +++ File "file1" differs from file "file2" @end example @noindent the output of @samp{numdiff -r 2:0 @var{file1} @var{file2}} is @example ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 @ Absolute error = 2.0000000000e-1, Relative error = 1.6666666667e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 @ Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 @ Absolute error = 1.0000000000e-2, Relative error = 1.9607843137e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 @ Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1 +++ File "file1" differs from file "file2" @end example @noindent @samp{numdiff -r 1:0.195 @var{file1} @var{file2}} displays @example ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 @ Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 +++ File "file1" differs from file "file2" @end example @noindent and, finally, @samp{numdiff -r 2:0.195 @var{file1} @var{file2}} displays @example ---------------- ##1 #:2 <== 9.9 ##1 #:2 ==> 8 @ Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 +++ File "file1" differs from file "file2" @end example @noindent Care not to leave any space between the prefix @samp{1:} or @samp{2:} and the value of the tolerance threshold, Numdiff would consider this as a wrong input. The option @option{-2} is only meaningful when both @option{-a} and @option{-r} are present on the command line. If the user specifies a non-zero tolerance threshold for both absolute and relative error by using both @option{-a} and @option{-r}, @command{numdiff} adopts this behavior: it considers equal two numerical fields as long as at least one between absolute and relative error does not exceed the corresponding threshold. With the option @option{-2} @command{numdiff} regards two numerical values as equal only if both absolute and relative error do not exceed the threshold of tolerance. For instance, if @var{file1} contains the unique line @verbatim 100 @end verbatim @noindent and @var{file2} the line @verbatim 100.00012 @end verbatim @noindent then the output of the command @samp{numdiff @var{file1} @var{file2}} will be @example ---------------- ##1 #:1 <== 100 ==> 100.00012 @@ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6 +++ File "@var{file1}" differs from file "@var{file2}" @end example @noindent The output of the commands @samp{numdiff -a 1.0e-4 @var{file1} @var{file2}} and @samp{numdiff -r 1.0e-6 @var{file1} @var{file2}} will be the same, while @samp{numdiff -a 1.0e-4 -r 1.3e-6 @var{file1} @var{file2}} and @samp{numdiff -a 1.3e-4 -r 1.0e-6 @var{file1} @var{file2}} will print the message @example +++ Files "@var{file1}" and "@var{file2}" are equal @end example @noindent since the relative error is 1.2e-6 < 1.3e-6, the absolute error is 1.2e-4 < 1.3e-4, and it is sufficient that one of them does not exceed the tolerance specified on the command line to make @command{numdiff} consider equal the two compared values. However, the commands @samp{numdiff -a 1.0e-4 -r 1.3e-6 -2 @var{file1} @var{file2}} and @samp{numdiff -a 1.3e-4 -r 1.0e-6 -2 @var{file1} @var{file2}} will print the message @example ---------------- ##1 #:1 <== 100 ==> 100.00012 @@ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6 +++ File "@var{file1}" differs from file "@var{file2}" @end example @noindent since the option @option{-2} makes @command{numdiff} regard two values as equal only if both absolute and relative difference do not exceed the corresponding threshold of tolerance. The option @option{-P} makes @command{numdiff} consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is less or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is less or equal than the first one means that both real and imaginary part of the second one are not greater than the real part and, respectively, the imaginary part of the first one. Finally, the option @option{-N} makes @command{numdiff} consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is greater or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is greater or equal than the first one means that both real and imaginary part of the second one are not less than the real part and, respectively, the imaginary part of the first one. The options @option{-I}, @option{-l}, @option{-o}, @option{-h} and @option{-v} do not require further explanations. The options @option{-l} and @option{-o} are only supplied for the users of some poorly designed operating systems (like MSDog or MSWindoze), whose default shell does not allow the redirection of standard error and standard output. The option @option{-I} has no effect on the outcome of numerical comparisons but affects the action of the filter, @pxref{Filtering}. The option @option{-s} requires as argument a set of characters, which will be taken as field delimiters. It is better to quote the set of the delimiters, just as in the next examples: @example numdiff -s ' \t\n,;:.' @var{file1} @var{file2} numdiff -s ' \t\n\r\f\v"\:;' @var{file1} @var{file2} numdiff -s `` \t\n''' @var{file1} @var{file2} @end example @noindent If you want to include in the set of delimiters also some special characters, e.g the @strong{blank}, then you must quote it. I recommend you to always use the single quote character (@verb{|'|}) to enclose the list of the delimiters, since in this way you will prevent any substitution or handling of characters by the shell. @noindent @command{numdiff} recognizes and interprets the following sequences of characters within the argument passed to the option @option{-s}: @itemize @item @samp{\f} form feed, @item @samp{\n} newline, @item @samp{\r} carriage return, @item @samp{\t} horizontal tab, @item @samp{\v} vertical tab. @end itemize @noindent The mentioned special characters are often used as delimiters in files containing numerical data but they can not be included directly in the set of delimiters. By passing the string @samp{ \t\n,;:.} as argument for the option @option{-s}, one tells @command{numdiff} use as field delimiters the characters @strong{blank}, @strong{horizontal tab}, @strong{newline}, @strong{comma}, @strong{semicolon}, @strong{colon} and @strong{dot}. Passing @samp{ \t\n} as argument to the option @option{-s} is the same as not using at all the option @option{-s}, since @strong{blank}, @strong{horizontal tab} and @strong{newline} are the default field delimiters. In the list of field delimiters the character @strong{backslash} (@samp{\}) is always treated in a special way. If followed by @samp{f}, @samp{n}, @samp{r}, @samp{t} or @samp{v} it is combined with the subsequent character and interpreted in the way we have just seen. @c Forse questo andrebbe cambiato nel programma !!! @c Non mi piace troppo così come è adesso. Otherwise, the @strong{backslash} is coupled with the following character and then removed. In particular, if you want to specify the @strong{backslash} itself as field delimiter, you have to put @strong{two backslashes} (@samp{\\}) in the list of delimiters. Therefore, the delimiters specified by the command line @example numdiff -s' \t\n\\\"' @var{file1} @var{file2} @end example @noindent are @strong{blank}, @strong{horizontal tab}, @strong{newline}, @strong{backslash} and @strong{double quote}, since @samp{\\} and @samp{\"} are interpreted by @command{numdiff} as @samp{\} and @samp{"}. Even if I have recommended to enclose the set of delimiters in single quotes, there are cases in which you will be constrained to use the double quote character (@samp{"}) to enclose the set of field delimiters, e.g. if the single quote character is used as field delimiter, like in one of the precedent examples. However you must take into account that in this case the shell could make some substitutions on the command line before executing @command{numdiff}. For instance, if your shell is GNU bash, then (citing the man page of GNU bash) @quotation Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of @samp{$}, @samp{`}, and @samp{\}. The characters @samp{$} and @samp{`} retain their special meaning within double quotes. The backslash retains its special meaning only when followed by one of the following characters: @samp{$}, @samp{`}, @samp{"}, @samp{\}, or @strong{}. A double quote may be quoted within double quotes by preceding it with a backslash @enddots{} The special parameters * and @@ have special meaning when in double quotes @dots{} @end quotation @noindent Therefore, if the set of delimiters is formed by @samp{ }, @samp{\t}, @samp{\n}, @samp{\} and @samp{"} and you decide to enclose them in double quotes, then the @command{numdiff} command line should be @example numdiff -s'' \t\n\\\\\"'' @var{file1} @var{file2} @end example @noindent and not @example numdiff -s'' \t\n\\\"'' @var{file1} @var{file2} @end example @noindent In this last case the shell would indeed replace the string @samp{ \t\n\\\"} @noindent by @samp{ \t\n\"} @noindent and then @command{numdiff} would take @samp{ }, @samp{\t}, @samp{\n} and @samp{"} as field delimiters. @command{numdiff} requires the presence of the @strong{newline} in the set of characters passed to @option{-s}. The absence of the @strong{newline} in the set of delimiters causes the issue of a suitable warning message and the termination of the program. If you are running Numdiff on MSDog/MSWindoze I recommend you to always put the @strong{carriage return} in the set of field delimiters. Otherwise, this character would be included in all the fields which stay at the end of a line and this would cause some undesirable effects. For instance, a number put at the end of a line would not be considered as a numerical field by @command{numdiff}, since @command{numdiff} would consider the final @strong{carriage return} as part of the field which then would be qualified as non-numerical. You can specify different delimiters for the two files to compare by putting the prefix @samp{1:} or @samp{2:} in front of the set of characters passed to @option{-s}. If the argument of @option{-s} begins with @samp{1:}, the characters after this prefix are used as field delimiters only for the file passed as first on the command line. Analogously, if the prefix is @samp{2:}, then the characters after it are used as field delimiters only for the file specified as second on the command line. You can also provide an explicit set of delimiters for just one of the files to compare, in which case @command{numdiff} uses the default field delimiters @strong{blank}, @strong{tab} and @strong{newline} for the other file. Therefore, with @samp{numdiff -s '1:: \n' @var{file1} @var{file2}} the program will take @strong{colon}, @strong{blank} and @strong{newline} as delimiters for @var{file1}, and @strong{blank}, @strong{tab} and @strong{newline} as delimiters for @var{file2}. The recommendations about quoting the set of delimiters are valid even in presence of a prefix. The option @option{-#} lets the user specify the number of digits in the significands used in multiple precision arithmetic. The default value is 35, the largest admissible value is 180. If @command{numdiff} has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user. @noindent Take into account that an higher precision makes the execution of @command{numdiff} slower. This is particularly true if @command{numdiff} is not using the computational routines from the GNU MP library and the files to compare contain a lot of numerical fields. In addition, you have to care that @command{numdiff} truncates the value of a numerical field if it has @i{too much} digits with respect to the current precision. To be precise, denoted by @var{P} the current value of the precision, the following rules apply. @itemize @item If @command{numdiff} has been built with its own internal support for multiple precision arithmetic, then @itemize @item if a number is written in ordinary decimal notation, @command{numdiff} will consider, in addition to all digits of the integer part, only the first @var{P} digits of the fractional part; @item if a value is written in scientific notation, then @command{numdiff} will only consider the first @var{P} digits of the fractional part of the mantissa. @end itemize @item If @command{numdiff} uses the routines from the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first @var{P} digits of the fractional part of the mantissa are considered. @end itemize @noindent You can find out whether your local version of @command{numdiff} is relying on GNU MP or not by executing the command @samp{numdiff -v}. If @command{numdiff} uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information: @example The software has been linked against the GNU Multiple Precision Arithmetic Library, version number 4.2.4. @end example @noindent If @command{numdiff} does not rely on GNU MP, then the displayed message will be (up to translation into your mother language) @example The software has been built with its own internal support for multiple precision arithmetic. @end example @noindent The options @option{-d}, @option{-t}, @option{-g}, @option{-p}, @option{-n}, @option{-e} and @option{-i} can be used to instruct @command{numdiff} about the numeric formats used in the files which it is going to compare. The two files to compare do not have to adopt the same numeric format and then @command{numdiff} allows to specify different numeric formats for them. Each of the options @option{-d}, @option{-t}, @option{-g}, @option{-p}, @option{-n}, @option{-e} and @option{-i} can have as argument one or two characters (one or two digits if the option is @option{-g}). In the first case the argument refers to both files to compare, in the second case the first character is for the file specified as first on the command line, the second character for the file specified as last. For instance, the option @option{-d} can be used to tell @command{numdiff} which character(s) is(are) used to mean the decimal point in the two files to compare. If you give the command @samp{numdiff -d_ @var{file1} @var{file2}}, then @command{numdiff} will understand that both in @var{file1} and in @var{file2} the character @strong{underscore} (@samp{_}) is used in place of the default one (@samp{.}) to indicate the position of the decimal point in the numerical values. But if the command is @samp{numdiff -d_: @var{file1} @var{file2}}, then @command{numdiff} will understand that the decimal point is indicated by the character @strong{underscore} in @var{file1}, and by @strong{colon} (@samp{:}) in @var{file2}. If you omit to use one of the options @option{-d}, @option{-t}, @option{-g}, @option{-p}, @option{-n}, @option{-e} and @option{-i}, then the corresponding attribute will take its default value, @pxref{Default Numeric Format}. You must be really careful when you use one or more of these options. First, not all characters can be passed to them as arguments. The arguments of the option @option{-g} must be digits, the arguments of the options @option{-d} and @option{-t} must be punctuation marks (punctuation marks are all the characters of the ASCII set for which the standard C function @code{ispunct} returns a non zero value), those ones of the options @option{-p}, @option{-n}, @option{-e} and @option{-i} must be graphical characters but digits (graphical characters are all the characters of the ASCII set for which the standard C function @code{isgraph} returns a non zero value). It is not possible to set the decimal point, the thousands separator, the positive sign, the negative sign, the prefix for decimal exponent or the symbol of the imaginary unit so that, for a same file, two or more of these characters come out to be equal. This rule also applies when you miss to explicitly select a symbol through the appropriate option. For instance, the command @samp{numdiff -d,. @var{file1} @var{file2}} will make @command{numdiff} abnormally terminate after printing the error message: @example The numeric format specified for the first file is illegal, the following symbols should be all different while two or more of them are actually equal: Decimal point = `,' Thousands separator = `,' Leading positive sign = `+' Leading negative sign = `-' Prefix for decimal exponent = `e' Symbol used to denote the imaginary unit = `i' @end example @noindent Through the option @option{-d} we have told to @command{numdiff} that in the first file the decimal point is indicated by the character @strong{comma}, but at the same time we have not modified the character in use to separate the groups of thousands, which has remained the default one, i.e. @strong{comma}, for both files to compare. In this way, we have implicitly told to @command{numdiff} that in @var{file1} the character @strong{comma} represents both decimal point and thousands separator. Since this is not reasonable, @command{numdiff} refuses to work. To avoid this problem it would be sufficient to explicitly notify to @command{numdiff} the thousands separator through the option @option{-t}: @samp{numdiff -d,. -t., @var{file1} @var{file2}}. Of course, here we are supposing that the decimal point and the thousands separator are represented in @var{file1} by @strong{comma} and @strong{dot} respectively, in @var{file2} by @strong{dot} and @strong{comma}. I strongly suggest you that in writing a file you avoid the use of the same symbol to mean two different things (like would be using @strong{comma} for both decimal point and thousands separator), it is nonsense. At last, it is possible (but stupid) to use as argument for the options @option{-d}, @option{-t}, @option{-g}, @option{-p}, @option{-n}, @option{-e} and @option{-i} one of the characters used to separate the fields in the files to compare. In such a case @command{numdiff} does not complain but you have to consider that it uses first the set of field delimiters in order to split the files into fields and then, when it has to distinguish between numerical and non-numerical fields, it takes into account the numeric formats specified for the two files. However, it should never happen to specify as argument for one of the options @option{-d}, @option{-t}, @option{-g}, @option{-p}, @option{-n}, @option{-e} and @option{-i} a character which is also used as field delimiter: again, in writing a file you should avoid (and people usually avoid it) to use the same symbol to mean two different things. The option @option{-X} can be used to restrict the comparison between files to a certain group of fields. @anchor{Use of the option -X} This option requires as argument a range of positive integer values or eventually just one positive integer number. The argument specifies the position(s) of the fields that @command{numdiff} has to ignore. Remember that the fields of a line are numerated starting from the left hand of the line and proceeding towards the right hand. The argument passed to @option{-X} can start with a prefix, which must be either @samp{1:} or @samp{2:}. @samp{1:} refers to the file passed as first on the command line, @samp{2:} to the file specified as second. With the prefix @samp{1:} only the fields of the first file corresponding to the given position(s) are ignored. Similarly, if you want to ignore only fields from the second file you have to use the prefix @samp{2:}. The option @option{-X} can appear more times on the command line, in which case @command{numdiff} will ignore all fields located in the positions so specified. Some examples can clarify the use of ranges and prefixes. If the file @file{List1} contains the data @verbatim * a 1 1 1 1 * b 2 2 2 2 * c 3 3 3 3 * d 4 4 4 4 * e 5 5 5 5 @end verbatim @noindent and @file{List2} the data @verbatim 1 1.1 1.01 A 1.001 1.0001 2 2.2 2.02 B 2.002 2.0002 3 3.3 3.03 C 3.003 3.0003 4 4.4 4.04 D 4.004 4.0004 5 5.5 5.05 E 5.005 5.0005 @end verbatim @noindent then the output of @samp{numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2} is @example ---------------- ##1 #:4 <== 1 ##1 #:2 ==> 1.1 @@ Absolute error = 1.0000000000e-1, Relative error = 1.0000000000e-1 ##1 #:5 <== 1 ##1 #:3 ==> 1.01 @@ Absolute error = 1.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##2 #:4 <== 2 ##2 #:2 ==> 2.2 @@ Absolute error = 2.0000000000e-1, Relative error = 1.0000000000e-1 ##2 #:5 <== 2 ##2 #:3 ==> 2.02 @@ Absolute error = 2.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##3 #:4 <== 3 ##3 #:2 ==> 3.3 @@ Absolute error = 3.0000000000e-1, Relative error = 1.0000000000e-1 ##3 #:5 <== 3 ##3 #:3 ==> 3.03 @@ Absolute error = 3.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##4 #:4 <== 4 ##4 #:2 ==> 4.4 @@ Absolute error = 4.0000000000e-1, Relative error = 1.0000000000e-1 ##4 #:5 <== 4 ##4 #:3 ==> 4.04 @@ Absolute error = 4.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##5 #:4 <== 5 ##5 #:2 ==> 5.5 @@ Absolute error = 5.0000000000e-1, Relative error = 1.0000000000e-1 ##5 #:5 <== 5 ##5 #:3 ==> 5.05 @@ Absolute error = 5.0000000000e-2, Relative error = 1.0000000000e-2 +++ File "List1" differs from file "List2" @end example @noindent Numdiff cuts off from @file{List1} the fields in the positions 1, 2 and 6 and from @file{List2} the fields in the positions 4, 5 and 6. In this way it compares the third, fourth and fifth field of every line of @file{List1} with the first, second and third field respectively of the corresponding line of @file{List2}. An equivalent form of the command @samp{numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2} is given by @samp{numdiff -X 1:1-2 -X 2:4-5 -X 6 List1 List2} : since the sixth field is cut off from both files we can refer to it without a prefix. As you can see, you can specify a range of fields by using the notation @samp{@var{m}-@var{n}}, where @var{m} and @var{n} are the field numbers of the first and of the last field in the range. It is even possible to use range expressions like @samp{@var{m}-} or @samp{-@var{n}}. The first expression corresponds to all fields starting from the @var{m}th one (inclusive) till to the end of line, the second selects all fields from the first one till to the @var{n}th one (inclusive). Therefore the command @samp{numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2} is equivalent to @samp{numdiff -X 1:-2 -X 2:4 -X 1:6 -X 2:5- List1 List2} or to @samp{numdiff -X 1:-2 -X 1:6 -X 2:4- List1 List2}. Care that the largest field number that you can use while writing a specification for the option @option{-X} is 32768. If you use the option @option{-X} the exit status of @command{numdiff} reflects the outcome of the restricted comparison. For instance, the exit status of @samp{numdiff -X 8- @var{file1} @var{file2}} is 1 only if @command{numdiff} has found a difference in the first seven fields of @var{file1} and @var{file2}. If the two files differ only in the fields after the seventh one, then @command{numdiff} ends with a zero exit status. Going back to the example with @file{List1} and @file{List2}, the output of @samp{numdiff -X 1:1-2 -X 1:4- -X 2:2- List1 List2} is @example +++ Files "List1" and "List2" are equal @end example @noindent since every field of @file{List1} at position 3 is equal to the first field in the corresponding line of @file{List2}. The exit code returned by the program to the shell is zero. The options @option{-z}, @option{-Z}, @option{-m}, @option{-H}, @option{-f}, and @option{-T} influence the action of the filter and their use is then described later, @ref{Filtering}. Care that @option{-z} and @option{-Z} require both an argument in the same form requested by @option{-X}. Since version 5 Numdiff accepts also long options to conform to the GNU standards. Now it is then possible, e.g., to use @samp{--separator='\n\t %'} or @samp{--separator '\n\t %'} instead of using @samp{-s '\n\t %'}. The long options, which start all with two dashes, are listed at the beginning of this chapter, each one near to the corresponding short option. The argument of a long option may or may not preceded by the @verb{|=|} sign. The only exception is the option @option{--test-filter}, for which the presence of the @verb{|=|} before the argument is mandatory. Then @samp{--test-filter=60} is correct while @samp{--test-filter 60} is not accepted. @node ndselect, Invoking ndselect, Invoking numdiff, Top @chapter Selecting lines for the comparison @cindex ndselect (introduction to its use) @cindex Tools Together with the version 5.x of Numdiff is shipped a useful tool, the program @command{ndselect}. I decided to create this utility in order to deal with a situation that comes out often in Numerical Analysis. Here I present a very simple example of such a situation. Let us suppose that file @file{list1} contains the values of the square root, rounded to the 20th decimal digit, for all the integer numbers between 10 and 20: @verbatim 12 3.46410161513775458705 13 3.60555127546398929312 14 3.74165738677394138558 15 3.87298334620741688518 16 4 17 4.12310562561766054982 18 4.24264068711928514641 19 4.35889894354067355224 20 4.47213595499957939282 21 4.58257569495584000659 22 4.69041575982342955457 23 4.7958315233127195416 24 4.89897948556635619639 @end verbatim @noindent while @var{list2} contains @emph{suitable} approximations of the square root only for the numbers between 12 and 21 which are multiple of 3: @verbatim 12 3.46410162002945508100 15 3.87298387096774193548 18 4.24264705882352941176 21 4.58260869565217391304 @end verbatim @noindent These approximations could have been obtained for instance by using the famous Heron's algorithm, which, given an approximation @code{a} for the square root of a number @code{x}, computes a better approximation by the formula @code{a := 0.5 * (x/a + a)}. What we want now is to understand by using @command{numdiff} how good are the approximations contained in file @var{list2}. Unfortunately, we cannot execute directly the command @samp{numdiff list1 list2}, since in this way we would compare the approximations provided for the square roots of 15, 18, and 21 with the square roots of 13, 14, and 15 respectively. To make the comparison in the right way, one could open @file{list1} in a text editor and remove from this file all the non interesting lines till to leave only the ones related to the numbers 12, 15, 18, and 21. But this approach is practicable because we have to remove few lines, and one can easily figure out how boring and inefficient would be to manually remove hundreds or thousands of lines from a file in order to compare it with another one. An expert GNU user would suggest that it is possible to make this removal automatic by using the well known utilities @command{head} and @command{sed}, in this particular case @samp{head -n 10 list1 | sed -n -e '1~3 p' > List1} A quick explanation for the ones who do not know how to use @command{head} and @command{sed}: the previous command extracts from @file{list1} the first 10 lines, namely the ones containing the square roots of the numbers from 12 to 21, then picks every third line starting from the first one between the extracted lines, in order to select only the ones related to 12, 15, 18, and 21. Finally, these lines are printed on the file @file{List1}, which then looks like: @verbatim 12 3.46410161513775458705 15 3.87298334620741688518 18 4.24264068711928514641 21 4.58257569495584000659 @end verbatim Once obtained @file{List1}, we can perform with @command{numdiff} the comparison between the values we are interested in: @samp{numdiff List1 list2} . Unfortunately, this trick only works if you have installed the GNU version of @command{sed}, which, as far as I know, is the only one to provide the extension @var{first~step} to specify line addresses. That is way I decided to implement @command{ndselect}, which allows to obtain the same result as before with the simpler command: @samp{ndselect -b 1 -e 10 -s 3 list1 > List1} The meaning of the arguments passed to the options @option{-b}, @option{-e}, and @option{-s} is the following: we are telling @command{ndselect} to print every third line of file @file{list1} (the option @option{-s} specifies the step), starting from the first one (the option @option{-b} specifies the beginning) and ending within the tenth one possibly inclusive (the option @option{-e} specifies the end). Because of the presence of the redirection operator @code{>}, the previous command sends to the file @file{List1} what @command{ndselect} would print on the screen (standard output). Using @command{ndselect} is very simple and elegant, other than extremely useful in the situations just outlined. A complete description of its use follows. @node Invoking ndselect, Filtering, ndselect, Top @chapter Invoking ndselect @cindex Invoking ndselect @cindex Options, command line (ndselect) @cindex Command line options for ndselect @cindex Synopsis (ndselect) @cindex Diagnostics (ndselect) @noindent @strong{SYNOPSIS} @example ndselect -h|--help|-v|--version @end example or @example ndselect [-b FIRST][-e LAST][-s STEP][-l PATH][-o PATH] [@var{file}] @end example @noindent where @var{file} is the name of the file to scan. In the first case @command{ndselect} prints a short help or/and version number, Copyright, License notice and NO-Warranty disclaimer. In the second case @command{ndselect} prints on the standard output every STEPth line of @var{file} starting with line FIRST and ending within line LAST. The complete path of @var{file} should be given, a directory name is not accepted. If no input file is specified, the program reads from the standard input. @noindent @strong{OPTIONS} @table @option @item -b, --beginning, --start=FIRST Specify the first line to print (The default behavior is to start with line number 1) @item -e, --end=LAST Specify the last line that can be printed (The default behavior is to arrive till to the end of the file) @item -s, --step=STEP Specify the step to use when selecting the lines to print (The default value for the step is 1) @item -l, --warnings-to=PATH Redirect warning and error messages from stderr to the indicated file @item -o, --output=PATH Redirect output from stdout to the indicated file @item -h, --help Show the help message @item -v, --version Show version number, Copyright, Distribution Terms and NO-Warranty @end table @noindent Passing 0 as argument to the option @option{-e} is equivalent to omit this option and leave enabled the default behavior (which consists in scanning till to the end of the file). @noindent @strong{DIAGNOSTICS} The exit status is 0 in case of normal termination, -1 (255) in case of error. @noindent As @command{numdiff} does, also @command{ndselect} since version 5 accepts long options. So instead of @samp{ndselect -b 1 -e 10 -s 3 list1 > List1}, you can launch this command as @samp{ndselect --start=1 --end=10 --step=3 list1 > List1}. @node Filtering, Warnings, Invoking ndselect, Top @chapter Using the filter of numdiff @cindex Filter Since version 5 it is possible to activate a filter when calling @command{numdiff}, so that the program performs automatically the comparison in the desired way. Recalling the example of chapter 6, if you run the command @command{numdiff -z 2- -V list1 list2} you obtain the following result: @example ---------------- ##1 <== 12 3.46410161513775458705 ##1 ==> 12 3.46410162002945508100 ##1 #:2 <== 3.46410161513775458705 ##1 #:2 ==> 3.46410162002945508100 @ Absolute error = 4.8917004940e-9, Relative error = 1.4121122985e-9 ---------------- ##2 <== 13 3.60555127546398929312 ==> ---------------- ##3 <== 14 3.74165738677394138558 ==> ---------------- ##4 <== 15 3.87298334620741688518 ##2 ==> 15 3.87298387096774193548 ##4 #:2 <== 3.87298334620741688518 ##2 #:2 ==> 3.87298387096774193548 @ Absolute error = 5.2476032505e-7, Relative error = 1.3549253331e-7 ---------------- ##5 <== 16 4 ==> ---------------- ##6 <== 17 4.12310562561766054982 ==> ---------------- ##7 <== 18 4.24264068711928514641 ##3 ==> 18 4.24264705882352941176 ##7 #:2 <== 4.24264068711928514641 ##3 #:2 ==> 4.24264705882352941176 @ Absolute error = 6.3717042443e-6, Relative error = 1.5018250929e-6 ---------------- ##8 <== 19 4.35889894354067355224 ==> ---------------- ##9 <== 20 4.47213595499957939282 ==> ---------------- ##10 <== 21 4.58257569495584000659 ##4 ==> 21 4.58260869565217391304 ##10 #:2 <== 4.58257569495584000659 ##4 #:2 ==> 4.58260869565217391304 @ Absolute error = 3.3000696334e-5, Relative error = 7.2013423303e-6 ---------------- ##11 <== 22 4.69041575982342955457 ==> ---------------- ##12 <== 23 4.7958315233127195416 ==> ---------------- ##13 <== 24 4.89897948556635619639 ==> +++ File "list1" differs from file "list2" @end example Numdiff has recognized that the lines of @file{list1} with the square roots for the numbers 13, 14, 16, 17, 19, 20, 22, 23 and 24 have been deleted from @file{list2}. The numerical comparison has been done by likening each line of @file{list2} to the line of @file{list1} which displays the square root for the same integer value. The output obtained running the filter of Numdiff by @command{numdiff -f -z 2- list1 list2} confirms this: @example 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 < 14 3.74165738677394138558 < 15 3.87298334620741688518 15 3.87298387096774193548 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 18 4.24264705882352941176 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 21 4.58260869565217391304 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" @end example If you compare the command @command{numdiff -z 2- -V list1 list2} with the one used here, @pxref{command}, for the files @file{bill1} and @file{bill2} you surely notice that the filter has been invoked in different ways, first with @option{-z @@} and then with @option{-z 2-}. The @i{synchronization} procedure used by the filter is based on @i{blurring} and byte by byte comparison. The options @option{-z} and @option{-Z} are used to select which field(s) from which file have to be blurred. They take both an argument in the same form requested by @option{-X}, @pxref{Use of the option -X}, but accept additionally the special value @samp{@@} as abbreviation for the range of fields @samp{1-}. Then the specifications @samp{1:@@}, @samp{2:@@} and @samp{@@} are used to mean all fields of the first file, of the second one or of both, respectively. Employing @option{-z} and @option{-Z} in the right way is extremely important to let the filter work as desired. For instance, @command{numdiff -f -z @@ list1 list2} matches the lines of @file{list1} and @file{list2} in the same wrong way @example 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 15 3.87298387096774193548 14 3.74165738677394138558 18 4.24264705882352941176 15 3.87298334620741688518 21 4.58260869565217391304 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 < 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 < 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" @end example @noindent as Numdiff would do without triggering the filter at all. It is essential then to understand what @i{blurring a field} means and how the filter uses blurring to match the lines of the files to compare. After reading the files the filter removes from each of them (from their images in the memory, actually) all the fields selected by the option @option{-X}, then it replaces each of the fields that have to be blurred by a special character. This special character is the same for both files and it is so chosen that it cannot appear in the text. Blurring a field means to replace it by this sort of @i{place card}. After doing this, the filter converts all remaining numerical fields to a standard format and compares the files byte by byte neglecting the field delimiters. This comparison is just used to establish which lines of the first file are not present in the second, which lines of the second file are missing in the first one and how to match the remaining lines to create a one-to-one correspondence. Only at this point @command{numdiff} inspects each couple of corresponding lines, splits the two lines into the constituent fields, and neglecting those ones eventually specified through the option @option{-X} compares corresponding fields as it is supposed to do, performing a numerical comparison whenever the fields are both legal numerical values. Blurring the right fields is essential to match the lines from the two files appropriately before doing any numerical comparison. Without blurring, the numerical fields could prevent @command{numdiff} from an appropriate matching of the lines, in case some of them are present in only one file, by creating confusion with their (maybe small) numeric differences. Blurring can be of two types, conditional or unconditional. The blurring is conditional if it has to be performed only for fields which turn out to be legal numerical values. The arguments of the option @option{-z} indicate which fields of which file have to be blurred @strong{under the condition that they are recognized as numeric fields}. Non-numeric fields are left by @option{-z} untouched (no blurring occurs for them). Then @samp{-z 1:5-7} makes the filter blur the 5th, 6th and 7th field of each line of the first file whenever they are recognized as numerical. By the option @option{-Z} you can specify which fields have to be unconditionally blurred, i.e. independently of their type, numerical or not. Then @samp{-Z 2:3-4} activates the blurring of the 3th and 4th field of each line of the second file. Going back to the comparison of the files @file{list1} and @file{list2}, the option @samp{-z 2-} of the command @samp{numdiff -z 2- -V list1 list2} makes the filter transform the (memory copies of the) two files as @example 12 @bullet{} 13 @bullet{} 14 @bullet{} 15 @bullet{} 16 @bullet{} 17 @bullet{} 18 @bullet{} 19 @bullet{} 20 @bullet{} 21 @bullet{} 22 @bullet{} 23 @bullet{} 24 @bullet{} @end example @noindent and @example 12 @bullet{} 15 @bullet{} 18 @bullet{} 21 @bullet{} @end example @noindent respectively. Here @bullet{} denotes the special symbol used by the filter in the blurring procedure, even if this symbol is not actually a bullet. Since in this example space, tab and newline are used as field delimiters, the byte by byte comparison between the transformed files produces the same result as the command @samp{sdiff -W} does when called on them: @example 12 @bullet{} 12 @bullet{} 13 @bullet{} < 14 @bullet{} < 15 @bullet{} 15 @bullet{} 16 @bullet{} < 17 @bullet{} < 18 @bullet{} 18 @bullet{} 19 @bullet{} < 20 @bullet{} < 21 @bullet{} 21 @bullet{} 22 @bullet{} < 23 @bullet{} < 24 @bullet{} < @end example @noindent If you put the blurred fields back you obtain exactly the output of @samp{numdiff -f -z 2- list1 list2}: @example 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 < 14 3.74165738677394138558 < 15 3.87298334620741688518 15 3.87298387096774193548 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 18 4.24264705882352941176 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 21 4.58260869565217391304 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" @end example @noindent Since the second field is a numerical value in all the lines of @file{list1} and @file{list2}, to use the option @option{-Z} instead of @option{-z} makes no difference in this case. The output of @samp{numdiff -f -Z 2- list1 list2} is just the same as for @samp{numdiff -f -z 2- list1 list2}. After this explanation you can also understand why @samp{numdiff -f -z @@ list1 list2} gives a wrong result. Since also the first field is always given by a numerical value, the option @samp{-z @@} makes the filter transform the two given files as @example @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @end example @noindent and @example @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @bullet{} @end example @noindent respectively, so that it is not anymore possible to match the lines in a reasonable way. Let us see now a typical situation where it is better to use @option{-Z} in place of @option{-z}. If the file @file{Table1} contains @verbatim -6 2.449490 -5 2.236068 -4 2.000000 -3 1.732051 -2 1.414214 -1 1.000000 0 0 - - - - - - - - - 1 1.000000 2 1.414214 3 1.732051 4 2.000000 - - - - - - - - - 5 2.236068 6 2.449490 7 2.645751 - - - - - - - - - 8 2.828427 9 3.000000 10 3.162278 11 3.316625 12 3.464102 - - - - - - - - - - - - - - - - - - 13 3.605551 14 3.741657 @end verbatim @noindent and @file{Table2} contains @verbatim -6 Not_defined -4 Not_defined -2 Not_defined 0 0.000000 2 1.414216 4 2.000000 6 2.449494 8 2.828469 10 3.162278 12 3.464102 14 3.741658 ********************END @end verbatim @noindent then the output of @samp{numdiff -z 1:2 -Z 2:2 -f Table1 Table2} is @example -6 2.449490 -6 Not_defined -5 2.236068 < -4 2.000000 -4 Not_defined -3 1.732051 < -2 1.414214 -2 Not_defined -1 1.000000 < 0 0 0 0.000000 - - - - - - - - - < 1 1.000000 < 2 1.414214 2 1.414216 3 1.732051 < 4 2.000000 4 2.000000 - - - - - - - - - < 5 2.236068 < 6 2.449490 6 2.449494 7 2.645751 < - - - - - - - - - < 8 2.828427 8 2.828469 9 3.000000 < 10 3.162278 10 3.162278 11 3.316625 < 12 3.464102 12 3.464102 - - - - - - - - - < - - - - - - - - - < 13 3.605551 < 14 3.741657 14 3.741658 > ********************END +++ File "Table1" differs from file "Table2" @end example @noindent which is exactly what is expected. On the other hand the command @samp{numdiff -z 2 -f Table1 Table2} displays @example -6 2.449490 | -6 Not_defined -5 2.236068 | -4 Not_defined -4 2.000000 | -2 Not_defined -3 1.732051 < -2 1.414214 < -1 1.000000 < 0 0 0 0.000000 - - - - - - - - - < 1 1.000000 < 2 1.414214 2 1.414216 3 1.732051 < 4 2.000000 4 2.000000 - - - - - - - - - < 5 2.236068 < 6 2.449490 6 2.449494 7 2.645751 < - - - - - - - - - < 8 2.828427 8 2.828469 9 3.000000 < 10 3.162278 10 3.162278 11 3.316625 < 12 3.464102 12 3.464102 - - - - - - - - - < - - - - - - - - - < 13 3.605551 < 14 3.741657 14 3.741658 > ********************END +++ File "Table1" differs from file "Table2" @end example @noindent which is partially wrong. Notice that in @file{Table1} you find (truncated to the sixth decimal digit) the square roots of the absolute values of the integer numbers between -6 and 20, plus some randomly added lines. The file @file{Table2} contains some approximations (obtained by Newton's method) for the square roots of the even numbers between -6 and 20. Since the (real) square root is not defined for negative numbers, the values corresponding to -6, -4 and -2 are replaced by @verb{|Not_defined|}. Since @verb{|Not_defined|} is not a numeric value, during the execution of the last command the filter transforms @file{Table1} in this way @example -6 @bullet{} -5 @bullet{} -4 @bullet{} -3 @bullet{} -2 @bullet{} -1 @bullet{} 0 @bullet{} - - - - - - - - - 1 @bullet{} 2 @bullet{} 3 @bullet{} 4 @bullet{} - - - - - - - - - 5 @bullet{} 6 @bullet{} 7 @bullet{} - - - - - - - - - 8 @bullet{} 9 @bullet{} 10 @bullet{} 11 @bullet{} 12 @bullet{} - - - - - - - - - - - - - - - - - - 13 @bullet{} 14 @bullet{} @end example @noindent and @file{Table2} in this other way @example -6 Not_defined -4 Not_defined -2 Not_defined 0 @bullet{} 2 @bullet{} 4 @bullet{} 6 @bullet{} 8 @bullet{} 10 @bullet{} 12 @bullet{} 14 @bullet{} ********************END @end example @noindent Unfortunately the first three lines are enough to confuse the synchronization procedure, which is based on a byte by byte comparison with exclusion of the field delimiters, as we explained before. You can check that this is definitely the case by looking at the output of the command @samp{sdiff -W} on the transformed files, which is @example -6 @bullet{} | -6 Not_defined -5 @bullet{} | -4 Not_defined -4 @bullet{} | -2 Not_defined -3 @bullet{} < -2 @bullet{} < -1 @bullet{} < 0 @bullet{} 0 @bullet{} - - - - - - - - - < 1 @bullet{} < 2 @bullet{} 2 @bullet{} 3 @bullet{} < 4 @bullet{} 4 @bullet{} - - - - - - - - - < 5 @bullet{} < 6 @bullet{} 6 @bullet{} 7 @bullet{} < - - - - - - - - - < 8 @bullet{} 8 @bullet{} 9 @bullet{} < 10 @bullet{} 10 @bullet{} 11 @bullet{} < 12 @bullet{} 12 @bullet{} - - - - - - - - - < - - - - - - - - - < 13 @bullet{} < 14 @bullet{} 14 @bullet{} > ********************END @end example If we give the command @samp{numdiff -z 1:2 -Z 2:2 -f Table1 Table2} instead of @samp{numdiff -z 2 -f Table1 Table2}, the second field of the lines of @file{Table2} is always blurred. The filter transforms then @file{Table2} into @example -6 @bullet{} -4 @bullet{} -2 @bullet{} 0 @bullet{} 2 @bullet{} 4 @bullet{} 6 @bullet{} 8 @bullet{} 10 @bullet{} 12 @bullet{} 14 @bullet{} ********************END @end example @noindent and @i{re-synchronizes} the files @file{Table1} and @file{Table2} in the right way. Using the unconditional blurring is suggested in all cases when a certain field, which you want to include in the comparison (use @option{-X} to completely neglect one or more fields), is of numeric type in almost all lines of (one of) the given files. This can be the case e.g. when in some lines the content of the field is given by a special numeric value, like @verb{|Infinity|}, @verb{|Inf|}, @verb{|+Inf|} or @verb{|-Inf|}, or by @verb{|NaN|}, abbreviation for @i{Not a Number}. Concerning the numerical fields which are not blurred, one has to remark, that the filter is not confused by differences in the numeric format. Before the byte by byte comparison, numeric values are converted indeed to a standard format. To offer an example of this, let us suppose that @file{short1} contains a list of numbers with their logarithms @verbatim 0.001 -3 0.01 -2 0.1 -1 1 0 1000 3 1000000 6 1000000000 9 @end verbatim @noindent and @file{short2} the same list of numbers and logarithms, but with differences in the numeric format: @verbatim ****************** 0.0010000 -3 .0100 -2 0000.10 -1 1. 0 1,000.000 3 1,000,000. 6 1,000,000,000 9 @end verbatim @noindent Then @samp{numdiff -f -z 2- short1 short2} displays @example > ****************** 0.001 -3 0.0010000 -3 0.01 -2 .0100 -2 0.1 -1 0000.10 -1 1 0 1. 0 1000 3 1,000.000 3 1000000 6 1,000,000. 6 1000000000 9 1,000,000,000 9 +++ File "short1" differs from file "short2" @end example @noindent showing that the filter has matched the lines in the right way. The filter can even handle the case when the same numerical value is written in decimal notation in one file and in scientific notation in the other one. If the files @file{decimal} and @file{scientific} contain @verbatim .001 -3 .01 -2 .1 -1 * * * * * * * * * 1 0 1000 3 1000000 6 1000000000 9 @end verbatim @noindent and @verbatim ***************** 1.0e-3 -3 1.0e-2 -2 1.0e-1 -1 1.0e0 0 1.0e3 3 1.0e6 6 1.0e9 9 ***************** @end verbatim @noindent respectively, then @samp{numdiff -f -z 2- decimal scientific} shows @example > ***************** .001 -3 1.0e-3 -3 .01 -2 1.0e-2 -2 .1 -1 1.0e-1 -1 * * * * * * * * * < 1 0 1.0e0 0 1000 3 1.0e3 3 1000000 6 1.0e6 6 1000000000 9 1.0e9 9 > ***************** +++ File "decimal" differs from file "scientific" @end example @noindent proving that the filter does not get confused. No problems come out also in the case when for a same (not blurred) field the scientific notation is used in both files. If the files @file{sc1} and @file{sc2} contain @verbatim 1.E-3 -3 1.00E-2 -2 1.0E-1 -1 1.0000E0 0 001.0E3 3 +01.000E6 6 1.0E+09 9 1.0E+10 10 * * * * * * * * * * @end verbatim @noindent and @verbatim ***************** 1.0e-003 -3 1.0e-2 -2 1.0e-1 -1 1.0e0 0 +1.0e3 3 1.0e+6 6 1.0e9 9 @end verbatim @noindent respectively, then @samp{numdiff -f -z 2- sc1 sc2} correctly displays @example > ***************** 1.E-3 -3 1.0e-003 -3 1.00E-2 -2 1.0e-2 -2 1.0E-1 -1 1.0e-1 -1 1.0000E0 0 1.0e0 0 001.0E3 3 +1.0e3 3 +01.000E6 6 1.0e+6 6 1.0E+09 9 1.0e9 9 1.0E+10 10 < * * * * * * * * * * < +++ File "sc1" differs from file "sc2" @end example @noindent Since for example @samp{9876.54e-3} and @samp{-0.0087E4} are recognized by Numdiff as valid numerical values, it is important that the filter can recognize e.g. that @samp{123.456E+2} and @samp{1.23456E+4} are the same number. The filter is able indeed to handle even an improper use of the scientific notation. We can see this in the case of the files @file{Scnot1}: @verbatim ------------------------- 1.2E0 * 1 2.45E-1 * 2 -3.678E-2 * 3 @end verbatim @noindent and @file{Scnot2}: @verbatim 12E-1 * 1 245E-3 * 2 -0.003678E+1 * 3 @end verbatim @noindent @samp{numdiff -f -z 3- Scnot1 Scnot2} displays the report: @example ------------------------- < 1.2E0 * 1 12E-1 * 1 2.45E-1 * 2 245E-3 * 2 -3.678E-2 * 3 -0.003678E+1 * 3 +++ File "Scnot1" differs from file "Scnot2" @end example @noindent which is exactly what you would expect in such a case. Also pretty hard cases do not confuse the filter. Let @file{Scnot1} be given by @verbatim 1.2000e0 * 1 02.4500e-1 * 2 -003.678E-2 * 3 @end verbatim @noindent and let @file{Scnot2} be the same file as before. The command @samp{numdiff -f -z 3- Scnot1 Scnot2} gives again the expected output: @example 1.2000e0 * 1 12E-1 * 1 02.4500e-1 * 2 245E-3 * 2 -003.678E-2 * 3 -0.003678E+1 * 3 +++ Files "Scnot1" and "Scnot2" have the same structure @end example Till now we have always used the option @option{-f} with no argument. @anchor{Use of the option -f} However @option{-f} accepts an optional argument, which can be used to control how @option{-f} displays its output. If you provide an argument, care not to leave any space between the option and the argument. So @samp{-f60} is correct while @samp{-f 60} makes Numdiff terminate after printing an error message. If the argument is a positive number @var{NUM}, then the side by side output produced by @option{-f} will be @var{NUM} columns wide. The default value for the width of the output is 130, which can fit onto a traditional printer line, and is the one used when @option{-f} has no argument or the supplied argument is zero. In other words, @samp{-f} and @samp{-f0} are just easier to remind versions of @samp{-f130}. A negative number as argument for @option{-f} has the same effect as the positive number with the same absolute value, but in addition it causes the suppression of common lines from the output. For instance the command @samp{numdiff -z 1:2 -Z 2:2 -f-130 Table1 Table2} displays the following text @example -5 2.236068 < -3 1.732051 < -1 1.000000 < - - - - - - - - - < 1 1.000000 < 3 1.732051 < - - - - - - - - - < 5 2.236068 < 7 2.645751 < - - - - - - - - - < 9 3.000000 < 11 3.316625 < - - - - - - - - - < - - - - - - - - - < 13 3.605551 < > ********************END +++ File "Table1" differs from file "Table2" @end example In conjunction with the option @option{-f} you can use @option{-T} to expand tabs to spaces in the output produced by @option{-f}. This is useful to preserve the alignment of tabs in the input files, if it is thrown off by the presence of the gutter. The options @option{-H} and @option{-m} affect the performance of the filter of Numdiff. But performance has more than one dimension and these options improve one aspect of performance at the cost of another, or they improve performance in some cases while hurting it in others. The way that the filter re-synchronizes two files to compare always comes up with a near-minimal set of deletions/insertions of lines. Usually it is good enough for practical purposes. If the filter displays a large set of line deletions/insertions, you might want it to use a modified algorithm that sometimes produces a smaller set of differences. The @option{-m} option does this; however, it can also cause the filter to run more slowly than usual, so it is not the default behavior. When the files you are comparing are large and have small groups of changes scattered throughout them, you can use the @option{-H} option to make a different modification to the algorithm that the filter uses. If the input files have a constant small density of changes, where change means deletion/insertion of lines, this option speeds up the comparisons without changing the output or in the worst case with minor modifications. To conclude, Numdiff is not perfect but if you play with its options and with @command{ndselect} you can do a lot of nice and difficult things, which before just the human eye could do. @node Warnings, Index, Filtering, Top @chapter Warnings @cindex Warnings @cindex Notes @cindex Caveats @itemize @item Bug reports have to be sent to the address @email{ivprimi(at)libero(dot)it} . Please, put Numdiff in the subject and indicate the version of Numdiff you are using, the version of the operating system you are running and, if you know it, the version of the compiler used to build Numdiff. @item Numdiff does not accept numbers in scientific notation whose exponents lie outside the range -1073741824, @dots{}, +1073741824. If such a number is found in any of the files to compare, the execution of the program is stopped immediately after printing a suitable error message on stderr. Under the assumption that the numeric format in use is the default one, with "1.0001e-2147483640" the displayed error messages is @example numdiff: A number with a too small exponent has been found, namely "1.0001e-2147483640". Exponents smaller than -1073741824 are not accepted, the execution of the program ends now @end example @item @anchor{with GNU MP is better} If Numdiff has been built with its own internal support for multiple precision arithmetic instead of being linked against the GNU MP Library, then performance degradation and memory exhaustion can already make impossible to handle exponents of magnitude @math{10^6 = 1000000}. This is what I obtained on my laptop, equipped with a dual core processor @@1.50 GHz and with 1GB of RAM, when I tried to compare the numbers 1.101e1000000000 and 1.0e1000000000: @example numdiff: Insufficient memory for new allocation, the execution of the program ends now @end example In addition, you can overload the processor with numbers whose exponents lie outside the range -1000000, @dots{}, 1000000. But at least on my machine, everything works fine and quick enough as long as exponent and size of the mantissa of the numbers are in the range -1000, @dots{}, 1000. Be careful and remember that Numdiff is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Consider also that, if you have numerical data with exponents outside the range -300, @dots{}, 300, probably there is something wrong with your data: either you are using the wrong scale, or you should replace very small numbers, like 1e-100, by zero, or it is quite likely that the machine/program/algorithm which produced these data is not working right :D @item If Numdiff has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user. @item After reading a numerical field, Numdiff truncates its value if this number has @i{too much} digits with respect to the current precision. To be precise, denoted by @var{P} the current value of the precision, the following rules apply. If @command{numdiff} has been built with its own internal support for multiple precision arithmetic, then @itemize @item if the number is written in ordinary decimal notation, @command{numdiff} will consider, in addition to all digits of the integer part, only the first @var{P} digits of the fractional part; @item if the value is written in scientific notation, then @command{numdiff} will only consider the first @var{P} digits of the fractional part of the mantissa. @end itemize If @command{numdiff} uses the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first @var{P} digits of the fractional part of the mantissa are considered. By current value of the precision I mean the integer value specified by the option @option{-#}, or the default one (35) when this option is not in use. @item You can find out whether your local version of @command{numdiff} is relying on GNU MP or not by executing the command @samp{numdiff -v}. If @command{numdiff} uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information: @example The software has been linked against the GNU Multiple Precision Arithmetic Library, version number 4.2.4. @end example @noindent If @command{numdiff} does not rely on GNU MP, then the displayed message will be (up to translation into your mother language) @example The software has been built with its own internal support for multiple precision arithmetic. @end example @item Numdiff manages perfectly only text files with an 8-bit encoding (ASCII and ISO 8859-* text files). The use of Numdiff with UTF-8 text files suffers from some restrictions (numbers and field delimiters must consist of ASCII characters, i.e. characters with the most significant bit equal to 0). @item If you are not including the so called white-space characters (usually @samp{ }, @samp{\t}, @samp{\f}, @samp{\v} and @samp{\r}) in the set of field delimiters, then a real and an imaginary number which are separated just by white-spaces can be coupled together and considered as a whole complex number. For example, if you are using only @strong{colon} (@samp{:}) and @strong{newline} as field delimiters and Numdiff finds a line like that @verbatim ::::3.0-5.6e-356i::::-12.9 +4.34i::::-12.9 4.34i::::New York:::: @end verbatim @noindent then it will consider this line as formed by four fields, the first two are numerical and given by the complex numbers @i{3.0-5.6e-356i} and @i{-12.9+4.34i}, the last two ones are the strings @verb{|New York|} and @verb{|-12.9 4.34i|}. I still do not know if I will modify this in the next version of Numdiff, so that the program recognizes only @verb{|3.0-5.6e-356i|} as numerical field and treats @verb{|-12.9 +4.34i|} as non-numerical because of the presence of spaces in the middle. @verb{|-12.9 4.34i|} is already considered as non-numerical due to the absence of a leading sign in the imaginary value. @item We have seen that one of the two files passed to @command{numdiff} can be @verb{|-|}, which refers to stdin (standard input). In this way one of the two files to compare can be the output produced by another command, like in @samp{cat file2 | numdiff -a 1.0e-3 file1 -}. However, if you trigger the filter through the options @option{-z} or/and @option{-Z}, Numdiff can not work with the standard input unless you use also the option @option{-f}. So the command @samp{cat file2 | numdiff -a 1.0e-3 -z @@ file1 -} displays only the error message @verbatim numdiff: -: Illegal seek @end verbatim (or maybe the translation of this message in the language you are using on your computer) but @samp{cat file2 | numdiff -a 1.0e-3 -z @@ -f file1 -} works as expected. @item This manual describes the version 5.x of Numdiff. Versions 4.0.0 and 3.x used even a different format for the output. @end itemize @node GNU Free Documentation License, , , Top @appendix GNU Free Documentation License @cindex GNU Free Documentation License @cindex GNU FDL @cindex FDL @include fdl.texi @node Index, , Warnings, Top @unnumbered Index @printindex cp @bye cmtk-3.0.0/Utilities/numdiff-5.2.1/docs/numdiff.html0000644000177700000170000057301411666247630021046 0ustar torstenman Numdiff Manual 5.2

        Numdiff Manual 5.2


        Next: , Previous: (dir), Up: (dir)

        Numdiff User Manual

        “...und der eignen Kraft vertrauend steigt ein frei Geschlecht empor!”

        
        
        
        This manual describes how to install and use Numdiff, a program which compares putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats.

        Copyright © 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi ivprimi(at)libero(dot)it

        Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being "Numdiff User Manual, version 5.2", and with no Back-Cover Texts. A copy of the license is included in GNU Free Documentation License.


        Next: , Previous: Top, Up: Top

        1 Copying

        Numdiff (also written numdiff) is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

        Numdiff 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 General Public License along with this program. If not, see http://www.gnu.org/licenses/.


        Next: , Previous: Copying, Up: Top

        2 Acknowledgments

        I want to thank Mr. Norman Clerman norm(dot)opcon(at)fuse(dot)net for several suggestions he gave me to improve the readability and the effectiveness of the output produced by Numdiff. He also pointed out the need to implement a filter to resynchronize the lines between two files in case of addition or deletion of one or more lines. I have to give him credit for the urge to prepare the versions 4.x and 5.x of Numdiff.

        Moreover, I want to thank my friends Mariapia Palombaro, since she removed some errors while reviewing the first version of this document, and Paolo Caramanica, who suggested me to add more information to the output of the option -S.


        Next: , Previous: Acknowledgments, Up: Top

        3 Overview

        Computer users often find occasion to ask how two files differ. Perhaps one file is a newer version of the other file. Or maybe the two files started out as identical copies but were changed by different people.

        There are several ways to think about the differences between two files. One way to think of the differences is as a series of lines that were deleted from, inserted in, or changed in one file to produce the other file. The well-known diff program compares two files line by line, finds groups of lines that differ, and reports each group of differing lines. Without particular options, the diff program considers any change in the amount or in the type of the characters as a relevant difference. However, trough some command line options it also provides ways to suppress certain kinds of differences that are not important to the user. For instance, diff provides ways to ignore differences in the amount of white space between words or lines, or differences in alphabetic case.

        Another way to think of the differences is as a series of words that were deleted from, inserted in, or changed in one file to produce the other file. Here “word” refers to a sequence of non white-space characters delimited by a couple of white-spaces, one before and the other one after the word.

        The less known wdiff program by Franc,ois Pinard pinard(at)iro(dot)umontreal(dot)ca compares words in two files and reports the differences.

        At last, one can think of the differences between two files as a sequence of pairs of bytes that can be either identical or different. The cmp program reports the differences between two files byte by byte, instead of line by line or word by word. As a result, it is often more useful than diff or wdiff for comparing binary files.

        However, none of these approaches turns out to be good when you want to compare a couple of text files composed partially or entirely by numerical fields. Indeed, when you compare a couple of such files, what you want to obtain usually is a list of the numerical fields in the second file which numerically differ from the corresponding fields in the first file. But, as you probably knows, a same number can be written using different notations and programs like diff or wdiff can not recognize whether a difference between two numeric fields is only due to the notation or is actually a difference of numerical values.

        For instance, 11.23 and 11.2300000 are the same number but represented in different ways. While, if you are interested in the numerical values, it is obvious that the difference in the representation is not meaningful and then it should be ignored, however diff and wdiff consider the previous one as a relevant difference and there is no way for you to tell these programs to ignore it !

        Another example of this type is given by 98765.4321 and 9.87654321E04 where the difference is only due to the use of the scientific notation in place of the ordinary decimal notation.

        Moreover, depending on your country you could stick to different conventions in writing numbers. For instance, the amount “three hundred millions and fifty-two thousands of dollars and forty-six cents” is usually written by an Italian accountant as 300.052.000,46$ while an American accountant would write 300,052,000.46$. Of course, 300.052.000,46$ and 300,052,000.46$ represent the same amount of money but diff and wdiff would report a difference, which probably is not what you want in a similar case.

        At last, sometimes you could want to ignore even differences in numerical values as long as they do not overcome a certain threshold. In other words, you could desire to suppress all “small” numerical differences too.

        For instance, it could happen that you want to ignore all numerical differences whose absolute value is not greater than 0.0001. If this is the case, then the numerical fields 33 and 33.00009 must be considered equal, while 33 and 33.00011 must be reported as different.

        However, diff and wdiff can not be used to ignore “small” numerical differences, since they do not even know what a numerical difference is.

        What I have been saying till now explains why I decided to implement a new program with the capability to “appropriately” compare files containing numerical fields. In writing this program I was inspired by ndiff, a GPL'ed software by Nelson H. Baabe of the Salt Lake City University. The author of ndiff had the same good reasons as me to write ndiff. ndiff is actually a good tool and I used it for a while. But I did not completely like the way it works and so numdiff was born. Although ndiff inspired numdiff, they are completely different from the viewpoint of the source code: numdiff has been entirely written from scratch with the addition of code coming from GNU bc, GNU diff and GNUlib. In addition, the last versions of Numdiff offer much more features than ndiff does.

        numdiff can be used to compare putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. numdiff takes two mandatory arguments, the paths of the two files to compare, and, after splitting them into lines and the lines into fields according to a given list of field delimiters, it compares every field of every line of the first file with the corresponding field of the second file. What corresponding here exactly means depends on the options passed to the program on the command line. With no options, corresponding means the field of the second file at the same position, where position refers both to the line number and to the location within the line. If the compared fields are both legal numerical values, then numdiff performs a numerical comparison between them, else it performs a literal comparison, i.e. the usual byte by byte comparison. In case of literal comparison, two fields are regarded as equal if they are formed by the same sequence of characters. In case of numerical comparison and without specific command line options, two fields are regarded as equal if their numerical difference is zero. Be careful ! If you do not explicitly specify a list of field delimiters by the option -s, then numdiff takes as field delimiters the characters newline (‘\n’, ASCII code 0x0A), horizontal tabulation (‘\t’, ASCII code 0x09), and blank (‘ ’, ASCII code 0x20).

        For instance, if the file list1 contains the data

        accident        123     23Joshua          34.55           +3+4i	        water
        dog       -3455.321     cat             2.345678e-9     .0005-6.23e2i
        
        

        and file list2 contains the data

        Accident        123     23456          34.5500         +3.0001+4i
        dog       -3455.320098  Cat     +2.345678e-9            -6.23e2i    $$$
        A new line
        
        

        then the output of the command ‘numdiff list1 list2’ will be:

             ----------------
             ##1       #:1   <== accident
             ##1       #:1   ==> Accident
             @                                                     @@
             ##1       #:3   <== 23Joshua
             ##1       #:3   ==> 23456
             @                                                     @@
             ##1       #:5   <== +3+4i
             ##1       #:5   ==> +3.0001+4i
             @ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5
             ##1       #>6   <== water
             ##1             ==>
             @ Line 1 in file "list2" is shorter than expected!
             ----------------
             ##2       #:2   <== -3455.321
             ##2       #:2   ==> -3455.320098
             @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7
             ##2       #:3   <== cat
             ##2       #:3   ==> Cat
             @                                                     @@
             ##2       #:5   <== .0005-6.23e2i
             ##2       #:5   ==> -6.23e2i
             @ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7
             ##2             <==
             ##2       #>6   ==> $$$
             @ Line 2 in file "list1" is shorter than expected!
             ----------------
             ##3             <==
             ##3       #>1   ==> A new line
             @ Line 3 in file "list1" is shorter than expected!
             ----------------
                       <==
             ##4       ==>
             
             
             +++  File "list1" differs from file "list2"
        

        At the same time numdiff will print the following error message on stderr:

             ***  End of file "list1" reached
                  Likely the files "list1" and "list2" do not have the same number of lines !
        

        It is worth remarking that numdiff can recognize complex numbers, provided that they are written in the form a+bi or a-bi with no extra characters between the values a, b and the sign + or - (the symbol i used to represent the imaginary unit can be actually changed by a suitable command line option, see Invoking numdiff). If you do not know what complex numbers are, do not worry! In this case probably you will never manage files containing complex numbers and so you can happily continue to ignore them. :)

        Let us consider now an example which shows how Numdiff can resynchronize the lines between two files in case of addition or deletion of one or more lines. The versions of Numdiff prior to 5 did not work well if one of the two files to compare contains in the middle some lines more or less than the other one. For instance, if you have one file that is 1000 lines long that you are comparing to a second file 1001 lines long, and except for that one extra line, located, let us say, at line 500, the files are identical, then numdiff version 4.x does not show only the one line difference: once the files are out of synchronization numdiff 4.x reports every line as different. Since version 5 it is possible in such cases to activate a filter which handles additions and deletions of lines. There are several options ruling how the filter actually works and I will give later a detailed explanation on how to use them to obtain each time the wished result. The simplest way to activate the filter consists in using the option -z @. If bill1 and bill2 are given by

         Month          Expenses
        -------------------------
         Jan09          $  233.56
         Feb09          $  850.77
         Mar09          $   12.55
         Apr09          $  524.00
         May09          $   78.25
         Jun09          $  230.00
         Jul09          $  443.10
         Aug09          $   67.65
         Sep09          $   10.00
         Oct09          $  201.45
         Nov09          $  110.00
         Dec09          $  200.27
        -------------------------
        Total           $ 2961.60
        

        and

         Month          Expenses
         Jan09          $  234.00
         Mar09          $   13.00
         May09          $   78.25
         Jul09          $  443.10
         Sep09          $   10.00
         Nov09          $  110.00
         Jan10          $  200.00
        -------------------------
        
        Total           $ 1088.35   
        

        respectively, then the differences between the two files are:

        • the insertion of the separator ------------------------- in bill1 before the list of the months,
        • the deletion in bill2 of the lines related to the expenses for the months February, April, June, August, October, December,
        • small changes in bill2 to the expenses of the months January (2009) and March,
        • the presence in bill2 of an entry for January 2010 just before the separator -------------------------,
        • the addition of an empty line to bill2 after the separator -------------------------,
        • and the different values for the total sum of the expenses.

        The output of the command ‘numdiff -z @ -V bill1 bill2’ (I have added here the option -V to let Numdiff show which couples of lines it is comparing each time) is exactly then what you expect:

             
             ----------------
             ##2       <== -------------------------
                       ==>
             
             ----------------
             ##3       <==  Jan09          $  233.56
             ##2       ==>  Jan09          $  234.00
             
             ##3       #:3   <== 233.56
             ##2       #:3   ==> 234.00
             @ Absolute error = 4.4000000000e-1, Relative error = 1.8838842268e-3
             ----------------
             ##4       <==  Feb09          $  850.77
                       ==>
             
             ----------------
             ##5       <==  Mar09          $   12.55
             ##3       ==>  Mar09          $   13.00
             
             ##5       #:3   <== 12.55
             ##3       #:3   ==> 13.00
             @ Absolute error = 4.5000000000e-1, Relative error = 3.5856573705e-2
             ----------------
             ##6       <==  Apr09          $  524.00
                       ==>
             
             ----------------
             ##8       <==  Jun09          $  230.00
                       ==>
             
             ----------------
             ##10      <==  Aug09          $   67.65
                       ==>
             
             ----------------
             ##12      <==  Oct09          $  201.45
                       ==>
             
             ----------------
             ##14      <==  Dec09          $  200.27
             ##8       ==>  Jan10          $  200.00
             
             ##14      #:1   <== Dec09
             ##8       #:1   ==> Jan10
             @                                                     @@
             ##14      #:3   <== 200.27
             ##8       #:3   ==> 200.00
             @ Absolute error = 2.7000000000e-1, Relative error = 1.3500000000e-3
             ----------------
                       <==
             ##10      ==>
             
             ----------------
             ##16      <== Total           $ 2961.60
             ##11      ==> Total           $ 1088.35
             
             ##16      #:3   <== 2961.60
             ##11      #:3   ==> 1088.35
             @ Absolute error = 1.8732500000e+3, Relative error = 1.7211834428e+0
             
             +++  File "bill1" differs from file "bill2"
             
        

        Numdiff has reported correctly the following differences:

        • the second line of file bill1, i.e. the one containing the separator, has no correspondance, or, if you prefer, has been deleted from file bill2.
        • The lines related to the months January 2009 and March have been slightly modified in bill2, namely the values of the expenses are slightly different. Notice that the line with the expenses for January 2009 is the third one in file bill1 and the second one in file bill2. This information is printed by Numdiff in the form
                    ##3       <==  Jan09          $  233.56
                    ##2       ==>  Jan09          $  234.00
          

          Analogously

                    ##5       <==  Mar09          $   12.55
                    ##3       ==>  Mar09          $   13.00
          

          says that the line for March is the fifth one in bill1 and the third one in bill2.

        • The line related to the total amount of the expenses appears also differently in the two files, since the amount of the expenses is different. Notice that this line is the 16th one in file bill1 and the 11th one in file bill2.
        • The lines related to the months February, April, June, August and October, i.e. the lines no. 4, 6, 8, 10 and 12 of bill1, are not present in bill2.
        • The line of bill1 with the expenses for December 2009 is replaced in bill2 by the line containing the value of the expenses for January 2010.
        • The tenth line of bill2, i.e. the empty line after the separator, is not present in bill1. With respect to bill1 this line represents then an addition.

        However, if you compare bill1 and bill2 without using the option -z @, the result is completely misleading. This is the output of ‘numdiff -V bill1 bill2’:

             
             ----------------
             ##2       <== -------------------------
             ##2       ==>  Jan09          $  234.00
             
             ##2       #:1   <== -------------------------
             ##2       #:1   ==> Jan09
             @                                                     @@
             ##2             <==
             ##2       #>2   ==> $  234.00
             @ Line 2 in file "bill1" is shorter than expected!
             ----------------
             ##3       <==  Jan09          $  233.56
             ##3       ==>  Mar09          $   13.00
             
             ##3       #:1   <== Jan09
             ##3       #:1   ==> Mar09
             @                                                     @@
             ##3       #:3   <== 233.56
             ##3       #:3   ==> 13.00
             @ Absolute error = 2.2056000000e+2, Relative error = 1.6966153846e+1
             ----------------
             ##4       <==  Feb09          $  850.77
             ##4       ==>  May09          $   78.25
             
             ##4       #:1   <== Feb09
             ##4       #:1   ==> May09
             @                                                     @@
             ##4       #:3   <== 850.77
             ##4       #:3   ==> 78.25
             @ Absolute error = 7.7252000000e+2, Relative error = 9.8724600639e+0
             ----------------
             ##5       <==  Mar09          $   12.55
             ##5       ==>  Jul09          $  443.10
             
             ##5       #:1   <== Mar09
             ##5       #:1   ==> Jul09
             @                                                     @@
             ##5       #:3   <== 12.55
             ##5       #:3   ==> 443.10
             @ Absolute error = 4.3055000000e+2, Relative error = 3.4306772908e+1
             ----------------
             ##6       <==  Apr09          $  524.00
             ##6       ==>  Sep09          $   10.00
             
             ##6       #:1   <== Apr09
             ##6       #:1   ==> Sep09
             @                                                     @@
             ##6       #:3   <== 524.00
             ##6       #:3   ==> 10.00
             @ Absolute error = 5.1400000000e+2, Relative error = 5.1400000000e+1
             ----------------
             ##7       <==  May09          $   78.25
             ##7       ==>  Nov09          $  110.00
             
             ##7       #:1   <== May09
             ##7       #:1   ==> Nov09
             @                                                     @@
             ##7       #:3   <== 78.25
             ##7       #:3   ==> 110.00
             @ Absolute error = 3.1750000000e+1, Relative error = 4.0575079872e-1
             ----------------
             ##8       <==  Jun09          $  230.00
             ##8       ==>  Jan10          $  200.00
             
             ##8       #:1   <== Jun09
             ##8       #:1   ==> Jan10
             @                                                     @@
             ##8       #:3   <== 230.00
             ##8       #:3   ==> 200.00
             @ Absolute error = 3.0000000000e+1, Relative error = 1.5000000000e-1
             ----------------
             ##9       <==  Jul09          $  443.10
             ##9       ==> -------------------------
             
             ##9       #:1   <== Jul09
             ##9       #:1   ==> -------------------------
             @                                                     @@
             ##9       #>2   <== $  443.10
             ##9             ==>
             @ Line 9 in file "bill2" is shorter than expected!
             ----------------
             ##10      <==  Aug09          $   67.65
             ##10      ==>
             
             ##10      #>1   <== Aug09          $   67.65
             ##10            ==>
             @ Line 10 in file "bill2" is shorter than expected!
             ----------------
             ##11      <==  Sep09          $   10.00
             ##11      ==> Total           $ 1088.35
             
             ##11      #:1   <== Sep09
             ##11      #:1   ==> Total
             @                                                     @@
             ##11      #:3   <== 10.00
             ##11      #:3   ==> 1088.35
             @ Absolute error = 1.0783500000e+3, Relative error = 1.0783500000e+2
             ----------------
             ##12      <==  Oct09          $  201.45
                       ==>
             
             
             ***  End of file "bill2" reached
                  Likely the files "bill1" and "bill2" do not have the same number of lines !
             
             +++  File "bill1" differs from file "bill2"
        

        Numdiff compares now the first, second, third line of bill1 with the first, second, third line of bill2 and so on. But this is not probably what you want in such a case: what is reasonable here is to compare entries related to the same month and not lines having the same location (i.e. line number).

        Numdiff offers also an option to run just the filter and see how it resynchronizes the two given files without doing any comparison between corresponding lines. The output of ‘numdiff -z @ -f bill1 bill2’ is

              Month          Expenses          Month          Expenses
             -------------------------     <
              Jan09          $  233.56         Jan09          $  234.00
              Feb09          $  850.77     <
              Mar09          $   12.55         Mar09          $   13.00
              Apr09          $  524.00     <
              May09          $   78.25         May09          $   78.25
              Jun09          $  230.00     <
              Jul09          $  443.10         Jul09          $  443.10
              Aug09          $   67.65     <
              Sep09          $   10.00         Sep09          $   10.00
              Oct09          $  201.45     <
              Nov09          $  110.00         Nov09          $  110.00
              Dec09          $  200.27     |   Jan10          $  200.00
             -------------------------        -------------------------
                                           >
             Total           $ 2961.60        Total           $ 1088.35
             
             
             +++  File "bill1" differs from file "bill2"
        

        and shows that the filter is doing its job in the right way, associating the lines according to the month and not to the line number. Running just the filter is extremely useful in all situations when you are not sure if the filter is working as you wish. You have indeed to instruct the filter in the right way to let it work correctly, and this requires the use of different options depending on the structure of the files to compare. Since to guess the right options can be sometime tricky, running just the filter and see the result is the best way to be certain that you are setting up everything correctly. Later, see Filtering, I will explain in detail

        • what the filter does behind the scenes to understand if and how it has to resynchronize the files to compare,
        • and how the related options affect the action of the filter.

        By the way, it is even possible to use -f without any other additional option for the filter, like in ‘numdiff -f bill1 bill2’, but the result is more or less the same you would obtain by performing a byte by byte comparison with removal of the field delimiters.

        The option -f can be followed by an argument in the form of an integer number whose meaning will be explained later, see Use of the option -f.

        Even if the output of numdiff is self-explanatory, in the next section I will explain in details all you have to know about it.


        Up: Overview

        3.1 Output format

        Let us go back to our first example. If the files list1 and list2 contain the data

        accident        123     23Joshua          34.55           +3+4i	        water
        dog       -3455.321     cat             2.345678e-9     .0005-6.23e2i
        
        

        and

        Accident        123     23456          34.5500         +3.0001+4i
        dog       -3455.320098  Cat     +2.345678e-9            -6.23e2i    $$$
        A new line
        
        

        respectively, then the output of the command ‘numdiff list1 list2’ will be:

             ----------------
             ##1       #:1   <== accident
             ##1       #:1   ==> Accident
             @                                                     @@
             ##1       #:3   <== 23Joshua
             ##1       #:3   ==> 23456
             @                                                     @@
             ##1       #:5   <== +3+4i
             ##1       #:5   ==> +3.0001+4i
             @ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5
             ##1       #>6   <== water
             ##1             ==>
             @ Line 1 in file "list2" is shorter than expected!
             ----------------
             ##2       #:2   <== -3455.321
             ##2       #:2   ==> -3455.320098
             @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7
             ##2       #:3   <== cat
             ##2       #:3   ==> Cat
             @                                                     @@
             ##2       #:5   <== .0005-6.23e2i
             ##2       #:5   ==> -6.23e2i
             @ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7
             ##2             <==
             ##2       #>6   ==> $$$
             @ Line 2 in file "list1" is shorter than expected!
             ----------------
             ##3             <==
             ##3       #>1   ==> A new line
             @ Line 3 in file "list1" is shorter than expected!
             ----------------
                       <==
             ##4       ==>
             
             
             +++  File "list1" differs from file "list2"
        

        numdiff prints a report on the standard output for every field of the first file which differs from the corresponding field of the second one.

        First this report indicates the locations of the fields, namely the numbers of the lines where the fields appear and their positions within the line. The position in the line is “1” for the first field of a line, “2” for the second field, “3” for the third one and so on: fields are numerated starting from the left hand of the line and proceeding towards the right hand. For each report the line number is introduced by the symbol “##”, while the field number by “#:”. Then numdiff shows in what the difference consists. For instance,

             ##1       #:1   <== accident
             ##1       #:1   ==> Accident
             @                                                     @@
        

        means that the first field of the first line is “accident” in the first file, while in the second file it appears as “Accident”. This difference could be then canceled by removing “accident” from the first file and inserting “Accident” in place of it. The arrows “<==” and “==>” try to visualize this idea. Analogously,

             ##2       #:2   <== -3455.321
             ##2       #:2   ==> -3455.320098
             @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7
        

        means that the second field of the second line is “-3455.321” in the first file and “-3455.320098” in the second one. Since the contents of the field are numerical in both files, numdiff also prints the absolute and relative errors.

        The absolute error (or absolute difference) is given by the absolute value of the difference between the values appearing in the two files.

        The relative error (or relative difference) is actually defined in a more complicated way. If n1 is the value appearing in the first file and n2 is the value in the second file, then the absolute error is given by the formula A=|n1-n2|, while the relative error R is given by:

        • R = 0 if n1 and n2 are equal,
        • Inf (infinity) if n2 differs from n1 and at least one of them is zero,
        • R = A/ min(|n1|, |n2|) if n1 and n2 are both non zero and n2 differs from n1. min(|n1|, |n2|) denotes the minimum between the absolute value of n1 and the absolute value of n2.

        With these definitions of absolute and relative error it turns out that A(n2, n1) = A(n1, n2) and R(n2, n1) = R(n1, n2). In other words, the absolute/relative error does not change if you only change the order of the compared values. Since version 5 it is actually possible to let Numdiff compute the relative error always with respect to the value from the first file or always with respect to the value from the second file, instead of using the preceding formula. This can be done through the option -r by writing its argument in a special form, see Alternative formulas for the computation of the relative difference.

        If at least one of the compared fields is not numerical, then the output line reporting absolute and relative errors is replaced by the separator:

        @                                                     @@
        

        It can happen that a line in one of the two files to compare contains more fields than the corresponding line of the other file. When this is the case, numdiff reports this difference by telling that a certain line (identified by its line number) appears to be shorter than expected, just as in

             ##1       #>6   <== water
             ##1             ==>
             @ Line 1 in file "list2" is shorter than expected!
        

        or in

             ##3             <==
             ##3       #>1   ==> A new line
             @ Line 3 in file "list1" is shorter than expected!
        

        In addition, numdiff shows the tail of the longer line, using the notation “#>n” to indicate the number n of the first field of the longer line for which there is no corresponding field in the shorter line. For instance,

             ##1       #>6   <== water
             ##1             ==>
             @ Line 1 in file "list2" is shorter than expected!
        

        means that for none of the fields of the first line starting from the sixth one there exists a corresponding field in the second file (list2). In this context, the symbol <<*>> (when it appears) is used to denote the End-Of-File, i.e. a line or the tail of a line which is located at the end of the corresponding file and does not have a terminating newline character.

        It can also happen that one of the two files to compare has less lines than the other one. In this case, if no special option is passed to the program, numdiff prints the number of the first line which appears in only one of the two files. Moreover, it prints on the standard error a message telling in which of the two files the end has been prematurely reached:

             ***  End of file "list1" reached
                  Likely the files "list1" and "list2" do not have the same number of lines !
        

        Unless the option -q is used (see Invoking numdiff), numdiff prints on standard output a message reporting the final status of the comparison. This message says either the two files are equal or they are different, just as in the example we are considering:

             +++  File "list1" differs from file "list2"
        

        The output produced just by running the filter is a side by side difference listing of the two compared files, like the one displayed by GNU sdiff. The files are listed in two columns with a gutter between them. The gutter contains one of the following markers:

        white space
        The corresponding lines are in common. That is, either the lines are identical, or the difference is ignored because of one of the options -I, -X, -z and -Z.
        |
        The corresponding lines differ, and they are either both complete or both incomplete.
        <
        (
        The files differ and only the first file contains the line.
        >
        )
        The files differ and only the second file contains the line.
        \
        The corresponding lines differ, and only the first line is incomplete.
        /
        The corresponding lines differ, and only the second line is incomplete.

        An input line is incomplete if its last character is not a newline. This can happen only if the line is the last one of its file. When an output line of the side by side difference listing represents two differing lines, one might be incomplete while the other is not. In this case the gutter is marked ‘\’ if the line from the first file is incomplete, ‘/’ if the line from the second file is.

        Side by side format is easy to read, but it has limitations. It generates much wider output than usual, and truncates lines that are too long to fit. Also, it relies on lining up output quite heavily, so its output looks particularly bad if you use varying width fonts, nonstandard tab stops, or nonprinting characters.

        The option -f can take an optional argument, which allows to set the width of the output and eventually to suppress common lines, see Invoking numdiff and Use of the option -f.

        More generally, the user can always make numdiff avoid to print, partially or totally, the messages that it would otherwise send to standard output. This can be achieved by some suitable command line options, see Invoking numdiff.


        Next: , Previous: Overview, Up: Top

        4 Installing

        To successfully compile, build and install Numdiff some tools are required. The first one is an ANSI C compiler. This compiler should at least accept the option -o to write its output to a specified file, the option -D for macros predefinition, the option -l to search for a specified library, and the options -I and -L to add a given directory to the search path for include and library files respectively.

        Numdiff has been successfully compiled and tested on Slackware® GNU/Linux 10.2 with the version 3.3.6 of the GNU C Compiler (GCC), on Slackware GNU/Linux 11 with GCC 3.4.6, on Slackware GNU/Linux 12.2 with GCC 4.2.4, on Slackware GNU/Linux 13 with GCC 4.3.3, on Debian® GNU/Linux 4.0 with GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21), on SunOS® 5.8 with GCC 2.95.3, and on SunOS 5.10 (i386) with the version 5.9 of the Sun C compiler.

        Moreover, you need a POSIX implementation of the make utility (I used both GNU make and smake by Joerg Schilling to compile Numdiff) and a POSIX implementation of the commands rm and find. At last, you need a proper installation of GNU Texinfo (in order to install the info documentation) and a shell sh-compatible.

        Configuration, building and installation of Numdiff can be performed through the standard three steps:

                     ./configure
                     make
                     make install
        

        If you leave enabled the Natural Language Support and you also want to install the localization files (at the moment only the Italian localization is supplied), then, after ‘make’, you will have to type and run

                     make install-nls
        

        By default, ‘make install’ will install all the files in /usr/local/bin, /usr/local/info etc. You can specify an installation prefix other than /usr/local using the option --prefix in the configure step, for instance ‘--prefix=$HOME’:

                     ./configure --prefix=$HOME
        

        For better control, you can use the options --bindir, --infodir, and so on. Type ‘./configure --help’ to obtain the complete list of all the available options.

        Anyway, the documentation files, including a full User Manual available in several formats (HTML, PDF and plain ASCII text), will always be put in DOCDIR/numdiff, where DOCDIR is the path specified by the option --docdir or, if this option has not been given to configure, PREFIX/local/doc. Here PREFIX is the installation prefix specified by the option --prefix or the default /usr/local.

        Once Numdiff has been installed you can remove all the files previously installed by a simple ‘make uninstall’. If you have also installed the localization files trough ‘make install-nls’, then, in order to remove also these ones, use ‘make uninstall-nls’ in place of ‘make uninstall’.

        Between the options accepted by configure there are --enable-debug, --enable-optimization, --enable-nls and --enable-gmp.

        The option --enable-debug turns on debugging when compiling the source code. This is obtained by passing to the compiler the -g option, but you can change this default debugging flag (which could not even be recognized by your compiler) by setting the environment variable DBGFLAGS before calling configure.

        The option --enable-optimization turns on basic optimization when compiling the source code. This is obtained by passing to the compiler the -O option, but you can change this default flag (which could not even be recognized by your compiler) by setting the environment variable OPTFLAGS before calling configure.

        The option --enable-nls turns on Natural Language Support. But you do not need to use it explicitly, since Natural Language Support is enabled by default. However, you can disable it by using --disable-nls. Disabling Natural Language Support is suggested whenever you want to install Numdiff on a system where the GNU gettext library is not present. In this case the installation of Numdiff can be accomplished, for instance, through

                     ./configure --disable-nls
                     make
                     make install
        

        Since version 5.2.0 Numdiff uses to perform all computations the GNU Multiple Precision Arithmetic Library (also called GNU MP or GMP), if this library is available at build-time. The old internal support for multiple precision arithmetic is a fall-back in case GNU MP is absent. However it is possible to use the internal support for multiple precision arithmetic even when GNU MP is available: it is sufficient to pass the option --enable-gmp=no or --disable-gmp to the configure script before building the program, like in

                     ./configure --disable-gmp
                     make
                     make install
        

        Enabling the old internal support for multiple precision arithmetic is deprecated, see with GNU MP is better. The latest version of GNU MP is available at ftp://ftp.gnu.org/gnu/gmp/. See the GNU MP web page at http://gmplib.org/ for up-to-date information on GNU MP.


        Next: , Previous: Installing, Up: Top

        5 Invoking numdiff

        SYNOPSIS

                numdiff -h|--help|-v|--version
        

        or

                numdiff [-s IFS][-a MAXERR][-r MAXERR][-2][-# PREC][-P][-N][-I]
                [-d C1C2][-t C1C2][-g N1N2][-p C1C2][-n C1C2][-e C1C2][-i C1C2]
                [-X 1:INT][-X 2:INT][-E][-D][-b][-V][-q][-S][-z 1:INT][-z 2:INT]
                [-Z 1:INT][-Z 2:INT][-m][-H][-f[NUM]][-T][-l PATH][-o PATH]
                file1 file2
        

        where file1 and file2 are the names of the two files to compare and INT stays for a positive integer value or for a range of integer values, like 1-, 3-5 or -7.

        In the first case numdiff prints a short help (not so short actually :)) or/and version number, Copyright, License notice, NO-Warranty disclaimer and some information about the way it was built. In the second case numdiff compares the files specified by the two (mandatory) arguments which follow the list of the options. The complete path of a file should be given, a directory name is not accepted. Moreover, the two arguments cannot refer to the same file but one of them can be -, which refers to stdin.

        OPTIONS

        -s, --separator=IFS
        Specify the set of characters to use to split the input lines into fields (The default set of characters is space, tab and newline)
        -a, --absolute-tolerance=MAXERR
        Specify the maximum absolute difference permitted before that two numeric fields are regarded as different (The default value is zero)
        -r, --relative-tolerance=MAXERR
        Specify the maximum relative difference permitted before that two numeric fields are regarded as different (The default value is zero)
        -2, --strict
        Order that two numerical values are regarded as equal only if both absolute and relative difference do not exceed the corresponding tolerance threshold
        -#, --digits=PREC
        Specify the number of digits in the significands used in multiple precision arithmetic
        -P, --positive-differences
        Ignore all differences due to numeric fields of the second file that are less than the corresponding numeric fields in the first file
        -N, --negative-differences
        Ignore all differences due to numeric fields of the second file that are greater than the corresponding numeric fields in the first file
        -I, --ignore-case
        Ignore changes in case while doing literal comparisons
        -d, --decimal-point=C1C2
        Specify the characters representing the decimal point in the two files to compare
        -t, --thousands-separator=C1C2
        Specify the characters representing the thousands separator in the two files to compare
        -g, --group-length=N1N2
        Specify the number of digits forming each group of thousands in the two files to compare
        -p, --plus-prefix=C1C2
        Specify the (optional) prefixes for positive values used in the two files to compare
        -n, --minus-prefix=C1C2
        Specify the prefixes for negative values used in the two files to compare
        -e, --exponent-letter=C1C2
        Specify the exponent letters used in the two files to compare
        -i, --imaginary-unit=C1C2
        Specify the characters representing the imaginary unit in the two files to compare
        -X, --exclude=1:INT
        Select the fields of the first file that have to be ignored
        -X, --exclude=2:INT
        Select the fields of the second file that have to be ignored
        -E, --essential
        While printing the differences between the two compared files show only the numerical ones
        -D, --dummy
        While printing the differences between the two compared files neglect all the numerical ones (dummy mode)
        -b, --brief
        Suppress all messages concerning the differences discovered in the structures of the two files
        -V, --verbose
        For every couple of lines which differ in at least one field print an header to show how these lines appear in the two compared files
        -q, --quiet, --silent
        Suppress all the standard output
        -S, --statistics
        Add some statistics to the standard output
        -z, --blur-if-numerical=1:INT
        Select the fields of the first file that have to be blurred during the synchronization procedure only if they turn out to be numeric
        -z, --blur-if-numerical=2:INT
        Select the fields of the second file that have to be blurred during the synchronization procedure only if they turn out to be numeric
        -Z, --blur-unconditionally=1:INT
        Select the fields of the first file that have to be unconditionally blurred during the synchronization procedure
        -Z, --blur-unconditionally=2:INT
        Select the fields of the second file that have to be unconditionally blurred during the synchronization procedure
        -m, --minimal
        During synchronization try hard to find a smaller set of changes
        -H, --speed-large-files
        During synchronization assume large files and many scattered small changes
        -f, --test-filter[=NUM]
        Run only the filter and then show the results of its attempt to synchronize the two files. If NUM is zero or is not specified, output at most 130 columns per line. If NUM is a positive number, output at most NUM columns per line. If NUM is a negative number, do not output common lines and display at most -NUM columns per line.
        -T, --expand-tabs
        Expand tabs to spaces in output while displaying the results of the synchronization procedure (meaningful only together with option -f)
        -l, --warnings-to=PATH
        Redirect warning and error messages from stderr to the indicated file
        -o, --output=PATH
        Redirect output from stdout to the indicated file
        -h, --help
        Show help message and predefined settings
        -v, --version
        Show version number, Copyright, Distribution Terms and NO-Warranty

        DIAGNOSTICS

        The exit status is 1 if the two given files differ, 0 if they are equal, -1 (255) in case of error.

        DEFAULT NUMERIC FORMAT (for both files to compare): Decimal point = `.'

        
        
        Thousands separator = `,'
        
        
        Number of digits in each thousands group = 3
        
        
        Leading positive sign = `+'
        
        
        Leading negative sign = `-'
        
        
        Prefix for decimal exponent = `e'
        
        
        Symbol used to denote the imaginary unit = `i'

        SOME EXPLANATIONS

        The options -D, -E, -b and -q are used to hide part of the standard output of the program according to some rule.

        The option -D triggers the “dummy mode”. In this mode numdiff does not print the numerical differences. A numerical difference occurs whenever the compared fields turn out to be both of numerical type, but the field from the second file has a value which differs from the one of the field from the first file. The “dummy mode” is so called since when it is active, numdiff does not perform the job for which I created it.

        The option -E triggers the “essential mode”. In this mode numdiff only prints the numerical differences between the two files and, if there are some, the differences in the structure. The latter ones occur either when one of the compared files contains a line for which there is no corresponding line in the other file, or when, comparing two lines, it turns out that one of them contains a field for which there exists no corresponding field in the other one. If you are not running any filter or cutting out some fields through the option -X, then the differences in the structure simply consist either in a different number of lines in the two files, or in a different number of fields on a line.

        The option -b triggers the “brief mode”. In this mode numdiff does not print the differences in the structure of the two files, see just above for an explanation on what they are.

        The option -q triggers the “quiet mode”. When in this mode numdiff does not print anything on the standard output. The “quiet mode” is useful if you only want to know whether a couple of files are equal or not. This information can be obtained by looking at the exit status of the program.

        The option -V triggers the “verbose mode”. In this mode numdiff produces a richer report by printing an header whenever the compared lines differ. The header shows how and where these lines appear in the compared files. For instance, if the files data1 and data2 contain the data

        12      33
        22      44.5
        0.008   1.002
        221.12  -34.56  water
        2101.21 boats
        

        and

        12      33
        22.3      44.5
        0.008   1.202
        221.12  -34.56
        2101.21 boats   dogs
        

        respectively, then the command ‘numdiff -V data1 data2’ will print the following output:

             ----------------
             ##2       <== 22      44.5
             ##2       ==> 22.3      44.5
             
             ##2       #:1   <== 22
             ##2       #:1   ==> 22.3
             @ Absolute error = 3.0000000000e-1, Relative error = 1.3636363636e-2
             ----------------
             ##3       <== 0.008   1.002
             ##3       ==> 0.008   1.202
             
             ##3       #:2   <== 1.002
             ##3       #:2   ==> 1.202
             @ Absolute error = 2.0000000000e-1, Relative error = 1.9960079840e-1
             ----------------
             ##4       <== 221.12  -34.56  water
             ##4       ==> 221.12  -34.56
             
             ##4       #>3   <== water
             ##4             ==>
             @ Line 4 in file "data2" is shorter than expected!
             ----------------
             ##5       <== 2101.21 boats
             ##5       ==> 2101.21 boats   dogs
             
             ##5             <==
             ##5       #>3   ==> dogs
             @ Line 5 in file "data1" is shorter than expected!
             
             +++  File "data1" differs from file "data2"
        

        You must care that the options -b and -V will be overridden if -q is also set.

        The amount of additional information printed by -V is trivially influenced by the options which alter the way numdiff performs the comparisons between fields (for instance -a, -r, -2, -N, -P, -D, -E, -I, -X).

        In the headers printed by numdiff when in “verbose mode” can also appear the symbol <<*>>. This symbol, if present, is always located at the end of a line to mean that the line is at the end of the corresponding file and does not have a terminating newline character.

        The option -S adds to the standard output of numdiff a statistical report with the following information:

        • the number of numeric comparisons the program has done (this quantity, like the successive ones, is influenced by the options -P and -N) and the number of those comparisons whose outcome is a relevant numerical difference.
        • the largest absolute error in the set of relevant numerical differences and the corresponding relative error,
        • the largest relative error in the set of relevant numerical differences together with the corresponding absolute error,
        • the sum and the arithmetic mean of all absolute errors,
        • the sum and the arithmetic mean of the relevant absolute errors,
        • the square root of the sum of the squares of all absolute errors,
        • the square root of the sum of the squares of the relevant absolute errors,
        • the quadratic mean of all absolute errors, and
        • the quadratic mean of the relevant absolute errors.
        By relevant numerical differences and relevant absolute errors I mean those ones appearing in the output of numdiff when the options -D and -q are not used. The information printed by -S is not removed when this option is used together with -q.

        The options -a, -r, -2, -P and -N affect the way numdiff performs the comparisons between numerical values. Without any of these options, numdiff considers two numerical fields as equal when their difference is zero.

        The option -a can be used to order that two numerical fields must be considered equal as long as their absolute difference does not exceed a certain threshold, which is specified by the argument that follows the -a option.

        The option -r can be used to order that two numerical fields must be considered equal as long as their relative difference does not exceed a certain threshold, which is specified by the argument that follows the -r option. The relative difference is normally defined in this way. If n1 is a value from the file specified as first on the command line and n2 is the corresponding value from the second file, then the absolute difference is given by the formula A=|n1-n2|. The relative difference R is given by:

        • R = 0 if n1 and n2 are equal,
        • Inf (infinity) if n2 differs from n1 and at least one of them is zero,
        • R = A/ min(|n1|, |n2|) if n1 and n2 are both non zero and n2 differs from n1. min(|n1|, |n2|) denotes the minimum between the absolute value of n1 and the absolute value of n2.

        With this definition of relative difference it turns out that R(n2, n1) = R(n1, n2): the relative difference does not change if you only change the ordering of the compared files on the command line.

        However there are cases when this default definition of relative error makes no sense. This can happen for instance when one of the files is a sample file containing a list of expected data, which could have been computed theoretically or come from experiments in a laboratory. In this case it is more natural to define the relative difference as the ratio between the absolute difference and the absolute value of the number coming from the sample file. If you put the prefix ‘1:’ (or ‘2:’) in front of the argument passed to -r, then Numdiff always compute the relative difference as the ratio between the absolute difference and the absolute value of the number from the first file (the second file, respectively). More precisely, with the prefix ‘1:’ the relative difference R is computed according to these rules:

        • R = 0 if n1 and n2 are equal,
        • Inf (infinity) if n2 differs from n1 and n1 is zero,
        • R = |n1-n2|/ |n1| if n1 is not zero and n2 differs from n1.

        With the prefix ‘2:’ the rules become:

        • R = 0 if n1 and n2 are equal,
        • Inf (infinity) if n2 differs from n1 and n2 is zero,
        • R = |n1-n2|/ |n2| if n2 is not zero and n2 differs from n1.

        With the last two sets of rules is not anymore true that R(n2, n1) = R(n1, n2): the relative difference changes, in the general case, together with the ordering of the files on the command line.

        If there is a prefix, the value after it is in any case interpreted as tolerance threshold for the relative difference, just as in the case when no prefix is given. You can use ‘-r 1:0’ or ‘-r 2:0’ if you just want to change the way the relative differences are computed and leave the tolerance threshold to its default value, i.e. zero. As a simple example, suppose that file1 and file2 contain

        1    9.9  0.5  440
        

        and

        1.2  8    0.51 400 
        

        respectively. Then ‘numdiff file1 file2’ displays

             ----------------
             ##1       #:1   <== 1
             ##1       #:1   ==> 1.2
              Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1
             ##1       #:2   <== 9.9
             ##1       #:2   ==> 8
              Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1
             ##1       #:3   <== 0.5
             ##1       #:3   ==> 0.51
              Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2
             ##1       #:4   <== 440
             ##1       #:4   ==> 400
              Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1
             
             +++  File "file1" differs from file "file2"
        

        numdiff -r 1:0 file1 file2’ prints

             ----------------
             ##1       #:1   <== 1
             ##1       #:1   ==> 1.2
              Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1
             ##1       #:2   <== 9.9
             ##1       #:2   ==> 8
              Absolute error = 1.9000000000e+0, Relative error = 1.9191919192e-1
             ##1       #:3   <== 0.5
             ##1       #:3   ==> 0.51
              Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2
             ##1       #:4   <== 440
             ##1       #:4   ==> 400
              Absolute error = 4.0000000000e+1, Relative error = 9.0909090909e-2
             
             +++  File "file1" differs from file "file2"
        

        the output of ‘numdiff -r 2:0 file1 file2’ is

             ----------------
             ##1       #:1   <== 1
             ##1       #:1   ==> 1.2
              Absolute error = 2.0000000000e-1, Relative error = 1.6666666667e-1
             ##1       #:2   <== 9.9
             ##1       #:2   ==> 8
              Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1
             ##1       #:3   <== 0.5
             ##1       #:3   ==> 0.51
              Absolute error = 1.0000000000e-2, Relative error = 1.9607843137e-2
             ##1       #:4   <== 440
             ##1       #:4   ==> 400
              Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1
             
             +++  File "file1" differs from file "file2"
        

        numdiff -r 1:0.195 file1 file2’ displays

             ----------------
             ##1       #:1   <== 1
             ##1       #:1   ==> 1.2
              Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1
             
             +++  File "file1" differs from file "file2"
        

        and, finally, ‘numdiff -r 2:0.195 file1 file2’ displays

             ----------------
             ##1       #:2   <== 9.9
             ##1       #:2   ==> 8
              Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1
             
             +++  File "file1" differs from file "file2"
        

        Care not to leave any space between the prefix ‘1:’ or ‘2:’ and the value of the tolerance threshold, Numdiff would consider this as a wrong input.

        The option -2 is only meaningful when both -a and -r are present on the command line. If the user specifies a non-zero tolerance threshold for both absolute and relative error by using both -a and -r, numdiff adopts this behavior: it considers equal two numerical fields as long as at least one between absolute and relative error does not exceed the corresponding threshold. With the option -2 numdiff regards two numerical values as equal only if both absolute and relative error do not exceed the threshold of tolerance. For instance, if file1 contains the unique line

        100
        

        and file2 the line

        100.00012
        

        then the output of the command ‘numdiff file1 file2’ will be

             ----------------
             ##1       #:1   <== 100
                             ==> 100.00012
             @ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6
             
             +++  File "file1" differs from file "file2"
        

        The output of the commands ‘numdiff -a 1.0e-4 file1 file2’ and ‘numdiff -r 1.0e-6 file1 file2’ will be the same, while ‘numdiff -a 1.0e-4 -r 1.3e-6 file1 file2’ and ‘numdiff -a 1.3e-4 -r 1.0e-6 file1 file2’ will print the message

             
             +++  Files "file1" and "file2" are equal
        

        since the relative error is 1.2e-6 < 1.3e-6, the absolute error is 1.2e-4 < 1.3e-4, and it is sufficient that one of them does not exceed the tolerance specified on the command line to make numdiff consider equal the two compared values. However, the commands ‘numdiff -a 1.0e-4 -r 1.3e-6 -2 file1 file2’ and ‘numdiff -a 1.3e-4 -r 1.0e-6 -2 file1 file2’ will print the message

             ----------------
             ##1       #:1   <== 100
                             ==> 100.00012
             @ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6
             
             +++  File "file1" differs from file "file2"
        

        since the option -2 makes numdiff regard two values as equal only if both absolute and relative difference do not exceed the corresponding threshold of tolerance.

        The option -P makes numdiff consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is less or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is less or equal than the first one means that both real and imaginary part of the second one are not greater than the real part and, respectively, the imaginary part of the first one.

        Finally, the option -N makes numdiff consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is greater or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is greater or equal than the first one means that both real and imaginary part of the second one are not less than the real part and, respectively, the imaginary part of the first one.

        The options -I, -l, -o, -h and -v do not require further explanations. The options -l and -o are only supplied for the users of some poorly designed operating systems (like MSDog or MSWindoze), whose default shell does not allow the redirection of standard error and standard output. The option -I has no effect on the outcome of numerical comparisons but affects the action of the filter, see Filtering.

        The option -s requires as argument a set of characters, which will be taken as field delimiters. It is better to quote the set of the delimiters, just as in the next examples:

             numdiff -s ' \t\n,;:.' file1 file2
             numdiff -s ' \t\n\r\f\v"\:;' file1 file2
             numdiff -s `` \t\n''' file1 file2
        

        If you want to include in the set of delimiters also some special characters, e.g the blank, then you must quote it. I recommend you to always use the single quote character (') to enclose the list of the delimiters, since in this way you will prevent any substitution or handling of characters by the shell.

        numdiff recognizes and interprets the following sequences of characters within the argument passed to the option -s:

        • \f’ form feed,
        • \n’ newline,
        • \r’ carriage return,
        • \t’ horizontal tab,
        • \v’ vertical tab.

        The mentioned special characters are often used as delimiters in files containing numerical data but they can not be included directly in the set of delimiters. By passing the string ‘ \t\n,;:.’ as argument for the option -s, one tells numdiff use as field delimiters the characters blank, horizontal tab, newline, comma, semicolon, colon and dot. Passing ‘ \t\n’ as argument to the option -s is the same as not using at all the option -s, since blank, horizontal tab and newline are the default field delimiters. In the list of field delimiters the character backslash (‘\’) is always treated in a special way. If followed by ‘f’, ‘n’, ‘r’, ‘t’ or ‘v’ it is combined with the subsequent character and interpreted in the way we have just seen. Otherwise, the backslash is coupled with the following character and then removed. In particular, if you want to specify the backslash itself as field delimiter, you have to put two backslashes (‘\\’) in the list of delimiters. Therefore, the delimiters specified by the command line

             numdiff -s' \t\n\\\"' file1 file2
        

        are blank, horizontal tab, newline, backslash and double quote, since ‘\\’ and ‘\"’ are interpreted by numdiff as ‘\’ and ‘"’.

        Even if I have recommended to enclose the set of delimiters in single quotes, there are cases in which you will be constrained to use the double quote character (‘"’) to enclose the set of field delimiters, e.g. if the single quote character is used as field delimiter, like in one of the precedent examples. However you must take into account that in this case the shell could make some substitutions on the command line before executing numdiff. For instance, if your shell is GNU bash, then (citing the man page of GNU bash)

        Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, and ‘\’. The characters ‘$’ and ‘`’ retain their special meaning within double quotes. The backslash retains its special meaning only when followed by one of the following characters: ‘$’, ‘`’, ‘"’, ‘\’, or <newline>. A double quote may be quoted within double quotes by preceding it with a backslash ... The special parameters * and @ have special meaning when in double quotes ...

        Therefore, if the set of delimiters is formed by ‘ ’, ‘\t’, ‘\n’, ‘\’ and ‘"’ and you decide to enclose them in double quotes, then the numdiff command line should be

             numdiff -s'' \t\n\\\\\"'' file1 file2
        

        and not

             numdiff -s'' \t\n\\\"'' file1 file2
        

        In this last case the shell would indeed replace the string

        \t\n\\\"

        by

        \t\n\"

        and then numdiff would take ‘ ’, ‘\t’, ‘\n’ and ‘"’ as field delimiters.

        numdiff requires the presence of the newline in the set of characters passed to -s. The absence of the newline in the set of delimiters causes the issue of a suitable warning message and the termination of the program.

        If you are running Numdiff on MSDog/MSWindoze I recommend you to always put the carriage return in the set of field delimiters. Otherwise, this character would be included in all the fields which stay at the end of a line and this would cause some undesirable effects. For instance, a number put at the end of a line would not be considered as a numerical field by numdiff, since numdiff would consider the final carriage return as part of the field which then would be qualified as non-numerical.

        You can specify different delimiters for the two files to compare by putting the prefix ‘1:’ or ‘2:’ in front of the set of characters passed to -s. If the argument of -s begins with ‘1:’, the characters after this prefix are used as field delimiters only for the file passed as first on the command line. Analogously, if the prefix is ‘2:’, then the characters after it are used as field delimiters only for the file specified as second on the command line. You can also provide an explicit set of delimiters for just one of the files to compare, in which case numdiff uses the default field delimiters blank, tab and newline for the other file. Therefore, with ‘numdiff -s '1:: \n' file1 file2’ the program will take colon, blank and newline as delimiters for file1, and blank, tab and newline as delimiters for file2. The recommendations about quoting the set of delimiters are valid even in presence of a prefix.

        The option -# lets the user specify the number of digits in the significands used in multiple precision arithmetic. The default value is 35, the largest admissible value is 180. If numdiff has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user.

        Take into account that an higher precision makes the execution of numdiff slower. This is particularly true if numdiff is not using the computational routines from the GNU MP library and the files to compare contain a lot of numerical fields. In addition, you have to care that numdiff truncates the value of a numerical field if it has too much digits with respect to the current precision. To be precise, denoted by P the current value of the precision, the following rules apply.

        • If numdiff has been built with its own internal support for multiple precision arithmetic, then
          • if a number is written in ordinary decimal notation, numdiff will consider, in addition to all digits of the integer part, only the first P digits of the fractional part;
          • if a value is written in scientific notation, then numdiff will only consider the first P digits of the fractional part of the mantissa.
        • If numdiff uses the routines from the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first P digits of the fractional part of the mantissa are considered.

        You can find out whether your local version of numdiff is relying on GNU MP or not by executing the command ‘numdiff -v’. If numdiff uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information:

             The software has been linked against
             the GNU Multiple Precision Arithmetic Library,
             version number 4.2.4.
        

        If numdiff does not rely on GNU MP, then the displayed message will be (up to translation into your mother language)

             The software has been built with
             its own internal support for multiple precision arithmetic.
        

        The options -d, -t, -g, -p, -n, -e and -i can be used to instruct numdiff about the numeric formats used in the files which it is going to compare. The two files to compare do not have to adopt the same numeric format and then numdiff allows to specify different numeric formats for them. Each of the options -d, -t, -g, -p, -n, -e and -i can have as argument one or two characters (one or two digits if the option is -g). In the first case the argument refers to both files to compare, in the second case the first character is for the file specified as first on the command line, the second character for the file specified as last. For instance, the option -d can be used to tell numdiff which character(s) is(are) used to mean the decimal point in the two files to compare. If you give the command ‘numdiff -d_ file1 file2’, then numdiff will understand that both in file1 and in file2 the character underscore (‘_’) is used in place of the default one (‘.’) to indicate the position of the decimal point in the numerical values. But if the command is ‘numdiff -d_: file1 file2’, then numdiff will understand that the decimal point is indicated by the character underscore in file1, and by colon (‘:’) in file2.

        If you omit to use one of the options -d, -t, -g, -p, -n, -e and -i, then the corresponding attribute will take its default value, see Default Numeric Format.

        You must be really careful when you use one or more of these options. First, not all characters can be passed to them as arguments. The arguments of the option -g must be digits, the arguments of the options -d and -t must be punctuation marks (punctuation marks are all the characters of the ASCII set for which the standard C function ispunct returns a non zero value), those ones of the options -p, -n, -e and -i must be graphical characters but digits (graphical characters are all the characters of the ASCII set for which the standard C function isgraph returns a non zero value).

        It is not possible to set the decimal point, the thousands separator, the positive sign, the negative sign, the prefix for decimal exponent or the symbol of the imaginary unit so that, for a same file, two or more of these characters come out to be equal. This rule also applies when you miss to explicitly select a symbol through the appropriate option. For instance, the command ‘numdiff -d,. file1 file2’ will make numdiff abnormally terminate after printing the error message:

             The numeric format specified for the first file is illegal,
             the following symbols should be all different
             while two or more of them are actually equal:
             
             Decimal point = `,'
             Thousands separator = `,'
             Leading positive sign = `+'
             Leading negative sign = `-'
             Prefix for decimal exponent = `e'
             Symbol used to denote the imaginary unit = `i'
        

        Through the option -d we have told to numdiff that in the first file the decimal point is indicated by the character comma, but at the same time we have not modified the character in use to separate the groups of thousands, which has remained the default one, i.e. comma, for both files to compare. In this way, we have implicitly told to numdiff that in file1 the character comma represents both decimal point and thousands separator. Since this is not reasonable, numdiff refuses to work. To avoid this problem it would be sufficient to explicitly notify to numdiff the thousands separator through the option -t: ‘numdiff -d,. -t., file1 file2’. Of course, here we are supposing that the decimal point and the thousands separator are represented in file1 by comma and dot respectively, in file2 by dot and comma. I strongly suggest you that in writing a file you avoid the use of the same symbol to mean two different things (like would be using comma for both decimal point and thousands separator), it is nonsense.

        At last, it is possible (but stupid) to use as argument for the options -d, -t, -g, -p, -n, -e and -i one of the characters used to separate the fields in the files to compare. In such a case numdiff does not complain but you have to consider that it uses first the set of field delimiters in order to split the files into fields and then, when it has to distinguish between numerical and non-numerical fields, it takes into account the numeric formats specified for the two files. However, it should never happen to specify as argument for one of the options -d, -t, -g, -p, -n, -e and -i a character which is also used as field delimiter: again, in writing a file you should avoid (and people usually avoid it) to use the same symbol to mean two different things.

        The option -X can be used to restrict the comparison between files to a certain group of fields. This option requires as argument a range of positive integer values or eventually just one positive integer number. The argument specifies the position(s) of the fields that numdiff has to ignore. Remember that the fields of a line are numerated starting from the left hand of the line and proceeding towards the right hand.

        The argument passed to -X can start with a prefix, which must be either ‘1:’ or ‘2:’. ‘1:’ refers to the file passed as first on the command line, ‘2:’ to the file specified as second. With the prefix ‘1:’ only the fields of the first file corresponding to the given position(s) are ignored. Similarly, if you want to ignore only fields from the second file you have to use the prefix ‘2:’.

        The option -X can appear more times on the command line, in which case numdiff will ignore all fields located in the positions so specified. Some examples can clarify the use of ranges and prefixes. If the file List1 contains the data

        * a  1    1     1     1
        * b  2    2     2     2
        * c  3    3     3     3
        * d  4    4     4     4
        * e  5    5     5     5
        

        and List2 the data

             1    1.1  1.01   A  1.001  1.0001
             2    2.2  2.02   B  2.002  2.0002
             3    3.3  3.03   C  3.003  3.0003
             4    4.4  4.04   D  4.004  4.0004
             5    5.5  5.05   E  5.005  5.0005
        

        then the output of ‘numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2’ is

             ----------------
             ##1       #:4   <== 1
             ##1       #:2   ==> 1.1
             @ Absolute error = 1.0000000000e-1, Relative error = 1.0000000000e-1
             ##1       #:5   <== 1
             ##1       #:3   ==> 1.01
             @ Absolute error = 1.0000000000e-2, Relative error = 1.0000000000e-2
             ----------------
             ##2       #:4   <== 2
             ##2       #:2   ==> 2.2
             @ Absolute error = 2.0000000000e-1, Relative error = 1.0000000000e-1
             ##2       #:5   <== 2
             ##2       #:3   ==> 2.02
             @ Absolute error = 2.0000000000e-2, Relative error = 1.0000000000e-2
             ----------------
             ##3       #:4   <== 3
             ##3       #:2   ==> 3.3
             @ Absolute error = 3.0000000000e-1, Relative error = 1.0000000000e-1
             ##3       #:5   <== 3
             ##3       #:3   ==> 3.03
             @ Absolute error = 3.0000000000e-2, Relative error = 1.0000000000e-2
             ----------------
             ##4       #:4   <== 4
             ##4       #:2   ==> 4.4
             @ Absolute error = 4.0000000000e-1, Relative error = 1.0000000000e-1
             ##4       #:5   <== 4
             ##4       #:3   ==> 4.04
             @ Absolute error = 4.0000000000e-2, Relative error = 1.0000000000e-2
             ----------------
             ##5       #:4   <== 5
             ##5       #:2   ==> 5.5
             @ Absolute error = 5.0000000000e-1, Relative error = 1.0000000000e-1
             ##5       #:5   <== 5
             ##5       #:3   ==> 5.05
             @ Absolute error = 5.0000000000e-2, Relative error = 1.0000000000e-2
             
             +++  File "List1" differs from file "List2"
        

        Numdiff cuts off from List1 the fields in the positions 1, 2 and 6 and from List2 the fields in the positions 4, 5 and 6. In this way it compares the third, fourth and fifth field of every line of List1 with the first, second and third field respectively of the corresponding line of List2. An equivalent form of the command ‘numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2’ is given by ‘numdiff -X 1:1-2 -X 2:4-5 -X 6 List1 List2’ : since the sixth field is cut off from both files we can refer to it without a prefix.

        As you can see, you can specify a range of fields by using the notation ‘m-n’, where m and n are the field numbers of the first and of the last field in the range. It is even possible to use range expressions like ‘m-’ or ‘-n’. The first expression corresponds to all fields starting from the mth one (inclusive) till to the end of line, the second selects all fields from the first one till to the nth one (inclusive). Therefore the command ‘numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2’ is equivalent to ‘numdiff -X 1:-2 -X 2:4 -X 1:6 -X 2:5- List1 List2’ or to ‘numdiff -X 1:-2 -X 1:6 -X 2:4- List1 List2’.

        Care that the largest field number that you can use while writing a specification for the option -X is 32768.

        If you use the option -X the exit status of numdiff reflects the outcome of the restricted comparison. For instance, the exit status of ‘numdiff -X 8- file1 file2’ is 1 only if numdiff has found a difference in the first seven fields of file1 and file2. If the two files differ only in the fields after the seventh one, then numdiff ends with a zero exit status.

        Going back to the example with List1 and List2, the output of ‘numdiff -X 1:1-2 -X 1:4- -X 2:2- List1 List2’ is

             
             +++  Files "List1" and "List2" are equal
        

        since every field of List1 at position 3 is equal to the first field in the corresponding line of List2. The exit code returned by the program to the shell is zero.

        The options -z, -Z, -m, -H, -f, and -T influence the action of the filter and their use is then described later, Filtering. Care that -z and -Z require both an argument in the same form requested by -X.

        Since version 5 Numdiff accepts also long options to conform to the GNU standards. Now it is then possible, e.g., to use ‘--separator='\n\t %'’ or ‘--separator '\n\t %'’ instead of using ‘-s '\n\t %'’.

        The long options, which start all with two dashes, are listed at the beginning of this chapter, each one near to the corresponding short option.

        The argument of a long option may or may not preceded by the = sign. The only exception is the option --test-filter, for which the presence of the = before the argument is mandatory. Then ‘--test-filter=60’ is correct while ‘--test-filter 60’ is not accepted.


        Next: , Previous: Invoking numdiff, Up: Top

        6 Selecting lines for the comparison

        Together with the version 5.x of Numdiff is shipped a useful tool, the program ndselect. I decided to create this utility in order to deal with a situation that comes out often in Numerical Analysis. Here I present a very simple example of such a situation. Let us suppose that file list1 contains the values of the square root, rounded to the 20th decimal digit, for all the integer numbers between 10 and 20:

        12       3.46410161513775458705
        13       3.60555127546398929312
        14       3.74165738677394138558
        15       3.87298334620741688518
        16       4
        17       4.12310562561766054982
        18       4.24264068711928514641
        19       4.35889894354067355224
        20       4.47213595499957939282
        21       4.58257569495584000659
        22       4.69041575982342955457
        23       4.7958315233127195416
        24       4.89897948556635619639
        

        while list2 contains suitable approximations of the square root only for the numbers between 12 and 21 which are multiple of 3:

        12       3.46410162002945508100
        15       3.87298387096774193548
        18       4.24264705882352941176
        21       4.58260869565217391304
        

        These approximations could have been obtained for instance by using the famous Heron's algorithm, which, given an approximation a for the square root of a number x, computes a better approximation by the formula a := 0.5 * (x/a + a). What we want now is to understand by using numdiff how good are the approximations contained in file list2. Unfortunately, we cannot execute directly the command ‘numdiff list1 list2’, since in this way we would compare the approximations provided for the square roots of 15, 18, and 21 with the square roots of 13, 14, and 15 respectively. To make the comparison in the right way, one could open list1 in a text editor and remove from this file all the non interesting lines till to leave only the ones related to the numbers 12, 15, 18, and 21. But this approach is practicable because we have to remove few lines, and one can easily figure out how boring and inefficient would be to manually remove hundreds or thousands of lines from a file in order to compare it with another one.

        An expert GNU user would suggest that it is possible to make this removal automatic by using the well known utilities head and sed, in this particular case ‘head -n 10 list1 | sed -n -e '1~3 p' > List1’ A quick explanation for the ones who do not know how to use head and sed: the previous command extracts from list1 the first 10 lines, namely the ones containing the square roots of the numbers from 12 to 21, then picks every third line starting from the first one between the extracted lines, in order to select only the ones related to 12, 15, 18, and 21. Finally, these lines are printed on the file List1, which then looks like:

        12       3.46410161513775458705
        15       3.87298334620741688518
        18       4.24264068711928514641
        21       4.58257569495584000659
        

        Once obtained List1, we can perform with numdiff the comparison between the values we are interested in: ‘numdiff List1 list2’ . Unfortunately, this trick only works if you have installed the GNU version of sed, which, as far as I know, is the only one to provide the extension first~step to specify line addresses. That is way I decided to implement ndselect, which allows to obtain the same result as before with the simpler command: ‘ndselect -b 1 -e 10 -s 3 list1 > List1

        The meaning of the arguments passed to the options -b, -e, and -s is the following: we are telling ndselect to print every third line of file list1 (the option -s specifies the step), starting from the first one (the option -b specifies the beginning) and ending within the tenth one possibly inclusive (the option -e specifies the end). Because of the presence of the redirection operator >, the previous command sends to the file List1 what ndselect would print on the screen (standard output).

        Using ndselect is very simple and elegant, other than extremely useful in the situations just outlined. A complete description of its use follows.


        Next: , Previous: ndselect, Up: Top

        7 Invoking ndselect

        SYNOPSIS

                ndselect -h|--help|-v|--version
        

        or

                ndselect [-b FIRST][-e LAST][-s STEP][-l PATH][-o PATH] [file]
             
        

        where file is the name of the file to scan.

        In the first case ndselect prints a short help or/and version number, Copyright, License notice and NO-Warranty disclaimer. In the second case ndselect prints on the standard output every STEPth line of file starting with line FIRST and ending within line LAST. The complete path of file should be given, a directory name is not accepted. If no input file is specified, the program reads from the standard input.

        OPTIONS

        -b, --beginning, --start=FIRST
        Specify the first line to print (The default behavior is to start with line number 1)
        -e, --end=LAST
        Specify the last line that can be printed (The default behavior is to arrive till to the end of the file)
        -s, --step=STEP
        Specify the step to use when selecting the lines to print (The default value for the step is 1)
        -l, --warnings-to=PATH
        Redirect warning and error messages from stderr to the indicated file
        -o, --output=PATH
        Redirect output from stdout to the indicated file
        -h, --help
        Show the help message
        -v, --version
        Show version number, Copyright, Distribution Terms and NO-Warranty

        Passing 0 as argument to the option -e is equivalent to omit this option and leave enabled the default behavior (which consists in scanning till to the end of the file).

        DIAGNOSTICS

        The exit status is 0 in case of normal termination, -1 (255) in case of error.

        As numdiff does, also ndselect since version 5 accepts long options. So instead of ‘ndselect -b 1 -e 10 -s 3 list1 > List1’, you can launch this command as ‘ndselect --start=1 --end=10 --step=3 list1 > List1’.


        Next: , Previous: Invoking ndselect, Up: Top

        8 Using the filter of numdiff

        Since version 5 it is possible to activate a filter when calling numdiff, so that the program performs automatically the comparison in the desired way. Recalling the example of chapter 6, if you run the command numdiff -z 2- -V list1 list2 you obtain the following result:

             
             ----------------
             ##1       <== 12       3.46410161513775458705
             ##1       ==> 12       3.46410162002945508100
             
             ##1       #:2   <== 3.46410161513775458705
             ##1       #:2   ==> 3.46410162002945508100
              Absolute error = 4.8917004940e-9, Relative error = 1.4121122985e-9
             ----------------
             ##2       <== 13       3.60555127546398929312
                       ==>
             
             ----------------
             ##3       <== 14       3.74165738677394138558
                       ==>
             
             ----------------
             ##4       <== 15       3.87298334620741688518
             ##2       ==> 15       3.87298387096774193548
             
             ##4       #:2   <== 3.87298334620741688518
             ##2       #:2   ==> 3.87298387096774193548
              Absolute error = 5.2476032505e-7, Relative error = 1.3549253331e-7
             ----------------
             ##5       <== 16       4
                       ==>
             
             ----------------
             ##6       <== 17       4.12310562561766054982
                       ==>
             
             ----------------
             ##7       <== 18       4.24264068711928514641
             ##3       ==> 18       4.24264705882352941176
             
             ##7       #:2   <== 4.24264068711928514641
             ##3       #:2   ==> 4.24264705882352941176
              Absolute error = 6.3717042443e-6, Relative error = 1.5018250929e-6
             ----------------
             ##8       <== 19       4.35889894354067355224
                       ==>
             
             ----------------
             ##9       <== 20       4.47213595499957939282
                       ==>
             
             ----------------
             ##10      <== 21       4.58257569495584000659
             ##4       ==> 21       4.58260869565217391304
             
             ##10      #:2   <== 4.58257569495584000659
             ##4       #:2   ==> 4.58260869565217391304
              Absolute error = 3.3000696334e-5, Relative error = 7.2013423303e-6
             ----------------
             ##11      <== 22       4.69041575982342955457
                       ==>
             
             ----------------
             ##12      <== 23       4.7958315233127195416
                       ==>
             
             ----------------
             ##13      <== 24       4.89897948556635619639
                       ==>
             
             
             +++  File "list1" differs from file "list2"
        

        Numdiff has recognized that the lines of list1 with the square roots for the numbers 13, 14, 16, 17, 19, 20, 22, 23 and 24 have been deleted from list2. The numerical comparison has been done by likening each line of list2 to the line of list1 which displays the square root for the same integer value. The output obtained running the filter of Numdiff by numdiff -f -z 2- list1 list2 confirms this:

             12       3.46410161513775458705         12       3.46410162002945508100
             13       3.60555127546398929312      <
             14       3.74165738677394138558      <
             15       3.87298334620741688518         15       3.87298387096774193548
             16       4                           <
             17       4.12310562561766054982      <
             18       4.24264068711928514641         18       4.24264705882352941176
             19       4.35889894354067355224      <
             20       4.47213595499957939282      <
             21       4.58257569495584000659         21       4.58260869565217391304
             22       4.69041575982342955457      <
             23       4.7958315233127195416       <
             24       4.89897948556635619639      <
             
             
             +++  File "list1" differs from file "list2"
        

        If you compare the command numdiff -z 2- -V list1 list2 with the one used here, see command, for the files bill1 and bill2 you surely notice that the filter has been invoked in different ways, first with -z @ and then with -z 2-.

        The synchronization procedure used by the filter is based on blurring and byte by byte comparison. The options -z and -Z are used to select which field(s) from which file have to be blurred. They take both an argument in the same form requested by -X, see Use of the option -X, but accept additionally the special value ‘@’ as abbreviation for the range of fields ‘1-’. Then the specifications ‘1:@’, ‘2:@’ and ‘@’ are used to mean all fields of the first file, of the second one or of both, respectively.

        Employing -z and -Z in the right way is extremely important to let the filter work as desired. For instance, numdiff -f -z @ list1 list2 matches the lines of list1 and list2 in the same wrong way

             12       3.46410161513775458705         12       3.46410162002945508100
             13       3.60555127546398929312         15       3.87298387096774193548
             14       3.74165738677394138558         18       4.24264705882352941176
             15       3.87298334620741688518         21       4.58260869565217391304
             16       4                           <
             17       4.12310562561766054982      <
             18       4.24264068711928514641      <
             19       4.35889894354067355224      <
             20       4.47213595499957939282      <
             21       4.58257569495584000659      <
             22       4.69041575982342955457      <
             23       4.7958315233127195416       <
             24       4.89897948556635619639      <
             
             
             +++  File "list1" differs from file "list2"
        

        as Numdiff would do without triggering the filter at all.

        It is essential then to understand what blurring a field means and how the filter uses blurring to match the lines of the files to compare.

        After reading the files the filter removes from each of them (from their images in the memory, actually) all the fields selected by the option -X, then it replaces each of the fields that have to be blurred by a special character. This special character is the same for both files and it is so chosen that it cannot appear in the text. Blurring a field means to replace it by this sort of place card.

        After doing this, the filter converts all remaining numerical fields to a standard format and compares the files byte by byte neglecting the field delimiters. This comparison is just used to establish which lines of the first file are not present in the second, which lines of the second file are missing in the first one and how to match the remaining lines to create a one-to-one correspondence.

        Only at this point numdiff inspects each couple of corresponding lines, splits the two lines into the constituent fields, and neglecting those ones eventually specified through the option -X compares corresponding fields as it is supposed to do, performing a numerical comparison whenever the fields are both legal numerical values.

        Blurring the right fields is essential to match the lines from the two files appropriately before doing any numerical comparison. Without blurring, the numerical fields could prevent numdiff from an appropriate matching of the lines, in case some of them are present in only one file, by creating confusion with their (maybe small) numeric differences.

        Blurring can be of two types, conditional or unconditional. The blurring is conditional if it has to be performed only for fields which turn out to be legal numerical values. The arguments of the option -z indicate which fields of which file have to be blurred under the condition that they are recognized as numeric fields. Non-numeric fields are left by -z untouched (no blurring occurs for them). Then ‘-z 1:5-7’ makes the filter blur the 5th, 6th and 7th field of each line of the first file whenever they are recognized as numerical.

        By the option -Z you can specify which fields have to be unconditionally blurred, i.e. independently of their type, numerical or not. Then ‘-Z 2:3-4’ activates the blurring of the 3th and 4th field of each line of the second file.

        Going back to the comparison of the files list1 and list2, the option ‘-z 2-’ of the command ‘numdiff -z 2- -V list1 list2’ makes the filter transform the (memory copies of the) two files as

             12       •
             13       •
             14       •
             15       •
             16       •
             17       •
             18       •
             19       •
             20       •
             21       •
             22       •
             23       •
             24       •
        

        and

             12       •
             15       •
             18       •
             21       •
        

        respectively. Here • denotes the special symbol used by the filter in the blurring procedure, even if this symbol is not actually a bullet. Since in this example space, tab and newline are used as field delimiters, the byte by byte comparison between the transformed files produces the same result as the command ‘sdiff -W’ does when called on them:

             12       •                        12       •
             13       •                     <
             14       •                     <
             15       •                        15       •
             16       •                     <
             17       •                     <
             18       •                        18       •
             19       •                     <
             20       •                     <
             21       •                        21       •
             22       •                     <
             23       •                     <
             24       •                     <
        

        If you put the blurred fields back you obtain exactly the output of ‘numdiff -f -z 2- list1 list2’:

             12       3.46410161513775458705           12       3.46410162002945508100
             13       3.60555127546398929312        <
             14       3.74165738677394138558        <
             15       3.87298334620741688518           15       3.87298387096774193548
             16       4                             <
             17       4.12310562561766054982        <
             18       4.24264068711928514641           18       4.24264705882352941176
             19       4.35889894354067355224        <
             20       4.47213595499957939282        <
             21       4.58257569495584000659           21       4.58260869565217391304
             22       4.69041575982342955457        <
             23       4.7958315233127195416         <
             24       4.89897948556635619639        <
             
             
             +++  File "list1" differs from file "list2"
             
        

        Since the second field is a numerical value in all the lines of list1 and list2, to use the option -Z instead of -z makes no difference in this case. The output of ‘numdiff -f -Z 2- list1 list2’ is just the same as for ‘numdiff -f -z 2- list1 list2’.

        After this explanation you can also understand why ‘numdiff -f -z @ list1 list2’ gives a wrong result. Since also the first field is always given by a numerical value, the option ‘-z @’ makes the filter transform the two given files as

             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
             •       •
        

        and

             •       •
             •       •
             •       •
             •       •
        

        respectively, so that it is not anymore possible to match the lines in a reasonable way.

        Let us see now a typical situation where it is better to use -Z in place of -z. If the file Table1 contains

        -6 	 2.449490
        -5 	 2.236068
        -4 	 2.000000
        -3 	 1.732051
        -2 	 1.414214
        -1       1.000000
        0        0
        - - - - - - - - -
        1 	 1.000000
        2 	 1.414214
        3 	 1.732051
        4 	 2.000000
        - - - - - - - - -
        5 	 2.236068
        6 	 2.449490
        7 	 2.645751
        - - - - - - - - -
        8 	 2.828427
        9 	 3.000000
        10 	 3.162278
        11 	 3.316625
        12 	 3.464102
        - - - - - - - - -
        - - - - - - - - -
        13 	 3.605551
        14 	 3.741657
        

        and Table2 contains

        -6       Not_defined
        -4       Not_defined
        -2       Not_defined
         0       0.000000
         2 	 1.414216
         4 	 2.000000
         6 	 2.449494
         8 	 2.828469
         10 	 3.162278
         12 	 3.464102
         14 	 3.741658
        ********************END
        

        then the output of ‘numdiff -z 1:2 -Z 2:2 -f Table1 Table2’ is

             -6       2.449490               -6       Not_defined
             -5       2.236068            <
             -4       2.000000               -4       Not_defined
             -3       1.732051            <
             -2       1.414214               -2       Not_defined
             -1       1.000000            <
             0        0                       0       0.000000
             - - - - - - - - -            <
             1        1.000000            <
             2        1.414214                2       1.414216
             3        1.732051            <
             4        2.000000                4       2.000000
             - - - - - - - - -            <
             5        2.236068            <
             6        2.449490                6       2.449494
             7        2.645751            <
             - - - - - - - - -            <
             8        2.828427                8       2.828469
             9        3.000000            <
             10       3.162278                10      3.162278
             11       3.316625            <
             12       3.464102                12      3.464102
             - - - - - - - - -            <
             - - - - - - - - -            <
             13       3.605551            <
             14       3.741657                14      3.741658
                                          >  ********************END
             
             
             +++  File "Table1" differs from file "Table2"
        

        which is exactly what is expected. On the other hand the command ‘numdiff -z 2 -f Table1 Table2’ displays

             -6       2.449490            |  -6       Not_defined
             -5       2.236068            |  -4       Not_defined
             -4       2.000000            |  -2       Not_defined
             -3       1.732051            <
             -2       1.414214            <
             -1       1.000000            <
             0        0                       0       0.000000
             - - - - - - - - -            <
             1        1.000000            <
             2        1.414214                2       1.414216
             3        1.732051            <
             4        2.000000                4       2.000000
             - - - - - - - - -            <
             5        2.236068            <
             6        2.449490                6       2.449494
             7        2.645751            <
             - - - - - - - - -            <
             8        2.828427                8       2.828469
             9        3.000000            <
             10       3.162278                10      3.162278
             11       3.316625            <
             12       3.464102                12      3.464102
             - - - - - - - - -            <
             - - - - - - - - -            <
             13       3.605551            <
             14       3.741657                14      3.741658
                                          >  ********************END
             
             
             +++  File "Table1" differs from file "Table2"
        

        which is partially wrong.

        Notice that in Table1 you find (truncated to the sixth decimal digit) the square roots of the absolute values of the integer numbers between -6 and 20, plus some randomly added lines. The file Table2 contains some approximations (obtained by Newton's method) for the square roots of the even numbers between -6 and 20. Since the (real) square root is not defined for negative numbers, the values corresponding to -6, -4 and -2 are replaced by Not_defined.

        Since Not_defined is not a numeric value, during the execution of the last command the filter transforms Table1 in this way

             -6       •
             -5       •
             -4       •
             -3       •
             -2       •
             -1       •
             0        •
             - - - - - - - - -
             1        •
             2        •
             3        •
             4        •
             - - - - - - - - -
             5        •
             6        •
             7        •
             - - - - - - - - -
             8        •
             9        •
             10       •
             11       •
             12       •
             - - - - - - - - -
             - - - - - - - - -
             13       •
             14       •
        

        and Table2 in this other way

             -6       Not_defined
             -4       Not_defined
             -2       Not_defined
              0       •
              2       •
              4       •
              6       •
              8       •
              10      •
              12      •
              14      •
             ********************END
        

        Unfortunately the first three lines are enough to confuse the synchronization procedure, which is based on a byte by byte comparison with exclusion of the field delimiters, as we explained before.

        You can check that this is definitely the case by looking at the output of the command ‘sdiff -W’ on the transformed files, which is

             -6       •           |  -6       Not_defined
             -5       •           |  -4       Not_defined
             -4       •           |  -2       Not_defined
             -3       •           <
             -2       •           <
             -1       •           <
             0        •               0       •
             - - - - - - - - -    <
             1        •           <
             2        •               2       •
             3        •           <
             4        •               4       •
             - - - - - - - - -    <
             5        •           <
             6        •               6       •
             7        •           <
             - - - - - - - - -    <
             8        •               8       •
             9        •           <
             10       •               10      •
             11       •           <
             12       •               12      •
             - - - - - - - - -    <
             - - - - - - - - -    <
             13       •           <
             14       •               14      •
                                  >  ********************END
        

        If we give the command ‘numdiff -z 1:2 -Z 2:2 -f Table1 Table2’ instead of ‘numdiff -z 2 -f Table1 Table2’, the second field of the lines of Table2 is always blurred. The filter transforms then Table2 into

             -6       •
             -4       •
             -2       •
              0       •
              2       •
              4       •
              6       •
              8       •
              10      •
              12      •
              14      •
             ********************END
        

        and re-synchronizes the files Table1 and Table2 in the right way.

        Using the unconditional blurring is suggested in all cases when a certain field, which you want to include in the comparison (use -X to completely neglect one or more fields), is of numeric type in almost all lines of (one of) the given files. This can be the case e.g. when in some lines the content of the field is given by a special numeric value, like Infinity, Inf, +Inf or -Inf, or by NaN, abbreviation for Not a Number.

        Concerning the numerical fields which are not blurred, one has to remark, that the filter is not confused by differences in the numeric format. Before the byte by byte comparison, numeric values are converted indeed to a standard format. To offer an example of this, let us suppose that short1 contains a list of numbers with their logarithms

        0.001          -3
        0.01           -2
        0.1            -1
        1               0
        1000            3
        1000000         6
        1000000000      9
        

        and short2 the same list of numbers and logarithms, but with differences in the numeric format:

        ******************
        0.0010000       -3
        .0100           -2
        0000.10         -1
        1.               0
        1,000.000        3
        1,000,000.       6
        1,000,000,000    9
        

        Then ‘numdiff -f -z 2- short1 short2’ displays

                                          >  ******************
             0.001          -3               0.0010000       -3
             0.01           -2               .0100           -2
             0.1            -1               0000.10         -1
             1               0               1.               0
             1000            3               1,000.000        3
             1000000         6               1,000,000.       6
             1000000000      9               1,000,000,000    9
             
             
             +++  File "short1" differs from file "short2"
        

        showing that the filter has matched the lines in the right way.

        The filter can even handle the case when the same numerical value is written in decimal notation in one file and in scientific notation in the other one. If the files decimal and scientific contain

        .001           -3
        .01            -2
        .1             -1
        * * * * * * * * *
        1               0
        1000            3
        1000000         6
        1000000000      9
        

        and

        *****************
        1.0e-3         -3
        1.0e-2         -2
        1.0e-1         -1
        1.0e0           0
        1.0e3           3
        1.0e6           6
        1.0e9           9
        *****************
        

        respectively, then ‘numdiff -f -z 2- decimal scientific’ shows

                                          >  *****************
             .001           -3               1.0e-3         -3
             .01            -2               1.0e-2         -2
             .1             -1               1.0e-1         -1
             * * * * * * * * *            <
             1               0               1.0e0           0
             1000            3               1.0e3           3
             1000000         6               1.0e6           6
             1000000000      9               1.0e9           9
                                          >  *****************
             
             
             +++  File "decimal" differs from file "scientific"
        

        proving that the filter does not get confused.

        No problems come out also in the case when for a same (not blurred) field the scientific notation is used in both files. If the files sc1 and sc2 contain

          1.E-3          -3
          1.00E-2        -2
          1.0E-1         -1
          1.0000E0        0
        001.0E3           3
        +01.000E6         6
          1.0E+09         9
          1.0E+10        10
        * * * * * * * * * *
        

        and

        *****************
         1.0e-003      -3
         1.0e-2        -2
         1.0e-1        -1
         1.0e0          0
        +1.0e3          3
         1.0e+6         6
         1.0e9          9
        

        respectively, then ‘numdiff -f -z 2- sc1 sc2’ correctly displays

                                          >  *****************
               1.E-3          -3              1.0e-003      -3
               1.00E-2        -2              1.0e-2        -2
               1.0E-1         -1              1.0e-1        -1
               1.0000E0        0              1.0e0          0
             001.0E3           3             +1.0e3          3
             +01.000E6         6              1.0e+6         6
               1.0E+09         9              1.0e9          9
               1.0E+10        10          <
             * * * * * * * * * *          <
             
             
             +++  File "sc1" differs from file "sc2"
        

        Since for example ‘9876.54e-3’ and ‘-0.0087E4’ are recognized by Numdiff as valid numerical values, it is important that the filter can recognize e.g. that ‘123.456E+2’ and ‘1.23456E+4’ are the same number. The filter is able indeed to handle even an improper use of the scientific notation. We can see this in the case of the files Scnot1:

        -------------------------
        1.2E0             *     1
        2.45E-1           *     2
        -3.678E-2         *     3
        

        and Scnot2:

        12E-1             *     1
        245E-3            *     2
        -0.003678E+1      *     3
        

        numdiff -f -z 3- Scnot1 Scnot2’ displays the report:

             -------------------------    <
             1.2E0             *     1       12E-1             *     1
             2.45E-1           *     2       245E-3            *     2
             -3.678E-2         *     3       -0.003678E+1      *     3
             
             
             +++  File "Scnot1" differs from file "Scnot2"
        

        which is exactly what you would expect in such a case. Also pretty hard cases do not confuse the filter. Let Scnot1 be given by

         1.2000e0         *     1
        02.4500e-1        *     2
        -003.678E-2       *     3
        

        and let Scnot2 be the same file as before. The command ‘numdiff -f -z 3- Scnot1 Scnot2’ gives again the expected output:

              1.2000e0         *     1       12E-1             *     1
             02.4500e-1        *     2       245E-3            *     2
             -003.678E-2       *     3       -0.003678E+1      *     3
             
             
             +++  Files "Scnot1" and "Scnot2" have the same structure
        

        Till now we have always used the option -f with no argument. However -f accepts an optional argument, which can be used to control how -f displays its output. If you provide an argument, care not to leave any space between the option and the argument. So ‘-f60’ is correct while ‘-f 60’ makes Numdiff terminate after printing an error message.

        If the argument is a positive number NUM, then the side by side output produced by -f will be NUM columns wide. The default value for the width of the output is 130, which can fit onto a traditional printer line, and is the one used when -f has no argument or the supplied argument is zero. In other words, ‘-f’ and ‘-f0’ are just easier to remind versions of ‘-f130’.

        A negative number as argument for -f has the same effect as the positive number with the same absolute value, but in addition it causes the suppression of common lines from the output. For instance the command ‘numdiff -z 1:2 -Z 2:2 -f-130 Table1 Table2’ displays the following text

             -5       2.236068            <
             -3       1.732051            <
             -1       1.000000            <
             - - - - - - - - -            <
             1        1.000000            <
             3        1.732051            <
             - - - - - - - - -            <
             5        2.236068            <
             7        2.645751            <
             - - - - - - - - -            <
             9        3.000000            <
             11       3.316625            <
             - - - - - - - - -            <
             - - - - - - - - -            <
             13       3.605551            <
                                          >  ********************END
             
             
             +++  File "Table1" differs from file "Table2"
        

        In conjunction with the option -f you can use -T to expand tabs to spaces in the output produced by -f. This is useful to preserve the alignment of tabs in the input files, if it is thrown off by the presence of the gutter.

        The options -H and -m affect the performance of the filter of Numdiff. But performance has more than one dimension and these options improve one aspect of performance at the cost of another, or they improve performance in some cases while hurting it in others.

        The way that the filter re-synchronizes two files to compare always comes up with a near-minimal set of deletions/insertions of lines. Usually it is good enough for practical purposes. If the filter displays a large set of line deletions/insertions, you might want it to use a modified algorithm that sometimes produces a smaller set of differences. The -m option does this; however, it can also cause the filter to run more slowly than usual, so it is not the default behavior.

        When the files you are comparing are large and have small groups of changes scattered throughout them, you can use the -H option to make a different modification to the algorithm that the filter uses. If the input files have a constant small density of changes, where change means deletion/insertion of lines, this option speeds up the comparisons without changing the output or in the worst case with minor modifications.

        To conclude, Numdiff is not perfect but if you play with its options and with ndselect you can do a lot of nice and difficult things, which before just the human eye could do.


        Next: , Previous: Filtering, Up: Top

        9 Warnings

        • Bug reports have to be sent to the address ivprimi(at)libero(dot)it . Please, put Numdiff in the subject and indicate the version of Numdiff you are using, the version of the operating system you are running and, if you know it, the version of the compiler used to build Numdiff.
        • Numdiff does not accept numbers in scientific notation whose exponents lie outside the range -1073741824, ..., +1073741824. If such a number is found in any of the files to compare, the execution of the program is stopped immediately after printing a suitable error message on stderr. Under the assumption that the numeric format in use is the default one, with "1.0001e-2147483640" the displayed error messages is
                    numdiff: A number with a too small exponent has been found,
                    namely "1.0001e-2147483640".
                    Exponents smaller than -1073741824 are not accepted,
                    the execution of the program ends now
          
        • If Numdiff has been built with its own internal support for multiple precision arithmetic instead of being linked against the GNU MP Library, then performance degradation and memory exhaustion can already make impossible to handle exponents of magnitude 10^6 = 1000000. This is what I obtained on my laptop, equipped with a dual core processor @1.50 GHz and with 1GB of RAM, when I tried to compare the numbers 1.101e1000000000 and 1.0e1000000000:
                    numdiff: Insufficient memory for new allocation,
                    the execution of the program ends now
          

          In addition, you can overload the processor with numbers whose exponents lie outside the range -1000000, ..., 1000000. But at least on my machine, everything works fine and quick enough as long as exponent and size of the mantissa of the numbers are in the range -1000, ..., 1000. Be careful and remember that Numdiff is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

          Consider also that, if you have numerical data with exponents outside the range -300, ..., 300, probably there is something wrong with your data: either you are using the wrong scale, or you should replace very small numbers, like 1e-100, by zero, or it is quite likely that the machine/program/algorithm which produced these data is not working right :D

        • If Numdiff has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user.
        • After reading a numerical field, Numdiff truncates its value if this number has too much digits with respect to the current precision. To be precise, denoted by P the current value of the precision, the following rules apply.

          If numdiff has been built with its own internal support for multiple precision arithmetic, then

          • if the number is written in ordinary decimal notation, numdiff will consider, in addition to all digits of the integer part, only the first P digits of the fractional part;
          • if the value is written in scientific notation, then numdiff will only consider the first P digits of the fractional part of the mantissa.

          If numdiff uses the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first P digits of the fractional part of the mantissa are considered.

          By current value of the precision I mean the integer value specified by the option -#, or the default one (35) when this option is not in use.

        • You can find out whether your local version of numdiff is relying on GNU MP or not by executing the command ‘numdiff -v’. If numdiff uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information:
                    The software has been linked against
                    the GNU Multiple Precision Arithmetic Library,
                    version number 4.2.4.
          

          If numdiff does not rely on GNU MP, then the displayed message will be (up to translation into your mother language)

                    The software has been built with
                    its own internal support for multiple precision arithmetic.
          
        • Numdiff manages perfectly only text files with an 8-bit encoding (ASCII and ISO 8859-* text files). The use of Numdiff with UTF-8 text files suffers from some restrictions (numbers and field delimiters must consist of ASCII characters, i.e. characters with the most significant bit equal to 0).
        • If you are not including the so called white-space characters (usually ‘ ’, ‘\t’, ‘\f’, ‘\v’ and ‘\r’) in the set of field delimiters, then a real and an imaginary number which are separated just by white-spaces can be coupled together and considered as a whole complex number. For example, if you are using only colon (‘:’) and newline as field delimiters and Numdiff finds a line like that
               ::::3.0-5.6e-356i::::-12.9   +4.34i::::-12.9    4.34i::::New York::::
          

          then it will consider this line as formed by four fields, the first two are numerical and given by the complex numbers 3.0-5.6e-356i and -12.9+4.34i, the last two ones are the strings New York and -12.9 4.34i. I still do not know if I will modify this in the next version of Numdiff, so that the program recognizes only 3.0-5.6e-356i as numerical field and treats -12.9 +4.34i as non-numerical because of the presence of spaces in the middle. -12.9 4.34i is already considered as non-numerical due to the absence of a leading sign in the imaginary value.

        • We have seen that one of the two files passed to numdiff can be -, which refers to stdin (standard input). In this way one of the two files to compare can be the output produced by another command, like in ‘cat file2 | numdiff -a 1.0e-3 file1 -’. However, if you trigger the filter through the options -z or/and -Z, Numdiff can not work with the standard input unless you use also the option -f. So the command ‘cat file2 | numdiff -a 1.0e-3 -z @ file1 -’ displays only the error message
               numdiff: -: Illegal seek
          
          (or maybe the translation of this message in the language you are using on your computer) but ‘cat file2 | numdiff -a 1.0e-3 -z @ -f file1 -’ works as expected.
        • This manual describes the version 5.x of Numdiff. Versions 4.0.0 and 3.x used even a different format for the output.


        Up: Top

        Appendix A GNU Free Documentation License

        Version 1.3, 3 November 2008
             Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
             http://fsf.org/
             
             Everyone is permitted to copy and distribute verbatim copies
             of this license document, but changing it is not allowed.
        
        1. PREAMBLE

          The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

          This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

          We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

        2. APPLICABILITY AND DEFINITIONS

          This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

          A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

          A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

          The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

          The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

          A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.

          Examples of suitable formats for Transparent copies include plain ascii without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

          The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

          The “publisher” means any person or entity that distributes copies of the Document to the public.

          A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.

          The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

        3. VERBATIM COPYING

          You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

          You may also lend copies, under the same conditions stated above, and you may publicly display copies.

        4. COPYING IN QUANTITY

          If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

          If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

          If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

          It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

        5. MODIFICATIONS

          You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

          1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
          2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
          3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
          4. Preserve all the copyright notices of the Document.
          5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
          6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
          7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
          8. Include an unaltered copy of this License.
          9. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
          10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
          11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
          12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
          13. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version.
          14. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section.
          15. Preserve any Warranty Disclaimers.

          If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

          You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

          You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

          The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

        6. COMBINING DOCUMENTS

          You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

          The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

          In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”

        7. COLLECTIONS OF DOCUMENTS

          You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

          You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

        8. AGGREGATION WITH INDEPENDENT WORKS

          A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

          If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

        9. TRANSLATION

          Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

          If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

        10. TERMINATION

          You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.

          However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.

          Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.

          Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.

        11. FUTURE REVISIONS OF THIS LICENSE

          The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

          Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document.

        12. RELICENSING

          “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.

          “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.

          “Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.

          An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.

          The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.

        ADDENDUM: How to use this License for your documents

        To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

               Copyright (C)  year  your name.
               Permission is granted to copy, distribute and/or modify this document
               under the terms of the GNU Free Documentation License, Version 1.3
               or any later version published by the Free Software Foundation;
               with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
               Texts.  A copy of the license is included in the section entitled ``GNU
               Free Documentation License''.
        

        If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.” line with this:

                 with the Invariant Sections being list their titles, with
                 the Front-Cover Texts being list, and with the Back-Cover Texts
                 being list.
        

        If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.

        If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.


        Previous: Warnings, Up: Top

        Index

        cmtk-3.0.0/Utilities/numdiff-5.2.1/docs/numdiff.txt0000644000177700000170000043317711666247630020726 0ustar torstenmanTable of Contents ***************** Numdiff User Manual 1 Copying 2 Acknowledgments 3 Overview 3.1 Output format 4 Installing 5 Invoking numdiff 6 Selecting lines for the comparison 7 Invoking ndselect 8 Using the filter of numdiff 9 Warnings Appendix A GNU Free Documentation License Index Numdiff User Manual ******************* _"...und der eignen Kraft vertrauend steigt ein frei Geschlecht empor!"_ This manual describes how to install and use Numdiff, a program which compares putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being "Numdiff User Manual, version 5.2", and with no Back-Cover Texts. A copy of the license is included in *note GNU Free Documentation License::. 1 Copying ********* Numdiff (also written numdiff) is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Numdiff 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 General Public License along with this program. If not, see `http://www.gnu.org/licenses/'. 2 Acknowledgments ***************** I want to thank Mr. Norman Clerman for several suggestions he gave me to improve the readability and the effectiveness of the output produced by Numdiff. He also pointed out the need to implement a filter to resynchronize the lines between two files in case of addition or deletion of one or more lines. I have to give him credit for the urge to prepare the versions 4.x and 5.x of Numdiff. Moreover, I want to thank my friends Mariapia Palombaro, since she removed some errors while reviewing the first version of this document, and Paolo Caramanica, who suggested me to add more information to the output of the option `-S'. 3 Overview ********** Computer users often find occasion to ask how two files differ. Perhaps one file is a newer version of the other file. Or maybe the two files started out as identical copies but were changed by different people. There are several ways to think about the differences between two files. One way to think of the differences is as a series of lines that were deleted from, inserted in, or changed in one file to produce the other file. The well-known `diff' program compares two files line by line, finds groups of lines that differ, and reports each group of differing lines. Without particular options, the `diff' program considers any change in the amount or in the type of the characters as a relevant difference. However, trough some command line options it also provides ways to suppress certain kinds of differences that are not important to the user. For instance, `diff' provides ways to ignore differences in the amount of white space between words or lines, or differences in alphabetic case. Another way to think of the differences is as a series of words that were deleted from, inserted in, or changed in one file to produce the other file. Here "word" refers to a sequence of non white-space characters delimited by a couple of white-spaces, one before and the other one after the word. The less known `wdiff' program by Franc,ois Pinard compares words in two files and reports the differences. At last, one can think of the differences between two files as a sequence of pairs of bytes that can be either identical or different. The `cmp' program reports the differences between two files byte by byte, instead of line by line or word by word. As a result, it is often more useful than `diff' or `wdiff' for comparing binary files. However, none of these approaches turns out to be good when you want to compare a couple of text files composed partially or entirely by numerical fields. Indeed, when you compare a couple of such files, what you want to obtain usually is a list of the numerical fields in the second file which *numerically* differ from the corresponding fields in the first file. But, as you probably knows, a same number can be written using different notations and programs like `diff' or `wdiff' can not recognize whether a difference between two numeric fields is only due to the notation or is actually a difference of numerical values. For instance, 11.23 and 11.2300000 are the same number but represented in different ways. While, if you are interested in the numerical values, it is obvious that the difference in the representation is not meaningful and then it should be ignored, however `diff' and `wdiff' consider the previous one as a relevant difference and there is no way for you to tell these programs to ignore it ! Another example of this type is given by 98765.4321 and 9.87654321E04 where the difference is only due to the use of the scientific notation in place of the ordinary decimal notation. Moreover, depending on your country you could stick to different conventions in writing numbers. For instance, the amount "three hundred millions and fifty-two thousands of dollars and forty-six cents" is usually written by an Italian accountant as 300.052.000,46$ while an American accountant would write 300,052,000.46$. Of course, 300.052.000,46$ and 300,052,000.46$ represent the same amount of money but `diff' and `wdiff' would report a difference, which probably is not what you want in a similar case. At last, sometimes you could want to ignore even differences in numerical values as long as they do not overcome a certain threshold. In other words, you could desire to suppress all "small" numerical differences too. For instance, it could happen that you want to ignore all numerical differences whose absolute value is not greater than 0.0001. If this is the case, then the numerical fields 33 and 33.00009 must be considered equal, while 33 and 33.00011 must be reported as different. However, `diff' and `wdiff' can not be used to ignore "small" numerical differences, since they do not even know what a numerical difference is. What I have been saying till now explains why I decided to implement a new program with the capability to "appropriately" compare files containing numerical fields. In writing this program I was inspired by `ndiff', a GPL'ed software by Nelson H. Baabe of the Salt Lake City University. The author of `ndiff' had the same good reasons as me to write `ndiff'. `ndiff' is actually a good tool and I used it for a while. But I did not completely like the way it works and so `numdiff' was born. Although `ndiff' inspired `numdiff', they are completely different from the viewpoint of the source code: `numdiff' has been entirely written from scratch with the addition of code coming from GNU bc, GNU diff and GNUlib. In addition, the last versions of Numdiff offer much more features than `ndiff' does. `numdiff' can be used to compare putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. `numdiff' takes two mandatory arguments, the paths of the two files to compare, and, after splitting them into lines and the lines into fields according to a given list of field delimiters, it compares every field of every line of the first file with the corresponding field of the second file. What _corresponding_ here exactly means depends on the options passed to the program on the command line. With no options, corresponding means the field of the second file at the same position, where position refers both to the line number and to the location within the line. If the compared fields are both legal numerical values, then `numdiff' performs a numerical comparison between them, else it performs a literal comparison, i.e. the usual byte by byte comparison. In case of literal comparison, two fields are regarded as equal if they are formed by the same sequence of characters. In case of numerical comparison and without specific command line options, two fields are regarded as equal if their numerical difference is zero. Be careful ! If you do not explicitly specify a list of field delimiters by the option `-s', then `numdiff' takes as field delimiters the characters newline (`\n', ASCII code 0x0A), horizontal tabulation (`\t', ASCII code 0x09), and blank (` ', ASCII code 0x20). For instance, if the file `list1' contains the data accident 123 23Joshua 34.55 +3+4i water dog -3455.321 cat 2.345678e-9 .0005-6.23e2i and file `list2' contains the data Accident 123 23456 34.5500 +3.0001+4i dog -3455.320098 Cat +2.345678e-9 -6.23e2i $$$ A new line then the output of the command `numdiff list1 list2' will be: ---------------- ##1 #:1 <== accident ##1 #:1 ==> Accident @ @@ ##1 #:3 <== 23Joshua ##1 #:3 ==> 23456 @ @@ ##1 #:5 <== +3+4i ##1 #:5 ==> +3.0001+4i @ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5 ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! ---------------- ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 ##2 #:3 <== cat ##2 #:3 ==> Cat @ @@ ##2 #:5 <== .0005-6.23e2i ##2 #:5 ==> -6.23e2i @ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7 ##2 <== ##2 #>6 ==> $$$ @ Line 2 in file "list1" is shorter than expected! ---------------- ##3 <== ##3 #>1 ==> A new line @ Line 3 in file "list1" is shorter than expected! ---------------- <== ##4 ==> +++ File "list1" differs from file "list2" At the same time `numdiff' will print the following error message on stderr: *** End of file "list1" reached Likely the files "list1" and "list2" do not have the same number of lines ! It is worth remarking that `numdiff' can recognize complex numbers, provided that they are written in the form a+bi or a-bi with no extra characters between the values a, b and the sign + or - (the symbol i used to represent the imaginary unit can be actually changed by a suitable command line option, *note Invoking numdiff::). If you do not know what complex numbers are, do not worry! In this case probably you will never manage files containing complex numbers and so you can happily continue to ignore them. :) Let us consider now an example which shows how Numdiff can resynchronize the lines between two files in case of addition or deletion of one or more lines. The versions of Numdiff prior to 5 did not work well if one of the two files to compare contains in the middle some lines more or less than the other one. For instance, if you have one file that is 1000 lines long that you are comparing to a second file 1001 lines long, and except for that one extra line, located, let us say, at line 500, the files are identical, then `numdiff' version 4.x does *not* show only the one line difference: once the files are out of synchronization `numdiff' 4.x reports every line as different. Since version 5 it is possible in such cases to activate a filter which handles additions and deletions of lines. There are several options ruling how the filter actually works and I will give later a detailed explanation on how to use them to obtain each time the wished result. The simplest way to activate the filter consists in using the option `-z @'. If `bill1' and `bill2' are given by Month Expenses ------------------------- Jan09 $ 233.56 Feb09 $ 850.77 Mar09 $ 12.55 Apr09 $ 524.00 May09 $ 78.25 Jun09 $ 230.00 Jul09 $ 443.10 Aug09 $ 67.65 Sep09 $ 10.00 Oct09 $ 201.45 Nov09 $ 110.00 Dec09 $ 200.27 ------------------------- Total $ 2961.60 and Month Expenses Jan09 $ 234.00 Mar09 $ 13.00 May09 $ 78.25 Jul09 $ 443.10 Sep09 $ 10.00 Nov09 $ 110.00 Jan10 $ 200.00 ------------------------- Total $ 1088.35 respectively, then the differences between the two files are: * the insertion of the separator ------------------------- in `bill1' before the list of the months, * the deletion in `bill2' of the lines related to the expenses for the months February, April, June, August, October, December, * small changes in `bill2' to the expenses of the months January (2009) and March, * the presence in `bill2' of an entry for January 2010 just before the separator -------------------------, * the addition of an empty line to `bill2' after the separator -------------------------, * and the different values for the total sum of the expenses. The output of the command `numdiff -z @ -V bill1 bill2' (I have added here the option `-V' to let Numdiff show which couples of lines it is comparing each time) is exactly then what you expect: ---------------- ##2 <== ------------------------- ==> ---------------- ##3 <== Jan09 $ 233.56 ##2 ==> Jan09 $ 234.00 ##3 #:3 <== 233.56 ##2 #:3 ==> 234.00 @ Absolute error = 4.4000000000e-1, Relative error = 1.8838842268e-3 ---------------- ##4 <== Feb09 $ 850.77 ==> ---------------- ##5 <== Mar09 $ 12.55 ##3 ==> Mar09 $ 13.00 ##5 #:3 <== 12.55 ##3 #:3 ==> 13.00 @ Absolute error = 4.5000000000e-1, Relative error = 3.5856573705e-2 ---------------- ##6 <== Apr09 $ 524.00 ==> ---------------- ##8 <== Jun09 $ 230.00 ==> ---------------- ##10 <== Aug09 $ 67.65 ==> ---------------- ##12 <== Oct09 $ 201.45 ==> ---------------- ##14 <== Dec09 $ 200.27 ##8 ==> Jan10 $ 200.00 ##14 #:1 <== Dec09 ##8 #:1 ==> Jan10 @ @@ ##14 #:3 <== 200.27 ##8 #:3 ==> 200.00 @ Absolute error = 2.7000000000e-1, Relative error = 1.3500000000e-3 ---------------- <== ##10 ==> ---------------- ##16 <== Total $ 2961.60 ##11 ==> Total $ 1088.35 ##16 #:3 <== 2961.60 ##11 #:3 ==> 1088.35 @ Absolute error = 1.8732500000e+3, Relative error = 1.7211834428e+0 +++ File "bill1" differs from file "bill2" Numdiff has reported correctly the following differences: * the second line of file `bill1', i.e. the one containing the separator, has no correspondance, or, if you prefer, has been deleted from file `bill2'. * The lines related to the months January 2009 and March have been slightly modified in `bill2', namely the values of the expenses are slightly different. Notice that the line with the expenses for January 2009 is the third one in file `bill1' and the second one in file `bill2'. This information is printed by Numdiff in the form ##3 <== Jan09 $ 233.56 ##2 ==> Jan09 $ 234.00 Analogously ##5 <== Mar09 $ 12.55 ##3 ==> Mar09 $ 13.00 says that the line for March is the fifth one in `bill1' and the third one in `bill2'. * The line related to the total amount of the expenses appears also differently in the two files, since the amount of the expenses is different. Notice that this line is the 16th one in file `bill1' and the 11th one in file `bill2'. * The lines related to the months February, April, June, August and October, i.e. the lines no. 4, 6, 8, 10 and 12 of `bill1', are not present in `bill2'. * The line of `bill1' with the expenses for December 2009 is replaced in `bill2' by the line containing the value of the expenses for January 2010. * The tenth line of `bill2', i.e. the empty line after the separator, is not present in `bill1'. With respect to `bill1' this line represents then an addition. However, if you compare `bill1' and `bill2' without using the option `-z @', the result is completely misleading. This is the output of `numdiff -V bill1 bill2': ---------------- ##2 <== ------------------------- ##2 ==> Jan09 $ 234.00 ##2 #:1 <== ------------------------- ##2 #:1 ==> Jan09 @ @@ ##2 <== ##2 #>2 ==> $ 234.00 @ Line 2 in file "bill1" is shorter than expected! ---------------- ##3 <== Jan09 $ 233.56 ##3 ==> Mar09 $ 13.00 ##3 #:1 <== Jan09 ##3 #:1 ==> Mar09 @ @@ ##3 #:3 <== 233.56 ##3 #:3 ==> 13.00 @ Absolute error = 2.2056000000e+2, Relative error = 1.6966153846e+1 ---------------- ##4 <== Feb09 $ 850.77 ##4 ==> May09 $ 78.25 ##4 #:1 <== Feb09 ##4 #:1 ==> May09 @ @@ ##4 #:3 <== 850.77 ##4 #:3 ==> 78.25 @ Absolute error = 7.7252000000e+2, Relative error = 9.8724600639e+0 ---------------- ##5 <== Mar09 $ 12.55 ##5 ==> Jul09 $ 443.10 ##5 #:1 <== Mar09 ##5 #:1 ==> Jul09 @ @@ ##5 #:3 <== 12.55 ##5 #:3 ==> 443.10 @ Absolute error = 4.3055000000e+2, Relative error = 3.4306772908e+1 ---------------- ##6 <== Apr09 $ 524.00 ##6 ==> Sep09 $ 10.00 ##6 #:1 <== Apr09 ##6 #:1 ==> Sep09 @ @@ ##6 #:3 <== 524.00 ##6 #:3 ==> 10.00 @ Absolute error = 5.1400000000e+2, Relative error = 5.1400000000e+1 ---------------- ##7 <== May09 $ 78.25 ##7 ==> Nov09 $ 110.00 ##7 #:1 <== May09 ##7 #:1 ==> Nov09 @ @@ ##7 #:3 <== 78.25 ##7 #:3 ==> 110.00 @ Absolute error = 3.1750000000e+1, Relative error = 4.0575079872e-1 ---------------- ##8 <== Jun09 $ 230.00 ##8 ==> Jan10 $ 200.00 ##8 #:1 <== Jun09 ##8 #:1 ==> Jan10 @ @@ ##8 #:3 <== 230.00 ##8 #:3 ==> 200.00 @ Absolute error = 3.0000000000e+1, Relative error = 1.5000000000e-1 ---------------- ##9 <== Jul09 $ 443.10 ##9 ==> ------------------------- ##9 #:1 <== Jul09 ##9 #:1 ==> ------------------------- @ @@ ##9 #>2 <== $ 443.10 ##9 ==> @ Line 9 in file "bill2" is shorter than expected! ---------------- ##10 <== Aug09 $ 67.65 ##10 ==> ##10 #>1 <== Aug09 $ 67.65 ##10 ==> @ Line 10 in file "bill2" is shorter than expected! ---------------- ##11 <== Sep09 $ 10.00 ##11 ==> Total $ 1088.35 ##11 #:1 <== Sep09 ##11 #:1 ==> Total @ @@ ##11 #:3 <== 10.00 ##11 #:3 ==> 1088.35 @ Absolute error = 1.0783500000e+3, Relative error = 1.0783500000e+2 ---------------- ##12 <== Oct09 $ 201.45 ==> *** End of file "bill2" reached Likely the files "bill1" and "bill2" do not have the same number of lines ! +++ File "bill1" differs from file "bill2" Numdiff compares now the first, second, third line of `bill1' with the first, second, third line of `bill2' and so on. But this is not probably what you want in such a case: what is reasonable here is to compare entries related to the same month and not lines having the same location (i.e. line number). Numdiff offers also an option to run just the filter and see how it resynchronizes the two given files without doing any comparison between corresponding lines. The output of `numdiff -z @ -f bill1 bill2' is Month Expenses Month Expenses ------------------------- < Jan09 $ 233.56 Jan09 $ 234.00 Feb09 $ 850.77 < Mar09 $ 12.55 Mar09 $ 13.00 Apr09 $ 524.00 < May09 $ 78.25 May09 $ 78.25 Jun09 $ 230.00 < Jul09 $ 443.10 Jul09 $ 443.10 Aug09 $ 67.65 < Sep09 $ 10.00 Sep09 $ 10.00 Oct09 $ 201.45 < Nov09 $ 110.00 Nov09 $ 110.00 Dec09 $ 200.27 | Jan10 $ 200.00 ------------------------- ------------------------- > Total $ 2961.60 Total $ 1088.35 +++ File "bill1" differs from file "bill2" and shows that the filter is doing its job in the right way, associating the lines according to the month and not to the line number. Running just the filter is extremely useful in all situations when you are not sure if the filter is working as you wish. You have indeed to instruct the filter in the right way to let it work correctly, and this requires the use of different options depending on the structure of the files to compare. Since to guess the right options can be sometime tricky, running just the filter and see the result is the best way to be certain that you are setting up everything correctly. Later, *note Filtering::, I will explain in detail * what the filter does behind the scenes to understand if and how it has to resynchronize the files to compare, * and how the related options affect the action of the filter. By the way, it is even possible to use `-f' without any other additional option for the filter, like in `numdiff -f bill1 bill2', but the result is more or less the same you would obtain by performing a byte by byte comparison with removal of the field delimiters. The option `-f' can be followed by an argument in the form of an integer number whose meaning will be explained later, *note Use of the option -f::. Even if the output of `numdiff' is self-explanatory, in the next section I will explain in details all you have to know about it. 3.1 Output format ================= Let us go back to our first example. If the files `list1' and `list2' contain the data accident 123 23Joshua 34.55 +3+4i water dog -3455.321 cat 2.345678e-9 .0005-6.23e2i and Accident 123 23456 34.5500 +3.0001+4i dog -3455.320098 Cat +2.345678e-9 -6.23e2i $$$ A new line respectively, then the output of the command `numdiff list1 list2' will be: ---------------- ##1 #:1 <== accident ##1 #:1 ==> Accident @ @@ ##1 #:3 <== 23Joshua ##1 #:3 ==> 23456 @ @@ ##1 #:5 <== +3+4i ##1 #:5 ==> +3.0001+4i @ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5 ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! ---------------- ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 ##2 #:3 <== cat ##2 #:3 ==> Cat @ @@ ##2 #:5 <== .0005-6.23e2i ##2 #:5 ==> -6.23e2i @ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7 ##2 <== ##2 #>6 ==> $$$ @ Line 2 in file "list1" is shorter than expected! ---------------- ##3 <== ##3 #>1 ==> A new line @ Line 3 in file "list1" is shorter than expected! ---------------- <== ##4 ==> +++ File "list1" differs from file "list2" `numdiff' prints a report on the standard output for every field of the first file which differs from the corresponding field of the second one. First this report indicates the locations of the fields, namely the numbers of the lines where the fields appear and their positions within the line. The position in the line is "1" for the first field of a line, "2" for the second field, "3" for the third one and so on: fields are numerated starting from the left hand of the line and proceeding towards the right hand. For each report the line number is introduced by the symbol "##", while the field number by "#:". Then `numdiff' shows in what the difference consists. For instance, ##1 #:1 <== accident ##1 #:1 ==> Accident @ @@ means that the first field of the first line is "accident" in the first file, while in the second file it appears as "Accident". This difference could be then canceled by removing "accident" from the first file and inserting "Accident" in place of it. The arrows "<==" and "==>" try to visualize this idea. Analogously, ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 means that the second field of the second line is "-3455.321" in the first file and "-3455.320098" in the second one. Since the contents of the field are numerical in both files, `numdiff' also prints the absolute and relative errors. The absolute error (or absolute difference) is given by the absolute value of the difference between the values appearing in the two files. The relative error (or relative difference) is actually defined in a more complicated way. If _n1_ is the value appearing in the first file and _n2_ is the value in the second file, then the absolute error is given by the formula _A=|n1-n2|_, while the relative error _R_ is given by: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and at least one of them is zero, * _R = A/ min(|n1|, |n2|)_ if _n1_ and _n2_ are both non zero and _n2_ differs from _n1_. _min(|n1|, |n2|)_ denotes the minimum between the absolute value of _n1_ and the absolute value of _n2_. With these definitions of absolute and relative error it turns out that _A(n2, n1) = A(n1, n2)_ and _R(n2, n1) = R(n1, n2)_. In other words, the absolute/relative error does not change if you only change the order of the compared values. Since version 5 it is actually possible to let Numdiff compute the relative error always with respect to the value from the first file or always with respect to the value from the second file, instead of using the preceding formula. This can be done through the option `-r' by writing its argument in a special form, *note Alternative formulas for the computation of the relative difference::. If at least one of the compared fields is not numerical, then the output line reporting absolute and relative errors is replaced by the separator: @ @@ It can happen that a line in one of the two files to compare contains more fields than the corresponding line of the other file. When this is the case, `numdiff' reports this difference by telling that a certain line (identified by its line number) appears to be shorter than expected, just as in ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! or in ##3 <== ##3 #>1 ==> A new line @ Line 3 in file "list1" is shorter than expected! In addition, `numdiff' shows the tail of the longer line, using the notation "#>n" to indicate the number n of the first field of the longer line for which there is no corresponding field in the shorter line. For instance, ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! means that for none of the fields of the first line starting from the sixth one there exists a corresponding field in the second file (`list2'). In this context, the symbol <<*>> (when it appears) is used to denote the End-Of-File, i.e. a line or the tail of a line which is located at the end of the corresponding file and does not have a terminating _newline_ character. It can also happen that one of the two files to compare has less lines than the other one. In this case, if no special option is passed to the program, `numdiff' prints the number of the first line which appears in only one of the two files. Moreover, it prints on the standard error a message telling in which of the two files the end has been prematurely reached: *** End of file "list1" reached Likely the files "list1" and "list2" do not have the same number of lines ! Unless the option `-q' is used (*note Invoking numdiff::), `numdiff' prints on standard output a message reporting the final status of the comparison. This message says either the two files are equal or they are different, just as in the example we are considering: +++ File "list1" differs from file "list2" The output produced just by running the filter is a side by side difference listing of the two compared files, like the one displayed by GNU sdiff. The files are listed in two columns with a gutter between them. The gutter contains one of the following markers: `white space' The corresponding lines are in common. That is, either the lines are identical, or the difference is ignored because of one of the options `-I', `-X', `-z' and `-Z'. `|' The corresponding lines differ, and they are either both complete or both incomplete. `<' `(' The files differ and only the first file contains the line. `>' `)' The files differ and only the second file contains the line. `\' The corresponding lines differ, and only the first line is incomplete. `/' The corresponding lines differ, and only the second line is incomplete. An input line is incomplete if its last character is not a newline. This can happen only if the line is the last one of its file. When an output line of the side by side difference listing represents two differing lines, one might be incomplete while the other is not. In this case the gutter is marked `\' if the line from the first file is incomplete, `/' if the line from the second file is. Side by side format is easy to read, but it has limitations. It generates much wider output than usual, and truncates lines that are too long to fit. Also, it relies on lining up output quite heavily, so its output looks particularly bad if you use varying width fonts, nonstandard tab stops, or nonprinting characters. The option `-f' can take an optional argument, which allows to set the width of the output and eventually to suppress common lines, *note Invoking numdiff:: and *note Use of the option -f::. More generally, the user can always make `numdiff' avoid to print, partially or totally, the messages that it would otherwise send to standard output. This can be achieved by some suitable command line options, *note Invoking numdiff::. 4 Installing ************ To successfully compile, build and install Numdiff some tools are required. The first one is an ANSI C compiler. This compiler should at least accept the option `-o' to write its output to a specified file, the option `-D' for macros predefinition, the option `-l' to search for a specified library, and the options `-I' and `-L' to add a given directory to the search path for include and library files respectively. Numdiff has been successfully compiled and tested on Slackware(R) GNU/Linux 10.2 with the version 3.3.6 of the GNU C Compiler (GCC), on Slackware GNU/Linux 11 with GCC 3.4.6, on Slackware GNU/Linux 12.2 with GCC 4.2.4, on Slackware GNU/Linux 13 with GCC 4.3.3, on Debian(R) GNU/Linux 4.0 with GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21), on SunOS(R) 5.8 with GCC 2.95.3, and on SunOS 5.10 (i386) with the version 5.9 of the Sun C compiler. Moreover, you need a POSIX implementation of the `make' utility (I used both GNU make and smake by Joerg Schilling to compile Numdiff) and a POSIX implementation of the commands `rm' and `find'. At last, you need a proper installation of GNU Texinfo (in order to install the info documentation) and a shell sh-compatible. Configuration, building and installation of Numdiff can be performed through the standard three steps: ./configure make make install If you leave enabled the Natural Language Support and you also want to install the localization files (at the moment only the Italian localization is supplied), then, after `make', you will have to type and run make install-nls By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/info' etc. You can specify an installation prefix other than `/usr/local' using the option `--prefix' in the `configure' step, for instance `--prefix=$HOME': ./configure --prefix=$HOME For better control, you can use the options `--bindir', `--infodir', and so on. Type `./configure --help' to obtain the complete list of all the available options. Anyway, the documentation files, including a full User Manual available in several formats (HTML, PDF and plain ASCII text), will always be put in `DOCDIR/numdiff', where DOCDIR is the path specified by the option `--docdir' or, if this option has not been given to `configure', `PREFIX/local/doc'. Here PREFIX is the installation prefix specified by the option `--prefix' or the default `/usr/local'. Once Numdiff has been installed you can remove all the files previously installed by a simple `make uninstall'. If you have also installed the localization files trough `make install-nls', then, in order to remove also these ones, use `make uninstall-nls' in place of `make uninstall'. Between the options accepted by `configure' there are `--enable-debug', `--enable-optimization', `--enable-nls' and `--enable-gmp'. The option `--enable-debug' turns on debugging when compiling the source code. This is obtained by passing to the compiler the `-g' option, but you can change this default debugging flag (which could not even be recognized by your compiler) by setting the environment variable `DBGFLAGS' before calling `configure'. The option `--enable-optimization' turns on basic optimization when compiling the source code. This is obtained by passing to the compiler the `-O' option, but you can change this default flag (which could not even be recognized by your compiler) by setting the environment variable `OPTFLAGS' before calling `configure'. The option `--enable-nls' turns on Natural Language Support. But you do not need to use it explicitly, since Natural Language Support is enabled by default. However, you can disable it by using `--disable-nls'. Disabling Natural Language Support is suggested whenever you want to install Numdiff on a system where the GNU gettext library is not present. In this case the installation of Numdiff can be accomplished, for instance, through ./configure --disable-nls make make install Since version 5.2.0 Numdiff uses to perform all computations the GNU Multiple Precision Arithmetic Library (also called GNU MP or GMP), if this library is available at build-time. The old internal support for multiple precision arithmetic is a fall-back in case GNU MP is absent. However it is possible to use the internal support for multiple precision arithmetic even when GNU MP is available: it is sufficient to pass the option `--enable-gmp=no' or `--disable-gmp' to the configure script before building the program, like in ./configure --disable-gmp make make install Enabling the old internal support for multiple precision arithmetic is deprecated, *note with GNU MP is better::. The latest version of GNU MP is available at `ftp://ftp.gnu.org/gnu/gmp/'. See the GNU MP web page at `http://gmplib.org/' for up-to-date information on GNU MP. 5 Invoking numdiff ****************** *SYNOPSIS* numdiff -h|--help|-v|--version or numdiff [-s IFS][-a MAXERR][-r MAXERR][-2][-# PREC][-P][-N][-I] [-d C1C2][-t C1C2][-g N1N2][-p C1C2][-n C1C2][-e C1C2][-i C1C2] [-X 1:INT][-X 2:INT][-E][-D][-b][-V][-q][-S][-z 1:INT][-z 2:INT] [-Z 1:INT][-Z 2:INT][-m][-H][-f[NUM]][-T][-l PATH][-o PATH] FILE1 FILE2 where FILE1 and FILE2 are the names of the two files to compare and INT stays for a positive integer value or for a range of integer values, like 1-, 3-5 or -7. In the first case `numdiff' prints a short help (not so short actually :)) or/and version number, Copyright, License notice, NO-Warranty disclaimer and some information about the way it was built. In the second case `numdiff' compares the files specified by the two (mandatory) arguments which follow the list of the options. The complete path of a file should be given, a directory name is not accepted. Moreover, the two arguments cannot refer to the same file but one of them can be -, which refers to stdin. *OPTIONS* `-s, --separator=IFS' Specify the set of characters to use to split the input lines into fields (The default set of characters is space, tab and newline) `-a, --absolute-tolerance=MAXERR' Specify the maximum absolute difference permitted before that two numeric fields are regarded as different (The default value is zero) `-r, --relative-tolerance=MAXERR' Specify the maximum relative difference permitted before that two numeric fields are regarded as different (The default value is zero) `-2, --strict' Order that two numerical values are regarded as equal only if both absolute and relative difference do not exceed the corresponding tolerance threshold `-#, --digits=PREC' Specify the number of digits in the significands used in multiple precision arithmetic `-P, --positive-differences' Ignore all differences due to numeric fields of the second file that are less than the corresponding numeric fields in the first file `-N, --negative-differences' Ignore all differences due to numeric fields of the second file that are greater than the corresponding numeric fields in the first file `-I, --ignore-case' Ignore changes in case while doing literal comparisons `-d, --decimal-point=C1C2' Specify the characters representing the decimal point in the two files to compare `-t, --thousands-separator=C1C2' Specify the characters representing the thousands separator in the two files to compare `-g, --group-length=N1N2' Specify the number of digits forming each group of thousands in the two files to compare `-p, --plus-prefix=C1C2' Specify the (optional) prefixes for positive values used in the two files to compare `-n, --minus-prefix=C1C2' Specify the prefixes for negative values used in the two files to compare `-e, --exponent-letter=C1C2' Specify the exponent letters used in the two files to compare `-i, --imaginary-unit=C1C2' Specify the characters representing the imaginary unit in the two files to compare `-X, --exclude=1:INT' Select the fields of the first file that have to be ignored `-X, --exclude=2:INT' Select the fields of the second file that have to be ignored `-E, --essential' While printing the differences between the two compared files show only the numerical ones `-D, --dummy' While printing the differences between the two compared files neglect all the numerical ones (dummy mode) `-b, --brief' Suppress all messages concerning the differences discovered in the structures of the two files `-V, --verbose' For every couple of lines which differ in at least one field print an header to show how these lines appear in the two compared files `-q, --quiet, --silent' Suppress all the standard output `-S, --statistics' Add some statistics to the standard output `-z, --blur-if-numerical=1:INT' Select the fields of the first file that have to be blurred during the synchronization procedure only if they turn out to be numeric `-z, --blur-if-numerical=2:INT' Select the fields of the second file that have to be blurred during the synchronization procedure only if they turn out to be numeric `-Z, --blur-unconditionally=1:INT' Select the fields of the first file that have to be unconditionally blurred during the synchronization procedure `-Z, --blur-unconditionally=2:INT' Select the fields of the second file that have to be unconditionally blurred during the synchronization procedure `-m, --minimal' During synchronization try hard to find a smaller set of changes `-H, --speed-large-files' During synchronization assume large files and many scattered small changes `-f, --test-filter[=NUM]' Run only the filter and then show the results of its attempt to synchronize the two files. If NUM is zero or is not specified, output at most 130 columns per line. If NUM is a positive number, output at most NUM columns per line. If NUM is a negative number, do not output common lines and display at most -NUM columns per line. `-T, --expand-tabs' Expand tabs to spaces in output while displaying the results of the synchronization procedure (meaningful only together with option -f) `-l, --warnings-to=PATH' Redirect warning and error messages from stderr to the indicated file `-o, --output=PATH' Redirect output from stdout to the indicated file `-h, --help' Show help message and predefined settings `-v, --version' Show version number, Copyright, Distribution Terms and NO-Warranty *DIAGNOSTICS* The exit status is 1 if the two given files differ, 0 if they are equal, -1 (255) in case of error. *DEFAULT NUMERIC FORMAT (for both files to compare):* Decimal point = `.' Thousands separator = `,' Number of digits in each thousands group = 3 Leading positive sign = `+' Leading negative sign = `-' Prefix for decimal exponent = `e' Symbol used to denote the imaginary unit = `i' *SOME EXPLANATIONS* The options `-D', `-E', `-b' and `-q' are used to hide part of the standard output of the program according to some rule. The option `-D' triggers the "dummy mode". In this mode `numdiff' does not print the numerical differences. A numerical difference occurs whenever the compared fields turn out to be both of numerical type, but the field from the second file has a value which differs from the one of the field from the first file. The "dummy mode" is so called since when it is active, `numdiff' does not perform the job for which I created it. The option `-E' triggers the "essential mode". In this mode `numdiff' only prints the numerical differences between the two files and, if there are some, the differences in the structure. The latter ones occur either when one of the compared files contains a line for which there is no corresponding line in the other file, or when, comparing two lines, it turns out that one of them contains a field for which there exists no corresponding field in the other one. If you are not running any filter or cutting out some fields through the option `-X', then the differences in the structure simply consist either in a different number of lines in the two files, or in a different number of fields on a line. The option `-b' triggers the "brief mode". In this mode `numdiff' does not print the differences in the structure of the two files, see just above for an explanation on what they are. The option `-q' triggers the "quiet mode". When in this mode `numdiff' does not print anything on the standard output. The "quiet mode" is useful if you only want to know whether a couple of files are equal or not. This information can be obtained by looking at the exit status of the program. The option `-V' triggers the "verbose mode". In this mode `numdiff' produces a richer report by printing an header whenever the compared lines differ. The header shows how and where these lines appear in the compared files. For instance, if the files `data1' and `data2' contain the data 12 33 22 44.5 0.008 1.002 221.12 -34.56 water 2101.21 boats and 12 33 22.3 44.5 0.008 1.202 221.12 -34.56 2101.21 boats dogs respectively, then the command `numdiff -V data1 data2' will print the following output: ---------------- ##2 <== 22 44.5 ##2 ==> 22.3 44.5 ##2 #:1 <== 22 ##2 #:1 ==> 22.3 @ Absolute error = 3.0000000000e-1, Relative error = 1.3636363636e-2 ---------------- ##3 <== 0.008 1.002 ##3 ==> 0.008 1.202 ##3 #:2 <== 1.002 ##3 #:2 ==> 1.202 @ Absolute error = 2.0000000000e-1, Relative error = 1.9960079840e-1 ---------------- ##4 <== 221.12 -34.56 water ##4 ==> 221.12 -34.56 ##4 #>3 <== water ##4 ==> @ Line 4 in file "data2" is shorter than expected! ---------------- ##5 <== 2101.21 boats ##5 ==> 2101.21 boats dogs ##5 <== ##5 #>3 ==> dogs @ Line 5 in file "data1" is shorter than expected! +++ File "data1" differs from file "data2" You must care that the options `-b' and `-V' will be overridden if `-q' is also set. The amount of additional information printed by `-V' is trivially influenced by the options which alter the way `numdiff' performs the comparisons between fields (for instance `-a', `-r', `-2', `-N', `-P', `-D', `-E', `-I', `-X'). In the headers printed by `numdiff' when in "verbose mode" can also appear the symbol <<*>>. This symbol, if present, is always located at the end of a line to mean that the line is at the end of the corresponding file and does not have a terminating *newline* character. The option `-S' adds to the standard output of `numdiff' a statistical report with the following information: * the number of numeric comparisons the program has done (this quantity, like the successive ones, is influenced by the options `-P' and `-N') and the number of those comparisons whose outcome is a relevant numerical difference. * the largest absolute error in the set of relevant numerical differences and the corresponding relative error, * the largest relative error in the set of relevant numerical differences together with the corresponding absolute error, * the sum and the arithmetic mean of all absolute errors, * the sum and the arithmetic mean of the relevant absolute errors, * the square root of the sum of the squares of all absolute errors, * the square root of the sum of the squares of the relevant absolute errors, * the quadratic mean of all absolute errors, and * the quadratic mean of the relevant absolute errors. By relevant numerical differences and relevant absolute errors I mean those ones appearing in the output of `numdiff' when the options `-D' and `-q' are not used. The information printed by `-S' is not removed when this option is used together with `-q'. The options `-a', `-r', `-2', `-P' and `-N' affect the way `numdiff' performs the comparisons between numerical values. Without any of these options, `numdiff' considers two numerical fields as equal when their difference is zero. The option `-a' can be used to order that two numerical fields must be considered equal as long as their absolute difference does not exceed a certain threshold, which is specified by the argument that follows the `-a' option. The option `-r' can be used to order that two numerical fields must be considered equal as long as their relative difference does not exceed a certain threshold, which is specified by the argument that follows the `-r' option. The relative difference is normally defined in this way. If _n1_ is a value from the file specified as first on the command line and _n2_ is the corresponding value from the second file, then the absolute difference is given by the formula _A=|n1-n2|_. The relative difference _R_ is given by: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and at least one of them is zero, * _R = A/ min(|n1|, |n2|)_ if _n1_ and _n2_ are both non zero and _n2_ differs from _n1_. _min(|n1|, |n2|)_ denotes the minimum between the absolute value of _n1_ and the absolute value of _n2_. With this definition of relative difference it turns out that _R(n2, n1) = R(n1, n2)_: the relative difference does not change if you only change the ordering of the compared files on the command line. However there are cases when this default definition of relative error makes no sense. This can happen for instance when one of the files is a sample file containing a list of expected data, which could have been computed theoretically or come from experiments in a laboratory. In this case it is more natural to define the relative difference as the ratio between the absolute difference and the absolute value of the number coming from the sample file. If you put the prefix `1:' (or `2:') in front of the argument passed to `-r', then Numdiff always compute the relative difference as the ratio between the absolute difference and the absolute value of the number from the first file (the second file, respectively). More precisely, with the prefix `1:' the relative difference _R_ is computed according to these rules: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and _n1_ is zero, * _R = |n1-n2|/ |n1|_ if _n1_ is not zero and _n2_ differs from _n1_. With the prefix `2:' the rules become: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and _n2_ is zero, * _R = |n1-n2|/ |n2|_ if _n2_ is not zero and _n2_ differs from _n1_. With the last two sets of rules is not anymore true that _R(n2, n1) = R(n1, n2)_: the relative difference changes, in the general case, together with the ordering of the files on the command line. If there is a prefix, the value after it is in any case interpreted as tolerance threshold for the relative difference, just as in the case when no prefix is given. You can use `-r 1:0' or `-r 2:0' if you just want to change the way the relative differences are computed and leave the tolerance threshold to its default value, i.e. zero. As a simple example, suppose that FILE1 and FILE2 contain 1 9.9 0.5 440 and 1.2 8 0.51 400 respectively. Then `numdiff FILE1 FILE2' displays ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1 +++ File "file1" differs from file "file2" `numdiff -r 1:0 FILE1 FILE2' prints ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 1.9191919192e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 Absolute error = 4.0000000000e+1, Relative error = 9.0909090909e-2 +++ File "file1" differs from file "file2" the output of `numdiff -r 2:0 FILE1 FILE2' is ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 1.6666666667e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 Absolute error = 1.0000000000e-2, Relative error = 1.9607843137e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1 +++ File "file1" differs from file "file2" `numdiff -r 1:0.195 FILE1 FILE2' displays ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 +++ File "file1" differs from file "file2" and, finally, `numdiff -r 2:0.195 FILE1 FILE2' displays ---------------- ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 +++ File "file1" differs from file "file2" Care not to leave any space between the prefix `1:' or `2:' and the value of the tolerance threshold, Numdiff would consider this as a wrong input. The option `-2' is only meaningful when both `-a' and `-r' are present on the command line. If the user specifies a non-zero tolerance threshold for both absolute and relative error by using both `-a' and `-r', `numdiff' adopts this behavior: it considers equal two numerical fields as long as at least one between absolute and relative error does not exceed the corresponding threshold. With the option `-2' `numdiff' regards two numerical values as equal only if both absolute and relative error do not exceed the threshold of tolerance. For instance, if FILE1 contains the unique line 100 and FILE2 the line 100.00012 then the output of the command `numdiff FILE1 FILE2' will be ---------------- ##1 #:1 <== 100 ==> 100.00012 @ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6 +++ File "FILE1" differs from file "FILE2" The output of the commands `numdiff -a 1.0e-4 FILE1 FILE2' and `numdiff -r 1.0e-6 FILE1 FILE2' will be the same, while `numdiff -a 1.0e-4 -r 1.3e-6 FILE1 FILE2' and `numdiff -a 1.3e-4 -r 1.0e-6 FILE1 FILE2' will print the message +++ Files "FILE1" and "FILE2" are equal since the relative error is 1.2e-6 < 1.3e-6, the absolute error is 1.2e-4 < 1.3e-4, and it is sufficient that one of them does not exceed the tolerance specified on the command line to make `numdiff' consider equal the two compared values. However, the commands `numdiff -a 1.0e-4 -r 1.3e-6 -2 FILE1 FILE2' and `numdiff -a 1.3e-4 -r 1.0e-6 -2 FILE1 FILE2' will print the message ---------------- ##1 #:1 <== 100 ==> 100.00012 @ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6 +++ File "FILE1" differs from file "FILE2" since the option `-2' makes `numdiff' regard two values as equal only if both absolute and relative difference do not exceed the corresponding threshold of tolerance. The option `-P' makes `numdiff' consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is less or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is less or equal than the first one means that both real and imaginary part of the second one are not greater than the real part and, respectively, the imaginary part of the first one. Finally, the option `-N' makes `numdiff' consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is greater or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is greater or equal than the first one means that both real and imaginary part of the second one are not less than the real part and, respectively, the imaginary part of the first one. The options `-I', `-l', `-o', `-h' and `-v' do not require further explanations. The options `-l' and `-o' are only supplied for the users of some poorly designed operating systems (like MSDog or MSWindoze), whose default shell does not allow the redirection of standard error and standard output. The option `-I' has no effect on the outcome of numerical comparisons but affects the action of the filter, *note Filtering::. The option `-s' requires as argument a set of characters, which will be taken as field delimiters. It is better to quote the set of the delimiters, just as in the next examples: numdiff -s ' \t\n,;:.' FILE1 FILE2 numdiff -s ' \t\n\r\f\v"\:;' FILE1 FILE2 numdiff -s `` \t\n''' FILE1 FILE2 If you want to include in the set of delimiters also some special characters, e.g the *blank*, then you must quote it. I recommend you to always use the single quote character (') to enclose the list of the delimiters, since in this way you will prevent any substitution or handling of characters by the shell. `numdiff' recognizes and interprets the following sequences of characters within the argument passed to the option `-s': * `\f' form feed, * `\n' newline, * `\r' carriage return, * `\t' horizontal tab, * `\v' vertical tab. The mentioned special characters are often used as delimiters in files containing numerical data but they can not be included directly in the set of delimiters. By passing the string ` \t\n,;:.' as argument for the option `-s', one tells `numdiff' use as field delimiters the characters *blank*, *horizontal tab*, *newline*, *comma*, *semicolon*, *colon* and *dot*. Passing ` \t\n' as argument to the option `-s' is the same as not using at all the option `-s', since *blank*, *horizontal tab* and *newline* are the default field delimiters. In the list of field delimiters the character *backslash* (`\') is always treated in a special way. If followed by `f', `n', `r', `t' or `v' it is combined with the subsequent character and interpreted in the way we have just seen. Otherwise, the *backslash* is coupled with the following character and then removed. In particular, if you want to specify the *backslash* itself as field delimiter, you have to put *two backslashes* (`\\') in the list of delimiters. Therefore, the delimiters specified by the command line numdiff -s' \t\n\\\"' FILE1 FILE2 are *blank*, *horizontal tab*, *newline*, *backslash* and *double quote*, since `\\' and `\"' are interpreted by `numdiff' as `\' and `"'. Even if I have recommended to enclose the set of delimiters in single quotes, there are cases in which you will be constrained to use the double quote character (`"') to enclose the set of field delimiters, e.g. if the single quote character is used as field delimiter, like in one of the precedent examples. However you must take into account that in this case the shell could make some substitutions on the command line before executing `numdiff'. For instance, if your shell is GNU bash, then (citing the man page of GNU bash) Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of `$', ``', and `\'. The characters `$' and ``' retain their special meaning within double quotes. The backslash retains its special meaning only when followed by one of the following characters: `$', ``', `"', `\', or **. A double quote may be quoted within double quotes by preceding it with a backslash ... The special parameters * and @ have special meaning when in double quotes ... Therefore, if the set of delimiters is formed by ` ', `\t', `\n', `\' and `"' and you decide to enclose them in double quotes, then the `numdiff' command line should be numdiff -s'' \t\n\\\\\"'' FILE1 FILE2 and not numdiff -s'' \t\n\\\"'' FILE1 FILE2 In this last case the shell would indeed replace the string ` \t\n\\\"' by ` \t\n\"' and then `numdiff' would take ` ', `\t', `\n' and `"' as field delimiters. `numdiff' requires the presence of the *newline* in the set of characters passed to `-s'. The absence of the *newline* in the set of delimiters causes the issue of a suitable warning message and the termination of the program. If you are running Numdiff on MSDog/MSWindoze I recommend you to always put the *carriage return* in the set of field delimiters. Otherwise, this character would be included in all the fields which stay at the end of a line and this would cause some undesirable effects. For instance, a number put at the end of a line would not be considered as a numerical field by `numdiff', since `numdiff' would consider the final *carriage return* as part of the field which then would be qualified as non-numerical. You can specify different delimiters for the two files to compare by putting the prefix `1:' or `2:' in front of the set of characters passed to `-s'. If the argument of `-s' begins with `1:', the characters after this prefix are used as field delimiters only for the file passed as first on the command line. Analogously, if the prefix is `2:', then the characters after it are used as field delimiters only for the file specified as second on the command line. You can also provide an explicit set of delimiters for just one of the files to compare, in which case `numdiff' uses the default field delimiters *blank*, *tab* and *newline* for the other file. Therefore, with `numdiff -s '1:: \n' FILE1 FILE2' the program will take *colon*, *blank* and *newline* as delimiters for FILE1, and *blank*, *tab* and *newline* as delimiters for FILE2. The recommendations about quoting the set of delimiters are valid even in presence of a prefix. The option `-#' lets the user specify the number of digits in the significands used in multiple precision arithmetic. The default value is 35, the largest admissible value is 180. If `numdiff' has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user. Take into account that an higher precision makes the execution of `numdiff' slower. This is particularly true if `numdiff' is not using the computational routines from the GNU MP library and the files to compare contain a lot of numerical fields. In addition, you have to care that `numdiff' truncates the value of a numerical field if it has too much digits with respect to the current precision. To be precise, denoted by P the current value of the precision, the following rules apply. * If `numdiff' has been built with its own internal support for multiple precision arithmetic, then * if a number is written in ordinary decimal notation, `numdiff' will consider, in addition to all digits of the integer part, only the first P digits of the fractional part; * if a value is written in scientific notation, then `numdiff' will only consider the first P digits of the fractional part of the mantissa. * If `numdiff' uses the routines from the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first P digits of the fractional part of the mantissa are considered. You can find out whether your local version of `numdiff' is relying on GNU MP or not by executing the command `numdiff -v'. If `numdiff' uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information: The software has been linked against the GNU Multiple Precision Arithmetic Library, version number 4.2.4. If `numdiff' does not rely on GNU MP, then the displayed message will be (up to translation into your mother language) The software has been built with its own internal support for multiple precision arithmetic. The options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' can be used to instruct `numdiff' about the numeric formats used in the files which it is going to compare. The two files to compare do not have to adopt the same numeric format and then `numdiff' allows to specify different numeric formats for them. Each of the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' can have as argument one or two characters (one or two digits if the option is `-g'). In the first case the argument refers to both files to compare, in the second case the first character is for the file specified as first on the command line, the second character for the file specified as last. For instance, the option `-d' can be used to tell `numdiff' which character(s) is(are) used to mean the decimal point in the two files to compare. If you give the command `numdiff -d_ FILE1 FILE2', then `numdiff' will understand that both in FILE1 and in FILE2 the character *underscore* (`_') is used in place of the default one (`.') to indicate the position of the decimal point in the numerical values. But if the command is `numdiff -d_: FILE1 FILE2', then `numdiff' will understand that the decimal point is indicated by the character *underscore* in FILE1, and by *colon* (`:') in FILE2. If you omit to use one of the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i', then the corresponding attribute will take its default value, *note Default Numeric Format::. You must be really careful when you use one or more of these options. First, not all characters can be passed to them as arguments. The arguments of the option `-g' must be digits, the arguments of the options `-d' and `-t' must be punctuation marks (punctuation marks are all the characters of the ASCII set for which the standard C function `ispunct' returns a non zero value), those ones of the options `-p', `-n', `-e' and `-i' must be graphical characters but digits (graphical characters are all the characters of the ASCII set for which the standard C function `isgraph' returns a non zero value). It is not possible to set the decimal point, the thousands separator, the positive sign, the negative sign, the prefix for decimal exponent or the symbol of the imaginary unit so that, for a same file, two or more of these characters come out to be equal. This rule also applies when you miss to explicitly select a symbol through the appropriate option. For instance, the command `numdiff -d,. FILE1 FILE2' will make `numdiff' abnormally terminate after printing the error message: The numeric format specified for the first file is illegal, the following symbols should be all different while two or more of them are actually equal: Decimal point = `,' Thousands separator = `,' Leading positive sign = `+' Leading negative sign = `-' Prefix for decimal exponent = `e' Symbol used to denote the imaginary unit = `i' Through the option `-d' we have told to `numdiff' that in the first file the decimal point is indicated by the character *comma*, but at the same time we have not modified the character in use to separate the groups of thousands, which has remained the default one, i.e. *comma*, for both files to compare. In this way, we have implicitly told to `numdiff' that in FILE1 the character *comma* represents both decimal point and thousands separator. Since this is not reasonable, `numdiff' refuses to work. To avoid this problem it would be sufficient to explicitly notify to `numdiff' the thousands separator through the option `-t': `numdiff -d,. -t., FILE1 FILE2'. Of course, here we are supposing that the decimal point and the thousands separator are represented in FILE1 by *comma* and *dot* respectively, in FILE2 by *dot* and *comma*. I strongly suggest you that in writing a file you avoid the use of the same symbol to mean two different things (like would be using *comma* for both decimal point and thousands separator), it is nonsense. At last, it is possible (but stupid) to use as argument for the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' one of the characters used to separate the fields in the files to compare. In such a case `numdiff' does not complain but you have to consider that it uses first the set of field delimiters in order to split the files into fields and then, when it has to distinguish between numerical and non-numerical fields, it takes into account the numeric formats specified for the two files. However, it should never happen to specify as argument for one of the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' a character which is also used as field delimiter: again, in writing a file you should avoid (and people usually avoid it) to use the same symbol to mean two different things. The option `-X' can be used to restrict the comparison between files to a certain group of fields. This option requires as argument a range of positive integer values or eventually just one positive integer number. The argument specifies the position(s) of the fields that `numdiff' has to ignore. Remember that the fields of a line are numerated starting from the left hand of the line and proceeding towards the right hand. The argument passed to `-X' can start with a prefix, which must be either `1:' or `2:'. `1:' refers to the file passed as first on the command line, `2:' to the file specified as second. With the prefix `1:' only the fields of the first file corresponding to the given position(s) are ignored. Similarly, if you want to ignore only fields from the second file you have to use the prefix `2:'. The option `-X' can appear more times on the command line, in which case `numdiff' will ignore all fields located in the positions so specified. Some examples can clarify the use of ranges and prefixes. If the file `List1' contains the data * a 1 1 1 1 * b 2 2 2 2 * c 3 3 3 3 * d 4 4 4 4 * e 5 5 5 5 and `List2' the data 1 1.1 1.01 A 1.001 1.0001 2 2.2 2.02 B 2.002 2.0002 3 3.3 3.03 C 3.003 3.0003 4 4.4 4.04 D 4.004 4.0004 5 5.5 5.05 E 5.005 5.0005 then the output of `numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2' is ---------------- ##1 #:4 <== 1 ##1 #:2 ==> 1.1 @ Absolute error = 1.0000000000e-1, Relative error = 1.0000000000e-1 ##1 #:5 <== 1 ##1 #:3 ==> 1.01 @ Absolute error = 1.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##2 #:4 <== 2 ##2 #:2 ==> 2.2 @ Absolute error = 2.0000000000e-1, Relative error = 1.0000000000e-1 ##2 #:5 <== 2 ##2 #:3 ==> 2.02 @ Absolute error = 2.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##3 #:4 <== 3 ##3 #:2 ==> 3.3 @ Absolute error = 3.0000000000e-1, Relative error = 1.0000000000e-1 ##3 #:5 <== 3 ##3 #:3 ==> 3.03 @ Absolute error = 3.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##4 #:4 <== 4 ##4 #:2 ==> 4.4 @ Absolute error = 4.0000000000e-1, Relative error = 1.0000000000e-1 ##4 #:5 <== 4 ##4 #:3 ==> 4.04 @ Absolute error = 4.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##5 #:4 <== 5 ##5 #:2 ==> 5.5 @ Absolute error = 5.0000000000e-1, Relative error = 1.0000000000e-1 ##5 #:5 <== 5 ##5 #:3 ==> 5.05 @ Absolute error = 5.0000000000e-2, Relative error = 1.0000000000e-2 +++ File "List1" differs from file "List2" Numdiff cuts off from `List1' the fields in the positions 1, 2 and 6 and from `List2' the fields in the positions 4, 5 and 6. In this way it compares the third, fourth and fifth field of every line of `List1' with the first, second and third field respectively of the corresponding line of `List2'. An equivalent form of the command `numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2' is given by `numdiff -X 1:1-2 -X 2:4-5 -X 6 List1 List2' : since the sixth field is cut off from both files we can refer to it without a prefix. As you can see, you can specify a range of fields by using the notation `M-N', where M and N are the field numbers of the first and of the last field in the range. It is even possible to use range expressions like `M-' or `-N'. The first expression corresponds to all fields starting from the Mth one (inclusive) till to the end of line, the second selects all fields from the first one till to the Nth one (inclusive). Therefore the command `numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2' is equivalent to `numdiff -X 1:-2 -X 2:4 -X 1:6 -X 2:5- List1 List2' or to `numdiff -X 1:-2 -X 1:6 -X 2:4- List1 List2'. Care that the largest field number that you can use while writing a specification for the option `-X' is 32768. If you use the option `-X' the exit status of `numdiff' reflects the outcome of the restricted comparison. For instance, the exit status of `numdiff -X 8- FILE1 FILE2' is 1 only if `numdiff' has found a difference in the first seven fields of FILE1 and FILE2. If the two files differ only in the fields after the seventh one, then `numdiff' ends with a zero exit status. Going back to the example with `List1' and `List2', the output of `numdiff -X 1:1-2 -X 1:4- -X 2:2- List1 List2' is +++ Files "List1" and "List2" are equal since every field of `List1' at position 3 is equal to the first field in the corresponding line of `List2'. The exit code returned by the program to the shell is zero. The options `-z', `-Z', `-m', `-H', `-f', and `-T' influence the action of the filter and their use is then described later, *note Filtering::. Care that `-z' and `-Z' require both an argument in the same form requested by `-X'. Since version 5 Numdiff accepts also long options to conform to the GNU standards. Now it is then possible, e.g., to use `--separator='\n\t %'' or `--separator '\n\t %'' instead of using `-s '\n\t %''. The long options, which start all with two dashes, are listed at the beginning of this chapter, each one near to the corresponding short option. The argument of a long option may or may not preceded by the = sign. The only exception is the option `--test-filter', for which the presence of the = before the argument is mandatory. Then `--test-filter=60' is correct while `--test-filter 60' is not accepted. 6 Selecting lines for the comparison ************************************ Together with the version 5.x of Numdiff is shipped a useful tool, the program `ndselect'. I decided to create this utility in order to deal with a situation that comes out often in Numerical Analysis. Here I present a very simple example of such a situation. Let us suppose that file `list1' contains the values of the square root, rounded to the 20th decimal digit, for all the integer numbers between 10 and 20: 12 3.46410161513775458705 13 3.60555127546398929312 14 3.74165738677394138558 15 3.87298334620741688518 16 4 17 4.12310562561766054982 18 4.24264068711928514641 19 4.35889894354067355224 20 4.47213595499957939282 21 4.58257569495584000659 22 4.69041575982342955457 23 4.7958315233127195416 24 4.89897948556635619639 while LIST2 contains _suitable_ approximations of the square root only for the numbers between 12 and 21 which are multiple of 3: 12 3.46410162002945508100 15 3.87298387096774193548 18 4.24264705882352941176 21 4.58260869565217391304 These approximations could have been obtained for instance by using the famous Heron's algorithm, which, given an approximation `a' for the square root of a number `x', computes a better approximation by the formula `a := 0.5 * (x/a + a)'. What we want now is to understand by using `numdiff' how good are the approximations contained in file LIST2. Unfortunately, we cannot execute directly the command `numdiff list1 list2', since in this way we would compare the approximations provided for the square roots of 15, 18, and 21 with the square roots of 13, 14, and 15 respectively. To make the comparison in the right way, one could open `list1' in a text editor and remove from this file all the non interesting lines till to leave only the ones related to the numbers 12, 15, 18, and 21. But this approach is practicable because we have to remove few lines, and one can easily figure out how boring and inefficient would be to manually remove hundreds or thousands of lines from a file in order to compare it with another one. An expert GNU user would suggest that it is possible to make this removal automatic by using the well known utilities `head' and `sed', in this particular case `head -n 10 list1 | sed -n -e '1~3 p' > List1' A quick explanation for the ones who do not know how to use `head' and `sed': the previous command extracts from `list1' the first 10 lines, namely the ones containing the square roots of the numbers from 12 to 21, then picks every third line starting from the first one between the extracted lines, in order to select only the ones related to 12, 15, 18, and 21. Finally, these lines are printed on the file `List1', which then looks like: 12 3.46410161513775458705 15 3.87298334620741688518 18 4.24264068711928514641 21 4.58257569495584000659 Once obtained `List1', we can perform with `numdiff' the comparison between the values we are interested in: `numdiff List1 list2' . Unfortunately, this trick only works if you have installed the GNU version of `sed', which, as far as I know, is the only one to provide the extension FIRST~STEP to specify line addresses. That is way I decided to implement `ndselect', which allows to obtain the same result as before with the simpler command: `ndselect -b 1 -e 10 -s 3 list1 > List1' The meaning of the arguments passed to the options `-b', `-e', and `-s' is the following: we are telling `ndselect' to print every third line of file `list1' (the option `-s' specifies the step), starting from the first one (the option `-b' specifies the beginning) and ending within the tenth one possibly inclusive (the option `-e' specifies the end). Because of the presence of the redirection operator `>', the previous command sends to the file `List1' what `ndselect' would print on the screen (standard output). Using `ndselect' is very simple and elegant, other than extremely useful in the situations just outlined. A complete description of its use follows. 7 Invoking ndselect ******************* *SYNOPSIS* ndselect -h|--help|-v|--version or ndselect [-b FIRST][-e LAST][-s STEP][-l PATH][-o PATH] [FILE] where FILE is the name of the file to scan. In the first case `ndselect' prints a short help or/and version number, Copyright, License notice and NO-Warranty disclaimer. In the second case `ndselect' prints on the standard output every STEPth line of FILE starting with line FIRST and ending within line LAST. The complete path of FILE should be given, a directory name is not accepted. If no input file is specified, the program reads from the standard input. *OPTIONS* `-b, --beginning, --start=FIRST' Specify the first line to print (The default behavior is to start with line number 1) `-e, --end=LAST' Specify the last line that can be printed (The default behavior is to arrive till to the end of the file) `-s, --step=STEP' Specify the step to use when selecting the lines to print (The default value for the step is 1) `-l, --warnings-to=PATH' Redirect warning and error messages from stderr to the indicated file `-o, --output=PATH' Redirect output from stdout to the indicated file `-h, --help' Show the help message `-v, --version' Show version number, Copyright, Distribution Terms and NO-Warranty Passing 0 as argument to the option `-e' is equivalent to omit this option and leave enabled the default behavior (which consists in scanning till to the end of the file). *DIAGNOSTICS* The exit status is 0 in case of normal termination, -1 (255) in case of error. As `numdiff' does, also `ndselect' since version 5 accepts long options. So instead of `ndselect -b 1 -e 10 -s 3 list1 > List1', you can launch this command as `ndselect --start=1 --end=10 --step=3 list1 > List1'. 8 Using the filter of numdiff ***************************** Since version 5 it is possible to activate a filter when calling `numdiff', so that the program performs automatically the comparison in the desired way. Recalling the example of chapter 6, if you run the command `numdiff -z 2- -V list1 list2' you obtain the following result: ---------------- ##1 <== 12 3.46410161513775458705 ##1 ==> 12 3.46410162002945508100 ##1 #:2 <== 3.46410161513775458705 ##1 #:2 ==> 3.46410162002945508100 Absolute error = 4.8917004940e-9, Relative error = 1.4121122985e-9 ---------------- ##2 <== 13 3.60555127546398929312 ==> ---------------- ##3 <== 14 3.74165738677394138558 ==> ---------------- ##4 <== 15 3.87298334620741688518 ##2 ==> 15 3.87298387096774193548 ##4 #:2 <== 3.87298334620741688518 ##2 #:2 ==> 3.87298387096774193548 Absolute error = 5.2476032505e-7, Relative error = 1.3549253331e-7 ---------------- ##5 <== 16 4 ==> ---------------- ##6 <== 17 4.12310562561766054982 ==> ---------------- ##7 <== 18 4.24264068711928514641 ##3 ==> 18 4.24264705882352941176 ##7 #:2 <== 4.24264068711928514641 ##3 #:2 ==> 4.24264705882352941176 Absolute error = 6.3717042443e-6, Relative error = 1.5018250929e-6 ---------------- ##8 <== 19 4.35889894354067355224 ==> ---------------- ##9 <== 20 4.47213595499957939282 ==> ---------------- ##10 <== 21 4.58257569495584000659 ##4 ==> 21 4.58260869565217391304 ##10 #:2 <== 4.58257569495584000659 ##4 #:2 ==> 4.58260869565217391304 Absolute error = 3.3000696334e-5, Relative error = 7.2013423303e-6 ---------------- ##11 <== 22 4.69041575982342955457 ==> ---------------- ##12 <== 23 4.7958315233127195416 ==> ---------------- ##13 <== 24 4.89897948556635619639 ==> +++ File "list1" differs from file "list2" Numdiff has recognized that the lines of `list1' with the square roots for the numbers 13, 14, 16, 17, 19, 20, 22, 23 and 24 have been deleted from `list2'. The numerical comparison has been done by likening each line of `list2' to the line of `list1' which displays the square root for the same integer value. The output obtained running the filter of Numdiff by `numdiff -f -z 2- list1 list2' confirms this: 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 < 14 3.74165738677394138558 < 15 3.87298334620741688518 15 3.87298387096774193548 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 18 4.24264705882352941176 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 21 4.58260869565217391304 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" If you compare the command `numdiff -z 2- -V list1 list2' with the one used here, *note command::, for the files `bill1' and `bill2' you surely notice that the filter has been invoked in different ways, first with `-z @' and then with `-z 2-'. The synchronization procedure used by the filter is based on blurring and byte by byte comparison. The options `-z' and `-Z' are used to select which field(s) from which file have to be blurred. They take both an argument in the same form requested by `-X', *note Use of the option -X::, but accept additionally the special value `@' as abbreviation for the range of fields `1-'. Then the specifications `1:@', `2:@' and `@' are used to mean all fields of the first file, of the second one or of both, respectively. Employing `-z' and `-Z' in the right way is extremely important to let the filter work as desired. For instance, `numdiff -f -z @ list1 list2' matches the lines of `list1' and `list2' in the same wrong way 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 15 3.87298387096774193548 14 3.74165738677394138558 18 4.24264705882352941176 15 3.87298334620741688518 21 4.58260869565217391304 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 < 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 < 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" as Numdiff would do without triggering the filter at all. It is essential then to understand what blurring a field means and how the filter uses blurring to match the lines of the files to compare. After reading the files the filter removes from each of them (from their images in the memory, actually) all the fields selected by the option `-X', then it replaces each of the fields that have to be blurred by a special character. This special character is the same for both files and it is so chosen that it cannot appear in the text. Blurring a field means to replace it by this sort of place card. After doing this, the filter converts all remaining numerical fields to a standard format and compares the files byte by byte neglecting the field delimiters. This comparison is just used to establish which lines of the first file are not present in the second, which lines of the second file are missing in the first one and how to match the remaining lines to create a one-to-one correspondence. Only at this point `numdiff' inspects each couple of corresponding lines, splits the two lines into the constituent fields, and neglecting those ones eventually specified through the option `-X' compares corresponding fields as it is supposed to do, performing a numerical comparison whenever the fields are both legal numerical values. Blurring the right fields is essential to match the lines from the two files appropriately before doing any numerical comparison. Without blurring, the numerical fields could prevent `numdiff' from an appropriate matching of the lines, in case some of them are present in only one file, by creating confusion with their (maybe small) numeric differences. Blurring can be of two types, conditional or unconditional. The blurring is conditional if it has to be performed only for fields which turn out to be legal numerical values. The arguments of the option `-z' indicate which fields of which file have to be blurred *under the condition that they are recognized as numeric fields*. Non-numeric fields are left by `-z' untouched (no blurring occurs for them). Then `-z 1:5-7' makes the filter blur the 5th, 6th and 7th field of each line of the first file whenever they are recognized as numerical. By the option `-Z' you can specify which fields have to be unconditionally blurred, i.e. independently of their type, numerical or not. Then `-Z 2:3-4' activates the blurring of the 3th and 4th field of each line of the second file. Going back to the comparison of the files `list1' and `list2', the option `-z 2-' of the command `numdiff -z 2- -V list1 list2' makes the filter transform the (memory copies of the) two files as 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19 * 20 * 21 * 22 * 23 * 24 * and 12 * 15 * 18 * 21 * respectively. Here * denotes the special symbol used by the filter in the blurring procedure, even if this symbol is not actually a bullet. Since in this example space, tab and newline are used as field delimiters, the byte by byte comparison between the transformed files produces the same result as the command `sdiff -W' does when called on them: 12 * 12 * 13 * < 14 * < 15 * 15 * 16 * < 17 * < 18 * 18 * 19 * < 20 * < 21 * 21 * 22 * < 23 * < 24 * < If you put the blurred fields back you obtain exactly the output of `numdiff -f -z 2- list1 list2': 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 < 14 3.74165738677394138558 < 15 3.87298334620741688518 15 3.87298387096774193548 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 18 4.24264705882352941176 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 21 4.58260869565217391304 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" Since the second field is a numerical value in all the lines of `list1' and `list2', to use the option `-Z' instead of `-z' makes no difference in this case. The output of `numdiff -f -Z 2- list1 list2' is just the same as for `numdiff -f -z 2- list1 list2'. After this explanation you can also understand why `numdiff -f -z @ list1 list2' gives a wrong result. Since also the first field is always given by a numerical value, the option `-z @' makes the filter transform the two given files as * * * * * * * * * * * * * * * * * * * * * * * * * * and * * * * * * * * respectively, so that it is not anymore possible to match the lines in a reasonable way. Let us see now a typical situation where it is better to use `-Z' in place of `-z'. If the file `Table1' contains -6 2.449490 -5 2.236068 -4 2.000000 -3 1.732051 -2 1.414214 -1 1.000000 0 0 - - - - - - - - - 1 1.000000 2 1.414214 3 1.732051 4 2.000000 - - - - - - - - - 5 2.236068 6 2.449490 7 2.645751 - - - - - - - - - 8 2.828427 9 3.000000 10 3.162278 11 3.316625 12 3.464102 - - - - - - - - - - - - - - - - - - 13 3.605551 14 3.741657 and `Table2' contains -6 Not_defined -4 Not_defined -2 Not_defined 0 0.000000 2 1.414216 4 2.000000 6 2.449494 8 2.828469 10 3.162278 12 3.464102 14 3.741658 ********************END then the output of `numdiff -z 1:2 -Z 2:2 -f Table1 Table2' is -6 2.449490 -6 Not_defined -5 2.236068 < -4 2.000000 -4 Not_defined -3 1.732051 < -2 1.414214 -2 Not_defined -1 1.000000 < 0 0 0 0.000000 - - - - - - - - - < 1 1.000000 < 2 1.414214 2 1.414216 3 1.732051 < 4 2.000000 4 2.000000 - - - - - - - - - < 5 2.236068 < 6 2.449490 6 2.449494 7 2.645751 < - - - - - - - - - < 8 2.828427 8 2.828469 9 3.000000 < 10 3.162278 10 3.162278 11 3.316625 < 12 3.464102 12 3.464102 - - - - - - - - - < - - - - - - - - - < 13 3.605551 < 14 3.741657 14 3.741658 > ********************END +++ File "Table1" differs from file "Table2" which is exactly what is expected. On the other hand the command `numdiff -z 2 -f Table1 Table2' displays -6 2.449490 | -6 Not_defined -5 2.236068 | -4 Not_defined -4 2.000000 | -2 Not_defined -3 1.732051 < -2 1.414214 < -1 1.000000 < 0 0 0 0.000000 - - - - - - - - - < 1 1.000000 < 2 1.414214 2 1.414216 3 1.732051 < 4 2.000000 4 2.000000 - - - - - - - - - < 5 2.236068 < 6 2.449490 6 2.449494 7 2.645751 < - - - - - - - - - < 8 2.828427 8 2.828469 9 3.000000 < 10 3.162278 10 3.162278 11 3.316625 < 12 3.464102 12 3.464102 - - - - - - - - - < - - - - - - - - - < 13 3.605551 < 14 3.741657 14 3.741658 > ********************END +++ File "Table1" differs from file "Table2" which is partially wrong. Notice that in `Table1' you find (truncated to the sixth decimal digit) the square roots of the absolute values of the integer numbers between -6 and 20, plus some randomly added lines. The file `Table2' contains some approximations (obtained by Newton's method) for the square roots of the even numbers between -6 and 20. Since the (real) square root is not defined for negative numbers, the values corresponding to -6, -4 and -2 are replaced by Not_defined. Since Not_defined is not a numeric value, during the execution of the last command the filter transforms `Table1' in this way -6 * -5 * -4 * -3 * -2 * -1 * 0 * - - - - - - - - - 1 * 2 * 3 * 4 * - - - - - - - - - 5 * 6 * 7 * - - - - - - - - - 8 * 9 * 10 * 11 * 12 * - - - - - - - - - - - - - - - - - - 13 * 14 * and `Table2' in this other way -6 Not_defined -4 Not_defined -2 Not_defined 0 * 2 * 4 * 6 * 8 * 10 * 12 * 14 * ********************END Unfortunately the first three lines are enough to confuse the synchronization procedure, which is based on a byte by byte comparison with exclusion of the field delimiters, as we explained before. You can check that this is definitely the case by looking at the output of the command `sdiff -W' on the transformed files, which is -6 * | -6 Not_defined -5 * | -4 Not_defined -4 * | -2 Not_defined -3 * < -2 * < -1 * < 0 * 0 * - - - - - - - - - < 1 * < 2 * 2 * 3 * < 4 * 4 * - - - - - - - - - < 5 * < 6 * 6 * 7 * < - - - - - - - - - < 8 * 8 * 9 * < 10 * 10 * 11 * < 12 * 12 * - - - - - - - - - < - - - - - - - - - < 13 * < 14 * 14 * > ********************END If we give the command `numdiff -z 1:2 -Z 2:2 -f Table1 Table2' instead of `numdiff -z 2 -f Table1 Table2', the second field of the lines of `Table2' is always blurred. The filter transforms then `Table2' into -6 * -4 * -2 * 0 * 2 * 4 * 6 * 8 * 10 * 12 * 14 * ********************END and re-synchronizes the files `Table1' and `Table2' in the right way. Using the unconditional blurring is suggested in all cases when a certain field, which you want to include in the comparison (use `-X' to completely neglect one or more fields), is of numeric type in almost all lines of (one of) the given files. This can be the case e.g. when in some lines the content of the field is given by a special numeric value, like Infinity, Inf, +Inf or -Inf, or by NaN, abbreviation for Not a Number. Concerning the numerical fields which are not blurred, one has to remark, that the filter is not confused by differences in the numeric format. Before the byte by byte comparison, numeric values are converted indeed to a standard format. To offer an example of this, let us suppose that `short1' contains a list of numbers with their logarithms 0.001 -3 0.01 -2 0.1 -1 1 0 1000 3 1000000 6 1000000000 9 and `short2' the same list of numbers and logarithms, but with differences in the numeric format: ****************** 0.0010000 -3 .0100 -2 0000.10 -1 1. 0 1,000.000 3 1,000,000. 6 1,000,000,000 9 Then `numdiff -f -z 2- short1 short2' displays > ****************** 0.001 -3 0.0010000 -3 0.01 -2 .0100 -2 0.1 -1 0000.10 -1 1 0 1. 0 1000 3 1,000.000 3 1000000 6 1,000,000. 6 1000000000 9 1,000,000,000 9 +++ File "short1" differs from file "short2" showing that the filter has matched the lines in the right way. The filter can even handle the case when the same numerical value is written in decimal notation in one file and in scientific notation in the other one. If the files `decimal' and `scientific' contain .001 -3 .01 -2 .1 -1 * * * * * * * * * 1 0 1000 3 1000000 6 1000000000 9 and ***************** 1.0e-3 -3 1.0e-2 -2 1.0e-1 -1 1.0e0 0 1.0e3 3 1.0e6 6 1.0e9 9 ***************** respectively, then `numdiff -f -z 2- decimal scientific' shows > ***************** .001 -3 1.0e-3 -3 .01 -2 1.0e-2 -2 .1 -1 1.0e-1 -1 * * * * * * * * * < 1 0 1.0e0 0 1000 3 1.0e3 3 1000000 6 1.0e6 6 1000000000 9 1.0e9 9 > ***************** +++ File "decimal" differs from file "scientific" proving that the filter does not get confused. No problems come out also in the case when for a same (not blurred) field the scientific notation is used in both files. If the files `sc1' and `sc2' contain 1.E-3 -3 1.00E-2 -2 1.0E-1 -1 1.0000E0 0 001.0E3 3 +01.000E6 6 1.0E+09 9 1.0E+10 10 * * * * * * * * * * and ***************** 1.0e-003 -3 1.0e-2 -2 1.0e-1 -1 1.0e0 0 +1.0e3 3 1.0e+6 6 1.0e9 9 respectively, then `numdiff -f -z 2- sc1 sc2' correctly displays > ***************** 1.E-3 -3 1.0e-003 -3 1.00E-2 -2 1.0e-2 -2 1.0E-1 -1 1.0e-1 -1 1.0000E0 0 1.0e0 0 001.0E3 3 +1.0e3 3 +01.000E6 6 1.0e+6 6 1.0E+09 9 1.0e9 9 1.0E+10 10 < * * * * * * * * * * < +++ File "sc1" differs from file "sc2" Since for example `9876.54e-3' and `-0.0087E4' are recognized by Numdiff as valid numerical values, it is important that the filter can recognize e.g. that `123.456E+2' and `1.23456E+4' are the same number. The filter is able indeed to handle even an improper use of the scientific notation. We can see this in the case of the files `Scnot1': ------------------------- 1.2E0 * 1 2.45E-1 * 2 -3.678E-2 * 3 and `Scnot2': 12E-1 * 1 245E-3 * 2 -0.003678E+1 * 3 `numdiff -f -z 3- Scnot1 Scnot2' displays the report: ------------------------- < 1.2E0 * 1 12E-1 * 1 2.45E-1 * 2 245E-3 * 2 -3.678E-2 * 3 -0.003678E+1 * 3 +++ File "Scnot1" differs from file "Scnot2" which is exactly what you would expect in such a case. Also pretty hard cases do not confuse the filter. Let `Scnot1' be given by 1.2000e0 * 1 02.4500e-1 * 2 -003.678E-2 * 3 and let `Scnot2' be the same file as before. The command `numdiff -f -z 3- Scnot1 Scnot2' gives again the expected output: 1.2000e0 * 1 12E-1 * 1 02.4500e-1 * 2 245E-3 * 2 -003.678E-2 * 3 -0.003678E+1 * 3 +++ Files "Scnot1" and "Scnot2" have the same structure Till now we have always used the option `-f' with no argument. However `-f' accepts an optional argument, which can be used to control how `-f' displays its output. If you provide an argument, care not to leave any space between the option and the argument. So `-f60' is correct while `-f 60' makes Numdiff terminate after printing an error message. If the argument is a positive number NUM, then the side by side output produced by `-f' will be NUM columns wide. The default value for the width of the output is 130, which can fit onto a traditional printer line, and is the one used when `-f' has no argument or the supplied argument is zero. In other words, `-f' and `-f0' are just easier to remind versions of `-f130'. A negative number as argument for `-f' has the same effect as the positive number with the same absolute value, but in addition it causes the suppression of common lines from the output. For instance the command `numdiff -z 1:2 -Z 2:2 -f-130 Table1 Table2' displays the following text -5 2.236068 < -3 1.732051 < -1 1.000000 < - - - - - - - - - < 1 1.000000 < 3 1.732051 < - - - - - - - - - < 5 2.236068 < 7 2.645751 < - - - - - - - - - < 9 3.000000 < 11 3.316625 < - - - - - - - - - < - - - - - - - - - < 13 3.605551 < > ********************END +++ File "Table1" differs from file "Table2" In conjunction with the option `-f' you can use `-T' to expand tabs to spaces in the output produced by `-f'. This is useful to preserve the alignment of tabs in the input files, if it is thrown off by the presence of the gutter. The options `-H' and `-m' affect the performance of the filter of Numdiff. But performance has more than one dimension and these options improve one aspect of performance at the cost of another, or they improve performance in some cases while hurting it in others. The way that the filter re-synchronizes two files to compare always comes up with a near-minimal set of deletions/insertions of lines. Usually it is good enough for practical purposes. If the filter displays a large set of line deletions/insertions, you might want it to use a modified algorithm that sometimes produces a smaller set of differences. The `-m' option does this; however, it can also cause the filter to run more slowly than usual, so it is not the default behavior. When the files you are comparing are large and have small groups of changes scattered throughout them, you can use the `-H' option to make a different modification to the algorithm that the filter uses. If the input files have a constant small density of changes, where change means deletion/insertion of lines, this option speeds up the comparisons without changing the output or in the worst case with minor modifications. To conclude, Numdiff is not perfect but if you play with its options and with `ndselect' you can do a lot of nice and difficult things, which before just the human eye could do. 9 Warnings ********** * Bug reports have to be sent to the address . Please, put Numdiff in the subject and indicate the version of Numdiff you are using, the version of the operating system you are running and, if you know it, the version of the compiler used to build Numdiff. * Numdiff does not accept numbers in scientific notation whose exponents lie outside the range -1073741824, ..., +1073741824. If such a number is found in any of the files to compare, the execution of the program is stopped immediately after printing a suitable error message on stderr. Under the assumption that the numeric format in use is the default one, with "1.0001e-2147483640" the displayed error messages is numdiff: A number with a too small exponent has been found, namely "1.0001e-2147483640". Exponents smaller than -1073741824 are not accepted, the execution of the program ends now * If Numdiff has been built with its own internal support for multiple precision arithmetic instead of being linked against the GNU MP Library, then performance degradation and memory exhaustion can already make impossible to handle exponents of magnitude 10^6 = 1000000. This is what I obtained on my laptop, equipped with a dual core processor @1.50 GHz and with 1GB of RAM, when I tried to compare the numbers 1.101e1000000000 and 1.0e1000000000: numdiff: Insufficient memory for new allocation, the execution of the program ends now In addition, you can overload the processor with numbers whose exponents lie outside the range -1000000, ..., 1000000. But at least on my machine, everything works fine and quick enough as long as exponent and size of the mantissa of the numbers are in the range -1000, ..., 1000. Be careful and remember that Numdiff is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Consider also that, if you have numerical data with exponents outside the range -300, ..., 300, probably there is something wrong with your data: either you are using the wrong scale, or you should replace very small numbers, like 1e-100, by zero, or it is quite likely that the machine/program/algorithm which produced these data is not working right :D * If Numdiff has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user. * After reading a numerical field, Numdiff truncates its value if this number has too much digits with respect to the current precision. To be precise, denoted by P the current value of the precision, the following rules apply. If `numdiff' has been built with its own internal support for multiple precision arithmetic, then * if the number is written in ordinary decimal notation, `numdiff' will consider, in addition to all digits of the integer part, only the first P digits of the fractional part; * if the value is written in scientific notation, then `numdiff' will only consider the first P digits of the fractional part of the mantissa. If `numdiff' uses the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first P digits of the fractional part of the mantissa are considered. By current value of the precision I mean the integer value specified by the option `-#', or the default one (35) when this option is not in use. * You can find out whether your local version of `numdiff' is relying on GNU MP or not by executing the command `numdiff -v'. If `numdiff' uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information: The software has been linked against the GNU Multiple Precision Arithmetic Library, version number 4.2.4. If `numdiff' does not rely on GNU MP, then the displayed message will be (up to translation into your mother language) The software has been built with its own internal support for multiple precision arithmetic. * Numdiff manages perfectly only text files with an 8-bit encoding (ASCII and ISO 8859-* text files). The use of Numdiff with UTF-8 text files suffers from some restrictions (numbers and field delimiters must consist of ASCII characters, i.e. characters with the most significant bit equal to 0). * If you are not including the so called white-space characters (usually ` ', `\t', `\f', `\v' and `\r') in the set of field delimiters, then a real and an imaginary number which are separated just by white-spaces can be coupled together and considered as a whole complex number. For example, if you are using only *colon* (`:') and *newline* as field delimiters and Numdiff finds a line like that ::::3.0-5.6e-356i::::-12.9 +4.34i::::-12.9 4.34i::::New York:::: then it will consider this line as formed by four fields, the first two are numerical and given by the complex numbers 3.0-5.6e-356i and -12.9+4.34i, the last two ones are the strings New York and -12.9 4.34i. I still do not know if I will modify this in the next version of Numdiff, so that the program recognizes only 3.0-5.6e-356i as numerical field and treats -12.9 +4.34i as non-numerical because of the presence of spaces in the middle. -12.9 4.34i is already considered as non-numerical due to the absence of a leading sign in the imaginary value. * We have seen that one of the two files passed to `numdiff' can be -, which refers to stdin (standard input). In this way one of the two files to compare can be the output produced by another command, like in `cat file2 | numdiff -a 1.0e-3 file1 -'. However, if you trigger the filter through the options `-z' or/and `-Z', Numdiff can not work with the standard input unless you use also the option `-f'. So the command `cat file2 | numdiff -a 1.0e-3 -z @ file1 -' displays only the error message numdiff: -: Illegal seek (or maybe the translation of this message in the language you are using on your computer) but `cat file2 | numdiff -a 1.0e-3 -z @ -f file1 -' works as expected. * This manual describes the version 5.x of Numdiff. Versions 4.0.0 and 3.x used even a different format for the output. Appendix A GNU Free Documentation License ***************************************** Version 1.3, 3 November 2008 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. `http://fsf.org/' Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The "publisher" means any person or entity that distributes copies of the Document to the public. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements." 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See `http://www.gnu.org/copyleft/'. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. "Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents ==================================================== To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. Index ***** Acknowledgments: See 2. (line 59) Build: See 4. (line 801) Caveats: See 9. (line 2686) Command line options for ndselect: See 7. (line 1900) Command line options for numdiff: See 5. (line 904) Compile: See 4. (line 801) Copying Conditions: See 1. (line 43) Diagnostics (ndselect): See 7. (line 1900) Diagnostics (numdiff): See 5. (line 904) FDL: See Appendix A. (line 2817) Filter: See 8. (line 1960) Format of the reports: See 3.1. (line 588) GNU FDL: See Appendix A. (line 2817) GNU Free Documentation License: See Appendix A. (line 2817) GNU General Public License: See 1. (line 43) GPL: See 1. (line 43) How to use numdiff: See 3. (line 75) Install: See 4. (line 801) Invoking ndselect: See 7. (line 1900) Invoking numdiff: See 5. (line 904) License: See 1. (line 43) ndselect (introduction to its use): See 6. (line 1816) Notes: See 9. (line 2686) Options, command line (ndselect): See 7. (line 1900) Options, command line (numdiff): See 5. (line 904) Output format (numdiff): See 3.1. (line 588) Overview: See 3. (line 75) Predefined settings of numdiff: See 5. (line 904) Purposes: See 3. (line 75) Synopsis (ndselect): See 7. (line 1900) Synopsis (numdiff): See 5. (line 904) Thanks: See 2. (line 59) Tools: See 6. (line 1816) Usage of numdiff: See 3. (line 75) Warnings: See 9. (line 2686) cmtk-3.0.0/Utilities/numdiff-5.2.1/docs/numdiff.info0000644000177700000170000044142211666247630021032 0ustar torstenmanThis is ./docs/numdiff.info, produced by makeinfo version 4.13 from ./docs/numdiff.txi. INFO-DIR-SECTION Text creation and manipulation START-INFO-DIR-ENTRY * Numdiff: (numdiff). Comparing files containing numeric fields (and not only) END-INFO-DIR-ENTRY _"...und der eignen Kraft vertrauend steigt ein frei Geschlecht empor!"_ This manual describes how to install and use Numdiff, a program which compares putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being "Numdiff User Manual, version 5.2", and with no Back-Cover Texts. A copy of the license is included in *note GNU Free Documentation License::.  File: numdiff.info, Node: Top, Next: Copying, Prev: (dir), Up: (dir) Numdiff User Manual ******************* _"...und der eignen Kraft vertrauend steigt ein frei Geschlecht empor!"_ This manual describes how to install and use Numdiff, a program which compares putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being "Numdiff User Manual, version 5.2", and with no Back-Cover Texts. A copy of the license is included in *note GNU Free Documentation License::. * Menu: * Copying:: Numdiff Copying Conditions (GPL) * Acknowledgments:: Acknowledgments * Overview:: Introduction to numdiff * Installing:: How to install numdiff * Invoking numdiff:: How to use numdiff * ndselect:: (numdiff) ndselect. Selecting lines * Invoking ndselect:: How to use ndselect * Filtering:: How to use the filter of numdiff * Warnings:: Various recommendations * GNU Free Documentation License:: The license covering this document * Index:: Complete index  File: numdiff.info, Node: Copying, Next: Acknowledgments, Prev: Top, Up: Top 1 Copying ********* Numdiff (also written numdiff) is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Numdiff 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 General Public License along with this program. If not, see `http://www.gnu.org/licenses/'.  File: numdiff.info, Node: Acknowledgments, Next: Overview, Prev: Copying, Up: Top 2 Acknowledgments ***************** I want to thank Mr. Norman Clerman for several suggestions he gave me to improve the readability and the effectiveness of the output produced by Numdiff. He also pointed out the need to implement a filter to resynchronize the lines between two files in case of addition or deletion of one or more lines. I have to give him credit for the urge to prepare the versions 4.x and 5.x of Numdiff. Moreover, I want to thank my friends Mariapia Palombaro, since she removed some errors while reviewing the first version of this document, and Paolo Caramanica, who suggested me to add more information to the output of the option `-S'.  File: numdiff.info, Node: Overview, Next: Installing, Prev: Acknowledgments, Up: Top 3 Overview ********** Computer users often find occasion to ask how two files differ. Perhaps one file is a newer version of the other file. Or maybe the two files started out as identical copies but were changed by different people. There are several ways to think about the differences between two files. One way to think of the differences is as a series of lines that were deleted from, inserted in, or changed in one file to produce the other file. The well-known `diff' program compares two files line by line, finds groups of lines that differ, and reports each group of differing lines. Without particular options, the `diff' program considers any change in the amount or in the type of the characters as a relevant difference. However, trough some command line options it also provides ways to suppress certain kinds of differences that are not important to the user. For instance, `diff' provides ways to ignore differences in the amount of white space between words or lines, or differences in alphabetic case. Another way to think of the differences is as a series of words that were deleted from, inserted in, or changed in one file to produce the other file. Here "word" refers to a sequence of non white-space characters delimited by a couple of white-spaces, one before and the other one after the word. The less known `wdiff' program by Franc,ois Pinard compares words in two files and reports the differences. At last, one can think of the differences between two files as a sequence of pairs of bytes that can be either identical or different. The `cmp' program reports the differences between two files byte by byte, instead of line by line or word by word. As a result, it is often more useful than `diff' or `wdiff' for comparing binary files. However, none of these approaches turns out to be good when you want to compare a couple of text files composed partially or entirely by numerical fields. Indeed, when you compare a couple of such files, what you want to obtain usually is a list of the numerical fields in the second file which *numerically* differ from the corresponding fields in the first file. But, as you probably knows, a same number can be written using different notations and programs like `diff' or `wdiff' can not recognize whether a difference between two numeric fields is only due to the notation or is actually a difference of numerical values. For instance, 11.23 and 11.2300000 are the same number but represented in different ways. While, if you are interested in the numerical values, it is obvious that the difference in the representation is not meaningful and then it should be ignored, however `diff' and `wdiff' consider the previous one as a relevant difference and there is no way for you to tell these programs to ignore it ! Another example of this type is given by 98765.4321 and 9.87654321E04 where the difference is only due to the use of the scientific notation in place of the ordinary decimal notation. Moreover, depending on your country you could stick to different conventions in writing numbers. For instance, the amount "three hundred millions and fifty-two thousands of dollars and forty-six cents" is usually written by an Italian accountant as 300.052.000,46$ while an American accountant would write 300,052,000.46$. Of course, 300.052.000,46$ and 300,052,000.46$ represent the same amount of money but `diff' and `wdiff' would report a difference, which probably is not what you want in a similar case. At last, sometimes you could want to ignore even differences in numerical values as long as they do not overcome a certain threshold. In other words, you could desire to suppress all "small" numerical differences too. For instance, it could happen that you want to ignore all numerical differences whose absolute value is not greater than 0.0001. If this is the case, then the numerical fields 33 and 33.00009 must be considered equal, while 33 and 33.00011 must be reported as different. However, `diff' and `wdiff' can not be used to ignore "small" numerical differences, since they do not even know what a numerical difference is. What I have been saying till now explains why I decided to implement a new program with the capability to "appropriately" compare files containing numerical fields. In writing this program I was inspired by `ndiff', a GPL'ed software by Nelson H. Baabe of the Salt Lake City University. The author of `ndiff' had the same good reasons as me to write `ndiff'. `ndiff' is actually a good tool and I used it for a while. But I did not completely like the way it works and so `numdiff' was born. Although `ndiff' inspired `numdiff', they are completely different from the viewpoint of the source code: `numdiff' has been entirely written from scratch with the addition of code coming from GNU bc, GNU diff and GNUlib. In addition, the last versions of Numdiff offer much more features than `ndiff' does. `numdiff' can be used to compare putatively similar files line by line and field by field, ignoring small numeric differences or/and different numeric formats. `numdiff' takes two mandatory arguments, the paths of the two files to compare, and, after splitting them into lines and the lines into fields according to a given list of field delimiters, it compares every field of every line of the first file with the corresponding field of the second file. What _corresponding_ here exactly means depends on the options passed to the program on the command line. With no options, corresponding means the field of the second file at the same position, where position refers both to the line number and to the location within the line. If the compared fields are both legal numerical values, then `numdiff' performs a numerical comparison between them, else it performs a literal comparison, i.e. the usual byte by byte comparison. In case of literal comparison, two fields are regarded as equal if they are formed by the same sequence of characters. In case of numerical comparison and without specific command line options, two fields are regarded as equal if their numerical difference is zero. Be careful ! If you do not explicitly specify a list of field delimiters by the option `-s', then `numdiff' takes as field delimiters the characters newline (`\n', ASCII code 0x0A), horizontal tabulation (`\t', ASCII code 0x09), and blank (` ', ASCII code 0x20). For instance, if the file `list1' contains the data accident 123 23Joshua 34.55 +3+4i water dog -3455.321 cat 2.345678e-9 .0005-6.23e2i and file `list2' contains the data Accident 123 23456 34.5500 +3.0001+4i dog -3455.320098 Cat +2.345678e-9 -6.23e2i $$$ A new line then the output of the command `numdiff list1 list2' will be: ---------------- ##1 #:1 <== accident ##1 #:1 ==> Accident @ @@ ##1 #:3 <== 23Joshua ##1 #:3 ==> 23456 @ @@ ##1 #:5 <== +3+4i ##1 #:5 ==> +3.0001+4i @ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5 ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! ---------------- ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 ##2 #:3 <== cat ##2 #:3 ==> Cat @ @@ ##2 #:5 <== .0005-6.23e2i ##2 #:5 ==> -6.23e2i @ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7 ##2 <== ##2 #>6 ==> $$$ @ Line 2 in file "list1" is shorter than expected! ---------------- ##3 <== ##3 #>1 ==> A new line @ Line 3 in file "list1" is shorter than expected! ---------------- <== ##4 ==> +++ File "list1" differs from file "list2" At the same time `numdiff' will print the following error message on stderr: *** End of file "list1" reached Likely the files "list1" and "list2" do not have the same number of lines ! It is worth remarking that `numdiff' can recognize complex numbers, provided that they are written in the form a+bi or a-bi with no extra characters between the values a, b and the sign + or - (the symbol i used to represent the imaginary unit can be actually changed by a suitable command line option, *note Invoking numdiff::). If you do not know what complex numbers are, do not worry! In this case probably you will never manage files containing complex numbers and so you can happily continue to ignore them. :) Let us consider now an example which shows how Numdiff can resynchronize the lines between two files in case of addition or deletion of one or more lines. The versions of Numdiff prior to 5 did not work well if one of the two files to compare contains in the middle some lines more or less than the other one. For instance, if you have one file that is 1000 lines long that you are comparing to a second file 1001 lines long, and except for that one extra line, located, let us say, at line 500, the files are identical, then `numdiff' version 4.x does *not* show only the one line difference: once the files are out of synchronization `numdiff' 4.x reports every line as different. Since version 5 it is possible in such cases to activate a filter which handles additions and deletions of lines. There are several options ruling how the filter actually works and I will give later a detailed explanation on how to use them to obtain each time the wished result. The simplest way to activate the filter consists in using the option `-z @'. If `bill1' and `bill2' are given by Month Expenses ------------------------- Jan09 $ 233.56 Feb09 $ 850.77 Mar09 $ 12.55 Apr09 $ 524.00 May09 $ 78.25 Jun09 $ 230.00 Jul09 $ 443.10 Aug09 $ 67.65 Sep09 $ 10.00 Oct09 $ 201.45 Nov09 $ 110.00 Dec09 $ 200.27 ------------------------- Total $ 2961.60 and Month Expenses Jan09 $ 234.00 Mar09 $ 13.00 May09 $ 78.25 Jul09 $ 443.10 Sep09 $ 10.00 Nov09 $ 110.00 Jan10 $ 200.00 ------------------------- Total $ 1088.35 respectively, then the differences between the two files are: * the insertion of the separator ------------------------- in `bill1' before the list of the months, * the deletion in `bill2' of the lines related to the expenses for the months February, April, June, August, October, December, * small changes in `bill2' to the expenses of the months January (2009) and March, * the presence in `bill2' of an entry for January 2010 just before the separator -------------------------, * the addition of an empty line to `bill2' after the separator -------------------------, * and the different values for the total sum of the expenses. The output of the command `numdiff -z @ -V bill1 bill2' (I have added here the option `-V' to let Numdiff show which couples of lines it is comparing each time) is exactly then what you expect: ---------------- ##2 <== ------------------------- ==> ---------------- ##3 <== Jan09 $ 233.56 ##2 ==> Jan09 $ 234.00 ##3 #:3 <== 233.56 ##2 #:3 ==> 234.00 @ Absolute error = 4.4000000000e-1, Relative error = 1.8838842268e-3 ---------------- ##4 <== Feb09 $ 850.77 ==> ---------------- ##5 <== Mar09 $ 12.55 ##3 ==> Mar09 $ 13.00 ##5 #:3 <== 12.55 ##3 #:3 ==> 13.00 @ Absolute error = 4.5000000000e-1, Relative error = 3.5856573705e-2 ---------------- ##6 <== Apr09 $ 524.00 ==> ---------------- ##8 <== Jun09 $ 230.00 ==> ---------------- ##10 <== Aug09 $ 67.65 ==> ---------------- ##12 <== Oct09 $ 201.45 ==> ---------------- ##14 <== Dec09 $ 200.27 ##8 ==> Jan10 $ 200.00 ##14 #:1 <== Dec09 ##8 #:1 ==> Jan10 @ @@ ##14 #:3 <== 200.27 ##8 #:3 ==> 200.00 @ Absolute error = 2.7000000000e-1, Relative error = 1.3500000000e-3 ---------------- <== ##10 ==> ---------------- ##16 <== Total $ 2961.60 ##11 ==> Total $ 1088.35 ##16 #:3 <== 2961.60 ##11 #:3 ==> 1088.35 @ Absolute error = 1.8732500000e+3, Relative error = 1.7211834428e+0 +++ File "bill1" differs from file "bill2" Numdiff has reported correctly the following differences: * the second line of file `bill1', i.e. the one containing the separator, has no correspondance, or, if you prefer, has been deleted from file `bill2'. * The lines related to the months January 2009 and March have been slightly modified in `bill2', namely the values of the expenses are slightly different. Notice that the line with the expenses for January 2009 is the third one in file `bill1' and the second one in file `bill2'. This information is printed by Numdiff in the form ##3 <== Jan09 $ 233.56 ##2 ==> Jan09 $ 234.00 Analogously ##5 <== Mar09 $ 12.55 ##3 ==> Mar09 $ 13.00 says that the line for March is the fifth one in `bill1' and the third one in `bill2'. * The line related to the total amount of the expenses appears also differently in the two files, since the amount of the expenses is different. Notice that this line is the 16th one in file `bill1' and the 11th one in file `bill2'. * The lines related to the months February, April, June, August and October, i.e. the lines no. 4, 6, 8, 10 and 12 of `bill1', are not present in `bill2'. * The line of `bill1' with the expenses for December 2009 is replaced in `bill2' by the line containing the value of the expenses for January 2010. * The tenth line of `bill2', i.e. the empty line after the separator, is not present in `bill1'. With respect to `bill1' this line represents then an addition. However, if you compare `bill1' and `bill2' without using the option `-z @', the result is completely misleading. This is the output of `numdiff -V bill1 bill2': ---------------- ##2 <== ------------------------- ##2 ==> Jan09 $ 234.00 ##2 #:1 <== ------------------------- ##2 #:1 ==> Jan09 @ @@ ##2 <== ##2 #>2 ==> $ 234.00 @ Line 2 in file "bill1" is shorter than expected! ---------------- ##3 <== Jan09 $ 233.56 ##3 ==> Mar09 $ 13.00 ##3 #:1 <== Jan09 ##3 #:1 ==> Mar09 @ @@ ##3 #:3 <== 233.56 ##3 #:3 ==> 13.00 @ Absolute error = 2.2056000000e+2, Relative error = 1.6966153846e+1 ---------------- ##4 <== Feb09 $ 850.77 ##4 ==> May09 $ 78.25 ##4 #:1 <== Feb09 ##4 #:1 ==> May09 @ @@ ##4 #:3 <== 850.77 ##4 #:3 ==> 78.25 @ Absolute error = 7.7252000000e+2, Relative error = 9.8724600639e+0 ---------------- ##5 <== Mar09 $ 12.55 ##5 ==> Jul09 $ 443.10 ##5 #:1 <== Mar09 ##5 #:1 ==> Jul09 @ @@ ##5 #:3 <== 12.55 ##5 #:3 ==> 443.10 @ Absolute error = 4.3055000000e+2, Relative error = 3.4306772908e+1 ---------------- ##6 <== Apr09 $ 524.00 ##6 ==> Sep09 $ 10.00 ##6 #:1 <== Apr09 ##6 #:1 ==> Sep09 @ @@ ##6 #:3 <== 524.00 ##6 #:3 ==> 10.00 @ Absolute error = 5.1400000000e+2, Relative error = 5.1400000000e+1 ---------------- ##7 <== May09 $ 78.25 ##7 ==> Nov09 $ 110.00 ##7 #:1 <== May09 ##7 #:1 ==> Nov09 @ @@ ##7 #:3 <== 78.25 ##7 #:3 ==> 110.00 @ Absolute error = 3.1750000000e+1, Relative error = 4.0575079872e-1 ---------------- ##8 <== Jun09 $ 230.00 ##8 ==> Jan10 $ 200.00 ##8 #:1 <== Jun09 ##8 #:1 ==> Jan10 @ @@ ##8 #:3 <== 230.00 ##8 #:3 ==> 200.00 @ Absolute error = 3.0000000000e+1, Relative error = 1.5000000000e-1 ---------------- ##9 <== Jul09 $ 443.10 ##9 ==> ------------------------- ##9 #:1 <== Jul09 ##9 #:1 ==> ------------------------- @ @@ ##9 #>2 <== $ 443.10 ##9 ==> @ Line 9 in file "bill2" is shorter than expected! ---------------- ##10 <== Aug09 $ 67.65 ##10 ==> ##10 #>1 <== Aug09 $ 67.65 ##10 ==> @ Line 10 in file "bill2" is shorter than expected! ---------------- ##11 <== Sep09 $ 10.00 ##11 ==> Total $ 1088.35 ##11 #:1 <== Sep09 ##11 #:1 ==> Total @ @@ ##11 #:3 <== 10.00 ##11 #:3 ==> 1088.35 @ Absolute error = 1.0783500000e+3, Relative error = 1.0783500000e+2 ---------------- ##12 <== Oct09 $ 201.45 ==> *** End of file "bill2" reached Likely the files "bill1" and "bill2" do not have the same number of lines ! +++ File "bill1" differs from file "bill2" Numdiff compares now the first, second, third line of `bill1' with the first, second, third line of `bill2' and so on. But this is not probably what you want in such a case: what is reasonable here is to compare entries related to the same month and not lines having the same location (i.e. line number). Numdiff offers also an option to run just the filter and see how it resynchronizes the two given files without doing any comparison between corresponding lines. The output of `numdiff -z @ -f bill1 bill2' is Month Expenses Month Expenses ------------------------- < Jan09 $ 233.56 Jan09 $ 234.00 Feb09 $ 850.77 < Mar09 $ 12.55 Mar09 $ 13.00 Apr09 $ 524.00 < May09 $ 78.25 May09 $ 78.25 Jun09 $ 230.00 < Jul09 $ 443.10 Jul09 $ 443.10 Aug09 $ 67.65 < Sep09 $ 10.00 Sep09 $ 10.00 Oct09 $ 201.45 < Nov09 $ 110.00 Nov09 $ 110.00 Dec09 $ 200.27 | Jan10 $ 200.00 ------------------------- ------------------------- > Total $ 2961.60 Total $ 1088.35 +++ File "bill1" differs from file "bill2" and shows that the filter is doing its job in the right way, associating the lines according to the month and not to the line number. Running just the filter is extremely useful in all situations when you are not sure if the filter is working as you wish. You have indeed to instruct the filter in the right way to let it work correctly, and this requires the use of different options depending on the structure of the files to compare. Since to guess the right options can be sometime tricky, running just the filter and see the result is the best way to be certain that you are setting up everything correctly. Later, *note Filtering::, I will explain in detail * what the filter does behind the scenes to understand if and how it has to resynchronize the files to compare, * and how the related options affect the action of the filter. By the way, it is even possible to use `-f' without any other additional option for the filter, like in `numdiff -f bill1 bill2', but the result is more or less the same you would obtain by performing a byte by byte comparison with removal of the field delimiters. The option `-f' can be followed by an argument in the form of an integer number whose meaning will be explained later, *note Use of the option -f::. Even if the output of `numdiff' is self-explanatory, in the next section I will explain in details all you have to know about it. * Menu: * Output format:: How numdiff prints its reports on stdout  File: numdiff.info, Node: Output format, Up: Overview 3.1 Output format ================= Let us go back to our first example. If the files `list1' and `list2' contain the data accident 123 23Joshua 34.55 +3+4i water dog -3455.321 cat 2.345678e-9 .0005-6.23e2i and Accident 123 23456 34.5500 +3.0001+4i dog -3455.320098 Cat +2.345678e-9 -6.23e2i $$$ A new line respectively, then the output of the command `numdiff list1 list2' will be: ---------------- ##1 #:1 <== accident ##1 #:1 ==> Accident @ @@ ##1 #:3 <== 23Joshua ##1 #:3 ==> 23456 @ @@ ##1 #:5 <== +3+4i ##1 #:5 ==> +3.0001+4i @ Absolute error = 1.0000000000e-4, Relative error = 2.0000000000e-5 ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! ---------------- ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 ##2 #:3 <== cat ##2 #:3 ==> Cat @ @@ ##2 #:5 <== .0005-6.23e2i ##2 #:5 ==> -6.23e2i @ Absolute error = 5.0000000000e-4, Relative error = 8.0256821830e-7 ##2 <== ##2 #>6 ==> $$$ @ Line 2 in file "list1" is shorter than expected! ---------------- ##3 <== ##3 #>1 ==> A new line @ Line 3 in file "list1" is shorter than expected! ---------------- <== ##4 ==> +++ File "list1" differs from file "list2" `numdiff' prints a report on the standard output for every field of the first file which differs from the corresponding field of the second one. First this report indicates the locations of the fields, namely the numbers of the lines where the fields appear and their positions within the line. The position in the line is "1" for the first field of a line, "2" for the second field, "3" for the third one and so on: fields are numerated starting from the left hand of the line and proceeding towards the right hand. For each report the line number is introduced by the symbol "##", while the field number by "#:". Then `numdiff' shows in what the difference consists. For instance, ##1 #:1 <== accident ##1 #:1 ==> Accident @ @@ means that the first field of the first line is "accident" in the first file, while in the second file it appears as "Accident". This difference could be then canceled by removing "accident" from the first file and inserting "Accident" in place of it. The arrows "<==" and "==>" try to visualize this idea. Analogously, ##2 #:2 <== -3455.321 ##2 #:2 ==> -3455.320098 @ Absolute error = 9.0200000000e-4, Relative error = 2.6104672633e-7 means that the second field of the second line is "-3455.321" in the first file and "-3455.320098" in the second one. Since the contents of the field are numerical in both files, `numdiff' also prints the absolute and relative errors. The absolute error (or absolute difference) is given by the absolute value of the difference between the values appearing in the two files. The relative error (or relative difference) is actually defined in a more complicated way. If _n1_ is the value appearing in the first file and _n2_ is the value in the second file, then the absolute error is given by the formula _A=|n1-n2|_, while the relative error _R_ is given by: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and at least one of them is zero, * _R = A/ min(|n1|, |n2|)_ if _n1_ and _n2_ are both non zero and _n2_ differs from _n1_. _min(|n1|, |n2|)_ denotes the minimum between the absolute value of _n1_ and the absolute value of _n2_. With these definitions of absolute and relative error it turns out that _A(n2, n1) = A(n1, n2)_ and _R(n2, n1) = R(n1, n2)_. In other words, the absolute/relative error does not change if you only change the order of the compared values. Since version 5 it is actually possible to let Numdiff compute the relative error always with respect to the value from the first file or always with respect to the value from the second file, instead of using the preceding formula. This can be done through the option `-r' by writing its argument in a special form, *note Alternative formulas for the computation of the relative difference::. If at least one of the compared fields is not numerical, then the output line reporting absolute and relative errors is replaced by the separator: @ @@ It can happen that a line in one of the two files to compare contains more fields than the corresponding line of the other file. When this is the case, `numdiff' reports this difference by telling that a certain line (identified by its line number) appears to be shorter than expected, just as in ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! or in ##3 <== ##3 #>1 ==> A new line @ Line 3 in file "list1" is shorter than expected! In addition, `numdiff' shows the tail of the longer line, using the notation "#>n" to indicate the number n of the first field of the longer line for which there is no corresponding field in the shorter line. For instance, ##1 #>6 <== water ##1 ==> @ Line 1 in file "list2" is shorter than expected! means that for none of the fields of the first line starting from the sixth one there exists a corresponding field in the second file (`list2'). In this context, the symbol <<*>> (when it appears) is used to denote the End-Of-File, i.e. a line or the tail of a line which is located at the end of the corresponding file and does not have a terminating _newline_ character. It can also happen that one of the two files to compare has less lines than the other one. In this case, if no special option is passed to the program, `numdiff' prints the number of the first line which appears in only one of the two files. Moreover, it prints on the standard error a message telling in which of the two files the end has been prematurely reached: *** End of file "list1" reached Likely the files "list1" and "list2" do not have the same number of lines ! Unless the option `-q' is used (*note Invoking numdiff::), `numdiff' prints on standard output a message reporting the final status of the comparison. This message says either the two files are equal or they are different, just as in the example we are considering: +++ File "list1" differs from file "list2" The output produced just by running the filter is a side by side difference listing of the two compared files, like the one displayed by GNU sdiff. The files are listed in two columns with a gutter between them. The gutter contains one of the following markers: `white space' The corresponding lines are in common. That is, either the lines are identical, or the difference is ignored because of one of the options `-I', `-X', `-z' and `-Z'. `|' The corresponding lines differ, and they are either both complete or both incomplete. `<' `(' The files differ and only the first file contains the line. `>' `)' The files differ and only the second file contains the line. `\' The corresponding lines differ, and only the first line is incomplete. `/' The corresponding lines differ, and only the second line is incomplete. An input line is incomplete if its last character is not a newline. This can happen only if the line is the last one of its file. When an output line of the side by side difference listing represents two differing lines, one might be incomplete while the other is not. In this case the gutter is marked `\' if the line from the first file is incomplete, `/' if the line from the second file is. Side by side format is easy to read, but it has limitations. It generates much wider output than usual, and truncates lines that are too long to fit. Also, it relies on lining up output quite heavily, so its output looks particularly bad if you use varying width fonts, nonstandard tab stops, or nonprinting characters. The option `-f' can take an optional argument, which allows to set the width of the output and eventually to suppress common lines, *note Invoking numdiff:: and *note Use of the option -f::. More generally, the user can always make `numdiff' avoid to print, partially or totally, the messages that it would otherwise send to standard output. This can be achieved by some suitable command line options, *note Invoking numdiff::.  File: numdiff.info, Node: Installing, Next: Invoking numdiff, Prev: Overview, Up: Top 4 Installing ************ To successfully compile, build and install Numdiff some tools are required. The first one is an ANSI C compiler. This compiler should at least accept the option `-o' to write its output to a specified file, the option `-D' for macros predefinition, the option `-l' to search for a specified library, and the options `-I' and `-L' to add a given directory to the search path for include and library files respectively. Numdiff has been successfully compiled and tested on Slackware(R) GNU/Linux 10.2 with the version 3.3.6 of the GNU C Compiler (GCC), on Slackware GNU/Linux 11 with GCC 3.4.6, on Slackware GNU/Linux 12.2 with GCC 4.2.4, on Slackware GNU/Linux 13 with GCC 4.3.3, on Debian(R) GNU/Linux 4.0 with GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21), on SunOS(R) 5.8 with GCC 2.95.3, and on SunOS 5.10 (i386) with the version 5.9 of the Sun C compiler. Moreover, you need a POSIX implementation of the `make' utility (I used both GNU make and smake by Joerg Schilling to compile Numdiff) and a POSIX implementation of the commands `rm' and `find'. At last, you need a proper installation of GNU Texinfo (in order to install the info documentation) and a shell sh-compatible. Configuration, building and installation of Numdiff can be performed through the standard three steps: ./configure make make install If you leave enabled the Natural Language Support and you also want to install the localization files (at the moment only the Italian localization is supplied), then, after `make', you will have to type and run make install-nls By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/info' etc. You can specify an installation prefix other than `/usr/local' using the option `--prefix' in the `configure' step, for instance `--prefix=$HOME': ./configure --prefix=$HOME For better control, you can use the options `--bindir', `--infodir', and so on. Type `./configure --help' to obtain the complete list of all the available options. Anyway, the documentation files, including a full User Manual available in several formats (HTML, PDF and plain ASCII text), will always be put in `DOCDIR/numdiff', where DOCDIR is the path specified by the option `--docdir' or, if this option has not been given to `configure', `PREFIX/local/doc'. Here PREFIX is the installation prefix specified by the option `--prefix' or the default `/usr/local'. Once Numdiff has been installed you can remove all the files previously installed by a simple `make uninstall'. If you have also installed the localization files trough `make install-nls', then, in order to remove also these ones, use `make uninstall-nls' in place of `make uninstall'. Between the options accepted by `configure' there are `--enable-debug', `--enable-optimization', `--enable-nls' and `--enable-gmp'. The option `--enable-debug' turns on debugging when compiling the source code. This is obtained by passing to the compiler the `-g' option, but you can change this default debugging flag (which could not even be recognized by your compiler) by setting the environment variable `DBGFLAGS' before calling `configure'. The option `--enable-optimization' turns on basic optimization when compiling the source code. This is obtained by passing to the compiler the `-O' option, but you can change this default flag (which could not even be recognized by your compiler) by setting the environment variable `OPTFLAGS' before calling `configure'. The option `--enable-nls' turns on Natural Language Support. But you do not need to use it explicitly, since Natural Language Support is enabled by default. However, you can disable it by using `--disable-nls'. Disabling Natural Language Support is suggested whenever you want to install Numdiff on a system where the GNU gettext library is not present. In this case the installation of Numdiff can be accomplished, for instance, through ./configure --disable-nls make make install Since version 5.2.0 Numdiff uses to perform all computations the GNU Multiple Precision Arithmetic Library (also called GNU MP or GMP), if this library is available at build-time. The old internal support for multiple precision arithmetic is a fall-back in case GNU MP is absent. However it is possible to use the internal support for multiple precision arithmetic even when GNU MP is available: it is sufficient to pass the option `--enable-gmp=no' or `--disable-gmp' to the configure script before building the program, like in ./configure --disable-gmp make make install Enabling the old internal support for multiple precision arithmetic is deprecated, *note with GNU MP is better::. The latest version of GNU MP is available at `ftp://ftp.gnu.org/gnu/gmp/'. See the GNU MP web page at `http://gmplib.org/' for up-to-date information on GNU MP.  File: numdiff.info, Node: Invoking numdiff, Next: ndselect, Prev: Installing, Up: Top 5 Invoking numdiff ****************** *SYNOPSIS* numdiff -h|--help|-v|--version or numdiff [-s IFS][-a MAXERR][-r MAXERR][-2][-# PREC][-P][-N][-I] [-d C1C2][-t C1C2][-g N1N2][-p C1C2][-n C1C2][-e C1C2][-i C1C2] [-X 1:INT][-X 2:INT][-E][-D][-b][-V][-q][-S][-z 1:INT][-z 2:INT] [-Z 1:INT][-Z 2:INT][-m][-H][-f[NUM]][-T][-l PATH][-o PATH] FILE1 FILE2 where FILE1 and FILE2 are the names of the two files to compare and INT stays for a positive integer value or for a range of integer values, like 1-, 3-5 or -7. In the first case `numdiff' prints a short help (not so short actually :)) or/and version number, Copyright, License notice, NO-Warranty disclaimer and some information about the way it was built. In the second case `numdiff' compares the files specified by the two (mandatory) arguments which follow the list of the options. The complete path of a file should be given, a directory name is not accepted. Moreover, the two arguments cannot refer to the same file but one of them can be -, which refers to stdin. *OPTIONS* `-s, --separator=IFS' Specify the set of characters to use to split the input lines into fields (The default set of characters is space, tab and newline) `-a, --absolute-tolerance=MAXERR' Specify the maximum absolute difference permitted before that two numeric fields are regarded as different (The default value is zero) `-r, --relative-tolerance=MAXERR' Specify the maximum relative difference permitted before that two numeric fields are regarded as different (The default value is zero) `-2, --strict' Order that two numerical values are regarded as equal only if both absolute and relative difference do not exceed the corresponding tolerance threshold `-#, --digits=PREC' Specify the number of digits in the significands used in multiple precision arithmetic `-P, --positive-differences' Ignore all differences due to numeric fields of the second file that are less than the corresponding numeric fields in the first file `-N, --negative-differences' Ignore all differences due to numeric fields of the second file that are greater than the corresponding numeric fields in the first file `-I, --ignore-case' Ignore changes in case while doing literal comparisons `-d, --decimal-point=C1C2' Specify the characters representing the decimal point in the two files to compare `-t, --thousands-separator=C1C2' Specify the characters representing the thousands separator in the two files to compare `-g, --group-length=N1N2' Specify the number of digits forming each group of thousands in the two files to compare `-p, --plus-prefix=C1C2' Specify the (optional) prefixes for positive values used in the two files to compare `-n, --minus-prefix=C1C2' Specify the prefixes for negative values used in the two files to compare `-e, --exponent-letter=C1C2' Specify the exponent letters used in the two files to compare `-i, --imaginary-unit=C1C2' Specify the characters representing the imaginary unit in the two files to compare `-X, --exclude=1:INT' Select the fields of the first file that have to be ignored `-X, --exclude=2:INT' Select the fields of the second file that have to be ignored `-E, --essential' While printing the differences between the two compared files show only the numerical ones `-D, --dummy' While printing the differences between the two compared files neglect all the numerical ones (dummy mode) `-b, --brief' Suppress all messages concerning the differences discovered in the structures of the two files `-V, --verbose' For every couple of lines which differ in at least one field print an header to show how these lines appear in the two compared files `-q, --quiet, --silent' Suppress all the standard output `-S, --statistics' Add some statistics to the standard output `-z, --blur-if-numerical=1:INT' Select the fields of the first file that have to be blurred during the synchronization procedure only if they turn out to be numeric `-z, --blur-if-numerical=2:INT' Select the fields of the second file that have to be blurred during the synchronization procedure only if they turn out to be numeric `-Z, --blur-unconditionally=1:INT' Select the fields of the first file that have to be unconditionally blurred during the synchronization procedure `-Z, --blur-unconditionally=2:INT' Select the fields of the second file that have to be unconditionally blurred during the synchronization procedure `-m, --minimal' During synchronization try hard to find a smaller set of changes `-H, --speed-large-files' During synchronization assume large files and many scattered small changes `-f, --test-filter[=NUM]' Run only the filter and then show the results of its attempt to synchronize the two files. If NUM is zero or is not specified, output at most 130 columns per line. If NUM is a positive number, output at most NUM columns per line. If NUM is a negative number, do not output common lines and display at most -NUM columns per line. `-T, --expand-tabs' Expand tabs to spaces in output while displaying the results of the synchronization procedure (meaningful only together with option -f) `-l, --warnings-to=PATH' Redirect warning and error messages from stderr to the indicated file `-o, --output=PATH' Redirect output from stdout to the indicated file `-h, --help' Show help message and predefined settings `-v, --version' Show version number, Copyright, Distribution Terms and NO-Warranty *DIAGNOSTICS* The exit status is 1 if the two given files differ, 0 if they are equal, -1 (255) in case of error. *DEFAULT NUMERIC FORMAT (for both files to compare):* Decimal point = `.' Thousands separator = `,' Number of digits in each thousands group = 3 Leading positive sign = `+' Leading negative sign = `-' Prefix for decimal exponent = `e' Symbol used to denote the imaginary unit = `i' *SOME EXPLANATIONS* The options `-D', `-E', `-b' and `-q' are used to hide part of the standard output of the program according to some rule. The option `-D' triggers the "dummy mode". In this mode `numdiff' does not print the numerical differences. A numerical difference occurs whenever the compared fields turn out to be both of numerical type, but the field from the second file has a value which differs from the one of the field from the first file. The "dummy mode" is so called since when it is active, `numdiff' does not perform the job for which I created it. The option `-E' triggers the "essential mode". In this mode `numdiff' only prints the numerical differences between the two files and, if there are some, the differences in the structure. The latter ones occur either when one of the compared files contains a line for which there is no corresponding line in the other file, or when, comparing two lines, it turns out that one of them contains a field for which there exists no corresponding field in the other one. If you are not running any filter or cutting out some fields through the option `-X', then the differences in the structure simply consist either in a different number of lines in the two files, or in a different number of fields on a line. The option `-b' triggers the "brief mode". In this mode `numdiff' does not print the differences in the structure of the two files, see just above for an explanation on what they are. The option `-q' triggers the "quiet mode". When in this mode `numdiff' does not print anything on the standard output. The "quiet mode" is useful if you only want to know whether a couple of files are equal or not. This information can be obtained by looking at the exit status of the program. The option `-V' triggers the "verbose mode". In this mode `numdiff' produces a richer report by printing an header whenever the compared lines differ. The header shows how and where these lines appear in the compared files. For instance, if the files `data1' and `data2' contain the data 12 33 22 44.5 0.008 1.002 221.12 -34.56 water 2101.21 boats and 12 33 22.3 44.5 0.008 1.202 221.12 -34.56 2101.21 boats dogs respectively, then the command `numdiff -V data1 data2' will print the following output: ---------------- ##2 <== 22 44.5 ##2 ==> 22.3 44.5 ##2 #:1 <== 22 ##2 #:1 ==> 22.3 @ Absolute error = 3.0000000000e-1, Relative error = 1.3636363636e-2 ---------------- ##3 <== 0.008 1.002 ##3 ==> 0.008 1.202 ##3 #:2 <== 1.002 ##3 #:2 ==> 1.202 @ Absolute error = 2.0000000000e-1, Relative error = 1.9960079840e-1 ---------------- ##4 <== 221.12 -34.56 water ##4 ==> 221.12 -34.56 ##4 #>3 <== water ##4 ==> @ Line 4 in file "data2" is shorter than expected! ---------------- ##5 <== 2101.21 boats ##5 ==> 2101.21 boats dogs ##5 <== ##5 #>3 ==> dogs @ Line 5 in file "data1" is shorter than expected! +++ File "data1" differs from file "data2" You must care that the options `-b' and `-V' will be overridden if `-q' is also set. The amount of additional information printed by `-V' is trivially influenced by the options which alter the way `numdiff' performs the comparisons between fields (for instance `-a', `-r', `-2', `-N', `-P', `-D', `-E', `-I', `-X'). In the headers printed by `numdiff' when in "verbose mode" can also appear the symbol <<*>>. This symbol, if present, is always located at the end of a line to mean that the line is at the end of the corresponding file and does not have a terminating *newline* character. The option `-S' adds to the standard output of `numdiff' a statistical report with the following information: * the number of numeric comparisons the program has done (this quantity, like the successive ones, is influenced by the options `-P' and `-N') and the number of those comparisons whose outcome is a relevant numerical difference. * the largest absolute error in the set of relevant numerical differences and the corresponding relative error, * the largest relative error in the set of relevant numerical differences together with the corresponding absolute error, * the sum and the arithmetic mean of all absolute errors, * the sum and the arithmetic mean of the relevant absolute errors, * the square root of the sum of the squares of all absolute errors, * the square root of the sum of the squares of the relevant absolute errors, * the quadratic mean of all absolute errors, and * the quadratic mean of the relevant absolute errors. By relevant numerical differences and relevant absolute errors I mean those ones appearing in the output of `numdiff' when the options `-D' and `-q' are not used. The information printed by `-S' is not removed when this option is used together with `-q'. The options `-a', `-r', `-2', `-P' and `-N' affect the way `numdiff' performs the comparisons between numerical values. Without any of these options, `numdiff' considers two numerical fields as equal when their difference is zero. The option `-a' can be used to order that two numerical fields must be considered equal as long as their absolute difference does not exceed a certain threshold, which is specified by the argument that follows the `-a' option. The option `-r' can be used to order that two numerical fields must be considered equal as long as their relative difference does not exceed a certain threshold, which is specified by the argument that follows the `-r' option. The relative difference is normally defined in this way. If _n1_ is a value from the file specified as first on the command line and _n2_ is the corresponding value from the second file, then the absolute difference is given by the formula _A=|n1-n2|_. The relative difference _R_ is given by: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and at least one of them is zero, * _R = A/ min(|n1|, |n2|)_ if _n1_ and _n2_ are both non zero and _n2_ differs from _n1_. _min(|n1|, |n2|)_ denotes the minimum between the absolute value of _n1_ and the absolute value of _n2_. With this definition of relative difference it turns out that _R(n2, n1) = R(n1, n2)_: the relative difference does not change if you only change the ordering of the compared files on the command line. However there are cases when this default definition of relative error makes no sense. This can happen for instance when one of the files is a sample file containing a list of expected data, which could have been computed theoretically or come from experiments in a laboratory. In this case it is more natural to define the relative difference as the ratio between the absolute difference and the absolute value of the number coming from the sample file. If you put the prefix `1:' (or `2:') in front of the argument passed to `-r', then Numdiff always compute the relative difference as the ratio between the absolute difference and the absolute value of the number from the first file (the second file, respectively). More precisely, with the prefix `1:' the relative difference _R_ is computed according to these rules: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and _n1_ is zero, * _R = |n1-n2|/ |n1|_ if _n1_ is not zero and _n2_ differs from _n1_. With the prefix `2:' the rules become: * _R = 0_ if _n1_ and _n2_ are equal, * _Inf_ (infinity) if _n2_ differs from _n1_ and _n2_ is zero, * _R = |n1-n2|/ |n2|_ if _n2_ is not zero and _n2_ differs from _n1_. With the last two sets of rules is not anymore true that _R(n2, n1) = R(n1, n2)_: the relative difference changes, in the general case, together with the ordering of the files on the command line. If there is a prefix, the value after it is in any case interpreted as tolerance threshold for the relative difference, just as in the case when no prefix is given. You can use `-r 1:0' or `-r 2:0' if you just want to change the way the relative differences are computed and leave the tolerance threshold to its default value, i.e. zero. As a simple example, suppose that FILE1 and FILE2 contain 1 9.9 0.5 440 and 1.2 8 0.51 400 respectively. Then `numdiff FILE1 FILE2' displays ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1 +++ File "file1" differs from file "file2" `numdiff -r 1:0 FILE1 FILE2' prints ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 1.9191919192e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 Absolute error = 1.0000000000e-2, Relative error = 2.0000000000e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 Absolute error = 4.0000000000e+1, Relative error = 9.0909090909e-2 +++ File "file1" differs from file "file2" the output of `numdiff -r 2:0 FILE1 FILE2' is ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 1.6666666667e-1 ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 ##1 #:3 <== 0.5 ##1 #:3 ==> 0.51 Absolute error = 1.0000000000e-2, Relative error = 1.9607843137e-2 ##1 #:4 <== 440 ##1 #:4 ==> 400 Absolute error = 4.0000000000e+1, Relative error = 1.0000000000e-1 +++ File "file1" differs from file "file2" `numdiff -r 1:0.195 FILE1 FILE2' displays ---------------- ##1 #:1 <== 1 ##1 #:1 ==> 1.2 Absolute error = 2.0000000000e-1, Relative error = 2.0000000000e-1 +++ File "file1" differs from file "file2" and, finally, `numdiff -r 2:0.195 FILE1 FILE2' displays ---------------- ##1 #:2 <== 9.9 ##1 #:2 ==> 8 Absolute error = 1.9000000000e+0, Relative error = 2.3750000000e-1 +++ File "file1" differs from file "file2" Care not to leave any space between the prefix `1:' or `2:' and the value of the tolerance threshold, Numdiff would consider this as a wrong input. The option `-2' is only meaningful when both `-a' and `-r' are present on the command line. If the user specifies a non-zero tolerance threshold for both absolute and relative error by using both `-a' and `-r', `numdiff' adopts this behavior: it considers equal two numerical fields as long as at least one between absolute and relative error does not exceed the corresponding threshold. With the option `-2' `numdiff' regards two numerical values as equal only if both absolute and relative error do not exceed the threshold of tolerance. For instance, if FILE1 contains the unique line 100 and FILE2 the line 100.00012 then the output of the command `numdiff FILE1 FILE2' will be ---------------- ##1 #:1 <== 100 ==> 100.00012 @ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6 +++ File "FILE1" differs from file "FILE2" The output of the commands `numdiff -a 1.0e-4 FILE1 FILE2' and `numdiff -r 1.0e-6 FILE1 FILE2' will be the same, while `numdiff -a 1.0e-4 -r 1.3e-6 FILE1 FILE2' and `numdiff -a 1.3e-4 -r 1.0e-6 FILE1 FILE2' will print the message +++ Files "FILE1" and "FILE2" are equal since the relative error is 1.2e-6 < 1.3e-6, the absolute error is 1.2e-4 < 1.3e-4, and it is sufficient that one of them does not exceed the tolerance specified on the command line to make `numdiff' consider equal the two compared values. However, the commands `numdiff -a 1.0e-4 -r 1.3e-6 -2 FILE1 FILE2' and `numdiff -a 1.3e-4 -r 1.0e-6 -2 FILE1 FILE2' will print the message ---------------- ##1 #:1 <== 100 ==> 100.00012 @ Absolute error = 1.2000000000e-4, Relative error = 1.2000000000e-6 +++ File "FILE1" differs from file "FILE2" since the option `-2' makes `numdiff' regard two values as equal only if both absolute and relative difference do not exceed the corresponding threshold of tolerance. The option `-P' makes `numdiff' consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is less or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is less or equal than the first one means that both real and imaginary part of the second one are not greater than the real part and, respectively, the imaginary part of the first one. Finally, the option `-N' makes `numdiff' consider two values equal whenever the second one, i.e. the one coming from the file specified as last on the command line, is greater or equal than the first one, which is the value coming from the file specified as first on the command line. If the values to compare are complex numbers, saying that the second one is greater or equal than the first one means that both real and imaginary part of the second one are not less than the real part and, respectively, the imaginary part of the first one. The options `-I', `-l', `-o', `-h' and `-v' do not require further explanations. The options `-l' and `-o' are only supplied for the users of some poorly designed operating systems (like MSDog or MSWindoze), whose default shell does not allow the redirection of standard error and standard output. The option `-I' has no effect on the outcome of numerical comparisons but affects the action of the filter, *note Filtering::. The option `-s' requires as argument a set of characters, which will be taken as field delimiters. It is better to quote the set of the delimiters, just as in the next examples: numdiff -s ' \t\n,;:.' FILE1 FILE2 numdiff -s ' \t\n\r\f\v"\:;' FILE1 FILE2 numdiff -s `` \t\n''' FILE1 FILE2 If you want to include in the set of delimiters also some special characters, e.g the *blank*, then you must quote it. I recommend you to always use the single quote character (') to enclose the list of the delimiters, since in this way you will prevent any substitution or handling of characters by the shell. `numdiff' recognizes and interprets the following sequences of characters within the argument passed to the option `-s': * `\f' form feed, * `\n' newline, * `\r' carriage return, * `\t' horizontal tab, * `\v' vertical tab. The mentioned special characters are often used as delimiters in files containing numerical data but they can not be included directly in the set of delimiters. By passing the string ` \t\n,;:.' as argument for the option `-s', one tells `numdiff' use as field delimiters the characters *blank*, *horizontal tab*, *newline*, *comma*, *semicolon*, *colon* and *dot*. Passing ` \t\n' as argument to the option `-s' is the same as not using at all the option `-s', since *blank*, *horizontal tab* and *newline* are the default field delimiters. In the list of field delimiters the character *backslash* (`\') is always treated in a special way. If followed by `f', `n', `r', `t' or `v' it is combined with the subsequent character and interpreted in the way we have just seen. Otherwise, the *backslash* is coupled with the following character and then removed. In particular, if you want to specify the *backslash* itself as field delimiter, you have to put *two backslashes* (`\\') in the list of delimiters. Therefore, the delimiters specified by the command line numdiff -s' \t\n\\\"' FILE1 FILE2 are *blank*, *horizontal tab*, *newline*, *backslash* and *double quote*, since `\\' and `\"' are interpreted by `numdiff' as `\' and `"'. Even if I have recommended to enclose the set of delimiters in single quotes, there are cases in which you will be constrained to use the double quote character (`"') to enclose the set of field delimiters, e.g. if the single quote character is used as field delimiter, like in one of the precedent examples. However you must take into account that in this case the shell could make some substitutions on the command line before executing `numdiff'. For instance, if your shell is GNU bash, then (citing the man page of GNU bash) Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of `$', ``', and `\'. The characters `$' and ``' retain their special meaning within double quotes. The backslash retains its special meaning only when followed by one of the following characters: `$', ``', `"', `\', or **. A double quote may be quoted within double quotes by preceding it with a backslash ... The special parameters * and @ have special meaning when in double quotes ... Therefore, if the set of delimiters is formed by ` ', `\t', `\n', `\' and `"' and you decide to enclose them in double quotes, then the `numdiff' command line should be numdiff -s'' \t\n\\\\\"'' FILE1 FILE2 and not numdiff -s'' \t\n\\\"'' FILE1 FILE2 In this last case the shell would indeed replace the string ` \t\n\\\"' by ` \t\n\"' and then `numdiff' would take ` ', `\t', `\n' and `"' as field delimiters. `numdiff' requires the presence of the *newline* in the set of characters passed to `-s'. The absence of the *newline* in the set of delimiters causes the issue of a suitable warning message and the termination of the program. If you are running Numdiff on MSDog/MSWindoze I recommend you to always put the *carriage return* in the set of field delimiters. Otherwise, this character would be included in all the fields which stay at the end of a line and this would cause some undesirable effects. For instance, a number put at the end of a line would not be considered as a numerical field by `numdiff', since `numdiff' would consider the final *carriage return* as part of the field which then would be qualified as non-numerical. You can specify different delimiters for the two files to compare by putting the prefix `1:' or `2:' in front of the set of characters passed to `-s'. If the argument of `-s' begins with `1:', the characters after this prefix are used as field delimiters only for the file passed as first on the command line. Analogously, if the prefix is `2:', then the characters after it are used as field delimiters only for the file specified as second on the command line. You can also provide an explicit set of delimiters for just one of the files to compare, in which case `numdiff' uses the default field delimiters *blank*, *tab* and *newline* for the other file. Therefore, with `numdiff -s '1:: \n' FILE1 FILE2' the program will take *colon*, *blank* and *newline* as delimiters for FILE1, and *blank*, *tab* and *newline* as delimiters for FILE2. The recommendations about quoting the set of delimiters are valid even in presence of a prefix. The option `-#' lets the user specify the number of digits in the significands used in multiple precision arithmetic. The default value is 35, the largest admissible value is 180. If `numdiff' has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user. Take into account that an higher precision makes the execution of `numdiff' slower. This is particularly true if `numdiff' is not using the computational routines from the GNU MP library and the files to compare contain a lot of numerical fields. In addition, you have to care that `numdiff' truncates the value of a numerical field if it has too much digits with respect to the current precision. To be precise, denoted by P the current value of the precision, the following rules apply. * If `numdiff' has been built with its own internal support for multiple precision arithmetic, then * if a number is written in ordinary decimal notation, `numdiff' will consider, in addition to all digits of the integer part, only the first P digits of the fractional part; * if a value is written in scientific notation, then `numdiff' will only consider the first P digits of the fractional part of the mantissa. * If `numdiff' uses the routines from the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first P digits of the fractional part of the mantissa are considered. You can find out whether your local version of `numdiff' is relying on GNU MP or not by executing the command `numdiff -v'. If `numdiff' uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information: The software has been linked against the GNU Multiple Precision Arithmetic Library, version number 4.2.4. If `numdiff' does not rely on GNU MP, then the displayed message will be (up to translation into your mother language) The software has been built with its own internal support for multiple precision arithmetic. The options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' can be used to instruct `numdiff' about the numeric formats used in the files which it is going to compare. The two files to compare do not have to adopt the same numeric format and then `numdiff' allows to specify different numeric formats for them. Each of the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' can have as argument one or two characters (one or two digits if the option is `-g'). In the first case the argument refers to both files to compare, in the second case the first character is for the file specified as first on the command line, the second character for the file specified as last. For instance, the option `-d' can be used to tell `numdiff' which character(s) is(are) used to mean the decimal point in the two files to compare. If you give the command `numdiff -d_ FILE1 FILE2', then `numdiff' will understand that both in FILE1 and in FILE2 the character *underscore* (`_') is used in place of the default one (`.') to indicate the position of the decimal point in the numerical values. But if the command is `numdiff -d_: FILE1 FILE2', then `numdiff' will understand that the decimal point is indicated by the character *underscore* in FILE1, and by *colon* (`:') in FILE2. If you omit to use one of the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i', then the corresponding attribute will take its default value, *note Default Numeric Format::. You must be really careful when you use one or more of these options. First, not all characters can be passed to them as arguments. The arguments of the option `-g' must be digits, the arguments of the options `-d' and `-t' must be punctuation marks (punctuation marks are all the characters of the ASCII set for which the standard C function `ispunct' returns a non zero value), those ones of the options `-p', `-n', `-e' and `-i' must be graphical characters but digits (graphical characters are all the characters of the ASCII set for which the standard C function `isgraph' returns a non zero value). It is not possible to set the decimal point, the thousands separator, the positive sign, the negative sign, the prefix for decimal exponent or the symbol of the imaginary unit so that, for a same file, two or more of these characters come out to be equal. This rule also applies when you miss to explicitly select a symbol through the appropriate option. For instance, the command `numdiff -d,. FILE1 FILE2' will make `numdiff' abnormally terminate after printing the error message: The numeric format specified for the first file is illegal, the following symbols should be all different while two or more of them are actually equal: Decimal point = `,' Thousands separator = `,' Leading positive sign = `+' Leading negative sign = `-' Prefix for decimal exponent = `e' Symbol used to denote the imaginary unit = `i' Through the option `-d' we have told to `numdiff' that in the first file the decimal point is indicated by the character *comma*, but at the same time we have not modified the character in use to separate the groups of thousands, which has remained the default one, i.e. *comma*, for both files to compare. In this way, we have implicitly told to `numdiff' that in FILE1 the character *comma* represents both decimal point and thousands separator. Since this is not reasonable, `numdiff' refuses to work. To avoid this problem it would be sufficient to explicitly notify to `numdiff' the thousands separator through the option `-t': `numdiff -d,. -t., FILE1 FILE2'. Of course, here we are supposing that the decimal point and the thousands separator are represented in FILE1 by *comma* and *dot* respectively, in FILE2 by *dot* and *comma*. I strongly suggest you that in writing a file you avoid the use of the same symbol to mean two different things (like would be using *comma* for both decimal point and thousands separator), it is nonsense. At last, it is possible (but stupid) to use as argument for the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' one of the characters used to separate the fields in the files to compare. In such a case `numdiff' does not complain but you have to consider that it uses first the set of field delimiters in order to split the files into fields and then, when it has to distinguish between numerical and non-numerical fields, it takes into account the numeric formats specified for the two files. However, it should never happen to specify as argument for one of the options `-d', `-t', `-g', `-p', `-n', `-e' and `-i' a character which is also used as field delimiter: again, in writing a file you should avoid (and people usually avoid it) to use the same symbol to mean two different things. The option `-X' can be used to restrict the comparison between files to a certain group of fields. This option requires as argument a range of positive integer values or eventually just one positive integer number. The argument specifies the position(s) of the fields that `numdiff' has to ignore. Remember that the fields of a line are numerated starting from the left hand of the line and proceeding towards the right hand. The argument passed to `-X' can start with a prefix, which must be either `1:' or `2:'. `1:' refers to the file passed as first on the command line, `2:' to the file specified as second. With the prefix `1:' only the fields of the first file corresponding to the given position(s) are ignored. Similarly, if you want to ignore only fields from the second file you have to use the prefix `2:'. The option `-X' can appear more times on the command line, in which case `numdiff' will ignore all fields located in the positions so specified. Some examples can clarify the use of ranges and prefixes. If the file `List1' contains the data * a 1 1 1 1 * b 2 2 2 2 * c 3 3 3 3 * d 4 4 4 4 * e 5 5 5 5 and `List2' the data 1 1.1 1.01 A 1.001 1.0001 2 2.2 2.02 B 2.002 2.0002 3 3.3 3.03 C 3.003 3.0003 4 4.4 4.04 D 4.004 4.0004 5 5.5 5.05 E 5.005 5.0005 then the output of `numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2' is ---------------- ##1 #:4 <== 1 ##1 #:2 ==> 1.1 @ Absolute error = 1.0000000000e-1, Relative error = 1.0000000000e-1 ##1 #:5 <== 1 ##1 #:3 ==> 1.01 @ Absolute error = 1.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##2 #:4 <== 2 ##2 #:2 ==> 2.2 @ Absolute error = 2.0000000000e-1, Relative error = 1.0000000000e-1 ##2 #:5 <== 2 ##2 #:3 ==> 2.02 @ Absolute error = 2.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##3 #:4 <== 3 ##3 #:2 ==> 3.3 @ Absolute error = 3.0000000000e-1, Relative error = 1.0000000000e-1 ##3 #:5 <== 3 ##3 #:3 ==> 3.03 @ Absolute error = 3.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##4 #:4 <== 4 ##4 #:2 ==> 4.4 @ Absolute error = 4.0000000000e-1, Relative error = 1.0000000000e-1 ##4 #:5 <== 4 ##4 #:3 ==> 4.04 @ Absolute error = 4.0000000000e-2, Relative error = 1.0000000000e-2 ---------------- ##5 #:4 <== 5 ##5 #:2 ==> 5.5 @ Absolute error = 5.0000000000e-1, Relative error = 1.0000000000e-1 ##5 #:5 <== 5 ##5 #:3 ==> 5.05 @ Absolute error = 5.0000000000e-2, Relative error = 1.0000000000e-2 +++ File "List1" differs from file "List2" Numdiff cuts off from `List1' the fields in the positions 1, 2 and 6 and from `List2' the fields in the positions 4, 5 and 6. In this way it compares the third, fourth and fifth field of every line of `List1' with the first, second and third field respectively of the corresponding line of `List2'. An equivalent form of the command `numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2' is given by `numdiff -X 1:1-2 -X 2:4-5 -X 6 List1 List2' : since the sixth field is cut off from both files we can refer to it without a prefix. As you can see, you can specify a range of fields by using the notation `M-N', where M and N are the field numbers of the first and of the last field in the range. It is even possible to use range expressions like `M-' or `-N'. The first expression corresponds to all fields starting from the Mth one (inclusive) till to the end of line, the second selects all fields from the first one till to the Nth one (inclusive). Therefore the command `numdiff -X 1:1-2 -X 2:4 -X 1:6 -X 2:5-6 List1 List2' is equivalent to `numdiff -X 1:-2 -X 2:4 -X 1:6 -X 2:5- List1 List2' or to `numdiff -X 1:-2 -X 1:6 -X 2:4- List1 List2'. Care that the largest field number that you can use while writing a specification for the option `-X' is 32768. If you use the option `-X' the exit status of `numdiff' reflects the outcome of the restricted comparison. For instance, the exit status of `numdiff -X 8- FILE1 FILE2' is 1 only if `numdiff' has found a difference in the first seven fields of FILE1 and FILE2. If the two files differ only in the fields after the seventh one, then `numdiff' ends with a zero exit status. Going back to the example with `List1' and `List2', the output of `numdiff -X 1:1-2 -X 1:4- -X 2:2- List1 List2' is +++ Files "List1" and "List2" are equal since every field of `List1' at position 3 is equal to the first field in the corresponding line of `List2'. The exit code returned by the program to the shell is zero. The options `-z', `-Z', `-m', `-H', `-f', and `-T' influence the action of the filter and their use is then described later, *note Filtering::. Care that `-z' and `-Z' require both an argument in the same form requested by `-X'. Since version 5 Numdiff accepts also long options to conform to the GNU standards. Now it is then possible, e.g., to use `--separator='\n\t %'' or `--separator '\n\t %'' instead of using `-s '\n\t %''. The long options, which start all with two dashes, are listed at the beginning of this chapter, each one near to the corresponding short option. The argument of a long option may or may not preceded by the = sign. The only exception is the option `--test-filter', for which the presence of the = before the argument is mandatory. Then `--test-filter=60' is correct while `--test-filter 60' is not accepted.  File: numdiff.info, Node: ndselect, Next: Invoking ndselect, Prev: Invoking numdiff, Up: Top 6 Selecting lines for the comparison ************************************ Together with the version 5.x of Numdiff is shipped a useful tool, the program `ndselect'. I decided to create this utility in order to deal with a situation that comes out often in Numerical Analysis. Here I present a very simple example of such a situation. Let us suppose that file `list1' contains the values of the square root, rounded to the 20th decimal digit, for all the integer numbers between 10 and 20: 12 3.46410161513775458705 13 3.60555127546398929312 14 3.74165738677394138558 15 3.87298334620741688518 16 4 17 4.12310562561766054982 18 4.24264068711928514641 19 4.35889894354067355224 20 4.47213595499957939282 21 4.58257569495584000659 22 4.69041575982342955457 23 4.7958315233127195416 24 4.89897948556635619639 while LIST2 contains _suitable_ approximations of the square root only for the numbers between 12 and 21 which are multiple of 3: 12 3.46410162002945508100 15 3.87298387096774193548 18 4.24264705882352941176 21 4.58260869565217391304 These approximations could have been obtained for instance by using the famous Heron's algorithm, which, given an approximation `a' for the square root of a number `x', computes a better approximation by the formula `a := 0.5 * (x/a + a)'. What we want now is to understand by using `numdiff' how good are the approximations contained in file LIST2. Unfortunately, we cannot execute directly the command `numdiff list1 list2', since in this way we would compare the approximations provided for the square roots of 15, 18, and 21 with the square roots of 13, 14, and 15 respectively. To make the comparison in the right way, one could open `list1' in a text editor and remove from this file all the non interesting lines till to leave only the ones related to the numbers 12, 15, 18, and 21. But this approach is practicable because we have to remove few lines, and one can easily figure out how boring and inefficient would be to manually remove hundreds or thousands of lines from a file in order to compare it with another one. An expert GNU user would suggest that it is possible to make this removal automatic by using the well known utilities `head' and `sed', in this particular case `head -n 10 list1 | sed -n -e '1~3 p' > List1' A quick explanation for the ones who do not know how to use `head' and `sed': the previous command extracts from `list1' the first 10 lines, namely the ones containing the square roots of the numbers from 12 to 21, then picks every third line starting from the first one between the extracted lines, in order to select only the ones related to 12, 15, 18, and 21. Finally, these lines are printed on the file `List1', which then looks like: 12 3.46410161513775458705 15 3.87298334620741688518 18 4.24264068711928514641 21 4.58257569495584000659 Once obtained `List1', we can perform with `numdiff' the comparison between the values we are interested in: `numdiff List1 list2' . Unfortunately, this trick only works if you have installed the GNU version of `sed', which, as far as I know, is the only one to provide the extension FIRST~STEP to specify line addresses. That is way I decided to implement `ndselect', which allows to obtain the same result as before with the simpler command: `ndselect -b 1 -e 10 -s 3 list1 > List1' The meaning of the arguments passed to the options `-b', `-e', and `-s' is the following: we are telling `ndselect' to print every third line of file `list1' (the option `-s' specifies the step), starting from the first one (the option `-b' specifies the beginning) and ending within the tenth one possibly inclusive (the option `-e' specifies the end). Because of the presence of the redirection operator `>', the previous command sends to the file `List1' what `ndselect' would print on the screen (standard output). Using `ndselect' is very simple and elegant, other than extremely useful in the situations just outlined. A complete description of its use follows.  File: numdiff.info, Node: Invoking ndselect, Next: Filtering, Prev: ndselect, Up: Top 7 Invoking ndselect ******************* *SYNOPSIS* ndselect -h|--help|-v|--version or ndselect [-b FIRST][-e LAST][-s STEP][-l PATH][-o PATH] [FILE] where FILE is the name of the file to scan. In the first case `ndselect' prints a short help or/and version number, Copyright, License notice and NO-Warranty disclaimer. In the second case `ndselect' prints on the standard output every STEPth line of FILE starting with line FIRST and ending within line LAST. The complete path of FILE should be given, a directory name is not accepted. If no input file is specified, the program reads from the standard input. *OPTIONS* `-b, --beginning, --start=FIRST' Specify the first line to print (The default behavior is to start with line number 1) `-e, --end=LAST' Specify the last line that can be printed (The default behavior is to arrive till to the end of the file) `-s, --step=STEP' Specify the step to use when selecting the lines to print (The default value for the step is 1) `-l, --warnings-to=PATH' Redirect warning and error messages from stderr to the indicated file `-o, --output=PATH' Redirect output from stdout to the indicated file `-h, --help' Show the help message `-v, --version' Show version number, Copyright, Distribution Terms and NO-Warranty Passing 0 as argument to the option `-e' is equivalent to omit this option and leave enabled the default behavior (which consists in scanning till to the end of the file). *DIAGNOSTICS* The exit status is 0 in case of normal termination, -1 (255) in case of error. As `numdiff' does, also `ndselect' since version 5 accepts long options. So instead of `ndselect -b 1 -e 10 -s 3 list1 > List1', you can launch this command as `ndselect --start=1 --end=10 --step=3 list1 > List1'.  File: numdiff.info, Node: Filtering, Next: Warnings, Prev: Invoking ndselect, Up: Top 8 Using the filter of numdiff ***************************** Since version 5 it is possible to activate a filter when calling `numdiff', so that the program performs automatically the comparison in the desired way. Recalling the example of chapter 6, if you run the command `numdiff -z 2- -V list1 list2' you obtain the following result: ---------------- ##1 <== 12 3.46410161513775458705 ##1 ==> 12 3.46410162002945508100 ##1 #:2 <== 3.46410161513775458705 ##1 #:2 ==> 3.46410162002945508100 Absolute error = 4.8917004940e-9, Relative error = 1.4121122985e-9 ---------------- ##2 <== 13 3.60555127546398929312 ==> ---------------- ##3 <== 14 3.74165738677394138558 ==> ---------------- ##4 <== 15 3.87298334620741688518 ##2 ==> 15 3.87298387096774193548 ##4 #:2 <== 3.87298334620741688518 ##2 #:2 ==> 3.87298387096774193548 Absolute error = 5.2476032505e-7, Relative error = 1.3549253331e-7 ---------------- ##5 <== 16 4 ==> ---------------- ##6 <== 17 4.12310562561766054982 ==> ---------------- ##7 <== 18 4.24264068711928514641 ##3 ==> 18 4.24264705882352941176 ##7 #:2 <== 4.24264068711928514641 ##3 #:2 ==> 4.24264705882352941176 Absolute error = 6.3717042443e-6, Relative error = 1.5018250929e-6 ---------------- ##8 <== 19 4.35889894354067355224 ==> ---------------- ##9 <== 20 4.47213595499957939282 ==> ---------------- ##10 <== 21 4.58257569495584000659 ##4 ==> 21 4.58260869565217391304 ##10 #:2 <== 4.58257569495584000659 ##4 #:2 ==> 4.58260869565217391304 Absolute error = 3.3000696334e-5, Relative error = 7.2013423303e-6 ---------------- ##11 <== 22 4.69041575982342955457 ==> ---------------- ##12 <== 23 4.7958315233127195416 ==> ---------------- ##13 <== 24 4.89897948556635619639 ==> +++ File "list1" differs from file "list2" Numdiff has recognized that the lines of `list1' with the square roots for the numbers 13, 14, 16, 17, 19, 20, 22, 23 and 24 have been deleted from `list2'. The numerical comparison has been done by likening each line of `list2' to the line of `list1' which displays the square root for the same integer value. The output obtained running the filter of Numdiff by `numdiff -f -z 2- list1 list2' confirms this: 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 < 14 3.74165738677394138558 < 15 3.87298334620741688518 15 3.87298387096774193548 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 18 4.24264705882352941176 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 21 4.58260869565217391304 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" If you compare the command `numdiff -z 2- -V list1 list2' with the one used here, *note command::, for the files `bill1' and `bill2' you surely notice that the filter has been invoked in different ways, first with `-z @' and then with `-z 2-'. The synchronization procedure used by the filter is based on blurring and byte by byte comparison. The options `-z' and `-Z' are used to select which field(s) from which file have to be blurred. They take both an argument in the same form requested by `-X', *note Use of the option -X::, but accept additionally the special value `@' as abbreviation for the range of fields `1-'. Then the specifications `1:@', `2:@' and `@' are used to mean all fields of the first file, of the second one or of both, respectively. Employing `-z' and `-Z' in the right way is extremely important to let the filter work as desired. For instance, `numdiff -f -z @ list1 list2' matches the lines of `list1' and `list2' in the same wrong way 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 15 3.87298387096774193548 14 3.74165738677394138558 18 4.24264705882352941176 15 3.87298334620741688518 21 4.58260869565217391304 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 < 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 < 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" as Numdiff would do without triggering the filter at all. It is essential then to understand what blurring a field means and how the filter uses blurring to match the lines of the files to compare. After reading the files the filter removes from each of them (from their images in the memory, actually) all the fields selected by the option `-X', then it replaces each of the fields that have to be blurred by a special character. This special character is the same for both files and it is so chosen that it cannot appear in the text. Blurring a field means to replace it by this sort of place card. After doing this, the filter converts all remaining numerical fields to a standard format and compares the files byte by byte neglecting the field delimiters. This comparison is just used to establish which lines of the first file are not present in the second, which lines of the second file are missing in the first one and how to match the remaining lines to create a one-to-one correspondence. Only at this point `numdiff' inspects each couple of corresponding lines, splits the two lines into the constituent fields, and neglecting those ones eventually specified through the option `-X' compares corresponding fields as it is supposed to do, performing a numerical comparison whenever the fields are both legal numerical values. Blurring the right fields is essential to match the lines from the two files appropriately before doing any numerical comparison. Without blurring, the numerical fields could prevent `numdiff' from an appropriate matching of the lines, in case some of them are present in only one file, by creating confusion with their (maybe small) numeric differences. Blurring can be of two types, conditional or unconditional. The blurring is conditional if it has to be performed only for fields which turn out to be legal numerical values. The arguments of the option `-z' indicate which fields of which file have to be blurred *under the condition that they are recognized as numeric fields*. Non-numeric fields are left by `-z' untouched (no blurring occurs for them). Then `-z 1:5-7' makes the filter blur the 5th, 6th and 7th field of each line of the first file whenever they are recognized as numerical. By the option `-Z' you can specify which fields have to be unconditionally blurred, i.e. independently of their type, numerical or not. Then `-Z 2:3-4' activates the blurring of the 3th and 4th field of each line of the second file. Going back to the comparison of the files `list1' and `list2', the option `-z 2-' of the command `numdiff -z 2- -V list1 list2' makes the filter transform the (memory copies of the) two files as 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19 * 20 * 21 * 22 * 23 * 24 * and 12 * 15 * 18 * 21 * respectively. Here * denotes the special symbol used by the filter in the blurring procedure, even if this symbol is not actually a bullet. Since in this example space, tab and newline are used as field delimiters, the byte by byte comparison between the transformed files produces the same result as the command `sdiff -W' does when called on them: 12 * 12 * 13 * < 14 * < 15 * 15 * 16 * < 17 * < 18 * 18 * 19 * < 20 * < 21 * 21 * 22 * < 23 * < 24 * < If you put the blurred fields back you obtain exactly the output of `numdiff -f -z 2- list1 list2': 12 3.46410161513775458705 12 3.46410162002945508100 13 3.60555127546398929312 < 14 3.74165738677394138558 < 15 3.87298334620741688518 15 3.87298387096774193548 16 4 < 17 4.12310562561766054982 < 18 4.24264068711928514641 18 4.24264705882352941176 19 4.35889894354067355224 < 20 4.47213595499957939282 < 21 4.58257569495584000659 21 4.58260869565217391304 22 4.69041575982342955457 < 23 4.7958315233127195416 < 24 4.89897948556635619639 < +++ File "list1" differs from file "list2" Since the second field is a numerical value in all the lines of `list1' and `list2', to use the option `-Z' instead of `-z' makes no difference in this case. The output of `numdiff -f -Z 2- list1 list2' is just the same as for `numdiff -f -z 2- list1 list2'. After this explanation you can also understand why `numdiff -f -z @ list1 list2' gives a wrong result. Since also the first field is always given by a numerical value, the option `-z @' makes the filter transform the two given files as * * * * * * * * * * * * * * * * * * * * * * * * * * and * * * * * * * * respectively, so that it is not anymore possible to match the lines in a reasonable way. Let us see now a typical situation where it is better to use `-Z' in place of `-z'. If the file `Table1' contains -6 2.449490 -5 2.236068 -4 2.000000 -3 1.732051 -2 1.414214 -1 1.000000 0 0 - - - - - - - - - 1 1.000000 2 1.414214 3 1.732051 4 2.000000 - - - - - - - - - 5 2.236068 6 2.449490 7 2.645751 - - - - - - - - - 8 2.828427 9 3.000000 10 3.162278 11 3.316625 12 3.464102 - - - - - - - - - - - - - - - - - - 13 3.605551 14 3.741657 and `Table2' contains -6 Not_defined -4 Not_defined -2 Not_defined 0 0.000000 2 1.414216 4 2.000000 6 2.449494 8 2.828469 10 3.162278 12 3.464102 14 3.741658 ********************END then the output of `numdiff -z 1:2 -Z 2:2 -f Table1 Table2' is -6 2.449490 -6 Not_defined -5 2.236068 < -4 2.000000 -4 Not_defined -3 1.732051 < -2 1.414214 -2 Not_defined -1 1.000000 < 0 0 0 0.000000 - - - - - - - - - < 1 1.000000 < 2 1.414214 2 1.414216 3 1.732051 < 4 2.000000 4 2.000000 - - - - - - - - - < 5 2.236068 < 6 2.449490 6 2.449494 7 2.645751 < - - - - - - - - - < 8 2.828427 8 2.828469 9 3.000000 < 10 3.162278 10 3.162278 11 3.316625 < 12 3.464102 12 3.464102 - - - - - - - - - < - - - - - - - - - < 13 3.605551 < 14 3.741657 14 3.741658 > ********************END +++ File "Table1" differs from file "Table2" which is exactly what is expected. On the other hand the command `numdiff -z 2 -f Table1 Table2' displays -6 2.449490 | -6 Not_defined -5 2.236068 | -4 Not_defined -4 2.000000 | -2 Not_defined -3 1.732051 < -2 1.414214 < -1 1.000000 < 0 0 0 0.000000 - - - - - - - - - < 1 1.000000 < 2 1.414214 2 1.414216 3 1.732051 < 4 2.000000 4 2.000000 - - - - - - - - - < 5 2.236068 < 6 2.449490 6 2.449494 7 2.645751 < - - - - - - - - - < 8 2.828427 8 2.828469 9 3.000000 < 10 3.162278 10 3.162278 11 3.316625 < 12 3.464102 12 3.464102 - - - - - - - - - < - - - - - - - - - < 13 3.605551 < 14 3.741657 14 3.741658 > ********************END +++ File "Table1" differs from file "Table2" which is partially wrong. Notice that in `Table1' you find (truncated to the sixth decimal digit) the square roots of the absolute values of the integer numbers between -6 and 20, plus some randomly added lines. The file `Table2' contains some approximations (obtained by Newton's method) for the square roots of the even numbers between -6 and 20. Since the (real) square root is not defined for negative numbers, the values corresponding to -6, -4 and -2 are replaced by Not_defined. Since Not_defined is not a numeric value, during the execution of the last command the filter transforms `Table1' in this way -6 * -5 * -4 * -3 * -2 * -1 * 0 * - - - - - - - - - 1 * 2 * 3 * 4 * - - - - - - - - - 5 * 6 * 7 * - - - - - - - - - 8 * 9 * 10 * 11 * 12 * - - - - - - - - - - - - - - - - - - 13 * 14 * and `Table2' in this other way -6 Not_defined -4 Not_defined -2 Not_defined 0 * 2 * 4 * 6 * 8 * 10 * 12 * 14 * ********************END Unfortunately the first three lines are enough to confuse the synchronization procedure, which is based on a byte by byte comparison with exclusion of the field delimiters, as we explained before. You can check that this is definitely the case by looking at the output of the command `sdiff -W' on the transformed files, which is -6 * | -6 Not_defined -5 * | -4 Not_defined -4 * | -2 Not_defined -3 * < -2 * < -1 * < 0 * 0 * - - - - - - - - - < 1 * < 2 * 2 * 3 * < 4 * 4 * - - - - - - - - - < 5 * < 6 * 6 * 7 * < - - - - - - - - - < 8 * 8 * 9 * < 10 * 10 * 11 * < 12 * 12 * - - - - - - - - - < - - - - - - - - - < 13 * < 14 * 14 * > ********************END If we give the command `numdiff -z 1:2 -Z 2:2 -f Table1 Table2' instead of `numdiff -z 2 -f Table1 Table2', the second field of the lines of `Table2' is always blurred. The filter transforms then `Table2' into -6 * -4 * -2 * 0 * 2 * 4 * 6 * 8 * 10 * 12 * 14 * ********************END and re-synchronizes the files `Table1' and `Table2' in the right way. Using the unconditional blurring is suggested in all cases when a certain field, which you want to include in the comparison (use `-X' to completely neglect one or more fields), is of numeric type in almost all lines of (one of) the given files. This can be the case e.g. when in some lines the content of the field is given by a special numeric value, like Infinity, Inf, +Inf or -Inf, or by NaN, abbreviation for Not a Number. Concerning the numerical fields which are not blurred, one has to remark, that the filter is not confused by differences in the numeric format. Before the byte by byte comparison, numeric values are converted indeed to a standard format. To offer an example of this, let us suppose that `short1' contains a list of numbers with their logarithms 0.001 -3 0.01 -2 0.1 -1 1 0 1000 3 1000000 6 1000000000 9 and `short2' the same list of numbers and logarithms, but with differences in the numeric format: ****************** 0.0010000 -3 .0100 -2 0000.10 -1 1. 0 1,000.000 3 1,000,000. 6 1,000,000,000 9 Then `numdiff -f -z 2- short1 short2' displays > ****************** 0.001 -3 0.0010000 -3 0.01 -2 .0100 -2 0.1 -1 0000.10 -1 1 0 1. 0 1000 3 1,000.000 3 1000000 6 1,000,000. 6 1000000000 9 1,000,000,000 9 +++ File "short1" differs from file "short2" showing that the filter has matched the lines in the right way. The filter can even handle the case when the same numerical value is written in decimal notation in one file and in scientific notation in the other one. If the files `decimal' and `scientific' contain .001 -3 .01 -2 .1 -1 * * * * * * * * * 1 0 1000 3 1000000 6 1000000000 9 and ***************** 1.0e-3 -3 1.0e-2 -2 1.0e-1 -1 1.0e0 0 1.0e3 3 1.0e6 6 1.0e9 9 ***************** respectively, then `numdiff -f -z 2- decimal scientific' shows > ***************** .001 -3 1.0e-3 -3 .01 -2 1.0e-2 -2 .1 -1 1.0e-1 -1 * * * * * * * * * < 1 0 1.0e0 0 1000 3 1.0e3 3 1000000 6 1.0e6 6 1000000000 9 1.0e9 9 > ***************** +++ File "decimal" differs from file "scientific" proving that the filter does not get confused. No problems come out also in the case when for a same (not blurred) field the scientific notation is used in both files. If the files `sc1' and `sc2' contain 1.E-3 -3 1.00E-2 -2 1.0E-1 -1 1.0000E0 0 001.0E3 3 +01.000E6 6 1.0E+09 9 1.0E+10 10 * * * * * * * * * * and ***************** 1.0e-003 -3 1.0e-2 -2 1.0e-1 -1 1.0e0 0 +1.0e3 3 1.0e+6 6 1.0e9 9 respectively, then `numdiff -f -z 2- sc1 sc2' correctly displays > ***************** 1.E-3 -3 1.0e-003 -3 1.00E-2 -2 1.0e-2 -2 1.0E-1 -1 1.0e-1 -1 1.0000E0 0 1.0e0 0 001.0E3 3 +1.0e3 3 +01.000E6 6 1.0e+6 6 1.0E+09 9 1.0e9 9 1.0E+10 10 < * * * * * * * * * * < +++ File "sc1" differs from file "sc2" Since for example `9876.54e-3' and `-0.0087E4' are recognized by Numdiff as valid numerical values, it is important that the filter can recognize e.g. that `123.456E+2' and `1.23456E+4' are the same number. The filter is able indeed to handle even an improper use of the scientific notation. We can see this in the case of the files `Scnot1': ------------------------- 1.2E0 * 1 2.45E-1 * 2 -3.678E-2 * 3 and `Scnot2': 12E-1 * 1 245E-3 * 2 -0.003678E+1 * 3 `numdiff -f -z 3- Scnot1 Scnot2' displays the report: ------------------------- < 1.2E0 * 1 12E-1 * 1 2.45E-1 * 2 245E-3 * 2 -3.678E-2 * 3 -0.003678E+1 * 3 +++ File "Scnot1" differs from file "Scnot2" which is exactly what you would expect in such a case. Also pretty hard cases do not confuse the filter. Let `Scnot1' be given by 1.2000e0 * 1 02.4500e-1 * 2 -003.678E-2 * 3 and let `Scnot2' be the same file as before. The command `numdiff -f -z 3- Scnot1 Scnot2' gives again the expected output: 1.2000e0 * 1 12E-1 * 1 02.4500e-1 * 2 245E-3 * 2 -003.678E-2 * 3 -0.003678E+1 * 3 +++ Files "Scnot1" and "Scnot2" have the same structure Till now we have always used the option `-f' with no argument. However `-f' accepts an optional argument, which can be used to control how `-f' displays its output. If you provide an argument, care not to leave any space between the option and the argument. So `-f60' is correct while `-f 60' makes Numdiff terminate after printing an error message. If the argument is a positive number NUM, then the side by side output produced by `-f' will be NUM columns wide. The default value for the width of the output is 130, which can fit onto a traditional printer line, and is the one used when `-f' has no argument or the supplied argument is zero. In other words, `-f' and `-f0' are just easier to remind versions of `-f130'. A negative number as argument for `-f' has the same effect as the positive number with the same absolute value, but in addition it causes the suppression of common lines from the output. For instance the command `numdiff -z 1:2 -Z 2:2 -f-130 Table1 Table2' displays the following text -5 2.236068 < -3 1.732051 < -1 1.000000 < - - - - - - - - - < 1 1.000000 < 3 1.732051 < - - - - - - - - - < 5 2.236068 < 7 2.645751 < - - - - - - - - - < 9 3.000000 < 11 3.316625 < - - - - - - - - - < - - - - - - - - - < 13 3.605551 < > ********************END +++ File "Table1" differs from file "Table2" In conjunction with the option `-f' you can use `-T' to expand tabs to spaces in the output produced by `-f'. This is useful to preserve the alignment of tabs in the input files, if it is thrown off by the presence of the gutter. The options `-H' and `-m' affect the performance of the filter of Numdiff. But performance has more than one dimension and these options improve one aspect of performance at the cost of another, or they improve performance in some cases while hurting it in others. The way that the filter re-synchronizes two files to compare always comes up with a near-minimal set of deletions/insertions of lines. Usually it is good enough for practical purposes. If the filter displays a large set of line deletions/insertions, you might want it to use a modified algorithm that sometimes produces a smaller set of differences. The `-m' option does this; however, it can also cause the filter to run more slowly than usual, so it is not the default behavior. When the files you are comparing are large and have small groups of changes scattered throughout them, you can use the `-H' option to make a different modification to the algorithm that the filter uses. If the input files have a constant small density of changes, where change means deletion/insertion of lines, this option speeds up the comparisons without changing the output or in the worst case with minor modifications. To conclude, Numdiff is not perfect but if you play with its options and with `ndselect' you can do a lot of nice and difficult things, which before just the human eye could do.  File: numdiff.info, Node: Warnings, Next: Index, Prev: Filtering, Up: Top 9 Warnings ********** * Bug reports have to be sent to the address . Please, put Numdiff in the subject and indicate the version of Numdiff you are using, the version of the operating system you are running and, if you know it, the version of the compiler used to build Numdiff. * Numdiff does not accept numbers in scientific notation whose exponents lie outside the range -1073741824, ..., +1073741824. If such a number is found in any of the files to compare, the execution of the program is stopped immediately after printing a suitable error message on stderr. Under the assumption that the numeric format in use is the default one, with "1.0001e-2147483640" the displayed error messages is numdiff: A number with a too small exponent has been found, namely "1.0001e-2147483640". Exponents smaller than -1073741824 are not accepted, the execution of the program ends now * If Numdiff has been built with its own internal support for multiple precision arithmetic instead of being linked against the GNU MP Library, then performance degradation and memory exhaustion can already make impossible to handle exponents of magnitude 10^6 = 1000000. This is what I obtained on my laptop, equipped with a dual core processor @1.50 GHz and with 1GB of RAM, when I tried to compare the numbers 1.101e1000000000 and 1.0e1000000000: numdiff: Insufficient memory for new allocation, the execution of the program ends now In addition, you can overload the processor with numbers whose exponents lie outside the range -1000000, ..., 1000000. But at least on my machine, everything works fine and quick enough as long as exponent and size of the mantissa of the numbers are in the range -1000, ..., 1000. Be careful and remember that Numdiff is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Consider also that, if you have numerical data with exponents outside the range -300, ..., 300, probably there is something wrong with your data: either you are using the wrong scale, or you should replace very small numbers, like 1e-100, by zero, or it is quite likely that the machine/program/algorithm which produced these data is not working right :D * If Numdiff has been linked against the GNU Multiple Precision Arithmetic Library (also called GNU MP), then the precision it uses is typically higher than the specified one. On my machine the actual value of the precision is 20 if the user gives a value between 0 and 20, 30 if the user specifies a precision between 21 and 30, 40 for a user-specified value between 31 and 40, and so on. Anyway, the actual precision is never less than the one required by the user. * After reading a numerical field, Numdiff truncates its value if this number has too much digits with respect to the current precision. To be precise, denoted by P the current value of the precision, the following rules apply. If `numdiff' has been built with its own internal support for multiple precision arithmetic, then * if the number is written in ordinary decimal notation, `numdiff' will consider, in addition to all digits of the integer part, only the first P digits of the fractional part; * if the value is written in scientific notation, then `numdiff' will only consider the first P digits of the fractional part of the mantissa. If `numdiff' uses the GNU MP library to perform its computations, the value of a numerical field is first translated into scientific notation and then only the first P digits of the fractional part of the mantissa are considered. By current value of the precision I mean the integer value specified by the option `-#', or the default one (35) when this option is not in use. * You can find out whether your local version of `numdiff' is relying on GNU MP or not by executing the command `numdiff -v'. If `numdiff' uses GNU MP, then this command will display the following message or similar (possibly translated into your mother language) among other information: The software has been linked against the GNU Multiple Precision Arithmetic Library, version number 4.2.4. If `numdiff' does not rely on GNU MP, then the displayed message will be (up to translation into your mother language) The software has been built with its own internal support for multiple precision arithmetic. * Numdiff manages perfectly only text files with an 8-bit encoding (ASCII and ISO 8859-* text files). The use of Numdiff with UTF-8 text files suffers from some restrictions (numbers and field delimiters must consist of ASCII characters, i.e. characters with the most significant bit equal to 0). * If you are not including the so called white-space characters (usually ` ', `\t', `\f', `\v' and `\r') in the set of field delimiters, then a real and an imaginary number which are separated just by white-spaces can be coupled together and considered as a whole complex number. For example, if you are using only *colon* (`:') and *newline* as field delimiters and Numdiff finds a line like that ::::3.0-5.6e-356i::::-12.9 +4.34i::::-12.9 4.34i::::New York:::: then it will consider this line as formed by four fields, the first two are numerical and given by the complex numbers 3.0-5.6e-356i and -12.9+4.34i, the last two ones are the strings New York and -12.9 4.34i. I still do not know if I will modify this in the next version of Numdiff, so that the program recognizes only 3.0-5.6e-356i as numerical field and treats -12.9 +4.34i as non-numerical because of the presence of spaces in the middle. -12.9 4.34i is already considered as non-numerical due to the absence of a leading sign in the imaginary value. * We have seen that one of the two files passed to `numdiff' can be -, which refers to stdin (standard input). In this way one of the two files to compare can be the output produced by another command, like in `cat file2 | numdiff -a 1.0e-3 file1 -'. However, if you trigger the filter through the options `-z' or/and `-Z', Numdiff can not work with the standard input unless you use also the option `-f'. So the command `cat file2 | numdiff -a 1.0e-3 -z @ file1 -' displays only the error message numdiff: -: Illegal seek (or maybe the translation of this message in the language you are using on your computer) but `cat file2 | numdiff -a 1.0e-3 -z @ -f file1 -' works as expected. * This manual describes the version 5.x of Numdiff. Versions 4.0.0 and 3.x used even a different format for the output.  File: numdiff.info, Node: GNU Free Documentation License, Up: Top Appendix A GNU Free Documentation License ***************************************** Version 1.3, 3 November 2008 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. `http://fsf.org/' Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The "publisher" means any person or entity that distributes copies of the Document to the public. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements." 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See `http://www.gnu.org/copyleft/'. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. "Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents ==================================================== To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.  File: numdiff.info, Node: Index, Prev: Warnings, Up: Top Index ***** [index] * Menu: * Acknowledgments: Acknowledgments. (line 6) * Build: Installing. (line 6) * Caveats: Warnings. (line 6) * Command line options for ndselect: Invoking ndselect. (line 6) * Command line options for numdiff: Invoking numdiff. (line 6) * Compile: Installing. (line 6) * Copying Conditions: Copying. (line 6) * Diagnostics (ndselect): Invoking ndselect. (line 6) * Diagnostics (numdiff): Invoking numdiff. (line 6) * FDL: GNU Free Documentation License. (line 6) * Filter: Filtering. (line 6) * Format of the reports: Output format. (line 6) * GNU FDL: GNU Free Documentation License. (line 6) * GNU Free Documentation License: GNU Free Documentation License. (line 6) * GNU General Public License: Copying. (line 6) * GPL: Copying. (line 6) * How to use numdiff: Overview. (line 6) * Install: Installing. (line 6) * Invoking ndselect: Invoking ndselect. (line 6) * Invoking numdiff: Invoking numdiff. (line 6) * License: Copying. (line 6) * ndselect (introduction to its use): ndselect. (line 6) * Notes: Warnings. (line 6) * Options, command line (ndselect): Invoking ndselect. (line 6) * Options, command line (numdiff): Invoking numdiff. (line 6) * Output format (numdiff): Output format. (line 6) * Overview: Overview. (line 6) * Predefined settings of numdiff: Invoking numdiff. (line 6) * Purposes: Overview. (line 6) * Synopsis (ndselect): Invoking ndselect. (line 6) * Synopsis (numdiff): Invoking numdiff. (line 6) * Thanks: Acknowledgments. (line 6) * Tools: ndselect. (line 6) * Usage of numdiff: Overview. (line 6) * Warnings: Warnings. (line 6)  Tag Table: Node: Top1077 Node: Copying2654 Node: Acknowledgments3391 Node: Overview4184 Ref: command15926 Node: Output format26317 Node: Installing35482 Node: Invoking numdiff40574 Ref: Default Numeric Format46644 Ref: Alternative formulas for the computation of the relative difference53537 Ref: Use of the option -X74221 Node: ndselect79920 Node: Invoking ndselect84144 Node: Filtering86074 Ref: Use of the option -f109251 Node: Warnings112465 Ref: with GNU MP is better113555 Node: GNU Free Documentation License119660 Node: Index144792  End Tag Table cmtk-3.0.0/Utilities/numdiff-5.2.1/docs/numdiff.info.gz0000644000177700000170000012076511666247630021455 0ustar torstenman‹‰«LKì\ks·’ý¼ø‹(©²dSc>ô²6IEQìXY?T–œTª¶*‡ 8WÃî<$3¿~Ow˜!9”â{óm/Ë%‰<Óݧ ¯gI©ñ/z>ÉãòyVÏ'Ét%Ù4ïéE‘OêØNôx©çæÖÒ§úÎe’gú Œô´Èçj­oõ9‰”ºx÷êýþOö¯^ž__¼§¯íçJÇ…5õ6ÙCfÉ¢Nùuu}öáz?ôzùîúÃïê©~'ƒžê]7ü^¤õy>_˜"Énô4Im©ã<«L’Ñhe‹$Æ›NJ½Kódy¥ó,]î©—ï~ZŸBi­ÿ؉¢¨Fˉ-´Mn2›éÿ.Ì´¢ÅV…©-ž•žTxœaÕ6Ñ?Û2ž¥6žUÊÎyñÕÎJ©kÒ'V›£•q‘Œ!à,¿×U®“¬¬LšòâëÒúÅõ´!Ußf®ïgI¥?œžžê®—_k…ßÙ$a%èÝŸ/ßìa€³ø6ËïS;¹¡¹ÊµÖž¢ý{¬ï.±÷Ý3^d  rný.Äö¶ÈúzÕ@ÛÝîò[ý™-œvt#[nºd“ÒÂ/TݲÚE@ý¦YȜ˕i»kO랣'»m3Z}SnL¨hÿÍDtÖ÷À½~ŒóºÔ……wÂnÐI؇ ŒF»n!/&„ÒÒÈ‚ƒñòš'öó 1K-@šP³GE$X¬Á( (2ð—RßQµ‚ƒÇð®IË\ßIU!<„]Ħ´öÒy‚S½Ìk› Šjœ—Jª5ÿ•<è¯~¶™-B.ÉëÄ^•Ê”ø¡– ê!TáyãÁFnå=9:øeHXP§½MÏ'QÀk¶,¬Š]É0Ë+Œ…eÝ'° ±%¨Mkx,´T¿]\¿~ÿñZŸ½û]ÿvöáÃÙ»ëßÅGæ5âç•qìq‚a± äµÔÛ—Î_£ýÙo.®'¡_]\¿{yu¥_½ÿ÷v vqþñÍÙ}ùñÃåû«—àñWÖzeªneR”Ãf@g ŠŸºp÷;v¯„T¦3sg îx‚Ýö£mRšÝÎÇC_.´C¨‹)% =]B¸O³ªZœ>~Ýdu”7ω”ÏŸ<Æ„6-@÷Þ1 ¼±„€òá¦WݤDØÄ,x lkv«ß¦-Èôyjù÷· sŽæùiEø)öœ?Élõ=)X•Ø[ÒQYßÜØR\?ÔwCª[ö¹s(èNv )ÜÄŒ“4ÁÖSh#´Z°“˜86àT‚ÀwAÍ…çó2Ƕآȋ’ÈhJ›BˆM£(«àSx;Zn¼§HÄK“§¹>7@=òðØ€ñÌrÌ!݉‚ÙD8]̦Mwûëw›}“þ´õ¨a´ @,¢‰ûÁ&6'ØÆ(  ÚÖ@Á§&œßBÀ‘Hç1 à7å­0ýûܱt¡Ö‘É™Eɰ 'äF ðxßrÏ~­ì³© ó2Ë1#A5ÃbE…6&ÕÉË€šSòP AŸchÄZ`àFÌ#°|µ°9ð/ÀA`F3š7Ô{³,eÀÇŒi’«8l˜‰Š¥¡oÓÕ­§ÝVM ‡IL´¾Ã‘ƒf‚ÀTüé³…„V~90À I6öjC}D;îmšîÓ~?$Ë“j…$«Q,‰£\VÕã ¦”$¯°ædU¿a¬yQ•Úšx&­É>¥Eàtæ7í0)v«¦\N€ ’è«â!ÌJì,àF!Y–îã­™#ÌW¤÷Aµ\X¯q4-L\qOüƒe§öŽœB³ÑAË|¹¾™‰Ù±£qRéd£ˆNÞT‘—†/H®Bv‚´>†I3ƒæˆâäÙÅ6Î2Ó—£Z&¤•«ÕâÛ¨~MCîÐ;ÀÞ”ö™œæÿßš$bR‡ÂªØgU¨& òñJ¼‘šÞ ¨NÚ“’¨¾`§äŸ}$)è™V޹’Á•è”ààŒí~ÕÚ0Ù+pº¸—C_—IfЉúvÁ¿‰9$®0PÏ‘ƒ¤ü.6ß7f*ZM²–½B2åÍom[ÜV ³e%Ë!R¾u[>ÍNÆÓVêÂ$ìü±–Ê#›Æ„vT»ñÄļÇéæS<_4êØ"u‡4~(úÍà©@’¼; % ÌGú¡÷¼%X:az«S,Fœ”JâÇ\!çL¼½a¿iDHâP Ó.-EQkðÖ&‘CÈáI9ußÁÁ#'Ýä9hý ÓSzDEq‡÷v†ó}ñþ¢RÙe"Š/IHRqA1(ÅU¬ p©ÊÍBVe'½f²®Iʾš'é©û™ä@9åcvguYó”«‘s:²>)6…cO‰Ì˜+q˜ƒëxúihš.Ÿº}f/ Ž:/°? ª‰ å cµh–³økl!àHBBÃc3†Xdf%•K3g™Æ¶PŽ>K­KÚ¿V/—Üœ-Çc‘ÂÞ­mP < h0:à Œÿ†Y1tÊ87-Ì®@Ö­7,¦äÓ=©­÷ø^^#®DË+C"~6J¾3ií·(ƒh8§´-ïúôÒž<·TÃi(¬·™K]ÅPˆ¡M„Ö2eUæ¦ðtÂZeg6sÆÔÜq}„ݪYû®azÑ:‘zçÖPÙ…ÌÑyÚŒ†tI(vSâ =³Sn«¨uØ+ÇxæQv’…}µø  Üd…A8ΑáÓÒi³@œœ] „ L~µ%íg3÷L3ªèRæFnéÅÉñÑat0xÃÔ‹ˆ> ÷/û„,·gmµm§.½¿Qeœ+˜"hPAÑ‹ÔÄ ÁŠóšØ8™cÏ|Ëõ¼ib–í3JA$&JžâBh+¾Æ·$HÃ¥¡ö;‚‰RÆv犅€\¹ÁlZ\e§šQ¥uVg“‚R¢9Š7Ìi2­–ûdOÄKãiUž‚4º&ˆËý2ù ö…fGAWÞayë§øžé ¤? ~›˜WD $`(QÿpÁZzG߸TÏdêLнÒþž—OÃZêØCÇ:FèHÌJú)¨”¾>ªXæZÌ ±Ñ@àâ¿]rÓrDbçŠÇè9‡ë½£r¶µêÛ‰é…s”Ñó$Hp•ÌmÙÚtî¹TµÊ7<é—k@†ã;À—ËA1Ï62`è)8ÔEæ’æ9½–àÀIaW(7©wødg§ G+¬¶Êó.— »]qk±àªÛZðsël­ ŒTžBý¸ÌS:•á%{WvCgðì„ >Á`QÕ«’«%Iï=ñrÁt4ò°Ñýz^#ŽmȈ`.`et"¨]ë1ø)T¼+Ûtl…Ât9Sø¤ˆ9i©Åé¼µå-ÕørJ{Ï/ªЦS©Põµqu¢1ÅÔÒð¹IE%UÄ~†{Ãnb´%’W›¬µšEÖ›…/­¡ùsµE‘`¿ÒåN IÌ‰Ôæ­‡U†]»Àɵ'2ˆr‘œ^¨O+”XÊÏ—ožpyɪ©bg‘Wfúu¤4Ⱦ¼Ï¾2i¥ßP’s«>f —HªeÄ9†©áùäÂuMOÂD0,Ù™–RkRâ»\‡(ô\% Üv#qøBöÞ•çŒb¬EÄÅHñ‰ÜýˆÝ©DºÅ)‘áê>ÌøV|u™cB)V=Q¤¢q^dÄÐSrïH¾ƒ8^u¡yOÀD k¦R o \’JV\ïôZ,á’cêEU±0tU2²T`Ñ>ZðPe\˜ ~4 ¦)pNy,ƒoÇPk*®ãÃùt€V‹7i2˜øÞùÈÉ6õL èj˜ÈKˆω“sr2…© I±² IîY`³Çw½•z?vl®¶›ë¿|lÞÚ„õcó¶€p,&ª¬˜*/h7oj©<²C\˜j ÛMÞ×,‡ËL=—t— ˜°³=;'~š+)L9>çÊTôÀ»T å“.%ó ·Q¾*P”.F¸¤›|¤S5–·’qN×ÚHlšÎk9RäüÝ+ÍÿÐÄèd\aûˆ—ŽlÕƒáxLé6^X¯¸!i¤ÚŬˆ‹oDrCÅmUF™FÖÓH«ÚiÑd¥×Â[ý{_çd>RÊfe¹„·H¤MóX(+iÍ%}"ªLë÷`â“)öš4pjoL+:‡<„cj½…-‘TÅhÚº¬žünÈÛ€£ž†/fVßô‚8•„UÓ؈ ¡qºââŠò»i'ÖïIºÆœ‡uXR1‘@ͱr°àúH pà©xÚu™¦¸µ:oçªÉtý¹c¹@ü¤ü¡«ðù¸ŒJdL ÝE(¸üi‹œòwо\¾¢Ý%¾%ü@Q@Oâ„ .Ò,[ÅÁbcšþÈ7œ‡” 2µîp âFçµÚ0H/w÷ÓÿdæìêüâB±‹ïîŸíQ¶Y$@hÆî2%5¯|s훿ؓRø8¥3§ÝOj½Å°¿×ÉF½}}¢Užø—®4f*£à¾¸°æ¯ 8é×z8ú%/gµi. Œ¢ÃÃÖ¥g£gÉøw÷ÄMÕ$¿qï÷G‡‡'¤xÁW. #<>:>±û/ø=QËÃý£h8²ÃD)ãýË=ì’[m#¯IÝï·¤f Ñ;„!>ÑúÜ ûl]JßÚÉIóÍ7êŒ9!o¨@½WÙ¼ x(1 Ú­Îꟺ[[ûk/ùôë¯nþ¯Oé¯o¿ûNûÍënñÝwß볕?èæõÛãœ&Ý-HÞ¿{úC7=c°û1ÍÝÚl'À™O­øV§œÉËîôô›2½ -†+-7fûþÈ #&°öX^ÆKð†ü€ÒeFøc`‡rÕ"$xð]¾dòÕØ†5Áðº›ZÚpߪ˜Qø˜bŽýƒ£ãáÑhd÷7çó õw?$aÎÍßÎfhŽU¯ÒٌձҢC‡bäÊ:<:NFýUÈ "mÁà!!È‘¸ù!ÃU„ þi„Œ¶É0 2gÑ8²¶(£¿G”N!ÜGd Îý={öLÓ}»f:‰û¥äEm«ñ¦À©ÀÔbiìX‘‡»jØ4OÓœ/[ȾÍmYšøêL•ÕŸŠOŸ>Õúe6šÐ¤ chÆf)o˜¦ËhËД¼½·mW®*k•ópô-ß .w#½-ìÜ·’ $­&f͹䮟}]´ç“'¡Z.DÏç¢þ¼O›gㄯäîã·¿ëj?W…iŸj¶Èl¨Âõô8$E%;ýŒÆÙ×»üÁr>F¦Ÿ(Ÿ;®V%“¹¹‘Êq%á˜/ Z+Œ*ë)íËõ>Ç'Ñ}~©7%èsŸ_êtíÉÁÁ(àÉY}³>ÚÑqt„Ñ®ìbC6í}\­ÏÓDèó.¿[{2p}~²ñFŸ~4<~@£×9¥öí>ÃGƒè¨ÏÉ­Ú¾I[á•·©ðÑ£jݦ¼í*Ú®È6详s4 Йð‚H]ˆRÙ–d}Ò•eÐþÑl"Æ.å{ìG€¬xÖ^¤°5¹\ÑZ$Ñ>·§ ç“ï¥ýCI‡Í"ÿÂ>´'m‡ÐLóEåb V\]¸FïN:6¦ðlµ9[p\Ö߯©e=÷ZóZlîà=RÕ!7­÷ÕŒ)í$Þ•3G…åá*F¨3þÊ»PÅÜ<¹VÕºÏ+‘µ!'!úð×e|iŸ)ÐK~öX}É'¥\EØjÐzõʼnۃÎZÃ>hVe tt»+ÜHa[õ¨®ÑVªQìÉèÕ‘éD­LБ颓“ÑÉÉÁpxtb÷G/Ýg·¼ôí‘ôK5zØv{^ÕktkYºÑhç`B]ÚªÏÃGô‰í:9<:<÷íþðá…ûº./|;ËøR}ž´‡ÝND¾tX*EÚ­\勇¶†ÝNg¾x؃ְ[ϚƼ™v³‚õ¡›Â5¿>XSµæÿ¦šq˜;¸ˆÎ•´\D¿ÿ¤‡Ññ£.btØ´xÐE4¯VMÌ+ó/ìÙQ謷3Nßx†íhHÙÚÐ-½u×rnˆmšƒë< E5öÙ¨SsÇÃÁàdtp0<±Ïú›A¬A¶;íoSÒmŒpG‰O¤}dl[\³Å(ÝÑ´?Š—£(!Šî”6¤Ø­ºŸ²À™ôXˆ,oˆKU‚¹ÊÄ‚µ{Íå¢ý­†ÖüÃ'‘c3×Ûøæ*Õãÿ; áxÍí''iJÿù] /Î&r×ÍÔÓ™ù¿öÞµ»ãj3ý'N/fÎâÅŒ BK”͉ÒéØIœc5&Ù¯A4ƒnˆb–×ø¯Ÿ}­ÚUÝ(ÙÉdÞfE&îº×¾ïgß©qSD¥H0âFH׆¼Môˆºç>f—–Ó¿4åâ`ÈûúêÛb>¡…V´ÕÍ^•j´žƒõJ 5¦ÁQTg/úÔFk5wó£Äyãi2 ýy2˦åM¹¨¦AÁá£a®fó¼é”òì ŠÀ|@ Ô¸†}’u–\|³3Kg|6YÂö EÁ9À˜IŠÀÅ„(¾z–0Q ÒM<ಆ…?’Ñ™,$hI&=Ø÷s¶gM޹¸Á í©§ßÌ•:…PPwN÷sQ!Üè¬ì¥»t¿“v€äÒ°@$(¯=…ÒŒ0jG ï+vÉ¿Û~=ú©W“[âŠáà–fh5’F f•àj èê“v„uކ’`œÃM³*FMtºaƒ Km¼ƒMILÅá4MÝtFœ £bå*óxQЫvµi·ì4Hf‰¥MÁlBTmO"!ïŠjšgW¥”­ ã ¯†Šè¯¨þ}¬žæõ°ÁÇv…*3þ!ý”Ÿ¦«ØM¸é—U_yD°›ÞYI~¡wöIÊñÇ©r^WÓE7+MR‹¿Î¯SÌ?Vö†ý½}©?¶ŠŽûGûûƒ½Ñáî~þÙàWÓËuºÜÒ?íWÚoÿšWýñ×Zu߸®zûLüª‹•˜;o¬úˆã{ÃU«ŽyFÃ]ؘýÑ ìÔÒ²Uÿ(³…>Ìf™»i¶ÐU7‡9þšˆ ¶øë¬ú“Iø5ö­xî¼Åf2êïí­ZõQowÔß?8õמõ°™ø‡iÕ—zâ§ýªSûí_c“Ô⯳ê¾q]õö™Xõt…Ùë œé¯}ÕÃ'Ö¬út/g}™{&|˜V}©÷%~ÚžõG¿êáר$µøë¬ºo\W½u"fÑW¯:\„ƒ=¿¦-«{º¡É»kVý# ykà TÄM³’ +´Q17m›É“mX#ÐÖºìƒÐp»zÙu•eÙ—yÇ)òn©?m—}ê—=üzu“¿ÊV¸¯ñ–K'è¦HŽG¡äøé‘Ÿa]n3)úÏ8þ¨÷[iŸ|ûkMm`¦¶ÜO>üD³¦³Zê¤ OŠ¿vMþJ¦èÀbJ‚BÛD>Æ Ú?8­6¨Ú'ÖxW>ݱÀ6Ã&å<%lRÔ( ›”×>"lò“Ä.kæ‚…æ”­LVÅŽX¹Ú¬$ÉÓžnjüeî|¹»[$[ØH¦¦x©Œ"¦ŽùÛ¢’ÜKЇTpºTD[òÍM»­ŸR…Õæµƒ•Uó>“¸´©-²®˜äªí¨°ä•% 8¸ÖâÊÆ8ÏÅŒClÜN?Ï)€ª¨ÃØÄÊõ8|‰ƒZG&%š™UI˜cf½“>rÌ_‡Žyµc-‹ÅñŸ, Öi»Nî‡/“ô±L·wŸ¬6/ÕRƒN–)U~"+ ÃKÕƒ¨“viÖt²JÜ]*—,“"Ü'«ÅŒ¥¬,èdkqŸ¬æ=KidÐÉ2yÞ}²<ÜŠ~–¹b鯟Ò¢+ý¹út®z ¦ôm?",õ=ê+óÇ“oJãÀgçÅZCh‰HŠºJÿ£¼R·cl?d$«ªr\dšå+¤0ÈâuÆzG/5¯ÔSÄ^òv1#ÛvLï( §žçä;((‚A›¦UQ/#H”1Ö½Gz~µ„±ª£]s(ªÛã¨[, yF<Ïãp$Ñä5ÎHè½S´#Î  ˆóüo‹b.„Ya|Ä”&ˆ.Ä?¨sœ‚øãÐn„e‡ ÐúoëдUIP¤¸ÙøGÜ|ÉJ+g åø×•¶M Eb⻫œS½÷ÖŒ™Â7~M`À/1$X’ ƒÝÑÀaAŒ ¸# f·ÅCt*)Fû*¿-Ôe9Îg¼8„RŒ¡êÜzüpIºènOm$±›7zV!@7#¨Wö—m´$’ü—,“áE‘nÂØpqÜý®{í}ÈŸ)þ>Qˆ Åv¡uÜG‡qŠ™aÌ!Of@ãp?£ˆ‘gè6ØŠDa_=jz5Ý—dIö4{¸‡©K¦óš€?Òóx< ù)38äÕPc‚>æ›|®2+ƒ»"•Cr–3íMÍqC\z½J2†î5áÃÃÀNqOЬ×;„¼QåÓë®F°—èl”áÍ€6aê=5¹ì3ŽæMà®Sú –uˆRÿšGÀþu1Ž è3Ÿ‚Ž3¤ÊšJÝWõáƒ×€ÎÚæNÖáÈ&ÀòÃ'’/âŸ$‘Lš›2½Êd 1¨\AÒi<2ß-M˜&§§é*p ‘þ+çNÿ«&G/‰÷þØTéäß©ÒÑý¿S¥¥›§Jÿ;Uzõ ùOŸ*mðk˜!gŠ÷çÄxRšO”&£ü¢y³—Åb ºe*¾¥“1µ„#£˜ ääs%YÜS«THk• OL4Õ6HÄñ°— 4CfÈUÌ´P%@A‰¾ÌhhyÈ@á†nÀB{É–—B&˜%œì¹1ô8 #ÁÚùo| ³Ë`Y/Dè’â •ÞaƒÑ`òk´Î&vÒ =;­qoëò!c¸lÕµð I’¥ÌYòH»åFµT€H$ªKÒº7~ó› …ôÒ³"Á>Â÷ÇlŠ3i¤ +ìÅÌkGÎG³ãôÝ~ž(|•Óé‚ ÷¹Ó¡CÛð†I#Öe“/,BÁk$4¢£ç•ÅŠÆã²·'ù5iËhRKÈ6@Ñ‘Ä0Qö‘U¹fƒÔÄ£n ÈoY˜ £7š·Ôh-ÑZ – µÑÅ4K8ùâ§Ù ;þôƒ¥™ÑÌxûƒ[t ¶ÇbÏùá-œÜþ¨ëÓ|Ü0ÉÛC0­úäÙìú‡t 4çbVÔÛü <pf×ÂäˆÉ€ |¯jÂaO¨¨Íh¨ˆîJibHwÔ¦—Dɧc.ÇÓvJ³)U yˆ¦q,¼Ö!«aº¸ò½4|/ ®š)Çàã¤ï±f •|Ä?ªun‚‰ õ-^ñÕé»îœ¢Ó\MQÖt—1D BñB»„­p'h¶œñH>_˜W*³¶T]0íÕh4)ºuá¾yTÜyÇ<ÅѺM^2ó^EùÙe,QúŠð¨QñÇɧËD)!á’[¨ëLXåìÉ8/LÀeêÍ¥éÚm-àô-/ P^¡ÚŒ~홤¯RT·z$~‡¬”%ê `ÐFF^¡t¨«G:)ÖîÄ4.¾aµ»Dµ»û*±ùŸnÁIˆþߣ×Òá°ðÄ~CÔi§"+œõ!tò¹ ä¸›ž¸º¿ùýlƒ+ˆ²^ȆlÖ7f¡ Ìš†éÒ²®Z›² mjªr}ž]"¸±«Õ’ø–igbJÃèíiê" 1©Š’»Ä‹ È™lå:x’œl‰)|»g ²PŒýPw¬†ø»ßíüþ÷éÖƒTÛ Cr"‚!ËaNO/Î&Ý××ÝLô1ò$suwìY‘OyáÖ  ’‚ç^ާ#â¹ã«äÕȬ ZÌØüƒ@¶þàa\{–ΑÀm‰Ý:‡Î;tY%®²YªÊÂŒQÞIeC· EbNB$æNÓ˜cnEó00¼’’."ÑXñ§e=[ºA‹¹uA~v" ˆžRTÒðq‡š‹#›+“ÿ="Ü¡Óxú¨1bÿûø¾™9G£þ¶©G7ÝZ 9gv$ñk[Ôü‚yÎcG·)<]/ô.'æ3?—w)…Sêb…‹ì4¹=dHr|˘xCN.Ð3F›C?÷§Ù/½GÇUet˜Gçȯƒ,2!®Œÿµ†l–‚ üQ2ò©Ä®2@IPg;\ó+©ZzéNG6çf¥æµ8]܉ Ü5ŽKÃÌj‚ä£ä‡Qgi°K(GÈFXœãä©–'É„—­² ½ÍÈó%[MÑ~»Ã þBÍDàpB%Cpl)kÓgÅá‡ËÍh`À»îÙ&œÝîwôïßÅçÙý3找ûiÍÐm­ÆZ‘&eؤ jê¢ô)Ÿ‚j"Ÿc'¿ÛLÞm™Žl}OjÙÚ½"€„&& -ýZÚ~RKÖôÖÚÔ÷1óh|b0â÷é~þ)­†v¨–fS´·ÁGN=à ô®ª÷5 ±¨z8F¦`åˆU'z”ð9@a¬Ë"gOƒ [y„`«§¨%Í\ð´å‚ÛäÚ‡2®ïÉïÈ~%»ü̼A…Ù*ω8kâÓfçnåo-)˜Õ Ûx²1ÁÁrdIPo\/ÉÜ(Æ—åz"ٰнøœË†Þeãy‰è%¹7`vÂ.¦›|î Ì¡UlËÓâjNÈj+µ2€ðý—›Z?\ŠÙ5ƈÈrþè ¸u¬­CÃ9]LXÇ’.„óÚˆŸ0…@ánZ7·«æÒ0­‹i6þ+[m½ÝF¹îsP 0{è+ÔÒ9êzûzQ|–>ÓMÚúêÙ³md'‰k25í ¸5xsl{û sûäPzNðÙÝÞ°·»üÙ‘ouÆ6¢'ŸçWE6 ç³ÛëÛGÐǰßß {él:š~¶nñÛôÌ ;lwì|1{}-¦{½Cßΰw´‡}²DÁa.k?Ý*F‡ûÛng*î¹ra‹™=óQ]G¤÷3Œ?ÎÒ7¯/ξóuÒ£è;¤n›é¢æi[g N‚ îÏÓó ¢ZþH<ó”ùü&½¢$VºRÇ ç‡p+“Õý é‚Ó=¿“ÓUÇóÃU%Äl™–lËçJ$\K8ÂËü’1ô¯¤lu'kSì ¿M&åxáÁÀšpùnúººí’âR£Å—ñY9».nóŒ/1Q)Nw™4Æ`°½‘ZKœ+ÚŒ¡ÛsW,~ æ÷ÕqOÒû|,½æá¸ðÍOtI"XêpüжL HL@ÎQü2›Ý,P3½J$aiv©˜Ø%CëÍTѦ™Zl‰%ç®$«¼“¥Êf¼‚Æ2è d˜É6ɵŠŸ·ŽÌCwÄŠeSÉÕÒÒòÙvgÓJƒ¡ÌfTãù}B èltFЍRþ¢šN£ýüªÀ@ö<+›i^%7Õ•'š%ÁÞ#8XñA„[.Øæ[ÚlÀÇùîò+›‰è÷ïÜŽoÒ‘èÅfK¦á‹ÿþõëW§›ËL>™$h-YUây9í(ƽ¢dþÒ½BëíœtÌ..ý‘ØÜ¸K¬jû.ìnÏý¦ÁÚV— IÿÔ›èdï³bJR‹ô«ªÑ#´“–lï¨Ú˜ÑåK‘¡8‡xX3¬CåŤ H4ð|å‹YI‚¹Èm”Z¥^M©Æóâ^K x-)ð„JVáSÎôòqçìt&·³^±w麽K&hà–ú?lPÅói>®…/°:ß^£…ÀÒ§ö¾‹?¿~sqv±“¸ýsY¥·?±êðS÷=ü¦õ’Rt@5þK·JÏ^\üõ/Ý,}uòÝéÛ·ðëÜÿ:„ÿÿeâgðËøÿ9üÿ쯮¿t'é³Á3|¬Ö_€˜Îñ—{ýd¦¿äúKÁ¿˜v¾KÇgç—Å߆òÛ)üÿ9üÿ þÿGøÿßàÿ8Ö¿»gÿ.Ïš†þì¾ü³kèþÿ5üÿú/çß¼ú+ü‚NÓ7'—øiÉ¿¸6^œ½<пÃ$a¡šC“§B²»|e‰m.µt~‰6èGŸË$·â=S#ŒÒ‘h͹|?'ILöûª“Ðet;騻G%çzrä½7D[²](¼&Å“‘nQÒ}É%.,òx{[Š»ËÇqôYyÿHI` cDAÖY`<Ðùëî·ÙÆ\#v5=ðNÔÑÈl/gÑ’WBŠÙ£î„ ˆ÷YsÍÂaÕxcCCCïÙ–«†¾íË¡‹k„ÕâÂòenT_&â“8›Pм!×–˜¸¯¤ØT«e9Û0EµQ%%Ñãá‡"n `5l„‚©÷Yß©ñ««^)ŽÖîx&%ƒ,yöú)».h^Ý® vün¸¸^/ÄÖ ]‡E®Ÿ,¹¼0LõgréwnGâ®¶.–Ûlù"†tÈéExìnÝÆAf8Hಠb3ŠN_0ñið]öƒ¢ÛÂöQܹÃ_Ì j2^ )M—TÝö ÁŒ$^¤3Œë¦Ïqàmú1o‰ïÿ§|HÇ‘%jåkVà¥ËFé÷%%ÔÕ7ŽVl Ëh Ä5ÓÍëŠÉ!ˆ |]J2ã›NpØ¿ésSÔÕÈŠZV؇3ñs.€¯ 32…“å¾pâ5Ó&µ`¯o°W¥Ô]S+Aº?㲕(_Û¢].jí[˜TCWœg,¾ê¨¤cµ$VÉm„ö`Èç8äl×?eÈ7ó»©o¿@aì)7FÑC(3’Zà# ãPc™¤ƒ½ßÓ™.*5—/™ù–†/l‹•_pð`$äGoìÚiϰcþÚžƒîôª´tôÄ͘îrì.ÿG¶ Õ—e=êc)?¶¼ÛAAwBKw±T𧜢¨ØðSñw<5rjA’´öIú‹žfÔµ¯-«'ŒVâH¼F»Ã§´k‹V4|J W4íl*~KTÂEÖÔ·«++†•ª/1{ê†óœ ÛØïs¢2‹»»Ç_£Oáöù -†ÚûÃ^Ó-êëÕ°u…C¸šùµ®¥ñ`.þÒ…æ£F£Õ_=ÕÃû¥ëúëŒïNØ& :2˜çüjüæ»ßR€ÒŽîÀ:¬üåô>Ô°Ù¯éþ܃¤ß‚Æ›wéb®î «ª:Çç5\º¹C„µjœ!ëÌ'ܧ°cßß5 ^yUw9°þ/_ ™Gú{»˜Ùež‡NL¦0øC®UÕ‹ýÝÝ׎÷Ç t6aäì:…î4y˜²Ïدà ’3¥±—5Pp8vƒQßÅßßKªVМ1‰¦µ|zM;NÐ ÚLš³qŸœ1Ä ®ŸnÔ7¢!ãÝK‘‰àÕ.¨ûºÝ§ô Ø\öÎÁánEžç¾ôКÝðdÄ+PÞ¿@ÛŸ•œM:©|Ïa²”ëã˜)Å=W5p(g¶ÑÔ¼I¨•Øϲµ…™‘…È º¶n;"$ƒ8#šò4+†ÁOrEß#]÷®Qɵﯰñ=/ÐLpµ •»Ìçw|$Œ©/IvžŸ|uþúâòì™Ø¡/IÜASRyàì 4h<Æ9Ö`ÿ¾#õ(€r^Ú¤[ý½m§õÁA }@C×óÓ'ß¼¼ÄÓ}úöìYúâõÛW'—éÖµ&XÄbíöñ"Émî‹ä]oS†ÜÔ³¾Hßu65`³aVàšÃî5Ö”¾HGôÂK.Oå/. °ÁÏ6ƒïÝ…Ôï»üý1Á©¨þéôx*ç§.8Ó‰00øá•bݯ_¦§ß½yyr~¢VÂÔ:•+Š³Å˜ˆSú÷J#bÿ¶Iº¾vu‹ý‘­W3NñÎ%î©Z–„§ùBƒ—öóM`1ÅÍ ™!á‹ /ênxÇ,þi2Í\N# ‘ÄlÄܦö¶|‘–ãñb^y·²F ؤôHd¢³ôíadÇîd‰¶5;ã|2±Í-ŽÂþ—³%3C¼dv…ÈÒêÜ´äÃO4•qà¬Ù¬I¿râ&Æ.3ا Ÿ%c2ðLô2Þ°ÓxÜ Ö¶i‰ïš(t˜µÙܱ†¶Ä¢}†@óL/8Þ‡ÎT§¡Ö¨õOÕ˜žú1A™T)ÚyMÖ¢¥jÇ%˜²þÄ)R™K§NÖ¥S+mj­‰û”ò½u4¿oLO²-x¡ÀCG4Ii^Ûäà^+"pBÎIQD™K$%ïxÁa,8&ºÂ² šH8‘®V˜˜U[±jŠ~¥[AÈ6Þª§©6+a²],K[ÞITšžÉεã«ø“:ýñtgåTc‹&ä '£^• ¯‘rÎ;aÖŠËYÁˆ5¶ŒýoñØIãÕ±SFZÑ~£ À~3t;ßn=qôFѽ >‹Fä`.sÚÑÌX\jâÒt9e­Q§V^6ª s¯ètJÊ;I3¬\§e©þ/•X/Öl´$ñV \³|®qWÞÐãM­|$±É¼”ò8#B $†¼Ö…*µ[:’(Ũ =|¢W|ñ÷á¦RbR„à«%OF£d(¿îîööÄÏǪJy:„¯=|²‹x¹ûŠ×;ô½á¸aVW‚»´×µ¶8l´6EZ J­Kàr¹Ý?Òd©Ì’‚ÓݵL|n2e ñ^“JµvM¢ï °6œcüˆGëÛ¿ÓFøÛu•ª–U[ß×ÿåÝ5%nl¹Íp£p`á–ÅOx»Ö<€¿¾l‚Ã'Lðèh¿Ðvחⲕ-Ûmô ï@pãG~ó{E§mmÁµ£s$t“]nBÇò“AYmÕÈðÊEÐLZ/Rô k/þ‚'ŠíÐ{v:{átÖภòF n/ ½© w Š]qð@7qúÈ7x<Ú­çÅdBxð‰UP¼"h¿øÏUÈ6ý–ט‚èÔÆþÏ‹÷”tšÀƒ ¯Ï<ˆ”•æÛJÝeŠh1a7,XW†v“ƒÒI¶B¥¤d¤q®Èþ=§ßlv’PGSä‚í ˆyKPåÝêAd‚ý9ŒH»¡G³‘(kþˆXø™:¼â”àáiˆÅ"ˆÌ  ‘Æo­¦Ô7ðk’§áפ¿fGÂJvbüš@¸ØÄ°ÌfVÈgä‡Ã"Lße[z®bޱ–È·ªNp{¬~Œ*!¢¶¥[„åE—$#,êGƒï!y¢H9¯‚¥¥öƒÉ­à‰‘;s¾¹í’^-F;0®ÑËŠÑ­`˜äiþ>›Õ­ªš–+§MEã- µ!<¤vÑ"7[k¤‘ u´áYÞ:-Çð…Ýqh9l!œ™B…IŠÂèÃ_éÔã=À\¹àåê#Þf›¨ U3pv0b§,%[Ö_éÛê)Ãyj;­ãem¶ ¯M0åsõªP"Ϊ—V-F_üòqõ‘­4J©µ‰ô,RUJS=µd<܆ÉJD­C+’/´¤‰g)ºØÔ`BΫšhã>ÇM!™Â‹=Å”¯je*†8Øê8K,KÛxX/†@(¶2ûVn$  “Á–ª(ðLÝ4ÖŒòjB,Q~ÐÙÒBå3W«Fm–å²7é *”$#‚·¸k&)¹þ -ðPùR"¡m™)¸$1lÛÖŒYu0œ„®ÊŒ…×›¦ÂÓj™æü8Íöø½Ø4çnš0r¸ß3¼+9QÛFö8Kˆ¬ÀëÆ„0¦p‘X¥ÒÈ[4äþG œÿ2täpë ’ƒ¨}ö!9ý7B2-à? !™³ÿ_DĆæqlØiû8‰±•[-½P-8ljÇ9æ[m`à"ÓtšE¼‘S3¡¼¥ýh•a$>g´m¶‰¸=³i˜¥Si¶¥AÉ ”—ÈŒ.eðäŽö,â§œk ¾jdÇQJB)— ü”-ðÌ´‘å<'áœqÆd—Ƴƒ Í Ž±'cò4»*ɯ÷NŠs„Pxg’~HÞ´ëbB@[X¾L J Ûn?wöáèÐ…ò"‹Ã؃âf­¼‰þ^Ò&8~1y78Þ$ÈøwÃãMr“Âë3'¬9rËð™8-fÿD£$UP3ó[A¯Ÿ0ãä)3NÛfÜV•aËÓSq•Xà¶dSH´6ˆn×dÙ$„„º×¼¬Ø3YÿƒI«ò¨.ð9þò“ïXBI”b.#–à]a3ð`ðjà´ ®È?~võ³ê솟2;‚ßCù”:Ò@xzŠç7{¤ë\Ϲ¥ËŒIŸ<….KX‘«(àe S›4õØ@¯¡Ëgê¼äøÚ+ö_J¡BqaÊ„ä ë?­ÂÌKx£L¨2f#SÂA³·Ìª|Šm²‡xVê‰Q Ã@³p½Ëy:8îKÊê<âï­°ÕD½>†kQõÑö¡Tµª÷W‘uHk›fx×U˜Ú"Pɤ¤éIå /típ†j%§ NßS_TõŽÒ´ßÛCC~Ÿ}ˆ>•¢ù?¤»ý~è‘è…~lÆà¦Æ2-©­v×fUŸAûWbFç/?ņ=ÑìEmù°í_â— `Ð;òÍÖoÀè`oÕÔÄÞï5Ëæ¹p¸ËÇ`§8\»Ãf7»2<­_âv}µðx»¶ƒÏÚ}á>4LåH:ÚMåø/šÊ½Û‹îdxî8¦âß§Î?1ÿ ÿ|êŽzý#ýáN]»Å+e^žÁâ_æü zûúsðÿ[ª£Üïƒÿ4T¯78Úû?‹ã~œ)ÒpñQÕ‰îÜ/_öáÿ„x¦sªÑDN?LÀøñ@ïV}µ?QˆU Õíá²ã`s:Xm£l$ÀpÍäa^’Ýã šfX"yüd‚ÐI°&kqÙÐ>'@"žÓV ÁÕá&ˆd5XR9뢴›,ü©·U¥¼…‰“¶ƒqµõ&07©t•ßfï‹rN7Þ^ÏVcL"l³Ú«)9°!ê~µ0‰ -Ë÷37ƒñ¶$´¶úÑ ×þlMjoÍc_µxÍìu¿úxºtSzI#(‹¯i€²¿˜[° <ôYåÅD]ãø9Õ¤û}R­ð€ HÄG— 8ZýQtƒ¢ZËd åk«E>±ß¤ 4VÊ@SÊp¹l-*C(3ä<0„pYì‚%ÈNð™ýÖ¥S[œ«[ÚÒvwªâ¨ÑB¡†Oøé¥ý%>’T:â…©ÜÊPm^ o°I’Ê׌½à.:vû;É~'4ѹ"ŽôØ®>¶Ë¸ÉM|«8.9º¹‘&ïý.-$CBüw%4"JÙ$Oçit˜sËN@âvIæv‡¹Q 35ÏÆ²½úÏuËüy²ÜŽ1¡¥j£®‰P×OI–ÿˆà6Xò›æ =[÷ÃôÞe—3µ/ÑägyÃBßô'JU†;‘"uÛó£å@g­‰zsŽS/´¬ïSßo—#gS ᨴflþA¬ñ®™wa=`LFyÂðSSŸözž£WI‡f#%&eÈ´î‚"P"Ô½„‚p3Ø$:٦ݘ´ºúÌW‹päü#H˜ôé$‘ÒØ+: :ýõgD«=þ’3’„²æ§‘ÄìâÓfÐzL’à˜¤kŽI’ãÎ+KŸxF<íðÕ ¦ôoIÿÞªœü~Si”ÔÊH¯s´å'&m£êÅ-Nõý’c€HæTðvµÙcQ€9¹3(Áæ¾,çè€ÙÈ8ï±gM#¬i•nQhà«‹çå Âú½ºø¶˜MÊ¿çºMqK”‹ ø‡ÎÚ\ÒPÙïÛ(m‡àm-USÌ5:Û í4çø!!?æÈÁCD¯ðYÎtê4®‘©3Pä ú ²·újS÷‚•5õzfM,2¥±$l¡p`Æ7s£&9• ÂÒ;TõÐRâ½øÛBÓ+¥Y§£á\™åj­-W ïuRF•n¦ß×ßÏ:¿=îmXƒíÏ}?ÿþúû÷ßÿvõÓïÞÑã››ácZ¾À£år½’06ÒÏF¨ ç‚«1&vóghï\Á‘ÿqG<Ê¿ÍKEµ–Îùî.çbXÂQΊŊêè4—w|m®­Ím(HÓRž4p}Á³Œb|ÝIÏ9· ®ÛUU5g3Ãu 2™ŠÏÎÀçHh]™^’X!G€ž+©P!¾8A#tÑÀFöqÁ2 £³PÖ»Å3_‡GZ£{Þ}=ãåg^ç# ßÌø {öŸÏùóq6Ÿ\fÃTü÷5[΋¿£F:ż|ÿõ{þØÇ=×=V·pÈ0@L.•fzDÖ®ë|ƱhÒ쓤T‰ û0A™YA¨1Í ]Ž Ü¯Çt" ‹u/|':°= øtß·”xGÚæšYê€Y“Ñšs‘5¬âi¥<§-‚…S?}wvÂuÅO40~%î‹¿Tù]1.§ål§“ìð/\MkRÖ;0›72¹ÏÁØ›Çõ6ÕTS)|À†žÌãSåK££NâQKe/¨W¤S‰ÞB/™ðë%m[/s½wùyèv'Ýz÷ýæ¶Ï!HjÍ8¶5É]|_4 ’½&³þC¬šp‚‹:á@+JtŽz$t?mÀà:{X.¤$9Gq¯rò‹¿®¥´XGˆ Ÿ õ‰y޾K“}öH4SB{)÷Дë¨k]ËÆTê+诮òéuËùìøBwkmuîÕ¼¢uÿžÃ†ìÆ›z‰Q HÙ‰¨n3¸3(“ó%abß¿ñ%}OyDÀ¶héïbm™Q“e³Äò²ª#1>ìÎvüI"që9ç·2ô*'gÒìšl†Ú`Œ2:g>ÝÓœÐ%|VCÈõ%æ ª¸MŠÇÈ«+¯:ÑÆÛ`œÔ ŽÌ~<¦¼+.Î#ë³\Ê5È„Gbuk‚¤æòñ‚$b·«œ›ÆWªÉÀ]Açá}§H„–­qá€Ú W°q|l[Îò)­wX 'd÷©âŒ¨ùû\ ©22%)WÜŒ¤;´‹znµB;ȽÊÅïþû¦@ö¼{·Ù‘C¾)¹ižã/ߡ̢5ƒŠ¹“ä¨ qTh÷Á4¤MwᤙŠBpZ[áÄï[Šõä¹µ<°©¤áâ¼xJp¶;8'ÊçßùÜýß#;< /Äæ+ùCˆÛ&ÂÚxb)m£Ö Ç~f½ž >SÊlæ.g¾Nkù¦ú½[<ɤRDmHÏÐ0 MJ>õ6Ƀn uJijúwÆ«‘…rÅf’GDà®q},zbmæ94ë&½vIvL³g\eùKW4â– ð†×Ÿn ¹¢ÉožsA /ÁQ7ï|ËIrõh?ÃO;5‰8Ô*¢hQS·ž ’'岬Ì/Š¥Ð¾Šcx/½x¨QV*´‘·Xëä’-îOiÅ*`-¥¨ªŠ}™™/Pª8U wÝ%Gú‚€6‚Çýp˜¦z ™>w6…X“C©D49JÞ‰4ŽhFM¡1 $)d Ž-=(κSPt°ÈÏȶ0„ÔH3ŸÄÁ*!»u© 8é´‹ZUæ¸z Û-€æ…N»LÔd­Ùüƒ– dòiß'rŠ’‡“UÂÚ¿sÎ^ÿ–%ͪȎ…­;ø—Yâ pΈžc7¤žË¶¶…÷§è3y¼—d¡ÛâæÖxš랆SøVäkMßjWG óXLU:ìs!,Ù Œ¡÷9ˆùÒ§³4ìwÒ‘"6¢|Lù)}mÈQë#xo·/Õaðµ®vØÏh@Ç}·ß‘,\^Ô–• s`Wà_Aœ4•‚œª}£tÛ®åa^/¯oœ]m¬ÒÎÆþ(*T澟·… ’'&rö ÆÄ¥îV-n†P %ª…¹Ô“òOZ£L”bZ§!:Èã9ë=Žnâô1Å Ì,‰Ç-ñ#…±ÏÃzìèVÇB˜³x9’º,áB0 ]\byâØrÕ âwVû%†¥#dBIê$œ&I{ö&x¥ý w"52j Ë–“e¸õsÙ"Õs˜µ×vcuq™áÛë""vpEœ†RÜ+¤}¤¤-ÜG…Ç„©JiŸ·îã)ˆ+¨tEìL÷ ½S! ZiY-¸„‡°cÚ1Â(¼‰^»ž³K’¿Mâ¹8ªh¦RQ8 d3‰P—‰gBÈ„Å'ŒÇNäZí5PìLÑ;‚vÌ}íeòu¹ ‚-6ØY{ô+[Ǥžg³j*` m®·ŸÆ[ÂM¬\‡xöâéVùC)‚¸. ž˜ó½È’DUrm]º€,Íóé#[D_(‘”„Gc¯²Ò›—pÞoƼ7AÚqÌíÚô*Ehï¯*ƒÐ{‚ÒdKJ!>6–˜æuÇrØTjon#dN¤fDÆâ†E‚ª¼®pù9yºË:c—û¢§»½ao·GnÌüB\s_/€ž¤¥ér¨çwkqO¤T‚àÒ•X5aOÿüá_F׈YÓè‚&z@f‹.×0¾§¹lq®!E AÖOD´ÆnWrÍUä‘Þ¶ ³C‰C"ÊM)ٱ ElÕ%0BDÌÒz¥Â~Ó“M&xeS'MâQ‹îpã9E(æ°ŠÛ²ÅK–-ÃIéC dt¸-þ8ÁUª¶#Àî¶{-Åø¬V›øÒm­`Õo:ñuðL{:¤¤ð:úGĆuLÛ^…^ÑÚí`“~ÞXn©E‚ŽÔ‡4Híl«B—ßs»s+ˆ;Ë«.5ÖɧƣÀÍYü(Œ1{e*Š&¡9»—ж@Ï>iTþ†Š}ºÃoŽAeE—ÚìÊ”[•hyó@M&¨¯w=vä(Ì;‹c„îíu²I°-x;_Âå.ˆ𢠖à8ùè5hÛŠ*ñ°ôW«–B׎UxV½Ü[ïŽ7·]ÍÀYÞµÖ4‰'‘Ä$¸ÕZh€ÝU3¤}nl&³8‘Ìbz‚IËS˜ õ°b‚r-jWÜT±ÆNWSª‹6 tOX¤Ô?TèXn[ᤠ!US + T%ŽŽØ(\%Óo¬ðÜ{Ö)XÐáëSø¨"B£*ÊiL2T?{›‹ŠØ/^Ÿr…e*þN#µåðþ¼¼Ÿ@¾‡6Õdj-,¤ÓkI¡ÊÙVÆrèTêzQ(‡ XPKD#/¢™áÀž1»JEh&™Na §/e› 4š|e ÖÚz"˜sF o%Ow|Öµ 0m†Ž3*¡AE2dËjhÐ׫jb´Å ÖWÅ Ç>¶,ÆeÀž©àC®’,ÃO“Ž‹e°kÚ¸eºŠ[j,…ÂÖ>~«.àí/ÿ]9ás6PÌ\¡^^q€¨‰Ð%Ù{E­ežßI°I(‘H0»Ž*YZHÅ(‘5QGŠÐreÍ’æšñ%j]_¸°âŽCᇥ’Æë¥’¢R8`ÆU‰Uëmµ ¹Ù¦Q¦åüG¤.@QÞ—…x 4Àw& —Æ&<•‰¡2Xöúú1>í; JÜ «7#úÒ­{€È`¨Ù5FÇÌÑAJ±DN”0¬I­ž<µo¶ pKOü®°ŒF[á"£€z'_=&ü==ÉoQ¸/hžå솢ÛoÈ+@¾bÙ}´{1âÝ Ö ÈYT7!^¥ß L:—ú(©RDÀ{Ÿ'‡<ê$Ü n[›Æºlw’BØíŒqΈâÔ¤üt$Îñá-¼µU½¸/&Û*²Fñ¥ Éê©ê¼AO3,R)š½ìê ô÷èªÂiA„êØyç¡ç0ÉmÞ8#5hLŒ@žÔÂ<¨^îÖ­ot%Ä9þ—Œ,š',&€NªUjn ÔÍ6xLEuÛ2ŠÉ+?[ÚãÂ)ähˆœ £GÒd­¶–›Ë)D‘†(»FïÎdÆ[þt­¥UBÍl„¦ƒ‘è³Äc|œ©­Ó~»tô|ɶ°›û¼DÔ¢bÞÎßõv¢eß?âúµ¸$¿k˜€€P­q•¬$Ä  ã¹Àýr`¢®î°s¹\ÐÛ%ÉsIJINÂP3¾ä6qmÒ™5Îë?ž°ÉQbu´}ï ³j:1l '6%¡›u|*TÛòow94Ýöµ5jËðàq%©ÄÒy¤wMók¼(*ÝǺP-< uƒå|àÌw´ßc17zàá·AÊÞQ—)§Ød|EJ¤L õ€ÉÑŸÞ°å,IíqIhb¤:óVKÜƒÍø·pÆ °¤®g”EÊÝÎYb÷’â…¹¨0ôuÁvs‰óÒg¸*9‡PŸIk­/KMõrd¾å÷G øÆÄÁÖ0X˜‘D´´“Â×y—uQp~á:s¬æ)"N•1ï¥ñŒa4°@øôœ+²óÁãrÚ½ä̇¤ï^¸’3)‚5g@jHSʇæ¤hù>¿JS*Â5Rä_ø|œ¦TV„k‹È¿ðù$M©Wâáó»*+jG{)±Ø´tÎ=%¦'û¼Ä ±ì&íÇÐoc§ä×–µ6RΗ½éÎÿnø ·gA7¶çƒ¿Õcˆ[ÌÎgÃP…dÌÏÅŠE C‡û‡ YÕ,û í©HÄlÁŠO…"1°t2Åv‘OŒå¢Õe6\üÃnŒŽ Ú†‚Î…¦ HÝl¥ëg€ƒöÞ׌+¯Mp‚Æ Ÿ¹"³‰­°.ýÍ,1×|‰œ›åÙˆ=Ìñâˆ1€ü“f¦¼ð_Qˆ¦Ô¹{ª£äjû1ºW'TUÚÉä±a7>Ú-°h ùayŒc9ndµ»ÉÅɦÞ1׳›mMÖr©bŒ…dÙÇë<@‰æ*h:MLm+e„Öÿ“•ðÏôïýû5ý{­I ÝËM_ŽºÀTR)â,æÖbNw„!„f/3žW0<ŒTÈ•ÄB®ØûŒÃ‘^ÿìÒãÜkæÍJšk@`d­ø$\&­mõ öÝh°ßžË?ËÆ˜ø*¦O“Ôõ`»4W+§¤ðHõ²W½ô¼|[=ÍO9 'Cw”¡¼ëvåÿ‹Íïgß×Éÿ½)¼Ä“Ò7)~ƒ×=ÏèÜ0_|‡ )úµß7;X5›±E ¹Ë3hJ¥üQ̼§’‰4Êsš¹ZœwO[“S¤Û ]÷ÙÜE‚‡‘ rªo»iîc3£"%ÒR…—G©MéÝÎ[ùya¹&‘Ÿ‘,TŽÎvkØß.ŸµÍN§N~¡)ܵÖaÁ}”2-—6üÅ~“A梘ŒÁ3©llœ CX¢=hb;-ñ~ÿpÿhoo8€3õw)p¼Êã™2®†/œU^ÕùÔë ½k,“\á•-g›È~oJŠONÖÕ–=¾¯ô]¶é<ÞQÙP—Âóî°)ù‚o­6$2’Æ{—¥Ç„Ÿî¤[>ÏÒÏÒlE¬o‘=äì‘™!Ë'ÑÀD°‚ú-ŒÚ‹ØðÜMYNœÆÚX°™¬àU%tªzé7(pÔ èšrÄ h- TŠ¹Ç§jSÜ¢VÄæ‡›mpe¹CçHúæØ4Ÿ×;¬Í2Ó¡ìuÒÁaÇV‡x>” žT_8—QAâ|µª¨“'ƒ~Æ»Ä1—èW‚L™s5!ßMŠZ ãHUbJö¡€¾)éгR’%òÊðMU–óÝ9ø(Þ“€c=5× ;v¢EèQ\4£¸ãjfìO¿§| 1a'\å  8Oä°æáæ<n&ŒÉÔYU×ïf1çˆE àI *¨–^Óf”­Rjæ жC…|7¨„u¬Ø÷R9½§p\ñDˆÑF²×ýh x’è3ö$4»¶+iÙ µ |¢.š‹–}«D+es&ò4 SÞˆd+ïɸó‰žÓ ð†Ã`—Þ¹-‰½-)·Êå&fToë—>ÌHµg…¤¥ MËòG6Í=ABZ'á¬[Ö‰x^“Ê¡lϘ¯²$-Š™"ã3⺭2!"&Gá9ªEüÂDó½4ä>í%ó KV¥5©Äèy 0à@Jd͔׎}"•M6¤Û¥ìmFp±à?gtú;N-›M “3™u$lšIÚzqööâò]\ž¾±WL2™ ùT€ 2"ȧΣ8üNj›×-Táõ™\¼ø|;Ðíb–eÏ‘èù58×[yì›M»Wé‰\DPºGB6~Ÿ‰P-×Q…"U+Ê&ZV®$þŠ« Ž"Ÿp ¤>ÖÍÆl&–&t²¼´Qhnp¢Ö @OÙ 4eè& '‚#t¿Ýq÷>i¹÷a Wq Îh°M—9'c@b Åj5ð¥. Ô™ž£Æó¨q4¢uúKa•>s«oS× Ëó ñ«ø:–0Zà†Eììa»©¦‘K)qQ`šÄÖ£9ÈQƧ¥óL´ ÒÎë7—g¯ÏñPqê¤Ý®#HøÍö š &i ÞY­Âu é¹&'h"Ññ¨5ùÇoŠŽ9ØÆäØ)¬â¸l-=’ ’;$;–äÙ‰³¬oI³)S„äzŸ·yõÓ(*žz~ÿž€–aàw*ªRt匇õ­Š_Á’ºâñú ¶†¾%ê|Š 0\Õ­Ë/ðÊÞ ¥vÀqtèlR’ìuUƒ0é Í.•…[!ýz*±'>ð­È]Ð%Ç+hеu‹má%ÖÕºœzºØ®ÎÊ»î{|Pn¸}6„ .ýó¢âÌOüþ2ŸßUñÅO][Î[¼«œ¹ŠÚ“ôÒ‹ÒúOÖ v© ê˜ ‚·sš-fäI0Øßë3‹ òÝ“Fmt'¶ü–9ð·r‹Z<-œøPÄãxc!²­1úÇî°¦–Ž–‹÷”W¨­å@T+”ø,Æ çbt\4žÊ«öœ­[{!Èš·ßæÒGàáe,¿{òº¸(éù" ðöîÝ¿§ÃnÚýcj bœøíÕADº‚&®‹H¥HÐ5:gô Eˆ®1ݶG·Rá“ú°q­ðc-±t‡Gƒƒ~÷h·ŸwZÆvÃÁ`ºó<ñ´àTZ¥5¾‰4ü±¯Ù‚‘m|cã£ßµ¯±D“¥ý]czo¶äý}Jv[;X²¿{½áîÁ~4ÜëÃî´î/¼4ÜFxâi±’´JÞ7ôÑ«½oÛYãXúèÆlãkÌ;òÊÈ7Þx%ö’ÄÝø­|Z6浃%[¹ßÀUÝîîr]½–­Üëa«á†a!¶•«¤³¤UZã›ûè-82¯sì}tヾi|yN^Ùõ§k½\Q7vŸÒ‡ÝßÖ–ìï¨7Âöäݽ–ý=è ûƒÑîp4êÖîï``Vioôã·`h_íXýø¶G¦í5^Ù¶ÆÍÓ¥ÍS‰h†ç5Îs×¥¨a5 ÅJ1¶Ež¯„Íñ±{WÝ`¸¯ ¿`±Ì9vpáÈ$¾ë§ˆ×J%$¼À…zµ¸òa2Û?&h'±ž¢x\ИA"æ4Ië:7Ü«N÷#ߦ;j.‰±S¸à|'¡tªKl@ªÓ®Šk¬†¡W (Š Ü¡Ëu’?´Z6‘(Ï®5ÂgWK~kÄ~È1Øtùv¼š‰†Ï®æ‰~k!?´šu¯áᳫ »ä:jέ¦aÇ+ÉY¸êkÈ“>û‰$IB­·þ‰ºŽ+ „D2¤ÑªpSêú8îPl è^Ó©ÆÐâï¬6%Õ‚ ÅŽirŠéf;T ÂÊQ >…¡û;‚_Â0ò\ÕôYê>vM|cõšø¼"̾XJ:ž,ÓüêÑŽ èe9“«éb®Nrx¬¦ÈúoZ}žú`S¤åa*ácI“Àô]Ú-ýlêð[иG½£ÉÚäú4K‚VÓA«ºQß=ÅÖë~‡»FH.dq³NÁÖÚ!lµ{‡+]%ÙÕ:FB·vœŠñnÐV3ó-id|…)ÐؤjÙ=j{î3ð)ßä&4Ò£;:Sm³$΀kÕ”:I ý—k÷(!C™ºUÐeXÎk)i5̓ÊnPFe'«C#È>bL³ŽÜ«»¬ߺª;‘@@£“í? R e+1Áü§ó±ô©üæ)Œ.}*_x"'|ýþßÊ ÷/Àè~÷,ƒ»¦r{X'¥K«áßÔ^Q.%h‘é0H`V\ }à‘×S}É»àú¿èoWÛ¾´Nà2îq Hª$ÐÝhÏ Æ G=Q2Ë\0ÄÌs¾Ž»’µÈ=hì]º…!,æ–»LÇ;xgþØqXhÛq fD>¹Ã¤IOQkQ£ÊöjC £J„Qa{Y³Ì¦B¡4¾P_ª2¯Äd (íW…h¶e•Ï\˜Ä1 Þ„ øP÷’/Û·Ž"äÖ´¨yÚÔ2kóãl>±û2aax°cw˜ VåÄ9Æ% ƒ ¶Ã8çªRLy²d1ËoŒG-i©Zy).gû¿òN`ÿÙÕˆ8Ì):Š`D‹Sk”{ß«a1ú²åµîmªUÊâŠÙ8Q jsW"ñ«å܄ɟáKݺìrˆ¦&‡`¨FO‚¢¦R0‰| ÅÌâDý§l8:ª\Ë’¬ü6Ë$‘x3w’üÞ‡RFBØK,ϨŒ¥× B•s›’OÍã‘_ê6l¾ï6ݾGI¾šØVéqçÄÆ,;êþà3íNYb¶?(ô®Íi‚¡-6ÑwiQÝeñâæLd²IÖÔ«žx|cS9}Ô@)¾CXȸÍÞ Ð8@¼ ÝQ{Gp™$jW #ûç€ÓYb:籚*gH.ÅʧJÞIœ žþÄ ±€ 7’Î'U,g× òp©:twë.{DÀ=ÄÏÜÖQ›DÈxÅi½ÃºÕ÷80¼Q"u£»˜™$|Âqº÷þqW~C9+¤»H¡¨ ìæôÀÒ%g#L¿Š j’þ³QfèÁ•ŠŒ`-‹Ÿm¦Õ,D|ä¢nÞZ†%À:ØÁD9‡¡–˜£NøR¤ïÀàp™ YOÒ­Yé¹s9/|u°»mŸ¬õ÷tp¼×=Ø4_„ØãËô÷ªû‚p`dBa[¬½™+¦§Õ;| ‰ÆŸ79ïÁzœ¼¼â‚I… ï±$ì¬v`p~ñv Q᪪¶ÁÒáñ¨»»é<¸¸ç–”g<’uÙ­o“`]R».†w,ËÁ5D-œZ”¢N(¹Âa!¬³k¸ÝNd·©°giB+[,GAk÷…cŸÛÑ=«"l'R£v"Mh'Rfv"}d'Ò9v"½b'Òv"ý`'Òv"9'’åw"y}‡À¦’%³ŠGÊôš„ù”K·# ¶U`W¨ îmd…a¾;jÎdÓ‘‚c’g*-¸@1aÇXš} ÚzOÂ4°_cªûŒ²à³+aïŠc·¬²°HKŒ@6ÆÝŸ#‰¢D˜Ébœq—ã°ŸàÄV|^¿¨K'Áæ(¤[ÇýI—ü,?—­ÇêÕOí­|*]uÊW¶{ð¤§W>•®º3«Úõ7iåSƒ•O¥«nàÊvŸ´?Ãuû“ˆ¥W+œ*óUŒ¤·&|n„KkC7hs©4ÎàëÓ¯kúOÊGûR~MoÊÇY‘>Ú£òkúT>ÎØôÑ~•_Ó³òq6©³J}ª]êƒ ©”#5²X¾¶5c«o 8eæÏ¨‰»,ÆÌ<Òí8wyl¨ñD^ÕëÐ*ý熻T­ µbad,4¯& Ör"œÖ義Ë ÀÖÚÖpÞþ!Hýìzxp˜ ô×h° “%ÿ›òóaK«-ÓÑÌÜNâ¿9æ-8·´C³¸üs^Ö?Lòk ÁhùpØòaªëÞ×)¥f}EkššUžä×eÿ(IõHÃé§v6‡­1Ó§çÏ×€Þ¢!bH4ÿsòáLuQέ.‰îoþ´.³çÞäcb_FéÖVW%n½míùeÈz`ÛZºgø„Ç­·n"}_©–Öý%KÛš§šnü¯Ù´›ÌŠî‡þ™ÖÉ¥ÑäEBù×–®›kjÉ®¤ñ®=}fNN_q(öý3­G.ޤtþ5&>-M?eˆ‡¾¦Rq÷‡Á÷ûË示Ñò=ÓÀLw³ã¦õóéÓ{Éa[Ó‘Ò3L£}ÀSüyÊ‚<éÄÆêTÛ3±Õânð}#¾åç÷ ,# ÙšI\«pÍdoƒÀrCuÕÉïFÌtdbÑ¡ªõ-I)™&**®-”UƒŸ@_údúúÓJÚ¹Šêþ´’.þRªû»Ó×ÓW×οéëSŸùÏG_ ö†ìç¤o³vn5‹™×˜P©§bã[õ|1t#A‚ÖRhV·m¢ÛC°™LSB,¼ÏÎAšñe<»Nz?EÝý¹ ªOÊ;´ûO& -#v£æ 7‡µF¯EPZ[.äüê1=Ïj»ËëÛr²ÝæK.‰„ÍÔ—{ËÓ-,ººÄ‹¢,Dúqõ¥MS>Ž€%ÇôàØzv3’ÒËñ Ãâ—šªîü­b%™,æ>y’ÊÀ“gÎCb«ßÂ8nœÙ¤òGÅà†Ev'â›;7܉xÜNÄÏv"Þµñ©%×9â9;Ù‰ÇNÄ$V7»=¶ý}ð´f£ÇŽ¢¿‘ßo-BìÿYÒͲµYîÅ UuÝ\½p‹£=^.ë4¿Y*å¤ÑdÓhritbÒè„¥‘CÈ­žû{ý½ü½”âHIÆYßÎs G•Ï8*¨”P=^™®áW&šíÞGŽ…Ï?6Žuž‡¡c½ô³i–é…éøÊÐT6é6Gü­F[“¦ÂMâh`ˆœÅå©Ùï,K\šå÷¨ŸkLRÿó4¹;~c½¼¿±^ζoÄòuÛwmîÂXž¶ßÙ/–]]ÓÆ ­X`ŽÛnϨí¹X2ŽÛˆiôŠ1îµµ‹¾qûÑ >h{n•¸˶qûE8j{.bã6"*2X±×KöåY5—•ç`Åù\êÔ¨\ëÏ*y3%sú#ø, ¾YeÕL•jz§éa“º)Þ‘æm¥©¸lM‹RS ˜gfu¹DD‰{Ì€þU£™v=§ BŒÖäé&%Æb”áA¸Yjð“·ÐωÌBY²D‹eÒæ)ÙŠ"¾ÛÄU06[ìÒÁʥÓÂ<2ŽÌÕüò5q¨Ã6 2 IµîÆÃº+«:Áѹƒ³ÅEPYM1޾žD[sä¦ã~ˆËO“BW+éÒÌ1ĵàÖ{.\þHÒPF‘·©>ÌÙŒ˜íc뤟Á¿8±.ý…ÕA¤ÏΗGiXÉ9‰ðç\ ”6ìY ’þÜA}6Âj=84Šÿ.f—‚ƒJ)d{þc'Óô -ÃK¢ é&ìU·ÏEjRô{/ýÒãç/‘d:¡ B¢S"!÷t¦&9«™ØzÂ.©nÁâ9¬Žà‡Ó’D°ì š ›…dÏÈï,g†”9í›LË›Œ€¥«¤ÏUõ§;ÂO¬þßÂ'A ;H‚¿‘b$ƒÈf2¢Oì‡ûú‰ûðHäo¼”º"?}k EàLuMB{îÊŸVî&ÒY¼Ëñ<š+¢Ÿ‡g!z¯eÙä½èÄÄý5×–þÛx.ú»eøóøôÅï5wɽœÑ¶÷­´ïù“¼ì=³ß ƒït«A‹w#Ià—‡ Ð¼I.æ¬ËI}ÐÆìŒ´@ÚH»Ñ¯05\àÁe·âýkúT V†’*ZºÁ•%CàcI5àl'`$„Ài²ö±Ä;60;`. +޵k‘µ$<ÆrqíÂà ­4ú߯J¿šèD?7w †IŸøÛäOü8ˆºôs;†>}b2·cé>}bßQËx¢Ð–ºòè¾Ú…Çó÷©´‡_klYôfs­äµh_Û^ ”_‹7¿íµ`Õé¿b߉µSùiÒ¦xûøãu¤©±Ç”©qìkË Sã´¤kZ÷¶IÎäø´Ó3w¤€¦ v M£8q”Ånr/©åíI ÑßQº #ÿSМŠ×ŽˆQ%&c[FÜ–|¢qmÄ©âpyhÏçnF*š4pÔÉÇö$¸®§ödÓ)F÷ß©?£tDá³Óøü±›ðÔ„UÁ•çÂSñYŸž;õ›¾/í}Ö÷;z¤Ÿyæ:è7  ̵ÜYº!T+['^5œFx‹pÑáï'ŸEçZÚù,~tžH¨`RYÿ¹þø…b’¾ÖØÆðÕæÚ¸ÏÃny-<úyxZ^ VÙ÷œ—ækÁVðšG*x«e¿èãæ©könªŸ[p0›¯;o_³g×?ó»e¤zÇ>Ó"f—ÈXcïŒDC­wG‡û½½]àJ ­¢ãáÁéîfœùvõèªþ‚@ÂR1id!v$¤ÓÀoD„¤²Ä5Ê 9kuƒá¨·»·úÙPF2è Gô ÅJl¤+_Š-… zMS„¾\jÁ€æŸzXù¤…4bnk®µkÅnˆn˜Þv1†×›ÇIŒbæáÌ`§á‘å $C˜ìip ø›aÒõöÍ“oF¢AR·˜Í1žF×È5Žmšß@㸽#lÿ³AÔxD{FÝ”'˜J‡6ú*a‡—k阳¼t)ôø/ }ÙzÉ_˧Ì#\¶¨ò׊ui\2^–Ö{ÆKµ4ø‰lf”Í1P¤=p-:‰ù?A>?Ïëú1¹E3 â¤êŒñAÉÉïq´µžE‡ÊŽ·—è™!º¢}\;¥¸þ|ô£• ßÔõ5ÜTËã@>¤¥6ĉß4*_'­'Kòn˜W#Ä$ÜöXm§Kæó´´tÒORbß\r3‰Ër^S-NNQ6¥èã¹ &t{†6`<ÍDpÞ]YgÛ#çq¹^Ó‘žóJd5™™=ÿ«žTÉ$/ÚØ;XLxrº¸›¡r’³o£±O†ø¾vø-Ò0"îúv‡® ´ “]µžgjÙO¸¼Àœ«‡³•BKõÈ–>p¦¸Ô‚6G%Õp™Åýýq1ìjPÙ`ªS!Qå‘6øP‘ðpÝg^©H Ö/㼎y~Wø:ìòé^Ãd4) @ñ)IÇêîGÄw¬©¸I¼M™“r¡‚`%¶©¢GA€ÓQ.æ®5Ý äEþÌ[ì0ÊZWZ&¾,”•Û.9ÂãùyJÀSbJŸ/úk~>%‚ó× Åüµb*Ÿù„(Çf¸âÊŸ_=î0% á?3®Áä.›eBš=ÈÀK¾NtîcB•À2ãÌXB>Å•Ç6 ®8Ìà/ó÷R|ZÜÌ´ä46­ úz3UG@Wˆαž`É ´uKÅè›棵ÕGÿZéÜüÂô_—Ì´áoUgªV8;ó(ٵٳ–±UyRÜIÉ4a•ë=! æ=ÓðŒ ‚eÚEk\²CIÊ5v„¤?ºì;êU/AÀ,¸`PAD’©üj Ôb¬Ô5ÕmÔ‘d‰%áR΋{©)IÆ»ÀØ›ÓÐ gý9PÖ|îªér„hòMÅp¼¡TfUâ´UhÍÍiz¿˜£Û04ma’¨£¶Y:6“k¿„&ÑÖ9ÕIïÄ×0£LIcðlg°‡Ær5lypaëgë€$2F‚%ãÔ!^_:\r‘ÈJˆZèo– %¸Ž ©±A«¤Õ ¥¤’tª*à!úE—VŒò<}Šg}Û,ÃÛü­Š7¼‡8uÜ@ñ÷¢ü„à=´p„†ÂÍ+½™—‹{Âß"´h…Õµð6y„­’î:…¨iæ_»™K•Ð$30²¼ÎãL a-\rs&vãC D~fÐ0ÜKúo^ý(uFpìÉRå?ƤÓÓá‡;˜RpQfWK®ÂA¡@|啃>¤vÕ˯ax„+­BF7® ¬f ôR’xN[ª0âàª#¥ G„ó)–ÆItêByÝ\œÒÜÑý™ |9åË3­b†½`­U 7Ä’5¢ò „˜æ¢1¹CiûQkøNÊueqL®Šs6›ä\I[5Ç•Â9ro3/­ÎݱVX쥴2õ–¤ %³ÃßïA€¾+¶²z{Z€0YnMÊz»¨ŸöÒ7 ºT°Î¸Wn­EX\ýãFØ5(p[îëjê{z¯¨Þm'zŠ›a¦ŠñœTUß¹÷aûrq¨.-™¯µ„—éXcsŠ)ßRí®l‹r)Y3¢sSÔ°),ñz> Èw ¬8‘§›T%²æpwÐ?쇻´×ëuÒÏü'to¹1ˆXË»]Q}\Ôi¦o#à™YK"ŒzªËû{ôƒÜÝåÀ‹5E—xk—ah,.ƒ£ iÀ«ÅÝ}€’Æ­„á8$}¢›)).Qg£€zgƒäëAÞvvGû»ý ~žyXÞ¨§VXǀܰcT±ŒfúbY áÓò Þ´ÄÛ #nKÏryl´ {èµf»†Ýe7³¢Æ°»Aÿÿ_ÄêU¼QLßÀ3xæ 3À@î}ßÃéïPm9º|.¸™É‚ f±Ѥ‚óõ¬,“~õõßSÇ+_}‰y{òªÃ…3„ó%²"³2°õ®FoGÈøn©:|¯o>:n;Àg³jáªË*rÒÍfžøñç‰=óÆ/—€¬<Ÿ–ÙDß“…`ëšš}Å£!w~£P/È„o {©e‹î2DÄdè´ù#±Y)á|]X«,gáWÁM° ÚEÜŦ"¸èn‘5€“Y@-âÂá\iÚs3n3hªÏKæ<ÔÆ8Nö㊯»c‹Ü ¦!h5D8ßž]~ýú›ËôäüOé·'oßžœ_þé·N "g inwd|â&´X*ŒöÕéÛg_ÃK'_ž½<»üŠK/Î.ÏO/.үߑ{sòöòìÙ7/OÞ¦o¾yûæõÅiO´ÜgX÷I´àÏdu'(…í]Yp[³Tr3dK¹‰–=¹¥¡ßÐqŸ]qÂŜ˜¢€['“a xlzžS_Çi^=-X¤ÇA†&ä|zBaUxd®9LäÜåžQX*ë T]´ÞQ#¤p3p~ꜞœ­NÞçrW>÷B6Ëxª¢»“\ŒM¤N<¤TUô¥ãç+hv“®2IUêüF©3÷uâI´ÜtK4!BÛcr¼m,´ž¼rÅý™.ƒÒÀÄoaœÊ¬H’s¨À¹õÚÞFOúµPì¶¾RµöV!(WÁC—sŠD/pj÷î»äÈQøŽ¯Ž™¶õµáÀ ›hÞíKD¾Ûõ³à!ê[£Ã~öÙ4 ‹W΄‹ŸÌAGgQT¦̈aQAÖªüb¡=«W`)™Õ£›€Ê“!fzÇ4{½E“RÙ± yN.*•b8ДÄ-ºÁ§éVIP…Ã&Å€˜™ì¼›K´¦+Ý/Ì™$˜K2:½±/Ûµ"㾈äB•µtiŸöø ¨ðAwn ’¶¹ŠˆOCÕü¸í¦˜ÃzÆEaØ kʆ sDê*‚QþͦZ.­j”nö¶5‚W¹˜¼#܇Õ*¥<šI9ï(dÀ»Êl”•»âUdO/cÙ#BMžéŽ2Þ2X¤KaÖMÇÏûÍÞ²Âm9Feª ÓYíÎ_,Ofœò 졸+¦Ù<Ý]á±q6h–wdÃáä–¼¾fw([°' 0sN¨·Â7Ú#«òº~ÀÍ_³#»{·0nKtÂZÚˆ‹ÙÛm½\ÎAŨܖ~ïÕb­áí ü­ÕA×eâPípü­] OÈ-õ[AÒWSóØúÇ4z±âÑŒqójÊd¥m–v¯@ªËgãrâDÍ­“‹gggDÎ.^§‡‡{GÝó²@©kD”«Ð‚M~sù¢+ ¦7TÀœWˆr”íÇÄ`SX‡™Zð©Ì0}‚  äØ)Ñ•©ùÜbV—È:7ª4_´‚Õ¡yÿmÁúÛ=/kª4Í4í£zQ½¼òlw9Á÷)ë·7ûk^}_Ó¿×ôï{q}?ßÜö8jWI+ž¸P‚Kd‰bÒ²fÈjšÑÄ.¡9PcºÊdM½z´ÃuÉm\8uî&lëJï{jMîtÔU§lœæ4ŠŽØè4"7VEèØíŒKÐ,wÒ­wÇ0iœÃŽpï8àm»×nz²s²ÖŒuÖ8ŽágÔëw÷zûyw´·_àÝÁ°‡®ØÏv{£Ýà“Ô}ršÿŸ@ÕÀßwDÈ›È.L^)œ@Qï˜Ý\ã×r!žÐ2}(ùð8&Œv¹€jIõ )‡&˜c{à¸y,0¶_*ÈžzNæk^1™™oÀMM£ð0ñ c“ï5|L³&Á£‘˜5W ïqÓ ÝZ½]9Ÿ„iV|¢¹U …ä ,½Qñ Å½Lã¦ç}Ì?ÍÙ}å%ç… Ã"“ÉIC¸œ1Ìv³ð¼‡MTàP‹ÿ•ë,C£ Ѥ+Îyì.'9ºò­„_U¹V6*}­ïö¼Ï*1¯{ÞÅ÷U<ÿÅ3ω¢¢WÃÒ-—I+ Ñg…Åô%“i󳚤×—ºx…}t&t/jq˜þ”:1&ÓÄüfvUªùÚù$™jH-/ë…k–Õ‘Z‹åüsG òÕ«€8~µ"˜8ž`]ÒÅŒ´Pìu¡8,lÂz5gí3”` ž&ýÓ¹úÐ'E‡Ng¡ì§gS®ÎÇãG ¶ðQ*8CGÄ’åê’“§âGê­=Þ(İÌsQòù6¹öÖl[÷ïÜÌ0´×Í‹M‰™Áã“3N†cX,dª“¼Ï‹+Qi”|ìõ>—òÙµÛë÷úÆ*’£‰ã°3W| ZˆR©ָQÚ{-ÏË1ņñB¾,Æù µxï<¹ÇÂ)ŇôdÍKÍ´e?^1 ~dê°Ö£N:‚¾g[è°ß?t¦ÇûG¶…m=ÛÆ/°øs¿? ‡ôïý{ȽPAó:bD·=›åÚ½»­ëûãÏ?¿®®{åüæóMéæ­€H" ïPW–èÍûGqÚª)·ò Z¾“B)Fç#^Ikf,Ñ›WÖ_m`¢Q)‘“Óï¥oÞžž¼úòå© ¥K‰ÁpM˲“Ž}üAA‡­C²æUYþHšŸ¡S×i$lXttéÆ5¬Ú†—ÃfÜ~:)ïŽ;sóœÍé%›ò$Œ#åñ`Á€—ø%+êŽ*›9wvkf¹¼25æ"ÁÉçcfSc0%û9µ.èœdVHƒœ\ñ#™Ä:%)Ö–êÅ¡ÌÇa9%§“á¨ÝÕ*¸àiG‚{`×Ôö(²”g2:»œHU±¡°EéjÃÄÇd¶4K$=û:ÝÀ5ÄOÊꤦòLè ÁªË‚).ê¶õNbîª|ŠËpÅ{V¥ÍV%»™Œ `©6úU>ËçprÞàj=±p!úYªcYOŽ`»QϪêôUpO†GœLnÙ\ö„{å-|AÓ'ƒø†Ñ$ôÙÄÒ±cõÙÑWêÝ÷¥rôˆtÊ¡ÙN¢Ð}>÷•ŠŒ" ºžQç/U|ƒ‘°¼ï}~î=éò·±¤áäd¢ž±‹,†Oçøæ|2uQ(r@æ~S,ÝÜÙn˜éñõ†£žAÈÒsûƒB,\¸Ù$¾\ ÷t9q@|É›çH–Z€ÐʱøÄ³ç,²¹‡ƒ^zòæÍ˳gê’:9ž>?}qv~vyöúü¢í¢d[MBX­’‚^¢„ø¼m€¶Ñ#ü5uQ„ IpzC´xû=Ðvf8ÃRjôú‘v[ÝâO¡ZÈÇ9×Åïî4{P:t’n¼Ò D‘G6tJÏ9•r¸Ü£#-XJí¸gÉ‹„F+‘S¾vO>%‘:ÊEM ˜,Üçå¼a”ÄIºfÊ‘1Ö4.Ç’¡Òž©TG㻞úB*~<ØM7a:Hnsn½r1ÏY$¯n‹ûÐ×£¶¢.‰õVÍæËàïÍŠB€¶E:†š%CðRðÀ«m)/+——Æ%ŒSÈœwv¸H 0޼P”ûÒnàLn]Þ.8äÙË9äáE4ócÈ[N‚¬–aŒˆƒic#P‰ñÒƒ€ ýroö¶Yê ”ÿ®XЫ%,šZS—Z_t6Ë£pr]8 ºˆV®ãÄ*ŒÀD½«c¤®NzOY•ðŸ1þ‰nø1ûrZHˆ0åè¹a&$Wâ®gÄØ³Ù{ÒÐâ(ëQm°KD°±ëĆÔE=cË 8'Ìqw"#7»é!3ë[q¾ˆðkwa‡a¡r‚ŸTZª¬Ìô34|È¥ñfuL(bóHIb aZÙ€D?M5µ…š€WúIâݤz~A=YÊõôSˆBËøøíð,»ar€=Òql¾ï¼s­ž<˃Í}†w(½„Ûí*aÓ5‡ ñxñÑŒF‹îl¤ˆà$»ù‚H’iOÛ—ÙøGûYÇ™ä 7ýø5›yÂmĽÓÚ^QbÙÍ÷4c‹ Ðñ¸ðiU Ü+CyÇèK¤æhižËšÒN£!]4ÏQô$qB½jRÁW0çÔ À"˜¸Ç¯"{ŸÓL¢áy¾ÑžÙ¶àœ„k^“¼ö¾p5“àΗÂc(} K fyWu©’éÿ6ÇUÛýŒ«>c&Fñ!Ÿ5×—ï3,w-¹}2ÏЋ¢EõÉ …žº9ÊCÒwG¹-scc˜ŠÞ쪡u¬…e]3Û*‰<Ö'ÊÄ›’Sh•zñå%ÄíãÁã@Ê!q¡Çx× ØHsX8(ØfD©[Ü“á ²"HÈWÎ×FQ`7ŠVþ€ Œe)`/s4—·¨@nr›¤ \=Rô Å.3Í0##y7ÖÅæVΗÌxj Ä`§˜D€°€Ù]¹,$¬jï®%-‘n6^!Â)$oÔÆëû &°¡—픽2+C~Gh‹pvdRðV¡‰=Ë%'›3VÈ•GÛšfIQ«ôev™~&„ÿ«W/qÁ¿ƒÿ°)2“kœÜç—Ï;Þó£FÛ.&®K9ôª 䉯/_½ì¤o€Æ\ŒçÅ=mæ›ç/¥[„Ê °»Ù —¦¶ûc6Ñ-·óæü«Núݳt›þÇ›¯°ü­wüxÊUÉó:ãSú÷/Пð8QSxIµv73û2’N9 „WV‘Â¥$Ý“ DA/Ÿ«Ì,o1V|9­œ+ShÞThµ[z¥.|¯ËOâØ–,¶È¸Æ;@NÝhÔ4Fõ$HFÍ6`¡—(á¤o`õ7˜þw$ͪåì#aè#š¼ë*Ÿ^Ë㨮ù`‡{â»™L?Ï'‚îQbÐÈ|ô`œw°U@|Ñlõm Oc•TˆÌ%Ùø¡°#Ôš£Š™Û|Þ!ñ·ÝjGÆïÈ:Èó‹!º5OLwóžlXe¸£Kã2)„~( OPW Èõæ ¦Ï €¯Ê‰cÆD‚ì9UfÃh‚ ^VlÕ@ª2åÔªinê=L¼„ RåÆéŒÆ=I¿ûÓŸ]¯¢Êá\ÌŠ:nSfMÜ×WÔN´÷p°\3hÇì”&ü›µhÃQ+eg6‘Z$+UFÝk u4(ª~ ß:V)Ü–È&nž8¡:;Y!8qE²q2F7-¬Å ['7à¨<Ï'ª)㟧³ Ü6÷5ôµñ5éG= E¹,Ó7&÷5¥Ó¶Áü 4:&Š¢œE6;4U|cŽ-0žæNlJKv/)~ðƸQ=Æ<esØá^©ê·Çýx6p§;dÆä•–sdÅa¾qdõqq»Íž6 ©ÒÕÚaÆ&êŠ qÂb‚˜÷ŒÞå{fOÑú¬}‘BÜ©ŠÐç^atÇœ¢äÝÖ®ù‹"åWKWŽ( ôý¾,&ž© bƒà:?F7ÀMöÒ?ž¾ýòäòìUúìõ›?%{…Áq¬5D¡#åNz²ñsÄ.ŽŽ¢LšÛh·7kñ)¨<;Skš¨¾bÍ´í'l?ZYE¹œ\]3¢µw¶N&¸¾¥X»œ óhª’" ©‹¯–µй„›ùøvFöØ'ôAÑ(Ë+¶++)›—S±Feþ¢¡ ¿˜«åíÑP{øè’£-°,ö¼wžÛy”­3%j.0b‡išà,W¢qܲÃseÛ Íš–¼‰^"¨ ?$tÞGž‰°7a˜%E [ÈͨIzwš“mŒ·Ê†ÉoÑ´“Õ¢ã½Ï:g'§jT¥L{õôN¤gçéÿóÍÉùåÙåŸ|ì!×d'ÖéD™æ–[*œ¥ªÙCTB£[ì_}O6¿ˆíud)¾ÓAP憻÷‘‰1ºNÆ ºb´2WV¹==ÅL†$#RWv<YdÊ$Á YΞÉTËôsÜf÷ rü‚»0S‰-"ú4U¹§‡Ñá„Д28šdh~“e|ÞDñk•—LÈAÊë]åþl;‚"÷#† ÿ‹~“ ±–Ó)DÂ8–TþÆñ‚F¨CЛ‚\ª=s²À0uQqU®º¢ç¿—[·ïqA¡™Cš[ï]o–¾×š1šß=2ÞXœój…Š…†ÊÞ³Ž‹- /¶íÙ8v3Y€¦cT&š—I'Œ\Æ‚•s/à>PT\Yç›.0ñ}AóºpYrr&q¯Å×y¿Ðôÿ9eÐÑúPIƒ-ž=r”b­ö'©[ý¸­ //þ°U.f ÉøÊ+F[R6ñÙ—T”^;Ž=¢nÊÕk•|—’GSU©*Sn™Ú"ÓÒS—y–ÃÃf0ÞN„”×í’³œCº³¼&O’æ^R\°ßpzj¢“‡»l;?Š2È*ÚÞIù0Ã|KnÂ>ØuÑ_Ú'ܱº“^œjY ;gcyiZòMbàUÓ;èáËSƒšx,î}n(Ç% Ëõ‡´@+˜ßW'«AõŸzÄ©xèiaÂÊ™Q°Š·; ÑØVŠùdéžXèzR‡zò‰;Êtt¯ÐÓŸÐŒÓ<}DÕ”óßk§ Òh» 0 ŽÅ–sM•>è"ÕàvPÂò\ï¨lSÏ3¶°HP<ó7ôÄVv”¿9€IHljo¬ &÷Õ5¹gúS6!U˜Sx鯉5î,‘‚A6R5çß-•õŽ@%.q?ñk!18¥gºÛK_½~~öâìÙ‰ X% giìóm')­þtÔÕ;2äP=Ÿ"yÝí½x ¨¡FÇ܇WÐC)? áo¼| GXmó²É˜:t°ÕׂmâÓÁm¢Ìzkï•&})õ~¸eIgЧ¯Q@ììîµd„Ó­Ÿ”Ìݜݸ븯c0xÒK¿©\Ü’·”gšMB¶O^[8ƒÛèõ¦$wû€ì× B—5¬'̵äkÖOÌû÷è AVêpø¶DÍ&ªc¸ä)›=bH…pQÓŽÌCŒN‚Ʋm$ž€¢Šˆq§bˆï„cSçu Ja1Sˆr¦Z}‡3l}ÈDÏíÀ—=8•Ó–ý $´¢T#bÓ˜'\ôCV2¤Öq°œ4áã¢Hˆb ºyZ:>ƒ‰‡Ræk$6K¿´4(a EU:͕ڴà&ÍÈhÈŠ¯óMƒÆ^·;fM¤GèG›Ðèbž;’F?ÏzéÉÁʓ͔L>x lìÖM'ÍÅŠ|ßãó^êLd¸u%Ö…VL?§½ôdBé9TfV.«› ОKΘÙf»¼* WSsB4ßñ õ§& Më,:>JÉô,#„Ë DU¤-Kä‚®üA4-„T½^æüؔԊÕ3fÍs‹ :üâŽÍ¢~º_™mÒH–H¥uúR *ˆŽ08'?ÇëŠ^a•KÎÚ‘±z Ú´vìùµÛbæ@‡ÊÌË•‘©~ÎÌÔHþé ªÎ®Û1k¥Ëaó"ÉO?!¯¨)e ñŸPž“žL"œJ×!®ƒ˜(m7=Œ^Æ"3]±2ÞKO6]DÆ\â@WL²y&<»“"ItWgÕ˜Œ?Z—ÆD¼ë'à—•©}8bñnY%ÕAÇж.bgjLÈq/ h˜Ù#ô?¢Ã+MÊð;íÇÔRZô òMö:SÖÔÚd‚à¬ÿ˜“k¾m4K.‹wÆÒOSÀ”»Ì×¼U;¼ H€jcÝü‘ãcd†ò® ÚÖ %¹­i‡¾åèÑ,ˆ v É4%E'˜‹7r³3’ RVHôÌÜJEµ <].‰üÏ%\Rì@ãÊ4¼Dä üD¦Ç¦'HG'-ËÈl „É”MJ0ƒ üÕ’mF&gsž±Ðœ‡,¶ú°'~àr®j àuËñ²…[·pÅgÚtî©2ϯ˜³³OŠsÉ'×sÜ"LÚ¤IDBò>›ªã@P÷Õ]Dq“á"Û#ͽ¸É½ê¥Ïs²L´owàñóAÖ͆՗`]UK´ßû9ô^Šª,’ö ! H‹¸qÃa˜Êt/åàU ä D!kµqwMæìõÚî7¼ÔæûŠl… B,KPôW[°Ú%`x¬ND´ÐRœ`Õ°iqaÝÔ°&÷ìÀ=}u®•šEB¶‰ÅD!9´o>‹ål[uÎPEÐ(IrôNØÃªîŒÉ$8Ê*VjõÈ–;nGÖ°á?p[š'mW²¼Î ;f»îçÞš¹³u§Þ˜ ŸÚ ¶P …F‹On^ÂùÒB7NÆÕ#E´•j-Àë ÚZ·kjÞt˜‹»–îóœcá0•aVK…w¸rÚ=(K-<}“¹𢰰RÔ&¹)ˆ¢5PÛ×KbMñQ†ª ý]¤)Ç®ãïjy[ã7ùÝÈïÒÑS”«„ ¤MO••¢—ѸÓ3B¦Ðy?„F<*›;è»–àS—͆YXä-cL”ø?Þ7ÉFÛfû,—ð÷Kíx‰P2ÄåÈÄÏ ©ñ*zŸ©Ê9ÓG?$¼ì\Î× Èeǹfx<ÞõJØãZRxnyz Ëà‰ÅP“4Jwë·têåK5À1Ö &Ó …–3 Å/ÆEmõ;G¥t 2!'Æpód¢ÕC¸=ÃÁ'yKòÜ›[Mç¥F]±Ý›ÐH ²•¶jž@ËPý¯Œ`‹Hm6·9›9‡zbôÄ£%t`ÿ[Yàúu_}yvŽžÝ篟}óêôü²iV½»L7c¦ìN"p-Ç_ƒ¼Ó…ce™®=ói¥»Wï±½tä*H·X_[Šk_aQÇbP Îôù$ £ld77¸65âc”Q} °„Ȱ`¡œÐhg*)+Z-€BŽ|3ŒvC 9#y{“Šöáí±DhCU®âKÊ÷ ZÒ3Hl œ½xèžÑ‰uZ¤N_·ÑXCŒ‹î'}M[áYc­Tç±'üΆ`±IlF±1n1ãuOG”ÕvOÁ>­­Ê›D+t„ç³8¯ò¼ÈhP¹ô9ræy¸dA0¡Uô›­4F ^Áý1’]JrÐE.¡²"X"hl­l6ÊoÍyadª{‹[AŽŠJg­)f5:'9@s;`´a¸e0j/Z0ž,máa/½|{r~ñ’H‚J-² pÆÞ‰õ¦Z »Ù¸jßXÓiÛâq ¤¬Œñ–˜^Ø¥¦í†RÞ‚^¸]±°îI†Ž¨:V Ó©âyXûV»°fმ§-ÈÆ±ÖDà?…cQ‰³ W+Ô¸J‹!Æ\F±Ì<ÙÆæ14•ÛÐqÚÖ)0_  "€l:‡º¯\‘Ò Z"œvÄÙ¤BqæŽ\'› -°i—Jcìã> Ó4äô³çföF06Í[R²bj¨¤· ƾ¦¢Zå}5Jž±É2<Kv·œ¾íì MÇ«l°Íau!^Z J6 ¯à Q/Mï(ÈéÛWgç–‚üÉXy,¦ ]9˜”&6HèÌ?Pì>C¶! óYlO Ǩ׺ÎïîÕÙ“ÍòÉ#á,ÌB1ÆFZ!—ZL«äë­’yVÄ‚–ÉªÄøcŠ/Á›ú¾(—]æZ"+ÏXEh²O³Åw¼@PäŨP©NŽ ÞÖ³Y¾'$^NW‘£É:½¶Ôèf#ѯ‹Y¸ •€L[:´uµMÄ7Ãqì¯]*“n®áÒ­oĶ«Ò-‘ämª•PBRsÉðVÈ®›ý~:¡šw> ­æU9Ï9úÙüik«Ý»6³TÖÞx¦¥)#VÑiÌ®11AK“êI‚Ú*Ѫ”s¡çÚì½y`éáâ }EÈÙ6ñÌ’Ö޾ã’LÆ AqõM»eñ²Ë1¡µçÛ»wÞÄ0ôäRŽ rÉujÀw¸“gí'45vu°;ÎJq‹£ò¦ëÅO"¢ÛhËY8.jÜ$n&iMŠÑ¹áÏIÇ®„×Cw™ŸYœSÎÍœÌÌĉa÷dDv WuÐï¥/¾¹üæíiúöôgj¹¸üúì"}yöìôüÂÂ.ÃaôùDÀÎg9¡MõȃâÆ~´«±'EôÂC‹"üWÀ.€Çµªæ ùŽfåûb^ø,\ÉZy¯!rW‹Ú  h\$ø- À¦ØƳ"7*®™æŒSÕóùŒÝår”sòáá¡w3[æ}¾é Ð^…9¸8ŽÈÄ©x³€5ÝÇR8›a„øbJ¡°ïÂ’#~©5ÎÚÜî ¹Ü˜ü;×§6lÞ`ÁÞ\uûIh…ÀÉ"¢¤Ï'v"º85°ZÒ3£ƒ©Ä¢C›«ó" ?®þÆÐg¬ƒZt^Mæ@H¶Õá´ì¬š*z‘»F. s:"þ˜ézJ@^“Û²¬Ø8©ïq,õº‘r3+‡»nÏçå9ÑT™¾žˆêž^/j$áÔl¶ß`r΀cÿ7+ ­rÎaÚ J–ÌP´N×P2¡ëìöý»p2”­x‘‚ødu4Z£Á`ЂÄÈ'æn¼Ê*)ãR b‹§/»*=/½(ЦƒÒW¯žñŸÛ>µŸÛù¡ùÒoq‘¾Í¯R’xÅù§»Uy¾FÌU`IeR¥F„Ìʤ¶]ƒ :åXhaš„>€‰+²áì©-„"KüPüXȆÊ[¸5ôÚDfê©ÒÚqàZ¥è ËãWEù)?Oÿtzòþ}ýÍÛôüäÕ©+ûÆ$QRD«[>ñFŠ ó‚K°IQE¨ni{âÂ:i¼c¡Üµ¥6‘1¦dË%°ßj3\3´ Û°ƒ7ÒçùŽÁ7>LJ›¢ï=ôš‹ØrRvì T-1W£Ú»w°ÚÜòõرþÌÉl3÷Çn.3²NÚ \^¯Ç“Ùàâ,QTþð¤>b¢Å¦ÌØ™/Ï..A;={›^ž]¾<½° ‡D„h‡âAú—;©«h‹Æà¾!ÿÊSVÆ!®ûŠU»Hµ%Ï  BpÀM·sľËç”#EB$£™R5)ö-b¹…øá€À- óT­Ü]kƒ,‹±ÛïQmÎ zšB†KÌýÑ ÷ÂmCR…>ÑÚ,TQyR‘ÓíXFô¾¤j®úqïé ie”¨!W6¤ÙÐ=mè/^#qý?szyk›òX´D¶¡çEv3++„6¥V`»ÑØú5 âh¶ó„5zñüåúS”®au¶hû§ýØQ¥ŸµƒâÇËmbèÍR!B¼eã^3!cóõڢɯ_§â­îÊ ôŸ<¢vò,Ûú+òÕ›'Èõ :$áÏk`¦¬¿œ° }øåd¤q­Û›\ûãk½dhëoÛµü¬_ljºU ðØdá’Ð {ÀÄ)œQ[Cçe¯eFOaG¯ïcȲ“Ñ]¿ØËŠˆîúÅÍrª½žé‘]³LëO6È2V^åuMè@.ãSµ~joÇõèâqVÞWÅJî˜>e×LCK¹ã“¦vy›Í~\"×Kl—»»þd¯¿"ßh>ÌêÛ¿~±õ­Ôº»†‚óev“^¢‰ó8aq$âŸýƒùS(ÈÏÃý½]ù(Z±ŸG££|¥Cÿywp¸›¼ÍaŠrù~ì ÷õ1{S éÑ@»ó´øçÑÞîáÐ}îöÏ»ý½éๅ>ç"=ü¼»¿¿+Oœx•‰ú\L3WK+5õ·½Ä1å‡5œÿ¼7ÚpsßøZ•âê~÷óÁîp¨« 'á烣£a¿1ýöpw°«kê„¢Ÿ÷û:³–Ž®aoކ{Ú“îðσÁpw_#VJT¨ßbJ$<1ÚÛÛKžR?ž=Úß÷mègêÁÑÌ)Rwh’ÿÍ5XCcmtk-3.0.0/Utilities/numdiff-5.2.1/docs/numdiff.pdf0000644000177700000170000112611311666247630020646 0ustar torstenman%PDF-1.4 3 0 obj << /Length 206 /Filter /FlateDecode >> stream xÚu1O1 …÷û‰¸q|Žãµ H0… *z•*h+]U~?>®ÜÈ‹ýÞ'ù=tÉd'• ’ôîíÐ¥«üÞáu뙀{";þôãD$Ð^äÎ>E) µê7²nÝêÎÄœ pe×vS˜’$U×¶Ïþñrè·û—„" û'»ÏCˆèÇYxØ¡¿l>̹™µÏ@ÙãD÷&Ÿ¦í8{ 9¼¶ûî¶-Áì)+‚ä¤?É—JV¨2ºqp»…O.*hÉå šy¦¿äÞHendstream endobj 2 0 obj << /Type /Page /Contents 3 0 R /Resources 1 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 7 0 R >> endobj 1 0 obj << /Font << /F72 6 0 R >> /ProcSet [ /PDF /Text ] >> endobj 10 0 obj << /Length 1186 /Filter /FlateDecode >> stream xÚVßoÜ6 ~Ï_áíIjE²$ÿÀžÚn)ºuE]÷ÒôÁ±uwBíóÁö%Í?R”/¾œ†1EQÔGŠüx2ð'£<òBñBå:ª»Ô?nd´QÜh¥`±ºŸ˜ÔA²tônss{gt$/E)£Í¯JSÍ‹\¦Ñ¦ùÆî¥ÒœóX²Ó¡‰e ÖØë@½;ĉdö@ª¿@3ÄF²j;‘æ¬%›Ð6RVììhœ¬ÛM³¯àa;{ï ÈÙ;Öû´µõ~>ÐqÝ¿üßü qÈe"Jtʵ¥c³w#œ+3Ö!’ê§;Óª%ucGܨ÷'iά7ÏÙ¾GË'ZL=VɼýT!²–¶+T7dr-)?ŸºÔî^H…'Þĉ–2;brúÝPudý´GÛ:{²¨{øˆX‡Õ¡OÕämŸ1³T\‘ù˜GçOâ#µ<™×wFÒµ>‹‹œ=ÄiÉžW6æàf/¶õ ƒ'ŠùDpï½·6F›jæv‡#u‡Ž]Õ¶$žŸÂ£µâ­éÎå9qv°‡z‰»n— .²ŒÆèwºLLîsu#\§”bÛ~èªiäç3—ª4þÌûþèãôQìö/¾æiž‘à*- o[SAfbY‰âB hÀ…! 5kÅ+54«1€­R!ÌBbö"æ/bñ"–^Ô JAʱÉà{Z~ñ1to¾ùcs& •^h€Aó²€À=—2Ø^pÉÙ.Y—¤Ë0®b8îñ8Àí÷ˆj‚ÿ²uvèqÝô^á¦×ÐŒP\ ùÚ5ÍÍv+Ð.3,ÏË2‹d tHÀ¾ø^:7úÖvý K1çëM3èRª)Ûé¿u¨¸ÐTð)ã8!›sN– «êoû–œ‡s¾Ê·ÏÁ§'€pcCõ©óuÀÞœhëä+ß‹Sv­Ö'¼¥Æ°~‹_ÆÍ>|þJÂ]\(6Ìv_»(Ó‚ûŸB£"ù6P[š•ì_ôf‡q&Ÿù€äŠŒP:ŸIÙV“H$R»v€xzHÖ¸®uãŸE!y CÙÇŠÂUˆ¨ü§ßúÙä(·  èä_³§4SÔ’ý[Rã4 `ÓžüøÎ‚ïGŸ$è6C®\(˜pÛ|{Ü!iJŠkŸáI_° =9KÖžù½S”8µ0e2¶ñOñsiùà_Ô" ë\´k þD–ÖYª†ç@vÁâr²i™³¯ãòò¿ãó õS[Cå CæGÆS†§kàd¦y©ôÿ.;ðüä0·(¡²'ñÿ9P#¦ Ê×™Ätcas]Â…i?ç—ƒ·Ì°·ð^ZPW )P‚{¿çWÕ0 ]Mƒ ÿó Ü¡nO¾µ›YqÅÓ"ƒQRè(—<Õ¹BŠ#’¾¤éÙ,YØ­Pá•; ìíñH?ƒ ÎfÉÂnm¼v‡Èø|écûºkendstream endobj 9 0 obj << /Type /Page /Contents 10 0 R /Resources 8 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 7 0 R /Annots [ 20 0 R 24 0 R 25 0 R ] >> endobj 20 0 obj << /Type /Annot /Border [0 0 0] /Rect [365.8488 137.5653 503.3018 147.5653] /Subtype /Link /A << /S /URI /URI (mailto:ivprimi(at)libero(dot)it) >> >> endobj 24 0 obj << /Type /Annot /Border [0 0 0] /Rect [306.0384 68.52 525.5433 79.4291] /Subtype /Link /A << /S /GoTo /D (GNU Free Documentation License) >> >> endobj 25 0 obj << /Type /Annot /Border [0 0 0] /Rect [72 55.3694 181.6178 66.2784] /Subtype /Link /A << /S /GoTo /D (GNU Free Documentation License) >> >> endobj 8 0 obj << /Font << /F54 13 0 R /F51 16 0 R /F60 19 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 29 0 obj << /Length 1045 /Filter /FlateDecode >> stream xÚí™ÉnÛ0†ïy åƒXîéŠE{¨‹Ú\[ixƒítyûÉãX¤‚6@,‰ίp>Ï VPøa…á…©©…‘ÅtyAãðõ‹wXTØäáøâÁSÅ F‰¥–ã«BqNOãÙûr>ú8~qñdÜyR\%…ììNeá]˜!œ)édÝ»sM¨’Ì+ŽGV”“O‹+›Q%Œ*×Wáú†Ö«‘àå¾ +÷0°s/|J"¤æÎ'-*É•Ú{d£Š1îæWà`ãfþ˜¯>‡‰ð·£‰µ&RÀt7€¹ÖGÓ7x‡ßÝÉŸþK ·á¸K#t¡kE(­™càáií*lØÁsˆ×©Ãð´Ø]Ú]xÒŠÍ­òŠ<"v9ut]¯Öîòmá€kfŸÝeÙ"[uÌ£_ÂAöLßði×~d˜Åç8˜I|»<>y]‡§„+j½¢ˆø¼þêi¶’¯Üæ o}¸XI³òLËï+$)kC4H2ÌRvó$eÈ]ž²ÛºÇŠ™•²Ðê/ã¡ âª!¥´|}€í7þê«åÕz»œìlP›‘'[ÊulæÎëþgÿ±×½÷ÁÆ%ÑBò)Æ£]… ûšÇ‡¾g*1ò—‡ü¶ðI*UFÙñ’2¦Ò端µ“…¯Â‰~ÏŠ0óœE]áv„©%’Šú–Z­]… ûÒç‰Ã¶©/U/ì3‹×€¸ÃKrx¡µT^®Rûr½¾vpÁE—~ðf9óuûe¢·Ñ“Ú}mÎ¥;“žº·k?È2Ì2„ƒé2i†Ïõ½ÑjçÿЃ°P”hcï;a¥¢Ú­ÆPT±a.ªGËë£j“QÅ>³QwQ…‚š¸‘z¾š5ßû×5µB°s~øªU²Aôa=Ì€ÛÕ¶$‰òy@ï'yó¤tendstream endobj 28 0 obj << /Type /Page /Contents 29 0 R /Resources 27 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 7 0 R /Annots [ 34 0 R 35 0 R 36 0 R 37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R 43 0 R 44 0 R 45 0 R ] >> endobj 34 0 obj << /Type /Annot /Border [0 0 0] /Rect [517.4736 682.2185 525.5433 694.9707] /Subtype /Link /A << /S /GoTo /D (1) >> >> endobj 35 0 obj << /Type /Annot /Border [0 0 0] /Rect [517.4736 649.84 525.5433 662.5921] /Subtype /Link /A << /S /GoTo /D (2) >> >> endobj 36 0 obj << /Type /Annot /Border [0 0 0] /Rect [517.4736 620.2509 525.5433 630.2136] /Subtype /Link /A << /S /GoTo /D (3) >> >> endobj 37 0 obj << /Type /Annot /Border [0 0 0] /Rect [514.6342 601.6914 525.5433 611.3883] /Subtype /Link /A << /S /GoTo /D (11) >> >> endobj 38 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 571.9322 525.5433 584.6843] /Subtype /Link /A << /S /GoTo /D (15) >> >> endobj 39 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 539.5536 525.5433 552.3057] /Subtype /Link /A << /S /GoTo /D (17) >> >> endobj 40 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 507.175 525.5433 519.9272] /Subtype /Link /A << /S /GoTo /D (31) >> >> endobj 41 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 474.7965 525.5433 487.5486] /Subtype /Link /A << /S /GoTo /D (33) >> >> endobj 42 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 442.4179 525.5433 455.1701] /Subtype /Link /A << /S /GoTo /D (34) >> >> endobj 43 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 410.0393 525.5433 422.7915] /Subtype /Link /A << /S /GoTo /D (47) >> >> endobj 44 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 377.6608 525.5433 390.4129] /Subtype /Link /A << /S /GoTo /D (49) >> >> endobj 45 0 obj << /Type /Annot /Border [0 0 0] /Rect [509.4038 348.0717 525.5433 358.0344] /Subtype /Link /A << /S /GoTo /D (56) >> >> endobj 30 0 obj << /D [28 0 R /XYZ 72 769.8898 null] >> endobj 27 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F91 33 0 R /F54 13 0 R >> /ProcSet [ /PDF /Text ] >> endobj 58 0 obj << /S /GoTo /D (Copying) >> endobj 61 0 obj (Copying) endobj 62 0 obj << /S /GoTo /D (Acknowledgments) >> endobj 65 0 obj (Acknowledgments) endobj 66 0 obj << /S /GoTo /D (Overview) >> endobj 69 0 obj (Overview) endobj 70 0 obj << /S /GoTo /D (Output format) >> endobj 73 0 obj (Output format) endobj 74 0 obj << /S /GoTo /D (Installing) >> endobj 77 0 obj (Installing) endobj 78 0 obj << /S /GoTo /D (Invoking numdiff) >> endobj 81 0 obj (Invoking numdiff) endobj 82 0 obj << /S /GoTo /D (ndselect) >> endobj 85 0 obj (Selecting lines for the comparison) endobj 86 0 obj << /S /GoTo /D (Invoking ndselect) >> endobj 89 0 obj (Invoking ndselect) endobj 90 0 obj << /S /GoTo /D (Filtering) >> endobj 93 0 obj (Using the filter of numdiff) endobj 94 0 obj << /S /GoTo /D (Warnings) >> endobj 97 0 obj (Warnings) endobj 98 0 obj << /S /GoTo /D (GNU Free Documentation License) >> endobj 100 0 obj (GNU Free Documentation License) endobj 101 0 obj << /S /GoTo /D (Index) >> endobj 104 0 obj (Index) endobj 107 0 obj << /Length 958 /Filter /FlateDecode >> stream xÚ…U[o£8~ï¯È#H…`cC˜}ÊTíLVÝL•P­ª} h T`6ê¿ßs1$m2Zñ€}®ß9þŽ-&|bËI< ýY«ÉöpXñ?7®<°ðÎM¾¦7Ó-&"ð“ “ôõCt÷—sWdo®pLîzÂi]/ CG|q=¥”s×¼¹ræ¼—`PïA'C8Âý;ýýæ>Ój©}­ÂðÿÐv—•ˆ})´0ÊÈ´„Q¸žŽ$Àon(FDäs}ÁÄ“3?HTD®Ëþ°Ûòg B(@ÎÏ@YÕ5¼;¶¥˯±ü~PtÒ ÏÜãz öD/_Û<çU‡Í+FÄ GWÆNÖ–âc[uì¼£ªé9Ù6³YÛ|ÌÖ™¶ÜÀ¢7ù)—áeV£É´iÙ‹ B-gWbÞwëaXß× Ûå-¶ {#B_è ¦Þ˜‚…I hXM¢>ýOjí|[>ÛE^çmVáF9OؤMUnY÷Xnm7Â:g6ð›5ÔÅЗ‡ÛÙlrÐÖÿÁ…ÎØD+\ÿ¢ËX 8(h0•žÌ×Ô·×:—¦È-éÿÅPv ,@öd5²'TÜØŽø@†u×¹Þ²¶±1‰k†×öÔ­¦¡¡+Äh9‘€ 2¡À¦Uöa.bÛ›Oåå'JAM‘/ ƒW/£ø„ÿ‚ÄÂ3èÍYëQEóÄKƒeᢌȫœ£˜+Œ %¢¬X¾ß̱Þ=7©¯n1PyOžÂr‘¢É÷°|NY<_¾°?è…pæ«Õ|™¾üFÕzc¹gGx,‰§MOó¡¸*nTÍ*(TšpÓ¼`ï«2ß±þDŸ6£Ñ7•=oøÿqúZÞ}DÈÈù×Åã"}áØtâ`÷°H—÷k°]Û=Æú±b£9ËžžóÆHwÏÞ5f>ÎW|æOÏ«'lÐúÞgÁú|‰ ¿‚ÆÔ®ÇYd ÑÐb@<‘ u`;ðv[ I4FÙë@áCÓÚD»ÜdeÕ]cž&Ì/XÞk2RNW4xÚÕŽ·E†fLFî;NY²ÐÚe¬$¾>4 (Áƒ@ƒáVBÝJ´¸,‡§bíÇŠQrí¦ByVÑÄïyGÔ:%å1ÒÄž¶Ù·ÙÁÿ5-öž¨µ[njÏħ·SHé'QOt’ø‰Œ¿ õÙÛ9Úyç†ü¾Ëó÷ï2 Â)Œyû2G_÷~Óî§ßZÝô3$ sŠè¤‹ç|´»éÓ|!ùCÞÿ´…`endstream endobj 106 0 obj << /Type /Page /Contents 107 0 R /Resources 105 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 7 0 R /Annots [ 108 0 R ] >> endobj 108 0 obj << /Type /Annot /Border [0 0 0] /Rect [122.9697 597.5029 283.3316 607.5029] /Subtype /Link /A << /S /URI /URI (http://www.gnu.org/licenses/) >> >> endobj 46 0 obj << /D [106 0 R /XYZ 72 769.8898 null] >> endobj 59 0 obj << /D [106 0 R /XYZ 72 769.8898 null] >> endobj 105 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 111 0 obj << /Length 1021 /Filter /FlateDecode >> stream xÚ…V[ë4~ß_Ñ7‰˜ø’¤á V @ÚûÆAÂÛ¤­µ‰]%é)˯g.N”tWB}ðxf<þüÍ%•»~rW©]µ×b¯+³;ôyT¿=È(eà‘­]~|yøîçBîd.ê¼–»—ã&ÈKógòx¶—T&S›f2ÒLk¨ïÓÌ“üpHU•¼Ù‡Tí“[G^ (N=‰ÕÓ˜fj/‹ÂÀ²Jf†¯J‘F|•fE©©VÉÀ„åÖ@Fz©o}ªá… Žˆïž‘|èE^›’"þ ”Er×Y~k¦Wt¶þ w&y`+…®“ç0ôp„ôxÿ„ôwܨR Sµ+ëJÔE]07€ Ì+n¿líÈ©Uë‡| ˆïñêK^äM˜`‘ár÷–¶ÇëØ®¬¾îam„ªòòæ‡.~ŸÀÜðmô^¨"×[˜Ç00q#ö‰oÛ1çãõtjG4dˆoÊ’ƒdR (½Š‚L.xJsf$‰ÙGñd1EMžô,ʘY\]Ál†­/”Î*Ò0§ÔbØW×9lô~ç(Ö7 ÈŽÅøäÿ%—º= 49îÛ1" Ç»á:aW^'Þ¢<ì2j¾ë!ö!z廑–|KÇóµGw‡Wãm­“_Zlsߣw_%ÁÅ’Ÿ;„‡½f*4ô™ŸÚ&c(d„øEÜ<3° c+áͼ.Óm‡O¾8ßïx Í¡3‘à1ø¿1yŒ( [¬y¥'‘†t‹9/ÿ_³SEœTf¸­ŠÄy¶,V*j0{¨±MCµ€EH *iX›¶kWÚèü|>ºõaˆª)Ïàl)+K`9o 5SÄzrk-’åz–CÛ¸‰½Žóe1‘x^±ÄODª‰ÙÐÉe©{Ì©fóRfÅ=BØñÁl7âŽe1O ËŬ$V`}¾Îų”® ”ÒˆÚ€Z ©ãÐx ¬UÓßB¨º Êöú~’ï? ,„ž'9h{Lü;ËÇÁÍ ìÈž,ÞçìÅYöûbw¡ÇõÕ®6ñõ\º±TáøxŽÂ‚ºßÌfÂr_öÑ»†0Œ<÷Ve{;»X¤:¯¡o¾ºö6³ïO¨ÝÇ.3–46Ò8±a•µ‘K”” :…ÏùdC£g½‰ò´ú€/—«äÂqf't·v°ðt} å™Ãâ <å§… 8ÓGزO:ŽGÌ\ XlÎ1.|wcãAi͵¼.ÚÕ ]WáÆå‚Óp‰òwü±ýô-às¦ âÊþøì†”øy6Ñç1iÿÐB_;endstream endobj 110 0 obj << /Type /Page /Contents 111 0 R /Resources 109 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 7 0 R /Annots [ 112 0 R ] >> endobj 112 0 obj << /Type /Annot /Border [0 0 0] /Rect [262.4542 695.5353 434.2706 705.5352] /Subtype /Link /A << /S /URI /URI (mailto:norm(dot)opcon(at)fuse(dot)net) >> >> endobj 47 0 obj << /D [110 0 R /XYZ 72 769.8898 null] >> endobj 63 0 obj << /D [110 0 R /XYZ 72 769.8898 null] >> endobj 109 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 115 0 obj << /Length 4080 /Filter /FlateDecode >> stream xÚ­[K㸾ϯè,r°¶"Ф¹Í»È&‡öÍmÉm¡eË+ÉÓÛùõ©©‡åî9dS$U,’õøªJ£bø«²ä!Ëu”ëÌ<ìOŸbé~ù¤¤µƒ»é”¿~úËÏV=¨8*âB=|=̈|-ÿ½ùÛÑ]¶j3TÛÚtÛÖz£ÿºÝc6_¾m“|Sußj˜A^a‚Ê3»ÑÛÿ|ýǧŸ¾†µmb#k´þˆÅ0ï–Q`MeQ¢¬ñŒ&i[£ˆQ½ÝÙ4AžtÂÌÌøv–[v@@ÇJóNÛNÅÝ^‡ ¶š¤zsíeãjÓcÙ´‡¡:óào±2ç’Û-üd›=NÞ»êV¦ -ÿr÷ ?[<»W¦9pþi¹)Ã’ -. —ÐQÀEp ‰Úü‹nÁwò}yfÏÕH°áÓÀÇZÆÿœÇsI›rÃ=nŽÏLéHÙ8£3kÀB 82ÛMëˆކÝéÍ6_¤ÿä¶pfo0ô«åL‰ ¥Ù±xBMÕóh?¸n¨Ji¯(¤<àzî«K¸(xy@1 ›q ìÛKíÉ<Ñ}sÿdûÂË9Äý¸ó³_ë g½­G‰+á!‰ª“åYi.¼ÅöÒøÓ‰ˆ„2Qa бQ–Ç9Ñùz¬ú¾AÂS}›Ý5îÇ^‘KGlõ܃2G¿È{}~bO$¥-îWç1Ÿ4”,XQ>û㪄˜ÜŽ¿ŽlSÉ<&ºe͹ðÂÛîü\^ó\<¿X­qå:•]8–…´éb”6]Ø÷8‡ÑZ~]Ïo:~•ºö†£ž~SŸ=ZÊ üð:;|Ï@ÕTlK~ûc]{zaQñ%â,ë þæe&íWæµ÷-Næ1¬§+‚7Qo“°ÅAËpéØ,•×=$¢[Ð-E‡Í©zfÀÊW?‡ïºiv/¸p‹O¯g±¤ÉÔ’&:Žt’æÀ«Áá°fp“,²J%2낇Ø>wîÄ«Ñŵ'´^®ó×B<ÏÌ€0Ìfð²¸%zI;oê`ÓY ›;ÉoÏ '–rÝÏÄÓõ"ðÔÖäâÖ2Ë¥º³Ü`W]XóºAÐT·G–óµç²èå›8xæ™SvФ_kâˆ5^»€m fmc㺹बRJ°îý#š)E²rÃiÅÊÚ.8l«• FÒ|Áç­Ø2d¯ׂƒ Õ6)È$Ð̉pé€V£îã;§öJ¯ 2ÅžÁJÅ+‹êœXÞ`8HˆÎ@Õ Àáóìz¶-w\ÈráÒßêr*ðÙ‹ÉÈŬX¢þz!2Uï5X›}Õ oÅè|óB&±Ü†Q0pߔ㬠qøàä±}n~¿>ñ ·88„ À!2ˆžˆ¼ЮC‹—Æ›Ÿ·¹!é!2ç_öË?®©ƒƒ—jðOïëÃ.Ì›+†œ3íÏÌý"AÓG—ƒãõ3a&FÝB}0™†5À˜xÜ/ô9’Jáh` >®OHaɽ‡Â¬ÒËða  %6Ñ])<Ðyšxf­Ð.¦h¿ =…-!~b¥Ý\å /¤¦bé´6‚óú%ÀÒÅa}F©2Œóópúä@°ƒA{6¢êÅÃâ^¥ó”»çIµü:ÿË?+@dºÌäD‰'¯ãéªÄ‹˜ )Ò@B’¸»CБ¥¼"ø<¢-:£É}x¢ž¥nñ°aCCŽX©Q +Ÿ æUµŸ1 Žǹã­,Q´“f`&É@Ш҆qg‡ô~àÞ®:SÁ¶_ÙñCè߯··Ä㤠Šû×ã×cŽvw«#I‘ON¨sûa=Å&˜UÜV}ò~0ȤÈŽAjŽ»öAu/¬C2¿^ow$?·š¦1Ýõ'sð¦„Ö8ËÂä/‰ö,„Ã!$qòcã$1:R#Ñn»|G g&6ß4ÁYàÓË™á*ÒÌL”&ÚÛÝ×{†W«È˜¢X"¸B8`h“éïF{ÿØÖr[¶€È¥›œM¹LhÀˆr•«“ÃbVYNh0 ~8Âj]€;â|<àî,O>/J#íàÃ32ËR ¹ã¨ÔùFÒsõ30ôaöxâsW ËÐÄ„DÖ:ô$$– 8ý1,’Tý"[D:ÎÇSJÖKr®i$Dè5M‘ä„!`— cê(aSu=È|L'!¹É®ôbq$hÍ/ÞŒ”•:ÐFßž) gŠË“C^ÜÝ·WŸD6V8øí¯>›Ðgô#ÌA†@‘¢gSL–…‡ùUb¡f$üDq4Ç’/_)c@gf9³ÙsÓñOS÷Ä'3‰·¡–€síØc`×ì0(éóìõµ4½³o9á‘OµPgât9 Öt=ÕôÜF& FƒÙ‚w%¡—Ž 6okFÂQV˜1Ï9süÌIµv9Y.âÚ_Ó‹àžË`ZdUCp ^öp)Ë=Âï³ë‡Ù3ån-„u?^É<ç…$§ÆËe³`åæÀýç“{’»M2³ñ _±=))2Œöµ#Éìôð’Ì–Žg¢ÀÆhoàW²¥CðI†E6ŸÝÄé‹4§÷pBvGzK™,ìáÈ(\º–Ò§œãѦ&ÜF†öÿžÃ¹ëkÒB©ïð5¶á‰@/Í™,ltË ¥|êÿúL_º4#!XÆ!tÕ·eBÁ‹©ùÍ,A924×ÎçY¤ (¢  P½Õø;Ë«0M*s"»,‰&8ŒÙ™rNÆ T9Eßêpíã‚=y76ì” âŸ÷S0BëÀ¿ 3„]ß¶ˆtókÕ8 ©BÜИ’ÙKÁò£J«!3 ê‹ñðyL:£4zr»T›]Q±€ÅŽˆ‡Ç¹èR°Ó©–”Ž1ØjAy⽸Yßèý+%!¬&Ï75¹¤tâhl&N µp$ r ×fž5lr™ 7(¾#“,{såqíA¨õüÛ>q¢•ª#½'ïßò*_ט1vÏ#Aœ:Z÷‰íqN W##8oà>Þ—;³ðèGظ»fP é¦Rý‘U#SGS c!c\>Ê7£Q_bÐ[¦5–ëtñQÍÇF6•!dz­@G‰M¾'m£Uâ¡:x÷¾.%Û´3 xiº4Ã!‡Ø‹…þ[ÝJ´A1©¯ƒ¤){Ä4eC™Þ+פv= Gj!/‘â­p(ÕBøÜòÐDkx€Óm<tyƒÝaÓxÒSA [[¸8y%7)PÚE¾@øÓý¼È4Ø¡úÃ,JùÆ\â‘\â’dzð…5 (,Äæ3¶G)CéÍ'Ù7x¿È³ÔF0ËèDq‹=Ì+"ÄŸbÃ]sïçóÞEì= ˜åƒîæ;¼K!ñŽi¥ASRD”O蕃g“%Û×>'"°Lj\¶òEд–AçëÖ¼TXâu2 !Þ ä}}òŒ‘må~òëŸm°O\{âO{—•ó¬Ip¡e€f)føùWd¸ã§=UaaÛûþÉ ™?²SÐ|fM1ì ÷rÍ%žÜ 0SÂú#×r̾˜Œãµð&³> Ïs²»/3×:ÆuVå§Þ`tú³2¡8qŸÑ)¨<=)¶á»X²Žá*î=z©*Ú…ODÀßœê¦ ç2”°œi:°þmq_3X×òäáØ†Ì‹ ß9Ø\²GìòÚ¦q²aâúì³ÝKwà,-ÉÅúÌ“ÛÍ^.„:à¾FOg‘#Á ÃÔ§M²WØvÒ÷Ëàhóþ™5eï‹þcþÁò>¸ +´'±M"@Y&ý³¬y¬ý÷olî©÷3ãÀÕZÛïÓÑI(-ç|E‰ŸÅ¦©ó%T­ ròÈœ<'p‚ßëélóåÀ`#]O‚£2â{Æ4ÎþÚHnB‹;€ow?T¬'Þ¸$>ÃÖJqg’œ$˜É 5Ü7عe6R¢Ì¿1:O?À *RqïÅS*µ>,ŸÞL¢§ßÞp‡ã=ÝIÛã}$v’A w ÀÄøØ=q|#_™(7Iºp¾âX<ÈCûü–“Žh=f`äC–Y¡Ä‰©Á8Ÿ“äÒEõ^};äsÌ¢Òa²D>ú8UC}¿0Ó¼YmìáùyB™2Eð €Ã;(´šù|Ì~}X#Ç×j™¼LÁ‹ g;ùmÈ:>¿œîËIì߸UÒ'‡‰ܹž:DÏ£$+žàø‡ù•YÙ{ÉŽÛÆgÐ ½ùå,¤Ç =׳¢Ø#Í5ÊBN6äH—UøLª.øSIÍ÷G‰Ôù·6Ä) Èµ/Áóô'Îd6\-g)½—ìôXcõ#:B¶¿'RN°H@Õì+B\;ÀnÙ.6I=.‚>ÎÜÇq¶F> endobj 116 0 obj << /Type /Annot /Border [0 0 0] /Rect [330.8181 479.0272 525.5433 489.0272] /Subtype /Link /A << /S /URI /URI (mailto:pinard(at)iro(dot)umontreal(dot)ca) >> >> endobj 48 0 obj << /D [114 0 R /XYZ 72 769.8898 null] >> endobj 67 0 obj << /D [114 0 R /XYZ 72 769.8898 null] >> endobj 113 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F52 23 0 R /F53 119 0 R >> /ProcSet [ /PDF /Text ] >> endobj 122 0 obj << /Length 3251 /Filter /FlateDecode >> stream xÚ½kÛÆñ»ÅÅ l1ÜAØ1šÄ‘ƒ|h „–¨aR¼”Ï—_ßyí’ÒQwW´¨Dû˜÷ O]$ðŸºÈôE–›87™½X·OYþðDÉh«9È·ïž|õS*‰‹¤Pï¶GHÞmþ½Þ•×—*«Ë•ŠúË•1&2__®¬µÑß>^ê<ªú5@À ¨ÒY°…ð€Aà:ìÈŒ©÷W|K»1¯I¾r:܄챮¬)¢7{>sÓ×ãǸ«å"XÄ´ôôäøÑÈüT£È£ràI½®‘=‰Þ#³o—ì]ÏÓn»ÄÔ4G¦>ÄSðyîyº+‘wÅäštQ€µ¶ÞiÁ]Wä*#þ¿@÷UÉÌö¶YˆÀéVΑ dÒâ<ÇjÙå«8I3÷8]ðÏ‹—Peqf‹â?b@í©'óCk8€û¿åg–‹ y™ o†…kòêÝ^®Ë!4˜°ãõpÀWÔX[-bÝj¥h°s#ÁjÔçWŠö;ÞÞwžÔO¤äù’©±ôÕ0½É šÓ“xÿTÒK%%jŠ&8!É'ɴ˯É ´W¾DzQsl_¶4Óž–a–»˜$ç6Ö<|Ìa¥p&®3Î`…ÛpL!µÃ¸[b ÊÆÂmD§mRÌÛf:›'¦½xNÎÊòšépÓMÙ]rJ„Bk$e>w7I9…ÚêÍVb„¹ëu„‚%7‰Tx@Oœà몫²YbÊn!µ‘´Ã¾des˜š›™™…å„.Éc•ØÇ”K‡w=ç¶Âʸ¥d¨ Rh9éráÒwjß–¤‰Ò¶©Tù*œÅ5yTÕ ¾ñá¸>ÇßkÆÒoÉk¶ìõ¹p Ü …G¾šÂ%`¡nœ5gèdÕ·iTÇä63ï2CèZã€ÑXIëÆ*̸r‡ xìwÖtUˆ}¯¢ájÿ!H9°“¸d<ÍžÿþÎ%\BöÄÛnI«¼a›Û š‹Cº*{êÙš\sÙÕá¹SoywÞ:gð^°ÌĨLH}q<Õzfîƒü n“¾7¬p݇¢‚GíˆT‰%  †‡˜—KšÅ ä“¶)kÔq³·¦N$.³o”«¶p>Ì,cÙ²]!jC$¡F°F…ˆ•uî8¡Dp‘Ó dôr08ÔÜù˜åµðdà'‰.M(toy8Iúü¸ÌÜ™¡³)ŸxøgÐÒ%£mô­Ø.b`éŇƒ ÿŒ¡Ñˇj‚\8LwB·Ö WûDý™:|e¹¥–œe{ËKÞlêA,ëÆ]•™ò["ÝÓ”´ZÙI«a ©GD@ôû¢3¶&ÎSíìjXòÃJÅÖYŸ}‰æ­(-úw••ËÓï1±SÊÝ­¬òR~yòoÿTyç¢UòV¡7óz¥ —<ÍŽýóo‰K~_në,4/ñ³Íþ‘ŒJMôêg¸öõ Ø«ÅÀ4ïÑJò)y·+j ¦`ÞäSÿŸJuÞË÷hM)¢¥þ ÙZe±U¡ãˆ„ÿ{ Oxª¥¯MiÜ`¢™BêüLØj–ˆÍbWèÓU:‹Ü'JðßNð¾óŸ!¿Ão'|H¯÷ÃX’“คKâ|Œ2ö(E…é²­Àe6·^³ÑŠÕÃ_#¾ä›Ö^’}žNîßP9TžiT|\èTñ_ ”ëu½©ö4$ßJúÚä"m~ì†Ý¡D_æ’ÌÑ9gÝŸ™g¶Æ@`7å¸Ü¸Ût˜ü§ŽñßÅF+Á¼ÆÌ=Íñ޶Ò,¯V…ìÅI’¸UkSéz±­ÜKuj@ÐEìò"|ê§OÖ\ÞÃ|«â\åzÆ{ýÿà=¼?§/3ο:Ïy`ÊœíI"Ì~f? ¹ÿ(Ž'I‘Ñ`4Ñkú ŽèŸq=Å’+0|¥L¿øâ‹%ü¯ˆ&þ˜p„Õ£E4Ïæ…obüÀ:LB z¤/QF’¤i~¶AÔ˶•šNžöã!;+wðq xgŽS7ò÷ ³Zmñă"V)µéf®duòo‰»Ÿ®DzŸ #ˆ}.úË‹Ìê`¥<øâÅ7|ðÕ=_âcÐ _¾|¯9%(x‡…NÒÒÁ@+÷G;¥†Ò#ORî·¦—ÂÀ÷C×°`ÁYÕ÷p(W+Ä!ÿª•}Ϋÿ¨0®~<{Jrpñ›ôôÁg½."ߊÏ<ÿ¬·h»üþ¤†~·u#OÉJžÊöÀ¿dx5MÆ])§ ƒ­ÖcµùÌÿ1Ù¿±´l endstream endobj 121 0 obj << /Type /Page /Contents 122 0 R /Resources 120 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 124 0 R >> endobj 123 0 obj << /D [121 0 R /XYZ 72 769.8898 null] >> endobj 120 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F54 13 0 R >> /ProcSet [ /PDF /Text ] >> endobj 127 0 obj << /Length 2756 /Filter /FlateDecode >> stream xÚµYYÜ6~÷¯˜Ø¢±ÝZ‘%ÊXv‚pàdÝy‹¬¦[=-ŒZjHê9üë·.²/ͱÀ® [Y*ÖůªØê,¿ê,×g¹3±3yz6_¿Hdúú…’Ñ (fû$?_¼øÛg«ÎTI¡Î.–L.F¿¬ÊÍ¹ŠÆê|¦¢þ|fŒ‰ÌûóYš¦Ñ?n勪þ¦ "¸årÙó¿.~{ñëEØÛjÛÔ˜§D t‚ê}AU’ÄyQd q'6U$îì芌gÊÄÊ&9Ѽz¥AÌ ¤|õFÊÂèï>œãÞÑÌ¤ÖÆF«Ã/³¿üðá§Ã/“¤pSÛ~d²O—C×lÑžøVõ}×óP(âXðŸj–¾ãÙVM9Ö7~¥ãL%i¶0¦šåO©mŽÕž—ãs¿ ÿ2ý è©së?>eC{,F JÛYkSéú)ì‰ùð™Ö·q’ü÷Öwà3›9­œI³~†fAe×ì§ìX³×¯_OÙR”úZ·"šæGÝòsY7²ð²©‡Q½”åŸÃªëÇJTW¥|UÝmªùX-~˜óyÌ<¥« ºªc]?ñ£­nyРv{t§¼ù?*Ÿ=¬¼Ícku(œW|6¹úêU*ú£Ö²‘)â ×ß¾} VIl}žVbQ/—U/š,ûn=©²~‰¼%qÖf0°qîG[~B(ßÇU…ƒ4ʵŒÆz] ³vYœëÜ€üȤݮQ²©]S„™ÂÛºix/L.=¸lwÎ&¸í²kà¥épù fšöŠ %%Á¿NÓš¦†ÿ/¯„G×âSG4;.|ª¢ßOé4S*‹mᬷPA2¿yóFœòk»`+wËGC­¯ÊùªZƒµ‹3“†Á×úºjî}V;^óÒoê]ËÐÉiéF¬JS#{‘¨¶ëKò^v<^²ß'IÛº¸È³ô̸"Îù¤Æ…Sæ rí¬¯Î–{Ü4Ûÿj¢Ô€Ø)Ràl§|À¾P ätHAŸë<êÐU´ÒWkò.Î]CܨèŠI)l8#” ºˆó\åÏ‹R<­L8/[¿)î9ï®ZŒ¿ïøRñ®óŽÄÁ(nª;žƒ`.¢ícör!VHÃ;\*8Ú)šoê‰ ÞÄ+ /Õ=s#Mgʹ8u¹; £Û¾GÏ %v qùî09-aØõkÑ»Ø×»Èü1.§Lãbë™âí¥b]Þx—õ…J¦¬Ð€g§øˆ — “% ó rõÿFžÛšÂ ì×vl¿ênìKÎÑm«²/!= ôâœøwd|‚X­öÀ8 d7ç6‹Êf mBN­ò8K“ü1ëep¤˜âÝ—<6E^xe§=X$Fû]N¼\)¡^z„QC}…Ú@ªzËï³C‡¤E a[œzäØÚ6Ùâ`iˆÏ<‹†û5šm ‡¾™R2—æÖg‘Ib$[n‡jÁb?ûjÓWƒxI’.ïÉgœA抦ìï™h‹É§–/`ÀòÊ·Û’r–|3G•èd·W^–KÜXÖK9ÙFÅI uhüm=–—„-@b ‚XÝzÍÞK3DoV»Íˆ²w-¢ ä)V³:Fum8˹3c {Ô` iu¯ d³=º ?a7Ù6‚¬–¥ü濈ý‹ˆZÈn‡ä@@~Ùz' LÖßÕ]D5dÎ>Pù±Š©VqZØ'šÍ@ö„Š'ì$|U °K£/KÖðž”Ù²T(xç5‚áÈãkzaÀ ×8;,Ĩ¯0¤ª8I18Ç&:L1¼RöÕ;ìΕߟÈ;áuKöýý`ÍüÐòü¸ÂÀA:È$ÃáÒ¦ï0ËKŒê{ž zOªåX*IBr/À³¬ä)d ~LIaª¢Ÿw|$KІÚ×yô9*ºãù½8 °ÁÈ U_‰,LHêt<Þ¹9s‚7G릦S‹ "I͹ÜÁÂ!S©Ÿ^y½×1_Œ¼ÇØ UJ5ÎA©ýòÅL#ߟ¬`ËàwÖõÖ×¾ø‚âj4-Y¡\oÞY›m&pCTÄlÅÑ–G·²ÙjŸáX Ÿ/d3÷{pÍ3Ü£X̵'l©¿Wü-e7 "ùq&@" €¤Fºjï¼]öܿˢh笠hiöX›<áÂÖvAгXÌâl‰A¿¨e­çµPo5ÕXwÂÆصÕ!õšÝ 3 õmþ…2)ºÙ"ÄúP{yàù…çBð g¸ßñ»@DMœJ‡MÞ‚>`,ñuxÃRΑÚ†K^gµ`®“ ¬W2·sMÇ{§“ dhS’9œ ÁJ¹p¡n‡Ý¶­ìâ·XS•»hä[>ˆkY<Œ\' ëvï‘]Ðji’D»˜x‚ÛwSHPâT#!ïÂ6à¾,5ÑçsgØÑðÈ?–íœPSåÞxøÝ*€lURÕ.öf¶2 0­¼$RÄãK-â),‡Xò•i¦“Ì'zŒ¼ß{ â‰$à"uŒ–0ËNK¢’ƒ´.T0äE×@.Å£cW\W˜k åKÅŠáyåSÑÈSK2£ÛS_$ì*$ïË“„=t÷˜ÁæåXù|O+zççqê2Ñ3…„ÊÝ>—TàWô#ÖUèƒÔùÓË/6Ih9 ˜³Ç0ƒsÒuѸ^T’ æeã¿§sÔNu›j„DûŒn@p×mz ñ)! õKã;,ØP¡‰0މµS¾CÀ„?±¡Nâ̦žh©µ¤8Äü‡/\Ÿ8Ó¨#°Àt|=G#†¹p¹"5¶â8­ÞtËÛÌt;D’à Y~à9ï wÛ‘·b|•wuvO;ÔÔ¤—ÈyÊM…†qbžå&­BIîÀ½¡“àN¥EÔê&ÀqÏÅΆ$m1ªÉc¥Š#£îåbй—°‹Ùýÿ¢S>§¢Ã¤ªB,?¨=ÁçÀt"#߉ա—€×xχ‹ÛèyÒgXaÄÅOŠNÍýì(ŒJ^ðÇhï§¢ô¨*Áî…nF¶ *ôGŸF§€pÒï.“€Øe_›rtÝ>ªaæN,dîŠà¨J?öýV6ümG l…':tÛ„ëG §—CÿhÅtµŒd%ûˆÖ-ª/arw¯u-üƒr_„«ê #\Õ^X]82@ ®‹EUtƒ '¾Þ4T—\á’îÊBxA_#û­/Ie;>«ky"j¨fç½ÊPƒ"'¼7fr±ŽoëP›ú0$¨1l)0ðM¨¶&RÀPïµF|¿K?@rUSú6[±°øo !ˆ­1¬dpÆ ¯ùÚ¡èœCGãO,l‡Ð¹ª=,ƒq |Í£OcP«p2ûÎíÅÇ Û)ññ#Y¦à¾¤˜fžÆ™ÎÃíWÓ¨I¾t/íÁíG±’ožâm’Øæá6™ëç3ïý…“ÑqšåÓñ-™\•L©—ÄpNìakõ{×â žÕxK·©ÚA:Í™Åß)ôã¿eý®3ñÅoe›Âÿµü ‰m6uV?W—'ÔÎ&q>ù áïe@?Šá…™ŠüO›þ„µó½Û)ëûÖ¹‹uø•þ?ð>·Aendstream endobj 126 0 obj << /Type /Page /Contents 127 0 R /Resources 125 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 124 0 R /Annots [ 132 0 R ] >> endobj 132 0 obj << /Type /Annot /Border [0 0 0] /Rect [238.3388 334.0667 421.4958 344.9758] /Subtype /Link /A << /S /GoTo /D (Invoking numdiff) >> >> endobj 128 0 obj << /D [126 0 R /XYZ 72 769.8898 null] >> endobj 125 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F59 131 0 R /F60 19 0 R /F53 119 0 R >> /ProcSet [ /PDF /Text ] >> endobj 135 0 obj << /Length 1518 /Filter /FlateDecode >> stream xÚ­XmoÛ6þž_ &ÇwRÁ24[[ Ú›±/Û€)¶{“-C–ó²_¿;eK±œ:é §ãñ¹»‡ÇˆS¿âÔÉSçóÊéÓÉâ„Gñ?'"¾¥ ‘vU~Ÿ|ÿÞˆSÁYÆ3q:¾îOO~žå«‘Hšb”Ф¥J©DR­uòåv$}RÔ·sÐ w  ¼3‰ý9þxòn¼]ÛHÃŒVêk.nõ•]G3É”Q¶Œ-‚·7KžÐO^ƒCžRqÆ9ú+¤B1a¸‹Úåž¶Ö ðHÛíËÍMOÛà6³fÈô¯ÅjOYòãˤÙ÷š ¦M®n÷´ÅAÛo‹É€mΤ Ú©aNbZtwšúZ`\5y 8Øáë°P"3+˜ îŠU#€ÁRÊ»çG @M¦íùW)0`R*†ÉH%;0ÉÃ0íPB{¸w´ßÌ ”°R\M’º(ó¦˜Ò ©â³ãpq‹Œj@ÄZÓì5ªzÿ«-–ôŠÞc=+W ¬7!¡HU(RP¸Ä—g$Á53.“YÓ½8£¼ÄÑÍfÝÄ:‡ã±Š©QGÑ[b‡beK»þŸ¼^àyYÒ’Üú,G°nºÄ*•T#íè¬uÇEZtC­bèTjýTÜ`–2£Ïfc"8 P„(çõCËq†ÃqÁSD†[NéåSЛ ÒhäÊÐêþå…ä¬LB²Ð)@üB,$gù0¼ÐJÀ÷Ùð:+^h8_Ò¸ ¨(…ƒ©(¨´˜åIhÑ8½ý  r³n¡e1œ?†­OHׯ“g²6|鹊{>7c É6ê[PdIŽ 8‡Ó:ðŸð”Âtq\,èptÂ>tK^h&ä;œ,ž©ŸÏ™`0¿îÝaÀ+*)˜:&¬ì¤zÙÙyD´ÌØUO,S¹ã õ@m÷Ùs›Júvd,0Û¦wlèïo)9(ôuø Â‡ù&Ø»QAMÌšÿ[p=t}ô›–.mã°”…ÞfÓ`zlÐKÍ[³3om2©D˘5SšÎÀÝkÞ6"ËÍb:¿Žþ¦ÿ’¯oâð7zR³BÝâ¡äZc8u'½ÀdÏäô,GœÛŽ]¦Ú(¢³³óºÝ”‰X#«¶‚¨£á’eè‘Ààvá²¢¶Ir/”Z÷›‰PqpLCãB‚Ïf CÈÑçŠç ¼k…óx*é¤Ú¬zm2˜¥ •—m1kÍã8œåÕbšÀ7±MÉ» 4óE°ÝžQ;Å}>iʇ¶c)–üÌ›Ø}h¦½vý[ÎƪÚPôØIs>x/õÌe´2cÖûajºƒ½z%1ÎpAúáâ‚®HO_±Œƒ{º|Ô,]\ü¯lí,]ÃÔ3üP]?Â]pøÂ¬€–žÞ zó”…î•»ëç·Wç*^u·¨³ðî³à}vè‚ÿ†.¯ÖU¹ÁsGE]#Ûák\Òƒ·?E*ÎHú vÓóÛƒ_ æ½ò^Ki}‘ª¡õ‹ŠÞ‹ÊûâjSo8sî«ùÿ|ûÚKšèendstream endobj 134 0 obj << /Type /Page /Contents 135 0 R /Resources 133 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 124 0 R >> endobj 136 0 obj << /D [134 0 R /XYZ 72 769.8898 null] >> endobj 137 0 obj << /D [134 0 R /XYZ 131.394 256.0169 null] >> endobj 133 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 140 0 obj << /Length 904 /Filter /FlateDecode >> stream xÚµVÛnÛ8}ÏWI•áˆË;© )ÒݶÚ…ߺ T±éZ¨"² ß‘²%[N•`×b^†gÏÌÐÃFþØÈ𑱂XaähvFÃò3F1XÄm“¿¦g~PlÄ(IhÂFÓEd:ÿý½LWcmÜ8fQ5Ž…‘¸ÇRÊèóØÛÈUXÔ`À¬Q‘ÿ;½={?ÝùV\%…øÅ]QÞ&Ê(%&IôÈ0‹BÕtãƒÒà˜ Â5µÍÅ…šX¾¾¾ÖTÑècZÑdŒÞiô Öì®Rý"\_¿y @J®‰ L0¸¸Á¸æLJ¸ÝŸª Ô§Ú¾Ú§nüþÛ»u™o1Œ8sUUV~¼J¢hóq1»ô«_\žn²‡“§QVie„¡ÊżÏÿ°ˆè£ˆ¼]uÅ5ÅesKe7œuqP ÜŒw»mÕ‡1±GLn·Å.èÿ΄Q¬&pÖeûý(Ë´!Z=Ÿ‰|~Ääóls, eDöRÑÿyDå›õP¡àâéï‹÷6-Pì#„SÕ»#qqÅË׳yÒñþÔ®|=ƒþò寂ÅÍÍoéyJ†¨Ðó–t¯ÞŽàÀÇ„ó‚Ç„¡ö§ÄàǤ7íQƒn®(®&)é‹JT·³/1-7iC‚¾ j$šMO °SŒZ âœHFýD rÝ÷sÒõø‚F¬ÜÔMÄà€X1+¤äÖMÊÏ¿“É$”è‡,@çwYž³s?™g‹…«Ö~²¨Êû0êZós?lð¦V)=Ї håOÛû9´8Ù? :¶@2ZÂ4]ûqåVP¤6‚«4ÒÜ7J³²ªšÖh¶ÉúÕÍÒ¯áÙE™ç0+ÇÜDYÃïÞh^; ]W€ÀíÜÿ_ù hÚ¹€"Ib \$)}Õ’é»,tZ)ÐV<1Q ïfe1ǹŽrlðаY.ð[!ªÌ7øà:4E4c,8¨CÔGƒ[¢…nÌþ€LTDqÚLÁ;ÌÊ"x¬u( l@7‹¬hÔÃÝÍ2˜ù›¬Ò*E«² àKŒâµø-Ä}ÀÖUô8O÷Â_úG… I¸Ävº]‚—-ð›G?‘^¹õ‹«ÊAZ‹vþÜÕ~jŸ®Ñw¹ëdÒìëLƨ<ÌóC½âsK«ZÚóÚ“¦mÿ| »àendstream endobj 139 0 obj << /Type /Page /Contents 140 0 R /Resources 138 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 124 0 R >> endobj 141 0 obj << /D [139 0 R /XYZ 72 769.8898 null] >> endobj 138 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 144 0 obj << /Length 1946 /Filter /FlateDecode >> stream xÚµYYoÛF~ϯpã¥kË=¹ êÀéF“…Ñ>´JË´ET"’râþúÎìì’”D©’‹:€¸çìß»ág1üãg‰8K¬dV&êl¶|ûá¿^pߚŠépÉ·7/¾~§ùY§üìæ~ƒÈÍÝoÑwól5áQ›O¦<ª'S)e$_O¦J©èããDØ(¯ Xá|‚Ü&:²“?n®_üpÓ­…fZIùo,vëv5ñQ M¥[aX¬wÜþóOÞ–Š f´†pÑÍxU\F‹¢ Œ74R‡þ"kCó§DÔV´¤Ó¶—8_•¨\>÷T®37´†¡¬~¢1Ç)ÊJOñ}†ÇÍ&"‰æ42Ïpi•¶ÝN¦ØqŒ”´¨Yópä“_Vná  •û3@BP>å’q'Nz‰¡Ž$‹e,½Žn‹ÅBŒiRXf¤á~ÙW`p­¢2[æÈŠÔ1((§ÆãDë([Kë¼Á!ÐÕ}XCJÄ1'Ûgè¯HÖ² Á•Yí—y±Ó¨ Ý¡¤2¯s2‰S}¨Úbæ÷¸cÀ’ÔA ù‰"¶ôO…›rŠø2cŒ ú2NÌÎæBFùçžÏ††î«|×ðBÃC«hèëDpG½ªì)J"ˆ¦\øÕ£FƲT‹d`6~„ÙˆbVö§E$̪rŒ³ †snÆiN¤ ÓÖÚÿ jŒ‚ÎÍõˆa¨(ïáôª^fm,Ò˜Ÿ[ÕÄ(}Çn±÷Díëå®@áˆr*Ç™š0††åàå#"L³Æ¤ ¬aFiéxxœ²D@ò<ÊÇzsK6íTÅšAœ4›Ð8>Õ +"_QúΞ,+,wYÖ}ÃF\Pµ^×Ë–Õºók”âvx¥áÅè$òiÓ¡Îi<‘Õ`Öåà0±h*j…<*©ìñ…x¢> n± ‹>á§‚ÂMùìbÌ?š¢tÉÊZŸ7¡B–.ÓQß%M›ôè´é qGá¿ãb@ 5q⥫?¦žªäËÐ ”zOï²7ÎQ€Mr\VÒÀfžxV)r\NÛëDœ÷^¼ë@3áð¸? Ŭ²úäœ5æP2¥ÍfH;ÞŸ¤éü©¡ÞС\¶3äIîK[x_¬°æ~㻉UQ~[‡ŠzXѽ¥ ºðÝëuW*‡¸çaÝ´Dô³¶ºí±‰¬¹©óæFÿ~P ªÈš1Œ”•Ïýê‚,fü×ú/·ŒÏ…7÷ý¡)8Ó\‹qæÏ¤ÂeÕ†š£»Mx·ô>ŒX£xq ^óçÕDcø©` ¢ÿs¶”É0u&^É8ëÚ2¦òôŒ—`åíüÒ 2¯=Û`Oã&úžªT÷»ÄÀæïJ~šênÜQøu¾Zd³mp E³'•ƒ`ÒòS]žÎºEÛ?Q{([ȃt×HZ¤›hŸù eæ,P”¡®ñx^«\åÃwH‰ƒZèŸ.-.>ѼˆAÀñØEhynèBSû4ä,¯ûÊçH=n›0iô‰%Í…·ô0ö¨î– G~Vmw9ÐCì›(»o R:ì1àß«¬ÎÚ*7< ¡oéêjãÃI“âCÉ‚tv{¤„’‚ ¥O JŒ¥ ü´VèMDýê/¸Îâž¡:f¡r®$@à šÏªkášÛê%9xähÌìÊñ¼ ݱ¢¹+\áR•^h΀¡EŒ ¤;û•/Ç@Êð¢Ò§£”n²®²BÔcѶÆNLQµ\eu¨nø¾üa˜ŽÕéeŠåÝÕ/@ßJÙÓƒí4ªuK¬Š"6ÀÖT+¯ÄCÂ%“›.ANÿ&#\23ËíÐëRÑŸ [/Zj(Z¸-)Ë·à’Jçî’°ð·÷eÑЌÃCÔƒ+4„™PµbÖ @FwhWîw>÷=°pËR“¦^²ß î}¼þBÈôôưÏPœã…¬·ÔëÑG ×6›-&cP¨SüÖßá‡wS‡Ëõζ=ûÍ3xp©¶(œ¿æþZ*/É^JŽ+¤DLìºÂˆ±/ººÚKÔà<2uPçoÄö©ãâo r¹ [‚>ìñ{_,üÄK‡——~º¡o3¯j—h°ÓÎ3¿ Òx>ƒšþ‹±#Óå’:ñ §Æö«Ø0öšslWg:ÿ9 è‰ÊmVŽQA¿­ãeCî! <"ÞÞ6ÕbÝzãçu]y+‡c!yi»¿ü•¸ ÑŸs¸Ë{wqfRc¸–V™ü><Ô<Þå·;ð°:fIr˜ÂO;ðH,ÔºãðPûáA¼> endobj 145 0 obj << /D [143 0 R /XYZ 72 769.8898 null] >> endobj 142 0 obj << /Font << /F51 16 0 R /F60 19 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 148 0 obj << /Length 611 /Filter /FlateDecode >> stream xÚ¥–MoÓ@†ïù–ÂÁVð2³ß‘*Á!RA¢¹UQšÈ4Aý÷¬?dÇö®ã8ÎÅqfÞywæÉ®1ûÁ@Ñ@iF4S<øþgåãß,ïbŸ†¼[OÞ| ƒõφÈúÇCøþ×faøœD1†i3ÆB6bÎyøùQ&éñÑFäÿlj%B}]¯&ÖUmAœ±s«8‡Qzjˆ2FZÇ’€à˜ÛN¹µ ­ƒéœYGÂÞ½],¢L7Ô¦¨Ì™­##(@yÓ‹›"MiBE3KæYËâ÷ÛowÛCÖ¡ì[’¦»´¸-Ë*¢¨ _ÉŒ¾.ž~I¶›çÇ£7Ë­(—’™d.×qër¯L”+ËÛ€ ¼Û¤`ò*¾*W‹”Ñ/7$X¶ ìç6©²igÂYKa:ÇöL /½uë¬j$…G– UÚF,—çD;x hƒŽæºGàÁm§„¸F8©5 “ŽÇCvð¸Ý§é Ê @¿BÍÇ}²ï'M<¤ÂKoYEý1xH?CZàࣱîx‚àR<šYWà¡»ÇKg¸Ž-²-PÓñiwìð…=x¨¾Ýã҇òãQƒ‡òã1 .:®ÅÃf(Qz –dk”±gL_‡îà±:> endobj 149 0 obj << /D [147 0 R /XYZ 72 769.8898 null] >> endobj 146 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 152 0 obj << /Length 1490 /Filter /FlateDecode >> stream xÚÅWYoÛF~÷¯Pã¥âj»¯ œ´Éƒ‘hõÖ(%QŠ+”]ýñÙÙ•I‰’“ö¡2`î1Ç7³³3³bÄáOŒb9ŠÅëÑ|}ÆÝòç3áF ˜tI^OÏ~|Š‘à,å©M—=!ÓÅoÁO«l3A›'"¨Ç¥T ž'ZëàãíX&A^ß@a î€@¨8 ÿ>½>{3Ý)eÈB­ÔcwtHe©àœÅiäˆñP ‹÷jŒ‚wE•Ó(¥OQÑwY”nãɬ(KùÄm7ômV¦nóš&í*s\ù_›|Þæ‹ïÐ*À9ЉÇVådï×§‰,Íù9x|òàÅå%¸ŠÃèÕö†<<…µÅ, ‡´t$\^¾ô`ºâBïSœ¿NžÕ†&ü e‘â=e]ƒüŒ ÿ«£wÈÅ£Í7¶C$qþˆ´Ýšš6+aãSoo’0öBíK8~pæ´â¶=lp2N€âêêQ©jÌ×xámfÏøÀx5kL¹m]äumÜY{ÅŒÃý9þò õ­þ’—Y[Ü~%—üA"‚äã¼í ®I.˜&3ØÉXо 9&»]•ƒ´›Ïž=sbÞT Âo–'/GgóU¾°"eÂ"õÕ½+>ç彿3ùƒ¬¦#L8a™WÚS±0ô­LKƒUæÝ½“Ødk7ª¶ë™¿¤{ WÞéûî ɇ KãH4O\‡Ð'yÍÒnGÊ8¤ïQ–Œï™&]®S_%š QÚ»¸¸pn~Û÷ªwÄ¢X.óÚA^Öf}ì À˜ýrˆîOÂÏ!f¡Òt²¶ë”¼â€…Û—DÁ¥ŠKeV£{p±‚™ËË¢LÐÁT'qXu ÓÙZ™jšäsS-ÜB»ÂÒZ/ˆ¿ÄIåàqÈD8Ø=OÉPC•à_„k1d‹1¢úž”Ü“à‚¶U."i*Ĉ­÷–Ýšµ¯ ´ÚÆ ]™&LHÙe‹?M‡ñ‹ñDª~y¿èm܃Jò¦¡ES1èY” ^ãâ;Ú74Â/<{jnwS›鬄ÿ÷´v‡ÐÒÌÝcd¶~Ϊ™L½,ˆøm¶sÜ[¸Œ”Í3r$vT(+/Ô£ªívÖ˜*C$¥s©V,‰î»t•#µæÊrkñch>·®X»ð¤½¼BÜm½kÞOí祵Ñ$Æ‹óŒä,lÔÒŽ’ŒáC«öHpà}‹c—GP†õ&:稺Ðb½°v³rL›aª*@ë@ªÿ‰¡`Þ$F+¨¦¥t`ÁbD¬Á «iàº]ì‚Y¹R˜Ö§ò€Æ$ICŽ W²²1nTáWfÓ"X;nÝêÚºµ?·»¼àˆð"Þ²Ûã.9WúìáHWͺ£IáQ05÷h=#ê5UñÅž„Œ|Žõ€$™¡ Û¹ ãß›‚€]A̻Ҫ¾ÍgÔI­BÜC²Çõ>«ß’…¡Ã0¸¯ PÓûjS@¥|ÂýŠ8aò±ýa×Û!ŸñG \oË. Å_stÇ Ädb ç„oz½èâO¸áƒ¹=à] 'ÄýœÏ@px"8;3 ÐÝ»¹OèÄ~ë½ÓÀ{bß–±X°DDªî³¿I ¿2‹¸ÓxúuŒïƒçE§endstream endobj 151 0 obj << /Type /Page /Contents 152 0 R /Resources 150 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 154 0 R >> endobj 153 0 obj << /D [151 0 R /XYZ 72 769.8898 null] >> endobj 150 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 157 0 obj << /Length 2489 /Filter /FlateDecode >> stream xÚ¥Y[ÛÆ~÷¯ØÚJaM–3ëQv‚p` @ºyÜåJÔŠ1Eª$eyûë{n3$µ”w›®s8sæÌ¹Ÿo(uÂ?u•ê«43AfÒèj½ÊôçgJF>PøS’ïožýí}¬®Täa®®n¶3&7›OÞ»â°RÞP®|åu+ßã™×+?Š"ïç/+ye÷¥ "82iì)µúýæ§g?Þ¸ÃcqdÌc2:ºIõTR†AšçÉU’çAëŒä½¾¾AÂ8ôÞW5Èì¼ç·U]«çü²©¶Û²ëùeÛµ{Í©õs”ÿÜ8¾ÎøH_ÅAG|dÑl@m°D¿kÑ §_soØ/ »’§þªlUeÇ•Ðn`¶­š;¦¯™þ§o…ÆåÌÇqWÝíV8ǯ'” XéÔ»_e‘÷Šg‹½Ó·+ÐÀ[WÅP5ÀáÎrV5ÌUM)gkܳn» M‹hC;Œnó• T¦dŽ}Û¬Hg Œ°nxÜ´ˆ >éhÔp®Ðàæãÿ¿%qË.Ç(ãýrDV Ùᎉÿ8 éf[ËÄ)»lhvL@‡'Í}:»¼/ë{^9ö4±…•c-›Ñ-$stj5 `ζ!AÌqÚ•¸[EàЦ=RŠxEWò,n$³À¸?ÚÙjËdNŸõü$Ÿ·Ýgg˜+ú…CO$³5²ÓF&ó~[eÆQí Üù-‘K²ËFk'Kâ0òq-ªŒ‚GâzÁ]guC‡r‘j{, 43J2º=ªç¹¡e"¶ÌþP81Àvÿ wÒr9ßrw,û)'q—ÎRÒš<–¡ÊHÜ\F51,D—[V[ôaIH†#s?=›8¯ÑóŸÅs3%d#2HÓ¸"•j( =?äŒ]Ò›«K@OR”DQïdKÇJ)íxŠeÆ9²*¹B,O(5%ҽз¼ E'×6xdA™€„x~!§é [¹fÀ,W¨ap s(ãa)†J›ÉpÐ=†âÎèå’$.l’Üâ?ƒ‹lÌEª,Ï{»Öœ§Ò«$Œ‚<79¶l蜴<éíŽÎŸ. ‡ /a‘ŒŸÞWRY¹ß_ñü¡¸+YlKmhâ)8f‘8ºÇ¤~È¥I>°§Êö˜ã&„:Õì~˜³m†›r(€œ€Hž8ÁÀ ‚Dø(ˆðt ·($q ÚpC¢àRzRsͤ¹Xãb©bÀÀ5ÐŒ™Ë½£²D¬JP¬¥ŽÕ‡hZ~¹›t®kH%Ö¤û–‡2'1¦b @„ßý´é±øö÷Í÷ì:ªAÕÊY/]H‘óZ‰ŽBÁZ®Û=×k…)øjÑ!bâ0|’;XQ£'ŠšIû„qWÖ…Ž ,­(Y#bÔ|Ö¶ò#®€8!—ÝÛ3[2‹Ÿ€` @o•qÌ1õ=Ö¯hÒ £pVÜ8`„GÊ9¨H“ Êõ‡$È©éAEëûê¶nä@XâÎ Œþ%F›Ã}¸ ¤IšˆÙüí¢eUÅQ$4i+*©íqàsŠÆ–exiÁÓ؈7•¬¨…€{¶ÝC{X+rò5H¤’8ŸY]}¶*ŽRše]Mè0±Ò÷xia‡ù[ö;]ixŠî+ËÖ€‹‘N”5ú)Î!¡£ ,†kvqô ÙÅ‚0á¹o;!"õáY;8@l,¾° ߯îš–¸o„J2Ö·ì2¡Šc¨o:™·úÃX€0Û·m·{䂨ƒø cÝ:»ÅrÚýU FNG‡•é"c j-ƒc¾ \Nª²ÞØ"^Wû ‚£çSP¸£óÂ}ƒ[#`_/DG¢“èüKäæ`¾¸bŽÇnÛº¦zS¢±ÜàÂ-Ù{ÛEw‡^Ü[¤K°*!°©Áœ»½¨¶•í£FL\î0qráöÇ 'ÛuZk&Y 5Aéy”°`ňÁ Ðvk¢7FFùõ;®­¯Xj;iÙž£( BÆWQyš¤é%´céü)áÚyÀÕøôk/RŽ6Æ´ëRøÊê§©ç ¶+‹~¢øúÉò LÂ|¦Åú±tiñ!j!Å„:P*Éç òDZ5„¹ÜyçWAªÃáhû~ˆÆXê¡AþÉYÉ\ÈŒÈQªŒòµ/W×XàÉ”¥ ²¦èéúœ’Òæã•°)¿Šp½`hî@óÁ^L¥˜PžýðnQÞ'-!ðg¿*ø Ò>6ꬩ6¬ÇR /h@º0»K¼œ¡ðšb‚SBú£ñ¨]l»TcÁ2Q¢Ñv›tl)x¸ PLèB€¼Ÿà&ºµ$˜ôôM€æ‚|åÒ™!.érÈ·Þµ’¬ßþ¦Šn¬µ]?Lñt±'ß¹{-\c>,dÐè[¬·Ú„É#ÛFëªÔ’^: 3v[a–åF/ѳ~2çµt+,¢îö0UpS ÅÒ¡˜z^hfŸ1×ëjS6TËÃÐSÚ@X$:ö´ù©íwÇ‚>†p‘lã4½ksU°!²SqáϦÅ"œ9€%èëF+á¼Æ›H’ácq’f¥ŸËZ†a €T›RW‹c!0hUCá P[8½T,íTãw—5a¦ê†¡(ymP.…Z?IÓ0Ì3ùý*Kì¯gÚ&ÎvŠ"x ½—/_.ñÇ_¨›òÄújúdÓ¾5^Æïã÷1†3 AUâ`ñã ûŒ$ªöß}¼âÃ9Y¹œbÄìbN(¸c'çI±Ðç•÷úB„Äp4 ÿìoÉ /^(qó‹×0R1Œþþæ ûÄ¥Ñ7¾yóo|÷oQÌ“·oãkÎré»ðíli£ˆ³àÿ“&>—†+Æw9Q¾voÅ€·}[ù§ì:ìB8”£ò¿Ò^ñì/x»®¾\Ü¥g»âG¬ø]r®ðŲH»¨ø¡š—ÕúH?üÀZö“e‰üÀUÉo[ý®íèk'¾ »Bvò(×C¹ùËÒ‘O‹~í¥Ïµ+ü¢ît.žUÌ?ïd¨wúÏ89z’ÀeÙ˜ÒO-Vþ/Dwù{endstream endobj 156 0 obj << /Type /Page /Contents 157 0 R /Resources 155 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 154 0 R /Annots [ 158 0 R 159 0 R ] >> endobj 158 0 obj << /Type /Annot /Border [0 0 0] /Rect [224.1517 602.2666 365.8791 613.1757] /Subtype /Link /A << /S /GoTo /D (Filtering) >> >> endobj 159 0 obj << /Type /Annot /Border [0 0 0] /Rect [246.0305 483.5404 389.0609 494.4495] /Subtype /Link /A << /S /GoTo /D (Use of the option -f) >> >> endobj 49 0 obj << /D [156 0 R /XYZ 72 769.8898 null] >> endobj 71 0 obj << /D [156 0 R /XYZ 72 443.7551 null] >> endobj 155 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R /F72 6 0 R >> /ProcSet [ /PDF /Text ] >> endobj 163 0 obj << /Length 2668 /Filter /FlateDecode >> stream xÚÍYoÜÆùÝ¿B•üÀ…½Ì\¼ŒÈ°Ô@‚R½5} w)‰(—TIʪ‚þø~ÇÌðÐìJn ¤àÎ|÷|ç8òLÀò,SgY®ã\gælwx#ìößßH»ÚÄvòÇë7ß}Nä™q! yv}³ r½ÿkôÃ]y¿‘ÑXm¶2ê7[­u¤?l¶Æ˜èÏ_7*ªþk ðRgI$Õæo×?½ùÓµgž¨$NŒÖ/Éèá’ª¹¤Rˆ8+ŠDNc‘Iò^\(!.>h)Õ÷——¤íÊÅF[©c™ˆì(ÎååGÆùa“ΧÍVe9œúôÉd-F,„H¶i¬t¥ê×b{N!~b«/C×<àáWÕ÷]ÏK+@‚Ø?ÕÖ¼çÝ_ª¦ë¯G±òX¨$Í•Ì5`eGOÑ,¨lÀl3Í>¦kÍÞ¾}{B©ŸëÖŠ¦ø§nù÷¦nìÁyS£<·Çÿw]?VV•ñ®´XÕ?ï«ÝXíÿb¹]ý ëªé:°ºÊµ®WüÓV¼hP»°Ÿ-•׿òI«LÉ%¤S|<½¸0VÔÚ2ÒEl ŽñüÝ»w`‘ˆèsX‰}}sSõV“›¾;UVç,°Î“$…E yEhH։ΘXdi2!à}) l ùlPê4*ñ'‰úêC=;òF×òïxW1à0–íÐË~o!0cÞÓß rKŒ&<¥Di3çoý*¤©‡}ãèsVE|@ Ä'¤fy¼«wHôŽO÷5œk´_PÁ+òåÝ I´ªÖfbë²é𴯈¥5©Y··\P—øIxØ#áµ²ÆR¶ŠI$iâ˜Åm}®:êÈ #kÙkÈYª‘÷à¾$( Y½"¨|¦D¡m:Â!u µáFké± Ùc¡’ÞóA[ªæé9øK=6`›/d!òÖcä2žõñαê+ëÀÎ"³+òø*u^2ð•e¶IU¢kA<”de5ù0ÜpÙ†MkÀ¡ë®eC#¡Ç¬ Ÿ­CµìÚ„Û‚Z¯¢k·m]ÁR!”º]reìvú¨-«_¥6Ü|ÓõϱV~HNS¨†­\$ªE2ñ”\œ‘‚ªs>e†°ˆ´) v+öuò$>v,ID´#â¹p–¢YÙâwNq _Îè’NÝ º((§3~ƒEê-]JG˜EˆZõàçûM õ#鎑iŠY`Ë ‹¦ºÁÀ1#¼\°MF4ù Ž/ž?Ø¥àÝ­·ñD&®ös–c‡Â>â_ÇÚšr<%ØÛ;ʰ )ÐÁ }Þä†M GÄ Üa`ÝñNïnvÊÆjé¢ÇzoÀ™)§`µ-­1‚<áj éÑ*Š—òÀÚîñ\&?ñš † ºÙ§²øÂ1Ö0Uôœ <¼8G_J1êëf’ÊSð^AY{Ï?wü‰ú‡s°Ô1 ÐÖÖ¹E›¼ò•SQÇÐJ¶"Bç@7:p§‡ÿxW޼šŒ=º vÔªÝ-*IëBºö±=Ä7`â²B¢Á¥Û=š/ŠQš¬˜Ì³¸<©Jd°Í\6øž@hÎç¬ÔmeÏ}É?‡®·Œ8Áî)9Ù· ‡Ä÷!PglFøÑÅ”YÄ”Jã¼ÚEŸ fb(òqSô*#Ñ#Ùì}Ö΋ì§ °·èÚ 4å[LS÷Š–-æôÝ8jœÐj(øÔä™SC…ÔY,óÄu¯Þ5AsÕÁ¾Ê‘ˆØgóW9Ñ÷Gá¢Y5Yö¶VÒ(4ðï­÷1¦ ŽïÛÌ)~Œ}˜ ô¡)Cv’F€ ¤K¢WÁÎ ¢Ã@a¶0ÿ ÑYtN­Üzƒ/›™ «£\:Þ‚½wã¥"èMÒf‡`€NY9¤­,âD&Žü/A§P±¾ª¸þí¯~etmé&“ŠEˆh™3¡yrçÈ‚‚Aû“$^¬­NrlŒðG„„Ô&Î¥ï“ë`$Kq2†Aª\g ¬v¡0‚R,•<EKB½½²Ó?8­½ZH‚ÖÉϽ&ÍõëMôclàz¡}t¢`f¦!‰¿5…'ÎÁOAÃ%i,R‘}ƒÒ«Bb‘Ç0ÛÉW\œ]:¿´˜¨ñÅ`wü£¶óÿì=†ž §b¢ß|Ëѹ\€ŒB»ÛQßäÀ0É¡ãÏ2úŽ×Ê x1Á MÅFùè|Mž f+g¢x5‘`šÆ0#é× ¢þ‚[ü  ©N†zã§T/y“0€u:ÜEl0 _ð| ¤çá®Re»:îóSE þK®g®ÆG¸K‘ÄI*òW°7Gé»'“plgÆ;êSÍï-QÉ`X-œ½¶+ æ.è×JÅy*’ÿ¿Þ˜¡“"[ B¿³‡C¡LrwíûªíF—´¨GÖn\Õ`ë¶voàÞ;=O`Öñè‹!Of5ã(þ×£P`˜<–"{1Ät®çùš™OÄCãÊ5Ÿsx',”âØRŸŽgî‹ÿÇÍ¿*]“¢endstream endobj 162 0 obj << /Type /Page /Contents 163 0 R /Resources 161 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 154 0 R >> endobj 164 0 obj << /D [162 0 R /XYZ 72 769.8898 null] >> endobj 161 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F54 13 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 167 0 obj << /Length 3610 /Filter /FlateDecode >> stream xÚåkܶñ»Å%þ=çVEêeĆÓ".\¤ Ð^¢I€èVÚ;ÅZi#i}vÑßy‘¢tZç ´ŸŠÃA\r8œçEª‹þÔE]¤™2š‹ÝáI(ÝoŸ(imbëƒüáúɯcu¡Â suq½Ÿ!¹.Üüñ®8^ªÍX]nÕ¦¿Üj­7úùåÖ³ùîÝe”mªþ] pJ§ñFéËŸ¯ÿüäëk·xÅAl´þ=Üc(’ Œ"J¨G ã(ÈÂÍxW HPÅ?Ëê§P™Æë±îð;à€Út{(n¸zš“ð‹ã– ÓWM1"«Ì6ˆ\à¿ë È`Oï¯u²#wÐYŒ(!`ÊøLiY¢còôÕOa¶®q2WjÓ*èRÐÕæHYŽˆñÏ„¶u l•T¦´NÑ–kÔDQ`¢P 1¥u=®•^ËçDP ”Å›ö,1J%A”¨Lð—Û4M6oi‹¦7ìcÏÊvBïúr@´i´¡Í®p,ží´Ncõo–Ý)D0ß)ì)áGw¹eB€½m7rc‡“ïHne¡z| ì² É"e¥˜ˆÄl²É7]Û|ààI=<:&õä0t锈çí-`{G¬ŽEoK~w÷Ä3ë;ÈÐäfó7Ôt\pg`±Â`)8j3Žùƒ]£4þ„…ô¹h,WG\78<7e®ãoc‰%M‡Mž©Ü·§²^ÃÁÔh5€Ëî€ÐGÞAè s4æû‰=Ì ²B'zІ”¤@ysxïëñNXФ>åön”¥:I…òŠÀy’}€ž=iÏXÄ6Zþn„ÎóÔ­H…i5p­jtD„Ò—Ô–Pù¹'™ð‡vj„í¡bE›†°D¨• ž,ÀT·ÃX€êˆß“¯2í­¥`BŽÛÆ4朗tO€ö]@ÆO¸N‡Ü¨Íõ]}N»RÇ›Ë:þ(‰jù1Þõt‹ûªl tä«jRièÿE¬N4³:qäyš‹ÕÙöë¦)0±1ó£»A6>ðJ÷=”Ecõ8ð@Ñß"i¤ÊU‹3F¢ †X׉EÚ–Î1€À,‚+îaWV-]ªI² 3It‘$a CxJ`ƒ†=—êà¶>àŠK}ˆ¹ÿñ«ftFª%×e"C'‚ÞßFËð‡òhŠA¸³–”³âN8úÇÓȨyó4BOƒna`´$â¬ZÅÎþŸ¯êXÜ |-¥¨Ó$H£4¹HL äŸ KÔv[‘àû5S”å„4€Ü^˜j{³G ˆ0 oSƒ4»¶Â "JK GVÝBài®šr`°zàù(ŽN’BNúÙ×»¢¹BKnœœÉùFž‡%((:žØ9¥µHv„°Bwýh-1w3@T5Šº(äp²Ä°=‘Xf¦d´óUßwâ¶è0É×[ulçœ#lõt\çJ4¸ E_Œ]ÿ|ÕJ˜ ‰=Û¬WÈNÅ›W¯Öl•¦v¥oððç¹5hp8Íγ’>t!œxMÈ>Y`I+¨±÷& ܈s Äƒ3ó>È[j"Øul±ŠZâVì²½»®ï+Ïàumi4Ÿ$6ô›bj#A¹5ëØÁa 6g3‰ótó‰ µ“jrǬ&ðu¾Ú»‚ÍéÕÚ¶GYÄyb  AJ½ß¯í¶1A”¹Øµ¯œæÛ%Q:v}éœ3TL»h,[UhÛ\’cÕ4“Ü”K%8YáÏÎ-BûH)‡S'¡ÓC$¨ÿTKøâLp‡‡2É`<,JL ¹öVçž3ʧŽ^àRôSDÚßɹAÃí)ÉtIR+YÖûYT•Wk‘ï.HùÔ[ŸÃçgu»ƒ4Ïç&ùéSä!$öéËÅÐúò¤6™nê×Ö¦Y ‡/^®¼bß–cKñw¿ûº‘O›z£Oexà/Š—¦#fÔÁT(OV“=X?‹ã9{Ö÷Ö«YÌP›ÞP«Ìk'2%"C1‰_ñ§­î¹Ñ fH’ué Hý$6›Ðá²ô «æ"΃ÄDù#¬…’ùmg”*A#…=´A_ÌŽºÚS†¿ÄÝ4ËWD›âH„ÍéG—ÀãÊ®T`i²õ{©¦ÒBm5_‰S}ì©Þƒà„©b5ÿhì‡E>?úh¤4a"Ú$ü:²Œ–Ð}‡8hL¦6•ÅDÍ/çL•IBkNi¿Wíi$:±`ŸaHC…IE~Á´“õÀËÛrJÄ»DĽ±Œ’äsº?x–¨kΕ%@qìÂ_~ùìåË5ú´F6¬=EŽï)ö%‘q¥mkTè8^ymLVôƒDjiÎö¾.vªJî H-Í6%vTŽK'ž°ý5—íwûíëÚ/!霖À…èòœ)ÌO¥0–fb{óÝó¨éÌ$üÓÈÅY±,4\Ì%O!‘,"X-?ú ¡‹ÅËó•Þj*¯ió-Ïð²*õ´‚Ñ«4KHJUf"C€ÊáW5 ©kUý¡–Š ,±v_ Ò@a!ZœYNÎk‘H‘HfõGÜ ¥Â»Ñù)Yhî]/²`LiAÁ8¥ÅFÑ ·–É-öM–NIMƒ{µÆÚ@‹Í^±c™½ŒÙì•H'"ÊÛÓ<¯D"¿\váHSÔ;zƒói-вAÐyæå–0Ýàuo†¯_ó#CÆ5?éŽmAÛ"; ;JÌ^)«u<ì´Aûî÷­ªá™Ì6ÓüQ™-Ä´6¢<öl®ÑÆ Ë•s µòEÈ@ÝÞ ‡€%§ÕÖXDóňÛÜû™[ä•?0ŧTÚEB0웲y,#×.‘­”¬…_¶L’RˆÙr½»@ƒý Īn:˜ý•,${Î*­\p¡Öâ—j´™)¾F¤ Fâ#O°Ãµ?rms˜nÊ*yr":{Ågƒâ·V9ÏV8ƒ9e=›çÐ+‹m’b¾ù@|û=OJt>lFåUKd7Í‹×èuJ?­ˆL[Ô¤Ú&_Ä;øš†Ÿx¬Ô<1gê·t?={çEBÓ"³Àhª—¤\v?¼ÃFÆÚ—p7=0^T'qßQ@HÑêýTîÓUô¼9ýðÜ11C³OXõê:µ{ô©ö(« G¼_]«ßb3‹‹çZ"DúÙÂðfÉJQhV¨¯Ð8pÛç,u¢„êppv„œ„j2ߌ%pà®8]A»ì?¸Êb{˘x"/'Ý“Y“Û2{ÐèæœRþ÷* òJ¡¯Ú]5¿À®o[N5Ê:µ+NÃbÇ%§ÑU@H§/«;%Q$‰{úò曼 X¯©EXÛwñßßÿ»èþùȇ9zª³¬ë³4í?Σu*Øx& ŒÉâÿôÐükm‰Ù=ÈgX }¤Az…'bö:mY½´Z œöÐàkŽ8rW#ïbG¡¥ÅÒmlTöEG+Ø%5J´…øÓ«³p‚8ÊÔn~zu“¦€\FÁ¨÷ßE~Í,endstream endobj 166 0 obj << /Type /Page /Contents 167 0 R /Resources 165 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 154 0 R /Annots [ 169 0 R 170 0 R 171 0 R ] >> endobj 169 0 obj << /Type /Annot /Border [0 0 0] /Rect [468.8462 657.5735 525.5433 668.4825] /Subtype /Link /A << /S /GoTo /D (Alternative formulas for the computation of the relative difference) >> >> endobj 170 0 obj << /Type /Annot /Border [0 0 0] /Rect [72 644.4228 376.7276 655.3319] /Subtype /Link /A << /S /GoTo /D (Alternative formulas for the computation of the relative difference) >> >> endobj 171 0 obj << /Type /Annot /Border [0 0 0] /Rect [256.759 201.6832 442.0144 212.5922] /Subtype /Link /A << /S /GoTo /D (Invoking numdiff) >> >> endobj 168 0 obj << /D [166 0 R /XYZ 72 769.8898 null] >> endobj 165 0 obj << /Font << /F51 16 0 R /F54 13 0 R /F52 23 0 R /F59 131 0 R >> /ProcSet [ /PDF /Text ] >> endobj 175 0 obj << /Length 1774 /Filter /FlateDecode >> stream xÚÍXm‹ã6þ¾¿"ßêÀÙgY’_J)\K W(ýÐ-ý°=¨7q³Ž•ÚÎ.ûï;orœÄÛÝã(-y4’fž™yFZµˆáŸZdÉ"Ëu”ëÌ,Vû›XÄ7JF!h„S•ïnoÞÿhÕBÅQjq»9Ûäv}|¿+K Õ2TA· µÖþzc‚_—ITÝc ¤ð Jg6Pfùéö§›nÇÃmb#k´~ÍÆQï-–&i[£ÈÒ?ñDPJ¦J:Šu¬agÔøF4ζ±Q–ÀV¬ñj,Â<Êlf¡Ò‘²qöÆíÿˆmü†B£Š"¸ÝU¦U€• ¯g€×5Hu%p—íš®EÅgþ.6èú'𻑹, %F¨íY8ì8\8nêÖÇ.ºð½ˆT’'oôýÛZõ@ÛW+\J“ëKtuà'_A'ªYtõ[ÝWÚ|¾û+×uUX†`»@ÁÞŠ]0¬ÛJ,^ã"ƒ.UÝ;ÏÉqמà9y7&®“Y¡Üëvåö‡¦¾<×Þÿ?¡èÉ3¨¸õ KÉ@3A‚QH#•§æ<%>´H¤h¬;—Œ-ÆzÕ*alI vÄÔ탟ÞàoÔCÏô³# WË$ Ð…²+W'ŠÇ5²Os¢]žDLöcj‡Fg¶·‡ê¢hûBŸñ²–OÑ|ÐØð+2C™¨0º8ç‰Ñù$·d!þúà¸)‘qä&šn#+FYÅeŒ–CFü¾ó.µ8kÈvüu„¼ÇŸNðA=mlÎL xëõIpôðÌŠW“kÜî”kU»òžÔýàS¿»êÐy#{15)Є+>ÇiÀ#Ÿ0¶`-rOz_Ì—-Ë'ì߿ÚAà0{ vöõvGÌÆŸ÷>€ø1—p ~BbQ7"a&…FŒ;>›’fZ7@R}vÀ,©{Î'tÛÄ1‡È¶Ûã0—£QTb3pìËî.*R˜³ cT”›Ü~&á³m®¹àT¦ð±A‚D¼.[&aÇÄ0’ç¤gè“ùãt¼û—•àø³hó˺¤À+g„÷«¢$® °Ÿ.øªù+:¹FÝ4ËÇ}í¥‡x åÀ"ϬiTLn´* Ç ]U®¦, îÏÕ²xWöŠÖ¶j«®*9f¦WøÿŽž|MsvƒäŒ9^f4˜ŠëØË-…ùbÂ>"ø\lEr^»¢º#L`Tv+!B¸Äù¦—< ”a“ÂЉµìØUMíOvb/[Àd‚æð7×ÌУ¬üëXóûa¦2wU‰(>ÖÐ €‘‚Œ”ƒ£νË$ñtW”7Ž{ùƒL¨‰ õêHM®ÃÞ‚z÷åZ6Úðï3Ñ¡UG_|?.m ‹Ÿ½[¸€H2‚E’óÜˈ6·œ8Æ Ï—S‡ò~Îï~p‡^J×ÉU´u-:ÑÕ¼9ÃJ—Ì™-fs92kRLrõæ¥ç[MAÓù‡!24;y7jáDoæÙ|µÝì+,´løÈ?R˜÷0Þœa’äc4'7ç,>‰[‡r[±¶Ê.}3Y™ÌdSßfþ&0ª½â›ÉuduqîFñòo±TV¤¯@:ª½rìÕvxìÝo½ÜeÖ²Í4¹ÜL—…ZáÄS!‚ jYÆ`‚ˆxn+êÆ^:¦ …/%H@g·V¿è¨Ng\»Þm—6®bÅüv!æ±4ù³“›ª‰´ÎæÄïÀ²T†8y¢ßP$H8(›'Ì,êÏ=kï=½Ì]uâ,ã”°S{ܯëÍ,™> endobj 177 0 obj << /Type /Annot /Border [0 0 0] /Rect [294.8323 496.1787 479.4747 507.0878] /Subtype /Link /A << /S /GoTo /D (Invoking numdiff) >> >> endobj 178 0 obj << /Type /Annot /Border [0 0 0] /Rect [505.1796 496.1787 525.5433 507.0878] /Subtype /Link /A << /S /GoTo /D (Use of the option -f) >> >> endobj 179 0 obj << /Type /Annot /Border [0 0 0] /Rect [72 483.028 191.0304 493.9371] /Subtype /Link /A << /S /GoTo /D (Use of the option -f) >> >> endobj 180 0 obj << /Type /Annot /Border [0 0 0] /Rect [201.2123 440.5872 383.6064 451.4963] /Subtype /Link /A << /S /GoTo /D (Invoking numdiff) >> >> endobj 176 0 obj << /D [174 0 R /XYZ 72 769.8898 null] >> endobj 173 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 183 0 obj << /Length 3908 /Filter /FlateDecode >> stream xÚíÛnÜ6ö½_á‡"E$EŠ*°©Ó¤.rCí]ì.°òX㢑¼’¦Žûõ{.$%5ÉlЇ}XðP¼+ÏŒ8KàŸ8ËäYfUlU–ž­wß%®ûÓwµV0c5òÃõw/^kq&’8Orqv½™mr}û÷èb[ÜŸ‹h(ÏW"êÎWJ©(ýþ|•¦itÙôCQ×0\5w0$T&#¡Ïÿyýów?^°ZêX§J} »0ï)Ž€•Èb)têq”&Nt*Çô|¥$t—#Àã¼äl+ó\iZy}nUÔ갼߯×HdÙ÷ø³Möuýˆƒ"¢‘vw_AoM¼xŽ6ºÙ#°ú–§kTŽ5ôñ~¿»­þ‘åµ»[*´Ì¢¶îy¤èJntå¿÷U;¨[hÄ@£J¢ë­›Û¥8pNÛ¸ÁÊï× h¡b¡“Œˆ~ùþêÆS]ðO ®ö;†˜f)°¾·H$n R_Ó̲ãµý¶Ýã²[þ,þ­Ë"`†Ýb]Þ»ïÈ€F{?TmƒmýË LN¦¤Š³L¢’ î«vIªBÄ©NS7癃ÑòïCW Z58Z”ÚpO¹5§åfALM×±”FÏ™×߃ÈlTA¨ (ˆ©·Ü®KÔŒÜÓh%Ј`˜L˜´H¦2Ö6Ï=™¯N#¶Û´7vźk{‰» ;Ô@Ü ÝTH) °ä Œè€}Qk€ÒzDë“%yX§±eÑ­ÏAõ·Ø—ŒD“9÷t8ùuåÐw49‰ØhdZ]Ý ñªð#o$4IùhÊäO1ly‰ò‹Ô¿Æósë6(šó ‘%qj´š¹d@|©Wʺìù»+§’' ƒ£,±MÁ(!‘Æ9ðz%tœ‹\ÒîhdQ³ÙÎJ““ÑB+„í›Q—ˆ7ÆQ¼÷´¬r¿Á2û8lãƒ6O9v²TMæœb?8¥¤¾Öí~UÄÊOø ;Iœ`œg‰“ƒ}±gðc3ÖÞ_xšI¦J°’±R¹=[%±’ÖÒD S/*L s•ÓçÚÍ}óþ×oAl2öŸ=X!¹õP‘„¡…†a[ŽgK&¸ÏT‚,‰®÷¶,…0‘ŠU Ÿ†¿Ú ÿºý¨ (pãÂýÌÛqç?¼ž‹ 6XZàÙ:À¹BÙd8>Aóì3P‰&±DBq©<ÊdÒ<A‰,"´ÓØœá,øË+ôoj&ù“àÇ„DÞbëÁ3Š`CÇ› çrAäqúÜ9£†û–©sæ9@cPÐû™{)ª@XÕÌd´WåMÅAÂj‚‘—YÆš™ýiš)­‘_ÖÌÚn{ÝLYhÈÍ‹É,Á:œF2IŒ–¾Pز QMÑ—^±Æ™0øŠºÑ8!3¦û‹•NefÝáI!ÿ›W ŒËMœ&"ûSÏ4Û2t³X$9Ç®:¶Ž;ÉC‹% ,fÑåРESÐG[ èS¯†-¹…쨔5Ì ùÖá0ƒ•öf€CÚ"w6n¶*`63‹û/¸knV»‰QWùܪ¿kƒkªò€°á¿ –#ËÛø‰¥3Åÿ|dZEt‰ƒ¿a§‰ª€@]îœW€½†"D@dÌ7<{Ø–K\¦“À‡óλâS¹$>Hk¬ÞÏï)þª! x ÉÍ½é™ Cž ˆäƒà )NhÄ ï“Fï 깑ÎW"3,R&­¥óèç–ãZýßñ”+Ž(3¨Éó»Šæàw.Jî£|‡Cc0NpnœBÁë"À+ø›…sùᢉ`°µCÚKIÉà—lÄó—nŽÜ[ÕÝëv‹JÇ™±>†ÃÝ–„.bkóÌMÚTaÖ\æpë5R)£Dô’(Á¸[ƒ¡ïÐâTˆQ‹±¿))™€r(7Ê·“X¸ã᪠Ù_AÒñ‚1âü²×…å¹ågZ³i¹N»_ÐÝŽ©õ ­ãYìäcMZf’X›lÎÖq8ë·¬Qëý\„ÞþÎ,SÁ?½Ï5ƒÝ®Ù`ôÛÕDÑ`£›  Ç#‹¶qñåݾ+&iVdì÷˜¶‹(hµNü1™Ê ûh§{ðû~ïUutâëÂÍ 'öº¤±Ã¢BÛí|À¨R Â;ÊFï¶¼.˜NXæÄKHQ$àãkOí„÷´Ž^9áæPÞ÷ß/éqaÀ‚Дeñ‹uÛl*àW¹.x ·Øõ›À´%/vQÑÒKdh¢&‡ ‘X=Ààçwo«`¼lŠ›zLi|_ ûŽJ?üý–Xv·/îÜ„«=ê ¢¶¸3{^Etžzö9ÔÁQ_ão⊠ðKÁŸ?!ÉÄñAÆYsIÏ™^*KýAM§ŒK¼¤‚'´gK‡G•*+Ú:¢¡s×N—3HÕ¬¦3/?Šl°·æš“C ñw(…€VTpÏ|£i¡œàsƒ¡¤S±(އUËÙ®Îb%ù5g93œÏœQ<3â6´¶Å¸¼ÅBb#`«YM`h}ƒ/ØR´,Á¡þì›NŠZVùUS÷‹j¯óØdêà ý€2’ dÏ›‚2NtJªeÞÁ:ŸqŽPþÂa3&6ÀñI€9ÆAë‰óàî³ê@ƒ+Z¨ ’,%¥IËU•È ¹û¾{Q·ë¢~qS5K(‚¤„Mf’–òXu $ ÔÓ­«f³X´µHòI7R .K%ÊaÍ^d•*ý k lŒ3剎žÔ$ª+aÀ,?iÂR.B{¯cc9Î9¤Ï¼¶å¨ºã/²~»E>H8CÆÈì #–xsåX8}ÆÛî{.Õ'Ú[O3«Oƒls_‡Z­î»rS}^›B´+²ìÖWÍ,YX²Vi/Æ™kzB-¤1Vxq5$Ì%A\a¤C3ª~¨d¹µLºÅŠJz@ú_ÿòÓ‡w?ž ×‹Îw3àH+}Üý’mù:4çUÕÜ:½&=еÍ]QdŸ±€ÏèÚšdôÄÒ TClŒé“Ò`ÃîiTçÉ}U˜ÛPâ\)À’ä×ÕÆ!µl ˜øt#»jP 4ÍvõŽéè[GO&@@š±2œóG.ŒŽr=k´˜«ð²§‹|è?)êØjµ-ëûÅô#v¸xæ‡s]íÍPT.|"ŽW1u9¸/òÒáÖe’³Y?HËëÔhÐ¥V¯p0Üô^¯àü'V«¹º¾$5zäèˆsIWosðȳTÑ£zOÈè¬ô^æ¹O9Öõ~™[ÎàÇ•gùã×>d,°É»‚ëHEíW0`¢+ Î% 8R9°¬Ø>Êä¼×¯ÞPáa¢µþxäÑÙO×ïÞRQD_½æFˆ/_ÈÔ,@yyåËY—ĘKîf£õ­q(~ïµqÃzÂêž7Ó „²x¦äõÓÎN¥…d嫯.YÙb#uðè ¦õ›Íi§k¯³t®›Xy=[œÀb-–Ð9(ƒ%/ˆåÁ–Œ·оçk “/øîùM’»ðµ˜|²˜zF:bt LÊ‚9ºm×§Ù8Þ´åb–Ä Â!à):¿-\?ê„Ô~r±‘‡; >j¼g»|—6-O²“üëÌ’>ÿ‚[_Ô¹™MüøË¯/;Aã8Ȇžß`ñóOe·¨d°s–åéˆðpDb.&¼á ÕË)Řò£lÀM£^}æ¹ý“«KªæecÉm®°sMËŽySib+³üO Â|X4u cRò…°(±M­ù–PÔùÆTdTCš8•³  ÒèåR ÐyÀÆÁ ¼<oÆ‚ÁA–ϰ›ß•»v^rH£…¤^Ïo,aÈà÷ª aRíƒôiŽ5Å$”^vm0¿¯Ð™w3_5ÆÌpß|!7ÌlœäÉôà˜Dr!Æš àƒ2’_ ³¨û–[?0—ŸPf°æi­7éÚ=ÕÂì±$(3¨ÜöX:|,‡,˜} ˆëR8U Å4g@)B†Ì‹œªTÙA±{èB]Ù(ÜUì&—œÕ*VÚŠ#ÓP0ƒöoA²ÖF£©ž¾<Ä[D’.:C‚ÝðïM8©ÕzÄÊ‹h¤yL¶¥[ëudf€”§ð©õa¾äà 2qðÁÛ¤ó6P‰Ù3c©¥ûŪZQ5Óœ]Ë “ؾ/úð& uû(&Ã_ŸeiõÔüN8RuW7IïóWN{¨©'/Ÿó+ ºuxl|»¢Åh~øí_a:¼†)g(=c£Ã&Æ@¶`ïâÿoc¾ÁÆ|øxý?lcð?Uü” 5endstream endobj 182 0 obj << /Type /Page /Contents 183 0 R /Resources 181 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 154 0 R >> endobj 50 0 obj << /D [182 0 R /XYZ 72 769.8898 null] >> endobj 75 0 obj << /D [182 0 R /XYZ 72 769.8898 null] >> endobj 181 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F52 23 0 R /F3 186 0 R /F60 19 0 R /F58 189 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 195 0 obj << /Length 1669 /Filter /FlateDecode >> stream xÚ­XÛŽÛ6}߯ð[e ’EQ×}hÚô†f Û§4@e[¶…•%A’³Ù¿ïœRkËZ¸(ŠkŠr.ð’ÈôŒˆçÃA€©uHLf9-á5;ù½GÄ‚n²Îú:›ÜH®ùºÌY9+Ý4Ƕ*ûC±}#2@c¨”ÕÁ-ŒÄpè¾ÜÃ( e±•«ØS:‹Øoµiê]¹?!ÐĤ×`z}Ìg3†çù‹¤»³F|b¤€Lœ€°3y2ñÈ#’’ál@ƒóÅíb¸id()Qt»¦“ݘdpâH„›•ﯗɫCb ‡ÁÈTCÉ”h þV/ø&ʾ´æþ-%cÄ##w(åu@y\"Õ»º>¥JäçUßÈ—€±2ª…+UfóŒ[Â2P°öá#g\¤ÞÈB¹“‚¸Ä š+Œ×š%|JMº¯Ë(rrU#Uc_>ˆì>ñòÖJñ )¥3çc›(0¬ÚÎE£4b˜¾«mAL¨ÐL‹&m6T Žà© ek̃ %ù¦œàˆ¸Ê\̱ÊL•½Y’óv„ >Q&ÒÉF ‘xÁ€#µñLmã×=;DîeB3Al«Ö,,&¬)EÈys_4D,ˆ—ûÑ·uU hdJ;“É qjäbŒ.&_¢›:œÃ5ݱïT1X[«ª½‚=ç]É*'ð&KŒg†ñžö®ÍFDq†V>|”^…š¦¯ãQ9h/Åñ‚¤ÝÑŸˆb±³°u –hØæ=Kgc¼0ûÒ&óu>ÐÔRF:ž6…ûcû}ÝÌ`Ñ0Uç}a*8~U±^|ÖwZz&ÿ¢—0žš†|Æ¥K´²Tá¶h;› ›|(lѤ›HmËUÓ·ù& A$N𘢈ðÂäMx.2ÿ&%´ÏO0ÖS%”‰¡L á]œ/½î¥ |›“8cTq» é0™ÚD™ç§ú™g£»åÅÕq B²)$¶àç#ÌÎÏôÔ2eû¦8ˆvðÒyë¹\6å(8Do1Ñ[%3¨ÖÎ\RzDBâ¢ÜÒôŽ^$Ĺ`zEFní†öíjE½}}òšn¿¢ß¥Õê*È¡·À…×A¶b×v\yzœ ²ŠèE3¾_)[ãL d§Hü>µs--ã²×á }â‚4Q7‚8ŠÝåÕqpá0pD÷hå×Ыÿåðc/ Tßä(v#‘ ¼0 ’Ëk%fÚ}Y½àAnÜ¡q-70 -+gì—ùmcȇŸ7æWúOÐ5¤!]›qñ¥Êw'endstream endobj 194 0 obj << /Type /Page /Contents 195 0 R /Resources 193 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 200 0 R /Annots [ 197 0 R 198 0 R 199 0 R ] >> endobj 197 0 obj << /Type /Annot /Border [0 0 0] /Rect [72 474.6594 259.083 485.5685] /Subtype /Link /A << /S /GoTo /D (with GNU MP is better) >> >> endobj 198 0 obj << /Type /Annot /Border [0 0 0] /Rect [72 461.8118 220.9075 471.8118] /Subtype /Link /A << /S /URI /URI (ftp://ftp.gnu.org/gnu/gmp/) >> >> endobj 199 0 obj << /Type /Annot /Border [0 0 0] /Rect [403.1871 461.8118 506.2769 471.8118] /Subtype /Link /A << /S /URI /URI (http://gmplib.org/) >> >> endobj 196 0 obj << /D [194 0 R /XYZ 72 769.8898 null] >> endobj 193 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 204 0 obj << /Length 2503 /Filter /FlateDecode >> stream xÚÝY[ÛÆ~÷¯X ¥€á 9$eÀ©ë [ÔkÃÞ¶iåR#‰0E*äÈ7äÇ÷܆"enëfÑ>­¹ž9sÎwn³ê*†ê*×Wy‘DE’§WÕáQ,Ãï)i…°"œ.ùýí£ï~0êJÅÑ:^««ÛíŒÈíæMðt_W*pvª _…I’æñ*LÓ4¸nWºÞãÝ»Vµ;^@ã§Ã†êŸc•¬B]Ä© T¾z{û§GÏnG–Œ6‘I“äßq>®û’àXå‘V&õüë,ŠMªˆ³ M¦‘ÕD«‰V‘-b5OV‘}b™$S™ÄW¡Î£õºÐDòõßaíÍ‹—(‘×мæoÔÓ©‰Ö…¡«,R:æí-ž¶Ý®ðNA¸ÿ5 ÷¶9þ¾‡Ö{Ûu× ­™bÂDEq’_ëú¥s—ÎÎ}ܸþáõÛ7aÉçßÿøìÕ+è÷} ß7<öòÕ³§Ð{ ß |×o‘‘J"eâœÎznxõSõ÷ºYoǽuƒ½ãl®õì¬WOzóS39õG^¡_ßܾ»ZºÏàû|wðý¾_àÃÛžïú<ݵ|»Ÿæ;~šŸs€ïðmßÜüåù[hà`#âûþ§ºIO4X\@nzâ¶n¬Z…Yª¨©²ˆ¶{Û[YnfÑQºÎs8 —ôÓ°Lf®–Èë4*ŒJd}Ùn–ˆj©,M–ˆêû‰jO8 S ÞfÏ»°Ý–Ú?p·Ûâo<[âÐÝ|Xé<èx†éÆÊ&'ãUw@RèÐÆ³Êznƒú¸1¸i~’ý[X–Æëùü#ú´ jW“$ƒèã4J²ÔÌÕW“Ct^;+Žôýʘ D,ޤt Îø±]òT\·;¿p‹¿Ú“¶»©ƒºÐ=ù‡oy¼©ß1¯DB…2œ„f~z˜Gt•Fë4 <)xCT€ÅÆ(ì~pܯÊÏ´KŽ)7‘^«Lôí=Ò0Ò$ŠAÚ²ðؓ˦›|JÉ\ÐQ{–ãt¦Üú96qÛ¹ÉÂî¾Me…CV6Í'| ~ q• pTðŸfEë$tÅ$1†t-óÌ®!®à¢;‚Ší¿ˆ$I¤s°¼™ïzÚ qtÓÝž®ŠêQiðg¤K Úv@Ý©8@Ðv®æQYwó"üÛªHÚ}IÇ;4 ¸LÁ¦h1‚­¬É …ñz´ll!–{uË8<”£¯Æë€¥÷Õ{áê²Í–#dO KÎô…^7.B)ç /£^FɸêHîFQ‹ðR¨¼X¾4$…Ç×Ü/ ÂL2zlO ö‚«¿Â'µÂÞÜYŸRð>ª Â$¢ó€h‚3]×b !‰²ßÖ£1“ÅQ¬ò¹ä>ìAÿ°h’‹ÅI5MÇÑ MÖ‰-òŸñÄÅÆQ†‡ GjòàÖo'™w‡ãèÌLKG§Ç#Ý’Fq÷lq§fÃÄ*x~'N´ýQPx*”@ö¶Bù,a‡cC ð®™ul’ɧqFÍæqtvƒ7ʲà9ÁÙ²/ð¹+Z&øtãÅUÌ•E¤f*¡5UÙ²r·÷¢ÙúFÏ[8 ¼`qŒ¼Ïd…îÂ\¡k­4¶K÷÷4Up`L±¿|.I¦£\ç>F‡KÖap…Ê$&hÃno·«ò©xEܦF™DKIt˜Qj(2N¢É‹—·Èþõ‹›×KŒà}×Q\¬ù¾ÿXLv!×ÇëøP†ƒ=–=šÖÈq—ˆ«8ƒ{fþž¿cS3˜,™{ç×bï¨UŒ.;k5É ñTŽ'(>â*ôÁû’‚7[ÆÈÀßÓ üÀ@†V;„åÉöˆîRfšºµo¥ê‹à)4È'56 \þæÖ“ÚØm‰„·«óE@œh$ròeå¦!PËïp,+š58 ˜§PÜäÚP û¡©Ç69?eq¬ÿc½—£ÞË»¡kNΆ®k,DÂÊ>á:f‘¤Fçs <£¢ÐÅ\,÷€ ö+,?Ö®}y ¼ó.µ£lÌÉÂs¹Iqض•L%W8ÔÎaHAòâ)·]ﱆî»trø4ùÅ)¾G a’€[¦ˆXP:%ÄlÙ”£d7V´VŠ~'%=3Ή-­9#LŽþ°<5‚Z˜™'§Sð|¶}÷p$ô#zÛ@âòþ„ jg'”R”Q`T^øÀSÂØÊÀxaù¤>tæ;9¶tÒ™b½Ñ#pŽHÈþ¿ Ï±ÀÁåÝ’Ú³,Êó…Ö£83JÁbè9C9‹\]æ 0 Ùÿ̱´à×ß›ÊSÌvHj’DLdN d¡ý…+îQ¾†Å Ò¬·ü+Ù9¥eÐõÎPèp¦¿`ýsD¢Ð6¤\ËhÇ D&%âS®… û‘§iõ†]¾ó¨º~¼Ù …3qB@Þ ÑF½¸Jö‡˜Z ˜™‡aß5#û¿ߌ˜ØÔ»Ú Oð=k k(UsuŒ4ŽòX}7ÐyæKäL,ì_çcnÆ9"ÎcŒÕ¹ ˆ%ŽP!bÀg:RbáØPïZ±¼´âòAVŸ|¨¡R¶ù푤Raé8j¤ªéÉ‘FËýÛ3rž’÷ËQÞG~,±!Ödìâ†EGœfQ¡²l.ùµŽtš]T@×»v ŠfÍ/) ¶‹/ÝSå_‘ü,=¹ɘL1Um‘ª K†n}½2”™âœÉí /¬Í,Éç¿M.Þ†¨¸9„-/â ŽíŠ71;‚ÃÙ¨ÒÉnþN05OÑ÷Jé0^FÏ£s÷¯zÆÍŒÖîÊÿ"0òä Œ\/GZÎú`mü~ŒŠÇçÌ%UÎϵ5ŽMŸ/y-kÎÓcA‚ hìFã,½Òäò˜P¶ÿª $_KÀëÉk.@cöš‹+‰náJ÷Έ°çizçqð@\ ¨Qc6¬Î/;¿ÑOUOòðeK»³H_*¹Àõou3É\º©95õäOaˆ¹4âç Úõ0šþð0álΡÊVõ¡lÀ…Ö­{‚ÿX´ÄDI¦/êÙ„´ÖÉ×”2SUßW·ÊC´õïe‚2Iÿ¦Â§9 ݃OD –§JÖ •±sNèÓ'Wgà]¼=xÈÓþƒïFÁ»}w Ê“ׄ{ÅŸ­£\s‘J*b7Ù×¼'¨síûTS* v©å SO–¯"îJ)qM,1¼™ó•wÝqï4¹ÅÙŸu„!'sUw—\Û†õþý'Þ!‹endstream endobj 203 0 obj << /Type /Page /Contents 204 0 R /Resources 202 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 200 0 R >> endobj 51 0 obj << /D [203 0 R /XYZ 72 769.8898 null] >> endobj 79 0 obj << /D [203 0 R /XYZ 72 769.8898 null] >> endobj 202 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F53 119 0 R /F52 23 0 R /F58 189 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 207 0 obj << /Length 1862 /Filter /FlateDecode >> stream xÚåYIÛ6¾Ï¯˜[e REí C›H¹dÐm Tcql!²ähIÆùõy I-Öx.ï{ÛGޏváŸ¸Ž½ë8ñăëõîÊUݯ„jÙ aE~½¹úùM(®…ë¤n*®oî&‹Üä[/·Ù~%¬N®la5+Û÷}+|¾²ƒ °ÞV+/±>ãõǤª P¿Ë¡«øà e{‰„–HVÿÜüvõúÆ)ôB' |ÿ±“¹sÎïEŽ‚Îÿ/îBÞXÈw\ßõae”°7ÏøÔ¶½iê~o—²ÚtÛïÄ;OMžì ¼Ô‰üPÍþ EàT¡ãF g ߡӨû=([rØw€Æ€ó«ƒæVr›±‚ŽÝ doy†;ð|«¾ãß¼Ø Ä]ËÓîêfWTбáo™­qþ–…QÛó˜^¢ÛB_Ý·Y…–Q Á"jPêÃÁ¾Q¹,”0N¥fu5éíj…#Rx]ïP&k$#ÆNäºàx"qÂ(ŒÏµÊÞXe_ö­½oä]qÿâ¥xù€Q|hÇÉÔ*Qêø~œža܉ÀÆ7të}WÔˆoV§à}£a@L }¯1ÁQ0‰£ ê–6@›#´zñF°j?B»{6 tæ¼ †Å’(4± v¨s”ãstj ¬±¿Ø •1¸Û9v¸(8&f€­P½ûP(ª‘®ä&;]ßê[úš@ëé­Náª6eL}‹NK¸ÒKÐFçB+ ´ò~_W²ê õtlF7ˆœDDÑÞÔs¼ ŠŸ /r¯|vGí;âc|cÆV­chš4XHXƒoþ°LQ‹]¶)ª¬9Ø}Ut'`Ž›¤ÁÆ$rB‘†O…‘Ó.ùCFRr&[ šdgº5,ÚYBEmÔãWÑ=úïÉ g;îŸ#Ç]—}._ˆçoßÝ,BíFÔco uè‘?ƒZ– sw¬#ª$KUµ°KÚ,g‹ i»‘óI-‘©ÞmfèŠî$u¡-UI-45&¥ƒôM5¶ú Ê;/òàXÂ)çð~´sx±èUìMo-Ë sÌeù9e]WD—\ã,—©Õ•s ŧv5 ±óNßP&Êyœ8P£/ʼ°ÚáÿéM£¯þŸ)}N$D8"Nç Á‹œHœH‘fH‘XλþšÈU²œ4†‰¥Ôr™ZzvDZš á£7> endobj 208 0 obj << /D [206 0 R /XYZ 72 769.8898 null] >> endobj 205 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 211 0 obj << /Length 2561 /Filter /FlateDecode >> stream xÚÅYYÛF~÷¯äÅÖä²ÙÍ+€¼žñÆ/Ø v8@8%q#‘ Ç¿~ëj^æØÌ‹†dwuUuu_µÔ…ê".âD{‰ŽÍÅæôÈ—á?)ys“ücýèï/Bu¡|/õSu±ÞM˜¬·¿:ÏÙy¥œ6_¹Ê©W®ÖÚ \¹Æçe¹ çþ«þ(€ªÜ3w§- }¥Wnø&tTºúmýó£«u¯R„^h´þžæ=Ý}ô"Ï"ýG‰@Œ‰´çk_g¤pzÂZ»nsÎó­{Ìê}îîŠcÞÈ≤^¤CYýI@«Ðó# s•öTèÇ4wÙꢄÿdã4·åms¨a¬*‹/Y[T%‹ÏšmŒkNø’ó0iëÁ”fQ/úÎÊ-Óœ2²ø-5\žµíŠ˜€ ¹Ð5Ä8;"fÁÚd¤"Ñ6¼Ÿ0ö"ßwQ‰—¦¡¹¯-w½-Û¼iшm^ÿúôÍ/¯{˜-ßwh¦ «¡ö·üÑVb(Ÿ¬sœ¸*Ðζ–8Í¡Â}ßðB´ÓA˜ÔÖfMwÄñ†‡«/,ÚFø¶,ætn…y%¬û&E‹/¸% HÈ’ƒØ©h»þtŸv¬„·r£ r^âÇN N¬ö‹£D f^²²V^bKTàRã|!'«+þªÐ`©–ÙÐAå«–çš3°““_aœ£’ùŽÚøp êÜµÌ “EäjU#_Jûü²©ŽÝ©oìôç«E™ÛM/nØ•ª4šZíîÇ: ÇOB'Ç^Qи…‚2YÎDœÂ(êz¬¨rÐÉÓw޹‘v iç°ô„»^P]%+ ºÿ} æÆb®šÅ)±N`±ôY¶˜ò}/ö£ø>b¿6E¤Ž! D*¶Fˆ¨Ì÷¾z£ÁCò>þ¿f—©Ÿ°×c)¨„ˆÜ kÆÈqàsSØg(Hcr…fʼn³-8,a%&‚Ì&>xdÂiäzðå.Æ Ô“4J¿k„Ñì(Ø" ýÔÌÜpæÏ˜½©,‚K?(«®û¬š>CÖwÛìz±6¥¡Ä*žæSƒç¯’©ªWŸÑö½aäMä oç2iÎÙFŠÓ^xjìúðys($i!ݶhÎø™aèÜbd0@”–¤¾Ø[aOI–ˆVD…,0«ÆÎØÄÊE_a`!“žkö9t-Úú`WKYýè‡>—Ù¬dè²ëlYÔàƒG)¦mµÏ­Bý©Þ0Ä„ŽúîÂ♫‡ø±?ñ›¬.Á~ÛVOß=[ÿ´\F5¼ÇÉôÜ£ÔÓ:Ngu´7EQç›–QÀ Èé ჋@6NÆ”í³Ý®d{‹FvDr Ónóº¶&”çAl_”$ÓŸ è$# ça¬z¢«ví¶»È,š®B¯øŸ%îj6‚fçm)õuíÿчއüx^2Bz*Qzjß‹”2S|8PPYðdœ>4€1;Gv“YÔÚ;ÒphŽ[*gÛlò¶EØ.?õ»ü”×$…¯ÛOGA:Ý¨Š½8ÕßÙ(×9fG->,æã¥½šªXsSµ>ÈÙæŸ qì¦ÍÚ®Ÿ•|î¬Ï[°n&(˜&÷$ÊÁóÌkúvrne&‡ðü­X­„ævYŸXÕP‚0¤Œ-ÉOŽÈF–VÂ;—Dè-Úyj+¶òпX)¨kdî_^á¹­™+àŽ«÷h{dý§ß¾ýlànm;¾ÐßÙ´Ë.VÙÒC&ÊW½y8µ Â>³:'˜ªï{¦—ïO™Ô@ÁÇ…8=åÇïÞc[q¡ ‹[P6äº@Þ*ª5¹ÅkYµv?–ÙŸñK– PrŠªìiGì¹)1Ÿà9‘܉Yï»C¹=hwž(¥—ö÷*϶ãnÞvÅãn‹}9ÝáRòR Ês¤máùÛbZöâ fÉ +NO,5׬ϰˆÐá}¢žíâæZº‹‡ú®o‰¥}–2gqkç7Öw0/ˆmÊ|É}òEIn§É´Gìšq±°´˪Í+}]=eû¢¤è—L€§OPO*·U¦°î·Î:ÆÉ‡·¯¯¸ž]ýûÝ«g°ø jÁQKúÛ7÷H¤C5¡?ÀȆ¿=&м@ òÜËE!Ê3¡±ÝãclÑãä4žVÚ’ºWÿ[v×÷`‡·ˆ)ã|Y®ñÚ3¦oÔÜ?ï϶ÛîƒÃè>ø<â@Hù²åaÌ,DfOê!´¬£Îg¾€ã3Iá|}µÔŒìëLðq¶ÙTõv|gjÓwSė뎱5øÈûÎRlâp܉˜ØÜáAgâ(ü+ÄÜZ@/{?,Êr|ÿg¾íN'iÃqèÄMW ?x+7‰¼.ffiáA—)ñ‚ÊAxQ`¬”Ýi[ìvKŠòQ¢„p[ UCÔ¶WZø~–›YÎM¬• àC/Žæ}ÓíѵY±¡\¦ÐíN0IŸ“6Ü%Ùû™@CŽæ>²JîÔ¯ðß³ã 6Írò›Wq+3×MWKݰ÷K¥Áª,®¿Þ„wZMø` ÁAªävFò[ËwuÉ•mqptvuÉ÷A}6fVŒ $L‚;̈3 _G7(˜l¢Ô¹¹È´w<£ç]œ„áA(9þ7çeÍ!ìá÷Œ×}Z…œF'dÞBnˆàk* l¼pÑcßPn°é=a$Ïñüdg‚ù¤ßÜô5]xÁÜ;£ë©ñ¤rƒÜYØâÄüþ&Ϧâçføí`ðœÐ{hH’rFÞHóÔ àSØeÄÇ"¦'K1?³Ý·b^B꯿g1oPÕ€ÃbGþdÃÐü'®gðæ†²•=y9jê> endobj 212 0 obj << /D [210 0 R /XYZ 72 769.8898 null] >> endobj 213 0 obj << /D [210 0 R /XYZ 372.0611 403.1318 null] >> endobj 209 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F55 192 0 R /F53 119 0 R >> /ProcSet [ /PDF /Text ] >> endobj 216 0 obj << /Length 1946 /Filter /FlateDecode >> stream xÚXYoÛF~ϯpã‡R@´å¼‚&èHѧÂh 4JY+K %*âŸúývîxÍ÷û5LíÞÅR/–*M©xñÏͯÏ~¹LJT"£õS–û.±_¥"NŒ$ûo릱-+²¨>UøƒÆJUônñEá=»-ÌZÞPûVáN¦*ûßÓ¨vó÷¸gØŒ:܆[|¯÷Dz!ewN ÂtOðñDv´t$‹ÏÎíë”Õ:súÉʶt£ú01xãåƒ5v˜ŠK©…LâÌÁB>êÊ—\Q‰œng«5¾dцî³÷[´èvnyf ëöa×vNŠ®y/€û:Ñνq7jö2½䑉6|â‘Y±X¦ºˆÞnxÿ'µçå²±<{¨»9)ÁÑ ¦‡Ã`‹Š£’ú„/rpxgž T`×mßuóqÞ;Æm½G íLß ë–ç»-¢R÷w[–8ÜSS)ôvõ—þEÓðjJxçÂÈn„YþåöÌ‚BJacÜžo‘aJOüw8U æQàN½Ë„&GZgûn8h U`]!òL›9ÙÚ®éo»Þ9_IÔîöÇ ±- R±Îð éÙ1qžbf§Ã¦&CË<æ5Î;°¾Gš®ˆb#K F¡9ÎØr¯â-xàâ2cöò]åQÀ5qÁØ7&½©}ü¬µÚ…1<ƒÌÑ&"ZÀzÉŠ®a€ª¤…A7¤Âè\“¾¼Ÿ2H+æ”22Ì©$&N2Ï©ÕyN%žS,¹kЈ»»7-Îk†7¼“Ú¬( Ò– AqRc• øhé9ijdööàDSþqòön³ Y/ )2é ;@Úm6¡%2­ü-×õ耖Ub² Á‘Ó¶c[Ãv¢1y넸ȅ2i1÷ýÎùn9ð'†‰°1Z´ˆ0Ý<¯ÚŒ5ÉsOPá³îȰÜS ÁKÉ|«‡ î6m.¹!±œ‘$òsQUb(]JBŽºç="=Í*Ÿœ”&ÈI3rÒdš8‰ªü¤eªð`êiùá"Z¢´Žü´lZ7áÕ"?ô;ordzûóTGR^r&ºÌÁâP¾“ýˆÌ›(SˆØäÙ$M€=… “ÕIM†$e‹†t³„ÀR's湺F)vhƒbçÉØ7 <×v%è²Yó"—·#ýÅøÂÜøÍ %…vÇ3`d!.÷ϰ¸ÁaåV7üëwìº*±âÌŒ×("§¨«yå=w´p¿µ’@ɇ¬© èÌêþèÂ_1Ôð9&ž£&öC_V8L(TpŠ3$ ñ©ªà>î°¡Ö‡˜Q"Àœ~Q}y`A+‚Ê[±ÂMЛÙ5O¬ð²Ÿx\1ªõ{ß­àqŒ>\äD‹6>ìÜ8±c¨5(”Z(ÛÕwM¹¢–è8µ(qr¦œä"Ës“Ë?.hQX”´¨j°ÆH6Ÿ¶¸Ò0€uë6 Q˜A• Z¢ª%$‰ÈïÄUgYQ\«Z(gn#ÃȲûYçJK~P^r=õ¤¡…«7ÖuÈf] šæþ[¹&ÕÄr–|dˆ ¤®om¹Æ¦ çîg_)4`8ݺÇdzÚºfÕn8ÜòÖ¡ùá«`Kn —äayPZ®'×EQ­ÿrªŒûvÜÏÃMåóo­Æ{ï”àc9"fäÒïµüF_·Ç1«–ˆVpÎã1Â8n¦þжpÝ$7Ñ›E®¹†’L¢ƒû±.Š’ÂÆ)ð¬ÎÇÏ o\¸áWJhèA|I(»R†Ø¨r‘êtPy<ˆã°p) èi&²ÕyÙr.|úMI”5Ô‰‚|ô¦TláŒHUªç9G*ü¬MâHë§•_6F$¡ ±ˆã¼dI$a¬ÂR¤@E2IK ¢R÷r_v§•Ä‘±J.ðGŠhU—]‚l¼Ö×§ïo.»¿ÐgH¨Ë¸ìÖ,x]ß}³g,÷¾cr‡²AõÂ×)èœ]`îMZ r¬Eú(‘Ó(J!%O%¿„ÜLM# à]Uñhþ±pjꦮª!« ývÒ}‡©¨ï^†l‡\äEzÒ>/Oþ…u}¼IÁ3ß¿zÅîz2TÆ3¯^½ög‚ôR©ÐïON]¿”Ž SŸU4™« ú—\µuÕã/“øf›s.F l÷ÿìR¾àÙßmß/Ïž’B§þ¿]¾ u}Šúù'=97Àp6j{srîú¥:Åþl¶ ôžÍ⯾ÿ¢Hã8+rƒ§¾£yÌú/Ní£” )Ϧǹ?üÉë×úԟחæŠõ®å ÿ~°Æ‘á¶+øÜì*·ðœò×s·Üò³ÝB?iàݶt§ìÃÑÞvvýÍ׳=y„v°*âoÿÿÅÖÓ4endstream endobj 215 0 obj << /Type /Page /Contents 216 0 R /Resources 214 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 200 0 R >> endobj 217 0 obj << /D [215 0 R /XYZ 72 769.8898 null] >> endobj 214 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 220 0 obj << /Length 3528 /Filter /FlateDecode >> stream xÚíiܶõ»…ë|èlãQHŠ¥ 6š¶ à¢(‚tÑMÊ3Ú!šÑZÒfã¢?¾ï ©c©ÝYÃF¢1â¡(òññ݇,Ÿ ø#Ÿ[õÜæi’§V?ߟ 7ýã3éF[X±.ùÍå³/¾5ò¹I! ùüòjärÿ÷ÍoåÍ…Ü ÕÅVnº‹mš¦óåÅVk½ysºPùæ'ü«ý±†U§k^@ó·Ç=LÕ?™^lU.´Ù(yñËß?ûæ2 d”IŒNÓÇ0ë"ø«)þRˆÄEÉa´¤[|ö™Ì2k6¯^½¾@h€‹ DoÛrèá†VìÛëÑ„ƒ·#üGY«¿zõÊ/i"°‹C>{:`á¸)Ôé¦_óë?Ô§ŠG†êÿ^Õ{ñb_¥|á^÷üÛÚn¨:~¥ÛUý|Sí†jÿ‹ØE>ÿüsÀN±ù6|__]U;áªkQTÔ ¾”¼\nL“d8À#ÿv‘§›ö–¥ãHÒÑü´CÁ*;• '4Þ½ãl{3 „µ§žŸÿéŸ3ßdÀR¥àÆxêöm C)m´vk~ÉG•§=¢pS7t`ÿ¼ÖÌÁÞÕMã· 6\&èS+ø¿FmÙW'^^_=€Žy’ëÜŸµ}w6>µ£^ÙÀa(ð€ ½ q5$$/0#˜Us&^ý\mÊ#í¼EÇK <Ý^¹×{Rü¡nOð[6<[ãÃUÛKzsrsÓÕQbÏóoqæ=ï‹R@i“aì9‚hôü;tõO5¡×¼Ÿ ÖÊܲÔ!b’ųÚó’)^A8Q²ÉDÖ(œD?eáh¡Õ\ÕïõpS'“ââp`ÊÚ;/ù”ȵ‹")¼pŸÀ¾‚žÆ.®5(»ñ~ã% YÐóiã,ß³=âEÊ®îYÏ`ÞÉíp¡v•# !äÒžZÍže wýÖå ÕÕ]°>õCyÚ¹³â,Ͳ$/rÏÑò ޾pE±¢#),©×Ž˜§µMt®ìœyq»ˆt¤Ö*±Êpü¸à¾û¸à~÷qÁ}óqÁ½ù¸àþz8yȩ́ÌR9·ž,mµÉ‚Òic7¯;åÞ:V"|{ƒãÚYÇ=ï~»jd*“ þ;Ã<€íÌ2oGî•ì¦_³ùA¦zîœÐ@Œ×;´-=œ_ðþ]é•MߺÑÍÄú€“g À¾ƒÕ¿§hÀÐÄ.¶•ÜÌf …üê«_½~»žÊøž “æàºjgœ¤á3½ek”™op:0©™ð„rïŒ*6ƒ_×ó¢²ñÆÚCð†i³+‰e´pàß`maUur/ÉgJˆ?ø±¡0V·ü{dÒÜ,’.°!ïå&w…µì‘˜(Ž‚,‘Óð*ø;µW÷C0v¬T/0oÛ¹{û£KhÆM!°ÂEL›Ê!§ÖÅyxÑÑKEd.¬º#Ý Â8‚ùÎŒ°´‰Ì•΀€rsG„ŒGZ$¹Í½—Ùá¡tzWî† î> Ò*‘ÒF‚ •‰ÑçãYqBÆ&67!nüÓYá(BãªÇ“$1½åC=;pL,¯ŠL+»=o¤ l¸¡¿žWñHY%à;åÖBAÌ¡<~¥;{vôC½Ãè'‚Æ8™èÆç®”i4xÂQ\Ð4ß9žbÈT$Fèb®ä‹ Qn¾d31E1O mÁ*ˆ¡’[áw›@ÎÜE¡H·‰qðI/d¯¤€¤Ïm«‚9Ú¸ƒ¨©ìêPŸçàÕ>•öºÃàáJ·ˆãTñ,NáîùéâS²¨6ý¹Þ€%R\õN_p-Ó7wrqëC×Û1šDŠE2QÀ¡GÈyA6NY äÇxvÝV§Ðñ…„q.ióY–†ÏqçšÈª8#2™ïxÄ#È"Éò??™©Ó^€ž^çA™€µ,nOË9ÏøpšÛz.øî€Î”_ê“sÛÜÞžƒíљҼ±ìª¦úélHÂÆÒK°e¬¢¸-Tc»E’“ÄtkëæÃ•+ù¦!{Ín1€öÛ¾mnZdí:JÇ!ø;°>?årN°ÀQÀŠ{;aî!Íä"CÃÛöL…nqýž·³ÃZ?u}¤OK×Ñ'À¬ÖÔ¥É~Û½üDÄÖ@lºkF‰¢íÈnÄi4´HïS5m™úÚç¤0Á1ƒC¤×YLøt„ô,|ðæQáëòuŒúpcb:óÎÛ0t)t¼ô”CÛ83f úLò-×N¥Þó¢ÊR‰a‘#Í9Ü2À-8"˜ë£˜Æ(Œy€“¤Ê´I; ÷Á7Ǫ<ÍC¶Ò—œXÁ\ñ6yNþúO%€ŸâJnSê´¯ñ‚qßüÝ¿3ÙÇÜO}çw(;eç‘åp×G¹±zI©èšw·å˜Ì×QoÆîafkXzûÿ¹{ûçFÓV­ÉÃ1Àý'ÔiÀ ^Ƕ֋5IùÚú° rìªÕ¤PŸŒ©OÀº-âϰ­½K·2@&Kó<‘™`Êÿ‹­ÙC<†—tØ,ä Þ>ƒ¼³æ²nÊ.ɲ=ï ¦){̸dA˜Ü…3=W2žzÃ?ΆezâL{šJ5"©ä çÆœIø¬bÃB§÷“¢mª&ù¿2/ÞqùU<éƒ+gÓ$SE1«ñ‰þ¸üò%`*’çy¢ŒÎÎ(NËôÊ— ”^íÇXÈ`ÏèèØÎ]'ã[/ŸÕËEZºN‡âJʉ Ù¡o¡ô²2Çq|¦“\Ú|ΫÐ1X­4‚´ç2?£D°ÒÊ 7 îñ¸h/‘çU>ÆÈk4¤Ô¤¤A'\»{ÛÒõ :^­]WY§Oa³ª°‰‹fғʲ{ SQ€Ki¡ím†Y¡Ø¦«m™¥úŒ6ÃÀÓQ0î»óô$3Ný²­ÆJ³Èò§$ÚlÈvó(8ò,{¬ùeó`ȳÚ_†ÞàJû+›$x0ÞµGÎÆöWè„Jlµ.´:À¤ªÌ]Ð5´”Êš•4\Ù̹•&4{´9`jþ±0&þ´Ž}è{~àBƒ™¨[_¹77£Ð‡÷¾Îxñ°Ý…õvT¨÷ô!žäoj©9¹c7^nÖDÏêÉÔˬÒs2–κTo¸(èîž hŽœ‘Ù?˜JÎíã¿xYËV„ªŽõµ ¶qQÙþ™•γ)ÐÊë§ØNÝ˽wäÄ÷ð„+ö:Ý~j\òŸFàhÊ \ü@Ë‘/UhÐ=ýÃL?N0Q¤êYk*¸êÙÃÒñ9Çï/ÌÂ6­Ï´­fž[=åkÇl'† VF8z1i'XßN°.Êÿ9ˆC@ÙrSÁº+VÝPR(e”¹ia³É­ýiÓÞ:©².q¦… ÕSÑw§çoƒÏJ,~ew=–L¦¹ m)]=«š÷þK™1ö^±ÿ‚k‹O“Ö4 ¹¾¥© <Ò|<Íéþ¯9çkŽ‚5§ F © ¹Ä8)çẨ¾Ð‹vt[=O…à€­© ¼*ùg.ã4‡°‰iŽ–fŒ7k×fƒõÜ>Å“{—ïì¼i'B»ó‚âø¢ ‹¸âPå¶t£«™Êë2a×ÚþyR¨ñê3eTLÜ05œ3ÐŒ±øÝM=â´$ h„Z4[5‘‡¨+Ù˜uð÷IX¶®D§©(-‹åµÛHâ]†~‘Ãé÷ùz^1Ð"IsµH2O2zw›¨LùÈÏCgU9õ§ßYè+*µçÇÔ$vã~¡íê h­ûqu¨á9#ßËíÀ¸î2z˜k(Ms ¦E“9 R%ñÓ£Zªõ«ÛÅÕ§—z´?ΡÉ­–½xbTWàG—¨JG~àÎ ØÜVfÏÓÎó4•¯ 5q¯z2+b¨"[–æYq%uaÁõÔ€¡XŒa)®vÙ2YɦŒ’ÛÊÄfÜ_¿Š7 m•¯ü;Çà7:¡š!·o‹è7þÊ ¹ ˆ”En.Çl™¿ 8Bfê±ÏJs)†nñ› ol¾_©Ð ô ¡_Ÿ!ü…)æ Ñù¶‰V®–õjYð{tSùæÿˆè7Xø8FŒMÑkfI®´ç&ŸJN¿í]QRäׄŠ4‘‰›éÍJÙ. +õ(¤}žôæM¦dì É76öý¦dÄ]?Ÿ;Ðî“ߘg‰€dû ·^øÿ~ŒÑÇŽ€ÄZ¤ò © ‡¨¦ä£ÓP4-{7㋜±ê¾+ûßËÑÐr¬°'%Dúa¬ …Œ?_ãA_ðøHÕ=dL´P¤ÀLù¨J—tS‹`ÁŠâl+Íß!ò¶&=ߪ€‰eD,,’êA]/5.Y•&¡ÃÊkú.†ÒÚªä tªïà¤ý§}ôé5OLa³¹Oý/Kxž>ÜWXU»5ªH}$•­Oµÿ6èöÈsT 5n_bzQÄ™6ª`Jç‰öQKótj¯ùðx¬Þ‚xÍÃxœ‰£!~Æ%Ó‡5äžøâ¿þúy endstream endobj 219 0 obj << /Type /Page /Contents 220 0 R /Resources 218 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 200 0 R >> endobj 221 0 obj << /D [219 0 R /XYZ 72 769.8898 null] >> endobj 218 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F53 119 0 R /F60 19 0 R /F54 13 0 R >> /ProcSet [ /PDF /Text ] >> endobj 224 0 obj << /Length 2674 /Filter /FlateDecode >> stream xÚíkÛÆñ»Å!þP >1ûäè ¤Eƒ¸@û!8 (š¥%ꎱD^I)öýñÇîòq«³ÎmÒ/>&¹;;;ïÙ™•¼ðO^åê*/tZèÜ\m/„~ÿBº·5@¬§ ¿¿yñõ·V^I‘–¢”W7»’›íß“?ÜU÷+™ëÕZ&ýj­µNìëÕÚ“¼mWªH~Âÿº÷ @µ· @ã§Ã†š„Ô«µ*„±‰R«ÜüéÅoIVÙÔ­?Ey€»„~•¥ÂIôÿµ9wH—HŽwÍÀoÛè2-xlº–»?{&~÷.nˆÃçd²E>™'êëvã&`Þã„ËÛG» Ïïè€ ÙLIÙ¤²(Q$øû„-bW×°ÎÚ¤•0$ùý ?H@–´ŠõLRÊÔZ“;ܤ7 „0ƒH`_“žCÀpµÖ¥Ls£ó«µÔ©´"§¥Q¾U®“m‡O–×ÀC(Öîˆï*Ù¬`ò®Â¡[·¢ÙñÔΉ?:„Ø?LÁ@ÕúEžf|ïú­×ʺA³#ññ®öx¤;ÜWA£[ž@åã~#ÕDÁtµN6Ýá€óDü–„#¼P2ʾi=â”æ¥IKcȦ¥,5}×!Ÿ¥Ú[»R.q³5ûVþ…¨®O}¸«[~#9£ìýî;”Õid¤Î¸Qcθppr¦pš ‚컞GÕ{šwÛ>yf õ·ƒãym3‘Ü W‘éö'†³©¥XŸ÷÷£µÐ8ÐN»*Ôãp¬ØŸü‚Üyl׺YâFIV Ç{">÷¬øADW‡û½3{¥§€Ÿ›ŽBÖ±¢(FZ½¡Ø7Ãq¾3‘õѱC*;Ö[AµTÇêzn2,ŽwÍ·‚ˆd¤„O{².ú"¡¡xõàà»Qbh¼Š ó‰v5ÃKÝõõ±aóÙ;wBp0B8w ¼Šl¦GDR'°g8¸ÍP$4nëŠQí«wßõÄk×?¬ ƒ‘å9æ…ˆ³Ë5l¼bKâ/ŒFøY·çœÚꈴ¶àØñs ãìgzàD]°v„˜$¥1áD5x#º³ñã×DGçÓÅD1H×dmõnèö'ÎCˆT#µ7¤£€Çß­$›r@K0?­ !¾OnMt¹šS2éx˜pÒ;“bÛð¦Oâ¬cŽh¨‚ííÝPp&Ô!“·;Æ<â`cá‹Hå>Dj‡ô#¸Tf“ºì¦¦ÙM›Tˆ¼pÉM¾ŽgÀÔXcÌo›I0{RÔ9‡YåiYXíV©'0ÙåhÀŽ®‚Ïòâ ïE±fB†±ª¿=ê)JŠÝcð9‹uüŒ, “J¥¥£fÝ_@ñõ$£„ üevr#÷dêšØ qاWo8†H¹O5&/í\¿óìctqÆa‚üQ—£ñÁ;G›¦cˆOø£Î]8@däŒÇSØ–`²m»®õkÁã2ÉÉc+ØãàyÞ°Ÿò?=ÆZº(†/è=e÷áSyÁÐ1 d²íN^‰z–ùxª\¨ßŒŠàHù€6œ2÷öáQ^¹ix›=Å{œqª¦ÓƧ?¶vâÑ5c£Djì—6—ž‡ _¦¥µÅ<ÿ,>P¦lÙzgü.Ö±3z‘§˜·?£GÉR©ÖG#.4 ¦êàìʰqµÙ„ · § ˜ ×fâ“CÍ#z¢ŽLœT21Ý~]Š4¹œ>Á<ƛّ(# ®-ŠDĘƒP[ÈÀÛ.ŠR¸é6^Šdi¡ŒPèe±RH¦J*å©óˆ< ŸšAt$­¡¨«ýuT@˜ÈpO G’6ÇÚ­íÁ¥­ÏHÎB½š•^ÎõâðàlÍÇØEªEHOiH]¢¡ç òžðsÝwqÅ( Ôé,{†éÅÛeq̉¹§õßQ¹¤9Ô|›uþò8GþË}CRB:,ògÍóP›‹rDηÑ©þ{O]ªÏõhÆ?³Ùu.šÅ-%72Íÿݪ§K]‹C”)\‘f!­"íR0l§±žÊŒ<M\pØ™äuaÞ÷ÑIÚ‡˜Ï;¿›Ô–Tµ‹üd9c³Ï‰k¿bè^`ùeC¿þú =?ô«/¡"Ú_2ô«/¡C¹ýŤ:/,7®0y2šp=„m2ü¢ ¿xÍa¦q϶s˜*( ËäáÐQCÔýiܘˆ8s_CÐ(s½00/ ¸ÜÂÐc„ÁèŽñÒÀȧ/ 4¶qÕxi`u‰ Ȍ݈TyɶzÞÝ'Ùº{ jœX_þÂËm¨ÌB;€„Ä5Èi)ëÝm½t^÷¡¡JÔN*Q¿6@ÒÙvRk³q=‘ç{Îöé ‚ü’ Žvo©£\LŠ>_zƒ}4®Ý¯ƒñdZP_ó| _-[´zGUhÏHè¶ Ÿƒ{Rƒ='£„´Åƒc“Ö ‘uÏŒ-.s$» ´¾šTÔ#Lùp×¹¶7N e]ïêów ËÞŽ%×Ð)Ž}^]†ž›*V¤Vê¹Bð*O ;vzñãGlUPÓ >èÞ« íM¡‡°ËK>-²Ñ‚E–L;޼n2¹0 aâ=Ó–ÎÀËøÄ(w.ÙaÂ7ßñ}_Ïîb˜O)ÚÆ~ŒJh~ÿš¼Ê2>L*ËcWy8?÷c²o•CTH±×n” ùØ}~3𺊱M¸õÂO¾³Â &=ükºO†“»›ë=OAvf!V¦;ÇÓï$ZFs Ú_RÖxl˜aU"5E8 ϪóH½ŽwxmÌ0ÂY»X_H‘J ‘”i û@‚LÀÌÝ›1Q÷ÀД©LÏ<ÍOmsX.<à í¶(Üöè[+ü•CbÄ36í9În!1ÄMúºþb°qóèNUŸiÄ–†ë%w¼:¶ÍÎ(‹YÇVÃÉ5Ä­]³¯ñÐaJzj-өѺ˜—ÁÛÆl2ÊŠ²Ðգ̡ (‹t½ø‹yãË—tC“Ûäåk<"Yxûí›7,wyéŠ7o~çV¤ÄŸ?»Ï~Ã÷ 5CÖ=]­ã«ÛM¥"üÕk<“áè÷Ö.]Åy¾}öˆnµäMý¼ª%¯Ågs*AsæWâbNunŸæô1ÕzÉ)ºò'8ÕKNÉ3›]ÈìTAê³Ôª.cÖ,™uÑê)fÍ’Yl>K±fJõ«KMX>eÂ*ƒ¢N²C¿zõÊÅÈo›½C÷Å—¯ø#UŠøÁwÕô6‡V_E£©*Ò¼,1$~2Kš‹@H1‹OQfrH›EÆD6{vdÌç‘ñžk÷[Œh@”9ˆMÈyjøßDü­Þ¡qˆsendstream endobj 223 0 obj << /Type /Page /Contents 224 0 R /Resources 222 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 226 0 R >> endobj 225 0 obj << /D [223 0 R /XYZ 72 769.8898 null] >> endobj 172 0 obj << /D [223 0 R /XYZ 72 699.7528 null] >> endobj 222 0 obj << /Font << /F51 16 0 R /F54 13 0 R /F52 23 0 R /F60 19 0 R /F55 192 0 R /F58 189 0 R >> /ProcSet [ /PDF /Text ] >> endobj 229 0 obj << /Length 1419 /Filter /FlateDecode >> stream xÚÝXßoÛ6~Ï_a$“‘ˆãOI –[±ÝÃ{ØLµäX¨,e²Ü´ýëwǣˑ%CÖt6‘§»ãùÝGšbÆá+f±œÅ‰b‰Šõl¹9á^üîDøVá¾Ê‹“o_1œYnÅl±8Yd¿¯ÖéÍ\m>EÐÌC¥T`.ç¡Ö:xSÍe¼Çõ»´ªkRpòÝ&QñjÊ„kH5ÿsñóÉO‹>$# 3Z©‡"ïõFâ—ûñ ÎYlm‰DŒ-\gg"‹bœ]BKh]]}?G¿`ÚKœ!¡˜0 ãã! #™Bv1¥ÇcÒØ£û•@AqÔ¥Ü;Ùmã'ô¦éVnëËFÚ íæ”;l¡ÌA©Þlúyñá•EÕ9bh‰e‰‰ÔhopŸ‚ðŒÝ¶ÇìéÜU´ q§ûI q$e€ÖUøÉ»©½ßºÌôËœtÚõ]~פ·ªýˆDnùœïž…]¯òê Ѭ§#ô T‹ã÷^ˆ›(#ÀÊØÆ°7”´G¶V J¥í£¢öãˆgÅáÐ(¦`¥/‹‹1?4ö`ïñ¥“IÒ‘išQéºÓ€0¬©Þ”¯ |M”_¸iÅ«K ìÐ’ ‘ŒÛ~°ëôï;®äŽþkÐÝ&hP 7EǃÅ>°0|h©£ô,åÀ,”bV‰”TŽ]”w­mK¢ºêj&êv(¨ 3¡.qˆÔuGŸ¿ÆuŽûE5D‰/øC¢i¸¦Ùôõ‚R·»:ƒ´¸—™_‰µ÷F•ÝÜÕ •a]eÝ•1jÃúo…[b¨ã7/eâ}úFù(NÍ"Åèû®ÆÎ¨îFsLmÜ\“_§MF‹`…!û+ó¼)–$Ôévä}–B‰w1Ä*¾¡ý[ÅŠžû$„¦Ž„<Ðò¿‘ÿô毰endstream endobj 228 0 obj << /Type /Page /Contents 229 0 R /Resources 227 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 226 0 R >> endobj 230 0 obj << /D [228 0 R /XYZ 72 769.8898 null] >> endobj 227 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F58 189 0 R >> /ProcSet [ /PDF /Text ] >> endobj 233 0 obj << /Length 3153 /Filter /FlateDecode >> stream xÚíZYÛÈ~÷¯ì>¬;bú&¹X98@‚  » „#Q3Œ%qLR>òëSWóÊ#ïñ cÀj5««««ëøª(}¥àŸ¾JÍUšÙ$³©»Ú^(™~óBËh ë1Éïn_üê•×WZ%¹ÊõÕínÂävûÝê÷Åãµ^uåõZ¯šëµµv忹^;çV¯×&[½Ãÿê7PæO‡-LUß+m¯×&SίŒ»þáöÏ/þxÛ‹äO¼³ö9É{ºKä7!QÞi’¿)÷EW‘Œp«à£ij<ˆJWÛš§Ž hÝÉã:k¹åïÝ<,ã¸)Û‡z¿ååõN¦qù^4¤WÅ‘9$ %V¯®3·Š;VǶ‹Ïo`J›UµC¥À9üøÖ¦‰Ê\ÇÇc€ÝžÑ+- &76 FeB¿©éº¢Â³µ¸y>9ÊéˆööT"¯«µ *I•O¯ÖÚ&Ú«”¸ìiu)Û™ñvÚÁvîCû$Y z­Ô’hë13/ŽÛ¥ƒmôҹ͙sgyéû#Z÷)éA‰CíN$ñ¥”6—"î¶Ï¦? >¡e<ž:~Dæ2#ÙÔ\|@eÀ„YýkQÙÁ&°ÒË!àZÕ.šM6¦t6óV°«ö¥F_Íi¸x.` ~W|Å"¾¯ö{Ýï¦g”hœNBîÂT%ëÙ˜šÖ—_‚X6¤~õå70ÒFß¾|y~­è*îÖ»¸’MìåË_÷TÃe]­gļÍo˜ô·wm½?aÃoâÿ8Œ&FÅ¿rínxöï9.\â1!øX0ZÚÿ믿†Ã)¯V¯ª½0úbéÚ‚Iò<·“k[иÉÁÖAÍLö3DS(›–¿ì4(}zGmTbRsØÒ\²å’gŸ$ i:µƒÛØ?€I×'L ô¿Ììð¾Fpòƒ=vÛòäW0hsnæ d«ë‚J'xK§ÎC’iH?Á=PnòV,Š‘ÛétQÀf$`X± ffõ?JÒB>;2Ž¢#¯S­Xñ8Û’Ö1e |ÃR._‚Ëgl~Á%ŒÎmaΞ9·v9ŒÓðSnÏ#Iåjí0hÌ “€°|_‰²Ê~ú,vá,ê<Ë4?"¬¨8£?Í!ä9eËWy¿ªu–&>5€ÿÀ¡µÎ—âSû©•a^ ?*@‘·œåì Œçê³ãsnbt~{*öËY;Go´³LßV„Á~õš„ñ ,jIí¨}ÆŒ0Sµü áŸö60õom²x£ß.ÉaL´;21äú‰\%0á81,Ê#øfQ$âá–#§Khp^"7—ȉDŒQ &TÝXfÕž¦…M%8ÈÒTi39í§NH'+n‡U}Œ˜4žö#PuàXHÔXD¬Ê–gŽ ×=Âu2"'\î8º!UW÷ر¡Ô´¼’üå1FEx†¥Š‹ô[&ªS‘ë³ÁÃ=y§°íj¦:oØŽ® 2qÞd‹xnj¿=é$¼o«m‰€Äæ,ð[´pš! xexOOˆðXÓ÷l™üݵ÷¸V¯Ne+¥‹VÁ®þT÷ëivR®©î‰•B‰“ËáÖyDá3’S\71&I)Li–Œ·óóÙÑJ¶~œ9T-ÊÿÈ$BÏ—¥G¯Íóì'‹ÿocæ—y²€¦o¥±qVv ± „|ªlÆ ŸÌ4Ežûÿ—ÿ³%ÿåJI»&xŽP&@‘üØUeq¼èZHe²ˆ5׋&¯5ɾ(øŠ¹qEÁQ¸=Ôs¯üóQØÁ]¤.zTSÞÍ–÷˜ÄW<„Ò¡ôóHËÓEËôÓPMç?î?ò¨Úñ'#õÜ‘¾wP±Ç1±¤Z‰i&À…Œªœ$¨,L]e‹€;r _S2 ‚àC0êÜI' æ&0œ%(‹Ö„ŠøŒœEk ýUlvM¯„JÄÛY¤Þ— 6ÃYC sn¡†´v£&$Š=—X|žxß7IÖ;o(~´Ûó†’'A;}¡Ø$S=L²4ab*8±`*8ÍX–{ÿPËw}ömx¶Ç" WÉ—!¶@ª:F†7LS%q;’!ÐE²‘„<±©™uýj‚2¹“{>P /5‡BPøÀÏÙ `@]:?«€Ý?÷EÛ1cºÙÜ2‘ž=Nt‹ ûöò †0ÂIEl½§zTó¤JNHÞ†‚(í ¸¢€©êPÜWGÒÞG~ªìø…ÏTz88c×´8UCI•"ÆÆ}lš{ŽÜE××G‘i<“cr—†‹rLžZû4ÇÀÓ³ÊÎúí\à,¤ïe,¹”“C™Ä¨~œgUBÑÄaˆrEãß`4DwËB!6¹"õèõ~}>·À …@,¹…÷¤'=ÛÍ<ú!9G¿-æÞ¦ß‘žê4¼h¤K“õγ£+y?²TïbV ˜ì+êPHFñ’Q¼Ÿ,'øÚ«È78ÊÍ0Ù>Ña;/ù#Ê6¤A‘?ÇbÄÂË/ÛeÀ±1|Jj@ÜÔá~BÍà %¢‹™1­ô]<ßg4¶¹9{€m³{`ªÔ¸ÿ£¨R‹–®FÁTI¿KQð,úâ&Ïåí®šƒ ¥–M"L5‘šijIõ$„s{·8>Í$z\*`LŽ™ddÙ©>P9§ð;ÚršVÀØLÒŠ™¦•˜SFi•䜥‘cy1¶÷¢X'Âùã‘ÝM‡§âÕR ±óô ,Ï䎡‰þÄðŸd‘ÅÒ_íÇÒ¤åï‹9#¸$ÍC|ñ´~}AÎÀCåáÌ ›8íú´ÿyÙÕ?/»‡ËdfÿÀ`¹Çf¥²ží»‹ÙRq 7Ó  +f ÝU#·¸ÃoÍÐynxiùáqOæX(ûÀÇÈÈ,Ñ$æ‰ Ö}î˧‹. Ÿ íHΪ ˺ϸOáŠêp:•®Nµ§GBêU)î0Úá€Ü ‰OQ/Ôs¢å;YÌ[è¤MÀè·‰l˶º?Fîµ8{ —J —¶[ޏÙá{åÕ¾z3êxø, !Ì^øýåÀã5qá8ítƳÿ$þÛú?Äøi¬)ð÷å]ÝÊë\»–%pqÚw̪ÄŽPS½¼³²g£ â(Ñ€NÞ33Ñ(–Ô©i"^ÆŒ¬×,F)zManËó“×U 9‡,•¢²ã@KÍ,›†É‹z4ñÔ®nGdzi:éäçÜ?䉳™ÿœ`Çì†À6GA0'·£­èBD$[¥"»”–qnÇDzåT›¡ Ó7"UÛ;±ÎT’åfÖ¿;]÷ù¡è;i›x-g“>’´H^ùåäڑ̿ïè­ >â¼[Î)g¼Otf®2—¸ rÐæøáèwr‘j="[ø•ܜٹ_úeüñÝ«JddŸüá&fí{9†}òË>ȸ ¼ðþžì‰Ÿ°C‘yYá6~)A3ŠÎüu¹w˜Bné²n/k2·¾8ˆé¤åyjøÒ+jT˜_|ƒo XÓqˆéDÒnî–Š1 5 ¶Š3éûJb~¹‹ñ¿tRmDZÁ•ø Fb[î«CÕQÜÖQ¤oåg¥Ük±ùJ,ün¨$ºI»üI*©»ræý‘êx7ÄY*ÈP¸è¶mìiù¿d·/¶"ÛÂoðŽåÙI ü¹ËÐ~¢ÐüM´ÝÿñQeendstream endobj 232 0 obj << /Type /Page /Contents 233 0 R /Resources 231 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 226 0 R /Annots [ 235 0 R ] >> endobj 235 0 obj << /Type /Annot /Border [0 0 0] /Rect [255.182 81.7615 396.9094 92.6705] /Subtype /Link /A << /S /GoTo /D (Filtering) >> >> endobj 234 0 obj << /D [232 0 R /XYZ 72 769.8898 null] >> endobj 231 0 obj << /Font << /F51 16 0 R /F55 192 0 R /F52 23 0 R /F58 189 0 R >> /ProcSet [ /PDF /Text ] >> endobj 238 0 obj << /Length 3821 /Filter /FlateDecode >> stream xÚÅÛnܸõ=_a x\تHФ”-Šv‹ÝmúÐöÁ}êˆ<–m5š‘#iâÍ~}Ï…¤.æxäEŠE‘ÄËááá¹Zœ¥ðOœYyfs•äÊfgÛÝ›Ô5|#ÜÛŒ¸šùîúÍïÐâL¤I‘âìúnäúöß›¿<”b3TWbÓ]\)¥6úÝÅU–e›÷û ™o>ãOû±†Qû{@í‡Ý-4Õ?¥B]\É<ÍôFê‹ÿ\ÿíÍ÷×%-u¢3¥NaÆEð—SüEš&¶( lÄ$©ÎíbÈÔwwgsÕóóœ? • ø³¿üö]rŽÐ|T‰ÄJhK Ú]ÝTââÊd‚^¥›2Ãã*Ì·DèÔ¾üéðç>¿Åßw߯Q3°Í¼¯BÍÏq¨™ã¨}ø°Äíü<ŽPQäæe<ÄÁYåß’BЦ¾”–›/ÄWü›'ü(‰¯îZ~Ö{à²-rg/ä¹ {öÐÜáalë‰îhÝJn@@&Þá[=ø¶®çAeÓ»{lnwÕäë8Ün*B£.¿½€¶‡²H%õ U×_bŸaÐɽG°rôQSú¨¢HDQHGÒÜ_¹ÿ#%ðºÒtkØ=>»Êàp2!²9/Žv"ÛüõéТÄãk=$ íªØ¼çï®Ú¶D¢í©Ë=3xH?¤—€cCÄŸ%ŽøÒóˆC_q?nŸZˆ”¬Gšê"LN¤AWnG}=?¥:1:h‰¤Ð“帞+v}ˆW¤*±ÚZG³«>FW!’Lg™¸w<ƤsµŸ‚¶2¦ð§%ì )£µƒÅL%©Jƒ£Õ\ïô®íXô wUu{ÅXÚD¨ÂÎÙë+"¼_ð¾zb1«X7¬Àö«“·[-‰À®.ï+nìœ µÒáN~’«7ñ@J~ðŠÊ\%Jù!7‹ý#»X[ï£AÇ$çt‘gx@Z Ìcá1“±¿#Mí"víW ©—ÈLÂ6‚n½;M ”Gkù+ aÊûXû¯Ì3B÷51Ncú±×vŒv˜ÁÏ=ÌÏkaÖìw é†#»ñž}ˆL>Íðd'ìlHT–H£ÍœûÃMOiï€ÂãHΑsѼ¼×<¥ê8«6D`29ñØë ‡œó%u>¹ ;ÊPT©¸÷¿œ–…7öþ«=ªšLmþAû«º§ºwé‚0nõyFÙ‚ò ÞÑ«tD~•õ3ë~"ÕbNÇm{xl&Ç! 1?YŒ®¬,T$m†#µ¦{ÇM”ŒCp”Ù¦¦  ví”l‚”5EC‚52Œ¥h¨ƒø@{í\iº©ïè˜)…±ózaÜòóyÄ‹ø™m+Búe ù:õ\¤AÓÔCŒanh®,ìÄ ƒrÉAâd{fÁd8—·g‰H‡!Eäà˜ªà˜ÈÄD¦–aÒ–,l©)û‡*ê¡X04"S« M>14ÇŒÍÂãáô=âB¹ñÂLØÌúd|á 0’hUÞgI”LŒÍE³k¿ê®íªKŸUuY®Yì†9lo¤j:%—Œ=–ñæ(b·#ŽÇNÂ0x7smšcÁSÇsß®˜­0úÿoÿo=®hT !z®WûŸ/Fˆ:ɵ¶§ýO™¥ÇüOc‘Z³z•5qh¶Ú+‚Ì‹ž²L‘¼Yˆý¨†ãô²„Sü„‚ŽÅµ)D’¦b ¢¹DÍ')³D#®[=Zw<Vîðòá“繘F™oWÅn¹sh³ëH¦z,ãx€¦ 3ÁÔ¥v¡¯YPc’F?P¯È)ðiŒ‘J§âN—I€wä«\mÖAaÄȽò”·§:Ý'R ÍrQ¨ÿží‡+¡Åç{—5Ÿ»1°S_eÛM ÇÕ¬(•°mÓön‚Ó¥Ù¤hC[·Î颽r)T¥žU–è'à_duÚ»sÝe·ÐÆeïê‚L‘,)2µHEP•.¥ðP_øò?·ãKÝT…Å·v#ðC:¿Á"eÎA»ÜòX$>)yˆã¹ì˜òõ…ö€npãZüÞ<à˜‹°ŽZ`¥@dHl½]éÍ]”ÎÛoWÃLå˜ÎÆöÎ HJ‘åfniƒs“¥Å©PüCq`¼ä\@ƒé,¸¦îªA&RŸoÜç„`ðµp=qAŒ9°ëà—¨&¥ë˜¥poyµ© †ø4õG'rÏOŸpF(TNgÑÊÂqÖ6ø¹³ >–/¨ág<ñ{«Ì€:¹Ävó×6xoÔÎrÚñìÉ=¹¡ë0É`à”³ÒïK7®:ÞºÒ 8ÄSœ†‡Ò½ù^¨ñîÙ–½\!x_²ñ%¥öÐÜ:´üòõœÒ¥ôšÀ°.`OÞÝÁÕº{îç¼[:É쉅û¡æŠ½Aj}µW?ó¹ðÇDí˜HT¡Ì s‘&i‘ê1-«µÙü€y Š­©zßåx+„ò}Î`¯?EŽX¡aq‹¢qÂ&Ád晈äe@óýÃÿþ/~¿™8%SéT,ê’m=„œ§Êfí®tã]!Ø•¯”ÜüÈ+€7 CÈ-ÜZv%¿\Åñ+fÒ+:¢ð9®ÃQÞªø“î¹QÁ³„w,®ÇÝòÀ8€R]>>_À©”ÍÁõñÅËYÞ¡S×_˜èO5‹J{óg&Ê &^rÛ<¿1]ýÌì0½Òa­õw£È1Þ‚úf]Æ Æ¡¯  ³¨gŸ2*Ç+0 …}]õ®š €ß¸QêH ÂÞLOþ›“—ÈΙÒÎÓÇ=1“æ'‰¤æeTUH†¥ßÑUTàÅ(&Uéºã–xzuhUîÇ’¸œñÌ›H öθЙwI@²n˜„ÿÜ:úÖ%I_ÏÍõà^úÇQ“nñâ@D(ØY,¹|ˆ LÝpÊEÖ@Ð|$™«'É\œ[ñ<’£'EUƒH¯q ¤1&x3½òt2ØêøùÂŒ Õ••"eÕÑ$¬À|å«Dj°·_Ø:™tðÚ.z9YY¼Ž"ÉÙ?Äè Øgá¸<^þãI$Á­È7æ«vÎÃnüå;M6cü"Ã'tqÂèØ»±ä.â¾QÆðÔé“»k‚7ˆ1¿Ï]1Ì0ðát¬MLaйãLK^©ÔR½GS Àêw”â‡ò~ÇõÄwPàÙÆuJš»k¹ w¼Æp Vþrš>ZU1`‰‚×ó§Ø9Ij ¯9a¦GmªThågjÚœæH)IOô“Zcsqµaž;áØ± {íÙ3²1¼˜3Mb6²v‰Ü|,à{ðƒ2–¹=ôâ`Wo”yáüÓ]HÅç60¾`¿ëÜar¤X“'Z+±î9¦Xy °{åÈ×A\“0ApÚ)?¶ùÍ­\¯+@Ǥ{>©1oëÛñœ)ñžç.õÁ‹óÌ-xæVǯ;„[«>šÂ”ÈÄbç÷k'Îú,’ç=þáÁ"¥epS«sZùò.MÈZ“¸U“ÌiÒ&¤¿YT£¤‚÷tf_Îk¿˜ØÜñ w–Ã{Øæº ·µ‰M;Ý~%Ýýøµú)ú#—,2Êæº0…ZšùÞï',â£?ðä†éEÞEbN=)©•‹B‘Òp÷}Ư«¨HXú¿hXÆ‹ãÕD†1Ý6¡`TbMbŒ±Ïn#͈¹òÖ"þÚÿ$íBÏendstream endobj 237 0 obj << /Type /Page /Contents 238 0 R /Resources 236 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 226 0 R >> endobj 239 0 obj << /D [237 0 R /XYZ 72 769.8898 null] >> endobj 236 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F58 189 0 R /F53 119 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 242 0 obj << /Length 4268 /Filter /FlateDecode >> stream xÚ½;k㸑ß÷W4î>¬+âC5ù´I.ÁÙdÌápȈÆVw++[YޞɯO½HQjÙíI‚Ì-ФŠÅb½‹Vw9üWw¥¾+½É¼)íÝîðU.Ý?~¥¤µ…ÛtÊ/>|õ³_êNåY•WêîÃà ȇýŸ6¿|ªŸïÕflî·j3Üo1›âýýÖZ»ùöx¯ýæ'üÓÿØÂ¬ã#O þóa]í¹2÷[ís[l´»ÿó‡ß~õ?"J….²ÂóæqÞ-øk—å…U„ÿGDå3.{§lVY{·Uef|ehø/80t ÃeþÁÂ8ãe숎øç¿dþlMc3ã7þàkZl[YUšj¾\}Ü#…ôf|jŽkK[@Ý奀: Û‡‡µ5­É`Ÿ^&¾Ðœ»=Ӭφßþ¯߅וuK›yë‹tÏk«*•Ùh(;½Qi@°4 Äã  éd#MþdõD \[/€žði7À“:l;em`wµ9a#[Cc«µÊ*g‹ù_;3›9U†Ãš¿qµ¡5¬rÀŒ¶QæhzŽ;éìði‘y¼™‘ÒT™V:æØŒ—®=6«¸äYéªÀ?íq‚ ‚·ÝŒüÂë›2ÕSd©w8al†=×'þdÏïcÏÏuÖ(óL•E Äötcd÷[ç«ÍÞúÝÖñUiJ ¾ÉT"CòõñÄä2£m*s‰\¥ÉtQ˜[©U˜ªL¨CÃnNÄ.#¿„e÷MGœ„$Â~¢X}<ÕHwÒ2ÏÌéjY% ·cýL#ᯇ#ކOa X­~š) UYÙjA³D'±„·ÁÕcÛYBT-¤8ï9¡êC6)Ø¥Êû™Ç9ÐÁ¤¢ø¥Ï\¹p?Çc0Øõ{ìbÃ=ˆ~õÝaäWýãϨñ„â¾ÿ»€úV 6Dèþp C¡9¯0(á°`7ëŽ)x¯K˜CǃÝÏç‘¿“-¯°Ð6š”„ž»:莡EÒmñµÏê,]fósNC'Ì/| jE‰©„á2¶Ï‡Åè¼`£ü÷.œºtáé ¯w†Çg¦E=ݙIJбíºsTŸ2)ì¡î:æ<ÙáŒN“ºãí4Ý^ˆ/O-ク9cŒG&‡DõÈÏPsÜs'鬼BÙÁ~ÒëÇF> “èË6,)†á¥Ä&¸ôYø7îÿÔQ4 fbhìF±$[W›_ß{P'Ÿ“…¸š÷[csËZE»Ñ¹øW(&HŽx$ä YUëÞÇàÜZž‘JОI†b©*€Ÿˆ/Éùã”c?rWõà®?žÚ}34m-=#¾øƒ‘[¦lÇÂá Øà¯-­Æ‚N×ìlžåUœäs-Ú“¶Yõ*vi‹›a»ŸÆ5ñ0 ¶6A†u·jÍ•Ë|¼Ð×J€ 3sáEÝ¢ª"€!–F÷¢FC:e·èíyJ"–ô…x±w[“W  UT…nÍ-Mt‡ÝóSwmºÒ>õÔ Œ Bn™YÇ35Û u·j{8xùÿ{oHã›ÊËô#¿Ðé¦÷_è£ÚÒ‘Ç3C¹YY“7¿²¹uzæEæ¼3_‚ƒ9{l'îxiǧ+{u>+¼ÿ"&y'\bËÌz]ÎÅ>úˆª”“y3àPý0K,„¨•apTTÄ'žDr‚Î'47éÄCÑ’àËLRUÉZ¹ûÌ/¸tW€²N×L,Ù×?Íf§1Ÿ6Ѭ™ö]O,p`»CKrÝÇ€|Cnw×?öçà ^ZþÜ‘P8 &òVzH•žx»ÌJïªD5 õm^l&òÈ[m¤æ"Ü5>\Á¥~SkX±9ep8ç‰Ø;¸Ï×öˆøOkyíRMÍNÞ§'ï(l?…Û8#QÑøšZÚË++å…àɾádøe˜ØÁî pú1AqÒ‚r“˜,ÞÕ¤îN=C¡ï)ïœ ì®k ×|zlGöI“Ð^‹ç§f$Ãþ Øþë=žJø€èéKIèTzÄ×’PÑÌ‘  ÈO)¼ò÷5lü´î¤¹*ó¹v7xitšÊ˜Š02©tbÆ|…e<¼oÈçï3½~jù¹V]7é*X¹ÈXõñÇ5,µÃŒŽžêZš"ƒ(,ˆ!þk²ZA\Ÿ0¨^Vi••Öú[óp*aU™“Mzh yº„‰ áSÜÙàÇÓ™cC¬‘W—³CEéÔâŒÉ#d#x‡OfœVs»óµzÿžçQºñkîg;+1WHõÐvÂЪ¢¦^£…3™5Æ'&Ö%i—¦Ax,ÆÙýòäŽ]å•"˵ ºx×wýª¯g Ú œ’cBìm®3˜~³êMv)LLV¾É.:¶‚#Ðe‘T T™»gÎ]Ãp‹®V1äSNSä,¥ÑGöòž•Uîß#¸.s*ÊäeÁU¾|ó ¤®„Aõèõ,Ú+çöÞ.PN±Œ¢1£¶~“Ú”rÒ”Ÿ¥5ÖÒpœNäs‡)5§zIV`…ýÈiL]&!ií~×KçáÉÃ2›ß·»{#dˆþt_ m% J“¨¦ÕH곕çäk…$³±qÍZ愘LŠ«E'&R^múç1$W^WÕaá3ïtŒCþû¶( u ¦œ°5†õÄ·BÍ_‹Óo®åš æQ±ï± k¶²§x‚Ðæ”ÈãQÊ‚vW%ågT¾™òl{!q!4„DGÔzîÄ|û"ÓNé9?§ M‰3`ÒSûø”†;a½zeñ·ã ø OC[ÚÍÒS¦ÒÞR ®tˆ-Õdµ)<;sêqI¨À4ßI–"D26DæŒh • •œ s~† 5ýxóG[Ö¶òm͹D`O¢zBŠMX³ dÕ`A—ÎÑé,òÉˈÏNwàÖi¦)ÑšÊ]P6º¨Þ@ghð9µË#¦ØgS Çjs !ÖÜ•ÐnK¨úÀ/÷RC`@½‚Ù?})£d­£±£Í ƒØî'í¿!#ñ9-£QæâŠ¢íFäDp°Ÿ EÃÎB ²• ~f¹•ÒI¹Sj˜QÖEK `±Wú’©IèAªß'gÅ ¦ÆøxÿÂÂ9´œòëù­Þ±cD…#Éb?#,/ˆ8>)öH±¾NH4nÐ{ÕÐbÉ5h7Ÿ˜?ÈÅŠôë“ù²¸Á’Øï×wãÔõ1ã4Ùz0ØÑ¢’C"„È­ôYeò¥Õ&S9¶»3MR¢Xœ„…CµqóJgÊUî¶K3*f˜4—´°6¦Û§ª¸Ù;<ƒóX‹ãÆ|ËõÝþT¬¿–’äJ¥'ý6³#rýI‡»1 —ÂäÜ/jô»ó0LNÓT¸H=€(4ä oR²ìg利UXÌ YL׃’GGŸ$Uàb C@UƺÌ÷Â!Ÿ—1g-}qq?KoCîÞ'ñKÄ}m×ïØIH—"ó݉nÄ€VÖ.+K¯ç~ñ'‰/™ÅçgV@B¹yæòY !e¡ç¥NàÄr•:sEH­‡@.£­¹)§ªlÈpÜPª7ÇšºÐ¢†j©‘+‘Ž<ʼ ½LùF¬d3ƒ;3Ng$;e=Õ«a&§#K‰H9UÛ>‡ÂM©×üÓu*]‚€cd!~/jZçÌåXáÚ Ài:kn?r?]Œ0 â¢]pçBFªI…"˜ÜÙaÄGrs•Ü®Á+.ÞoiQ „IüÉw:¡„ªŽêx­„Údº¼zÝxZoC²ê¥íd¾ûCUD$ë=)(r>XÀZ—v„’:Â,J'~`ªÕ’,KꈵіÑÂÁ|Æ‹ ,’äîEwbþ9ªîxÁs\W5XÜ,ÔªÆù˜»kªpOX\ˆx'ãçkü¶ÕtÖ„åì²Þ¹ãÇ<40®d^ƒç Gäc”d˜ÝÊó´kƒÒ¬à0){Ã_)cR{Hõ²x-> ¦Ó¼Qåä>Þõ¦sX]ë$WåÊxûˆ‡Ø¶»YvåteÁ }ítÑ?É*åÝ¢Bôo8æå­Jq C…P8»•œ«fÌ Þ`ÕÿO\4¶(o:]FŸ…kkƇ«¬Ð8§;÷†}¸Þq³CùÒJßAzÃ`úº4 ä庆·!O2paI€ña@cá¥3íOTyr“·:¿4Ê_N{à­ÓTnÊkŽ Ko Ðœ&LT sçPÇÛa]=¦A'‹›„Š$t¬ËåÊHÈ ‘Üù™Ü1ž!íáÊEª‹ä%¨ÁdtÇAYxÝÿ!5øeò±HéO׳àÝfÚC„¸Õ*Ës3¿f½.‡á Ò$ÜŽôE,P`ûå©áÒ'¾„À†ï]BGÇ—Šu¸lÖ1¼Ÿb®eHÝF[Å5`½s7ÅâÆÇ2EÛ€ÈÐtŸCK[ÕHΰCNËwPéÉ×:a ù½ ì‚O·¬²4ŸØÇ8ñÖv•dª×7püÂoDŠÌi[®–zZýaG‘)¯tr㪂Ày]‘© ~¾‰†E/`Ë]ØS«"jÉMœd§$[8:>ÙahvÁ‡È`1-s­sµbINAauuÈ9%·š±ý’™€^ÖE\Mà;¡ä¦µ–Xþ¢RæÀS0Ÿ..uZŠ…PP'ÐL± 3©¤¼ ,?„² æÆYž+Otðg@ “ñâz ‚ eñ=ÜØËìC²å}øõØ?0ïbÞendstream endobj 241 0 obj << /Type /Page /Contents 242 0 R /Resources 240 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 226 0 R >> endobj 243 0 obj << /D [241 0 R /XYZ 72 769.8898 null] >> endobj 240 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F53 119 0 R /F58 189 0 R /F55 192 0 R /F54 13 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 246 0 obj << /Length 4009 /Filter /FlateDecode >> stream xÚµ[YÛF~÷¯ð›%¬Åe³’ö!q’Å,’ @fIp$JC˜µ$åñä×o]M‘ÒÖ³00j6‹ÕWÕWG—Õëþ©×qô:NtèØ¼ÞV¯BéþðJIk›!É×·¯þþU¯U¤aª^ßîGLnw¿¬Þßg§µZuùz£VÍz£µ^Ùwë1fus\GÉê#þ©?@u<0õŸ«t¿†J¯7Q»Šâõo·ÿzõím?%ÙÀ­¿4óžnfþÑpþ* ƒ8M,Ä¡5ŠVq{ó«¶ÞwY#O÷YË»uÜ$³‹´ï ?Ím+ö¶U˜‘P2«ã<(›@Ç‘½BL—za(˧ñÐòØ<{˜)™UN»‚ç³ä½w$V£7…¸t(¥R©ïÞ¬iZmÅÒG·GãÜð‹‹mªÔ ·ú6ë¥D»U½÷t9™OR´ƒï¼uƶ˜ÁŠ-•ÅÑonŽ’EZ6õÛÚ“.¬Þð¢ Ñ/*Œ.Ž€pãc ψ—"Þ¡ÀïýrʬíÐÜ›xõÝ·f6¸8R×[:cž3Iv—p*ÔA¥Ñsl³» <ôŽŽ;p•ñCð7‡Xpv,,ÖWYx%üÀ½Ú¢ÎÜûé<D˜–Â="áø;Y'äIÞ²»Šó%Â&C^vd5Žœ ”Kãy0tµ»+û9%ö9~t÷DË¡t14£ï=ö~bÇ@–X“ðy·%¯.Gq'ûfÏo%æ‡CÑ»pÈ}0’Àƒ×½€•óÑ4?A!õf÷»|’ŒbEñ¹ñ§´/Ê\yÜ&½†»‡ÑÜiƒ³•¤I<4¶±Yôµ ´ÕÉUB&΃?'(´säÁw}Ö eÅÚñËîVl 0 ?;ŽÑD0Æ‹ô¨ÕìZMÙÄÓ³ àìwm8ïtŽyôeæ½Õtñ<®1=:Ò8P‡3mLN&q²™uoÏ‚ilõPÿfe-¤ä÷9Ž6ˆdh“Ñw×¤Øø{êEýŠ¢Õ©Ì¶™r­ñU¯g¶è3ôѳsÙ1 ¹6ØXœ¯J„&±—Ðà93æpD3ïŠmÖÉl†3РM.:Ä2l8¹¹uÌAÐ<– ¦ªB“.„È.™‰n²’…ç㜡¬ÎcY”.HŸÇ2 ï®E­õÂŽ€8íÌÕ˜O;b†ÈKPhùÌ8L^Câ^<Ôfª°E8¿„¬&‘ˆhäCvš±ã4H$' ñ«J/?3Eaß–²¡‰º„rÝuQûµì/;»ÓËÎîø²³»2“œø¤]b\Fp7LyW¥(d–„¶"T}LˆÑ`¨š8Ý/M>ˆ¬j8ŸNÕf•u”d.îÎraŠâïžuÙñŒIë8¹0ë à{oì#v³¿‘O¯Q1à’H½[ Ž`bñv6€^®Q{ºÍpæø)C܃_¾É÷NÉÏòÇsÕg/9 i|YeÝo2é]ÏaK¥Ó™›4ÅAÝhæ3À=Ý—fþ”á‘¢¬ãä¢ô?x'‰Pb÷Œ©•È î"“¬š<+ËG~±…8hO[Áϸ £ûL3À8¤ DC6>Eí†_Vh¼¨…0‡¿ ›­¤¸©û$þX‹Y!åVß—$ 7¸ú¬”‰\nNYô!o ¨ejÌDÚé‚E»Á <œ²–ç„ê¨-ƒµ&H®¸EYüm ìàŒcÉ% ¼œd÷ä3Âxmã±ã’QÀþýƒÄÚè9y^æ^‘¯‰gýd©»â€ûݵ>]ãÔ$´N#ó™ù™Šsì.ø¥jp¦ü¼×uAŒhô¼| %în¸°k1†*yŽ!cn¬ ƒvÞqâŒ×gvî³DÝùr¹NßgÍY°dFNbütBìuI¡Pûµ*ˆ/ŒÌBØÊ™ØpDþÕÏïoh-7üŽå½ã—ý¥ ¼è¾è¯R&¬Z¿ 8Ç4ï…%¶´Ö¹ó‰TàLäÅ¢…]Úv …)DËBØäÝ;Ê"3ôH; ?{À–òˆûk]2©BñÁ:Šˆã”®¬)ѬLa|4Š]=ȵRßP¾Õ’S`ÓÀj•>÷ZEÅ‹÷ Öšgº,Wr»òREiÑ=¥/ULìžy§ÌžªžÒÕƒ‡C“X()jƬ¼DW˜oiä î|À _ ÐuÄR2Ž0­íÓ°Ycz»ðºJ#èôé°Gî3©ÍPâ/0Òå;šTî"Ó‹ƒ¯~†ö{¤»!ˆ¾áî–Ôh÷|‘ƒà#}ÔéåºÚƒô5èãŽçô^XŒ!hA'§Iñ–·{^'ã¨UG:‰ž¢/“ã ¶ÿälG=öþr¾â“I‚8‰ÒI4E"ÑåÚ#’KuÅ~*xl²‘àŽ.€„ì¶Rp£Îþ–$šOí(5‰øéŠG>ˆèå“wZfÅŽ+ß e]Ýøoý… <Í>õ©dd@ÝäÙ›=É)óØÏA‡fÂA«Z‡XæäM2àŸø+®pà¨o‹ŠDúèùÓºßëã䟈˜\áPí#9¬¸µ°"ÁR]6Ÿ<‘cÖ<2%ÙB˜·5ÿbÚW¦—g³w\}åD”:ìó·2ôðß’w ¿â¦ì á磻 •7 :ͯ(ÿF„X.ÃàCld ‹› ùÏ&ÐÑÕè6§9ËÅR ©ð t:•E.ÔO=òÔöùÌÆT|[ÓJ¾æŒ8Ÿ0• Û¢C÷»YsÊ|Ûû@–´¾¤Óõ‘C]ú|>æ©hé‡ûAWÎíìt¢÷$„å̰»7 ”ìTZi'ÊÕ·“»8¾®dÛ몺(âÜšç­S‚4Ì'?ßÿä'ây*-bÿ¡/˜Îк@…±½ª†5¸¡¯×"ąДÂ8©ë½!“ÂyÞ~º_s2’¦ÇgÊ݇ýƈÂB#o¹<ÝDÚ.‰Õا ñBâwWÔ„šqM(,•ë}¤^³Ê¤v³=åÛb_øÊå¾”³¯SÞT.ÀM_ÚYHu(l< eùö³•Îûº,ë‡k¼iÄÇê®.…A °_î|ªŠ–RdЇ“7ùq¶úᾟM÷PK±ª¯C­}õ+ÂŽ,§òe¨~˜mwæóÄ'ÂŽw~ t¨ØR~“ nSM+˜0ÙðÏoßÌMïÖ‚3ç×™ŸØ|]óí÷y¶ë·ëT·`Ó>úÚ^4C#û2 ±h‹,6³,~jò}ñi"»áfäŸNõ1ŸîGþf®8ýg:u&áûk:–Ú³ç#ŸH t(ØzÑWdº†#o®)$öš@‘ËAÔ8sñ‡¹§—ªÌ0Xº2𯑼/#I¹b|qPp*5jŽÌ…ãÓ¡Ó0ˆ»ªÆTÙ>•OxNÅ‹N.ðÝàÎÎÙQ1¾c‹îé¤AçÝ;rN{E Ý…»lDI¬g*@øâpÇúrÇ!ýtËïÆÁÀÜý‡Ò +Êl"Us[¡Á‹NâÁ5 ^%úàG£Õ8ñ=+yê ßê0œÔ£Q{Í!‚mÍn\þ󹢄Z˜¨6OvŒŠo)ñ‡Õ·\ ‹ó@Hr) – XÈO’ùH%,Jã9ÿú-6 «SÒ„ET>î=Û*+ŽùÎs’ÚÞÝ0§›¢› Ë"¸ÔÏÞd9r¬ú+'ÉÙXx37.Ï 'ã¼{LÅgÆ{ªM) 6ñ¤ä óŒ ×ËÊ ú¨Èˆ[+ÿ‰$1$Kñ@&L2£ÔÀ£¨Nì÷ñÿl!¶¬çÔšOܤ€W‘¹ê®6u©~¢é0òøgk1ðhw}¡ ‰éKj/LÌÁÿ^ +ßendstream endobj 245 0 obj << /Type /Page /Contents 246 0 R /Resources 244 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 226 0 R /Annots [ 248 0 R ] >> endobj 248 0 obj << /Type /Annot /Border [0 0 0] /Rect [333.1821 420.8612 499.9096 431.7703] /Subtype /Link /A << /S /GoTo /D (Default Numeric Format) >> >> endobj 247 0 obj << /D [245 0 R /XYZ 72 769.8898 null] >> endobj 244 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F58 189 0 R /F55 192 0 R /F53 119 0 R >> /ProcSet [ /PDF /Text ] >> endobj 251 0 obj << /Length 3418 /Filter /FlateDecode >> stream xÚ­koãÆñûý ùº8±Ë}ðaôŠ&iЦ(P 1ÐMÒ-±'‰*IÝÿ}çµË¥Låäàî“»;3;;3;/*»Qð?»)ôMQš´4…½yÜ¿Q2ýþM&o+€XÅ ßÞ¿ùý_\v“©´RUvsÿ4#r¿þWòݶ>ÞfÉØÜ®²¤¿]cww»²Ö&?nu™|À?Ýû  ùÓ~ Sí/*3·+]*ë]Þþûþoo¾¿,9íRgùçîþuž*g3âÿñVÉ©ûúÑŸ˜<ãÙ*Íœ+`7Âêö¹¯t¶…)ÓÊš\@ûæØy¢<Ð_8}•ŒȨ0Éž=éÆ-u²ö í¾Þ1È@ФkIj#ÃÕ‡5¿ŒÈ{wp6`Œ)4G8Òˆ«}z»*süD:xlÈ&¸´mÃ??â©nVe™ªª‘fή 9NMÔ;„¬vžß·" KÂå)è5I@ãíÓӒȬM•ÊmÙÓ‰Äá¯ÉqÛÁ««’¨²…úæt–ÜߖƯ֓͵kž"á qpì»îš=F™Œ1aÜz'˜$ú†Ä®‚Éæ¬£Æë„¶šOGKûˆ0D~÷ÌÍ”JËL9/ÒœåÒááÚ§g@× É,ˆ$䊫DiRWVÞúèèÈ¿^0£³¦Â³Úw§ÍVx dæ8¶ }šÿÏ«:³i®2Ïëj\b3ËRë¬×ø×è1L¹LdUª<;:9’ÕúmŠovI½ –1r&˜Á¥gä§v×d¬ «-¡Ç‹Íô¿ºJ˪ô÷ÿkØÕfyòàCÛ üÁ©ûæò<Ù6}ëdWøî¸–$¾'tGöC‹ÞÁIØ ð¹gÀEA¥k-†ˆÓä%Á¡}â€(Ùý¨}ÂÆIFþÐg`Ù¡Ñ+mìðU,CË0/ÓR'2„[dƒûÈe®Á‘ÞŽð„ÏK¾ì-«‚ÉÿºoÎSðšÞìP ô´Ju®¼Í¬»e.Á€ƒaõÍÀ’$A7Dµ#¢‚(mB¶a.ȧÐiY’þrò¹ê Æ0’¿o×È"O¡Eàó4N-Té8›Ó>ò¯ Iò$T±?„ÆL·I°è±²1åCØj}EX–3_ Ë9löš(ÿ r›ËäÜo w¼Š;N ,p©Ï¢Þ²HSe”·ôÕá:–MY]dÙXíAWÍ,µ¢” R\HŸLA<”#«öj²ÝýCQ‘ËÉÂÜbÝÄ—VOƒÏ¯ãçüª ¡˜(:èf·"ìdç‚®˜À0éÊ{$Îd, J…õ'2Wuu¦Ðá$GÂ@ ÜõÐ,3U EíuÅL>ùÊuç]-—g¥È¢w`ü¸«1páþÁ]À{ˆP8ØN!ªaDržeªÆ_o¬›^`|&‰€­ì8+­pe²W&ã C j÷äë¨×\~VŠö@!ÊMþJ¡};7•S¬6ÊBÉAì")SIEUîȃ+7 ‰âºÔÆ‚/¼ýzÚ²F)­=Åæ€—1Sn;…YbËï¼­‡9sëv9NžÚaËs“Š}4—¬¯9̃±T|Ôÿœ ôí#…@g&Ô⇕4Kb(Oð®œJX‘õû°÷ÀS‘lpƒG6˜Sd™$ì,lj=½T²8ÿDâ¾ÇéÜ-1%¬?ùZr¢¼“Ì2S¸3Õâ-.Tò×n.R¾=yRÇz*Äf8? ,àÍ”}÷ E÷á(lxnì" qßâ)žy‘¬ ê7¤·YF†áÄð.ŽÓ‰ãŒÌ(ı×}¶…:EéR_«Ý— _×pHà/…¯ Üìü·;~Yr‡/KîºX iq¸àø¾¬–e®_®‰2?Ñ(·•{žú¸my–‡­4 5˜õnèx"¶pE)¨¶“;ÇÁ™;­à#înW¹†û±©É9ŠìZ‰ÀY®R[Ùü¬&‰Ê4SæxSqá‹Ãq0l§þaÌ›}eNY7'D0ˆTwÏ‚dNéÆ-°ø:…§# è„œ¬ãSrC[y¨ö3%¤8SÝWR݇1Ô}Ÿõ…R IsCDWD¡üã*êû ¬!®aªœÜ M”Sª þ|]‚Äk¡:U“Uåk^¥ãÃsêËFYô®±:KâÚ¡;§¾] b–VUر>ƒ•Ž”iá܆ÚP±”$±)‹T+åB^#ÇÂ^†q ávÊ,BO’pÌÿ¡$Zê QöáŸBä¢UE] \ïÉEl$Û¡‹¡K8¶>ªIzoŸG}¸uxµ1—ô›Sh‚gîÁNÂ,ÿq†Qp—w\ó¶Ô¼<¹Ê'Í&D^ÈQ¢”P#•¢¸|ßÛB®– `ê³$šÐ]'õD_ ¶ÂÆœI¾è¹ÑN çË WÍ3Gtƒÿ‚P‹Îº2i¡³üÊ/¡÷‰Y%GkS;ƒŽ¬vC9 4ªH~lØj^ÊP2­zdÄ)›sÎ$É f„Œ²kv€}*8ËT¡l[Kò7Ö½$Â’ÒÚ3˜]ó$lQúu‘÷·‹ù!§ÉKf œÔ(깨"h¤ÔÄö•|_§”±î׃wšB‰RÚÍ6ò§[&¾äM³ÈÚò…Y2 [$Çz˜œž•`a/}ÑÐä+[¾ÒåZ91¹] øõcˆÈ[ž¨yû©U/fð‰j†,Î œ,ê8ÉQLNÞ´c¨‘z^_þú£+›ÏŒ²»«F.ê’Ä´IM»"F?]^êÙÔ*÷:&ù¾:•ºìÅ7ѧ¦—j‹¯®ö.ÅÄ5 )¸ Ó·“5ƒ×à ºj€5 ,NGwÊHÕ¿ß‹9:áÊP fÜ%%å:…ü¬¸Bž±–‰î¼^4³„Í™Y!5•†ž­³³;jé’›ÓÉ?ÑÔøTy6~Jœ»G¿·É œçítjÊêµ¶i¨ÀI“Ͷ_l5À<97£^ÀÆ}\E ¬Vê9S’ vˆÜw™¸ m柚¼< €èZ€ž‰ƒF‰»7 ¶9@À_¸ÊMZZ{fïô;‚Pìê>|Û¢n»|›òv°/žå°’綸ßäæAÒϼ°· w!zŠ3& tø%`2¥˜ÀN–güP$Š[jDLXâßX/` 8 RûÄ£ %{žÁ¹×\©ÔŠ.¡ÚÏ_&ðÔs;Šê¸·œÀgi–W×dð.ªC¿SH‡ÆMö<¹ïzßpl÷qÓ3¾Cd9&ð3„pT0ð£8f;Ñ—¤Ÿé»eSƒ+¯Ö‹ác ™­$Yyê ãæV’+»éÉø}ù†¬Y—ü =$ÝÆžß¹åà›áoµÂMù{;ŒËŸÿË47y{bÚÝX@1wžÛ­©á]/m»Ê 3qΙÙ=û–T{eàpˆ:SüÌa~z.HHpW ®œéy÷QpàÁ™ž—qׂk× Îô\È©·\'¸Np¦ç‚BVøÃ›ynìd9Ó°©¶á¨k}µ®ƒû]_Ri>Ïæü¦™WjªðÕ.ùfšRÑ24šj¯cpÔBêÛiJEË8X{Ppj¼ÊSe„ÔwӔЖq°ÀUÐwj½¤Ê ©?OS*ZÆÁ© þÔyƒH•RßOS*ZÆÁ’qX“‚éÌÛPã쳊1³xÝÐsO’tO¿]+ yH™/þìg&—Ýe+OÂV~&Ù]>GÒwn%Sì‡Âë²™`UE¥çvÚ‹Æi ¶×º<».«³Kjùê+d$|uçû‡wïøêfŸÃðúîÝ#]Äù¯~ó0t»¶È1ô=bøê÷C•Ë¿f…¿­ÀÙ›]=¶®ÅZº1ÏîÕ§4/O©¾Ü1õo:梧¿Náú²Âõ²ðôe…£¿’Rÿ,˜ÞÒendstream endobj 250 0 obj << /Type /Page /Contents 251 0 R /Resources 249 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 254 0 R >> endobj 252 0 obj << /D [250 0 R /XYZ 72 769.8898 null] >> endobj 253 0 obj << /D [250 0 R /XYZ 104.081 496.6478 null] >> endobj 249 0 obj << /Font << /F51 16 0 R /F53 119 0 R /F52 23 0 R /F58 189 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 257 0 obj << /Length 2415 /Filter /FlateDecode >> stream xÚÅZ[oܺ~ϯ0’‡h‘®Ê«$MÑÓƒæ EчÂÚUÖZ[ˆ,9’öØé¯ï ‡¤.Ëõ%Np "¥ápîü†~Æà/?ËÅY^È´¹:ÛݼbîõçWܶ@±“üùâÕï?h~ÆYj˜ágû“‹Ë%?_—·žŒÕfË“~³•R&ú|³UJ%Û(’_ñŸîs TíØ÷‡›KxUÿ›q¹ÙŠ‚)³ùÏÅ__ýå"ˆ¤…Nµ’ò1É]D~1—Ÿ3–æÆd H–2­¸ÕâOäüôièšꂳªï»ž†ïé!RþT[þ;zûª)Çúד«ørªBo¹L¹f¹ÝÿÍ–Ér¼9×`I £?¼÷».WdG+¤[ñþýƒœ"¶Í7©)¾IÍèþÛÕŸ¸)dPL­M![!Ö¦©Œ™ï‰–?Îáò´ÃÕRkÉä .‡ûHV§®â¦P§®RõK¨çpuÚáj)µdêq­~Û ×§®[qäp(ü/p¸þþÏŽdÖÏÖRkɾŸš/t8œœNm»ÿ»wï@T¦Yò¡n£×«‡‘¿¦Ée½ßWý@“}ßݸђZ¼Fæk°°€ë-ÏS-mù÷r:Kv‡q Qç_ú½pô_Ç{ `œ£³˜ejEŽÉ"d2ãŽì-q¯+Àvªj.Ýîã,(²äÀMžtC=Ö] ß)F°M‘—í% ²Õ|Kœ"Y\!u* >WD¼@ôñV187™RËX«Q7.a…븲ꤼìÚ^+T牦i‰š_Òê,t( D‡Ž[íÌ„w0V‰ðð+}­Gú°ënn˾rds `}ÜÝŽûî€& »~¾3ê¸a~=ÍAgšt{zZ k1kÕ;šºµÛEÒÏ®bìDˆAÖÅŸa3¿¿»Ú*£ *ãVàžŒfMªþÛyea aL°½žt†IO¬!¹‘¸ …j²N˜~%z¯-E h×~É¢½½ p¨¼ý¬ZLæ:å<ÓÏŒåÔE­ÊSUˆ|YˆÂ8“"©¾H1H¤²±âBö¡Ïûµ¸¡Å )¹S¾î0á3å%|‰;<7),/œ\-*¨~ÄrûO|ª„Ÿó­˜¿’‰Àc¿ùü<[.çzë^Q…aÜ<9OAbŠÌ£Yª¡l/sz@ÏgÉ•óx‹S|r)ˆã¨ªº§œ‹çkºÕK]×j©ÔÐÚñY¦ tØk ˆ<c6+ÒÈ'ŽmŽ`HÞcZá²8ñF€s„^t¾+ÍB¶&àà¢À6ynÃOô6c%••&détçÒ Ç»²%¾‚“‘†cGßPÆÑ-©m©ê#‘”ô¸ Ɇû Jý\¥Æl{R }[.3p$ÖèMh{ –Ke릉Òh2%µ¥ÞÕ{W€ª¤GokìUEõ—ê¨öÒQ ¹ô>ÇÈ2žÁ¼vE3J6´j^ÚÓ¾ðX,j…4X|ÞD£4ÍE.Å6ÆÅR„0ŽE]–šÂø”~ë¬uw]õ•£ÖsjÅÒ˜|%Ô‚!à¡ÌsÄŠá#{ ž?$ØQ½£h„Sýåª4¦X‡ ݽØR'rºîòÆúj‡õ!qp)”‡h뇑æþ`Eº}Såj{‘òMÄB&ÝÚÚITMç®ÎL!µ?5^‡Á‰øGðê~J(Ç+À4ˆâ9öÉËu<¡*(ÃóG#Q¬"‘Ÿ¤xKØñ8>ãÀO¤™’ü;D·™R Í.¼Ò+ÌAâDŒfÁŸƒj 0XªYýP0ÙÕÖ;†MCƒE¹ÀÈr„ÃXöc@¸GÆ#›kÌÖù#Yž“u¢‰hž1¯;°r B¦B±U‰ïZ4G‘ƒœšMGMsð–A§*NôcÚ4nÒ¹çµãæšÐYáŠ'£Sƒ"†•ŸÖÿ_@ãC€²¶¤ôÙz(?O 8/²Çàé·)ý pª T%U,Õ³•.§æã!džfÐí®T Ìã*-ŠÕTš{Põ =xÁRVL Û5!н¤ÄX"±Ÿí©¬´KærœM܇¦ì¯ªÁ}X¡'ÄîÔ­æÇvï¸`üK6á8œØª€X'öcb†çàf¥gñÜj´%¹BB<lå‰ðff'œXÓHã>töW-ÖœêB‰'H«fÒ6mSÝÛ ãì=–£+{V†}lW£R¨\ú8Ö;+•JÍýÎ=P®§X+|½s»›*°ô±¯wôkߥï‰P ©—Îvu­XöõеXºµL>l kd–ÔmåÔ¾!Ä–ùt:ÁØ™ – h¢ÆÔ¥Ÿºãx-VȇŠ]M¹„aá톕Ï4v-ˆ9ÈÌEd–pRÁ¢Êæ«ûõl½ƒêqÏž(u×%n Í0ÝYˆ lBã#Ü™´Їo›¥áSÌp¼>‚ØsÏîÊÜ’h×ËC(/›ÉR^x»-úæøM™Ló,t|tN¹‘1¦ñ:nRi¤‡¦ŠQ•X™`DEíe·P¶ >ZíG·Üh|ÙµþMpºEXSAR+‘­ æ½A¼–û1\„ìPÎ;$¼Ör·]K …Kª6~MiR¨§Ù* Ø_„εj-HÎwûMÝ]ÅÿÈͬl÷³Ža*wØøÑÁQ©Åê"ã—.\§õñÙ±Ž>£Øí¾¼¹m¦¹»N!Âx9ÏTÊM!žÿ‹€áîÂÞœB-â\ˆ§]kήËfJ ,ÒXQí•®>Ÿ{"…6F=âÒ™©´„ËHäMXI<+ ƒX)?:³#roñ¿hÃ8ÃÒ¬P&òCÓù¥Éº`þ‹½íýÏ[_eãÿÉÿÓ> endobj 258 0 obj << /D [256 0 R /XYZ 72 769.8898 null] >> endobj 255 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F58 189 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 261 0 obj << /Length 1496 /Filter /FlateDecode >> stream xÚ­WmoÛ6þž_á/Cd âø*Jòeź ù2Ö˜b3¶PYJ%yiúëwÇ#eÙQÒt(Ä"y:>w|îáI,8ü‰…• ›+–+«ëýÓ.DxJÁ"šü¸ºøþ ÁYÁ ±XÝž8YmÞ&¯wåÝR$ƒ[¦"é–©R*1?,S­uòk³”yò/þk?T`ÕlÉÀÏö˜ªÞq¡–©Ì¹6‰âË÷«ß.~ZŒ4Ìh¥¾„|´{ ~™1n´ðøûªYv•ç‰óHC "yÀY›>íê ²¤½¥É'¸–S×EÆ [h„ޝúA³2g™ÊD0»$‡å@¿w ›´}5TmCSŠ~0}úñPÖhhiuع#ÜŽLáTŽs0å#‹‘TÁû ñÝ5´]mû€¦ÙŒ‡Vµ„œAB ÄE* ÿ™0ž†[Ülš㊫I–ä ²ÄˆQ+UéÄ}ªâÒºEö$GÃÎ ‡®‰`°J&7x°d0DHÛ®Ýb´åž¦|6§6ýÎÕ5ÍU=ý~F¿®kY!™bZÅHÓÏsÙ‚i£MÌÆ+ô¦æ½ É2É‹èîï§ÝéÿánÿmÝýòmÝݾÜ]Ù 7$‚£ŠYÎÇ3Y½À/x…‡ õf‘‚8á +PbˆÜ(ýl¨sâµÅ,ƒ±ô•[ŸÈ+èGKáÅ¡£ÉCR &s£NKÒÓØèÉ»¸½QÉf¬úuTÀêÆ—–ÛE]®{u®Ð"Gå5z‘ðf$„¦ýòD¡G»tj8£ÐÎÞ3(§PÞÂü›ªp$SïñˆMžÜ•[GJŸ£V /RHq‚zæ^í¾„ú±CD ²e¸I^—›¤Ý‹= æÕ@0«…yL©g"£Í•dPFˆ¯‘òÖÁmS…+A'Z$ìJlSVBüêì(»-ÂÞóßßúAµýõã•6xF±-÷±N`å¶íöQÒ?ÝgžŠ05ôÙp%ç̯™ô¯Ä½°ŒK“GI7~õÏ-jxrÚ)xlTǶH ý\CšRµ¯ý;žÈ=y*ë¾¥§Ú_[Àűô>ƒ™¿™À ]Ñhù¡ÌŽËøÓ Ï?_ÿIïPêJ|iSv›¹™Ëäº]Âb׬Ъ8“ <3kI:l~&öØ´xõ¨nê¸ü*´+´ÄÆÂ E-`Äâh<¯ñD^Ûx’iïîÊ®ÚîêòPºÁUß]γ„sVjÂkÝvÏì)5R@<Þ“ö9ÛX?¹1g*“ætãªéWnh÷Ø?©¢`:·cæ3ÿÆ¡¯"'”~²®²¤ýW49Ë…ÍÎ À¦u¡Oùï[YäGšâ õT[:r®“û]µÆÙ‘Y?”Ý€Ðèb?…÷Õ°£§-ïýW™oJè»zïÊ$^:Ѭ†V16uÞSð8Dd7ž†n[5§j¶´Ž÷*Ù…m×HúÓ+Á‹@ŸÖ€+é JoÛ‘j\(A­£>öÓð¼†^Úù&:§šÝL³ßù Ô;E:„ã#€’ªjTUæ‚BEÂQmÃx_záðëû2è'Ôhƒ“–&Ák\Þun²~ì©qáftA=Í79^¦#¿®æ( äã×@_mìôǬOJ°ºO­(ÂDEv’çgò5j¢°¾ÂÐÌW”1LÙcO™®Ò[ß_Ì`5ŠK>m/E‘Üb¶‘"ƒb@:Žü}2L0I ]."|dz+7¯‡œq‘?›Õ‚ Ëe°u›¬°u¢ðP"·‡‘O…'%,xŇß=öØ·´ÝÃ2×£ûïü,Ò´yæfFÁIŸKïUÆgƒð)h¦mÉø9F5™¹bG ¯Ý3²‰=æD6OÙûŸ‡CÃ`æ¡ QÛPήû±†XlEÿs4+Vendstream endobj 260 0 obj << /Type /Page /Contents 261 0 R /Resources 259 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 254 0 R /Annots [ 263 0 R ] >> endobj 263 0 obj << /Type /Annot /Border [0 0 0] /Rect [185.5454 680.886 328.2121 691.7951] /Subtype /Link /A << /S /GoTo /D (Filtering) >> >> endobj 262 0 obj << /D [260 0 R /XYZ 72 769.8898 null] >> endobj 259 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 266 0 obj << /Length 3228 /Filter /FlateDecode >> stream xÚ¥ÙŽãÆñ}¿bÞ–JVtìƒ $€Äq‚…óà1ò0G¢FÄHä˜Çî,äÛSG7Ii{vÇ6öUÝUÕu·ä€?yãÔó:÷Ú7»ó+†^ÉÐÚŠízÉ7·¯¾úÖÈ)òR”òæöp±ÉíþßÙ_ŽÕãFfc½ÙʬßlµÖ™}»ÙE‘ý4~ªwø¡ß´÷¼èÔ´qzà‘CàÇ#Ïh]dØ«‡®Ýl•pFdZnþsûW½Ñ7Êä¦ÐúKTÎë>¥¨“.WÒ‘Vesa I´ÚÍÖX•ýP=cø-Îd'"¬¸w€‘íñXsc×aÈ‘¿æ­¸Ùª2—NX:îvãuÖÝ×°ìV(“}@fàÁÀ!°ÄQ<Ûï7Êgu?Ä5È*79tž¸Ýx£ï';ãÊ=¢þ“š4‡cƒ×úÜv|I{†¬xáé¤ú€ÍÓ‚N >ëNoP<3çp»¾»ï«s ]­Iץʽ÷À¤¼ÝÄã“ “{é\X™o@heöw\y³-´Ï0îf+u.p´f_ïš} ø«Òe#âWZ–«¾®PpiüØ0IªôDÝØœšYú‘š–v(ˆ{¼‘e;Gl$6U'^þ¡Á;©Šø^Fܺ’cÕ¸B¨;G… £¦0ׯ:ObÇÍåë¾ÙÁÁÈqIû×m…Âùq– j׬-³ïXiñ‚„§ä{b,àL äñŠW±”±²Kä òîçÇs—Ó’'$–0Ä]OaŠ„¡¦Ý¤ëȽj½òb61¶Ndïê€I=lÓ#‹h7„Í™¡¸uÁ]ð…uëç¤æB $ëÔ £L  ò¹ÕV†e¯á0©A½™WÝÏÀƒ,ûÐx¿1$cZ<&FHµ¬#âUSÕ‡¡~Q©UJ‡¡©%1܇“º«” C{¶½Í%“šû5ì­BU§Ó²i”–¹µ¶¸ª&ÈE æ¾v›†§3þ¿#”ÉáLè’>}ÀK¯ ²åY)ø[MÜVâmêŠd‘[eÁtK›¥g»,ÀX0²:/l!…´ÒHíœ)ŒsÒ ´wÄ cŒT°ÚêÒ—ªÔ°_ ¤˜A\!­qÚ[çt ŒóÆø$ˆ™A¼ÃÍ‚÷hïLƒØR¤ÄVº8›K¥¥wd¬thn¤Ñö3ˆ;\딥YIrÑÆ{`J¡ :mŒRE D‰¤ƒ¬M •¥q%Xö4bJÎ Æ+ãŒ-‹Y!¬)Sä+5ƒØR€€j](€+ŒKž¢gW¯¥Q.ØI@x‚(f$Ý•\¯µ]‚„¤LÂ6)–ŽÍlÂ\`’YÙ•´5piÔ—-F¦%ÈÅ…wT98A†‰,i…ºv·ÆE^ú^`Œv¯zdO'=ÕFY(2YZÈ%Dƒ±á—‰¢³Ðí£¹â•}úÈñ®àÙl/Ëp·„ýrîj4‘à†Ð1âŽAiá*Qž¤¿¼Ôª%»¢Xê ®ü@þ>: ²>}Í Bƒ¢š±‰~ Aˆv˜×¿Ç2)!TY#¼âE6LX †¦%(¡‰ŠƒÍó ’`¾¬|Vx[k”{&µ(^.ä·Çšã@رÏHR ÀÓ)˜xX‹"P!¯cLƒ«‹¦›…¡îŽ„xÉ^a‚FÓcÕîj>än£J Ltêž{ŒCãP»iàöwußµ¯)^ºï¶)®õ{ŸÁuj/A†0x2DG鈴w|Eš3)9ò6W6FÂUê&@_]Tqfì2áýBqf†Ö* ]dD?-2lZ+_ŸD̸\NŒ¼ŸR˜™Ü)ÈšxñCÌÜ4§‰ÃÅñ16ùXˆ9L™ƒz”Wœâ`ðÂ)JÇ6sÁÛÖP,2ª´ÂÂ1à fN“r¿ý+»È ü?? #ž¾ªxòÁbÀ`2DEÏÁûÉ%I±`¡þE¡)bÉ!#J–¬Š‘6Ž´ò‘‘£>ædøÅ ¿ÈÈ2úý ˆ}ÊH k1€ì:gMHpB¹ÜB¤“¯é¼o‡dîIZ!"YLj¤2 4†EŒþc®e‚üá$Ý 6ž7Êè+ÿUw¢ä à1¦g‹œò©suW|Ñ©Š\Xa—Ë)¤Ë~lYb(Ak!-—å ”a™Rt7ˆÉ3…ªm7‰U6·Ô]JlýD$즑̰¥™s«ÝH.©ž”p×Ïóî{žÿ9­‹"U”WW +˜¸œ>Ë)À–k}þë7|>ÈÈ. òÌCB8AV›ðw‹,Çо#װDzGHÿØÁ¡h„â²B/Ðu¶…È9'"LjQ¤uëGe0°rX™Aè’ǰÙAøJó&4<5d Jö“0Ãé ¥»ËâMÊ»ð¡Òr2Ù³k E.¡á½,98 )Š0ìÏõ"=WÑ©J?—‰p檠F½–ÏmÂwŒkûæþ “´|½›Ö ô¾]{±ó|û0Ò­êGaïtâí\É”üÕ©7±®¸;ÖOA+!cÉÐêJ+÷ÍÈ>Ó.zí¾&I%™›çÈ‘ô(ÅØYT:Kº”<ãNÁ;6ä-†œ¹wº*ÚëR(žC™Ã)tX¤°yª«küº–, » Ó…j$ Ñ ¬Ù>•N‘CÑbUoÏæð êMh˜Ø uÑ+{ƒJ¢8:û«W¤ï±´FK©¬HZR-Ñ·ÈVKH÷«ÝØìª»S@kîªi£³íöñ’3HV ¯Ì=¯/7¡€‡=®Tx!õð†åi¦ ƃ¨/>:±î74trvR÷SVS³Çij—ʉ\‡±õa‹PÀ†vëbA™¢V*¶ÈXï›pkÜ`NäA2SÅe.ó5VÌEŽû1ˆþÈûþGnäÑ;öVœÇî0Ýßíæb—# ᆃTa‡~¬[rÁón®.æÁJ¾´hÇi&šì€Á NŠ‹ SMd-tä—V¯#Ä™öÕý®2¥X¹ÄÆ’g“u‰yhYˆ[îNlªš±©‡t”­r­]Œ4ŽuµOZv›C26Çâí>§BÓ/Å:¹“t¹ôÒ®rÙG¨•ýÚ@t"‡$çûUÏ3»jÎi¡—ŽÀ@p„óåš.’°m˲‹šs8¦³ÿòÌP/KCø¨`_‹Ù†rÄkù?Í€¯yäÏüy÷œ›,!¦RsÕ\™}ÍÙEDœ³>ðÄ\©<‘¶ÄÌÊňʭ‚/¢k‰ùoÇ£ûŽW¶œd–³œðôñ"§ ¶¾Ë;R2.I•Ðù’ð8ˆû…ú¼ð@ˆdòÒ:sÉåIÑ[.•Ï\èÂê÷MÐÇ`Î!Š`EFôbaúнÄNZ¢¼‡ìÊØßÅì_Êh@!9ä>‰!,X\šô†Ÿ™Nü‚ƒËÖ¤… ži¢ú&e!fáÀ]Cañõ"¢Û¨²¼Žqè*8Æ!ô øäCTKû03;X_#èŽûJ"‰ÑRƸËQæ}öv©WïXÃdú=÷“.wب“§ÉWãà"kÂñ ú(×cÊ™ryågÞEìJëÜ,Msý ¦—Wg®=9Ïv¦–GJÚ§ã=†ùÖCÊÃK…öêÌDŠ9ˆ¼ØŽB8•BløÐ`%°%Eƒ |KΆÂHz-¥ÄD´Îmåê9nâ zû§¿  =ìøsÚ©¨Ü nï>¯vë„OªÈ‚Gd„¤óaˆ99,x˜¥/YKÞ*ð.ŽmÕï|çú /P¿þÁèO9ŸüÖ!×øŠAß?ÛèÃoº»ð Jïœê™ì’GççªÔ»ÚMú}ÂRÙ)àŽvU«À&ç@ztæY *“‘úŠY€>W>¿ ~3,Œ’B'¯Ë$ü+Äãó¯ŸþÄ._O‹y+o¯"‹¸6+2ú“•ôÊ`&‚Ыgü–09ÈS™ªE½û µ(>’HÈݳQ$øƉ£“•ëòšl‡Yý|éû`ì¹»Ø7Ú®KêÀÍÍóñ×oá§Fÿº†÷endstream endobj 265 0 obj << /Type /Page /Contents 266 0 R /Resources 264 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 254 0 R >> endobj 52 0 obj << /D [265 0 R /XYZ 72 769.8898 null] >> endobj 83 0 obj << /D [265 0 R /XYZ 72 769.8898 null] >> endobj 264 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F52 23 0 R /F55 192 0 R /F54 13 0 R >> /ProcSet [ /PDF /Text ] >> endobj 269 0 obj << /Length 1431 /Filter /FlateDecode >> stream xÚ•WKÛ6¾ï¯ð-2P³âSTš¢-R½Ô9µ¢µä]5²´ä8¹ô·g¤,m´É>>fæãÇ#¹Iá'7™Úd^ ¯3³9œnÒ`þp#Co3vó)¯÷7?þjåF¦"Os¹Ù›ìË¿’Ÿï‹‡­LÆj»“I¿Ýi­÷r»3Æ$ÂÙ›ê€ÍÿëöŽ'5u‡¶»°~¼ç­MB »ÓCÑãâ¡k·;•f6M´Úþ³ÿýæ—ý¾UVX£õ÷²œæ='WåDj¤\)â2)š-¦…ý’õn Úø,ùíwlü¸Užsì‡cGcwÄÈÁ™š;“Æ ï½ƒÑ×P•aÖ"$™ ée&ý°Åd’ º®[•%Ø Öbà`Žù†7Ü|€©m‡^Š:L˜§ÒµÍçvLcdž<’½~DÿeµX ÁovÒ|Y PK-¤M3 »úÄt™à¬q£6äkçùš\¤Ê˜ïß©4ýt«(ˆ™÷aþk[Z‘)8Ù3Gò°†µ2B¥:bMY§6€p¨‡øñ34ÄîŠÿe ûŠ"˜åb»s.MöˆO1ò<‚Ú ÂXàa„ÝÞpSÆ;r|K¶ÅHÐù‰£\‡(0§ %®²ˆN° q4¯›uÐ7Q‹›§¨®¼pÚͦýmÊ”E§‘t<¶êÌåÂz—?ã,íÒÓÀ‚A Ã:r‹• 2{Ò´Ï„Õ6_žèôŽHŒ]ÿ´t±Vè)þp+µTɱïNÜ›J©#¨ý0ò=¸Øa4®g€h)Ÿ¸„ Zåþ—pÆnô6|…J3ú¤V²({î(­ 9˜9ÒÅÃØ¦w¾œçN%K»àU*™7jùÌŒA±Pó È8—ð[Ü C}‹e ŽÕí¡9O…Eä8N^ÀèP̆î 9T[ÖÿáៀйðòAç ¢¥™ÉkRðCqhVF÷ Û–=PUÁZÝVf1ˆ)Ü)©Ì’£}UÖÓòCÈ=—H':˾¡_Á!‡·È»X¼ZyQ…ê›Æ\sÔžêcÝ…Cѹ~ô&ó¤áŠÈÀ*°û M诓>…8ò,ªäÛoKŽœìx¹/Öë&+”Ìóç)oš›èD¾;7e(Ÿà«|>z ¨†®£,ce@§òè#ˆ¸|è«ØX‚¾hEÐlÚã<"QÎ#s ýÃ#š³¬Þ ø5¶Z* xpås*E/r›GMŇQyŸ|õ² qªô5+ŽZ`ÜÜ pHå@í}\*ú¼(Zî‘õÓ8QúT5ÁÕtÿ«#”l­[n£Œ]ƒÏT’ã …ÊçÉ¿à0N…|tºåÙʸ9<Ž¥àÞŸþøÍ:•åcÅeN²ž)¸æg[Dg 5#kt•­ñË÷ íDÔBendstream endobj 268 0 obj << /Type /Page /Contents 269 0 R /Resources 267 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 254 0 R >> endobj 270 0 obj << /D [268 0 R /XYZ 72 769.8898 null] >> endobj 267 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 273 0 obj << /Length 2146 /Filter /FlateDecode >> stream xÚÅYëoÛFÿž¿Âß"æ–ûâã€KÓ«‹ 6jE‘ PZ¢,¢©’”Ýýã;Ý•HÓZà ÚÇpwf~ó\Ë‹þÉ‹T]¤™™NÍÅzÿ*vË¿¾’nEtNò¯Õ«o¾³òBÆ"sy±ÚŽYm>-ÞíŠÃR.†rÉE·Œ´Ö‹ôËȳ¸j–*[<àí¯P5÷LÐl`Òãe]®ñwXF*ÍRµÐzùyõë÷«À•UVX£õטtOE¦e*”´Æ‹ [#I„tÙD!·Z·Z·À_Eܦ¸íIºËõ€üVô¹Vâ‹He"ÎMB'Þþ ¤¯oð«[^ñ€?Tç+òL‚Úe"¤Î-}ŽÖxÊ´ˆvDÑ®¬D0z(»¾jwØ›HKëtrZÛÍ]ÏKž'"‡\¨Î€3¹ãº~àùº`_šS^¦„4qêØÏjca2™8ÊCG.€¾;ô|MÁlÐ];Øm»WÐ8yÔvß8ž’ësd ›¥E:óDû%ÌîÐñ ¬]•‹wí©¾÷;âÂm}¨ÖeÓ—¬/iRa“ÍX iAN’²ExªµƒD¥vá¹ÂñÇëè§efE×Á²ÊL`á nšÅ¦ò¡i]Õ>0&yKX a‡±æ×m³á †´Ÿ7äÄ(ù À0™ÈdðŒ xoû„‘¡ °ZtŽ“ö8`d>δPCùXQå@ ¿–ŠÂÕ ÞÃàfØñjMÑÍW’yϸ”ŒµH’,{‘O¥"Ob/pÞ tÏ|<§ +óä…Á°Ð^»öX³âéÁ5pr_1VÍ%&¥QCÒÚTö:´"¬6ÅÞ}Fñ ~Ñ%h« ]ӧĽa ·”®¶î ôpwHã ‰6H <;‹NÌ¢?œ¢è®¼¯šìó’9Ž"2ø7”Ug"IE¢7 ×ÎAgqbÒ±9Þ:­ªÕ¤ý2Ê=šà¢L“šÔ2IC‡Ž¼Œ¢‹ÿÆÆ+æõÆÃ‚—ÇÚ‘žÅo$.–ö—Öƒ!cú¤‡ÂóÐù9ñåýœòéL‚p§I`McJâXýÏÈ”ˆo°˜™!År.„(‡Òªx’mf!P¹fªr³¨ „W¸L$…ÛñÕL‰1™ÅÿrÃk„ÑÎlÊm«ÝQOQ:œ Á]„„lù!žï“1†€Ôõ˜Î „ªˆ'‰¤ÙLKŸ“åœ" °ó,~ê¥øõ¿~(o°þœ{B«ŠC“š¨mz*ò¬«zà>œ%l̰z } Ï¡àl˜bÜ݄솧zÕÀŒ¡ìݲ;CmW¹º„VÒ8™sC¸îai¡ÈA-á–y}µ~pi€õmÿ/«JE‡Ñ¯†ö 6³!<+ÓlŒV’ ­ÓIþ1$¬ª£V~DÓ…{B! }Ý×7”@\áb½'ŒŠûr.Çôæì¹]!¦V\r°Ã‘Í)àr±ÿ—Øb!wžÕ]n…Je:V‰EËlŒ÷¬êZ´a¸`)}ôßv¬íŒ?hÃÿQ»  j5æš ]šœx{,)Í$aRç‚æòø´˜àF†,„¤è{°Ž¿ÆúC`ý¿4î©PYå“„ŸŠ4דP5åžc¶ë®èiå+Ý~ä»+Š4®»:í~‹p2ò”îÈ4«e¦áƽsßXá7V˜OðäÂUtÓó:¼!×e_ oDq¾ˆ±&‡:·çiÑÝ÷e(R`…,(B”†q{8ñ $³øÈº¥l¨f’ơ㨔[Êߎœ/!º5i7ÄkÇã­ÝWžÛ¯Ä&5¨žMŽT0Y²gN°²)îÜ «;ÎNeµÌ P¦É$Pž×/ªÔ0Ï<îÀ“áZW—‘W·Ïr¡7ú\8žbźhF1x¨P¤úÎd6…‘»s/*¹Â>m’dŠ‘ÃN:k‰œi^®«~p”ÿ䟴2g©Ú`‚÷€¼¾äbü =«±MPg­LêâˆJX£ƒïpÉy•ý™wêý><>nx½pûóQ3Á©ì¸–Vú;+œÕkl¥ô8:¹ê]ûþÏ©Ã|]> endobj 53 0 obj << /D [272 0 R /XYZ 72 769.8898 null] >> endobj 87 0 obj << /D [272 0 R /XYZ 72 769.8898 null] >> endobj 271 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F53 119 0 R /F52 23 0 R /F58 189 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 276 0 obj << /Length 1035 /Filter /FlateDecode >> stream xÚµWMsã6 ½çWx&i&R àG¦éLÛi=n½½´=hm9ÑT¶<¶œ4ýõDY‰mÅM²MrE€à{À)ÃDñ?Lœž8oroNfË ÕOÿuý(cì¹ËÓ‹o~&˜€Êƒ 0™.‚Lç¿'?Þë’¶L3H6ifŒIüuš!bòy[­nãT{ÇN¥Œ1ùCÖm|Ö4‹ø\¥Ú';6.ç;š4Ó¨,&Ó?§¿\ü4Ð’¦œÐ˜ÿ"5øRc2àr „{jÚæŠ:j>ÍÈjfÁh"‡LDX8zÆB8›4<^DÛ*5ì–<Ñ“`èljTf–ƒ ¶Ûì׊½W3ޤ“{ÉB¹ÙJ‚ÄЬdŠªíŸÛè¾æ,¹¤éÜ·Õ^P÷Ú&z3± Üê>%›mïPD{d#Täíá®ì7œu]­xÙmÏA?ç`åh‚a2Âaµã¢-clQå*(ê¯8¸g¨=¸ö®h÷£(‹ŽÔFˆßnŠ¥œd¹Ž:øI&R® ©÷Jâ4›åV”ÄÌDEm³SÑ1ïrPÔ’žGñ¾š<èLÍr]HªK¤ä\L]aŽÜçe,Íf¯â¹Ì«ä!e0…ï1õ&É¥Lò©séR)±n‚é¤ü»X®ë}输„ë®22g¯ºd¨}¢xª¾yeçf_ÛnuÚ~³˜’e±šÕ ä á¸¦]˜ìŸBgýûoñYWÛ¢I†zL@†Ûû°HQl[T#`M-™i$½#».§ÛXÛë1"Ü^Üî–|ŽÁènçìèï0ŸQT——ÂÆr'{s“Ê ’€îgLŽAã!y§è|”››ï^Š¢•Ò‰”¥öQø2|lE¹¼æÕ@ÏQ½ÌS˜Ö4”;-×ÂóXßÙ6õNNY\n6Í&{T˜ûN) ¨Ê,\ÅÙOe]´Õý‹« GÖhnqâU±éǶ]õIÍ{«ˆ4çËšàƒtdË·ÓpØ]’¦foõÁ7 1'hp@ãX¥Æ[çL@0žÈ¡qgј7 Á44 ñŽ À­ÇZ`Þøó~R÷qc`VÁúquã9u¿̨º_DóuS®ÑYe4)Ö©{µºyÓ ‰Ï.àU_«n:© ígðc¥cO6vûùÚ0 ø“‰,8Ë=†ÁëEãNÐøFmùÓÑ;¾Ñ4 GޏóÍù$ä£(|¦z¯ } 0µC!ã–!¿̈Ϡ9T’}•½ãc5£”™}µIgñó±É«¾VÈþ¤‚aȽaž|<#w޲ÎiýÁêÇh´Ð Ç4XÕ! †ëø¿ª[~Ûü á¹ zendstream endobj 275 0 obj << /Type /Page /Contents 276 0 R /Resources 274 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 277 0 R >> endobj 54 0 obj << /D [275 0 R /XYZ 72 769.8898 null] >> endobj 91 0 obj << /D [275 0 R /XYZ 72 769.8898 null] >> endobj 274 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 280 0 obj << /Length 2327 /Filter /FlateDecode >> stream xÚÅYÛnÜÈ}÷WöC8°‡éûňƒ\6ûhƒ » „ÒPáÑP&glØ_ŸS}rÄ‘¥¼dð4›ÝÕ§«ªO¦øÃÿüŠ ëdí¤U×÷¯XêþøŠ§Ö#ÖÓ!¹|õû4¿à¬öÌó‹Ë›™‘ËÍ/Õ_¯öíjÍ«aµ–RVîýj­”ª~»ÝmìÚßaPKmUýʸÚîãs™ÓßÄßÝJ¸ê€—÷›åj-3ª’zõÛåß_ýí² ÕB×ZIù½M•q [Ó­qÆjë½ÁMÍ´âaƒoÞph\³ê>¬È\%8zŒÕ•ªµÚjã•×Ú)Ƙўbí5—5¦ÙdF¥9>üqÉŠaÎxm´àVz.™ÊVF§`Þ¼pÖ>Âú_ÐÍ\OÀѵ”$S[¾ûí€&·Ãб™PIÀoûv­ßÅÞ´Ûfß}>;ËÖ›VBJ&Ûµ «¯—–_Ÿü·¼]ÎÅPïϹÀ;á:¥mÜ.PXÁ³1Œ‘Ÿ"šü6FH½ŽxG8Ök‡—Ø:–{$¢YBcŸD#_‚F>B£ ç·^9­‘ÚpÄÑ¿ŽôµÂ9£—oß¾E®1,ôC·M‘½íÆ=6ÝÍM;ŒñáfèïSk>Z¼¦%N‰‰`H4<ÒÄÄÓûÓá~2IT"­¨ˆˆš1¶‡LB×ýí®ûÖn¨dv×ìS îÚØÞv»6Í deYõŸdF#4â¹ð3!û[,\m¤I£~×øÒ(ƒé}^v$|Ÿˆ›!u =XÑUý~ŒÏ7tvf“"‹ÞÓ¿Walð*½áò] PªV^œœ&®p>%ó7¹asdž«K=Bäù–ɪّ™ˆùƒŽ»† |¦SŽ­Úàõ]´ÉQØæÆ>D¯nV´Ûûø°ìmãkn˜šx[œ÷6Ïî®Q¡PŠ.ƒÃØ´ìÐúíÐ]7Ûøæº]!ÝØ'Ð)¢+½Å¡5zÎi§ÁM’¾Úô;ZO1¼Äz_cï¶û´ë`3L h›ë¦ßå!»T?ñ*–J¿ìn°QcÝ ý-îû¸BÌ#4("Ýî9ëZ]ƒªÌ‹“ö¾‹ÈŸÝtËòƘ]¿ ‰ôu<Á7~:4ÃÑ3å`ĸ€k.µž§x<-Ž'+NTc£Ÿº ûö¶bÇç•6U³=´HíYJ¼è{ÂvاÇ+BM¯6qá@=Çèbh‘CN9D;Üçõ‚ŸñûÓLQOÊš÷KïjiDŽç´.’j}“Ü‘ÇÌëç·8J¬£:‹¡ ]g“Ç+bØ|æ®ûíaȧgÌ’¯ß/a]]{a\fêH<¹ËZÅ7\si-j±³Lã¸ZðÿãQ`[á•ÖÌA¾-•7.Ëô֨©Z¡†9/¼<ÖáÅ©ªLµ(ÂÚJg,äâ•Æ=9U—©Î ïàY@%+ÎiîòvNGa«K(î¥Vnn8ùÉäÊ W+Nòoq}[ 85×Ônkà™ó$tW¦ …(3ã,ç^7ùµ§Å^|·<ó;ÂìdÑÿ—ø +þxCEV€°ˆ“ñaVN[ê“EeQ;½¿oˆ37‹Nù‘[dºo‘Ã"—áùŸG"ãGz[ä4®GQjSTb„8s5¡ õ›:cfxzº;^fSÂH¡j„ú±sruņkYSÓ]8‹“›øtÈòM¼Œ Ä¿Ì]÷Û»X^šÛ eeNa€=k㘜Y¸A—q߃ôØ K@’J| °é[@vÚûõdçEÖ\uÛ-ž¬±Y–Ú3 RòÚ:91,žm¸d6=„XSÉÚíרµë÷Tõ¯³ºÀæÂæãõBf½®N4€%᜜1W‘I¹‹¦Sfˆ²%Hí>êÉMLþnË=hž©QíÄ!_¨]”VÈbêNè†qÏPº¥ ñ—%(´ ¦åšÆŸÝÊjÇÝTæp^ØelDÞŒkŸ ¦c¨ò%Lm³´¶©5±c¹Dï:ÊÓŒÊHòE jfAÕŒiŸ,Œ_WáNƒ€ß + !·Ë˜¿QÄc³ß-an ½“,=Pt¢–½N<ƒÔ tiÝ”{¬+7 jª²~’Ré+ HššÞ_53ök¾A† ¥TVzWÛßC’² ûP>e9ô!’d=‚Ü'hxòrnïÛ$QEý5'õÑŒ„8.¢Qˆk]õád×ïâöP Ïd&BnÇôX*5³l™rR«”“Z¥Ú’ðÿ~¾Ù!íàSê÷0üÆò±mìcßÂmI)×èͯ¨ô#þáÑþñ"‡/w4×MçnŽÀNd·ÜÙÑ 8!:ÜñšA<Í£S Â2u8^x…hA}"Z¹“ØÑãx7ó">]N·'H¿dêöp?ç*Ÿh͋ġ0€[\jQ¥ wzÚO‡vÜ÷bj¹|ûs%Áà8z[hä_Ï(U|ädŒã£Š‘ Îvtsr‚«3U?ZO†-”ÙSc¡úÿ<¦Ý‡ë£/e6Db7ž® ‚íÂ Ã±Ë  Ë’}Â=Ö `nýrÁXX:'Ò°õdÜ¢b81—ƒi„‹5ð4!ÿ#†“Á5”\›nYµÙ†ªkò× â·¯ë̽á›^”}|<óÏÕôY.V¯ô=úx¤Mú¶H¿ô5àjh?wMBûé$%døQ ¡=4»ÛÌ‚ÌâœI{.Š«âḶÛMør¦ ãj”€ñõ3Ò—>ˆ_]fv)èTþP‚ÅŠCIG¨ëfB¹Jž£\W -³“øûEGr[ƒ\Ìä,I¥Î¬*öijìEôéJqÞm qæ•~QÄÉnù%ƒþ‹¬½I¾ëã H`Mò(’5v?âíÖìɇ¢4–4X”)¨”¸ëÍSd¦¦ßÍÿ°6ý ܘ>zg¡ÕïŽïú“?È^Nö†vv¬Bnçb=|]9UÕ™5þ Ï … endstream endobj 279 0 obj << /Type /Page /Contents 280 0 R /Resources 278 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 277 0 R /Annots [ 282 0 R 283 0 R 284 0 R ] >> endobj 282 0 obj << /Type /Annot /Border [0 0 0] /Rect [72 151.2722 162.6803 162.1813] /Subtype /Link /A << /S /GoTo /D (command) >> >> endobj 283 0 obj << /Type /Annot /Border [0 0 0] /Rect [472.658 92.0941 525.5433 103.0032] /Subtype /Link /A << /S /GoTo /D (Use of the option -X) >> >> endobj 284 0 obj << /Type /Annot /Border [0 0 0] /Rect [72 78.9435 164.7179 89.8525] /Subtype /Link /A << /S /GoTo /D (Use of the option -X) >> >> endobj 281 0 obj << /D [279 0 R /XYZ 72 769.8898 null] >> endobj 278 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F54 13 0 R >> /ProcSet [ /PDF /Text ] >> endobj 287 0 obj << /Length 3331 /Filter /FlateDecode >> stream xÚ•ÉŽÛÈõî¯hÌ%ÜbX;iä8Éaré A`h‰Ýb,‰ ’šžž¯ÏÛªHJTÛ†«XUïÕÛêmÕê.‡ê.è»P˜¬0ÁÞmïr™þòNÉh;6Ó-Þýþ“Sw*ÏʼTw3$»¯þ¼¯ž×j5ÔëZuë1fU|Xo¬µ«¿÷Í鉧†=lªqlWÿÉ•= ü`ÚGþ=­u±:Ãâq×ÀF³Þh›{»2~ý߇¿¾ûñ!Që´Ëœ5ækL¥}_c­ðYi-pè³ÜYEìýxDî-RõJÜX£V?#-®§à®ÈBéðXÜü&{fG(•Ygðžß1¶ê´ÃA¾ŒÖ˜,·ÖG´ÿúf´Í‰QÒûÇ„ óO{äfàÕWkV¯[zÞMúùµÛÕGׇ¸ IJ˜¶ªÓÛÐò|²ºVz:¼í¾ˆzäín£t™ùR;™L¹<W»ºoºz—­7®ô«Oëlm§°È)Ñ̼V§-q¿$M•—™ÉHêt+{ËÛ<²y‚æèûüshúAñ õ¢üm‘™‚öX [”è>²Û3$ šSMsŽíxùy™Z¦[F¼LÊÂùºÈ¼ñ£úñŒ …²ãñ²aé,WÁLpëÛ¸UBN*².Ïœ2QCžÖÐà.ïz_±áðÊ ë^­Úè^PNÝ®%5Þ©-!dÎXCç( °>¸•ɬ·*W^-!8ëŠ;0¦ ÝÂ.纴Îå…Êsâ#Ÿ›zñ¹sNiÀéMY”º4ˆ»´«º, Zú¬*³Å1KFÙÛ¼ ¦SZ&àŠˆ¸]6ÓV{ ¼…6ˆV*øEŠ/i1ØÄ3ŠÂ©ˆX«„ØÚç…/w”_*“ÛEÄ>‚€Ê¬‚Á·…„Yi£rçµó@+ˆÌ5[o€^p›û"(Uj õµ *â,¨~,H>÷Á8§µ}ëT'P2®BÁÂBiàè7 žKÑçK[‚ölžçÞ•o‚êêËÜ*é«Þºð&¨I ] ب ØbP@xRÒ¢”´M(¢PZ°5ï (¨£¾<Ô”C4G½÷ï߃ÚsXþÔàîB]ý@Þçþ@¯Yw=TÛdY0SWÉ Eî&¨‘Hán-ûEå• ÛW£bÅôÍrð ¦ïá²à!Áá‡\k-RFDãŠHšœu³Dt3¸ÂÆRu §ºÃüîÀþé¯áp¸ÂqŽÊ ±óÉÃsÖˆ§:Ö<ýØv#P {þœÝEoÙ­D”Ï1ö…X×£h nL„µÑ³Â4Š›d £F~·É‹Z™ªž…תcdbýŒ æ¹¡þuÈ09r«—ղĭMú¦¹¹Ç$$-¯t5K¸&s¢CþMÆn%5ÜCåÄà`f nÿ"–£¥®ß3V4Ý go¡’…ÔUn{½ æûF]Ä´¹ßƒ, ¢j…s‘h¼G>ï:¬\WñΊË=!×r$áz†b·;YjÇŠ\,· `v¬þIñ]³­dÿĵ Y-ÏVüÉqE²ãùG4žîHö‚§žbX\öpÛöuXudº.ÖR2§q–oæåWvÊ¢Àê§_¹!å"ˆ7æ"0–ëB»ØÒ È ͱ(½Âµ±¥Æû,–P1°¹MO^Îkdù…û?Æ ½ã] º…«Wsù\}F3nz¸ÍVCfµob$ÂÏy,Æô‘ø ÃjÖT7ä´žÜo‰Çtsq²ÓÕÓ\Šç©¡ÇØ…@}- ôzÝ&ÇÅ%ÒÑD/nµŽ¥61±u#Ÿ5Á´”FOb½UÚŽ ç}Qµ8'¾ê%9æ„õ‚ßíi‚Œ:?*Ì’.‚nåÔI¤#,¤py¦§è&·ðÅ( $3C<“§ÛS½‰“v“DP/ǶíD1Òõ¡Ë&‰­âêÛ¹ÕßpÓ¢™ãp ¿Ä Ç(Ñ6¢ö…à_B\·î²o³äú æ¦¦ÆØš@òE@BJµ8äûè¾ðÊ<‹Ê‘:J`?Š!Ùÿ3…o6›ä0aÓôŽÜsšÐ?šè]r¢8F†¹²Iàulƒ¹<ƒjÞÌue„öBMCé°å«ÑŽS+¬ÎãU2WîFvâýqR@Iºä·ø ¶—£Z¶2¨F7O^?eмñ:i™’ ç {JdÏOûøIYá‚Q.÷´ Ä¥îÞ7eˆ1 ^– äK‹¦?ºóâ"+„ ªd]™2˜jd©?£“ÓéÉ#»B‚Y€È{Ϲo¨;‰bG»â:HÆ;ȱò‚Š1òÙÂ^Tb/×ÓX½Ø®¿4*—;éêq&Ë) 6Lãæ'¢gÖÓ_"6ü²v>ÎuÛ‹@¢†ì¤²^—n¬¹`LXSkgf„ã=íy¾¡_»T¼Så^rn‡¿ÿKÓ“óæÁgP]Ô !Òb¥EãÉ-ŸPv¡-&®t èÿ¦Ù¯ Év ‰w};‘™$o*Ç´GÒOøx[ yyi5É›`bÂêäOÆF‹ÂÔ(œjåžšJc†“Ž=¦TN-{!œ½/¥B@Òs'¦y;0X`ß:]|=2lÒÖ™ÈRm°©”vTE 2'Ê0ÚÇvçDÉ h zâÛ9ýS],NQ‡¶m«^6õmê/ !eáß5<*:]²w\‹•":‰åð‡s"+´|NM÷«pϹ9µeÒÞ]SJÙP'ÒÚ'——š8ÔÀ!6+ŽÜäÿã0=p @C: Ær9SééÍS˜å~ Úo-Ï<ßá2ŒCÑŸ¸&ëo'‚w7hâU"XR¥‡«#‘`hH(ìz=?I"”ÑéjçJA2/Ç^] žæpá—Ïÿ%Ä6ÃmG°§(¤ùEGvµº 01¡25ØÄ‹<ž9­§•BEô‰?’‹HÇëÕ¨wÌÉçB«E ðÃC2}tI6_=ÄŒ_ð’çz4œŽ,öHÛjRÎ*ô»H4w Ô§X2¨¾ó…±5œ&nÙ‘ÀÄu­‚înRãžHå˾™öGGzÒ©…ƒË1ŒomôÑQð°sÒ 3fÖgs²(í„éU¯97@ÌS©£ÛžZ©ÈµÓ4Æ!Þ‹ؾ~åN%¹5îÆhÔ>QCà7öŠd–´sÒÏŒÆÒ¡•Äv+Ò#º¤•`3|ÇK*jO›a1¢euàWL u°£?²¥ãzìè[ýKåtæmðßg>ˆîÌ^žîÕüaY¤ƒöÄ%‘²Ð‡7¦È\>ª‚‹[zXmIòt…%wåöæ¦c$BL£›’/[1rÏE–§å¤þÆAˆ3cÏ€8*Ó¾0|ÅÄ}¯7™/UXp0 iô´-Â1õè‰ëÍ\œã¹-AºúúÖÈóX|Q»é[ßzùg¹°q0ñø¹¨ðPdƨòûþT±½òÛ¶ºÊÔÔ¥ëò‘›!ü\Ê÷q~Ö™‡Ëg\Lq?Ω!…ýÀ)Nªi âʉ’a9«WM6iÚ¨Üf+ÒË]ªDái3CÖ~¶>]ée‡)84æÜ¿:¢íyêyƒe<Ðs./?´€£r®£Éžô³±·ïm1ñYp`µŽÛÝÛ<Ÿ”DåÕ;æÃ}J4³çaΫ)¨%œl³øhÿÇLxXendstream endobj 286 0 obj << /Type /Page /Contents 287 0 R /Resources 285 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 277 0 R >> endobj 288 0 obj << /D [286 0 R /XYZ 72 769.8898 null] >> endobj 285 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F54 13 0 R /F53 119 0 R >> /ProcSet [ /PDF /Text ] >> endobj 291 0 obj << /Length 1442 /Filter /FlateDecode >> stream xÚÅYKoã6¾çWø¶2©|?=µèóÚ´=´ªØJ#Ä–Kn6ýõá²”(ɲÈÁ9óq^â|bøŠÁ_Y±²NNZµÚìÏXœ¾9ãq”ƒD>ùæâì«ï5_qVxæùêâjr±ý#ûöº¼]ó¬¯Ö9Ïë\J™¹ë\)•ýÚÕÍ?4Õ_ƒP…c•ýɸÚõô<è´WôÛ¬…ËŽ°¸ßÖ (×¹P̨LÚõ_?Ÿ}w1X«….´’ò%§¹—\s¦ðJ‡¦`ZñàÞmÝ€1à…Ò6»,7ka³zBZºÁ=oÚ=ú…Q)u×6$­‘(Fžv!­ÿ~‚iblšàªæX°jWw=r„+Œ4<Š} IJÙâÀÌCKY.ìY|ò9 º©ßm¨ƒ:ù;»™ñ…SÖG”ü?ʹÈgw4¶Áå³QµU®8Hz¬]. ®™ 1 {ò^>a†Š°iæEw ‘ŒSh=ÿF¿û°ôd°¸ò0¶fd»t`Ê ÷léC ]W4NÅÐW’ï%Ö^‡òWXk‡}ÔJQZší«àj{€é{šÞ´·uzÃ:‚ƒÐ…p & k½Iá2ÁƄɑǗͽÊoi"¼¹#X BÙͬ+¬÷ö€—й°±2l’iV©$`;‡—'±IŽáxXQ-ލG4‹#Ú婜¸[ÜF¿4¢`‹#òÅÅÒ™‹¿3âuïÌä¤Ì+$p…ÉAGö—;S–_Ý®³—#~¨:â,9öÕÇ=ö‡†µ»_;•ÐJ„É~¬ÕœÎ¨Ó ¸By–„¶UÓö£–"ì©¿á¸C›À†M]îpÆQ?¼ß£e—ÁÞ6.»²¥§K¸§ñpÒfqÞ#¡ËRÐ6Ô@aqýö@|`C€ªm©ÎqÊ“¯†­7…ðÚMSW#½šv«±‡B<É%$½ØlO^áZM‡© \R†pÿr™¡Iº„Éãn`•=¦Lñì—ÀcÉðp“ŒI–TŸÊýmlñƒeÊ’ê9Ný*/ã¦È®pФÞíêæ¤_âà˜˜Lˆ7@Lƒ٩v(bÔÆ®Þר·µìôadÌo?y"µéÊ '¡PV'ŠSU )Œ7™¡`©ÆäÜè@e²ÅTlÆ‹'l•u徚 A|¡H‰w•‘k¿¢B>Ú=ñ[šå·œëB2™x{7ⷿϽ› ¸¡0þD\QtÛÒ¹0b}w]lHf…XEKÚfúÑuýqöpã’B²åŽt®Ä˜x¿©;¥ ï­ZŽrrø…èF©¯é”àÖ²yègmcÞÜìÆZ/kó>±¶ï³[.ÖnùXûw)¸·pîWÄú-DüA¬ßÄéçcýRÿš ¼ÏQ%–=ªñUÁLÁ,›ÖŸðˆ[hùÐgÛ#>˜ì{fO à wEB‡- —# $j ƒmGó£>¡!C˜¾DºˆkAõS¹é‘áD.rPðØ# 8ö4ßFSŸ¸}ÓÁ§¹ ¨+jµ£[²ÑTHHÒžäã…+¼ÔÚg;2+¸‘Ú1Ы3Y(£8ã†k.­ÕJ;Ëô:×0ž‘Œ ¯´fŽ36Çsðn7ª¦µæ0ôÎ /OD,=ö¨;&U !ÖV:c­ôŠK§µ{VUªÎ ï Â`*¢8§á\î<”W=l¡¸—Z¹)°IÍŠTÀ6®0Üùým+¸œi#´áÖ@”wÏ{íU_aŠg9÷ìÆ˜'ÓHAŽœRC28ì3 ì Â^2c¥GÔs6ÁyžT•\jnÀGºõ {“֤ªÐV¯> endobj 292 0 obj << /D [290 0 R /XYZ 72 769.8898 null] >> endobj 289 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 295 0 obj << /Length 1388 /Filter /FlateDecode >> stream xÚíXKoä6 ¾çW{Y¶võ–\ôÐZ Eo;½ôÔÉxvÜõØÁسiö×—iÅ<»i¢=4bI¦Dñ#ù‘޼ð+¯½ºöAA{s}{¼¼üöJò(‰|.òÕöêÓo­¼–¢(E)¯·ûÅ!ÛÝÏÙׇên#³±Þä2;mr­u>ÛäÆ˜ìÇ¡éÞÐÒx¡Ç&ûEHÓŽ4O{ú==» Ù^w êM®Œp&Óaóëöû«o¶é¶VÙ­?fT’[1MÍM“B¾,Øè aŒ*sÞf¦p¥0Òz[¥*­5Öƒ¥Jˆìs¼èË¥.¤ž¶ê´Õ—6hi•ÖRyYÂávzeŸît´Ó¤¡ ¥/M°Ö9m,.Ÿ*Õea¬¢û¾zõ `Vdß6- æg/Úfå šìšý¾> 4ÙŸú#–ÒêþÔû¹ Q®Ê†2j|Ý€»º[Ømd™<ã\ßâß¾ƒå.‡“ûÛ¸æ³f -‰PëSs[µ´ônc]Vµg>;*¥7UË"sÝmÓM:z‹!†Ïߨ²…óµÐ…qÐD“"^k€ýN;Éb/YÇF¬Ÿ¬ n›¬žqò'p¢4{Rq–ð¢ãÁíº°ü¾ˆºþs«ÀA@^¸“/Ä2+ËZ»”TÆ>šŠ§5Ý0ÖÕŽ&1g/©p²p®Ä*Þ_Va–*Žè²ê-@=à’ʺž^íÐéÄ Â©ŽA‡ ÑixWŒ»j¨‹MøgÛ ÷H/ã]üË+2D`‘B£;1ƒˆ­ò=Q ç*gϸPÈ ìÒ3UQðb8†9ê -5¿Ã•ÏÃ8Q*óéPyT±Ü¾gV]5HÊ€°»ô>”î+éÕÅ«KSÂØOç¾, i ­œ,\atÐñí—ûE0zæ;(õw-L«®)’Ê0$ÀyQšœÛѤBÙH6=-œ#ÛË17qéþ€Ûh²îhk m¡P<—/þ ,caåpƒ7Í»á`oEXÀÊxï—qsŠìù†‚ôTGK1|Û1ƶË^#tœ K;ô³|àUdÝÓ„S |×êvGÊÜ~W«"^¼6]—óìf£Êˆ%ŠÓî'Œo&Æžœ& .òG옩ĺS ÎBݵ4Âð¯1¨(‚ fÔŠÂJ½ÄóÈìµ½‡Áx˜õ'Üš³h­XÁ4¶;³Rĉ pâI  â:OØî¹ˆÃ•>ã¿!âþ¿îLärç4w.²ÓÇÁüë°=Ïf¦;èÙ=·}#Vìw)ÛÚ‡M0Ș‰°§ïƒj¤ìh¸2ós¦ë¹ðU‘jŽý©¦T•aˆ⎛–ߌ=í=Vã-fè§ê±t¶‘7kÖÐpÆVô8ÕÕZ×ê¦}Lù˜íÄh: îz™"?Ôxç€ý=‡CM<·Ç£îiŽzƒ'By¸c…²kn ŽtÇkçç ?¼^æsî8ÉTaLiJ±–‹¹MBJ;èB×H,7IHÄŸÕ“¦QYx­„•«B* A+¢ ® É$tYàoT±zaúÐüM’5}è6*É\6K'™Ëø–Yú0Î&…kî'—d.Ç‘O2ÎXOÆá?Sþ4 +Sendstream endobj 294 0 obj << /Type /Page /Contents 295 0 R /Resources 293 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 277 0 R >> endobj 296 0 obj << /D [294 0 R /XYZ 72 769.8898 null] >> endobj 293 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 299 0 obj << /Length 723 /Filter /FlateDecode >> stream xÚµWMsÓ0½çWä†ÍŒ„vµúê0€ràÐS¸ð1š„fh“M/üzÖ–,’Fv<ÐÚ3‘-?í®VoŸ˜*¾aêpê¼–^;š^ÞLTêþ9ô$!ö!¯g“ï LAÉ Lg«#³Å§êÍÕü¶†j·¬T¿j¡µ®üY-ˆ¨úp·Þüˆ]»+-›gª>+ ë]|Ïc¶«ØnjôÕ=¼Y¬¨k¤,U:Ô_fï'ç³­A# i}jRW˜îOÍ[iѲ=´R‚v~¢n üKÃár´£\kÌs^P© ¥GOè1¶Å„„ÑRµWÉ(N–u†A`/‚ ƒ4X‹¦ "K °z¤ØÇOhþUÆ(‚(ƒ5mÚòZÅÕ`%i¯Û¡óÍ¢¡%VßÒ˜ I$$ö×`góï×K,ÙÖ$µeFܳHôˆü[¦{¨vóõæ®ä@–Áꂊ%'lšÏÅv÷u±\­7ËEqÙh${pF:l$aÜ1Oé—¸³’€lÉiÐÜf Qà»§¤¦))zË…ßzÊÅþ­„ꯄ–JÔR)Z¥D=/\çoÇs¯“L`M<ÒÐí}# ·ü{ žEš’ž¼MôÛܳ²®^üŽæà SÇÇØbì J$dËnØ{.2Êü!Ó×en£ R‘ƒr§Eç¥sž_G“Þäñ¨­²Ì«YN_VHfarv²r’–éÌt§Q±ü 9{PÔ9Ñ3ƒ<¾ ¶ß™J»·€ª©×Áºý_/F’ê*E2&jÌØ.Cžšír„žè<ôôJPÞ†»Z7c$éIRdr<§)k3¶+6ö1RéòPKÆ ëãγçøc–ðžSÑ€›ãÓQôsbè;5 y::=%Ocö’'¡Ò“¬Ûñ)k|tÚJ9)nœb©|€C¯XµCöÐæŸÀ©M·endstream endobj 298 0 obj << /Type /Page /Contents 299 0 R /Resources 297 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 277 0 R >> endobj 300 0 obj << /D [298 0 R /XYZ 72 769.8898 null] >> endobj 297 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 303 0 obj << /Length 1487 /Filter /FlateDecode >> stream xÚÍXIsÜD¾ûWLå ‰Dï’(Š8„C̉P 43’‘4±MñãyKwÏa»(“b\eõò¶þÞ×ê×’ r‘«E^è¬Ð¹Y¬vÂÿ~!}+‰ôXäÛË‹/ßZ¹"+E)—ë#—õÏÉw›êf)“©Y¦2–©Ö:)¾Z¦Æ˜ä§±í®yhÚ€Pƒm“|Òl'îG~ÍÏn©Šd“»ºA½L•Î$F,¹üáâÍeŒÖ*›Y£õc‹Šr3KSÇK“BdyYº…+Ë,·ª ¾zõ ÂV$oÛ-D æ’—ÕÕ¶‘/¸W·ëu3ŒÜYýηÎÄÕ \Á9ž©*Øi*óÌj£Ééí¦]!Å–I;ò“»pª¶¦í=ŽÉ-öáj:Rp"iînÀœWSSg‘J~ÙŽEcf@¼N Ì’Ñ®f7Ó¦áQòÞïvø¨:©yü7¿ÂXµ¶Ð.0¸´n¿CÀ8ÛéŸL å»~˜áEc‹4ª§RgÒ GVÑ9@µÉ´ƒl³·—l°n!ÈÃE²n+Äö~œ‹6²8Ÿ¦#uˆOn•SšR,S§…Hþò̈óïúé׺Y·]SSô"D³í(ÀÛçvÌí˜hGÐïÜŽzÌ£˜j/'³\+a¥·óõ¬S…4Jš…e>‰pV&‚IxJ%@Ixe”ç<ðÞú7¹Hé#yJÔ*Ê8 Ý3”ÜœªŽªÃn¼ì!Õäæ|.ˆlŒç„³±»(¶ Å~¶›ÌœjU±ù#Ì|Þu²Ñ"P¨Â¨ÜÇ^ÄØqØ•s•^U?E2pÆœRyáýÐ8HÆç”eTÖÒ9eô¤¢°qF <©èÉ.*ý'y“:.Ó kfŽ4Q87ÒÙegLhœÑˆ3Q”òÔÆ7þ¥ûÅÌïÍ»ïù;¨ê23päü/J 8©R€ÏÅj˜Új‹ä=OÞ}wñÚMVLqüpº´+, J‘`=·¡ò£€òk‹¢˜¯r ”á€>õä`ùCï÷l IªM¨mÅ4`áØ­*(tX|êý39éØÞMVªªdÚ¬šäjk¯Ûé½”?ÑücO(ùî°M#KCËéV&Ës§L‰¶ qÕÕØo÷ÓaàãÒº¤ÚûT+s¢ÔRuKçëf`.šwøÿŠ"ÎàŒïN8u»ÄJ41?JãF’ô6I®ò ¡Äköv³ÝsÕ„‘K>ÈàËB " Á¡ºñ–¶mB³¹íwI¥v”IäïÎòÆÀë´ö˜7€ê¸´¾beø*,»‘]¼ï˜î27Crw(Æ%î„Í>¨ Õú+¼ôTTX‘ƒ+*)¹ýŽ–|;õÝK h±›iÓSA^{†ÁÄm¬9@€jÕ@àŸòŽJªJÐØ‘ψ‚w%6bäú#ŽS‡Ûráêp78P4s4hã4ÞJ  úå?¶•€ë…ƒËÚ{JüÊ‹SÅèñ1ª-#v‰c‡=†zqÜmG~va v<ƒ(8áQ9uºæ 9Ü9O·Ïëpoõ—Ö°=#¡yžy…«x˜ï[=íÃí·÷÷Λ¦"ž¼ñp@±+ŸxjÍÍ6Þ÷/è¹6w×rpê9WzòŸ•ÿç;Å©¬,Kã…y‡¦FBUª”>=5ÞÓžY5sNU™ikä}‚Ѹ‰)RûtB£òýHS&gËl‚‚ú“<˜F«¤Þp4éÍ¿åQej{ä°T¼YÎ$·Õèã\Ê Š#øÍðBŸÕôIãü3ÈÄoÉqMüØEÖ˜ù÷[¡3k¬{⹨N/¸tâ†ï,áL§[ý#YҢ̤(Õ類:–uâXÖJÎ^Áróù˳;¿õ>·EóìõóYtáºüÜ1Êç¶(žn¿¼ý —3üendstream endobj 302 0 obj << /Type /Page /Contents 303 0 R /Resources 301 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 305 0 R >> endobj 304 0 obj << /D [302 0 R /XYZ 72 769.8898 null] >> endobj 301 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 308 0 obj << /Length 965 /Filter /FlateDecode >> stream xÚÕX[Ó8~Ÿ_Ñ7’ >¾gÅ,<ìOE‚LãÒhÚd”d4Ìjüžc'%2b‡ñ"¶•êÛw>Ÿ‹ícV ¿°2|e¬È­0rµ9œ±±ûâ ÆZ†ˆly¶>{òRÁ X^°Vëí ɺz—<ß•—)$ƒK3Hº4B$ö÷4“R&¯ûºùº†‚ÕeòžÜ¡}”i·¡lRn“+Vn[7®ZŒ§ü—8~çätW˜ƒ·™T¹c¾Ö vBÈãê»3ÑC4Ô± mlBˆˆxH\„ß>/^ý±¸ÿ¹¥;Ÿ:ÝH¯›-îǶè"Ú”ƒÛßàNPòë5V)ÅV×Ó¶fãûšÄ]ZeçÈïó†&¸ú¼å¨`›ÖO~Õ$ó)û›fCg®kI¾þ«ê¶ t ï‡7~†ŠXºé\yL¨"¹ÞÕai¿Óq$$ç(Tz³p¿cKh*Ë à¦píŸuxL¨O#›öpYväO8]×h—¯¹/Ø{›ëiœžT»‘gô¶›°£b•Ûׇzp! h¤ãu'ˆŽòîË%‰•wuçè9èCì]îa óBŠât}¼M-¾X®PDëdS6T1Ip¬ÃÂ$¡Ë¯f ò15¦²rd™æp4îf&਎1-û±†þ-&Ä>¼½ yzkQg˜OßQGKËx¸ô¿cÏöÄÇ =|棑ÅÌ'Y‘_SZ_ÕÛ­÷R†ùQFÜJ o–ö@.•T§y±m¾}(]ÙL 'å0®l—ÄÞM±÷‰ó¸ÀCºí—ìƒI•º=øb¢-š$&ÔߨSìî|œ # ko¹KE×@ÞS]~O D, ž.O£§«Í;Íh ü”iðÄ)/©|ʳ¹.€ÅTÊ•ˆõvÈ8àÿ4òß(÷X#<–Wyt¯ŠŸ²¬d,ÈÿDzRQ½JÿUþ ÕHendstream endobj 307 0 obj << /Type /Page /Contents 308 0 R /Resources 306 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 305 0 R >> endobj 309 0 obj << /D [307 0 R /XYZ 72 769.8898 null] >> endobj 306 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R >> /ProcSet [ /PDF /Text ] >> endobj 312 0 obj << /Length 1915 /Filter /FlateDecode >> stream xÚ½Yßsã¶~¿¿Âo¥Ú#ƒßo:}HšÌ¤~rg:m:SZ¢$ÎIä )ŸëüõÙÅ.(Ò¦ç¬ËÝ(`±Ø]|ØoËÿåW7>è"honÖÇw‚»?¾“ü•ƒD>ùöîÝ7?Xy#EQŠRÞÜmgJî6ÿɾÛWŸV2;Õ«\fý*×ZgáÃ*7ÆdÿšvG]§=Õøm²Ÿ„4‡ýçt[jÛ• Ù 7 êU®Œp&3jõß»¼ûþn´Ö*[X£õo95Ê-¸¦¦®I! _–|t…°FF®ûÍNLE­•¦„Pìô$5WXÊB;åYjQ‘±EÞÿ†¢\†PxeÁ© i…âþËMs¡0V'©¿¢è–eQ–!¤U\ÌWÂ/j„”•‹¹éáZQ Wjù•£J«Hq­,kzS¤üC%ÕÕb ®ƒ¯û¯¢’ä‚XsµÝ2oØ­dñ I&Vd^ø÷ýíßY‘œo»6…›ré £ÑÙ‘†Dö¸RžøJf»èè3òwœöü±îŽGä°ª‰ Íüß’ÕRµX˾µ@n[&¼ügbEùAqÇ¿©UÔa²œ%ïªûC-'ßjÉ/%n/õ'2ªi‡S]±…DµrÙR[ÎYyÁÒ]ÜÍ9:’ñ[²ùu¶–·\%[ߨ¥kã]6Ôk pÇ6ÞÆò!‡Øg¢KØÆA¡CÓ&™z’ÈòþxY8ã4[rÙbÀŒvZŸ£‹ªÙ[à;‚§BÀ<ñâ÷,iú>Ù´b•WfwÉd*‹êžƒ Û”{vO}„Ú€:¶ðÑõÇž‚&¡‚ŠQ_ô3¨B -¿›¨±‰µÙ©[<–ÁÁ¹2&Méî ÅSžÄæ Ô\]ãH(O9k¦ñ-|¼¨P]O!¥Ksm ݵ†k+”Wßyõmy/.‚û÷ð¡ xû±ó\µ63’‘…’*å‘~e!÷䘘žÚõ>þìÚæçzXZÈûBH—澸ÖœÐó—Ñ…+ý4}ÉW§/tårfÔüù¥™ñÅ-·GVØícÊ¤Ñ -¬‚†ü½‚˦“Ïʾ9+FÊ–ñ^Ü®»é£95‘q¢Ü„bƹÍ@íð°ÛÕ‘4Nõ†‡ZlÁžÏ_WQ h©Ç)ŸDA‹Bý©J pÓêø[y>Â0NmÖèíždžÐéî4<⊸„ëMS”F?ƒ.ðL®Ac$ò¸jtpSݱCî5–c(‡ïUß ‹ü•áCbMž¾\@mé­LõHþ¯%H õ§1 lìÄ‚CMo"‡'‚0Ö»CìXŸH¶kÙ–®§öØõìȬÄA§ðABˆuPqSã´-µçÚˆÈ7"!Ï^\Ç£ˆñÊÒ-ô‚H”ÒЛÞ÷Ÿ¿šÂ)§_Þ~@õ…+ƒ²…÷RO!ð+W5}3Òé¥ÊdCuä¯Cƒ•×ù9ëWv…Fã0´½ûT ø”&àR€“Y)!'Œ©kLETÞ¬kVÙkbd2d–ºb&uÄÎ#Ž4ÆvTˆ¸‹d=·¹p]½9!yCâN/A§@™2ñ‡¿^ޏÊendstream endobj 311 0 obj << /Type /Page /Contents 312 0 R /Resources 310 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 305 0 R >> endobj 313 0 obj << /D [311 0 R /XYZ 72 769.8898 null] >> endobj 310 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F60 19 0 R /F54 13 0 R >> /ProcSet [ /PDF /Text ] >> endobj 316 0 obj << /Length 1026 /Filter /FlateDecode >> stream xÚWKÛ6¾ï¯0öR*»bù%E  =;§¤@YŽ…Úr!i³h}‡R–eJëÆA >¾Îó#—oüã›\lòBÒBæjS˜_þëûQ ˆt y¿}øñcÆ7œQà ßl÷WJ¶»Ïäáü;ád¨“”“.I¥”¤ø)I•RäSß´_qi8¨¶cE¾0®ŽÎG™ó¿m" ò›§]@™¤B1­ˆ’ÉÛß~ÝŽÖf"£™’ò-§F\Ä51u­ÐT ú„¦,SÜùÇàG9‡r‘‘”[+@oÊ%åˆÓtça×»wŸ­ ø:cDFUXB4¨Ò«¨g§NpPg,pž¥”+ô%åàK.ôöP·ä?½Ì•û’ÓŒÃsàö°÷II÷˜¹ô_œ‹¿ýáÜ ÷ÜXÄŒášS©ƒâPt×@Ž{[¶|Ž¥Mû?}Ì.AçYð³ò ²Œ‘w7?6À¸0â:|6 `-#© 9³‹ÌÅÓ>æPV2·á%©•»,F¥@HKÈŽ?nµž|ÅŒå„ߥúòEálw§Ÿî+9ÆÐmg‰žŠ¾]ˆ,ü«P…3ñy…Z ÒP¹µ žžž| ?6ÇÚå„> endobj 317 0 obj << /D [315 0 R /XYZ 72 769.8898 null] >> endobj 314 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 320 0 obj << /Length 1421 /Filter /FlateDecode >> stream xÚ­XKoã6¾çW¹T^¯X¾).ŠZxö°—MÑC·@[Ž…ÚV`)i³¿¾3Ê–*›]Ô9‡óøæÁaČߘ99s…b…rz¶Ú_ñøùï+g9PäC’Ÿn®¾oÄLpæ¹³›ÍˆÉÍúìçmy?YWÍs‘ç¹R*+ÞÍs­uö[[îèS·¢ ç:ûÄ…Þu´>i64æ²È`s¿®PÍs©¹Õ™Öó?o~½ZÞœ´5Ò0£•ú’Q'º„irhšàœ9ïíÌzÏœ‘E0p±X€šÜðì}½]v½®Võ¾Ü]Ór]o6Õ±¥ÅæØìãìLß®êêÐÕ›zuf\‚šË‚$çÂ2­ ‚öþ04ˆÇãDz# ÃíTXîº*ºnº"«ZÚ?4}¿«âd…è78´yh«5CÅfB3¯u¯‡ z|hÐ6ês»«ö-~p‘þ¢íæ¡£I¹kã‰ú@cïýp¨lñX<ôη},r®9FN4´å~päø"Xƒ‹[´ù;VkØ=M@#0Ý­‰k· ‚|tBÛÕ‘vìÏO(& w”†¨×€V€®Ž bœ’5ë¸ n{—5`wXöΩ1£ìøeÓ»´:Sízýãd¡âDBó W»©hމB¸Hô1/QÅ$c§=_9Í׎ùöQ$}Ö•`~‚y.•c^øqT ¶ÌUHžÁÁçcØã|™K@Kr ‘4Ëî Ír1ÅñȇG? ¦6cRΑjåœÉ.”²Txà·´Q¦¥´IqC^ î#¡ŸR!zÕÄKº½¡RòíCªî@´[iÕØ3*©àÓRzsù ŒRùÌÔ*çÀUâ%—W“·gÑ“Ly¼â1´"¤)Hׇ zQñÅØÝ y>òñéúΙ2ÊŒq>R9¸µ¢ ‰ÔÕP&±.Qézš:{{ª‡R¸ðLÚÇì<<ìñV"ú|C5%ÿLk™Óˆõ#lL%¼´Ìû¢He<•\Rzó'â´†iÝÞïJ´á©M—ÁŒI#0~Œ—l: ra ú”v—ÀjHîL^hãÚ28ûugpð‹Q9®Cç“ÁJù¯ÇqY›r[€‰¾û¼`å.RUL¿\ÅΧG!ÿÅÊF´?$-üŸ*ÜP¨£ # ô&›8ÿ¯hàdºs c°sƒžQ’«>bVpVBfoæ!]`n)«ÿÅfbO©M‘¥“ÚA†pÐÎB+[QH_ªbƒÚ%ÎÉŠKìïÖ4OJ€ÎÓXß7 9‡X)ÜR'@ÞêS…é+šÄbÐÜ¡Äús°4 ¾Åîà‰æ°0EìíÁpìqçqn ôŽx:ž;¿Bu¬C›S  a$ÁÅΊ‹‚ Œ° }¨Ú·~.«±YäEVS»¦¹Ïê=•ÝæØ•ÔâwE¶ŒÄ§ž¨GÍ5n’:óÜr¬äÐ}€4µÄñÉGM0`s³Äã÷‹ÔcÃFy“!±Ö}gºn”ßи% vQ›@C—é¾”q¬û˜Â<6÷CÕÁ¹±§ux>³tâ Á'_±óÿoõøn;E’R2ŠŒ;Ý6Æ+.ú‡Åð}~Iáª@§…Á´ö…æA*Ë eôúÇ(|[(Í”…·tŒŽwé ÞXÆ5—ã>Ÿú¥¯‰7e¸ã °K còV•,á>×bOš¼¹sŬ+èÖw¾êëZãà©4ŠšI-õDùÍ jżózÜn l},ˆ 6 nß*ø/”ÿçÇtendstream endobj 319 0 obj << /Type /Page /Contents 320 0 R /Resources 318 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 305 0 R >> endobj 321 0 obj << /D [319 0 R /XYZ 72 769.8898 null] >> endobj 318 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 324 0 obj << /Length 2148 /Filter /FlateDecode >> stream xÚ½Yݓ۶÷_qã—PµÉà‹èÉKÚ±§î´yÉå%mgÊ“¨ŠÔP”/ö_ß]ì‚u”î.çlê%žíeVIGl5ùÚoårh>ÓÄæhê3’w¦N³¢nõ¢ÁÑò%/¨[šÜ`'w*irYU( Uò}ºÑìúèöÃHÛ²çýâj–zÕÑ·…eï¾ìÚ5tûjz„6¨%Ðd•þY ä³Nédf }‡nÆøÚ€i5õ±»h+Üý¾þ„*Vmœ úι“Ï3'¬›ž#8†¢gP$ü§°Ba´>U] Àt£žÄ: yD{@÷sâš™º|Ù†sƒxŒ 8kT#`­˜U=ϨÀñhTè nìËmExÀSƈÆåþ¸ ¬¿îFÈ!"U‘Üb;¢!ð¹ÝŽºÌª @iûjázT:œ/d–K==²ˆ(ŽÚå}Y·Óë™Ë†ÏŠ“,&Öaw¸ÙáreÏâúE$>¥ÏPêžBé‹Ãõÿ{?±J&‘9ô6å'ŽØ¡Ø „†ÖÐ–á¯æ Š’¿óU½ÊžiÛý%¦£fS•hëþÄ’« ØsÔª¤³%’»cp^ ¬Šåƒ)ê¸c/~”  Á3©ìïÃÝ…ÙáA‚e,|D¡‹ ÇçtV(s<=+æÎO)húâäü€Wõº°~Ìu¡Tƒi¨Ö(f7÷>S¹?ñ™à¹D°p•ÊÕT„mù똖`“&·7$ª~[·åPQ·\O.Œ…¡²°&{Õ3¥y¦…_ÈæcÀ°ÚSó„öáàËûŠ‚ $î°9 -QM/gíÕ‰(ÔО*\Buûz¨GìyŽi‡-þϵGÏ&Ì'^èU¦TídÃ~ú×CCmñv*,î‚ã¹çP2ú ÜE?˜›ìºÅaˆú aƒÈ ˱d€-N](Œò̘g¥‰ü5Î%>ÈšlÄ9ÂõSyÝ‚Zf¢ðqËe×¶-ž£²°Çê¤&á§5!P¬ªuy@Ǩÿi‘[È­‡HáÄp×Ó,ƤM5òÉO±"À¹Ó€I#5K$µxK|ÁaazL"°ü˜D ÃÅî@´€oÏâ3'¾9ñ­lèËéC4v ïzÜT=5u[¡0.ìJ@ÀK_ɸ7I`Äíi:ª‡Mˆ¦öRmá|f´zi¢¶Xò°mTðqÈ¥‰®å 2"ù.d»Ä¥pâ‹Ì?²ä!„»X&ô´A¾sˆÀ‰°}A#ÈÞV¼°šFv߸p>lPŠÛr/èƒù¶ZR]3::j8“»È(ñÕõDwNÐFKªèÉSD‘éÜ»©§Œ[@É÷.· Mwû.Äͧ§¡Tbn3ö䨈kðVk$P­Ž1+ ÔL°,ñõ' X2¡ ãݦþÝW¡¿×#æÂú.ˆ¸¥q—4¡ü¨˜½Ã™«…¤PÜå@w˜Ô9Ÿ|XxC0T–µû¡l1™â‰">7pTþ‚ãQ# 6̾:|!G’ïüL_E@–¢ß„ÁÛò®©äI[Í—˜9´íI‰¢­êýMÊíÏÁ…ù~àÓ.¿ü·îšf¼¿Ž•Æzf“CxÖ̧â4Ï™‚Ë–õü@ðÝü;n|›Järž˜äMLJ 9ðs•3ÝèÏç2ÓøòôH{M³¯",™+gžsn¤µ®÷òO·lÁègXVFèLCJVùUÐ| iÿ¦ø'²ÿûCuçendstream endobj 323 0 obj << /Type /Page /Contents 324 0 R /Resources 322 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 305 0 R >> endobj 325 0 obj << /D [323 0 R /XYZ 72 769.8898 null] >> endobj 160 0 obj << /D [323 0 R /XYZ 398.2471 411.6333 null] >> endobj 322 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 328 0 obj << /Length 1954 /Filter /FlateDecode >> stream xÚ•É’ÛDôž¯˜Ê™Œµz‘‡@R„CN¦8UhlÙV¢Å¥…aøzÞÖ’ì($U£îׯ߾µÕ]ÿÕ]ß%©S˜»}ý,ð‡gJV[ÀØ.Q^íž½|cÕŠÂ,ÊÔÝîxEdwø-øáœ_6*ŠÍVÝf«µÒo6[cLðK_6' g@*pm‚ß#eª÷ÓöÈßf§Á‡õ¡D½ÙÆ&r&0nóÇîçg¯w“´6¶¡5ZÿŸRÞŠjñR5Ea’ettad"QíèÐEÖZµÙ:EÁw(Ïr€šÂý­Ò¡²QBw¾Å"_¯ü{ýîGº¹¯ê,4 Þ|ñâ…Ü}SV`>x¾ËªB=çÝ¡<‹®çͱkkYÝ Çϑ˭÷PÊÔZ‡ÜC¥3KLß6hû,Ø£?ÚŒÿ~Ä¿´Ê ·ÚDÁc Ž$ÜÉ¡N)ÊVÈü)œ¯kÁ~i .AŽÛãštJŒœ¯˜åD;Š„¹‚Ò£xïWy:°«¶ÊóÜ}6Ï¡ev £vys½ó‡~ßþ’-¶ ¯ „âúËΈØì:n.ÚB> £w@œN‚4Ä®ÓO¨›†‘Kõ—˜8Ül›;”µì™¶ÿŽ=©„£±bªŒ¢\º‚ßý…Br*0S^!ÅSS Hj°ca¢# 6$1lr.&€ .ãÀ`*Ìï N¥(‡Ib2j’…6Ž“k›’T]‹r>²,àÇ8h¹¸`=ò†½­Sä ’¿-¼GøœKVÌr#àDŠ.äÚ` L-©ÆårG¸‰žs¦çýºGMhA#ïÑŸ>/€“X«dµ g¦@©?MÖÞe£¸40t²¨q¡à-:Œš¶«ófïõ=zd [©š;œz¬wÔðà€q„l!T­‹ƒWäD"̉aÛù+ùÂQ\iµ •ËÌu`œsIÚºí$O‡³¯/m# CéÉM_ú:Èö¥,/æ2„•PÊ¥¯õ…CÏç !yÚ9]E ’…EãÈÔåˆ tmQ¼=x¡°o{¦JG×ÊúöJ¶iáJw/}·ó_H  ÌT†€õ$¶þ”k!ìˆú¶ž²C³rΜž©ÌTríŒEaìÈ`~LÀŒ¦¯l}la„HÅ_K.»H®4ƒDIsTuJ¥4‘ÁÒEëÊ¢Ev|8åü¶jöHçÜQK,ÿ™TA\O€C˦*E§-÷m}É;*¯¼XPm‘;níï&&m6El:hмÛJ0{ÅÞ­Ëf S¨¼`:hKÅÀ v}Šª &-v|YNË¢[„íâJE(¬wˆ3†™Î'`^UOŒVJ:âR(œ¸‹I/cXÑPù8–y“œIBKâãgwfÎì]yw’ëÌnàÛdøN–A oÙþƤ³­±qEv1Ëdâ­’ `a@1•7 H)_ *øR_^H[{#s¡40/¬€¼:Q…„ÈÆ&MæœÀÏÝ¡¬}˜#x} ‘Ã\®"¬†hXLô&ub¡O]€<ÔO }ÓW%¿·Yd8™ñêz ³*T©‹¿¬‡‘$ó°J±v^§á\ößr¢i‡ÎD7ãÄY& ®‹J*$VS¼N‰u¿ oòªÇ¹É&0¾’ópÉÃŽM®+°ÉqÙÇ™OÒnµ>Ë :žÎDZ%ÁÜÛjlÆñò­£yëÀ‚^Í6®×YðP6K¾p`T˜yLXR­oð€âf@ª Ó$ØS±Â `q©n¦b>¿#ôyv•'ê#çZìÓ¼SF­X’y¶°G&ý÷ꇈ,Y¼}eqÚaÇ Sf‹²¡3ðnîä@ö£XAŒœÏöPñ‡E©^–BÚpdüë"K¤{$G “æPâ¡4LHE' ùXÃQ¬¥ê\zŒvŽZ§R,=èã¾øò€/4³¢¿ç±|ðOAí,³¹—ù¯ðS¹0¹1# îÉXs¡d,{ž+ŽsMë‡w›í@"ž.Ž]›cÇÁ¿ —ÓkÙÜ<Ũ@·]?Ü£t(¿bhœ<‰Û6 Y½hà‹B¦³›'Ý*ý`à0$öÕ8ùáž¡+¯>àiÉM;ðBþî8?´ ¼ÉðÊ‘a‹ŸEÜr’a€×ÐB•WOØË/–_Åœz«6‰Ceü7Í¡‡ag?¬“…&UN0½€”ÌF»Ð&Ú^;“+ØþÐÊë„ýSIZ>²›Ò?7D𘠌Ûû&W þ%Ãý —ΣoL¥„A¥iùí€÷S±˜èÈ gcí…-ž¦G‘‘H'öÑ…ý•ÿx&E endstream endobj 327 0 obj << /Type /Page /Contents 328 0 R /Resources 326 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 330 0 R >> endobj 329 0 obj << /D [327 0 R /XYZ 72 769.8898 null] >> endobj 326 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 333 0 obj << /Length 3696 /Filter /FlateDecode >> stream xÚµZ[oÜ6~ϯ0ú¤ÁzQ¤n-X'›´^4‰á:(Ší>È3š±6i¢K]÷×﹑’Ærâ-vÀâå<<<üÎ…£Îø¯Î’ð,IµŸêÄœm/iþôBIi ë)É«›/ßFêL~dêìf7›äfûOïõ]~\)¯/Vk嵫µÖÚ˾]­1ÞÏ«Ôxy[—@Pï;èTÚ„žIVÿºùÇ‹77ná(ŒüÈhý5þÝc./•ø¡ŠŒå2Œý 2ЏÌVë(¡ BVSÀÊË·q0Ýcêg&QhíÇYÓ ¿*aÚ¹`‘q‹3g>`r,ngÚxÛ²;Vìîˆm(:á”q§G,ªCKÜ?ë$óãÐ$sP­Ñ:îvàu‚ƒè]ðoà±|_cTÊùÓ7 ºC^U\HC4ë¹v—w\¸-ᨄ×{{¾¤‰u~ »€TßX鎒ýÆ_ôFÖë&œX†AýdÑ *ÊаÒa5ßlŠc_,³FêËÛ+6+8V x%é?¶D\o;»Êý¢q3Ê7‘ù3Ö ¡Ö¡P'lì°ƒD… Òâp\ÙRn 6Lï5P™&ÐâAÔc’ƒ‰:¯¸¯ðúþ:5îаLÈ W}y¤ÆöcË0[:¤¡å«™+FÌžÑbá€ÊÚí‹/ˆ¸e:› €ÈöÜ]Qå“ó~¶LïóÉdLŠö› Êß¿ÿÈ…wW<àÇÅÙæíjhtƒÔ]a6^@uâîèê̹-@i¶£› Éß%#¸°W–Å¡iÑšˆ'ýb¢¡ð…föŽ¥’W­óÝQQh(؆ÜîkåáHÞQÓ9/ð¶’>²£ð¥eÈØ^^>E{âvNQã‘Ox9äûºìQ ¶2…Ø„ˆÈÏR$AR¢ÃôLûY”¦´óxéZ$ʯ®'teónB ×+ çâSýóÑ;ÒÞ nˆL 8nüeg»¥Kîhðˆ{V §,¼Yø&¬ØÜVq(ßÏylñy@Iž88jvëphΟ-Ê/ß4@3` MA+ˆ7kàMûi¨2ÁŠ¿=ÖEÈ P&2@2“Ù÷?ü>}ÀQ˜6Ù ïУ¾Å>æÌ»FŠ‹w+ ±ãþ®¨¹tÉŸž.·“ˆá{h‹Íᘷ6è˜xz‘¸ÙÃÔ‘D‡œØð˜ .ç ÿ,ëO](°5ÅHýí’DÃÔO²,ú’ż¬»a·+!°ÖïPð%e³'F©.îÅàTU³Éñ¾þMÎüØ×';ÑlMj¾¢œ)i5975‰) „~¹6Óü ƒZÕôšDÜ= Ç«Ðr̵±é•5¤c—K_ˆ@RÖ9Ô‚ÆùƒÐºDa;QXh1f¬°[i~:ZwñÕÚ@ ¼ÕÀdDØÓp*äpŠ$e23–T‡Þ«M` &¥ç™&éi!3“a¤È†ËHÁÔ8²•%ñ@;°& §»§“j?u\•x¨–,]NË}8Rü„X[Qû;nÊ;F­ª±F*¶ñKF #3ŠÄ0UWþ!˜F`-îr˜²á¢HZ[îY¢>‰ÏS\΂G˜º0š1‡òW"i:t&ë©CÇøDñ‰Gqä½²j™¸(m±#_‡ë¼ùD{m!|Ê2Ókdz ²èÙaÊ87…âDʬôNa©Ÿ/o~øðñ†É/Þÿ²´ÍŸWJN___¼¿ùå;¼ñìéó­áúDëjn‘ì³Çj†â8)ó¶•3´Q;\N&ïÝ›kl}ý,ºJµwñêòÇKœáæž‚¾o/oÞ¿ù æÿi‰÷·8ɇk‚.8ê¹B/ìâg½¹|ýñÇ‹kÛ®¼×Wp²7c(1ó×MÉ\™à™‘ŠkÉž³ÎPª šFX¤@g ‡¨£¢—ÃÊ [tVÉÑ˹"Z7nË€ªzço­VÇr P 9\kR\¦O)î‚,µ({€ÝN) ()Ì–膘0°N:;NªýÍN í}Û¸"íâ.+­–Û·”ÍÁrÆ À¦Äé¹ÇI+öãZcRÖ³% Y1ãÒ »ëØ®0`TÀú•M*+=å&¡Úyoì­†¶¹Á{qt)Æê×Lƒ90Q•Îû†aìµ êH÷­½8Ðù‡› ¡^åvPÊ5Í$3’ÅÞg ïz™×®¡õ¢›AGÁwdšx8ädØÄ/Ç×˼Ú7mI´¦½¿ãÀŒèé2Nì>žõ°qø õ$8êl–ƒõaš· "Eç8ÄZ6ÀA'Ý*°Nü¶ƒTßþý›B¦|&ˆ€3‰DÖàc¨-–ÑB`ia¦‘¨2òÞqòª<г€™«+zœZˆqÀÅR„LsB`Jo 'B^–*;Ábr~ƒÙä7„%(¼»¢7“Hs½g?žJÂd¬8WIÕ@lš]¿ù¿Gà·.¦ö‹š\LÒu“w¾\Ž17ù$ÜØJF£ú|b¬‚‹©Q™œÂs^ûôó¡úb×OÞ(Lyó„=›bsΟÑHóÁM(Lu·’—Vê§®€åüF»É{«ïØZöR˜«• b{×i¬ÍBaûBrƒ©0¥Ër0³Ÿ¤ fʬ$úf‘n@»Ã°¹[L¸A3Í¥bOŠþ ýÔ@`šüÿ†IÜE{Doc` þévœ_oGÏ"h!l8š I§~ 6L„tµ¨PÊOLzú+–Hßkçkds¸åŸ>DEú$uF!ÏÄéÁkp*ŠóÇ$»¦¢ŒŠ¼ÞÛß"0a;TSXrÊ9ÙaOµ·߀7³Ù‚MëÐØG_Ii-IÇ_›0¤×|W=õ¨ ÝOÊòó»,¨Ú2yÐ%å‚V÷¬@­ò¦ÐÖÓ’…÷~n¹°ô˜€£¦¦E|<&oݤž7"OÀQä›8ÖËOÀ¸¥/ü²é¿)´¡¡™xF-å/˜ˆ\ ¸_»GÃGòmZµ\Â$ÜŽJu ÇÄØ+’»„ÞRj3 }•&é34 ôå®Ð}YUÌ gkëé¯G Œ¥£ÌqL(¼-{±K$ü030y˜H¿a-ç€ 3T2‹7ªt $}!/£Çœ~7v.#‘Gò1O†#Ø·£o¾€!¶I¿ŠqšÙwÞgp½£‡#ù•9@y5ÆOÀúw‹FÖOÃìÏD4äÅ/.H’IÕ†_A:FÕ¢8²”oÇš&˜h]½ ¤½ðI£èUÈAÃ’öéÐT=Cû´oŒÉfÚ‡Œ4µä)pá åp¦¿V8Ù,t·xÄ*Œý,r·xÄø\ég*¿`7ÿäYseZÈ۾͆²zÛ„¨o øƒ¼]Ïendstream endobj 332 0 obj << /Type /Page /Contents 333 0 R /Resources 331 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 330 0 R /Annots [ 334 0 R ] >> endobj 334 0 obj << /Type /Annot /Border [0 0 0] /Rect [315.3164 689.9313 452.7695 699.9313] /Subtype /Link /A << /S /URI /URI (mailto:ivprimi(at)libero(dot)it) >> >> endobj 55 0 obj << /D [332 0 R /XYZ 72 769.8898 null] >> endobj 95 0 obj << /D [332 0 R /XYZ 72 769.8898 null] >> endobj 201 0 obj << /D [332 0 R /XYZ 93.6002 509.0679 null] >> endobj 331 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F60 19 0 R /F52 23 0 R /F4 337 0 R /F54 13 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 340 0 obj << /Length 3574 /Filter /FlateDecode >> stream xÚ­Z[oä¶~ß_a •›…)‰Ú§&AÓºènˆÓ"m D3£«ÖH®¤YÛA|Ïi,'Ó´»€E‘ÉsÿÎáè+ÿõUž\åÎÄÎäöjsx£¤ûþ–Ö f¬¦S¾¼}óùש¾Ò*.T¡¯nw³En·¾º+®u4V×+õ×+cLT¼»^Yk£¿^;•}[Äv?À 66‰¬»þÇíßüî6lœ&iœZc~î|aÞϲ0q¦5Éb•ZMG½Ùá¾05™N…&L(`œÓÛzç'ÎÖ´&6i‘ÉÄãP!A Hêî*l«è÷¾½^%E½ÿÈϦ^Ãp_öÏü>v<ñ^óH˜¦£]‡Έ¯¸è†ç´Ò }@*u”­¬5ÞUÒE\hžå³ñøÒ©øŒv±ÎS/èK"†f–ƒÚð”-dOÒ }w/·Ü‘p‰0Tç©I\ìl¦=S3Zò¡D9l&¸ >GÒc£Cyb ±t(y€¾’I›®êmÕWÛ˜vR°CkS¤´Ã—À“ƒîñ›¾â¹T$9Êb9Ó„Ï ÃÐ~轈6õ€:·2YÝðàJé ú#"ìj<L8ßHšhþ¦&%ÛòÜ5~ÿìö$çNñÃ’[&œ‹ÐV¿Z¬Žmj­Ìù5šOî"0:’•ÕI¬ž@ ˜¾­v%Ñxѵ2ð½J•Iá¯æGRS–**ÄÀÓ¦dÀ˜ïFMîdÉZÆÀ±ÄLB¦¦$¬àYj‹¹¸ù"Á89z¿»vpä#²ÐEž#sÁlùµ;ŽÜ€ý=¿<£Pº£¼5 ôú>ጪ¼qw²|·èm“¤ˆ•-ÜîÖÆZ^dÄ1P€ ›à`¿v/›É¦ä±þ—ääÓ¬hF¢Or”x‘ÌE_=±~G]ð]jE)ÁËn:r¡‡Ò³5S'Ð.‚nzjIΫOKT§i¬6^Qãëœ }Í"?ãÜêô¢èÉçÑ haŽAã=Ðòö[~÷êžZÈ÷ =cÐÿX£ÿç—Ø$vy–Ìß6ø5´†¦{·É)†b{×ÑJ?z­BØDIì縗/PÈ8tðàM)Ch§èy@#†¡^7ÏÜ=¢>•íМvÓŽ>vaÇÉ Â!:>sÏG à×îÑG”ìÉ'x=Ñ­òБB¡;cë'pðaþÝ¢´]œƒ>Í]À-2Q4t»ñ±ìåí®¸±®Ð%a«©Û{ô¶Ø.÷eÝr¤)ùÑWe#ä6¸b7¨åžpW‡œŽ~ÂÁÐ8kœØ,/ÙŸðÀÆçé?Þ1%›Iò9l=zšWµp•ƒÒ†Ìú,ÒžI½Ý‘އ5¸¡ Žnscœ=@ƒ‹§QM—(eÓR·C¸Tׄ}\UOÜ×b–wœ2²—|Ó×â8MTø•ä-³¨F’SB-&ãÈ2LSœà#4룙éch(ñ°sÓ5ŒÎÎÕ1Sn| ]Ç¢ äqrZìÝb6‰»%sõG‚ï Ç3à=O©ydU:>BJL  v®1Ýô@_k/ºAü|(~iÆ–ýÔ_h|PvfÕÇÕ¥23Oiåûš‹Fí"VðeªoWÜð•p²nìà]$­,Ây;M&vEˆ,i8\F‡[AˤØÌê%¹ey 9“7±“ÕØ³ŒÒÊV’¥DÈÄEžú ùÙÒJ3s% [ô&¶Úi™öqtz* ¨òKÄgØòRr(%ì Uò;¼7£Ù~aìý•Í!«$Ë ¬º3k¢Ë(°þþ’™s.)DnÆÌ‰Å-­ëT|b¦&#D¬–4m;~2샱{* J‘ ;ÈÛ+FÓ01”žx°÷”(ížyÒxGˆ_·¾§âŽÀé§‘G>…„?SÈ΋qR¨³+!6M%b+–ÜÅî2H\xÆxW޾%M3Ї}·ïËA’KvÄ ýÇ 0Ôµ!bÍåaén(›ÙxÊ%aä*§›Ä<ˆÄâ@|*ÈÏNQ"z(eç5Ä`Õ¸¨–FÇÆ[}éÁUÇÆI°ÜRJÌ-ÉJî¨^97&Sâx6%å®á:F¦÷"$Î*«–R؃'‘d ’p¬E´€L<*Ú6þNà̵Nã´Pn®7—™ ¹ª±jÊ&€¯rË© vŸá³Šê¤9ˆ/b~°•ëIj«nRû…í×3 _Hý±“¿mªrKpyÏ Âœ]ÚPF:»O™^ãÔ‡)âÆQAU]’{þW.tõ»‚‘"Aã÷;¬Óe‘³b¿Æ¥ÁCS{ÇÏ@¶g:BåÇ«ô^çJbþ¸K·˜À1Û—ËW2‰s>–r »ù`É(Sz:ÄÆŸÅ¨ˆ>Šü„ðC®ƒÇ遲IdƒP?Œ[.Ö‹ÏHANIvŽ#S5ŒèXPðB±óͺ/GrÑB÷xÏ+÷&M8ˆ–x˜gå@!!ÑôŠWžK(Õ/%„“dÌ›U¤‰06Õ“Ü*MNJ€{Ò¹ùô<•.m%@}e¯:«Ce3€…ZX¶gµ]°^í`”2Ù.gÛr¯UlçFé &rÁ¹«›*a;ü7÷ÌïÃÞëXAx9}"«‹º£ Ì”›\—eÊFèû!ÞÊ¥PƒRÝ1>±cåõVJU íí¶Ôú­ãàÕŒ† }wÜß½ü {8 ü¾ÌÃBÇI~‰°úñ¢z nÕõŸûkI|]¾0/ Ûʼ¯þvYù'MôYQOÊjý 6oä7*!2*Éö2@°Åy¶7·P"9ê ãÐqlOå]B]é$3Çq«*~/›¡ãi§ßɤ³«xõ û“¨OrzV—ÈyÚ蛎×n9±¨ŸØ´ÈâTgÙåf#.„Y¸3—ÇÆd&ÆdQ‰¨ï·g¶e_±-„ÖšI¹¾Z¼Ãõ?rh}qsú£–ª'×4½Oš\r-‚/ÚÍót!úç+yÞ4Mµ=UuyöQ¡“ä÷Àtœüí¬¬é^ ïˆÃï´Táµò)®TSîs(§oý4éh¦÷fرTž”4ÖáÍÚùܶO*_DZê_»t^O?;úá•ìtRPý_|öLÍ,ÚÎE®<1YìBž!ÚÆQõç^t¬”gõ4ýÑ(?†zßYÄ)øª_€ànI®ÖÉuê„e© L’Þôµè M×’F»vøZ¿Hã'n²uj)±7â ²þEðãY²Èù¬ ¡*V¼yl,l<ñøÉÊ`uJ?å4å’¢œ sT¼9ý| Eè¤H¶ÐÅæî­ýÀÄþ§žÿëJWendstream endobj 339 0 obj << /Type /Page /Contents 340 0 R /Resources 338 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 330 0 R >> endobj 341 0 obj << /D [339 0 R /XYZ 72 769.8898 null] >> endobj 338 0 obj << /Font << /F51 16 0 R /F52 23 0 R /F55 192 0 R /F60 19 0 R /F53 119 0 R /F54 13 0 R >> /ProcSet [ /PDF /Text ] >> endobj 344 0 obj << /Length 3649 /Filter /FlateDecode >> stream xÚ•ZYoÜÈ~÷¯ü ¡yΓ|¬¡Àë±’`ç¡5ähqÈ ØÊ¯O]}p†²³ 6»«»«««¾:8áUáU]åEìqž\íŽ/é~|Jk [—äÍÝ‹W¿¤áUøeP†WwûÅ"wÕ?¼›Ói³r¯îªMè5ß7Û8޽›×üüð靨H¼_6Eâ uÍoïz˜Sx»ùXwhLjjúާ|l`ÝfÂ’#ЇeD^Rnþy÷§ïï ³i”úiÇ?;“¡»<œ%Ìý(L}²(óƒ4 íÉbd£¢cå‰w³Ù¦Yä}@î>›x¸<…Õp8b¹æžwø‡Œ9$¬3Á8'ü§£•Ž ‡;—t˜¦~„åÕ6Šý,#âêo›"öêa4ò ýøš[1?>õ(Òÿà?ŸwÄÖ= ¼˜$ ‚·¼Ú†QîA”@+õó"(h“·ý '= x¥º"¢O?Ê£â*ðã¨`Úóž.ïÛØâdî~ Âtõœ ÜOšÂm!°\.CÛŒl3¿vޱ¢^_úýå lÛ€n*2ò÷ÝØÜ·5î{ )Œ5¨r²#Ï*(I—§*Ëܽã!z-]Þz4˜Žëæ£[ù º•‚n%ã¼>6ìæé…0â´¯aœ,Ühœ¢éå5Ú(=ùö<PuÂÂtP·¬àØfSÀ8DÊF›/r¤¯jt™Ib!ÉÏàîüöÈܬ%€zƺrd‰´vPÁ"à C¶ûð‰<¤–PG÷M¢q¸KižÚú(×¼ÊnÆfÀô?@3ìÿPwõ€ÎÙý<#ì´h’8vy¯×«zÀ›)èfŒ/NèÖQ±åbÛz/ë;›:ÞÕC§ã£Æ ³Z¥ ƒˆ/âÉzUAÿŽ€ƒó…ñôÊ Ä±Ó¨ÊØ¨¡jM¼2a+P€-[ãi‚0tTÓ$î†ÞiÿÂì3¾ÈõJ4¬ÏÓÈ>7|ïֲ “ŒÔ¤” +0žûX(N< ×Yîh,I²Äzàë΋-0É%ã:5Æá i“΢æž(n¢I$plЕö¸ú£¬bDЛ°ùÆ“âýõŒVk÷nÐ{Â¥ç­íh”ê}=ÔÝ®¶¾~{–ö0¢†’#Ý`’ôùãíÛRóÛ·w¿I¥éÓ;©)Åû_n?ÝÞÝþùÓ—µLjEdåzý Ï{¢$R»Oì&»ÀáN/Y!‘ ).«i&+ŒéT(+´¤u¾”  gÅÊjÚ !é!DVš  ¶›TÓ gŠxŽ~ÂC­ÜÊ íD1 á… ÂáÆAiè¢úCT‡WaLqXk"Ë@ü<ÙðƒÂ1|X½jêјZ{Âbš®rM/,‰Ø4a¢Qè%‹§Ch¬ÝîzÆ0“•HœW$Lx6Ú*vìã¾Ê9Ø%ÄÖÚjû­©j¼»ªgÃ?ÕŠ>m—NÖh9Ò„–™sGÝËZ2§S7+ä{P’\Ë,RÑ"´QaÍÄäe~@p06wúr%’Ô—ve+ ïFpÁšµ(Õ¨›bHŒHE \ cn§æ+±bÉáv”šÐBJ(ÒI(¡£ÉžW2æ‚/ã¬Ã@|;3Å•ã’a…96‚ ¨Íñ;0v\­™¢d…ÖE'Ûc-‰!5$`á¬çe( g·IÙ¢Pi•ÅÔå\A.:3ÅÕdU"æ—ÂùoRÌ$ÆÔŽ÷:Mk®ÈxQ<||Ьà)S]¥˜ùeQ\€QÛÒ̤|¨û'&%§º¬À‰ ú"[]H£/Vq¡bÊvEÞŒCýï¹1Îí—8Ù`È ƒ)”§¡UïÍ0Gi<Ì?Ï%¥7p£)g•¿:òÀ˜\<Œ9%û—ÜCu¤4‘êÄ(ï~”û©“~âc8feˆog>B#3ÎÒ)žÙÒýÃݤ˜L­9ñèI$•ÇØ)ô¤Rjà½vë¸wI™ùž‹ðäí°’9ðºRt‚ÖQ>¥¸’Õv¥,&á’ª«^é¦Aõn)7@ £„õzyÎún´\žÕCý¬Äi€S~zâÞ/N9¯:)f‹©L‘Ä9™¡:jöhà$5^QkÒ\ü…ƒtCzvÆÙEÏçÙRh+ã£SMDÁá•Ñü=?µ" ï~gíÁ%Ef³Z5a§ ßiÍÖx$·®)µ¾"Õ×]$^3ô¶ú3ÍHîýÄ3ŽSMŸºp<.ùa”?ÕÌÕËA85+‰q`ßï–jR8È3k85’?ˆ 1m‘`€5²äÌ\nÇF_#-ü5Hâ§ÙûL`VݵkœL eêl°TȳKJœ(m‘‰:®Õ5é%¥Î^ÍI±W´çÒ®­˜5ƒUMÒ‚’´ï€œ@™8J†³ 1Å3bBï·‡rºcUÀ˜`¤ÒQ{gy)^'ìJùì…µEá MS 2(…Æ©þ>%r4 ªµâŠÁHµ½Žýˆ»„b‡$ܰ)§P¢ô P¸ïhãpî ÄõwŽû¡´nÃLcµ—¶‰XFŸU#‡D÷Nð5Ô­ºleÍiÝ¥ÎXm‰ó܉ÿsŽ O6$´Âw²Bxlz@5K‡R+it6g/ݹSEÉ‹Qž³õ,¦ÒÑêjÁÞ¥Å\K4hÙ^sõ;3uöõOBr¢C·œs“—<˜‹0ëԓ۹̧Å/·£ïô˜N×Ù›ŸPöu÷[êã3%wŠ8‚¿íØ!ôS()8”ŽÆºúAOS¦Ú1L¬”0(*M“¬ó|fIì_©R@/qjk!2[V5V[ñjÑÄ0Ì^-[¸ŸI$¸Lb‰Uí>q$þ3ônMÃ5ÒV+ 0¶jå,€ü$‘3ÐÒ±“ÁËš¸5²uËþPHèZÍ®x¨‘Y ßµÒ™ÅŠlúç–‹ËäxRq¼Ý3©rê…gè„ý³VËr¦èˆœ©UJMQiu çXðÄÏ£IgÒPšÕËþ«X)Ë )•$B›l +RXûŽô©)‹Z0óô· S”ÔY—†Ã)ê$BäûaöÜ âü£I€î,¼çÎÿ³ê¹ãÇʉKãý5Ouëþºâò·[ >ñÓŠ©Ù×ãÙGHûyQxÐ9#ÿDÄ~ |dptéýd[©€“ÔCVC­«a|Çó`e!Ý[N;lÐÁCw”Ë}ŸÆ—øÙ¯Ð>Ç6¤äÅ&~;)Ní!•yêp”-ÊÝLÊ6Ž-âm32ˆE9ë.À¿|ÒñÿÛ³ß~Y®‰Èéó\FÑãŠö¿QT {¤…rçèEn.8•;,rçyq^93ßÏ•|Ú¶Xv1ä.³’ŸF¶\‚M4’æh Q] Î/þŸÊà {xúÁØ ·Eò·KµÀPð ø´MNˆÑ÷¦Ž˜Jb5^KUHGæ9C-ëk‚ ŽtÙ4·7æ†4ÚÔÖ¹*¼£á(JP2¬Fó¹ÿg‘x7endstream endobj 343 0 obj << /Type /Page /Contents 344 0 R /Resources 342 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 330 0 R /Annots [ 345 0 R ] >> endobj 345 0 obj << /Type /Annot /Border [0 0 0] /Rect [100.7996 671.0272 186.7077 681.0272] /Subtype /Link /A << /S /URI /URI (http://fsf.org/) >> >> endobj 56 0 obj << /D [343 0 R /XYZ 72 769.8898 null] >> endobj 26 0 obj << /D [343 0 R /XYZ 72 769.8898 null] >> endobj 342 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F60 19 0 R /F52 23 0 R /F55 192 0 R >> /ProcSet [ /PDF /Text ] >> endobj 348 0 obj << /Length 4031 /Filter /FlateDecode >> stream xÚ•]sÛ6ò=¿"ã—Ò3Küû–ÄM“Nšæ®î5¹ë=À"-sL‘*IÕñ¿¿ýJ”“ÏX$°X,ö{ŒŸGð?ÏÕó|­ÃµÎ“ç›Ý³H†ïŸÅò´ˆ•òêúÙ÷oÒøy…ETÄϯogH®Ëÿ/÷û˕ʃª-/ã þr¹ÒZ/àߟ>üŽIðær}UñÛUkÖÁæ°«ÚKxÍXw-/y_žÍå*”ÀÇE© .ÿ{ý󳯱©JÃ4Ñúkgrp_;Y¡Ã,Šàx* £4‰ùx@T¾þŒur}¹ÖAoZ o@òöð`z9ÀÃÝ݇y¤»Åß<ïðìy\Á29>àuǧ%D¼j‡ì^¸ÌÈoô®Æi\õ•)Í ¼6²ËÆlCEô ï«ÁÛ´*{Ýò¯AfûV±ã4ʉ·]oi5@fgÁÃ]‡"Jâu0ˆàô¦þ3Š“ës@ Ûý}™¦A17榩xfì’ø„[B厈{›†§ð:m½Ã%ŽpwiÉÊÝnƒep=:æà8ž„6ë«¿ë¡n·óãft\ÂX¡ ¢ <ÖWÆžŽ±½£AfÐÃ%°ÁàSÙ<"OŠà¡dô´­Úª¯7ü2ÒÁ¾ŒüV•õHFŽ4âøŸQÝÚ—zg¶•°®í˜ï‹³d0T:üÝ#u_h›Æª-à‹—ÄëHÓT„Îå4R‹ÒtÛÞì@’ð—軜ÞÑ ô$çàì@ÛÑÄÐíÈüL”V¬HÖ#Ï[ÝÈ@7P1„P:|Èl£Õär€k/Σ*ëÄg„òšN¾pâá0Ó‹4°ÇHâL´lä7ÖNø­¾ÈˆdgƱê^k×ù8Ìaì™J‹=çÑÀ0B¶sü†‘1úÚri‡‚ (Ûi#@ÿõ³i¥YçµR1qÃ7ܧù`hñâÙBØ+‰É ÂÔfòlð¶3¥àf]¡GÓ2ÞΚ(ÃC=à“.”AÐsÌÉR–N(¾G¥Z|ÚÎýQ‚:¨¬` JU`nçK8°ð2²˜ß™þ½ÄžÖc5ÜL. h¤!Ú…O°$ÈGœ‡c«Âó£l%¤”õÀf{ 4[¡d oÆ&ü×ÁòcÁ)íØ•ÈqßÇê(jaçG~Æx@ª©£L €‘înd˜'…‚×iðRp×Îó#É8r ,Ðÿ»¬¼å߃ãB)»°5-ˆß´VõŒ£Ä`ø/pÚìÏ'—ÆòÇ_Ô}Rô„òOѵžb NÙCÂcÛ ¢oÊ®–…Ó4tBYû+ƒà/BwÔ4Ì×ÑšŽúãœÞY¬ â–£õR˜ÃàV܃}a诉ƒ“‡º’uu»iw)H÷„ 2¨ÜÏ ÀðÃ(Ž8‰hØÔ ®èx–n©"Œ# ,…H”‘€6‰þl9²ÒiƱNçJ@g©¾K»í8¸ˆcÛÙ¦¾à±÷æšðÆ* ‹ui¯ u²N™ß4I`Vçú¶ ìY‹°ÈTF9s‚¼,[~û  y¿Ä »i• +þ.8>$Ÿ–Ñ@›¤q.@‡aŠ›ŠòHø!úo—k7GAx– -P¡tX`*Í[\]_-Ò¡BȲF™¨uXÄj}lÍh«£¡BÂôåjÓµkIëðë4êÝ~™®´ —ìùöú Ÿ£0R™v”Òè?9³|ÁíëýÈ‹ÉAƒŠØJä#¦÷o™‘†Q¡,7Êj¨·-9õ”xà3å’®* x |9uü+æ§Z¡J5ç'E…8 ¯1»½8ö^*fï¡¢YVrcÎ8ùq¦ç‚¥vAóµçu§LRiêXY&}øéŒºD¹¯-GH²0U…Ú'¤ñõ2§“PÊbB}Z (†½œýüè^¤).Â<Î-®ý+:ð×’¡2k\&¶ÒI¢ÎŽ|•Ç)çOS¨e§ý¯9×£¼á‘g½$Þ9¬qb “Rxpy ¾`èç'—Ã3V—.k†¡ rO2zxº±Á.Í%Ïz€~@®—¥LôTÄVÃj)[ºžÔjI˜èx£ì›\¢ÒðœKTIÕ'‚\¬À]6üpÇ.øw'ñÝ’g¸<ùš¿KÁ)&¾âÅÁ÷v§}ß‘˜„ad‰Î1cÎüì¤P£dº—,˜3 @²X“•ZòÝPœo Ît¶è|µô(ÀíŒpD œ› K›¢QKRIÂX¹ÿ´+N|Wœ +N ão›¾ÞK …á³þ7Òoò¿ëÔÂy\\] AÈÙ$®Z)”Ô“ °S+ ©¢Ò³kÎ’PEIzÚFáô“Rˆ)‘ДûYA/#Ø*9ÒbŠxM’S©¤¢.ÇFF‰Ÿ†åwÁCóÕLZeÖ0¨E°}?5ˆ=*w#êz/ GKÁX»m÷: Á¹kn/e+ö4Ía`—ÃN¦ˆ5vÓ‹ah*þñbÙk®Œ4»ðÙ)lUrYÁå6þÞ‘µ•HPÎZ¶5¥Ñ®yGrŸÖðKÙZ!3 ‡ ¸» Ÿ!±†ð¥wnY/ôQ‰‰›®ê²êQpÑ(DÙÞÂR<8îhPv½žÊ'xî«[ÀÙn(@s‰Ã6a^ÏĵíÊwo!} xâ쾤[Ó—6í(èVEM§ûËw•6ü€7ÊOUÖx[u&äíöSà]ÙámÅ$iLËŠæ|å,P¬Éx%¤Î´¯°ŒXçÖ€C¯â±®.Ž wZ€B@ÚŽÑ"µ81aÊã'œ¤ç|jkì³”ÑÞ`œ–9¡tÒ0[§znù •6‹‚a@øç+„‰¢BõÝ/Œÿõ¯èÕ?¿ãÞàóEDŸ)ðÒ,žX†kÓ²ŒÁ‡Rh†CSG‹’¨±’;;›°ÃóÕ±CšW)5B··Ñnº†>ìäú°ª½»OÛt»)üõÖjj×½A{EHN¨…«óšP˜F*UMi@l/êI¦kv´L(8¼P’y…—S :έÂr¸÷¾xàÏmÂbYÇM%ÚSL†ÄÆNK»±öÊ)Äñ³ >é_+"ûV•Ì}«’[u5U;8vuú)Gb[møÐOŸÈLáü°™20Å™+®i°_ýØ.ñ²Û€u4ÙÍ¥„¦¼`¹ ÇífÚ¤ÓØ%Ö€»—Día5å÷PÉ3õ´Ž=IÏ0¼É Ðý¹–‹pmiDºð¦Äi¡&œ÷Ðݹë«éÖžŒ\ÉW.HÛ)glxK)~\&Ö/÷u˜è(è¦{Þžä2ÊxÏ¿›Ž…J¹†Ç\­›ÆSÎdJçã’Â-¿%æ ‡i÷UW<º6T*°³¢S]àá)Y|ÜCº·y«¥?¡H6U¼áRÆöVrv Ê6Bð¹^ëV”za«sN朂<<ûŽh‡·ôô+µû–¨û"‰¤yˆ'Lðî–çg4–õL¦“F”†a æÛÅ UµÝa{Çך$ýÃÿK뤟G1×>Ð8AkƒÜò÷¹”¤º³V¤ ˆ•à\¶G=5ïð……’Çõb®ìÎ#ÏÆàÅ4hÙ:ÇÛ­ãWtz*³ýíŒ|}çÒì,'õ> endobj 349 0 obj << /D [347 0 R /XYZ 72 769.8898 null] >> endobj 346 0 obj << /Font << /F51 16 0 R /F57 352 0 R >> /ProcSet [ /PDF /Text ] >> endobj 355 0 obj << /Length 3628 /Filter /FlateDecode >> stream xÚ…ÙnÜFòÝ_!äe9€4ËæÍ¼9>-ì8@”‹Í>PCކ1‡󰬿O]}ÍP2 xØÝUÝÕuWµÔUÿÔU]åE¼-â<¹Ú_…2ýù•’¯€¸qA~º{õï÷©ºRá¶ Kuu·÷6¹«ÿ¼>67Q4}½QAûmsÇqðúGþýù×?ð# ÞoŠ$›†GoÀ)‚Ýrlú |ÌÕÜ=£|haŸÝæFÁ–À«2 £ U›ÿßýçÕ»;Cl¥Û4‰ãïÝÉÀ}ïfe¼Í®eÛ0M]o7làr_‘Èfœ€B•GœZ€Ê ©œy²ê¦¿ˆö–‘ø á«{ `|dAGkxÕ{^Ì‚¶f´{˜Œ'œAæCç…6h5-}êÈëÞ·Zo ‡ʋ緛›$.ƒ;ÁU ãÀ!ë™7*Þª4Ì/(E„|)‚ešyt51$Ŷ*Yã Àž²t€“íÜÉüc;x²âU˜"NŒ5ß5.b¾âéÝp¹,7_;€ÿ$ÑŽm¯é’Ëñ1$øøÚNí}×lý;gtçÿnðTF†Á±Bô':’UóÂôŒC07c[u²Øóï,¬Fdîfõ ç[­j2-2’U–dÁžO×y`æ¢ìpíPÑË€!HUˆ*ü˜iIÈž‡51k:ã8Z¥S׸¨X7¨„ èÉÙ(æCŸ+yS ?èæŒHâ±ò¨r|‰§fx|ÏRA”‰EÑNû'&î7ô5±=]¯*}%NêžÎlx0MeX‰|íØÜîw¿¡Ó¼  ýÀó­l?Ìž%ÃŒå׉ÞÍb¹šÌt[f“y‹lÊc˦<±|A“kÍIÎ#Q…o³X 쇑—£.¤×¸ñ¹ñÃT5Ú³fÉÀ+6 a.`|ÃbÀÓè¯P%3vÍX ¹@0·k6^ëb: K'¢…!ö2{W^‘ž0ºNn0_€Á Ö•ÎMÍ0…iXÉò±êÅèqEÏâÎÙ³°Œ®¦¡¯îÉûÃÊœH¿¬à¸ éÂÌ®Š§.ì yZmÔaÄ5·ô³ïqæ`¿Çæì²¸>¬y¶ªþ °«ý"èÝ©zh¦ç•,LÉ„ÉJ@¢iR%€­-{‘Míý"^(³à|Ÿª/ú.0³N­+ ØaSÍ5Œ<€°mÑþÍÞ  “(tßsÂ2j׉„3ŒvS:€ÌVU¢ Thn»¢`iA‚Âk=SÆ):Ö$ KÝðt…?%¨Ø÷9[И7àajÖ¥†ÁîÐ6FÒ:m Í¥qCãdJŠR¨@xà€Î×%Z ‘úL}¢½¾,ÍÙ6¨÷Ä­:F0$v|õjÖî9—&*c8uÃz{0‚èƒ-²w6ÁTüà ÇÓb¢Šî†€0mF4É>3Z'±Â¤›àæq8 q‡–#'¯IJ!†öÍÜ[¹yßèsrÖŸÏ7ËD=ÉR×v8ÂEÇ‘d™ØÛŽ­TæÐw"fMà±ï†ªæ£Z&ä8ù>RŒvGןæŠ2ñj´K-æ8ˆ«Þ ¦iÍ=솣V²NxË2J‹ïibœæçbL%1M3á0ìò’ £ée1g¤NcÍ&¹äG&šÁ¶^ÞE)S Yð-ÎÊÁÖkÁË$T¯ß]5ëÊ~¢¬dè¯1mŽí^‰ŠW¼LÎÕgI…ePE‹}*Êÿˆr¢¥>ÏNqirxÎÖ©žÿè¥þ=£xD‰Ç35GÏ„PZ9Íc{O´%ïÀKÈ[Äôœòjp¢Ù(;#{9õ–5;¾$‘Ž#x‹v¹i..wÖšAÄñÊUU?ªñ"{O/üÌ<꤅ÊØolŽUÛ›½Á.´’õLïžrN\v Z嘜“I'äÖŬXY[xqáµíxˆ»Žè„ ‡¾á'“BV£`ìŸG3äP >­d H6eΪBx!s©ˆ:· À8½Ó<]ͧÒ6Na:©Z³™²‘R¾‡O 1ÙËqò”çª5NÇdo’NÅRƱ£:0Yè’‰PºÚ9ïÖóÊ ÖÁ°tèÅä$$R^¶Hý #— À! fé 7sÒa–•CrB^°™ð…8:P'Ö8*ĆÅJ1Tè}&¡ :ž”:f/™ÏŠëÚW“6q¡¶r©ƒ»j| ݉Ös.£µŠ=Œ©~fz5Up „}Z]FáÈfSGž¨ô.˜GT&µÒà/“o•¢Ea§…—˰Õ3]iEántQpõÊ=] eó´ò¹–+ª\V¤±¯{ ùY|üOooßß¾yQöîöÓ¯¿Ú*–mO@ykÛTÙžœ‘®#¬&_€v S)‚àŸL3™’9ÆÏîŸxž¾7NH¥h?ÈVϔ縄'öµ›ÇÒÌI¤wÚÓj$Þs‰ÊM„¥R0â5îìä*ˆe|/Å©©¯®†Oƒ‚èºØlöÙ•s¶é½þÄ(Æw]ÉW˜€¤žÄ§Ëkº§5ã4A3·í®Ñ 0#¡%•¥M¹1dþøG¥ê áœC¬É;Iΰ&àåµ:Õ5;J¸«oýฒë%%9=ñr9ðÒ- ÓYQƒg<×Ú¡S7‡ÁQ_y£è¦€5Ò¦(tJhŲÌ/Y«Rôßg‘¤P´ÍÀ¿&=㣧+ÄìWÎ=¤°M‰j űK,5f°›„ÁíªßòÛ‡×^æÁeC&kiÎPä·Êd¤1ù}+)˜âu€yÇeüH´Ežù~ìµx¿?ð´$O¸ª-,Ó¾3-©N@~C¿R=Ȉz6h÷ˆEZëtÃÀoëORŒô{¬ÈIIÓ†&dƒVŽ‹ÉmÚ:~æIn™ù2¹JV†½Gyðb›¨(óEu$®µÇÆ»¨È9B!;â’”ÛtÿJªˆ9.®;!jbHd‘ÑÌÖÔÿ°‚Ý5´îz#FÄœ¡›±áOª'e›$€s|DÑÅkuíDݵ(¡fýjáDIüëÃøÄ ®k‡ ®ú£á·çîÄI}H†ü¾  ˆf$¨ij]:¸e|Ô+¦#ôüˆXñŠéæk+ÝÍ+t[æÆK é¬ä ÃØr™FAìÂq¦*ÎþìÇM8´ÒuŸ=Ž­n›T±—Á3Ø;Çv2°º¿|£òm™¾™þ$fú¡¥’#—â1WŽ¥EÁŸNFÖLI·R,=&F‚Ü–œ¤˜cfš³´óÈ¿Ça”MîÄíÀèW´Ùíâ‚´CÅÝöw™…²=ͦ©/ë:Q“ypÛÖ„‰t t£ÊÎã™ß“ðÂLN¥–&N£!}>ÄÜ3Q˜Ýx†1æ¡ñß IÏÒDjW¯ºÄ¡d\R꫾ôúÆC®¥íwíI·ªUêøÁQ3^2N† _­K%^øm©&„å§x°=•^#†Ñi„à›ekPùW÷Ú²}óèÅ]•šB1{ЃHÌ\zÒäÉ.½¥ê5¾×>þêxé…[§å˜8}ÜÁŒnN¤m°Øª°L}#|#Føû¬Ë’$+سLg]9Za'Ÿ'Ž’YnÍ0¨uÔ•S–KâælñÒ[³Íôü]ÝS®¦f0·x_ £ùYœ”[;zù‚?´.«Ø¦Y¢|v½vý¶1î íÃcMtÒj8KòEºøpp^H Úo©…Kž{–­äæÝŽÿøÀ#ñ’˜–ÁëCdÁ½ú=qË–þoIÖQ‘Yʆ2D@ÊœzÅËÑ·ÖI’ ÂóˆïŒ¤ƒÅkbDzìþ»Úy¦Œp3Y’}„ôß1qIS{£=m–žÉö9“ÕÙp§‘æ›ì{ííùóÊ5wÛãÑ6†€{Ôv-BÝOyd´·½”‘XË¥+,á–*9¡âµîìXÞNa–§ß$/ÅΊÐëèk&ñe]pÛ)úE’J<,¥ï!yM¢Ü¿7(W“sœ¶ä )SùïJ§ãX:Ï/Gó‡¥tw0K‡D| "NÿnÐöLvãNÔqµÍz'‘óšÃZéëÚiŸƒ¨¥ºÄ%§Õñ>ÖOä¥J|#üù%?#&£wpI\gå·îƒ±ª¸])# È;ñ88pžŸ'žÑ]²ÛžûØã7°ô»ô_R[Œ*†PQHié5¯¼q:,9q³Â‡ãô´Ó|ÓÍY4ž @”Át¹žyÆù—$škŒB\Ϧ¬p¤Jr„óË¥¥ãYµvá’ã.=9s«ŸnÏÎ)¦Ïv:_öS˜¨d%Qê;Ÿ[O_¸R6ú¥RºF©ÞÉ•¼Ûh_jf"qþRqò‹U 2‘§À„"ˆ±ÏI ~Ü™?‹"»‹2ùC4ܺªåƒ|wª(w¢…^1ÁmÌ#T5ë>ŒJ¶*ÕYª> endobj 356 0 obj << /D [354 0 R /XYZ 72 769.8898 null] >> endobj 353 0 obj << /Font << /F51 16 0 R >> /ProcSet [ /PDF /Text ] >> endobj 359 0 obj << /Length 3558 /Filter /FlateDecode >> stream xÚZYܸ~÷¯0ü àéÕ}$O»¶wãÍÚ^À³Ù '_ëxÖR´Kù,>rrFÙÄ ½fYî]+îtRËÀrÔîŽlX;ï¯||å  Ü‹±§ã®…¢/j\¹y;“œm»“[ʼnn3àÛ.¤ÔdÑ:=›É‡¦+[ÄÅ:AIÚfÜ׃Š~e¦£oººr1YìLc1±HûµÍ›2ŠÛROg¦Ê¹#+‰ØË|“Iº°—S{ÉíO–±acíEÇQ6¼º1ò#ç㜠Ơ¹ßo1ø¡ëY·Úºz¨â0yÒøLPÍb˜òRiÃjžÑ)$Aäý:¸WKvfÍy–«i!2â ÙÚm:²b£DŠÄDŽÕÛ±ì0³Æšæñ±•‰£%EWP4R¶­ARŒ$¾äÉ— ´ìtÕ©ïf\a:&ßâíeÞÊ5+¸íEÔC•ßùldèÌ>Gâ熺±ê–mü8/êöËcî9LÉàB£Z´3µ‡ÔxmÝΧøESZOï Ÿ[å@JèÈ(è_8ˆçèûÞ b/Û©Œ:‡i*–Ù¡°±È€/°àCDC¦qèÔˆÙšeá“{Fr²Ìïµd™2—§þ«ô¾›32 `õÇSÃz 1YâÖÚátU­Ýõ $…›Šö^IÿÈX“®³»\g¡ë<ÈV´5{aýMùËøì  )<¹ñm !FEbc)îŒ !‘÷JíͼF%0¯8¶ïáé0+sà=Ãj¡¨Ç‰•y1û.^ÈÝÑãë`|7EDÔ¸7Öó8>f[\åŠåV°MÀÎç»§½ŸÿF´/¢i#w7ŒFtaÌv„K³ýVïÔ9¢DؤƠn._2ƒh6ç@°JÛŒ"cXó“û¸µp æ%Òĸ d¼æ€(ÇÉôƒqöNDX‡i‚¬ÀŠHòHØØLj:Eáœe¶ñ*GŸ›ioL˜Ù1u^s‡®Dzn90ú~±ßG<å»ÇLW$ÎCU˜Èþ'YXÏ,7sô²EyÊÆ8j:tsk6y§|{Ò4‘4ö5L~˜¨¯ )³AZF‡€ctÈX+öF!tvÛž¬=ØÕŸ…ànTpz+·`šÈKõÂç„ÞëH‰Àç(j!)öv&ŸÎ¡ :q ˶A€óU§¯¦{t$}WñYA`YziÞdse‰uw%« º^0”{ ÇhÔÛöÇÆÕSBÜ 1ho'…/—ðÉž‘õ…øzrÈ9ñ>36É×`\Ä®Å÷Ç9´ÎW;6ìŒØ4RT6ömñmÉC ,Ð`ÓœGŽk\^åQJý6î­hDw'Rñ„¬ §ýÌVoV±‘ûsµÚ¦´°àA}$Í¥`Ðj,;ÇÈ)g j$]‘@:YÞ䯹Z<ºT<‹w‰+÷d~G$,ŸÚá?2ÒªrÛtº8Œ/4ŸAœ!%¬G]káe»óÓ¨Œײ"–ÊJ\ õV}2îèî¹áé'É?¢hÝœ³¯&nÔÜø gÓȰð—¾0,¨]U2Râ.Ý4àK7]É,׌gNjäûRâ ôSãDœ<½ÑøªP‡kï:Ä1 # Þ‹v•÷þ4ϳ‡ÆÜ®Éy‘Ê1…è]蛋 ÓVKŒSÉþ«ªG/FäË‹…\ Œ”Ò?–#NùÀîZKj4~: Â$æCªD6³$ÖcªQ©VâR«6®úEÌP« ‚ÀÖ›Ž9mì›Ô²°ÌÙRÖxÆ_Á®î¸jžÁ­Ÿza"ß¹èÃ\¢ÊÌߌW¡î’²~¸`Æ\ÃØÒ¶Y²/õzj$™©B£Ñ60›h™¡ŽjÉÍ㙲 ß½Ò ÌY»ŸÌôVBñ•ý;9'j¡÷ÚÕòuÎ=“´Gá¥|“{˜áì"ϴΤZF:Ò3‰óU Åkr¾¤4‡(šJf†–xñõÛKJ>í?ñÙ"P{ÚÙ<ì¥O¡.³úpž„E¹ñ$jÙªD/ÐÙ³Lß)–cÏ ŸiCˆQèƒX1dƒonºV;Ôe¥kqPÌ»×B4¤‰™O‘ã…†Ei±,OÌ6FØDd,9vË‚Es¥éÛ»ÓÈzEÓíÉpÏ:Ìw¢OZNe‰`re‰Gð—ç‘‹‰×ËJ£8!Îÿ–•.0›3p˜óù½AÛ³„Ó$˜ÖmìËv'A¿{.C RsaÛÔé+骒y%Åb{·€ú¼†…6¸àÎ!i|";Ùr[kÚyU}«Y{oËéÏ-€¿õ¦ÕlM65SÍèÄúú£ñœV¥¢»xصº©Ùê;"ÃY¢hQXa~ÍïÝ +|-Ê?ý#0êͲÙ>E)±6WÀÏФ†ä¤Y‘–ⲫW•°«^fÛ£¦¶5HL­1‚É/^f<×(Ñ»"ýôJJrâÇœÂ×2Í-¼Žîó(Q¥y ØÊÖ^@wf˜¿ ¤ö©ð‡¨‡Iúµ9ðÑWÖ¦´%”E1 ïäkí':kÅ%À·qŽMEd“æI´8ÿD‹/Þ!cús^¿}ýö'­c¼{ñÛÔÞÞ½7$œ§©ø¬¾#w?àBqšNó)}´I®?Ú$¦ÖƒäPVh”f^Cm—懧Xª¿•!3«eo¿\$}ü>”ÏsËfý\½„}‘jÓÿ:y$Ï´Üuöì@,ŸRŠp o‚öeŽÚ‡µò¢o£çèGþµ@t5ì٢ø¹k<3yП«J7ì?ö8!'ΓÍ/+§rQ#Ö¤%œ|=|4óÎjx£ûúö ºÂ6ö!/0压çn[õˆ#V­îRÆ:ªqeçºF~áÔJ&}ypŽÿ± úe=Ì×p>¢A ‹ ¶8Ù³wx ËéÑ)NJsµäApr³³¹eÒ7,ÖøYa «0+òxì…½ %Z”–[^ÿ¯òêŠ{‹sSZW–…˜âÜw’óÛ9\ó@<("6&äÖ"1™£Ùy ûC‹\_Þ ^è¬Ú›¹e§ìðyBÛ©9ju 3›JM]³%m^‘÷ëµ’ææ—7Àež›;Y:çÁ’Š+SÓ ”R>£üœHø„F5˜Ì¤$\ßÎ3y@Ô¹¦±¾Ý‚w³ú ¸^Q¶¿,ÁoÔþ1Ÿ&àÂû¯„ëüÓ Û’'TA4ÅÂHtªvÀãV§ŒÏÑŸ‰ ?Ø_!9+Î/5±>µaØyðEÏ>]ÅgU=­¯d.ìš'M©‹ÈNq"^6a8†¸B_Ì?Tˆ‹X3ðBì(¾ òõ$ %….Â剤ÜI*ËHóc!È«,‹ÈҚ̵¿üúªÜp¬¾ç'†‚MôšíˆËVŠ—a°{þé‘ÄÂÁù“¥þ°ƒ¾8¼„¼?ëOðîÚ+!y§”€R~?Cö ?hÔî3-›¶¶‹ŸbèÛî«üXnŸSõáMRE,§òïÓ8¹H'=Z<‹Ü}« ;/ÁÔ˜!gž8'@9¨¤ïsäµR;àBX«5Lu.Œw£Â$šg3‡®YÎef#H!9s½ÕÆüÜòp…endstream endobj 358 0 obj << /Type /Page /Contents 359 0 R /Resources 357 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 361 0 R >> endobj 360 0 obj << /D [358 0 R /XYZ 72 769.8898 null] >> endobj 357 0 obj << /Font << /F51 16 0 R >> /ProcSet [ /PDF /Text ] >> endobj 364 0 obj << /Length 3630 /Filter /FlateDecode >> stream xÚ•ZÝoÛFÏ_ä¥4ûø)’wO¾ÄM}—:Eâ¢8\ï–(‹%ª$ÇÿýÍoföƒ2e·0`’»³³³ó=³Š^‡ô½Îã×y‘\Iž¾^n_…:üõU¤oçqîƒüóöÕß~Ì¢×QxQ†eôúv=Ar»úop¹ßŸÇyPïVgQÐ|?;O’$¸ü»*adÉÙÿnÿõêêÖ›ÅÙE–&ÉKg²p/¬L.aHÇ‹a–F|¼k¢*Nâ`ÜÔxI‚e·=£ãÞá°;"›žÝî-ÍeIðˆ³tY±ÅÇag–)ªŠÏþ(àŸx > 2}E°Âflé¼Vý{”¤?5ÃØõod¤9&ôÛY¶ª¾!z¢@Qv}sŠwU vƒÎ£ä"Êœ»êX”Ì|¬ÚŠ˜†á-Äë®73ŒéÃ!ñ –yY°4ò OsÞ1hæÍ?0€j¾b Ã>4ƒâ>f"ÆÀÄL<ÞœÁ+†ÀîõjzêŸD\.ø+Hí°ñC«dFÁ=¿Ee1½¼9í qd¡'É,2’Äÿ”Š@3!l Á±µÒÌ„ ïí†Í’­axsqvžFyðŸ³"­"Pf€ha\Õm=BÞYTm«û1aFЖ°Õ„+À¯X¾r†‰ü/Þ0¦ó(»X™S´¸ˆŠ,c„ ¢u±ƒwŸ>~„Àßaåíõ§›/‚þý¨¶O¯ŸÞýúóÕÍíÆx„PÜŠ;tA̯ { ²«Ê¨¾*y,»¶U–‹EšáÝ@êÕ@K¨[ËSŒ„ž8"ÅÊœ÷BÜÔ½|A@n 6ÔubcDtotÜ*{5XaÓÞÆMøfä2n ÿA?6Ö BßÊHõ­É‘îÛjY›ÃÈF M’•è[ƒÇ¡je£êö˜©=ØZ¦Ž7ÕS%qv/XÇžx˜"2aNÉFƒ¹ã4ÉÌáI”IÊ® ö¿‡‘$%ì~¯ €qSò¢1ÏÐKÃóÃÊ÷2Û™…2!(°‹Ó0 À¡ž]€0ÐÇÃëÍÞÖ×ãcMØÄoHÝÊphk¥—éæ”eÎñ·Ë/ßXùû; =[±)à a›Œñf´ ®Ø·mäKF5Lìy…D£™ ã0ŒÄùxÄêü°gTǘø {Ä9ÓNÊÒ™6>ÅwlÝWê?y¼’Çà‚4# ÃÓÔó‚5 s+ Ãa‰©E‰Á'~j-¬èª1²qÎæê>*nÅœ_‘ÕáâÖ㜀­ùŸ'Qâl/‰ÒÙ#æRØ÷|LQJöØ‘—làƒ¹"n¦e¨’‡g;‘Šn_^ŒFØyp:SI,£Ùuì:ßÎõn% 71‘˜y{Nø¼lÏ)\}þ÷lÜ”@|Ij™Çœ)1›HÊmec"¦pBVÇñe[+ÄÚsO…ºF\Ý×þž¥äuƒI ûŠxЙ–n]òwØ2=Y ^‡½Y›ÈÙÊa«ûû¾¾'†¾Á*::ƘIØ#€û‘ph ükGc>Xæ9ÒÔ×AÏöM+VÅ FXšAàv¢=Øü‡ÉéäÙ6Ûf4*y-Ñ?[™ôà†Ò ôE&z\˜Å…9›OÏÊB‚>XŸÚëÈ(—¸QV>Âñ`B< $ñ“÷ÙÄŠWðúþë Ÿÿz:Q.‚ß6õNæ”q3Ç›ICZª*À¯»e{``=ÈT]3èƒ<ô­J‡ÆÇÒòã¢cêÀk¸;ݸ‚qîÛGAÍÁÏ®džä¥Z§.*ú4 ÒóøðXݨ Ó\M6-^8@³z'ßµÉò9“ÞÒ׺~‹FK‘s“YŠ6œRh_ý(¤ïb ÙT×tB+ÍUMG“ÓwÍ«M¿E Ñ9Ž^Ý“«1 ènNÖ⼜'}Øt­çT}É=—›š›Þ~¾¼ùòñÎêë®Á…›Ó &+z_ÙÅ þ ˜O~˜;/ä•ù¼¼ mLa•IÇs+¼ïVÍïa”šXåµW“í× Wù`qÉ<ÊÇÉR ËFŸêʵæ0gHùK!:ͼnY3Êd[ñù[õg嬅›t®ù@a’<ò2>skÇ&_z½5‘fKåvƒ/“†ná·Y„NIwC[Í÷%…ìk–˜'ið¤Ðjó$Yâ%9ƒ­ÉE¼T.:¤—ASv±„lþ ¼¤É“šÂ¤çIV"JÁà)@â+@âw‚$[R:^à€ˆX2J ¾Ý–³¾HKžR*QLMe!¡IÅQ8qXÕ »XzV+.JϬÐÑMëôi3ÍPzô;î È€s†ÓŠÙÐë¸<(Ý×úÄã2›«Ó•Ó½tàtµDw&eÞ"ëµÝNºlšWš,OYÌ ¯˜j ¨ÙG›ò`•Õ™³%zogºb§Ã%¶ƒ%ó¹Ü3Kž oÅHÛ"‹\g¿Á÷1C{ÃP3s’#%Þ²­š­ Lñl+f&¼ãÍÓëXBå ®\‚P°r'1zƒéîv®¤£Ú ô’?_X`ä–piš3q™Î÷ƒiÜvÈKgåxŸh/Œöê5H™z›tƒ®:–c,…î@é}3XÅ«š­Öq’\ÏVÄËÊæ½±&¸qÈa(†Õ=ßFº›™Ñ‘kï“•S\raSL¯ cJ¾ä‚¡ð.þDÝ€rsQÝiaÄ\ìQeoõV÷Ó[-¾Ê£°+Wp+½{3Â1³]/Dê}¥kô<¾y¶*JÒÔ‹«Çijüfá$HÒ8Hi4’y®âèù ܇r½­oi‚{qØå¶MõG_À{6½‰´zF«"·ƒŠ’¶%ŒRÈo–ܼæÑ^ V8ü¦w‡’bMô·k/UûBÃAýkõ\‚ZšõêóÏ´îúÆuLO&§îj!ʦ5XyzŸ4Â(ìp§½œ¦¢HeQ'msìÎÝú¶Fè¥ß7šF_-£âèåý‰; šª¿/m{T‡ªA®êïÎÜ›|ëáäŽà|NG!'‘Bf·š\âäž×Iʧ¿Âàm³<¸´‘–TãXo}j“bÒ2W÷z¡@ÏåÏi«­0ƒS£µ?1¸£1{+’(¯ Œ†X4ÛŸaA£…S3x÷_Ö¨´6}6>®:ŒÝ–Ü‚± (/rßתẽû°Æµ+0Ãrÿ&ñ®aNxПôúñiHÞê%ÂG˜{iDH ¯] ¤O¹S ‘Ã"Iµñ+Ô*<ÌM×`N\H%G]·e/_séð­YG·J‰<öœOõðm¥XŽzÕç/õ…¥NØp^.زBëÑ‚üXc©+)ÃI›á(+õ†å_´!Ü[žX¨[ß “¬t×…„ãà~ïÒÊ&bö™Sþª±ok©&Kw.F~/òxòv-áð¹j¶Ó ô¯EG¶’’¦ç‡Y£%¬ŒÀ1khišû»d!LR$ZöÛj§­5Œ•|§Ú£³µ@¦µ­9Qi•^ò §óµ¦SýÉ]ž³S¾ uj&‹õg‰V~|™¨fù@u×j.%!¼Ú©ÉrZߘk”t‹Ps.‰?Ú¥®ÖcÝOÚÏIµÝÉÍÚýÏõú~à ™Ç¾å-ÒyË[d^U¾^Ì"Ó 8²¼g„½Œž¨ÎO$„!¶.Z4g] ï2Äi‡,ZÃÞjñܭȼ¹¤” ?Q–Pƒ»i9E÷ª*€qI•F#£#?ˆ)£Ø*lï~ÑC¾Á´Û1#qÜõ—Xÿc©Ï¥Ã\èÅ‘Ù=d»íŸí*ŽÍ¶–ŸÞ¸_æ%å^þ¥ƒü&HµÞè/…”-K2¿ù™žy&/ý_…ÓÚðüS€º_½Ñ‡¹i߀‘5+œýÑP5ê/‘ælæàÖ‘OôÄÆcW˜£©±w~{Ò¶b­ÁvòLB÷[Ï`)o]Ÿ¹FÞds÷ÓÃöýxÚëLª² óKÖÿáÿJendstream endobj 363 0 obj << /Type /Page /Contents 364 0 R /Resources 362 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 361 0 R >> endobj 365 0 obj << /D [363 0 R /XYZ 72 769.8898 null] >> endobj 362 0 obj << /Font << /F51 16 0 R >> /ProcSet [ /PDF /Text ] >> endobj 368 0 obj << /Length 2819 /Filter /FlateDecode >> stream xÚYÝoÛÈÏ_aä¥)\~Iº7Ÿ›\]$> rz(š>¬$Ú"B‘*Iâûë;¿™Ù%%ѹ€¹;3»;;ß³27!ý™›yt3_ijE™ÆqÜþ$ß_¾`'‹$hò\f­iÍ"Ø÷y5¡Ag»¢®dɧ‚öÙL¦†¶l‰Þ,³0 ÒdòŸÇ¿¿ùðè™M£t–&qügwòtv³e<Ë®e³0M _ïq²ˆƒ¼Ù±HŒË$M‚ú ß8xûõ±‘YS<ïø>DÙ”G²hp•@éº]ÑÊ>|Ã`#×j+¢É_Õ :f‚ö±].;w;ÙزØðF•lt}êù<؆P]Ap’#Ifjâ™IÃ9ßò´£S㥠°¥Å ~Ç?hkã^Î(·2MÕèž±­lT7‚öQø6õ^&*<™\ ËEP@ººál2ÍÌ<¸Ò^ ÏGëÝæƒ»™`-Æ+æv.šŒEÓ©òqß$Ì[é@4Cƒƒ(¬ÙÛJ­¹|L“UÛaí;Dé•$!6Þe.ŠÂþ2ÝHi«—sd ɉÒmtIYž“yËAk÷ù˜Ê÷lG*([Šï Œn Yã–?Ãú½äÐ+ÚJ¹Å¤é@öDÜÕ‚:¶ºº€‹Ì˜±idf&^.ˆ¿ ƒ”ù#Ç$ýfaðñËã—|åô5Á?ïÁ÷ŠF÷¿>¬ñëGù>þí^!Ÿîï><¬>ð £<î !“ºÐäKì]?u¸À cUoJãÚ0V‹KˆçfoÆhÍ×ô¯,Ú€*§ü¬!&kÈ/ÄÿaR&Qñ6-mÙÊÖ(a:Ç,Ô× vu:¦êË(›†)Ü©±DØ;f *ö †âBø½ó»e³Žì»’*?ÉÀY mˆ«ˆÃb³SK‰w;LØ‹}Q’œ™¹¢Rħ6d+ÂC=ê > R”óÖj°ˆ–ì`i4ÂÔ°ˆ‚õQ½ˆö ^d íkhâ>tG8ªŸw¶(e 9ák±hÛ³Ñ c,àMÍV‘ï5XXëÞK+ŸÿìHæ‹0 Vy~™]ÖÊL2[Ì‘,H‰°ƒ,èȦC:I‚ÑXôdñ®ë?½:fÏÕqV7Ïï)>½”ùS÷þ’Ÿ(gË,2 ]¥eO7ÂÑYZ¾Þ,iè0Y8‹3³zÀŽˆB:ðqÙ•]óÈÞE¦7ÈGÍDônâ€#Þ“KûÊûü\Låè½S<}, ´š¨6NdÚ ‡ú…/²ˆõ‹·ÂÇÕ ›#{f<_*³{ü_kÚãB€¨Ï.ZÞºÐs.«;À¾š8©õ€>‘ÐÊÒ•;RúÚ‰ß*ˇÛñú†½3 )ëÀ糬O^€^Š˜iPúÂÓ'ù"^ÖeYs’ »UŒÕC+C N·B²©¥Rî|hE^ÐÍàˆ˜× Ä«®`mÇâ “ÿо£Å’ƒK´”]1÷Ƥ$ñ62s·‡·lÄãVÆjy%Ó³¬ÃÀâ¯ar±Ä§ëB+H¢±O[cjܦ=ƒN €sê唇٪~â¸}‘¤G´Ï©²>²Ø­Š+M2)3uþ8›;“ajXe‹¾8"KKû q/ðö"H+Ÿ1ýþÿgÖØˆ®w#:üªIB2‹çé *£¥´*‘ËbW¹X-µY4,æ¢ ·Ž5¯)T p¿v*Ä«Ûê¶ò¹R9€k¢Q]pØ3F#ú’‘záb®I›ÁoQolœÈàªE=‹Ã©ÔéZÁ¨S¾>”ѱðû‹L7¶’ÁV-aëjǘڬÂ'&šâ>ÇÂk”ಌµŒzíxÝ ÜŸí¬h¬l¹‰ãlóiÂ¥“Þä/­ÂzwÞÄç8 Ë^«¹Rqk7bž‡Îö͉L/,,k¨Ô›ˆÚrµ¶«¹ÉøÃµºÀ8Ó«µý¸²xÏ•S,F?(€~â\Å+&&¸~Ñè%òÃþÆhÃ=Í'Îðw>¬î~y½mA²ül[Ï•oÉæYðú*¹±GæNÒjÜQª‚Ö$^ׄ„M‚UÑåo…ž+‹9êó Vœ³ò·ê³‘›Z5B@úÀA“ߨ-›r+›ýæAqq¯G«¼0QæTƒ‘XdyV]¹gàÝk³aÎÞcìºDæÈ„Èà›®áŽže[ Å›!~)¶G¿ËCŒS4 `àÏVœ¾” Ÿ·²›ŒœåXSM°£n_^+Zbræ|‹(6lö£ È!î0h’xÜ öÂqA_|+dÔ{½‰^燱O”é‘0á$kùÝî¥*WC¸m]aª^Ç@+kÄñœ–=ó#®ûª½gËà3v/»ÂÇIŽ0v+!°n\þVpÞ¾1fû&ô6w–M*Ѥ_îõ¼•$\TB¡õÂB£C§·'ž¤ ·•&êÞ%qÞÉ„Ä4–“Õx‡o(v]öFO€oîmeç*¼ê$[I˜.i¢M8n°ŸP/”ϓⱔ]‚ïúl«â¾cxÅ!î«MÝ|¸áLJýÉEzÄcv-ß‹·A€8$Q»ã½åÚ‡oå㪠ßúrŒ2Œ%RéiW—ùù!ÅÆÔ¸VŸÉ*$ã†eQÛO¹B?bgTl·è©wcÜ_ˆÔ[Sñ\ÈsЦ»º&Ÿ§Þû­î0áGv=¨•µåUË„´?§ÈÉC®ÛúBkFÛ,i¢uq¡Zµ}ŒÏC´ljGŸdz×i4¯#Xøª³»ÊæÚb°ç:¶±¹þ 0÷ËÁ‰”¦GÕòâÐ×ÕÈ^¢¡w.ão/RûZ¤òßã Zò #~ÙDZëØ+Dì“å(¦ E8¥;”>M ²¨\W €ž{Lú¾2Ð;«ÇUµ|…³á_܃³þòï]{Å S¦Ô’4…u-H¿éµïÆýG31XŠ\¬…©èg,¯ÿ?òƒ;JÒð]ŠÈ< n7öÚ@Ôæ|£0\Œº.ÿl¼‹Éb y|T¨/~áR,‰¾Ò<Ð`å+$Z8|•`l“»gø»Ë}¤HÃêWj³PÃZØ?Úç”N·!R®Pî¦TËŒ©iu+EŸ¼Ô ‰©U]ÑéÈêsXƒ>ÿÈo)@¤-Lá·¸ýó±ÕÕ¬êæHK}Õé›sêGòíàAH·ð\6÷oDûè €FÏ‘›J,={Rà’áyæž÷ÿ ùÿBendstream endobj 367 0 obj << /Type /Page /Contents 368 0 R /Resources 366 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 361 0 R /Annots [ 370 0 R ] >> endobj 370 0 obj << /Type /Annot /Border [0 0 0] /Rect [93.6002 612.4469 253.9621 622.4468] /Subtype /Link /A << /S /URI /URI (http://www.gnu.org/copyleft/) >> >> endobj 369 0 obj << /D [367 0 R /XYZ 72 769.8898 null] >> endobj 366 0 obj << /Font << /F51 16 0 R /F52 23 0 R >> /ProcSet [ /PDF /Text ] >> endobj 373 0 obj << /Length 1477 /Filter /FlateDecode >> stream xÚ•WYoÛF~÷¯úˆ6܃Wú”Øqš" DéKS ´HYÛP\‡mýûÎìì’Ôa¤…s¯™ýfæ›Ù_DðÇ©X¤™d™LÕb½»ŠÜò+îFK8±œy»ºzuóXå|±Ú)Y•oöûp)Ò jÊú)\J)ƒ7¯éûþÓW¨à6ÌTÐVÍn ÈdÁzØUMƒ¾èµiHä£=ëpÉAeçyžD"ˆãðïÕïWïV#ØXÄ,VRþ̦ñܹe` WLªDxËD¢Xq²ìææÂøxn¾þ¥IðÌL(yðHóÞÐw@¬2ƒ~«Qª£ÙG½&3p²1¸ÓÒä€JÌÐ’x‰j8z„,Ç;C›O-À%Œ‹LX”«0“ºSFÁÚ{Ažæ¥£ÂÀæä„nè[Ч´ÆùЀȃžv*3Ðd G‹ÿ€«NÝc«û¾j^Â,¶Ê]$kDVVGwÙ ³GýZ1;tùpÍ‚FX[§Hì1¼Éû™….´>“ŒÇQj}VWk"Ø=‘Î_‰äܘ&µAñGÔ„š{:8GÝêû­sÊhnIÇê þÆõÆô°Ó‘À?c¼ŠbÓ "É ®^÷õ4Û÷Õkâ‡ä‹ŒåI¢2c‚ƒÑ`¥òÄ|mö-Üé|‹âèþqǯl&ŸF,‰r.CÁCUΓ$8X®¢xS7ÎoN9KTê%™uü’+ÁDœd0Š˜J\>WíNwÍyÔˆ4Åï}[4}UÒ3 ¿kÿ’†¥îúVß }Esä+ãPíL©7'ºõKc‹ÌD‹"³(†¦¬Z/à4ö€Ì‰"öl1ÃÁ­-d8ºqê]ýÂ%—ññŸU;™É™¼„Ã[P4~]ôØÃ\~?ÜÕºÛzÝNN¸¾˜MÿX´~Ý€©⯗îÔ@3Ьsù‡æ¡h5ÄÂi«Ö(ܽ<>uÛš¦_^›vU=õþͱùé·Åú‡;|„aEP ¨¼™ÿL(j_VçìÑͺJïÝœÈtdM fNþì÷ïÛ ®ù/‘~ñ‚]ªÓP™˜H#xQy¸Ìc«ðXù5ÕRœl œùBšð€…å!ŒÁ‘-¾«…«fö<ăªlPX’4Ã'V[’–xàÚLz[µÏ…­0O=U¼Î ·!HXÓ1PsH¶Mâe¼³­öu±v ÑÓ.éY®d~\t¿q©ˆiIÕa)”˜}¸à°ñ€ý.•Rðfª}¤f¬º»TUÊ‘¥¾Æ'Tiñ ×]ŠU*ÿy•äIÄ"•¹ZIÙZµ/)ȯî° DÁj'ëÒųΠöS!މ8ËñKI÷´’³,¯´pÏqñŒe"?Á5¦ñÏÍ2z†„Ã3¡:6â9|Þ,%³ÿïrÊ¥9Kã4=O9 ôSN qÞ¾à⇆H'uøêY‡»_üÛì ‚‹Ö-ØÇ¹C')‡Kóœ‘BÙrëÙùÎfÆ?õôö ×õÀPugÙï›dØ3Î& ï·­‡§gÊBuœ„;wî}W±5Rǃ^rM=õ#YæÛûBv¾ñÒc;UÍvt?Œè¹k Fp6Pj ”RSŸi= ³¶tlñ|wjÃ‡ÖÆý”°íZG‹[´5ôA5,ËÜ™b·ÇF¯rí:ž7n´æÅŠ.A8Aé=ÑTÐ="‰*’j+³ÝØü•~§®ŠnÖL>¡‰6,j¶wh_8©2 ¶h‹º®jZìÍ–*?v'.¬qakl‹ŠsK&ÛÐï3Xé }pdHérç}-’:ìû±%……Jt€ý„÷USâKÍùgÔr‡¶ê5ÑìãÅK‘fŽ{ì)'þi×AG¸"ÿÓÖfü=:³P·ó?6ÿÉ&Øendstream endobj 372 0 obj << /Type /Page /Contents 373 0 R /Resources 371 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 361 0 R >> endobj 374 0 obj << /D [372 0 R /XYZ 72 769.8898 null] >> endobj 371 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F31 377 0 R /F58 189 0 R >> /ProcSet [ /PDF /Text ] >> endobj 380 0 obj << /Length 2246 /Filter /FlateDecode >> stream xÚí[ËrGÝû+´”«¢N¿Ë`Ç@ŠWaŠEȱe£BÖ¸ô€ð÷éžžÇÕÌôm'`l 4òѽš>gνýQÿ +ˆFŽ.nhõö§V½šxÄBžüz¢ØˆQâ¨c£³«­ g—Ž_..Ùxz8aãÿ:ûc$%'ZHî#†¿+Þ=øý¬É¢¸"J ‘û2 ®ÿ•ü—`†p¦dý•¸&TIV¥iù]"P!5@:šC„r®Äý1|d‰ÓZVgJUˆ‹CîÆŸÅ!·ã/óò./¯ýýÞ„WÓEx{í/W1’° ”‘„ WñxÃÿxò|ü>i;´r+‰‘^,Úß¹V¶¼tÊ?ZÜKZ!ýpay?«ó„r»•u@L ®Ÿu[#þJKAœµeÂgièØÌæ¥,$À91ŒÉG¬ÿôã=j)aá©×ÜùÇŸ'õTÁ&7 §N°ÀSi9µ±p5uröÅDáÆEg:Ê:ÎÑyð”ÏÁvJ·9OÙ‹ðöb´Ùk+ïKóÊÂø:‚À´Ti’J‚ÑP)¡i½’”Ñ¡F_:*ÊtsîËïDH1žÏÂõb®ø¸¸]ÏŠÅ*þéªXÆ‹ËÕ´4«éÅz@RÌûã’}M%Iªo2K"$Á1"Mˆ†“„¥ $iå/¥¼IáÙß”¼œ} L 2åïOšïùô' «o8K"„ÁñcÈS¢á„aiaJaƒ„ÝÆ’>¶]' ÛÛîîOt=ÀY "ÈRÀa4\ XÚ )‰¥ÊT¹ õùk|ޝãs|T,.Ë7B­._„§º¯ˉÐüq•ìÔ$ µÜ$Ó“€-Xšt '½›µ×·)É•ŠFtœ›—´Ÿ{þ¯ÅjK «¨’TQ_€Kc™ûì¯Ù€HœŸj ûÓΓ.@)¡ÎíP&q•«ë .,­—ƒôHÅ)»ÛÁ*67ÑÊJ>1fœæ]:ñØho†-G;¦ißbé`4”ö^ÚžHe‰/øñ1?ÉÎßNŽ_ -0ÂŒ´û®á~ Ò»¶`HQiÔ€ˆšjT9ƒsi5h¸š°´AKB#t\Ê:‰Mæº^=]éFyeÙ½n¾urÒ xV0ˆò'dZ0 .,m ¡Å¨¬åÐêq±¼©kÏ:΋«XqÖ§ñåôöÐçðÐõ`jC¡S?¹¦’Œ×#–eÆ!,ÝxÂh8ãÝ´½‚#'šêXpžçÏç¯ßEú‡ 7$&Ä~ºŠIF_áÍWLK¦Aeª Œ†JM£ ±†‰Ž­òVPyÂqQZÂÅæ¦Ú´* $ÎUý«ED½Š-ìt±Zú`«åXsjî8Ë"ŒÁÄÑpư´1ewÌm3ö<î)N—çóHÇixcó÷|v±EOÝ0$XbÖ÷šsþ˜Z,hÆ#·XéÅ‚­áM{6 †Ó‰e tJM ã*ÒY²–˜(.ö»wûxR3õ g5€ˆf ‡ˆf@0\3ݬý:Tåbx‘«ó/а-ð%ÁºˆŽ±YM›=ƒÎJÃÀyG´áR~IPI(ùEHD4R£Êö?­ ×H7kO#ܨPúãöÕËìâÃËÅj}>Ÿy&:ìZí½çÛ:®™/2?­€ÀtÇÑ 2›0*%4­ ÞiU#íç~ÚI^‰%8Êçàŧ೸Ÿ‘Ý&64œjáOçd“bšî{ªfü†UÐà&Ø££nx»9ÿ£¡çäд­ ü|‚sUA܇FkŠvÄ1ù$¥PbV ˆHrÒ_Øn¥¢áRè¦Ý®-­¤Çi›ŒWÃFÇM¬zø Q„½+%öUænUFñrÜôH Ïà©*Óà&ØU/Ü`OÛj Ã5ÕÍšÒõªÖ2jêuVS¡ÜU…MÑvól×)–qáârs6׫Ï"Õl]¡ñípbsùo®´ùÊLù‡rœH‘\§lýÓþÑ ÊR’æFC¹FÓ6L+Ëü›6¦}]”{«á} ¡½"÷Æp7chè­Ç9«DÔi“éj£ájé¦M8ƒRaÆS­¾É:Û[°DYî³ÿŸô‹âføP(½#À›“õšÙ:é –eÕ[×ly‘”P#ò,·8„ä ”i.A,œb$gË/wDSuoòNØ1Ÿ`\?þªÛÏò×âþÀX"!ˆ…ó‡älùc.LP#›õí¦*ÈWõ¶ãzët‹Û$~Ác†¨$¹ÕØdÉmq¹` R®ÛX8¹HΖ\ÿBW-›rÆ7]~.§|¥G~jèo¬Û×íì¼°î¹ëAÎuð—nà!cˆƒ·¡p‘tR&j´´”˜ºFŸfkôé2þ*ηÞL.¦—Ñ bñ]7=ûâzµ}Za—kÆ9Ô=”%ë”1H­‰1‚eÓÖР2Æ£¡¼£i[Ú•Ï_•›ÓÍ2!qãb5ØÎ‡ŽÉî7²vw…zps®piW€L¥]„ÂÕÑI™rîa¢:pû6ë o¿.ŠÛÒf«¶µÛZXf©^ÁxuÑG6YLzóÓlÆò]"ÞQ£2M?Œ†«KÛŠƒúéŸ(õ½_5!ÝbX» ;£OBõØe€ˆ XõÑptÓ& BF¤©~Y–5ˆ³ç‹r¿a°¾0Ï?çûóëÈáÀŠ ˜«7˜.8 jðøT`0TRhÖVPÒj«Ý±³pš-.óÕðOí•Üo=ÜwYºôœA`Ú¶8D–¥a4\:Ý´)7 bV‹x—u£w«óëj *,W]uNÕ »ŸOáLEÒf¨"ÌÚl›©Qxc ƒáZéfMh%²áœÇíª÷Y­¼VŽÏ.ÍÔvxåDïÜìÒeÎÖ´žƒré‡Ëln Ÿ­ùî „endstream endobj 379 0 obj << /Type /Page /Contents 380 0 R /Resources 378 0 R /MediaBox [0 0 595.2756 841.8898] /Parent 361 0 R /Annots [ 387 0 R 388 0 R 389 0 R 390 0 R 391 0 R 392 0 R 393 0 R 394 0 R 395 0 R 396 0 R 397 0 R 398 0 R 399 0 R 400 0 R 401 0 R 402 0 R 403 0 R 404 0 R 405 0 R 406 0 R 407 0 R 408 0 R 409 0 R 410 0 R 411 0 R 412 0 R 413 0 R 414 0 R 415 0 R 416 0 R 417 0 R 418 0 R 419 0 R 420 0 R 421 0 R ] >> endobj 387 0 obj << /Type /Annot /Border [0 0 0] /Rect [284.7451 672.7948 289.3528 680.7649] /Subtype /Link /A << /S /GoTo /D (2) >> >> endobj 388 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 629.832 289.3528 636.0586] /Subtype /Link /A << /S /GoTo /D (15) >> >> endobj 389 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 587.1232 289.3528 593.2502] /Subtype /Link /A << /S /GoTo /D (47) >> >> endobj 390 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 574.8003 289.3528 582.7705] /Subtype /Link /A << /S /GoTo /D (33) >> >> endobj 391 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 564.221 289.3528 572.1911] /Subtype /Link /A << /S /GoTo /D (17) >> >> endobj 392 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 553.6416 289.3528 561.6117] /Subtype /Link /A << /S /GoTo /D (15) >> >> endobj 393 0 obj << /Type /Annot /Border [0 0 0] /Rect [284.7451 543.0622 289.3528 551.0323] /Subtype /Link /A << /S /GoTo /D (1) >> >> endobj 394 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 497.8578 289.3528 506.8242] /Subtype /Link /A << /S /GoTo /D (33) >> >> endobj 395 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 487.2785 289.3528 496.2448] /Subtype /Link /A << /S /GoTo /D (17) >> >> endobj 396 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 444.3157 289.3528 450.4427] /Subtype /Link /A << /S /GoTo /D (49) >> >> endobj 397 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 433.7363 289.3528 439.9629] /Subtype /Link /A << /S /GoTo /D (34) >> >> endobj 398 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 421.4135 289.3528 429.3836] /Subtype /Link /A << /S /GoTo /D (11) >> >> endobj 399 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 378.4507 289.3528 384.5777] /Subtype /Link /A << /S /GoTo /D (49) >> >> endobj 400 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 367.8713 289.3528 373.9983] /Subtype /Link /A << /S /GoTo /D (49) >> >> endobj 401 0 obj << /Type /Annot /Border [0 0 0] /Rect [284.7451 357.2919 289.3528 363.5186] /Subtype /Link /A << /S /GoTo /D (1) >> >> endobj 402 0 obj << /Type /Annot /Border [0 0 0] /Rect [284.7451 346.7125 289.3528 352.8395] /Subtype /Link /A << /S /GoTo /D (1) >> >> endobj 403 0 obj << /Type /Annot /Border [0 0 0] /Rect [284.7451 304.0037 289.3528 310.2304] /Subtype /Link /A << /S /GoTo /D (3) >> >> endobj 404 0 obj << /Type /Annot /Border [0 0 0] /Rect [280.1374 261.2949 289.3528 267.5215] /Subtype /Link /A << /S /GoTo /D (15) >> >> endobj 405 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 686.9508 525.5433 694.9209] /Subtype /Link /A << /S /GoTo /D (33) >> >> endobj 406 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 676.4828 525.5433 684.4529] /Subtype /Link /A << /S /GoTo /D (17) >> >> endobj 407 0 obj << /Type /Annot /Border [0 0 0] /Rect [520.9356 634.3329 525.5433 640.4599] /Subtype /Link /A << /S /GoTo /D (1) >> >> endobj 408 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 590.1954 525.5433 599.1617] /Subtype /Link /A << /S /GoTo /D (31) >> >> endobj 409 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 581.9689 525.5433 588.0959] /Subtype /Link /A << /S /GoTo /D (47) >> >> endobj 410 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 537.8314 525.5433 546.7978] /Subtype /Link /A << /S /GoTo /D (33) >> >> endobj 411 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 527.3634 525.5433 536.3298] /Subtype /Link /A << /S /GoTo /D (17) >> >> endobj 412 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 516.8954 525.5433 525.8618] /Subtype /Link /A << /S /GoTo /D (11) >> >> endobj 413 0 obj << /Type /Annot /Border [0 0 0] /Rect [520.9356 508.669 525.5433 514.796] /Subtype /Link /A << /S /GoTo /D (3) >> >> endobj 414 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 465.0296 525.5433 472.9997] /Subtype /Link /A << /S /GoTo /D (17) >> >> endobj 415 0 obj << /Type /Annot /Border [0 0 0] /Rect [520.9356 454.5616 525.5433 462.432] /Subtype /Link /A << /S /GoTo /D (3) >> >> endobj 416 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 410.1701 525.5433 419.1365] /Subtype /Link /A << /S /GoTo /D (33) >> >> endobj 417 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 399.7021 525.5433 408.6685] /Subtype /Link /A << /S /GoTo /D (17) >> >> endobj 418 0 obj << /Type /Annot /Border [0 0 0] /Rect [520.9356 357.5522 525.5433 363.7788] /Subtype /Link /A << /S /GoTo /D (2) >> >> endobj 419 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 347.0842 525.5433 353.3108] /Subtype /Link /A << /S /GoTo /D (31) >> >> endobj 420 0 obj << /Type /Annot /Border [0 0 0] /Rect [520.9356 303.4448 525.5433 311.4149] /Subtype /Link /A << /S /GoTo /D (3) >> >> endobj 421 0 obj << /Type /Annot /Border [0 0 0] /Rect [516.3279 259.5514 525.5433 267.4219] /Subtype /Link /A << /S /GoTo /D (47) >> >> endobj 57 0 obj << /D [379 0 R /XYZ 72 769.8898 null] >> endobj 102 0 obj << /D [379 0 R /XYZ 72 769.8898 null] >> endobj 378 0 obj << /Font << /F51 16 0 R /F72 6 0 R /F2 383 0 R /F38 386 0 R >> /ProcSet [ /PDF /Text ] >> endobj 385 0 obj << /Length1 746 /Length2 987 /Length3 532 /Length 1531 /Filter /FlateDecode >> stream xÚí’iTW†«‚èXÀâEÅ‚B’ \0‚ ÊEA‡ÌM˜dÒa‚IW‚ –ºBQ "ÊâB+Z@@PpÁ£¨EªÂQ­h-(ʦ"h¬ÇSüÙþêéÜ?ó}ß{ßûÌ{ÇÊÒWb'Æ©P¸€R2v(u®^Nåð++Wb A)Ý0:ÔÉ bµ Ž€:óy"Ä ¸R*-MÈ×0ÀÚÕ¦W$b¤ )¦^³*X)F %% £å1IÿÞÀF@:âENH å„áöy(e½oãjÕ‡Q$¤#X(`ÍBÚ§”¤àP†p½)ö,È’üPýͨIÒSôÚ÷†ôÉS¤ö/¥P©H/ ‡´²¿4¾gó‚8¡VôŸz0IHÅJ9 *àðïûDÄBq_‚‘®2ŒŒ€}}¨Äû“°áõqp=ú¹ºÍx©}3_ŒP2Z¼â¾ýX³Ñ„¬àqx<”²ëÃ[p¿³æ+¥N(å€/tMcZ„ÇZñ…B…B‰C €˜ËQR »°ÁDE#½w*p\{1ÞÛG>ýŽyó(M”½Øñ…¬1*p"!/úoB©š¦¡’éûQØ4>Ô2‚ B ”"µ·)é̘°¤üØœõó3n5´‰˜˜œs­Tw:y&§éÁÌÑ5tÁhÑj¬3#ŽJ|ºø— ëMóÅë.GI¸º»Æ—‡›Ø¤ï—µH›V† ¬L»T>Rñýöǵ“ª f´ÔMéÐG–þàù2}gsçvOÛúð UõµÃ¾Ã§4&"ÁiÅžûàÒßõ;¯v5/¤2¨Ú#•ãWîïó¶Ö´ü~uø½áÉNñi^ƒ~IžÝ=”g£‘5T!èðIµËRÜßÒG½uåìá–ÆÎ¸'ý‰? ¿~Tý²¼º%&Ñ{á©Tùè¦íC2¦…¬:6wéúXrª»‰[šE²ó±y¶._è³/ëbZM7Ô”edç¦î›EÖÈmGvXˆ+rL™³ç2_½gÈxKül‰~òêýLYVgòêÌÅi{Óº§od–é´¤ølCÏ›kîó»L‹ógÃg:~Àn¦¨Ißê“9hJ°ùoëŸÜ×FÔ©Ëï—lMçrt\Ãö Ò}ƒÏXš.QÏqÓÀ[³Z>‹ØU- 3]›xlôé~êòGH^E#§aQšzªEúç»’<ëBšbFÖx)xàË*θWX’}uSŠ‘`ã›$ÛsÖÕ:Óo¹]7—¶¿i­œÖ>ºA9ÌðfdÒ¥âÖÇ_*q’+ŠöŽ˜(Ø,o¼Ž*ýUâg:÷…AÂø`!ñòfµÎœò\ÕD&¼½gÞÁ•ÿT¼óüÙ`N™º>·tsž¡Q[yÜ F¾iÀ7Þy6 >¶_é’5§Ôõ¹Iq`Ð ?ÒÀ(/uœDä'l.ðº2†~Ne·ˆ*ÌÚºÜs!šp”lA$kåéÔIŽ0®‚˜"™jÿâ r ®Lp·¶ÏO’ωYGŒÒ>~q¯ð¶Y­ñ€;…sÀNûhÿ gW~{êJgæ£\¾mÏÅlûG>-÷z0©á¦êɯ²HNN­ [—r¾³¼»jÜ“•—M;ÜÜU¶ªp–8kŒ…ÔÝWÜѽû’ÝMí5xµ{Ïíã§í«† ¼à2‚¹t!2lJf®hÛ[2wsCºAQs|˃·>6ÜÐÕ\ÇØÎ×Å–eȉ=þR“’âå_ÍjU¶þÍÌŒ%…;¶G§¨*Åļ=îj }W¬Úrù6«c“·,ÐLÖôlr~—”iÒA¨×¯rr>纄›{Ò»Ttm½Qï€_°.»X¹W–à«õýlÅÝò’ìä“ÎØz‡kͮжñ›â:~|åWXðLÄ9k>ôœQU»Ëæ›B7jÍôáYíÆ¶u¥>»9Ç» +ã;|ó‡>æýÃùßà?a %!F3”£Ã‘?îÇKhendstream endobj 386 0 obj << /Type /Font /Subtype /Type1 /Encoding 422 0 R /FirstChar 46 /LastChar 46 /Widths 423 0 R /BaseFont /WLGQCD+CMTI9 /FontDescriptor 384 0 R >> endobj 384 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /WLGQCD+CMTI9 /ItalicAngle -14.04 /StemV 70 /XHeight 431 /FontBBox [-35 -250 1148 750] /Flags 4 /CharSet (/period) /FontFile 385 0 R >> endobj 423 0 obj [315 ] endobj 422 0 obj << /Type /Encoding /Differences [ 0 /.notdef 46/period 47/.notdef] >> endobj 382 0 obj << /Length1 1482 /Length2 8980 /Length3 532 /Length 9850 /Filter /FlateDecode >> stream xÚí”UXÛ¶¨ î.ÁÁ¥q îwî »Kîwww‚[‚‚ ¸ ÎíµöÙ+¹û<Þût¾ÓõÒÿ˜£ÆøkÌYEO£ªÁ&a1³”…8º²ÙB)euAž^ jiêj q”6uµ 7k'È'Ä-(Ä+ˆN‚8yAm­m\ŒRL%ñ$,¡¶æ¦ŽeSWKX sS0@bnkéêŃêÝáP·t±„º[Z°£ [sW€™¥µ­#:Ç_> ŽVÿ¿ÂnNÿ^r·„ºÀ¤Œ0I&LÑâöXXZ¡s€ °^–0“ÿRÿY\Ö ™:üU6£ÿ¶jê` öú¯uˆƒ“›«%  ±°„:þgªŽå¿Ô”--lÝþsUÁÕlk.áh ¶pþ+dë"këii¡jëjn°2»Xþ·t´øO ØØþVàPV“WÕWbù{7ÿ^R5µutÕôrú§è_¹3ð7Ãfµõp²sra‰°ëßÿŒþ£•Œ£9ÄÂÖvxù¦P¨©:ì\ÀˆàØ:ZXz,=a¾ìŽWØ-ØHüV(ú_› Ûo«¿cÿB.Úþƒ<œ'S¨¥#ØÒÊõwø_Ñmí?a‡9ÄÁÁôwDÀq´ü‡yaå\= ¿VÈÕjùGÆ_ý!nÐßî¿„ÜÿÈàp¸Xº[:þŽð8mÿhÃK‘øM|ÉßK–úM鈦'û›`rr¿ &&ÿ›`V ¿ Öáõo‚Õý&ØTþ!XÕß«¢ñ›`ãÓüM°gÐúM0köqü² ¬ŸÙo‚õ3ÿ½œ°† ì™,ÿÀ¿¦ýÂ|¬ÿ@˜Í3²ýaö ÌüÂ4~#¦áøÂ4  LÃé„õ…þmø¶ëÓpûaî LÃãà ëëõ7þ÷×URâéÃÆ-`ã‚SØ,øü¼œ~ÿW¢¹vê]ÿþÂ^ú³•-ìaiéii޾81µKi /õ—Éÿ\†ÄüLÒº9Tß3Ó‰²÷ \4ªä̼Z§{[žN€½ƒ´CíqOîò®ÃWmBö$È96uîqÇÝd'Ý»•\÷gº²×¶í¯œö¦Ù‹CÞg*Ó«c¥‰zOrU¥5 ,ÓÀõ¸7ôf„òñëʦƒµ"Âê^rÓ¨ã¦:—FòD¬xà&Æ#®L…øÛE ¶°,A:ÜðoóQs Åà™wPs«o2ªÿ;,)ˆÀÅ©}ú4\-ž°Ö€v¾¡ª*„d„Wô&“1þrJ2)©ì~ÂÚÚ¡Kó@Ïg´Z´eÌÍblS ¸PÈyŸ©lòšÒm{˜Ù¦|˜!l%3Ñ"úÊt øDôBå}õ‘Ï€°¡ÃaFý”ö]15 ½Ú…õ9Íê"¤ú¦?Î:žrUÏâfem}ÚÆÆ­Åxø9°Tâ'öÀD,":»V¶¥0vF3 ·žþú¾IÂM8¿w22Æsn#ýDv±Ä#åœ"WׄV‰ÍŠ9^º”Ó5ëØadF_1ݘ8ѽb)ú®Ë>á*kéVôåiùÑCºE»˜² ;E:É[Ú˜ b:t§~Á‘ dwxæzrÃLÝô=4%´H€Z¥,¯3VÂî žÈG.4¡•ªˆ²$VôU ¬Vᮎ ®‚9-“FÚè;IÍBSY½€íp°©hQã¡¶œ½6Ïsª±SáÇ%S¯ýIanˆ€ÒÚG§ªN=ÖS4üï5K—~ÅoØ’lÈKÅ&6þ0@xÞ® &©HÑgœÓŠ?¶ L«üÈ*ªÃÏàDžÿLlÕoê“D8F—€A™ÒëIýà7õt lTŽs÷Ex]ÀtªPÖfGʤ5Ñ*gQUöôÞŠ´>›7Ž A†àÄ¢·ˆ‰~ýup´„IŸ‡Çð!íIÅü¾ñßE Ö—ä+GËÔ”ÊOóû¹cÚû€·”™Ö˜o: ’‹Gñ(ô GjUØÊ§ß½)ßó®Hþ2«q¡ÙõбiÓ§Ü*Ú‡Fß0äË {Dó ‘­WCN³Ù –#ÌÚdn÷"æs|çeš¯*‘BÜž[‡(Üv< \$®2Öå~W4:½Ð _âã| [í¬`XØ›ò#£ÏjÖÛmä3v4J·ÀkŽ ÿ"FGŒ›fhíÖ&¶/áˆß0¸™Ó‹r‘&S`9 ǰ>Âçƒ'Åe¸ÖkWA•ǵƂªAÉ<„ŽŽÕªU›çþô?ö§’¶ÂBŽj¾ða­Mš7ð#E¾BLJp4¶aw®s˜¢ôǧýðüE0·f‰ˆ¼áò ÄauÄnO5ïæ{¯V>Oêo¸Æ›^qÆé4¬äÅÑTƒLN/™\"‡“lü!Ž&#†yŧ5¦®ÿv¯X¢w¢Uõ×_EÉÌ‚"4'΄øÇ¼ž~Õ¯dVñÖ¹R Oøºõ„¦:Bå2Š+#õÏ0Ue%í¿­ÒŠ)æQ —f¯x‰ µAÕwb‘¤Æ2|² øæ1 nÐ ½‹Æçb¯­ÀYC{æYÇP]+G>¯c/Oœéwϕł6:1Rxa€@¸Ä1ZØÏ íÜvø"MÏh„3ÌZîôL&¿&s*Dëµ_›¾‡#l–ÍÜש)Tçê“y™rwwûGdô>¸é2ª=YŽž J"óLÃbuËÔòÕ¼4³Êl …Çë¼I‡Æ´˜¸J{æ§â¾ë£FØ¿^•¶CÞP.qüJ è«ús°Gȇq6«|ªR 9rmAû˜v ¼„¶Ät™4Ū|Êü¢ Q{<«é<;¼“,µgïÑ*Av§©¿?EhV¢ÍP*çKd/3Ô'z~eµ›}G G3óz“s9nˉ&¶yiæBkçÖ2¸òúæbÝ Õ¨ÓLàs¹ã¨kPÁÉÆ7»¹tÇ^ãA<+mªH;ÆóŽ4H0ɆƒÂ]ðºKX«èþÔBR—Sšn¡j×ôÒGÄ*˜óÐó VžÊÛ¯W38Û(´wm-3ÐÁ3!´GêÊ ¹óaJTâÑ4¿cå½.÷ˆ²ÃÞ½ì-說°¨v ÆoBœóüW+¬ªý@_:Bb¬-ÉHàoû¾0fRX§0_f´øÔø6ð»w‹Võ=˜K-Þ–~§ü!MªL øþ2K¢_u6¨Z•!À)w¸ì¥¨”0Òûäûá‹J­81QBJþÏ2…,‡4º;B¡4Yy¬­d +öƒü™9äÉY¡_`#E×*_0öðž@~­Q.¥½\{t¸£Ur¾5,;˜Ï·kô±‘¨߃÷,Mqi9óº“Obçø‘?Ç›¯,0¬ëúñ‹´3œV(×E¡E¨&$´IÜ“³ Gu]õܤ»Àè˜ÅAM7I¡ßáeж]ñ~Â-Ž€C®]Îíw†õH޹‡”.2Èié¤Nª+v7¼4[Ó­Wø:ÜÏ«ëÒ‹ŒÅqº‰±ÑôÞz„Åš2“±f¯%ìÌ8̨‘Ô§FöùP¤­r_” QĔɖÓ÷}‡.cÕÒ{øž0ìè•VÒˆ,ò0Ý™–ïã÷ƹ×[°Ž”¼ÕÚÝ…„Cïó°’?HÐ~4B19g%ì,j°‹·/Ðø\žóÁÒÕb~³àV …Ü=/Ÿ¯„Ó»\9: ÚµÿZð™©Ë†}l•Íb÷I- °£ÏwÿóǽC¤CÙúƒÇ;ªiÖŠõŸ†Ü((ÌdÃNã³.póÄå·wwú4g­%øƒqh6w½`”‰Ä¼øËŽË¬Üµ£ôIgc$«\]§XÉIYx ›Šbg‡ûÇc¨7¿âÖÒ«=`ÖÌ<Á7Ô&ÌÕ£oÜðL;æS×N˜…—ÜŒºvè —è¯ÊW*¤ÒÓ645¾ð £¥×º¬:N#¶9¯ö(,6ÓtÕ'¯s&±{Œ¯”˜ÜEâ®HÉ£el4Þ½¢¤— RN ÷¾ü˜v ¸tQ~€ûªãG oƒÝÁU~”œ8UˆR·u†øxÁ¥þ*Ÿ–#)VQó®.x$A¨ŽaäXMLwÞùÙºÚ`MÎ=jŒµ”4Šiœ™0îm& „‹¶cáħ­îkõ#ð¥õÎXÖ§¹‡´u߯Q< ”½Ž½9¬ëÆÕÕ~p]mJ”^ž6ëkÃ[zž\ëK|u@¡+GBŽŒÖ`Ÿ ÿrP*1?1ÕÉH]¿¶Žmc¿“ǣߛMZË%—€=ItìàZ™ó\q;¾E}¯DéÕ:­· ¯°¼R`ƒ{@3ÈÔ8J,ãÛ/‘5AYê‡Ô'«¡.!7³Ëm®Õ;?5djð—›/ÑEHFï,˜ïx+ÿü•d³h¯Ò†Ø¨Ý}ˆÍR÷säÃ3WTC³Èô.,Ô“ªòJe‘Í—wÆ4¢1*A¥²dÝί…¤¬lÖîÏ\c£ˆ7²‹‡gï߃_¬èu|eÿBÝˬ (§Ó×ñ±›’Ug;§œ;ÁÌä~?N}~kŽÏa£¶Æ£À~P©zÔgèúIÊÉÔ¥'²ò³Ï§sÝF™Îس`5×òqYcu“(¿6’§Oh3q0Ý«4 » øü Cï½Èd°'á \”·¤—Zèc; E=@’´§#zܤU¢SV,‰‡«¹ùõçä—E桟1GøiØgùÒiKSR'Y#Òu¿&išh ›‹ò‡'ðûPŒ ¸ŒSBõÏ{RÕþ›L’7S‡£ñëm–­àÜË—E/ÐOÒ^øö™+â' »Z´™zÁ¤{¸T14qLGªÛ ̰òSœwu:èÇ’òso}£Ÿò¿LM~ÈÓý¦"ÑÝVsXBް‹žÕAR§"ÑlŽÛ» ·xG3=‘2źFòîõh7¡™§Gf/¾ìHƒÓµJš{•…Œ/Ã`ˆ²n¢­SÇ(€‚O³®r°_ùuË0¶Lºk˜ÅB4²ƒ,{ðëwföOSQ¢–ÒúÍ+ãøÁÒ&1’ Ä&‚’Ö³ï{ rW†Û£ò¿¼ø¨àíî¿ÆD·ködmdáSO¿ó¾“¥Û›³²/^eÍì½&‚Þr‹(~G°ùhÅž½0l…µ/²"Kõ\)¯d‘"Ïs„¢r_Ú†½³L/.~#Ó% % j–Mtk$öàÔÄ®/Q_4ùbªù„>I„Tƒ¸zD×ênÖjEWPmp‹-€7x~Ëžñ.©¹ß¿ö6Xä¾±¯¨ƒ•†e¬Áw½ndB´,}È'(è‘m´ sVÔœ2=ât#:“NHÁb#ð{zñõz"5|J"—w]‰¨/d ÷l5j81^Ž[S9%6øv1|OwóàtÍèÒÂÚT~’ å_¸ðqX5n»ã½h/¾†Ë•›ø¥™~Tޑɲæ&åÐ,9égåerŸèù!ÁVZº*W¨–õšvi&€s\‰Å³Ìøæç­D£]¸ä’˜·U»×5 åøl»Hq(T*øâ™9dÀ¢Îà.“>ã‰$+—äìœBâyA`¿„ÂH»idÑØŒiP¦^Âúõpe¦ß‚x%iÑ3ý™ÇÔ³F yê>Ú4ìdícCâºÇõøs;hûmÊÂ1’¤’‘ÿŠz-aßžU¹Ìf™llƒáÒ~ÕJéw’éyõ!3 #þó‡My8\À>ŠvøØ…ÉT,líÊ9ô¸Ÿ¥Õïäm8ÑO§eh¾É£tøJ£*)O½à®\x™?7©ÄÈ#‡bp°wÍmÒ•ÂâT5£ÏÚÉfxô:ÇÃ÷£Ê¸å( ýnD¥'“jL&¥õù³[߬K‘¯Ð¹Æ6'ä>ˆpnë8ˆA’ýÕWõ=¤[QÕbO.Ÿ%"xÅg«^ <רòÚw¹e%/$SΙR|•9ü¤ûf—Ü:°¨ùîxÈPmvÕ<ÇYiö‹¨Š—JÍ Ât "Õõ}3dÖò¦3УŒ…Î'{‚9Äk¿ÚDÓµîsrUMlÁ®­4ƒ-'N‚Gˆž$Cv¸Œ‡‘.ª‚àjÄ™ôç§ýq-N»œfªm#ßH-F3v¥µ™Çh]Ô’½¨Í lƒðر›¡?{ßû%éÛNmT/BUg^Gc­Êþpôæ"Ðþ6Î,ÂÙH@ ôdóê#ö2¤ ÔgšÐúM°ô!­~m<Ññ Ð ¯•¯ÜÉÒ3+]q& `Æ;ÄÕ«Cì”1û›Ö%—'{êÏÁþø©Uð›A7o^„Fæ)cS-¯‹S£ûèÝÝÌå­\§ŸÊz6ò¬ ¼Ž—}ùÅ$\_ÿ ª ˚ȫÖë-Blù©Ž<VwUóî©DÉ ªw…«LóÑ΢EϲÀ’GV±q±npÛ£ iéDȲðÈQdŘ’H°å:ÆžBÊÀ?ÿXÙÅwk)U.:šmÖ¾xT Á÷ŒÕéySÕSéL ztwï9¿{bLfPÒNþŠ>×–òwöâ<¨j{Ç"òÜ\A²ÃZöêÇm”àÏÇ:Ñuô—ËF7R‹hsŽ"úÆÏ?ñËfÍS˜y3”wðî«ûÒ vú)Tab˜ô2Kì½¥šî™†cpÎ4e6¸+ˆ½-éM“ÝðõÑqø\ñæâ¦º|¸æG#‘ýè’ÃÃÆ—¿®Mì§‹¾Okšt±KZ%9‡²4Û§«ÐúMég£Ý›ŠgmA“ð• qAYüŠò“H<2Noåg™•+*ù/D¤1¿éãT\ó©¼8y“\À‹ñ°² ’”Ì;ÍÁ3mÈ#dð›Ýž´g(±ÜAE=BE·M=¾ëGªI«dîÞ¿A=íR' (D˜Ö?ßEíjLFìãóŠ-ŽwÖ‹%rš¾?‚uµƒ ìvšs@ZþóôS…KŒx£mJÒ/^z!ÉÓfö.âtâÌ.81ü D9Bû¶×”Î¥tEH,"Á-Î{‰9-ŸÂdӔɃ4gkü cQ3¿Ü¨i¤Ÿ®±j¾´CµLpŽWu€[Fó9ë)‘ž¸k%ôL#ÛüÛû¾>í¾ìpÂÉøVʼn·ú*ŠÎ›n[Ãùí.^=|ÀÀfgÝóC›Ée¸i‘ F^.BäzC¬™»;n–ÚØS¤,];ZÜŒ°¶Œû5Õûäp¬‹õ>ÿý²r̾†Ê:E•åâ"0nHɤ¾KZõ& Ÿƒ†Qª¤Twl½hŸœXG¦¢6Uó˜m(ðx›þF({kÒÚ^0)…¢ûÅ%©v<iÏ•0mÚ j®ÃÆ®JgÁ%ïOîžÂ„‘" 1Êé{Ì8úo®xt‘{õR“[k®¥ìK–NÞ;Õ5³îÙ_xí#òÏ|×qf[¹ÂûNpIÑõ¹AGq3‘÷ï©«´£<‚™›r§Ø«oòÏòªZ„%ØEeúj6s×dÄ.ÌöAS*Lå<²¨c¶++ÑßÀÂZ:4†bK~×Û“¤8ÂS*4NjhhmÂ!ËŠ¾ù~¸éJ¢ÓDÖžŒžå##9RŸ*/&$šUí¶{v7&äÑϿØh :Õµ˜´êUô%,@Ólª4"W&ÛºUM*Dû/n?¬ /Å%½x$´-NJFW µ]lWó™Ðú±ì‰âcl¹þÔS:AxRžèjà°)þýÚ4kï³;[ᪿJú¨¦Ýbôp1IY-œ{iRgmÏöQqϯ†Y¾ŸÂªò¡"ò.\OÎMcá×ÙR„_&¨¾¯~ŒwI.Iúdõx„ÊÀ½7~¾F0hΤŸÇ¯˜Ö·ÅIöÞŽÂS.;Sã“50gÁ3¸ÑÐÅ4å–Œ¸A¹á<ŠÑmÐîó_¸•lH窻ھe'󟬭½jRo­±Äç–=kŠ<ÜØœb“$Ô¦øæƒz!…¸ —¾Mä`ªõ\sî~^p*Õþ fôÍ˨D‰-*E|ª_l2Æg%yf °Ê)!âP«TÓßš'Í'2½IU7·A!E—s†*ÃxiÆ$?/ÎËÈùjq(Ý÷‚ÚN=]h£8mkSîÖè2káÁ†åTx1L¥r\M)Þ˜OR)Ñí»ã}ÒR$r–lîT!›)õ™ž¿Ïëæ»¿qÛSó½ŠJAï5£È§5 )ž~´—o*•{½=¯÷zúDšÈ?¦~ B£n¥.ã,°¹&ÀoÕ†z2Psïi-*G}ðÐ>jš…Réè'Û–N~ÜÎ~ ˆuá's’^ì³§ôÕÇÓ¬‘IJpÿLöØ‘ž4o»¼Ò† ÍEÅxŸðmQÿÏ·RÖ¢6îÎ…˜]ºÀcs'@¹¯8žÇkÙã„®Eæ¢Àc‡¥)&$Öœ"Ôg««›oּ߹íšÜ¹uÏn]öì¾~¼V΂gÆÆ…¸+Zç'¬|¼½sTuóJzçˆ)UõEe x¹TD]ý% 4øW ]®Ç$EäζÄÏï“+ÙVZNWò‰¤Lö¦*ÄQYì›hÕ=6²C²I=–®#ê;;H”ßâ{e«“àŠk“.5zA9m>ñb¿è¡ 6sa"¨ÌI'­Ð½öγ‰{s³:çnÜ63mòÞŽZ_HúëWBÇXpnlA]òó¡ø‚žñF†°``â|Õ›å+™Â¾ÖÕçsêøÌÚà§ìµ!%¸¥\ŽZÌx¨ðÖ—·M™JYšŽn==ôWpæB²íããivç ][^jÒ,Õñd ÊVÿ¬´µô”­ð]‘©Î­:Cg"jÃg‚’2ÑÍè«1]GFZ„8å „pap`'!Ð皊¸ã)êÀ›#u…E2“T'u/eéÐ@F&õâZA?=Î9®yØÛõ¾É(j#{¬ð^lL·0¯t}ÇlH†U ÌQØÐßûÜËù°m­cB'@Ya8*ßù;Wø¦d;ÇI ¾"¤áÐÓk‚Ðq µ×:DkßÒN/Û21"6$1K(¯wz G»¨§wÅ ï×=ôðE}K}Éç„åµõ‚qÿ€«z¿Ð²›+¼£ç¢Ô/÷:@}}™#)Í¡Õá†Kªœûp}öj'ÕÅk}¡u7sc¼¿¾!æ†,1³ó‘²ãù½í•w³fù:Õ¨ðÙ; ˆÕºIH7§†ZEã»gSkN¬X¡Nr¦xòüä¡*ËOmöôˆªf [¶é-ò ôÒÙˆN6Öfe½ibTî>:Žrå;ñ„°Å®ÏW¢Î÷fp!žD&*;d²¿køôSÙÉž‡!‚(•¦˜ax­n™ÊÄI'ð°Ô*PNZôœÀ™ÇrÍ¥w¬Ä†SVjRZõÌêÅm"£bkتÕ×ÓÑ:2 ¥zZœŸé-‡ã úËMŸùï­çF¬ž¨ù y2¢h‰ü˜wŒ•Mx³üæÊÞlØ„ é_áùYFŽJcqò°é™8µC¼'pÍ/Ô{ÒWn¿äô¤gEÂõÿÀô„)…æ­º#łމÀþŒ'½M–9™ÿ ô›ôIÓ¾ÚÓ÷ ÒÖ@þQy”kœ‰C|÷ò1|PÑEWp­Ûq¿ï(£x´Õ¢@°eŒ:§§Ð{CR>v¦½ãrBž¹ƒõ¸ÈŒ<Zó“ ÂàÄN¨44°æd*áÒœ¿]-«04Pʰ#€6d”µɪ¢¡[ÄÁëƒÇ'fT$ƒ;Pd³YL»òû8¥ä #ƒ¹«Aò(Ò•ß9Èoß#|ã¯RšÕÅÂ~¥b‘z&¢Õ¤Û=Ö %  t÷é(Ü”Ø`Eóí©&´]Õùªò|ŒÓ<Û›Þ±Ü5) 4H²&c½»n~{ßøº¨¨ÀÙ{ìSƒ<nSu'Š:<¹ó„N+M¶’ˆâú­‰ÎÎÀŠƒÅøˆÚyqõ=–¤ºÉR›-ÍÎ'èÌú sÀ¥óe³Ï%û>åù{²„áŒåC®©²Ês>ÊK¼=Ãv·«… ÆTŠ8eˆ²ñQA7•9±ª]ŧ[ÇRë¤XŠ)YŸD€Å… „5ölÁf‹Ýˆ]òþ¥­=Û†aþ\ôðìñ¦Û.Ò†ÛœG>u;GzøïÝÞƒRì÷Ók/|ù)#BÛ£–¨ÇÙáz+}c/¨ÙôO9qó‹ ^»UÅЙ¥*>kÚ»ê¶5?9òz"”÷lÊ‚¸È¹1åFÖ/âXÂE#9ñ Þ‚Z—¼Ê!WÞ ¤ëOmÅ—Ì{¤ñJ­<¤3/³¬ÑOdI}|.[ÈýlL8_ümO÷ '°¶‰X+ë®Wr÷ŽÒÝBÊb.%4’ëÔmßseÒÏ^lûê«qö™ºcm,át¹Q?o "ã"ÛZF«¿ ,|+S×Ïðíai’/¬Z;|E?Á©Mþ¢71qV+½ÃÒbÅZO3¬Íí¢È¤t"!9ïaD]DÌN·µ,¬š®ËöòÔ[­”tHŒ…èÁÚ½La k<˜ ¤’¢B—È÷Uô×Ã(¼Á¢ù©.Æ4räZq¹¬e0óÌ»³›hàÌÁÅ·E‡g?\9‚^ êØÎuO?ÍB5AØd_çŸ 8÷™ó…}ÀþÄfÉ5ÓG†ÄÏZL³]èYÞ¿uýÐಌ%-¸9äHëÁ¼'À€ÐükºXõ&YçÊq(ÁS,êš ÝÔÓüMj²™ ™Í½CÊ $ %(]šËy(jÂ× ÿ††Á±|’“÷ÛF¿4Þ•7ގДrTöªdèy¡5-„-à—¯™u4d—©{"Œ‰• S¶Œ³Ž®(‡Þ.ÝkàvFaͲ’pXòY´˜²Œ§ý•!ÝF?ª|²}.YìÊ-Mò…!Úr=«G㫹ZtA«…fcHG69Ûf>É/ôJ9V‚ì«1L¸ŒáyF¬Äžˆ©)<‡Áh›/—„x'×ý¢-__å¶D ›ž—µoÜ1çÆ–mì_åt5@‘íFìÔ˜{üÞ•}{­3¡5Aùç\N’© ƒ2Á$Æ´_©Ák M–Ÿ†ûåP¥‰´u¾w:¬j2½*|™ÆùÿøCÿßÿ# ˜ƒ-M¡®S¨=úÿËÇŒoendstream endobj 383 0 obj << /Type /Font /Subtype /Type1 /Encoding 424 0 R /FirstChar 11 /LastChar 121 /Widths 425 0 R /BaseFont /MQHPZK+CMR9 /FontDescriptor 381 0 R >> endobj 381 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /MQHPZK+CMR9 /ItalicAngle 0 /StemV 74 /XHeight 431 /FontBBox [-39 -250 1036 750] /Flags 4 /CharSet (/ff/fi/parenleft/parenright/comma/one/two/three/four/five/seven/nine/A/B/C/D/F/G/H/I/L/N/O/P/S/T/U/W/a/b/c/d/e/f/g/h/i/k/l/m/n/o/p/r/s/t/u/v/w/y) /FontFile 382 0 R >> endobj 425 0 obj [600 571 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 400 400 0 0 285 0 0 0 0 514 514 514 514 514 0 514 0 514 0 0 0 0 0 0 0 771 728 742 785 0 671 806 771 371 0 0 642 0 771 799 699 0 0 571 742 771 0 1056 0 0 0 0 0 0 0 0 0 514 571 457 571 457 314 514 571 285 0 542 285 856 571 514 571 0 402 405 400 571 542 742 0 542 ] endobj 424 0 obj << /Type /Encoding /Differences [ 0 /.notdef 11/ff/fi 13/.notdef 40/parenleft/parenright 42/.notdef 44/comma 45/.notdef 49/one/two/three/four/five 54/.notdef 55/seven 56/.notdef 57/nine 58/.notdef 65/A/B/C/D 69/.notdef 70/F/G/H/I 74/.notdef 76/L 77/.notdef 78/N/O/P 81/.notdef 83/S/T/U 86/.notdef 87/W 88/.notdef 97/a/b/c/d/e/f/g/h/i 106/.notdef 107/k/l/m/n/o/p 113/.notdef 114/r/s/t/u/v/w 120/.notdef 121/y 122/.notdef] >> endobj 376 0 obj << /Length1 1477 /Length2 7467 /Length3 532 /Length 8340 /Filter /FlateDecode >> stream xÚí”e\Tm·ðIA:¤‡î:•în$‡f`èn¤CJ:¤¥S¤A@J¤»K¥SàÌ}?Ϲõ<çãû~zïì/ó_׺Öúïuí½h4´9$­  9ØÈ H«ê耜ÜO¤]Aænv°Œ¹H$Ým<Ü €Ÿ€ßS€4ÄÙËÕÎÆÖ À,ÍòW’ @Ò äjgi¨š»Ù‚œà5,ÍÚK;›'@ÒÑ õ×(@ ¹z€¬8Ÿ+;K7€ÈÆü”ë/!E°5 ø¯°•»ó/y€\¡p)3\’W´‚€½V ë§\jx/Üäÿ†Ô—swtT3wú«ü_Cú_ËæNvŽ^ÿN€89»»\ª++ø?SõAÿrSYÙ¹;ý窢›¹£¥$ØÆàþWÈ*gç ²Ò°s³´¸¹ºƒþƒÀVÿéÛß\2JªJzÊlÿ:ο×4ÌíÀn:^Îÿý+ùoþføp\í<¯¸9¹¹ðDøõßÿLþ£—,Øbe†?üsWWs¯§ðNü Àlò€<á¾\œ`ˆ| >?€5Äõé_§É+ àrq‡À‡ô÷,àk‡ù¸\Îæ® °#Èú(ðßÑÿHæpYBœœÌGø\¶^ζ ðï|/¼ ÄêwHÀu4‡ÚþŽÀm `Ð?Ìoèfë ú#Ï€‚œì,!ŽßÅàý$¼•Ôo‚w‘þMBðCù‡á·)÷›àÝä/€Kñ7Ákªü&xµH^Eã7Á÷iÿ&ølt~ÜS÷7ÁkêýCÂÿ>‰ÿ1rø+Ãõ{®Â𾿠> ËÈ ×°úáwúy\Ö ÜÒæ„kÚþpO»?.áðÂ-ÿ@¸†ÓoÂ5À \òÂ5œÿ@x_×?ÞúÂGâöÂ5Üÿ@¸†Ç×€ýFøç‘Ëó„kxýÿûU•’‚xúp8xxyü|<a!¿ÿ‘féî êÝþþÂ_÷ÿfk;ø·òY>ŸXŠ†Ú¿m /ó—-œ(GeE”²iNP«ïúú3d.ѱdXÙ…u¥Îà¶"“{u‡ö‹Ýá«ùEîgKBú·‡³LïVrƒÓLU¯mgÚ«Cœö¦éó#~Dõ©•‘²âþwLJùÌ2:»hK4ݯ<º³B ä2u#Âêyi´pÓ]Ê"ù"–a¸)I(Ëã!þöè-l‹'wüÛBô¼äS„Ë'1ÁÓ½Ýð{†®>£ô19õ7èÅüîçäݽsÍqœÚØÊW·N»ð4¤Þ1•hàê•0OÙKF‰.ù¡¢í,h©ñú›¯¢ê<ÚÄ‹9ë+OôËÀA€ê“ªk>:Àö}µÐ«ë+íW§´B}MI’/¢¬ubÍýnî³çÌ-ñô&=¯{ëPŒÖf‘œ#iOé¢Y’•" añËS­£n‡™êæOäR^òU^9»Û^B|çÏX¸Í¤)X½çYPî§Õ½¿Éë®æ?±§* ¬P´ûÌ¿ÂËÈ-‚è÷ÙŒ¾VêO3d8Öç舋5Õ‡åãë~zLÜã=§†™WÐÖ3Zƒ#9ÌÞ¸3‘Ù*ñ>_y uj#Åž»?´ëÃ(Z˜4¯«½êgÙ[›^‘rЬo Ew}ÖÀ&à’ ™jzÿéA&r¹í“DóÇM €À‹×}Z*•8KáòºÑÈ«_v[8˜3Ǿ/à3U{ 4Š‘¿áÿzŒ×P«Ø“ NÜ6S»¿uê“ü‘lB+²­¿]…£÷rŒnÑé5ò}Mh„·çûØ·TêÈá ×€Ô+Šï»ÖØ0š{& ¨¤^—AmNió6¸=}{„™ãÄ6öý#ë‰/|„÷”BWKJ#“"Dãµ4«oìQnpVŠiЦ;8gÊG1Õ£L ³¿øŠÕÕR+€foèÑŒAã… !9|TE,?øY`KúU|6ÛÎê…zñ¸4wJ¨µ¡½ÃÏ7¥ˆœÂÝ+:2Ÿ‡2ºÅí|G{£}>nJ‰þƒBz=eXéÙ£[è%àGø›ƒÀü±÷‚ͤêóijÙBw"Ê’†¢Ü3YdX;°×™’NoÓ}…¹‡â2 4I;cËÎJºÒ*Ρìz\Ó€:c¤O„G1dÓÌÁ‹MÍ•ùLä;¼7ód•f’Ï´Ø®ÄÍ:CšÑô _*_áln Öì`)ŠŸ®¸Çà 1 ùªAy²»ÏÚp8¹èÒº“C±Ø‚,(åñKÛmÌ-—§åòDü{À:‘¨ÈŽ­ú÷túŸ´â‘HŠ"sE«ö(zAoZù¶4"aæË>µÙ†Àë>Ûð³æ£T©ád>}v‘ž˜4ñ´HE'6ÒJ¯FK&¹‰d¶5]4QÇQÖ^EqpvM9¨P€ˆY¿L¬ïÓ®àß©íç÷„]C×h°ÜAúz1¥›‚Ήo«ÆªJ]>xÎÊ]l¬¥m.€ZA餞™7êeï „%ŽX+™«cO(m.6¢ãmö§6sºß±}‹±é³Íž¥ÈûRí¯mˆÐs(7vðí¯k fAL°jÚ¸õíµÄy©:Úo'cÞ¦¥ Ò`~k¨ækÇuòÍd Eiò\‡í4ïEY÷^õ!’|Ñ7ÁWPTŒ<×Ó|ߎ¯&äU(L)‹êÞ³.CR>E…‘æ§O?"&åÖË-×H4,ž8ì¤ò¸P(æ59˰ãl‹IÈ#›#Ûõî4 ÒVo±?*•Saç¥Ü\Û©ŸËxô±ƒÑ¸}æSPö2ÁÜxälƒ ýÔ†$‘&ÚîÇE gL€’3«’jÛÆW¡üÃ/¥ˆaÙD?ç8hð“3.3.‚^*dz\ü,ƒ)4s¸Y‚µš¾øýª•دž×(f*ÜΠ»b(d­»]d(ßx£ŽSÆ 4ƒýmÊNû\$ª¥f°À±uÍy®ç´ûã4H‚·‘G—gå òÝ},R"ð|±ŠÇésÆpAî•}—#Nƒ<â¢gxÄF™²÷¶Á¡»#V¥÷+'¥7„*o×ÄH¤uŒðˆZ¨(õ ©¤ õ¶ãæ³{¸ ïkÁwÓn:ØCT÷^ÚE<ÛÉœ?ÜǶÒ:Í£‹t`ŸéÔ9J¿úÚÀÚkÈ)´Wäû´Ì^$¼v|꽉¦ÆQ,ýÖám‚߉­xâÄ6wJ™µŠ+•¡°Aá}{µ×yùð®úW^±û-dž‘ÎçÛì÷È÷?¿ÝmÇž0„Z8 žwW¾2h8²ì²ÐÑ×â•Å-)¼ühcJ`„BJ$=0Î+“Ó%cP”çãzÏÁÏ]¿0'ßtbáËj·dÛæ"=UB¨¯Nrœ¶d¼Öƒ],d:‘û·|Ê›PÔ³ó‚¹Íhs•½ 4ð ;¡Nñˆ”eVmg-çÛÝßÐ÷t C%ºoéøé*V¢‡Ru¤¹ÄžÄÕ©{ù}Q`ç$êí\ÐQpü(‰:ìmaá½X;WÞDCò¡“jq>VY~?á¼ÆæòÜÁ¾%¡;ˆúe¾§µèR|Çó¡6æã„”[¾r‚Ž:¢0³: {VÙ¨ÐýåYw‡Ðb¦FV e‰Ú…zñê 3À àRö3Îܳj»Ÿ÷†ž’f(%<÷Üt?!Öóê_ÒÅÙ$c{É—J¿ Íe5QFÒg!EGå×d‰›\smUÕDÍÖ§¨T„=òñ bHˆWba[ÿ0°!O8zI7ú¦^M"Jsº M t¤½^¿´RâÚ…ä/þðy½”&­g‚)ýê2ÜS:¯œ]{¡2qÓ`÷yKßl16œuL>ÌÉÍçå ãédK±É¢Ê@ 3^Ý ÂÉÅž„”‘èpa|Pó‰é‹x 3öØ*6*!ÜOø§‘Ο½ õ•º'~²rRµ±[Lt~q#t£µ‡uí7²–b ™Ù»Ž9?ãø‰û x0Шfo›“Ó{)ˆð–ðK/o˜Uý|Ëš_n —²ôzæ ŸcåZ w™ ÊGá?Ý$zÇ7½q "ÝùÅ cÝ`d·Hª£Y?'Áwæ0–[ïõªâØÎ!lEšçýÒ€ ò,"PŸC¤±ŽÖ…Û® Òš-5€ûQŽuGé`Ùz?­ÝJ“FÔŸUuˆßœscÀ03[ã)Õ^}ñÆ¥¯Ž3çô6KSЦiý1©‚üÚF§æý$žkñ‘+µÑ{I»0\Åy1”·®rSÔwþM•ë+–ÖSHr+ì‹/°§éž3)Ø¥wDË åõÊÔ­K{q¬#AÎO‘ÇËHblDXòJ 4ÒPd?^çnƒ×YšòHª½J‰XX¬hG¨¿˜ÙôÆ`´ô ­³Ä“‘köKEÜ©GÀœÁ)»3óêæ ”~õZ|„HÞˆæ±wrü½™ª• ;QÕ+DI­óe4¹uÆe³_]0-)µ“PrcŠø§—fý~eD#žµóybíðlüB ™^"ἡ®¤ÀeZÄ›z—ù¡[5«¦»@“íªÍçúcuúçrÚ.e¸•–¿ò³ïÑz˜F:1£,9Ö‹u»ìC•º ¢ë\N«üŠ}.×¼qC9ÕRyK"Ï[ FtÙ½ 5é«?MXmßB j§x^mM.mîx7>7àèÙÔ7^»~½éŸ´b®´Ï«³¯÷MµÊá]ßðÕòÅOÍ EnW¨Ä—vÌ÷ãU4 ƒæraâ¥Q»}`5bðyÈ-y…%I=CUš‹•Õӡž¡-J[s5ÔXŠCBÔÈ¡þÎ-ZüÝ»à»1¶G™ÕÝ›à´Ã6Âd4äþâqÙG$Xo®ñb¶R/Ȉ˜,$þCü‡îr”8:&û솽<%l$õJÌÑ»á¸ûh…Oqÿ†R&&Áï|žSûÖ etŸÅÚÅ^È$H£"[yõjOÏD¸gÍš®zò½ë‰®:€Œæá KS‡líYUèìe|}ÊPU™Ø7[â¥ÄÔR©}<9iÞ þ1V‡~Üå{H]=±há©Ü;~“¦·0«ÓÎÏ.œ²$7ÎÔ>m90F¢}• “@¥Ìµ™7Õ&*·×}D/ÕGX»Ñm{¸ªªë‰¿®aïyƒà¯bÀ/BiR‹â×]{r£ƒ§jÀ9& +bĦ·h—I)}9…ÕãËkë1¸›{¨E n;ì«Ä† 0ýĦ­Ñgü¹Êú´Ž[’ª±_1ðº9'…:E•C¢gü)ýjöMÈ’AǯG‰eÜ"˜†M3×üù›Uj²š¤a#ßãìå@>#'Šè™†(âF7"+Aû½FÆ(žÄV9Zä¯Ù:¬{IÃñ‚û/ÍZ°†]¿‰ÒÎI\²Ñ}I¤·à­føŽAª(jñzà¤jA¼òsc)Å+ÆÍÚ£‰*} ¯Ž×…F‰| ½(¥,¶hÖ©¾çû XOTS®eqÛ‹hf5}ÃÑÁcÌMyIžé©éUaù‘l5Œr%ÞxÆoŸ…?úSc†KŠÆñŒYbW –zS´®óvœX@= *:¶!O¼¨¤f½ÄXÊÕ ¦/@#®NF J4bP'[<èN!ôˆÌ QÉ›Ø?qIxBTPÆÝÚõ®‘C Ð2záM².¤Ô0Mé¾ßuÊ.üÆ>µþ€g¿j}Üóäàä%š­z ío£¥ŸX©3¯ã°f+-—G¶ä[-›V*@ß·5™¯uç¼^ß éb‹”pP„HêH™7ô¯VZ>sSy H7¶<+XL¶Or1¸Øí,d=Íÿ‘+?y+…™Óï¦UùÐãÓK®îó„"™Ë#0‘ Ÿÿ§g“qÚÖäQÏ€¯Ž(ž/'ßè¶;`ÌÞî$ª¶šÄÿI0¹ŠÀãÚ¡8+Sèµå÷u¦SŸšê=ÏéÖû·sÄKÝ,;V[É£A¿SœÛ¥J{²Õx~­”œÓ¿ÒΕò‘¹P’³¦å)T“ûàz“•Ú‚ºó9S]È)±XïgL^VNo麲5ãf¿¯tIBJ"û^îöõ3Ûáµ#¬–˜I®§¨¶@³“‹1²Šð. –'gÿû¡¯ õ{"#/¡{6ô‰Ç²xöà8QÞÁnPøTEâÕ„Öè±lîäÅÛÏG©óÀÊⲟ9¤²qFCêêâ$›tª}´™™ç¸¸AŸ;¹ÑÔVðƒâ^ï‰¤ÈØsg„8HºÝ}Õ/5"-WV}yZë¨Ú%Í›„uxÊ›% ^o7©M䵿½Z7aê¬(C¯#Õ‘Ó¹–^uÚà,Ä/ð ú´VE&7ÀöšôfE¸·r««ƒí{N¤ÔM’Ë’KR';¶¨œy+hú7˜3Ëý (ö‹{Ù߆ÈÑÛ9ºå·Ë6)øç:I¼ª^’~³V9 ÙÝbö~9ì1±ý)‚Óüt3Çl‚5zœ°ÙÏ0IUž&Šê‹êg”a¶§E·újª±Ø ô qøì«Â™ß¯Ÿg§Kg?ŸŒeæb²Á¼Ñój;9Üg÷¤ÌÕ>±öº Ý8ê§ôì)¶Ý~xb¿VžþžnÛ G ‡î—Ø>±’cL–t¯Ý»ë螯¨Žøn—E{“Šð€%:ÝÝøK*®ŸƒÆ4,2‘nïšÐï#ÒßkÙZ:اŽh9;Ä/|p÷&„Éó³ŠöèÛÎE©›§·‡ZQ¹[¼ÔbôÔ?6×>Þ ëWq¸¹—Fï^íÁë"`†5e¸ÄÖ3)ºlØiËG×Uj¸c»L¦‰Ü‘žT éïNê°:ƒ¦ùp`7‰~ÖÖsR£éÙ{¿Ô·çRMÑ,KÑ)8¨ Wc‘òëM†NÍφÅ?´É^)ws~tBD¤ ÎéN’ì¥ÀžÑ¿júÕšƒ­Ký˜w¯özÜó<|i›ru Vúøœý€Ä{gO@¤üjÌ@r†où ü¢8d4¨„-©hêûç÷›OT$m}æH|ôšœAHT½ÕÎíH}`þ²Šðtö^![ÀÑCÈÌS’®Ä]×%üjUÅšÚÜ0‰âåþÑR@npÒ[5Œz +˜ÚQ¾xÚ±ñì~ ¹QºLŒçwû*BUúîÈ»!¤DöG®Ÿ*ÍlP™öäùJŸ~žÊê®òq2ê?S·|:Õâ…U «$ê[èLÍ:¾WC=ÙK6žáO¾¤°°Ø÷æDs¾x¶ Kr]ÜÒ.:wŸr{[Î5ºŠWLµ[ƒÏˆ…XÅÄÂ0á~%åoÔ,tº‘kgJa-ÕçYúÔÖ²ç$¾`xm`6€Pæû‹w£¦£o‡›®²TTù³žîjänÎ Osºc3Dý;3~®t£‘?Iq>2ÏKòzÅ*;S†cþØ™èåxu¯ô¢³r·[ïa‰ÂFDõc&ë“J9q‡X¬c@À°%ðFRÌ`ýßä}_Yí[j=+aÏukÝÓˆ|ü,2?Ó7Þ'‚tâ~ò©÷ñ¦û?ß9vi«çhSÊ8j ú¡ ³èÇÍË‹$™B’¨…qZ&?¤8A^·…¸šïuÄ5^]ƒ*‹»’Ø+Ð.Râ®Wž'º0~mbõˆº^:N3ÔÙÍYÁ¢îÿ$“mö®…¨ª¬ä—ÞÕæ¤V…ÒOvÐM¬g1ucû„v#Ó©£ý,§1vn,¥¸I¦a'®Š]c ›È¾/ãD£  G ÛiP k­öMóê¼À¦1?¹ä̘´_R¶‹Dv_õÃÂSJ+ö ?²{üºµŠ-áYíw$>‘¨"…÷: 5ïÐ+YÈ »ã«—Ά°ðå :äMÅ#"+QH…Õöx±’«%Ó?3|MTÝ”<Ó’#zqã.ïI-ÂåoƼô¦­ðAE0T)I‘u½åÕe,¡¼2§›Qš­?T…¦¶ÉH ¤výýRÅ*^¶*Ý÷º|XÞ·­ˆT#2Ðu¾Z‰$#¡ïGóñîìiªz- JAÝ?³’‡‹¾Lk<¹$C!ÏHÚÏÚ.f5àþ?ü=ýÿþŸ(`é2wuƒ8™»:<ý/±º£Yendstream endobj 377 0 obj << /Type /Font /Subtype /Type1 /Encoding 426 0 R /FirstChar 39 /LastChar 121 /Widths 427 0 R /BaseFont /DJMJVK+CMTT9 /FontDescriptor 375 0 R >> endobj 375 0 obj << /Ascent 611 /CapHeight 611 /Descent -222 /FontName /DJMJVK+CMTT9 /ItalicAngle 0 /StemV 74 /XHeight 431 /FontBBox [-6 -233 542 698] /Flags 4 /CharSet (/quoteright/parenleft/parenright/comma/hyphen/period/slash/one/three/semicolon/A/B/C/D/F/G/I/L/N/P/S/T/U/V/quoteleft/a/b/c/d/e/f/g/h/i/k/l/m/n/o/p/r/s/t/u/v/w/x/y) /FontFile 376 0 R >> endobj 427 0 obj [525 525 525 0 0 525 525 525 525 0 525 0 525 0 0 0 0 0 0 0 525 0 0 0 0 0 525 525 525 525 0 525 525 0 525 0 0 525 0 525 0 525 0 0 525 525 525 525 0 0 0 0 0 0 0 0 0 525 525 525 525 525 525 525 525 525 525 0 525 525 525 525 525 525 0 525 525 525 525 525 525 525 525 ] endobj 426 0 obj << /Type /Encoding /Differences [ 0 /.notdef 39/quoteright/parenleft/parenright 42/.notdef 44/comma/hyphen/period/slash 48/.notdef 49/one 50/.notdef 51/three 52/.notdef 59/semicolon 60/.notdef 65/A/B/C/D 69/.notdef 70/F/G 72/.notdef 73/I 74/.notdef 76/L 77/.notdef 78/N 79/.notdef 80/P 81/.notdef 83/S/T/U/V 87/.notdef 96/quoteleft/a/b/c/d/e/f/g/h/i 106/.notdef 107/k/l/m/n/o/p 113/.notdef 114/r/s/t/u/v/w/x/y 122/.notdef] >> endobj 351 0 obj << /Length1 785 /Length2 1553 /Length3 532 /Length 2118 /Filter /FlateDecode >> stream xÚíRyçùþ 6zL±d8t…S càð8ƒ0H4ÂÀljf89 €±µÅX.ÀØk; +; [„€ƒ™,ˆÂŒq&Ë$kKY‰ÈðDNHiˆ4€“ °4à½|‚ xƒl’‘  C$ R!µlÉAë¯e2—ù­²Ø"S€±È¤ ²H†´€ R(OX4 9ù+L}/îÊ¥Ñ<‰ôeù¯1ý‰@¤C´ˆÿP`:“ËY&ƒ,Æ÷T?ð«;€d€<‘e’sDGQ*Qf!–W*Ú Š¸\úŠléw„A[(èˆAö üó;9Á<>Æ05³G[[Ö–è¨ÿ⑸,Èà¬Ü&Qjß0e ‚<„ Â$û#ûNVÇ]<èr®¯DÚ„­sþÈí¦Ø«9öÈ©a{Õû¬š^PgF%VeTªœõʽ E¦XŽjVc#;øTìC•E5“‚\‚ìÒT@Dg^{³ýLÂsî8³fË›!½ù‘°&é IŒu¡æ«cR g†F÷Œ ä³Ézϲyõ™ ï‹‘Ôî…éàs° ¨S= w~Í¢@³ù×þÐÇŠ9¶‰yxÉœ­_äÐ&<Ê“z*L"Ã:uuï[…¢-ù.ÆR?†ðÇã;NXhÜáz¤íúËø†Ûá÷w×zKe>ÛoˆM¹*Ä5ѦÀóèÄ1C~¶,¬}*ªh0ò_›r)/Þ@“?¾ÁOвÁ ÜHÕRãÌ?Hß„Ñè„FÃä¢q®AwJi‰;¯`ÏK æî„R»¥k™öþ1϶,È9’#Iˆfõ¨T¶¾ÉÙÉC/¼f${ª²P¸b^«®g’Ghl/uÈ•á+Òóv;ܺÝì>Òž˜®¢¼«´h†nÚÉL…÷7g†‹îyîZ¬€vœèÖ¯î)“Š/·)ÿüv\«´_CóðyMÇwÏe?évvyu¯{È4ÕHñíS ÂîÈ{—>JS~ªoÓ_?;ñ/y¾Ø/Êõ8žjWû+“¬{é·‚[…c²KfF1-¸ç;mK2E$`²\KQÛ—ÍuÀÕÉRµ\´Ûm«Z~!èÛ3–zöMofÙéʸÎêÜ®MÔ›â5Vk²I4Ím˜UA‘yS>ÖO?Ͱtê$ȉ›\­_ÌõßK=Ô¹ÑX8ß'ãy½ÙÖ¶Jv•o’}ô/Òö³Ôá:‹¼ÒÚ{[ñÊòÃoêÅgø_ˆãòý™‹¬IRël¹ÂÊž¼’èuÎYªÜmn\•MQ-<µ%Õ§g¶¥йÇ#TksmêÅî¢'Ë‚ ómÏm•9‘V‚7ØÎ×/F™•Ö„wÏ-ÝzåÕ§#ÕNê/ “QšÅ.W²Î,½ÿI…èMÝЂ”;+¥ÿüAvÌYÕ¦ã¤ýj?ïüÙšŽ§Æóåù —¦(âImº*ãbðÑzäŠòã#‘¼Þ/µVïÑ¢RjŠÍ’Læâù듯C“.쨑Ùh^ÿvs¨º×»ñk­êþC`ñâÄíF›r‘Oœ•íV}LÝ~Ü O‘ÊoŒÜl’$3«€Oží·òˆ¥D^I¤mΤ5é+ ;UòWuò¢ÎØwÊ.zzž–5ïj|oèÇM êUBŠóz@±êm·"ýjGGÄšL(êsÌs§ÕC…æþ¿<äv(«í,ZÚš_’¦©‘R&ž±sNõ®;.º iRè³o‚nÏŸ R~k.PgI‡NcÙ›cº6ß´ɳÐ×lC7„¯c³íGÀt&öXz»Y¢£NPûé¥Êk…±ÊÏæ.âÄÉ ‡nžx ¥w?¡j×·õù“ ½òóùë.§‹¹:hçZie–X)Î^á\¿Ó× Í#þX©¨qÑHâ†üÀ©[cÁWœ# C’TÚÛ“×;|†$fïŒ{»ëèÄÇdòjÂm’{™|Ák¥uÏ]I꿎Mxëú»ç:±p08ähªëb¨VbÛw÷pëä ëþ¹‰—}\æX|6ËÖïäã–´V¶K¸”d˜¬÷Çc­0ƨà^¸ûÆs?;úÝtCä78æêÒj R܉‹ {‡$GÛ/ õžœæïË™Sñå +©j’!eïa¯í%L?ôÿø þ/ð· Ñ@"‹Ó‰¬PÄoô½aÉendstream endobj 352 0 obj << /Type /Font /Subtype /Type1 /Encoding 428 0 R /FirstChar 97 /LastChar 115 /Widths 429 0 R /BaseFont /LIQAHK+CMCSC10 /FontDescriptor 350 0 R >> endobj 350 0 obj << /Ascent 514 /CapHeight 683 /Descent 0 /FontName /LIQAHK+CMCSC10 /ItalicAngle 0 /StemV 72 /XHeight 431 /FontBBox [14 -250 1077 750] /Flags 4 /CharSet (/a/c/i/s) /FontFile 351 0 R >> endobj 429 0 obj [613 0 591 0 0 0 0 0 302 0 0 0 0 0 0 0 0 0 458 ] endobj 428 0 obj << /Type /Encoding /Differences [ 0 /.notdef 97/a 98/.notdef 99/c 100/.notdef 105/i 106/.notdef 115/s 116/.notdef] >> endobj 336 0 obj << /Length1 735 /Length2 1135 /Length3 532 /Length 1685 /Filter /FlateDecode >> stream xÚíRkXg•]]hä¦XlÅÂp‰ÜJHbB Y.I ¹H¹Ô É@&Nf`2!DÀjy¨@Ë‚]0ò 7i×r)«hQì‚n°Š‹¶°(XéXwŸ¥?wí³3æ}ÏùÎ{æ|/Õ6x›¯‹…øJ¸1h .à/ å B¥úãHÀ`xy1_e<À¤ îV/.“A¡þX‚‡ã¥àäï¼Dâ¾r‡Å ˆ@B ÉI 1ˆ{01 jà‹ @èÒ  ) < ’Ð(  Å ÅÃ(Å}ÉÃÎë¶D™ðJ‚pi p"M:¤E †"j@ÅQÜwcä,ˆtòß0µRœ¯DÝ |IžÌèW((‡õ/8&OPˆ0 „£+©Ðkk"H+å+Q!"°ØG €þº+ø° ’ÄX ĈZîC¨d¥ 2¶e îaA¡QáB×åÛ\†‚A%ÂÔ ÿ]â.׌Õd68¬öÒit:ƒ$’ý+FñP1&Qr؈㠚BîY±C F% €T¤_wŠä€Œ$ ˆÃpÊÒe²Y€»‚E6)¿þ??LuÈÉܘlR•Ád6=í߈b%ŽC(±¼doê8˜Ì ‚T˜2ü&Þ¦•}~!»ZÃ;}£f‹_ü×ù»/Ýj[›5ô©RÙ½3Ñe¤!r¾¶ÄÂtl͘Mò‚•âãoRCzùO2ó‹o/Ž%ÅŒ•¤4[EN—ˆÔK°›Í7k½0øÓÛ èæHOuaTÅÕ/žvŒŸ v {døWÛUí{“η—j=8‘üäÜ# [¶Ú†š'Vç²rôÉæ…'Vëû³4²£&×»SØ7Êõó§Ê ÷=oên-[@®LýPÏœfÇ,¦ ‹ÎÕýê—§3Î|¥-Ø7>hjz6áRn ÏÚjÓ5Aýˆï§×ïYÑ7^Ñ¿}¦òýDÏ8ëBgÞ«OÍÍôôË|õ¹ËãÉʼn B6ÿŽcE¦eu÷_èáà‡ª†ìi{§ézí“w¼®;ù{ÇD°¦}>Œ SœÎÙæ1×V™øÜ¿È³ø`N Û¤•T~ð£Á„¶ÆîÕª„VcàwPš_´)mà9%šyäþ‹È)›Î§¦°ÉTñòN1ui7G\{‹óòB+VX)™xi¤ë3 öè;Ã.ë¶Î¿4“}¥Õqržw{Çl›á®1ÓXYPVGÙÜ=\•‡;=ï“ë‡õÆÂûœÞ®:£–Ñ™d)¢ão—M;¶ét_Vßfì¸Áh½n]Ùø:ÚåŸÆ¶í‡Ë:œY9gx›Ô7Ï·ñ ]Ï9x~¶E`×µñÚ¢šeÄ9׆‹°/7 ™¶Æè»‹‘;­6\2%bŽöœÓHµûm/Y3ù…Óû³öýYÎïüÐ^—$e*7Ï £W<ÛÎFÜÞúœeVWö=O6À0Èôc5ÄÖ×Vl‹¿ã¥Þ[,~Î ®¹?U”›ã5“]a½¯$P³öYÐvjøQúÙ9³µúºmâÀÁYnZAœðè7S×V$",³âtìwÃµš¡Ÿ°öìcÑÞª{‰5ÉïOÍêíÞ?8õEÞÓþ¯Ï`”[öíIBÃZN4Ðß—òUáƒÎ[õ·N[»²UX¯v¹ÑRÕ8knùô mP“[z.¢ÑÑ;÷ª«Ê8;@qRú Bèü¸ËÁÝääé{SávfÖTÛYî1YvãCo©Zx.j®®íxêy§û½£u1ór·""ömbv MÛvTiRžè‹ÁÉ‹)¿if›x¬}äM¿LU›°®Z›ä×ϱ¿² ùlb°GJ;~¤ïÂpi©¥ËÇ¥ÑúbxÇHXyN@ÕþÒ@ó9"|Þ_¤U¦ïšŸyÔ¨ŸÑÙxW$ì»Â=ú'¿"lUjÕÏùÏz½wÈøué{›w.œÉÖÑ ¶Ü«þ{ZSˆã-›0µd(¶tݨ¡¾¸3:R˜èàZ zz%9Í)n¯¶L×UuÝMwùh(jB–µ µÇí½Ò7ÚpŽßåê¥/|Ji‡Ž³‹r·°.ë lø1ó^ë®ßžn­¤Q¾/à6ÅUz«Ä›/¼»©¼ù”Ë)«‹ôÿð¡ü_àB@Œ@ N`r?HùÙÀŠ®endstream endobj 337 0 obj << /Type /Font /Subtype /Type1 /Encoding 430 0 R /FirstChar 54 /LastChar 54 /Widths 431 0 R /BaseFont /TORYVI+CMR7 /FontDescriptor 335 0 R >> endobj 335 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /TORYVI+CMR7 /ItalicAngle 0 /StemV 79 /XHeight 431 /FontBBox [-27 -250 1122 750] /Flags 4 /CharSet (/six) /FontFile 336 0 R >> endobj 431 0 obj [569 ] endobj 430 0 obj << /Type /Encoding /Differences [ 0 /.notdef 54/six 55/.notdef] >> endobj 191 0 obj << /Length1 1094 /Length2 5656 /Length3 532 /Length 6371 /Filter /FlateDecode >> stream xÚí—e\Të·Ç é.¥Rr†Bº»CRbÈa†¤CºA$„!¥%¥¤¥»iIAi”¸sÎÿþçžûòÞW÷s÷~³¿ÏZë·{=ëy±Ù™u øäìá¶e8 Á'(hh ð€üøìì ž„3¦hƒ€HÄÅrÞŽAT\TB˜_B•P€»ûy:;:!œ \$rnOg;@ËáqCiØÙ@p;gƒBúTxô!^ϧ{ ¾€ÀÞÙ°…8:ÃðA8Rƒ9Àà-Û{»ÿ;ôâé…2àD™ä ,ÚÃaP?€=Ĥ G½ ‚rò¿aêŸâÊÞP¨¶Ûòvé¿ÅmÜœ¡~ÿ™ws÷F@<Zp{ˆ'쟩&™Ó‚Ø;{»ý3ª†°:ÛÉÁ¡Ÿ8PXô_ËÎ^Êξ{]g„ÀÁêùs³ÿ§Tóþ´2ÖÑÐPVæùÏ]ý3¨kã Cú¹Cü¿³ÿdߌꑧ³/ÀœÈÏ/€JDÝÿ~²üÇË”`vp{gj,DD6žž6~ø¨ù@‘ @à ³‡ø ¾(Ç Ž@•P 8À=ñÿØTAÈÁùµ?QX‚à ±?„ðÿÅ¢`Há7‰@Š¿ U«ôQ•Ê¿IRûM(­ß„RÑþM(¿H ¥¢û›Pfõ“dô›P*¦‘ªY ÈßðÏü¢Jÿ†¨ZèßeÁí7¢vû¢¤Üÿ†Âçߥìõ7EõïOüï#"/÷ àð ¢ÚŒÒ€EøƒþK¢·§'†øó ¢íßìàŒMÄb‡?? ·“ŒpÉlˆz¬T4QŽÅåEŸU1ÒY—% ü¾"I>ãÙ8na¢jä÷}¤_UJÒ.-"ͽa8]oêãÂÒÿ´¿ þ­ÅÚ¥Üa×üP·gZ‡¬¿#é&BòBžRF'èv[¡Y²-þÃÆ‰zëxþj| š-á3LéÊí“+ǽÞÇï[àxR’¾†äM<ŽwÑU&Ô<,ü—'¡C¦eóµ,w÷Ú¡ µCî¦ý Îæëgw‡Ë-VÈWoå„/VdÌ 4×€µÏô' I¤¿’*z&N›pWñ)•œcSª¬3ntw°®ŠwM¾7—ÕÏlowÔ ÌíÛfì Öqô4¾ÇÖ˜Þ¬§õ¨™ ,Þ*Ïc Ý^¨À!;¸”Ì#R“ÎVnWcwžÙv§(øðv5¨6¨Û2öšÞJÁ²À&Û"¦ª_2öÕªÕÓ@s×þûþø„‚m&…ZÛÙADϲ»á§ ”8]÷S®ð4xC'kÕ Ú_ í/Ñ|7øácWâMºþÄRÁË7’ÇO’­I5^íªÔWŒ'ª ýô·ž¬K’üÙ£VcÛ¨<=W[ž«ÇFÌ ÊC5×íÛ¿>#G4vÒ†p㫬Iðúê½úŠwý©ÉWW]ñ(Ù¸D~ñ‹çÔuobž½ÓÚÛÈÄn}Ù "þw³½A< Âí»ð‚5’²²Øsn!©Ùåaº.Á‡ß{°·dù«U·E²«{œ^ŽV‘QoºÞÅ£ýÔ~×ÊÝeû66Aþ—t%õ£ÒAÐS©ÐACQ½«U»ØAà÷Iì‡ávÆ9]"n!³y]®QåäJ,‚좛 Ù}ëK¢3näþ)Þ E‘xâkócZ¯š¸ã} "¢ßî™vþú´Š\Û°.ädùþ‚¼pÂ)ü`5‘ˆ7m²z”}݉¾ð¤ þ.n5WªÇ‹qžö°H&Ó¤Ú{pmȆS®<9òNŽˆŒl¿Ó„’ÃHg¯‡ý”{…+ÃÝtyqéµSë4Ôžf‡A—Çìú“Õ¢Éaz—ká:jc´oj?)ä™…»¡þ±‚ŽAê#ã7ùJ²þ¯ÓiƒÛÉ)?]°ÅvGi୫Ƶ sT%8}ù,„5ŠƒùV^ØàÌ1bÉ¿P2²;$øi¼{¢¯[ù¼Pabà¶ÐÙ±Á–â¤(˜ TuITC¯Ê“F4íØðúÅ=Õ¨Î÷8âîÇ#[9Œ¼hU‹@εI 0Mg‘õªÛ„¨ÕEjTDxÛv_áóOóµ`[ ¾å€Ê:áùŠr z²UŽ‹†#þš—óCCÈ'e½ÉY©sÌk‘Àh¦56pEkªr °§Ê²pßÇ¡®¾õ…‘žI†í6ð[Ç‹måôgöFo|b×&*ÍZ½c„’Ìè·›ËÑ‚44U¬¶ 9õÝ%"ÔSÔêÄ õ–àÔfÒBo°Â’7r¤”U$1÷¶|[÷–µ¥,Äç7&¹37=Þ^æêØyE«v¨ÕejfØÍ¥È2J}U–Ãr“(¼ÖdªÞÏŽÛH7ç”ð Y¶í@D›&3´¡ëpÙdès$y#¹¾­>—Ì"Ô5ÅÂEò<ԲŦh _c£‹[¡Zצóº®ÞÓ˜ŽäP=寣 0t]ý†39õÝÜú¡Ôu=Vé7 6`+‹pß—¡²ûè|nÊt ¥{:6¿ £aäül–YQ*µ@D_ÚTþ;^ÒþµŠÈ~ä-…ÝßíuÆú =tŸ/² á»û›cuµ¹”mIº¯csÛøÔÌ5vbüzƒˆq26üýöüѵ«vXƒñW#-”…ÞsU÷Ú|L•‹=[UºÁ*ÕU’¿ÚÒßóãv¼æ *LÕ‡w"4ÌH™§1AȨU’í`«1÷)J¾E2ö.‰‹‚S5®Ù4ÆNÖK¼ÛßNÚÌaÃC ¤ùíØÈ’øC©ñ]Ò Æ‹Šâ”:8^È|¦Sö½šû軨&Wb¼0¡ˆ{í µ1à8ºv»³(tA{ ïyÀ¨¢×´Ìæ‹e˜Ñ·xwÄ5(œÒ®ß¥Pò¼”å—Míà5úJ±½,Â%<ØJøîlöVþ£Ìº|µ;Ĥб’m°å®O¢˜šXMLF!ä‹6ë$‹nùtQ{N1¦çàVqÇþjÁ;§#XRYTâka}ZŸwÊ:*8ž`ÒÊëP] ¿p‚ã°²Ü+‡Á° ¯èûQ&ØÖ­V+FSL¦òºÚ¸÷f½dÅÒ«QC¡œ¼9s·Ëxõ45ò‚—¾”q͹Rª„¦lU‘Ödôn‡ò‰„|U&O$ÍMñÖ)t¾ßÓÏŽcÐõWQ[—ømb‚ÌÃ|ÎT:ë Û‡Èn"ÃÅð½öBµŸ›ë­®Oî»Èa캔Z±Lq¦qÁŽ_‹]_´ñš‹lû˜ªñY?i=0œJ:¸ðóv.þäì>Ðô˜±‘”Ôäð¤yÇçìSð¶¢ëF²‰ÈÙN'ði ÀÈÑ8!ñbÆ›14yñ’Ë7f @îÒ*T+°‡–b¹E·Q;„¨¬zx9 د ð‰Ö|nvýúb¨wн›:/™3k”¬-©»"»‰¨ ²—Ø„¯Õ%4÷Â[yAå!˜ÔÉ"`á þÒÌOγ¼e…I¥l á³ú€Rï6ïX0 gQ±‘´׆ҡûótŸ‰GpÒõ.²gd#©H áª =FÍݺ#PØTjyfûmaL—By¡¥¯µ#AÆZ~œ«ÇšA«‡U¬&Î,³BÉ ·o5nñi‰áè­iŽZ¥Í~dÓ¬÷–¾mè—±·üdE@wë_‚ù-7{”@ÊŽ0=Mù…»çS– ¬>ÁVŒ5eÆ–üU…HËë~…û‘e%ɪB–ÙƒÉ÷tYŠ<\Wi‡_µžg¿ Ñ1ÊÇçiOLüôõ¶ß^~»y‘óY˜KþÜrÀæe%‡¯±X–:OáG‘¯ÌÔr# â—Bžæš6’’'–õ+å Õ‹±w)ÁàIÙNÝÈ“%S^"Ã"^zÓm6…’äá wDð¼äÕÈ—“{[žoě٠çÈï+Üzªaåw Ò¬+S’B × ™_.g¾›ÆÉ=tÒô “’Ù?üºd?Ü,ñ"¤ÓȃfP¤o“vÚ›µá†F› *ušH|C븨I V†‘ûÆsµiÍuëð¡÷:;¥r¥9ª· iQ2ŽˎƬ}æ—ËY£?o3Ý{i9RMåhv’ÓÊÓ‰ºƒ¸6ZF±&¦ü+R±hŽéàx¼ø^ƒT{DzQ³mÔ›'ѲøkKWUí6µz[f‚“aL<\­Tð²Y,6% Üj2âè œRsí_ 0®º~E´ø+ŽÕÖØ±óŒ>´ÿѦí†kó¸DwÂ(–Pifh‡µ›8 šyù!÷ñXÎv”\“†Šuðí,šº=/5i{Z®Å¢P4rÉz]0ÂÕÞ­™—?€êc¾iÄ}gÃ6›ææ‹‡„VC½¡Ì ·Y+ˆtIjõ˜“ð2×µ‰GâzGOÄ«kŠŽ i7´OmÆ?Þ>LÇØ)PoH£E\@;¦(ÄXÚλ1©ðªÊ{ÈýûlŒnb”¢[*OõYéÞŸ1i `qŸ×Tû€ßÉg*€Ï*(çÍk'å•ÊíËÿ|öa;Bäâ•=Èž¦½QEâ–J±¾:"޾kƱL¸XÀvr8å‰rACÎå±ãÚ»cž=ûΪì7ðÙ¨ ÀÅÂËÓ-û ™¦´ órØûsþ‹†bF÷(˜¡<æ4)ÑDÑqÖ¯ŽÕák°·qqyùÐAÝ]å—ã²—ÁKÀsÇþZjbÃÝX²³ê©¸ùkµ1úêc¸¢ˆ<ë$øª2ñK°‚iÄþL>½Ô]{wÓÇÞ¾Ý\\ü.®e?¡vì³iÏËù#Ž3˜’9ú›r^©Î·”U— ÖþÞ=~Í•‰ýÆÁ,Ì–F³þÚÅnšç‰e XÅUDXW~Nƒ2;ô0h¼¸š¿á:ˆ/):‘ó~¨¾»”Z£ïhÖ–ÔØ(£Â=‰“žÇKx(ÈO9fËô8ðÇxTÁ·Y‚XÅË:_Ò&j²­ Áh1Û~ýè^}sŒXÂï7¢äò5JN÷…ˆ›dI´ï*YJn®‚Vkü”õMóñ¬ä4Ç7±œá!áG9 À…t­t䌋UK5þÈÁò2!Íí¡Ý°Ÿ*Ã]~,g§oæ½^5\ÝßO­Æþ`÷ó•0Á欯_^9‘ÌqÅÒ#q€¤)½ó:¸­,Ïg«¨ƒ­}ïÆ‚v#Dà[96!†š×;$ñªsѬŒS­¡ooló4IšÉ¶÷mÉÓŒ,›œÐ‰*Àn…‘ÒýÝŒ2 +'\‡Hqé|⼄Tn»–¤#…VÀQòÄ„³¤Lçt»¾j‹£ÅæuØ௽G5SQ&'ò]þIÊAXÉ5žÄ©ÿaå9;÷y¸É¨m¦˜™±µÝר.ÂËÎ}_ê4Ô™¿»X|F”Š"~bjj誙̂&®­RñÁ7ñ9ùå2sRE¨aYÖ^YLnSþлYæw4âá‚S‰±yG4‰Kä¤xì,Ÿ†iþúKÍ ZJeÓ¾¦hiçM—-6VÏWQêæ,ËRÅù°Ì/èß²oj³ëýŒ·“ø˜—Ã8^d¶=ýh±XâpVÅïúI‚ ÛªÌeYÍóhêc0åA{)©ÂÐaí=Ö,ö= K‘.x㤤¦]ýø—Ýgß—`Btžù®ªG¹»¿Šß6ÿð!ÍL¥3Ç—•a“¾çBLï…F PwnÆëð22±,¿G3èÇRD?0K“¨É¦Zèm œ³ZñMMæ|Ñð ì±i×)¬$•X%[›¡þ4y[Ýöû é_þͬÇ(Œ›/¢Â(ÑÚ7w«»¤2­Ñ~í=ÝbžIEÆ‚¤ë&íâÆ[NŽ® óÒïÅk:©#D¤ü­ÚVÜDœ5IEz3ómá·k“ÅÑMç¿Ôeb÷5] aÑ”‚$óS} å!:"ãOé°¬™çò÷\Š,¤Ju¤|ŠXÅÂ0ô£´-üßÐVÕß3q :OûÖ F|Ê™ÑÝÕ-j¡§a5Án¼Ë?$ñzBÊ|ÞÃØ TÄôr»ÀÆBqXÄËT©WîDür"?¬ä‘­vxJ¥³C D),+žéÎN~ò!{ÁTíHMB’ˆž|CÕÛÈ#Þ¾Y‡Žš4f³äQ òŒe75fÿ˜P&ìÛÈ\°{}Ù ø#S˜¦ê~tÝÙçû¦˜”ѳؖóKÑW=ÊftBïôËÒE ©vŧí÷ å9T>w¾¦ÝÅócÛ~m‘GªN!–||¬š˜p.ïÌ|=”jÑ3™µTMŒaÏeIÙšqyª`­4Ê÷«HŒ„Ä„*GÅá q©&ôòXy)î¯LhéŸ6`땤Œ¤…”NP`Ð<Ë<¥¹¯D¦Ã6Á>öètéÊ€ŸTS@=s«n4w?U%ItišÕ±²’éOÑcÑ'ÐNl+š˜û äûÙD8¤ ZV‰S?'M\¯H¶­c4;óñìCoO¥ÃóVËW¨®ewîYº¬¨t}–6#ÒSå¡[ ¥=ÙÛ]“èÂsE†²ÌZ[b½Ö¤u5îHïmÕÚ€Ü?jõrŠ gâZNj½pìí¬^js³L'Hì•]HŠ&ˆ9òøT#™žñ1£ÊŽÐò070ߥÌ6ìMSŒ’a–Š £ PWöb”µðô{1̊°'y´ àã´õ¢ì³? ×; óENü£' .úœŠ)x× ?—Ó`þªkTn`‹[¿T ç‡ k#öz÷l?½²FX}þˆi 940ýð3”ƒRÔ{ŽŒQl+‰*ç'U6 ü¹Ü‹¸—ð‘-Rt w˜Iõûö&¤ÕJ©$½ŠÏ¨¡¦Ø¤˜péÐ¥¿f£Ì9á%7\„0¶1—2-ŒœÌUñägŽvõL6Æ6u˜A´#< UEè©Cy?}H‡L£MWù¼âh·YOpx;\~Ý?SSóÎm ~Gðxu£ò@;;Ô¹²S“‰—dé%æ5ïU2koŠd迺nqtxª~ö^2žUÖŒíw Ãz±9„|G9SϸéÞq(Jƒyb]“ØyÍwß¹jU¥û@&äÇŒØW;AIMé•~s|®Ï· üÞ˶ÄÍ} %œî¯ýx‡9âoÕgïº0­Ju>«Šy'$ô@@ ¡Cœ y­úfDhFò©Yù±!.Ã.º°k4ê7*FQýy*rq@h‰Sæ"áÐ._$£´*ÚNµè½ÿ.¤ºi‡8]¯H¿'G{-'7ÆÀ‚À%(A^}rœÐvpúðµA¿‹ —Eù÷àwå3š£Ñý}‹ËSqÜÜÅÙ2ŸøV?V[D6Q3µ¨oµ›ñù‘Ü1<› ÎÂP1ß“FBнŸümÌ4-Ô}‚ü>Ý{9—B>¼'È\ÛEAÒk…pöÌG )XÝf%ø– 1‡Kõi ÞFŸ2{ÅÌqýÔ^»âPíxõmq„­ôø@/ãÕ¯¯–µ{ù~r'ö¿œÞ£ö„§.}TÈ3­b>4ߎE­ÏÝ,¼pšû¢ Æû×ìK‹Thè ’ï©1K è_ý*~ôጬöã¿4;º¾®Î=h€øÑùM¤ê|£pq·cŒBÙÝñȽ¬Ž¾*X¡ùéP|Ò£"ÄÙW2|B“$¨t_jzñM4j85÷)góÛ=h„´ÔëèUÚ‘«µLýöºó”¨fÕ¶-.®î—·ïw‰ K‹Ü?æÖ G0wîíû&û¬õø]Iqñ³hø¼w‘Ç‹~eü[¯.‚„ð_‘#7鹌6ûÍCëÖ©Æ×/‘b¸—Åý‹vÅüN”,œ;NÌ\ÄsºI]ßqR‘ªIÏb†K´)ûôõñøÿ‡þÿ üŸ°ƒBl<p7OWüÿ ºsendstream endobj 192 0 obj << /Type /Font /Subtype /Type1 /Encoding 432 0 R /FirstChar 12 /LastChar 116 /Widths 433 0 R /BaseFont /VOKKFF+CMSL10 /FontDescriptor 190 0 R >> endobj 190 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /VOKKFF+CMSL10 /ItalicAngle -9.46 /StemV 79 /XHeight 431 /FontBBox [-62 -250 1123 750] /Flags 4 /CharSet (/fi/one/two/C/D/E/F/I/M/N/O/P/R/U/X/e/f/i/l/m/n/p/r/s/t) /FontFile 191 0 R >> endobj 433 0 obj [556 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 722 764 681 653 0 0 361 0 0 0 917 750 778 681 0 736 0 0 750 0 0 750 0 0 0 0 0 0 0 0 0 0 0 0 444 306 0 0 278 0 0 278 833 556 0 556 0 392 394 389 ] endobj 432 0 obj << /Type /Encoding /Differences [ 0 /.notdef 12/fi 13/.notdef 49/one/two 51/.notdef 67/C/D/E/F 71/.notdef 73/I 74/.notdef 77/M/N/O/P 81/.notdef 82/R 83/.notdef 85/U 86/.notdef 88/X 89/.notdef 101/e/f 103/.notdef 105/i 106/.notdef 108/l/m/n 111/.notdef 112/p 113/.notdef 114/r/s/t 117/.notdef] >> endobj 188 0 obj << /Length1 1100 /Length2 4729 /Length3 532 /Length 5442 /Filter /FlateDecode >> stream xÚí“gXS[›†)Ò¢4éÒ¡—Ð$€©ÒI !T  ‘î¡¥HG& H•Þ;ˆHi ˆÔÉ9ß|GçÌÏ™_sÍÞö½Öó>ë¹ÞõnkÆ0q g¬#\‹Á‹ƒ$@J@-(ÌÀÔ$IH´pp<‹ÑvÀÕ€ EEPÃÛ(MÜ—Sƒ”À2 ÖÇtqÅ…µ®ÿ)’j á8¤“uÀ»ÂÑD'†uBÂñþ@  hòg…ÐîÇùÀ% Ðé„:Â]€äŸ™ô0,Pþ_ËÎÞÿÞò㼈¡€ÂÄ×ĈÎX Êè G$ ±Ä³àÄ$ÿ¡þi®ëB: ÿ´ÿÏ>ý7…‰òÿO íá‡ã€P¬3‡ù§Ôþ¯xP¸3ÒýÏ]=¼ é¤qAÁâŠ`¹-#½t‘~pgc$ÞɈÇyÃÿZ†cœÿ™ƒØ½¿RHBÍ¡Pý;¢_ì_ÛÆH ÞÔß”ú¥ÿ‹A¿˜Ø&Òh-%!%" ‰ï¿¿lþqœÆ ëŒÄ'CVè€Ã9øˆ#B$Yà=‰q†ûá~ÄÈ’,žX$v†D`q€?ﬔÄbà.þŲR@I¼/öo–“Jjý" ¤ö/"ÖêüMòÄJÝ_$”ÔûED¥Ñߤ@Tÿ"i ¤É/"ž`ñ7GGÒáo; ÿ ‰•ˆß ”tý e’ÈßhŒú ‰‰Ð¿x;’˜ßxö7$:ã~C¢³×o(GlÙoHÌìý ¥‰VþáMM¬ß=qâ/-.-#”#VÊ)Êþ‹Îɇƒcðý‡ÄYû7#Äá„ÃýàN€©q¬“r˜[jmDQNÞ`1…p>ÅóŽjeÛttøÐ!×t·—-÷ Œœ‰"(•§sµ'r…ëÅLÆÝqzŸÐuJ¡º¹}v¸qo:p@3kúâÙmPMv¨³i²ûj`×axE”VøC4 K" VŒÄÖp,e6nï✌ €ÞÊÒßÏ5žZóî 0|Ü«·~¬Buµêàñè«F²<Ðñû2óŽ™´)Ÿ/ë„=רUiÏ)²7q©Æv*דJy=6BÂàù¤Zý¨£ïö£3ÝÉ€èúö´ºJš½û,/ [©Ø;›2¶5- ®žGv_jrÝ6îÊJÔQ¥÷ׇî>Ý.$¥8R»•Ö]¬µ ;à`J82[x–SËi1ÿÓ½À¥0/(ÿ†”ŸŠ=¥=ÊÞpÕ°(3>N@ +,X”¨rSí(íà=KmU›Ö¼“‡ÉÑ2I,µ›Ï³ój¡ÞàÉ[œˆ*òü=æ{–åÄÂL¾ôvËŸ¿ÿþ²å“cì>“Ë´{ÞÁl‡‰¸[ûÚ’†’óÚùéziyM²†>r@!åz àŒõd­ÓÎ(§®@ëú‹ÖÈÎ ð´•wÆÄf,üA¤¶Ù"†\ÙèŒÐ¬pdRïhR»Ú£ÃméN:øà<¦ÝrC¨m¡FÔˆ_4´á?ô)ƒËhHe+¢Yz Êù~ë^ÎçCú «š gvÐeèƒõ¨Bô­ý¸Ÿ.Çz÷š‚I)Òʤ"lÎwN‚®Ì®×|ÛëÔcïÀïaâ|ìuÄ ¹×HæDš'aÆäj­$0&hC#rN*Í]Ò>ôIà}5®: —Ð|/µ>e$Q~pxárÚëÜ{¼2ÏYxÖãó]ýMôÀ‹‚úO5…ùìÃëW‡l¶²©7?= ôëEÍ9ÍEËnù ñ¤œrÕÀ&ž÷iñn÷™(™.x_*…‡=ݛ⋸°¢>~|i>"ØxËõn´h…¹Ñ’D…¤@ò3‡5†¥îcÝêÖ;Õ«–<[2wU_ã•KŠt¾2loòxÒÈŸ4¾f ayâÙÈ„ðøš#i=wÅ”‡Ïq˜hiBámC³QøžgíèD±Âc’áux Öû –J 8¼¯ÂL¯}J®Ð—-íQû§Ïü³‘Ë>Ü[¿„?+X Dƒ~`ƒ_…dÞ¶„‰ÌJÕ‡Y“g._¡ÍÈ÷,Üa¶W½ y|ËQœ×þ[FX›DdE½M—4â}§»BW4—Kë%ŽV— ¦05Q±ýèUŽ ¾ïû••œ²”krWQÖås"‚wÏçzIƒ"ÉÒóR­.1 ¹µ}ÞL1°+¢Nw3-_m§‚ý#±ú«j³Â{9?÷«ÏAY6ge¢µ¯¦šåÌ.,H ×mO>A«wM§ìÖrb`Eã­sÓ}^:€ªm¼²Ed‡Ej :›îfNƒ×˜Ç~‹âÛA‰oFD÷Ý1Ok³ÉƯ~"Ñx¢ÆÖ]Æ–›($à ˜ _Ô ¨:_Lg–Å®*’¼>³Ûú2_ýGø‡¹½BPGT%w‡—1}ºXÚ_oÙ§°4æ´ÖÝÝ|F¢ÖÀ”øNzGœy(÷f½‰öP}Où—]ºk°Û,”|Ñ›Y Øœ—þÑ4Ø (½Ÿ1Ð>Í««{õ­;È%Z*ßÈÌâ6]«AD¬Cp»~:€¬òhˆ<ÑnS¢|z~²äÒ(jÍêþ’yªðî ½Ì­•m8«à¥Ób˜o™0âã ¯a5¿Y’{òú)Ã.I˜ä·äR‹¥÷Çí]64%MÙßÇö¦×øxf¾Ehj«ömþP¯‘ÂBŧ¾ _ Ì+ou5Ÿr€OèÛÃhgÞܽÔpÆjkäf3>n+±+ëÑv×®A…ÞW#Ó]|&Í.$ßÉ‘×t|U.løE—‹OƒzdçeÆ¥³ÕÁGóÖ<[Ëͽkzƒ1óB^µl]¡ªsNÂP;w¢˜E¾ö ÁHŠ•j$Ÿa­´†aÎgØÐ—-(]·­áûã’|›VÃ\]éB¿ Ÿ_w6ÜéRtY¦8Ø:¾jö=öÏý>?_蘥™.R×R¦Û£Çƒ=ÞyÇÒüd²ˆí¢ [§ÚÈX‹8¾tptšóá­½‡kòÏ;ü_•Dªì>ŸƒeÆ¥ÎΞ‡Å; Hßèà­´¯U1‡\\ÍL‹…&t4…¨ðLÊÜ;þJÎ~Ÿ£•ô­3ê¡§ˆb¶Ö¥Qÿš1Û×…‚fyC=H(L•ÃE¸ñésy¼ßÄ$3Y¹ˆKäAÈüi™lÜ‹ñåN:R#ËÞôð¸Q’áXš«Q5,øÁí™ÏTÚkø¬š ì OŽIâ<–ÒÏR8áößã®éåEõâ÷"ÞikboY°¡Qµô£õëËk3Ì# µM =£T¥4Y±Ywdë*©Ž”ô± …rµÏ1»ÅžÓ2õAG}ÍéÃiV¯ÇÞYs¾Rõ|õ,x”v\Uà6šD¬þ@)Då[K[Ì2“yúvë‰RÏb¥ÍìPŠvƒìWÉZG0™ßýÔˆÀ鹈é$}áF‚;e<Ð\ ÑwãSß½’¦Íu޹À¦Dg;(ê©Wºx°ëNcÐ&ËÿS­Cî~†vò°Ó y;]Q̲–µ'É]º¸Žïb-H£gMlýÉâ²1—¼ –‰·Z,ÿØ]ù”ÊQjìÛëÁ¾wu¹|‚J(ƒ!Žœƒ-©èV«®j†ºóØ•í5ÔŒΔÕJ²pYêy™Î8ʇ’€‰`*)é #eûŸ•¦¹UŠI'ôø~µ­H"ï·dø¡dj^HeTã(zÅ=í'G_ùóššîÔJm§"èȨ8YD‘Éœ ì Ìý@¢ó ä“ÌZ$X‘a±•öbÝU¿SzüA´û(Ï&½› åÏHy¸»×|iëXÖ=¹›¨SH*Mgï6`£04ÜA;øÃà\Ö‡]~§©†š½‹ô¬¼‡h¯è½åÅa‹™k¢*®¦ž#o·IÀ52[jb–\ÂuÍ“õ!÷|ïõ+ÛÉÆif÷þsB­½7\oG‡;5u¯iNM}C¸ïìYg½¼yª±¾¸“8VðÖž„ŸÑ[Ó€T:JÓ$X¡Î”ŠêÐsI:‹Â8°r¥†p>\z×{å¢À“V´rw”m蟈 .µø}fP@B ØÖ2.ƒ6㵑ýò®€J0¢ã¨4ì,K„ZÜZ¶¸¼Ý%‰÷+G7oτцòpYtG¨AàqN‚ɳÈÂi5Ú¶UÅ\áËO¾­»ºbB/Ùõ×í¨v"q-\{6|çyóŠTé;Ý^ëḲ,xøsÿ¹ô’ìÈ÷z™½C ‡¥±÷p­÷„÷~–±‡"£U,”ãÑnc æ)@ÂK1Æ­;¨r‹½$®àöCP a Ÿ8\Y¬8·|®üÚÖsnr•õ“¤#  ]§ à©ïÂ÷’Kk•Aq#=:qÀmCñCêuÞñ ømz“¯Xœ¢ãŠÔS`‹‹zy°€ý‚ôz¿ä‰‡’ãøéä‰ïýk×¾luoSø|1°l&e8|z•ôb‡bDç£ëº/ýä‹”HÍ«‡ èšà™ÐvItõŠlöyÐ'W.Ù[#ë ÑrÜ w˜Jú»„ètL•¨Õ¨Sð3FT~^Jp¹ÍxÐ7ø$F¼ôuW˜±Þ:" ù›-fуµw¬}ÉŒú²©ÙÌÞZíQŸäÒ‹•Øù„©LöwO<5±ã& û—|Ä‹&¶" În6>ºðþm±2Aø° Rþ0†Yer†ejŸ _ ï%}ÜU¥s¤Ýå*›!ßmdE)e¡¦ÇZLy†KY½]vÊ¥mu¨£ô"´ë™u0SMÄÓxɬv†þñ²›×[x 8“…¢n«g,@W”ÌåH¬b‚ £Ÿ½ÉO Óä šI7°S“u†dGXÌiF–œOÕékkG3RýÞö“‰õÔ1Þwõ ît±¬PhŠmÓølˆUTœL×ïyK¥¤<ì!ß:= 1àƒYšÎ˜Ñs–çÆ¬J¡>pÝÜU3©Gæ²6®ƒ•úiÕ5}=¤æZe´²m_Lr§¸FkæXËŠ³G¢f<",vÃ8Õ$gèå®aRÆÃWA.躙Q2çøRoÙ´F°*×]3›&tŒ ’À7(<Ñt Ù+k,¼-Q( «ÛÞ‚[åLÜÉuß™ì¼HµQûÊu¶#˜[@„ÕbÈOûJ^Žüê7#í+Fiîæ–Dð­ 8V6µéÁÜTÇÆRž[!jCraç›O¢CK׿vø®ó *¥G¼±¾lÏ’í>H¿ÿºßÅ\æÔ„ßÊ}¿û½bxã^¸õ¹3nÕ¹ªý‰JÔø©(ËÑàÓ‡ÁYTJ‘®A¶ú;Ù¬‘V‹€nÈ3“úåû×™5ª­¥—M×IǺ¦DÍw“㼚¶ÜµÆöëðÉ ¢YÚ!—TŸ/hg60úv¿é„ÝN&›÷g±¿ùq¤KI¿¹ÍoúuÞõÏž£ßù—ù H»ðƒiùO„¦Êù^Ò0ßç+0Í™èRÌw÷©ÔähØgIûñ›Û>ÏÎw»8¾((|cÙ3¸Aú-•†NczN£ù1?F@>ïi²gÈ‘ò>3£V®õ‘ÓA´EÿõõzU¨|Zí£ÚÏ—Òúµ·êù^ýX2CŸzÍf ˜ ’"CÃná?{~ñdúŸ¾¤`g¸ÕÞ(v¼¶a°YæmÃ[)щÒR@pGð/m©½Ìӑθ™ëiU&{|a/‘âv’Õ_}Õúã&@È)÷êZ4ÕM¿”Í“õf›Ëþ×kÕÆ>æ“æ,ºE€µzÞ¾¥þÄ2¿¢_  «Ô*~aÆiZÍ×vl´I) ­PÊ%¹AXQ(õD\i¹óš½ /c«OvP.7{¶z‚vU·zª¼§Ïo%³l_=ûb wÛ/„->Ú»1ŽÖìÒ(?r°óµ^ÈI½Ó{Ü”fƒé:â~Pž Qà,Ì'-–b[È.U¥ê¹Õ×­GÇŽ€w{ÁÖv•¯*-»Åžd¿íä0µÖZ~GQöQÌh¾_ù¹½Î†Hø7'ox”àKuôÉ\½Ë.!Íã”EK«ìØUçË%Cå.%G0 V§]Ü×PUÈ2¶¬õí¥ èdYD•;¯é—åÁæ„@xcÏ”ýª«á¬ÿö'j3…$1›»!èDF½õ¢äæ¤Ë;GV[ñ½ÔP¼'¥?Ä0ùÍtU¹îÍÞ‰'Œí6¬ï¹•,?§ƒ´÷v–ú3|'po Vœ"KR&PœoêGú!$8á?8o¤Ôþ Æ®§H¢ÐStY¦2:][i.ºßŽ7ÝÖ·Ëú6ÿ°šâ«}E. 8[ä Ö"O¹1¥#¹r.êýö¥µ[Í‘¯¾ùŽÜp:׿&Ïæ]ß¹`x†<ª2¢Öbëx©ŸFAcyö zß'’ðÀ²ûBm•³ýðÕÁçò ú2Kë=L†úŸÛmòE½|gQrä`MÈ4ãN+…È;ùŽ»>³"ôyÖË †̾Îê²¼)â Îz{½mûÎqÊÖq$µ ¼¦îü<@ED…6òèšÓ‚í弯#dªlÅ#Z—äÇÖ˜é›>Ygù#vÞØ5ÒŽhJL4±*/§y²7í íRžg9DeZÓ€ Nåð9£>GJ‡ç«;?ê[z»%«½›ct Xue¥ÏP$¨©ŒR¯7Ä£Ðú£±ŽËwÀsú9ï`É iwÂÿ¨HÏÏP(å•f…6;²1žOÄ€Ü=šÌZ_âµÜG“ÒHkºW‹†â­F©ÿáøƒÿN(¸E;àÜÿKGñ‚endstream endobj 189 0 obj << /Type /Font /Subtype /Type1 /Encoding 434 0 R /FirstChar 49 /LastChar 121 /Widths 435 0 R /BaseFont /MWMMJU+CMSLTT10 /FontDescriptor 187 0 R >> endobj 187 0 obj << /Ascent 611 /CapHeight 611 /Descent -222 /FontName /MWMMJU+CMSLTT10 /ItalicAngle -9.46 /StemV 69 /XHeight 431 /FontBBox [-20 -233 617 696] /Flags 4 /CharSet (/one/two/C/D/E/F/I/O/P/R/X/a/e/f/h/i/l/m/n/o/r/s/t/u/y) /FontFile 188 0 R >> endobj 435 0 obj [525 525 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 525 525 525 525 0 0 525 0 0 0 0 0 525 525 0 525 0 0 0 0 0 525 0 0 0 0 0 0 0 0 525 0 0 0 525 525 0 525 525 0 0 525 525 525 525 0 0 525 525 525 525 0 0 0 525 ] endobj 434 0 obj << /Type /Encoding /Differences [ 0 /.notdef 49/one/two 51/.notdef 67/C/D/E/F 71/.notdef 73/I 74/.notdef 79/O/P 81/.notdef 82/R 83/.notdef 88/X 89/.notdef 97/a 98/.notdef 101/e/f 103/.notdef 104/h/i 106/.notdef 108/l/m/n/o 112/.notdef 114/r/s/t/u 118/.notdef 121/y 122/.notdef] >> endobj 185 0 obj << /Length1 733 /Length2 1220 /Length3 532 /Length 1768 /Filter /FlateDecode >> stream xÚíRiXSW&H¬DYF«ëAGd‘ L€2 ”5HH.ÉÅä&†$$²Tê›@Up‰HmS6YTF¦€ [°,­DeëØ"j/X;ÏПí¯yæÜ?çûÞ÷¼ç½ïù6›ÛÒ¸¢Xˆ!B¤¶$Éxú3‰@ÄmÞì)ØRX„x±¥ Q©$@“ñ€=(.TG”o|®3ªÑtÿ8NÆìêjQŸ/k*žþÇØ¹@K¯Gï ˜ë4FÊ¿lê˜>˜h|:[o°]•Ÿ¾¢Ò¦FT+[=WºâlΫ¨Ÿtn\SÔCa!w{´ü^¡€ÏÎÌò±qÜUzüLUõü\E‘G‡ƒÆâd>ÒíV”æxWnÊîùæiò—Å©„ÃÝi-ç·o¬Y/QUð"!ŸK£:ðeÕøú+îJîÊ>êmÇ­Îê ½óP{Å]ZÝ•»î^}ûN!WžN›ÅE¾¨wL¨#,ÓîÉ=°FcÒot{ïùRaãÂK½¸rýä°×“·—c*©ÑÌDn^ÛŸqý=’qðQ^e-~m¡¦¦1¹+ñç3¢Gßt0ÙPÿqÓ ÍmÎ1ö‚¿¸ê™mÎ0‡Â|œWÜœñv·¿Öäá­}+é‡;ÃþÙ}¼#Ta{2–´Fµ²´@÷zÓìì ÆÓÕ@\Ðrã~Çë‰ ¸¶ÃÍçÚtXEl/+Vx§ô)¿µ :×ýç½÷ÖW~ÞdŽ{oøfSD_‰†&Éam¥ùO''oáƒrã¥ÎS“ô­Â¬ƒô\½ó•ÍD¾ß\eªH3±Iôœ¼ Í’¹>ùˆñëŸ(Äwë˜Â° Me6â¹SÜ©„±3.¯vé&<;¬Â§çT¶ZíûøÁ@ûêÀ—¡-†Ë¢R¿uÕÉž8màt6$‡Ð _ud¾¬<…pîp팅Ëy¯ÏSFOYÛ´ .GZémÇÖ}vôûéÝ´šN‡¼^IŒO0nidµVw[Ë$_uT§fæùÖ‡¾O.¹ç]ŽÙe1i¢=»s­Š2_þ·¡ï7 ôè}ÜǸþÜêÅ$U€‰¥·Ù%Mûü½¸;¢Ûd]UZG4‹nç¦Ïwо¨6ª«Ï¤±o©÷æZ5dÐͬ²¶´ZfåÓ©åUûâ™™Ätœ(iÝ,ÙÃwÏP3ÿ})ÜsùÈÓ‡†ÅÎZâ&öYï‘zçÊm}Ä)ÜuÌæ^y[óXÿè.³Û/ܱ®—·i{„89د©碧Tíj2Ó²rÌ”ã{ZºlÆ kÊ&èò oû¹téj¯©Mïâùµ%㑯ŸßR/‹÷銙êÚø¯>M««¶¨wåƒôÃÖX§ï.€@^zÌÏY5º;ŸQ/FðåODZî÷=\›û µõ¾Ÿ}:þÓ«Ä[´ÞC3³/M_šLéµöåϦìw¬Õ£ê×Ov°b5ø†IñŒ¤žýÒCú%äÇŽONìa5VJuÿÎ@¬Ùb~­áÃéHïˆ:‘Å*Ï5¦¶®²vÓuâæóC÷3”C4ñ¶‘òÎ*póµ­Ùïh¶[EªÊ9ßlå¡ ^ÿjÑ*uInò0盓£v´-c°¹j“+ŠøÉO0ÕûEö,×Ìg ®o#iúõ¹0)[Ælçâø»ØE——{™ñÎÅŸÐ9t{Ã?è{óâ\¸ÿ üOp[" Ù’}¸_9õ¨Ûendstream endobj 186 0 obj << /Type /Font /Subtype /Type1 /Encoding 436 0 R /FirstChar 82 /LastChar 82 /Widths 437 0 R /BaseFont /KSSHUT+CMR8 /FontDescriptor 184 0 R >> endobj 184 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /KSSHUT+CMR8 /ItalicAngle 0 /StemV 76 /XHeight 431 /FontBBox [-36 -250 1070 750] /Flags 4 /CharSet (/R) /FontFile 185 0 R >> endobj 437 0 obj [782 ] endobj 436 0 obj << /Type /Encoding /Differences [ 0 /.notdef 82/R 83/.notdef] >> endobj 130 0 obj << /Length1 792 /Length2 1730 /Length3 532 /Length 2305 /Filter /FlateDecode >> stream xÚíRy<”k&œ2êDt$äj,‰YËÈ“m„²M3ï0™ygÎkÆÇR’„G!T–!kHE¤e´8вU# ©£Ô:}ý¾ÎŸß÷×÷ûžçŸçºïë¹ïë¹î…tõг¦²ö€ö,ˆ£‡ÕÇ["Ñ‹Äg BÙ ™CgA[É`MM€í\€30ƼoŒ@¶,v8L æÚ¶: $cÀš Ât ˆdN0È× €‹B9áú€5ƒ¸/ÜÜÁP©ú, Ò)`D‡èMŽ S¹ìo©0‹´eêb‘TĨ ÞÁwÅZþ²~,nÏe0v™ åúGžÌ¤3Âÿf°˜l.„"‹ ÂÐT/ð«8"H¥s™?f9db 1@@k¨1ü§‡ÚÓy ՕΡ42#\ŒƒõG%bÿu m}¶ºlÕý{´‹IW2âÂÙ €ùÎ^ÄØïXlLç»1ú VLïo'¿šÙA•8¼@†ar8Bü‰ÄD`:DyÈ+FëC,Žø v&  ±`ÄÂ\Å£A“B_‘ €Þó/„Åà4ý;? -¾×ƆŋÐ3Àz8¼¸?ÆÐ0Æc¢þHáÂ0qÿ”صo˜F ‚<‚èédQÌîM¯9TmÇP"£ª–Qxðþµ¸ê 3ýQ¡ÙªGðå6¸î½BœÂ^z©|Ú¸Óy4•†®Rc)ˆð@Çu+V(éäfz, Œúú/iɾݼ’y&a¸Gc}Yw¢wǾ°k2Î#Xã<•ñDéâ®ÎùÉè}­Ï{äNQ7¼LCøe_uNw¾êK¾77æÀâ³z Z”}3?(~îQi~ÖòtE†iR6Qêq†ù'YŒÖߊÀf…hôxŸ5ÝîAX¦fôhgN ±Ö™ámQWëD|³lࡎé2cy»ã¨´m^ŽžÓª%¹«(Ū s‡I°²yW#Óº?Xév`UHåœùI,ûr*Ê=P4z¿ñ¨ô”ßÇ™/I*”¤Äšò%^º&Y–aÚº£:÷1*2‡Hrð‰a޵å6¡œUÒm柖ý‘u³DÀÛôñ~¥Î¢Ãzpˆ‚ˆ™ž³™¸K·ªVâkÇ“0õ¹ méÏ{ûúfcRÎßÞv·0°žÔ¥ÛRv©‰¿U±,^ÚOPkoÏßX»ŒÕ=`£Œ´PT3[-oí;H‚õ\oç%7D®ÂωÔK FgÚ?™½lKó\/4R–y«rLŒ´)ÂäÔ5§²Àð&ew~ÑJ§’"õÜÒCJ‹Š1Ãߙʦ–˜V¾ÅJåD6LY×Þ¢eÃÉ@…¶Ó¾›tn£î–½ãÈ'»~Ì Ô‡},ë›!,E„áê]ðf¾AŸÛ- Ýó "Žï›x×e¨ž€ Èõw˜ª°í~O‹þrpºÛ+§`W{w4\’ñìÎsºé@lC¾wƒ¹÷yM‹F•Ц³Vnz8)ÃðÑM”ìŸCQëò˜eJ(ªÒ`‹ 9H»g€¨xÃqj $¨c'²ç ÎÍ_ä§íDGv[U!9γyÈCÓ±†±IbÉ3éÙÉ´5ƒà˜3ÛŒ/å£Z>ÍuÝ5;gÞ÷pŽ»_ñîxbë“«DñËnÔ@eÚ¯|Ë[V­ÒÍBûùtó¯kãf~úe°j¦i"÷¨vsJþa‹gó›[wX¹ÝË -¼¬ŸqáVL]§È®Ö€·Ì°¨híÅV©äkpq4­äÌÕûv7_òO_Ùj”ëæ€zÃoïgxniÙ!4ÛÏÄHø9ºª Éù?Éì1šCü¾TóO«ôýùÞ|ÍÌ0‡Æ(°o½vƒÓXžårå£\9w“ãºÉ*׃ˆÍ·ñ¹¯úªñoÝÌoD·ßix±kùÏR¨Í_ú®6…lHñDp(·½pwòµa8|ÅIÆ;˜©muu“à[¬o!I5HÊ*É»á›C¼í+gNˉÚÞ‡~96Û6Ö ÕuD:Ñîé@Mø†Õ¯µmÕ zéÇšMÎIVÙÃ6>½ŠG\œ1Š/Û„ý4ï›ôÆ‘ªå êÕÃnqÜÙÈåv“ó{qsš4ß«Î?ñ枢ð„ætçÆòµE«DÚÒB ¹ê@QñŠ!¹X¯Ž²B§Ó·ç¢²/ß·²ðÕжì„éÄ™Ÿ‡ðù绎UÕË)rµôöMÚylêÖäV×Í£ï[–$}r_£tSë\[VJe|oi©ÿ 8#ǧ=¹—³OuZp)+•nÙÓØÅÏ J½*JÎÁa©±—k>çìD³%ë†ñíÙ¨Ô›²u™óFùiçìŽdFù^ê¸ú‚{¡ù2Jd\S6|± ÐAPž§Ó;ù¹îÆHi¿ʼn-ŸµrÖ¼ì|‰È*á—ªÆÂ»ªqÝû’NNŽ Ÿ ^-çí²)¥^eÛ&~è.’Íï;”p¶^‹ÿjÄâ‰<%#íšrWx²Þëèü‘ᢴV|RùÑ Š„—»I Ï#es|JjŒêj¨%ç6§à«=ß?;—%9ˆklS<¥ÅÐ~{õ“I¹òÓ)f„íñK%5DDÁÍ¡ §@Ç®=E¤3Xj4Av [¯ÈÆgt×NWádŽ×ÅÄ,U‰ÉåóäOž·r¼ª1ÿáBü¿ÀÿD $Ó ‡ þ•ŸÃÙendstream endobj 131 0 obj << /Type /Font /Subtype /Type1 /Encoding 438 0 R /FirstChar 97 /LastChar 110 /Widths 439 0 R /BaseFont /CIYDOD+CMMI10 /FontDescriptor 129 0 R >> endobj 129 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /CIYDOD+CMMI10 /ItalicAngle -14.04 /StemV 72 /XHeight 431 /FontBBox [-32 -250 1048 750] /Flags 4 /CharSet (/a/b/i/n) /FontFile 130 0 R >> endobj 439 0 obj [529 429 0 0 0 0 0 0 345 0 0 0 0 600 ] endobj 438 0 obj << /Type /Encoding /Differences [ 0 /.notdef 97/a/b 99/.notdef 105/i 106/.notdef 110/n 111/.notdef] >> endobj 118 0 obj << /Length1 1392 /Length2 7749 /Length3 532 /Length 8573 /Filter /FlateDecode >> stream xÚí—eT[Ûú¯qm‘âÜ%¸»»;¥„B‚;”"ÅŠw(î^Šw‡R¼´HqЇ›½÷ÿœöžóñÞOwÜäKžw¾kþž5ç\kŒ0ÒjëqÊØÀ¬ÀŠ0¨;' ( Óò€\·Êop«ÿ&x‚Æo‚'hþ&x‚Ö¿Iž ý›àw­û›à z¿‰À­ÿ›àwdð›à Æ¿ ž`òo‚ŸmnÐo‚wZý&x§õ¿ È—±ùá÷ þÿÚ’?ng÷Âõìÿ@¸ä„K¼üᎠ\Ãé7Â$7ô„kÀþ@¸†ó×pùá® \Ãí„ï’û·òøá^¿‘žëóÂs}ÿÆÿ~¨deaÞ~œ‚¼N^ž¿à øß­=\á'Õýï×üÑüÛBà2ì ¶ÆZœƒY‹…:¤~xS¨P0UŽÊ†(kׯÙÐõùvÈB¢cñˆš Ûj½ñMEÎê×…[T»¿Î¸âÑk—ø´/[ž/¶2|[(ŒO34|~8Ó]†ìã¶}˜=?@ÔšY-K2)ìÏ>ØÏ×f‘×ßF_¡Eè6ólìÎ 2VÌp4«gâ£ÕÅKs)‹àÿê…—ôåëdH C8ÆGöåX»Ç³›Œ¼ÄK„kk´èh7òˆywì§K‡RÁ-ß…8EzÞlälWæ~(kšÐ஦èúaúýNQÎÛ«å—9ýFk#õ͆ü×á ñÑ.Ppü‚Ä áõ—އQRÎÚô”.¼3$USqȲ¡MáFùkþ¨ur–§8b`Ùçcå32ôHêŠh£çG/÷¹q¦•Y’6½ÖŒXé2bKKMä’ÄÑÈ¥†üÂmµï±èëGžag³u˜ d½÷>6` KE¼˜s®ØL py+Æä¶“÷Q½ ­zž jž¥ïÿž±D)xºÒ ·7–µ×0 aç´ÖƒcùŠz³òKæj[‹®è¦§Zº±ÁY!â¾ÊOÃ:tc2Ç ù(A’â¥oe< 'Àɉ')ÑI2¨s;£iCüúèæm›0²_O ”¢‹¨"Á6ˆQƒ fÏRbâcljñ·ÉJ]ÖÌ_„åû ]ú™qÞ8l9§Úo½ŠÒ굺sM_x>&ŽÝ:k“™]¡Ê]¯<§Lyï rLŸÎ·RØè ó­C½ŽÄ}Z&ËÂo%7Çú˜Gp_¶Ë¼È:úN0ˆ›™Õk4ë?GØÁséè¶6,8fZ9˜n — ˆe7c=S–.3™É_Àûæ<± K„ç ú(ulVÞ©™Å£í2Ïcm6Ò‰3 ØZ¿º5·m›|1“áâ…7HlORºñÖ6ƒ?CPo/œ£iVÝÁr—×TÌ!m¡§š±¼â$vЧ¶$cû¢õ.‚Þß”e"¥TÐåµp[ÃLÃw;(úvHà²wÁò…ç¡8tÚ·ïYÔ_Fc|¶m „xu‘Õï=eå‹ö¹ñ\mÉ(¸Æß²‡7¥ êê…)ßÒ G”ÜCK·—ÂqÛ®Ú‘´äIµº‹ìÉËfy‘Èò4n8qvé^áIW]<Êæ³äG5Ù´t¿¡M< °j¤ŽzeCOþ„ò¾åyŽuO²½ŒaºÙ"CªJä@Ù7¶ãò«OlQ'êBîY«É¤øE®.¥pq‡0)j>Ø¥{°fÆDÛ™ÌIX^ Пi%æÑ¹zu AE”°§&èñ®²L¾ô1šiÚ9þœó%>^g¦Î¡Ñðß!åW¾Óç HšÝqN ý–ZWy’t¡ËÝçi*qˆÉO®yvcë?`ñ°K3Côméé0ŸaMcP”Æ‹1ÉÕ3+»O4_f¨vûOzÞp¯ÓnácšWvA‡^P×ÈïiöÒfÆÜjš˜)¹ð}D<‰ß÷#•u&|QÎÛ¨#äøõ}pô¸~Zó4†¡X/Š›ÜɉW¡æ˜aÁF7½É-c ÿ“pùb%ÃÉaCi]iåÈk/3’$™† B§«DJiîg&ÁWL’ƒ܌"Ìúå¯÷ 'Ê!ƒö™{rÍKdµ «ëþƵ·L¶óÜ´ñÏbù ˜Ð÷r#Ë’Õˆ6è`*-œ3_‚Ó"r0¯êx R“g:W­Æö‹o°v?¡ë¶îÛlgÛýå™@$`$”ÂW¢Ú&“TÙ¯KNiNºiÎAÁ–òR ²»G’'CöòÐÑÖ/,‘xÛ¥4†:Çç7¼Ö2Fì.27vëÞû ™Û/É äù!ü  µë‰%sã[¼Yý”œPí.!8÷é{?@r¶Ib t&=§Öã·ã|bÝCCÊïCpy6“š(×G„b—dÊACç?ÕD9¡>ß{haOŠž#“\¶ÿnI_'Ðëûóâ'ý%µôWo£žÉʻ߷mì¶£/šZóÈ]©MXg¾>i© û²¥ÛØ8­*šŸ»Þýl§@P%(]R%à%Ì>QÐ¥žfÙ¤0¤*Êœ(31É¿øu+þMá ›,Ä‚¥™Óä¾!U¶ÅVH´qÏJ†˜XÎ|úZŽÚ9Wýš³O4øúé±"ÍÍŽ_ªáòa]ËÐÙèØ³PÕ1u¯n×ðŒ ˜ÚžÔ°¡ ò4*1º3иVøÇÔ_Ó§òÈ›×à“`øÛ­û³ZÑ.…ú¿ôPFêà@•‘8ßaùÙ Ì´»X SÝRÐnvžoå[uf[–gœ„RÊŒ7¯f]ø»ßóÊk=Ð|ÿøšŠõŠæèÚð¡Tj¹Åkä;« Oò°ÏóÐlá~P§Ðvõgo)lÂ"ÚyKæU’å)ng÷ðJIj'fÒÕ,1ÁûVEÚSõÒjŠTš,R{Þ«BFTÑŒD©bqØSæ´Ô_Y’s¤FñŒéÃÜ­¯gM(*6GÝ.ëMN§çhjîÛ:¢Ž-G•Ý}Ló+_W½´À3±}ÞMìó„(P³²H.înö ¦c955/X¥oʦk¡XœŠã~ÿ<ëëpÉÇú¾ÉéÕã®HœÇ{/¡DJ·í ™]‡:j¹»×Ž™êûª.Žö¡ÍžVö­ïë‡Ï…IÎM.$÷Ì4f¶ŸçóRò.Öö;Ÿ‹Øæ¨j8ÌXÚEYò²B6óÃSPM0µ)véMuaÈbGU"ŒüÕjÁ!«ŒlO«œvš@û%OM÷™:šF»³è»kg>ðOšGÐÛªéBÀÍ¿’DÓŸ7ZŠÍÎ=¢JG] ÐͰvÇ×å%›8rj<øï2‰Ë–xâ:#I„*òôå…ãlî¶Ëå9ý5&ï<Ø4•«~Í•jþŠ8§ï¯<9Ù€v3qÏòš}x*¿¯³_‰|z÷ñEg¬ a¸ƒÀk¥ÜQeÅâ†Qf+ŽòÝûÂÌÚ†x™ö´WHªÄó¦4ô1ÖŠ¦“ßd0“èí½ÂèkJ`j¬$Ûs.=­çIÜ9ØãþnáÿGÆ&—º²I³‘˜ˆæÓ¡'KúÆÉ×5–@õÝŽ÷áäîȺ¤èVÑ©q`ºãÉçIa‰cé8F£ó÷3µ ŬöÆÐŒä̪–àwHO,-]2ËfЪ¼¯3ùè-~V‹ù%êŒp8¤דàÀ¤úoh ì ’!ò‘-çy˺êb¨¼wSóŠrNQ‚ÊœuoֻЂä=æl~ ï‚Yñ9ä1nß&‹¦_†ßˆ7oz!“ªÂéy7pW³rºM [è—]§ûÛWz|d\ýª‘óï‰VVœ'6/Ó"Ÿ¼%™€1føvÜë7OYX O;ÇZiôØøtÆ9ªP.ì¾X¸ i÷Šœ=´)‹ùQ¦‡)L(_s¬ûú„ÆN9…­÷YÏ¥5òÀxt3>G ¹ä—ì¾ qúŠfü/iÇ8tƒò¿9i쌚¬F$QSšÊ±j×z#W&óÊ'˜”öæÝr‰Aþ@ây˜ëRF_24ŠÊCØg¼Xm •MÇai3$ü¾—© {‹òe·Þ‹æpF+ñC)áÊ¢.Ȯå ³õ,7G‹£m–©F“‘—!–ÁvCíò^iôVz­¶yº"ÊyJñYÏvwÎ>ÅÆØòQíþXÑ$X øµ; p–æ RTFëå)q´’Ê´ ;Qzû~h# ™u\õh4ëK@d2ª3M{éÑ–$­Ò †ÒrÔJUhì³·5B:®~“?·ÀÈqhþIà£^<œR¢m|ü¡°7Ø8å©„;ñTu6‘Æ ÜÅÈ Ê:¨H*A”«'W~÷8ì±Â;./%‹£»%‹Ý×} û]c3¹ÙN‘å¼7üÍ8)Rqéâ§ÎqpšâšÓ§ŠŸAÒ÷]¢­ÄßC¼L†¬²× ÊVš:Û–©V8Ûô…6òäÓÞ\wËk”|›˜Ù:º_×X#ômôŠ«Ø¼R!…igªëóÙˆwºÏTF{DëYˆ÷Á2º÷¥=þeêbo7?£f&)‹F[G"ñN³¾ºç¡ôQœÏEiÆ~önêÝ>›wVã× ë òÐü†; ÇU*ÙwQ„ê³_|yjÖWg£a™,‚¯~ú eV³›TÚ¿ùøÑc¨â™2’yd3$]xÉRû”+ç|„!Z¶\¡ú¸yôªþ›SmÜvýhL‰°òWÏêí‘OzÉýJ^·Á’b«H7ÃpÒÁX”±®±iÞÚFäΤfÌgé öÆnºòTÙœª  msãóUÛùÍRÖv ÷æ¹ékC“ŽìÕê¼_©)pö(ÂÈ-^³¶F…)w° ÐÙo7V¸lYÎyñb†xz}9N ‚áÜ7ÖÓ`¡)ËMÌ#å„#qÎc £Ë0Ó7û¨¥\Z±®Û¬­–‹DÙ•ÎÓºvfŒh–i"eŠ»¦þŠ0LSl߈b«.ï£À,•H/$—»1¤‰U{‡¤šdsm_3ô¾üTÝ$Sê,Ö?ŽŠê9eócŠûÑÞxr϶¼_q@àE8«t¢c§§úÍl°Ÿ±ÆYïªï~å1JA*9èòãâTÀãêŠ;–Ag¬´ÚÔ ¡Øß»eKië8Õ秉uxŽG*ˆm¯›üü§˜Ðp‰ÇÅóJ}#»WRíF2’ò›éîá"»¾ó,¯vÔ÷wƒÎ^sž‡`NÔµÜl‘ãg ?»$CÅLaDk¥'ÊÚŸÔLÙ´Ù™®‹¬òøÎrØDc¿|’é¤ëjé¡{K¬yämRQ~×ÏßJžc‡AB€6â™&híÓÂð•}glÀ9"—ó a!û¥wx«Lü}µ9¶rι巠S:z4ž:hŽÙ¾UÇ쟞I™àzf§½­Üéoc¤» ~üÍôQDïcÈo\òUå6 É ¥êÙ)Tb…/Ë!òÒ$]Ú UÅUô :¡ü”ÆJÍ”E¢7œ®(MP€dí0(Ö•O¯&*j•ù¢88 †Ì|â#À9–FÆÓžá5­Ìd¾…²EÉ:@ˆ½8«i]¶Qhd€}>6Æ-qf UéQûCoö|PR‰!/»òãMïÊü²“ª¡§®Ÿ Œ‘GeÉ`ÄÝ÷›N1ë_P¤ˆ„åIš×Îýµ*\ŠÒc³…ýÇò8~•Ye”õr¼ÇdÂlɰ¾Ž)îꦯ­ýåÏé õDÖ¡Ûóhé£'äÝF¥‘¢¿?ÈÚí0%3ª¯´ø)~bÐF׬›Á`~ožð\ ­Ãè[ŽCòjg½y%i&LeZƧàl²ß“ˆUäÜqÁ‘«¼–%Z–ÓbœK~©ý^6V¶V 7\9ôà]”YIâÃŒ<"«6®"‘_EozaÕ…§ÃJh%ñà¦ïñ!9Ÿ‰GÕi¥ˆ~.ÒW{+!ß!Ð3>zL½n¬\¹3)cëS“\hЏ?ažMŠÃí“V.è8b”‹X•þ“öêB|„qACN Ôx&hÒߨª¶ÉÕo¥CåÑrÇ åOC2†é:Õ€¡ËhüÒ8gù;nY* V ñ’£`«‘£%¶ S+S­vCbÌF}á˜4VÝš9Ñ>J×:ƒ}7eC¢›"7Dr}š;°w³Œ¡â÷Üb1 (Åîèð4­›˜ Ý·nɶçN—YŸ&•ø4à°ô±²qy‚"æZ<Aü§¦¶7²”½QƒÂû¼4Rvt²ÌzÀg¤žªCÁ·›-B 3*ç;¡ oŠwoè‚«D›æVS“Ç»Os-‰ËÄDÍdD›íßÙÓ?°â÷;“s‰²ÇH [ˆ Ö yêK3韛Ic’6޳0aG½Shóqˆ 9ÿ„¯§ï}®êñmO¼ÄàNU¾i3Ÿ¼¼<ñD:‘ŒÝ³í/âÛÑff¤îy9¤Ka‘œØ˜'DpƒÅ¢¯üüÈõ[ìÔ9ê1²´×¼ÚY±Ï·êc쪻/Û'îñoœˆ‘0|i$LYS®ºtLqŽÚ§2jΣ:ããê„bR+œöR…$ùÕr>±½¦-3õ¢÷9©˜ÇbÏB,Gk5úòéˆL…î]º>»ìÅ¢òñªÝ5»«Ó%`ZqÛ¾"šØ{v6",d—€έR²Òþë ]‡dd ‚Örƒ°˜é~âO·§:¥3L RÇÏ“(½j¦µè'ÜÒ!Ͳº ?NL_™ÓO£ +£TŠð%úýzyæZKì&ª7¹ÄÑ~4׈þbPÄõ@œ‹Ö/VYl\®ƒëÿ,Uf©$ÓüäPo0ò ¿LÈ)„x¼0…C#Î*¹³ždˆ¯kT0Ȇ X·ù> m2غÅ8ðSO“yz@\<;ÔDÌ6#ž%ˆ$Jדò9Ù-wɇ®æR5MPøl›<›¬ßgHÄè½\šÌÜeÔýgb߷ш8—ºÔëí¥k*sƒá¸çµRGb~¸~‰ñëâ{aË)ˆêõväáMÉ‚E·Ý® ö¼x2Í/ư¸ÎVùؾ‰Ô¯ÆßiH‹:´Œ Ž"-iO8ÏlåÂCtFØæ&P,›)LFÚ£.»”xs«ù]*üçÖÅ´€ñœ]¾†íþ‰žÔ¥¸ø¡l<‚•µëÃùv…M«mß°Á†dd:U‹ž´t‰O7¹D—ݲÄѼˆ(ž¢NC™^aä[jî%Ñ쥌æŠ<‹Ý(ÙãVRY–»ho£«Š ˆâr¨·‘÷cL½ÊÒ´š‚gÀt•ä»EÔkz*‰Z¥£2µ•Uõ‚G:ùO½õýì…2ÔÓ8ÁA_4JÅQ?þ^üY?S>ô¿- “ò æ"ËÆrÎzƒ¹£O«ºíÓá•[3¸U‡œ5Jݬ–ïÁ‘ªZcw‰s¬üúîô™£]…¸þxìs³¨á‡wÄ:Le¹9î(Þûç×òö²¥º.–cÚڙ>ÓBF‰}–_¼Ó‰D9Á5·Î {¿˜þ7ô¬æ ñVÞ7þiÓ¹—·oÓüW§Í…WŠ>ÛŽ›H°—Ë~6_¯GÐ=·ÿÚY«·ðDÌÞ? ш‰ ÃµÁ"ÂÓ·>ZSg¾o¼õ\IØ`Ž“^È`ÜC­õœðc|¥fø˜Š =™Q÷ðsV>ÊZ`SÇÞùììµ¶ÝÅœK¢4×RùˆR”u²Z…).>_U(Ñ÷ Ο öN>˜_pGü"#XI²Yu»‹`À®ÏohŸ»D`+Rœ¦•³;X[8ÄûóeõÛ¤š,# g\Ë2ÇÅ!¥âM$Ì—ú—QÅ®tF1Éô}AXv®¡9¯QEF2ÂkY(–%z˜V¿×/pÉ­ñL:•3 ,”ÌH`N£p³ÈÊ´ý jãÒ¦ -.Bν{wßé6Ÿó¼¶c(º^¤õLÄ2”¥¬ž Zz’ìèÖXSŠ(y²ÃÍó©J*€±5”S¥Ï´ï$º“oR’œk¹W¯?q_*!õ x™A­ÿ|mÞÅlɤ¸œ)³ÊQðVœ‘ûzN)au••™|XSÕÏ:'3–ÕÊNa]ÆÚŠ?ñ Cj1G¨ˆ¿9¢Mi¦ ÷»— TïDìl´ë(,b樴¡«~}—C”&2£”bØFÆžY¯ñ¸I0†ê*' ß³ªªLø)¢RÕÖ/}$ëU{9[¶|]¶yX[0ÃUóLÊÚ‹qƒ„Å 4ß*7:mf3Ú¬ôvs |b‚a^º`öÆq¿Åi°È€Ï"%èÙZJtþ _tfêͤÞL0ã§9 ÏY bkYwÕzÓ¢'· ïϯw‡£P9½žEÍcŽ’QùÒ-ú\DîÙœ—ýÓЊuË;"Ÿ’0Ë­Š&Ðö·"õ‡ãðž3(µÿ:„Öäv£¾T'³t½ŸiLècœCü®ñTk^ˆÿ•vÿ÷Êt1­ÓšÛ‰d5Cþ|Ñ»‰bìó(,ç…ôtþØSVâuüLË¥{Õ—ÙchñÁœ£ »Y§¥j$Vúõ ˜Äjâ^æCªuóyygÛñn§ñ› ™Û:#4v²6xÖ:²w—A—7ØYª!eH—Ÿ+*ÓÏ/ÑŸâÒq'¨uýü`±Û—§e Ú=UÀ2UÇ;ìà=”§ƒle=×s{ƒ)͵Õ÷€?.k’rMA_½•* ž†×wŽEù\Oâo1’4ë{æz™çë>ÔÙ*l_ÄÈ¡æ4ä1xͬ±r¬\îeóü~°þÿÿOL`í¹ºÃœ@®/±þCg·endstream endobj 119 0 obj << /Type /Font /Subtype /Type1 /Encoding 440 0 R /FirstChar 12 /LastChar 122 /Widths 441 0 R /BaseFont /SAIPQD+CMB10 /FontDescriptor 117 0 R >> endobj 117 0 obj << /Ascent 694 /CapHeight 686 /Descent -194 /FontName /SAIPQD+CMB10 /ItalicAngle 0 /StemV 108 /XHeight 444 /FontBBox [-62 -250 1011 750] /Flags 4 /CharSet (/fi/parenleft/parenright/colon/A/C/D/E/F/G/I/L/M/N/O/P/R/S/T/U/X/Y/a/b/c/d/e/f/g/h/i/k/l/m/n/o/p/q/r/s/t/u/w/y/z) /FontFile 118 0 R >> endobj 441 0 obj [556 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 389 389 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 278 0 0 0 0 0 0 756 0 722 767 656 628 786 0 397 0 0 600 950 783 750 683 0 760 556 694 769 0 0 756 756 0 0 0 0 0 0 0 486 556 444 556 467 306 500 556 278 0 528 278 833 556 500 556 528 428 394 390 556 0 722 0 528 444 ] endobj 440 0 obj << /Type /Encoding /Differences [ 0 /.notdef 12/fi 13/.notdef 40/parenleft/parenright 42/.notdef 58/colon 59/.notdef 65/A 66/.notdef 67/C/D/E/F/G 72/.notdef 73/I 74/.notdef 76/L/M/N/O/P 81/.notdef 82/R/S/T/U 86/.notdef 88/X/Y 90/.notdef 97/a/b/c/d/e/f/g/h/i 106/.notdef 107/k/l/m/n/o/p/q/r/s/t/u 118/.notdef 119/w 120/.notdef 121/y/z 123/.notdef] >> endobj 32 0 obj << /Length1 753 /Length2 987 /Length3 532 /Length 1528 /Filter /FlateDecode >> stream xÚí’{XLiÇ×–bZÙ.Œ/Séb®fºLH¥I)›Š´b÷tÎ;uj朜¦ËHÚ'{+̦‰DŠ'· QäRÑEÖ¦IäJ¢6›ÅžÂz–?wÿÚgÏùçü~ï÷ý¾Ÿóý½–“üØ® %$¡`ó9|1p÷u[èÅç>‡Ç°´t§ ¢ÀIb6¢€bÀwrâט0Àw|±Ð^<w2JIáaá `ín3 r®rHá(B_Då´ŠÈ@‰âP¡äW™ øìˆþ0R±ã0ø|€á¨„Â0œ`p˜¼) Þµ±˜¨K±Š¦¡€5 ihDŒ$dJ€A)ƒ;¤Ï‚4É¿õ©¹$F&›‡Èìßçô™‘ã2å{ )ŠQ@ ø’¤ˆO¥Aðž)ûì /"ÃQW"L›/äð„ïúx´‡˜®@ÑEÃÁ>$°O9èô)¸¾>’Eþv vpÙÁ E 2 ÞGý`ÍÿXÓ1QxÔRœÎÂxˆ2´$ꜱ­xõ•{®æµ‰6×ìK©)S×8s:o;_§Jêá„#•Q^ðuz×ÜC\L*ºcV캢2!€«j2ªaj³;3@ÿÚ²ô˪ìK#åYëi'¶E•Ø=kfõ¶Æ– -ôéà;ä˜u­×=p£ñõó•‘Iµw´ëA:cIv©ÏOpa{kÚ•þ'žäR»·Š’ÙkòFkVqëZdËÓ†lß/æ®’ Û7‚§ESêŒ,ÀÖµ9­÷–§ödäàâ,Íè|ƒI±»XIx“÷¦§Ç‘†J¿Ì®Ñ<•û¶ë­IáÁÁ8Ñéº`Ø›ŽÉã\ÑÙs®v|<ò·-VÁÆK‹WZt[«Ú¶ç ى˧uÙëåôŽºsá;Á4#D¬>áè5® ûïbòšåý¦deöýó61¹êîßçÏô]%xô`v”–šxFróxòêž_w\j$JÑñž~›ÃrwìµÜ7u¯aò¹«íØE>Á^•Å0¼éLó²­^!ª'}~Ú7õ|ø”:7dŸŽ e~õ£§†y‹£4›—µÔ›nÞ]=Œø Ýêþ2&¡i¼©¹¤s{¯þÓ Mè.};Ù’ªµÏ×®®µÒ»å|íMÍ3Ô"PÝ1ó±qþ+=#ÃÀCfW>BÒ§ä®—¸«ÜÖë”øÄæ¼¢3¦´mƒCl•U¼G-KJ⨧ßYÀÒF.~=ßÛ|ž²tÆ vçV2­Ö¥ ïpv_/Vò¢0bV;þÚi‘jÿ&o“ ÓóÔb¶»A™»vb3Ô¼ÐÿÕ2¤Ùè$[|SüTɾ̜|vÚ–Šô³69-OÌÜå’Ú©“U%¾+.H‰‹˜Zßßñ¸»¼¹Ù^Îf%½iî±88¼Zêg6:ä>7À«=ˆ™¨>„¦ Ü…Ëoûºô.š©eµ“ ƒìÖš÷ s vóO4ŽÕ ·¸1®ÂœLß²öHÕe¡n×ÃIUo,5 ïóô|üóº´Üêžb“¯OÚÍÊîe¦æ¯Øv~ian\|N;Ê%7H3|ñ²yMVWà©ÚåÞ~çÖçt¥‘Zô'ÈvßW}ûK þã‹‘q7ïf;ÚÖï_–xwI:ÑÁ¸`+ãà…eå5ÔP××é?º#I+ï×ôÕh4ÝkÄYe^÷]”m«úo°LZ3·`HÆFVMGߨ’RôÌÑ#.ñLô‡Â?Fͱ¬>S—Ìs)?_´S_×1ÃǺ³zAi¹îfËò…·ìF´Ÿõ0\¼Š½wgÙá!ùM$‹)q£ËJbtR×Þtò„zÞ?|ÿü' PD()G¨HÆŸ_œBùendstream endobj 33 0 obj << /Type /Font /Subtype /Type1 /Encoding 442 0 R /FirstChar 46 /LastChar 46 /Widths 443 0 R /BaseFont /MLFXRE+CMBXTI10 /FontDescriptor 31 0 R >> endobj 31 0 obj << /Ascent 694 /CapHeight 686 /Descent -194 /FontName /MLFXRE+CMBXTI10 /ItalicAngle -14.04 /StemV 107 /XHeight 444 /FontBBox [-29 -250 1274 754] /Flags 4 /CharSet (/period) /FontFile 32 0 R >> endobj 443 0 obj [356 ] endobj 442 0 obj << /Type /Encoding /Differences [ 0 /.notdef 46/period 47/.notdef] >> endobj 22 0 obj << /Length1 2153 /Length2 13788 /Length3 532 /Length 14970 /Filter /FlateDecode >> stream xÚí·UT\ݶp‹kÐàZXpwwww§€Â݃»kÐ܃ îwwÁõ¯oŸs6Ùç¼÷é¶ ºF·û©ŽK9'f̾ìy˜ìeù´ê\f)zï:‘߆£µ5Í\pB*O­ý(OÕ-ø|1xœ¯B#¡±¿BÑ£ïÑØ“ÊÅ­#•e§VÿL =ù<’#bÕ=5fu"Äß&¡…~ù·c»;æC!B^Ê‹1Ľ9\L0›XîBó„`D#>Ϫ„Õýj¬!¢¡¤‹™Ê,»º'³:fæ»ÃbÛíR×ä¦ú÷ºoˆ™§-D3ºqüý!øI^WíSøJ)5˜c>Éæ*Et[Wè¯!2a,l¥’W¸©ÂÙʧ@ú½¢tê²F ŸWbùŸ!$ßЛÂp?Mv‚‚›-?6zªV%S.%z”NPõüäú)’ïˆ ÛÅ´_0kدºŽ’^1&Ò±çNœ ú{vþÐäSípR=’àtûÓŒq~¾!³ý(zdó.tÕœZ=­ºâas˜‘çË/:²P¦wneyª4S>jµ'¢b' FŔˢv1± Ò#?úÔFU\O>@þÀÅb~»Ü1Ó«ŸÛ‰cQáxÒ®wŸòý…÷Œ/$úå[h€NúIs[˜§1ä3”ÞY{Ë ûzJIòGB‡Ge¼ ÔÝ‹t­^=^°ËÌr‹çjÂŽ¹”!×Fk€­ûòX1“´¹~VVÄwWQÑ„€ e;¢H+Ï@YHÛ§aÑ?ÈÉs±ÍØ3G÷9]å––|°Ìz0fäf… õµw'¿=!ËàvØÈ—ãŸf§Q±ï¿³(—yó2m´wo–¸5ä?ñ âBáÍSJU  ⻑¿8Æv™P!QKÊw!¤Ê'æ„[º¤E¨Êyo†›x(c…_ä>|ñ»¼†òÖóT‹h@€Ö”µ1÷'ÙeÔ œèK5œáÈ\¡Y&hZù5?•7Ò³ï/’§Êñ8³‡L[DËý6)¬þÃ]ÄM¿µ$[ñݽúl`us¡ËZF@Œ3°²•Xc,èS S¥Ë&’òð’‹ìùÀ\_?YÆA(¹còŸŽA-6Ú„“úgçňJ7ÇÒbÏ—ú ™Õ[u]b ŽŸG,¡/òGrFÆè?%ÒýÝs}˲p±Ç±Ù¿ÆelT–ò‘‡>š…cQhn_OilùAô‹¹D#WLÿö9üɆ¥ªvxŒbÄãvÙ~ZF6%<ч,ZšúÚ¸ûIi²òÜεii•AÅtÛ-`—k³øWâ$Íå{¤„ëÕûÕuÏ•P“”NØuéHÅå_+¶"ë0Y7|Û&(H•ê Á(ó'M…-Dª5 ¥…Y›2zhã†8ÀÓC ^~ ›#Þû—&ÐÕ¹éXõ…JÆ í®ÂvŠ#ú™‚Öd‹ŒƒåÓRמÓúÂU?©›@ÌîÐüg8 %‚Z‰,ɇö$cX®k¡Èõ}¨òCÆ>ÜYÙ‚ F;øvZ·Ç-¸\X9­¨¬á«Gß&Ê¢ iq£)s7hC}’V}û8wMK fLf/äVƒrÞ³k—ЦIQuæÆ†Î® FŒïa’G?ÛüãñþjKwW äO<Î@‡$Ñæ,ûVÍUw»øÃ> E¶Ä¥ghûµyë³b ‹$µýëU\ÝîŸsÿ¥ÑÒœcŸ‚µiÁµ™¶dR»v¢¸g ”<$V'Zåóz܋ەbÄÂ埠Òð{÷û;îÌ`èû\ÌŽ±ˆ˜|_ŽùOnöžñÖËÍΚÊ9Ë8Pr ZØ’ÉJã í³ÑË6uKûŸ>$ˆø¯yÆÝfÀ¨3í¬›«1·é&qï®T@hŒ!&KA/­À^t­ý½ÓÒ^ê yո؄&›(lÞ†øÙY*®?¾‘‹b×ÌCЉ |Ój–®&b‡p NBsB3ûŽÐ+ƒ?­Þ‘–\°³',Wg‰xçûˆÖ“ÕOÍôŠßÏc6ã&v .È­²ŠØsî`TÂq“ìæâ*qªq—¦ä…ãYÞ]q¯2\|{Mh>Ž'ìÒË–ë[ü™õ¥GôœPÅrZ^ÞOç6ÈÕÔ ®ê9u2‰6–ë¤8ÊP~PP™å– o/ÆûÝÙh/‰ÅÄ´?»^ºŸÃÎ#k)­wv© aœ6¤½„ænÜ`sÎÍX™õ8-g† ­¨ #[µ»Vé.ÓUF¾]Z¿eÓq>ºݢ“>¢ë ¾ct´’|TôÁqt'³KúöŽþ“$n·ýÜ-늉Œ°³ÃwH¥»v°5Ê!7—uê'´D $2¹~bÙù!÷‡]$¡x‡¦¯QãPwä?îÜtÆÞìKÖÌÄù\Qônt•†+™Ëa®Ä¾2Ó¡ ͼ÷Mr¨i”úä . ©Š©H;¨š]Û¯a±J1MÚŠŒ»(𣛖•9ö=òânͲSÐÙ!G-_Õ³8STÙã8vÔÜ5a‚±Ù-—áøé(Eh°|Ÿ)ŽXéÙŽü‘ƒœáªˆñIlË쬞»…ĸéð½}Èwn­*ÒN¹L‰{–šôÆ×Ÿ~f×<rëü"Ý×H7r™1ä?²i%«ZÊRÜÛ˜ë¢?ÛÏu¸Ÿ:ö±Ñެp8þxïç’¹î¸[qâød,qÝÿåšWxònªˆ}–NH|‰×ω|CÛb“ïo_ÇGtÕm—´‘•”«ð›ôjžo+K|(‚d „ûÏøMü4!Æêíf!~^ Djíø'¸ ¬OU&=êÖ WœÜâëˆ^£dñÒ„ï÷Çä½}7y™\hˆÒ¢"¦%’aÃMÙfe“Ã@å”°Ó*gí ”¶1h»_›Ñ%¿þv`Ó@ÃÕÁÙa¤_ A—%s ÄèçÐ$ôËtl ºõ.ûš »ºurÖM©Þktrø}ºý3íFëêoù±Ê‚-Ø_yŶP|l[Û½öü:xa‥íóü¨Š&­½ ¾ýÚM œìt!OÓϲ~ŽJm&Â' ÄFBBmˆý‘pæ¶`}dÅsW«…Y} e#«äÓ‡fÅ0›a2`†@ã:ÅÔcT³)S,Ú;êÐu%Ïþ‚¤Â&Kü4.•WÖ>˜XŽÑ˜† ±®½Ëdah;l†0”æŒ8oXŠÙ˜sö¥¨òZÜèŸ5”~¤%f¬r‚F4y$;“ˆ6µ4æqRi¶ R8EΨad6°ÚñÀ^î‹ËÕÈ˳m5á¿$oä~-göõȉ÷}ñï XzWµnñðN– >µzÕ˜¡SÁ»9 À©Ö=Ý£Oâ®ð%]q^š =—hÞø.Ÿÿj¾åÜã¯ÁH-ÛéÚp>O(§éÚç›k¥Öf“f|Ñåï ç“@^ižïRkÇMãnö«¡š_jÖÒ?C§ià‰R8zkS$µq¾ba?É·\ÿ‚I¢«'‡F ©yN4ÝÐó žœæÙ>+ººrßWa‡ùS Ä›é2àø~`Å ËOyA*õ­C¢G×@<ˆÕ2&47TÃóÕêÑ9Órz·åD?,E‚ëØ^’… Í‚·êþ§"“ĆnÞ+dêHyÄ· ;¯ð=³æCtìE}â ꪱ›°PÆ^¬ŒÇ|˜êd+eîævs4­¼ïþ”ò™¼s€á>ÑË~<„%`þCø0 $bÒÑ­E/†zmÌ×=ýkÕÖ0ÑƒŠ‚MêÁC³¡F ÜœF Ù'–°u1ÜãÂr®¤;ANï2Îýþ’ Ÿ·*è£K¼¦advÆ1®‡½½4 Ú„…AÎãd…èlòî@¨/¢GâÂok"H±öiÁŒH‚‰BùlãÑ„<3ENÉ¡ö÷\ aœÊÞ"äŽ5–ð°Áo ®'Lçý/¼‹±Ýéé[£¼UÇSJ>؃a¼T Å‹Ÿˆ +ТúSÀÔØsé'ï 4$$N{Nô¦Â6†ÎöÞN_1Aˆy{|;E>IZ…1±ioª‘Õ˜ÇÓA2#Ox5²ü.g•êƒ-‘ÝN¤»Ñ’óÏ‘”6„Âûô¥fD5¼œt*¹(q¹ëƒtÜJG&¹…‘lXËQ…•3¢’{-œMs†nQSC­LÊ\÷Y«Wg/PsºÿA·^þa ’×ñÍçÚXI§\ (׎ ¦Ž‘OGô2Ú±5hñtZØùtÁ÷ehÕÚGyVG¬–yWX» ]TjŸ)¹|íÎN³¨N‘§vGðv Gèæ^hY1“;/½.ÉNÅco -j¯ 4·¾l¢`ß®n³êª˜=l‰ðÀ OÜÞÃbrR…üºá¬´^"·C:àZÕTwj¾ð7p¸¢¥SŠáC Ÿ Ù••²Ð<Š}®±EPšÎA_w×~u« ˜÷û&´*•¥°ðýêN½”ˆàv³®$aµ‹ÃÝ i쫌³ÞR¢˜Ñ/¶þ'>ä&ù6íqŸÌ2/ëì·oöû¢kFøŸLI>ˆƒ_`=H•å—mKd Eµ•& 8¦Ã"šLs<2Äô¶£Gå‰ÊTb´VǤ˜%âšš>Ÿ‹ÁãW„öåÀ®œgT•ß×Ý)H:8Ç»ïRÊÌÙB^’jN0' òIµ9JODB¢ï`´]äCÃbÖËᜄn°¥]H–µSu~MP 3¬©!Ukä︄yø©Ã”uD…”Y±xW¬>zÎ}í+ºy÷5º³ÌsÁ‰Ä#´{Ô5RXƒ¡t«–*cÐÑse_¿ÇÐ)±Š,ô«üš=Íö)Ú!ãÁÌ‚3ºN ”mŒáHz™êÓãs« íu|ùèV}£ÈdÃ1¤þáÇíqÕ;Í’yYé0ö^ܧ®?ôlQãžtƒÜɽ>,‘Ð+æ0B,jrܨ Mn¡Üâ œè]E$0Áã&nË“&³¯‰E‡SIaZñß*m 5Ë Ç7AVÛHØlãã¥]6^¥r)ØzŸ™“B½ûû…x°²¯¨ëOQ' áæßû \_•0âM3žÃ¼‹Ià§R6†U§^mXeô%½zJÝÿþm)Ìè ȸ`É`¼Ÿ#µ+7j=:¨xÌÐRàÔl2}ü6\qÊ^1[2\ÈôûÃç®Ík§ÉÔ«³äu©4GÝÀÉ­%FAóŸû*c:rúÈíÄ<µÄ¹68û ººð¥µ‚ ›9¶udžQ¨#ço7¿:\- ð á„C¥³Ã(aCLñŒ÷z9$Û²ãw8’Yæš/Û±z3éÃi‹æ˜>½šS· Ë\º?lûµ!?—cëŠP„Û¦# ¯y ¢Ý ñV±IE#>ªÆ¹RéL™ˆK0‰ÞP¡Ëi^)^i¤a:Ҷ9ú²lȤÄX‡ÿ鉛½wä·—gîy9t6_B_½(6ØfF ¥”³a*ò‡,#¢£sl æÜÎììß1©Š¸%eL”nTè¡…"äA¾›ÇºÐÍ”ÜwKÛ¤û…_[Á÷ºÑBJeó2p¦*ú½Ö+ÐÄÅ;L&"9Ó8N0y7/Mfñ»^ç·ú#B.÷™´±c¬u/²°×ºê§÷Vuä¦x§NDVÙìý…·8¨U³·kCK—Bf«Ì׋lÜâ ªõ{Åî5šLPå@‚¼[ˆ£ ¯qŒ/Çï»t{y¯r­Xå“ß³k|Ë;œGÅ ùVÄŸéñ-åSDÚ©MÌÌLÉš(E=¾Œ§Ó8€ ¥¬ÉF@°}0×/¤Ø:Ö|¤Í Ú÷—²O]”4úuZz!”pvœzH™æ‘ƒ•k‹ç‹§Q#sŠ ÎWíÁ€HUÿf”Õæ•ùQHCθ#=‹ß*•2* uS8*´»þê½ÚWóC]Òp½îìµüÚy$?Öa´/é¶R³ïȵôÍÊÄ™Ë3Òjnëk.#b|8¹z £DûgÒÆ®ÄOo(pZâ¿""âçößð®•]Ѫ ×dCÜW‘qw&¬E$¢$4\ô’{|jRbÄkªåjE¾éfŽÐ­:ÁqYW¶ÍŽùuŽ¡x+óÈêp•„Ô°¬ã¨rÔ³@¯—‰ôKÂTZàlGwÌžÏ+›c©ÏV©ÏïÅû¤+¨ÔÒ¶DÈ®vwö&M ŒRM†Ê‚~)-ò”ZuBË|Á¬¾Rߦ%¾iŠ¿ s”#[Þa)D\*uÍ£Ènýp¿Æ4f6ñúµZR1FÁÏÞ–:¬/j‘ÊMÚ²r$¯Óœ%>¢¥—PæüÔÎ~sfQ. ^¡št!gÀcveÜ ÇS05ØÚ‘˜ú±v×î“d3'½¾’]z ´Å¾æŠ¬[fâz$ç¨.ï¼åÖï™H5|¶üV™-6ér$“’4ê´2GKeLr :š¬dgÄðSÌ€äZÒz­+‰™} :9œ‰mß‹ ry0â7 úLÑŒGmëg™ŽÝõKÒ„žâ3^„¸µ’—@âú¸/©­ßúFM t8ñ‹ÏÄ´&K^Þ) ¿ÇïǺÎCOGíIß;¦‚•Œй+ÜjàÅÔŠ#‹*”}Òˆœø˜úP“¦ÀÏI”4ú3ÑÅ11|a?àèÉ-)–’”˜ùG—°ËO¸Ðu™ë:…å+ùlƒDêh éI.½ªVê K¡ä,˜ÞÕ¶N¡ÔZ=u’\TÔåîQå€ÏåEáØÕ²Ö­æ¸Z».¸‹X˜H8S—ƒÆè ”F“Á&ˆø L|ãóÄt¡²ýwÓ}[>Ÿìž¡ 'Š{O¦aöjFLÜ– á4|aœ­<¢&ì§e¨™g¿°×¥:ù`´Y…³ç&·&¤e ¬¿¯7(Ð2 œˆH幌ëD|6>‹¾û‰!íãl‰âqý€Ö›ŽIª6·–˜8w©ÔVÙD·Aàœ‘ãUÎôxNžþ~<=/"¨îtC|€aéáKé¦ÁçúѽÀä¨Ô j~Ç­3¬2 Ú"c]K}§Ê8W\ÌÒ\Måh± “v(+¦ªÂÎ`å÷ްýÜ\ÁÃ9ÞAôÉÅ¡¿êÈ3æbÛ0q>´á±ù6àûQ¸»T"£ªЋ¶ÐÖ %Ý- ©žæ91ɾB ~´™FȲ)£«-rGEàË-¤F«9Æ~ýމüNbªab”P¹eà¶ìõlñÙâÛV‘%ÿ¢¤x”Tû2Û¹XŠd{ôϽã(7ðP¬óXñlUøð/r ,m’˜œÖ©Ž*™íîö±/7q8¿ ˆKRÄ#3^Wa¾tîÕ9±®sZñÃûŠG|Ë+ÀëØr²†²·Œ,»*·ƒESúiT"aìŒKLg‹FC;E¸Á•…þLpÄ•æà‘ÄWuÞ¾EF¤s[Þ#óÔ':X7¶„­­u@ÞSO–€’@Ö°Åt ¾6ÞÀϼ3ž æ$W+[7‘˜Ý#[;(Ñ>BËg)û#ØðP pÃÈÖ “VË¢±ù¡­Á¹B:ÕXº4c] 2^?4²CÔ7¾ØÑõˆ\øŠbLÛ±™ bʪ Ï X3švkMÎiö‘§YàDðÿŠÄ¸W†/ŒTP­ÐÆþúcç9ÿ±ªõϷ׃+®°"è¶¶¥OX‰Gª‡9xÞ?&Ò»7܇w¥ýl\©¸z:ÜÍéa0Ó¦qVóåÌó,ÎÉꪤ^7¹2¨³6* )©äŸ ”K.XxÜW?¿¾«ënM±e1Úp:`Çà¿í¸‚h š*DË©'P¥É‡fPoS˜Ãrð®Ò—˜*(x¦`}txZp±¥U7·þ–|Èòôòçúzÿƒû£ wè“f_’¦Qíæu¸U‹.Ž2á ¼‹jn5b²Þ „M4Z3¥Å :I¤ßöü;´¬öDq¿-8&¶Ìص@ §}Äú#úÙ R#+Ça8ÊÐPRº$rôÚÖ2ÓƒîÀcõà\öÒR¼ Â7ŸœìÛí`Ãi>÷^ô,s¶}v¦zÿ8%bfòþúþ¤YB þ W'ÿ36¸8t;V!(ÿ£°±W!|е5¬ƒ4´[8Yw-G‹MþÈÕ/ ¬Ö,$Ëex¦÷ ØÉ¿Û*֮  B©ÃîYuÂr(;Q‚ÖïvÜÖ™u‚]?cšT\çfƘ9õžovƒ’ºªTQ*Ks<ð¿x¯cIfÜäÿQu¡Ê·“" ˜$:è sI$—[äÙ\ò]ÊoI œœœo‹êgŽ¥Š|ÏœO®ÏË|–Sa~Sp¼§?@ûÖüºxÌ‘“¡[5ËDñ-D…‰ P‚!(1±0'Y‘‰‰'ùÛ-°6DŠ• ¯Ôoç…SðÏ¢hìL[}IÏÔ§^žá|E?’E$ Ÿ] AýöBËîaƒc\+ât{õ—^.T†a‰´–º&xî7v.ê¯ÈÁª}Øb¹Ÿ…P¡ ¡áaF(í‡a¶Æýwès¹NG8*@u%)ƒŠ?1ŽœâòBÐéŽ+*uËúhcb"M^# FE1-]ö›vŽù² dl¥©¹bLjÆü¶ýº…ˆ†ãŒ×5†èÉÌÒŒ[ÆÄ£HXD^-Ž6pGËBÛä΋n²î|b¹©¸¤ög)l×tQ·¢DÇ^YÿtGÎ+Þ$Á\¡¹yÊÞùpPR-ß×ïÁØÉ\s‹©ócÄ ã>á¡:m"£ÅúA¤Eî†u›EÐÉæEDÛnQŸ.r¦Ÿt±O°Ó= Žd^¸[“ù›hÏË6HzXœ;=íÇBWÎxZÂí5™¹ÄÜg²Ï˜jÑ&G™ï(žf‰S4†ÆE)ìI;WÄ Ü3õúTU_-1Ñ.<ÖX)KmÈé£ëÈT©ý¡™TÑĸš÷y<]3¸`Ý_z=î(÷ç¬eŠíº"üvZ¾ÃŠ•a‹ƒðùÎs¿)ßý£á¡g`ß”Rô†ËuDœR`ª}é‚Ö°9¡ÐM ¬”^û½ó®‰+ýlžò9±Ðî˜ßÜ—ìÜL°dM¯øeb”»˜Ó¯~_àX;èì—ÜåhÔ:–sN5°šu`¼j)B#MáÛõ§N¼žxô0ý+ZI!O× g,!hyUnTâCM›8ÚÝ`^f ܨѦý1îýÞ2„T+o#øÎ&îÕ•€ª»ê5ùÒ¥ƒ~ÚnDœšæ½?æJ…‰ˆÿõ‰7ió[3”Ô†Ný8TÀ¤o‹. kŸç‹‚ß»d lÐûB1Nè2—ö_Š’åú‘£½hÏk¿_{í-. Áø•Ï^Ýi: •>ʘ×Oàdç!±¾cä~·Ãʯæ–sŸ…t*ƒòµ 7µÓ-=õyÅp¥.Ô=1âìèDb˜xò²é/Q¹zö(¢Y`á̾dæðçK[ϰ9 ÖfÒí2*ù‚ôøèK‚A0#6Š,¦™*~Ђɲ2ÄàH±¥k-&p»=’®MZ,ðÑâÆ2}Ÿœø7Ê‹ Á4¤hìôÍÑD éF¦eX¡úYºÉ†Õð.þOT–$*³£álJÕ‡õ ’.%Ë7"«Ê{wòÌÅìÕØÊ€?X]ó4Œ–ôãŒBIàÿ涆¡¦ÏÑ!¸¦›j£3y47f´hÛ`›$nîÈ¡7/ Ú>÷Q±ŽóqwðèÒ?c'³}‚…<%•þ9èCŒã"|ßH‡ÐŒ{cZO&ÊgðÎul9}Í„â5vC‰¥:ðä‰-=Ç] %B ÁâævY~/[Kÿüf—€˜da±¬‹4ý¢J§ÕÿYãæðª—ô«”ˆç”%`Ñ#2=Æôµ#S\—Åj’ßJúóÚ¦Y-z ³åš†Æ‘XÉå'Ÿ›è¸ªEù(s L.©ŒCÂÔ(©5u¼½‰©”•zÝàÌÎF®¤‡Ì¹ Äh›fnï/VåÞ¸æJZx,$DÅ ÐépÒ$ئµè>4Âú´Eqé©Ëò>-R–º~ð¦xFfØ¢²vf=«:Bí;žépýš¿+ã5ÜWŠmÉ“3dƒ¥ƒñ;ߣÑò(å”»Ù¨!¼o gNÅßðmÓ ð2¢î²×‘üJîôÀNþnÔ—ÔÆ=Àø¬ŸKíÈÔ•ñÙeâÈ<ô¾`GJ ø7¡j‚ê¨ÈüVgw ª¿LaGè1¦R‡Ññd2 ±KHW8½q||uÌ?XQbŒ³% HÛõÆ•µ¸tFÚõ¸ñjtOØ{J̳H&4¨ñIM€–ÓñgúY­æº#5uƒJMkw!Œ…ì™hæt­¦ÝÖ_iÕK}Ýj#œsµ{ã³îâq¡fgóMø ‚X§êBOížîˆ²\Z±Cy¹ ^%>hM¦ÏŠýw®·yRæmÆÎ‹­¥s»P ˆ+-U7ÄüÝÿ«Xq³›uÛlO‚N'AÖhAoïqO¶â÷UZCôŠ—ê°æô%I>'×Ñ8(û[Ä{¦†eC„;šË¦ô—cÓj‚€™§ê–uØ(FéQ:ïS…>ïÅ, u¿‰‘Ç µ&m/~÷üúâݪÆs—n‡+?gÚñ_[÷[‡ÊVt®a¦÷x£ºIcÌ3bV_aj2Úµ5bõ¥¶• ¦‚¡FäõG±d 7…QƒhÂÒ¡ŸFR¶0ìm¢RlðK¦:M¾ñ©&YR¹x€ YTƒRû3ôµðó/®¹”ìLY¸¡«÷È3\s¯YA[CÍ·HmÛxÛê3žÞe8Ä"õÄkí?%OÅ”ºÈõ†\ÂI—¼B]à™W‰/ë·ßã‘n¬/ÌÞ¥ÇHRÓ~}êRZnåœð.ó®w|‡g ½â¹ñ–âðiW÷àè¿uRÉì¡Ï/õêtŠóÆžä•ÓI]»q\jnÝ'£]ÐW5–xú4£ ‚€o ýNÁd0j²D†T¿dÛEëZlù4yPÓ²Ãë%z^£ªwtüq2©7Òû‰¤“NP ÖÍõèK*<ò‡hœkÅ8—£ƒÈ9ˆÔ¾Y÷‚ѵ°/wl#çC?Kl=ÕU}ףþöÒ§›tiЍÕûR3ƒúKŸHL=uæh·Puk«'*EÍnÛ$Ò¯¶:±«^%ÔÖ‰­ëŒ‘Ej•Ëçg[‹&·Ø¬šÓÉ;p'dÎùÝý¥Íõ~ГLʾ/§ná0‚žˆì¥ )Y˜iL¯Íe+ã·¥tÖº[ö±Å鯬H”¸bZ6âÏõ¤¾x?>oQLXàûù²d´ïc„=Ärv”òÖõpøÔ²õ •|&*¸®¸Ìyˆ¨8¾\Ø#´±%NáDt#Iœ˜Cã¯ûT6ÒÖÒCÏ÷K.‚åöù¦LšÖ?¥uE„ÿö=«K†‰+Ìõß‹y=Ñ vĪBQš§"2|Ü.]¸· ²õ¡t;nÒec>¦ø6÷À>*Õx¡2þÐsVÓˆCœ~…d²2¥c¨ êXæ2ܾŠa°FFÖgÍÒüaµÁ$1ë ñcÃuá)ãÝßÃîk™š™PÙ¡¤!9„ߥ´=É­—ïgr™#YO¢ ¹2|pø•|XIVC–.ÌSà9Šp¿Þ*¡ªD+Áµt‹DSˆÖ>6â­ð&»JóˆþA\Ii© +7¹ãº$Œ)*·z¼ýrZßò]ºÚ»§ôc’4V‰·°AK°4¯¾Ía­ßŒs'¿îœÊc-Ý–A·p@ŒaQQ0h­ E‰M ÷F4ÿ©èÓ"Éž¾ÄƒÄêˆ|§b)¯2j•£ßÉK)] Ý^YØÄ?ý´¯Õð ?c_y»Ö…ÕN¥z”/ïµzlÍ+Ùøð7‚]¶8.\hKyŒ‹k,væð? _#¾è¼™æ6ª1E²,ècÜ–à!ã ^ éÔÁ©Peu(þ©qæÌGñï›JDŽ–4¾­5¦>oõ×RÆm,)º)ÈÓîóZ%Ñ~Uß>ÉË?Hý¿ËÄæ¾/šÊ÷Ž"=Ï׿Hž0%½¡ÄÏúV?·Åˆ$µm7¿D4>¬²a°ñæÅŽ ]~lÄÓïø‰ÛœØ|3]« “lŠ¡è˱<Ö¢Ò‡+½Yèïzí)MºEçð,ÍÖGÙXw‹¶­H˜ê¯ÃZ;;þ)gˆcà`E}xᔑS:âG.wv(÷^Æ,?ž‚G ñq=GD9íÔcucÕáø1?ÇóÓÒʓ˲5ž– Ý•ÔðñÕÍY8TÜŽýU²Ó0ÏTæ„‹Ü1ÀZ3\þÙº¢*gm2aî³/Iõ©h¨0—½(¹«t¢”µeêû¥CôˆÃ‰«ÝCø'Smb©Y¤Cíô2áýp¸ÛJSŽq˜˜CÕ÷±óšƒîGjª¢n:š‰§ 2¢ÌF¸ -¢î—ª/BÖüZ—³Æ¦À¾‘û÷Z©d³¿?e\Û—CíŽÉ÷ÕxwÁœþ®»>s¾¥3”Üw‡/ÿl€f¼ézÇ/tY+ß ã#¾iá,©ºOpgÛüë)EŸÓŽÀ:šªÑœ@û‚yz€Ì%é®’à*¸bÃz\ô ÷>‡ƒ|ß(NFÖ&ÝS]qÊß©H;rMâF×s j~õH%bŠ~»þ(Ã+ )˜_?ûÌš‘„Æ U™X’ìºÉ±íDsŸbl™  ö„òîù#‘³ÚÝÖu¿êªxú j å<ºÎB¿P_iËYmz½Â§\$tw…ð”ëÖüh0éc檗ЖMÏ5SÐpò¼i#ªÉvÀÓÑ%Ç: 5õ{ò7·ÌcëÓô®Ñ"M…NRÃüÖ´ AÍV§W&~%”’Šö½¶ºÆ¸áòÖ2A£i…TVŽÛƪ)”ÀW’`%ÞŠFâ0ÑÒl¬;‘<”aŸ~’ÆGzý‘•ky¡h²‰+®[6 ’Ðkhô¤ZN XÊ>WÆ¥kÒƒ4ãÆêߦOÏ\k-úÂ×lÒ5:_¥ýòò×¼¡BÔVnœ@uq=×­=ûÑ ¦”r^¶« )x?Ÿµ™ŠˆEFع¯h”Ì2c ¸°˜†‡¬Œ?õÀP™ŽW>|Þ£|1º¸)zÅ7yOñLø.‡›$ig^>¦«ë ³u³;4v“çP™y%÷Ódm.’l´‡ô{Ò+IÍYŽïeÖÆçÍòÍ%‘~IIíˆ 4¬ò.ÃlcŸˆž˜iUhq´ˆf´—C_ï †ñ9ロ¿$9> Ö”®­`9³óï?z7W¼@nºYÙTù;êJ‰üAôEÂå"OK~¶I ž¹…ª¶¥Æãr bÆËT€ñ«à†Þn’è,"ú~d&|†Xkêvnê @|Ö;UÀ#ñVœt<øª$Ôó<ÿ d&WÁÃ2–‘2vjz7ËŠ¶Ùüü‡ ÇKÄž´ä£sú·Ì£Á^9Ú—dùÒ.(™]üuPk§ä‰yYSÚxnÊÖ}Œ¥=2C²*©v“N¥,´tÈZði''?Pî~à'qÖÚ>o˜_"`|(Ô÷ØÌýP,q8Ý.AQ”ÿìÕD–ÌHËx¢BP8“yln ;çNdqv®CØC˜ÇLÖ@÷´Ó5eÉèîž{ñE葽WòXnMè`§íc¹Zw‘“ÚÒfLÁ‡~ . ¬Z»ƒœ¡šüŸÕÛ¶îêž3>è;ïÑ…•µõˆ‹ˆo>ðL«ÜA|«-Xû˜¯ázfˆ/¶IÂIä°àÝãªø”NÖêpêØW£@•j—³š$ºª¬˜6Ò¥E¿îcÕÅùµ6ÁÝ6&Í"ŠAÃàH³ßÿªÈrÏâ^ns“ö%iÈh'ºŽe"s@2ì;1xÿKzÙ³Õê ¤5ëÜ•umR¯ÀB™•ÉHýöú[ý‰hqÓf¡×A_ÒÜ5üD—>óì ¹…Û^_@ ]l_KXú[æ}b‰ßÚ­…³‰ÕÓ'>£êÆÞž„w$Y¿sÑÙŽ•‡?¢~íû!¸®b‘gñ9ýA€¯îÝêÒ4GLyH¶9´'ÿË‹~…Õç˜çñgÌϲ´¢™Ú†‹+}ä&íKÚ‹Ãç¼щWÔçË6ÇëÛºK¬ÍjY+UH½¯Ì(¥ã¥2»ïÞí ({¬Ÿ¡¹¼2 9t0ìô£à埦ÐâyöÍ(^œ:’Å×(M«š‘>¦À|M˵Uàyܬ9’¶7CÁuÍ1öÂÍhþ£|RõA+óvªÄ³QwÍië¦ýF× q»ÖB«1¯úTéÙ‡ C£÷°pb’½¸÷º{ݸ¶ëö¨z'+(:näu4a«ú áDôŒõ£xåij+yT–‚xùqÐÌÛ;²—5!G¦_ôÌÙ+ª‹LÑ>8É3\& ÄžUc lÊFJÂhòmPaäû³nK¾ÛOm˜Wltÿ¸äþ"Säñ`sÞY Iý}ÃæÖ‰U#{òÛ=Zétr ñƒ÷¼iîOâ ±€;$Ê»þ¨´¯˜8~ìõ¿ Íb}9ÒA¹  “ŠèÑRÂ0v²%%gÃW3²ÜŽ#Éóoc¸¸*Ñŵ~rኄ˾ˆ$Û#Åèô†/ðËHGbä!ÑqèΙ³0dtë ?·;!Oˆ%™É#)þÉmAuw¨¿øý¹½jú;u:õ~ÈO¾àô)9ÙÈPZã þ[aëI¬ dÁyo[“»¥Te6tò›;´p ïš‹äz=áIÞò6Ý0ù¯eÓºŠ–],ÿþÿ þ?1¹ÐÔÅÍÑÞÔÅéÿÔÈQendstream endobj 23 0 obj << /Type /Font /Subtype /Type1 /Encoding 444 0 R /FirstChar 33 /LastChar 126 /Widths 445 0 R /BaseFont /PFFAPB+CMTT10 /FontDescriptor 21 0 R >> endobj 21 0 obj << /Ascent 611 /CapHeight 611 /Descent -222 /FontName /PFFAPB+CMTT10 /ItalicAngle 0 /StemV 69 /XHeight 431 /FontBBox [-4 -235 731 800] /Flags 4 /CharSet (/exclam/quotedbl/numbersign/dollar/percent/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/at/A/B/C/D/E/F/G/H/I/J/L/M/N/O/P/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/underscore/quoteleft/a/b/c/d/e/f/g/h/i/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/bar/asciitilde) /FontFile 22 0 R >> endobj 445 0 obj [525 525 525 525 525 0 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 0 525 525 525 525 525 525 525 525 525 525 525 0 525 525 525 525 525 0 525 525 525 525 525 525 525 525 525 525 525 525 0 525 525 525 525 525 525 525 525 525 525 525 0 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 525 0 525 0 525 ] endobj 444 0 obj << /Type /Encoding /Differences [ 0 /.notdef 33/exclam/quotedbl/numbersign/dollar/percent 38/.notdef 39/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/less/equal/greater 63/.notdef 64/at/A/B/C/D/E/F/G/H/I/J 75/.notdef 76/L/M/N/O/P 81/.notdef 82/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright 94/.notdef 95/underscore/quoteleft/a/b/c/d/e/f/g/h/i 106/.notdef 107/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z 123/.notdef 124/bar 125/.notdef 126/asciitilde 127/.notdef] >> endobj 18 0 obj << /Length1 792 /Length2 778 /Length3 532 /Length 1339 /Filter /FlateDecode >> stream xÚíTkPWµ•ìÔkxH{ÅI}„$»@H #BxX»µËî YIvq³ÁDmłȫ-Oßµ¥ Ž(‚‘ªXŸX@q SAÑúÔÁj— ã¶¿:Ýý³ßwÎ=÷ìùî\Á¬ð(‘/AÇÃ@šbE¨•¿Ð(ŠTŒð?b,ISþ åõôD¯! R€È䮈\*ã €dbÈ æúÍ#É€¯2$ŽQ c5PÇià˜DÑ8 Y“øjµ rl…DB=d’!!æ¡( Hœñ0¤x’1GA”š²ñ6aHz %CFÏ™s9“óg‘ )­ PÍ“(in/È9ù7LM4hµJL7&oNé-Ó‘ZÓ+­K2°¡4j"u 7 Ò ›ˆ±˜–Ä}©-"Ô]Œ¸IÇRH!N²¸¨1­šû"&Záâ3‘ÄÆøÆ„-¾š« ÇHŠ6%A€¼a›kôMÍ¥ÄF‡ˆåˆÜûúkÙ„Í(œ&H*¸J=Æ0˜‰Ç ®’‚µ( )4rŽ%bŠf¹%€‹&¨i†76VHt$eÐuÍ Ô Hp’Áµ#ûI<78Þzû— Ú¸Väê Džœõ2™4õoDÜÀ0bÍ§Š îu­&¹°!4Bœ×ÙAã^é+‹|} -`ïåƒïJ¬žµTÞî´<±´6m+I¤FIwDÌJ`Ëw÷Ôä6ó[íã^…¶Ìaûeöò¡=¶?Ôdí*_š¿^Ú(¾Å7mÈ*zÿ…pÎ`PóªÏK¶mìq”72½[6Ívéš½®eêb@»·áIw‡µÍüÈoç;;È:÷[v½3ƒoêºõëÇjןY€ß»p=$(œ¯ÌšÓªö¶ŽÂFnò–©“[[…ý¾Mm=«íˆçÓ²ãŒw23Ž*7g¥9®½úK’%ÿJæœÝÃ)aV¼F'Å©®ËÍégz$yë58…ÌléuÓŒ:´•EÓn·É‡úkíÏ­¼S]…f¼°tØ—ö´KÜv´ÀÉÿîšUõ žÄðsRÅÁGJT÷Ëê›­;ê?Dm¶uúå=Ûi¥Øh{Z¢«‹´ÁU%yq%Tf±î.Q׃<Ü£šÙ?}÷ñRï‘ø>¹ !ì°È¢ÁbrÂIQÃÞoZ¡A*Î"öÕ;*?uº®Un$wÀ ?µ }N9_½—*ì-´An—^ž›ê•¥:±pk.ßCÚ.ù<½r¯³ztZ»÷h_yS ‘/mi¯> ÃË;c›çªqiíþÞæ›Ó7‹Âe+÷±é…ƒ“KéöýHtæÆk4¶íÎ.6Ë'Eo^{Qü›*³øxcJTQOÕAù¨ó âV¦•¿s]UjÖh¯ûŠÁÅ´ýƒ ±mû®?nƒíG÷¬9>è¿Ä:éÁŒÛóoÏ *³2DË-Õ=ÎÌûî÷æ/ðÛ õ‰]è%íå]¤qï¡ùŸ¹zÜØ²ÚîIvl†¶tnðdä>¼ÿþÜUŒ1,­Ã˜DÞ_¡Fë¿endstream endobj 19 0 obj << /Type /Font /Subtype /Type1 /Encoding 446 0 R /FirstChar 0 /LastChar 15 /Widths 447 0 R /BaseFont /ZUAUOX+CMSY10 /FontDescriptor 17 0 R >> endobj 17 0 obj << /Ascent 750 /CapHeight 683 /Descent -194 /FontName /ZUAUOX+CMSY10 /ItalicAngle -14.035 /StemV 85 /XHeight 431 /FontBBox [-29 -960 1116 775] /Flags 4 /CharSet (/minus/circlecopyrt/bullet) /FontFile 18 0 R >> endobj 447 0 obj [778 0 0 0 0 0 0 0 0 0 0 0 0 1000 0 500 ] endobj 446 0 obj << /Type /Encoding /Differences [ 0 /minus 1/.notdef 13/circlecopyrt 14/.notdef 15/bullet 16/.notdef] >> endobj 15 0 obj << /Length1 2150 /Length2 16051 /Length3 532 /Length 17226 /Filter /FlateDecode >> stream xÚ¬¶steͶ¸³c۶ݱmÛ¶mtØAÛI§cÛ¶mÛÉ·ßsî=ÝçþþýÆÎØc?³æšõ¬Yµj…ŒHA™NÐÄÞÈTÌÞÎ…Ž‰ž‰›PXV‰‰‘‰ž‘Q†ŒLØÉÔÐÅÒÞNÄÐÅ”›‰‹‹™PÌÔððÇÍÆÊÍÆ CF(lïàédináBH)LõO¡ ­©“¥±¡¡¬¡‹…©- †±¡ ¡²½±¥©‹'=¡  ¡Ò?W8*™:›:¹™šÐÃ01šX»™š[ÚÁ0ü£$igfOÈñï°‰«Ãÿ¹™:9¤)ÿ¥IE4±·³ñ$415ƒa³Ìf pùÿCëÿsµ±‘3´ý§ü?ú† m-m<ÿ'ÁÞÖÁÕÅÔ‰PÖÞÄÔÉîÿ¦ª›þÛMÖÔÄÒÕöÿŽJºÚX Ú™Û˜2þ;dé,féaj¢`éblAhfhãlú¯¸©Éÿ•tî_ ¢’*Z’r4ÿ^Ó)ZÚ¹¨x:ü§ê?Éÿb¦? 莓¥¡6# ½L€DÀçéþŸ¹DíŒíM,íÌ ™ÙØ œ =a»@l„ÞL„–v&¦„¦az;{À%„€žøšÙ;Áü³ €5g0ûWìßÈ @Ë?È@›?ÈúOòŸaÀ0 ¶¡íŸ ÅÑÕÞÅÔÄÈæßkÿŸ6B;W[£¶Ž¹ÝŸ0;!ƒ‰½¡ÓŸ×ÿÔøï¬Œ„ †N¦v6¦fE™þ'ú’7bèüO gë?A€¯ƒ«óŸÀÖØÞÖÖðO`iáé`aúÇ`è(doò'ÄAÈàlcèlñ'ÂIÈàeêdÿ'¸ {;Óÿ0ÀÞÅýÏ8ÀÛÅÂÉô¯Œzoïú§lÿtßÒí¯ €®3`_ü‡²Î¦n¹öƒé5‚  jgù·ç?÷lcÿ×E\ÿ”±µüï(;@ÐÔÑÕðÏò³¦üC€©„þ`á?˜Cäê‹þ‡8ûC€YÄÿ pÿ’póRà"ý‡.2à"û‡.rà"ÿâ¸(ü!€‹â¸(ý!€‹ò¸¨ü!€‹ê¸¨ý!€‹ú¸hü!€‹æˆ à¢õ‡.FN†ÆÖ¦.ÿµÝçÿž¯ÿ`ùÏÿý$p±ÿÏÿðú³ë¹^Fàeüç¡gˆ™ü…ÿì‹¿ðŸ]û4ÌÿB@£,þB@§þ:]jV!ÀÉú/Hýuö0¬þœ3L€ó”Áî/XÙÿ…+‡¿`åø¬œþ£¿`åò¬\ÿB€•Û_°rÿëøXyü…+Ï¿`åõ4LmMþ÷ùß!BBöÞtÌ€£ðÅøÏJp–“Ë÷¿2]§ŸË¿^Ñ€WÑÿ²™%àÅejêaj ³¼`oÌbõ£!¬ÔO4ª œXȼ1^®®k¶6x)ئhDÚ‘zã—ÆKy: üøûŽsT›â¸Øe c|êüÇ›ÁAºW3ŽÆMº¬ç¾ñcð)BkÃÜݰüÌÆhi’fAæÕÀi®¥ˆÊ!äP·¶ÛïîŒv ±tÕðÐ_ä,DJˆ©Ž¥¬áëîˆIßÁÖ'ƒý¬Â¡šhV¯íÛ\‘_ò¡r?tÑâŒÛX”v¨Q•ùÏJ Âj?û†ª2Í•ÀW ”F$ƒ³Pª3½°Eõ§¯0&D#dÝ.i›Û4ˆÞÉØu7ŠöôYhô- ¤– ¯¾çÛWÄP.ÅÒ½=:ò½ýnJCDÎ×7Á#æ$ͧ\4žÞKÚ;öNå­6ð«u=ùÌ|=3þvÌLN­žr[Óî¢yüÌ:ms-q1‡°2øÝñ@êwëw‘MÄiÓóOXTiÜŒ:gO%£“¦¡b¢ž9«œ/ˆ8¥?à ¯Oä‹](At4[¨"*èùœÄZÊ^#]ôá95ÀÅÀT)†ÜÓÉdkbÆì››á1ˆ¡_wC½î’‹o꤇—…ºE{eÞ ²/{´ öGiN_¦¸ïŒEŠç‚[kR:Ñkîz=3oxwŽ=S6Bpì3£²ÔÚ=3¬CƒR£ž[c¸OBûRÕ×Ãhô—oùÔ=uMíÐÛ2‚Ô1åÕÜ9™š%Ç9§«Äùp³†¥VgÛ§-–¾ 2y`>ž4…æWÉv&¼Xz æ<ûƒEz|;#Üúa"È[— ¦eÍÙ¶p°ä$~~A`²[#X”A* µù`&ü¶8ÿÎqk×7ªŸì+µòŒ©_[lºµp>誦ɇCKl¡d!ö=Õ"J´ÏexJœøçö?&”Ô’–d?ÈÑ‚gÅJ,3˜~€ê´­x\Ü +yè“Æ¿òõDÎ"ìí4¨o*~–ÿk¤)ÛÔÚ=¿LhîŠ.¬1iÈôŠÁî)çŽâLF ßí/-jÉ®ª ØÈ÷{ÚN¹+R^ìE‚š~“/×hiH^òB7¾1”t¬ZÓè‡Ê%›>ªÔHž]4^4.|pO:hù,YG´(«Ã£@¾§š@ÉRËŒi [ßø´ !5;N|Ë/ÂE»Z¦r}€ÌŠŠJ_kïý.lè÷Ò¹öüÄ>-‚Ôît5Õ~ôµÓWé°(v,™¡Q~—e»Ä7?ýâø b§v’#màkF‰Æ¼Ö¼›zÅ>Òr„'¾N2ïb/^;÷+ˆÃoÂîsÖÿeEšÎ\AÿÕ½ŽŽÉ×íõ4baÀ')¿]H­1¬×îi:a$~diæ¢Rh`ýÛïŽâ•¹³†-ÛF\*ÕÂà]YÕGÕŽ…@ÄŒò˜% V¿fwfUÆ_ŽfØš"¾¾õZF ÊФ Æ‘axÜʳ~.=]p³,Ö:Ö”Ëh原m»•u£ñ\"›8…ß¹qÁùÄ‚ZÃÐïä·c~Õ¥ÞÕQþ,MÜüêã\wÂáâÑ&…´ßÜT£“çUÊV@¤9»Á•,r_]Û…`Ó,ÕªNÿ ̺\gÝ ‚‰Á—•—p<¦\z\¼ èt4‚I °{¡‰Yw‹œ!/¦1pIYzt»,â„®_£‘ש*\9=Ó²§ü ü>f=ÉA/ˆˆ×Iõ~Ñú0¿äÊ[SviU#û2«‰A.¢8pærâá{T]“a¯\óÎb‰¾ŸÝ¼ušKðŒ31„ Û2!ai»ÕM‡ß=èš‚Cµ‹åJOâDkÇ•èöïõ”,_þר¨àqø&•h©øîþE{-Ù*œA+œí+ϳ#xq!i’ Æ»Uް µ”M¾µ»°ˆ¢qºÙžÉšJI•ß {2ù‹öFÍÖßì1«Ö“,N$`bEg«toÐdœI¿!MgYZÆ’*~ÜJ$k˦m§ÈB‡Hè1­ÄÅ’£`áðÓ*úŠ¥ûœ¸=þ<4·Kd5—”'ʘãî"<¢)»[dÕ6HÙBãáúbãê*ɲ"¯03âÝæ©è¶Í”C>ûñ°â¸®Ç¸®Ø!÷Æ¿Wå౩٘0üyš„ê …=z/*yž/¦y\éâÐûÁ”Ëé–öЮ´˶%TÓqß×§åh±=³¥ô³É¸i’«ßól¡cÛÓhÕý>+Ø™ÛGìÅÞØsjoZϪ… NÑ«]ôL‡XÃèyÛ.³¥²;[Ó!¿a  *œHêåãq ¹a[¿K6Ù0D<+Ã+OÉFë=Ø:-˜šTB?™†å7ò׊òv£Ó¤Þz‘‰€•°b|߈²³Æé‚3rÆ k %hÈDã"ô6ÜîWÆ$¤Õ¢R®¬ ç“1æG'E÷ž"URVE_2¶äÜ”‰5Oæ2&ÙC–ª¸ä+&E¬»T‹»Ú¨]W×"œc® ½œË( .…\„*hÐe>5—eJÑa‹`+÷Þ“Eýñ:ðÄ”; þª9vFÏ5fæÙ!^ô!äÍ¡+žvá‚Ó8'4pZ“@íR‡=‚±YÇ—ÙÓL‚Ãá¬lÜB,-°=ƒvÓï—6ƒE«x¬Âþ‚zCf^nV®ð üsg5Óβ4>*X\N9P|Þb*-ò7\‰Æ ûˆÑÐza·)¦Ïaþìò,r7ÃÒÂa~(†^ÂÜ“{ÀcŠÁŽwðCáÆ¡›=$ cî/—2‹k0—Ï¢-IÈpm”Ù¼Œzº­Ž[¨̯È]'Ÿd꺒Àý]L-‹ V_œCúUÛ$fŒŠy)4xP³¦”ÉìWPtÀ7õ&iã†|ÒWýÄ/.ÊzCgïÖ¨ë¦N‚Yd‹¬å¢{Cøõ,³Ö*lž‘ù©"õº:{Þi¬!5Y†Âöž˜Ÿg¸9;G™ô]¹À%|?:ýL,% ]ìñ •@ÆØýf íZ޾úxëŽd²[Øn#û©E‚Ǽ‘bƒ 7S‰Ì[5\µ‘í„’.¾|D“—äV‚O·0Bþ/³3§Ö„„ËB¥Ó ƒîÓž‘ð®=l¹ÖeŒ£ëGÍß’üΰYŸD¤iPçø¡Ó.Úõ¢ü 6$SW˜¼r³½ßز™qáO ‰ðÎ…¨ã^Zª˜Û™·'öÆÜ% µŽa ïAÑ,{ʼûÇ€Þð‰‡Fh’m‘¶ïfi%,­C ÏÌÕê}^}~VFu#"¿ú²‚m«|¹ô½ÖhåbC…–õ½• ´ÊSäz+tS2` /iK6•U/flh74”A;ªÇ5ð&Úý´ãÞ E!J“34äl—]â›S #·÷ÆŸ÷8Ú{zd®½­B™~6? ßø¼>t~äëVj>ô1ÆíéŸ1)zQ‹LTV ¶Ý¶Ø2ûœ¾ÇÚOu çÿ-$aŒ¨*Óp¢Y.2ä+AF¹¯ì¬ÜÉMü,=g‡'Bd„·|õTÌ1XMP>)Æš@¦ñª¾h’ÌÖ—ˆDóQ×f-€ÝsNf(I‹ueµ€¬ -í‘Ыz}Aj¯÷ÅTŒ#~$7 Y°fÑ8F›îÀ€#‰z€ð…%|ìÚÎ!Â1µX˜Ÿþ×k²g¶òSΨ˜ÄçÚTÑò1OŽ7ø´+«›«:>%aH+Fu!hbìê“ôPÉeð‚ÒÖ—ZÙ7Yzõ¥Ÿ/…øM-¿9E+ƒD_\b)¿:Ñ“ü¢º_ŸPÌ»W> DhP~3ëe£¾¡2mby÷µ)\-)M®µ¦ ¨  ¿ ãèÁÍ£ù´vX_Ã@žBòÌ\§t­Pæ Ç;©Ýq .­Jû!ð‘ÞTzJ õɳé=º2Ðo¤ Ùˆ(¯!;â‰úV¥dà?%KmcG")BáŠ+é½ç©±ÔŒ±S‘Ãã®(ÈÄtFÇÃmQh}`j™}òû“ŒUx¸~ãYt€5ȚЦ’£"Uäe‹Î:™Y2d ‹ÄB®f-—“™—åUݺ:™6˜xA,tl†óëÍe¾.5ï^@o0³‰¸n\º ³`w.R-òΜ•Jú¥Y˜]¤Ôq`ö³ ¯cŽ·õÀ› gÜIZ?± ²Ù"HÓŽN¦GÿÜ>«lóUõgœº:|g\iÀ-1>>÷Œ?Õ¡„€2Ѷ®ø«É M ‹ù ¤À’ÏlÇnBê½Ýµ‹­óO5æ…;éÇDá˜ÚЖºQÍ览@F"[ŽJ‚Ls¿_ q -J‘ÚŠ3m-ÞÅ'Ÿ8A=«\Ñ 8êwןÈÉ`(!/°Q,h£9À2P°kè_³Ôàxˆó„•"‹N9ª¤U“ÏGW¥¾ÇÞZùûÓ):.Pn«æRÐ/® ò‡Þ¼‡^X´4“ŸÄTu¶ÍhD|U!œ7€òÑîÁ›¸‰ú{x84ÓÂõòJ§f]&êÜÙã?£¹ôll±Á!ùR+"Ùºÿ|š'ÅE­ÀéCüé ÔKïAn\ØËÏh\A7Ä}á1¬@¥’*^…£÷ Ö÷ë7Ä5hžâÖ±»2Mÿ!øuqcTvÍ™ïTâª&Q1ßøù†]ëB“öOtí!ëÌdÜñ¬Ë`®DR!k"÷„§ƒQ—Àd“)Rmyá*ôÌ!šå‰hv$7|ƒÜ§WJ -_š=VtlPUŸuŸvC!@Æø°¾up$‚ºme‡ËർYo™Àœ†Fã?Bûôh`Ö[ƒ+& ûpsi ´X‹÷;œ$ûÝïåE õã.ÐÛ®ÂÔšõ'†`㬛¡~‡ûþ=ó÷ýi„tÿkÇ2-2Ou]âm5²TŽÑÕaxÇhÖ.4ÑÉ0ÙïVòª!!:›Ôþâ„CסÐo9ŠÂ\LLûI2CWaÁpçh0{’¶!®ÁÒæeб3m¬2éÞšOÈî÷Çç¬@ ú"¢Û(ë/t}]¤ñ’õÑéžq§’ªÙ2k!ǰžî±öThmËÝ"Mi‘UL"vШÀVŒÊ(š_¢µ¼ßãÇ46^¸2.EAâ¼N÷…¥â,ÎEÛUÈâ$cÓ;ŠŸçúKZ¾Á5 dËd‚tg0Ëuê¨ÁÙT)ÔgÉPÁS°‚lýDÕ¾9Vhbõt22‚JFû.æ.Õ>ñÖƒüKnüãn}…ØuBôv7ßW?>Ä)èá€Á &4‘šöIÝ6ërÑÔupµ0¼ŸN²ƒ lŇÉeñµ§­$fÉ_–SÒ»3©úmŠê@_Ö¨ß"§×yyÉJ`òÉÐ6>Úd‘È<\cB>…'ʘǪâ÷¾gÓ@v㵡·7F¥-ëØZ] ŒD\n™«‚)°¢z9ì#j'¸Mpd~º…r (;² I ¶s\ùü¡Ýá{gHgšX§ŠÙƒ£‡"ù![ØÅ¹X=ÔoP„##Ÿ²HÁˆnÎÜ•Ю*èïÄhî{^6D¥<`dhî‡|k-Ö©‹«˜iδ7_’‘9;‰³VRÀÜ&À(¨à’W!K›X¯ã±ˆVï®^ÔÙnÞaî:Mw}ìDC.}øñMc[ò î€zÂGë0 ÙÇc¾_ëÑÊ*µa©À§ëÙ¦m•Ò0cÕß(Ÿ÷o€2DQ•ï*õÕE]¯daÕ2âNì‡R[›88ôËTQi8ÖDi|`•2õ>QbZÊQîºÔ°5¾§5LšEúv‘ÏŽc¾0€Éèþ=ü â`!%%DO-B×Í@Cô°s•Ξ_@ê$xÈ;¨VÞ]a3,©þxÅxÀéœÖËí¤Ñ%ì¨Â®vaò;Ýž­«+áß!~Cº6ñ?‡ÙäñR¤ã/0åö‡ÑûÉ[È0Dr`!ºè¥Ž4ƒþ½¥Ð}aý¤:óôS=Çêcú«ŒüJŒ,H'."HöG‹\Ÿ’ &r–pæ:p †cS¤.áj×ü¶Ïƒ‚AóÀ ß.ùë¨ Ûíx¶8s’ƒÔc€)‘9ÚΛŒ¯e‘óN†„2Ì9Ýœu[ÎPzãÕ½PûÏD4ãu¬y}R“+¯­¶§è•¼my^4SÈ@`=4—Zªõl‡¡4Ÿ:Ðþ(W¿®rœGO;¥ãZö8©»æž÷ð”Rö.ÎtàTR©¸_{Þu*vŒaQŠ…ö™ÑÑ^îNw5æÖ„Z/~¨UÀä Í ]M„Û?âšwe[M¿C“˜ë›NF¨#{NCTH}^¸O|ÃY5IoÂÏÒÄ8V·#‹>¢‰éI²¯+ƒ]tLGF ým±àÀRa”ä°=€´%µÖÝÁsF%ñæ³ÔÏÖí²â@¨%/Õ? ÕºO™rÀã´`¢•è!Þ7õu0-Ãu|ÂqA!vÃd¼nÈÊHRÊ+sò²LTþõ^ØU‹cYt»»Lüçš½Ï;'U,z\hÍ9÷•î&ÛȨž2þ­N“2ërŒûÅGI °ûÃ-ª÷c“|^¡C‘ÁW9Ár]þòл:A“)®ìñþ¥ðQÙˆÔ„kÑÚü×µ;r(+ükvjAí¡Ø‡*Gÿ$ÙvÛÂÜ| ßöÖ¤áîûÜK¾Æc)cÈ5´2$§LêXžOÑ›µÅ ½OâÊk}ÿ•Âe:—Ôù~¸€HçwH¯Š$줭æ4®‚Jeúiu•zæÁ\R.æòœqÚVK»²u(Ñ;ƒô8;(åÓzØ\ÒasÌL»Òô2<9¸€[ôsÃÐ$`Pª¯±;¡3gµNï=V a±²tCè¡U§òú»«×žq߇mÔÀ…úÌ7Rƒòs.QÀ„¼y˜?.Ù»\d}cÜÍÕ&Ó±Ò‹ ™ÈJèða¤Ec2äê%y9ÃÑQŒÆqåàýM,ôŠ ¥aö¥Y@Ö¡‰¹6iª?ŸÞóòGZÅÝ ®…V5P8/8 +OœâŠÈjn¶¢ËÆíh‰íz@[Ñ]—>Ncªa‚|ꟾ–Óúj„Éõ(†i7L §¸ó;-uW½­t·µÁAÄÚõ•¦2 …èll`wІ%l¹:F¯µn #%Ûˆþ~Ê@4û ͈z;]ÅqR¥Eí7ïÔx²™s£×I£l˜Éa/%ZÝp jT0C Ô¼ö¾XË.©j}Ý¿8E·I=PT7»Sµf Šl³£_òÛN0æùœS`ÑüÂÒRÑ×ÄLK×°e2½nv!¬ÚšgÿMe£½ÐÍÏež*äš'ãã1ú~ÛOU_x¦ûXDó[‹q![j>y”|Ýh‘˜_¼Ú¯ßªÀÜáz2êñw·æÔo¾oæÈyÐ 3Ö¼½Ì› †™Ó™cT|´¢¶žëlb”æãñMºº˜ŠøeëE6¢8¼=B94ôytÙÇ=sL;ûÂK~öO®J@¥ÉǸ4,®aHhlöžõÆÉÜÚ±x—ìÓJ8TD)…tÃtPSÁ‚Ì Ui¢f÷F.‡ºvX”æLµc¤aQeÆÍˆ¯åíx4xø"0Ô§D'ÇÄxìíXÝßÝ!6|™ÅûZ:Ízûœf²¡Pîµçf¨;ƣΜÌS{t-„.þA÷ HD/çgË*Q«Ñ@í„!§oðш¬¶ŽOû{»Ö2ý6*òŽ’d·¯ƒêžig›Š~¾`³U>šƒ½$ç6Qùˆ+µ,üÚ]¸OÇH¥Š­D÷´ÆXŠiåDT½Cçaˆ9 nû«\»¾ü)gºÈ\÷¯b:¿»[Û•Ö0eï´ wÁYÈó}¶X DÉ‘r½CÊÌ$L ”_íZäñ@-‡gths¢1¡Ñ~P5”·O¹„{$™–}µ%CnºhàG­ÒÔ±_eh Z ¡i'ân•0’šƒ'˜0Æ$J:KÉL—Z¤5ÚƒÃQvKüÏ2©ŸD3û9…£8º%ÏÔœ pàÙµÍ(ª[¿Rƒrßð Èí˜àDJ>QØaÙ½ñ7ßÞ¨!*;¶Ú½95(vô6—}~³>nmIÈws~Oi¤u¶!Ô{‹‰òÚt°'Ô’™JÌþéÞaSƒ¬…êÉR)i’°+8¯¿vEv§Ã^$>Á ý‚d çåiZ%›ã_,Æ8s±J™Ã[ÇýUtÌíDIsbs«\e[Þ°·ƒï•«oWñ{Œ0…™PeV 18C\õ¹-ýðñw Lku¥üÔpµab½hÜ+˜Œv÷ùÈe*¡† «èïß)1»—HD˜¾9Ï}§É¢Y:x Åpý)ÕÔÐ{”$T¿„|* ¹HZž*%8~ɰú¾•D:ÆÑ_ž‹‡N¦¹uêGy>á©JÄ“õä®·´:ýREÖúk úÎOÕiFuJWçšÜ&2OÙ[ŠÏ²îöÀv宵úmÈ'`±0„×VÖ-ÃpJ˜ÄÍÀÆJÕÚL]»“7Ñe4&ÓzVu´Ãxr‹<¾†(-‰›—ƒ¶«8Ýi)ùñêWÜx“ýΣ$ïCϼÚHIüɧ$faˆþ(0Ð-ËŽuz‘ÌG-$f(K器W Ùhì<—®³ÛÅ@„fÄ(ØÍ áì%2üO:ÙÍµŠ±Aõx—_¿ë>$kS~Júx×Ü"*;8þ ÛenÅéUüc6{O3Èoî6ÇUŒFª§Ós Û+¼eD^Å3' îÃ\VT`DoÕD²A( œÖSá2 •‰ãzRz±Ðg^™¹sµlƒ^’«¦iˆ®ŒøË— @<\M¥à5Óu~ùr!Îpß²}"fãÒã%­nŽ[8\à.0¤Ë3v%RÇmНufOð¦Q;žG Ó¾¬¨XNŠ®¿Ží°è\Da^HH<¤gÀ(]Ô²ÚäwŠChH÷Jõ#áů^Ây›¢WsñpÆå­¹ØÛáb!„Ô”2ÍjàcʯwVgþ¼`ôoãÒŠ»Bíù©¼}¾Ä…FƧ¾¼•š÷Žâõ ˆf4×ÓÑ+ÇíãX–¼zVˆ¡å6Ý›JÍÃzr²d8Ä;UΨBè5J*Ã"]b^e¿³ÉÖI+‹­o¡ó#}ß]6:Yü›F}ÂbÚ'#¿¬²÷šÑMRt!b×Â\v»è¸ s}Z¥"jL Õi gó`cƒ|ç+º¢„:2úµ±£Ó#Å“Xáöés‰š¦1Ÿ õ>±ÒU¶«Ì}óÞu4›hNlëÎÀoEë;Õ…ÖXÆ*\H¿Ýq3ÂxÖbKÇaÜù\2w‰%½ƒê½~"dÈõêéšë¡ñrúmÈ•<×ɯ7#™sT»Ë˜ï“å9é'p4EÊc1¨Äß|Ñ‹yKÂ^Jü†£^3Œd[ȆÇ+ÇÓ²©O®œwÊ¢&uy8vhášýƒNÇO‡8á´èÅálÙÒNôˆ7O Ú̓H)<û$:‹HªÀ¡Üö„„Z0é¡ÒˆÂ•ÿ6 ›M³†Tú3$ðÁ]©xω*2˜Ã’é\Ö@¦f•$OÑJϱŒ¹ ÅÏ„ú´ ¤š^BÂuà„* ‹ˆž«|\+ã|M?çÂÏli¢æpå—êf”Éý´*qpº¨»û€[…±(˜N¸m‚øó#’Úza®ŽXy¶Àhë æÚQ0W#}fšpCµÁvïI>+8”Ÿiàçí>è~ˆ+Ÿn()Xß5°†‚¹ê¯¡°®'º™Ä]M>ñNÇ%ú×ÖÑù¨O?“¿1…›ŠI¿Ó“ÝL;•­ôx*Â{‘与K•½Ž ÷Âz—µ”>(6µ•Ñ–'âÛ§ê%g/ÛÔÔm»ð­–QФ„4µZj¤z­ý(ŒB×܆m–ôF™Ó£4ç…ÒX{¤½éçÕŠÎ K\VÐߑÆd]T§“e—ü¥§SÉ´K`Ôÿ˜·aˆ„ ƒRAdˆ+òvÈÅŽô>DÁCïÞ¦c)íܰ‘{h÷À…V&˜Hl[–ÂhÓ)¡«©H¾ðË,ßä;¸j­ózÂf:Ì{Bzžr¦ÎÃ÷>pÊÌõXŽZT;XïÊŸb/ãê¤s"ÊŸ,a^½Z/Œ Ÿè¦ûÚ¼TƼÎÑ«g™Ós.¸ïs%N¤‡{µ“xbªŠèÆ|¬×D{¶g¼ÎõEœz —v1ªyÝߺˆÁ Øìb'^ jfaEÒehç„9™àžUV¾jCK7Nâ(žø¾ÔªŸï{>/sð¤Oï™Þʲ™Ÿ’1)ÚXô'vð<+S+ú—ã¬3Ç7nÇ\7R’—ÜáŸQ(œÜq–±”€EìNöé¸ÙÜ îvò·C÷?êvOþ™P’4„VWƒ6e…ê¹oýèF§G}ýEÀ®z "vHÚ´ÐHi-3!6[è‡N ¼h|±vÎ9áïõR­ùðT1VÌè ó07^Ü*„1k[vºùË Á¼_›ój;DZô.zª£q؆[Ç]—xU¦ ŽS,\y÷šo³æ©þaçüUOÖi±ÍÖ•ŽO”`{NÖ+£/ž¼=黤tÖò¾P…U¬ôÕ”sú…©º}ûÛKb×åÌ }»K|Ù›õ±þë²ŒŽªîóö´çú—÷ÚÎàþè$¦ö >¶+n¤ë/˜;ý9 4Øc`$ôT)݃íçåέ¶`Þþ$êÜy2¦Q´ìÏ!ÒðÊ;Yø‚‰¹» [ å–&BÚbúWYÃX <»Hx>²úÑTßʦ~LDþDGÒäœ1­R³üÝÓË…dA2‡Y¡Õ(9–v#á+I‚d;ÃÅ·Ìõƒ„wáÄîvÃÄi½FÌ@"µ(¨òÖPÛägƒóë•Ä2³Œßœ—ñ´*]ÊÏe"†HÚ4)ÿM{l²_ÎÒŸvücYU°ª­uÖÝùÒ7yMßÒðb¾××_ãû'"¯ß¤oÒñÜc¯Õÿ’>]y‘EAÚ'³Ýõî¡“'rɹc¼2 ;™ ZWíkÀj¤§S{T +¥m€Wïe¸²°µ6nGP.O ³d?G’æS-Â55vt~PVΡøˆß›¹ÄÊwóË(ÏÀÇ?'.=r†h(yE †4±IEÕsÄcbîø1yr¢¼Ê;0þ=­ÛÙ%ê³°=6¬Á(iÂîöûÉÙL²ÈÊ•sá;ÄDð¼¯4QÜnÔHsÐújÛMkM<*Ÿé"¼‰k™æú®íY†tøgUßKÅI¶D'zïv’œ±f7È-Ûoø‘m±¯. à3˜²à³d|Œ$EÈÕé”vƒ }ûFL¬¶i敇*ðà#ÙïòçðàÂÈ<̬vbn¼…a·@H0Óß[#640|ï]ê*N3`G3Yú—¹6ÒWå‹‚¦î‡bêårç^ÔP»t²RÀflJUŽ@’ð¡QÃÇ‘2up@vºÛïe{ü èæ[4ñÀY² ˜ý¨ù~éB#‹=¾Às²‚|"³"–:ä.i6¤ N“_=þ~±¤ÜÚîjÚ"“©Q™ÎáûÑyíÉÐBrÔuI{YI~Y=lOCßeÅÛH«e(€ÊÀZüfë#Ð@;¦â;3¤0fÚ³ÀÃoÒEÇ †ÿ;w¦â·X¶=‚§C®"[¤°‰Ö¸ÅäfÎìÜËña<ý@æ3ßmDJ1¼´Y}P#a^;ðˆ°ÁžèD‚Lõ ?UÑ­ñíX/j‚¦þtn6*SÇ2-»—…¦N… ÷åx9þýÞéïB¶šAÊÌÒé¯rêåÂñÁnbʤÒ5!ÝÈ̇°[îu¿Vñ¯¯Q€ ¼oì¨Z4ômI—fW Ú—׫õ…4ß GÀÂ9ÍÞ÷&Ïè€}ëÕÞ5‹óe2¶,Cm“@9£™©0ÞãÒ.V!˜í‘Ÿ½ÛÿŠZÉË9ù^,ž¿„-¦"ò„Eÿ2†}E¹SÍ!‰}xÞýäÑ . iØx˜1@;{w’ö5·¯Î@UTPú9ÌŽ—ÞùÁ¯Â6 ð7H‡ÙÈIcÌ)ò}éö¬Ð‰wØ1CeÀüá`>á4ûÂvåiW‘R­ü†¨Ÿ:ÁÏ ÄGkVz9¸sîpDÆvƒ$—ÄÙU[Øe‰fPf9²A6çÙC^§ù‘RÏžÏ:ÑûOà˜ˆ{“¬îa*#í«¨bT%ܯ5Ù½ÅvrÚ¶1ÍZ K²=šiVU"C<ãw!wou©È?t“?Ö!Åù؆ëz®PY)˜¸“l]à+Ý”8®3Uí»¥ñ"å‚©<¨Áëïçl´ío|÷9jL“@V”!åðû¦Ï¶ð8èó.D —JPq*f™#Õ g½äŒœ2å(†LŒ–ùS"špá|R´(Ÿ¾˜y‡}ã”—ÜÞ*e±³'»Dõ¦‚w‚ÊQ‰ œéB73BÑ{çq_a,ŸQ­´«Ñ*„öJôEšõÌ™ÁûHk©<"k ³}VÛ‘’4îd¿÷ M-7JgBÉhª5")~)õ.Þ5¹þ­¯[WOq^N¯‡”8=ñK[(¬¤Ú.í‹Iî0ººYǽe¯šÆðc;oâ¢â¹î=ÿZI¨« w]VƒK£löÚØyõ’{Ý!¤‹‹­þ–lÒû' ËQz=5<¾Ü.9h%ì#]ÙÆ¤é´-eÇ'þ ª ÄÆÁüÒÍ/¾óïèD;µqå‡_xMA§ÞµkWgñw“hkýj-· î×QA°&°|‘ Óé’¬lÏE­‡aýèœV!«œO@áU?+‡e %ˆétM{Ó‰Ýkî,=ë*‰…~ô¦WrTÃÔ×.ù‘„²z%@'ô8¤Å ³{µý¼ƒýMôæÑ~§“á¸%ÁUÄçQÒuK½‹Y|ÈÆæµ·•×TeÎj•šì‰òëíd•C*Ú³5 BŠNòê8TÚ{q%öÊzvïUq˜LÑJ?ƒÿø–hhçgB4t`æÙ±ßI64r§åÉõK?'\æêðUN%Qò*Ï.™zóž–Áî/tbÛFœIîÁBêG9çªDC¤#µ­Ü:ïü/•Øì¤yNZŠçËS<¿?|!¬5âA_mm"é@•úaøÑBÙépí„o±¥‹’ƒ0xíX=¥]+{›ä:c•Ía“@¸Éhĉ§:­“T+n!F* Á0UgŠ”# 1³ær [¿ /r›@Òõ#µü´”íI´áÃI¶£Ã_pþX+ÿ×Å4<‰švÎ]x³ä/ê®}$îýžû,Ü+ýI¶•S;ë?ÈlhM±<õ8{£#…ÑoÏßM^ÈÈ38 HIêÁû‹ÙÝ? •^ï<úåõ+zh[±Ö„ý»J· TxжP3V¢Ç"¶Ã ¡¶µMÀW¶0`ùnÛ³ÝJúôCÿ‹ J°p“‚Mî&ã¤×5pÕ¼f>´KÁÌok0±èqCÔÃÎ9Iåf‘Ž®Íu¬ýýIÙÆ«ò‘(–ðXOQ@•}<í’ý›ú²ûi´ùsð2>¶öäæ7 —¸_®]“œÀv‡ºýмÕEC& úÞ]o;н;·뀞ԆÃzãºZýÂTÆw`fÆqEXr–à Pjãû¡ ö¨ì£&E_ ¸²Á¿L°ÁJä÷õnAÝ)ÎñÌ”m—í—8À½H@F ÙF¨Ï‚ÐÊþÚ¸€Î€¾>ž Ô_4¬ìóUm& !Úð*Õ뢛% ´Àý.SGæ6vS4¨:4ÈA¡^o$˜ð(ŽÓ#´®G;“é¥N€´àâ÷(D± ¶ã5[œsdSÅò›ÍÎ[£ý‡Eìw{TÍøè;.R’ðÁK3³`Rv¯°ܸö›N18%±êø±£ôH©³iÐE•ƒB¢àñæqê憎Yé$É¿N Ûõ2>Vï9îá{¶kÛX‚¡[Ö0UöJȼöxŽ4 ávÃ3 À𸥠ïoö÷¶©FaÂnë_l¸”¹'¤ZüÚ$Û5ò×ùÄkC\”Ì” i«ó–-`r¸î§á”EQzj!<‰¸”öô¨™ òÌ)™é'¬èÒø_ÄUÖ Ù“Ú‰h#¿Òˆp*Lß  çJL·¬¯”:¶2Óf¥…¡bا3À Í>Hí¿¹1ƒ€é¼xšRH‹,ìТ-øj¿MÊ ­¾l¤ßðŠùPJ8¨ up¤Wã#yŽª_E ‹áËèÿdµŸ%‘¥Q{ë¯I„­ýd6él¦-³JðÛ¸˜òªÉîKn«‰ÉxŽQ‡Ä¶3*äÅOí ‘·}òÿ²ð“tÃû{Ö'œü ©z\ÍÑ´ Sáãù~¿8ÔÕ·”Öù šßsßLûûŽû&ÏT¯µ†œ7“wžÍUÝí€æ¸*HEâÕím5—yƒöµw23À)¹ YüR,[7»ßÞHnuãvØ:Ÿõ¸VÝF¾*Z¨´A™Öî2Æ“"hŸVŸW70Ú8>àòHQ£ò1y Ö¡S…¿ìfÑöºG¡§!ãЊÙG1lPèuRØ·”ÇK½­'±‘#ÁoªMÒhÀÏI4“ZzGùÃN¦êáôƒ>”ßî˜èÉ Ô5ÞZã/Ý{ü¸ªô‹EµÎçQ$öŸâéca _ÀÓ{^TÏê e˜Ý }öº¡’Y¼‚æ‘.­Ó™Œæbö3fk‰FŒ¡¿–¶TË“Iҽʩ6fåçZ37Xz´i *õž]Ͷ³¾ßX#ž5r8u­v¶LnêUÒv™¡íGœ^&'¯$9t鶦_Òãl7ÎGÏFÍiˆ1+K˜*ìͲ⪌Ìò?Sç.Ö[vaÍ`(~µyÿ”I¤N˜*SXóF˜Gz3‚@yž®N1|rÏ¡P©×+›g”F’l“°Ýí’*õ]©x\ìiHü-SEv?ÅMúD¤îÿlçoçSFÿ…±Bq«×7¥]tÈBSb-ãq«FEù öJ‚¼A;öb…ÑÒªÞê÷Áy›àóÒ€f£Ê,å÷If)ÞahäÔòâè²!©ÕCÍÕŸR†ŸBÂÀ®_ M³\¢›jQcúÎe/_âŸ}¨Tœ£Y;Å€_ðà¤5S»Â£ÝæÊ72¤íƒPÁØ;äƒwJ”|Õå½ï¬ñ>‰~¡¯(M0´ûÈc oSDiWþv´ » k¨Ö‰C›Â×NÞn“úìP—«;Š´cÍå³–É–žRMó(A¼R_ë‘e¬öê¯àYù肱Ùü=ާüQjb]Gºö¶°ØE|óUÌ`²a¡ªËµ|Ë/r¹V¹ì2DÉ¢Œ"tæ g ˆî·b=¡Æ×ø Ã’ŸŸ…ñ¹ïS{Ѓ÷;ÛF;L¼XXè [<_$¯Ò¿éÛÇpDn^?Þû 4$Öú5‰ÀVÍ£"Ÿ?,N Qµ„•Û„'Û ¹uî,màU ž@çŽ6ÈSŸßÚê&KÛù¹˜Äæõ¼ƒ»ÎXžE¨»)š.µé¼„;(W¾I- lâô‰òÉ€›é/!ÿm#ý@Îq’ùànÒ+`…Îy EŠ„nïœÉðA﫦ƒò­¡ýжÏ(ý nÙAao‰Ä jQ?é4Û¾B]±ã<ªFm• ò&œ›Ùï:Æ ó¨dE Ÿ~„õÌÊÃ/ZëuS#ÇQhï2#ƒo船~GŠLbûL@<ÀÊR’À¥¬æµq¯1bn“*2ÆŒZ2sVú ¿~׈µÏÑÄ‘~úQøõ¦6«¡ÑòN¼ð6ÿôåŒß¡Ÿ×ã4oá#¢'ß²†u^ÌŽï¼{è7ÂÔT[ `ÌP?yñœ·_Oº4Èf¾äm|çl¾JÀi]rj–$fûšæti{(¬ƒÙgöy{¼›0¢§«F:å•ÖÙôZÇc9?Ë/m–ÿºéÀ`g˜²¦Ží*(íLw’‡%7,¬X^%ŸIâ eÿ•Ûmaù:ë°P^•Eoº¦`7šçÎóÒZNç[0¥È”.X®Úƒ`ZD#F(X© ¶E0MWÉ ££¦Ó ¯„ÛxX±_¦P7ºóý O­Á ±¤9¸®Ì*-hÀÃÊê'_ä`–SFH®Bޏ8&”Ús®ݯnʘ¾ËÍã4yS«çù«¶•£°B ¡à·ð…¸Â> ú~ûÑÜøå7ÈK<ý§J`è¨ÆAwxó÷¢õ÷k7¯öðœiyóê{hùÝÍ0ÑøB#lˆ ½]ï«ò©¶F*ç⃲‘Ú¨Ó?ÝdE³*o•ÇÃÄDôÐJƒ‚©)áä·eÍÀd”“ t§ÍçbÒô£¶CÍG¶,#ä65«Ë»>ÎU™%òNø~2ÒŒLŠ™´=ðNkˆ,cñ-í<«3€.YÆÁhù ÚÃ<•~á>[w\û¾?&ÞLRµ…îÝsÛûƒ§¸—±z¬E­ÞîîõeC™æ×ÊjE…‹´øwem¿˜0~.ç_Ä™,ø&½#„ØÒûð/ì‚X.[ÎÓP<;ø—óÂûsq/•àR ˜zPÇ«/ªßi<Ð)5 óØ/Jlhfv›4ÂåoôuSÄF`Dgs`#HöŒ @/4‰m­»ïcûPñ‚”麦ÞATš¾…”ÝÇðk€eYuzè"ή†¼¿ {Dr”¿!s›ÆžŠv9*CÁ.UíˆËÃõg”O£ÔÆ:_Þ*àV÷€Ä’à þ…^ÚWg€Ù xºqKì¸Ó3,`±Dì\Dg— ¦a˜µU½Ý&Ëí¿Å8GÞhN1• à&[|ö( ìÞƒå­rk‡cý*EÝ ¤,jz5UÀ”iz‚£6¯!†Z õ Þû¤`&Ó¨ÐÑnu½È;ÌèH¤°(½Å‚3BîMרîw «¼aGÃyu{P ¾Cý¤êbóm7ª%h˜»K,¥íiT!bž°½ĪªÆ—>U(FÏH½Õ<é°tôk¡•|èÝ*ÙÝ gãù¤Þ•iDï„qkžhWýƒøþWÐA”š·ÚŸÕ É—×ÈZ^Hè†Ñµ˜ÅœuU|™"ß›àˆy°WÓ‰Ì@j*ÕËË/tC+xT·ÐWOkT,ÏBu‰9µ´@ûFXsV)U‰ð(%͵3BX°J"…ê1W ÕZ½;*cëÐåø¿&…¢È@˜øJÁÞmUT¹2z©}ÆÍ· Dt- KŒ©•9Ý-aäJ•.1ÓÄ·’ïðâuªÊ{D<`ˆëÂ]ÁËñÅrÐd6ÉXRG|úòZ"­êu¢dÏ›IglEãPýÈ ¤O&WQTbÓ½u1Rp óIKXñ7ûB‚Ý2×áÞH¦ƒƒÑ;ÊÁ¢_€_²WGtÖ_™v^ÆókIé"WXÉ­PÈ`ÿÂ|5G2)1¼¼já"‘A™‰¯À8Å0æÇ²ÙÐL:«¸åf¼ÏV‡:®Y¯UƒöoQuû8à=Ê4Ê} åòtd…BDkoüáE³!¯xžå æõ—n3ˆÁÚ<¼¨™Šå–gµ)W™ †Ÿj­rÔâ¤ÛÌÂ0Qꦠq ëÉ#Cñb÷k®è2Nö!A¬ªŽ¿ ¼7tI~¢Ì072©íEÑö…aøôê¨_ YàÛO8DÐeˆ' ,ép:O]ÈCã$ê–¸£ÏŽ $]ü)Á¹ýȘ…W¢†”=isÖGYÛø²ê{§–Èy¶ŠP”7ïÞö<øâáuÍÄ• @u¡¬¢Q´9 f‰cv•ó›8ÿÒÓwÈÑA‘îÆF¤›¥éwœBó$í°O}J¦¾¤¯²9— €0çq¹[/¨fŒï=£j·J}“kì² ÙF|• ¢iÿØ25yYp¥Q}:4Ã5¡|Wj2‰&%\Ñýþ‡ÛWåó€Ö ‹3sfO‚žµ‚™†¦!]bÙxàÒ~*”¤-•¦¢ñåFgE!ÔÑkDÏ„åÄxÊZ´‘¦9r£§ˆÖ¥ÕHitìÞ,3„ï¤?Ó£!3Þ–ê}u(qZ_:ÃNÚÞ;2ˆŽ}ìf.¤¢÷§ËâÙD¶ Ðdìz€…ŒBo)ªQceG1ùþÃphñ¶Yw Üo¼¥mv‚нV÷^Õ—ÃÙ 4h8ìÑ‘ÇA¡¡˜Ž 5ûe¹íÄ>€9ºµ…·ý×säŒ5Çÿ·šƒg‚Ò&‰û7‰ò¾öZ³o®Þ¼ SmÎO’vñЬ<Ÿ(lº¸>ÙlÕc׳é[MKJ?­ ’d;ý·NW…ñs“¥1ºîÇ_?tšÓúðGÖߘu'²ÖJ–$†J_«"Ë{szÛ–ì+|Ó8&ÊÊ,ùð<9SûèóŸ±ëªlÛz&U®¾ýÿÜÅ#QyßõÇ?ü^ ž}´—ûúÆG}/Ùø_ý»õvÖî¯g÷¥½’›Ù¸ï÷¿Éç4gOÈOêùrYäÒ¼7&2ú.p½ájÀþÿ±Ìsé]ïÃÙJ}TxsÏÙJW±%}Ì×úoGÞœ|´ÝÐê§ý­*ÿ‚öEñr)úJie½Ž[V´ž³‰Øp;ýþÉ]ŒæJ¦D^×Wn[Spk¿úÔô ¾ÍKÖ´ðnŽºk忨Mí¯ïÛ™œ[îõ½äš伈xÏ Ã G"jx_ý<[ø–{tè_‰IQÙ›ßO×Z®#rrâ®/'.^ÀZ½'zÎ?·÷LyeqðzìÔÿ*)K·/«òñ¿äxi®Uþ륇¿Ûåq+DJÚ÷±i¯ õÛ¬(ørÓú»k3góP¸F $ç¤&•äç&esó,Ïendstream endobj 16 0 obj << /Type /Font /Subtype /Type1 /Encoding 448 0 R /FirstChar 11 /LastChar 124 /Widths 449 0 R /BaseFont /EITZIN+CMR10 /FontDescriptor 14 0 R >> endobj 14 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /EITZIN+CMR10 /ItalicAngle 0 /StemV 69 /XHeight 431 /FontBBox [-251 -250 1009 969] /Flags 4 /CharSet (/ff/fi/fl/ffi/exclam/quotedblright/numbersign/dollar/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/equal/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/quotedblleft/bracketright/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/emdash) /FontFile 15 0 R >> endobj 449 0 obj [583 556 556 833 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 278 500 833 500 0 0 278 389 389 500 778 278 333 278 500 500 500 500 500 500 500 500 500 500 500 278 278 0 778 0 0 0 750 708 722 764 681 653 785 750 361 514 778 625 917 750 778 681 778 736 556 722 750 750 1028 750 750 611 278 500 278 0 0 278 500 556 444 556 444 306 500 556 278 306 528 278 833 556 500 556 528 392 394 389 556 528 722 528 528 444 0 1000 ] endobj 448 0 obj << /Type /Encoding /Differences [ 0 /.notdef 11/ff/fi/fl/ffi 15/.notdef 33/exclam/quotedblright/numbersign/dollar 37/.notdef 39/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon 60/.notdef 61/equal 62/.notdef 65/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/quotedblleft/bracketright 94/.notdef 96/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z 123/.notdef 124/emdash 125/.notdef] >> endobj 12 0 obj << /Length1 1502 /Length2 10118 /Length3 532 /Length 11026 /Filter /FlateDecode >> stream xÚí”e\›Û¶îq Å­x€Å .ÅÝÝŠC—`ÅB‘â®E‹•â.E‹§E‹»·ÃZûìÕž}>Þûéþn’ù?s¼c=û4(ŽàßÝÕÎÌÕú·Âdqqü-Ù ÿ0Ï“/˜Çïuž'G0kÈíÚÑÍå·ÀõWÜÿˆx²ëútÿð“ èExŸ’BœÝž†øåi?âÿßÓºìozÊ/ÿ›ž"ÓÓ~Tþ!þ'kÿÐÓ­ÿ§ùÿ£ËOWŠýw+žR˜ÿ¦§~XüC ާv€ÿÀ¿Œÿµâ|2jõ>µÁú|2ýŸÊÚýOuÏ èiâÙþÀ§ºŽàS]§?ð©ËøTÈõ|š Øø´y·?ðɆûødÃã7r>ÕõúŸê¾ùÿ÷¥•pôôfñrY9Ÿ†èÉ/P€WÀ÷DZ¸¹< 7ìï7ãÓÝÿ7[BŸ^ˆ'Ä0?ãh!b“RVê']0^†ÌèJžV2ÜZ›&Ķ·$„7åÒ0¦¡<Šŵ~ÄI>P¬`[ò¬Ô‹ûô{k²‡Îáöc0æ¥k¢Yì# äôucÛg½Ýš§Zwj`>úN{¾ìÞŽ\¥´âË'9ˆD*¹?ó³õY™ÇHÓn$ŒrZ”’ :ÛËq_oöe ç ˆ ÓÏñæIº'l0Ó¢r”§Ó„ïÐ9=-WG  [ªy½l¹ÇêÚ-lj¶A÷µ´9L¾âbç › d|¾Xê}^IÔìý•ÁZµlFCAãSåý¿ØkÊ :ÈfPöWÃ@Fí™÷_I·'·9Fob1¦,K¶‡°œÁcÚŸ9o¦¸ƒ`ÑSy_EžR[‘0åÎ=p\× ãQ“Q´’$Ø›µÛw:æ³d”Sß|™àëF» ÃÀeÓõæ *Pìf^#Öž¯:É–#ÙhL¼¿í_ÒDLôbB•¯'ã:…¶¹/âò¦#SApò;9MÔÌðý\‹æ”iÈXyDùúî[x¡eí%2‡´2æL_/à ¿[ß׫}蕨W§KóÒ GâÔÏK&b$‡×™óç_¸™4‚×õŠéã5~i‘·€5>gO+sÙcÄÇd~ûH_¼ÌfëWÃÍóã# µ È ûÈQ×Òií`¬°vŒ¤¤Ç Þ½Ç^ÊÆ “öq*¯ÖÙ»Æ~¡ÜYØ2¥½jä QhŒ©UwøüÁgyA”€ƒV6ïÊ:ù u´w„|i}+oë¦gŒÉUX™%Ÿ-SÝÐ×%*Ï…‚N¶œ€Ãh‹#c§ÖÖ÷ÊM¬)p_’Ö‰˜ô:÷ê]´@ç{8 ÓY¡Wº—Z­¨{ƒnd¾ÌœÒYiüf _ªçßI0á¶^:ªÜa ¾u±;Ð\³Švå²`=¶®<~ð½ÕúþA èCOò•)giúîê oßm!¡uûÓ·¡©ÆvEI I¦d?Õ)òEÓ™u|ät½m‡3Ž÷žu>DÅcƒíû P©¶]:Ý·G*”#«»’‡?’´ñ±-Ž Tj0QtÏa0¸Ta w½|m[uГ֟äàÆ¯þ•'â'#ïí­Ea0cî£0ÈJà'±â”fBçU ÃéKý/•¡k ?¹¡+/´”ót?ÿªØ_°Íúpv»ˆ; ¢;Aý¼ ]˜,€°Co~œ^®< ŸÈiçn CVŸ“£)œy}}õgºã˜^Qn{¶¬ÏÓ$YùoÒÍv87i¢b½Í#OBe¶dXc®b„àVð¼ [òÝß³®ÇwG^ŽÖ›†ºj¥ú3ÍIÒêÒÔ=óŒê°ôö˜¿‘-ßÞ [ú Ú_ÔyŠøTë­«=IT¡ÕñõÆÜK*¹CðššeË}}(Krˆžä¸aùØr"LsR´'{1‘f–dù%…øÅD¡WLF9xÊcbøÎáMµ<¶=PF †Ý÷›€ÖÈãòˆ’K'Ûüĸ6×óŽ“W~z=.Lh_M´­FsßÏáÿÌ;ÔÓd#éB°›„vqtˆk´ôhôý&q>Ätì‘>êMÒCÙû0±ÕfÌdà2üµå.™“=üL_ëîy±>AUFVÒ¬¸·¦$ƒý!<æ¯xC&:nˆ ˆÎ3g%<€¥" *¿Råcn¦ºÊ+» —U8ÜŸá ,ã¨Ó/¡ÝÏ f”uÏÝüè¥Ã;ìÞØÔ‹ÂÙ4äMqˆZú›'ݬ§DùÔܘí¤/b‹xzÓc¨¿Þ†Tžæ6áüJy—t~ðþPµé*äлº2«H†¨ç¢3"|›AýnE÷Ù}¡¡¿s!séul!„ãÝaœÑ—on4±ô}›bÖ¬üuÅ–F]jÝùq‹7í>‰ièV)AÕMAåÁL´6üìrÞŸvÏe$V™eÌrÂG¯^;Q[E1¢!ç¡éGI¦kœ¼¾åŽÏxw…δÆ#îÕÚ“Ã-qѥΤøv½ÿx'ä;†‰ÉW7ìÂø2Aw¹ÔÃŒ·¸…pv]ôŸEf­ØØw…ôXö½ÔYƒ\¡l­@ä»LMÚ+hlRQgš*v=³z‘“h‘î4 rÙ½h²õ—)ANVuÏgüJˆÎ{º¢Y~ÊžùdÖy–•{¦Çtð4®¨Ÿ¶Î}ÑÊí95³¾,‚³<Ìeû×ñ\„{’-Y@PJ¾vÒ§0&û–s®¾éì-“-y׸a §ÔV:íôU¿E¶äŽJÌÓ¥.¹Ë+òY6åÈÑ^ ?RF¡€3OáÚ oôôݶ*£è©}cÛ. áXÿ|Aáî%Ú"ÔœK‚úXTeÉ#} K‡kŸM„L.f¯Å6Lšu­b¡ŸÌL¶œFÖ˜ß[LªQ›ê+Œ›pªÓÍï– o­ÿRÌ´EAbQo5ñ•¥‹€Úe²`ü¥¸ÌµJž’i+8`Ì*ÿdøÈšõÊ$MwY@Ë<®ïðК]³ET‚šD¹]ïQO9L›ðUò•^SK'e²ûµæ~/°¸ø’+H–õ§õ̰á.Bµ‡õAG\5ÎÆ#.”³!A!1ôKÖ:¼1<}°çú²”¿ÂOÒ2mÖBŸ@Ϊ½éãVÎ;ÙÆZ"]mõ™Æ–¡mÄj y©Àð“ž©ï’ Mö¯KÃΗ ”µš—öuÀë˜ê‚¨8[¯úB›P X"£I*|_ —Dà×9¢ÍãʤŽyùœaC½PºÖðx» YÕ_Q Dí¼­%¨#¸ÃÈÌç”Lœ 7Æ®0xq)˜£M“çä*Ê/eO²ãp­˜S€.ùœ^çg™‚ ÂÎ?gï›1ß ñKSWŠoŒtZ$¢£‡$ö f¿z”Â5ÉGÖ­P„mÝõcf`&òÄS=Z µðLJwã#­µTN/™ß¦\•©–ÅÈf+D‹·–C;2¢WÅ9–]a`Vª|ä=I/ª ¥´\y¸iDK@Ft Aâ-¿ºD“W|Ó·PŽ=Þ^¬BÓý¬úst&í»öä{ó¥ÌL’Óæè,FŠ3V#FãVñ;áñ*——¨oxÇÁFS­“*™-{gepã‹YŽ1¡¬x{|,uŒ³›3å ª‚ûæäå" ÊF±Æîfâ´»òyÅ‹ÏÜÁ©î¯ okã ê­=Ã|ó1Š0˜Î6q5’@Åmñ£7·” ÅúDè„Pñp51ÉçúŸ‹Åu’Gy£Ÿ#U¯®I—“¬‡å Ó$TG.ßsÅ®Bˇ?¸¯Ÿ*ˆÁ[žÒ9[@VD‘)/„Μ,Ÿa€©î5›™ûî›ü˜Ž¾À~ÜT‚ã/x¿Ê) »¼ ¾ù2>ëžMm9Š9ñióÃâ:[µL°µòrÉñ¤hüçw`E…@o¼Ö½NÉevšÏÓT_H‹»,ª?+k% À´rø¹Ð—ži²‡#é˨Žóƒ97F9=—»q ßÓ©4¶Ì•’.|/õžg:‡š1)wù—èøì‚ž=§ö,ç|‘¤•JT‹±1Ž©"<ò+óðÙ±;Ã͸ÄsxÏgØÛgX’¯³KU&u7χ*ØŸ*Æx]b”r³w(kˆ¦MÎÐú·—ß·¼&Ѧ«½*hÓØÝÆ@*I¨Ã³ {çS~.éõ)ø!ÞOt¸‡–iŸ<:v^y¡ã¾¡Üƒ½$÷¹¼»‰ ðýWªNûm**Nâ+~z¦-4«¹-ãóÖøŽGk†Š/ñå<†1E± CË3íñØ/[d±krL(‰jÕp÷äˆ_tã}6z)äÜQ¹ð‘œ|V<ä3]!‰Od(áòYsLœtPªàãwç(ݬ P–¢6mÍIf™/—¶‹¾âvÕ@# ù>£êÚjDÈnYÄysóbhŸ{RS„HÖjT:¯N×@ AÌa*ÂæŽä ŠqÅÝrcD’—Vp9ü˜ß8qD-ú-CkЦÛ¥Ä$p%«É;`ΜÅÕ¯ÇyºšO±èh7cœ;樼 ™¢Û ‰ßxÜë»ú‡º«5¨P+èI#Ç‚lVÌ6ÊÍ¿À{¬ÇO~oÎq¸•€’æÄ]p•ëú°(‘SÊ“Énü¸AÔO%ÕuM¤4D=q5”(¹Ä!Ç‹y!TrîÌ&‚*ê:ï%O×ô)¼R'uw”GÆîÝ A®›µé»s)èãÍÖø¼Zˆßùî5ãÝwæ-ÔŠkæCfX-7à xíYÖà!e‚µXÏUû'÷V9·Üf X°Ÿ›5qè¦1ÜýYœrªáŠÅwóÅàFø+C™ #Äû(»‰í|$òxyy\í»Û8ýåüY<íÇBúM.ƒÁª ŽÊÍ3ß®ø&Îû_1ó‡Ñáp¢_T¦¯»ž%(Ú~-ZmØÜœL$¾V=[ÎþòKzâ .f,‘‘‡¹ÜqVŠÃ×÷ ÙÞC~÷\q¨ÿñzªÕu߸ò”ËîÊ#T émý9Y/Ah/¤¹º7oÜ^¯ ™Ï#LuN@æ¢Òó„›ÓõœÑ²Nw*¯Í2>o0;ÿ¶–`èÜŽK«cS¤ a[1d­²¿Â‡ß”øfß‘¾~NíýiŒin7êd±;„ýAlEñG½ËÅà(üª§˜@Žš  i]Ðë~z¢xc`¥'Œl²¥-#a2˜¶>OhŠ·+ûWTè'uÅŽ)¯ç»ÆE$‰ÜÆuÝ# ûP™ÞêH\¢Äpç&oh-nÓ¶ \}ÔìÃÜ5þQo ÝX(â>ë– K–ІÒqÒça3•î* r8øÏÈp`\¨ji ú’5ü¢~Ï•0@öª»ÔŽ’æ?A£ï±&uåÝX?‘'oXÍò‹7Fýœ[5¯PWñýIެéSÓÄ"Û•RûkÜFº@)Ní]”÷ˆsw“8  U/…¦ÝtÕFP7/„“ÅÖ—†êì><\G¼sôù'¸›ƒyb[I ÁfÌ©Q´Vë® ÜïÒ£ý56âÉšü™_ÏI€ ¼¶íÛòM£Èa=ÁnÐ%e?·ªÎ •«‹-TåA£¬ÿeÏó²üÀ|/%aö”MT-Ç2)ž–Ê–Õ¬ñœ­>ë b°mЉ€\º;ßqêèM#ƒá­Ú{LËC3›ÒéÃø%Ý…MMS¾J¾ÔóÝhó„ î*/ýJ…Ø>?éâªr!ƒp'½| ‰&TE-í ö$õ%Qý„M´~ƒÃ±åÇVÉ&Ï– Z„¾(Í ­ŒHNÚá FNcŒÕ¦ƒáä©ÉJÚž¸M0¿ ÎŠøŽtG ˜åžJ9*ÖêDr2ØR¿û ûË_Njf&®j·ÍN¥Ê=·5vGö£ˆ0ïýé1ʱ)»)]ø`,nÚ@¥2Ä:ÐЇçÔ$œ`x¾³¨ËW§ &¶Ê÷øbz“´!ãÛ¤¬¡Ú jW’0\²»·yšXD£ÙRôþÕ⯦T+;§A1–E̪¦þX+Çì¦*Ñ­¬5ÁÝFÀÄQp¤­"1M}ô­Æá÷O×£Ç7õ$ñoÍèø¦E¾¼Öťݷ9—ãž+bmؾæ†ñ/Oëàñ|#“î0 {Z£–#¿d3$aü~Ki}òür¸3.ËŽiu|Š_–Ù6ÂaýÐÈýy`Æ6„ ›h¾¢Ž×t¡ê¦DÃ5>fZS¹TýŠ÷š~ßô¼.ç™>èaš>k^Þ8è\>Âw‘ªî·²ñ„b$-nÄyk´D~…Ýœ_Ž}ÑsgYxF428¢ãì7*¬KB¨Šþ•öyÀö t8dìhýª%ówŸ¢gM²à n=G»ü?ª_q&RD^ºJ-g8î×’ÓN„i~Úèë$’ÀÉ=&q‚ÄvNÙ{d@ÛPÔøß ªÂ…v¿J¦Ì5é“‹ºæ{ã„&¦\ÚGI1HµÂmöÓ7{c̓0m·Èˆv%V b>À'^¿‹gÿÅ"Èi#„Ð{O…Ö…kpÖ 5«Ò—+U³ÌTØòhDs½ð9”]&Ýx³Ê¡¯²Ô4GMH¼Bâ{j‘¥ðHc? >àBLv)ÔÁðvÉ!¤väx«W”Íì˜3®ËA½¼«’Sçݾ8¼ŽÉÍì+ o%Aaƒ)U_ô¾PUª²°ºÓì/Ë¡O´°1Ëÿú¼|D ÞÊXiݵ” ¬~ׇH‹¥+Ýóÿ”ôíõ6ô'ÿÎA±6B ìý(””j¨¦ÒzHçÑ™`†Š9}[BLa(¨° w¾î£ hÍm1»ÜO¸–\F¬è ×M¸h‘GÎnS?:ìäùø­1ÀáŸó–¿àéª:œª&¡,®6(üáé{A9ÈaçóxÎ':cm/¬'ýÚ”·Œ[ uËï!'AÔp¬ êO»èÕÖ@¦‘ξ´Ô%ivß…XÜ“nK } ™Z]:y'SˆDÚ“™ €0ÌÕ±†{)rQ½ }à×@ 36XÝ›½¤Ðè\X… ìPÞ j¿LúÕ;rdýý§SÎ/;z†i;üÏÆ˜ïHºëý¤¡¦pÔQs”eا$´=â&³$“¤ëÑK›çŸ")_ñ­•l±?õÉÑÛŸ/Ä÷y/ˆIõÿÄ^™=f0îÄã_\à8 ˜>XZ‹X1á $èit³$g¤ÀEŽ9ú˜`z*ÂÈÔ/̰çµù/DÚ˜´ '™Ez8;*ƵZA ùðF‡QXhGg½ÒJî¡ùï ÷«õZèÚÆÐÇzÁ-šæÔTŠN©‚Q¯)fcȨ;NÓb¤êÎhô5íCE=BÐŽJ¯®ê³,o!öÐ_K¸ÝìÏ<1ë™Ñj36´áJhÉ Í1õ¡…hˆ2FC QÄÕÁOòâÇ—~•…Ò¦ Ýç‘qúâóçï9R8'ÑJ»àN¶–Mó&§¤™jÏ‹¶g 2íÚ±ò쿉XF+>'µ¯§»zÏïØA~®¶ä4hÄl5ïÒìlsSR©kB`úÊ4÷g¤ŽQµ‹¿Ò\×¢ç«D*,íÙ´ÞóÓe='åzþõèù9¤èY`W¿ß­¸mõœÖ&wQ@ñáT²ß.­hu;rxˆþù$=ÜnÀÙƒE«Î g'iý÷aµð>òðˆÝºÉ˜!”4¦î~é£^çðÛxªi¼Ïv ʧúXÊ*«Ôà9òXpôAR—=ç$ç™s¾ntæ)W‰ÎeòñT©øòÖÔUC+V¯Ü‰îT7KÃÝÈÕ®«—l®¼h…Ýãà‘ Ræ"³Èb3·<®Uˆ¶ß—TÇ2G &Ô¼m‡?,SY‚çwÇeÁxަæš~ô ŽøVïÌÑö(6ŵZâˆ~EŒŸª§*h°&¡J#݈˜ÿ|”Žf¢Ò`øÈ5”Oͯ™«6™Í<<Úú@÷ÖdÔ¨ì¨a8—"VYž™h®néÔsA¼Ú~^LW|wv}é¤ÚQPw’ ƒû÷çÒ4…k–¢¶ˆ÷݆^¢TI?¤Ê g2“…VWÜLRÙ¡ó‡s·úÖÈPßÍ ôPÏ™ã7ßÖÇ/`0²æ¤ˆ÷ï <°#v«(á\Ò®ƒö©°ŸQñ°Ì¨ï_jœ«$ˆwÇ3ï¨Ó9Ûœ¤ûª%QÚšxô(ø…ŠåÉQœ§ñ=f+Øöxc»z¾“¡OŒ’ëU´…¡©õ@¬fJí3N|p¶š^Ig¢ UÄ•ØÚk÷sül‘8¿ÃcIþFÁ™§•£J?™˜…ëW5›È|ùJÛ6]á+o´ãÒ0"ÏÕÉÉðî’º'–C\MîÕïqcíµ3„õ¾éd:ì]Á&øå9¸×°ËÞÕJ*+"Ÿq9ÕSPEž¨Üíæ69ûŒf“4>wv¥27£½ýEQ?û"íÒη+~o5Qáfþ>èñ嘶‘ÿÜékå€+Í÷¯_jJ û.”]#ÖP ÞܹP¸T ŠF°•HÁ]ìpŽ3¢s²÷®ªþq ¦12éÂn¿^7š±ÛÀáÖƒ&.Hœ=&þ²Ìõ\²ìw4¼àNócÊ¡ÔöΓósäÕa“’â¾GœÔVÁúA¤_k¿F~ÆÅkÐxÈ©$V0ôDÄk-¸Ç_Ù³Á‡…H˜¨_¤7>?-4ân»p… i'‡êø{TËÙÏRÊHeS¯¦xÉ GæòÍQÄ!21.ÛŸ' P7m’D™Œ2/Þ¾¿KÙùÀAÞd_–~;.C‡Õw~E£bþ†‘KtêY´UÌë®ÅñX)8MRÒï¯Tñ¢ÇÎwm³J‚AVh_C]p‰à}ÆÃœgÐÖtáe$øs¢°/þuÑ:©ÿƒ®ÀN½x<¸0·ÿd5CûcSð1®×h{¢5åÝ…nž¢³›2LÄaŠ”¼%YübM1hΣ`ìÔ T± Få‡eÔ‹ës‡ïÉz«#õøÔ&DDˆÑ/ò`Ô¨—¡ðò5 ÆŒë¹ô³×‹¤[îk·L'¹)`bòB©9ãñäÄ–¥2—bJˆ<2Zùx¤ý7¨Œa>M1ªˆ:]ý™ø¼ÿT±eÙÕC¯/w^ýùxëÐÇ˜Š‚3/mVDK 3?Ÿ]Ê€÷‡3„ü†íJ)©çx|?öÏ·¿ŽëV›2¢b•/X —Œõï–×÷&²Q3Ðò{$›X€‡G(Ú ªíæ»SâÂ…ð8$}ã&èõ…6ù¯.÷EôðƒbqH¨·£9kKi¹ñy šëÑj&}=Ÿ)–Ž '÷•ÀÄV >>lwÝfôŠ“%Ù;ÿQ_·“Lõ˜Wä\æÛe´"rï{ý–%0x ÃåÖ—î"Ó¾2r ˆAZgÊ޹=š=í]gå̇‹;¢Tiýuxù^~µì5uigÏÎ]ð‘Öªp®ðHwÄ»ÌqiÁˆÜÏâ>øÎ£s<Ø^Ñ]*ª-O¥•0e¯ÖWÔXMøÚúÕ]sg¤†Â%ÊÌò‰-R✭†úܾS‚¤Ñ¼Ï>o/l^;Ñ»§'½¢Ì<ÚˆþìøáÖÞ_µÜÜI›Ð¤:a4†ô,Ë£éEMžÐÂ:ÃôaØ€/2£»ìFÚ )Û8B²¦ª–6a‹w CÿLX:Ó‘E7Ap—4aü+úEíGajÍ#Ò/œáÙ?·¹)#«)t‹.ezy@ÒÎíFË3ýÒ‹N0l–w‡š÷öÉçÒâäw¯©a‚öG15²3]£ÁEÙõɽ‹2„<þö}¥i~i\ön‹~ÎbQNf=€‰D¿漺=Uà™6åÛGâÂr›" ™r&›¨á¸"W%î<*GÔLC³E¸‹P /'<â_½=:œýTòÉ#›1¿õiÂÙÞOÁse«Aõ‘ŽÁ{*®\&XY5hÌËȚܜcå«§"„ÃM^üéIzT¼)ÌðlC¹*»e_Ж—ÕYòkJ‚·Üä¾{LݽN^ŽÑÁ‘Iþtñ€lhß"¯:0Yó–RœŸ]ïk>oXI{„u½SÊþ¶Á¼§ncÿ¡„ÎkId#|%8õÄñѸ%¶ôÌ;ËîçE©Uåkì ¬TšŸ4¡j\èJ¯ÞXo‹Î8PÌQÞIïeÙ«ÈhºË_4ÏˬiøhãOQvÕ{ܦuáÅ6òÆÅ:‚¥mHzG&É™¾>´\`œ¶†a’öP>ÏT|·øUïgŒI§ótÄ=^ ?9D·³ é4ôÖ^ËJ³ô-âÄîZ Û«È£Š“ ý»lêN,E›” —K·å'T½—y¯óUÃ^ÊaÉùÔ|¶»‹PæÜÛ£²ô½ß"‘¶X¦³8öÇ8Ò]\0›ol¼Ï$RËPÕtV±…œ\'æäÙD¨pÌ÷( ùF7;æ¨ìbÉ©¯—ínëEªDf;ØY3šÜl=bTh&Æ ëÏê¹÷Ñ7;ÀÜË3„rêšzι–©g_Ãy´$”¸æ¯77? A%YÊt}€ÆV-»2PMïäÃØ›£ñFvRÆöê€Acõ 7ˆÊši'|"D+ðÞš24£¬qŽÉñRÀ÷õUeP5}{MÅ"kê+ÞöGb&£Ü·püæ¨P4Û¨Jöл(ôзïÚ/©Lb/Ò^Á‘‹Úvǵ­B¸ ]Ä5o¨û¤Ý6†iœB „ë1“R]ޤ7Ø_wâÎbT“i„Hp¤) ìµPéYoªûJ™¡rÓ3L9ÏtÍH§‡Ù™ø³¼+u-vB7Ì ~dÓ\^«;ì`R?Æ0G\±·mJ“§§²´¦o†+…!ZÅ–ºô“1ìžWšç†ŠKçÛ#q¥KµÞã1 wÊj]1f¼Lã?Ò=>õ|Õî'³§.’Gïo®èÇ»a2Tdþ>í‚ðmÊaj…i[Ù¨àÙÞŽ¢.SMåDüCq…Vî$05i¿Ÿ|(†þF»ÌÍcª^)e² 8tN®OÍéaê¼Í»ã¨Îà5\é¼fFé©C5\Úõ€Xæ–’Ìp²†Ý¿H¢—dˆ­Â<ÝÏ8$ß’žATɰj*2ÁßVÄÕ0^D<ñÛUaÌ. Fj·ÇVÄ Ù›.wªÞ‡1 c¸ ¹Y­¿–ÿ°æ[͈MÛx§¾=ɰ¡ŽhauÔ)»öÊWXNîg"äR›[ÒóÝî>c%Éæc ÛßSò%W·½A¦ÇS)%Q¹We¦ó[žÇPå*´Q²p”vù.OgLÍÊsü~ÿ?Áÿ ,ì f.0G{3[Àw ɳendstream endobj 13 0 obj << /Type /Font /Subtype /Type1 /Encoding 450 0 R /FirstChar 12 /LastChar 122 /Widths 451 0 R /BaseFont /YOAKNH+CMTI10 /FontDescriptor 11 0 R >> endobj 11 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName /YOAKNH+CMTI10 /ItalicAngle -14.04 /StemV 68 /XHeight 431 /FontBBox [-163 -250 1146 969] /Flags 4 /CharSet (/fi/exclam/quotedblright/parenleft/parenright/comma/hyphen/period/slash/zero/one/two/three/four/five/six/nine/equal/A/G/I/K/N/R/quotedblleft/a/b/c/d/e/f/g/h/i/l/m/n/o/p/r/s/t/u/v/w/y/z) /FontFile 12 0 R >> endobj 451 0 obj [562 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 307 514 0 0 0 0 0 409 409 0 0 307 358 307 511 511 511 511 511 511 511 511 0 0 511 0 0 0 767 0 0 0 743 0 0 0 0 0 774 0 386 0 769 0 0 743 0 0 0 729 0 0 0 0 0 0 0 0 0 514 0 0 0 0 511 460 460 511 460 307 460 511 307 0 0 256 818 562 511 511 0 422 409 332 537 460 664 0 486 409 ] endobj 450 0 obj << /Type /Encoding /Differences [ 0 /.notdef 12/fi 13/.notdef 33/exclam/quotedblright 35/.notdef 40/parenleft/parenright 42/.notdef 44/comma/hyphen/period/slash/zero/one/two/three/four/five/six 55/.notdef 57/nine 58/.notdef 61/equal 62/.notdef 65/A 66/.notdef 71/G 72/.notdef 73/I 74/.notdef 75/K 76/.notdef 78/N 79/.notdef 82/R 83/.notdef 92/quotedblleft 93/.notdef 97/a/b/c/d/e/f/g/h/i 106/.notdef 108/l/m/n/o/p 113/.notdef 114/r/s/t/u/v/w 120/.notdef 121/y/z 123/.notdef] >> endobj 5 0 obj << /Length1 1555 /Length2 9260 /Length3 532 /Length 10157 /Filter /FlateDecode >> stream xÚí–UX›Ûöîq/.…P¼¸»;Š»h€àPÜ­Š;Å¡¸{¡Hw(w/Ú“µö¯öì}yÎÕyNr“ßøÆï;Çß|BO£¡Å&eíl ’w†¸±q±s e^Jësq¹Ø9±èée  7°3DÖ $ äâJ¹Û¹9\üÂ<¼Â|¼Xô@g/(ØÖÎ È$ÃüW’PÊ [Y@€/-Üì@NðVŽ@-g+0ÈÍ‹(åèÔük…+Pä ‚Â@ÖìX\\@k°•Ðd †`qüåH bã øWØÚÝåß` ¨+Ü n’·hí qôZƒl°8ÔœáZ ¸“ÿ¦þ³¸¼»££š…Ó_åÿîÒ=·p;zýO†³“‹» |él ‚Bþ3Uô/sÒÎŽÿ%£äfá¶’‚Ø:‚€œÿ ]åÁž k °›•ÐÆÂÑôw±þO ð¶ým€CM_CGC—õÎóï‡`ˆ›¶—Ë?eÿÊþ›¹~3¼;P°'Ј“““ žÿþû—ɈÉA¬œ­Áø@ðñ- P /,ødÀ‰èÃC¬Až@'Ü1;ÄÙ ¾o‰ÐÆŠõ×qÂOœÃæïØ¿Žà—Èaåìädñ;ÂäpŸ¡³õïÃú‡ù8nο.áfý‘ñ—г;ôw€ç/YØpaWxþa>8ƒ` ÈïÜÈ¿ÎþÓˆà_î/⇗‘úMðÒ¿ ¾\æ7Á×Êþ&øåþ!øå|{ ¿ ¾5Åßß—Òo‚ë©þ&¸ÞËß×SûMp=õH®§ñ›à5µ~¼QÚ¿ ¾?ßWÐû‡àoÇïs‚ëYþ&¸žÕï!à„ Zÿð‚þÀ¿Nï„û±ýá†ìþ@¸#ð7áðÂ]8þpN¿‘ nòÂm8ÿp. \úþ50 ¼õn ܆û·ûá6<þx%à6<ÿ@¸ ¯¿ñ¿ßziigO6ø4³qçž‹‹G(ÀÇé÷¿%Z¹C¡ ˆÛß*üîø7Û€á7 ä ²ÂšŸq¶ ±ßVê/Wðµ •QÚ¶)A­®{²;x.ÑñðÊk–•ZýÛòt"Ü-Ô-j{€kT»ï«QùãÀ× ©Ó[0ó­tï€þYúK¯MÚëà}¼¶Æ©‹>Dõ‰•‘Òw…ýY'ûyL²ÚÛèK4=F°úžŒ~}ùtGðÐZMüÔ×¥¼áËøïÞ¢,ûÛ‡c4³.ž:·»Þ`ä&=š![êš_«¥x=Ù0¼MørMXóƤ$jÃ=÷ešA\å½¥Ñu&—‘ãYLÆãù 7ã´ªN—…ª©ìBÃu rÞ2…He'à¨ÖŽB„š„j†€ñ¦åüv;sCµ+ª/3ÏìT~5Dx‹®ÕOâÆµvSq踞îãV3e0?ÿ¥Ì£:?*÷PYFåšPƒ»c/_TaÓO«ñ|z3ŒMi¥aî`$y^:¸‹_Ì®0ᵬ.þ‰è†9¦A”Cw]™\¾üîˆQVø‰9ë¯zæÃxÕx^¡'ǸY£®Öa¼Üøâõ„3ÄVEœÙY™`¬cò\_/*r›Ë¦ V²®¼†q\‡ËéF/\,Wõd‘¾˜Ï­p…]ÍD-[M{<€—°(ÎàÑó¦V©ßz‘}Š!󈄗³:kód;c6¿šÖΕm3ˆhÑÝ@“ÉËHLñ§øñ:‡ûQßædfÁ´ß”ŒâùdúqýT€‚€õnÆ` ~l ñYEå­£¼Õg¨‰­ènTS¼YPN@>C¹Þ‰¸ŸšïîdÓþN¾~âØ’ù[^E^⇒¥lG…lñ£t‚\í€! ³B+Šo™»ükq\ïÅmñéchU[zŠûóg>•ú·Wr„ïÓ&ˆ.TA´±ÈD÷¾6µVí^Ë7eŸ¢D»¤[ ‚ú┨iZèNvıƒCš>Ânc~ÇžQZÔ²„Ø«xØâójû£?*&y{¥Ëdˆ[ŽStBaûËXH1{Yõ}1ÔlÏ›¶Â‚9v-Qt^áÊ5¶žôq†KWqðÚ”hùÙü´“T½¤[T’"OJõ½Ãà=¡x\(\-¾\sñ×§=ä •çõp°:ãÊs4Ûyä~©›¹1¶ã‹,÷ÿjò½%;'ÙjËà–ÖMiŒ¯ ªªXNðt°¿Â³M ÍVÉb¡]ùÞds‰7lÖú‹‡=d“ ®p¹ÖHÃÅ"9D÷i²(–O8ÿ;×u–}Ÿ3<ˆAÎøyëaG¡Ä=å»Õc­}=ä¦e9«~ˆ5“Û92ó¡vγƼ¿xb=.5‰ú‘hG×!"scyuÆ ¯ïU¿ÈÒN4C{iQa3—[5gbøÄ Å‚i5¤á?¡ä Ðý6jº©ÀCKšx«5$®]¸Øú¥Ç&í·¯ù¯û|¾úbèS<’ =²Ð~ÌÏ?ï£P'à˜QÑm~ŒWF°ŸR(5HÂæŸ·RVª~õNÔ2g-hã­Ý,uð‘0Ì0 uö-M',dÜ wYñü?ç¼ÌïÆŒö/(8hà^NŽTÇߢ»àëT” Ìñ}Å©òΩÆì™Ö vkü5ššú‡ðDãxkÝ×fi8s¡E?-ÅSÞU‚ŠRòRp*($íQC©÷Dãß#¡›uE½•(w:#¯B!SüÙÂcÚ¥•?KêF™åK d9‘kySœ™D ]A4mDóóaÝnÓ–ÌšZüáVª;{ skè7¼X¹´ƒb8²SfÌ"UÍ·´|Kuß&«Ú¢ »Þ"1RþØ£T7VuŸmaTÀ1޳Š›¯?¶ ¥ÌÖãeU^œÉQRL¢=>íš[–ÍXÖo›? Ãúø%92yŠø…ÎÒ ¤@V I PÄêÞ¾ý×G¤Ù§æ˜L6½ÍåÔʆ¢}½·ªxîSä#ogâZø Ûd&ÌJ¼è·g¯$±ÌÛ–½ì[sKè\Q0yÏvMW¤_¯Gÿ”QÀ]*ÅÖëly‡A¦MþÅ®m Õà#‰a/Ü$Ò§›’bñí1ØkP?JIQÈp˜X_äPTô„³éàBùÌlqj÷9ïõN‚“@­À!JúF1jGftN /RèT¾<'÷Á¾Ò£„V⇰_zÞ/ç .à{W¯ð[Ðß~Óes‹Z+˜ûuiXZûõ& JÎ=ÊúVÙÜög¤]I®÷Sacî¢"~Ÿûå¹”Ø]`FƒöÕùîôóÝ…4‰‹Ï­GU±#qëÞrêÊ‚GA^(ZöS­€Ð B{6w˜Ú¢ýpTSŸawüSìé_ò®ÈCÔtÄfüBæ%y¼öPñ¸¬Ž–Ñ·°©Ä–"ã&¡J5ቭÿY(VñD8_– G®ÁšÔm¨_8Ý$ñ5IÉî‚ ³4ê'$'‡¡FÉb§Qíum=‰Äqzú–¥º °öÁŒ­CM6WaͳިF¼)®…lZ‹0ufã'ÿ@Ýi/¹Š"PîÂJgV•~–¯OH~¿‰P0}“3ye¢í%íÀ¤CLï…rr ]ÉDŽhªo¶0:ÄöN ¾ÃìóÓ2uuWÑÙÌeåâWx›«ïD~º¡C†¦«¡2ð‚4JÁ¡° »±PSÓ•þP’š\2ÕŽ³x¥gMЦ¾Ö¦"ñ=¡Pšrßò¥v\ ¥ˆ82§Î”X|3è¸e)¼£âp´¢ÅpÑ* o¬má4h†èH“n¶~—9JèÆž÷³ïõÅUÅF³Cü«Mb™BUM,yÝCês’‹_·[b†Éš›3‡æo˜Buè»O¹ç¥†v£§€Éñ7¹ãhø ̧}ŸyQÚy_Ƴ,ÖFôÃ8Íp>^r׎ƒr0†è§~v |eŒÏÕê½ ~,R³&ÝôÏŽ4î…±—G:s‘¸Iõgl‡ãÚÕJ)N7ªhËhPÖ·¿c0` œÌ.|i›Kh@W@30 ER³Övîøšéñ]÷!ˆ8uƒäù¬Y3à dßæ–gòºÑýààÓånP òh0’S6€Í>¼ÈàQǽ,qcŸ8<à.}úù „ÀÀy²¡±×00³‡±º$>Ëûj‡Q-GðZ+mƒíã5e†³@/§<ÛfLçîZ¾2Âm€ŸyÞÆÀÁ1Æi4×°^W|ô‹6~êYr~‰ëÐpuZö);õ­òuà/Uá^mÝWHÔÏJ"N×Wõ·ŠÌ÷Gƒrõ3A=žÂ‘ÀPS3騥åqpÏ·‰Š÷! Fͨ‹¿¶Gy1EsNïpx}¸ Ó¿œ°¡}ÀËôÉÊØéûRtàQ»7Ib£¥Ç¾øSU]%©AÕ5}ÜÝÑBX¾L·Õ¬w„'#.x£^戲V}mX‘"JÓ´’^ÑúPAߘ*½xøóYó½eÔî 4gRrU܆i§ý¢)ó©#vû³´'´ÐÝÇV_\ýgHn–ÕXÔž®Òg€8 bßBŒgº˜ùf €Ì“×: Ã7àÂÒ&LÔ¤üA9Ýl}óõšÑ|tE‡1G…ØÈöw}P4°öº~·pÜì¼.í‹«óŠ ›GIÚÌäòvưuBt<Î yÙHFXRpxTXê“oüEÿËÒ•gtž|°ÕsÊí«œIH{|)2]ÃàÉa£šÐôNd¡£ÕÊtÄk7|NâF»ÁÈvKð"”´áÝ´Ö¥h3Áôøq±SA Ù@¾‚Þ‹ò®vÇH;ùËï¨AiÖ`b2ƒÙiiaY‚pävç†òïóá'¾TzCM*làé݈¨–ìç´¢_(BQ83’Ø·?ÕípÒÏSœªN[“z?¿Hsaü˜ˆñ!j²ºÍ5ÑÏ·»³Æ=ðv$uf= á8ooª¹TZÕ0C¢ŽŸÓÍ9Dö¯™¨Ê„E!¦ ½'íæqDÉkº†‰& šyÁ®‡ú!j›°íç%hEz¥¡ ¢(Ÿ¯õN¦V7ùÊæz¦Éàú+”G²gôã¼Eqtix9‰§¼ÞR:ÅKÜäÏÂ5iŒ½Ü´ìëyÐzÎÄLê©qm=æ{”–=_·ú¼¦F½WêàžΤcª·ç¥ÙvúÐ>lwÆÍ/¨/À…?ÚL#„ê‰l)™‡¿¯ Gïòá3½®Zõ÷R…¶eJÖq¨Ïý Hjœ„%ÅtͶ&pi>~|‚e ¥¯.‘_vHKÈIsœåݸªÚž%У¦W/^0 Lñ ÕÔ½Šô‰ºµV^rŽ $DæÍ»ŠØ…ÁÈ#ÝsDxý?óƦ=3V‘Ê'0]ª˜ÿ*‰Ø¿f¥ß^1NÀ`d»{Ü©2+Ò¬‘5ñÑeâ'V™r|­þ†Q 2åö9Ы(ÉúÙñè z<žã­yðûÓyùJ.Z’ºQœ©•Á"=Õ BÛï ‰j!¨ë†Êª-º™!ãÒyèÌå@@x.lüe¿]uÈ€œ¡t‘ié†ôèÆtñ©NõàĕžÀeƒýRwG “¢€ðèVWfm­içaIžò¬ˆqÀ|ôE{ft6-S/Ÿø­ò+Lýy&©h]בÏCÍÕ™²ÒÅ?5ß–*¾‹ãÄ“ý 3J‹j*z§¸‹¿Í< ”·Û/Òñ±¬“íÕÝjé&‡T£´“Þñðžô!ñ?­×G‘åt[ñó$4¢ä2"䳤€'©:Û®â¹~é“E늀˓9 ñÅák1 ºÌšóž‰1¸–$‰Û¯)ÜTâÉýYòSLˆ°zÔpøpß[–v+0O!uÉã‹ÝŽlªC ËŒ*³´àÝ—š šò X¶Í*+õD²$G C¹°&²úò5îIþÌ\XÕ¢‡=‡ iò1Û‘½^Z‡¨¤±64¢Ÿœtú»×¨Ý÷Þi¤q„+öÔé—:úí»`—†ø•gGÐ’Ô·U™ã—eE¼XȾãÙo«Ý£Ï`E‰ð€ ¶âq\Æ ¾&U`üB¼E®êv|jÂ4ý v÷FöŽ;„Äë0„çK1‘#±pÄV‘Ò­®ˆzt D ¨üèI¸N%1U,3Fžçµ½Zêwõ<†Ç„éJrM«Ž€ð¢Ôf¨ù½QàçI‚VÒòÀÜUÀ‹ÏŽPSÜw*_i{¾Á2ç¹]©m?ršœúç¦²Š¾dË»UoÙÕd£êh]šxVùµ€šB€¬Òc°e?>s@DÞ|±¾¸æÖöBå——ÿ2 [½ÔT—-v2WˆPHA¡ Ú*»,2°ýbªk¦ë@$ZEßbÒã$}‚®ø2q¿NÎ&gRê”VåÃÙXSÍ«THúgRË"“=P…íñK¡çÿÍeáò¬Ì¸ËÃN´MGÂÊËÚ“rÖ-ývdžËÙ£òñQP¡€¼ùôö$šCA¤­oÄ%_Çk°/à¬ëoº°˜Üs_:I=„2y.¯ûYPpãuØ|¸l¤šÕ’òôf±Èo¿W ùÕWáýþò"{P²K¾>kÜJÔjñÑ{Ê ,´;ð%Ö%Ëǧm| ÞO ýùLˆL „i…}}¸²Þ»÷3eÇèÎÏzûªý(Õ&¨¸@ÀtvSªrÊSX•‘];Ç)J]¦D±üð#¨eêI k¦l”› ̽Hþ殟fƒƒí˜%l*+­ãÎ ?Š"ôs¦íB€ ó”͇¥ì · ó¬â™gºdO 7«Ý}~ˆùÙº\¿´¾,ü/;ɯ5•YˆwØ•äyû‹ËgI£%ŽÌh—·ÃU׳²¶ÓÛ)kœ)eÞL„výAMBÆ~eƒ²s!zÌsÝ×!}¯×‚ÌÏYòÒ2|`”w'üœ3#ˆ¬—G”l9âYf&Ÿ{¨r꽊XCBï§Ï³$¢Ç~^‰ æ³ ŸY‰'ÿ@‹e^Í=›ª=±µKW^˜iOOÑ+œ¼[XlÖÅ´e¸äYDc,E¬Nx¾ÌÞ4’ìz¥nZ%ÁÓ–iþ„YÆ0¶S¹6˜0۔ϖ^`¶ï®/Hv uÁ9Özý!ã ùéêK.¬Æ¼1!kAŸwïcÔÛ}üTŠ$#'c½“º}=vä±µµ› Â;-e߬‘²Þ›,(ïK6gføl.æÂJú½‰›^pX"5JÁú$—&9G‰òYåI¶ïM‰Ù¯Tþ“ ø•ˆIIA‘lžx²{B^Η*1®¶ŸÒEô`´Üsü¢«¹oµ»´]`l˜À´MýœgÛS¿Bn- ÉÜ1 Šk˜üî?^¶Ÿ~³=‡h…Zq УY]+Ûk Ï}‰ägšvª¬ÒH™¥<Ê‹yX3)æ»í7#ìÍ°ÉøÊO×\JÒ«ä÷N4†Œöæò1. €‰e16)•ƒáËJ£ö”%OÉ]|¦.ݱËçØ®ípç~í¸ˆv±>öQ6‹$s>«Õ'¤/²Òâ¥ýÆtŒÀ%!zƒ ©dü:±h\n¿"¸s Ü.rzm”Š¿Ev”4ZÜés¹z?ožå˨¤Ћó™g™†J‚“_ ¬Ä¯>s¨Ôz3ü½-â“Ü{œÖ:·cW•;ª‹§—Öø5èýEŸÞÕS1ít÷á_½­<‹¤y†\AϤ„ ž¸í>ÉŽ¸|ZtN»íBÚ²Žà¤wDÚéÆÓœ’ØÀç¯G×°½éã×EêÍ_Y¬¸а½ $5Åu8%*K»ƒ£‡,ëúçªS:ÇcTä(^w¸©{pögd/6iX»®ž®R)DçÍ•z¢­Õ{‚ò:d.òüõœÉý ®ÏCºJ‚Ëút#QÒ2ÈüEYÁ]èïž§ÌqýzþP:ZòVÈ6c]°HI.Ⲃ]h1½=ƒBçUbzò² ÃN¿rT_ÏÀTÝÈÇxÚ?y£Þ€Ûfª¾oöËœwÃv´JBUo Ðo‰Cëb”ñ%ádOyô­ï ¥ãbÏñŠ ÍãÃxO¦2`FÔ%ÐÞ5JuyN5;þ%Wfüh Aû¾êcŠ—•´ÍJ•,‡¶àÉÝT·M·J\ú¹ñq` ††=›Îb¢ / iY™…ÐD×7Ùk׬£¹@Ÿ—îøpÛF“ø iÓ§Þ›O^p.Ý6Ü|ÕLKrîl˜'™NÓTèç4²p£©CMIø¯pªôIr#?£`À÷€¥Ñ)PHcëX¨¨£žysLë±jIt]Nb¾ü}S\´ósù´à)1á£ïÒñ÷H¯¯üÕl·Š¡ñ»lé W` m‚è9ÇAHQÚ-ÍO,þ{Ó ˜ }ONâE¶»Èœ…±Rú :»aã'geaU2§±¶ÖH9ì^³²xÎkX8ßH66Ç"z¡‚µD­Ã÷3Æ›t] ¾[a_‹¨¤F˜ŸòN¶|\Q|5@Eª0>|ªòí­Ý\ºÛÓ*~JŽœX´ÑÔδò·G½Ÿ0 ¨s%ºìåü”>Î(ClÄŒFàšóèZççj¹KϼÁZ,ŒÎæ3_õß"¥ß ÇU%©H¤}³iÙ³8êP’}} a¾«4 ãx[ö÷j?‹xcÁxJw2y\\eˆa¯†Ò¶õk=ªš†³´eÛ"¦ôBGì—OáIè½Xw‘3eÔ?ë`¥xEüa¶9»jª,oÊšnQßÓgc^R„vˆ$ò*™Ú5`&…W3Xµ®1§¼ ÉßÌjùoƒj˧^K–"gÑ¡í1G77´«„`´·I;¦ENQ¢ÌŒ13 °"ïØ õy’7TÙ~¨ŽØ04]Æ`4þ„kÏ)%,\×°­Þm½}ðýÞŠ%¾U˜ðôhëvU„uZ(úøj.Þ£‘ò<õ}“vF”Ú“$"±Ö:\Ä“ŸyìILøû¯h*± KùAÐw8´Ä“F³’=ønžþEÎÏŽ‡ÏÒÉdŠ~~Ccº{/ÍÄýIÑð4§=[M)õker?%ø:wÝSløõÑë^†0ïDÑ„À„ ±ë4‘þÀIü8ÄQÓ EPòW-§꘾¹‹ŸúÚ>‰xðØêɃj~Ò°C#V'˜Á¥•ª¡øÐó|ìŠ5Œ»ï¹Ym5õ^®ØÌk;Z¿¦›«Ó7)‡Çǃ…6ƒR(Q»½¸Ü6‡<ƒã‡ýýÜ.;}!ÓÂx–Ú8ß:¢žaÍJyùa©ÅàÓ‰˜l,*ÎçngfrovÃeï7oœ{·X{p‹Áëš=Ûm{¡&Mð @¾„QÏ–óJIÁò¤ÑcðTµqÎÎà²O›==ïÕÆ˜ßhiè7ÞËø€§•Hx$øt¶¦HÂ[t™=…y&į9I„Ý‹ÅvkŒz}€‡ØaÁ¿j;¯Äº¿ÿNt¢9FýR$ ËlÚ}-ÿ´•æ¤Â4®öÃ4»†«ÂšýÔ6»,"õ¼ª¿t½™ÚÑ/½r±œõ&ä½-„Õ†–îh¥^Ã2³½ƒ~:f•‰§ðÕSñi¹ÇBÊ5}¬±Ë¬’,T!x£uÚÇ´¬ü«l…Þsð­\'ß'ÖDì“/D?ˆ8™½hg[FÄFQQÉn-ú$ÄÎNûßxø§¾Méê%MÚåf’1wÆ´…iÿØÜËìˆ<‡ðýô`~ó÷T”idaÿíyaÀ‘[ ¡V„ØS!³²µ‹¸±4Ù„àRü¸Ù ÛöÆzÑW4\¼µÑNilÇ.shŸ”ì´AÍšèè õ´¢Tý0µ%«Í±Þ)+Ý%•þNÓñh@*&n»³œ >ÀûʈVôi?2Qïj9º–^ã’Ç! Úï*XÙÝ ¿e¾/Õ\ØFè°ٔLjj“‘/fü´gÐ:˜eÉ€ª‹V’y ÁÇ¿Ùo8—Ÿ~K;ñrϹÌΖPÊô³ÀfYj~Ì%“˜ã++1ö~"½“Aû ¤¤ÉÙ²W®o+´«‘óLIke¹6lí$¡å¬>vY™¨.­V›£ ñ·ìÅåýî¶|·ùú}ˮ梄ÛÉ>².¹y?6ôCÞíU=î¸ãÚy£-÷Ú½"O(%Ù¥ÈÛFöUµœM]h)¤ºðˆÜ«:m\˜â×u¤1ÝúoƒÅŒÐsi_Ûÿ|J÷¼ –|ò+ŠKIœÈ²÷°k5[J"°¥J0‡å!ò‰³îl2ÖHÜÌ÷”ízÅ÷¯è¼ÌóÓÓ+(<åKõnÁZ›©ÉË0»È¤²oFsj]Í—›i¶;^þ¦ãce/^çÍú‰yK¸|ÓëÞ¢4C˜w5Ôa9Tж•Ž™bOz!6Òa»ö¶Þáw{ô u¸‡IÈÆs$råfe5ü++K#2š<^bdYã%®Qãáaª/NmêÐÚ€ŸàÍœoT3’àês‹ËýÛÏ9/4e蟪*¾…BûøHpö*gh,Î z3êlò0! ær»i{°øŽ†Œ)ÆšI"m·Ê¬;¦çºøíÍ«'¼võêÁiÂÚÏZ¡{9µ Ǻvº„, ¬×Ô™ÛhŸʔüŽZy^´ÔöÕ È´HPÓÑÊVÎø€×æÙHqÜ{¸?Áˆ“ç/ÐdNínä\DP`ê«ZÂïlP?¶c¾ ñ)¢Ù×”¬¹?1á<qµªn‹2U ^Ç0,y0¯&ÉŽ@ô:«L‰×íøúàÿÔnìkàRºKÁÇ(œÏè0ðÄÐ'‘vñÝûÕW¡snv÷„ž{hÂF*8°Ù*·¦ò½Õ׉ ZxonE©¸:ñ>8‰¶Â: ]}ý¥Fž(vÊg±sÔAd¬2]ŽG®Ó;oÊiwÇ3 ŤXpTl¢¯º:̉fIçå¢Y.=b×ë´ÌChT–†P&kNæÍ%Ñè+â$^ªú_Æõ¶¼Ü LÔ£L@y¦ÁšÆa´—›¦xºgùé+ F?ÞÊ«³Š/=kf¯Åûí±¸Ÿr_=¿ï²#ñÆK)Ö¸FH „XX¾¨YûdÒèçØ¥í]_‰8‘+0#lÁÂu¾—Å.Å'‹1O½èÔãU~wá2\«ßÐÔÜ~‰ƒ°ç­SÐXxZHL€Ètªœ)ÆÑÎF8bއœ_08‚i£T6I—x—Ã/rÿþkÅ6Õ …bªpË–ìì« r„ÈÙ/ çžâQ5²)%·kÉ;²í°ìœØ×ï'žú a"®¸60<­ž\´ßû·ò«0Lñ«bêÓÉÿHåÕð€=LO¶Ó[žR,±ù Yä¦ZL úÅ®‚óÿðƒõÿ ü?QÀÊdusv²€:`ý/Z)endstream endobj 6 0 obj << /Type /Font /Subtype /Type1 /Encoding 452 0 R /FirstChar 11 /LastChar 121 /Widths 453 0 R /BaseFont /NXPUPV+CMBX12 /FontDescriptor 4 0 R >> endobj 4 0 obj << /Ascent 694 /CapHeight 686 /Descent -194 /FontName /NXPUPV+CMBX12 /ItalicAngle 0 /StemV 109 /XHeight 444 /FontBBox [-53 -251 1139 750] /Flags 4 /CharSet (/ff/fi/comma/period/one/two/three/four/five/six/seven/eight/nine/colon/A/B/C/D/E/F/G/H/I/L/M/N/O/P/S/T/U/W/a/b/c/d/e/f/g/h/i/k/l/m/n/o/p/r/s/t/u/v/w/x/y) /FontFile 5 0 R >> endobj 453 0 obj [656 625 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 313 0 313 0 0 562 562 562 562 562 562 562 562 562 313 0 0 0 0 0 0 850 800 813 862 738 707 884 880 419 0 0 676 1067 880 845 769 0 0 625 782 865 0 1162 0 0 0 0 0 0 0 0 0 547 625 500 625 513 344 562 625 313 0 594 313 938 625 562 625 0 459 444 438 625 594 813 594 594 ] endobj 452 0 obj << /Type /Encoding /Differences [ 0 /.notdef 11/ff/fi 13/.notdef 44/comma 45/.notdef 46/period 47/.notdef 49/one/two/three/four/five/six/seven/eight/nine/colon 59/.notdef 65/A/B/C/D/E/F/G/H/I 74/.notdef 76/L/M/N/O/P 81/.notdef 83/S/T/U 86/.notdef 87/W 88/.notdef 97/a/b/c/d/e/f/g/h/i 106/.notdef 107/k/l/m/n/o/p 113/.notdef 114/r/s/t/u/v/w/x/y 122/.notdef] >> endobj 7 0 obj << /Type /Pages /Count 6 /Parent 454 0 R /Kids [2 0 R 9 0 R 28 0 R 106 0 R 110 0 R 114 0 R] >> endobj 124 0 obj << /Type /Pages /Count 6 /Parent 454 0 R /Kids [121 0 R 126 0 R 134 0 R 139 0 R 143 0 R 147 0 R] >> endobj 154 0 obj << /Type /Pages /Count 6 /Parent 454 0 R /Kids [151 0 R 156 0 R 162 0 R 166 0 R 174 0 R 182 0 R] >> endobj 200 0 obj << /Type /Pages /Count 6 /Parent 454 0 R /Kids [194 0 R 203 0 R 206 0 R 210 0 R 215 0 R 219 0 R] >> endobj 226 0 obj << /Type /Pages /Count 6 /Parent 454 0 R /Kids [223 0 R 228 0 R 232 0 R 237 0 R 241 0 R 245 0 R] >> endobj 254 0 obj << /Type /Pages /Count 6 /Parent 454 0 R /Kids [250 0 R 256 0 R 260 0 R 265 0 R 268 0 R 272 0 R] >> endobj 277 0 obj << /Type /Pages /Count 6 /Parent 455 0 R /Kids [275 0 R 279 0 R 286 0 R 290 0 R 294 0 R 298 0 R] >> endobj 305 0 obj << /Type /Pages /Count 6 /Parent 455 0 R /Kids [302 0 R 307 0 R 311 0 R 315 0 R 319 0 R 323 0 R] >> endobj 330 0 obj << /Type /Pages /Count 6 /Parent 455 0 R /Kids [327 0 R 332 0 R 339 0 R 343 0 R 347 0 R 354 0 R] >> endobj 361 0 obj << /Type /Pages /Count 5 /Parent 455 0 R /Kids [358 0 R 363 0 R 367 0 R 372 0 R 379 0 R] >> endobj 454 0 obj << /Type /Pages /Count 36 /Parent 456 0 R /Kids [7 0 R 124 0 R 154 0 R 200 0 R 226 0 R 254 0 R] >> endobj 455 0 obj << /Type /Pages /Count 23 /Parent 456 0 R /Kids [277 0 R 305 0 R 330 0 R 361 0 R] >> endobj 456 0 obj << /Type /Pages /Count 59 /Kids [454 0 R 455 0 R] >> endobj 457 0 obj << /Type /Outlines /First 60 0 R /Last 103 0 R /Count 11 >> endobj 103 0 obj << /Title 104 0 R /A 101 0 R /Parent 457 0 R /Prev 99 0 R >> endobj 99 0 obj << /Title 100 0 R /A 98 0 R /Parent 457 0 R /Prev 96 0 R /Next 103 0 R >> endobj 96 0 obj << /Title 97 0 R /A 94 0 R /Parent 457 0 R /Prev 92 0 R /Next 99 0 R >> endobj 92 0 obj << /Title 93 0 R /A 90 0 R /Parent 457 0 R /Prev 88 0 R /Next 96 0 R >> endobj 88 0 obj << /Title 89 0 R /A 86 0 R /Parent 457 0 R /Prev 84 0 R /Next 92 0 R >> endobj 84 0 obj << /Title 85 0 R /A 82 0 R /Parent 457 0 R /Prev 80 0 R /Next 88 0 R >> endobj 80 0 obj << /Title 81 0 R /A 78 0 R /Parent 457 0 R /Prev 76 0 R /Next 84 0 R >> endobj 76 0 obj << /Title 77 0 R /A 74 0 R /Parent 457 0 R /Prev 68 0 R /Next 80 0 R >> endobj 72 0 obj << /Title 73 0 R /A 70 0 R /Parent 68 0 R >> endobj 68 0 obj << /Title 69 0 R /A 66 0 R /Parent 457 0 R /Prev 64 0 R /Next 76 0 R /First 72 0 R /Last 72 0 R /Count -1 >> endobj 64 0 obj << /Title 65 0 R /A 62 0 R /Parent 457 0 R /Prev 60 0 R /Next 68 0 R >> endobj 60 0 obj << /Title 61 0 R /A 58 0 R /Parent 457 0 R /Next 64 0 R >> endobj 458 0 obj << /Names [(-1) 30 0 R (1) 46 0 R (10) 153 0 R (11) 49 0 R (12) 164 0 R (13) 168 0 R (14) 176 0 R (15) 50 0 R (16) 196 0 R (17) 51 0 R (18) 208 0 R (19) 212 0 R (2) 47 0 R (20) 217 0 R (21) 221 0 R (22) 225 0 R (23) 230 0 R (24) 234 0 R (25) 239 0 R (26) 243 0 R (27) 247 0 R (28) 252 0 R (29) 258 0 R (3) 48 0 R (30) 262 0 R (31) 52 0 R (32) 270 0 R (33) 53 0 R (34) 54 0 R (35) 281 0 R (36) 288 0 R (37) 292 0 R (38) 296 0 R (39) 300 0 R (4) 123 0 R (40) 304 0 R (41) 309 0 R (42) 313 0 R (43) 317 0 R (44) 321 0 R (45) 325 0 R (46) 329 0 R (47) 55 0 R (48) 341 0 R (49) 56 0 R (5) 128 0 R (50) 349 0 R (51) 356 0 R (52) 360 0 R (53) 365 0 R (54) 369 0 R (55) 374 0 R (56) 57 0 R (6) 136 0 R (7) 141 0 R (8) 145 0 R (9) 149 0 R (Acknowledgments) 63 0 R (Alternative formulas for the computation of the relative difference) 172 0 R (Copying) 59 0 R (Default Numeric Format) 213 0 R (Filtering) 91 0 R (GNU Free Documentation License) 26 0 R (Index) 102 0 R (Installing) 75 0 R (Invoking ndselect) 87 0 R (Invoking numdiff) 79 0 R (Output format) 71 0 R (Overview) 67 0 R (Use of the option -X) 253 0 R (Use of the option -f) 160 0 R (Warnings) 95 0 R (command) 137 0 R (ndselect) 83 0 R (with GNU MP is better) 201 0 R] /Limits [(-1) (with GNU MP is better)] >> endobj 459 0 obj << /Kids [458 0 R] >> endobj 460 0 obj << /Dests 459 0 R >> endobj 461 0 obj << /Type /Catalog /Pages 456 0 R /Outlines 457 0 R /Names 460 0 R /PageMode /UseOutlines >> endobj 462 0 obj << /Producer (pdfeTeX-1.21a) /Creator (TeX) /CreationDate (D:20100112180409+01'00') /PTEX.Fullbanner (This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) kpathsea version 3.5.4) >> endobj xref 0 463 0000000000 65535 f 0000000407 00000 n 0000000293 00000 n 0000000009 00000 n 0000291518 00000 n 0000281084 00000 n 0000291360 00000 n 0000292594 00000 n 0000002370 00000 n 0000001740 00000 n 0000000475 00000 n 0000279869 00000 n 0000268562 00000 n 0000279709 00000 n 0000267067 00000 n 0000249561 00000 n 0000266908 00000 n 0000249154 00000 n 0000247539 00000 n 0000248996 00000 n 0000001888 00000 n 0000246026 00000 n 0000230775 00000 n 0000245866 00000 n 0000002054 00000 n 0000002214 00000 n 0000142019 00000 n 0000005494 00000 n 0000003599 00000 n 0000002475 00000 n 0000005438 00000 n 0000230455 00000 n 0000228648 00000 n 0000230294 00000 n 0000003812 00000 n 0000003947 00000 n 0000004080 00000 n 0000004215 00000 n 0000004351 00000 n 0000004487 00000 n 0000004623 00000 n 0000004758 00000 n 0000004894 00000 n 0000005030 00000 n 0000005166 00000 n 0000005302 00000 n 0000007952 00000 n 0000009574 00000 n 0000014259 00000 n 0000032695 00000 n 0000047388 00000 n 0000052858 00000 n 0000098607 00000 n 0000102975 00000 n 0000104459 00000 n 0000133653 00000 n 0000141962 00000 n 0000171089 00000 n 0000005599 00000 n 0000008009 00000 n 0000295084 00000 n 0000005643 00000 n 0000005669 00000 n 0000009631 00000 n 0000294996 00000 n 0000005721 00000 n 0000005755 00000 n 0000014316 00000 n 0000294871 00000 n 0000005800 00000 n 0000005827 00000 n 0000032752 00000 n 0000294810 00000 n 0000005877 00000 n 0000005909 00000 n 0000047445 00000 n 0000294722 00000 n 0000005956 00000 n 0000005985 00000 n 0000052915 00000 n 0000294634 00000 n 0000006038 00000 n 0000006073 00000 n 0000098664 00000 n 0000294546 00000 n 0000006118 00000 n 0000006171 00000 n 0000103032 00000 n 0000294458 00000 n 0000006225 00000 n 0000006261 00000 n 0000104516 00000 n 0000294370 00000 n 0000006307 00000 n 0000006353 00000 n 0000133710 00000 n 0000294282 00000 n 0000006398 00000 n 0000006425 00000 n 0000294192 00000 n 0000006492 00000 n 0000006542 00000 n 0000171146 00000 n 0000294114 00000 n 0000006585 00000 n 0000008066 00000 n 0000007648 00000 n 0000006610 00000 n 0000007788 00000 n 0000009688 00000 n 0000009261 00000 n 0000008160 00000 n 0000009401 00000 n 0000014373 00000 n 0000013942 00000 n 0000009782 00000 n 0000014082 00000 n 0000227641 00000 n 0000218786 00000 n 0000227480 00000 n 0000017991 00000 n 0000017811 00000 n 0000014480 00000 n 0000017933 00000 n 0000292704 00000 n 0000021273 00000 n 0000020922 00000 n 0000018086 00000 n 0000021215 00000 n 0000218401 00000 n 0000215814 00000 n 0000218239 00000 n 0000021064 00000 n 0000023235 00000 n 0000022992 00000 n 0000021394 00000 n 0000023114 00000 n 0000023172 00000 n 0000024494 00000 n 0000024314 00000 n 0000023330 00000 n 0000024436 00000 n 0000026795 00000 n 0000026615 00000 n 0000024589 00000 n 0000026737 00000 n 0000027761 00000 n 0000027581 00000 n 0000026890 00000 n 0000027703 00000 n 0000029594 00000 n 0000029414 00000 n 0000027844 00000 n 0000029536 00000 n 0000292821 00000 n 0000032809 00000 n 0000032246 00000 n 0000029677 00000 n 0000032396 00000 n 0000032540 00000 n 0000127111 00000 n 0000035843 00000 n 0000035663 00000 n 0000032915 00000 n 0000035785 00000 n 0000040404 00000 n 0000039640 00000 n 0000035950 00000 n 0000040346 00000 n 0000039798 00000 n 0000040000 00000 n 0000040196 00000 n 0000067435 00000 n 0000043195 00000 n 0000042366 00000 n 0000040512 00000 n 0000043137 00000 n 0000042532 00000 n 0000042683 00000 n 0000042838 00000 n 0000042986 00000 n 0000047502 00000 n 0000047266 00000 n 0000043278 00000 n 0000215512 00000 n 0000213465 00000 n 0000215353 00000 n 0000212696 00000 n 0000206969 00000 n 0000212532 00000 n 0000206121 00000 n 0000199467 00000 n 0000205959 00000 n 0000050070 00000 n 0000049395 00000 n 0000047646 00000 n 0000050012 00000 n 0000049553 00000 n 0000049702 00000 n 0000049858 00000 n 0000292938 00000 n 0000133767 00000 n 0000052972 00000 n 0000052736 00000 n 0000050153 00000 n 0000055227 00000 n 0000055047 00000 n 0000053105 00000 n 0000055169 00000 n 0000058195 00000 n 0000057951 00000 n 0000055310 00000 n 0000058073 00000 n 0000058131 00000 n 0000060510 00000 n 0000060330 00000 n 0000058304 00000 n 0000060452 00000 n 0000064381 00000 n 0000064201 00000 n 0000060593 00000 n 0000064323 00000 n 0000067493 00000 n 0000067255 00000 n 0000064501 00000 n 0000067377 00000 n 0000293055 00000 n 0000069305 00000 n 0000069125 00000 n 0000067626 00000 n 0000069247 00000 n 0000072975 00000 n 0000072634 00000 n 0000069401 00000 n 0000072917 00000 n 0000072776 00000 n 0000077165 00000 n 0000076985 00000 n 0000073084 00000 n 0000077107 00000 n 0000081814 00000 n 0000081634 00000 n 0000077286 00000 n 0000081756 00000 n 0000086406 00000 n 0000086049 00000 n 0000081960 00000 n 0000086348 00000 n 0000086191 00000 n 0000090269 00000 n 0000090026 00000 n 0000086528 00000 n 0000090148 00000 n 0000090206 00000 n 0000293172 00000 n 0000093066 00000 n 0000092886 00000 n 0000090391 00000 n 0000093008 00000 n 0000095094 00000 n 0000094751 00000 n 0000093175 00000 n 0000095036 00000 n 0000094893 00000 n 0000098721 00000 n 0000098485 00000 n 0000095177 00000 n 0000100531 00000 n 0000100351 00000 n 0000098840 00000 n 0000100473 00000 n 0000103089 00000 n 0000102853 00000 n 0000100627 00000 n 0000104573 00000 n 0000104337 00000 n 0000103222 00000 n 0000293289 00000 n 0000107726 00000 n 0000107074 00000 n 0000104667 00000 n 0000107668 00000 n 0000107232 00000 n 0000107368 00000 n 0000107521 00000 n 0000111412 00000 n 0000111232 00000 n 0000107821 00000 n 0000111354 00000 n 0000113222 00000 n 0000113042 00000 n 0000111520 00000 n 0000113164 00000 n 0000114965 00000 n 0000114785 00000 n 0000113317 00000 n 0000114907 00000 n 0000116043 00000 n 0000115863 00000 n 0000115060 00000 n 0000115985 00000 n 0000117873 00000 n 0000117693 00000 n 0000116126 00000 n 0000117815 00000 n 0000293406 00000 n 0000119193 00000 n 0000119013 00000 n 0000117968 00000 n 0000119135 00000 n 0000121463 00000 n 0000121283 00000 n 0000119288 00000 n 0000121405 00000 n 0000122856 00000 n 0000122676 00000 n 0000121570 00000 n 0000122798 00000 n 0000124620 00000 n 0000124440 00000 n 0000122939 00000 n 0000124562 00000 n 0000127175 00000 n 0000126931 00000 n 0000124703 00000 n 0000127053 00000 n 0000129485 00000 n 0000129305 00000 n 0000127271 00000 n 0000129427 00000 n 0000293523 00000 n 0000133830 00000 n 0000133344 00000 n 0000129568 00000 n 0000133486 00000 n 0000199161 00000 n 0000197197 00000 n 0000199002 00000 n 0000137807 00000 n 0000137627 00000 n 0000133973 00000 n 0000137749 00000 n 0000142076 00000 n 0000141669 00000 n 0000137940 00000 n 0000141811 00000 n 0000146486 00000 n 0000146306 00000 n 0000142195 00000 n 0000146428 00000 n 0000196795 00000 n 0000194394 00000 n 0000196632 00000 n 0000150458 00000 n 0000150278 00000 n 0000146570 00000 n 0000150400 00000 n 0000154347 00000 n 0000154167 00000 n 0000150529 00000 n 0000154289 00000 n 0000293640 00000 n 0000158308 00000 n 0000158128 00000 n 0000154418 00000 n 0000158250 00000 n 0000161641 00000 n 0000161278 00000 n 0000158379 00000 n 0000161583 00000 n 0000161420 00000 n 0000163461 00000 n 0000163281 00000 n 0000161724 00000 n 0000163403 00000 n 0000193314 00000 n 0000184692 00000 n 0000193153 00000 n 0000171204 00000 n 0000165895 00000 n 0000163569 00000 n 0000183570 00000 n 0000173439 00000 n 0000183410 00000 n 0000173121 00000 n 0000171311 00000 n 0000172961 00000 n 0000166309 00000 n 0000166445 00000 n 0000166581 00000 n 0000166718 00000 n 0000166855 00000 n 0000166991 00000 n 0000167128 00000 n 0000167264 00000 n 0000167401 00000 n 0000167538 00000 n 0000167675 00000 n 0000167812 00000 n 0000167949 00000 n 0000168086 00000 n 0000168223 00000 n 0000168359 00000 n 0000168495 00000 n 0000168631 00000 n 0000168768 00000 n 0000168905 00000 n 0000169042 00000 n 0000169178 00000 n 0000169315 00000 n 0000169452 00000 n 0000169589 00000 n 0000169726 00000 n 0000169863 00000 n 0000169997 00000 n 0000170134 00000 n 0000170269 00000 n 0000170406 00000 n 0000170543 00000 n 0000170679 00000 n 0000170816 00000 n 0000170952 00000 n 0000173352 00000 n 0000173328 00000 n 0000184251 00000 n 0000183908 00000 n 0000193951 00000 n 0000193669 00000 n 0000197062 00000 n 0000196996 00000 n 0000199383 00000 n 0000199359 00000 n 0000206656 00000 n 0000206376 00000 n 0000213167 00000 n 0000212951 00000 n 0000215732 00000 n 0000215708 00000 n 0000218666 00000 n 0000218610 00000 n 0000228281 00000 n 0000227949 00000 n 0000230688 00000 n 0000230664 00000 n 0000246969 00000 n 0000246589 00000 n 0000249439 00000 n 0000249380 00000 n 0000268040 00000 n 0000267616 00000 n 0000280589 00000 n 0000280253 00000 n 0000292217 00000 n 0000291863 00000 n 0000293749 00000 n 0000293865 00000 n 0000293967 00000 n 0000294037 00000 n 0000295159 00000 n 0000296439 00000 n 0000296478 00000 n 0000296516 00000 n 0000296625 00000 n trailer << /Size 463 /Root 461 0 R /Info 462 0 R /ID [<8BC4BF0E7D1EDCAAAC33C06743522B2A> <8BC4BF0E7D1EDCAAAC33C06743522B2A>] >> startxref 296829 %%EOF cmtk-3.0.0/Utilities/numdiff-5.2.1/getopt.h0000644000177700000170000001745311666247630017253 0ustar torstenman/* Declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables defined in this header. When this happens, include the headers that might declare getopt so that they will not cause confusion if included after this file. Then systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ #if defined __GETOPT_PREFIX && !defined __need_getopt # include # include # if HAVE_UNISTD_H # include # endif # undef __need_getopt # undef getopt # undef getopt_long # undef getopt_long_only # undef optarg # undef opterr # undef optind # undef optopt # define __GETOPT_CONCAT(x, y) x ## y # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) # define getopt __GETOPT_ID (getopt) # define getopt_long __GETOPT_ID (getopt_long) # define getopt_long_only __GETOPT_ID (getopt_long_only) # define optarg __GETOPT_ID (optarg) # define opterr __GETOPT_ID (opterr) # define optind __GETOPT_ID (optind) # define optopt __GETOPT_ID (optopt) #endif /* Standalone applications get correct prototypes for getopt_long and getopt_long_only; they declare "char **argv". libc uses prototypes with "char *const *argv" that are incorrect because getopt_long and getopt_long_only can permute argv; this is required for backward compatibility (e.g., for LSB 2.0.1). This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', but it caused redefinition warnings if both unistd.h and getopt.h were included, since unistd.h includes getopt.h having previously defined __need_getopt. The only place where __getopt_argv_const is used is in definitions of getopt_long and getopt_long_only below, but these are visible only if __need_getopt is not defined, so it is quite safe to rewrite the conditional as follows: */ #if !defined __need_getopt # if defined __GETOPT_PREFIX # define __getopt_argv_const /* empty */ # else # define __getopt_argv_const const # endif #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifndef __THROW # ifndef __GNUC_PREREQ # define __GNUC_PREREQ(maj, min) (0) # endif # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # else # define __THROW # endif #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; #ifndef __need_getopt extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; #endif #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ cmtk-3.0.0/Utilities/numdiff-5.2.1/setmode.h0000644000177700000170000000176711666247630017412 0ustar torstenman/* Set a file descriptor's mode to binary or to text. Copyright (C) 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Paul Eggert */ #ifndef set_binary_mode bool set_binary_mode (int, bool); # if ! HAVE_SETMODE_DOS # define set_binary_mode(fd, mode) 1 # endif #endif cmtk-3.0.0/Utilities/numdiff-5.2.1/exitfail.c0000644000177700000170000000217711666247630017546 0ustar torstenman/* Failure exit status Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "system.h" #include "exitfail.h" #include /* Modified by Ivano Primi on April 18, 2009. The value of the constant EXIT_FAILURE (1) is used by Numdiff to mean that the given files are different. To signal troubles Numdiff uses EXIT_TROUBLE (-1). */ int volatile exit_failure = EXIT_TROUBLE; cmtk-3.0.0/Utilities/numdiff-5.2.1/AUTHORS0000644000177700000170000000104611666247630016637 0ustar torstenmanNumdiff Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 - Ivano Primi (Ivano Primi is also the author of the program) Note: Numdiff includes source code from * GNU BC 1.06, Copyright (C) 1991, 1992, 1993, 1994, 1997, 2000 Free Software Foundation, Inc. * GNU C Library, Copyright (C) 1989-1994,1996-1999,2001,2003,2004 Free Software Foundation, Inc. and source code from GNU DIFF, Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. cmtk-3.0.0/Utilities/numdiff-5.2.1/analyze.c0000644000177700000170000006275311666247630017412 0ustar torstenman/* Analyze file differences for GNU DIFF. Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU DIFF. GNU DIFF is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU DIFF 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* The basic algorithm is described in: "An O(ND) Difference Algorithm and its Variations", Eugene Myers, Algorithmica Vol. 1 No. 2, 1986, pp. 251-266; see especially section 4.2, which describes the variation used below. Unless the --minimal option is specified, this code uses the TOO_EXPENSIVE heuristic, by Paul Eggert, to limit the cost to O(N**1.5 log N) at the price of producing suboptimal output for large inputs with many differences. The basic algorithm was independently discovered as described in: "Algorithms for Approximate String Matching", E. Ukkonen, Information and Control Vol. 64, 1985, pp. 100-118. */ /* This file, coming from the source code of GNU DIFF, has been modified by Ivano Primi so that it could be merged into the source code of Numdiff. Numdiff is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Numdiff 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. */ #include "numdiff.h" #include #include #include static lin *xvec, *yvec; /* Vectors being compared. */ static lin *fdiag; /* Vector, indexed by diagonal, containing 1 + the X coordinate of the point furthest along the given diagonal in the forward search of the edit matrix. */ static lin *bdiag; /* Vector, indexed by diagonal, containing the X coordinate of the point furthest along the given diagonal in the backward search of the edit matrix. */ static lin too_expensive; /* Edit scripts longer than this are too expensive to compute. */ #define SNAKE_LIMIT 20 /* Snakes bigger than this are considered `big'. */ struct partition { lin xmid, ymid; /* Midpoints of this partition. */ bool lo_minimal; /* Nonzero if low half will be analyzed minimally. */ bool hi_minimal; /* Likewise for high half. */ }; /* Find the midpoint of the shortest edit script for a specified portion of the two files. Scan from the beginnings of the files, and simultaneously from the ends, doing a breadth-first search through the space of edit-sequence. When the two searches meet, we have found the midpoint of the shortest edit sequence. If FIND_MINIMAL is nonzero, find the minimal edit script regardless of expense. Otherwise, if the search is too expensive, use heuristics to stop the search and report a suboptimal answer. Set PART->(xmid,ymid) to the midpoint (XMID,YMID). The diagonal number XMID - YMID equals the number of inserted lines minus the number of deleted lines (counting only lines before the midpoint). Return the approximate edit cost; this is the total number of lines inserted or deleted (counting only lines before the midpoint), unless a heuristic is used to terminate the search prematurely. Set PART->lo_minimal to true iff the minimal edit script for the left half of the partition is known; similarly for PART->hi_minimal. This function assumes that the first lines of the specified portions of the two files do not match, and likewise that the last lines do not match. The caller must trim matching lines from the beginning and end of the portions it is going to specify. If we return the "wrong" partitions, the worst this can do is cause suboptimal diff output. It cannot cause incorrect diff output. */ static lin diag (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal, struct partition *part) { lin *const fd = fdiag; /* Give the compiler a chance. */ lin *const bd = bdiag; /* Additional help for the compiler. */ lin const *const xv = xvec; /* Still more help for the compiler. */ lin const *const yv = yvec; /* And more and more . . . */ lin const dmin = xoff - ylim; /* Minimum valid diagonal. */ lin const dmax = xlim - yoff; /* Maximum valid diagonal. */ lin const fmid = xoff - yoff; /* Center diagonal of top-down search. */ lin const bmid = xlim - ylim; /* Center diagonal of bottom-up search. */ lin fmin = fmid, fmax = fmid; /* Limits of top-down search. */ lin bmin = bmid, bmax = bmid; /* Limits of bottom-up search. */ lin c; /* Cost. */ bool odd = (fmid - bmid) & 1; /* True if southeast corner is on an odd diagonal with respect to the northwest. */ fd[fmid] = xoff; bd[bmid] = xlim; for (c = 1;; ++c) { lin d; /* Active diagonal. */ bool big_snake = 0; /* Extend the top-down search by an edit step in each diagonal. */ fmin > dmin ? fd[--fmin - 1] = -1 : ++fmin; fmax < dmax ? fd[++fmax + 1] = -1 : --fmax; for (d = fmax; d >= fmin; d -= 2) { lin x, y, oldx, tlo = fd[d - 1], thi = fd[d + 1]; if (tlo >= thi) x = tlo + 1; else x = thi; oldx = x; y = x - d; while (x < xlim && y < ylim && xv[x] == yv[y]) ++x, ++y; if (x - oldx > SNAKE_LIMIT) big_snake = 1; fd[d] = x; if (odd && bmin <= d && d <= bmax && bd[d] <= x) { part->xmid = x; part->ymid = y; part->lo_minimal = part->hi_minimal = 1; return 2 * c - 1; } } /* Similarly extend the bottom-up search. */ bmin > dmin ? bd[--bmin - 1] = LIN_MAX : ++bmin; bmax < dmax ? bd[++bmax + 1] = LIN_MAX : --bmax; for (d = bmax; d >= bmin; d -= 2) { lin x, y, oldx, tlo = bd[d - 1], thi = bd[d + 1]; if (tlo < thi) x = tlo; else x = thi - 1; oldx = x; y = x - d; while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) --x, --y; if (oldx - x > SNAKE_LIMIT) big_snake = 1; bd[d] = x; if (!odd && fmin <= d && d <= fmax && x <= fd[d]) { part->xmid = x; part->ymid = y; part->lo_minimal = part->hi_minimal = 1; return 2 * c; } } if (find_minimal) continue; /* Heuristic: check occasionally for a diagonal that has made lots of progress compared with the edit distance. If we have any such, find the one that has made the most progress and return it as if it had succeeded. With this heuristic, for files with a constant small density of changes, the algorithm is linear in the file size. */ if (200 < c && big_snake && speed_large_files) { lin best; best = 0; for (d = fmax; d >= fmin; d -= 2) { lin dd = d - fmid; lin x = fd[d]; lin y = x - d; lin v = (x - xoff) * 2 - dd; if (v > 12 * (c + (dd < 0 ? -dd : dd))) { if (v > best && xoff + SNAKE_LIMIT <= x && x < xlim && yoff + SNAKE_LIMIT <= y && y < ylim) { /* We have a good enough best diagonal; now insist that it end with a significant snake. */ int k; for (k = 1; xv[x - k] == yv[y - k]; k++) if (k == SNAKE_LIMIT) { best = v; part->xmid = x; part->ymid = y; break; } } } } if (best > 0) { part->lo_minimal = 1; part->hi_minimal = 0; return 2 * c - 1; } best = 0; for (d = bmax; d >= bmin; d -= 2) { lin dd = d - bmid; lin x = bd[d]; lin y = x - d; lin v = (xlim - x) * 2 + dd; if (v > 12 * (c + (dd < 0 ? -dd : dd))) { if (v > best && xoff < x && x <= xlim - SNAKE_LIMIT && yoff < y && y <= ylim - SNAKE_LIMIT) { /* We have a good enough best diagonal; now insist that it end with a significant snake. */ int k; for (k = 0; xv[x + k] == yv[y + k]; k++) if (k == SNAKE_LIMIT - 1) { best = v; part->xmid = x; part->ymid = y; break; } } } } if (best > 0) { part->lo_minimal = 0; part->hi_minimal = 1; return 2 * c - 1; } } /* Heuristic: if we've gone well beyond the call of duty, give up and report halfway between our best results so far. */ if (c >= too_expensive) { lin fxybest, fxbest; lin bxybest, bxbest; fxbest = bxbest = 0; /* Pacify `gcc -Wall'. */ /* Find forward diagonal that maximizes X + Y. */ fxybest = -1; for (d = fmax; d >= fmin; d -= 2) { lin x = MIN (fd[d], xlim); lin y = x - d; if (ylim < y) x = ylim + d, y = ylim; if (fxybest < x + y) { fxybest = x + y; fxbest = x; } } /* Find backward diagonal that minimizes X + Y. */ bxybest = LIN_MAX; for (d = bmax; d >= bmin; d -= 2) { lin x = MAX (xoff, bd[d]); lin y = x - d; if (y < yoff) x = yoff + d, y = yoff; if (x + y < bxybest) { bxybest = x + y; bxbest = x; } } /* Use the better of the two diagonals. */ if ((xlim + ylim) - bxybest < fxybest - (xoff + yoff)) { part->xmid = fxbest; part->ymid = fxybest - fxbest; part->lo_minimal = 1; part->hi_minimal = 0; } else { part->xmid = bxbest; part->ymid = bxybest - bxbest; part->lo_minimal = 0; part->hi_minimal = 1; } return 2 * c - 1; } } } /* Compare in detail contiguous subsequences of the two files which are known, as a whole, to match each other. The results are recorded in the vectors files[N].changed, by storing 1 in the element for each line that is an insertion or deletion. The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1. Note that XLIM, YLIM are exclusive bounds. All line numbers are origin-0 and discarded lines are not counted. If FIND_MINIMAL, find a minimal difference no matter how expensive it is. */ static void compareseq (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal) { lin * const xv = xvec; /* Help the compiler. */ lin * const yv = yvec; /* Slide down the bottom initial diagonal. */ while (xoff < xlim && yoff < ylim && xv[xoff] == yv[yoff]) ++xoff, ++yoff; /* Slide up the top initial diagonal. */ while (xlim > xoff && ylim > yoff && xv[xlim - 1] == yv[ylim - 1]) --xlim, --ylim; /* Handle simple cases. */ if (xoff == xlim) while (yoff < ylim) files[1].changed[files[1].realindexes[yoff++]] = 1; else if (yoff == ylim) while (xoff < xlim) files[0].changed[files[0].realindexes[xoff++]] = 1; else { lin c; struct partition part; /* Find a point of correspondence in the middle of the files. */ c = diag (xoff, xlim, yoff, ylim, find_minimal, &part); if (c == 1) { /* This should be impossible, because it implies that one of the two subsequences is empty, and that case was handled above without calling `diag'. Let's verify that this is true. */ abort (); #if 0 /* The two subsequences differ by a single insert or delete; record it and we are done. */ if (part.xmid - part.ymid < xoff - yoff) files[1].changed[files[1].realindexes[part.ymid - 1]] = 1; else files[0].changed[files[0].realindexes[part.xmid]] = 1; #endif } else { /* Use the partitions to split this problem into subproblems. */ compareseq (xoff, part.xmid, yoff, part.ymid, part.lo_minimal); compareseq (part.xmid, xlim, part.ymid, ylim, part.hi_minimal); } } } /* Discard lines from one file that have no matches in the other file. A line which is discarded will not be considered by the actual comparison algorithm; it will be as if that line were not in the file. The file's `realindexes' table maps virtual line numbers (which don't count the discarded lines) into real line numbers; this is how the actual comparison algorithm produces results that are comprehensible when the discarded lines are counted. When we discard a line, we also mark it as a deletion or insertion so that it will be printed in the output. */ static void discard_confusing_lines (struct file_data filevec[], int minimal) { int f; lin i; char *discarded[2]; lin *equiv_count[2]; lin *p; /* Allocate our results. */ p = xmalloc ((filevec[0].buffered_lines + filevec[1].buffered_lines) * (2 * sizeof *p)); for (f = 0; f < 2; f++) { filevec[f].undiscarded = p; p += filevec[f].buffered_lines; filevec[f].realindexes = p; p += filevec[f].buffered_lines; } /* Set up equiv_count[F][I] as the number of lines in file F that fall in equivalence class I. */ p = zalloc (filevec[0].equiv_max * (2 * sizeof *p)); equiv_count[0] = p; equiv_count[1] = p + filevec[0].equiv_max; for (i = 0; i < filevec[0].buffered_lines; ++i) ++equiv_count[0][filevec[0].equivs[i]]; for (i = 0; i < filevec[1].buffered_lines; ++i) ++equiv_count[1][filevec[1].equivs[i]]; /* Set up tables of which lines are going to be discarded. */ discarded[0] = zalloc (filevec[0].buffered_lines + filevec[1].buffered_lines); discarded[1] = discarded[0] + filevec[0].buffered_lines; /* Mark to be discarded each line that matches no line of the other file. If a line matches many lines, mark it as provisionally discardable. */ for (f = 0; f < 2; f++) { size_t end = filevec[f].buffered_lines; char *discards = discarded[f]; lin *counts = equiv_count[1 - f]; lin *equivs = filevec[f].equivs; size_t many = 5; size_t tem = end / 64; /* Multiply MANY by approximate square root of number of lines. That is the threshold for provisionally discardable lines. */ while ((tem = tem >> 2) > 0) many *= 2; for (i = 0; i < end; i++) { lin nmatch; if (equivs[i] == 0) continue; nmatch = counts[equivs[i]]; if (nmatch == 0) discards[i] = 1; else if (nmatch > many) discards[i] = 2; } } /* Don't really discard the provisional lines except when they occur in a run of discardables, with nonprovisionals at the beginning and end. */ for (f = 0; f < 2; f++) { lin end = filevec[f].buffered_lines; register char *discards = discarded[f]; for (i = 0; i < end; i++) { /* Cancel provisional discards not in middle of run of discards. */ if (discards[i] == 2) discards[i] = 0; else if (discards[i] != 0) { /* We have found a nonprovisional discard. */ register lin j; lin length; lin provisional = 0; /* Find end of this run of discardable lines. Count how many are provisionally discardable. */ for (j = i; j < end; j++) { if (discards[j] == 0) break; if (discards[j] == 2) ++provisional; } /* Cancel provisional discards at end, and shrink the run. */ while (j > i && discards[j - 1] == 2) discards[--j] = 0, --provisional; /* Now we have the length of a run of discardable lines whose first and last are not provisional. */ length = j - i; /* If 1/4 of the lines in the run are provisional, cancel discarding of all provisional lines in the run. */ if (provisional * 4 > length) { while (j > i) if (discards[--j] == 2) discards[j] = 0; } else { register lin consec; lin minimum = 1; lin tem = length >> 2; /* MINIMUM is approximate square root of LENGTH/4. A subrun of two or more provisionals can stand when LENGTH is at least 16. A subrun of 4 or more can stand when LENGTH >= 64. */ while (0 < (tem >>= 2)) minimum <<= 1; minimum++; /* Cancel any subrun of MINIMUM or more provisionals within the larger run. */ for (j = 0, consec = 0; j < length; j++) if (discards[i + j] != 2) consec = 0; else if (minimum == ++consec) /* Back up to start of subrun, to cancel it all. */ j -= consec; else if (minimum < consec) discards[i + j] = 0; /* Scan from beginning of run until we find 3 or more nonprovisionals in a row or until the first nonprovisional at least 8 lines in. Until that point, cancel any provisionals. */ for (j = 0, consec = 0; j < length; j++) { if (j >= 8 && discards[i + j] == 1) break; if (discards[i + j] == 2) consec = 0, discards[i + j] = 0; else if (discards[i + j] == 0) consec = 0; else consec++; if (consec == 3) break; } /* I advances to the last line of the run. */ i += length - 1; /* Same thing, from end. */ for (j = 0, consec = 0; j < length; j++) { if (j >= 8 && discards[i - j] == 1) break; if (discards[i - j] == 2) consec = 0, discards[i - j] = 0; else if (discards[i - j] == 0) consec = 0; else consec++; if (consec == 3) break; } } } } } /* Actually discard the lines. */ for (f = 0; f < 2; f++) { char *discards = discarded[f]; lin end = filevec[f].buffered_lines; lin j = 0; for (i = 0; i < end; ++i) if ((minimal) || discards[i] == 0) { filevec[f].undiscarded[j] = filevec[f].equivs[i]; filevec[f].realindexes[j++] = i; } else filevec[f].changed[i] = 1; filevec[f].nondiscarded_lines = j; } free (discarded[0]); free (equiv_count[0]); } /* Adjust inserts/deletes of identical lines to join changes as much as possible. We do something when a run of changed lines include a line at one end and have an excluded, identical line at the other. We are free to choose which identical line is included. `compareseq' usually chooses the one at the beginning, but usually it is cleaner to consider the following identical line to be the "change". */ static void shift_boundaries (struct file_data filevec[]) { int f; for (f = 0; f < 2; f++) { bool *changed = filevec[f].changed; bool const *other_changed = filevec[1 - f].changed; lin const *equivs = filevec[f].equivs; lin i = 0; lin j = 0; lin i_end = filevec[f].buffered_lines; while (1) { lin runlength, start, corresponding; /* Scan forwards to find beginning of another run of changes. Also keep track of the corresponding point in the other file. */ while (i < i_end && !changed[i]) { while (other_changed[j++]) continue; i++; } if (i == i_end) break; start = i; /* Find the end of this run of changes. */ while (changed[++i]) continue; while (other_changed[j]) j++; do { /* Record the length of this run of changes, so that we can later determine whether the run has grown. */ runlength = i - start; /* Move the changed region back, so long as the previous unchanged line matches the last changed one. This merges with previous changed regions. */ while (start && equivs[start - 1] == equivs[i - 1]) { changed[--start] = 1; changed[--i] = 0; while (changed[start - 1]) start--; while (other_changed[--j]) continue; } /* Set CORRESPONDING to the end of the changed run, at the last point where it corresponds to a changed run in the other file. CORRESPONDING == I_END means no such point has been found. */ corresponding = other_changed[j - 1] ? i : i_end; /* Move the changed region forward, so long as the first changed line matches the following unchanged one. This merges with following changed regions. Do this second, so that if there are no merges, the changed region is moved forward as far as possible. */ while (i != i_end && equivs[start] == equivs[i]) { changed[start++] = 0; changed[i++] = 1; while (changed[i]) i++; while (other_changed[++j]) corresponding = i; } } while (runlength != i - start); /* If possible, move the fully-merged run of changes back to a corresponding run in the other file. */ while (corresponding < i) { changed[--start] = 1; changed[--i] = 0; while (other_changed[--j]) continue; } } } } /* Cons an additional entry onto the front of an edit script OLD. LINE0 and LINE1 are the first affected lines in the two files (origin 0). DELETED is the number of lines deleted here from file 0. INSERTED is the number of lines inserted here in file 1. If DELETED is 0 then LINE0 is the number of the line before which the insertion was done; vice versa for INSERTED and LINE1. */ static struct change * add_change (lin line0, lin line1, lin deleted, lin inserted, struct change *old) { struct change *new = xmalloc (sizeof *new); new->line0 = line0; new->line1 = line1; new->inserted = inserted; new->deleted = deleted; new->link = old; return new; } /* Scan the tables of which lines are inserted and deleted, producing an edit script in forward order. */ static struct change * build_script (struct file_data const filevec[]) { struct change *script = 0; bool *changed0 = filevec[0].changed; bool *changed1 = filevec[1].changed; lin i0 = filevec[0].buffered_lines, i1 = filevec[1].buffered_lines; /* Note that changedN[-1] does exist, and is 0. */ while (i0 >= 0 || i1 >= 0) { if (changed0[i0 - 1] | changed1[i1 - 1]) { lin line0 = i0, line1 = i1; /* Find # lines changed here in each file. */ while (changed0[i0 - 1]) --i0; while (changed1[i1 - 1]) --i1; /* Record this change. */ script = add_change (i0, i1, line0 - i0, line1 - i1, script); } /* We have reached lines in the two files that match each other. */ i0--, i1--; } return script; } /* Report the differences of two files. */ int diff_2_files (struct file_data filevec[], argslist* argl) { lin diags; int f; struct change *e, *p; struct change *script; int changes; /* This code was just used to discover the reason of a bug :) */ /* #ifdef __USE_FILE_OFFSET64 printf ("\n %s: FILE OFFSET 64 in use, sizeof (struct stat) = %u\n", __FILE__, sizeof (struct stat)); #else printf ("\n %s: FILE OFFSET 64 NOT in use, sizeof (struct stat) = %u\n", __FILE__, sizeof (struct stat)); #endif */ /* If we have detected that either file is binary, return the error code -1. */ if (read_files (filevec, argl)) return -1; else { /* Allocate vectors for the results of comparison: a flag for each line of each file, saying whether that line is an insertion or deletion. Allocate an extra element, always 0, at each end of each vector. */ size_t s = filevec[0].buffered_lines + filevec[1].buffered_lines + 4; bool *flag_space = zalloc (s * sizeof *flag_space); filevec[0].changed = flag_space + 1; filevec[1].changed = flag_space + filevec[0].buffered_lines + 3; /* Some lines are obviously insertions or deletions because they don't match anything. Detect them now, and avoid even thinking about them in the main comparison algorithm. */ discard_confusing_lines (filevec, (argl->optmask & _M_MASK)); /* Now do the main comparison algorithm, considering just the undiscarded lines. */ xvec = filevec[0].undiscarded; yvec = filevec[1].undiscarded; diags = (filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3); fdiag = xmalloc (diags * (2 * sizeof *fdiag)); bdiag = fdiag + diags; fdiag += filevec[1].nondiscarded_lines + 1; bdiag += filevec[1].nondiscarded_lines + 1; /* Set TOO_EXPENSIVE to be approximate square root of input size, bounded below by 256. */ too_expensive = 1; for (; diags != 0; diags >>= 2) too_expensive <<= 1; too_expensive = MAX (256, too_expensive); compareseq (0, filevec[0].nondiscarded_lines, 0, filevec[1].nondiscarded_lines, (argl->optmask & _M_MASK)); free (fdiag - (filevec[1].nondiscarded_lines + 1)); /* Modify the results slightly to make them prettier in cases where that can validly be done. */ shift_boundaries (filevec); /* Get the results of comparison in the form of a chain of `struct change's -- an edit script. */ script = build_script (filevec); /* Set CHANGES if we had any diffs. */ changes = (script != 0); if ( argl->optmask & _F_MASK && argl->output_mode > OUTMODE_QUIET ) { if (changes | !suppress_common_lines) print_sdiff_script (script); } else { if (changes | !suppress_common_lines) notedown_sdiff_script (script); } free (filevec[0].undiscarded); free (flag_space); for (f = 0; f < 2; f++) { free (filevec[f].equivs); free (filevec[f].linbuf + filevec[f].linbuf_base); } for (e = script; e; e = p) { p = e->link; free (e); } } if (filevec[0].buffer != filevec[1].buffer) free (filevec[0].buffer); free (filevec[1].buffer); return changes; } cmtk-3.0.0/Utilities/numdiff-5.2.1/getopt.c0000644000177700000170000010123711666247630017240 0ustar torstenman/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include #endif #include /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #include #ifdef VMS # include #endif #ifdef _LIBC # include #else # include "gettext.h" # define _(msgid) gettext (msgid) #endif #if defined _LIBC && defined USE_IN_LIBIO # include #endif #ifndef attribute_hidden # define attribute_hidden #endif /* Unlike standard Unix `getopt', functions like `getopt_long' let the user intersperse the options with the other arguments. As `getopt_long' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Using `getopt' or setting the environment variable POSIXLY_CORRECT disables permutation. Then the application's behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" #include "getopt_int.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Keep a global copy of all internal members of getopt_data. */ static struct _getopt_data getopt_data; #ifndef __GNU_LIBRARY__ /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif #endif /* not __GNU_LIBRARY__ */ #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (d->__nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (char **argv, struct _getopt_data *d) { int bottom = d->__first_nonopt; int middle = d->__last_nonopt; int top = d->optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, d->__nonoption_flags_max_len), '\0', top + 1 - d->__nonoption_flags_max_len); d->__nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->__first_nonopt += (d->optind - d->__last_nonopt); d->__last_nonopt = d->optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (int argc, char **argv, const char *optstring, int posixly_correct, struct _getopt_data *d) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ d->__first_nonopt = d->__last_nonopt = d->optind; d->__nextchar = NULL; d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { d->__ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { d->__ordering = REQUIRE_ORDER; ++optstring; } else if (d->__posixly_correct) d->__ordering = REQUIRE_ORDER; else d->__ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (!d->__posixly_correct && argc == __libc_argc && argv == __libc_argv) { if (d->__nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') d->__nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = d->__nonoption_flags_max_len = strlen (orig_str); if (d->__nonoption_flags_max_len < argc) d->__nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (d->__nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) d->__nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', d->__nonoption_flags_max_len - len); } } d->__nonoption_flags_len = d->__nonoption_flags_max_len; } else d->__nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT environment variable were set. */ int _getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct, struct _getopt_data *d) { int print_errors = d->opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; d->optarg = NULL; if (d->optind == 0 || !d->__initialized) { if (d->optind == 0) d->optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring, posixly_correct, d); d->__initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ || (d->optind < d->__nonoption_flags_len \ && __getopt_nonoption_flags[d->optind] == '1')) #else # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') #endif if (d->__nextchar == NULL || *d->__nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (d->__last_nonopt > d->optind) d->__last_nonopt = d->optind; if (d->__first_nonopt > d->optind) d->__first_nonopt = d->optind; if (d->__ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__last_nonopt != d->optind) d->__first_nonopt = d->optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (d->optind < argc && NONOPTION_P) d->optind++; d->__last_nonopt = d->optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (d->optind != argc && !strcmp (argv[d->optind], "--")) { d->optind++; if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__first_nonopt == d->__last_nonopt) d->__first_nonopt = d->optind; d->__last_nonopt = argc; d->optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (d->optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (d->__first_nonopt != d->__last_nonopt) d->optind = d->__first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (d->__ordering == REQUIRE_ORDER) return -1; d->optarg = argv[d->optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ d->__nextchar = (argv[d->optind] + 1 + (longopts != NULL && argv[d->optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[d->optind][1] == '-' || (long_only && (argv[d->optind][2] || !strchr (optstring, argv[d->optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { if ((unsigned int) (nameend - d->__nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; d->optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; d->optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[d->optind][1] == '-' || strchr (optstring, *d->__nextchar) == NULL) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), argv[0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], d->__nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar = (char *) ""; d->optind++; d->optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *d->__nextchar++; char *temp = strchr (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*d->__nextchar == '\0') ++d->optind; if (temp == NULL || c == ':') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (d->__posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: illegal option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: invalid option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `d->optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } d->__nextchar += strlen (d->__nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } d->__nextchar += strlen (d->__nextchar); return optstring[0] == ':' ? ':' : '?'; } } d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } d->__nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; d->optind++; } else d->optarg = NULL; d->__nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option requires an argument -- %c\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; d->__nextchar = NULL; } } return c; } } int _getopt_internal (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct) { int result; getopt_data.optind = optind; getopt_data.opterr = opterr; result = _getopt_internal_r (argc, argv, optstring, longopts, longind, long_only, posixly_correct, &getopt_data); optind = getopt_data.optind; optarg = getopt_data.optarg; optopt = getopt_data.optopt; return result; } /* glibc gets a LSB-compliant getopt. Standalone applications get a POSIX-compliant getopt. */ #if _LIBC enum { POSIXLY_CORRECT = 0 }; #else enum { POSIXLY_CORRECT = 1 }; #endif int getopt (int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, POSIXLY_CORRECT); } #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ cmtk-3.0.0/Utilities/numdiff-5.2.1/Makefile.in0000644000177700000170000003002611666247630017634 0ustar torstenman# !/bin/sh # Numdiff makefile # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Ivano Primi # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. # # @configure_input@ PACKAGE=numdiff PACKAGETWO=ndselect VERSION=5.2.1 SHELL=/bin/sh .SUFFIXES: .SUFFIXES: .c .o prefix =@prefix@ exec_prefix =@exec_prefix@ bindir =@bindir@ docdir =@docdir@ localedir =@localedir@ infodir =@infodir@ srcdir =@srcdir@ VPATH =@srcdir@ BINDIR=$(bindir) DOCDIR=$(docdir)/$(PACKAGE) INFODIR=$(infodir) LOCALEDIR=$(localedir) CC=@CC@ @SET_MAKE@ #MAKE=make MKDIR=$(srcdir)/shtool install -d DIST_MKDIR=$(srcdir)/shtool mkdir -f -m 777 INSTALL=$(srcdir)/shtool install -c MOVE=$(srcdir)/shtool move -p INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) -m 644 FIND=@FIND@ INSTINFO=@INSTINFO@ LS=ls CP=cp RM=rm -f RMDIR=rmdir RD=rm -f -R CAT=cat GZIP=gzip -f TAR=tar MSGFMT=msgfmt -c MSGMERGE=msgmerge XGETTEXT=xgettext -C -D$(srcdir) -k_ -kN_ --msgid-bugs-address=ivprimi@libero.it TEXI2HTML=makeinfo --html --no-split TEXI2INFO=makeinfo TEXI2PDF=texi2pdf TEXI2TXT=makeinfo --plaintext # flags for the preprocessor: CPPFLAGS =-DPACKAGE="\"$(PACKAGE)\"" -DPACKAGE2="\"$(PACKAGETWO)\"" -DLOCALEDIR="\"$(LOCALEDIR)\"" -I$(srcdir) -I. @CPPFLAGS@ # flags for the C compiler: CFLAGS =@CFLAGS@ # flags for the linker: LDFLAGS =@LDFLAGS@ # -L and -l options: LIBS =@LIBS@ @LIB_CLOCK_GETTIME@ OBJECTS= ./analyze.o ./arith.o ./cmpbuf.o ./cmpfns.o ./error.o ./exitfail.o ./flags.o ./getopt.o ./getopt1.o ./inout.o ./io.o ./main.o ./ndselect.o ./numutil.o ./options.o ./setmode.o ./side.o ./util.o ./xalloc-die.o ./xmalloc.o @LIBOBJS@ OBJECTSONE=./analyze.o ./arith.o ./cmpbuf.o ./cmpfns.o ./error.o ./exitfail.o ./flags.o ./getopt.o ./getopt1.o ./inout.o ./io.o ./main.o ./numutil.o ./options.o ./setmode.o ./side.o ./util.o ./xalloc-die.o ./xmalloc.o @LIBOBJS@ SOURCESONE=$(srcdir)/analyze.c $(srcdir)/arith.c $(srcdir)/cmpbuf.c $(srcdir)/cmpfns.c $(srcdir)/error.c $(srcdir)/errors.c $(srcdir)/exitfail.c $(srcdir)/flags.c $(srcdir)/getopt.c $(srcdir)/getopt1.c $(srcdir)/inout.c $(srcdir)/io.c $(srcdir)/main.c $(srcdir)/new.c $(srcdir)/number.c $(srcdir)/numutil.c $(srcdir)/options.c $(srcdir)/read_line.c $(srcdir)/setmode.c $(srcdir)/side.c $(srcdir)/util.c $(srcdir)/xalloc-die.c $(srcdir)/xmalloc.c OBJECTSTWO=./getopt.o ./ndselect.o SOURCESTWO=$(srcdir)/getopt.c $(srcdir)/ndselect.c $(srcdir)/read_line.c DOCS=$(srcdir)/AUTHORS $(srcdir)/BUGS $(srcdir)/COPYING $(srcdir)/ChangeLog $(srcdir)/INSTALL $(srcdir)/NEWS $(srcdir)/README $(srcdir)/TODO TEXISRC=$(srcdir)/docs/numdiff.txi FDLTEXI=$(srcdir)/docs/fdl.texi HTMLFILE=$(srcdir)/docs/numdiff.html INFOFILE=$(srcdir)/docs/numdiff.info PDFFILE=$(srcdir)/docs/numdiff.pdf TXTFILE=$(srcdir)/docs/numdiff.txt # l10n files PACKAGE_POT=$(srcdir)/po/$(PACKAGE)/$(PACKAGE).pot PACKAGETWO_POT=$(srcdir)/po/$(PACKAGETWO)/$(PACKAGETWO).pot PACKAGE_IT=$(srcdir)/po/$(PACKAGE)/it PACKAGETWO_IT=$(srcdir)/po/$(PACKAGETWO)/it IT_LOC_DIR=$(DESTDIR)$(LOCALEDIR)/it/LC_MESSAGES GARBAGE=./numdiff.aux ./numdiff.cp ./numdiff.cps ./numdiff.fn ./numdiff.ky ./numdiff.log ./numdiff.pg ./numdiff.toc ./numdiff.tp ./numdiff.vr ./config.log ./config.status ./config.h.in.save ./config.h # Rules to build the executable programs all: $(PACKAGE) $(PACKAGETWO) $(PACKAGE): $(OBJECTS) $(CC) $(OBJECTSONE) -o $@ $(LDFLAGS) $(LIBS) $(PACKAGETWO): $(OBJECTS) $(CC) $(OBJECTSTWO) -o $@ $(LDFLAGS) $(LIBS) # Rules to build the documentation. The documentation # must be built in $(srcdir)/docs ! info: $(INFOFILE).gz $(INFOFILE).gz: $(INFOFILE) $(CAT) $(INFOFILE) | $(GZIP) > $(INFOFILE).gz $(INFOFILE): $(TEXISRC) $(TEXI2INFO) $(TEXISRC) -o $(INFOFILE) html: $(HTMLFILE) $(HTMLFILE): $(TEXISRC) $(TEXI2HTML) $(TEXISRC) -o $(HTMLFILE) pdf: $(PDFFILE) $(PDFFILE): $(TEXISRC) $(TEXI2PDF) $(TEXISRC) -o $(PDFFILE) txt: $(TXTFILE) $(TXTFILE): $(TEXISRC) $(TEXI2TXT) $(TEXISRC) -o $(TXTFILE) # Rules to create PO template files. They should be used # only by the maintainer of the package. pot: $(PACKAGE_POT) $(PACKAGETWO_POT) $(PACKAGE_POT): $(SOURCESONE) @echo 'This command is intended for maintainers to use; it' @echo 'requires special tools to work.' $(XGETTEXT) --package-name=$(PACKAGE) \ --package-version=$(VERSION) \ -o $(PACKAGE_POT) $(SOURCESONE) *.h $(PACKAGETWO_POT): $(SOURCESTWO) @echo 'This command is intended for maintainers to use; it' @echo 'requires special tools to work.' $(XGETTEXT) --package-name=$(PACKAGETWO) \ --package-version=$(VERSION) \ -o $(PACKAGETWO_POT) $(SOURCESTWO) *.h po: $(PACKAGE_IT).po $(PACKAGETWO_IT).po $(PACKAGE_IT).po: $(PACKAGE_POT) @echo 'This command is intended for maintainers to use; it' @echo 'requires special tools to work.' if $(SHELL) -c "$(LS) $(PACKAGE_IT).po" \ >/dev/null 2>&1; then \ $(MSGMERGE) $(PACKAGE_IT).po $(PACKAGE_POT) -o $(PACKAGE_IT).po.new; \ $(MOVE) $(PACKAGE_IT).po.new $(PACKAGE_IT).po; \ else $(CP) $(PACKAGE_POT) $(PACKAGE_IT).po; fi $(PACKAGETWO_IT).po: $(PACKAGETWO_POT) @echo 'This command is intended for maintainers to use; it' @echo 'requires special tools to work.' if $(SHELL) -c "$(LS) $(PACKAGETWO_IT).po" \ >/dev/null 2>&1; then \ $(MSGMERGE) $(PACKAGETWO_IT).po $(PACKAGETWO_POT) -o $(PACKAGETWO_IT).po.new; \ $(MOVE) $(PACKAGETWO_IT).po.new $(PACKAGETWO_IT).po; \ else $(CP) $(PACKAGETWO_POT) $(PACKAGETWO_IT).po; fi # Rules to build the l10n files. They # must be built in $(srcdir)/po/numdiff (for numdiff) and # in $(srcdir)/po/ndselect (for ndselect). mo: $(PACKAGE_IT).mo $(PACKAGETWO_IT).mo $(PACKAGE_IT).mo: $(PACKAGE_IT).po $(MSGFMT) $(PACKAGE_IT).po -o $(PACKAGE_IT).mo $(PACKAGETWO_IT).mo: $(PACKAGETWO_IT).po $(MSGFMT) $(PACKAGETWO_IT).po -o $(PACKAGETWO_IT).mo # Rules needed by the installation process. installdirs: all $(MKDIR) $(DESTDIR)$(BINDIR) $(MKDIR) $(DESTDIR)$(DOCDIR) $(MKDIR) $(DESTDIR)$(INFODIR) $(MKDIR) $(IT_LOC_DIR) install: installdirs html info pdf txt $(INSTALL_PROGRAM) $(PACKAGE) $(PACKAGETWO) $(DESTDIR)$(BINDIR) $(INSTALL_DATA) $(DOCS) $(DESTDIR)$(DOCDIR) $(INSTALL_DATA) $(HTMLFILE) $(DESTDIR)$(DOCDIR) $(INSTALL_DATA) $(PDFFILE) $(DESTDIR)$(DOCDIR) $(INSTALL_DATA) $(TXTFILE) $(DESTDIR)$(DOCDIR) $(POST_INSTALL) $(INSTALL_DATA) $(INFOFILE) $(DESTDIR)$(INFODIR) $(INSTALL_DATA) $(INFOFILE).gz $(DESTDIR)$(INFODIR) if $(SHELL) -c "$(INSTINFO) --version" \ >/dev/null 2>&1; then \ $(INSTINFO) --dir-file=$(DESTDIR)$(INFODIR)/dir $(DESTDIR)$(INFODIR)/numdiff.info; \ else true; fi install-nls: install $(INSTALL_DATA) $(PACKAGE_IT).mo $(IT_LOC_DIR)/$(PACKAGE).mo $(INSTALL_DATA) $(PACKAGETWO_IT).mo $(IT_LOC_DIR)/$(PACKAGETWO).mo # Rules needed to removed the installed stuff uninstall: $(RM) $(DESTDIR)$(BINDIR)/$(PACKAGE) $(RM) $(DESTDIR)$(BINDIR)/$(PACKAGETWO) $(RM) $(DESTDIR)$(DOCDIR)/* $(RMDIR) $(DESTDIR)$(DOCDIR) $(INSTINFO) --delete $(DESTDIR)$(INFODIR)/numdiff.info $(DESTDIR)$(INFODIR)/dir $(RM) $(DESTDIR)$(INFODIR)/numdiff.info.gz $(RM) $(DESTDIR)$(INFODIR)/numdiff.info uninstall-nls: uninstall $(FIND) $(DESTDIR)$(LOCALEDIR) -name '$(PACKAGE).mo' -exec $(RM) \{\} \; $(FIND) $(DESTDIR)$(LOCALEDIR) -name '$(PACKAGETWO).mo' -exec $(RM) \{\} \; # Cleaning rules clean: $(RM) $(OBJECTS) $(RM) $(PACKAGE) $(RM) $(PACKAGETWO) distclean: clean $(RM) $(GARBAGE) maintainer-clean: distclean @echo 'This command is intended for maintainers to use; it' @echo 'deletes files that may need special tools to rebuild.' $(RM) $(HTMLFILE) $(RM) $(INFOFILE) $(RM) $(INFOFILE).gz $(RM) $(PDFFILE) $(RM) $(TXTFILE) $(RM) $(PACKAGE_POT) $(RM) $(PACKAGETWO_POT) $(RM) $(PACKAGE_IT).mo $(RM) $(PACKAGETWO_IT).mo # To make a distribution tarball createdirs: $(DIST_MKDIR) $(srcdir)/$(PACKAGE)-$(VERSION) $(DIST_MKDIR) $(srcdir)/$(PACKAGE)-$(VERSION)/RCS $(DIST_MKDIR) $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(DIST_MKDIR) $(srcdir)/$(PACKAGE)-$(VERSION)/m4 $(DIST_MKDIR) $(srcdir)/$(PACKAGE)-$(VERSION)/po $(DIST_MKDIR) $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGE) $(DIST_MKDIR) $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGETWO) copy: createdirs $(CP) $(DOCS) $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/Makefile.in $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/aclocal.m4 $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/config.h.in $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/configure.ac $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/configure $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(TEXISRC) $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(CP) $(FDLTEXI) $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(CP) $(HTMLFILE) $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(CP) $(INFOFILE) $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(CP) $(INFOFILE).gz $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(CP) $(PDFFILE) $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(CP) $(TXTFILE) $(srcdir)/$(PACKAGE)-$(VERSION)/docs $(CP) $(srcdir)/analyze.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/arith.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/cmpbuf.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/cmpfns.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/error.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/errors.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/exitfail.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/flags.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/getopt.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/getopt1.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/inout.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/io.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/main.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/ndselect.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/new.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/number.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/numutil.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/options.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/read_line.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/setmode.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/side.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/util.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/xalloc-die.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/xmalloc.c $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/cmpbuf.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/error.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/exitfail.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/getopt.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/getopt_int.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/gettext.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/ndselect.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/number.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/numdiff.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/setmode.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/system.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/unlocked-io.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/xalloc.h $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/shtool $(srcdir)/$(PACKAGE)-$(VERSION) $(CP) $(srcdir)/m4/setmode.m4 $(srcdir)/$(PACKAGE)-$(VERSION)/m4 $(CP) $(srcdir)/m4/st_mtim.m4 $(srcdir)/$(PACKAGE)-$(VERSION)/m4 $(CP) $(PACKAGE_POT) $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGE) $(CP) $(PACKAGE_IT).po $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGE) $(CP) $(PACKAGE_IT).mo $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGE) $(CP) $(PACKAGETWO_POT) $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGETWO) $(CP) $(PACKAGETWO_IT).po $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGETWO) $(CP) $(PACKAGETWO_IT).mo $(srcdir)/$(PACKAGE)-$(VERSION)/po/$(PACKAGETWO) dist: copy $(TAR) cvf $(srcdir)/$(PACKAGE)-$(VERSION).tar $(srcdir)/$(PACKAGE)-$(VERSION) $(GZIP) $(srcdir)/$(PACKAGE)-$(VERSION).tar $(RD) $(srcdir)/$(PACKAGE)-$(VERSION) # To make a backup tarball tarball: copy $(CP) $(srcdir)/RCS/* $(srcdir)/$(PACKAGE)-$(VERSION)/RCS $(TAR) cvf $(srcdir)/$(PACKAGE)-$(VERSION).tar $(srcdir)/$(PACKAGE)-$(VERSION) $(GZIP) $(srcdir)/$(PACKAGE)-$(VERSION).tar $(RD) $(srcdir)/$(PACKAGE)-$(VERSION) cmtk-3.0.0/Utilities/numdiff-5.2.1/setmode.c0000644000177700000170000000322411666247630017373 0ustar torstenman/* Set a file descriptor's mode to binary or to text. Copyright (C) 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Paul Eggert */ #if HAVE_CONFIG_H # include #endif #if HAVE_STDBOOL_H # include #else typedef enum {false = 0, true = 1} bool; #endif #if HAVE_SETMODE_DOS # include # if HAVE_FCNTL_H # include # endif # if HAVE_UNISTD_H # include # endif #endif #include "setmode.h" #undef set_binary_mode /* Set the binary mode of FD to MODE, returning its previous mode. MODE is 1 for binary and 0 for text. If setting the mode might cause problems, ignore the request and return MODE. Always return 1 on POSIX platforms, which do not distinguish between text and binary. */ bool set_binary_mode (int fd, bool mode) { #if HAVE_SETMODE_DOS if (isatty (fd)) return mode; return setmode (fd, mode ? O_BINARY : O_TEXT) != O_TEXT; #else return 1; #endif } cmtk-3.0.0/Utilities/numdiff-5.2.1/configure0000755000177700000170000112760411666247630017510 0ustar torstenman#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for Numdiff 5.2. # # Report bugs to <>. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Numdiff' PACKAGE_TARNAME='numdiff' PACKAGE_VERSION='5.2' PACKAGE_STRING='Numdiff 5.2' PACKAGE_BUGREPORT='' ac_unique_file="numdiff.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS SET_MAKE LIB_CLOCK_GETTIME INSTINFO FIND EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_largefile enable_debug enable_optimization enable_nls enable_gmp ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Numdiff 5.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/numdiff] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Numdiff 5.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files --enable-debug turn on debugging default=no --enable-optimization turn on basic optimization default=no --enable-nls turn on Natural Language Support default=yes --enable-gmp turn on use of GNU MP default=yes Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to <>. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Numdiff configure 5.2 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Numdiff $as_me 5.2, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" if test "x$DBGFLAGS" = "x"; then DBGFLAGS="-g" fi if test "x$OPTFLAGS" = "x"; then OPTFLAGS="-O" fi CPPFLAGS="${CPPFLAGS:=}" CFLAGS="${CFLAGS:=}" LDFLAGS="${LDFLAGS:=}" LIBS="${LIBS:=}" CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H" if test "`$CPP -v < /dev/null 2>&1 | grep '/usr/local/include' 2>&1`" = ""; then CPPFLAGS="$CPPFLAGS -I/usr/local/include" LDFLAGS="$LDFLAGS -L/usr/local/lib" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "${ac_cv_header_minix_config_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 $as_echo_n "checking for minix/config.h... " >&6; } if test "${ac_cv_header_minix_config_h+set}" = set; then $as_echo_n "(cached) " >&6 fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 $as_echo "$ac_cv_header_minix_config_h" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5 $as_echo_n "checking minix/config.h usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5 $as_echo_n "checking minix/config.h presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to ## ## ----------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 $as_echo_n "checking for minix/config.h... " >&6; } if test "${ac_cv_header_minix_config_h+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_header_minix_config_h=$ac_header_preproc fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 $as_echo "$ac_cv_header_minix_config_h" >&6; } fi if test "x$ac_cv_header_minix_config_h" = x""yes; then MINIX=yes else MINIX= fi if test "$MINIX" = yes; then cat >>confdefs.h <<\_ACEOF #define _POSIX_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_1_SOURCE 2 _ACEOF cat >>confdefs.h <<\_ACEOF #define _MINIX 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test "${ac_cv_safe_to_define___extensions__+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_safe_to_define___extensions__=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && cat >>confdefs.h <<\_ACEOF #define __EXTENSIONS__ 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _GNU_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _TANDEM_SOURCE 1 _ACEOF ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "x$CC" != xcc; then { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -f conftest2.$ac_objext && { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -f conftest2.$ac_objext && { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } cat >>confdefs.h <<\_ACEOF #define NO_MINUS_C_MINUS_O 1 _ACEOF fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Extract the first word of "find", so it can be a program name with args. set dummy find; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_FIND+set}" = set; then $as_echo_n "(cached) " >&6 else case $FIND in [\\/]* | ?:[\\/]*) ac_cv_path_FIND="$FIND" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_FIND="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi FIND=$ac_cv_path_FIND if test -n "$FIND"; then { $as_echo "$as_me:$LINENO: result: $FIND" >&5 $as_echo "$FIND" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi for ac_prog in install-info ginstall-info do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_INSTINFO+set}" = set; then $as_echo_n "(cached) " >&6 else case $INSTINFO in [\\/]* | ?:[\\/]*) ac_cv_path_INSTINFO="$INSTINFO" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_INSTINFO="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi INSTINFO=$ac_cv_path_INSTINFO if test -n "$INSTINFO"; then { $as_echo "$as_me:$LINENO: result: $INSTINFO" >&5 $as_echo "$INSTINFO" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$INSTINFO" && break done { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi if test $ac_cv_header_stdc = yes; then { $as_echo "$as_me:$LINENO: result: Ok! I have just found them." >&5 $as_echo "Ok! I have just found them." >&6; } else { { $as_echo "$as_me:$LINENO: error: Cannot find ANSI C header files!" >&5 $as_echo "$as_me: error: Cannot find ANSI C header files!" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if test "${ac_cv_header_stdbool_h+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; # if defined __xlc__ || defined __GNUC__ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 reported by James Lemley on 2005-10-05; see http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html This test is not quite right, since xlc is allowed to reject this program, as the initializer for xlcbug is not one of the forms that C requires support for. However, doing the test right would require a runtime test, and that would make cross-compilation harder. Let us hope that IBM fixes the xlc bug, and also adds support for this kind of constant expression. In the meantime, this test will reject xlc, which is OK, since our stdbool.h substitute should suffice. We also test this with GCC, where it should work, to detect more quickly whether someone messes up the test in the future. */ char digs[] = "0123456789"; int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); # endif /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdbool_h=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } { $as_echo "$as_me:$LINENO: checking for _Bool" >&5 $as_echo_n "checking for _Bool... " >&6; } if test "${ac_cv_type__Bool+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type__Bool=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (_Bool)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((_Bool))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type__Bool=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 $as_echo "$ac_cv_type__Bool" >&6; } if test "x$ac_cv_type__Bool" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STDBOOL_H 1 _ACEOF fi for ac_header in fcntl.h locale.h stddef.h \ stdlib.h string.h sys/file.h time.h unistd.h wchar.h wctype.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to ## ## ----------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_opendir=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_opendir=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 $as_echo_n "checking whether stat file-mode macros are broken... " >&6; } if test "${ac_cv_header_stat_broken+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if defined S_ISBLK && defined S_IFDIR extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; #endif #if defined S_ISBLK && defined S_IFCHR extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; #endif #if defined S_ISLNK && defined S_IFREG extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; #endif #if defined S_ISSOCK && defined S_IFREG extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stat_broken=no else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stat_broken=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 $as_echo "$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then cat >>confdefs.h <<\_ACEOF #define STAT_MACROS_BROKEN 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_sys_wait_h=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if test "${ac_cv_sys_largefile_CC+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_largefile_CC=' -n32'; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if test "${ac_cv_sys_file_offset_bits+set}" = set; then $as_echo_n "(cached) " >&6 else while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=no; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=64; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if test "${ac_cv_sys_large_files+set}" = set; then $as_echo_n "(cached) " >&6 else while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=no; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=1; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi { $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const /**/ _ACEOF fi { $as_echo "$as_me:$LINENO: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if test "${ac_cv_c_inline+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_inline=$ac_kw else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:$LINENO: checking for variable-length arrays" >&5 $as_echo_n "checking for variable-length arrays... " >&6; } if test "${ac_cv_c_vararrays+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0]; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_vararrays=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_vararrays=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_vararrays" >&5 $as_echo "$ac_cv_c_vararrays" >&6; } if test $ac_cv_c_vararrays = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_C_VARARRAYS 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for size_t" >&5 $as_echo_n "checking for size_t... " >&6; } if test "${ac_cv_type_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_size_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((size_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 $as_echo "$ac_cv_type_size_t" >&6; } if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:$LINENO: checking for pid_t" >&5 $as_echo_n "checking for pid_t... " >&6; } if test "${ac_cv_type_pid_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_pid_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((pid_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 $as_echo "$ac_cv_type_pid_t" >&6; } if test "x$ac_cv_type_pid_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 $as_echo_n "checking for ptrdiff_t... " >&6; } if test "${ac_cv_type_ptrdiff_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_ptrdiff_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (ptrdiff_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((ptrdiff_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_ptrdiff_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 $as_echo "$ac_cv_type_ptrdiff_t" >&6; } if test "x$ac_cv_type_ptrdiff_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define ptrdiff_t int _ACEOF fi { $as_echo "$as_me:$LINENO: checking for ssize_t" >&5 $as_echo_n "checking for ssize_t... " >&6; } if test "${ac_cv_type_ssize_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_ssize_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (ssize_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((ssize_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_ssize_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 $as_echo "$ac_cv_type_ssize_t" >&6; } if test "x$ac_cv_type_ssize_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi { $as_echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5 $as_echo_n "checking for struct stat.st_blksize... " >&6; } if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static struct stat ac_aggr; if (ac_aggr.st_blksize) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blksize=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static struct stat ac_aggr; if (sizeof ac_aggr.st_blksize) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blksize=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_blksize=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 $as_echo "$ac_cv_member_struct_stat_st_blksize" >&6; } if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_ST_BLKSIZE 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 $as_echo_n "checking for struct stat.st_rdev... " >&6; } if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static struct stat ac_aggr; if (ac_aggr.st_rdev) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_rdev=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static struct stat ac_aggr; if (sizeof ac_aggr.st_rdev) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_rdev=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_rdev=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 $as_echo "$ac_cv_member_struct_stat_st_rdev" >&6; } if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_ST_RDEV 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for nanoseconds member of struct stat.st_mtim" >&5 $as_echo_n "checking for nanoseconds member of struct stat.st_mtim... " >&6; } if test "${ac_cv_struct_st_mtim_nsec+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_CPPFLAGS="$CPPFLAGS" ac_cv_struct_st_mtim_nsec=no # tv_nsec -- the usual case # _tv_nsec -- Solaris 2.6, if # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1 # && !defined __EXTENSIONS__) # st__tim.tv_nsec -- UnixWare 2.1.2 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct stat s; s.st_mtim.ST_MTIM_NSEC; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_st_mtim_nsec=$ac_val; break else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CPPFLAGS="$ac_save_CPPFLAGS" fi { $as_echo "$as_me:$LINENO: result: $ac_cv_struct_st_mtim_nsec" >&5 $as_echo "$ac_cv_struct_st_mtim_nsec" >&6; } if test $ac_cv_struct_st_mtim_nsec != no; then cat >>confdefs.h <<_ACEOF #define ST_MTIM_NSEC $ac_cv_struct_st_mtim_nsec _ACEOF fi { $as_echo "$as_me:$LINENO: checking for __gmpz_init in -lgmp" >&5 $as_echo_n "checking for __gmpz_init in -lgmp... " >&6; } if test "${ac_cv_lib_gmp___gmpz_init+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgmp $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char __gmpz_init (); int main () { return __gmpz_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_gmp___gmpz_init=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gmp___gmpz_init=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_gmp___gmpz_init" >&5 $as_echo "$ac_cv_lib_gmp___gmpz_init" >&6; } if test "x$ac_cv_lib_gmp___gmpz_init" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBGMP 1 _ACEOF LIBS="-lgmp $LIBS" fi HAVE_VSPRINTF=0 { $as_echo "$as_me:$LINENO: checking for vsprintf" >&5 $as_echo_n "checking for vsprintf... " >&6; } if test "${ac_cv_func_vsprintf+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define vsprintf to an innocuous variant, in case declares vsprintf. For example, HP-UX 11i declares gettimeofday. */ #define vsprintf innocuous_vsprintf /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vsprintf (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef vsprintf /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char vsprintf (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_vsprintf || defined __stub___vsprintf choke me #endif int main () { return vsprintf (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_vsprintf=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_vsprintf=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_vsprintf" >&5 $as_echo "$ac_cv_func_vsprintf" >&6; } if test "x$ac_cv_func_vsprintf" = x""yes; then HAVE_VSPRINTF=1 fi if test $HAVE_VSPRINTF = 0; then { { $as_echo "$as_me:$LINENO: error: Declaration of vsprintf() not present!" >&5 $as_echo "$as_me: error: Declaration of vsprintf() not present!" >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: result: Ok! vsprintf() is declared." >&5 $as_echo "Ok! vsprintf() is declared." >&6; } fi HAVE_MEMSET=0 { $as_echo "$as_me:$LINENO: checking for memset" >&5 $as_echo_n "checking for memset... " >&6; } if test "${ac_cv_func_memset+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define memset to an innocuous variant, in case declares memset. For example, HP-UX 11i declares gettimeofday. */ #define memset innocuous_memset /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memset (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef memset /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char memset (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_memset || defined __stub___memset choke me #endif int main () { return memset (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_memset=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_memset=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_memset" >&5 $as_echo "$ac_cv_func_memset" >&6; } if test "x$ac_cv_func_memset" = x""yes; then HAVE_MEMSET=1 fi if test $HAVE_MEMSET = 0; then { { $as_echo "$as_me:$LINENO: error: Declaration of memset() not present!" >&5 $as_echo "$as_me: error: Declaration of memset() not present!" >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: result: Ok! memset() is declared." >&5 $as_echo "Ok! memset() is declared." >&6; } fi HAVE_MEMCHR=0 { $as_echo "$as_me:$LINENO: checking for memchr" >&5 $as_echo_n "checking for memchr... " >&6; } if test "${ac_cv_func_memchr+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define memchr to an innocuous variant, in case declares memchr. For example, HP-UX 11i declares gettimeofday. */ #define memchr innocuous_memchr /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memchr (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef memchr /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char memchr (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_memchr || defined __stub___memchr choke me #endif int main () { return memchr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_memchr=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_memchr=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_memchr" >&5 $as_echo "$ac_cv_func_memchr" >&6; } if test "x$ac_cv_func_memchr" = x""yes; then HAVE_MEMCHR=1 fi if test $HAVE_MEMCHR = 0; then { { $as_echo "$as_me:$LINENO: error: Declaration of memchr() not present!" >&5 $as_echo "$as_me: error: Declaration of memchr() not present!" >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: result: Ok! memchr() is declared." >&5 $as_echo "Ok! memchr() is declared." >&6; } fi HAVE_STRERROR=0 { $as_echo "$as_me:$LINENO: checking for strerror" >&5 $as_echo_n "checking for strerror... " >&6; } if test "${ac_cv_func_strerror+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strerror to an innocuous variant, in case declares strerror. For example, HP-UX 11i declares gettimeofday. */ #define strerror innocuous_strerror /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strerror (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strerror /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_strerror || defined __stub___strerror choke me #endif int main () { return strerror (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_strerror=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strerror=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_strerror" >&5 $as_echo "$ac_cv_func_strerror" >&6; } if test "x$ac_cv_func_strerror" = x""yes; then HAVE_STRERROR=1 fi if test $HAVE_STRERROR = 0; then { { $as_echo "$as_me:$LINENO: error: Declaration of strerror() not present!" >&5 $as_echo "$as_me: error: Declaration of strerror() not present!" >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: result: Ok! strerror() is declared." >&5 $as_echo "Ok! strerror() is declared." >&6; } fi HAVE_STRSPN=0 { $as_echo "$as_me:$LINENO: checking for strspn" >&5 $as_echo_n "checking for strspn... " >&6; } if test "${ac_cv_func_strspn+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strspn to an innocuous variant, in case declares strspn. For example, HP-UX 11i declares gettimeofday. */ #define strspn innocuous_strspn /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strspn (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strspn /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strspn (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_strspn || defined __stub___strspn choke me #endif int main () { return strspn (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_strspn=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strspn=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_strspn" >&5 $as_echo "$ac_cv_func_strspn" >&6; } if test "x$ac_cv_func_strspn" = x""yes; then HAVE_STRSPN=1 fi if test $HAVE_STRSPN = 0; then { { $as_echo "$as_me:$LINENO: error: Declaration of strspn() not present!" >&5 $as_echo "$as_me: error: Declaration of strspn() not present!" >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: result: Ok! strspn() is declared." >&5 $as_echo "Ok! strspn() is declared." >&6; } fi HAVE_STRCSPN=0 { $as_echo "$as_me:$LINENO: checking for strcspn" >&5 $as_echo_n "checking for strcspn... " >&6; } if test "${ac_cv_func_strcspn+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define strcspn to an innocuous variant, in case declares strcspn. For example, HP-UX 11i declares gettimeofday. */ #define strcspn innocuous_strcspn /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strcspn (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef strcspn /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strcspn (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_strcspn || defined __stub___strcspn choke me #endif int main () { return strcspn (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_strcspn=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strcspn=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_strcspn" >&5 $as_echo "$ac_cv_func_strcspn" >&6; } if test "x$ac_cv_func_strcspn" = x""yes; then HAVE_STRCSPN=1 fi if test $HAVE_STRCSPN = 0; then { { $as_echo "$as_me:$LINENO: error: Declaration of strcspn() not present!" >&5 $as_echo "$as_me: error: Declaration of strcspn() not present!" >&2;} { (exit 1); exit 1; }; } else { $as_echo "$as_me:$LINENO: result: Ok! strcspn() is declared." >&5 $as_echo "Ok! strcspn() is declared." >&6; } fi { $as_echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 $as_echo_n "checking whether strerror_r is declared... " >&6; } if test "${ac_cv_have_decl_strerror_r+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef strerror_r (void) strerror_r; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_strerror_r=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_strerror_r=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 $as_echo "$ac_cv_have_decl_strerror_r" >&6; } if test "x$ac_cv_have_decl_strerror_r" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R 0 _ACEOF fi for ac_func in strerror_r do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if test "${ac_cv_func_strerror_r_char_p+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_func_strerror_r_char_p=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strerror_r_char_p=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then cat >>confdefs.h <<\_ACEOF #define STRERROR_R_CHAR_P 1 _ACEOF fi for ac_header in vfork.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to ## ## ----------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in fork vfork do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:$LINENO: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if test "${ac_cv_func_fork_works+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_fork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_fork_works=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_fork_works=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:$LINENO: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if test "${ac_cv_func_vfork_works+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then ac_cv_func_vfork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_vfork_works=yes else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_vfork_works=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_VFORK 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define vfork fork _ACEOF fi if test "x$ac_cv_func_fork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_FORK 1 _ACEOF fi for ac_func in localeconv gettimeofday isascii setlocale strchr strftime waitpid do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # setmode DOS ? for ac_header in fcntl.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to ## ## ----------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for DOS-style setmode" >&5 $as_echo_n "checking for DOS-style setmode... " >&6; } if test "${ac_cv_func_setmode_dos+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if HAVE_FCNTL_H # include #endif #if HAVE_UNISTD_H # include #endif int main () { int ret = setmode && setmode (1, O_BINARY); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_setmode_dos=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_setmode_dos=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_setmode_dos" >&5 $as_echo "$ac_cv_func_setmode_dos" >&6; } if test $ac_cv_func_setmode_dos = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SETMODE_DOS 1 _ACEOF fi # Check for clock_gettime and its library. Solaris puts it in -lrt or # -lposix4, but we don't want to link that library unless we have to. diff_saved_libs=$LIBS { $as_echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if test "${ac_cv_search_clock_gettime+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF for ac_lib in '' rt posix4; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_search_clock_gettime=$ac_res else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_clock_gettime+set}" = set; then break fi done if test "${ac_cv_search_clock_gettime+set}" = set; then : else ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5 $as_echo "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi case $ac_cv_search_clock_gettime in no | 'none required') LIB_CLOCK_GETTIME=;; *) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;; esac for ac_func in clock_gettime do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS=$diff_saved_libs cat >>confdefs.h <<\_ACEOF #define USE_UNLOCKED_IO 1 _ACEOF { $as_echo "$as_me:$LINENO: checking whether clearerr_unlocked is declared" >&5 $as_echo_n "checking whether clearerr_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_clearerr_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef clearerr_unlocked (void) clearerr_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_clearerr_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_clearerr_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_clearerr_unlocked" >&5 $as_echo "$ac_cv_have_decl_clearerr_unlocked" >&6; } if test "x$ac_cv_have_decl_clearerr_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_CLEARERR_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_CLEARERR_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 $as_echo_n "checking whether feof_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef feof_unlocked (void) feof_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_feof_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_feof_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 $as_echo "$ac_cv_have_decl_feof_unlocked" >&6; } if test "x$ac_cv_have_decl_feof_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FEOF_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FEOF_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether ferror_unlocked is declared" >&5 $as_echo_n "checking whether ferror_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_ferror_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef ferror_unlocked (void) ferror_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_ferror_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_ferror_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_ferror_unlocked" >&5 $as_echo "$ac_cv_have_decl_ferror_unlocked" >&6; } if test "x$ac_cv_have_decl_ferror_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FERROR_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FERROR_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether fflush_unlocked is declared" >&5 $as_echo_n "checking whether fflush_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_fflush_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef fflush_unlocked (void) fflush_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_fflush_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_fflush_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fflush_unlocked" >&5 $as_echo "$ac_cv_have_decl_fflush_unlocked" >&6; } if test "x$ac_cv_have_decl_fflush_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FFLUSH_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FFLUSH_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 $as_echo_n "checking whether fgets_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_fgets_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef fgets_unlocked (void) fgets_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_fgets_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_fgets_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 $as_echo "$ac_cv_have_decl_fgets_unlocked" >&6; } if test "x$ac_cv_have_decl_fgets_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FGETS_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FGETS_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether fputc_unlocked is declared" >&5 $as_echo_n "checking whether fputc_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_fputc_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef fputc_unlocked (void) fputc_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_fputc_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_fputc_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputc_unlocked" >&5 $as_echo "$ac_cv_have_decl_fputc_unlocked" >&6; } if test "x$ac_cv_have_decl_fputc_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FPUTC_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FPUTC_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether fputs_unlocked is declared" >&5 $as_echo_n "checking whether fputs_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_fputs_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef fputs_unlocked (void) fputs_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_fputs_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_fputs_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fputs_unlocked" >&5 $as_echo "$ac_cv_have_decl_fputs_unlocked" >&6; } if test "x$ac_cv_have_decl_fputs_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FPUTS_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FPUTS_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether fread_unlocked is declared" >&5 $as_echo_n "checking whether fread_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_fread_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef fread_unlocked (void) fread_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_fread_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_fread_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fread_unlocked" >&5 $as_echo "$ac_cv_have_decl_fread_unlocked" >&6; } if test "x$ac_cv_have_decl_fread_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FREAD_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FREAD_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether fwrite_unlocked is declared" >&5 $as_echo_n "checking whether fwrite_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_fwrite_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef fwrite_unlocked (void) fwrite_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_fwrite_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_fwrite_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_fwrite_unlocked" >&5 $as_echo "$ac_cv_have_decl_fwrite_unlocked" >&6; } if test "x$ac_cv_have_decl_fwrite_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FWRITE_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FWRITE_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 $as_echo_n "checking whether getc_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef getc_unlocked (void) getc_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_getc_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_getc_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 $as_echo "$ac_cv_have_decl_getc_unlocked" >&6; } if test "x$ac_cv_have_decl_getc_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETC_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETC_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether getchar_unlocked is declared" >&5 $as_echo_n "checking whether getchar_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_getchar_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef getchar_unlocked (void) getchar_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_getchar_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_getchar_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getchar_unlocked" >&5 $as_echo "$ac_cv_have_decl_getchar_unlocked" >&6; } if test "x$ac_cv_have_decl_getchar_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETCHAR_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETCHAR_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether putc_unlocked is declared" >&5 $as_echo_n "checking whether putc_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_putc_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef putc_unlocked (void) putc_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_putc_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_putc_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_putc_unlocked" >&5 $as_echo "$ac_cv_have_decl_putc_unlocked" >&6; } if test "x$ac_cv_have_decl_putc_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_PUTC_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_PUTC_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether putchar_unlocked is declared" >&5 $as_echo_n "checking whether putchar_unlocked is declared... " >&6; } if test "${ac_cv_have_decl_putchar_unlocked+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef putchar_unlocked (void) putchar_unlocked; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_putchar_unlocked=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_putchar_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_putchar_unlocked" >&5 $as_echo "$ac_cv_have_decl_putchar_unlocked" >&6; } if test "x$ac_cv_have_decl_putchar_unlocked" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_PUTCHAR_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_PUTCHAR_UNLOCKED 0 _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether strerror is declared" >&5 $as_echo_n "checking whether strerror is declared... " >&6; } if test "${ac_cv_have_decl_strerror+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { #ifndef strerror (void) strerror; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_strerror=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_strerror=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror" >&5 $as_echo "$ac_cv_have_decl_strerror" >&6; } if test "x$ac_cv_have_decl_strerror" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR 0 _ACEOF fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; else enable_debug=no fi # Check whether --enable-optimization was given. if test "${enable_optimization+set}" = set; then enableval=$enable_optimization; else enable_optimization=no fi # Check whether --enable-nls was given. if test "${enable_nls+set}" = set; then enableval=$enable_nls; else enable_nls=yes fi # Check whether --enable-gmp was given. if test "${enable_gmp+set}" = set; then enableval=$enable_gmp; else enable_gmp=yes fi if test "x$enable_gmp" = "xno"; then CPPFLAGS="$CPPFLAGS -DDISABLE_GMP " fi if test "x$enable_nls" = "xyes"; then CPPFLAGS="$CPPFLAGS -DENABLE_NLS " fi if test "x$enable_debug" = "xyes"; then CFLAGS="$CFLAGS $DBGFLAGS " fi if test "x$enable_optimization" = "xyes"; then CFLAGS="$CFLAGS $OPTFLAGS " fi { $as_echo "$as_me:$LINENO: result: Configuration terminated with success:" >&5 $as_echo "Configuration terminated with success:" >&6; } { $as_echo "$as_me:$LINENO: result: Preprocessor flags = \"$CPPFLAGS\"" >&5 $as_echo "Preprocessor flags = \"$CPPFLAGS\"" >&6; } { $as_echo "$as_me:$LINENO: result: Compiler flags = \"$CFLAGS\"" >&5 $as_echo "Compiler flags = \"$CFLAGS\"" >&6; } { $as_echo "$as_me:$LINENO: result: Linker flags = \"$LDFLAGS\"" >&5 $as_echo "Linker flags = \"$LDFLAGS\"" >&6; } { $as_echo "$as_me:$LINENO: result: Libraries = \"$LIBS\"" >&5 $as_echo "Libraries = \"$LIBS\"" >&6; } { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Numdiff $as_me 5.2, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ Numdiff config.status 5.2 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } fi ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cmtk-3.0.0/Utilities/numdiff-5.2.1/xmalloc.c0000644000177700000170000000646211666247630017401 0ustar torstenman/* xmalloc.c -- malloc with out of memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, 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 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #if ! HAVE_INLINE # define static_inline #endif #include "xalloc.h" #undef static_inline #include #include #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif /* 1 if calloc is known to be compatible with GNU calloc. This matters if we are not also using the calloc module, which defines HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ #if defined HAVE_CALLOC || defined __GLIBC__ enum { HAVE_GNU_CALLOC = 1 }; #else enum { HAVE_GNU_CALLOC = 0 }; #endif /* Allocate N bytes of memory dynamically, with error checking. */ void * xmalloc (size_t n) { void *p = malloc (n); if (!p && n != 0) xalloc_die (); return p; } /* Change the size of an allocated block of memory P to N bytes, with error checking. */ void * xrealloc (void *p, size_t n) { p = realloc (p, n); if (!p && n != 0) xalloc_die (); return p; } /* If P is null, allocate a block of at least *PN bytes; otherwise, reallocate P so that it contains more than *PN bytes. *PN must be nonzero unless P is null. Set *PN to the new block's size, and return the pointer to the new block. *PN is never set to zero, and the returned pointer is never null. */ void * x2realloc (void *p, size_t *pn) { return x2nrealloc (p, pn, 1); } /* Allocate S bytes of zeroed memory dynamically, with error checking. There's no need for xnzalloc (N, S), since it would be equivalent to xcalloc (N, S). */ void * xzalloc (size_t s) { return memset (xmalloc (s), 0, s); } /* Allocate zeroed memory for N elements of S bytes, with error checking. S must be nonzero. */ void * xcalloc (size_t n, size_t s) { void *p; /* Test for overflow, since some calloc implementations don't have proper overflow checks. But omit overflow and size-zero tests if HAVE_GNU_CALLOC, since GNU calloc catches overflow and never returns NULL if successful. */ if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) xalloc_die (); return p; } /* Clone an object P of size S, with error checking. There's no need for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any need for an arithmetic overflow check. */ void * xmemdup (void const *p, size_t s) { return memcpy (xmalloc (s), p, s); } /* Clone STRING. */ char * xstrdup (char const *string) { return xmemdup (string, strlen (string) + 1); } cmtk-3.0.0/Utilities/numdiff-5.2.1/m4/0000755000177700000170000000000012263615445016103 5ustar torstenmancmtk-3.0.0/Utilities/numdiff-5.2.1/m4/st_mtim.m40000644000177700000170000000341711666247630020031 0ustar torstenman# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 5 dnl From Paul Eggert. # Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim, # if it exists. AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC], [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim], ac_cv_struct_st_mtim_nsec, [ac_save_CPPFLAGS="$CPPFLAGS" ac_cv_struct_st_mtim_nsec=no # tv_nsec -- the usual case # _tv_nsec -- Solaris 2.6, if # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1 # && !defined __EXTENSIONS__) # st__tim.tv_nsec -- UnixWare 2.1.2 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val" AC_TRY_COMPILE([#include #include ], [struct stat s; s.st_mtim.ST_MTIM_NSEC;], [ac_cv_struct_st_mtim_nsec=$ac_val; break]) done CPPFLAGS="$ac_save_CPPFLAGS"]) if test $ac_cv_struct_st_mtim_nsec != no; then AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec, [Define to be the nanoseconds member of struct stat's st_mtim, if it exists.]) fi ] ) cmtk-3.0.0/Utilities/numdiff-5.2.1/m4/setmode.m40000644000177700000170000000246611666247630020020 0ustar torstenman# Check for setmode, DOS style. # Copyright (C) 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AC_FUNC_SETMODE_DOS], [AC_CHECK_HEADERS(fcntl.h unistd.h) AC_CACHE_CHECK([for DOS-style setmode], [ac_cv_func_setmode_dos], [AC_TRY_LINK( [#include #if HAVE_FCNTL_H # include #endif #if HAVE_UNISTD_H # include #endif], [int ret = setmode && setmode (1, O_BINARY);], [ac_cv_func_setmode_dos=yes], [ac_cv_func_setmode_dos=no])]) if test $ac_cv_func_setmode_dos = yes; then AC_DEFINE(HAVE_SETMODE_DOS, 1, [Define to 1 if you have the DOS-style `setmode' function.]) fi]) cmtk-3.0.0/Utilities/numdiff-5.2.1/CMake/0000755000177700000170000000000012263615445016543 5ustar torstenmancmtk-3.0.0/Utilities/numdiff-5.2.1/CMake/CheckTypeExists.cmake0000644000177700000170000000232711667175021022626 0ustar torstenman# - Check if the system has the specified type # CHECK_TYPE_EXISTS (TYPE HEADER VARIABLE) # # TYPE - the name of the type or struct or class you are interested in # HEADER - the header(s) where the prototype should be declared # VARIABLE - variable to store the result # # The following variables may be set before calling this macro to # modify the way the check is run: # # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # Copyright (c) 2009, Michihiro NAKAJIMA # Copyright (c) 2006, Alexander Neundorf, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. INCLUDE(CheckCSourceCompiles) MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT) SET(_INCLUDE_FILES) FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) SET(_CHECK_TYPE_EXISTS_SOURCE_CODE " ${_INCLUDE_FILES} int main() { static ${_TYPE} tmp; if (sizeof(tmp)) return 0; return 0; } ") CHECK_C_SOURCE_COMPILES("${_CHECK_TYPE_EXISTS_SOURCE_CODE}" ${_RESULT}) ENDMACRO (CHECK_TYPE_EXISTS) cmtk-3.0.0/Utilities/numdiff-5.2.1/CMake/COPYING-CMAKE-SCRIPTS0000644000177700000170000000245711667175021021547 0ustar torstenmanRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cmtk-3.0.0/Utilities/numdiff-5.2.1/CMake/CheckStructMember.cmake0000644000177700000170000000244611667175021023123 0ustar torstenman# - Check if the given struct or class has the specified member variable # CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE) # # STRUCT - the name of the struct or class you are interested in # MEMBER - the member which existence you want to check # HEADER - the header(s) where the prototype should be declared # VARIABLE - variable to store the result # # The following variables may be set before calling this macro to # modify the way the check is run: # # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # Copyright (c) 2006, Alexander Neundorf, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. INCLUDE(CheckCSourceCompiles) MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT) SET(_INCLUDE_FILES) FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE " ${_INCLUDE_FILES} int main() { static ${_STRUCT} tmp; if (sizeof(tmp.${_MEMBER})) return 0; return 0; } ") CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) ENDMACRO (CHECK_STRUCT_MEMBER) cmtk-3.0.0/Utilities/numdiff-5.2.1/CMake/FindLibintlGettext.cmake0000644000177700000170000000616711730240447023314 0ustar torstenman## ## Copyright 2012 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 4033 $ ## ## $LastChangedDate: 2012-03-14 18:08:55 -0700 (Wed, 14 Mar 2012) $ ## ## $LastChangedBy: torsten_at_home $ ## ## ## ## THIS IS BASED ON THE KDE "FindGettext.cmake" FILE ## ## # Try to find Gettext functionality # Once done this will define # # GETTEXT_FOUND - system has Gettext # GETTEXT_INCLUDE_DIR - Gettext include directory # GETTEXT_LIBRARIES - Libraries needed to use Gettext # TODO: This will enable translations only if Gettext functionality is # present in libc. Must have more robust system for release, where Gettext # functionality can also reside in standalone Gettext library, or the one # embedded within kdelibs (cf. gettext.m4 from Gettext source). # # Copyright (c) 2006, Chusslove Illich, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (LIBC_HAS_GETTEXT OR LIBINTL_HAS_GETTEXT) # in cache already set(GETTEXT_FOUND TRUE) else (LIBC_HAS_GETTEXT OR LIBINTL_HAS_GETTEXT) include(CheckLibraryExists) include(CheckFunctionExists) CHECK_INCLUDE_FILES(libintl.h HAVE_LIBINTL_H) set(GETTEXT_LIBRARIES) if (HAVE_LIBINTL_H) check_function_exists(_libintl_gettext LIBC_HAS_GETTEXT) if (LIBC_HAS_GETTEXT) set(GETTEXT_SOURCE "built in libc") set(GETTEXT_LIBRARIES "") set(GETTEXT_FOUND TRUE) else (LIBC_HAS_GETTEXT) find_library(LIBINTL_LIBRARY NAMES intl libintl ) if(LIBINTL_LIBARY) check_library_exists(${LIBINTL_LIBRARY} "_libintl_gettext" "" LIBINTL_HAS_GETTEXT) if (LIBINTL_HAS_GETTEXT) set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) set(GETTEXT_FOUND TRUE) endif (LIBINTL_HAS_GETTEXT) endif(LIBINTL_LIBARY) endif (LIBC_HAS_GETTEXT) endif (HAVE_LIBINTL_H) if (GETTEXT_FOUND) if (NOT Gettext_FIND_QUIETLY) message(STATUS "Found Gettext: ${GETTEXT_SOURCE}") endif (NOT Gettext_FIND_QUIETLY) else (GETTEXT_FOUND) if (Gettext_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find Gettext") endif (Gettext_FIND_REQUIRED) endif (GETTEXT_FOUND) mark_as_advanced(GETTEXT_INCLUDE_DIR GETTEXT_LIBRARIES) endif (LIBC_HAS_GETTEXT OR LIBINTL_HAS_GETTEXT) cmtk-3.0.0/Utilities/sqlite3/0000755000177700000170000000000012263615445015056 5ustar torstenmancmtk-3.0.0/Utilities/sqlite3/install-sh0000755000177700000170000002202111340335155017047 0ustar torstenman#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: cmtk-3.0.0/Utilities/sqlite3/CMakeLists.txt0000644000177700000170000000416011517604372017615 0ustar torstenman## ## Copyright 2010 Torsten Rohlfing ## ## Copyright 2010-2011 SRI International ## ## This file is part of the Computational Morphometry Toolkit. ## ## http://www.nitrc.org/projects/cmtk/ ## ## The Computational Morphometry Toolkit is free software: you can ## redistribute it and/or modify it under the terms of the GNU General Public ## License as published by the Free Software Foundation, either version 3 of ## the License, or (at your option) any later version. ## ## The Computational Morphometry Toolkit 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 General Public License along ## with the Computational Morphometry Toolkit. If not, see ## . ## ## $Revision: 199 $ ## ## $LastChangedDate: 2009-07-13 16:38:02 -0700 (Mon, 13 Jul 2009) $ ## ## $LastChangedBy: torstenrohlfing $ ## PROJECT(sqlite3) INCLUDE_REGULAR_EXPRESSION("^.*.h$") SET(SQLITE_VERSION_MAJOR 3) SET(SQLITE_VERSION_MINOR 7) SET(SQLITE_VERSION_PATCH 4) SET(SQLITE_VERSION "sqlite-3.7.4") SET(sqlite_SRCS sqlite3.c) ADD_DEFINITIONS(-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE) ADD_LIBRARY(cmtksqlite3 ${sqlite_SRCS}) TARGET_LINK_LIBRARIES(cmtksqlite3) INSTALL(TARGETS cmtksqlite3 RUNTIME DESTINATION ${CMTK_INSTALL_BIN_DIR} COMPONENT runtime LIBRARY DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT runtime ARCHIVE DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT libraries) FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") INSTALL(FILES ${files} DESTINATION ${CMTK_INSTALL_INCLUDE_DIR} COMPONENT headers) ADD_EXECUTABLE(sqlite shell.c) TARGET_LINK_LIBRARIES(sqlite cmtksqlite3) INSTALL(TARGETS sqlite RUNTIME DESTINATION ${CMTK_INSTALL_BIN_DIR} COMPONENT runtime LIBRARY DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT runtime ARCHIVE DESTINATION ${CMTK_INSTALL_LIB_DIR} COMPONENT libraries) SET(SQLITE_LIBRARIES cmtksqlite3) cmtk-3.0.0/Utilities/sqlite3/aclocal.m40000644000177700000170000077507211340335155016730 0ustar torstenman# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # serial 48 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) # ----------------------------------------------------------- # If this macro is not defined by Autoconf, define it here. m4_ifdef([AC_PROVIDE_IFELSE], [], [m4_define([AC_PROVIDE_IFELSE], [m4_ifdef([AC_PROVIDE_$1], [$2], [$3])])]) # AC_PROG_LIBTOOL # --------------- AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([_AC_PROG_LIBTOOL])dnl dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. AC_PROVIDE_IFELSE([AC_PROG_CXX], [AC_LIBTOOL_CXX], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX ])]) dnl And a similar setup for Fortran 77 support AC_PROVIDE_IFELSE([AC_PROG_F77], [AC_LIBTOOL_F77], [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 ])]) dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [AC_LIBTOOL_GCJ], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], [AC_LIBTOOL_GCJ], [ifdef([AC_PROG_GCJ], [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([A][M_PROG_GCJ], [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) ifdef([LT_AC_PROG_GCJ], [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) ])])# AC_PROG_LIBTOOL # _AC_PROG_LIBTOOL # ---------------- AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) ])# _AC_PROG_LIBTOOL # AC_LIBTOOL_SETUP # ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], [AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl AC_LIBTOOL_SYS_MAX_CMD_LEN AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE AC_LIBTOOL_OBJDIR AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. [double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Constants: rm="rm -f" # Global variables: default_ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" ofile="$default_ofile" with_gnu_ld="$lt_cv_prog_gnu_ld" AC_CHECK_TOOL(AR, ar, false) AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(STRIP, strip, :) old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then AC_PATH_MAGIC fi ;; esac AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes AC_ARG_WITH([pic], [AC_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=default # Use C for the default configuration in the libtool script tagname= AC_LIBTOOL_LANG_C_CONFIG _LT_AC_TAGCONFIG ])# AC_LIBTOOL_SETUP # _LT_AC_SYS_COMPILER # ------------------- AC_DEFUN([_LT_AC_SYS_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_AC_SYS_COMPILER # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. AC_DEFUN([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. AC_DEFUN([_LT_COMPILER_BOILERPLATE], [ac_outfile=conftest.$ac_objext printf "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. AC_DEFUN([_LT_LINKER_BOILERPLATE], [ac_outfile=conftest.$ac_objext printf "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ])# _LT_LINKER_BOILERPLATE # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], [AC_LINK_IFELSE(AC_LANG_PROGRAM,[ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'`; fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_AC_SYS_LIBPATH_AIX # _LT_AC_SHELL_INIT(ARG) # ---------------------- AC_DEFUN([_LT_AC_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_AC_SHELL_INIT # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], [_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac echo=${ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string=`eval $cmd`) 2>/dev/null && echo_test_string=`eval $cmd` && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null then break fi done fi if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. echo='printf %s\n' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then echo="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. ECHO=$echo if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(ECHO) ])])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_LOCK # ----------- AC_DEFUN([_LT_AC_LOCK], [AC_ARG_ENABLE([libtool-lock], [AC_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac need_locks="$enable_libtool_lock" ])# _LT_AC_LOCK # AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [AC_REQUIRE([LT_AC_PROG_SED]) AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $rm conftest* ]) if test x"[$]$2" = xyes; then ifelse([$5], , :, [$5]) else ifelse([$6], , :, [$6]) fi ])# AC_LIBTOOL_COMPILER_OPTION # AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ------------------------------------------------------------ # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then ifelse([$4], , :, [$4]) else ifelse([$5], , :, [$5]) fi ])# AC_LIBTOOL_LINKER_OPTION # AC_LIBTOOL_SYS_MAX_CMD_LEN # -------------------------- AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [# find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi ])# AC_LIBTOOL_SYS_MAX_CMD_LEN # _LT_AC_CHECK_DLFCN # ------------------ AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl ])# _LT_AC_CHECK_DLFCN # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # --------------------------------------------------------------------- AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif #ifdef __cplusplus extern "C" void exit (int); #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); exit (status); }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_AC_TRY_DLOPEN_SELF # AC_LIBTOOL_DLOPEN_SELF # ---------------------- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_AC_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi ])# AC_LIBTOOL_DLOPEN_SELF # AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) # --------------------------------- # Check to see if options -c and -o are simultaneously supported by compiler AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $rm -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* ]) ])# AC_LIBTOOL_PROG_CC_C_O # AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) # ----------------------------------------- # Check to see if we can do hard links to lock some files if needed AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_REQUIRE([_LT_AC_LOCK])dnl hard_links="nottested" if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi ])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS # AC_LIBTOOL_OBJDIR # ----------------- AC_DEFUN([AC_LIBTOOL_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir ])# AC_LIBTOOL_OBJDIR # AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) # ---------------------------------------------- # Check hardcoding attributes. AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi ])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH # AC_LIBTOOL_SYS_LIB_STRIP # ------------------------ AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], [striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi ])# AC_LIBTOOL_SYS_LIB_STRIP # AC_LIBTOOL_SYS_DYNAMIC_LINKER # ----------------------------- # PORTME Fill in your ld.so characteristics AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` else sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; kfreebsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix3*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; knetbsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='GNU ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; nto-qnx*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no export_dynamic_flag_spec='${wl}-Blargedynsym' runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER # _LT_AC_TAGCONFIG # ---------------- AC_DEFUN([_LT_AC_TAGCONFIG], [AC_ARG_WITH([tags], [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], [include additional configurations @<:@automatic@:>@])], [tagnames="$withval"]) if test -f "$ltmain" && test -n "$tagnames"; then if test ! -f "${ofile}"; then AC_MSG_WARN([output file `$ofile' does not exist]) fi if test -z "$LTCC"; then eval "`$SHELL ${ofile} --config | grep '^LTCC='`" if test -z "$LTCC"; then AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) else AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) fi fi if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" fi # Extract list of available tagged configurations in $ofile. # Note that this assumes the entire list is on one line. available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for tagname in $tagnames; do IFS="$lt_save_ifs" # Check whether tagname contains only valid characters case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in "") ;; *) AC_MSG_ERROR([invalid tag name: $tagname]) ;; esac if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null then AC_MSG_ERROR([tag name \"$tagname\" already exists]) fi # Update the list of available tags. if test -n "$tagname"; then echo appending configuration tag \"$tagname\" to $ofile case $tagname in CXX) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_LIBTOOL_LANG_CXX_CONFIG else tagname="" fi ;; F77) if test -n "$F77" && test "X$F77" != "Xno"; then AC_LIBTOOL_LANG_F77_CONFIG else tagname="" fi ;; GCJ) if test -n "$GCJ" && test "X$GCJ" != "Xno"; then AC_LIBTOOL_LANG_GCJ_CONFIG else tagname="" fi ;; RC) AC_LIBTOOL_LANG_RC_CONFIG ;; *) AC_MSG_ERROR([Unsupported tag name: $tagname]) ;; esac # Append the new tag name to the list of available tags. if test -n "$tagname" ; then available_tags="$available_tags $tagname" fi fi done IFS="$lt_save_ifs" # Now substitute the updated list of available tags. if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then mv "${ofile}T" "$ofile" chmod +x "$ofile" else rm -f "${ofile}T" AC_MSG_ERROR([unable to update list of available tagged configurations.]) fi fi ])# _LT_AC_TAGCONFIG # AC_LIBTOOL_DLOPEN # ----------------- # enable checks for dlopen support AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_DLOPEN # AC_LIBTOOL_WIN32_DLL # -------------------- # declare package support for building win32 DLLs AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_WIN32_DLL # AC_ENABLE_SHARED([DEFAULT]) # --------------------------- # implement the --enable-shared flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]AC_ENABLE_SHARED_DEFAULT) ])# AC_ENABLE_SHARED # AC_DISABLE_SHARED # ----------------- # set the default shared flag to --disable-shared AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no) ])# AC_DISABLE_SHARED # AC_ENABLE_STATIC([DEFAULT]) # --------------------------- # implement the --enable-static flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]AC_ENABLE_STATIC_DEFAULT) ])# AC_ENABLE_STATIC # AC_DISABLE_STATIC # ----------------- # set the default static flag to --disable-static AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no) ])# AC_DISABLE_STATIC # AC_ENABLE_FAST_INSTALL([DEFAULT]) # --------------------------------- # implement the --enable-fast-install flag # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) ])# AC_ENABLE_FAST_INSTALL # AC_DISABLE_FAST_INSTALL # ----------------------- # set the default to --disable-fast-install AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no) ])# AC_DISABLE_FAST_INSTALL # AC_LIBTOOL_PICMODE([MODE]) # -------------------------- # implement the --with-pic flag # MODE is either `yes' or `no'. If omitted, it defaults to `both'. AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl pic_mode=ifelse($#,1,$1,default) ])# AC_LIBTOOL_PICMODE # AC_PROG_EGREP # ------------- # This is predefined starting with Autoconf 2.54, so this conditional # definition can be removed once we require Autoconf 2.54 or later. m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi]) EGREP=$ac_cv_prog_egrep AC_SUBST([EGREP]) ])]) # AC_PATH_TOOL_PREFIX # ------------------- # find a file program which can recognise shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="ifelse([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi ])# AC_PATH_TOOL_PREFIX # AC_PATH_MAGIC # ------------- # find a file program which can recognise a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# AC_PATH_MAGIC # AC_PROG_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], [AC_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no]) AC_REQUIRE([LT_AC_PROG_SED])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; nto-qnx*) lt_cv_deplibs_check_method=unknown ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown ])# AC_DEPLIBS_CHECK_METHOD # AC_PROG_NM # ---------- # find the pathname to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" ])# AC_PROG_NM # AC_CHECK_LIBM # ------------- # check for math library AC_DEFUN([AC_CHECK_LIBM], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac ])# AC_CHECK_LIBM # AC_LIBLTDL_CONVENIENCE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, # it is assumed to be `libltdl'. LIBLTDL will be prefixed with # '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' # (note the single quotes!). If your package is not flat and you're not # using automake, define top_builddir and top_srcdir appropriately in # the Makefiles. AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_CONVENIENCE # AC_LIBLTDL_INSTALLABLE([DIRECTORY]) # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl installable library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, # and an installed libltdl is not found, it is assumed to be `libltdl'. # LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with # '${top_srcdir}/' (note the single quotes!). If your package is not # flat and you're not using automake, define top_builddir and top_srcdir # appropriately in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, lt_dlinit, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLINCL= fi # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" ])# AC_LIBLTDL_INSTALLABLE # AC_LIBTOOL_CXX # -------------- # enable support for C++ libraries AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_LT_AC_LANG_CXX]) ])# AC_LIBTOOL_CXX # _LT_AC_LANG_CXX # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX # _LT_AC_PROG_CXXCPP # ------------------ AC_DEFUN([_LT_AC_PROG_CXXCPP], [ AC_REQUIRE([AC_PROG_CXX]) if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP fi ])# _LT_AC_PROG_CXXCPP # AC_LIBTOOL_F77 # -------------- # enable support for Fortran 77 libraries AC_DEFUN([AC_LIBTOOL_F77], [AC_REQUIRE([_LT_AC_LANG_F77]) ])# AC_LIBTOOL_F77 # _LT_AC_LANG_F77 # --------------- AC_DEFUN([_LT_AC_LANG_F77], [AC_REQUIRE([AC_PROG_F77]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) ])# _LT_AC_LANG_F77 # AC_LIBTOOL_GCJ # -------------- # enable support for GCJ libraries AC_DEFUN([AC_LIBTOOL_GCJ], [AC_REQUIRE([_LT_AC_LANG_GCJ]) ])# AC_LIBTOOL_GCJ # _LT_AC_LANG_GCJ # --------------- AC_DEFUN([_LT_AC_LANG_GCJ], [AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) ])# _LT_AC_LANG_GCJ # AC_LIBTOOL_RC # ------------- # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) ])# AC_LIBTOOL_RC # AC_LIBTOOL_LANG_C_CONFIG # ------------------------ # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) AC_DEFUN([_LT_AC_LANG_C_CONFIG], [lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP AC_LIBTOOL_DLOPEN_SELF # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC="$lt_save_CC" ])# AC_LIBTOOL_LANG_C_CONFIG # AC_LIBTOOL_LANG_CXX_CONFIG # -------------------------- # Ensure that the configuration vars for the C compiler are # suitably defined. Those variables are subsequently used by # AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_AC_TAGVAR(no_undefined_flag, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Dependencies to place before and after the object being linked: _LT_AC_TAGVAR(predep_objects, $1)= _LT_AC_TAGVAR(postdep_objects, $1)= _LT_AC_TAGVAR(predeps, $1)= _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration AC_PROG_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_AC_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=yes else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes ; then lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then lt_int_apple_cc_single_mod=yes fi if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before switch to ELF _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' ;; *) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix3*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi fi _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; linux*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC*) # Portland Group C++ compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; openbsd2*) # C++ shared libraries are fairly broken _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' else # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system # linker. We must also pass each convience library through # to the system linker between allextract/defaultextract. # The C++ compiler will combine linker options so we # cannot just pass the convience library names through # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | grep -v '^2\.7' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_AC_TAGVAR(GCC, $1)="$GXX" _LT_AC_TAGVAR(LD, $1)="$LD" AC_LIBTOOL_POSTDEP_PREDEP($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_CONFIG($1) AC_LANG_POP CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ldcxx=$with_gnu_ld with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld ])# AC_LIBTOOL_LANG_CXX_CONFIG # AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) # ------------------------------------ # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" ifelse([$1], [], [#! $SHELL # `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 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 General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= # ### BEGIN LIBTOOL CONFIG], [# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) # Whether or not to disallow shared libs when runtime libs are static allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A C compiler. LTCC=$lt_LTCC # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # A language-specific compiler. CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? with_gcc=$_LT_AC_TAGVAR(GCC, $1) # An ERE matcher. EGREP=$lt_EGREP # The linker used to build libraries. LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S # A BSD-compatible nm program. NM=$lt_NM # A symbol stripping program STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" # Shared library suffix (normally ".so"). shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode # What is the maximum length of a command? max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds # Commands used to build a loadable module (assumed same as above if empty) module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) # Dependencies to place after the objects being linked to create a # shared library. postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) # Dependencies to place before the objects being linked to create a # shared library. predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) # Dependencies to place after the objects being linked to create a # shared library. postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) # If ld is used when linking, flag to hardcode \$libdir into # a binary during linking. This must work even if \$libdir does # not exist. hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) # Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) ifelse([$1],[], [# ### END LIBTOOL CONFIG], [# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ ifelse([$1],[], [ case $host_os in aix3*) cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || \ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ]) else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` if test -f "$ltmain_in"; then test -f Makefile && make "$ltmain" fi fi ])# AC_LIBTOOL_CONFIG # AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi ])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # --------------------------------- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_OBJEXT]) # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32*) symcode='[[ABCDGISTW]]' ;; hpux*) # Its linker distinguishes data from code symbols if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; linux*) if test "$host_cpu" = ia64; then symcode='[[ABCDGIRSTW]]' lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if grep ' nm_test_var$' "$nlist" >/dev/null; then if grep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[[]] = { EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -f conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi ]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) # --------------------------------------- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], [_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) ifelse([$1],[CXX],[ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; icpc* | ecpc*) # Intel C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; vxworks*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; newsos6) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; linux*) case $cc_basename in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; esac ;; osf3* | osf4* | osf5*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ;; esac # # Check to make sure the static flag actually works. # wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) ]) # AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) # ------------------------------------ # See if the linker supports building shared libraries. AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix4* | aix5*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ],[ runpath_var= _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)= _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_minus_L, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_AC_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_AC_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>/dev/null` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can't use # them. _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; interix3*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=yes _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_AC_TAGVAR(archive_cmds, $1)='' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=yes else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_AC_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # see comment about different semantics on the GNU ld section _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; bsdi[[45]]*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) case $host_os in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' ;; esac fi ;; esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ;; dgux*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu | dragonfly*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; openbsd*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi ;; os2*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine linker options so we # cannot just pass the convience library names through # without $wl, iff we do not link with $LD. # Luckily, gcc supports the same syntax we need for Sun Studio. # Supported since Solaris 2.6 (maybe 2.5.1?) case $wlarc in '') _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; *) _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_AC_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_AC_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; esac fi ]) AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no # # Do we need to explicitly link libc? # case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_AC_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) _LT_AC_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $rm conftest* AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac ])# AC_LIBTOOL_PROG_LD_SHLIBS # _LT_AC_FILE_LTDLL_C # ------------------- # Be careful that the start marker always follows a newline. AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifndef __CYGWIN__ # # ifdef __CYGWIN32__ # # define __CYGWIN__ __CYGWIN32__ # # endif # #endif # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #ifdef __CYGWIN__ # #include # DECLARE_CYGWIN_DLL( DllMain ); # #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ ])# _LT_AC_FILE_LTDLL_C # _LT_AC_TAGVAR(VARNAME, [TAGNAME]) # --------------------------------- AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS) ]) AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) ]) # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # # LT_AC_PROG_SED # -------------- # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. AC_DEFUN([LT_AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR cmtk-3.0.0/Utilities/sqlite3/cmtk_sqlite3_mangle.h0000644000177700000170000002357111517604372021162 0ustar torstenman#ifndef cmtk_sqlite_mangle_h #define cmtk_sqlite_mangle_h /* This header file mangles all symbols exported from the sqlite library. It is included in all files while building the sqlite library. Due to namespace pollution, no sqlite headers should be included in .h files in VTK. The following command was used to obtain the symbol list: nm libcmtksqlite.so |grep " [TRD] " This is the way to recreate the whole list: nm libcmtksqlite.so |grep " [TRD] " | awk '{ print "#define "$3" cmtk_sqlite_"$3 }' REMOVE the "_init" and "_fini" entries. */ #define sqlite3_aggregate_context cmtk_sqlite3_aggregate_context #define sqlite3_aggregate_count cmtk_sqlite3_aggregate_count #define sqlite3_auto_extension cmtk_sqlite3_auto_extension #define sqlite3_backup_finish cmtk_sqlite3_backup_finish #define sqlite3_backup_init cmtk_sqlite3_backup_init #define sqlite3_backup_pagecount cmtk_sqlite3_backup_pagecount #define sqlite3_backup_remaining cmtk_sqlite3_backup_remaining #define sqlite3_backup_step cmtk_sqlite3_backup_step #define sqlite3_bind_blob cmtk_sqlite3_bind_blob #define sqlite3_bind_double cmtk_sqlite3_bind_double #define sqlite3_bind_int cmtk_sqlite3_bind_int #define sqlite3_bind_int64 cmtk_sqlite3_bind_int64 #define sqlite3_bind_null cmtk_sqlite3_bind_null #define sqlite3_bind_parameter_count cmtk_sqlite3_bind_parameter_count #define sqlite3_bind_parameter_index cmtk_sqlite3_bind_parameter_index #define sqlite3_bind_parameter_name cmtk_sqlite3_bind_parameter_name #define sqlite3_bind_text cmtk_sqlite3_bind_text #define sqlite3_bind_text16 cmtk_sqlite3_bind_text16 #define sqlite3_bind_value cmtk_sqlite3_bind_value #define sqlite3_bind_zeroblob cmtk_sqlite3_bind_zeroblob #define sqlite3_blob_bytes cmtk_sqlite3_blob_bytes #define sqlite3_blob_close cmtk_sqlite3_blob_close #define sqlite3_blob_open cmtk_sqlite3_blob_open #define sqlite3_blob_read cmtk_sqlite3_blob_read #define sqlite3_blob_write cmtk_sqlite3_blob_write #define sqlite3_busy_handler cmtk_sqlite3_busy_handler #define sqlite3_busy_timeout cmtk_sqlite3_busy_timeout #define sqlite3_changes cmtk_sqlite3_changes #define sqlite3_clear_bindings cmtk_sqlite3_clear_bindings #define sqlite3_close cmtk_sqlite3_close #define sqlite3_collation_needed cmtk_sqlite3_collation_needed #define sqlite3_collation_needed16 cmtk_sqlite3_collation_needed16 #define sqlite3_column_blob cmtk_sqlite3_column_blob #define sqlite3_column_bytes cmtk_sqlite3_column_bytes #define sqlite3_column_bytes16 cmtk_sqlite3_column_bytes16 #define sqlite3_column_count cmtk_sqlite3_column_count #define sqlite3_column_decltype cmtk_sqlite3_column_decltype #define sqlite3_column_decltype16 cmtk_sqlite3_column_decltype16 #define sqlite3_column_double cmtk_sqlite3_column_double #define sqlite3_column_int cmtk_sqlite3_column_int #define sqlite3_column_int64 cmtk_sqlite3_column_int64 #define sqlite3_column_name cmtk_sqlite3_column_name #define sqlite3_column_name16 cmtk_sqlite3_column_name16 #define sqlite3_column_text cmtk_sqlite3_column_text #define sqlite3_column_text16 cmtk_sqlite3_column_text16 #define sqlite3_column_type cmtk_sqlite3_column_type #define sqlite3_column_value cmtk_sqlite3_column_value #define sqlite3_commit_hook cmtk_sqlite3_commit_hook #define sqlite3_complete cmtk_sqlite3_complete #define sqlite3_complete16 cmtk_sqlite3_complete16 #define sqlite3_config cmtk_sqlite3_config #define sqlite3_context_db_handle cmtk_sqlite3_context_db_handle #define sqlite3_create_collation cmtk_sqlite3_create_collation #define sqlite3_create_collation16 cmtk_sqlite3_create_collation16 #define sqlite3_create_collation_v2 cmtk_sqlite3_create_collation_v2 #define sqlite3_create_function cmtk_sqlite3_create_function #define sqlite3_create_function16 cmtk_sqlite3_create_function16 #define sqlite3_create_module cmtk_sqlite3_create_module #define sqlite3_create_module_v2 cmtk_sqlite3_create_module_v2 #define sqlite3_data_count cmtk_sqlite3_data_count #define sqlite3_db_config cmtk_sqlite3_db_config #define sqlite3_db_handle cmtk_sqlite3_db_handle #define sqlite3_db_mutex cmtk_sqlite3_db_mutex #define sqlite3_db_status cmtk_sqlite3_db_status #define sqlite3_declare_vtab cmtk_sqlite3_declare_vtab #define sqlite3_enable_shared_cache cmtk_sqlite3_enable_shared_cache #define sqlite3_errcode cmtk_sqlite3_errcode #define sqlite3_errmsg cmtk_sqlite3_errmsg #define sqlite3_errmsg16 cmtk_sqlite3_errmsg16 #define sqlite3_exec cmtk_sqlite3_exec #define sqlite3_expired cmtk_sqlite3_expired #define sqlite3_extended_errcode cmtk_sqlite3_extended_errcode #define sqlite3_extended_result_codes cmtk_sqlite3_extended_result_codes #define sqlite3_file_control cmtk_sqlite3_file_control #define sqlite3_finalize cmtk_sqlite3_finalize #define sqlite3_free cmtk_sqlite3_free #define sqlite3_free_table cmtk_sqlite3_free_table #define sqlite3_get_autocommit cmtk_sqlite3_get_autocommit #define sqlite3_get_auxdata cmtk_sqlite3_get_auxdata #define sqlite3_get_table cmtk_sqlite3_get_table #define sqlite3_global_recover cmtk_sqlite3_global_recover #define sqlite3_initialize cmtk_sqlite3_initialize #define sqlite3_interrupt cmtk_sqlite3_interrupt #define sqlite3_last_insert_rowid cmtk_sqlite3_last_insert_rowid #define sqlite3_libversion cmtk_sqlite3_libversion #define sqlite3_libversion_number cmtk_sqlite3_libversion_number #define sqlite3_limit cmtk_sqlite3_limit #define sqlite3_malloc cmtk_sqlite3_malloc #define sqlite3_memory_alarm cmtk_sqlite3_memory_alarm #define sqlite3_memory_highwater cmtk_sqlite3_memory_highwater #define sqlite3_memory_used cmtk_sqlite3_memory_used #define sqlite3_mprintf cmtk_sqlite3_mprintf #define sqlite3_next_stmt cmtk_sqlite3_next_stmt #define sqlite3_open cmtk_sqlite3_open #define sqlite3_open16 cmtk_sqlite3_open16 #define sqlite3_open_v2 cmtk_sqlite3_open_v2 #define sqlite3_os_end cmtk_sqlite3_os_end #define sqlite3_os_init cmtk_sqlite3_os_init #define sqlite3_overload_function cmtk_sqlite3_overload_function #define sqlite3_prepare cmtk_sqlite3_prepare #define sqlite3_prepare16 cmtk_sqlite3_prepare16 #define sqlite3_prepare16_v2 cmtk_sqlite3_prepare16_v2 #define sqlite3_prepare_v2 cmtk_sqlite3_prepare_v2 #define sqlite3_profile cmtk_sqlite3_profile #define sqlite3_progress_handler cmtk_sqlite3_progress_handler #define sqlite3_randomness cmtk_sqlite3_randomness #define sqlite3_realloc cmtk_sqlite3_realloc #define sqlite3_release_memory cmtk_sqlite3_release_memory #define sqlite3_reset cmtk_sqlite3_reset #define sqlite3_reset_auto_extension cmtk_sqlite3_reset_auto_extension #define sqlite3_result_blob cmtk_sqlite3_result_blob #define sqlite3_result_double cmtk_sqlite3_result_double #define sqlite3_result_error cmtk_sqlite3_result_error #define sqlite3_result_error16 cmtk_sqlite3_result_error16 #define sqlite3_result_error_code cmtk_sqlite3_result_error_code #define sqlite3_result_error_nomem cmtk_sqlite3_result_error_nomem #define sqlite3_result_error_toobig cmtk_sqlite3_result_error_toobig #define sqlite3_result_int cmtk_sqlite3_result_int #define sqlite3_result_int64 cmtk_sqlite3_result_int64 #define sqlite3_result_null cmtk_sqlite3_result_null #define sqlite3_result_text cmtk_sqlite3_result_text #define sqlite3_result_text16 cmtk_sqlite3_result_text16 #define sqlite3_result_text16be cmtk_sqlite3_result_text16be #define sqlite3_result_text16le cmtk_sqlite3_result_text16le #define sqlite3_result_value cmtk_sqlite3_result_value #define sqlite3_result_zeroblob cmtk_sqlite3_result_zeroblob #define sqlite3_rollback_hook cmtk_sqlite3_rollback_hook #define sqlite3_set_authorizer cmtk_sqlite3_set_authorizer #define sqlite3_set_auxdata cmtk_sqlite3_set_auxdata #define sqlite3_shutdown cmtk_sqlite3_shutdown #define sqlite3_sleep cmtk_sqlite3_sleep #define sqlite3_snprintf cmtk_sqlite3_snprintf #define sqlite3_soft_heap_limit cmtk_sqlite3_soft_heap_limit #define sqlite3_sourceid cmtk_sqlite3_sourceid #define sqlite3_sql cmtk_sqlite3_sql #define sqlite3_status cmtk_sqlite3_status #define sqlite3_step cmtk_sqlite3_step #define sqlite3_stmt_status cmtk_sqlite3_stmt_status #define sqlite3_strnicmp cmtk_sqlite3_strnicmp #define sqlite3_test_control cmtk_sqlite3_test_control #define sqlite3_thread_cleanup cmtk_sqlite3_thread_cleanup #define sqlite3_threadsafe cmtk_sqlite3_threadsafe #define sqlite3_total_changes cmtk_sqlite3_total_changes #define sqlite3_trace cmtk_sqlite3_trace #define sqlite3_transfer_bindings cmtk_sqlite3_transfer_bindings #define sqlite3_update_hook cmtk_sqlite3_update_hook #define sqlite3_user_data cmtk_sqlite3_user_data #define sqlite3_value_blob cmtk_sqlite3_value_blob #define sqlite3_value_bytes cmtk_sqlite3_value_bytes #define sqlite3_value_bytes16 cmtk_sqlite3_value_bytes16 #define sqlite3_value_double cmtk_sqlite3_value_double #define sqlite3_value_int cmtk_sqlite3_value_int #define sqlite3_value_int64 cmtk_sqlite3_value_int64 #define sqlite3_value_numeric_type cmtk_sqlite3_value_numeric_type #define sqlite3_value_text cmtk_sqlite3_value_text #define sqlite3_value_text16 cmtk_sqlite3_value_text16 #define sqlite3_value_text16be cmtk_sqlite3_value_text16be #define sqlite3_value_text16le cmtk_sqlite3_value_text16le #define sqlite3_value_type cmtk_sqlite3_value_type #define sqlite3_version cmtk_sqlite3_version #define sqlite3_vfs_find cmtk_sqlite3_vfs_find #define sqlite3_vfs_register cmtk_sqlite3_vfs_register #define sqlite3_vfs_unregister cmtk_sqlite3_vfs_unregister #define sqlite3_vmprintf cmtk_sqlite3_vmprintf #define sqlite3_blob_reopen cmtk_sqlite3_blob_reopen #define sqlite3_compileoption_get cmtk_sqlite3_compileoption_get #define sqlite3_compileoption_used cmtk_sqlite3_compileoption_used #define sqlite3_create_function_v2 cmtk_sqlite3_create_function_v2 #define sqlite3_log cmtk_sqlite3_log #define sqlite3_rtree_geometry_callback cmtk_sqlite3_rtree_geometry_callback #define sqlite3_soft_heap_limit64 cmtk_sqlite3_soft_heap_limit64 #define sqlite3_stmt_readonly cmtk_sqlite3_stmt_readonly #define sqlite3_wal_autocheckpoint cmtk_sqlite3_wal_autocheckpoint #define sqlite3_wal_checkpoint cmtk_sqlite3_wal_checkpoint #define sqlite3_wal_hook cmtk_sqlite3_wal_hook #endif // #ifndef cmtk_sqlite_mangle_h cmtk-3.0.0/Utilities/sqlite3/sqlite3.h0000644000177700000170000110060711517604372016616 0ustar torstenman/* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the SQLite library ** presents to client programs. If a C-function, structure, datatype, ** or constant definition does not appear in this file, then it is ** not a published API of SQLite, is subject to change without ** notice, and should not be referenced by programs that use SQLite. ** ** Some of the definitions that are in this file are marked as ** "experimental". Experimental interfaces are normally new ** features recently added to SQLite. We do not anticipate changes ** to experimental interfaces but reserve the right to make minor changes ** if experience from use "in the wild" suggest such changes are prudent. ** ** The official C-language API documentation for SQLite is derived ** from comments in this file. This file is the authoritative source ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ #include "cmtk_sqlite3_mangle.h" #include /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. */ #ifdef __cplusplus extern "C" { #endif /* ** Add the ability to override 'extern' */ #ifndef SQLITE_EXTERN # define SQLITE_EXTERN extern #endif #ifndef SQLITE_API # define SQLITE_API #endif /* ** These no-op macros are used in front of interfaces to mark those ** interfaces as either deprecated or experimental. New applications ** should not use deprecated interfaces - they are support for backwards ** compatibility only. Application writers should be aware that ** experimental interfaces are subject to change in point releases. ** ** These macros used to resolve to various kinds of compiler magic that ** would generate warning messages when they were used. But that ** compiler magic ended up generating such a flurry of bug reports ** that we have taken it all out and gone back to using simple ** noop macros. */ #define SQLITE_DEPRECATED #define SQLITE_EXPERIMENTAL /* ** Ensure these symbols were not defined by some previous header file. */ #ifdef SQLITE_VERSION # undef SQLITE_VERSION #endif #ifdef SQLITE_VERSION_NUMBER # undef SQLITE_VERSION_NUMBER #endif /* ** CAPI3REF: Compile-Time Library Version Numbers ** ** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header ** evaluates to a string literal that is the SQLite version in the ** format "X.Y.Z" where X is the major version number (always 3 for ** SQLite3) and Y is the minor version number and Z is the release number.)^ ** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer ** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same ** numbers used in [SQLITE_VERSION].)^ ** The SQLITE_VERSION_NUMBER for any given release of SQLite will also ** be larger than the release from which it is derived. Either Y will ** be held constant and Z will be incremented or else Y will be incremented ** and Z will be reset to zero. ** ** Since version 3.6.18, SQLite source code has been stored in the ** Fossil configuration management ** system. ^The SQLITE_SOURCE_ID macro evaluates to ** a string which identifies a particular check-in of SQLite ** within its configuration management system. ^The SQLITE_SOURCE_ID ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.7.4" #define SQLITE_VERSION_NUMBER 3007004 #define SQLITE_SOURCE_ID "2010-12-07 20:14:09 a586a4deeb25330037a49df295b36aaf624d0f45" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros ** but are associated with the library instead of the header file. ^(Cautious ** programmers might include assert() statements in their application to ** verify that values returned by these interfaces match the macros in ** the header, and thus insure that the application is ** compiled with matching library and header files. ** **
        ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
        ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
        ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
        ** 
        )^ ** ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] ** macro. ^The sqlite3_libversion() function returns a pointer to the ** to the sqlite3_version[] string constant. The sqlite3_libversion() ** function is provided for use in DLLs since DLL users usually do not have ** direct access to string constants within the DLL. ^The ** sqlite3_libversion_number() function returns an integer equal to ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns ** a pointer to a string constant whose value is the same as the ** [SQLITE_SOURCE_ID] C preprocessor macro. ** ** See also: [sqlite_version()] and [sqlite_source_id()]. */ SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; SQLITE_API const char *sqlite3_libversion(void); SQLITE_API const char *sqlite3_sourceid(void); SQLITE_API int sqlite3_libversion_number(void); /* ** CAPI3REF: Run-Time Library Compilation Options Diagnostics ** ** ^The sqlite3_compileoption_used() function returns 0 or 1 ** indicating whether the specified option was defined at ** compile time. ^The SQLITE_ prefix may be omitted from the ** option name passed to sqlite3_compileoption_used(). ** ** ^The sqlite3_compileoption_get() function allows iterating ** over the list of options that were defined at compile time by ** returning the N-th compile time option string. ^If N is out of range, ** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ ** prefix is omitted from any strings returned by ** sqlite3_compileoption_get(). ** ** ^Support for the diagnostic functions sqlite3_compileoption_used() ** and sqlite3_compileoption_get() may be omitted by specifying the ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. ** ** See also: SQL functions [sqlite_compileoption_used()] and ** [sqlite_compileoption_get()] and the [compile_options pragma]. */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS SQLITE_API int sqlite3_compileoption_used(const char *zOptName); SQLITE_API const char *sqlite3_compileoption_get(int N); #endif /* ** CAPI3REF: Test To See If The Library Is Threadsafe ** ** ^The sqlite3_threadsafe() function returns zero if and only if ** SQLite was compiled mutexing code omitted due to the ** [SQLITE_THREADSAFE] compile-time option being set to 0. ** ** SQLite can be compiled with or without mutexes. When ** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes ** are enabled and SQLite is threadsafe. When the ** [SQLITE_THREADSAFE] macro is 0, ** the mutexes are omitted. Without the mutexes, it is not safe ** to use SQLite concurrently from more than one thread. ** ** Enabling mutexes incurs a measurable performance penalty. ** So if speed is of utmost importance, it makes sense to disable ** the mutexes. But for maximum safety, mutexes should be enabled. ** ^The default behavior is for mutexes to be enabled. ** ** This interface can be used by an application to make sure that the ** version of SQLite that it is linking against was compiled with ** the desired setting of the [SQLITE_THREADSAFE] macro. ** ** This interface only reports on the compile-time mutex setting ** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but ** can be fully or partially disabled using a call to [sqlite3_config()] ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], ** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the ** sqlite3_threadsafe() function shows only the compile-time setting of ** thread safety, not any run-time changes to that setting made by ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() ** is unchanged by calls to sqlite3_config().)^ ** ** See the [threading mode] documentation for additional information. */ SQLITE_API int sqlite3_threadsafe(void); /* ** CAPI3REF: Database Connection Handle ** KEYWORDS: {database connection} {database connections} ** ** Each open SQLite database is represented by a pointer to an instance of ** the opaque structure named "sqlite3". It is useful to think of an sqlite3 ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] ** is its destructor. There are many other interfaces (such as ** [sqlite3_prepare_v2()], [sqlite3_create_function()], and ** [sqlite3_busy_timeout()] to name but three) that are methods on an ** sqlite3 object. */ typedef struct sqlite3 sqlite3; /* ** CAPI3REF: 64-Bit Integer Types ** KEYWORDS: sqlite_int64 sqlite_uint64 ** ** Because there is no cross-platform way to specify 64-bit integer types ** SQLite includes typedefs for 64-bit signed and unsigned integers. ** ** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. ** The sqlite_int64 and sqlite_uint64 types are supported for backwards ** compatibility only. ** ** ^The sqlite3_int64 and sqlite_int64 types can store integer values ** between -9223372036854775808 and +9223372036854775807 inclusive. ^The ** sqlite3_uint64 and sqlite_uint64 types can store integer values ** between 0 and +18446744073709551615 inclusive. */ #ifdef SQLITE_INT64_TYPE typedef SQLITE_INT64_TYPE sqlite_int64; typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; #elif defined(_MSC_VER) || defined(__BORLANDC__) typedef __int64 sqlite_int64; typedef unsigned __int64 sqlite_uint64; #else typedef long long int sqlite_int64; typedef unsigned long long int sqlite_uint64; #endif typedef sqlite_int64 sqlite3_int64; typedef sqlite_uint64 sqlite3_uint64; /* ** If compiling for a processor that lacks floating point support, ** substitute integer for floating-point. */ #ifdef SQLITE_OMIT_FLOATING_POINT # define double sqlite3_int64 #endif /* ** CAPI3REF: Closing A Database Connection ** ** ^The sqlite3_close() routine is the destructor for the [sqlite3] object. ** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is ** successfully destroyed and all associated resources are deallocated. ** ** Applications must [sqlite3_finalize | finalize] all [prepared statements] ** and [sqlite3_blob_close | close] all [BLOB handles] associated with ** the [sqlite3] object prior to attempting to close the object. ^If ** sqlite3_close() is called on a [database connection] that still has ** outstanding [prepared statements] or [BLOB handles], then it returns ** SQLITE_BUSY. ** ** ^If [sqlite3_close()] is invoked while a transaction is open, ** the transaction is automatically rolled back. ** ** The C parameter to [sqlite3_close(C)] must be either a NULL ** pointer or an [sqlite3] object pointer obtained ** from [sqlite3_open()], [sqlite3_open16()], or ** [sqlite3_open_v2()], and not previously closed. ** ^Calling sqlite3_close() with a NULL pointer argument is a ** harmless no-op. */ SQLITE_API int sqlite3_close(sqlite3 *); /* ** The type for a callback function. ** This is legacy and deprecated. It is included for historical ** compatibility and is not documented. */ typedef int (*sqlite3_callback)(void*,int,char**, char**); /* ** CAPI3REF: One-Step Query Execution Interface ** ** The sqlite3_exec() interface is a convenience wrapper around ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], ** that allows an application to run multiple statements of SQL ** without having to use a lot of C code. ** ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, ** semicolon-separate SQL statements passed into its 2nd argument, ** in the context of the [database connection] passed in as its 1st ** argument. ^If the callback function of the 3rd argument to ** sqlite3_exec() is not NULL, then it is invoked for each result row ** coming out of the evaluated SQL statements. ^The 4th argument to ** to sqlite3_exec() is relayed through to the 1st argument of each ** callback invocation. ^If the callback pointer to sqlite3_exec() ** is NULL, then no callback is ever invoked and result rows are ** ignored. ** ** ^If an error occurs while evaluating the SQL statements passed into ** sqlite3_exec(), then execution of the current statement stops and ** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() ** is not NULL then any error message is written into memory obtained ** from [sqlite3_malloc()] and passed back through the 5th parameter. ** To avoid memory leaks, the application should invoke [sqlite3_free()] ** on error message strings returned through the 5th parameter of ** of sqlite3_exec() after the error message string is no longer needed. ** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors ** occur, then sqlite3_exec() sets the pointer in its 5th parameter to ** NULL before returning. ** ** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() ** routine returns SQLITE_ABORT without invoking the callback again and ** without running any subsequent SQL statements. ** ** ^The 2nd argument to the sqlite3_exec() callback function is the ** number of columns in the result. ^The 3rd argument to the sqlite3_exec() ** callback is an array of pointers to strings obtained as if from ** [sqlite3_column_text()], one for each column. ^If an element of a ** result row is NULL then the corresponding string pointer for the ** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the ** sqlite3_exec() callback is an array of pointers to strings where each ** entry represents the name of corresponding result column as obtained ** from [sqlite3_column_name()]. ** ** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer ** to an empty string, or a pointer that contains only whitespace and/or ** SQL comments, then no SQL statements are evaluated and the database ** is not changed. ** ** Restrictions: ** **
          **
        • The application must insure that the 1st parameter to sqlite3_exec() ** is a valid and open [database connection]. **
        • The application must not close [database connection] specified by ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. **
        • The application must not modify the SQL statement text passed into ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. **
        */ SQLITE_API int sqlite3_exec( sqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */ ); /* ** CAPI3REF: Result Codes ** KEYWORDS: SQLITE_OK {error code} {error codes} ** KEYWORDS: {result code} {result codes} ** ** Many SQLite functions return an integer result code from the set shown ** here in order to indicates success or failure. ** ** New error codes may be added in future versions of SQLite. ** ** See also: [SQLITE_IOERR_READ | extended result codes] */ #define SQLITE_OK 0 /* Successful result */ /* beginning-of-error-codes */ #define SQLITE_ERROR 1 /* SQL error or missing database */ #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ #define SQLITE_PERM 3 /* Access permission denied */ #define SQLITE_ABORT 4 /* Callback routine requested an abort */ #define SQLITE_BUSY 5 /* The database file is locked */ #define SQLITE_LOCKED 6 /* A table in the database is locked */ #define SQLITE_NOMEM 7 /* A malloc() failed */ #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ #define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */ #define SQLITE_FULL 13 /* Insertion failed because database is full */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ #define SQLITE_EMPTY 16 /* Database is empty */ #define SQLITE_SCHEMA 17 /* The database schema changed */ #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ #define SQLITE_MISMATCH 20 /* Data type mismatch */ #define SQLITE_MISUSE 21 /* Library used incorrectly */ #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ #define SQLITE_AUTH 23 /* Authorization denied */ #define SQLITE_FORMAT 24 /* Auxiliary database format error */ #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ #define SQLITE_NOTADB 26 /* File opened that is not a database file */ #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ #define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ /* end-of-error-codes */ /* ** CAPI3REF: Extended Result Codes ** KEYWORDS: {extended error code} {extended error codes} ** KEYWORDS: {extended result code} {extended result codes} ** ** In its default configuration, SQLite API routines return one of 26 integer ** [SQLITE_OK | result codes]. However, experience has shown that many of ** these result codes are too coarse-grained. They do not provide as ** much information about problems as programmers might like. In an effort to ** address this, newer versions of SQLite (version 3.3.8 and later) include ** support for additional result codes that provide more detailed information ** about errors. The extended result codes are enabled or disabled ** on a per database connection basis using the ** [sqlite3_extended_result_codes()] API. ** ** Some of the available extended result codes are listed here. ** One may expect the number of extended result codes will be expand ** over time. Software that uses extended result codes should expect ** to see new result codes in future releases of SQLite. ** ** The SQLITE_OK result code will never be extended. It will always ** be exactly zero. */ #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) #define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) #define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) #define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) #define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) #define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) #define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) #define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8)) #define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8)) #define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8)) #define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8)) #define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8)) #define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8)) #define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8)) #define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8)) #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) /* ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the ** 3rd parameter to the [sqlite3_open_v2()] interface and ** in the 4th parameter to the xOpen method of the ** [sqlite3_vfs] object. */ #define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ #define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ #define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ #define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ #define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ #define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ #define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */ #define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ #define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ #define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ /* ** CAPI3REF: Device Characteristics ** ** The xDeviceCharacteristics method of the [sqlite3_io_methods] ** object returns an integer which is a vector of the these ** bit values expressing I/O characteristics of the mass storage ** device that holds the file that the [sqlite3_io_methods] ** refers to. ** ** The SQLITE_IOCAP_ATOMIC property means that all writes of ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values ** mean that writes of blocks that are nnn bytes in size and ** are aligned to an address which is an integer multiple of ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means ** that when data is appended to a file, the data is appended ** first then the size of the file is extended, never the other ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that ** information is written to disk in the same order as calls ** to xWrite(). */ #define SQLITE_IOCAP_ATOMIC 0x00000001 #define SQLITE_IOCAP_ATOMIC512 0x00000002 #define SQLITE_IOCAP_ATOMIC1K 0x00000004 #define SQLITE_IOCAP_ATOMIC2K 0x00000008 #define SQLITE_IOCAP_ATOMIC4K 0x00000010 #define SQLITE_IOCAP_ATOMIC8K 0x00000020 #define SQLITE_IOCAP_ATOMIC16K 0x00000040 #define SQLITE_IOCAP_ATOMIC32K 0x00000080 #define SQLITE_IOCAP_ATOMIC64K 0x00000100 #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 /* ** CAPI3REF: File Locking Levels ** ** SQLite uses one of these integer values as the second ** argument to calls it makes to the xLock() and xUnlock() methods ** of an [sqlite3_io_methods] object. */ #define SQLITE_LOCK_NONE 0 #define SQLITE_LOCK_SHARED 1 #define SQLITE_LOCK_RESERVED 2 #define SQLITE_LOCK_PENDING 3 #define SQLITE_LOCK_EXCLUSIVE 4 /* ** CAPI3REF: Synchronization Type Flags ** ** When SQLite invokes the xSync() method of an ** [sqlite3_io_methods] object it uses a combination of ** these integer values as the second argument. ** ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the ** sync operation only needs to flush data to mass storage. Inode ** information need not be flushed. If the lower four bits of the flag ** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. ** If the lower four bits equal SQLITE_SYNC_FULL, that means ** to use Mac OS X style fullsync instead of fsync(). ** ** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags ** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL ** settings. The [synchronous pragma] determines when calls to the ** xSync VFS method occur and applies uniformly across all platforms. ** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how ** energetic or rigorous or forceful the sync operations are and ** only make a difference on Mac OSX for the default SQLite code. ** (Third-party VFS implementations might also make the distinction ** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the ** operating systems natively supported by SQLite, only Mac OSX ** cares about the difference.) */ #define SQLITE_SYNC_NORMAL 0x00002 #define SQLITE_SYNC_FULL 0x00003 #define SQLITE_SYNC_DATAONLY 0x00010 /* ** CAPI3REF: OS Interface Open File Handle ** ** An [sqlite3_file] object represents an open file in the ** [sqlite3_vfs | OS interface layer]. Individual OS interface ** implementations will ** want to subclass this object by appending additional fields ** for their own use. The pMethods entry is a pointer to an ** [sqlite3_io_methods] object that defines methods for performing ** I/O operations on the open file. */ typedef struct sqlite3_file sqlite3_file; struct sqlite3_file { const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ }; /* ** CAPI3REF: OS Interface File Virtual Methods Object ** ** Every file opened by the [sqlite3_vfs] xOpen method populates an ** [sqlite3_file] object (or, more commonly, a subclass of the ** [sqlite3_file] object) with a pointer to an instance of this object. ** This object defines the methods used to perform various operations ** against the open file represented by the [sqlite3_file] object. ** ** If the xOpen method sets the sqlite3_file.pMethods element ** to a non-NULL pointer, then the sqlite3_io_methods.xClose method ** may be invoked even if the xOpen reported that it failed. The ** only way to prevent a call to xClose following a failed xOpen ** is for the xOpen to set the sqlite3_file.pMethods element to NULL. ** ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or ** [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). ** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] ** flag may be ORed in to indicate that only the data of the file ** and not its inode needs to be synced. ** ** The integer values to xLock() and xUnlock() are one of **
          **
        • [SQLITE_LOCK_NONE], **
        • [SQLITE_LOCK_SHARED], **
        • [SQLITE_LOCK_RESERVED], **
        • [SQLITE_LOCK_PENDING], or **
        • [SQLITE_LOCK_EXCLUSIVE]. **
        ** xLock() increases the lock. xUnlock() decreases the lock. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, ** PENDING, or EXCLUSIVE lock on the file. It returns true ** if such a lock exists and false otherwise. ** ** The xFileControl() method is a generic interface that allows custom ** VFS implementations to directly control an open file using the ** [sqlite3_file_control()] interface. The second "op" argument is an ** integer opcode. The third argument is a generic pointer intended to ** point to a structure that may contain arguments or space in which to ** write return values. Potential uses for xFileControl() might be ** functions to enable blocking locks with timeouts, to change the ** locking strategy (for example to use dot-file locks), to inquire ** about the status of a lock, or to break stale locks. The SQLite ** core reserves all opcodes less than 100 for its own use. ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available. ** Applications that define a custom xFileControl method should use opcodes ** greater than 100 to avoid conflicts. ** ** The xSectorSize() method returns the sector size of the ** device that underlies the file. The sector size is the ** minimum write that can be performed without disturbing ** other bytes in the file. The xDeviceCharacteristics() ** method returns a bit vector describing behaviors of the ** underlying device: ** **
          **
        • [SQLITE_IOCAP_ATOMIC] **
        • [SQLITE_IOCAP_ATOMIC512] **
        • [SQLITE_IOCAP_ATOMIC1K] **
        • [SQLITE_IOCAP_ATOMIC2K] **
        • [SQLITE_IOCAP_ATOMIC4K] **
        • [SQLITE_IOCAP_ATOMIC8K] **
        • [SQLITE_IOCAP_ATOMIC16K] **
        • [SQLITE_IOCAP_ATOMIC32K] **
        • [SQLITE_IOCAP_ATOMIC64K] **
        • [SQLITE_IOCAP_SAFE_APPEND] **
        • [SQLITE_IOCAP_SEQUENTIAL] **
        ** ** The SQLITE_IOCAP_ATOMIC property means that all writes of ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values ** mean that writes of blocks that are nnn bytes in size and ** are aligned to an address which is an integer multiple of ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means ** that when data is appended to a file, the data is appended ** first then the size of the file is extended, never the other ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that ** information is written to disk in the same order as calls ** to xWrite(). ** ** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill ** in the unread portions of the buffer with zeros. A VFS that ** fails to zero-fill short reads might seem to work. However, ** failure to zero-fill short reads will eventually lead to ** database corruption. */ typedef struct sqlite3_io_methods sqlite3_io_methods; struct sqlite3_io_methods { int iVersion; int (*xClose)(sqlite3_file*); int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); int (*xSync)(sqlite3_file*, int flags); int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); int (*xLock)(sqlite3_file*, int); int (*xUnlock)(sqlite3_file*, int); int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); int (*xFileControl)(sqlite3_file*, int op, void *pArg); int (*xSectorSize)(sqlite3_file*); int (*xDeviceCharacteristics)(sqlite3_file*); /* Methods above are valid for version 1 */ int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); void (*xShmBarrier)(sqlite3_file*); int (*xShmUnmap)(sqlite3_file*, int deleteFlag); /* Methods above are valid for version 2 */ /* Additional methods may be added in future releases */ }; /* ** CAPI3REF: Standard File Control Opcodes ** ** These integer constants are opcodes for the xFileControl method ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] ** interface. ** ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This ** opcode causes the xFileControl method to write the current state of ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) ** into an integer that the pArg argument points to. This capability ** is used during testing and only needs to be supported when SQLITE_TEST ** is defined. ** ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS ** layer a hint of how large the database file will grow to be during the ** current transaction. This hint is not guaranteed to be accurate but it ** is often close. The underlying VFS might choose to preallocate database ** file space based on this hint in order to help writes to the database ** file run faster. ** ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS ** extends and truncates the database file in chunks of a size specified ** by the user. The fourth argument to [sqlite3_file_control()] should ** point to an integer (type int) containing the new chunk-size to use ** for the nominated database. Allocating database file space in large ** chunks (say 1MB at a time), may reduce file-system fragmentation and ** improve performance on some systems. */ #define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_GET_LOCKPROXYFILE 2 #define SQLITE_SET_LOCKPROXYFILE 3 #define SQLITE_LAST_ERRNO 4 #define SQLITE_FCNTL_SIZE_HINT 5 #define SQLITE_FCNTL_CHUNK_SIZE 6 #define SQLITE_FCNTL_FILE_POINTER 7 /* ** CAPI3REF: Mutex Handle ** ** The mutex module within SQLite defines [sqlite3_mutex] to be an ** abstract type for a mutex object. The SQLite core never looks ** at the internal representation of an [sqlite3_mutex]. It only ** deals with pointers to the [sqlite3_mutex] object. ** ** Mutexes are created using [sqlite3_mutex_alloc()]. */ typedef struct sqlite3_mutex sqlite3_mutex; /* ** CAPI3REF: OS Interface Object ** ** An instance of the sqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" ** in the name of the object stands for "virtual file system". ** ** The value of the iVersion field is initially 1 but may be larger in ** future versions of SQLite. Additional fields may be appended to this ** object when the iVersion value is increased. Note that the structure ** of the sqlite3_vfs object changes in the transaction between ** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not ** modified. ** ** The szOsFile field is the size of the subclassed [sqlite3_file] ** structure used by this VFS. mxPathname is the maximum length of ** a pathname in this VFS. ** ** Registered sqlite3_vfs objects are kept on a linked list formed by ** the pNext pointer. The [sqlite3_vfs_register()] ** and [sqlite3_vfs_unregister()] interfaces manage this list ** in a thread-safe way. The [sqlite3_vfs_find()] interface ** searches the list. Neither the application code nor the VFS ** implementation should use the pNext pointer. ** ** The pNext field is the only field in the sqlite3_vfs ** structure that SQLite will ever modify. SQLite will only access ** or modify this field while holding a particular static mutex. ** The application should never modify anything within the sqlite3_vfs ** object once the object has been registered. ** ** The zName field holds the name of the VFS module. The name must ** be unique across all VFS modules. ** ** ^SQLite guarantees that the zFilename parameter to xOpen ** is either a NULL pointer or string obtained ** from xFullPathname() with an optional suffix added. ** ^If a suffix is added to the zFilename parameter, it will ** consist of a single "-" character followed by no more than ** 10 alphanumeric and/or "-" characters. ** ^SQLite further guarantees that ** the string will be valid and unchanged until xClose() is ** called. Because of the previous sentence, ** the [sqlite3_file] can safely store a pointer to the ** filename if it needs to remember the filename for some reason. ** If the zFilename parameter to xOpen is a NULL pointer then xOpen ** must invent its own temporary name for the file. ^Whenever the ** xFilename parameter is NULL it will also be the case that the ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. ** ** The flags argument to xOpen() includes all bits set in ** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] ** or [sqlite3_open16()] is used, then flags includes at least ** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. ** If xOpen() opens a file read-only then it sets *pOutFlags to ** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. ** ** ^(SQLite will also add one of the following flags to the xOpen() ** call, depending on the object being opened: ** **
          **
        • [SQLITE_OPEN_MAIN_DB] **
        • [SQLITE_OPEN_MAIN_JOURNAL] **
        • [SQLITE_OPEN_TEMP_DB] **
        • [SQLITE_OPEN_TEMP_JOURNAL] **
        • [SQLITE_OPEN_TRANSIENT_DB] **
        • [SQLITE_OPEN_SUBJOURNAL] **
        • [SQLITE_OPEN_MASTER_JOURNAL] **
        • [SQLITE_OPEN_WAL] **
        )^ ** ** The file I/O implementation can use the object type flags to ** change the way it deals with files. For example, an application ** that does not care about crash recovery or rollback might make ** the open of a journal file a no-op. Writes to this journal would ** also be no-ops, and any attempt to read the journal would return ** SQLITE_IOERR. Or the implementation might recognize that a database ** file will be doing page-aligned sector reads and writes in a random ** order and set up its I/O subsystem accordingly. ** ** SQLite might also add one of the following flags to the xOpen method: ** **
          **
        • [SQLITE_OPEN_DELETEONCLOSE] **
        • [SQLITE_OPEN_EXCLUSIVE] **
        ** ** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be ** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] ** will be set for TEMP databases and their journals, transient ** databases, and subjournals. ** ** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction ** with the [SQLITE_OPEN_CREATE] flag, which are both directly ** analogous to the O_EXCL and O_CREAT flags of the POSIX open() ** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the ** SQLITE_OPEN_CREATE, is used to indicate that file should always ** be created, and that it is an error if it already exists. ** It is not used to indicate the file should be opened ** for exclusive access. ** ** ^At least szOsFile bytes of memory are allocated by SQLite ** to hold the [sqlite3_file] structure passed as the third ** argument to xOpen. The xOpen method does not have to ** allocate the structure; it should just fill it in. Note that ** the xOpen method must set the sqlite3_file.pMethods to either ** a valid [sqlite3_io_methods] object or to NULL. xOpen must do ** this even if the open fails. SQLite expects that the sqlite3_file.pMethods ** element will be valid after xOpen returns regardless of the success ** or failure of the xOpen call. ** ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] ** to test whether a file is at least readable. The file can be a ** directory. ** ** ^SQLite will always allocate at least mxPathname+1 bytes for the ** output buffer xFullPathname. The exact size of the output buffer ** is also passed as a parameter to both methods. If the output buffer ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is ** handled as a fatal error by SQLite, vfs implementations should endeavor ** to prevent this by setting mxPathname to a sufficiently large value. ** ** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() ** interfaces are not strictly a part of the filesystem, but they are ** included in the VFS structure for completeness. ** The xRandomness() function attempts to return nBytes bytes ** of good-quality randomness into zOut. The return value is ** the actual number of bytes of randomness obtained. ** The xSleep() method causes the calling thread to sleep for at ** least the number of microseconds given. ^The xCurrentTime() ** method returns a Julian Day Number for the current date and time as ** a floating point value. ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian ** Day Number multipled by 86400000 (the number of milliseconds in ** a 24-hour day). ** ^SQLite will use the xCurrentTimeInt64() method to get the current ** date and time if that method is available (if iVersion is 2 or ** greater and the function pointer is not NULL) and will fall back ** to xCurrentTime() if xCurrentTimeInt64() is unavailable. */ typedef struct sqlite3_vfs sqlite3_vfs; struct sqlite3_vfs { int iVersion; /* Structure version number (currently 2) */ int szOsFile; /* Size of subclassed sqlite3_file */ int mxPathname; /* Maximum file pathname length */ sqlite3_vfs *pNext; /* Next registered VFS */ const char *zName; /* Name of this virtual file system */ void *pAppData; /* Pointer to application-specific data */ int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, int flags, int *pOutFlags); int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); void (*xDlClose)(sqlite3_vfs*, void*); int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); int (*xSleep)(sqlite3_vfs*, int microseconds); int (*xCurrentTime)(sqlite3_vfs*, double*); int (*xGetLastError)(sqlite3_vfs*, int, char *); /* ** The methods above are in version 1 of the sqlite_vfs object ** definition. Those that follow are added in version 2 or later */ int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); /* ** The methods above are in versions 1 and 2 of the sqlite_vfs object. ** New fields may be appended in figure versions. The iVersion ** value will increment whenever this happens. */ }; /* ** CAPI3REF: Flags for the xAccess VFS method ** ** These integer constants can be used as the third parameter to ** the xAccess method of an [sqlite3_vfs] object. They determine ** what kind of permissions the xAccess method is looking for. ** With SQLITE_ACCESS_EXISTS, the xAccess method ** simply checks whether the file exists. ** With SQLITE_ACCESS_READWRITE, the xAccess method ** checks whether the named directory is both readable and writable ** (in other words, if files can be added, removed, and renamed within ** the directory). ** The SQLITE_ACCESS_READWRITE constant is currently used only by the ** [temp_store_directory pragma], though this could change in a future ** release of SQLite. ** With SQLITE_ACCESS_READ, the xAccess method ** checks whether the file is readable. The SQLITE_ACCESS_READ constant is ** currently unused, though it might be used in a future release of ** SQLite. */ #define SQLITE_ACCESS_EXISTS 0 #define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */ #define SQLITE_ACCESS_READ 2 /* Unused */ /* ** CAPI3REF: Flags for the xShmLock VFS method ** ** These integer constants define the various locking operations ** allowed by the xShmLock method of [sqlite3_io_methods]. The ** following are the only legal combinations of flags to the ** xShmLock method: ** **
          **
        • SQLITE_SHM_LOCK | SQLITE_SHM_SHARED **
        • SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE **
        • SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED **
        • SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE **
        ** ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as ** was given no the corresponding lock. ** ** The xShmLock method can transition between unlocked and SHARED or ** between unlocked and EXCLUSIVE. It cannot transition between SHARED ** and EXCLUSIVE. */ #define SQLITE_SHM_UNLOCK 1 #define SQLITE_SHM_LOCK 2 #define SQLITE_SHM_SHARED 4 #define SQLITE_SHM_EXCLUSIVE 8 /* ** CAPI3REF: Maximum xShmLock index ** ** The xShmLock method on [sqlite3_io_methods] may use values ** between 0 and this upper bound as its "offset" argument. ** The SQLite core will never attempt to acquire or release a ** lock outside of this range */ #define SQLITE_SHM_NLOCK 8 /* ** CAPI3REF: Initialize The SQLite Library ** ** ^The sqlite3_initialize() routine initializes the ** SQLite library. ^The sqlite3_shutdown() routine ** deallocates any resources that were allocated by sqlite3_initialize(). ** These routines are designed to aid in process initialization and ** shutdown on embedded systems. Workstation applications using ** SQLite normally do not need to invoke either of these routines. ** ** A call to sqlite3_initialize() is an "effective" call if it is ** the first time sqlite3_initialize() is invoked during the lifetime of ** the process, or if it is the first time sqlite3_initialize() is invoked ** following a call to sqlite3_shutdown(). ^(Only an effective call ** of sqlite3_initialize() does any initialization. All other calls ** are harmless no-ops.)^ ** ** A call to sqlite3_shutdown() is an "effective" call if it is the first ** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only ** an effective call to sqlite3_shutdown() does any deinitialization. ** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ ** ** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() ** is not. The sqlite3_shutdown() interface must only be called from a ** single thread. All open [database connections] must be closed and all ** other SQLite resources must be deallocated prior to invoking ** sqlite3_shutdown(). ** ** Among other things, ^sqlite3_initialize() will invoke ** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() ** will invoke sqlite3_os_end(). ** ** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. ** ^If for some reason, sqlite3_initialize() is unable to initialize ** the library (perhaps it is unable to allocate a needed resource such ** as a mutex) it returns an [error code] other than [SQLITE_OK]. ** ** ^The sqlite3_initialize() routine is called internally by many other ** SQLite interfaces so that an application usually does not need to ** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] ** calls sqlite3_initialize() so the SQLite library will be automatically ** initialized when [sqlite3_open()] is called if it has not be initialized ** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] ** compile-time option, then the automatic calls to sqlite3_initialize() ** are omitted and the application must call sqlite3_initialize() directly ** prior to using any other SQLite interface. For maximum portability, ** it is recommended that applications always invoke sqlite3_initialize() ** directly prior to using any other SQLite interface. Future releases ** of SQLite may require this. In other words, the behavior exhibited ** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the ** default behavior in some future release of SQLite. ** ** The sqlite3_os_init() routine does operating-system specific ** initialization of the SQLite library. The sqlite3_os_end() ** routine undoes the effect of sqlite3_os_init(). Typical tasks ** performed by these routines include allocation or deallocation ** of static resources, initialization of global variables, ** setting up a default [sqlite3_vfs] module, or setting up ** a default configuration using [sqlite3_config()]. ** ** The application should never invoke either sqlite3_os_init() ** or sqlite3_os_end() directly. The application should only invoke ** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() ** interface is called automatically by sqlite3_initialize() and ** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate ** implementations for sqlite3_os_init() and sqlite3_os_end() ** are built into SQLite when it is compiled for Unix, Windows, or OS/2. ** When [custom builds | built for other platforms] ** (using the [SQLITE_OS_OTHER=1] compile-time ** option) the application must supply a suitable implementation for ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied ** implementation of sqlite3_os_init() or sqlite3_os_end() ** must return [SQLITE_OK] on success and some other [error code] upon ** failure. */ SQLITE_API int sqlite3_initialize(void); SQLITE_API int sqlite3_shutdown(void); SQLITE_API int sqlite3_os_init(void); SQLITE_API int sqlite3_os_end(void); /* ** CAPI3REF: Configuring The SQLite Library ** ** The sqlite3_config() interface is used to make global configuration ** changes to SQLite in order to tune SQLite to the specific needs of ** the application. The default configuration is recommended for most ** applications and so this routine is usually not necessary. It is ** provided to support rare applications with unusual needs. ** ** The sqlite3_config() interface is not threadsafe. The application ** must insure that no other SQLite interfaces are invoked by other ** threads while sqlite3_config() is running. Furthermore, sqlite3_config() ** may only be invoked prior to library initialization using ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. ** Note, however, that ^sqlite3_config() can be called as part of the ** implementation of an application-defined [sqlite3_os_init()]. ** ** The first argument to sqlite3_config() is an integer ** [SQLITE_CONFIG_SINGLETHREAD | configuration option] that determines ** what property of SQLite is to be configured. Subsequent arguments ** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option] ** in the first argument. ** ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. ** ^If the option is unknown or SQLite is unable to set the option ** then this routine returns a non-zero [error code]. */ SQLITE_API int sqlite3_config(int, ...); /* ** CAPI3REF: Configure database connections ** ** The sqlite3_db_config() interface is used to make configuration ** changes to a [database connection]. The interface is similar to ** [sqlite3_config()] except that the changes apply to a single ** [database connection] (specified in the first argument). The ** sqlite3_db_config() interface should only be used immediately after ** the database connection is created using [sqlite3_open()], ** [sqlite3_open16()], or [sqlite3_open_v2()]. ** ** The second argument to sqlite3_db_config(D,V,...) is the ** configuration verb - an integer code that indicates what ** aspect of the [database connection] is being configured. ** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE]. ** New verbs are likely to be added in future releases of SQLite. ** Additional arguments depend on the verb. ** ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if ** the call is considered successful. */ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); /* ** CAPI3REF: Memory Allocation Routines ** ** An instance of this object defines the interface between SQLite ** and low-level memory allocation routines. ** ** This object is used in only one place in the SQLite interface. ** A pointer to an instance of this object is the argument to ** [sqlite3_config()] when the configuration option is ** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. ** By creating an instance of this object ** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) ** during configuration, an application can specify an alternative ** memory allocation subsystem for SQLite to use for all of its ** dynamic memory needs. ** ** Note that SQLite comes with several [built-in memory allocators] ** that are perfectly adequate for the overwhelming majority of applications ** and that this object is only useful to a tiny minority of applications ** with specialized memory allocation requirements. This object is ** also used during testing of SQLite in order to specify an alternative ** memory allocator that simulates memory out-of-memory conditions in ** order to verify that SQLite recovers gracefully from such ** conditions. ** ** The xMalloc and xFree methods must work like the ** malloc() and free() functions from the standard C library. ** The xRealloc method must work like realloc() from the standard C library ** with the exception that if the second argument to xRealloc is zero, ** xRealloc must be a no-op - it must not perform any allocation or ** deallocation. ^SQLite guarantees that the second argument to ** xRealloc is always a value returned by a prior call to xRoundup. ** And so in cases where xRoundup always returns a positive number, ** xRealloc can perform exactly as the standard library realloc() and ** still be in compliance with this specification. ** ** xSize should return the allocated size of a memory allocation ** previously obtained from xMalloc or xRealloc. The allocated size ** is always at least as big as the requested size but may be larger. ** ** The xRoundup method returns what would be the allocated size of ** a memory allocation given a particular requested size. Most memory ** allocators round up memory allocations at least to the next multiple ** of 8. Some allocators round up to a larger multiple or to a power of 2. ** Every memory allocation request coming in through [sqlite3_malloc()] ** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, ** that causes the corresponding memory allocation to fail. ** ** The xInit method initializes the memory allocator. (For example, ** it might allocate any require mutexes or initialize internal data ** structures. The xShutdown method is invoked (indirectly) by ** [sqlite3_shutdown()] and should deallocate any resources acquired ** by xInit. The pAppData pointer is used as the only parameter to ** xInit and xShutdown. ** ** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes ** the xInit method, so the xInit method need not be threadsafe. The ** xShutdown method is only called from [sqlite3_shutdown()] so it does ** not need to be threadsafe either. For all other methods, SQLite ** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the ** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which ** it is by default) and so the methods are automatically serialized. ** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other ** methods must be threadsafe or else make their own arrangements for ** serialization. ** ** SQLite will never invoke xInit() more than once without an intervening ** call to xShutdown(). */ typedef struct sqlite3_mem_methods sqlite3_mem_methods; struct sqlite3_mem_methods { void *(*xMalloc)(int); /* Memory allocation function */ void (*xFree)(void*); /* Free a prior allocation */ void *(*xRealloc)(void*,int); /* Resize an allocation */ int (*xSize)(void*); /* Return the size of an allocation */ int (*xRoundup)(int); /* Round up request size to allocation size */ int (*xInit)(void*); /* Initialize the memory allocator */ void (*xShutdown)(void*); /* Deinitialize the memory allocator */ void *pAppData; /* Argument to xInit() and xShutdown() */ }; /* ** CAPI3REF: Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the first argument to the [sqlite3_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications ** should check the return code from [sqlite3_config()] to make sure that ** the call worked. The [sqlite3_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** **
        **
        SQLITE_CONFIG_SINGLETHREAD
        **
        There are no arguments to this option. ^This option sets the ** [threading mode] to Single-thread. In other words, it disables ** all mutexing and puts SQLite into a mode where it can only be used ** by a single thread. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to change the [threading mode] from its default ** value of Single-thread and so [sqlite3_config()] will return ** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD ** configuration option.
        ** **
        SQLITE_CONFIG_MULTITHREAD
        **
        There are no arguments to this option. ^This option sets the ** [threading mode] to Multi-thread. In other words, it disables ** mutexing on [database connection] and [prepared statement] objects. ** The application is responsible for serializing access to ** [database connections] and [prepared statements]. But other mutexes ** are enabled so that SQLite will be safe to use in a multi-threaded ** environment as long as no two threads attempt to use the same ** [database connection] at the same time. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to set the Multi-thread [threading mode] and ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the ** SQLITE_CONFIG_MULTITHREAD configuration option.
        ** **
        SQLITE_CONFIG_SERIALIZED
        **
        There are no arguments to this option. ^This option sets the ** [threading mode] to Serialized. In other words, this option enables ** all mutexes including the recursive ** mutexes on [database connection] and [prepared statement] objects. ** In this mode (which is the default when SQLite is compiled with ** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access ** to [database connections] and [prepared statements] so that the ** application is free to use the same [database connection] or the ** same [prepared statement] in different threads at the same time. ** ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to set the Serialized [threading mode] and ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the ** SQLITE_CONFIG_SERIALIZED configuration option.
        ** **
        SQLITE_CONFIG_MALLOC
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mem_methods] structure. The argument specifies ** alternative low-level memory allocation routines to be used in place of ** the memory allocation routines built into SQLite.)^ ^SQLite makes ** its own private copy of the content of the [sqlite3_mem_methods] structure ** before the [sqlite3_config()] call returns.
        ** **
        SQLITE_CONFIG_GETMALLOC
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods] ** structure is filled with the currently defined memory allocation routines.)^ ** This option can be used to overload the default memory allocation ** routines with a wrapper that simulations memory allocation failure or ** tracks memory usage, for example.
        ** **
        SQLITE_CONFIG_MEMSTATUS
        **
        ^This option takes single argument of type int, interpreted as a ** boolean, which enables or disables the collection of memory allocation ** statistics. ^(When memory allocation statistics are disabled, the ** following SQLite interfaces become non-operational: **
          **
        • [sqlite3_memory_used()] **
        • [sqlite3_memory_highwater()] **
        • [sqlite3_soft_heap_limit64()] **
        • [sqlite3_status()] **
        )^ ** ^Memory allocation statistics are enabled by default unless SQLite is ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory ** allocation statistics are disabled by default. **
        ** **
        SQLITE_CONFIG_SCRATCH
        **
        ^This option specifies a static memory buffer that SQLite can use for ** scratch memory. There are three arguments: A pointer an 8-byte ** aligned memory buffer from which the scrach allocations will be ** drawn, the size of each scratch allocation (sz), ** and the maximum number of scratch allocations (N). The sz ** argument must be a multiple of 16. ** The first argument must be a pointer to an 8-byte aligned buffer ** of at least sz*N bytes of memory. ** ^SQLite will use no more than two scratch buffers per thread. So ** N should be set to twice the expected maximum number of threads. ** ^SQLite will never require a scratch buffer that is more than 6 ** times the database page size. ^If SQLite needs needs additional ** scratch memory beyond what is provided by this configuration option, then ** [sqlite3_malloc()] will be used to obtain the memory needed.
        ** **
        SQLITE_CONFIG_PAGECACHE
        **
        ^This option specifies a static memory buffer that SQLite can use for ** the database page cache with the default page cache implemenation. ** This configuration should not be used if an application-define page ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option. ** There are three arguments to this option: A pointer to 8-byte aligned ** memory, the size of each page buffer (sz), and the number of pages (N). ** The sz argument should be the size of the largest database page ** (a power of two between 512 and 32768) plus a little extra for each ** page header. ^The page header size is 20 to 40 bytes depending on ** the host architecture. ^It is harmless, apart from the wasted memory, ** to make sz a little too large. The first ** argument should point to an allocation of at least sz*N bytes of memory. ** ^SQLite will use the memory provided by the first argument to satisfy its ** memory needs for the first N pages that it adds to cache. ^If additional ** page cache memory is needed beyond what is provided by this option, then ** SQLite goes to [sqlite3_malloc()] for the additional storage space. ** The pointer in the first argument must ** be aligned to an 8-byte boundary or subsequent behavior of SQLite ** will be undefined.
        ** **
        SQLITE_CONFIG_HEAP
        **
        ^This option specifies a static memory buffer that SQLite will use ** for all of its dynamic memory allocation needs beyond those provided ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE]. ** There are three arguments: An 8-byte aligned pointer to the memory, ** the number of bytes in the memory buffer, and the minimum allocation size. ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts ** to using its default memory allocator (the system malloc() implementation), ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory ** allocator is engaged to handle all of SQLites memory allocation needs. ** The first pointer (the memory pointer) must be aligned to an 8-byte ** boundary or subsequent behavior of SQLite will be undefined.
        ** **
        SQLITE_CONFIG_MUTEX
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mutex_methods] structure. The argument specifies ** alternative low-level mutex routines to be used in place ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the ** content of the [sqlite3_mutex_methods] structure before the call to ** [sqlite3_config()] returns. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** the entire mutexing subsystem is omitted from the build and hence calls to ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will ** return [SQLITE_ERROR].
        ** **
        SQLITE_CONFIG_GETMUTEX
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mutex_methods] structure. The ** [sqlite3_mutex_methods] ** structure is filled with the currently defined mutex routines.)^ ** This option can be used to overload the default mutex allocation ** routines with a wrapper used to track mutex usage for performance ** profiling or testing, for example. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** the entire mutexing subsystem is omitted from the build and hence calls to ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will ** return [SQLITE_ERROR].
        ** **
        SQLITE_CONFIG_LOOKASIDE
        **
        ^(This option takes two arguments that determine the default ** memory allocation for the lookaside memory allocator on each ** [database connection]. The first argument is the ** size of each lookaside buffer slot and the second is the number of ** slots allocated to each database connection.)^ ^(This option sets the ** default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] ** verb to [sqlite3_db_config()] can be used to change the lookaside ** configuration on individual connections.)^
        ** **
        SQLITE_CONFIG_PCACHE
        **
        ^(This option takes a single argument which is a pointer to ** an [sqlite3_pcache_methods] object. This object specifies the interface ** to a custom page cache implementation.)^ ^SQLite makes a copy of the ** object and uses it for page cache memory allocations.
        ** **
        SQLITE_CONFIG_GETPCACHE
        **
        ^(This option takes a single argument which is a pointer to an ** [sqlite3_pcache_methods] object. SQLite copies of the current ** page cache implementation into that object.)^
        ** **
        SQLITE_CONFIG_LOG
        **
        ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a ** function with a call signature of void(*)(void*,int,const char*), ** and a pointer to void. ^If the function pointer is not NULL, it is ** invoked by [sqlite3_log()] to process each logging event. ^If the ** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. ** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is ** passed through as the first parameter to the application-defined logger ** function whenever that function is invoked. ^The second parameter to ** the logger function is a copy of the first parameter to the corresponding ** [sqlite3_log()] call and is intended to be a [result code] or an ** [extended result code]. ^The third parameter passed to the logger is ** log message after formatting via [sqlite3_snprintf()]. ** The SQLite logging interface is not reentrant; the logger function ** supplied by the application must not invoke any SQLite interface. ** In a multi-threaded application, the application-defined logger ** function must be threadsafe.
        ** **
        */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ #define SQLITE_CONFIG_PCACHE 14 /* sqlite3_pcache_methods* */ #define SQLITE_CONFIG_GETPCACHE 15 /* sqlite3_pcache_methods* */ #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications ** should check the return code from [sqlite3_db_config()] to make sure that ** the call worked. ^The [sqlite3_db_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** **
        **
        SQLITE_DBCONFIG_LOOKASIDE
        **
        ^This option takes three additional arguments that determine the ** [lookaside memory allocator] configuration for the [database connection]. ** ^The first argument (the third parameter to [sqlite3_db_config()] is a ** pointer to an memory buffer to use for lookaside memory. ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb ** may be NULL in which case SQLite will allocate the ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the ** size of each lookaside buffer slot. ^The third argument is the number of ** slots. The size of the buffer in the first argument must be greater than ** or equal to the product of the second and third arguments. The buffer ** must be aligned to an 8-byte boundary. ^If the second argument to ** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally ** rounded down to the next smaller multiple of 8. ^(The lookaside memory ** configuration for a database connection can only be changed when that ** connection is not currently using lookaside memory, or in other words ** when the "current value" returned by ** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns ** [SQLITE_BUSY].)^
        ** **
        */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes ** ** ^The sqlite3_extended_result_codes() routine enables or disables the ** [extended result codes] feature of SQLite. ^The extended result ** codes are disabled by default for historical compatibility. */ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); /* ** CAPI3REF: Last Insert Rowid ** ** ^Each entry in an SQLite table has a unique 64-bit signed ** integer key called the [ROWID | "rowid"]. ^The rowid is always available ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those ** names are not also used by explicitly declared columns. ^If ** the table has a column of type [INTEGER PRIMARY KEY] then that column ** is another alias for the rowid. ** ** ^This routine returns the [rowid] of the most recent ** successful [INSERT] into the database from the [database connection] ** in the first argument. ^If no successful [INSERT]s ** have ever occurred on that database connection, zero is returned. ** ** ^(If an [INSERT] occurs within a trigger, then the [rowid] of the inserted ** row is returned by this routine as long as the trigger is running. ** But once the trigger terminates, the value returned by this routine ** reverts to the last value inserted before the trigger fired.)^ ** ** ^An [INSERT] that fails due to a constraint violation is not a ** successful [INSERT] and does not change the value returned by this ** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, ** and INSERT OR ABORT make no changes to the return value of this ** routine when their insertion fails. ^(When INSERT OR REPLACE ** encounters a constraint violation, it does not fail. The ** INSERT continues to completion after deleting rows that caused ** the constraint problem so INSERT OR REPLACE will always change ** the return value of this interface.)^ ** ** ^For the purposes of this routine, an [INSERT] is considered to ** be successful even if it is subsequently rolled back. ** ** This function is accessible to SQL statements via the ** [last_insert_rowid() SQL function]. ** ** If a separate thread performs a new [INSERT] on the same ** database connection while the [sqlite3_last_insert_rowid()] ** function is running and thus changes the last insert [rowid], ** then the value returned by [sqlite3_last_insert_rowid()] is ** unpredictable and might not equal either the old or the new ** last insert [rowid]. */ SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); /* ** CAPI3REF: Count The Number Of Rows Modified ** ** ^This function returns the number of database rows that were changed ** or inserted or deleted by the most recently completed SQL statement ** on the [database connection] specified by the first parameter. ** ^(Only changes that are directly specified by the [INSERT], [UPDATE], ** or [DELETE] statement are counted. Auxiliary changes caused by ** triggers or [foreign key actions] are not counted.)^ Use the ** [sqlite3_total_changes()] function to find the total number of changes ** including changes caused by triggers and foreign key actions. ** ** ^Changes to a view that are simulated by an [INSTEAD OF trigger] ** are not counted. Only real table changes are counted. ** ** ^(A "row change" is a change to a single row of a single table ** caused by an INSERT, DELETE, or UPDATE statement. Rows that ** are changed as side effects of [REPLACE] constraint resolution, ** rollback, ABORT processing, [DROP TABLE], or by any other ** mechanisms do not count as direct row changes.)^ ** ** A "trigger context" is a scope of execution that begins and ** ends with the script of a [CREATE TRIGGER | trigger]. ** Most SQL statements are ** evaluated outside of any trigger. This is the "top level" ** trigger context. If a trigger fires from the top level, a ** new trigger context is entered for the duration of that one ** trigger. Subtriggers create subcontexts for their duration. ** ** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does ** not create a new trigger context. ** ** ^This function returns the number of direct row changes in the ** most recent INSERT, UPDATE, or DELETE statement within the same ** trigger context. ** ** ^Thus, when called from the top level, this function returns the ** number of changes in the most recent INSERT, UPDATE, or DELETE ** that also occurred at the top level. ^(Within the body of a trigger, ** the sqlite3_changes() interface can be called to find the number of ** changes in the most recently completed INSERT, UPDATE, or DELETE ** statement within the body of the same trigger. ** However, the number returned does not include changes ** caused by subtriggers since those have their own context.)^ ** ** See also the [sqlite3_total_changes()] interface, the ** [count_changes pragma], and the [changes() SQL function]. ** ** If a separate thread makes changes on the same database connection ** while [sqlite3_changes()] is running then the value returned ** is unpredictable and not meaningful. */ SQLITE_API int sqlite3_changes(sqlite3*); /* ** CAPI3REF: Total Number Of Rows Modified ** ** ^This function returns the number of row changes caused by [INSERT], ** [UPDATE] or [DELETE] statements since the [database connection] was opened. ** ^(The count returned by sqlite3_total_changes() includes all changes ** from all [CREATE TRIGGER | trigger] contexts and changes made by ** [foreign key actions]. However, ** the count does not include changes used to implement [REPLACE] constraints, ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The ** count does not include rows of views that fire an [INSTEAD OF trigger], ** though if the INSTEAD OF trigger makes changes of its own, those changes ** are counted.)^ ** ^The sqlite3_total_changes() function counts the changes as soon as ** the statement that makes them is completed (when the statement handle ** is passed to [sqlite3_reset()] or [sqlite3_finalize()]). ** ** See also the [sqlite3_changes()] interface, the ** [count_changes pragma], and the [total_changes() SQL function]. ** ** If a separate thread makes changes on the same database connection ** while [sqlite3_total_changes()] is running then the value ** returned is unpredictable and not meaningful. */ SQLITE_API int sqlite3_total_changes(sqlite3*); /* ** CAPI3REF: Interrupt A Long-Running Query ** ** ^This function causes any pending database operation to abort and ** return at its earliest opportunity. This routine is typically ** called in response to a user action such as pressing "Cancel" ** or Ctrl-C where the user wants a long query operation to halt ** immediately. ** ** ^It is safe to call this routine from a thread different from the ** thread that is currently running the database operation. But it ** is not safe to call this routine with a [database connection] that ** is closed or might close before sqlite3_interrupt() returns. ** ** ^If an SQL operation is very nearly finished at the time when ** sqlite3_interrupt() is called, then it might not have an opportunity ** to be interrupted and might continue to completion. ** ** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. ** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE ** that is inside an explicit transaction, then the entire transaction ** will be rolled back automatically. ** ** ^The sqlite3_interrupt(D) call is in effect until all currently running ** SQL statements on [database connection] D complete. ^Any new SQL statements ** that are started after the sqlite3_interrupt() call and before the ** running statements reaches zero are interrupted as if they had been ** running prior to the sqlite3_interrupt() call. ^New SQL statements ** that are started after the running statement count reaches zero are ** not effected by the sqlite3_interrupt(). ** ^A call to sqlite3_interrupt(D) that occurs when there are no running ** SQL statements is a no-op and has no effect on SQL statements ** that are started after the sqlite3_interrupt() call returns. ** ** If the database connection closes while [sqlite3_interrupt()] ** is running then bad things will likely happen. */ SQLITE_API void sqlite3_interrupt(sqlite3*); /* ** CAPI3REF: Determine If An SQL Statement Is Complete ** ** These routines are useful during command-line input to determine if the ** currently entered text seems to form a complete SQL statement or ** if additional input is needed before sending the text into ** SQLite for parsing. ^These routines return 1 if the input string ** appears to be a complete SQL statement. ^A statement is judged to be ** complete if it ends with a semicolon token and is not a prefix of a ** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within ** string literals or quoted identifier names or comments are not ** independent tokens (they are part of the token in which they are ** embedded) and thus do not count as a statement terminator. ^Whitespace ** and comments that follow the final semicolon are ignored. ** ** ^These routines return 0 if the statement is incomplete. ^If a ** memory allocation fails, then SQLITE_NOMEM is returned. ** ** ^These routines do not parse the SQL statements thus ** will not detect syntactically incorrect SQL. ** ** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior ** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked ** automatically by sqlite3_complete16(). If that initialization fails, ** then the return value from sqlite3_complete16() will be non-zero ** regardless of whether or not the input SQL is complete.)^ ** ** The input to [sqlite3_complete()] must be a zero-terminated ** UTF-8 string. ** ** The input to [sqlite3_complete16()] must be a zero-terminated ** UTF-16 string in native byte order. */ SQLITE_API int sqlite3_complete(const char *sql); SQLITE_API int sqlite3_complete16(const void *sql); /* ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors ** ** ^This routine sets a callback function that might be invoked whenever ** an attempt is made to open a database table that another thread ** or process has locked. ** ** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] ** is returned immediately upon encountering the lock. ^If the busy callback ** is not NULL, then the callback might be invoked with two arguments. ** ** ^The first argument to the busy handler is a copy of the void* pointer which ** is the third argument to sqlite3_busy_handler(). ^The second argument to ** the busy handler callback is the number of times that the busy handler has ** been invoked for this locking event. ^If the ** busy callback returns 0, then no additional attempts are made to ** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned. ** ^If the callback returns non-zero, then another attempt ** is made to open the database for reading and the cycle repeats. ** ** The presence of a busy handler does not guarantee that it will be invoked ** when there is lock contention. ^If SQLite determines that invoking the busy ** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] ** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler. ** Consider a scenario where one process is holding a read lock that ** it is trying to promote to a reserved lock and ** a second process is holding a reserved lock that it is trying ** to promote to an exclusive lock. The first process cannot proceed ** because it is blocked by the second and the second process cannot ** proceed because it is blocked by the first. If both processes ** invoke the busy handlers, neither will make any progress. Therefore, ** SQLite returns [SQLITE_BUSY] for the first process, hoping that this ** will induce the first process to release its read lock and allow ** the second process to proceed. ** ** ^The default busy callback is NULL. ** ** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] ** when SQLite is in the middle of a large transaction where all the ** changes will not fit into the in-memory cache. SQLite will ** already hold a RESERVED lock on the database file, but it needs ** to promote this lock to EXCLUSIVE so that it can spill cache ** pages into the database file without harm to concurrent ** readers. ^If it is unable to promote the lock, then the in-memory ** cache will be left in an inconsistent state and so the error ** code is promoted from the relatively benign [SQLITE_BUSY] to ** the more severe [SQLITE_IOERR_BLOCKED]. ^This error code promotion ** forces an automatic rollback of the changes. See the ** ** CorruptionFollowingBusyError wiki page for a discussion of why ** this is important. ** ** ^(There can only be a single busy handler defined for each ** [database connection]. Setting a new busy handler clears any ** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] ** will also set or clear the busy handler. ** ** The busy callback should not take any actions which modify the ** database connection that invoked the busy handler. Any such actions ** result in undefined behavior. ** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); /* ** CAPI3REF: Set A Busy Timeout ** ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps ** for a specified amount of time when a table is locked. ^The handler ** will sleep multiple times until at least "ms" milliseconds of sleeping ** have accumulated. ^After at least "ms" milliseconds of sleeping, ** the handler returns 0 which causes [sqlite3_step()] to return ** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]. ** ** ^Calling this routine with an argument less than or equal to zero ** turns off all busy handlers. ** ** ^(There can only be a single busy handler for a particular ** [database connection] any any given moment. If another busy handler ** was defined (using [sqlite3_busy_handler()]) prior to calling ** this routine, that other busy handler is cleared.)^ */ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); /* ** CAPI3REF: Convenience Routines For Running Queries ** ** This is a legacy interface that is preserved for backwards compatibility. ** Use of this interface is not recommended. ** ** Definition: A result table is memory data structure created by the ** [sqlite3_get_table()] interface. A result table records the ** complete query results from one or more queries. ** ** The table conceptually has a number of rows and columns. But ** these numbers are not part of the result table itself. These ** numbers are obtained separately. Let N be the number of rows ** and M be the number of columns. ** ** A result table is an array of pointers to zero-terminated UTF-8 strings. ** There are (N+1)*M elements in the array. The first M pointers point ** to zero-terminated strings that contain the names of the columns. ** The remaining entries all point to query results. NULL values result ** in NULL pointers. All other values are in their UTF-8 zero-terminated ** string representation as returned by [sqlite3_column_text()]. ** ** A result table might consist of one or more memory allocations. ** It is not safe to pass a result table directly to [sqlite3_free()]. ** A result table should be deallocated using [sqlite3_free_table()]. ** ** ^(As an example of the result table format, suppose a query result ** is as follows: ** **
        **        Name        | Age
        **        -----------------------
        **        Alice       | 43
        **        Bob         | 28
        **        Cindy       | 21
        ** 
        ** ** There are two column (M==2) and three rows (N==3). Thus the ** result table has 8 entries. Suppose the result table is stored ** in an array names azResult. Then azResult holds this content: ** **
        **        azResult[0] = "Name";
        **        azResult[1] = "Age";
        **        azResult[2] = "Alice";
        **        azResult[3] = "43";
        **        azResult[4] = "Bob";
        **        azResult[5] = "28";
        **        azResult[6] = "Cindy";
        **        azResult[7] = "21";
        ** 
        )^ ** ** ^The sqlite3_get_table() function evaluates one or more ** semicolon-separated SQL statements in the zero-terminated UTF-8 ** string of its 2nd parameter and returns a result table to the ** pointer given in its 3rd parameter. ** ** After the application has finished with the result from sqlite3_get_table(), ** it must pass the result table pointer to sqlite3_free_table() in order to ** release the memory that was malloced. Because of the way the ** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling ** function must not try to call [sqlite3_free()] directly. Only ** [sqlite3_free_table()] is able to release the memory properly and safely. ** ** The sqlite3_get_table() interface is implemented as a wrapper around ** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access ** to any internal data structures of SQLite. It uses only the public ** interface defined here. As a consequence, errors that occur in the ** wrapper layer outside of the internal [sqlite3_exec()] call are not ** reflected in subsequent calls to [sqlite3_errcode()] or ** [sqlite3_errmsg()]. */ SQLITE_API int sqlite3_get_table( sqlite3 *db, /* An open database */ const char *zSql, /* SQL to be evaluated */ char ***pazResult, /* Results of the query */ int *pnRow, /* Number of result rows written here */ int *pnColumn, /* Number of result columns written here */ char **pzErrmsg /* Error msg written here */ ); SQLITE_API void sqlite3_free_table(char **result); /* ** CAPI3REF: Formatted String Printing Functions ** ** These routines are work-alikes of the "printf()" family of functions ** from the standard C library. ** ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their ** results into memory obtained from [sqlite3_malloc()]. ** The strings returned by these two routines should be ** released by [sqlite3_free()]. ^Both routines return a ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough ** memory to hold the resulting string. ** ** ^(In sqlite3_snprintf() routine is similar to "snprintf()" from ** the standard C library. The result is written into the ** buffer supplied as the second parameter whose size is given by ** the first parameter. Note that the order of the ** first two parameters is reversed from snprintf().)^ This is an ** historical accident that cannot be fixed without breaking ** backwards compatibility. ^(Note also that sqlite3_snprintf() ** returns a pointer to its buffer instead of the number of ** characters actually written into the buffer.)^ We admit that ** the number of characters written would be a more useful return ** value but we cannot change the implementation of sqlite3_snprintf() ** now without breaking compatibility. ** ** ^As long as the buffer size is greater than zero, sqlite3_snprintf() ** guarantees that the buffer is always zero-terminated. ^The first ** parameter "n" is the total size of the buffer, including space for ** the zero terminator. So the longest string that can be completely ** written will be n-1 characters. ** ** These routines all implement some additional formatting ** options that are useful for constructing SQL statements. ** All of the usual printf() formatting options apply. In addition, there ** is are "%q", "%Q", and "%z" options. ** ** ^(The %q option works like %s in that it substitutes a null-terminated ** string from the argument list. But %q also doubles every '\'' character. ** %q is designed for use inside a string literal.)^ By doubling each '\'' ** character it escapes that character and allows it to be inserted into ** the string. ** ** For example, assume the string variable zText contains text as follows: ** **
        **  char *zText = "It's a happy day!";
        ** 
        ** ** One can use this text in an SQL statement as follows: ** **
        **  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
        **  sqlite3_exec(db, zSQL, 0, 0, 0);
        **  sqlite3_free(zSQL);
        ** 
        ** ** Because the %q format string is used, the '\'' character in zText ** is escaped and the SQL generated is as follows: ** **
        **  INSERT INTO table1 VALUES('It''s a happy day!')
        ** 
        ** ** This is correct. Had we used %s instead of %q, the generated SQL ** would have looked like this: ** **
        **  INSERT INTO table1 VALUES('It's a happy day!');
        ** 
        ** ** This second example is an SQL syntax error. As a general rule you should ** always use %q instead of %s when inserting text into a string literal. ** ** ^(The %Q option works like %q except it also adds single quotes around ** the outside of the total string. Additionally, if the parameter in the ** argument list is a NULL pointer, %Q substitutes the text "NULL" (without ** single quotes).)^ So, for example, one could say: ** **
        **  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
        **  sqlite3_exec(db, zSQL, 0, 0, 0);
        **  sqlite3_free(zSQL);
        ** 
        ** ** The code above will render a correct SQL statement in the zSQL ** variable even if the zText variable is a NULL pointer. ** ** ^(The "%z" formatting option works like "%s" but with the ** addition that after the string has been read and copied into ** the result, [sqlite3_free()] is called on the input string.)^ */ SQLITE_API char *sqlite3_mprintf(const char*,...); SQLITE_API char *sqlite3_vmprintf(const char*, va_list); SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); /* ** CAPI3REF: Memory Allocation Subsystem ** ** The SQLite core uses these three routines for all of its own ** internal memory allocation needs. "Core" in the previous sentence ** does not include operating-system specific VFS implementation. The ** Windows VFS uses native malloc() and free() for some operations. ** ** ^The sqlite3_malloc() routine returns a pointer to a block ** of memory at least N bytes in length, where N is the parameter. ** ^If sqlite3_malloc() is unable to obtain sufficient free ** memory, it returns a NULL pointer. ^If the parameter N to ** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns ** a NULL pointer. ** ** ^Calling sqlite3_free() with a pointer previously returned ** by sqlite3_malloc() or sqlite3_realloc() releases that memory so ** that it might be reused. ^The sqlite3_free() routine is ** a no-op if is called with a NULL pointer. Passing a NULL pointer ** to sqlite3_free() is harmless. After being freed, memory ** should neither be read nor written. Even reading previously freed ** memory might result in a segmentation fault or other severe error. ** Memory corruption, a segmentation fault, or other severe error ** might result if sqlite3_free() is called with a non-NULL pointer that ** was not obtained from sqlite3_malloc() or sqlite3_realloc(). ** ** ^(The sqlite3_realloc() interface attempts to resize a ** prior memory allocation to be at least N bytes, where N is the ** second parameter. The memory allocation to be resized is the first ** parameter.)^ ^ If the first parameter to sqlite3_realloc() ** is a NULL pointer then its behavior is identical to calling ** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc(). ** ^If the second parameter to sqlite3_realloc() is zero or ** negative then the behavior is exactly the same as calling ** sqlite3_free(P) where P is the first parameter to sqlite3_realloc(). ** ^sqlite3_realloc() returns a pointer to a memory allocation ** of at least N bytes in size or NULL if sufficient memory is unavailable. ** ^If M is the size of the prior allocation, then min(N,M) bytes ** of the prior allocation are copied into the beginning of buffer returned ** by sqlite3_realloc() and the prior allocation is freed. ** ^If sqlite3_realloc() returns NULL, then the prior allocation ** is not freed. ** ** ^The memory returned by sqlite3_malloc() and sqlite3_realloc() ** is always aligned to at least an 8 byte boundary, or to a ** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time ** option is used. ** ** In SQLite version 3.5.0 and 3.5.1, it was possible to define ** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in ** implementation of these routines to be omitted. That capability ** is no longer provided. Only built-in memory allocators can be used. ** ** The Windows OS interface layer calls ** the system malloc() and free() directly when converting ** filenames between the UTF-8 encoding used by SQLite ** and whatever filename encoding is used by the particular Windows ** installation. Memory allocation errors are detected, but ** they are reported back as [SQLITE_CANTOPEN] or ** [SQLITE_IOERR] rather than [SQLITE_NOMEM]. ** ** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] ** must be either NULL or else pointers obtained from a prior ** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have ** not yet been released. ** ** The application must not read or write any part of ** a block of memory after it has been released using ** [sqlite3_free()] or [sqlite3_realloc()]. */ SQLITE_API void *sqlite3_malloc(int); SQLITE_API void *sqlite3_realloc(void*, int); SQLITE_API void sqlite3_free(void*); /* ** CAPI3REF: Memory Allocator Statistics ** ** SQLite provides these two interfaces for reporting on the status ** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] ** routines, which form the built-in memory allocation subsystem. ** ** ^The [sqlite3_memory_used()] routine returns the number of bytes ** of memory currently outstanding (malloced but not freed). ** ^The [sqlite3_memory_highwater()] routine returns the maximum ** value of [sqlite3_memory_used()] since the high-water mark ** was last reset. ^The values returned by [sqlite3_memory_used()] and ** [sqlite3_memory_highwater()] include any overhead ** added by SQLite in its implementation of [sqlite3_malloc()], ** but not overhead added by the any underlying system library ** routines that [sqlite3_malloc()] may call. ** ** ^The memory high-water mark is reset to the current value of ** [sqlite3_memory_used()] if and only if the parameter to ** [sqlite3_memory_highwater()] is true. ^The value returned ** by [sqlite3_memory_highwater(1)] is the high-water mark ** prior to the reset. */ SQLITE_API sqlite3_int64 sqlite3_memory_used(void); SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); /* ** CAPI3REF: Pseudo-Random Number Generator ** ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to ** select random [ROWID | ROWIDs] when inserting new records into a table that ** already uses the largest possible [ROWID]. The PRNG is also used for ** the build-in random() and randomblob() SQL functions. This interface allows ** applications to access the same PRNG for other purposes. ** ** ^A call to this routine stores N bytes of randomness into buffer P. ** ** ^The first time this routine is invoked (either internally or by ** the application) the PRNG is seeded using randomness obtained ** from the xRandomness method of the default [sqlite3_vfs] object. ** ^On all subsequent invocations, the pseudo-randomness is generated ** internally and without recourse to the [sqlite3_vfs] xRandomness ** method. */ SQLITE_API void sqlite3_randomness(int N, void *P); /* ** CAPI3REF: Compile-Time Authorization Callbacks ** ** ^This routine registers a authorizer callback with a particular ** [database connection], supplied in the first argument. ** ^The authorizer callback is invoked as SQL statements are being compiled ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various ** points during the compilation process, as logic is being created ** to perform various actions, the authorizer callback is invoked to ** see if those actions are allowed. ^The authorizer callback should ** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the ** specific action but allow the SQL statement to continue to be ** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be ** rejected with an error. ^If the authorizer callback returns ** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] ** then the [sqlite3_prepare_v2()] or equivalent call that triggered ** the authorizer will fail with an error message. ** ** When the callback returns [SQLITE_OK], that means the operation ** requested is ok. ^When the callback returns [SQLITE_DENY], the ** [sqlite3_prepare_v2()] or equivalent call that triggered the ** authorizer will fail with an error message explaining that ** access is denied. ** ** ^The first parameter to the authorizer callback is a copy of the third ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter ** to the callback is an integer [SQLITE_COPY | action code] that specifies ** the particular action to be authorized. ^The third through sixth parameters ** to the callback are zero-terminated strings that contain additional ** details about the action to be authorized. ** ** ^If the action code is [SQLITE_READ] ** and the callback returns [SQLITE_IGNORE] then the ** [prepared statement] statement is constructed to substitute ** a NULL value in place of the table column that would have ** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] ** return can be used to deny an untrusted user access to individual ** columns of a table. ** ^If the action code is [SQLITE_DELETE] and the callback returns ** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the ** [truncate optimization] is disabled and all rows are deleted individually. ** ** An authorizer is used when [sqlite3_prepare | preparing] ** SQL statements from an untrusted source, to ensure that the SQL statements ** do not try to access data they are not allowed to see, or that they do not ** try to execute malicious statements that damage the database. For ** example, an application may allow a user to enter arbitrary ** SQL queries for evaluation by a database. But the application does ** not want the user to be able to make arbitrary changes to the ** database. An authorizer could then be put in place while the ** user-entered SQL is being [sqlite3_prepare | prepared] that ** disallows everything except [SELECT] statements. ** ** Applications that need to process SQL from untrusted sources ** might also consider lowering resource limits using [sqlite3_limit()] ** and limiting database size using the [max_page_count] [PRAGMA] ** in addition to using an authorizer. ** ** ^(Only a single authorizer can be in place on a database connection ** at a time. Each call to sqlite3_set_authorizer overrides the ** previous call.)^ ^Disable the authorizer by installing a NULL callback. ** The authorizer is disabled by default. ** ** The authorizer callback must not do anything that will modify ** the database connection that invoked the authorizer callback. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** ** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the ** statement might be re-prepared during [sqlite3_step()] due to a ** schema change. Hence, the application should ensure that the ** correct authorizer callback remains in place during the [sqlite3_step()]. ** ** ^Note that the authorizer callback is invoked only during ** [sqlite3_prepare()] or its variants. Authorization is not ** performed during statement evaluation in [sqlite3_step()], unless ** as stated in the previous paragraph, sqlite3_step() invokes ** sqlite3_prepare_v2() to reprepare a statement after a schema change. */ SQLITE_API int sqlite3_set_authorizer( sqlite3*, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pUserData ); /* ** CAPI3REF: Authorizer Return Codes ** ** The [sqlite3_set_authorizer | authorizer callback function] must ** return either [SQLITE_OK] or one of these two constants in order ** to signal SQLite whether or not the action is permitted. See the ** [sqlite3_set_authorizer | authorizer documentation] for additional ** information. */ #define SQLITE_DENY 1 /* Abort the SQL statement with an error */ #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ /* ** CAPI3REF: Authorizer Action Codes ** ** The [sqlite3_set_authorizer()] interface registers a callback function ** that is invoked to authorize certain SQL statement actions. The ** second parameter to the callback is an integer code that specifies ** what action is being authorized. These are the integer action codes that ** the authorizer callback may be passed. ** ** These action code values signify what kind of operation is to be ** authorized. The 3rd and 4th parameters to the authorization ** callback function will be parameters or NULL depending on which of these ** codes is used as the second parameter. ^(The 5th parameter to the ** authorizer callback is the name of the database ("main", "temp", ** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback ** is the name of the inner-most trigger or view that is responsible for ** the access attempt or NULL if this access attempt is directly from ** top-level SQL code. */ /******************************************* 3rd ************ 4th ***********/ #define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ #define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ #define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ #define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ #define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ #define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ #define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ #define SQLITE_CREATE_VIEW 8 /* View Name NULL */ #define SQLITE_DELETE 9 /* Table Name NULL */ #define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ #define SQLITE_DROP_TABLE 11 /* Table Name NULL */ #define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ #define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ #define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ #define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ #define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ #define SQLITE_DROP_VIEW 17 /* View Name NULL */ #define SQLITE_INSERT 18 /* Table Name NULL */ #define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ #define SQLITE_READ 20 /* Table Name Column Name */ #define SQLITE_SELECT 21 /* NULL NULL */ #define SQLITE_TRANSACTION 22 /* Operation NULL */ #define SQLITE_UPDATE 23 /* Table Name Column Name */ #define SQLITE_ATTACH 24 /* Filename NULL */ #define SQLITE_DETACH 25 /* Database Name NULL */ #define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ #define SQLITE_REINDEX 27 /* Index Name NULL */ #define SQLITE_ANALYZE 28 /* Table Name NULL */ #define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ #define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ #define SQLITE_FUNCTION 31 /* NULL Function Name */ #define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ #define SQLITE_COPY 0 /* No longer used */ /* ** CAPI3REF: Tracing And Profiling Functions ** ** These routines register callback functions that can be used for ** tracing and profiling the execution of SQL statements. ** ** ^The callback function registered by sqlite3_trace() is invoked at ** various times when an SQL statement is being run by [sqlite3_step()]. ** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the ** SQL statement text as the statement first begins executing. ** ^(Additional sqlite3_trace() callbacks might occur ** as each triggered subprogram is entered. The callbacks for triggers ** contain a UTF-8 SQL comment that identifies the trigger.)^ ** ** ^The callback function registered by sqlite3_profile() is invoked ** as each SQL statement finishes. ^The profile callback contains ** the original statement text and an estimate of wall-clock time ** of how long that statement took to run. ^The profile callback ** time is in units of nanoseconds, however the current implementation ** is only capable of millisecond resolution so the six least significant ** digits in the time are meaningless. Future versions of SQLite ** might provide greater resolution on the profiler callback. The ** sqlite3_profile() function is considered experimental and is ** subject to change in future versions of SQLite. */ SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); /* ** CAPI3REF: Query Progress Callbacks ** ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback ** function X to be invoked periodically during long running calls to ** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for ** database connection D. An example use for this ** interface is to keep a GUI updated during a large query. ** ** ^The parameter P is passed through as the only parameter to the ** callback function X. ^The parameter N is the number of ** [virtual machine instructions] that are evaluated between successive ** invocations of the callback X. ** ** ^Only a single progress handler may be defined at one time per ** [database connection]; setting a new progress handler cancels the ** old one. ^Setting parameter X to NULL disables the progress handler. ** ^The progress handler is also disabled by setting N to a value less ** than 1. ** ** ^If the progress callback returns non-zero, the operation is ** interrupted. This feature can be used to implement a ** "Cancel" button on a GUI progress dialog box. ** ** The progress handler callback must not do anything that will modify ** the database connection that invoked the progress handler. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** */ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); /* ** CAPI3REF: Opening A New Database Connection ** ** ^These routines open an SQLite database file whose name is given by the ** filename argument. ^The filename argument is interpreted as UTF-8 for ** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte ** order for sqlite3_open16(). ^(A [database connection] handle is usually ** returned in *ppDb, even if an error occurs. The only exception is that ** if SQLite is unable to allocate memory to hold the [sqlite3] object, ** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] ** object.)^ ^(If the database is opened (and/or created) successfully, then ** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The ** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain ** an English language description of the error following a failure of any ** of the sqlite3_open() routines. ** ** ^The default encoding for the database will be UTF-8 if ** sqlite3_open() or sqlite3_open_v2() is called and ** UTF-16 in the native byte order if sqlite3_open16() is used. ** ** Whether or not an error occurs when it is opened, resources ** associated with the [database connection] handle should be released by ** passing it to [sqlite3_close()] when it is no longer required. ** ** The sqlite3_open_v2() interface works like sqlite3_open() ** except that it accepts two additional parameters for additional control ** over the new database connection. ^(The flags parameter to ** sqlite3_open_v2() can take one of ** the following three values, optionally combined with the ** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE], ** and/or [SQLITE_OPEN_PRIVATECACHE] flags:)^ ** **
        ** ^(
        [SQLITE_OPEN_READONLY]
        **
        The database is opened in read-only mode. If the database does not ** already exist, an error is returned.
        )^ ** ** ^(
        [SQLITE_OPEN_READWRITE]
        **
        The database is opened for reading and writing if possible, or reading ** only if the file is write protected by the operating system. In either ** case the database must already exist, otherwise an error is returned.
        )^ ** ** ^(
        [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
        **
        The database is opened for reading and writing, and is creates it if ** it does not already exist. This is the behavior that is always used for ** sqlite3_open() and sqlite3_open16().
        )^ **
        ** ** If the 3rd parameter to sqlite3_open_v2() is not one of the ** combinations shown above or one of the combinations shown above combined ** with the [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], ** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_PRIVATECACHE] flags, ** then the behavior is undefined. ** ** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection ** opens in the multi-thread [threading mode] as long as the single-thread ** mode has not been set at compile-time or start-time. ^If the ** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens ** in the serialized [threading mode] unless single-thread was ** previously selected at compile-time or start-time. ** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be ** eligible to use [shared cache mode], regardless of whether or not shared ** cache is enabled using [sqlite3_enable_shared_cache()]. ^The ** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not ** participate in [shared cache mode] even if it is enabled. ** ** ^If the filename is ":memory:", then a private, temporary in-memory database ** is created for the connection. ^This in-memory database will vanish when ** the database connection is closed. Future versions of SQLite might ** make use of additional special filenames that begin with the ":" character. ** It is recommended that when a database filename actually does begin with ** a ":" character you should prefix the filename with a pathname such as ** "./" to avoid ambiguity. ** ** ^If the filename is an empty string, then a private, temporary ** on-disk database will be created. ^This private database will be ** automatically deleted as soon as the database connection is closed. ** ** ^The fourth parameter to sqlite3_open_v2() is the name of the ** [sqlite3_vfs] object that defines the operating system interface that ** the new database connection should use. ^If the fourth parameter is ** a NULL pointer then the default [sqlite3_vfs] object is used. ** ** Note to Windows users: The encoding used for the filename argument ** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever ** codepage is currently defined. Filenames containing international ** characters must be converted to UTF-8 prior to passing them into ** sqlite3_open() or sqlite3_open_v2(). */ SQLITE_API int sqlite3_open( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); SQLITE_API int sqlite3_open16( const void *filename, /* Database filename (UTF-16) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); SQLITE_API int sqlite3_open_v2( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb, /* OUT: SQLite db handle */ int flags, /* Flags */ const char *zVfs /* Name of VFS module to use */ ); /* ** CAPI3REF: Error Codes And Messages ** ** ^The sqlite3_errcode() interface returns the numeric [result code] or ** [extended result code] for the most recent failed sqlite3_* API call ** associated with a [database connection]. If a prior API call failed ** but the most recent API call succeeded, the return value from ** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode() ** interface is the same except that it always returns the ** [extended result code] even when extended result codes are ** disabled. ** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. ** ^(Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions.)^ ** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. ** When that happens, the second error will be reported since these ** interfaces always report the most recent result. To avoid ** this, each thread can obtain exclusive use of the [database connection] D ** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning ** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after ** all calls to the interfaces listed here are completed. ** ** If an interface fails with SQLITE_MISUSE, that means the interface ** was invoked incorrectly by the application. In that case, the ** error code and message may or may not be set. */ SQLITE_API int sqlite3_errcode(sqlite3 *db); SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); SQLITE_API const char *sqlite3_errmsg(sqlite3*); SQLITE_API const void *sqlite3_errmsg16(sqlite3*); /* ** CAPI3REF: SQL Statement Object ** KEYWORDS: {prepared statement} {prepared statements} ** ** An instance of this object represents a single SQL statement. ** This object is variously known as a "prepared statement" or a ** "compiled SQL statement" or simply as a "statement". ** ** The life of a statement object goes something like this: ** **
          **
        1. Create the object using [sqlite3_prepare_v2()] or a related ** function. **
        2. Bind values to [host parameters] using the sqlite3_bind_*() ** interfaces. **
        3. Run the SQL by calling [sqlite3_step()] one or more times. **
        4. Reset the statement using [sqlite3_reset()] then go back ** to step 2. Do this zero or more times. **
        5. Destroy the object using [sqlite3_finalize()]. **
        ** ** Refer to documentation on individual methods above for additional ** information. */ typedef struct sqlite3_stmt sqlite3_stmt; /* ** CAPI3REF: Run-time Limits ** ** ^(This interface allows the size of various constructs to be limited ** on a connection by connection basis. The first parameter is the ** [database connection] whose limit is to be set or queried. The ** second parameter is one of the [limit categories] that define a ** class of constructs to be size limited. The third parameter is the ** new limit for that construct.)^ ** ** ^If the new limit is a negative number, the limit is unchanged. ** ^(For each limit category SQLITE_LIMIT_NAME there is a ** [limits | hard upper bound] ** set at compile-time by a C preprocessor macro called ** [limits | SQLITE_MAX_NAME]. ** (The "_LIMIT_" in the name is changed to "_MAX_".))^ ** ^Attempts to increase a limit above its hard upper bound are ** silently truncated to the hard upper bound. ** ** ^Regardless of whether or not the limit was changed, the ** [sqlite3_limit()] interface returns the prior value of the limit. ** ^Hence, to find the current value of a limit without changing it, ** simply invoke this interface with the third parameter set to -1. ** ** Run-time limits are intended for use in applications that manage ** both their own internal database and also databases that are controlled ** by untrusted external sources. An example application might be a ** web browser that has its own databases for storing history and ** separate databases controlled by JavaScript applications downloaded ** off the Internet. The internal databases can be given the ** large, default limits. Databases managed by external sources can ** be given much smaller limits designed to prevent a denial of service ** attack. Developers might also want to use the [sqlite3_set_authorizer()] ** interface to further control untrusted SQL. The size of the database ** created by an untrusted script can be contained using the ** [max_page_count] [PRAGMA]. ** ** New run-time limit categories may be added in future releases. */ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); /* ** CAPI3REF: Run-Time Limit Categories ** KEYWORDS: {limit category} {*limit categories} ** ** These constants define various performance limits ** that can be lowered at run-time using [sqlite3_limit()]. ** The synopsis of the meanings of the various limits is shown below. ** Additional information is available at [limits | Limits in SQLite]. ** **
        ** ^(
        SQLITE_LIMIT_LENGTH
        **
        The maximum size of any string or BLOB or table row, in bytes.
        )^ ** ** ^(
        SQLITE_LIMIT_SQL_LENGTH
        **
        The maximum length of an SQL statement, in bytes.
        )^ ** ** ^(
        SQLITE_LIMIT_COLUMN
        **
        The maximum number of columns in a table definition or in the ** result set of a [SELECT] or the maximum number of columns in an index ** or in an ORDER BY or GROUP BY clause.
        )^ ** ** ^(
        SQLITE_LIMIT_EXPR_DEPTH
        **
        The maximum depth of the parse tree on any expression.
        )^ ** ** ^(
        SQLITE_LIMIT_COMPOUND_SELECT
        **
        The maximum number of terms in a compound SELECT statement.
        )^ ** ** ^(
        SQLITE_LIMIT_VDBE_OP
        **
        The maximum number of instructions in a virtual machine program ** used to implement an SQL statement. This limit is not currently ** enforced, though that might be added in some future release of ** SQLite.
        )^ ** ** ^(
        SQLITE_LIMIT_FUNCTION_ARG
        **
        The maximum number of arguments on a function.
        )^ ** ** ^(
        SQLITE_LIMIT_ATTACHED
        **
        The maximum number of [ATTACH | attached databases].)^
        ** ** ^(
        SQLITE_LIMIT_LIKE_PATTERN_LENGTH
        **
        The maximum length of the pattern argument to the [LIKE] or ** [GLOB] operators.
        )^ ** ** ^(
        SQLITE_LIMIT_VARIABLE_NUMBER
        **
        The maximum index number of any [parameter] in an SQL statement.)^ ** ** ^(
        SQLITE_LIMIT_TRIGGER_DEPTH
        **
        The maximum depth of recursion for triggers.
        )^ **
        */ #define SQLITE_LIMIT_LENGTH 0 #define SQLITE_LIMIT_SQL_LENGTH 1 #define SQLITE_LIMIT_COLUMN 2 #define SQLITE_LIMIT_EXPR_DEPTH 3 #define SQLITE_LIMIT_COMPOUND_SELECT 4 #define SQLITE_LIMIT_VDBE_OP 5 #define SQLITE_LIMIT_FUNCTION_ARG 6 #define SQLITE_LIMIT_ATTACHED 7 #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 #define SQLITE_LIMIT_VARIABLE_NUMBER 9 #define SQLITE_LIMIT_TRIGGER_DEPTH 10 /* ** CAPI3REF: Compiling An SQL Statement ** KEYWORDS: {SQL statement compiler} ** ** To execute an SQL query, it must first be compiled into a byte-code ** program using one of these routines. ** ** The first argument, "db", is a [database connection] obtained from a ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or ** [sqlite3_open16()]. The database connection must not have been closed. ** ** The second argument, "zSql", is the statement to be compiled, encoded ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() ** use UTF-16. ** ** ^If the nByte argument is less than zero, then zSql is read up to the ** first zero terminator. ^If nByte is non-negative, then it is the maximum ** number of bytes read from zSql. ^When nByte is non-negative, the ** zSql string ends at either the first '\000' or '\u0000' character or ** the nByte-th byte, whichever comes first. If the caller knows ** that the supplied string is nul-terminated, then there is a small ** performance advantage to be gained by passing an nByte parameter that ** is equal to the number of bytes in the input string including ** the nul-terminator bytes. ** ** ^If pzTail is not NULL then *pzTail is made to point to the first byte ** past the end of the first SQL statement in zSql. These routines only ** compile the first statement in zSql, so *pzTail is left pointing to ** what remains uncompiled. ** ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be ** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set ** to NULL. ^If the input text contains no SQL (if the input is an empty ** string or a comment) then *ppStmt is set to NULL. ** The calling procedure is responsible for deleting the compiled ** SQL statement using [sqlite3_finalize()] after it has finished with it. ** ppStmt may not be NULL. ** ** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; ** otherwise an [error code] is returned. ** ** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are ** recommended for all new programs. The two older interfaces are retained ** for backwards compatibility, but their use is discouraged. ** ^In the "v2" interfaces, the prepared statement ** that is returned (the [sqlite3_stmt] object) contains a copy of the ** original SQL text. This causes the [sqlite3_step()] interface to ** behave differently in three ways: ** **
          **
        1. ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it ** always used to do, [sqlite3_step()] will automatically recompile the SQL ** statement and try to run it again. **
        2. ** **
        3. ** ^When an error occurs, [sqlite3_step()] will return one of the detailed ** [error codes] or [extended error codes]. ^The legacy behavior was that ** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code ** and the application would have to make a second call to [sqlite3_reset()] ** in order to find the underlying cause of the problem. With the "v2" prepare ** interfaces, the underlying reason for the error is returned immediately. **
        4. ** **
        5. ** ^If the specific value bound to [parameter | host parameter] in the ** WHERE clause might influence the choice of query plan for a statement, ** then the statement will be automatically recompiled, as if there had been ** a schema change, on the first [sqlite3_step()] call following any change ** to the [sqlite3_bind_text | bindings] of that [parameter]. ** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column ** and the [SQLITE_ENABLE_STAT2] compile-time option is enabled. ** the **
        6. **
        */ SQLITE_API int sqlite3_prepare( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare_v2( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare16( sqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare16_v2( sqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); /* ** CAPI3REF: Retrieving Statement SQL ** ** ^This interface can be used to retrieve a saved copy of the original ** SQL text used to create a [prepared statement] if that statement was ** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. */ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database ** ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if ** the [prepared statement] X is [SELECT] statement and false (zero) if ** X is an [INSERT], [UPDATE], [DELETE], CREATE, DROP, [ANALYZE], ** [ALTER], or [REINDEX] statement. ** If X is a NULL pointer or any other kind of statement, including but ** not limited to [ATTACH], [DETACH], [COMMIT], [ROLLBACK], [RELEASE], ** [SAVEPOINT], [PRAGMA], or [VACUUM] the result of sqlite3_stmt_readonly(X) is ** undefined. */ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); /* ** CAPI3REF: Dynamically Typed Value Object ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} ** ** SQLite uses the sqlite3_value object to represent all values ** that can be stored in a database table. SQLite uses dynamic typing ** for the values it stores. ^Values stored in sqlite3_value objects ** can be integers, floating point values, strings, BLOBs, or NULL. ** ** An sqlite3_value object may be either "protected" or "unprotected". ** Some interfaces require a protected sqlite3_value. Other interfaces ** will accept either a protected or an unprotected sqlite3_value. ** Every interface that accepts sqlite3_value arguments specifies ** whether or not it requires a protected sqlite3_value. ** ** The terms "protected" and "unprotected" refer to whether or not ** a mutex is held. A internal mutex is held for a protected ** sqlite3_value object but no mutex is held for an unprotected ** sqlite3_value object. If SQLite is compiled to be single-threaded ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) ** or if SQLite is run in one of reduced mutex modes ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] ** then there is no distinction between protected and unprotected ** sqlite3_value objects and they can be used interchangeably. However, ** for maximum code portability it is recommended that applications ** still make the distinction between protected and unprotected ** sqlite3_value objects even when not strictly required. ** ** ^The sqlite3_value objects that are passed as parameters into the ** implementation of [application-defined SQL functions] are protected. ** ^The sqlite3_value object returned by ** [sqlite3_column_value()] is unprotected. ** Unprotected sqlite3_value objects may only be used with ** [sqlite3_result_value()] and [sqlite3_bind_value()]. ** The [sqlite3_value_blob | sqlite3_value_type()] family of ** interfaces require protected sqlite3_value objects. */ typedef struct Mem sqlite3_value; /* ** CAPI3REF: SQL Function Context Object ** ** The context in which an SQL function executes is stored in an ** sqlite3_context object. ^A pointer to an sqlite3_context object ** is always first parameter to [application-defined SQL functions]. ** The application-defined SQL function implementation will pass this ** pointer through into calls to [sqlite3_result_int | sqlite3_result()], ** [sqlite3_aggregate_context()], [sqlite3_user_data()], ** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], ** and/or [sqlite3_set_auxdata()]. */ typedef struct sqlite3_context sqlite3_context; /* ** CAPI3REF: Binding Values To Prepared Statements ** KEYWORDS: {host parameter} {host parameters} {host parameter name} ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} ** ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, ** literals may be replaced by a [parameter] that matches one of following ** templates: ** **
          **
        • ? **
        • ?NNN **
        • :VVV **
        • @VVV **
        • $VVV **
        ** ** In the templates above, NNN represents an integer literal, ** and VVV represents an alphanumeric identifier.)^ ^The values of these ** parameters (also called "host parameter names" or "SQL parameters") ** can be set using the sqlite3_bind_*() routines defined here. ** ** ^The first argument to the sqlite3_bind_*() routines is always ** a pointer to the [sqlite3_stmt] object returned from ** [sqlite3_prepare_v2()] or its variants. ** ** ^The second argument is the index of the SQL parameter to be set. ** ^The leftmost SQL parameter has an index of 1. ^When the same named ** SQL parameter is used more than once, second and subsequent ** occurrences have the same index as the first occurrence. ** ^The index for named parameters can be looked up using the ** [sqlite3_bind_parameter_index()] API if desired. ^The index ** for "?NNN" parameters is the value of NNN. ** ^The NNN value must be between 1 and the [sqlite3_limit()] ** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999). ** ** ^The third argument is the value to bind to the parameter. ** ** ^(In those routines that have a fourth argument, its value is the ** number of bytes in the parameter. To be clear: the value is the ** number of bytes in the value, not the number of characters.)^ ** ^If the fourth parameter is negative, the length of the string is ** the number of bytes up to the first zero terminator. ** ** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and ** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or ** string after SQLite has finished with it. ^The destructor is called ** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(), ** sqlite3_bind_text(), or sqlite3_bind_text16() fails. ** ^If the fifth argument is ** the special value [SQLITE_STATIC], then SQLite assumes that the ** information is in static, unmanaged space and does not need to be freed. ** ^If the fifth argument has the value [SQLITE_TRANSIENT], then ** SQLite makes its own private copy of the data immediately, before ** the sqlite3_bind_*() routine returns. ** ** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that ** is filled with zeroes. ^A zeroblob uses a fixed amount of memory ** (just an integer to hold its size) while it is being processed. ** Zeroblobs are intended to serve as placeholders for BLOBs whose ** content is later written using ** [sqlite3_blob_open | incremental BLOB I/O] routines. ** ^A negative value for the zeroblob results in a zero-length BLOB. ** ** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer ** for the [prepared statement] or with a prepared statement for which ** [sqlite3_step()] has been called more recently than [sqlite3_reset()], ** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() ** routine is passed a [prepared statement] that has been finalized, the ** result is undefined and probably harmful. ** ** ^Bindings are not cleared by the [sqlite3_reset()] routine. ** ^Unbound parameters are interpreted as NULL. ** ** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an ** [error code] if anything goes wrong. ** ^[SQLITE_RANGE] is returned if the parameter ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. ** ** See also: [sqlite3_bind_parameter_count()], ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. */ SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); /* ** CAPI3REF: Number Of SQL Parameters ** ** ^This routine can be used to find the number of [SQL parameters] ** in a [prepared statement]. SQL parameters are tokens of the ** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as ** placeholders for values that are [sqlite3_bind_blob | bound] ** to the parameters at a later time. ** ** ^(This routine actually returns the index of the largest (rightmost) ** parameter. For all forms except ?NNN, this will correspond to the ** number of unique parameters. If parameters of the ?NNN form are used, ** there may be gaps in the list.)^ ** ** See also: [sqlite3_bind_blob|sqlite3_bind()], ** [sqlite3_bind_parameter_name()], and ** [sqlite3_bind_parameter_index()]. */ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); /* ** CAPI3REF: Name Of A Host Parameter ** ** ^The sqlite3_bind_parameter_name(P,N) interface returns ** the name of the N-th [SQL parameter] in the [prepared statement] P. ** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" ** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" ** respectively. ** In other words, the initial ":" or "$" or "@" or "?" ** is included as part of the name.)^ ** ^Parameters of the form "?" without a following integer have no name ** and are referred to as "nameless" or "anonymous parameters". ** ** ^The first host parameter has an index of 1, not 0. ** ** ^If the value N is out of range or if the N-th parameter is ** nameless, then NULL is returned. ^The returned string is ** always in UTF-8 encoding even if the named parameter was ** originally specified as UTF-16 in [sqlite3_prepare16()] or ** [sqlite3_prepare16_v2()]. ** ** See also: [sqlite3_bind_blob|sqlite3_bind()], ** [sqlite3_bind_parameter_count()], and ** [sqlite3_bind_parameter_index()]. */ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); /* ** CAPI3REF: Index Of A Parameter With A Given Name ** ** ^Return the index of an SQL parameter given its name. ^The ** index value returned is suitable for use as the second ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero ** is returned if no matching parameter is found. ^The parameter ** name must be given in UTF-8 even if the original statement ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. ** ** See also: [sqlite3_bind_blob|sqlite3_bind()], ** [sqlite3_bind_parameter_count()], and ** [sqlite3_bind_parameter_index()]. */ SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); /* ** CAPI3REF: Reset All Bindings On A Prepared Statement ** ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset ** the [sqlite3_bind_blob | bindings] on a [prepared statement]. ** ^Use this routine to reset all host parameters to NULL. */ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); /* ** CAPI3REF: Number Of Columns In A Result Set ** ** ^Return the number of columns in the result set returned by the ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL ** statement that does not return data (for example an [UPDATE]). ** ** See also: [sqlite3_data_count()] */ SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); /* ** CAPI3REF: Column Names In A Result Set ** ** ^These routines return the name assigned to a particular column ** in the result set of a [SELECT] statement. ^The sqlite3_column_name() ** interface returns a pointer to a zero-terminated UTF-8 string ** and sqlite3_column_name16() returns a pointer to a zero-terminated ** UTF-16 string. ^The first parameter is the [prepared statement] ** that implements the [SELECT] statement. ^The second parameter is the ** column number. ^The leftmost column is number 0. ** ** ^The returned string pointer is valid until either the [prepared statement] ** is destroyed by [sqlite3_finalize()] or until the next call to ** sqlite3_column_name() or sqlite3_column_name16() on the same column. ** ** ^If sqlite3_malloc() fails during the processing of either routine ** (for example during a conversion from UTF-8 to UTF-16) then a ** NULL pointer is returned. ** ** ^The name of a result column is the value of the "AS" clause for ** that column, if there is an AS clause. If there is no AS clause ** then the name of the column is unspecified and may change from ** one release of SQLite to the next. */ SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); /* ** CAPI3REF: Source Of Data In A Query Result ** ** ^These routines provide a means to determine the database, table, and ** table column that is the origin of a particular result column in ** [SELECT] statement. ** ^The name of the database or table or column can be returned as ** either a UTF-8 or UTF-16 string. ^The _database_ routines return ** the database name, the _table_ routines return the table name, and ** the origin_ routines return the column name. ** ^The returned string is valid until the [prepared statement] is destroyed ** using [sqlite3_finalize()] or until the same information is requested ** again in a different encoding. ** ** ^The names returned are the original un-aliased names of the ** database, table, and column. ** ** ^The first argument to these interfaces is a [prepared statement]. ** ^These functions return information about the Nth result column returned by ** the statement, where N is the second function argument. ** ^The left-most column is column 0 for these routines. ** ** ^If the Nth column returned by the statement is an expression or ** subquery and is not a column value, then all of these functions return ** NULL. ^These routine might also return NULL if a memory allocation error ** occurs. ^Otherwise, they return the name of the attached database, table, ** or column that query result column was extracted from. ** ** ^As with all other SQLite APIs, those whose names end with "16" return ** UTF-16 encoded strings and the other functions return UTF-8. ** ** ^These APIs are only available if the library was compiled with the ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. ** ** If two or more threads call one or more of these routines against the same ** prepared statement and column at the same time then the results are ** undefined. ** ** If two or more threads call one or more ** [sqlite3_column_database_name | column metadata interfaces] ** for the same [prepared statement] and result column ** at the same time then the results are undefined. */ SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); /* ** CAPI3REF: Declared Datatype Of A Query Result ** ** ^(The first parameter is a [prepared statement]. ** If this statement is a [SELECT] statement and the Nth column of the ** returned result set of that [SELECT] is a table column (not an ** expression or subquery) then the declared type of the table ** column is returned.)^ ^If the Nth column of the result set is an ** expression or subquery, then a NULL pointer is returned. ** ^The returned string is always UTF-8 encoded. ** ** ^(For example, given the database schema: ** ** CREATE TABLE t1(c1 VARIANT); ** ** and the following statement to be compiled: ** ** SELECT c1 + 1, c1 FROM t1; ** ** this routine would return the string "VARIANT" for the second result ** column (i==1), and a NULL pointer for the first result column (i==0).)^ ** ** ^SQLite uses dynamic run-time typing. ^So just because a column ** is declared to contain a particular type does not mean that the ** data stored in that column is of the declared type. SQLite is ** strongly typed, but the typing is dynamic not static. ^Type ** is associated with individual values, not with the containers ** used to hold those values. */ SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); /* ** CAPI3REF: Evaluate An SQL Statement ** ** After a [prepared statement] has been prepared using either ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function ** must be called one or more times to evaluate the statement. ** ** The details of the behavior of the sqlite3_step() interface depend ** on whether the statement was prepared using the newer "v2" interface ** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy ** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the ** new "v2" interface is recommended for new applications but the legacy ** interface will continue to be supported. ** ** ^In the legacy interface, the return value will be either [SQLITE_BUSY], ** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. ** ^With the "v2" interface, any of the other [result codes] or ** [extended result codes] might be returned as well. ** ** ^[SQLITE_BUSY] means that 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. ** ** ^[SQLITE_DONE] means that the statement has finished executing ** successfully. sqlite3_step() should not be called again on this virtual ** machine without first calling [sqlite3_reset()] to reset the virtual ** machine back to its initial state. ** ** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] ** is returned each time a new row of data is ready for processing by the ** caller. The values may be accessed using the [column access functions]. ** sqlite3_step() is called again to retrieve the next row of data. ** ** ^[SQLITE_ERROR] means that a run-time error (such as a constraint ** violation) has occurred. sqlite3_step() should not be called again on ** the VM. More information may be found by calling [sqlite3_errmsg()]. ** ^With the legacy interface, a more specific error code (for example, ** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) ** can be obtained by calling [sqlite3_reset()] on the ** [prepared statement]. ^In the "v2" interface, ** the more specific error code is returned directly by sqlite3_step(). ** ** [SQLITE_MISUSE] means that the this routine was called inappropriately. ** Perhaps it was called on a [prepared statement] that has ** already been [sqlite3_finalize | finalized] or on one that had ** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could ** be the case that the same database connection is being used by two or ** more threads at the same moment in time. ** ** For all versions of SQLite up to and including 3.6.23.1, it was required ** after sqlite3_step() returned anything other than [SQLITE_ROW] that ** [sqlite3_reset()] be called before any subsequent invocation of ** sqlite3_step(). Failure to invoke [sqlite3_reset()] in this way would ** result in an [SQLITE_MISUSE] return from sqlite3_step(). But after ** version 3.6.23.1, sqlite3_step() began calling [sqlite3_reset()] ** automatically in this circumstance rather than returning [SQLITE_MISUSE]. ** ** Goofy Interface Alert: In the legacy interface, the sqlite3_step() ** API always returns a generic error code, [SQLITE_ERROR], following any ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call ** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the ** specific [error codes] that better describes the error. ** We admit that this is a goofy design. The problem has been fixed ** with the "v2" interface. If you prepare all of your SQL statements ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, ** then the more specific [error codes] are returned directly ** by sqlite3_step(). The use of the "v2" interface is recommended. */ SQLITE_API int sqlite3_step(sqlite3_stmt*); /* ** CAPI3REF: Number of columns in a result set ** ** ^The sqlite3_data_count(P) interface returns the number of columns in the ** current row of the result set of [prepared statement] P. ** ^If prepared statement P does not have results ready to return ** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of ** interfaces) then sqlite3_data_count(P) returns 0. ** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. ** ** See also: [sqlite3_column_count()] */ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); /* ** CAPI3REF: Fundamental Datatypes ** KEYWORDS: SQLITE_TEXT ** ** ^(Every value in SQLite has one of five fundamental datatypes: ** **
          **
        • 64-bit signed integer **
        • 64-bit IEEE floating point number **
        • string **
        • BLOB **
        • NULL **
        )^ ** ** These constants are codes for each of those types. ** ** Note that the SQLITE_TEXT constant was also used in SQLite version 2 ** for a completely different meaning. Software that links against both ** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not ** SQLITE_TEXT. */ #define SQLITE_INTEGER 1 #define SQLITE_FLOAT 2 #define SQLITE_BLOB 4 #define SQLITE_NULL 5 #ifdef SQLITE_TEXT # undef SQLITE_TEXT #else # define SQLITE_TEXT 3 #endif #define SQLITE3_TEXT 3 /* ** CAPI3REF: Result Values From A Query ** KEYWORDS: {column access functions} ** ** These routines form the "result set" interface. ** ** ^These routines return information about a single column of the current ** result row of a query. ^In every case the first argument is a pointer ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] ** that was returned from [sqlite3_prepare_v2()] or one of its variants) ** and the second argument is the index of the column for which information ** should be returned. ^The leftmost column of the result set has the index 0. ** ^The number of columns in the result can be determined using ** [sqlite3_column_count()]. ** ** If the SQL statement does not currently point to a valid row, or if the ** column index is out of range, the result is undefined. ** These routines may only be called when the most recent call to ** [sqlite3_step()] has returned [SQLITE_ROW] and neither ** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. ** If any of these routines are called after [sqlite3_reset()] or ** [sqlite3_finalize()] or after [sqlite3_step()] has returned ** something other than [SQLITE_ROW], the results are undefined. ** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] ** are called from a different thread while any of these routines ** are pending, then the results are undefined. ** ** ^The sqlite3_column_type() routine returns the ** [SQLITE_INTEGER | datatype code] for the initial data type ** of the result column. ^The returned value is one of [SQLITE_INTEGER], ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value ** returned by sqlite3_column_type() is only meaningful if no type ** conversions have occurred as described below. After a type conversion, ** the value returned by sqlite3_column_type() is undefined. Future ** versions of SQLite may change the behavior of sqlite3_column_type() ** following a type conversion. ** ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() ** routine returns the number of bytes in that BLOB or string. ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts ** the string to UTF-8 and then returns the number of bytes. ** ^If the result is a numeric value then sqlite3_column_bytes() uses ** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns ** the number of bytes in that string. ** ^If the result is NULL, then sqlite3_column_bytes() returns zero. ** ** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16() ** routine returns the number of bytes in that BLOB or string. ** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts ** the string to UTF-16 and then returns the number of bytes. ** ^If the result is a numeric value then sqlite3_column_bytes16() uses ** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns ** the number of bytes in that string. ** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. ** ** ^The values returned by [sqlite3_column_bytes()] and ** [sqlite3_column_bytes16()] do not include the zero terminators at the end ** of the string. ^For clarity: the values returned by ** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of ** bytes in the string, not the number of characters. ** ** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), ** even empty strings, are always zero terminated. ^The return ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. ** ** ^The object returned by [sqlite3_column_value()] is an ** [unprotected sqlite3_value] object. An unprotected sqlite3_value object ** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()]. ** If the [unprotected sqlite3_value] object returned by ** [sqlite3_column_value()] is used in any other way, including calls ** to routines like [sqlite3_value_int()], [sqlite3_value_text()], ** or [sqlite3_value_bytes()], then the behavior is undefined. ** ** These routines attempt to convert the value where appropriate. ^For ** example, if the internal representation is FLOAT and a text result ** is requested, [sqlite3_snprintf()] is used internally to perform the ** conversion automatically. ^(The following table details the conversions ** that are applied: ** **
        ** **
        Internal
        Type
        Requested
        Type
        Conversion ** **
        NULL INTEGER Result is 0 **
        NULL FLOAT Result is 0.0 **
        NULL TEXT Result is NULL pointer **
        NULL BLOB Result is NULL pointer **
        INTEGER FLOAT Convert from integer to float **
        INTEGER TEXT ASCII rendering of the integer **
        INTEGER BLOB Same as INTEGER->TEXT **
        FLOAT INTEGER Convert from float to integer **
        FLOAT TEXT ASCII rendering of the float **
        FLOAT BLOB Same as FLOAT->TEXT **
        TEXT INTEGER Use atoi() **
        TEXT FLOAT Use atof() **
        TEXT BLOB No change **
        BLOB INTEGER Convert to TEXT then use atoi() **
        BLOB FLOAT Convert to TEXT then use atof() **
        BLOB TEXT Add a zero terminator if needed **
        **
        )^ ** ** The table above makes reference to standard C library functions atoi() ** and atof(). SQLite does not really use these functions. It has its ** own equivalent internal routines. The atoi() and atof() names are ** used in the table for brevity and because they are familiar to most ** C programmers. ** ** Note that when type conversions occur, pointers returned by prior ** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or ** sqlite3_column_text16() may be invalidated. ** Type conversions and pointer invalidations might occur ** in the following cases: ** **
          **
        • The initial content is a BLOB and sqlite3_column_text() or ** sqlite3_column_text16() is called. A zero-terminator might ** need to be added to the string.
        • **
        • The initial content is UTF-8 text and sqlite3_column_bytes16() or ** sqlite3_column_text16() is called. The content must be converted ** to UTF-16.
        • **
        • The initial content is UTF-16 text and sqlite3_column_bytes() or ** sqlite3_column_text() is called. The content must be converted ** to UTF-8.
        • **
        ** ** ^Conversions between UTF-16be and UTF-16le are always done in place and do ** not invalidate a prior pointer, though of course the content of the buffer ** that the prior pointer references will have been modified. Other kinds ** of conversion are done in place when it is possible, but sometimes they ** are not possible and in those cases prior pointers are invalidated. ** ** The safest and easiest to remember policy is to invoke these routines ** in one of the following ways: ** **
          **
        • sqlite3_column_text() followed by sqlite3_column_bytes()
        • **
        • sqlite3_column_blob() followed by sqlite3_column_bytes()
        • **
        • sqlite3_column_text16() followed by sqlite3_column_bytes16()
        • **
        ** ** In other words, you should call sqlite3_column_text(), ** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result ** into the desired format, then invoke sqlite3_column_bytes() or ** sqlite3_column_bytes16() to find the size of the result. Do not mix calls ** to sqlite3_column_text() or sqlite3_column_blob() with calls to ** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() ** with calls to sqlite3_column_bytes(). ** ** ^The pointers returned are valid until a type conversion occurs as ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or ** [sqlite3_finalize()] is called. ^The memory space used to hold strings ** and BLOBs is freed automatically. Do not pass the pointers returned ** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into ** [sqlite3_free()]. ** ** ^(If a memory allocation error occurs during the evaluation of any ** of these routines, a default value is returned. The default value ** is either the integer 0, the floating point number 0.0, or a NULL ** pointer. Subsequent calls to [sqlite3_errcode()] will return ** [SQLITE_NOMEM].)^ */ SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); /* ** CAPI3REF: Destroy A Prepared Statement Object ** ** ^The sqlite3_finalize() function is called to delete a [prepared statement]. ** ^If the most recent evaluation of the statement encountered no errors or ** or if the statement is never been evaluated, then sqlite3_finalize() returns ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then ** sqlite3_finalize(S) returns the appropriate [error code] or ** [extended error code]. ** ** ^The sqlite3_finalize(S) routine can be called at any point during ** the life cycle of [prepared statement] S: ** before statement S is ever evaluated, after ** one or more calls to [sqlite3_reset()], or after any call ** to [sqlite3_step()] regardless of whether or not the statement has ** completed execution. ** ** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. ** ** The application must finalize every [prepared statement] in order to avoid ** resource leaks. It is a grievous error for the application to try to use ** a prepared statement after it has been finalized. Any use of a prepared ** statement after it has been finalized can result in undefined and ** undesirable behavior such as segfaults and heap corruption. */ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); /* ** CAPI3REF: Reset A Prepared Statement Object ** ** The sqlite3_reset() function is called to reset a [prepared statement] ** object back to its initial state, ready to be re-executed. ** ^Any SQL statement variables that had values bound to them using ** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. ** Use [sqlite3_clear_bindings()] to reset the bindings. ** ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S ** back to the beginning of its program. ** ** ^If the most recent call to [sqlite3_step(S)] for the ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], ** or if [sqlite3_step(S)] has never before been called on S, ** then [sqlite3_reset(S)] returns [SQLITE_OK]. ** ** ^If the most recent call to [sqlite3_step(S)] for the ** [prepared statement] S indicated an error, then ** [sqlite3_reset(S)] returns an appropriate [error code]. ** ** ^The [sqlite3_reset(S)] interface does not change the values ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. */ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); /* ** CAPI3REF: Create Or Redefine SQL Functions ** KEYWORDS: {function creation routines} ** KEYWORDS: {application-defined SQL function} ** KEYWORDS: {application-defined SQL functions} ** ** ^These functions (collectively known as "function creation routines") ** are used to add SQL functions or aggregates or to redefine the behavior ** of existing SQL functions or aggregates. The only differences between ** these routines are the text encoding expected for ** the the second parameter (the name of the function being created) ** and the presence or absence of a destructor callback for ** the application data pointer. ** ** ^The first parameter is the [database connection] to which the SQL ** function is to be added. ^If an application uses more than one database ** connection then application-defined SQL functions must be added ** to each database connection separately. ** ** ^The second parameter is the name of the SQL function to be created or ** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 ** representation, exclusive of the zero-terminator. ^Note that the name ** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. ** ^Any attempt to create a function with a longer name ** will result in [SQLITE_MISUSE] being returned. ** ** ^The third parameter (nArg) ** is the number of arguments that the SQL function or ** aggregate takes. ^If this parameter is -1, then the SQL function or ** aggregate may take any number of arguments between 0 and the limit ** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third ** parameter is less than -1 or greater than 127 then the behavior is ** undefined. ** ** ^The fourth parameter, eTextRep, specifies what ** [SQLITE_UTF8 | text encoding] this SQL function prefers for ** its parameters. Every SQL function implementation must be able to work ** with UTF-8, UTF-16le, or UTF-16be. But some implementations may be ** more efficient with one encoding than another. ^An application may ** invoke sqlite3_create_function() or sqlite3_create_function16() multiple ** times with the same function but with different values of eTextRep. ** ^When multiple implementations of the same function are available, SQLite ** will pick the one that involves the least amount of data conversion. ** If there is only a single implementation which does not care what text ** encoding is used, then the fourth argument should be [SQLITE_ANY]. ** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** ** ^The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are ** pointers to C-language functions that implement the SQL function or ** aggregate. ^A scalar SQL function requires an implementation of the xFunc ** callback only; NULL pointers must be passed as the xStep and xFinal ** parameters. ^An aggregate SQL function requires an implementation of xStep ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing ** SQL function or aggregate, pass NULL poiners for all three function ** callbacks. ** ** ^(If the tenth parameter to sqlite3_create_function_v2() is not NULL, ** then it is destructor for the application data pointer. ** The destructor is invoked when the function is deleted, either by being ** overloaded or when the database connection closes.)^ ** ^The destructor is also invoked if the call to ** sqlite3_create_function_v2() fails. ** ^When the destructor callback of the tenth parameter is invoked, it ** is passed a single argument which is a copy of the application data ** pointer which was the fifth parameter to sqlite3_create_function_v2(). ** ** ^It is permitted to register multiple implementations of the same ** functions with the same name but with either differing numbers of ** arguments or differing preferred text encodings. ^SQLite will use ** the implementation that most closely matches the way in which the ** SQL function is used. ^A function implementation with a non-negative ** nArg parameter is a better match than a function implementation with ** a negative nArg. ^A function where the preferred text encoding ** matches the database encoding is a better ** match than a function where the encoding is different. ** ^A function where the encoding difference is between UTF16le and UTF16be ** is a closer match than a function where the encoding difference is ** between UTF8 and UTF16. ** ** ^Built-in functions may be overloaded by new application-defined functions. ** ** ^An application-defined function is permitted to call other ** SQLite interfaces. However, such calls must not ** close the database connection nor finalize or reset the prepared ** statement in which the function is running. */ SQLITE_API int sqlite3_create_function( sqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void *pApp, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*) ); SQLITE_API int sqlite3_create_function16( sqlite3 *db, const void *zFunctionName, int nArg, int eTextRep, void *pApp, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*) ); SQLITE_API int sqlite3_create_function_v2( sqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void *pApp, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*), void(*xDestroy)(void*) ); /* ** CAPI3REF: Text Encodings ** ** These constant define integer codes that represent the various ** text encodings supported by SQLite. */ #define SQLITE_UTF8 1 #define SQLITE_UTF16LE 2 #define SQLITE_UTF16BE 3 #define SQLITE_UTF16 4 /* Use native byte order */ #define SQLITE_ANY 5 /* sqlite3_create_function only */ #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ /* ** CAPI3REF: Deprecated Functions ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain ** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid ** the use of these functions. To help encourage people to avoid ** using these functions, we are not going to tell you what they do. */ #ifndef SQLITE_OMIT_DEPRECATED SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64); #endif /* ** CAPI3REF: Obtaining SQL Function Parameter Values ** ** The C-language implementation of SQL functions and aggregates uses ** this set of interface routines to access the parameter values on ** the function or aggregate. ** ** The xFunc (for scalar functions) or xStep (for aggregates) parameters ** to [sqlite3_create_function()] and [sqlite3_create_function16()] ** define callbacks that implement the SQL functions and aggregates. ** The 4th parameter to these callbacks is an array of pointers to ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for ** each parameter to the SQL function. These routines are used to ** extract values from the [sqlite3_value] objects. ** ** These routines work only with [protected sqlite3_value] objects. ** Any attempt to use these routines on an [unprotected sqlite3_value] ** object results in undefined behavior. ** ** ^These routines work just like the corresponding [column access functions] ** except that these routines take a single [protected sqlite3_value] object ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. ** ** ^The sqlite3_value_text16() interface extracts a UTF-16 string ** in the native byte-order of the host machine. ^The ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces ** extract UTF-16 strings as big-endian and little-endian respectively. ** ** ^(The sqlite3_value_numeric_type() interface attempts to apply ** numeric affinity to the value. This means that an attempt is ** made to convert the value to an integer or floating point. If ** such a conversion is possible without loss of information (in other ** words, if the value is a string that looks like a number) ** then the conversion is performed. Otherwise no conversion occurs. ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ ** ** Please pay particular attention to the fact that the pointer returned ** from [sqlite3_value_blob()], [sqlite3_value_text()], or ** [sqlite3_value_text16()] can be invalidated by a subsequent call to ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], ** or [sqlite3_value_text16()]. ** ** These routines must be called from the same thread as ** the SQL function that supplied the [sqlite3_value*] parameters. */ SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); SQLITE_API int sqlite3_value_bytes(sqlite3_value*); SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); SQLITE_API double sqlite3_value_double(sqlite3_value*); SQLITE_API int sqlite3_value_int(sqlite3_value*); SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); SQLITE_API int sqlite3_value_type(sqlite3_value*); SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); /* ** CAPI3REF: Obtain Aggregate Function Context ** ** Implementations of aggregate SQL functions use this ** routine to allocate memory for storing their state. ** ** ^The first time the sqlite3_aggregate_context(C,N) routine is called ** for a particular aggregate function, SQLite ** allocates N of memory, zeroes out that memory, and returns a pointer ** to the new memory. ^On second and subsequent calls to ** sqlite3_aggregate_context() for the same aggregate function instance, ** the same buffer is returned. Sqlite3_aggregate_context() is normally ** called once for each invocation of the xStep callback and then one ** last time when the xFinal callback is invoked. ^(When no rows match ** an aggregate query, the xStep() callback of the aggregate function ** implementation is never called and xFinal() is called exactly once. ** In those cases, sqlite3_aggregate_context() might be called for the ** first time from within xFinal().)^ ** ** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is ** less than or equal to zero or if a memory allocate error occurs. ** ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the ** value of N in subsequent call to sqlite3_aggregate_context() within ** the same aggregate function instance will not resize the memory ** allocation.)^ ** ** ^SQLite automatically frees the memory allocated by ** sqlite3_aggregate_context() when the aggregate query concludes. ** ** The first parameter must be a copy of the ** [sqlite3_context | SQL function context] that is the first parameter ** to the xStep or xFinal callback routine that implements the aggregate ** function. ** ** This routine must be called from the same thread in which ** the aggregate SQL function is running. */ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); /* ** CAPI3REF: User Data For Functions ** ** ^The sqlite3_user_data() interface returns a copy of ** the pointer that was the pUserData parameter (the 5th parameter) ** of the [sqlite3_create_function()] ** and [sqlite3_create_function16()] routines that originally ** registered the application defined function. ** ** This routine must be called from the same thread in which ** the application-defined function is running. */ SQLITE_API void *sqlite3_user_data(sqlite3_context*); /* ** CAPI3REF: Database Connection For Functions ** ** ^The sqlite3_context_db_handle() interface returns a copy of ** the pointer to the [database connection] (the 1st parameter) ** of the [sqlite3_create_function()] ** and [sqlite3_create_function16()] routines that originally ** registered the application defined function. */ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); /* ** CAPI3REF: Function Auxiliary Data ** ** The following two functions may be used by scalar SQL functions to ** associate metadata with argument values. If the same value is passed to ** multiple invocations of the same SQL function during query execution, under ** some circumstances the associated metadata may be preserved. This may ** be used, for example, to add a regular-expression matching scalar ** function. The compiled version of the regular expression is stored as ** metadata associated with the SQL value passed as the regular expression ** pattern. The compiled regular expression can be reused on multiple ** invocations of the same function so that the original pattern string ** does not need to be recompiled on each invocation. ** ** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata ** associated by the sqlite3_set_auxdata() function with the Nth argument ** value to the application-defined function. ^If no metadata has been ever ** been set for the Nth argument of the function, or if the corresponding ** function parameter has changed since the meta-data was set, ** then sqlite3_get_auxdata() returns a NULL pointer. ** ** ^The sqlite3_set_auxdata() interface saves the metadata ** pointed to by its 3rd parameter as the metadata for the N-th ** argument of the application-defined function. Subsequent ** calls to sqlite3_get_auxdata() might return this data, if it has ** not been destroyed. ** ^If it is not NULL, SQLite will invoke the destructor ** function given by the 4th parameter to sqlite3_set_auxdata() on ** the metadata when the corresponding function parameter changes ** or when the SQL statement completes, whichever comes first. ** ** SQLite is free to call the destructor and drop metadata on any ** parameter of any function at any time. ^The only guarantee is that ** the destructor will be called before the metadata is dropped. ** ** ^(In practice, metadata is preserved between function calls for ** expressions that are constant at compile time. This includes literal ** values and [parameters].)^ ** ** These routines must be called from the same thread in which ** the SQL function is running. */ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); /* ** CAPI3REF: Constants Defining Special Destructor Behavior ** ** These are special values for the destructor that is passed in as the ** final argument to routines like [sqlite3_result_blob()]. ^If the destructor ** argument is SQLITE_STATIC, it means that the content pointer is constant ** and will never change. It does not need to be destroyed. ^The ** SQLITE_TRANSIENT value means that the content will likely change in ** the near future and that SQLite should make its own private copy of ** the content before returning. ** ** The typedef is necessary to work around problems in certain ** C++ compilers. See ticket #2191. */ typedef void (*sqlite3_destructor_type)(void*); #define SQLITE_STATIC ((sqlite3_destructor_type)0) #define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) /* ** CAPI3REF: Setting The Result Of An SQL Function ** ** These routines are used by the xFunc or xFinal callbacks that ** implement SQL functions and aggregates. See ** [sqlite3_create_function()] and [sqlite3_create_function16()] ** for additional information. ** ** These functions work very much like the [parameter binding] family of ** functions used to bind values to host parameters in prepared statements. ** Refer to the [SQL parameter] documentation for additional information. ** ** ^The sqlite3_result_blob() interface sets the result from ** an application-defined function to be the BLOB whose content is pointed ** to by the second parameter and which is N bytes long where N is the ** third parameter. ** ** ^The sqlite3_result_zeroblob() interfaces set the result of ** the application-defined function to be a BLOB containing all zero ** bytes and N bytes in size, where N is the value of the 2nd parameter. ** ** ^The sqlite3_result_double() interface sets the result from ** an application-defined function to be a floating point value specified ** by its 2nd argument. ** ** ^The sqlite3_result_error() and sqlite3_result_error16() functions ** cause the implemented SQL function to throw an exception. ** ^SQLite uses the string pointed to by the ** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() ** as the text of an error message. ^SQLite interprets the error ** message string from sqlite3_result_error() as UTF-8. ^SQLite ** interprets the string from sqlite3_result_error16() as UTF-16 in native ** byte order. ^If the third parameter to sqlite3_result_error() ** or sqlite3_result_error16() is negative then SQLite takes as the error ** message all text up through the first zero character. ** ^If the third parameter to sqlite3_result_error() or ** sqlite3_result_error16() is non-negative then SQLite takes that many ** bytes (not characters) from the 2nd parameter as the error message. ** ^The sqlite3_result_error() and sqlite3_result_error16() ** routines make a private copy of the error message text before ** they return. Hence, the calling function can deallocate or ** modify the text after they return without harm. ** ^The sqlite3_result_error_code() function changes the error code ** returned by SQLite as a result of an error in a function. ^By default, ** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() ** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. ** ** ^The sqlite3_result_toobig() interface causes SQLite to throw an error ** indicating that a string or BLOB is too long to represent. ** ** ^The sqlite3_result_nomem() interface causes SQLite to throw an error ** indicating that a memory allocation failed. ** ** ^The sqlite3_result_int() interface sets the return value ** of the application-defined function to be the 32-bit signed integer ** value given in the 2nd argument. ** ^The sqlite3_result_int64() interface sets the return value ** of the application-defined function to be the 64-bit signed integer ** value given in the 2nd argument. ** ** ^The sqlite3_result_null() interface sets the return value ** of the application-defined function to be NULL. ** ** ^The sqlite3_result_text(), sqlite3_result_text16(), ** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces ** set the return value of the application-defined function to be ** a text string which is represented as UTF-8, UTF-16 native byte order, ** UTF-16 little endian, or UTF-16 big endian, respectively. ** ^SQLite takes the text result from the application from ** the 2nd parameter of the sqlite3_result_text* interfaces. ** ^If the 3rd parameter to the sqlite3_result_text* interfaces ** is negative, then SQLite takes result text from the 2nd parameter ** through the first zero character. ** ^If the 3rd parameter to the sqlite3_result_text* interfaces ** is non-negative, then as many bytes (not characters) of the text ** pointed to by the 2nd parameter are taken as the application-defined ** function result. ** ^If the 4th parameter to the sqlite3_result_text* interfaces ** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that ** function as the destructor on the text or BLOB result when it has ** finished using that result. ** ^If the 4th parameter to the sqlite3_result_text* interfaces or to ** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite ** assumes that the text or BLOB result is in constant space and does not ** copy the content of the parameter nor call a destructor on the content ** when it has finished using that result. ** ^If the 4th parameter to the sqlite3_result_text* interfaces ** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT ** then SQLite makes a copy of the result into space obtained from ** from [sqlite3_malloc()] before it returns. ** ** ^The sqlite3_result_value() interface sets the result of ** the application-defined function to be a copy the ** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The ** sqlite3_result_value() interface makes a copy of the [sqlite3_value] ** so that the [sqlite3_value] specified in the parameter may change or ** be deallocated after sqlite3_result_value() returns without harm. ** ^A [protected sqlite3_value] object may always be used where an ** [unprotected sqlite3_value] object is required, so either ** kind of [sqlite3_value] object can be used with this interface. ** ** If these routines are called from within the different thread ** than the one containing the application-defined function that received ** the [sqlite3_context] pointer, the results are undefined. */ SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); SQLITE_API void sqlite3_result_double(sqlite3_context*, double); SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); SQLITE_API void sqlite3_result_int(sqlite3_context*, int); SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); SQLITE_API void sqlite3_result_null(sqlite3_context*); SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); /* ** CAPI3REF: Define New Collating Sequences ** ** ^These functions add, remove, or modify a [collation] associated ** with the [database connection] specified as the first argument. ** ** ^The name of the collation is a UTF-8 string ** for sqlite3_create_collation() and sqlite3_create_collation_v2() ** and a UTF-16 string in native byte order for sqlite3_create_collation16(). ** ^Collation names that compare equal according to [sqlite3_strnicmp()] are ** considered to be the same name. ** ** ^(The third argument (eTextRep) must be one of the constants: **
          **
        • [SQLITE_UTF8], **
        • [SQLITE_UTF16LE], **
        • [SQLITE_UTF16BE], **
        • [SQLITE_UTF16], or **
        • [SQLITE_UTF16_ALIGNED]. **
        )^ ** ^The eTextRep argument determines the encoding of strings passed ** to the collating function callback, xCallback. ** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep ** force strings to be UTF16 with native byte order. ** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin ** on an even byte address. ** ** ^The fourth argument, pArg, is a application data pointer that is passed ** through as the first argument to the collating function callback. ** ** ^The fifth argument, xCallback, is a pointer to the collating function. ** ^Multiple collating functions can be registered using the same name but ** with different eTextRep parameters and SQLite will use whichever ** function requires the least amount of data transformation. ** ^If the xCallback argument is NULL then the collating function is ** deleted. ^When all collating functions having the same name are deleted, ** that collation is no longer usable. ** ** ^The collating function callback is invoked with a copy of the pArg ** application data pointer and with two strings in the encoding specified ** by the eTextRep argument. The collating function must return an ** integer that is negative, zero, or positive ** if the first string is less than, equal to, or greater than the second, ** respectively. A collating function must alway return the same answer ** given the same inputs. If two or more collating functions are registered ** to the same collation name (using different eTextRep values) then all ** must give an equivalent answer when invoked with equivalent strings. ** The collating function must obey the following properties for all ** strings A, B, and C: ** **
          **
        1. If A==B then B==A. **
        2. If A==B and B==C then A==C. **
        3. If A<B THEN B>A. **
        4. If A<B and B<C then A<C. **
        ** ** If a collating function fails any of the above constraints and that ** collating function is registered and used, then the behavior of SQLite ** is undefined. ** ** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() ** with the addition that the xDestroy callback is invoked on pArg when ** the collating function is deleted. ** ^Collating functions are deleted when they are overridden by later ** calls to the collation creation functions or when the ** [database connection] is closed using [sqlite3_close()]. ** ** ^The xDestroy callback is not called if the ** sqlite3_create_collation_v2() function fails. Applications that invoke ** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should ** check the return code and dispose of the application data pointer ** themselves rather than expecting SQLite to deal with it for them. ** This is different from every other SQLite interface. The inconsistency ** is unfortunate but cannot be changed without breaking backwards ** compatibility. ** ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. */ SQLITE_API int sqlite3_create_collation( sqlite3*, const char *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*) ); SQLITE_API int sqlite3_create_collation_v2( sqlite3*, const char *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*), void(*xDestroy)(void*) ); SQLITE_API int sqlite3_create_collation16( sqlite3*, const void *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*) ); /* ** CAPI3REF: Collation Needed Callbacks ** ** ^To avoid having to register all collation sequences before a database ** can be used, a single callback function may be registered with the ** [database connection] to be invoked whenever an undefined collation ** sequence is required. ** ** ^If the function is registered using the sqlite3_collation_needed() API, ** then it is passed the names of undefined collation sequences as strings ** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, ** the names are passed as UTF-16 in machine native byte order. ** ^A call to either function replaces the existing collation-needed callback. ** ** ^(When the callback is invoked, the first argument passed is a copy ** of the second argument to sqlite3_collation_needed() or ** sqlite3_collation_needed16(). The second argument is the database ** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], ** or [SQLITE_UTF16LE], indicating the most desirable form of the collation ** sequence function required. The fourth parameter is the name of the ** required collation sequence.)^ ** ** The callback function should register the desired collation using ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or ** [sqlite3_create_collation_v2()]. */ SQLITE_API int sqlite3_collation_needed( sqlite3*, void*, void(*)(void*,sqlite3*,int eTextRep,const char*) ); SQLITE_API int sqlite3_collation_needed16( sqlite3*, void*, void(*)(void*,sqlite3*,int eTextRep,const void*) ); #ifdef SQLITE_HAS_CODEC /* ** Specify the key for an encrypted database. This routine should be ** called right after sqlite3_open(). ** ** The code to implement this API is not available in the public release ** of SQLite. */ SQLITE_API int sqlite3_key( sqlite3 *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The key */ ); /* ** Change the key on an open database. If the current database is not ** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the ** database is decrypted. ** ** The code to implement this API is not available in the public release ** of SQLite. */ SQLITE_API int sqlite3_rekey( sqlite3 *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The new key */ ); /* ** Specify the activation key for a SEE database. Unless ** activated, none of the SEE routines will work. */ SQLITE_API void sqlite3_activate_see( const char *zPassPhrase /* Activation phrase */ ); #endif #ifdef SQLITE_ENABLE_CEROD /* ** Specify the activation key for a CEROD database. Unless ** activated, none of the CEROD routines will work. */ SQLITE_API void sqlite3_activate_cerod( const char *zPassPhrase /* Activation phrase */ ); #endif /* ** CAPI3REF: Suspend Execution For A Short Time ** ** The sqlite3_sleep() function causes the current thread to suspend execution ** for at least a number of milliseconds specified in its parameter. ** ** If the operating system does not support sleep requests with ** millisecond time resolution, then the time will be rounded up to ** the nearest second. The number of milliseconds of sleep actually ** requested from the operating system is returned. ** ** ^SQLite implements this interface by calling the xSleep() ** method of the default [sqlite3_vfs] object. If the xSleep() method ** of the default VFS is not implemented correctly, or not implemented at ** all, then the behavior of sqlite3_sleep() may deviate from the description ** in the previous paragraphs. */ SQLITE_API int sqlite3_sleep(int); /* ** CAPI3REF: Name Of The Folder Holding Temporary Files ** ** ^(If this global variable is made to point to a string which is ** the name of a folder (a.k.a. directory), then all temporary files ** created by SQLite when using a built-in [sqlite3_vfs | VFS] ** will be placed in that directory.)^ ^If this variable ** is a NULL pointer, then SQLite performs a search for an appropriate ** temporary file directory. ** ** It is not safe to read or modify this variable in more than one ** thread at a time. It is not safe to read or modify this variable ** if a [database connection] is being used at the same time in a separate ** thread. ** It is intended that this variable be set once ** as part of process initialization and before any SQLite interface ** routines have been called and that this variable remain unchanged ** thereafter. ** ** ^The [temp_store_directory pragma] may modify this variable and cause ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, ** the [temp_store_directory pragma] always assumes that any string ** that this variable points to is held in memory obtained from ** [sqlite3_malloc] and the pragma may attempt to free that memory ** using [sqlite3_free]. ** Hence, if this variable is modified directly, either it should be ** made NULL or made to point to memory obtained from [sqlite3_malloc] ** or else the use of the [temp_store_directory pragma] should be avoided. */ SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; /* ** CAPI3REF: Test For Auto-Commit Mode ** KEYWORDS: {autocommit mode} ** ** ^The sqlite3_get_autocommit() interface returns non-zero or ** zero if the given database connection is or is not in autocommit mode, ** respectively. ^Autocommit mode is on by default. ** ^Autocommit mode is disabled by a [BEGIN] statement. ** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. ** ** If certain kinds of errors occur on a statement within a multi-statement ** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], ** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the ** transaction might be rolled back automatically. The only way to ** find out whether SQLite automatically rolled back the transaction after ** an error is to use this function. ** ** If another thread changes the autocommit status of the database ** connection while this routine is running, then the return value ** is undefined. */ SQLITE_API int sqlite3_get_autocommit(sqlite3*); /* ** CAPI3REF: Find The Database Handle Of A Prepared Statement ** ** ^The sqlite3_db_handle interface returns the [database connection] handle ** to which a [prepared statement] belongs. ^The [database connection] ** returned by sqlite3_db_handle is the same [database connection] ** that was the first argument ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to ** create the statement in the first place. */ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); /* ** CAPI3REF: Find the next prepared statement ** ** ^This interface returns a pointer to the next [prepared statement] after ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL ** then this interface returns a pointer to the first prepared statement ** associated with the database connection pDb. ^If no prepared statement ** satisfies the conditions of this routine, it returns NULL. ** ** The [database connection] pointer D in a call to ** [sqlite3_next_stmt(D,S)] must refer to an open database ** connection and in particular must not be a NULL pointer. */ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); /* ** CAPI3REF: Commit And Rollback Notification Callbacks ** ** ^The sqlite3_commit_hook() interface registers a callback ** function to be invoked whenever a transaction is [COMMIT | committed]. ** ^Any callback set by a previous call to sqlite3_commit_hook() ** for the same database connection is overridden. ** ^The sqlite3_rollback_hook() interface registers a callback ** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. ** ^Any callback set by a previous call to sqlite3_rollback_hook() ** for the same database connection is overridden. ** ^The pArg argument is passed through to the callback. ** ^If the callback on a commit hook function returns non-zero, ** then the commit is converted into a rollback. ** ** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions ** return the P argument from the previous call of the same function ** on the same [database connection] D, or NULL for ** the first call for each function on D. ** ** The callback implementation must not do anything that will modify ** the database connection that invoked the callback. Any actions ** to modify the database connection must be deferred until after the ** completion of the [sqlite3_step()] call that triggered the commit ** or rollback hook in the first place. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** ** ^Registering a NULL function disables the callback. ** ** ^When the commit hook callback routine returns zero, the [COMMIT] ** operation is allowed to continue normally. ^If the commit hook ** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK]. ** ^The rollback hook is invoked on a rollback that results from a commit ** hook returning non-zero, just as it would be with any other rollback. ** ** ^For the purposes of this API, a transaction is said to have been ** rolled back if an explicit "ROLLBACK" statement is executed, or ** an error or constraint causes an implicit rollback to occur. ** ^The rollback callback is not invoked if a transaction is ** automatically rolled back because the database connection is closed. ** ** See also the [sqlite3_update_hook()] interface. */ SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); /* ** CAPI3REF: Data Change Notification Callbacks ** ** ^The sqlite3_update_hook() interface registers a callback function ** with the [database connection] identified by the first argument ** to be invoked whenever a row is updated, inserted or deleted. ** ^Any callback set by a previous call to this function ** for the same database connection is overridden. ** ** ^The second argument is a pointer to the function to invoke when a ** row is updated, inserted or deleted. ** ^The first argument to the callback is a copy of the third argument ** to sqlite3_update_hook(). ** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], ** or [SQLITE_UPDATE], depending on the operation that caused the callback ** to be invoked. ** ^The third and fourth arguments to the callback contain pointers to the ** database and table name containing the affected row. ** ^The final callback parameter is the [rowid] of the row. ** ^In the case of an update, this is the [rowid] after the update takes place. ** ** ^(The update hook is not invoked when internal system tables are ** modified (i.e. sqlite_master and sqlite_sequence).)^ ** ** ^In the current implementation, the update hook ** is not invoked when duplication rows are deleted because of an ** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook ** invoked when rows are deleted using the [truncate optimization]. ** The exceptions defined in this paragraph might change in a future ** release of SQLite. ** ** The update hook implementation must not do anything that will modify ** the database connection that invoked the update hook. Any actions ** to modify the database connection must be deferred until after the ** completion of the [sqlite3_step()] call that triggered the update hook. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** ** ^The sqlite3_update_hook(D,C,P) function ** returns the P argument from the previous call ** on the same [database connection] D, or NULL for ** the first call on D. ** ** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()] ** interfaces. */ SQLITE_API void *sqlite3_update_hook( sqlite3*, void(*)(void *,int ,char const *,char const *,sqlite3_int64), void* ); /* ** CAPI3REF: Enable Or Disable Shared Pager Cache ** KEYWORDS: {shared cache} ** ** ^(This routine enables or disables the sharing of the database cache ** and schema data structures between [database connection | connections] ** to the same database. Sharing is enabled if the argument is true ** and disabled if the argument is false.)^ ** ** ^Cache sharing is enabled and disabled for an entire process. ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite, ** sharing was enabled or disabled for each thread separately. ** ** ^(The cache sharing mode set by this interface effects all subsequent ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. ** Existing database connections continue use the sharing mode ** that was in effect at the time they were opened.)^ ** ** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled ** successfully. An [error code] is returned otherwise.)^ ** ** ^Shared cache is disabled by default. But this might change in ** future releases of SQLite. Applications that care about shared ** cache setting should set it explicitly. ** ** See Also: [SQLite Shared-Cache Mode] */ SQLITE_API int sqlite3_enable_shared_cache(int); /* ** CAPI3REF: Attempt To Free Heap Memory ** ** ^The sqlite3_release_memory() interface attempts to free N bytes ** of heap memory by deallocating non-essential memory allocations ** held by the database library. Memory used to cache database ** pages to improve performance is an example of non-essential memory. ** ^sqlite3_release_memory() returns the number of bytes actually freed, ** which might be more or less than the amount requested. ** ^The sqlite3_release_memory() routine is a no-op returning zero ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. */ SQLITE_API int sqlite3_release_memory(int); /* ** CAPI3REF: Impose A Limit On Heap Size ** ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the ** soft limit on the amount of heap memory that may be allocated by SQLite. ** ^SQLite strives to keep heap memory utilization below the soft heap ** limit by reducing the number of pages held in the page cache ** as heap memory usages approaches the limit. ** ^The soft heap limit is "soft" because even though SQLite strives to stay ** below the limit, it will exceed the limit rather than generate ** an [SQLITE_NOMEM] error. In other words, the soft heap limit ** is advisory only. ** ** ^The return value from sqlite3_soft_heap_limit64() is the size of ** the soft heap limit prior to the call. ^If the argument N is negative ** then no change is made to the soft heap limit. Hence, the current ** size of the soft heap limit can be determined by invoking ** sqlite3_soft_heap_limit64() with a negative argument. ** ** ^If the argument N is zero then the soft heap limit is disabled. ** ** ^(The soft heap limit is not enforced in the current implementation ** if one or more of following conditions are true: ** **
          **
        • The soft heap limit is set to zero. **
        • Memory accounting is disabled using a combination of the ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. **
        • An alternative page cache implementation is specifed using ** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...). **
        • The page cache allocates from its own memory pool supplied ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than ** from the heap. **
        )^ ** ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], ** the soft heap limit is enforced on every memory allocation. Without ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced ** when memory is allocated by the page cache. Testing suggests that because ** the page cache is the predominate memory user in SQLite, most ** applications will achieve adequate soft heap limit enforcement without ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT]. ** ** The circumstances under which SQLite will enforce the soft heap limit may ** changes in future releases of SQLite. */ SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); /* ** CAPI3REF: Deprecated Soft Heap Limit Interface ** DEPRECATED ** ** This is a deprecated version of the [sqlite3_soft_heap_limit64()] ** interface. This routine is provided for historical compatibility ** only. All new applications should use the ** [sqlite3_soft_heap_limit64()] interface rather than this one. */ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); /* ** CAPI3REF: Extract Metadata About A Column Of A Table ** ** ^This routine returns metadata about a specific column of a specific ** database table accessible using the [database connection] handle ** passed as the first function argument. ** ** ^The column is identified by the second, third and fourth parameters to ** this function. ^The second parameter is either the name of the database ** (i.e. "main", "temp", or an attached database) containing the specified ** table or NULL. ^If it is NULL, then all attached databases are searched ** for the table using the same algorithm used by the database engine to ** resolve unqualified table references. ** ** ^The third and fourth parameters to this function are the table and column ** name of the desired column, respectively. Neither of these parameters ** may be NULL. ** ** ^Metadata is returned by writing to the memory locations passed as the 5th ** and subsequent parameters to this function. ^Any of these arguments may be ** NULL, in which case the corresponding element of metadata is omitted. ** ** ^(
        ** **
        Parameter Output
        Type
        Description ** **
        5th const char* Data type **
        6th const char* Name of default collation sequence **
        7th int True if column has a NOT NULL constraint **
        8th int True if column is part of the PRIMARY KEY **
        9th int True if column is [AUTOINCREMENT] **
        **
        )^ ** ** ^The memory pointed to by the character pointers returned for the ** declaration type and collation sequence is valid only until the next ** call to any SQLite API function. ** ** ^If the specified table is actually a view, an [error code] is returned. ** ** ^If the specified column is "rowid", "oid" or "_rowid_" and an ** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output ** parameters are set for the explicitly declared column. ^(If there is no ** explicitly declared [INTEGER PRIMARY KEY] column, then the output ** parameters are set as follows: ** **
        **     data type: "INTEGER"
        **     collation sequence: "BINARY"
        **     not null: 0
        **     primary key: 1
        **     auto increment: 0
        ** 
        )^ ** ** ^(This function may load one or more schemas from database files. If an ** error occurs during this process, or if the requested table or column ** cannot be found, an [error code] is returned and an error message left ** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^ ** ** ^This API is only available if the library was compiled with the ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined. */ SQLITE_API int sqlite3_table_column_metadata( sqlite3 *db, /* Connection handle */ const char *zDbName, /* Database name or NULL */ const char *zTableName, /* Table name */ const char *zColumnName, /* Column name */ char const **pzDataType, /* OUTPUT: Declared data type */ char const **pzCollSeq, /* OUTPUT: Collation sequence name */ int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ int *pPrimaryKey, /* OUTPUT: True if column part of PK */ int *pAutoinc /* OUTPUT: True if column is auto-increment */ ); /* ** CAPI3REF: Load An Extension ** ** ^This interface loads an SQLite extension library from the named file. ** ** ^The sqlite3_load_extension() interface attempts to load an ** SQLite extension library contained in the file zFile. ** ** ^The entry point is zProc. ** ^zProc may be 0, in which case the name of the entry point ** defaults to "sqlite3_extension_init". ** ^The sqlite3_load_extension() interface returns ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. ** ^If an error occurs and pzErrMsg is not 0, then the ** [sqlite3_load_extension()] interface shall attempt to ** fill *pzErrMsg with error message text stored in memory ** obtained from [sqlite3_malloc()]. The calling function ** should free this memory by calling [sqlite3_free()]. ** ** ^Extension loading must be enabled using ** [sqlite3_enable_load_extension()] prior to calling this API, ** otherwise an error will be returned. ** ** See also the [load_extension() SQL function]. */ SQLITE_API int sqlite3_load_extension( sqlite3 *db, /* Load the extension into this database connection */ const char *zFile, /* Name of the shared library containing extension */ const char *zProc, /* Entry point. Derived from zFile if 0 */ char **pzErrMsg /* Put error message here if not 0 */ ); /* ** CAPI3REF: Enable Or Disable Extension Loading ** ** ^So as not to open security holes in older applications that are ** unprepared to deal with extension loading, and as a means of disabling ** extension loading while evaluating user-entered SQL, the following API ** is provided to turn the [sqlite3_load_extension()] mechanism on and off. ** ** ^Extension loading is off by default. See ticket #1863. ** ^Call the sqlite3_enable_load_extension() routine with onoff==1 ** to turn extension loading on and call it with onoff==0 to turn ** it back off again. */ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); /* ** CAPI3REF: Automatically Load Statically Linked Extensions ** ** ^This interface causes the xEntryPoint() function to be invoked for ** each new [database connection] that is created. The idea here is that ** xEntryPoint() is the entry point for a statically linked SQLite extension ** that is to be automatically loaded into all new database connections. ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three ** arguments and expects and integer result as if the signature of the ** entry point where as follows: ** **
        **    int xEntryPoint(
        **      sqlite3 *db,
        **      const char **pzErrMsg,
        **      const struct sqlite3_api_routines *pThunk
        **    );
        ** 
        )^ ** ** If the xEntryPoint routine encounters an error, it should make *pzErrMsg ** point to an appropriate error message (obtained from [sqlite3_mprintf()]) ** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg ** is NULL before calling the xEntryPoint(). ^SQLite will invoke ** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any ** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], ** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. ** ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already ** on the list of automatic extensions is a harmless no-op. ^No entry point ** will be called more than once for each database connection that is opened. ** ** See also: [sqlite3_reset_auto_extension()]. */ SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); /* ** CAPI3REF: Reset Automatic Extension Loading ** ** ^This interface disables all automatic extensions previously ** registered using [sqlite3_auto_extension()]. */ SQLITE_API void sqlite3_reset_auto_extension(void); /* ** The interface to the virtual-table mechanism is currently considered ** to be experimental. The interface might change in incompatible ways. ** If this is a problem for you, do not use the interface at this time. ** ** When the virtual-table mechanism stabilizes, we will declare the ** interface fixed, support it indefinitely, and remove this comment. */ /* ** Structures used by the virtual table interface */ typedef struct sqlite3_vtab sqlite3_vtab; typedef struct sqlite3_index_info sqlite3_index_info; typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; typedef struct sqlite3_module sqlite3_module; /* ** CAPI3REF: Virtual Table Object ** KEYWORDS: sqlite3_module {virtual table module} ** ** This structure, sometimes called a a "virtual table module", ** defines the implementation of a [virtual tables]. ** This structure consists mostly of methods for the module. ** ** ^A virtual table module is created by filling in a persistent ** instance of this structure and passing a pointer to that instance ** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. ** ^The registration remains valid until it is replaced by a different ** module or until the [database connection] closes. The content ** of this structure must not change while it is registered with ** any database connection. */ struct sqlite3_module { int iVersion; int (*xCreate)(sqlite3*, void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVTab, char**); int (*xConnect)(sqlite3*, void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVTab, char**); int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); int (*xDisconnect)(sqlite3_vtab *pVTab); int (*xDestroy)(sqlite3_vtab *pVTab); int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); int (*xClose)(sqlite3_vtab_cursor*); int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, int argc, sqlite3_value **argv); int (*xNext)(sqlite3_vtab_cursor*); int (*xEof)(sqlite3_vtab_cursor*); int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); int (*xBegin)(sqlite3_vtab *pVTab); int (*xSync)(sqlite3_vtab *pVTab); int (*xCommit)(sqlite3_vtab *pVTab); int (*xRollback)(sqlite3_vtab *pVTab); int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), void **ppArg); int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); }; /* ** CAPI3REF: Virtual Table Indexing Information ** KEYWORDS: sqlite3_index_info ** ** The sqlite3_index_info structure and its substructures is used as part ** of the [virtual table] interface to ** pass information into and receive the reply from the [xBestIndex] ** method of a [virtual table module]. The fields under **Inputs** are the ** inputs to xBestIndex and are read-only. xBestIndex inserts its ** results into the **Outputs** fields. ** ** ^(The aConstraint[] array records WHERE clause constraints of the form: ** **
        column OP expr
        ** ** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is ** stored in aConstraint[].op using one of the ** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ ** ^(The index of the column is stored in ** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the ** expr on the right-hand side can be evaluated (and thus the constraint ** is usable) and false if it cannot.)^ ** ** ^The optimizer automatically inverts terms of the form "expr OP column" ** and makes other simplifications to the WHERE clause in an attempt to ** get as many WHERE clause terms into the form shown above as possible. ** ^The aConstraint[] array only reports WHERE clause terms that are ** relevant to the particular virtual table being queried. ** ** ^Information about the ORDER BY clause is stored in aOrderBy[]. ** ^Each term of aOrderBy records a column of the ORDER BY clause. ** ** The [xBestIndex] method must fill aConstraintUsage[] with information ** about what parameters to pass to xFilter. ^If argvIndex>0 then ** the right-hand side of the corresponding aConstraint[] is evaluated ** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit ** is true, then the constraint is assumed to be fully handled by the ** virtual table and is not checked again by SQLite.)^ ** ** ^The idxNum and idxPtr values are recorded and passed into the ** [xFilter] method. ** ^[sqlite3_free()] is used to free idxPtr if and only if ** needToFreeIdxPtr is true. ** ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in ** the correct order to satisfy the ORDER BY clause so that no separate ** sorting step is required. ** ** ^The estimatedCost value is an estimate of the cost of doing the ** particular lookup. A full scan of a table with N entries should have ** a cost of N. A binary search of a table of N entries should have a ** cost of approximately log(N). */ struct sqlite3_index_info { /* Inputs */ int nConstraint; /* Number of entries in aConstraint */ struct sqlite3_index_constraint { int iColumn; /* Column on left-hand side of constraint */ unsigned char op; /* Constraint operator */ unsigned char usable; /* True if this constraint is usable */ int iTermOffset; /* Used internally - xBestIndex should ignore */ } *aConstraint; /* Table of WHERE clause constraints */ int nOrderBy; /* Number of terms in the ORDER BY clause */ struct sqlite3_index_orderby { int iColumn; /* Column number */ unsigned char desc; /* True for DESC. False for ASC. */ } *aOrderBy; /* The ORDER BY clause */ /* Outputs */ struct sqlite3_index_constraint_usage { int argvIndex; /* if >0, constraint is part of argv to xFilter */ unsigned char omit; /* Do not code a test for this constraint */ } *aConstraintUsage; int idxNum; /* Number used to identify the index */ char *idxStr; /* String, possibly obtained from sqlite3_malloc */ int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ int orderByConsumed; /* True if output is already ordered */ double estimatedCost; /* Estimated cost of using this index */ }; /* ** CAPI3REF: Virtual Table Constraint Operator Codes ** ** These macros defined the allowed values for the ** [sqlite3_index_info].aConstraint[].op field. Each value represents ** an operator that is part of a constraint term in the wHERE clause of ** a query that uses a [virtual table]. */ #define SQLITE_INDEX_CONSTRAINT_EQ 2 #define SQLITE_INDEX_CONSTRAINT_GT 4 #define SQLITE_INDEX_CONSTRAINT_LE 8 #define SQLITE_INDEX_CONSTRAINT_LT 16 #define SQLITE_INDEX_CONSTRAINT_GE 32 #define SQLITE_INDEX_CONSTRAINT_MATCH 64 /* ** CAPI3REF: Register A Virtual Table Implementation ** ** ^These routines are used to register a new [virtual table module] name. ** ^Module names must be registered before ** creating a new [virtual table] using the module and before using a ** preexisting [virtual table] for the module. ** ** ^The module name is registered on the [database connection] specified ** by the first parameter. ^The name of the module is given by the ** second parameter. ^The third parameter is a pointer to ** the implementation of the [virtual table module]. ^The fourth ** parameter is an arbitrary client data pointer that is passed through ** into the [xCreate] and [xConnect] methods of the virtual table module ** when a new virtual table is be being created or reinitialized. ** ** ^The sqlite3_create_module_v2() interface has a fifth parameter which ** is a pointer to a destructor for the pClientData. ^SQLite will ** invoke the destructor function (if it is not NULL) when SQLite ** no longer needs the pClientData pointer. ^The destructor will also ** be invoked if the call to sqlite3_create_module_v2() fails. ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData /* Client data for xCreate/xConnect */ ); SQLITE_API int sqlite3_create_module_v2( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData, /* Client data for xCreate/xConnect */ void(*xDestroy)(void*) /* Module destructor function */ ); /* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** ** Every [virtual table module] implementation uses a subclass ** of this object to describe a particular instance ** of the [virtual table]. Each subclass will ** be tailored to the specific needs of the module implementation. ** The purpose of this superclass is to define certain fields that are ** common to all module implementations. ** ** ^Virtual tables methods can set an error message by assigning a ** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should ** take care that any prior string is freed by a call to [sqlite3_free()] ** prior to assigning a new string to zErrMsg. ^After the error message ** is delivered up to the client application, the string will be automatically ** freed by sqlite3_free() and the zErrMsg field will be zeroed. */ struct sqlite3_vtab { const sqlite3_module *pModule; /* The module for this virtual table */ int nRef; /* NO LONGER USED */ char *zErrMsg; /* Error message from sqlite3_mprintf() */ /* Virtual table implementations will typically add additional fields */ }; /* ** CAPI3REF: Virtual Table Cursor Object ** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} ** ** Every [virtual table module] implementation uses a subclass of the ** following structure to describe cursors that point into the ** [virtual table] and are used ** to loop through the virtual table. Cursors are created using the ** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed ** by the [sqlite3_module.xClose | xClose] method. Cursors are used ** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods ** of the module. Each module implementation will define ** the content of a cursor structure to suit its own needs. ** ** This superclass exists in order to define fields of the cursor that ** are common to all implementations. */ struct sqlite3_vtab_cursor { sqlite3_vtab *pVtab; /* Virtual table of this cursor */ /* Virtual table implementations will typically add additional fields */ }; /* ** CAPI3REF: Declare The Schema Of A Virtual Table ** ** ^The [xCreate] and [xConnect] methods of a ** [virtual table module] call this interface ** to declare the format (the names and datatypes of the columns) of ** the virtual tables they implement. */ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); /* ** CAPI3REF: Overload A Function For A Virtual Table ** ** ^(Virtual tables can provide alternative implementations of functions ** using the [xFindFunction] method of the [virtual table module]. ** But global versions of those functions ** must exist in order to be overloaded.)^ ** ** ^(This API makes sure a global version of a function with a particular ** name and number of parameters exists. If no such function exists ** before this API is called, a new function is created.)^ ^The implementation ** of the new function always causes an exception to be thrown. So ** the new function is not good for anything by itself. Its only ** purpose is to be a placeholder function that can be overloaded ** by a [virtual table]. */ SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); /* ** The interface to the virtual-table mechanism defined above (back up ** to a comment remarkably similar to this one) is currently considered ** to be experimental. The interface might change in incompatible ways. ** If this is a problem for you, do not use the interface at this time. ** ** When the virtual-table mechanism stabilizes, we will declare the ** interface fixed, support it indefinitely, and remove this comment. */ /* ** CAPI3REF: A Handle To An Open BLOB ** KEYWORDS: {BLOB handle} {BLOB handles} ** ** An instance of this object represents an open BLOB on which ** [sqlite3_blob_open | incremental BLOB I/O] can be performed. ** ^Objects of this type are created by [sqlite3_blob_open()] ** and destroyed by [sqlite3_blob_close()]. ** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces ** can be used to read or write small subsections of the BLOB. ** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. */ typedef struct sqlite3_blob sqlite3_blob; /* ** CAPI3REF: Open A BLOB For Incremental I/O ** ** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located ** in row iRow, column zColumn, table zTable in database zDb; ** in other words, the same BLOB that would be selected by: ** **
        **     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
        ** 
        )^ ** ** ^If the flags parameter is non-zero, then the BLOB is opened for read ** and write access. ^If it is zero, the BLOB is opened for read access. ** ^It is not possible to open a column that is part of an index or primary ** key for writing. ^If [foreign key constraints] are enabled, it is ** not possible to open a column that is part of a [child key] for writing. ** ** ^Note that the database name is not the filename that contains ** the database but rather the symbolic name of the database that ** appears after the AS keyword when the database is connected using [ATTACH]. ** ^For the main database file, the database name is "main". ** ^For TEMP tables, the database name is "temp". ** ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set ** to be a null pointer.)^ ** ^This function sets the [database connection] error code and message ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related ** functions. ^Note that the *ppBlob variable is always initialized in a ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob ** regardless of the success or failure of this routine. ** ** ^(If the row that a BLOB handle points to is modified by an ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects ** then the BLOB handle is marked as "expired". ** This is true if any column of the row is changed, even a column ** other than the one the BLOB handle is open on.)^ ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for ** a expired BLOB handle fail with an return code of [SQLITE_ABORT]. ** ^(Changes written into a BLOB prior to the BLOB expiring are not ** rolled back by the expiration of the BLOB. Such changes will eventually ** commit if the transaction continues to completion.)^ ** ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of ** the opened blob. ^The size of a blob may not be changed by this ** interface. Use the [UPDATE] SQL command to change the size of a ** blob. ** ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces ** and the built-in [zeroblob] SQL function can be used, if desired, ** to create an empty, zero-filled blob in which to read or write using ** this interface. ** ** To avoid a resource leak, every open [BLOB handle] should eventually ** be released by a call to [sqlite3_blob_close()]. */ SQLITE_API int sqlite3_blob_open( sqlite3*, const char *zDb, const char *zTable, const char *zColumn, sqlite3_int64 iRow, int flags, sqlite3_blob **ppBlob ); /* ** CAPI3REF: Move a BLOB Handle to a New Row ** ** ^This function is used to move an existing blob handle so that it points ** to a different row of the same database table. ^The new row is identified ** by the rowid value passed as the second argument. Only the row can be ** changed. ^The database, table and column on which the blob handle is open ** remain the same. Moving an existing blob handle to a new row can be ** faster than closing the existing handle and opening a new one. ** ** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - ** it must exist and there must be either a blob or text value stored in ** the nominated column.)^ ^If the new row is not present in the table, or if ** it does not contain a blob or text value, or if another error occurs, an ** SQLite error code is returned and the blob handle is considered aborted. ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle ** always returns zero. ** ** ^This function sets the database handle error code and message. */ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); /* ** CAPI3REF: Close A BLOB Handle ** ** ^Closes an open [BLOB handle]. ** ** ^Closing a BLOB shall cause the current transaction to commit ** if there are no other BLOBs, no pending prepared statements, and the ** database connection is in [autocommit mode]. ** ^If any writes were made to the BLOB, they might be held in cache ** until the close operation if they will fit. ** ** ^(Closing the BLOB often forces the changes ** out to disk and so if any I/O errors occur, they will likely occur ** at the time when the BLOB is closed. Any errors that occur during ** closing are reported as a non-zero return value.)^ ** ** ^(The BLOB is closed unconditionally. Even if this routine returns ** an error code, the BLOB is still closed.)^ ** ** ^Calling this routine with a null pointer (such as would be returned ** by a failed call to [sqlite3_blob_open()]) is a harmless no-op. */ SQLITE_API int sqlite3_blob_close(sqlite3_blob *); /* ** CAPI3REF: Return The Size Of An Open BLOB ** ** ^Returns the size in bytes of the BLOB accessible via the ** successfully opened [BLOB handle] in its only argument. ^The ** incremental blob I/O routines can only read or overwriting existing ** blob content; they cannot change the size of a blob. ** ** This routine only works on a [BLOB handle] which has been created ** by a prior successful call to [sqlite3_blob_open()] and which has not ** been closed by [sqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. */ SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); /* ** CAPI3REF: Read Data From A BLOB Incrementally ** ** ^(This function is used to read data from an open [BLOB handle] into a ** caller-supplied buffer. N bytes of data are copied into buffer Z ** from the open BLOB, starting at offset iOffset.)^ ** ** ^If offset iOffset is less than N bytes from the end of the BLOB, ** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is ** less than zero, [SQLITE_ERROR] is returned and no data is read. ** ^The size of the blob (and hence the maximum value of N+iOffset) ** can be determined using the [sqlite3_blob_bytes()] interface. ** ** ^An attempt to read from an expired [BLOB handle] fails with an ** error code of [SQLITE_ABORT]. ** ** ^(On success, sqlite3_blob_read() returns SQLITE_OK. ** Otherwise, an [error code] or an [extended error code] is returned.)^ ** ** This routine only works on a [BLOB handle] which has been created ** by a prior successful call to [sqlite3_blob_open()] and which has not ** been closed by [sqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. ** ** See also: [sqlite3_blob_write()]. */ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); /* ** CAPI3REF: Write Data Into A BLOB Incrementally ** ** ^This function is used to write data into an open [BLOB handle] from a ** caller-supplied buffer. ^N bytes of data are copied from the buffer Z ** into the open BLOB, starting at offset iOffset. ** ** ^If the [BLOB handle] passed as the first argument was not opened for ** writing (the flags parameter to [sqlite3_blob_open()] was zero), ** this function returns [SQLITE_READONLY]. ** ** ^This function may only modify the contents of the BLOB; it is ** not possible to increase the size of a BLOB using this API. ** ^If offset iOffset is less than N bytes from the end of the BLOB, ** [SQLITE_ERROR] is returned and no data is written. ^If N is ** less than zero [SQLITE_ERROR] is returned and no data is written. ** The size of the BLOB (and hence the maximum value of N+iOffset) ** can be determined using the [sqlite3_blob_bytes()] interface. ** ** ^An attempt to write to an expired [BLOB handle] fails with an ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred ** before the [BLOB handle] expired are not rolled back by the ** expiration of the handle, though of course those changes might ** have been overwritten by the statement that expired the BLOB handle ** or by other independent statements. ** ** ^(On success, sqlite3_blob_write() returns SQLITE_OK. ** Otherwise, an [error code] or an [extended error code] is returned.)^ ** ** This routine only works on a [BLOB handle] which has been created ** by a prior successful call to [sqlite3_blob_open()] and which has not ** been closed by [sqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. ** ** See also: [sqlite3_blob_read()]. */ SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); /* ** CAPI3REF: Virtual File System Objects ** ** A virtual filesystem (VFS) is an [sqlite3_vfs] object ** that SQLite uses to interact ** with the underlying operating system. Most SQLite builds come with a ** single default VFS that is appropriate for the host computer. ** New VFSes can be registered and existing VFSes can be unregistered. ** The following interfaces are provided. ** ** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. ** ^Names are case sensitive. ** ^Names are zero-terminated UTF-8 strings. ** ^If there is no match, a NULL pointer is returned. ** ^If zVfsName is NULL then the default VFS is returned. ** ** ^New VFSes are registered with sqlite3_vfs_register(). ** ^Each new VFS becomes the default VFS if the makeDflt flag is set. ** ^The same VFS can be registered multiple times without injury. ** ^To make an existing VFS into the default VFS, register it again ** with the makeDflt flag set. If two different VFSes with the ** same name are registered, the behavior is undefined. If a ** VFS is registered with a name that is NULL or an empty string, ** then the behavior is undefined. ** ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. ** ^(If the default VFS is unregistered, another VFS is chosen as ** the default. The choice for the new VFS is arbitrary.)^ */ SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); /* ** CAPI3REF: Mutexes ** ** The SQLite core uses these routines for thread ** synchronization. Though they are intended for internal ** use by SQLite, code that links against SQLite is ** permitted to use any of these routines. ** ** The SQLite source code contains multiple implementations ** of these mutex routines. An appropriate implementation ** is selected automatically at compile-time. ^(The following ** implementations are available in the SQLite core: ** **
          **
        • SQLITE_MUTEX_OS2 **
        • SQLITE_MUTEX_PTHREAD **
        • SQLITE_MUTEX_W32 **
        • SQLITE_MUTEX_NOOP **
        )^ ** ** ^The SQLITE_MUTEX_NOOP implementation is a set of routines ** that does no real locking and is appropriate for use in ** a single-threaded application. ^The SQLITE_MUTEX_OS2, ** SQLITE_MUTEX_PTHREAD, and SQLITE_MUTEX_W32 implementations ** are appropriate for use on OS/2, Unix, and Windows. ** ** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex ** implementation is included with the library. In this case the ** application must supply a custom mutex implementation using the ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function ** before calling sqlite3_initialize() or any other public sqlite3_ ** function that calls sqlite3_initialize().)^ ** ** ^The sqlite3_mutex_alloc() routine allocates a new ** mutex and returns a pointer to it. ^If it returns NULL ** that means that a mutex could not be allocated. ^SQLite ** will unwind its stack and return an error. ^(The argument ** to sqlite3_mutex_alloc() is one of these integer constants: ** **
          **
        • SQLITE_MUTEX_FAST **
        • SQLITE_MUTEX_RECURSIVE **
        • SQLITE_MUTEX_STATIC_MASTER **
        • SQLITE_MUTEX_STATIC_MEM **
        • SQLITE_MUTEX_STATIC_MEM2 **
        • SQLITE_MUTEX_STATIC_PRNG **
        • SQLITE_MUTEX_STATIC_LRU **
        • SQLITE_MUTEX_STATIC_LRU2 **
        )^ ** ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) ** cause sqlite3_mutex_alloc() to create ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. ** The mutex implementation does not need to make a distinction ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does ** not want to. ^SQLite will only request a recursive mutex in ** cases where it really needs one. ^If a faster non-recursive mutex ** implementation is available on the host platform, the mutex subsystem ** might return such a mutex in response to SQLITE_MUTEX_FAST. ** ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return ** a pointer to a static preexisting mutex. ^Six static mutexes are ** used by the current version of SQLite. Future versions of SQLite ** may add additional static mutexes. Static mutexes are for internal ** use by SQLite only. Applications that use SQLite mutexes should ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or ** SQLITE_MUTEX_RECURSIVE. ** ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() ** returns a different mutex on every call. ^But for the static ** mutex types, the same mutex is returned on every call that has ** the same type number. ** ** ^The sqlite3_mutex_free() routine deallocates a previously ** allocated dynamic mutex. ^SQLite is careful to deallocate every ** dynamic mutex that it allocates. The dynamic mutexes must not be in ** use when they are deallocated. Attempting to deallocate a static ** mutex results in undefined behavior. ^SQLite never deallocates ** a static mutex. ** ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt ** to enter a mutex. ^If another thread is already within the mutex, ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] ** upon successful entry. ^(Mutexes created using ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. ** In such cases the, ** mutex must be exited an equal number of times before another thread ** can enter.)^ ^(If the same thread tries to enter any other ** kind of mutex more than once, the behavior is undefined. ** SQLite will never exhibit ** such behavior in its own use of mutexes.)^ ** ** ^(Some systems (for example, Windows 95) do not support the operation ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() ** will always return SQLITE_BUSY. The SQLite core only ever uses ** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^ ** ** ^The sqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. ^(The behavior ** is undefined if the mutex is not currently entered by the ** calling thread or is not currently allocated. SQLite will ** never do either.)^ ** ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or ** sqlite3_mutex_leave() is a NULL pointer, then all three routines ** behave as no-ops. ** ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. */ SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); /* ** CAPI3REF: Mutex Methods Object ** ** An instance of this structure defines the low-level routines ** used to allocate and use mutexes. ** ** Usually, the default mutex implementations provided by SQLite are ** sufficient, however the user has the option of substituting a custom ** implementation for specialized deployments or systems for which SQLite ** does not provide a suitable implementation. In this case, the user ** creates and populates an instance of this structure to pass ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. ** Additionally, an instance of this structure can be used as an ** output variable when querying the system for the current mutex ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. ** ** ^The xMutexInit method defined by this structure is invoked as ** part of system initialization by the sqlite3_initialize() function. ** ^The xMutexInit routine is called by SQLite exactly once for each ** effective call to [sqlite3_initialize()]. ** ** ^The xMutexEnd method defined by this structure is invoked as ** part of system shutdown by the sqlite3_shutdown() function. The ** implementation of this method is expected to release all outstanding ** resources obtained by the mutex methods implementation, especially ** those obtained by the xMutexInit method. ^The xMutexEnd() ** interface is invoked exactly once for each call to [sqlite3_shutdown()]. ** ** ^(The remaining seven methods defined by this structure (xMutexAlloc, ** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and ** xMutexNotheld) implement the following interfaces (respectively): ** **
          **
        • [sqlite3_mutex_alloc()]
        • **
        • [sqlite3_mutex_free()]
        • **
        • [sqlite3_mutex_enter()]
        • **
        • [sqlite3_mutex_try()]
        • **
        • [sqlite3_mutex_leave()]
        • **
        • [sqlite3_mutex_held()]
        • **
        • [sqlite3_mutex_notheld()]
        • **
        )^ ** ** The only difference is that the public sqlite3_XXX functions enumerated ** above silently ignore any invocations that pass a NULL pointer instead ** of a valid mutex handle. The implementations of the methods defined ** by this structure are not required to handle this case, the results ** of passing a NULL pointer instead of a valid mutex handle are undefined ** (i.e. it is acceptable to provide an implementation that segfaults if ** it is passed a NULL pointer). ** ** The xMutexInit() method must be threadsafe. ^It must be harmless to ** invoke xMutexInit() multiple times within the same process and without ** intervening calls to xMutexEnd(). Second and subsequent calls to ** xMutexInit() must be no-ops. ** ** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] ** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite ** memory allocation for a fast or recursive mutex. ** ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is ** called, but only if the prior call to xMutexInit returned SQLITE_OK. ** If xMutexInit fails in any way, it is expected to clean up after itself ** prior to returning. */ typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; struct sqlite3_mutex_methods { int (*xMutexInit)(void); int (*xMutexEnd)(void); sqlite3_mutex *(*xMutexAlloc)(int); void (*xMutexFree)(sqlite3_mutex *); void (*xMutexEnter)(sqlite3_mutex *); int (*xMutexTry)(sqlite3_mutex *); void (*xMutexLeave)(sqlite3_mutex *); int (*xMutexHeld)(sqlite3_mutex *); int (*xMutexNotheld)(sqlite3_mutex *); }; /* ** CAPI3REF: Mutex Verification Routines ** ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines ** are intended for use inside assert() statements. ^The SQLite core ** never uses these routines except inside an assert() and applications ** are advised to follow the lead of the core. ^The SQLite core only ** provides implementations for these routines when it is compiled ** with the SQLITE_DEBUG flag. ^External mutex implementations ** are only required to provide these routines if SQLITE_DEBUG is ** defined and if NDEBUG is not defined. ** ** ^These routines should return true if the mutex in their argument ** is held or not held, respectively, by the calling thread. ** ** ^The implementation is not required to provided versions of these ** routines that actually work. If the implementation does not provide working ** versions of these routines, it should at least provide stubs that always ** return true so that one does not get spurious assertion failures. ** ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then ** the routine should return 1. This seems counter-intuitive since ** clearly the mutex cannot be held if it does not exist. But the ** the reason the mutex does not exist is because the build is not ** using mutexes. And we do not want the assert() containing the ** call to sqlite3_mutex_held() to fail, so a non-zero return is ** the appropriate thing to do. ^The sqlite3_mutex_notheld() ** interface should also return 1 when given a NULL pointer. */ #ifndef NDEBUG SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); #endif /* ** CAPI3REF: Mutex Types ** ** The [sqlite3_mutex_alloc()] interface takes a single argument ** which is one of these integer constants. ** ** The set of static mutexes may change from one SQLite release to the ** next. Applications that override the built-in mutex logic must be ** prepared to accommodate additional static mutexes. */ #define SQLITE_MUTEX_FAST 0 #define SQLITE_MUTEX_RECURSIVE 1 #define SQLITE_MUTEX_STATIC_MASTER 2 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ #define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */ /* ** CAPI3REF: Retrieve the mutex for a database connection ** ** ^This interface returns a pointer the [sqlite3_mutex] object that ** serializes access to the [database connection] given in the argument ** when the [threading mode] is Serialized. ** ^If the [threading mode] is Single-thread or Multi-thread then this ** routine returns a NULL pointer. */ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); /* ** CAPI3REF: Low-Level Control Of Database Files ** ** ^The [sqlite3_file_control()] interface makes a direct call to the ** xFileControl method for the [sqlite3_io_methods] object associated ** with a particular database identified by the second argument. ^The ** name of the database is "main" for the main database or "temp" for the ** TEMP database, or the name that appears after the AS keyword for ** databases that are added using the [ATTACH] SQL command. ** ^A NULL pointer can be used in place of "main" to refer to the ** main database file. ** ^The third and fourth parameters to this routine ** are passed directly through to the second and third parameters of ** the xFileControl method. ^The return value of the xFileControl ** method becomes the return value of this routine. ** ** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes ** a pointer to the underlying [sqlite3_file] object to be written into ** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER ** case is a short-circuit path which does not actually invoke the ** underlying sqlite3_io_methods.xFileControl method. ** ** ^If the second parameter (zDbName) does not match the name of any ** open database file, then SQLITE_ERROR is returned. ^This error ** code is not remembered and will not be recalled by [sqlite3_errcode()] ** or [sqlite3_errmsg()]. The underlying xFileControl method might ** also return SQLITE_ERROR. There is no way to distinguish between ** an incorrect zDbName and an SQLITE_ERROR return from the underlying ** xFileControl method. ** ** See also: [SQLITE_FCNTL_LOCKSTATE] */ SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); /* ** CAPI3REF: Testing Interface ** ** ^The sqlite3_test_control() interface is used to read out internal ** state of SQLite and to inject faults into SQLite for testing ** purposes. ^The first parameter is an operation code that determines ** the number, meaning, and operation of all subsequent parameters. ** ** This interface is not for use by applications. It exists solely ** for verifying the correct operation of the SQLite library. Depending ** on how the SQLite library is compiled, this interface might not exist. ** ** The details of the operation codes, their meanings, the parameters ** they take, and what they do are all subject to change without notice. ** Unlike most of the SQLite API, this function is not guaranteed to ** operate consistently from one release to the next. */ SQLITE_API int sqlite3_test_control(int op, ...); /* ** CAPI3REF: Testing Interface Operation Codes ** ** These constants are the valid operation code parameters used ** as the first argument to [sqlite3_test_control()]. ** ** These parameters and their meanings are subject to change ** without notice. These values are for testing purposes only. ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 #define SQLITE_TESTCTRL_PENDING_BYTE 11 #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 #define SQLITE_TESTCTRL_ISKEYWORD 16 #define SQLITE_TESTCTRL_PGHDRSZ 17 #define SQLITE_TESTCTRL_SCRATCHMALLOC 18 #define SQLITE_TESTCTRL_LAST 18 /* ** CAPI3REF: SQLite Runtime Status ** ** ^This interface is used to retrieve runtime status information ** about the performance of SQLite, and optionally to reset various ** highwater marks. ^The first argument is an integer code for ** the specific parameter to measure. ^(Recognized integer codes ** are of the form [SQLITE_STATUS_MEMORY_USED | SQLITE_STATUS_...].)^ ** ^The current value of the parameter is returned into *pCurrent. ** ^The highest recorded value is returned in *pHighwater. ^If the ** resetFlag is true, then the highest record value is reset after ** *pHighwater is written. ^(Some parameters do not record the highest ** value. For those parameters ** nothing is written into *pHighwater and the resetFlag is ignored.)^ ** ^(Other parameters record only the highwater mark and not the current ** value. For these latter parameters nothing is written into *pCurrent.)^ ** ** ^The sqlite3_status() routine returns SQLITE_OK on success and a ** non-zero [error code] on failure. ** ** This routine is threadsafe but is not atomic. This routine can be ** called while other threads are running the same or different SQLite ** interfaces. However the values returned in *pCurrent and ** *pHighwater reflect the status of SQLite at different points in time ** and it is possible that another thread might change the parameter ** in between the times when *pCurrent and *pHighwater are written. ** ** See also: [sqlite3_db_status()] */ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); /* ** CAPI3REF: Status Parameters ** ** These integer constants designate various run-time status parameters ** that can be returned by [sqlite3_status()]. ** **
        ** ^(
        SQLITE_STATUS_MEMORY_USED
        **
        This parameter is the current amount of memory checked out ** using [sqlite3_malloc()], either directly or indirectly. The ** figure includes calls made to [sqlite3_malloc()] by the application ** and internal memory usage by the SQLite library. Scratch memory ** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in ** this parameter. The amount returned is the sum of the allocation ** sizes as reported by the xSize method in [sqlite3_mem_methods].
        )^ ** ** ^(
        SQLITE_STATUS_MALLOC_SIZE
        **
        This parameter records the largest memory allocation request ** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their ** internal equivalents). Only the value returned in the ** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
        )^ ** ** ^(
        SQLITE_STATUS_MALLOC_COUNT
        **
        This parameter records the number of separate memory allocations.
        )^ ** ** ^(
        SQLITE_STATUS_PAGECACHE_USED
        **
        This parameter returns the number of pages used out of the ** [pagecache memory allocator] that was configured using ** [SQLITE_CONFIG_PAGECACHE]. The ** value returned is in pages, not in bytes.
        )^ ** ** ^(
        SQLITE_STATUS_PAGECACHE_OVERFLOW
        **
        This parameter returns the number of bytes of page cache ** allocation which could not be satisfied 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.
        )^ ** ** ^(
        SQLITE_STATUS_PAGECACHE_SIZE
        **
        This parameter records the largest memory allocation request ** handed to [pagecache memory allocator]. Only the value returned in the ** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
        )^ ** ** ^(
        SQLITE_STATUS_SCRATCH_USED
        **
        This parameter returns the number of allocations used out of the ** [scratch memory allocator] configured using ** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not ** in bytes. Since a single thread may only have one scratch allocation ** outstanding at time, this parameter also reports the number of threads ** using scratch memory at the same time.
        )^ ** ** ^(
        SQLITE_STATUS_SCRATCH_OVERFLOW
        **
        This parameter returns the number of bytes of scratch memory ** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH] ** buffer and where forced to overflow to [sqlite3_malloc()]. The values ** returned include overflows because the requested allocation was too ** larger (that is, because the requested allocation was larger than the ** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer ** slots were available. **
        )^ ** ** ^(
        SQLITE_STATUS_SCRATCH_SIZE
        **
        This parameter records the largest memory allocation request ** handed to [scratch memory allocator]. Only the value returned in the ** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
        )^ ** ** ^(
        SQLITE_STATUS_PARSER_STACK
        **
        This parameter records the deepest parser stack. It is only ** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].
        )^ **
        ** ** New status parameters may be added from time to time. */ #define SQLITE_STATUS_MEMORY_USED 0 #define SQLITE_STATUS_PAGECACHE_USED 1 #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 #define SQLITE_STATUS_SCRATCH_USED 3 #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 #define SQLITE_STATUS_MALLOC_SIZE 5 #define SQLITE_STATUS_PARSER_STACK 6 #define SQLITE_STATUS_PAGECACHE_SIZE 7 #define SQLITE_STATUS_SCRATCH_SIZE 8 #define SQLITE_STATUS_MALLOC_COUNT 9 /* ** CAPI3REF: Database Connection Status ** ** ^This interface is used to retrieve runtime status information ** about a single [database connection]. ^The first argument is the ** database connection object to be interrogated. ^The second argument ** is an integer constant, taken from the set of ** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros, that ** determines the parameter to interrogate. The set of ** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros is likely ** to grow in future releases of SQLite. ** ** ^The current value of the requested parameter is written into *pCur ** and the highest instantaneous value is written into *pHiwtr. ^If ** the resetFlg is true, then the highest instantaneous value is ** reset back down to the current value. ** ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a ** non-zero [error code] on failure. ** ** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. */ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); /* ** CAPI3REF: Status Parameters for database connections ** ** These constants are the available integer "verbs" that can be passed as ** the second argument to the [sqlite3_db_status()] interface. ** ** New verbs may be added in future releases of SQLite. Existing verbs ** might be discontinued. Applications should check the return code from ** [sqlite3_db_status()] to make sure that the call worked. ** The [sqlite3_db_status()] interface will return a non-zero error code ** if a discontinued or unsupported verb is invoked. ** **
        ** ^(
        SQLITE_DBSTATUS_LOOKASIDE_USED
        **
        This parameter returns the number of lookaside memory slots currently ** checked out.
        )^ ** ** ^(
        SQLITE_DBSTATUS_CACHE_USED
        **
        This parameter returns the approximate number of of bytes of heap ** memory used by all pager caches associated with the database connection.)^ ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. ** ** ^(
        SQLITE_DBSTATUS_SCHEMA_USED
        **
        This parameter returns the approximate number of of bytes of heap ** memory used to store the schema for all databases associated ** with the connection - main, temp, and any [ATTACH]-ed databases.)^ ** ^The full amount of memory used by the schemas is reported, even if the ** schema memory is shared with other database connections due to ** [shared cache mode] being enabled. ** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0. ** ** ^(
        SQLITE_DBSTATUS_STMT_USED
        **
        This parameter returns the approximate number of of bytes of heap ** and lookaside memory used by all prepared statements associated with ** the database connection.)^ ** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0. **
        **
        */ #define SQLITE_DBSTATUS_LOOKASIDE_USED 0 #define SQLITE_DBSTATUS_CACHE_USED 1 #define SQLITE_DBSTATUS_SCHEMA_USED 2 #define SQLITE_DBSTATUS_STMT_USED 3 #define SQLITE_DBSTATUS_MAX 3 /* Largest defined DBSTATUS */ /* ** CAPI3REF: Prepared Statement Status ** ** ^(Each prepared statement maintains various ** [SQLITE_STMTSTATUS_SORT | counters] that measure the number ** of times it has performed specific operations.)^ These counters can ** be used to monitor the performance characteristics of the prepared ** statements. For example, if the number of table steps greatly exceeds ** the number of table searches or result rows, that would tend to indicate ** that the prepared statement is using a full table scan rather than ** an index. ** ** ^(This interface is used to retrieve and reset counter values from ** a [prepared statement]. The first argument is the prepared statement ** object to be interrogated. The second argument ** is an integer code for a specific [SQLITE_STMTSTATUS_SORT | counter] ** to be interrogated.)^ ** ^The current value of the requested counter is returned. ** ^If the resetFlg is true, then the counter is reset to zero after this ** interface call returns. ** ** See also: [sqlite3_status()] and [sqlite3_db_status()]. */ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); /* ** CAPI3REF: Status Parameters for prepared statements ** ** These preprocessor macros define integer codes that name counter ** values associated with the [sqlite3_stmt_status()] interface. ** The meanings of the various counters are as follows: ** **
        **
        SQLITE_STMTSTATUS_FULLSCAN_STEP
        **
        ^This is the number of times that SQLite has stepped forward in ** a table as part of a full table scan. Large numbers for this counter ** may indicate opportunities for performance improvement through ** careful use of indices.
        ** **
        SQLITE_STMTSTATUS_SORT
        **
        ^This is the number of sort operations that have occurred. ** A non-zero value in this counter may indicate an opportunity to ** improvement performance through careful use of indices.
        ** **
        SQLITE_STMTSTATUS_AUTOINDEX
        **
        ^This is the number of rows inserted into transient indices that ** were created automatically in order to help joins run faster. ** A non-zero value in this counter may indicate an opportunity to ** improvement performance by adding permanent indices that do not ** need to be reinitialized each time the statement is run.
        ** **
        */ #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 #define SQLITE_STMTSTATUS_SORT 2 #define SQLITE_STMTSTATUS_AUTOINDEX 3 /* ** CAPI3REF: Custom Page Cache Object ** ** The sqlite3_pcache type is opaque. It is implemented by ** the pluggable module. The SQLite core has no knowledge of ** its size or internal structure and never deals with the ** sqlite3_pcache object except by holding and passing pointers ** to the object. ** ** See [sqlite3_pcache_methods] for additional information. */ typedef struct sqlite3_pcache sqlite3_pcache; /* ** CAPI3REF: Application Defined Page Cache. ** KEYWORDS: {page cache} ** ** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can ** register an alternative page cache implementation by passing in an ** instance of the sqlite3_pcache_methods structure.)^ ** In many applications, most of the heap memory allocated by ** SQLite is used for the page cache. ** By implementing a ** custom page cache using this API, an application can better control ** the amount of memory consumed by SQLite, the way in which ** that memory is allocated and released, and the policies used to ** determine exactly which parts of a database file are cached and for ** how long. ** ** The alternative page cache mechanism is an ** extreme measure that is only needed by the most demanding applications. ** The built-in page cache is recommended for most uses. ** ** ^(The contents of the sqlite3_pcache_methods structure are copied to an ** internal buffer by SQLite within the call to [sqlite3_config]. Hence ** the application may discard the parameter after the call to ** [sqlite3_config()] returns.)^ ** ** ^(The xInit() method is called once for each effective ** call to [sqlite3_initialize()])^ ** (usually only once during the lifetime of the process). ^(The xInit() ** method is passed a copy of the sqlite3_pcache_methods.pArg value.)^ ** The intent of the xInit() method is to set up global data structures ** required by the custom page cache implementation. ** ^(If the xInit() method is NULL, then the ** built-in default page cache is used instead of the application defined ** page cache.)^ ** ** ^The xShutdown() method is called by [sqlite3_shutdown()]. ** It can be used to clean up ** any outstanding resources before process shutdown, if required. ** ^The xShutdown() method may be NULL. ** ** ^SQLite automatically serializes calls to the xInit method, ** so the xInit method need not be threadsafe. ^The ** xShutdown method is only called from [sqlite3_shutdown()] so it does ** not need to be threadsafe either. All other methods must be threadsafe ** in multithreaded applications. ** ** ^SQLite will never invoke xInit() more than once without an intervening ** call to xShutdown(). ** ** ^SQLite invokes the xCreate() method to construct a new cache instance. ** SQLite will typically create one cache instance for each open database file, ** though this is not guaranteed. ^The ** first parameter, szPage, is the size in bytes of the pages that must ** be allocated by the cache. ^szPage will not be a power of two. ^szPage ** will the page size of the database file that is to be cached plus an ** increment (here called "R") of about 100 or 200. SQLite will use the ** extra R bytes on each page to store metadata about the underlying ** database page on disk. The value of R depends ** on the SQLite version, the target platform, and how SQLite was compiled. ** ^R is constant for a particular build of SQLite. ^The second argument to ** xCreate(), bPurgeable, is true if the cache being created will ** be used to cache database pages of a file stored on disk, or ** false if it is used for an in-memory database. The cache implementation ** does not have to do anything special based with the value of bPurgeable; ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will ** never invoke xUnpin() except to deliberately delete a page. ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to ** false will always have the "discard" flag set to true. ** ^Hence, a cache created with bPurgeable false will ** never contain any unpinned pages. ** ** ^(The xCachesize() method may be called at any time by SQLite to set the ** suggested maximum cache-size (number of pages stored by) the cache ** instance passed as the first argument. This is the value configured using ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable ** parameter, the implementation is not required to do anything with this ** value; it is advisory only. ** ** The xPagecount() method must return the number of pages currently ** stored in the cache, both pinned and unpinned. ** ** The xFetch() method locates a page in the cache and returns a pointer to ** the page, or a NULL pointer. ** A "page", in this context, means a buffer of szPage bytes aligned at an ** 8-byte boundary. The page to be fetched is determined by the key. ^The ** mimimum key value is 1. After it has been retrieved using xFetch, the page ** is considered to be "pinned". ** ** If the requested page is already in the page cache, then the page cache ** implementation must return a pointer to the page buffer with its content ** intact. If the requested page is not already in the cache, then the ** behavior of the cache implementation should use the value of the createFlag ** parameter to help it determined what action to take: ** ** **
        createFlag Behaviour when page is not already in cache **
        0 Do not allocate a new page. Return NULL. **
        1 Allocate a new page if it easy and convenient to do so. ** Otherwise return NULL. **
        2 Make every effort to allocate a new page. Only return ** NULL if allocating a new page is effectively impossible. **
        ** ** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite ** will only use a createFlag of 2 after a prior call with a createFlag of 1 ** failed.)^ In between the to xFetch() calls, SQLite may ** attempt to unpin one or more cache pages by spilling the content of ** pinned pages to disk and synching the operating system disk cache. ** ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page ** as its second argument. If the third parameter, discard, is non-zero, ** then the page must be evicted from the cache. ** ^If the discard parameter is ** zero, then the page may be discarded or retained at the discretion of ** page cache implementation. ^The page cache implementation ** may choose to evict unpinned pages at any time. ** ** The cache must not perform any reference counting. A single ** call to xUnpin() unpins the page regardless of the number of prior calls ** to xFetch(). ** ** The xRekey() method is used to change the key value associated with the ** page passed as the second argument. If the cache ** previously contains an entry associated with newKey, it must be ** discarded. ^Any prior cache entry associated with newKey is guaranteed not ** to be pinned. ** ** When SQLite calls the xTruncate() method, the cache must discard all ** existing cache entries with page numbers (keys) greater than or equal ** to the value of the iLimit parameter passed to xTruncate(). If any ** of these pages are pinned, they are implicitly unpinned, meaning that ** they can be safely discarded. ** ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). ** All resources associated with the specified cache should be freed. ^After ** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] ** handle invalid, and will not use it with any other sqlite3_pcache_methods ** functions. */ typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; struct sqlite3_pcache_methods { void *pArg; int (*xInit)(void*); void (*xShutdown)(void*); sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); void (*xCachesize)(sqlite3_pcache*, int nCachesize); int (*xPagecount)(sqlite3_pcache*); void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); void (*xUnpin)(sqlite3_pcache*, void*, int discard); void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); void (*xDestroy)(sqlite3_pcache*); }; /* ** CAPI3REF: Online Backup Object ** ** The sqlite3_backup object records state information about an ongoing ** online backup operation. ^The sqlite3_backup object is created by ** a call to [sqlite3_backup_init()] and is destroyed by a call to ** [sqlite3_backup_finish()]. ** ** See Also: [Using the SQLite Online Backup API] */ typedef struct sqlite3_backup sqlite3_backup; /* ** CAPI3REF: Online Backup API. ** ** The backup API copies the content of one database into another. ** It is useful either for creating backups of databases or ** for copying in-memory databases to or from persistent files. ** ** See Also: [Using the SQLite Online Backup API] ** ** ^Exclusive access is required to the destination database for the ** duration of the operation. ^However the source database is only ** read-locked while it is actually being read; it is not locked ** continuously for the entire backup operation. ^Thus, the backup may be ** performed on a live source database without preventing other users from ** reading or writing to the source database while the backup is underway. ** ** ^(To perform a backup operation: **
          **
        1. sqlite3_backup_init() is called once to initialize the ** backup, **
        2. sqlite3_backup_step() is called one or more times to transfer ** the data between the two databases, and finally **
        3. sqlite3_backup_finish() is called to release all resources ** associated with the backup operation. **
        )^ ** There should be exactly one call to sqlite3_backup_finish() for each ** successful call to sqlite3_backup_init(). ** ** sqlite3_backup_init() ** ** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the ** [database connection] associated with the destination database ** and the database name, respectively. ** ^The database name is "main" for the main database, "temp" for the ** temporary database, or the name specified after the AS keyword in ** an [ATTACH] statement for an attached database. ** ^The S and M arguments passed to ** sqlite3_backup_init(D,N,S,M) identify the [database connection] ** and database name of the source database, respectively. ** ^The source and destination [database connections] (parameters S and D) ** must be different or else sqlite3_backup_init(D,N,S,M) will file with ** an error. ** ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is ** returned and an error code and error message are store3d in the ** destination [database connection] D. ** ^The error code and message for the failed call to sqlite3_backup_init() ** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or ** [sqlite3_errmsg16()] functions. ** ^A successful call to sqlite3_backup_init() returns a pointer to an ** [sqlite3_backup] object. ** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and ** sqlite3_backup_finish() functions to perform the specified backup ** operation. ** ** sqlite3_backup_step() ** ** ^Function sqlite3_backup_step(B,N) will copy up to N pages between ** the source and destination databases specified by [sqlite3_backup] object B. ** ^If N is negative, all remaining source pages are copied. ** ^If sqlite3_backup_step(B,N) successfully copies N pages and there ** are still more pages to be copied, then the function resturns [SQLITE_OK]. ** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages ** from source to destination, then it returns [SQLITE_DONE]. ** ^If an error occurs while running sqlite3_backup_step(B,N), ** then an [error code] is returned. ^As well as [SQLITE_OK] and ** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], ** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. ** ** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if **
          **
        1. the destination database was opened read-only, or **
        2. the destination database is using write-ahead-log journaling ** and the destination and source page sizes differ, or **
        3. The destination database is an in-memory database and the ** destination and source page sizes differ. **
        )^ ** ** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then ** the [sqlite3_busy_handler | busy-handler function] ** is invoked (if one is specified). ^If the ** busy-handler returns non-zero before the lock is available, then ** [SQLITE_BUSY] is returned to the caller. ^In this case the call to ** sqlite3_backup_step() can be retried later. ^If the source ** [database connection] ** is being used to write to the source database when sqlite3_backup_step() ** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this ** case the call to sqlite3_backup_step() can be retried later on. ^(If ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or ** [SQLITE_READONLY] is returned, then ** there is no point in retrying the call to sqlite3_backup_step(). These ** errors are considered fatal.)^ The application must accept ** that the backup operation has failed and pass the backup operation handle ** to the sqlite3_backup_finish() to release associated resources. ** ** ^The first call to sqlite3_backup_step() obtains an exclusive lock ** on the destination file. ^The exclusive lock is not released until either ** sqlite3_backup_finish() is called or the backup operation is complete ** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to ** sqlite3_backup_step() obtains a [shared lock] on the source database that ** lasts for the duration of the sqlite3_backup_step() call. ** ^Because the source database is not locked between calls to ** sqlite3_backup_step(), the source database may be modified mid-way ** through the backup process. ^If the source database is modified by an ** external process or via a database connection other than the one being ** used by the backup operation, then the backup will be automatically ** restarted by the next call to sqlite3_backup_step(). ^If the source ** database is modified by the using the same database connection as is used ** by the backup operation, then the backup database is automatically ** updated at the same time. ** ** sqlite3_backup_finish() ** ** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the ** application wishes to abandon the backup operation, the application ** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). ** ^The sqlite3_backup_finish() interfaces releases all ** resources associated with the [sqlite3_backup] object. ** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any ** active write-transaction on the destination database is rolled back. ** The [sqlite3_backup] object is invalid ** and may not be used following a call to sqlite3_backup_finish(). ** ** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no ** sqlite3_backup_step() errors occurred, regardless or whether or not ** sqlite3_backup_step() completed. ** ^If an out-of-memory condition or IO error occurred during any prior ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then ** sqlite3_backup_finish() returns the corresponding [error code]. ** ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() ** is not a permanent error and does not affect the return value of ** sqlite3_backup_finish(). ** ** sqlite3_backup_remaining(), sqlite3_backup_pagecount() ** ** ^Each call to sqlite3_backup_step() sets two values inside ** the [sqlite3_backup] object: the number of pages still to be backed ** up and the total number of pages in the source database file. ** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces ** retrieve these two values, respectively. ** ** ^The values returned by these functions are only updated by ** sqlite3_backup_step(). ^If the source database is modified during a backup ** operation, then the values are not updated to account for any extra ** pages that need to be updated or the size of the source database file ** changing. ** ** Concurrent Usage of Database Handles ** ** ^The source [database connection] may be used by the application for other ** purposes while a backup operation is underway or being initialized. ** ^If SQLite is compiled and configured to support threadsafe database ** connections, then the source database connection may be used concurrently ** from within other threads. ** ** However, the application must guarantee that the destination ** [database connection] is not passed to any other API (by any thread) after ** sqlite3_backup_init() is called and before the corresponding call to ** sqlite3_backup_finish(). SQLite does not currently check to see ** if the application incorrectly accesses the destination [database connection] ** and so no error code is reported, but the operations may malfunction ** nevertheless. Use of the destination database connection while a ** backup is in progress might also also cause a mutex deadlock. ** ** If running in [shared cache mode], the application must ** guarantee that the shared cache used by the destination database ** is not accessed while the backup is running. In practice this means ** that the application must guarantee that the disk file being ** backed up to is not accessed by any connection within the process, ** not just the specific connection that was passed to sqlite3_backup_init(). ** ** The [sqlite3_backup] object itself is partially threadsafe. Multiple ** threads may safely make multiple concurrent calls to sqlite3_backup_step(). ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() ** APIs are not strictly speaking threadsafe. If they are invoked at the ** same time as another thread is invoking sqlite3_backup_step() it is ** possible that they return invalid values. */ SQLITE_API sqlite3_backup *sqlite3_backup_init( sqlite3 *pDest, /* Destination database handle */ const char *zDestName, /* Destination database name */ sqlite3 *pSource, /* Source database handle */ const char *zSourceName /* Source database name */ ); SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); /* ** CAPI3REF: Unlock Notification ** ** ^When running in shared-cache mode, a database operation may fail with ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or ** individual tables within the shared-cache cannot be obtained. See ** [SQLite Shared-Cache Mode] for a description of shared-cache locking. ** ^This API may be used to register a callback that SQLite will invoke ** when the connection currently holding the required lock relinquishes it. ** ^This API is only available if the library was compiled with the ** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. ** ** See Also: [Using the SQLite Unlock Notification Feature]. ** ** ^Shared-cache locks are released when a database connection concludes ** its current transaction, either by committing it or rolling it back. ** ** ^When a connection (known as the blocked connection) fails to obtain a ** shared-cache lock and SQLITE_LOCKED is returned to the caller, the ** identity of the database connection (the blocking connection) that ** has locked the required resource is stored internally. ^After an ** application receives an SQLITE_LOCKED error, it may call the ** sqlite3_unlock_notify() method with the blocked connection handle as ** the first argument to register for a callback that will be invoked ** when the blocking connections current transaction is concluded. ^The ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] ** call that concludes the blocking connections transaction. ** ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, ** there is a chance that the blocking connection will have already ** concluded its transaction by the time sqlite3_unlock_notify() is invoked. ** If this happens, then the specified callback is invoked immediately, ** from within the call to sqlite3_unlock_notify().)^ ** ** ^If the blocked connection is attempting to obtain a write-lock on a ** shared-cache table, and more than one other connection currently holds ** a read-lock on the same table, then SQLite arbitrarily selects one of ** the other connections to use as the blocking connection. ** ** ^(There may be at most one unlock-notify callback registered by a ** blocked connection. If sqlite3_unlock_notify() is called when the ** blocked connection already has a registered unlock-notify callback, ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is ** called with a NULL pointer as its second argument, then any existing ** unlock-notify callback is canceled. ^The blocked connections ** unlock-notify callback may also be canceled by closing the blocked ** connection using [sqlite3_close()]. ** ** The unlock-notify callback is not reentrant. If an application invokes ** any sqlite3_xxx API functions from within an unlock-notify callback, a ** crash or deadlock may be the result. ** ** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always ** returns SQLITE_OK. ** ** Callback Invocation Details ** ** When an unlock-notify callback is registered, the application provides a ** single void* pointer that is passed to the callback when it is invoked. ** However, the signature of the callback function allows SQLite to pass ** it an array of void* context pointers. The first argument passed to ** an unlock-notify callback is a pointer to an array of void* pointers, ** and the second is the number of entries in the array. ** ** When a blocking connections transaction is concluded, there may be ** more than one blocked connection that has registered for an unlock-notify ** callback. ^If two or more such blocked connections have specified the ** same callback function, then instead of invoking the callback function ** multiple times, it is invoked once with the set of void* context pointers ** specified by the blocked connections bundled together into an array. ** This gives the application an opportunity to prioritize any actions ** related to the set of unblocked database connections. ** ** Deadlock Detection ** ** Assuming that after registering for an unlock-notify callback a ** database waits for the callback to be issued before taking any further ** action (a reasonable assumption), then using this API may cause the ** application to deadlock. For example, if connection X is waiting for ** connection Y's transaction to be concluded, and similarly connection ** Y is waiting on connection X's transaction, then neither connection ** will proceed and the system may remain deadlocked indefinitely. ** ** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock ** detection. ^If a given call to sqlite3_unlock_notify() would put the ** system in a deadlocked state, then SQLITE_LOCKED is returned and no ** unlock-notify callback is registered. The system is said to be in ** a deadlocked state if connection A has registered for an unlock-notify ** callback on the conclusion of connection B's transaction, and connection ** B has itself registered for an unlock-notify callback when connection ** A's transaction is concluded. ^Indirect deadlock is also detected, so ** the system is also considered to be deadlocked if connection B has ** registered for an unlock-notify callback on the conclusion of connection ** C's transaction, where connection C is waiting on connection A. ^Any ** number of levels of indirection are allowed. ** ** The "DROP TABLE" Exception ** ** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost ** always appropriate to call sqlite3_unlock_notify(). There is however, ** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, ** SQLite checks if there are any currently executing SELECT statements ** that belong to the same connection. If there are, SQLITE_LOCKED is ** returned. In this case there is no "blocking connection", so invoking ** sqlite3_unlock_notify() results in the unlock-notify callback being ** invoked immediately. If the application then re-attempts the "DROP TABLE" ** or "DROP INDEX" query, an infinite loop might be the result. ** ** One way around this problem is to check the extended error code returned ** by an sqlite3_step() call. ^(If there is a blocking connection, then the ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in ** the special "DROP TABLE/INDEX" case, the extended error code is just ** SQLITE_LOCKED.)^ */ SQLITE_API int sqlite3_unlock_notify( sqlite3 *pBlocked, /* Waiting connection */ void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ void *pNotifyArg /* Argument to pass to xNotify */ ); /* ** CAPI3REF: String Comparison ** ** ^The [sqlite3_strnicmp()] API allows applications and extensions to ** compare the contents of two buffers containing UTF-8 strings in a ** case-independent fashion, using the same definition of case independence ** that SQLite uses internally when comparing identifiers. */ SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); /* ** CAPI3REF: Error Logging Interface ** ** ^The [sqlite3_log()] interface writes a message into the error log ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. ** ^If logging is enabled, the zFormat string and subsequent arguments are ** used with [sqlite3_snprintf()] to generate the final output string. ** ** The sqlite3_log() interface is intended for use by extensions such as ** virtual tables, collating functions, and SQL functions. While there is ** nothing to prevent an application from calling sqlite3_log(), doing so ** is considered bad form. ** ** The zFormat string must not be NULL. ** ** To avoid deadlocks and other threading problems, the sqlite3_log() routine ** will not use dynamically allocated memory. The log message is stored in ** a fixed-length buffer on the stack. If the log message is longer than ** a few hundred characters, it will be truncated to the length of the ** buffer. */ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); /* ** CAPI3REF: Write-Ahead Log Commit Hook ** ** ^The [sqlite3_wal_hook()] function is used to register a callback that ** will be invoked each time a database connection commits data to a ** [write-ahead log] (i.e. whenever a transaction is committed in ** [journal_mode | journal_mode=WAL mode]). ** ** ^The callback is invoked by SQLite after the commit has taken place and ** the associated write-lock on the database released, so the implementation ** may read, write or [checkpoint] the database as required. ** ** ^The first parameter passed to the callback function when it is invoked ** is a copy of the third parameter passed to sqlite3_wal_hook() when ** registering the callback. ^The second is a copy of the database handle. ** ^The third parameter is the name of the database that was written to - ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter ** is the number of pages currently in the write-ahead log file, ** including those that were just committed. ** ** The callback function should normally return [SQLITE_OK]. ^If an error ** code is returned, that error will propagate back up through the ** SQLite code base to cause the statement that provoked the callback ** to report an error, though the commit will have still occurred. If the ** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value ** that does not correspond to any valid SQLite error code, the results ** are undefined. ** ** A single database handle may have at most a single write-ahead log callback ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any ** previously registered write-ahead log callback. ^Note that the ** [sqlite3_wal_autocheckpoint()] interface and the ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will ** those overwrite any prior [sqlite3_wal_hook()] settings. */ SQLITE_API void *sqlite3_wal_hook( sqlite3*, int(*)(void *,sqlite3*,const char*,int), void* ); /* ** CAPI3REF: Configure an auto-checkpoint ** ** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around ** [sqlite3_wal_hook()] that causes any database on [database connection] D ** to automatically [checkpoint] ** after committing a transaction if there are N or ** more frames in the [write-ahead log] file. ^Passing zero or ** a negative value as the nFrame parameter disables automatic ** checkpoints entirely. ** ** ^The callback registered by this function replaces any existing callback ** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback ** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism ** configured by this function. ** ** ^The [wal_autocheckpoint pragma] can be used to invoke this interface ** from SQL. ** ** ^Every new [database connection] defaults to having the auto-checkpoint ** enabled with a threshold of 1000 pages. The use of this interface ** is only necessary if the default setting is found to be suboptimal ** for a particular application. */ SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N); /* ** CAPI3REF: Checkpoint a database ** ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X ** on [database connection] D to be [checkpointed]. ^If X is NULL or an ** empty string, then a checkpoint is run on all databases of ** connection D. ^If the database connection D is not in ** [WAL | write-ahead log mode] then this interface is a harmless no-op. ** ** ^The [wal_checkpoint pragma] can be used to invoke this interface ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the ** [wal_autocheckpoint pragma] can be used to cause this interface to be ** run whenever the WAL reaches a certain size threshold. */ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); /* ** Undo the hack that converts floating point types to integer for ** builds on processors without floating point support. */ #ifdef SQLITE_OMIT_FLOATING_POINT # undef double #endif #ifdef __cplusplus } /* End of the 'extern "C"' block */ #endif #endif /* ** 2010 August 30 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* */ #ifndef _SQLITE3RTREE_H_ #define _SQLITE3RTREE_H_ #ifdef __cplusplus extern "C" { #endif typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; /* ** Register a geometry callback named zGeom that can be used as part of an ** R-Tree geometry query as follows: ** ** SELECT ... FROM WHERE MATCH $zGeom(... params ...) */ SQLITE_API int sqlite3_rtree_geometry_callback( sqlite3 *db, const char *zGeom, int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes), void *pContext ); /* ** A pointer to a structure of the following type is passed as the first ** argument to callbacks registered using rtree_geometry_callback(). */ struct sqlite3_rtree_geometry { void *pContext; /* Copy of pContext passed to s_r_g_c() */ int nParam; /* Size of array aParam[] */ double *aParam; /* Parameters passed to SQL geom function */ void *pUser; /* Callback implementation user data */ void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ }; #ifdef __cplusplus } /* end of the 'extern "C"' block */ #endif #endif /* ifndef _SQLITE3RTREE_H_ */ cmtk-3.0.0/Utilities/sqlite3/Makefile.am0000644000177700000170000000106311340335155017102 0ustar torstenman AM_CFLAGS = @THREADSAFE_FLAGS@ @DYNAMIC_EXTENSION_FLAGS@ -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE lib_LTLIBRARIES = libsqlite3.la libsqlite3_la_SOURCES = sqlite3.c libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8 bin_PROGRAMS = sqlite3 sqlite3_SOURCES = shell.c sqlite3.h sqlite3_LDADD = $(top_builddir)/libsqlite3.la @READLINE_LIBS@ sqlite3_DEPENDENCIES = $(top_builddir)/libsqlite3.la include_HEADERS = sqlite3.h sqlite3ext.h EXTRA_DIST = sqlite3.pc sqlite3.1 pkgconfigdir = ${libdir}/pkgconfig pkgconfig_DATA = sqlite3.pc man_MANS = sqlite3.1 cmtk-3.0.0/Utilities/sqlite3/missing0000755000177700000170000002540611340335155016454 0ustar torstenman#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: cmtk-3.0.0/Utilities/sqlite3/INSTALL0000644000177700000170000002243211340335155016102 0ustar torstenmanInstallation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. cmtk-3.0.0/Utilities/sqlite3/sqlite3.c0000644000177700000170002040236711517604372016622 0ustar torstenman#include "cmtk_sqlite3_mangle.h" /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version 3.7.4. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a one translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements ** of 5% or more are commonly seen when SQLite is compiled as a single ** translation unit. ** ** This file is all you need to compile SQLite. To use SQLite in other ** programs, you need this file and the "sqlite3.h" header file that defines ** the programming interface to the SQLite library. (If you do not have ** the "sqlite3.h" header file at hand, you will find a copy embedded within ** the text of this file. Search for "Begin file sqlite3.h" to find the start ** of the embedded sqlite3.h header file.) Additional code files may be needed ** if you want a wrapper to interface SQLite with your choice of programming ** language. The code for the "sqlite3" command-line shell is also in a ** separate file. This file contains only code for the core SQLite library. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 #ifndef SQLITE_PRIVATE # define SQLITE_PRIVATE static #endif #ifndef SQLITE_API # define SQLITE_API #endif /************** Begin file sqliteInt.h ***************************************/ /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ /* ** These #defines should enable >2GB file support on POSIX if the ** underlying operating system supports it. If the OS lacks ** large file support, or if the OS is windows, these should be no-ops. ** ** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any ** system #includes. Hence, this block of code must be the very first ** code in all source files. ** ** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch ** on the compiler command line. This is necessary if you are compiling ** on a recent machine (ex: Red Hat 7.2) but you want your code to work ** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2 ** without this option, LFS is enable. But LFS does not exist in the kernel ** in Red Hat 6.0, so the code won't work. Hence, for maximum binary ** portability you should omit LFS. ** ** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later. */ #ifndef SQLITE_DISABLE_LFS # define _LARGE_FILE 1 # ifndef _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 64 # endif # define _LARGEFILE_SOURCE 1 #endif /* ** Include the configuration header output by 'configure' if we're using the ** autoconf-based build */ #ifdef _HAVE_SQLITE_CONFIG_H #include "config.h" #endif /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/ /************** Begin file sqliteLimit.h *************************************/ /* ** 2007 May 7 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file defines various limits of what SQLite can process. */ /* ** The maximum length of a TEXT or BLOB in bytes. This also ** limits the size of a row in a table or index. ** ** The hard limit is the ability of a 32-bit signed integer ** to count the size: 2^31-1 or 2147483647. */ #ifndef SQLITE_MAX_LENGTH # define SQLITE_MAX_LENGTH 1000000000 #endif /* ** This is the maximum number of ** ** * Columns in a table ** * Columns in an index ** * Columns in a view ** * Terms in the SET clause of an UPDATE statement ** * Terms in the result set of a SELECT statement ** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement. ** * Terms in the VALUES clause of an INSERT statement ** ** The hard upper limit here is 32676. Most database people will ** tell you that in a well-normalized database, you usually should ** not have more than a dozen or so columns in any table. And if ** that is the case, there is no point in having more than a few ** dozen values in any of the other situations described above. */ #ifndef SQLITE_MAX_COLUMN # define SQLITE_MAX_COLUMN 2000 #endif /* ** The maximum length of a single SQL statement in bytes. ** ** It used to be the case that setting this value to zero would ** turn the limit off. That is no longer true. It is not possible ** to turn this limit off. */ #ifndef SQLITE_MAX_SQL_LENGTH # define SQLITE_MAX_SQL_LENGTH 1000000000 #endif /* ** The maximum depth of an expression tree. This is limited to ** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might ** want to place more severe limits on the complexity of an ** expression. ** ** A value of 0 used to mean that the limit was not enforced. ** But that is no longer true. The limit is now strictly enforced ** at all times. */ #ifndef SQLITE_MAX_EXPR_DEPTH # define SQLITE_MAX_EXPR_DEPTH 1000 #endif /* ** The maximum number of terms in a compound SELECT statement. ** The code generator for compound SELECT statements does one ** level of recursion for each term. A stack overflow can result ** if the number of terms is too large. In practice, most SQL ** never has more than 3 or 4 terms. Use a value of 0 to disable ** any limit on the number of terms in a compount SELECT. */ #ifndef SQLITE_MAX_COMPOUND_SELECT # define SQLITE_MAX_COMPOUND_SELECT 500 #endif /* ** The maximum number of opcodes in a VDBE program. ** Not currently enforced. */ #ifndef SQLITE_MAX_VDBE_OP # define SQLITE_MAX_VDBE_OP 25000 #endif /* ** The maximum number of arguments to an SQL function. */ #ifndef SQLITE_MAX_FUNCTION_ARG # define SQLITE_MAX_FUNCTION_ARG 127 #endif /* ** The maximum number of in-memory pages to use for the main database ** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE */ #ifndef SQLITE_DEFAULT_CACHE_SIZE # define SQLITE_DEFAULT_CACHE_SIZE 2000 #endif #ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE # define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500 #endif /* ** The default number of frames to accumulate in the log file before ** checkpointing the database in WAL mode. */ #ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT # define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000 #endif /* ** The maximum number of attached databases. This must be between 0 ** and 30. The upper bound on 30 is because a 32-bit integer bitmap ** is used internally to track attached databases. */ #ifndef SQLITE_MAX_ATTACHED # define SQLITE_MAX_ATTACHED 10 #endif /* ** The maximum value of a ?nnn wildcard that the parser will accept. */ #ifndef SQLITE_MAX_VARIABLE_NUMBER # define SQLITE_MAX_VARIABLE_NUMBER 999 #endif /* Maximum page size. The upper bound on this value is 65536. This a limit ** imposed by the use of 16-bit offsets within each page. ** ** Earlier versions of SQLite allowed the user to change this value at ** compile time. This is no longer permitted, on the grounds that it creates ** a library that is technically incompatible with an SQLite library ** compiled with a different limit. If a process operating on a database ** with a page-size of 65536 bytes crashes, then an instance of SQLite ** compiled with the default page-size limit will not be able to rollback ** the aborted transaction. This could lead to database corruption. */ #ifdef SQLITE_MAX_PAGE_SIZE # undef SQLITE_MAX_PAGE_SIZE #endif #define SQLITE_MAX_PAGE_SIZE 65536 /* ** The default size of a database page. */ #ifndef SQLITE_DEFAULT_PAGE_SIZE # define SQLITE_DEFAULT_PAGE_SIZE 1024 #endif #if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE # undef SQLITE_DEFAULT_PAGE_SIZE # define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE #endif /* ** Ordinarily, if no value is explicitly provided, SQLite creates databases ** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain ** device characteristics (sector-size and atomic write() support), ** SQLite may choose a larger value. This constant is the maximum value ** SQLite will choose on its own. */ #ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE # define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192 #endif #if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE # undef SQLITE_MAX_DEFAULT_PAGE_SIZE # define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE #endif /* ** Maximum number of pages in one database file. ** ** This is really just the default value for the max_page_count pragma. ** This value can be lowered (or raised) at run-time using that the ** max_page_count macro. */ #ifndef SQLITE_MAX_PAGE_COUNT # define SQLITE_MAX_PAGE_COUNT 1073741823 #endif /* ** Maximum length (in bytes) of the pattern in a LIKE or GLOB ** operator. */ #ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH # define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000 #endif /* ** Maximum depth of recursion for triggers. ** ** A value of 1 means that a trigger program will not be able to itself ** fire any triggers. A value of 0 means that no trigger programs at all ** may be executed. */ #ifndef SQLITE_MAX_TRIGGER_DEPTH # define SQLITE_MAX_TRIGGER_DEPTH 1000 #endif /************** End of sqliteLimit.h *****************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /* Disable nuisance warnings on Borland compilers */ #if defined(__BORLANDC__) #pragma warn -rch /* unreachable code */ #pragma warn -ccc /* Condition is always true or false */ #pragma warn -aus /* Assigned value is never used */ #pragma warn -csu /* Comparing signed and unsigned */ #pragma warn -spa /* Suspicious pointer arithmetic */ #endif /* Needed for various definitions... */ #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif /* ** Include standard header files as necessary */ #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_INTTYPES_H #include #endif /* ** The number of samples of an index that SQLite takes in order to ** construct a histogram of the table content when running ANALYZE ** and with SQLITE_ENABLE_STAT2 */ #define SQLITE_INDEX_SAMPLES 10 /* ** The following macros are used to cast pointers to integers and ** integers to pointers. The way you do this varies from one compiler ** to the next, so we have developed the following set of #if statements ** to generate appropriate macros for a wide range of compilers. ** ** The correct "ANSI" way to do this is to use the intptr_t type. ** Unfortunately, that typedef is not available on all compilers, or ** if it is available, it requires an #include of specific headers ** that vary from one machine to the next. ** ** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on ** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). ** So we have to define the macros in different ways depending on the ** compiler. */ #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) #elif !defined(__GNUC__) /* Works for compilers other than LLVM */ # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) #elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ # define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) #else /* Generates a warning - but it always works */ # define SQLITE_INT_TO_PTR(X) ((void*)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(X)) #endif /* ** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. ** 0 means mutexes are permanently disable and the library is never ** threadsafe. 1 means the library is serialized which is the highest ** level of threadsafety. 2 means the libary is multithreaded - multiple ** threads can use SQLite as long as no two threads try to use the same ** database connection at the same time. ** ** Older versions of SQLite used an optional THREADSAFE macro. ** We support that for legacy. */ #if !defined(SQLITE_THREADSAFE) #if defined(THREADSAFE) # define SQLITE_THREADSAFE THREADSAFE #else # define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */ #endif #endif /* ** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1. ** It determines whether or not the features related to ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can ** be overridden at runtime using the sqlite3_config() API. */ #if !defined(SQLITE_DEFAULT_MEMSTATUS) # define SQLITE_DEFAULT_MEMSTATUS 1 #endif /* ** Exactly one of the following macros must be defined in order to ** specify which memory allocation subsystem to use. ** ** SQLITE_SYSTEM_MALLOC // Use normal system malloc() ** SQLITE_MEMDEBUG // Debugging version of system malloc() ** ** (Historical note: There used to be several other options, but we've ** pared it down to just these two.) ** ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as ** the default. */ #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)>1 # error "At most one of the following compile-time configuration options\ is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG" #endif #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)==0 # define SQLITE_SYSTEM_MALLOC 1 #endif /* ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the ** sizes of memory allocations below this value where possible. */ #if !defined(SQLITE_MALLOC_SOFT_LIMIT) # define SQLITE_MALLOC_SOFT_LIMIT 1024 #endif /* ** We need to define _XOPEN_SOURCE as follows in order to enable ** recursive mutexes on most Unix systems. But Mac OS X is different. ** The _XOPEN_SOURCE define causes problems for Mac OS X we are told, ** so it is omitted there. See ticket #2673. ** ** Later we learn that _XOPEN_SOURCE is poorly or incorrectly ** implemented on some systems. So we avoid defining it at all ** if it is already defined or if it is unneeded because we are ** not doing a threadsafe build. Ticket #2681. ** ** See also ticket #2741. */ #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ #endif /* ** The TCL headers are only needed when compiling the TCL bindings. */ #if defined(SQLITE_TCL) || defined(TCLSH) # include #endif /* ** Many people are failing to set -DNDEBUG=1 when compiling SQLite. ** Setting NDEBUG makes the code smaller and run faster. So the following ** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1 ** option is set. Thus NDEBUG becomes an opt-in rather than an opt-out ** feature. */ #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) # define NDEBUG 1 #endif /* ** The testcase() macro is used to aid in coverage testing. When ** doing coverage testing, the condition inside the argument to ** testcase() must be evaluated both true and false in order to ** get full branch coverage. The testcase() macro is inserted ** to help ensure adequate test coverage in places where simple ** condition/decision coverage is inadequate. For example, testcase() ** can be used to make sure boundary values are tested. For ** bitmask tests, testcase() can be used to make sure each bit ** is significant and used at least once. On switch statements ** where multiple cases go to the same block of code, testcase() ** can insure that all cases are evaluated. ** */ #ifdef SQLITE_COVERAGE_TEST SQLITE_PRIVATE void sqlite3Coverage(int); # define testcase(X) if( X ){ sqlite3Coverage(__LINE__); } #else # define testcase(X) #endif /* ** The TESTONLY macro is used to enclose variable declarations or ** other bits of code that are needed to support the arguments ** within testcase() and assert() macros. */ #if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST) # define TESTONLY(X) X #else # define TESTONLY(X) #endif /* ** Sometimes we need a small amount of code such as a variable initialization ** to setup for a later assert() statement. We do not want this code to ** appear when assert() is disabled. The following macro is therefore ** used to contain that setup code. The "VVA" acronym stands for ** "Verification, Validation, and Accreditation". In other words, the ** code within VVA_ONLY() will only run during verification processes. */ #ifndef NDEBUG # define VVA_ONLY(X) X #else # define VVA_ONLY(X) #endif /* ** The ALWAYS and NEVER macros surround boolean expressions which ** are intended to always be true or false, respectively. Such ** expressions could be omitted from the code completely. But they ** are included in a few cases in order to enhance the resilience ** of SQLite to unexpected behavior - to make the code "self-healing" ** or "ductile" rather than being "brittle" and crashing at the first ** hint of unplanned behavior. ** ** In other words, ALWAYS and NEVER are added for defensive code. ** ** When doing coverage testing ALWAYS and NEVER are hard-coded to ** be true and false so that the unreachable code then specify will ** not be counted as untested code. */ #if defined(SQLITE_COVERAGE_TEST) # define ALWAYS(X) (1) # define NEVER(X) (0) #elif !defined(NDEBUG) # define ALWAYS(X) ((X)?1:(assert(0),0)) # define NEVER(X) ((X)?(assert(0),1):0) #else # define ALWAYS(X) (X) # define NEVER(X) (X) #endif /* ** Return true (non-zero) if the input is a integer that is too large ** to fit in 32-bits. This macro is used inside of various testcase() ** macros to verify that we have tested SQLite for large-file support. */ #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) /* ** The macro unlikely() is a hint that surrounds a boolean ** expression that is usually false. Macro likely() surrounds ** a boolean expression that is usually true. GCC is able to ** use these hints to generate better code, sometimes. */ #if defined(__GNUC__) && 0 # define likely(X) __builtin_expect((X),1) # define unlikely(X) __builtin_expect((X),0) #else # define likely(X) !!(X) # define unlikely(X) !!(X) #endif /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ /************** Begin file sqlite3.h *****************************************/ /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the SQLite library ** presents to client programs. If a C-function, structure, datatype, ** or constant definition does not appear in this file, then it is ** not a published API of SQLite, is subject to change without ** notice, and should not be referenced by programs that use SQLite. ** ** Some of the definitions that are in this file are marked as ** "experimental". Experimental interfaces are normally new ** features recently added to SQLite. We do not anticipate changes ** to experimental interfaces but reserve the right to make minor changes ** if experience from use "in the wild" suggest such changes are prudent. ** ** The official C-language API documentation for SQLite is derived ** from comments in this file. This file is the authoritative source ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ #include /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. */ #if 0 extern "C" { #endif /* ** Add the ability to override 'extern' */ #ifndef SQLITE_EXTERN # define SQLITE_EXTERN extern #endif #ifndef SQLITE_API # define SQLITE_API #endif /* ** These no-op macros are used in front of interfaces to mark those ** interfaces as either deprecated or experimental. New applications ** should not use deprecated interfaces - they are support for backwards ** compatibility only. Application writers should be aware that ** experimental interfaces are subject to change in point releases. ** ** These macros used to resolve to various kinds of compiler magic that ** would generate warning messages when they were used. But that ** compiler magic ended up generating such a flurry of bug reports ** that we have taken it all out and gone back to using simple ** noop macros. */ #define SQLITE_DEPRECATED #define SQLITE_EXPERIMENTAL /* ** Ensure these symbols were not defined by some previous header file. */ #ifdef SQLITE_VERSION # undef SQLITE_VERSION #endif #ifdef SQLITE_VERSION_NUMBER # undef SQLITE_VERSION_NUMBER #endif /* ** CAPI3REF: Compile-Time Library Version Numbers ** ** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header ** evaluates to a string literal that is the SQLite version in the ** format "X.Y.Z" where X is the major version number (always 3 for ** SQLite3) and Y is the minor version number and Z is the release number.)^ ** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer ** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same ** numbers used in [SQLITE_VERSION].)^ ** The SQLITE_VERSION_NUMBER for any given release of SQLite will also ** be larger than the release from which it is derived. Either Y will ** be held constant and Z will be incremented or else Y will be incremented ** and Z will be reset to zero. ** ** Since version 3.6.18, SQLite source code has been stored in the ** Fossil configuration management ** system. ^The SQLITE_SOURCE_ID macro evaluates to ** a string which identifies a particular check-in of SQLite ** within its configuration management system. ^The SQLITE_SOURCE_ID ** string contains the date and time of the check-in (UTC) and an SHA1 ** hash of the entire source tree. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.7.4" #define SQLITE_VERSION_NUMBER 3007004 #define SQLITE_SOURCE_ID "2010-12-07 20:14:09 a586a4deeb25330037a49df295b36aaf624d0f45" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version, sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros ** but are associated with the library instead of the header file. ^(Cautious ** programmers might include assert() statements in their application to ** verify that values returned by these interfaces match the macros in ** the header, and thus insure that the application is ** compiled with matching library and header files. ** **
        ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
        ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
        ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
        ** 
        )^ ** ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] ** macro. ^The sqlite3_libversion() function returns a pointer to the ** to the sqlite3_version[] string constant. The sqlite3_libversion() ** function is provided for use in DLLs since DLL users usually do not have ** direct access to string constants within the DLL. ^The ** sqlite3_libversion_number() function returns an integer equal to ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns ** a pointer to a string constant whose value is the same as the ** [SQLITE_SOURCE_ID] C preprocessor macro. ** ** See also: [sqlite_version()] and [sqlite_source_id()]. */ SQLITE_API const char sqlite3_version[] = SQLITE_VERSION; SQLITE_API const char *sqlite3_libversion(void); SQLITE_API const char *sqlite3_sourceid(void); SQLITE_API int sqlite3_libversion_number(void); /* ** CAPI3REF: Run-Time Library Compilation Options Diagnostics ** ** ^The sqlite3_compileoption_used() function returns 0 or 1 ** indicating whether the specified option was defined at ** compile time. ^The SQLITE_ prefix may be omitted from the ** option name passed to sqlite3_compileoption_used(). ** ** ^The sqlite3_compileoption_get() function allows iterating ** over the list of options that were defined at compile time by ** returning the N-th compile time option string. ^If N is out of range, ** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ ** prefix is omitted from any strings returned by ** sqlite3_compileoption_get(). ** ** ^Support for the diagnostic functions sqlite3_compileoption_used() ** and sqlite3_compileoption_get() may be omitted by specifying the ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. ** ** See also: SQL functions [sqlite_compileoption_used()] and ** [sqlite_compileoption_get()] and the [compile_options pragma]. */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS SQLITE_API int sqlite3_compileoption_used(const char *zOptName); SQLITE_API const char *sqlite3_compileoption_get(int N); #endif /* ** CAPI3REF: Test To See If The Library Is Threadsafe ** ** ^The sqlite3_threadsafe() function returns zero if and only if ** SQLite was compiled mutexing code omitted due to the ** [SQLITE_THREADSAFE] compile-time option being set to 0. ** ** SQLite can be compiled with or without mutexes. When ** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes ** are enabled and SQLite is threadsafe. When the ** [SQLITE_THREADSAFE] macro is 0, ** the mutexes are omitted. Without the mutexes, it is not safe ** to use SQLite concurrently from more than one thread. ** ** Enabling mutexes incurs a measurable performance penalty. ** So if speed is of utmost importance, it makes sense to disable ** the mutexes. But for maximum safety, mutexes should be enabled. ** ^The default behavior is for mutexes to be enabled. ** ** This interface can be used by an application to make sure that the ** version of SQLite that it is linking against was compiled with ** the desired setting of the [SQLITE_THREADSAFE] macro. ** ** This interface only reports on the compile-time mutex setting ** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but ** can be fully or partially disabled using a call to [sqlite3_config()] ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], ** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the ** sqlite3_threadsafe() function shows only the compile-time setting of ** thread safety, not any run-time changes to that setting made by ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() ** is unchanged by calls to sqlite3_config().)^ ** ** See the [threading mode] documentation for additional information. */ SQLITE_API int sqlite3_threadsafe(void); /* ** CAPI3REF: Database Connection Handle ** KEYWORDS: {database connection} {database connections} ** ** Each open SQLite database is represented by a pointer to an instance of ** the opaque structure named "sqlite3". It is useful to think of an sqlite3 ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] ** is its destructor. There are many other interfaces (such as ** [sqlite3_prepare_v2()], [sqlite3_create_function()], and ** [sqlite3_busy_timeout()] to name but three) that are methods on an ** sqlite3 object. */ typedef struct sqlite3 sqlite3; /* ** CAPI3REF: 64-Bit Integer Types ** KEYWORDS: sqlite_int64 sqlite_uint64 ** ** Because there is no cross-platform way to specify 64-bit integer types ** SQLite includes typedefs for 64-bit signed and unsigned integers. ** ** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. ** The sqlite_int64 and sqlite_uint64 types are supported for backwards ** compatibility only. ** ** ^The sqlite3_int64 and sqlite_int64 types can store integer values ** between -9223372036854775808 and +9223372036854775807 inclusive. ^The ** sqlite3_uint64 and sqlite_uint64 types can store integer values ** between 0 and +18446744073709551615 inclusive. */ #ifdef SQLITE_INT64_TYPE typedef SQLITE_INT64_TYPE sqlite_int64; typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; #elif defined(_MSC_VER) || defined(__BORLANDC__) typedef __int64 sqlite_int64; typedef unsigned __int64 sqlite_uint64; #else typedef long long int sqlite_int64; typedef unsigned long long int sqlite_uint64; #endif typedef sqlite_int64 sqlite3_int64; typedef sqlite_uint64 sqlite3_uint64; /* ** If compiling for a processor that lacks floating point support, ** substitute integer for floating-point. */ #ifdef SQLITE_OMIT_FLOATING_POINT # define double sqlite3_int64 #endif /* ** CAPI3REF: Closing A Database Connection ** ** ^The sqlite3_close() routine is the destructor for the [sqlite3] object. ** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is ** successfully destroyed and all associated resources are deallocated. ** ** Applications must [sqlite3_finalize | finalize] all [prepared statements] ** and [sqlite3_blob_close | close] all [BLOB handles] associated with ** the [sqlite3] object prior to attempting to close the object. ^If ** sqlite3_close() is called on a [database connection] that still has ** outstanding [prepared statements] or [BLOB handles], then it returns ** SQLITE_BUSY. ** ** ^If [sqlite3_close()] is invoked while a transaction is open, ** the transaction is automatically rolled back. ** ** The C parameter to [sqlite3_close(C)] must be either a NULL ** pointer or an [sqlite3] object pointer obtained ** from [sqlite3_open()], [sqlite3_open16()], or ** [sqlite3_open_v2()], and not previously closed. ** ^Calling sqlite3_close() with a NULL pointer argument is a ** harmless no-op. */ SQLITE_API int sqlite3_close(sqlite3 *); /* ** The type for a callback function. ** This is legacy and deprecated. It is included for historical ** compatibility and is not documented. */ typedef int (*sqlite3_callback)(void*,int,char**, char**); /* ** CAPI3REF: One-Step Query Execution Interface ** ** The sqlite3_exec() interface is a convenience wrapper around ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], ** that allows an application to run multiple statements of SQL ** without having to use a lot of C code. ** ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, ** semicolon-separate SQL statements passed into its 2nd argument, ** in the context of the [database connection] passed in as its 1st ** argument. ^If the callback function of the 3rd argument to ** sqlite3_exec() is not NULL, then it is invoked for each result row ** coming out of the evaluated SQL statements. ^The 4th argument to ** to sqlite3_exec() is relayed through to the 1st argument of each ** callback invocation. ^If the callback pointer to sqlite3_exec() ** is NULL, then no callback is ever invoked and result rows are ** ignored. ** ** ^If an error occurs while evaluating the SQL statements passed into ** sqlite3_exec(), then execution of the current statement stops and ** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() ** is not NULL then any error message is written into memory obtained ** from [sqlite3_malloc()] and passed back through the 5th parameter. ** To avoid memory leaks, the application should invoke [sqlite3_free()] ** on error message strings returned through the 5th parameter of ** of sqlite3_exec() after the error message string is no longer needed. ** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors ** occur, then sqlite3_exec() sets the pointer in its 5th parameter to ** NULL before returning. ** ** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() ** routine returns SQLITE_ABORT without invoking the callback again and ** without running any subsequent SQL statements. ** ** ^The 2nd argument to the sqlite3_exec() callback function is the ** number of columns in the result. ^The 3rd argument to the sqlite3_exec() ** callback is an array of pointers to strings obtained as if from ** [sqlite3_column_text()], one for each column. ^If an element of a ** result row is NULL then the corresponding string pointer for the ** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the ** sqlite3_exec() callback is an array of pointers to strings where each ** entry represents the name of corresponding result column as obtained ** from [sqlite3_column_name()]. ** ** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer ** to an empty string, or a pointer that contains only whitespace and/or ** SQL comments, then no SQL statements are evaluated and the database ** is not changed. ** ** Restrictions: ** **
          **
        • The application must insure that the 1st parameter to sqlite3_exec() ** is a valid and open [database connection]. **
        • The application must not close [database connection] specified by ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. **
        • The application must not modify the SQL statement text passed into ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. **
        */ SQLITE_API int sqlite3_exec( sqlite3*, /* An open database */ const char *sql, /* SQL to be evaluated */ int (*callback)(void*,int,char**,char**), /* Callback function */ void *, /* 1st argument to callback */ char **errmsg /* Error msg written here */ ); /* ** CAPI3REF: Result Codes ** KEYWORDS: SQLITE_OK {error code} {error codes} ** KEYWORDS: {result code} {result codes} ** ** Many SQLite functions return an integer result code from the set shown ** here in order to indicates success or failure. ** ** New error codes may be added in future versions of SQLite. ** ** See also: [SQLITE_IOERR_READ | extended result codes] */ #define SQLITE_OK 0 /* Successful result */ /* beginning-of-error-codes */ #define SQLITE_ERROR 1 /* SQL error or missing database */ #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ #define SQLITE_PERM 3 /* Access permission denied */ #define SQLITE_ABORT 4 /* Callback routine requested an abort */ #define SQLITE_BUSY 5 /* The database file is locked */ #define SQLITE_LOCKED 6 /* A table in the database is locked */ #define SQLITE_NOMEM 7 /* A malloc() failed */ #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ #define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */ #define SQLITE_FULL 13 /* Insertion failed because database is full */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ #define SQLITE_EMPTY 16 /* Database is empty */ #define SQLITE_SCHEMA 17 /* The database schema changed */ #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ #define SQLITE_MISMATCH 20 /* Data type mismatch */ #define SQLITE_MISUSE 21 /* Library used incorrectly */ #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ #define SQLITE_AUTH 23 /* Authorization denied */ #define SQLITE_FORMAT 24 /* Auxiliary database format error */ #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ #define SQLITE_NOTADB 26 /* File opened that is not a database file */ #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ #define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ /* end-of-error-codes */ /* ** CAPI3REF: Extended Result Codes ** KEYWORDS: {extended error code} {extended error codes} ** KEYWORDS: {extended result code} {extended result codes} ** ** In its default configuration, SQLite API routines return one of 26 integer ** [SQLITE_OK | result codes]. However, experience has shown that many of ** these result codes are too coarse-grained. They do not provide as ** much information about problems as programmers might like. In an effort to ** address this, newer versions of SQLite (version 3.3.8 and later) include ** support for additional result codes that provide more detailed information ** about errors. The extended result codes are enabled or disabled ** on a per database connection basis using the ** [sqlite3_extended_result_codes()] API. ** ** Some of the available extended result codes are listed here. ** One may expect the number of extended result codes will be expand ** over time. Software that uses extended result codes should expect ** to see new result codes in future releases of SQLite. ** ** The SQLITE_OK result code will never be extended. It will always ** be exactly zero. */ #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) #define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) #define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) #define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) #define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) #define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) #define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) #define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8)) #define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8)) #define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8)) #define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8)) #define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8)) #define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8)) #define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8)) #define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8)) #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) /* ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the ** 3rd parameter to the [sqlite3_open_v2()] interface and ** in the 4th parameter to the xOpen method of the ** [sqlite3_vfs] object. */ #define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ #define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ #define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ #define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ #define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ #define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ #define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */ #define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ #define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ #define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ /* ** CAPI3REF: Device Characteristics ** ** The xDeviceCharacteristics method of the [sqlite3_io_methods] ** object returns an integer which is a vector of the these ** bit values expressing I/O characteristics of the mass storage ** device that holds the file that the [sqlite3_io_methods] ** refers to. ** ** The SQLITE_IOCAP_ATOMIC property means that all writes of ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values ** mean that writes of blocks that are nnn bytes in size and ** are aligned to an address which is an integer multiple of ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means ** that when data is appended to a file, the data is appended ** first then the size of the file is extended, never the other ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that ** information is written to disk in the same order as calls ** to xWrite(). */ #define SQLITE_IOCAP_ATOMIC 0x00000001 #define SQLITE_IOCAP_ATOMIC512 0x00000002 #define SQLITE_IOCAP_ATOMIC1K 0x00000004 #define SQLITE_IOCAP_ATOMIC2K 0x00000008 #define SQLITE_IOCAP_ATOMIC4K 0x00000010 #define SQLITE_IOCAP_ATOMIC8K 0x00000020 #define SQLITE_IOCAP_ATOMIC16K 0x00000040 #define SQLITE_IOCAP_ATOMIC32K 0x00000080 #define SQLITE_IOCAP_ATOMIC64K 0x00000100 #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 /* ** CAPI3REF: File Locking Levels ** ** SQLite uses one of these integer values as the second ** argument to calls it makes to the xLock() and xUnlock() methods ** of an [sqlite3_io_methods] object. */ #define SQLITE_LOCK_NONE 0 #define SQLITE_LOCK_SHARED 1 #define SQLITE_LOCK_RESERVED 2 #define SQLITE_LOCK_PENDING 3 #define SQLITE_LOCK_EXCLUSIVE 4 /* ** CAPI3REF: Synchronization Type Flags ** ** When SQLite invokes the xSync() method of an ** [sqlite3_io_methods] object it uses a combination of ** these integer values as the second argument. ** ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the ** sync operation only needs to flush data to mass storage. Inode ** information need not be flushed. If the lower four bits of the flag ** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. ** If the lower four bits equal SQLITE_SYNC_FULL, that means ** to use Mac OS X style fullsync instead of fsync(). ** ** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags ** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL ** settings. The [synchronous pragma] determines when calls to the ** xSync VFS method occur and applies uniformly across all platforms. ** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how ** energetic or rigorous or forceful the sync operations are and ** only make a difference on Mac OSX for the default SQLite code. ** (Third-party VFS implementations might also make the distinction ** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the ** operating systems natively supported by SQLite, only Mac OSX ** cares about the difference.) */ #define SQLITE_SYNC_NORMAL 0x00002 #define SQLITE_SYNC_FULL 0x00003 #define SQLITE_SYNC_DATAONLY 0x00010 /* ** CAPI3REF: OS Interface Open File Handle ** ** An [sqlite3_file] object represents an open file in the ** [sqlite3_vfs | OS interface layer]. Individual OS interface ** implementations will ** want to subclass this object by appending additional fields ** for their own use. The pMethods entry is a pointer to an ** [sqlite3_io_methods] object that defines methods for performing ** I/O operations on the open file. */ typedef struct sqlite3_file sqlite3_file; struct sqlite3_file { const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ }; /* ** CAPI3REF: OS Interface File Virtual Methods Object ** ** Every file opened by the [sqlite3_vfs] xOpen method populates an ** [sqlite3_file] object (or, more commonly, a subclass of the ** [sqlite3_file] object) with a pointer to an instance of this object. ** This object defines the methods used to perform various operations ** against the open file represented by the [sqlite3_file] object. ** ** If the xOpen method sets the sqlite3_file.pMethods element ** to a non-NULL pointer, then the sqlite3_io_methods.xClose method ** may be invoked even if the xOpen reported that it failed. The ** only way to prevent a call to xClose following a failed xOpen ** is for the xOpen to set the sqlite3_file.pMethods element to NULL. ** ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or ** [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). ** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] ** flag may be ORed in to indicate that only the data of the file ** and not its inode needs to be synced. ** ** The integer values to xLock() and xUnlock() are one of **
          **
        • [SQLITE_LOCK_NONE], **
        • [SQLITE_LOCK_SHARED], **
        • [SQLITE_LOCK_RESERVED], **
        • [SQLITE_LOCK_PENDING], or **
        • [SQLITE_LOCK_EXCLUSIVE]. **
        ** xLock() increases the lock. xUnlock() decreases the lock. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, ** PENDING, or EXCLUSIVE lock on the file. It returns true ** if such a lock exists and false otherwise. ** ** The xFileControl() method is a generic interface that allows custom ** VFS implementations to directly control an open file using the ** [sqlite3_file_control()] interface. The second "op" argument is an ** integer opcode. The third argument is a generic pointer intended to ** point to a structure that may contain arguments or space in which to ** write return values. Potential uses for xFileControl() might be ** functions to enable blocking locks with timeouts, to change the ** locking strategy (for example to use dot-file locks), to inquire ** about the status of a lock, or to break stale locks. The SQLite ** core reserves all opcodes less than 100 for its own use. ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available. ** Applications that define a custom xFileControl method should use opcodes ** greater than 100 to avoid conflicts. ** ** The xSectorSize() method returns the sector size of the ** device that underlies the file. The sector size is the ** minimum write that can be performed without disturbing ** other bytes in the file. The xDeviceCharacteristics() ** method returns a bit vector describing behaviors of the ** underlying device: ** **
          **
        • [SQLITE_IOCAP_ATOMIC] **
        • [SQLITE_IOCAP_ATOMIC512] **
        • [SQLITE_IOCAP_ATOMIC1K] **
        • [SQLITE_IOCAP_ATOMIC2K] **
        • [SQLITE_IOCAP_ATOMIC4K] **
        • [SQLITE_IOCAP_ATOMIC8K] **
        • [SQLITE_IOCAP_ATOMIC16K] **
        • [SQLITE_IOCAP_ATOMIC32K] **
        • [SQLITE_IOCAP_ATOMIC64K] **
        • [SQLITE_IOCAP_SAFE_APPEND] **
        • [SQLITE_IOCAP_SEQUENTIAL] **
        ** ** The SQLITE_IOCAP_ATOMIC property means that all writes of ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values ** mean that writes of blocks that are nnn bytes in size and ** are aligned to an address which is an integer multiple of ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means ** that when data is appended to a file, the data is appended ** first then the size of the file is extended, never the other ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that ** information is written to disk in the same order as calls ** to xWrite(). ** ** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill ** in the unread portions of the buffer with zeros. A VFS that ** fails to zero-fill short reads might seem to work. However, ** failure to zero-fill short reads will eventually lead to ** database corruption. */ typedef struct sqlite3_io_methods sqlite3_io_methods; struct sqlite3_io_methods { int iVersion; int (*xClose)(sqlite3_file*); int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); int (*xSync)(sqlite3_file*, int flags); int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); int (*xLock)(sqlite3_file*, int); int (*xUnlock)(sqlite3_file*, int); int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); int (*xFileControl)(sqlite3_file*, int op, void *pArg); int (*xSectorSize)(sqlite3_file*); int (*xDeviceCharacteristics)(sqlite3_file*); /* Methods above are valid for version 1 */ int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); void (*xShmBarrier)(sqlite3_file*); int (*xShmUnmap)(sqlite3_file*, int deleteFlag); /* Methods above are valid for version 2 */ /* Additional methods may be added in future releases */ }; /* ** CAPI3REF: Standard File Control Opcodes ** ** These integer constants are opcodes for the xFileControl method ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] ** interface. ** ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This ** opcode causes the xFileControl method to write the current state of ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) ** into an integer that the pArg argument points to. This capability ** is used during testing and only needs to be supported when SQLITE_TEST ** is defined. ** ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS ** layer a hint of how large the database file will grow to be during the ** current transaction. This hint is not guaranteed to be accurate but it ** is often close. The underlying VFS might choose to preallocate database ** file space based on this hint in order to help writes to the database ** file run faster. ** ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS ** extends and truncates the database file in chunks of a size specified ** by the user. The fourth argument to [sqlite3_file_control()] should ** point to an integer (type int) containing the new chunk-size to use ** for the nominated database. Allocating database file space in large ** chunks (say 1MB at a time), may reduce file-system fragmentation and ** improve performance on some systems. */ #define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_GET_LOCKPROXYFILE 2 #define SQLITE_SET_LOCKPROXYFILE 3 #define SQLITE_LAST_ERRNO 4 #define SQLITE_FCNTL_SIZE_HINT 5 #define SQLITE_FCNTL_CHUNK_SIZE 6 #define SQLITE_FCNTL_FILE_POINTER 7 /* ** CAPI3REF: Mutex Handle ** ** The mutex module within SQLite defines [sqlite3_mutex] to be an ** abstract type for a mutex object. The SQLite core never looks ** at the internal representation of an [sqlite3_mutex]. It only ** deals with pointers to the [sqlite3_mutex] object. ** ** Mutexes are created using [sqlite3_mutex_alloc()]. */ typedef struct sqlite3_mutex sqlite3_mutex; /* ** CAPI3REF: OS Interface Object ** ** An instance of the sqlite3_vfs object defines the interface between ** the SQLite core and the underlying operating system. The "vfs" ** in the name of the object stands for "virtual file system". ** ** The value of the iVersion field is initially 1 but may be larger in ** future versions of SQLite. Additional fields may be appended to this ** object when the iVersion value is increased. Note that the structure ** of the sqlite3_vfs object changes in the transaction between ** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not ** modified. ** ** The szOsFile field is the size of the subclassed [sqlite3_file] ** structure used by this VFS. mxPathname is the maximum length of ** a pathname in this VFS. ** ** Registered sqlite3_vfs objects are kept on a linked list formed by ** the pNext pointer. The [sqlite3_vfs_register()] ** and [sqlite3_vfs_unregister()] interfaces manage this list ** in a thread-safe way. The [sqlite3_vfs_find()] interface ** searches the list. Neither the application code nor the VFS ** implementation should use the pNext pointer. ** ** The pNext field is the only field in the sqlite3_vfs ** structure that SQLite will ever modify. SQLite will only access ** or modify this field while holding a particular static mutex. ** The application should never modify anything within the sqlite3_vfs ** object once the object has been registered. ** ** The zName field holds the name of the VFS module. The name must ** be unique across all VFS modules. ** ** ^SQLite guarantees that the zFilename parameter to xOpen ** is either a NULL pointer or string obtained ** from xFullPathname() with an optional suffix added. ** ^If a suffix is added to the zFilename parameter, it will ** consist of a single "-" character followed by no more than ** 10 alphanumeric and/or "-" characters. ** ^SQLite further guarantees that ** the string will be valid and unchanged until xClose() is ** called. Because of the previous sentence, ** the [sqlite3_file] can safely store a pointer to the ** filename if it needs to remember the filename for some reason. ** If the zFilename parameter to xOpen is a NULL pointer then xOpen ** must invent its own temporary name for the file. ^Whenever the ** xFilename parameter is NULL it will also be the case that the ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. ** ** The flags argument to xOpen() includes all bits set in ** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] ** or [sqlite3_open16()] is used, then flags includes at least ** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. ** If xOpen() opens a file read-only then it sets *pOutFlags to ** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. ** ** ^(SQLite will also add one of the following flags to the xOpen() ** call, depending on the object being opened: ** **
          **
        • [SQLITE_OPEN_MAIN_DB] **
        • [SQLITE_OPEN_MAIN_JOURNAL] **
        • [SQLITE_OPEN_TEMP_DB] **
        • [SQLITE_OPEN_TEMP_JOURNAL] **
        • [SQLITE_OPEN_TRANSIENT_DB] **
        • [SQLITE_OPEN_SUBJOURNAL] **
        • [SQLITE_OPEN_MASTER_JOURNAL] **
        • [SQLITE_OPEN_WAL] **
        )^ ** ** The file I/O implementation can use the object type flags to ** change the way it deals with files. For example, an application ** that does not care about crash recovery or rollback might make ** the open of a journal file a no-op. Writes to this journal would ** also be no-ops, and any attempt to read the journal would return ** SQLITE_IOERR. Or the implementation might recognize that a database ** file will be doing page-aligned sector reads and writes in a random ** order and set up its I/O subsystem accordingly. ** ** SQLite might also add one of the following flags to the xOpen method: ** **
          **
        • [SQLITE_OPEN_DELETEONCLOSE] **
        • [SQLITE_OPEN_EXCLUSIVE] **
        ** ** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be ** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] ** will be set for TEMP databases and their journals, transient ** databases, and subjournals. ** ** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction ** with the [SQLITE_OPEN_CREATE] flag, which are both directly ** analogous to the O_EXCL and O_CREAT flags of the POSIX open() ** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the ** SQLITE_OPEN_CREATE, is used to indicate that file should always ** be created, and that it is an error if it already exists. ** It is not used to indicate the file should be opened ** for exclusive access. ** ** ^At least szOsFile bytes of memory are allocated by SQLite ** to hold the [sqlite3_file] structure passed as the third ** argument to xOpen. The xOpen method does not have to ** allocate the structure; it should just fill it in. Note that ** the xOpen method must set the sqlite3_file.pMethods to either ** a valid [sqlite3_io_methods] object or to NULL. xOpen must do ** this even if the open fails. SQLite expects that the sqlite3_file.pMethods ** element will be valid after xOpen returns regardless of the success ** or failure of the xOpen call. ** ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] ** to test whether a file is at least readable. The file can be a ** directory. ** ** ^SQLite will always allocate at least mxPathname+1 bytes for the ** output buffer xFullPathname. The exact size of the output buffer ** is also passed as a parameter to both methods. If the output buffer ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is ** handled as a fatal error by SQLite, vfs implementations should endeavor ** to prevent this by setting mxPathname to a sufficiently large value. ** ** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() ** interfaces are not strictly a part of the filesystem, but they are ** included in the VFS structure for completeness. ** The xRandomness() function attempts to return nBytes bytes ** of good-quality randomness into zOut. The return value is ** the actual number of bytes of randomness obtained. ** The xSleep() method causes the calling thread to sleep for at ** least the number of microseconds given. ^The xCurrentTime() ** method returns a Julian Day Number for the current date and time as ** a floating point value. ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian ** Day Number multipled by 86400000 (the number of milliseconds in ** a 24-hour day). ** ^SQLite will use the xCurrentTimeInt64() method to get the current ** date and time if that method is available (if iVersion is 2 or ** greater and the function pointer is not NULL) and will fall back ** to xCurrentTime() if xCurrentTimeInt64() is unavailable. */ typedef struct sqlite3_vfs sqlite3_vfs; struct sqlite3_vfs { int iVersion; /* Structure version number (currently 2) */ int szOsFile; /* Size of subclassed sqlite3_file */ int mxPathname; /* Maximum file pathname length */ sqlite3_vfs *pNext; /* Next registered VFS */ const char *zName; /* Name of this virtual file system */ void *pAppData; /* Pointer to application-specific data */ int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, int flags, int *pOutFlags); int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); void (*xDlClose)(sqlite3_vfs*, void*); int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); int (*xSleep)(sqlite3_vfs*, int microseconds); int (*xCurrentTime)(sqlite3_vfs*, double*); int (*xGetLastError)(sqlite3_vfs*, int, char *); /* ** The methods above are in version 1 of the sqlite_vfs object ** definition. Those that follow are added in version 2 or later */ int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); /* ** The methods above are in versions 1 and 2 of the sqlite_vfs object. ** New fields may be appended in figure versions. The iVersion ** value will increment whenever this happens. */ }; /* ** CAPI3REF: Flags for the xAccess VFS method ** ** These integer constants can be used as the third parameter to ** the xAccess method of an [sqlite3_vfs] object. They determine ** what kind of permissions the xAccess method is looking for. ** With SQLITE_ACCESS_EXISTS, the xAccess method ** simply checks whether the file exists. ** With SQLITE_ACCESS_READWRITE, the xAccess method ** checks whether the named directory is both readable and writable ** (in other words, if files can be added, removed, and renamed within ** the directory). ** The SQLITE_ACCESS_READWRITE constant is currently used only by the ** [temp_store_directory pragma], though this could change in a future ** release of SQLite. ** With SQLITE_ACCESS_READ, the xAccess method ** checks whether the file is readable. The SQLITE_ACCESS_READ constant is ** currently unused, though it might be used in a future release of ** SQLite. */ #define SQLITE_ACCESS_EXISTS 0 #define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */ #define SQLITE_ACCESS_READ 2 /* Unused */ /* ** CAPI3REF: Flags for the xShmLock VFS method ** ** These integer constants define the various locking operations ** allowed by the xShmLock method of [sqlite3_io_methods]. The ** following are the only legal combinations of flags to the ** xShmLock method: ** **
          **
        • SQLITE_SHM_LOCK | SQLITE_SHM_SHARED **
        • SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE **
        • SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED **
        • SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE **
        ** ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as ** was given no the corresponding lock. ** ** The xShmLock method can transition between unlocked and SHARED or ** between unlocked and EXCLUSIVE. It cannot transition between SHARED ** and EXCLUSIVE. */ #define SQLITE_SHM_UNLOCK 1 #define SQLITE_SHM_LOCK 2 #define SQLITE_SHM_SHARED 4 #define SQLITE_SHM_EXCLUSIVE 8 /* ** CAPI3REF: Maximum xShmLock index ** ** The xShmLock method on [sqlite3_io_methods] may use values ** between 0 and this upper bound as its "offset" argument. ** The SQLite core will never attempt to acquire or release a ** lock outside of this range */ #define SQLITE_SHM_NLOCK 8 /* ** CAPI3REF: Initialize The SQLite Library ** ** ^The sqlite3_initialize() routine initializes the ** SQLite library. ^The sqlite3_shutdown() routine ** deallocates any resources that were allocated by sqlite3_initialize(). ** These routines are designed to aid in process initialization and ** shutdown on embedded systems. Workstation applications using ** SQLite normally do not need to invoke either of these routines. ** ** A call to sqlite3_initialize() is an "effective" call if it is ** the first time sqlite3_initialize() is invoked during the lifetime of ** the process, or if it is the first time sqlite3_initialize() is invoked ** following a call to sqlite3_shutdown(). ^(Only an effective call ** of sqlite3_initialize() does any initialization. All other calls ** are harmless no-ops.)^ ** ** A call to sqlite3_shutdown() is an "effective" call if it is the first ** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only ** an effective call to sqlite3_shutdown() does any deinitialization. ** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ ** ** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() ** is not. The sqlite3_shutdown() interface must only be called from a ** single thread. All open [database connections] must be closed and all ** other SQLite resources must be deallocated prior to invoking ** sqlite3_shutdown(). ** ** Among other things, ^sqlite3_initialize() will invoke ** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() ** will invoke sqlite3_os_end(). ** ** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. ** ^If for some reason, sqlite3_initialize() is unable to initialize ** the library (perhaps it is unable to allocate a needed resource such ** as a mutex) it returns an [error code] other than [SQLITE_OK]. ** ** ^The sqlite3_initialize() routine is called internally by many other ** SQLite interfaces so that an application usually does not need to ** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] ** calls sqlite3_initialize() so the SQLite library will be automatically ** initialized when [sqlite3_open()] is called if it has not be initialized ** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] ** compile-time option, then the automatic calls to sqlite3_initialize() ** are omitted and the application must call sqlite3_initialize() directly ** prior to using any other SQLite interface. For maximum portability, ** it is recommended that applications always invoke sqlite3_initialize() ** directly prior to using any other SQLite interface. Future releases ** of SQLite may require this. In other words, the behavior exhibited ** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the ** default behavior in some future release of SQLite. ** ** The sqlite3_os_init() routine does operating-system specific ** initialization of the SQLite library. The sqlite3_os_end() ** routine undoes the effect of sqlite3_os_init(). Typical tasks ** performed by these routines include allocation or deallocation ** of static resources, initialization of global variables, ** setting up a default [sqlite3_vfs] module, or setting up ** a default configuration using [sqlite3_config()]. ** ** The application should never invoke either sqlite3_os_init() ** or sqlite3_os_end() directly. The application should only invoke ** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() ** interface is called automatically by sqlite3_initialize() and ** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate ** implementations for sqlite3_os_init() and sqlite3_os_end() ** are built into SQLite when it is compiled for Unix, Windows, or OS/2. ** When [custom builds | built for other platforms] ** (using the [SQLITE_OS_OTHER=1] compile-time ** option) the application must supply a suitable implementation for ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied ** implementation of sqlite3_os_init() or sqlite3_os_end() ** must return [SQLITE_OK] on success and some other [error code] upon ** failure. */ SQLITE_API int sqlite3_initialize(void); SQLITE_API int sqlite3_shutdown(void); SQLITE_API int sqlite3_os_init(void); SQLITE_API int sqlite3_os_end(void); /* ** CAPI3REF: Configuring The SQLite Library ** ** The sqlite3_config() interface is used to make global configuration ** changes to SQLite in order to tune SQLite to the specific needs of ** the application. The default configuration is recommended for most ** applications and so this routine is usually not necessary. It is ** provided to support rare applications with unusual needs. ** ** The sqlite3_config() interface is not threadsafe. The application ** must insure that no other SQLite interfaces are invoked by other ** threads while sqlite3_config() is running. Furthermore, sqlite3_config() ** may only be invoked prior to library initialization using ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. ** Note, however, that ^sqlite3_config() can be called as part of the ** implementation of an application-defined [sqlite3_os_init()]. ** ** The first argument to sqlite3_config() is an integer ** [SQLITE_CONFIG_SINGLETHREAD | configuration option] that determines ** what property of SQLite is to be configured. Subsequent arguments ** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option] ** in the first argument. ** ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. ** ^If the option is unknown or SQLite is unable to set the option ** then this routine returns a non-zero [error code]. */ SQLITE_API int sqlite3_config(int, ...); /* ** CAPI3REF: Configure database connections ** ** The sqlite3_db_config() interface is used to make configuration ** changes to a [database connection]. The interface is similar to ** [sqlite3_config()] except that the changes apply to a single ** [database connection] (specified in the first argument). The ** sqlite3_db_config() interface should only be used immediately after ** the database connection is created using [sqlite3_open()], ** [sqlite3_open16()], or [sqlite3_open_v2()]. ** ** The second argument to sqlite3_db_config(D,V,...) is the ** configuration verb - an integer code that indicates what ** aspect of the [database connection] is being configured. ** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE]. ** New verbs are likely to be added in future releases of SQLite. ** Additional arguments depend on the verb. ** ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if ** the call is considered successful. */ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); /* ** CAPI3REF: Memory Allocation Routines ** ** An instance of this object defines the interface between SQLite ** and low-level memory allocation routines. ** ** This object is used in only one place in the SQLite interface. ** A pointer to an instance of this object is the argument to ** [sqlite3_config()] when the configuration option is ** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. ** By creating an instance of this object ** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) ** during configuration, an application can specify an alternative ** memory allocation subsystem for SQLite to use for all of its ** dynamic memory needs. ** ** Note that SQLite comes with several [built-in memory allocators] ** that are perfectly adequate for the overwhelming majority of applications ** and that this object is only useful to a tiny minority of applications ** with specialized memory allocation requirements. This object is ** also used during testing of SQLite in order to specify an alternative ** memory allocator that simulates memory out-of-memory conditions in ** order to verify that SQLite recovers gracefully from such ** conditions. ** ** The xMalloc and xFree methods must work like the ** malloc() and free() functions from the standard C library. ** The xRealloc method must work like realloc() from the standard C library ** with the exception that if the second argument to xRealloc is zero, ** xRealloc must be a no-op - it must not perform any allocation or ** deallocation. ^SQLite guarantees that the second argument to ** xRealloc is always a value returned by a prior call to xRoundup. ** And so in cases where xRoundup always returns a positive number, ** xRealloc can perform exactly as the standard library realloc() and ** still be in compliance with this specification. ** ** xSize should return the allocated size of a memory allocation ** previously obtained from xMalloc or xRealloc. The allocated size ** is always at least as big as the requested size but may be larger. ** ** The xRoundup method returns what would be the allocated size of ** a memory allocation given a particular requested size. Most memory ** allocators round up memory allocations at least to the next multiple ** of 8. Some allocators round up to a larger multiple or to a power of 2. ** Every memory allocation request coming in through [sqlite3_malloc()] ** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, ** that causes the corresponding memory allocation to fail. ** ** The xInit method initializes the memory allocator. (For example, ** it might allocate any require mutexes or initialize internal data ** structures. The xShutdown method is invoked (indirectly) by ** [sqlite3_shutdown()] and should deallocate any resources acquired ** by xInit. The pAppData pointer is used as the only parameter to ** xInit and xShutdown. ** ** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes ** the xInit method, so the xInit method need not be threadsafe. The ** xShutdown method is only called from [sqlite3_shutdown()] so it does ** not need to be threadsafe either. For all other methods, SQLite ** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the ** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which ** it is by default) and so the methods are automatically serialized. ** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other ** methods must be threadsafe or else make their own arrangements for ** serialization. ** ** SQLite will never invoke xInit() more than once without an intervening ** call to xShutdown(). */ typedef struct sqlite3_mem_methods sqlite3_mem_methods; struct sqlite3_mem_methods { void *(*xMalloc)(int); /* Memory allocation function */ void (*xFree)(void*); /* Free a prior allocation */ void *(*xRealloc)(void*,int); /* Resize an allocation */ int (*xSize)(void*); /* Return the size of an allocation */ int (*xRoundup)(int); /* Round up request size to allocation size */ int (*xInit)(void*); /* Initialize the memory allocator */ void (*xShutdown)(void*); /* Deinitialize the memory allocator */ void *pAppData; /* Argument to xInit() and xShutdown() */ }; /* ** CAPI3REF: Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the first argument to the [sqlite3_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications ** should check the return code from [sqlite3_config()] to make sure that ** the call worked. The [sqlite3_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** **
        **
        SQLITE_CONFIG_SINGLETHREAD
        **
        There are no arguments to this option. ^This option sets the ** [threading mode] to Single-thread. In other words, it disables ** all mutexing and puts SQLite into a mode where it can only be used ** by a single thread. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to change the [threading mode] from its default ** value of Single-thread and so [sqlite3_config()] will return ** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD ** configuration option.
        ** **
        SQLITE_CONFIG_MULTITHREAD
        **
        There are no arguments to this option. ^This option sets the ** [threading mode] to Multi-thread. In other words, it disables ** mutexing on [database connection] and [prepared statement] objects. ** The application is responsible for serializing access to ** [database connections] and [prepared statements]. But other mutexes ** are enabled so that SQLite will be safe to use in a multi-threaded ** environment as long as no two threads attempt to use the same ** [database connection] at the same time. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to set the Multi-thread [threading mode] and ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the ** SQLITE_CONFIG_MULTITHREAD configuration option.
        ** **
        SQLITE_CONFIG_SERIALIZED
        **
        There are no arguments to this option. ^This option sets the ** [threading mode] to Serialized. In other words, this option enables ** all mutexes including the recursive ** mutexes on [database connection] and [prepared statement] objects. ** In this mode (which is the default when SQLite is compiled with ** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access ** to [database connections] and [prepared statements] so that the ** application is free to use the same [database connection] or the ** same [prepared statement] in different threads at the same time. ** ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** it is not possible to set the Serialized [threading mode] and ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the ** SQLITE_CONFIG_SERIALIZED configuration option.
        ** **
        SQLITE_CONFIG_MALLOC
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mem_methods] structure. The argument specifies ** alternative low-level memory allocation routines to be used in place of ** the memory allocation routines built into SQLite.)^ ^SQLite makes ** its own private copy of the content of the [sqlite3_mem_methods] structure ** before the [sqlite3_config()] call returns.
        ** **
        SQLITE_CONFIG_GETMALLOC
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods] ** structure is filled with the currently defined memory allocation routines.)^ ** This option can be used to overload the default memory allocation ** routines with a wrapper that simulations memory allocation failure or ** tracks memory usage, for example.
        ** **
        SQLITE_CONFIG_MEMSTATUS
        **
        ^This option takes single argument of type int, interpreted as a ** boolean, which enables or disables the collection of memory allocation ** statistics. ^(When memory allocation statistics are disabled, the ** following SQLite interfaces become non-operational: **
          **
        • [sqlite3_memory_used()] **
        • [sqlite3_memory_highwater()] **
        • [sqlite3_soft_heap_limit64()] **
        • [sqlite3_status()] **
        )^ ** ^Memory allocation statistics are enabled by default unless SQLite is ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory ** allocation statistics are disabled by default. **
        ** **
        SQLITE_CONFIG_SCRATCH
        **
        ^This option specifies a static memory buffer that SQLite can use for ** scratch memory. There are three arguments: A pointer an 8-byte ** aligned memory buffer from which the scrach allocations will be ** drawn, the size of each scratch allocation (sz), ** and the maximum number of scratch allocations (N). The sz ** argument must be a multiple of 16. ** The first argument must be a pointer to an 8-byte aligned buffer ** of at least sz*N bytes of memory. ** ^SQLite will use no more than two scratch buffers per thread. So ** N should be set to twice the expected maximum number of threads. ** ^SQLite will never require a scratch buffer that is more than 6 ** times the database page size. ^If SQLite needs needs additional ** scratch memory beyond what is provided by this configuration option, then ** [sqlite3_malloc()] will be used to obtain the memory needed.
        ** **
        SQLITE_CONFIG_PAGECACHE
        **
        ^This option specifies a static memory buffer that SQLite can use for ** the database page cache with the default page cache implemenation. ** This configuration should not be used if an application-define page ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option. ** There are three arguments to this option: A pointer to 8-byte aligned ** memory, the size of each page buffer (sz), and the number of pages (N). ** The sz argument should be the size of the largest database page ** (a power of two between 512 and 32768) plus a little extra for each ** page header. ^The page header size is 20 to 40 bytes depending on ** the host architecture. ^It is harmless, apart from the wasted memory, ** to make sz a little too large. The first ** argument should point to an allocation of at least sz*N bytes of memory. ** ^SQLite will use the memory provided by the first argument to satisfy its ** memory needs for the first N pages that it adds to cache. ^If additional ** page cache memory is needed beyond what is provided by this option, then ** SQLite goes to [sqlite3_malloc()] for the additional storage space. ** The pointer in the first argument must ** be aligned to an 8-byte boundary or subsequent behavior of SQLite ** will be undefined.
        ** **
        SQLITE_CONFIG_HEAP
        **
        ^This option specifies a static memory buffer that SQLite will use ** for all of its dynamic memory allocation needs beyond those provided ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE]. ** There are three arguments: An 8-byte aligned pointer to the memory, ** the number of bytes in the memory buffer, and the minimum allocation size. ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts ** to using its default memory allocator (the system malloc() implementation), ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory ** allocator is engaged to handle all of SQLites memory allocation needs. ** The first pointer (the memory pointer) must be aligned to an 8-byte ** boundary or subsequent behavior of SQLite will be undefined.
        ** **
        SQLITE_CONFIG_MUTEX
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mutex_methods] structure. The argument specifies ** alternative low-level mutex routines to be used in place ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the ** content of the [sqlite3_mutex_methods] structure before the call to ** [sqlite3_config()] returns. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** the entire mutexing subsystem is omitted from the build and hence calls to ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will ** return [SQLITE_ERROR].
        ** **
        SQLITE_CONFIG_GETMUTEX
        **
        ^(This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mutex_methods] structure. The ** [sqlite3_mutex_methods] ** structure is filled with the currently defined mutex routines.)^ ** This option can be used to overload the default mutex allocation ** routines with a wrapper used to track mutex usage for performance ** profiling or testing, for example. ^If SQLite is compiled with ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then ** the entire mutexing subsystem is omitted from the build and hence calls to ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will ** return [SQLITE_ERROR].
        ** **
        SQLITE_CONFIG_LOOKASIDE
        **
        ^(This option takes two arguments that determine the default ** memory allocation for the lookaside memory allocator on each ** [database connection]. The first argument is the ** size of each lookaside buffer slot and the second is the number of ** slots allocated to each database connection.)^ ^(This option sets the ** default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] ** verb to [sqlite3_db_config()] can be used to change the lookaside ** configuration on individual connections.)^
        ** **
        SQLITE_CONFIG_PCACHE
        **
        ^(This option takes a single argument which is a pointer to ** an [sqlite3_pcache_methods] object. This object specifies the interface ** to a custom page cache implementation.)^ ^SQLite makes a copy of the ** object and uses it for page cache memory allocations.
        ** **
        SQLITE_CONFIG_GETPCACHE
        **
        ^(This option takes a single argument which is a pointer to an ** [sqlite3_pcache_methods] object. SQLite copies of the current ** page cache implementation into that object.)^
        ** **
        SQLITE_CONFIG_LOG
        **
        ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a ** function with a call signature of void(*)(void*,int,const char*), ** and a pointer to void. ^If the function pointer is not NULL, it is ** invoked by [sqlite3_log()] to process each logging event. ^If the ** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. ** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is ** passed through as the first parameter to the application-defined logger ** function whenever that function is invoked. ^The second parameter to ** the logger function is a copy of the first parameter to the corresponding ** [sqlite3_log()] call and is intended to be a [result code] or an ** [extended result code]. ^The third parameter passed to the logger is ** log message after formatting via [sqlite3_snprintf()]. ** The SQLite logging interface is not reentrant; the logger function ** supplied by the application must not invoke any SQLite interface. ** In a multi-threaded application, the application-defined logger ** function must be threadsafe.
        ** **
        */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ #define SQLITE_CONFIG_PCACHE 14 /* sqlite3_pcache_methods* */ #define SQLITE_CONFIG_GETPCACHE 15 /* sqlite3_pcache_methods* */ #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications ** should check the return code from [sqlite3_db_config()] to make sure that ** the call worked. ^The [sqlite3_db_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** **
        **
        SQLITE_DBCONFIG_LOOKASIDE
        **
        ^This option takes three additional arguments that determine the ** [lookaside memory allocator] configuration for the [database connection]. ** ^The first argument (the third parameter to [sqlite3_db_config()] is a ** pointer to an memory buffer to use for lookaside memory. ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb ** may be NULL in which case SQLite will allocate the ** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the ** size of each lookaside buffer slot. ^The third argument is the number of ** slots. The size of the buffer in the first argument must be greater than ** or equal to the product of the second and third arguments. The buffer ** must be aligned to an 8-byte boundary. ^If the second argument to ** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally ** rounded down to the next smaller multiple of 8. ^(The lookaside memory ** configuration for a database connection can only be changed when that ** connection is not currently using lookaside memory, or in other words ** when the "current value" returned by ** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns ** [SQLITE_BUSY].)^
        ** **
        */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes ** ** ^The sqlite3_extended_result_codes() routine enables or disables the ** [extended result codes] feature of SQLite. ^The extended result ** codes are disabled by default for historical compatibility. */ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); /* ** CAPI3REF: Last Insert Rowid ** ** ^Each entry in an SQLite table has a unique 64-bit signed ** integer key called the [ROWID | "rowid"]. ^The rowid is always available ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those ** names are not also used by explicitly declared columns. ^If ** the table has a column of type [INTEGER PRIMARY KEY] then that column ** is another alias for the rowid. ** ** ^This routine returns the [rowid] of the most recent ** successful [INSERT] into the database from the [database connection] ** in the first argument. ^If no successful [INSERT]s ** have ever occurred on that database connection, zero is returned. ** ** ^(If an [INSERT] occurs within a trigger, then the [rowid] of the inserted ** row is returned by this routine as long as the trigger is running. ** But once the trigger terminates, the value returned by this routine ** reverts to the last value inserted before the trigger fired.)^ ** ** ^An [INSERT] that fails due to a constraint violation is not a ** successful [INSERT] and does not change the value returned by this ** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, ** and INSERT OR ABORT make no changes to the return value of this ** routine when their insertion fails. ^(When INSERT OR REPLACE ** encounters a constraint violation, it does not fail. The ** INSERT continues to completion after deleting rows that caused ** the constraint problem so INSERT OR REPLACE will always change ** the return value of this interface.)^ ** ** ^For the purposes of this routine, an [INSERT] is considered to ** be successful even if it is subsequently rolled back. ** ** This function is accessible to SQL statements via the ** [last_insert_rowid() SQL function]. ** ** If a separate thread performs a new [INSERT] on the same ** database connection while the [sqlite3_last_insert_rowid()] ** function is running and thus changes the last insert [rowid], ** then the value returned by [sqlite3_last_insert_rowid()] is ** unpredictable and might not equal either the old or the new ** last insert [rowid]. */ SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); /* ** CAPI3REF: Count The Number Of Rows Modified ** ** ^This function returns the number of database rows that were changed ** or inserted or deleted by the most recently completed SQL statement ** on the [database connection] specified by the first parameter. ** ^(Only changes that are directly specified by the [INSERT], [UPDATE], ** or [DELETE] statement are counted. Auxiliary changes caused by ** triggers or [foreign key actions] are not counted.)^ Use the ** [sqlite3_total_changes()] function to find the total number of changes ** including changes caused by triggers and foreign key actions. ** ** ^Changes to a view that are simulated by an [INSTEAD OF trigger] ** are not counted. Only real table changes are counted. ** ** ^(A "row change" is a change to a single row of a single table ** caused by an INSERT, DELETE, or UPDATE statement. Rows that ** are changed as side effects of [REPLACE] constraint resolution, ** rollback, ABORT processing, [DROP TABLE], or by any other ** mechanisms do not count as direct row changes.)^ ** ** A "trigger context" is a scope of execution that begins and ** ends with the script of a [CREATE TRIGGER | trigger]. ** Most SQL statements are ** evaluated outside of any trigger. This is the "top level" ** trigger context. If a trigger fires from the top level, a ** new trigger context is entered for the duration of that one ** trigger. Subtriggers create subcontexts for their duration. ** ** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does ** not create a new trigger context. ** ** ^This function returns the number of direct row changes in the ** most recent INSERT, UPDATE, or DELETE statement within the same ** trigger context. ** ** ^Thus, when called from the top level, this function returns the ** number of changes in the most recent INSERT, UPDATE, or DELETE ** that also occurred at the top level. ^(Within the body of a trigger, ** the sqlite3_changes() interface can be called to find the number of ** changes in the most recently completed INSERT, UPDATE, or DELETE ** statement within the body of the same trigger. ** However, the number returned does not include changes ** caused by subtriggers since those have their own context.)^ ** ** See also the [sqlite3_total_changes()] interface, the ** [count_changes pragma], and the [changes() SQL function]. ** ** If a separate thread makes changes on the same database connection ** while [sqlite3_changes()] is running then the value returned ** is unpredictable and not meaningful. */ SQLITE_API int sqlite3_changes(sqlite3*); /* ** CAPI3REF: Total Number Of Rows Modified ** ** ^This function returns the number of row changes caused by [INSERT], ** [UPDATE] or [DELETE] statements since the [database connection] was opened. ** ^(The count returned by sqlite3_total_changes() includes all changes ** from all [CREATE TRIGGER | trigger] contexts and changes made by ** [foreign key actions]. However, ** the count does not include changes used to implement [REPLACE] constraints, ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The ** count does not include rows of views that fire an [INSTEAD OF trigger], ** though if the INSTEAD OF trigger makes changes of its own, those changes ** are counted.)^ ** ^The sqlite3_total_changes() function counts the changes as soon as ** the statement that makes them is completed (when the statement handle ** is passed to [sqlite3_reset()] or [sqlite3_finalize()]). ** ** See also the [sqlite3_changes()] interface, the ** [count_changes pragma], and the [total_changes() SQL function]. ** ** If a separate thread makes changes on the same database connection ** while [sqlite3_total_changes()] is running then the value ** returned is unpredictable and not meaningful. */ SQLITE_API int sqlite3_total_changes(sqlite3*); /* ** CAPI3REF: Interrupt A Long-Running Query ** ** ^This function causes any pending database operation to abort and ** return at its earliest opportunity. This routine is typically ** called in response to a user action such as pressing "Cancel" ** or Ctrl-C where the user wants a long query operation to halt ** immediately. ** ** ^It is safe to call this routine from a thread different from the ** thread that is currently running the database operation. But it ** is not safe to call this routine with a [database connection] that ** is closed or might close before sqlite3_interrupt() returns. ** ** ^If an SQL operation is very nearly finished at the time when ** sqlite3_interrupt() is called, then it might not have an opportunity ** to be interrupted and might continue to completion. ** ** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. ** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE ** that is inside an explicit transaction, then the entire transaction ** will be rolled back automatically. ** ** ^The sqlite3_interrupt(D) call is in effect until all currently running ** SQL statements on [database connection] D complete. ^Any new SQL statements ** that are started after the sqlite3_interrupt() call and before the ** running statements reaches zero are interrupted as if they had been ** running prior to the sqlite3_interrupt() call. ^New SQL statements ** that are started after the running statement count reaches zero are ** not effected by the sqlite3_interrupt(). ** ^A call to sqlite3_interrupt(D) that occurs when there are no running ** SQL statements is a no-op and has no effect on SQL statements ** that are started after the sqlite3_interrupt() call returns. ** ** If the database connection closes while [sqlite3_interrupt()] ** is running then bad things will likely happen. */ SQLITE_API void sqlite3_interrupt(sqlite3*); /* ** CAPI3REF: Determine If An SQL Statement Is Complete ** ** These routines are useful during command-line input to determine if the ** currently entered text seems to form a complete SQL statement or ** if additional input is needed before sending the text into ** SQLite for parsing. ^These routines return 1 if the input string ** appears to be a complete SQL statement. ^A statement is judged to be ** complete if it ends with a semicolon token and is not a prefix of a ** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within ** string literals or quoted identifier names or comments are not ** independent tokens (they are part of the token in which they are ** embedded) and thus do not count as a statement terminator. ^Whitespace ** and comments that follow the final semicolon are ignored. ** ** ^These routines return 0 if the statement is incomplete. ^If a ** memory allocation fails, then SQLITE_NOMEM is returned. ** ** ^These routines do not parse the SQL statements thus ** will not detect syntactically incorrect SQL. ** ** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior ** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked ** automatically by sqlite3_complete16(). If that initialization fails, ** then the return value from sqlite3_complete16() will be non-zero ** regardless of whether or not the input SQL is complete.)^ ** ** The input to [sqlite3_complete()] must be a zero-terminated ** UTF-8 string. ** ** The input to [sqlite3_complete16()] must be a zero-terminated ** UTF-16 string in native byte order. */ SQLITE_API int sqlite3_complete(const char *sql); SQLITE_API int sqlite3_complete16(const void *sql); /* ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors ** ** ^This routine sets a callback function that might be invoked whenever ** an attempt is made to open a database table that another thread ** or process has locked. ** ** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] ** is returned immediately upon encountering the lock. ^If the busy callback ** is not NULL, then the callback might be invoked with two arguments. ** ** ^The first argument to the busy handler is a copy of the void* pointer which ** is the third argument to sqlite3_busy_handler(). ^The second argument to ** the busy handler callback is the number of times that the busy handler has ** been invoked for this locking event. ^If the ** busy callback returns 0, then no additional attempts are made to ** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned. ** ^If the callback returns non-zero, then another attempt ** is made to open the database for reading and the cycle repeats. ** ** The presence of a busy handler does not guarantee that it will be invoked ** when there is lock contention. ^If SQLite determines that invoking the busy ** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] ** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler. ** Consider a scenario where one process is holding a read lock that ** it is trying to promote to a reserved lock and ** a second process is holding a reserved lock that it is trying ** to promote to an exclusive lock. The first process cannot proceed ** because it is blocked by the second and the second process cannot ** proceed because it is blocked by the first. If both processes ** invoke the busy handlers, neither will make any progress. Therefore, ** SQLite returns [SQLITE_BUSY] for the first process, hoping that this ** will induce the first process to release its read lock and allow ** the second process to proceed. ** ** ^The default busy callback is NULL. ** ** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] ** when SQLite is in the middle of a large transaction where all the ** changes will not fit into the in-memory cache. SQLite will ** already hold a RESERVED lock on the database file, but it needs ** to promote this lock to EXCLUSIVE so that it can spill cache ** pages into the database file without harm to concurrent ** readers. ^If it is unable to promote the lock, then the in-memory ** cache will be left in an inconsistent state and so the error ** code is promoted from the relatively benign [SQLITE_BUSY] to ** the more severe [SQLITE_IOERR_BLOCKED]. ^This error code promotion ** forces an automatic rollback of the changes. See the ** ** CorruptionFollowingBusyError wiki page for a discussion of why ** this is important. ** ** ^(There can only be a single busy handler defined for each ** [database connection]. Setting a new busy handler clears any ** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] ** will also set or clear the busy handler. ** ** The busy callback should not take any actions which modify the ** database connection that invoked the busy handler. Any such actions ** result in undefined behavior. ** ** A busy handler must not close the database connection ** or [prepared statement] that invoked the busy handler. */ SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); /* ** CAPI3REF: Set A Busy Timeout ** ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps ** for a specified amount of time when a table is locked. ^The handler ** will sleep multiple times until at least "ms" milliseconds of sleeping ** have accumulated. ^After at least "ms" milliseconds of sleeping, ** the handler returns 0 which causes [sqlite3_step()] to return ** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]. ** ** ^Calling this routine with an argument less than or equal to zero ** turns off all busy handlers. ** ** ^(There can only be a single busy handler for a particular ** [database connection] any any given moment. If another busy handler ** was defined (using [sqlite3_busy_handler()]) prior to calling ** this routine, that other busy handler is cleared.)^ */ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); /* ** CAPI3REF: Convenience Routines For Running Queries ** ** This is a legacy interface that is preserved for backwards compatibility. ** Use of this interface is not recommended. ** ** Definition: A result table is memory data structure created by the ** [sqlite3_get_table()] interface. A result table records the ** complete query results from one or more queries. ** ** The table conceptually has a number of rows and columns. But ** these numbers are not part of the result table itself. These ** numbers are obtained separately. Let N be the number of rows ** and M be the number of columns. ** ** A result table is an array of pointers to zero-terminated UTF-8 strings. ** There are (N+1)*M elements in the array. The first M pointers point ** to zero-terminated strings that contain the names of the columns. ** The remaining entries all point to query results. NULL values result ** in NULL pointers. All other values are in their UTF-8 zero-terminated ** string representation as returned by [sqlite3_column_text()]. ** ** A result table might consist of one or more memory allocations. ** It is not safe to pass a result table directly to [sqlite3_free()]. ** A result table should be deallocated using [sqlite3_free_table()]. ** ** ^(As an example of the result table format, suppose a query result ** is as follows: ** **
        **        Name        | Age
        **        -----------------------
        **        Alice       | 43
        **        Bob         | 28
        **        Cindy       | 21
        ** 
        ** ** There are two column (M==2) and three rows (N==3). Thus the ** result table has 8 entries. Suppose the result table is stored ** in an array names azResult. Then azResult holds this content: ** **
        **        azResult[0] = "Name";
        **        azResult[1] = "Age";
        **        azResult[2] = "Alice";
        **        azResult[3] = "43";
        **        azResult[4] = "Bob";
        **        azResult[5] = "28";
        **        azResult[6] = "Cindy";
        **        azResult[7] = "21";
        ** 
        )^ ** ** ^The sqlite3_get_table() function evaluates one or more ** semicolon-separated SQL statements in the zero-terminated UTF-8 ** string of its 2nd parameter and returns a result table to the ** pointer given in its 3rd parameter. ** ** After the application has finished with the result from sqlite3_get_table(), ** it must pass the result table pointer to sqlite3_free_table() in order to ** release the memory that was malloced. Because of the way the ** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling ** function must not try to call [sqlite3_free()] directly. Only ** [sqlite3_free_table()] is able to release the memory properly and safely. ** ** The sqlite3_get_table() interface is implemented as a wrapper around ** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access ** to any internal data structures of SQLite. It uses only the public ** interface defined here. As a consequence, errors that occur in the ** wrapper layer outside of the internal [sqlite3_exec()] call are not ** reflected in subsequent calls to [sqlite3_errcode()] or ** [sqlite3_errmsg()]. */ SQLITE_API int sqlite3_get_table( sqlite3 *db, /* An open database */ const char *zSql, /* SQL to be evaluated */ char ***pazResult, /* Results of the query */ int *pnRow, /* Number of result rows written here */ int *pnColumn, /* Number of result columns written here */ char **pzErrmsg /* Error msg written here */ ); SQLITE_API void sqlite3_free_table(char **result); /* ** CAPI3REF: Formatted String Printing Functions ** ** These routines are work-alikes of the "printf()" family of functions ** from the standard C library. ** ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their ** results into memory obtained from [sqlite3_malloc()]. ** The strings returned by these two routines should be ** released by [sqlite3_free()]. ^Both routines return a ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough ** memory to hold the resulting string. ** ** ^(In sqlite3_snprintf() routine is similar to "snprintf()" from ** the standard C library. The result is written into the ** buffer supplied as the second parameter whose size is given by ** the first parameter. Note that the order of the ** first two parameters is reversed from snprintf().)^ This is an ** historical accident that cannot be fixed without breaking ** backwards compatibility. ^(Note also that sqlite3_snprintf() ** returns a pointer to its buffer instead of the number of ** characters actually written into the buffer.)^ We admit that ** the number of characters written would be a more useful return ** value but we cannot change the implementation of sqlite3_snprintf() ** now without breaking compatibility. ** ** ^As long as the buffer size is greater than zero, sqlite3_snprintf() ** guarantees that the buffer is always zero-terminated. ^The first ** parameter "n" is the total size of the buffer, including space for ** the zero terminator. So the longest string that can be completely ** written will be n-1 characters. ** ** These routines all implement some additional formatting ** options that are useful for constructing SQL statements. ** All of the usual printf() formatting options apply. In addition, there ** is are "%q", "%Q", and "%z" options. ** ** ^(The %q option works like %s in that it substitutes a null-terminated ** string from the argument list. But %q also doubles every '\'' character. ** %q is designed for use inside a string literal.)^ By doubling each '\'' ** character it escapes that character and allows it to be inserted into ** the string. ** ** For example, assume the string variable zText contains text as follows: ** **
        **  char *zText = "It's a happy day!";
        ** 
        ** ** One can use this text in an SQL statement as follows: ** **
        **  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
        **  sqlite3_exec(db, zSQL, 0, 0, 0);
        **  sqlite3_free(zSQL);
        ** 
        ** ** Because the %q format string is used, the '\'' character in zText ** is escaped and the SQL generated is as follows: ** **
        **  INSERT INTO table1 VALUES('It''s a happy day!')
        ** 
        ** ** This is correct. Had we used %s instead of %q, the generated SQL ** would have looked like this: ** **
        **  INSERT INTO table1 VALUES('It's a happy day!');
        ** 
        ** ** This second example is an SQL syntax error. As a general rule you should ** always use %q instead of %s when inserting text into a string literal. ** ** ^(The %Q option works like %q except it also adds single quotes around ** the outside of the total string. Additionally, if the parameter in the ** argument list is a NULL pointer, %Q substitutes the text "NULL" (without ** single quotes).)^ So, for example, one could say: ** **
        **  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
        **  sqlite3_exec(db, zSQL, 0, 0, 0);
        **  sqlite3_free(zSQL);
        ** 
        ** ** The code above will render a correct SQL statement in the zSQL ** variable even if the zText variable is a NULL pointer. ** ** ^(The "%z" formatting option works like "%s" but with the ** addition that after the string has been read and copied into ** the result, [sqlite3_free()] is called on the input string.)^ */ SQLITE_API char *sqlite3_mprintf(const char*,...); SQLITE_API char *sqlite3_vmprintf(const char*, va_list); SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); /* ** CAPI3REF: Memory Allocation Subsystem ** ** The SQLite core uses these three routines for all of its own ** internal memory allocation needs. "Core" in the previous sentence ** does not include operating-system specific VFS implementation. The ** Windows VFS uses native malloc() and free() for some operations. ** ** ^The sqlite3_malloc() routine returns a pointer to a block ** of memory at least N bytes in length, where N is the parameter. ** ^If sqlite3_malloc() is unable to obtain sufficient free ** memory, it returns a NULL pointer. ^If the parameter N to ** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns ** a NULL pointer. ** ** ^Calling sqlite3_free() with a pointer previously returned ** by sqlite3_malloc() or sqlite3_realloc() releases that memory so ** that it might be reused. ^The sqlite3_free() routine is ** a no-op if is called with a NULL pointer. Passing a NULL pointer ** to sqlite3_free() is harmless. After being freed, memory ** should neither be read nor written. Even reading previously freed ** memory might result in a segmentation fault or other severe error. ** Memory corruption, a segmentation fault, or other severe error ** might result if sqlite3_free() is called with a non-NULL pointer that ** was not obtained from sqlite3_malloc() or sqlite3_realloc(). ** ** ^(The sqlite3_realloc() interface attempts to resize a ** prior memory allocation to be at least N bytes, where N is the ** second parameter. The memory allocation to be resized is the first ** parameter.)^ ^ If the first parameter to sqlite3_realloc() ** is a NULL pointer then its behavior is identical to calling ** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc(). ** ^If the second parameter to sqlite3_realloc() is zero or ** negative then the behavior is exactly the same as calling ** sqlite3_free(P) where P is the first parameter to sqlite3_realloc(). ** ^sqlite3_realloc() returns a pointer to a memory allocation ** of at least N bytes in size or NULL if sufficient memory is unavailable. ** ^If M is the size of the prior allocation, then min(N,M) bytes ** of the prior allocation are copied into the beginning of buffer returned ** by sqlite3_realloc() and the prior allocation is freed. ** ^If sqlite3_realloc() returns NULL, then the prior allocation ** is not freed. ** ** ^The memory returned by sqlite3_malloc() and sqlite3_realloc() ** is always aligned to at least an 8 byte boundary, or to a ** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time ** option is used. ** ** In SQLite version 3.5.0 and 3.5.1, it was possible to define ** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in ** implementation of these routines to be omitted. That capability ** is no longer provided. Only built-in memory allocators can be used. ** ** The Windows OS interface layer calls ** the system malloc() and free() directly when converting ** filenames between the UTF-8 encoding used by SQLite ** and whatever filename encoding is used by the particular Windows ** installation. Memory allocation errors are detected, but ** they are reported back as [SQLITE_CANTOPEN] or ** [SQLITE_IOERR] rather than [SQLITE_NOMEM]. ** ** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] ** must be either NULL or else pointers obtained from a prior ** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have ** not yet been released. ** ** The application must not read or write any part of ** a block of memory after it has been released using ** [sqlite3_free()] or [sqlite3_realloc()]. */ SQLITE_API void *sqlite3_malloc(int); SQLITE_API void *sqlite3_realloc(void*, int); SQLITE_API void sqlite3_free(void*); /* ** CAPI3REF: Memory Allocator Statistics ** ** SQLite provides these two interfaces for reporting on the status ** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] ** routines, which form the built-in memory allocation subsystem. ** ** ^The [sqlite3_memory_used()] routine returns the number of bytes ** of memory currently outstanding (malloced but not freed). ** ^The [sqlite3_memory_highwater()] routine returns the maximum ** value of [sqlite3_memory_used()] since the high-water mark ** was last reset. ^The values returned by [sqlite3_memory_used()] and ** [sqlite3_memory_highwater()] include any overhead ** added by SQLite in its implementation of [sqlite3_malloc()], ** but not overhead added by the any underlying system library ** routines that [sqlite3_malloc()] may call. ** ** ^The memory high-water mark is reset to the current value of ** [sqlite3_memory_used()] if and only if the parameter to ** [sqlite3_memory_highwater()] is true. ^The value returned ** by [sqlite3_memory_highwater(1)] is the high-water mark ** prior to the reset. */ SQLITE_API sqlite3_int64 sqlite3_memory_used(void); SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); /* ** CAPI3REF: Pseudo-Random Number Generator ** ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to ** select random [ROWID | ROWIDs] when inserting new records into a table that ** already uses the largest possible [ROWID]. The PRNG is also used for ** the build-in random() and randomblob() SQL functions. This interface allows ** applications to access the same PRNG for other purposes. ** ** ^A call to this routine stores N bytes of randomness into buffer P. ** ** ^The first time this routine is invoked (either internally or by ** the application) the PRNG is seeded using randomness obtained ** from the xRandomness method of the default [sqlite3_vfs] object. ** ^On all subsequent invocations, the pseudo-randomness is generated ** internally and without recourse to the [sqlite3_vfs] xRandomness ** method. */ SQLITE_API void sqlite3_randomness(int N, void *P); /* ** CAPI3REF: Compile-Time Authorization Callbacks ** ** ^This routine registers a authorizer callback with a particular ** [database connection], supplied in the first argument. ** ^The authorizer callback is invoked as SQL statements are being compiled ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various ** points during the compilation process, as logic is being created ** to perform various actions, the authorizer callback is invoked to ** see if those actions are allowed. ^The authorizer callback should ** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the ** specific action but allow the SQL statement to continue to be ** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be ** rejected with an error. ^If the authorizer callback returns ** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] ** then the [sqlite3_prepare_v2()] or equivalent call that triggered ** the authorizer will fail with an error message. ** ** When the callback returns [SQLITE_OK], that means the operation ** requested is ok. ^When the callback returns [SQLITE_DENY], the ** [sqlite3_prepare_v2()] or equivalent call that triggered the ** authorizer will fail with an error message explaining that ** access is denied. ** ** ^The first parameter to the authorizer callback is a copy of the third ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter ** to the callback is an integer [SQLITE_COPY | action code] that specifies ** the particular action to be authorized. ^The third through sixth parameters ** to the callback are zero-terminated strings that contain additional ** details about the action to be authorized. ** ** ^If the action code is [SQLITE_READ] ** and the callback returns [SQLITE_IGNORE] then the ** [prepared statement] statement is constructed to substitute ** a NULL value in place of the table column that would have ** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] ** return can be used to deny an untrusted user access to individual ** columns of a table. ** ^If the action code is [SQLITE_DELETE] and the callback returns ** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the ** [truncate optimization] is disabled and all rows are deleted individually. ** ** An authorizer is used when [sqlite3_prepare | preparing] ** SQL statements from an untrusted source, to ensure that the SQL statements ** do not try to access data they are not allowed to see, or that they do not ** try to execute malicious statements that damage the database. For ** example, an application may allow a user to enter arbitrary ** SQL queries for evaluation by a database. But the application does ** not want the user to be able to make arbitrary changes to the ** database. An authorizer could then be put in place while the ** user-entered SQL is being [sqlite3_prepare | prepared] that ** disallows everything except [SELECT] statements. ** ** Applications that need to process SQL from untrusted sources ** might also consider lowering resource limits using [sqlite3_limit()] ** and limiting database size using the [max_page_count] [PRAGMA] ** in addition to using an authorizer. ** ** ^(Only a single authorizer can be in place on a database connection ** at a time. Each call to sqlite3_set_authorizer overrides the ** previous call.)^ ^Disable the authorizer by installing a NULL callback. ** The authorizer is disabled by default. ** ** The authorizer callback must not do anything that will modify ** the database connection that invoked the authorizer callback. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** ** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the ** statement might be re-prepared during [sqlite3_step()] due to a ** schema change. Hence, the application should ensure that the ** correct authorizer callback remains in place during the [sqlite3_step()]. ** ** ^Note that the authorizer callback is invoked only during ** [sqlite3_prepare()] or its variants. Authorization is not ** performed during statement evaluation in [sqlite3_step()], unless ** as stated in the previous paragraph, sqlite3_step() invokes ** sqlite3_prepare_v2() to reprepare a statement after a schema change. */ SQLITE_API int sqlite3_set_authorizer( sqlite3*, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pUserData ); /* ** CAPI3REF: Authorizer Return Codes ** ** The [sqlite3_set_authorizer | authorizer callback function] must ** return either [SQLITE_OK] or one of these two constants in order ** to signal SQLite whether or not the action is permitted. See the ** [sqlite3_set_authorizer | authorizer documentation] for additional ** information. */ #define SQLITE_DENY 1 /* Abort the SQL statement with an error */ #define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ /* ** CAPI3REF: Authorizer Action Codes ** ** The [sqlite3_set_authorizer()] interface registers a callback function ** that is invoked to authorize certain SQL statement actions. The ** second parameter to the callback is an integer code that specifies ** what action is being authorized. These are the integer action codes that ** the authorizer callback may be passed. ** ** These action code values signify what kind of operation is to be ** authorized. The 3rd and 4th parameters to the authorization ** callback function will be parameters or NULL depending on which of these ** codes is used as the second parameter. ^(The 5th parameter to the ** authorizer callback is the name of the database ("main", "temp", ** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback ** is the name of the inner-most trigger or view that is responsible for ** the access attempt or NULL if this access attempt is directly from ** top-level SQL code. */ /******************************************* 3rd ************ 4th ***********/ #define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ #define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ #define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ #define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ #define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ #define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ #define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ #define SQLITE_CREATE_VIEW 8 /* View Name NULL */ #define SQLITE_DELETE 9 /* Table Name NULL */ #define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ #define SQLITE_DROP_TABLE 11 /* Table Name NULL */ #define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ #define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ #define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ #define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ #define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ #define SQLITE_DROP_VIEW 17 /* View Name NULL */ #define SQLITE_INSERT 18 /* Table Name NULL */ #define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ #define SQLITE_READ 20 /* Table Name Column Name */ #define SQLITE_SELECT 21 /* NULL NULL */ #define SQLITE_TRANSACTION 22 /* Operation NULL */ #define SQLITE_UPDATE 23 /* Table Name Column Name */ #define SQLITE_ATTACH 24 /* Filename NULL */ #define SQLITE_DETACH 25 /* Database Name NULL */ #define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ #define SQLITE_REINDEX 27 /* Index Name NULL */ #define SQLITE_ANALYZE 28 /* Table Name NULL */ #define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ #define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ #define SQLITE_FUNCTION 31 /* NULL Function Name */ #define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ #define SQLITE_COPY 0 /* No longer used */ /* ** CAPI3REF: Tracing And Profiling Functions ** ** These routines register callback functions that can be used for ** tracing and profiling the execution of SQL statements. ** ** ^The callback function registered by sqlite3_trace() is invoked at ** various times when an SQL statement is being run by [sqlite3_step()]. ** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the ** SQL statement text as the statement first begins executing. ** ^(Additional sqlite3_trace() callbacks might occur ** as each triggered subprogram is entered. The callbacks for triggers ** contain a UTF-8 SQL comment that identifies the trigger.)^ ** ** ^The callback function registered by sqlite3_profile() is invoked ** as each SQL statement finishes. ^The profile callback contains ** the original statement text and an estimate of wall-clock time ** of how long that statement took to run. ^The profile callback ** time is in units of nanoseconds, however the current implementation ** is only capable of millisecond resolution so the six least significant ** digits in the time are meaningless. Future versions of SQLite ** might provide greater resolution on the profiler callback. The ** sqlite3_profile() function is considered experimental and is ** subject to change in future versions of SQLite. */ SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); /* ** CAPI3REF: Query Progress Callbacks ** ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback ** function X to be invoked periodically during long running calls to ** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for ** database connection D. An example use for this ** interface is to keep a GUI updated during a large query. ** ** ^The parameter P is passed through as the only parameter to the ** callback function X. ^The parameter N is the number of ** [virtual machine instructions] that are evaluated between successive ** invocations of the callback X. ** ** ^Only a single progress handler may be defined at one time per ** [database connection]; setting a new progress handler cancels the ** old one. ^Setting parameter X to NULL disables the progress handler. ** ^The progress handler is also disabled by setting N to a value less ** than 1. ** ** ^If the progress callback returns non-zero, the operation is ** interrupted. This feature can be used to implement a ** "Cancel" button on a GUI progress dialog box. ** ** The progress handler callback must not do anything that will modify ** the database connection that invoked the progress handler. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** */ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); /* ** CAPI3REF: Opening A New Database Connection ** ** ^These routines open an SQLite database file whose name is given by the ** filename argument. ^The filename argument is interpreted as UTF-8 for ** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte ** order for sqlite3_open16(). ^(A [database connection] handle is usually ** returned in *ppDb, even if an error occurs. The only exception is that ** if SQLite is unable to allocate memory to hold the [sqlite3] object, ** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] ** object.)^ ^(If the database is opened (and/or created) successfully, then ** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The ** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain ** an English language description of the error following a failure of any ** of the sqlite3_open() routines. ** ** ^The default encoding for the database will be UTF-8 if ** sqlite3_open() or sqlite3_open_v2() is called and ** UTF-16 in the native byte order if sqlite3_open16() is used. ** ** Whether or not an error occurs when it is opened, resources ** associated with the [database connection] handle should be released by ** passing it to [sqlite3_close()] when it is no longer required. ** ** The sqlite3_open_v2() interface works like sqlite3_open() ** except that it accepts two additional parameters for additional control ** over the new database connection. ^(The flags parameter to ** sqlite3_open_v2() can take one of ** the following three values, optionally combined with the ** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE], ** and/or [SQLITE_OPEN_PRIVATECACHE] flags:)^ ** **
        ** ^(
        [SQLITE_OPEN_READONLY]
        **
        The database is opened in read-only mode. If the database does not ** already exist, an error is returned.
        )^ ** ** ^(
        [SQLITE_OPEN_READWRITE]
        **
        The database is opened for reading and writing if possible, or reading ** only if the file is write protected by the operating system. In either ** case the database must already exist, otherwise an error is returned.
        )^ ** ** ^(
        [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
        **
        The database is opened for reading and writing, and is creates it if ** it does not already exist. This is the behavior that is always used for ** sqlite3_open() and sqlite3_open16().
        )^ **
        ** ** If the 3rd parameter to sqlite3_open_v2() is not one of the ** combinations shown above or one of the combinations shown above combined ** with the [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], ** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_PRIVATECACHE] flags, ** then the behavior is undefined. ** ** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection ** opens in the multi-thread [threading mode] as long as the single-thread ** mode has not been set at compile-time or start-time. ^If the ** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens ** in the serialized [threading mode] unless single-thread was ** previously selected at compile-time or start-time. ** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be ** eligible to use [shared cache mode], regardless of whether or not shared ** cache is enabled using [sqlite3_enable_shared_cache()]. ^The ** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not ** participate in [shared cache mode] even if it is enabled. ** ** ^If the filename is ":memory:", then a private, temporary in-memory database ** is created for the connection. ^This in-memory database will vanish when ** the database connection is closed. Future versions of SQLite might ** make use of additional special filenames that begin with the ":" character. ** It is recommended that when a database filename actually does begin with ** a ":" character you should prefix the filename with a pathname such as ** "./" to avoid ambiguity. ** ** ^If the filename is an empty string, then a private, temporary ** on-disk database will be created. ^This private database will be ** automatically deleted as soon as the database connection is closed. ** ** ^The fourth parameter to sqlite3_open_v2() is the name of the ** [sqlite3_vfs] object that defines the operating system interface that ** the new database connection should use. ^If the fourth parameter is ** a NULL pointer then the default [sqlite3_vfs] object is used. ** ** Note to Windows users: The encoding used for the filename argument ** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever ** codepage is currently defined. Filenames containing international ** characters must be converted to UTF-8 prior to passing them into ** sqlite3_open() or sqlite3_open_v2(). */ SQLITE_API int sqlite3_open( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); SQLITE_API int sqlite3_open16( const void *filename, /* Database filename (UTF-16) */ sqlite3 **ppDb /* OUT: SQLite db handle */ ); SQLITE_API int sqlite3_open_v2( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb, /* OUT: SQLite db handle */ int flags, /* Flags */ const char *zVfs /* Name of VFS module to use */ ); /* ** CAPI3REF: Error Codes And Messages ** ** ^The sqlite3_errcode() interface returns the numeric [result code] or ** [extended result code] for the most recent failed sqlite3_* API call ** associated with a [database connection]. If a prior API call failed ** but the most recent API call succeeded, the return value from ** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode() ** interface is the same except that it always returns the ** [extended result code] even when extended result codes are ** disabled. ** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. ** ^(Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions.)^ ** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. ** When that happens, the second error will be reported since these ** interfaces always report the most recent result. To avoid ** this, each thread can obtain exclusive use of the [database connection] D ** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning ** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after ** all calls to the interfaces listed here are completed. ** ** If an interface fails with SQLITE_MISUSE, that means the interface ** was invoked incorrectly by the application. In that case, the ** error code and message may or may not be set. */ SQLITE_API int sqlite3_errcode(sqlite3 *db); SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); SQLITE_API const char *sqlite3_errmsg(sqlite3*); SQLITE_API const void *sqlite3_errmsg16(sqlite3*); /* ** CAPI3REF: SQL Statement Object ** KEYWORDS: {prepared statement} {prepared statements} ** ** An instance of this object represents a single SQL statement. ** This object is variously known as a "prepared statement" or a ** "compiled SQL statement" or simply as a "statement". ** ** The life of a statement object goes something like this: ** **
          **
        1. Create the object using [sqlite3_prepare_v2()] or a related ** function. **
        2. Bind values to [host parameters] using the sqlite3_bind_*() ** interfaces. **
        3. Run the SQL by calling [sqlite3_step()] one or more times. **
        4. Reset the statement using [sqlite3_reset()] then go back ** to step 2. Do this zero or more times. **
        5. Destroy the object using [sqlite3_finalize()]. **
        ** ** Refer to documentation on individual methods above for additional ** information. */ typedef struct sqlite3_stmt sqlite3_stmt; /* ** CAPI3REF: Run-time Limits ** ** ^(This interface allows the size of various constructs to be limited ** on a connection by connection basis. The first parameter is the ** [database connection] whose limit is to be set or queried. The ** second parameter is one of the [limit categories] that define a ** class of constructs to be size limited. The third parameter is the ** new limit for that construct.)^ ** ** ^If the new limit is a negative number, the limit is unchanged. ** ^(For each limit category SQLITE_LIMIT_NAME there is a ** [limits | hard upper bound] ** set at compile-time by a C preprocessor macro called ** [limits | SQLITE_MAX_NAME]. ** (The "_LIMIT_" in the name is changed to "_MAX_".))^ ** ^Attempts to increase a limit above its hard upper bound are ** silently truncated to the hard upper bound. ** ** ^Regardless of whether or not the limit was changed, the ** [sqlite3_limit()] interface returns the prior value of the limit. ** ^Hence, to find the current value of a limit without changing it, ** simply invoke this interface with the third parameter set to -1. ** ** Run-time limits are intended for use in applications that manage ** both their own internal database and also databases that are controlled ** by untrusted external sources. An example application might be a ** web browser that has its own databases for storing history and ** separate databases controlled by JavaScript applications downloaded ** off the Internet. The internal databases can be given the ** large, default limits. Databases managed by external sources can ** be given much smaller limits designed to prevent a denial of service ** attack. Developers might also want to use the [sqlite3_set_authorizer()] ** interface to further control untrusted SQL. The size of the database ** created by an untrusted script can be contained using the ** [max_page_count] [PRAGMA]. ** ** New run-time limit categories may be added in future releases. */ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); /* ** CAPI3REF: Run-Time Limit Categories ** KEYWORDS: {limit category} {*limit categories} ** ** These constants define various performance limits ** that can be lowered at run-time using [sqlite3_limit()]. ** The synopsis of the meanings of the various limits is shown below. ** Additional information is available at [limits | Limits in SQLite]. ** **
        ** ^(
        SQLITE_LIMIT_LENGTH
        **
        The maximum size of any string or BLOB or table row, in bytes.
        )^ ** ** ^(
        SQLITE_LIMIT_SQL_LENGTH
        **
        The maximum length of an SQL statement, in bytes.
        )^ ** ** ^(
        SQLITE_LIMIT_COLUMN
        **
        The maximum number of columns in a table definition or in the ** result set of a [SELECT] or the maximum number of columns in an index ** or in an ORDER BY or GROUP BY clause.
        )^ ** ** ^(
        SQLITE_LIMIT_EXPR_DEPTH
        **
        The maximum depth of the parse tree on any expression.
        )^ ** ** ^(
        SQLITE_LIMIT_COMPOUND_SELECT
        **
        The maximum number of terms in a compound SELECT statement.
        )^ ** ** ^(
        SQLITE_LIMIT_VDBE_OP
        **
        The maximum number of instructions in a virtual machine program ** used to implement an SQL statement. This limit is not currently ** enforced, though that might be added in some future release of ** SQLite.
        )^ ** ** ^(
        SQLITE_LIMIT_FUNCTION_ARG
        **
        The maximum number of arguments on a function.
        )^ ** ** ^(
        SQLITE_LIMIT_ATTACHED
        **
        The maximum number of [ATTACH | attached databases].)^
        ** ** ^(
        SQLITE_LIMIT_LIKE_PATTERN_LENGTH
        **
        The maximum length of the pattern argument to the [LIKE] or ** [GLOB] operators.
        )^ ** ** ^(
        SQLITE_LIMIT_VARIABLE_NUMBER
        **
        The maximum index number of any [parameter] in an SQL statement.)^ ** ** ^(
        SQLITE_LIMIT_TRIGGER_DEPTH
        **
        The maximum depth of recursion for triggers.
        )^ **
        */ #define SQLITE_LIMIT_LENGTH 0 #define SQLITE_LIMIT_SQL_LENGTH 1 #define SQLITE_LIMIT_COLUMN 2 #define SQLITE_LIMIT_EXPR_DEPTH 3 #define SQLITE_LIMIT_COMPOUND_SELECT 4 #define SQLITE_LIMIT_VDBE_OP 5 #define SQLITE_LIMIT_FUNCTION_ARG 6 #define SQLITE_LIMIT_ATTACHED 7 #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 #define SQLITE_LIMIT_VARIABLE_NUMBER 9 #define SQLITE_LIMIT_TRIGGER_DEPTH 10 /* ** CAPI3REF: Compiling An SQL Statement ** KEYWORDS: {SQL statement compiler} ** ** To execute an SQL query, it must first be compiled into a byte-code ** program using one of these routines. ** ** The first argument, "db", is a [database connection] obtained from a ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or ** [sqlite3_open16()]. The database connection must not have been closed. ** ** The second argument, "zSql", is the statement to be compiled, encoded ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() ** use UTF-16. ** ** ^If the nByte argument is less than zero, then zSql is read up to the ** first zero terminator. ^If nByte is non-negative, then it is the maximum ** number of bytes read from zSql. ^When nByte is non-negative, the ** zSql string ends at either the first '\000' or '\u0000' character or ** the nByte-th byte, whichever comes first. If the caller knows ** that the supplied string is nul-terminated, then there is a small ** performance advantage to be gained by passing an nByte parameter that ** is equal to the number of bytes in the input string including ** the nul-terminator bytes. ** ** ^If pzTail is not NULL then *pzTail is made to point to the first byte ** past the end of the first SQL statement in zSql. These routines only ** compile the first statement in zSql, so *pzTail is left pointing to ** what remains uncompiled. ** ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be ** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set ** to NULL. ^If the input text contains no SQL (if the input is an empty ** string or a comment) then *ppStmt is set to NULL. ** The calling procedure is responsible for deleting the compiled ** SQL statement using [sqlite3_finalize()] after it has finished with it. ** ppStmt may not be NULL. ** ** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; ** otherwise an [error code] is returned. ** ** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are ** recommended for all new programs. The two older interfaces are retained ** for backwards compatibility, but their use is discouraged. ** ^In the "v2" interfaces, the prepared statement ** that is returned (the [sqlite3_stmt] object) contains a copy of the ** original SQL text. This causes the [sqlite3_step()] interface to ** behave differently in three ways: ** **
          **
        1. ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it ** always used to do, [sqlite3_step()] will automatically recompile the SQL ** statement and try to run it again. **
        2. ** **
        3. ** ^When an error occurs, [sqlite3_step()] will return one of the detailed ** [error codes] or [extended error codes]. ^The legacy behavior was that ** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code ** and the application would have to make a second call to [sqlite3_reset()] ** in order to find the underlying cause of the problem. With the "v2" prepare ** interfaces, the underlying reason for the error is returned immediately. **
        4. ** **
        5. ** ^If the specific value bound to [parameter | host parameter] in the ** WHERE clause might influence the choice of query plan for a statement, ** then the statement will be automatically recompiled, as if there had been ** a schema change, on the first [sqlite3_step()] call following any change ** to the [sqlite3_bind_text | bindings] of that [parameter]. ** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column ** and the [SQLITE_ENABLE_STAT2] compile-time option is enabled. ** the **
        6. **
        */ SQLITE_API int sqlite3_prepare( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare_v2( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare16( sqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); SQLITE_API int sqlite3_prepare16_v2( sqlite3 *db, /* Database handle */ const void *zSql, /* SQL statement, UTF-16 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const void **pzTail /* OUT: Pointer to unused portion of zSql */ ); /* ** CAPI3REF: Retrieving Statement SQL ** ** ^This interface can be used to retrieve a saved copy of the original ** SQL text used to create a [prepared statement] if that statement was ** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. */ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database ** ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if ** the [prepared statement] X is [SELECT] statement and false (zero) if ** X is an [INSERT], [UPDATE], [DELETE], CREATE, DROP, [ANALYZE], ** [ALTER], or [REINDEX] statement. ** If X is a NULL pointer or any other kind of statement, including but ** not limited to [ATTACH], [DETACH], [COMMIT], [ROLLBACK], [RELEASE], ** [SAVEPOINT], [PRAGMA], or [VACUUM] the result of sqlite3_stmt_readonly(X) is ** undefined. */ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); /* ** CAPI3REF: Dynamically Typed Value Object ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} ** ** SQLite uses the sqlite3_value object to represent all values ** that can be stored in a database table. SQLite uses dynamic typing ** for the values it stores. ^Values stored in sqlite3_value objects ** can be integers, floating point values, strings, BLOBs, or NULL. ** ** An sqlite3_value object may be either "protected" or "unprotected". ** Some interfaces require a protected sqlite3_value. Other interfaces ** will accept either a protected or an unprotected sqlite3_value. ** Every interface that accepts sqlite3_value arguments specifies ** whether or not it requires a protected sqlite3_value. ** ** The terms "protected" and "unprotected" refer to whether or not ** a mutex is held. A internal mutex is held for a protected ** sqlite3_value object but no mutex is held for an unprotected ** sqlite3_value object. If SQLite is compiled to be single-threaded ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) ** or if SQLite is run in one of reduced mutex modes ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] ** then there is no distinction between protected and unprotected ** sqlite3_value objects and they can be used interchangeably. However, ** for maximum code portability it is recommended that applications ** still make the distinction between protected and unprotected ** sqlite3_value objects even when not strictly required. ** ** ^The sqlite3_value objects that are passed as parameters into the ** implementation of [application-defined SQL functions] are protected. ** ^The sqlite3_value object returned by ** [sqlite3_column_value()] is unprotected. ** Unprotected sqlite3_value objects may only be used with ** [sqlite3_result_value()] and [sqlite3_bind_value()]. ** The [sqlite3_value_blob | sqlite3_value_type()] family of ** interfaces require protected sqlite3_value objects. */ typedef struct Mem sqlite3_value; /* ** CAPI3REF: SQL Function Context Object ** ** The context in which an SQL function executes is stored in an ** sqlite3_context object. ^A pointer to an sqlite3_context object ** is always first parameter to [application-defined SQL functions]. ** The application-defined SQL function implementation will pass this ** pointer through into calls to [sqlite3_result_int | sqlite3_result()], ** [sqlite3_aggregate_context()], [sqlite3_user_data()], ** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], ** and/or [sqlite3_set_auxdata()]. */ typedef struct sqlite3_context sqlite3_context; /* ** CAPI3REF: Binding Values To Prepared Statements ** KEYWORDS: {host parameter} {host parameters} {host parameter name} ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} ** ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, ** literals may be replaced by a [parameter] that matches one of following ** templates: ** **
          **
        • ? **
        • ?NNN **
        • :VVV **
        • @VVV **
        • $VVV **
        ** ** In the templates above, NNN represents an integer literal, ** and VVV represents an alphanumeric identifier.)^ ^The values of these ** parameters (also called "host parameter names" or "SQL parameters") ** can be set using the sqlite3_bind_*() routines defined here. ** ** ^The first argument to the sqlite3_bind_*() routines is always ** a pointer to the [sqlite3_stmt] object returned from ** [sqlite3_prepare_v2()] or its variants. ** ** ^The second argument is the index of the SQL parameter to be set. ** ^The leftmost SQL parameter has an index of 1. ^When the same named ** SQL parameter is used more than once, second and subsequent ** occurrences have the same index as the first occurrence. ** ^The index for named parameters can be looked up using the ** [sqlite3_bind_parameter_index()] API if desired. ^The index ** for "?NNN" parameters is the value of NNN. ** ^The NNN value must be between 1 and the [sqlite3_limit()] ** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999). ** ** ^The third argument is the value to bind to the parameter. ** ** ^(In those routines that have a fourth argument, its value is the ** number of bytes in the parameter. To be clear: the value is the ** number of bytes in the value, not the number of characters.)^ ** ^If the fourth parameter is negative, the length of the string is ** the number of bytes up to the first zero terminator. ** ** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and ** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or ** string after SQLite has finished with it. ^The destructor is called ** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(), ** sqlite3_bind_text(), or sqlite3_bind_text16() fails. ** ^If the fifth argument is ** the special value [SQLITE_STATIC], then SQLite assumes that the ** information is in static, unmanaged space and does not need to be freed. ** ^If the fifth argument has the value [SQLITE_TRANSIENT], then ** SQLite makes its own private copy of the data immediately, before ** the sqlite3_bind_*() routine returns. ** ** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that ** is filled with zeroes. ^A zeroblob uses a fixed amount of memory ** (just an integer to hold its size) while it is being processed. ** Zeroblobs are intended to serve as placeholders for BLOBs whose ** content is later written using ** [sqlite3_blob_open | incremental BLOB I/O] routines. ** ^A negative value for the zeroblob results in a zero-length BLOB. ** ** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer ** for the [prepared statement] or with a prepared statement for which ** [sqlite3_step()] has been called more recently than [sqlite3_reset()], ** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() ** routine is passed a [prepared statement] that has been finalized, the ** result is undefined and probably harmful. ** ** ^Bindings are not cleared by the [sqlite3_reset()] routine. ** ^Unbound parameters are interpreted as NULL. ** ** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an ** [error code] if anything goes wrong. ** ^[SQLITE_RANGE] is returned if the parameter ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. ** ** See also: [sqlite3_bind_parameter_count()], ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. */ SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); /* ** CAPI3REF: Number Of SQL Parameters ** ** ^This routine can be used to find the number of [SQL parameters] ** in a [prepared statement]. SQL parameters are tokens of the ** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as ** placeholders for values that are [sqlite3_bind_blob | bound] ** to the parameters at a later time. ** ** ^(This routine actually returns the index of the largest (rightmost) ** parameter. For all forms except ?NNN, this will correspond to the ** number of unique parameters. If parameters of the ?NNN form are used, ** there may be gaps in the list.)^ ** ** See also: [sqlite3_bind_blob|sqlite3_bind()], ** [sqlite3_bind_parameter_name()], and ** [sqlite3_bind_parameter_index()]. */ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); /* ** CAPI3REF: Name Of A Host Parameter ** ** ^The sqlite3_bind_parameter_name(P,N) interface returns ** the name of the N-th [SQL parameter] in the [prepared statement] P. ** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" ** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" ** respectively. ** In other words, the initial ":" or "$" or "@" or "?" ** is included as part of the name.)^ ** ^Parameters of the form "?" without a following integer have no name ** and are referred to as "nameless" or "anonymous parameters". ** ** ^The first host parameter has an index of 1, not 0. ** ** ^If the value N is out of range or if the N-th parameter is ** nameless, then NULL is returned. ^The returned string is ** always in UTF-8 encoding even if the named parameter was ** originally specified as UTF-16 in [sqlite3_prepare16()] or ** [sqlite3_prepare16_v2()]. ** ** See also: [sqlite3_bind_blob|sqlite3_bind()], ** [sqlite3_bind_parameter_count()], and ** [sqlite3_bind_parameter_index()]. */ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); /* ** CAPI3REF: Index Of A Parameter With A Given Name ** ** ^Return the index of an SQL parameter given its name. ^The ** index value returned is suitable for use as the second ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero ** is returned if no matching parameter is found. ^The parameter ** name must be given in UTF-8 even if the original statement ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. ** ** See also: [sqlite3_bind_blob|sqlite3_bind()], ** [sqlite3_bind_parameter_count()], and ** [sqlite3_bind_parameter_index()]. */ SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); /* ** CAPI3REF: Reset All Bindings On A Prepared Statement ** ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset ** the [sqlite3_bind_blob | bindings] on a [prepared statement]. ** ^Use this routine to reset all host parameters to NULL. */ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); /* ** CAPI3REF: Number Of Columns In A Result Set ** ** ^Return the number of columns in the result set returned by the ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL ** statement that does not return data (for example an [UPDATE]). ** ** See also: [sqlite3_data_count()] */ SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); /* ** CAPI3REF: Column Names In A Result Set ** ** ^These routines return the name assigned to a particular column ** in the result set of a [SELECT] statement. ^The sqlite3_column_name() ** interface returns a pointer to a zero-terminated UTF-8 string ** and sqlite3_column_name16() returns a pointer to a zero-terminated ** UTF-16 string. ^The first parameter is the [prepared statement] ** that implements the [SELECT] statement. ^The second parameter is the ** column number. ^The leftmost column is number 0. ** ** ^The returned string pointer is valid until either the [prepared statement] ** is destroyed by [sqlite3_finalize()] or until the next call to ** sqlite3_column_name() or sqlite3_column_name16() on the same column. ** ** ^If sqlite3_malloc() fails during the processing of either routine ** (for example during a conversion from UTF-8 to UTF-16) then a ** NULL pointer is returned. ** ** ^The name of a result column is the value of the "AS" clause for ** that column, if there is an AS clause. If there is no AS clause ** then the name of the column is unspecified and may change from ** one release of SQLite to the next. */ SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); /* ** CAPI3REF: Source Of Data In A Query Result ** ** ^These routines provide a means to determine the database, table, and ** table column that is the origin of a particular result column in ** [SELECT] statement. ** ^The name of the database or table or column can be returned as ** either a UTF-8 or UTF-16 string. ^The _database_ routines return ** the database name, the _table_ routines return the table name, and ** the origin_ routines return the column name. ** ^The returned string is valid until the [prepared statement] is destroyed ** using [sqlite3_finalize()] or until the same information is requested ** again in a different encoding. ** ** ^The names returned are the original un-aliased names of the ** database, table, and column. ** ** ^The first argument to these interfaces is a [prepared statement]. ** ^These functions return information about the Nth result column returned by ** the statement, where N is the second function argument. ** ^The left-most column is column 0 for these routines. ** ** ^If the Nth column returned by the statement is an expression or ** subquery and is not a column value, then all of these functions return ** NULL. ^These routine might also return NULL if a memory allocation error ** occurs. ^Otherwise, they return the name of the attached database, table, ** or column that query result column was extracted from. ** ** ^As with all other SQLite APIs, those whose names end with "16" return ** UTF-16 encoded strings and the other functions return UTF-8. ** ** ^These APIs are only available if the library was compiled with the ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. ** ** If two or more threads call one or more of these routines against the same ** prepared statement and column at the same time then the results are ** undefined. ** ** If two or more threads call one or more ** [sqlite3_column_database_name | column metadata interfaces] ** for the same [prepared statement] and result column ** at the same time then the results are undefined. */ SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); /* ** CAPI3REF: Declared Datatype Of A Query Result ** ** ^(The first parameter is a [prepared statement]. ** If this statement is a [SELECT] statement and the Nth column of the ** returned result set of that [SELECT] is a table column (not an ** expression or subquery) then the declared type of the table ** column is returned.)^ ^If the Nth column of the result set is an ** expression or subquery, then a NULL pointer is returned. ** ^The returned string is always UTF-8 encoded. ** ** ^(For example, given the database schema: ** ** CREATE TABLE t1(c1 VARIANT); ** ** and the following statement to be compiled: ** ** SELECT c1 + 1, c1 FROM t1; ** ** this routine would return the string "VARIANT" for the second result ** column (i==1), and a NULL pointer for the first result column (i==0).)^ ** ** ^SQLite uses dynamic run-time typing. ^So just because a column ** is declared to contain a particular type does not mean that the ** data stored in that column is of the declared type. SQLite is ** strongly typed, but the typing is dynamic not static. ^Type ** is associated with individual values, not with the containers ** used to hold those values. */ SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); /* ** CAPI3REF: Evaluate An SQL Statement ** ** After a [prepared statement] has been prepared using either ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function ** must be called one or more times to evaluate the statement. ** ** The details of the behavior of the sqlite3_step() interface depend ** on whether the statement was prepared using the newer "v2" interface ** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy ** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the ** new "v2" interface is recommended for new applications but the legacy ** interface will continue to be supported. ** ** ^In the legacy interface, the return value will be either [SQLITE_BUSY], ** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. ** ^With the "v2" interface, any of the other [result codes] or ** [extended result codes] might be returned as well. ** ** ^[SQLITE_BUSY] means that 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. ** ** ^[SQLITE_DONE] means that the statement has finished executing ** successfully. sqlite3_step() should not be called again on this virtual ** machine without first calling [sqlite3_reset()] to reset the virtual ** machine back to its initial state. ** ** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] ** is returned each time a new row of data is ready for processing by the ** caller. The values may be accessed using the [column access functions]. ** sqlite3_step() is called again to retrieve the next row of data. ** ** ^[SQLITE_ERROR] means that a run-time error (such as a constraint ** violation) has occurred. sqlite3_step() should not be called again on ** the VM. More information may be found by calling [sqlite3_errmsg()]. ** ^With the legacy interface, a more specific error code (for example, ** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) ** can be obtained by calling [sqlite3_reset()] on the ** [prepared statement]. ^In the "v2" interface, ** the more specific error code is returned directly by sqlite3_step(). ** ** [SQLITE_MISUSE] means that the this routine was called inappropriately. ** Perhaps it was called on a [prepared statement] that has ** already been [sqlite3_finalize | finalized] or on one that had ** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could ** be the case that the same database connection is being used by two or ** more threads at the same moment in time. ** ** For all versions of SQLite up to and including 3.6.23.1, it was required ** after sqlite3_step() returned anything other than [SQLITE_ROW] that ** [sqlite3_reset()] be called before any subsequent invocation of ** sqlite3_step(). Failure to invoke [sqlite3_reset()] in this way would ** result in an [SQLITE_MISUSE] return from sqlite3_step(). But after ** version 3.6.23.1, sqlite3_step() began calling [sqlite3_reset()] ** automatically in this circumstance rather than returning [SQLITE_MISUSE]. ** ** Goofy Interface Alert: In the legacy interface, the sqlite3_step() ** API always returns a generic error code, [SQLITE_ERROR], following any ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call ** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the ** specific [error codes] that better describes the error. ** We admit that this is a goofy design. The problem has been fixed ** with the "v2" interface. If you prepare all of your SQL statements ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, ** then the more specific [error codes] are returned directly ** by sqlite3_step(). The use of the "v2" interface is recommended. */ SQLITE_API int sqlite3_step(sqlite3_stmt*); /* ** CAPI3REF: Number of columns in a result set ** ** ^The sqlite3_data_count(P) interface returns the number of columns in the ** current row of the result set of [prepared statement] P. ** ^If prepared statement P does not have results ready to return ** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of ** interfaces) then sqlite3_data_count(P) returns 0. ** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. ** ** See also: [sqlite3_column_count()] */ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); /* ** CAPI3REF: Fundamental Datatypes ** KEYWORDS: SQLITE_TEXT ** ** ^(Every value in SQLite has one of five fundamental datatypes: ** **
          **
        • 64-bit signed integer **
        • 64-bit IEEE floating point number **
        • string **
        • BLOB **
        • NULL **
        )^ ** ** These constants are codes for each of those types. ** ** Note that the SQLITE_TEXT constant was also used in SQLite version 2 ** for a completely different meaning. Software that links against both ** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not ** SQLITE_TEXT. */ #define SQLITE_INTEGER 1 #define SQLITE_FLOAT 2 #define SQLITE_BLOB 4 #define SQLITE_NULL 5 #ifdef SQLITE_TEXT # undef SQLITE_TEXT #else # define SQLITE_TEXT 3 #endif #define SQLITE3_TEXT 3 /* ** CAPI3REF: Result Values From A Query ** KEYWORDS: {column access functions} ** ** These routines form the "result set" interface. ** ** ^These routines return information about a single column of the current ** result row of a query. ^In every case the first argument is a pointer ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] ** that was returned from [sqlite3_prepare_v2()] or one of its variants) ** and the second argument is the index of the column for which information ** should be returned. ^The leftmost column of the result set has the index 0. ** ^The number of columns in the result can be determined using ** [sqlite3_column_count()]. ** ** If the SQL statement does not currently point to a valid row, or if the ** column index is out of range, the result is undefined. ** These routines may only be called when the most recent call to ** [sqlite3_step()] has returned [SQLITE_ROW] and neither ** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. ** If any of these routines are called after [sqlite3_reset()] or ** [sqlite3_finalize()] or after [sqlite3_step()] has returned ** something other than [SQLITE_ROW], the results are undefined. ** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] ** are called from a different thread while any of these routines ** are pending, then the results are undefined. ** ** ^The sqlite3_column_type() routine returns the ** [SQLITE_INTEGER | datatype code] for the initial data type ** of the result column. ^The returned value is one of [SQLITE_INTEGER], ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value ** returned by sqlite3_column_type() is only meaningful if no type ** conversions have occurred as described below. After a type conversion, ** the value returned by sqlite3_column_type() is undefined. Future ** versions of SQLite may change the behavior of sqlite3_column_type() ** following a type conversion. ** ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() ** routine returns the number of bytes in that BLOB or string. ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts ** the string to UTF-8 and then returns the number of bytes. ** ^If the result is a numeric value then sqlite3_column_bytes() uses ** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns ** the number of bytes in that string. ** ^If the result is NULL, then sqlite3_column_bytes() returns zero. ** ** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16() ** routine returns the number of bytes in that BLOB or string. ** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts ** the string to UTF-16 and then returns the number of bytes. ** ^If the result is a numeric value then sqlite3_column_bytes16() uses ** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns ** the number of bytes in that string. ** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. ** ** ^The values returned by [sqlite3_column_bytes()] and ** [sqlite3_column_bytes16()] do not include the zero terminators at the end ** of the string. ^For clarity: the values returned by ** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of ** bytes in the string, not the number of characters. ** ** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), ** even empty strings, are always zero terminated. ^The return ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. ** ** ^The object returned by [sqlite3_column_value()] is an ** [unprotected sqlite3_value] object. An unprotected sqlite3_value object ** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()]. ** If the [unprotected sqlite3_value] object returned by ** [sqlite3_column_value()] is used in any other way, including calls ** to routines like [sqlite3_value_int()], [sqlite3_value_text()], ** or [sqlite3_value_bytes()], then the behavior is undefined. ** ** These routines attempt to convert the value where appropriate. ^For ** example, if the internal representation is FLOAT and a text result ** is requested, [sqlite3_snprintf()] is used internally to perform the ** conversion automatically. ^(The following table details the conversions ** that are applied: ** **
        ** **
        Internal
        Type
        Requested
        Type
        Conversion ** **
        NULL INTEGER Result is 0 **
        NULL FLOAT Result is 0.0 **
        NULL TEXT Result is NULL pointer **
        NULL BLOB Result is NULL pointer **
        INTEGER FLOAT Convert from integer to float **
        INTEGER TEXT ASCII rendering of the integer **
        INTEGER BLOB Same as INTEGER->TEXT **
        FLOAT INTEGER Convert from float to integer **
        FLOAT TEXT ASCII rendering of the float **
        FLOAT BLOB Same as FLOAT->TEXT **
        TEXT INTEGER Use atoi() **
        TEXT FLOAT Use atof() **
        TEXT BLOB No change **
        BLOB INTEGER Convert to TEXT then use atoi() **
        BLOB FLOAT Convert to TEXT then use atof() **
        BLOB TEXT Add a zero terminator if needed **
        **
        )^ ** ** The table above makes reference to standard C library functions atoi() ** and atof(). SQLite does not really use these functions. It has its ** own equivalent internal routines. The atoi() and atof() names are ** used in the table for brevity and because they are familiar to most ** C programmers. ** ** Note that when type conversions occur, pointers returned by prior ** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or ** sqlite3_column_text16() may be invalidated. ** Type conversions and pointer invalidations might occur ** in the following cases: ** **
          **
        • The initial content is a BLOB and sqlite3_column_text() or ** sqlite3_column_text16() is called. A zero-terminator might ** need to be added to the string.
        • **
        • The initial content is UTF-8 text and sqlite3_column_bytes16() or ** sqlite3_column_text16() is called. The content must be converted ** to UTF-16.
        • **
        • The initial content is UTF-16 text and sqlite3_column_bytes() or ** sqlite3_column_text() is called. The content must be converted ** to UTF-8.
        • **
        ** ** ^Conversions between UTF-16be and UTF-16le are always done in place and do ** not invalidate a prior pointer, though of course the content of the buffer ** that the prior pointer references will have been modified. Other kinds ** of conversion are done in place when it is possible, but sometimes they ** are not possible and in those cases prior pointers are invalidated. ** ** The safest and easiest to remember policy is to invoke these routines ** in one of the following ways: ** **
          **
        • sqlite3_column_text() followed by sqlite3_column_bytes()
        • **
        • sqlite3_column_blob() followed by sqlite3_column_bytes()
        • **
        • sqlite3_column_text16() followed by sqlite3_column_bytes16()
        • **
        ** ** In other words, you should call sqlite3_column_text(), ** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result ** into the desired format, then invoke sqlite3_column_bytes() or ** sqlite3_column_bytes16() to find the size of the result. Do not mix calls ** to sqlite3_column_text() or sqlite3_column_blob() with calls to ** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() ** with calls to sqlite3_column_bytes(). ** ** ^The pointers returned are valid until a type conversion occurs as ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or ** [sqlite3_finalize()] is called. ^The memory space used to hold strings ** and BLOBs is freed automatically. Do not pass the pointers returned ** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into ** [sqlite3_free()]. ** ** ^(If a memory allocation error occurs during the evaluation of any ** of these routines, a default value is returned. The default value ** is either the integer 0, the floating point number 0.0, or a NULL ** pointer. Subsequent calls to [sqlite3_errcode()] will return ** [SQLITE_NOMEM].)^ */ SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); /* ** CAPI3REF: Destroy A Prepared Statement Object ** ** ^The sqlite3_finalize() function is called to delete a [prepared statement]. ** ^If the most recent evaluation of the statement encountered no errors or ** or if the statement is never been evaluated, then sqlite3_finalize() returns ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then ** sqlite3_finalize(S) returns the appropriate [error code] or ** [extended error code]. ** ** ^The sqlite3_finalize(S) routine can be called at any point during ** the life cycle of [prepared statement] S: ** before statement S is ever evaluated, after ** one or more calls to [sqlite3_reset()], or after any call ** to [sqlite3_step()] regardless of whether or not the statement has ** completed execution. ** ** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. ** ** The application must finalize every [prepared statement] in order to avoid ** resource leaks. It is a grievous error for the application to try to use ** a prepared statement after it has been finalized. Any use of a prepared ** statement after it has been finalized can result in undefined and ** undesirable behavior such as segfaults and heap corruption. */ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); /* ** CAPI3REF: Reset A Prepared Statement Object ** ** The sqlite3_reset() function is called to reset a [prepared statement] ** object back to its initial state, ready to be re-executed. ** ^Any SQL statement variables that had values bound to them using ** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. ** Use [sqlite3_clear_bindings()] to reset the bindings. ** ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S ** back to the beginning of its program. ** ** ^If the most recent call to [sqlite3_step(S)] for the ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], ** or if [sqlite3_step(S)] has never before been called on S, ** then [sqlite3_reset(S)] returns [SQLITE_OK]. ** ** ^If the most recent call to [sqlite3_step(S)] for the ** [prepared statement] S indicated an error, then ** [sqlite3_reset(S)] returns an appropriate [error code]. ** ** ^The [sqlite3_reset(S)] interface does not change the values ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. */ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); /* ** CAPI3REF: Create Or Redefine SQL Functions ** KEYWORDS: {function creation routines} ** KEYWORDS: {application-defined SQL function} ** KEYWORDS: {application-defined SQL functions} ** ** ^These functions (collectively known as "function creation routines") ** are used to add SQL functions or aggregates or to redefine the behavior ** of existing SQL functions or aggregates. The only differences between ** these routines are the text encoding expected for ** the the second parameter (the name of the function being created) ** and the presence or absence of a destructor callback for ** the application data pointer. ** ** ^The first parameter is the [database connection] to which the SQL ** function is to be added. ^If an application uses more than one database ** connection then application-defined SQL functions must be added ** to each database connection separately. ** ** ^The second parameter is the name of the SQL function to be created or ** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 ** representation, exclusive of the zero-terminator. ^Note that the name ** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. ** ^Any attempt to create a function with a longer name ** will result in [SQLITE_MISUSE] being returned. ** ** ^The third parameter (nArg) ** is the number of arguments that the SQL function or ** aggregate takes. ^If this parameter is -1, then the SQL function or ** aggregate may take any number of arguments between 0 and the limit ** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third ** parameter is less than -1 or greater than 127 then the behavior is ** undefined. ** ** ^The fourth parameter, eTextRep, specifies what ** [SQLITE_UTF8 | text encoding] this SQL function prefers for ** its parameters. Every SQL function implementation must be able to work ** with UTF-8, UTF-16le, or UTF-16be. But some implementations may be ** more efficient with one encoding than another. ^An application may ** invoke sqlite3_create_function() or sqlite3_create_function16() multiple ** times with the same function but with different values of eTextRep. ** ^When multiple implementations of the same function are available, SQLite ** will pick the one that involves the least amount of data conversion. ** If there is only a single implementation which does not care what text ** encoding is used, then the fourth argument should be [SQLITE_ANY]. ** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** ** ^The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are ** pointers to C-language functions that implement the SQL function or ** aggregate. ^A scalar SQL function requires an implementation of the xFunc ** callback only; NULL pointers must be passed as the xStep and xFinal ** parameters. ^An aggregate SQL function requires an implementation of xStep ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing ** SQL function or aggregate, pass NULL poiners for all three function ** callbacks. ** ** ^(If the tenth parameter to sqlite3_create_function_v2() is not NULL, ** then it is destructor for the application data pointer. ** The destructor is invoked when the function is deleted, either by being ** overloaded or when the database connection closes.)^ ** ^The destructor is also invoked if the call to ** sqlite3_create_function_v2() fails. ** ^When the destructor callback of the tenth parameter is invoked, it ** is passed a single argument which is a copy of the application data ** pointer which was the fifth parameter to sqlite3_create_function_v2(). ** ** ^It is permitted to register multiple implementations of the same ** functions with the same name but with either differing numbers of ** arguments or differing preferred text encodings. ^SQLite will use ** the implementation that most closely matches the way in which the ** SQL function is used. ^A function implementation with a non-negative ** nArg parameter is a better match than a function implementation with ** a negative nArg. ^A function where the preferred text encoding ** matches the database encoding is a better ** match than a function where the encoding is different. ** ^A function where the encoding difference is between UTF16le and UTF16be ** is a closer match than a function where the encoding difference is ** between UTF8 and UTF16. ** ** ^Built-in functions may be overloaded by new application-defined functions. ** ** ^An application-defined function is permitted to call other ** SQLite interfaces. However, such calls must not ** close the database connection nor finalize or reset the prepared ** statement in which the function is running. */ SQLITE_API int sqlite3_create_function( sqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void *pApp, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*) ); SQLITE_API int sqlite3_create_function16( sqlite3 *db, const void *zFunctionName, int nArg, int eTextRep, void *pApp, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*) ); SQLITE_API int sqlite3_create_function_v2( sqlite3 *db, const char *zFunctionName, int nArg, int eTextRep, void *pApp, void (*xFunc)(sqlite3_context*,int,sqlite3_value**), void (*xStep)(sqlite3_context*,int,sqlite3_value**), void (*xFinal)(sqlite3_context*), void(*xDestroy)(void*) ); /* ** CAPI3REF: Text Encodings ** ** These constant define integer codes that represent the various ** text encodings supported by SQLite. */ #define SQLITE_UTF8 1 #define SQLITE_UTF16LE 2 #define SQLITE_UTF16BE 3 #define SQLITE_UTF16 4 /* Use native byte order */ #define SQLITE_ANY 5 /* sqlite3_create_function only */ #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ /* ** CAPI3REF: Deprecated Functions ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain ** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid ** the use of these functions. To help encourage people to avoid ** using these functions, we are not going to tell you what they do. */ #ifndef SQLITE_OMIT_DEPRECATED SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64); #endif /* ** CAPI3REF: Obtaining SQL Function Parameter Values ** ** The C-language implementation of SQL functions and aggregates uses ** this set of interface routines to access the parameter values on ** the function or aggregate. ** ** The xFunc (for scalar functions) or xStep (for aggregates) parameters ** to [sqlite3_create_function()] and [sqlite3_create_function16()] ** define callbacks that implement the SQL functions and aggregates. ** The 4th parameter to these callbacks is an array of pointers to ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for ** each parameter to the SQL function. These routines are used to ** extract values from the [sqlite3_value] objects. ** ** These routines work only with [protected sqlite3_value] objects. ** Any attempt to use these routines on an [unprotected sqlite3_value] ** object results in undefined behavior. ** ** ^These routines work just like the corresponding [column access functions] ** except that these routines take a single [protected sqlite3_value] object ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. ** ** ^The sqlite3_value_text16() interface extracts a UTF-16 string ** in the native byte-order of the host machine. ^The ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces ** extract UTF-16 strings as big-endian and little-endian respectively. ** ** ^(The sqlite3_value_numeric_type() interface attempts to apply ** numeric affinity to the value. This means that an attempt is ** made to convert the value to an integer or floating point. If ** such a conversion is possible without loss of information (in other ** words, if the value is a string that looks like a number) ** then the conversion is performed. Otherwise no conversion occurs. ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ ** ** Please pay particular attention to the fact that the pointer returned ** from [sqlite3_value_blob()], [sqlite3_value_text()], or ** [sqlite3_value_text16()] can be invalidated by a subsequent call to ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], ** or [sqlite3_value_text16()]. ** ** These routines must be called from the same thread as ** the SQL function that supplied the [sqlite3_value*] parameters. */ SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); SQLITE_API int sqlite3_value_bytes(sqlite3_value*); SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); SQLITE_API double sqlite3_value_double(sqlite3_value*); SQLITE_API int sqlite3_value_int(sqlite3_value*); SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); SQLITE_API int sqlite3_value_type(sqlite3_value*); SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); /* ** CAPI3REF: Obtain Aggregate Function Context ** ** Implementations of aggregate SQL functions use this ** routine to allocate memory for storing their state. ** ** ^The first time the sqlite3_aggregate_context(C,N) routine is called ** for a particular aggregate function, SQLite ** allocates N of memory, zeroes out that memory, and returns a pointer ** to the new memory. ^On second and subsequent calls to ** sqlite3_aggregate_context() for the same aggregate function instance, ** the same buffer is returned. Sqlite3_aggregate_context() is normally ** called once for each invocation of the xStep callback and then one ** last time when the xFinal callback is invoked. ^(When no rows match ** an aggregate query, the xStep() callback of the aggregate function ** implementation is never called and xFinal() is called exactly once. ** In those cases, sqlite3_aggregate_context() might be called for the ** first time from within xFinal().)^ ** ** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is ** less than or equal to zero or if a memory allocate error occurs. ** ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the ** value of N in subsequent call to sqlite3_aggregate_context() within ** the same aggregate function instance will not resize the memory ** allocation.)^ ** ** ^SQLite automatically frees the memory allocated by ** sqlite3_aggregate_context() when the aggregate query concludes. ** ** The first parameter must be a copy of the ** [sqlite3_context | SQL function context] that is the first parameter ** to the xStep or xFinal callback routine that implements the aggregate ** function. ** ** This routine must be called from the same thread in which ** the aggregate SQL function is running. */ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); /* ** CAPI3REF: User Data For Functions ** ** ^The sqlite3_user_data() interface returns a copy of ** the pointer that was the pUserData parameter (the 5th parameter) ** of the [sqlite3_create_function()] ** and [sqlite3_create_function16()] routines that originally ** registered the application defined function. ** ** This routine must be called from the same thread in which ** the application-defined function is running. */ SQLITE_API void *sqlite3_user_data(sqlite3_context*); /* ** CAPI3REF: Database Connection For Functions ** ** ^The sqlite3_context_db_handle() interface returns a copy of ** the pointer to the [database connection] (the 1st parameter) ** of the [sqlite3_create_function()] ** and [sqlite3_create_function16()] routines that originally ** registered the application defined function. */ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); /* ** CAPI3REF: Function Auxiliary Data ** ** The following two functions may be used by scalar SQL functions to ** associate metadata with argument values. If the same value is passed to ** multiple invocations of the same SQL function during query execution, under ** some circumstances the associated metadata may be preserved. This may ** be used, for example, to add a regular-expression matching scalar ** function. The compiled version of the regular expression is stored as ** metadata associated with the SQL value passed as the regular expression ** pattern. The compiled regular expression can be reused on multiple ** invocations of the same function so that the original pattern string ** does not need to be recompiled on each invocation. ** ** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata ** associated by the sqlite3_set_auxdata() function with the Nth argument ** value to the application-defined function. ^If no metadata has been ever ** been set for the Nth argument of the function, or if the corresponding ** function parameter has changed since the meta-data was set, ** then sqlite3_get_auxdata() returns a NULL pointer. ** ** ^The sqlite3_set_auxdata() interface saves the metadata ** pointed to by its 3rd parameter as the metadata for the N-th ** argument of the application-defined function. Subsequent ** calls to sqlite3_get_auxdata() might return this data, if it has ** not been destroyed. ** ^If it is not NULL, SQLite will invoke the destructor ** function given by the 4th parameter to sqlite3_set_auxdata() on ** the metadata when the corresponding function parameter changes ** or when the SQL statement completes, whichever comes first. ** ** SQLite is free to call the destructor and drop metadata on any ** parameter of any function at any time. ^The only guarantee is that ** the destructor will be called before the metadata is dropped. ** ** ^(In practice, metadata is preserved between function calls for ** expressions that are constant at compile time. This includes literal ** values and [parameters].)^ ** ** These routines must be called from the same thread in which ** the SQL function is running. */ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); /* ** CAPI3REF: Constants Defining Special Destructor Behavior ** ** These are special values for the destructor that is passed in as the ** final argument to routines like [sqlite3_result_blob()]. ^If the destructor ** argument is SQLITE_STATIC, it means that the content pointer is constant ** and will never change. It does not need to be destroyed. ^The ** SQLITE_TRANSIENT value means that the content will likely change in ** the near future and that SQLite should make its own private copy of ** the content before returning. ** ** The typedef is necessary to work around problems in certain ** C++ compilers. See ticket #2191. */ typedef void (*sqlite3_destructor_type)(void*); #define SQLITE_STATIC ((sqlite3_destructor_type)0) #define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) /* ** CAPI3REF: Setting The Result Of An SQL Function ** ** These routines are used by the xFunc or xFinal callbacks that ** implement SQL functions and aggregates. See ** [sqlite3_create_function()] and [sqlite3_create_function16()] ** for additional information. ** ** These functions work very much like the [parameter binding] family of ** functions used to bind values to host parameters in prepared statements. ** Refer to the [SQL parameter] documentation for additional information. ** ** ^The sqlite3_result_blob() interface sets the result from ** an application-defined function to be the BLOB whose content is pointed ** to by the second parameter and which is N bytes long where N is the ** third parameter. ** ** ^The sqlite3_result_zeroblob() interfaces set the result of ** the application-defined function to be a BLOB containing all zero ** bytes and N bytes in size, where N is the value of the 2nd parameter. ** ** ^The sqlite3_result_double() interface sets the result from ** an application-defined function to be a floating point value specified ** by its 2nd argument. ** ** ^The sqlite3_result_error() and sqlite3_result_error16() functions ** cause the implemented SQL function to throw an exception. ** ^SQLite uses the string pointed to by the ** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() ** as the text of an error message. ^SQLite interprets the error ** message string from sqlite3_result_error() as UTF-8. ^SQLite ** interprets the string from sqlite3_result_error16() as UTF-16 in native ** byte order. ^If the third parameter to sqlite3_result_error() ** or sqlite3_result_error16() is negative then SQLite takes as the error ** message all text up through the first zero character. ** ^If the third parameter to sqlite3_result_error() or ** sqlite3_result_error16() is non-negative then SQLite takes that many ** bytes (not characters) from the 2nd parameter as the error message. ** ^The sqlite3_result_error() and sqlite3_result_error16() ** routines make a private copy of the error message text before ** they return. Hence, the calling function can deallocate or ** modify the text after they return without harm. ** ^The sqlite3_result_error_code() function changes the error code ** returned by SQLite as a result of an error in a function. ^By default, ** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() ** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. ** ** ^The sqlite3_result_toobig() interface causes SQLite to throw an error ** indicating that a string or BLOB is too long to represent. ** ** ^The sqlite3_result_nomem() interface causes SQLite to throw an error ** indicating that a memory allocation failed. ** ** ^The sqlite3_result_int() interface sets the return value ** of the application-defined function to be the 32-bit signed integer ** value given in the 2nd argument. ** ^The sqlite3_result_int64() interface sets the return value ** of the application-defined function to be the 64-bit signed integer ** value given in the 2nd argument. ** ** ^The sqlite3_result_null() interface sets the return value ** of the application-defined function to be NULL. ** ** ^The sqlite3_result_text(), sqlite3_result_text16(), ** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces ** set the return value of the application-defined function to be ** a text string which is represented as UTF-8, UTF-16 native byte order, ** UTF-16 little endian, or UTF-16 big endian, respectively. ** ^SQLite takes the text result from the application from ** the 2nd parameter of the sqlite3_result_text* interfaces. ** ^If the 3rd parameter to the sqlite3_result_text* interfaces ** is negative, then SQLite takes result text from the 2nd parameter ** through the first zero character. ** ^If the 3rd parameter to the sqlite3_result_text* interfaces ** is non-negative, then as many bytes (not characters) of the text ** pointed to by the 2nd parameter are taken as the application-defined ** function result. ** ^If the 4th parameter to the sqlite3_result_text* interfaces ** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that ** function as the destructor on the text or BLOB result when it has ** finished using that result. ** ^If the 4th parameter to the sqlite3_result_text* interfaces or to ** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite ** assumes that the text or BLOB result is in constant space and does not ** copy the content of the parameter nor call a destructor on the content ** when it has finished using that result. ** ^If the 4th parameter to the sqlite3_result_text* interfaces ** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT ** then SQLite makes a copy of the result into space obtained from ** from [sqlite3_malloc()] before it returns. ** ** ^The sqlite3_result_value() interface sets the result of ** the application-defined function to be a copy the ** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The ** sqlite3_result_value() interface makes a copy of the [sqlite3_value] ** so that the [sqlite3_value] specified in the parameter may change or ** be deallocated after sqlite3_result_value() returns without harm. ** ^A [protected sqlite3_value] object may always be used where an ** [unprotected sqlite3_value] object is required, so either ** kind of [sqlite3_value] object can be used with this interface. ** ** If these routines are called from within the different thread ** than the one containing the application-defined function that received ** the [sqlite3_context] pointer, the results are undefined. */ SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); SQLITE_API void sqlite3_result_double(sqlite3_context*, double); SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); SQLITE_API void sqlite3_result_int(sqlite3_context*, int); SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); SQLITE_API void sqlite3_result_null(sqlite3_context*); SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); /* ** CAPI3REF: Define New Collating Sequences ** ** ^These functions add, remove, or modify a [collation] associated ** with the [database connection] specified as the first argument. ** ** ^The name of the collation is a UTF-8 string ** for sqlite3_create_collation() and sqlite3_create_collation_v2() ** and a UTF-16 string in native byte order for sqlite3_create_collation16(). ** ^Collation names that compare equal according to [sqlite3_strnicmp()] are ** considered to be the same name. ** ** ^(The third argument (eTextRep) must be one of the constants: **
          **
        • [SQLITE_UTF8], **
        • [SQLITE_UTF16LE], **
        • [SQLITE_UTF16BE], **
        • [SQLITE_UTF16], or **
        • [SQLITE_UTF16_ALIGNED]. **
        )^ ** ^The eTextRep argument determines the encoding of strings passed ** to the collating function callback, xCallback. ** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep ** force strings to be UTF16 with native byte order. ** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin ** on an even byte address. ** ** ^The fourth argument, pArg, is a application data pointer that is passed ** through as the first argument to the collating function callback. ** ** ^The fifth argument, xCallback, is a pointer to the collating function. ** ^Multiple collating functions can be registered using the same name but ** with different eTextRep parameters and SQLite will use whichever ** function requires the least amount of data transformation. ** ^If the xCallback argument is NULL then the collating function is ** deleted. ^When all collating functions having the same name are deleted, ** that collation is no longer usable. ** ** ^The collating function callback is invoked with a copy of the pArg ** application data pointer and with two strings in the encoding specified ** by the eTextRep argument. The collating function must return an ** integer that is negative, zero, or positive ** if the first string is less than, equal to, or greater than the second, ** respectively. A collating function must alway return the same answer ** given the same inputs. If two or more collating functions are registered ** to the same collation name (using different eTextRep values) then all ** must give an equivalent answer when invoked with equivalent strings. ** The collating function must obey the following properties for all ** strings A, B, and C: ** **
          **
        1. If A==B then B==A. **
        2. If A==B and B==C then A==C. **
        3. If A<B THEN B>A. **
        4. If A<B and B<C then A<C. **
        ** ** If a collating function fails any of the above constraints and that ** collating function is registered and used, then the behavior of SQLite ** is undefined. ** ** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() ** with the addition that the xDestroy callback is invoked on pArg when ** the collating function is deleted. ** ^Collating functions are deleted when they are overridden by later ** calls to the collation creation functions or when the ** [database connection] is closed using [sqlite3_close()]. ** ** ^The xDestroy callback is not called if the ** sqlite3_create_collation_v2() function fails. Applications that invoke ** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should ** check the return code and dispose of the application data pointer ** themselves rather than expecting SQLite to deal with it for them. ** This is different from every other SQLite interface. The inconsistency ** is unfortunate but cannot be changed without breaking backwards ** compatibility. ** ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. */ SQLITE_API int sqlite3_create_collation( sqlite3*, const char *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*) ); SQLITE_API int sqlite3_create_collation_v2( sqlite3*, const char *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*), void(*xDestroy)(void*) ); SQLITE_API int sqlite3_create_collation16( sqlite3*, const void *zName, int eTextRep, void *pArg, int(*xCompare)(void*,int,const void*,int,const void*) ); /* ** CAPI3REF: Collation Needed Callbacks ** ** ^To avoid having to register all collation sequences before a database ** can be used, a single callback function may be registered with the ** [database connection] to be invoked whenever an undefined collation ** sequence is required. ** ** ^If the function is registered using the sqlite3_collation_needed() API, ** then it is passed the names of undefined collation sequences as strings ** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, ** the names are passed as UTF-16 in machine native byte order. ** ^A call to either function replaces the existing collation-needed callback. ** ** ^(When the callback is invoked, the first argument passed is a copy ** of the second argument to sqlite3_collation_needed() or ** sqlite3_collation_needed16(). The second argument is the database ** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], ** or [SQLITE_UTF16LE], indicating the most desirable form of the collation ** sequence function required. The fourth parameter is the name of the ** required collation sequence.)^ ** ** The callback function should register the desired collation using ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or ** [sqlite3_create_collation_v2()]. */ SQLITE_API int sqlite3_collation_needed( sqlite3*, void*, void(*)(void*,sqlite3*,int eTextRep,const char*) ); SQLITE_API int sqlite3_collation_needed16( sqlite3*, void*, void(*)(void*,sqlite3*,int eTextRep,const void*) ); #ifdef SQLITE_HAS_CODEC /* ** Specify the key for an encrypted database. This routine should be ** called right after sqlite3_open(). ** ** The code to implement this API is not available in the public release ** of SQLite. */ SQLITE_API int sqlite3_key( sqlite3 *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The key */ ); /* ** Change the key on an open database. If the current database is not ** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the ** database is decrypted. ** ** The code to implement this API is not available in the public release ** of SQLite. */ SQLITE_API int sqlite3_rekey( sqlite3 *db, /* Database to be rekeyed */ const void *pKey, int nKey /* The new key */ ); /* ** Specify the activation key for a SEE database. Unless ** activated, none of the SEE routines will work. */ SQLITE_API void sqlite3_activate_see( const char *zPassPhrase /* Activation phrase */ ); #endif #ifdef SQLITE_ENABLE_CEROD /* ** Specify the activation key for a CEROD database. Unless ** activated, none of the CEROD routines will work. */ SQLITE_API void sqlite3_activate_cerod( const char *zPassPhrase /* Activation phrase */ ); #endif /* ** CAPI3REF: Suspend Execution For A Short Time ** ** The sqlite3_sleep() function causes the current thread to suspend execution ** for at least a number of milliseconds specified in its parameter. ** ** If the operating system does not support sleep requests with ** millisecond time resolution, then the time will be rounded up to ** the nearest second. The number of milliseconds of sleep actually ** requested from the operating system is returned. ** ** ^SQLite implements this interface by calling the xSleep() ** method of the default [sqlite3_vfs] object. If the xSleep() method ** of the default VFS is not implemented correctly, or not implemented at ** all, then the behavior of sqlite3_sleep() may deviate from the description ** in the previous paragraphs. */ SQLITE_API int sqlite3_sleep(int); /* ** CAPI3REF: Name Of The Folder Holding Temporary Files ** ** ^(If this global variable is made to point to a string which is ** the name of a folder (a.k.a. directory), then all temporary files ** created by SQLite when using a built-in [sqlite3_vfs | VFS] ** will be placed in that directory.)^ ^If this variable ** is a NULL pointer, then SQLite performs a search for an appropriate ** temporary file directory. ** ** It is not safe to read or modify this variable in more than one ** thread at a time. It is not safe to read or modify this variable ** if a [database connection] is being used at the same time in a separate ** thread. ** It is intended that this variable be set once ** as part of process initialization and before any SQLite interface ** routines have been called and that this variable remain unchanged ** thereafter. ** ** ^The [temp_store_directory pragma] may modify this variable and cause ** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, ** the [temp_store_directory pragma] always assumes that any string ** that this variable points to is held in memory obtained from ** [sqlite3_malloc] and the pragma may attempt to free that memory ** using [sqlite3_free]. ** Hence, if this variable is modified directly, either it should be ** made NULL or made to point to memory obtained from [sqlite3_malloc] ** or else the use of the [temp_store_directory pragma] should be avoided. */ SQLITE_API char *sqlite3_temp_directory; /* ** CAPI3REF: Test For Auto-Commit Mode ** KEYWORDS: {autocommit mode} ** ** ^The sqlite3_get_autocommit() interface returns non-zero or ** zero if the given database connection is or is not in autocommit mode, ** respectively. ^Autocommit mode is on by default. ** ^Autocommit mode is disabled by a [BEGIN] statement. ** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. ** ** If certain kinds of errors occur on a statement within a multi-statement ** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], ** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the ** transaction might be rolled back automatically. The only way to ** find out whether SQLite automatically rolled back the transaction after ** an error is to use this function. ** ** If another thread changes the autocommit status of the database ** connection while this routine is running, then the return value ** is undefined. */ SQLITE_API int sqlite3_get_autocommit(sqlite3*); /* ** CAPI3REF: Find The Database Handle Of A Prepared Statement ** ** ^The sqlite3_db_handle interface returns the [database connection] handle ** to which a [prepared statement] belongs. ^The [database connection] ** returned by sqlite3_db_handle is the same [database connection] ** that was the first argument ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to ** create the statement in the first place. */ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); /* ** CAPI3REF: Find the next prepared statement ** ** ^This interface returns a pointer to the next [prepared statement] after ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL ** then this interface returns a pointer to the first prepared statement ** associated with the database connection pDb. ^If no prepared statement ** satisfies the conditions of this routine, it returns NULL. ** ** The [database connection] pointer D in a call to ** [sqlite3_next_stmt(D,S)] must refer to an open database ** connection and in particular must not be a NULL pointer. */ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); /* ** CAPI3REF: Commit And Rollback Notification Callbacks ** ** ^The sqlite3_commit_hook() interface registers a callback ** function to be invoked whenever a transaction is [COMMIT | committed]. ** ^Any callback set by a previous call to sqlite3_commit_hook() ** for the same database connection is overridden. ** ^The sqlite3_rollback_hook() interface registers a callback ** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. ** ^Any callback set by a previous call to sqlite3_rollback_hook() ** for the same database connection is overridden. ** ^The pArg argument is passed through to the callback. ** ^If the callback on a commit hook function returns non-zero, ** then the commit is converted into a rollback. ** ** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions ** return the P argument from the previous call of the same function ** on the same [database connection] D, or NULL for ** the first call for each function on D. ** ** The callback implementation must not do anything that will modify ** the database connection that invoked the callback. Any actions ** to modify the database connection must be deferred until after the ** completion of the [sqlite3_step()] call that triggered the commit ** or rollback hook in the first place. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** ** ^Registering a NULL function disables the callback. ** ** ^When the commit hook callback routine returns zero, the [COMMIT] ** operation is allowed to continue normally. ^If the commit hook ** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK]. ** ^The rollback hook is invoked on a rollback that results from a commit ** hook returning non-zero, just as it would be with any other rollback. ** ** ^For the purposes of this API, a transaction is said to have been ** rolled back if an explicit "ROLLBACK" statement is executed, or ** an error or constraint causes an implicit rollback to occur. ** ^The rollback callback is not invoked if a transaction is ** automatically rolled back because the database connection is closed. ** ** See also the [sqlite3_update_hook()] interface. */ SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); /* ** CAPI3REF: Data Change Notification Callbacks ** ** ^The sqlite3_update_hook() interface registers a callback function ** with the [database connection] identified by the first argument ** to be invoked whenever a row is updated, inserted or deleted. ** ^Any callback set by a previous call to this function ** for the same database connection is overridden. ** ** ^The second argument is a pointer to the function to invoke when a ** row is updated, inserted or deleted. ** ^The first argument to the callback is a copy of the third argument ** to sqlite3_update_hook(). ** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], ** or [SQLITE_UPDATE], depending on the operation that caused the callback ** to be invoked. ** ^The third and fourth arguments to the callback contain pointers to the ** database and table name containing the affected row. ** ^The final callback parameter is the [rowid] of the row. ** ^In the case of an update, this is the [rowid] after the update takes place. ** ** ^(The update hook is not invoked when internal system tables are ** modified (i.e. sqlite_master and sqlite_sequence).)^ ** ** ^In the current implementation, the update hook ** is not invoked when duplication rows are deleted because of an ** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook ** invoked when rows are deleted using the [truncate optimization]. ** The exceptions defined in this paragraph might change in a future ** release of SQLite. ** ** The update hook implementation must not do anything that will modify ** the database connection that invoked the update hook. Any actions ** to modify the database connection must be deferred until after the ** completion of the [sqlite3_step()] call that triggered the update hook. ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** database connections for the meaning of "modify" in this paragraph. ** ** ^The sqlite3_update_hook(D,C,P) function ** returns the P argument from the previous call ** on the same [database connection] D, or NULL for ** the first call on D. ** ** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()] ** interfaces. */ SQLITE_API void *sqlite3_update_hook( sqlite3*, void(*)(void *,int ,char const *,char const *,sqlite3_int64), void* ); /* ** CAPI3REF: Enable Or Disable Shared Pager Cache ** KEYWORDS: {shared cache} ** ** ^(This routine enables or disables the sharing of the database cache ** and schema data structures between [database connection | connections] ** to the same database. Sharing is enabled if the argument is true ** and disabled if the argument is false.)^ ** ** ^Cache sharing is enabled and disabled for an entire process. ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite, ** sharing was enabled or disabled for each thread separately. ** ** ^(The cache sharing mode set by this interface effects all subsequent ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. ** Existing database connections continue use the sharing mode ** that was in effect at the time they were opened.)^ ** ** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled ** successfully. An [error code] is returned otherwise.)^ ** ** ^Shared cache is disabled by default. But this might change in ** future releases of SQLite. Applications that care about shared ** cache setting should set it explicitly. ** ** See Also: [SQLite Shared-Cache Mode] */ SQLITE_API int sqlite3_enable_shared_cache(int); /* ** CAPI3REF: Attempt To Free Heap Memory ** ** ^The sqlite3_release_memory() interface attempts to free N bytes ** of heap memory by deallocating non-essential memory allocations ** held by the database library. Memory used to cache database ** pages to improve performance is an example of non-essential memory. ** ^sqlite3_release_memory() returns the number of bytes actually freed, ** which might be more or less than the amount requested. ** ^The sqlite3_release_memory() routine is a no-op returning zero ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. */ SQLITE_API int sqlite3_release_memory(int); /* ** CAPI3REF: Impose A Limit On Heap Size ** ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the ** soft limit on the amount of heap memory that may be allocated by SQLite. ** ^SQLite strives to keep heap memory utilization below the soft heap ** limit by reducing the number of pages held in the page cache ** as heap memory usages approaches the limit. ** ^The soft heap limit is "soft" because even though SQLite strives to stay ** below the limit, it will exceed the limit rather than generate ** an [SQLITE_NOMEM] error. In other words, the soft heap limit ** is advisory only. ** ** ^The return value from sqlite3_soft_heap_limit64() is the size of ** the soft heap limit prior to the call. ^If the argument N is negative ** then no change is made to the soft heap limit. Hence, the current ** size of the soft heap limit can be determined by invoking ** sqlite3_soft_heap_limit64() with a negative argument. ** ** ^If the argument N is zero then the soft heap limit is disabled. ** ** ^(The soft heap limit is not enforced in the current implementation ** if one or more of following conditions are true: ** **
          **
        • The soft heap limit is set to zero. **
        • Memory accounting is disabled using a combination of the ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. **
        • An alternative page cache implementation is specifed using ** [sqlite3_config]([SQLITE_CONFIG_PCACHE],...). **
        • The page cache allocates from its own memory pool supplied ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than ** from the heap. **
        )^ ** ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], ** the soft heap limit is enforced on every memory allocation. Without ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced ** when memory is allocated by the page cache. Testing suggests that because ** the page cache is the predominate memory user in SQLite, most ** applications will achieve adequate soft heap limit enforcement without ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT]. ** ** The circumstances under which SQLite will enforce the soft heap limit may ** changes in future releases of SQLite. */ SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); /* ** CAPI3REF: Deprecated Soft Heap Limit Interface ** DEPRECATED ** ** This is a deprecated version of the [sqlite3_soft_heap_limit64()] ** interface. This routine is provided for historical compatibility ** only. All new applications should use the ** [sqlite3_soft_heap_limit64()] interface rather than this one. */ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); /* ** CAPI3REF: Extract Metadata About A Column Of A Table ** ** ^This routine returns metadata about a specific column of a specific ** database table accessible using the [database connection] handle ** passed as the first function argument. ** ** ^The column is identified by the second, third and fourth parameters to ** this function. ^The second parameter is either the name of the database ** (i.e. "main", "temp", or an attached database) containing the specified ** table or NULL. ^If it is NULL, then all attached databases are searched ** for the table using the same algorithm used by the database engine to ** resolve unqualified table references. ** ** ^The third and fourth parameters to this function are the table and column ** name of the desired column, respectively. Neither of these parameters ** may be NULL. ** ** ^Metadata is returned by writing to the memory locations passed as the 5th ** and subsequent parameters to this function. ^Any of these arguments may be ** NULL, in which case the corresponding element of metadata is omitted. ** ** ^(
        ** **
        Parameter Output
        Type
        Description ** **
        5th const char* Data type **
        6th const char* Name of default collation sequence **
        7th int True if column has a NOT NULL constraint **
        8th int True if column is part of the PRIMARY KEY **
        9th int True if column is [AUTOINCREMENT] **
        **
        )^ ** ** ^The memory pointed to by the character pointers returned for the ** declaration type and collation sequence is valid only until the next ** call to any SQLite API function. ** ** ^If the specified table is actually a view, an [error code] is returned. ** ** ^If the specified column is "rowid", "oid" or "_rowid_" and an ** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output ** parameters are set for the explicitly declared column. ^(If there is no ** explicitly declared [INTEGER PRIMARY KEY] column, then the output ** parameters are set as follows: ** **
        **     data type: "INTEGER"
        **     collation sequence: "BINARY"
        **     not null: 0
        **     primary key: 1
        **     auto increment: 0
        ** 
        )^ ** ** ^(This function may load one or more schemas from database files. If an ** error occurs during this process, or if the requested table or column ** cannot be found, an [error code] is returned and an error message left ** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^ ** ** ^This API is only available if the library was compiled with the ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined. */ SQLITE_API int sqlite3_table_column_metadata( sqlite3 *db, /* Connection handle */ const char *zDbName, /* Database name or NULL */ const char *zTableName, /* Table name */ const char *zColumnName, /* Column name */ char const **pzDataType, /* OUTPUT: Declared data type */ char const **pzCollSeq, /* OUTPUT: Collation sequence name */ int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ int *pPrimaryKey, /* OUTPUT: True if column part of PK */ int *pAutoinc /* OUTPUT: True if column is auto-increment */ ); /* ** CAPI3REF: Load An Extension ** ** ^This interface loads an SQLite extension library from the named file. ** ** ^The sqlite3_load_extension() interface attempts to load an ** SQLite extension library contained in the file zFile. ** ** ^The entry point is zProc. ** ^zProc may be 0, in which case the name of the entry point ** defaults to "sqlite3_extension_init". ** ^The sqlite3_load_extension() interface returns ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. ** ^If an error occurs and pzErrMsg is not 0, then the ** [sqlite3_load_extension()] interface shall attempt to ** fill *pzErrMsg with error message text stored in memory ** obtained from [sqlite3_malloc()]. The calling function ** should free this memory by calling [sqlite3_free()]. ** ** ^Extension loading must be enabled using ** [sqlite3_enable_load_extension()] prior to calling this API, ** otherwise an error will be returned. ** ** See also the [load_extension() SQL function]. */ SQLITE_API int sqlite3_load_extension( sqlite3 *db, /* Load the extension into this database connection */ const char *zFile, /* Name of the shared library containing extension */ const char *zProc, /* Entry point. Derived from zFile if 0 */ char **pzErrMsg /* Put error message here if not 0 */ ); /* ** CAPI3REF: Enable Or Disable Extension Loading ** ** ^So as not to open security holes in older applications that are ** unprepared to deal with extension loading, and as a means of disabling ** extension loading while evaluating user-entered SQL, the following API ** is provided to turn the [sqlite3_load_extension()] mechanism on and off. ** ** ^Extension loading is off by default. See ticket #1863. ** ^Call the sqlite3_enable_load_extension() routine with onoff==1 ** to turn extension loading on and call it with onoff==0 to turn ** it back off again. */ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); /* ** CAPI3REF: Automatically Load Statically Linked Extensions ** ** ^This interface causes the xEntryPoint() function to be invoked for ** each new [database connection] that is created. The idea here is that ** xEntryPoint() is the entry point for a statically linked SQLite extension ** that is to be automatically loaded into all new database connections. ** ** ^(Even though the function prototype shows that xEntryPoint() takes ** no arguments and returns void, SQLite invokes xEntryPoint() with three ** arguments and expects and integer result as if the signature of the ** entry point where as follows: ** **
        **    int xEntryPoint(
        **      sqlite3 *db,
        **      const char **pzErrMsg,
        **      const struct sqlite3_api_routines *pThunk
        **    );
        ** 
        )^ ** ** If the xEntryPoint routine encounters an error, it should make *pzErrMsg ** point to an appropriate error message (obtained from [sqlite3_mprintf()]) ** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg ** is NULL before calling the xEntryPoint(). ^SQLite will invoke ** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any ** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], ** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. ** ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already ** on the list of automatic extensions is a harmless no-op. ^No entry point ** will be called more than once for each database connection that is opened. ** ** See also: [sqlite3_reset_auto_extension()]. */ SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); /* ** CAPI3REF: Reset Automatic Extension Loading ** ** ^This interface disables all automatic extensions previously ** registered using [sqlite3_auto_extension()]. */ SQLITE_API void sqlite3_reset_auto_extension(void); /* ** The interface to the virtual-table mechanism is currently considered ** to be experimental. The interface might change in incompatible ways. ** If this is a problem for you, do not use the interface at this time. ** ** When the virtual-table mechanism stabilizes, we will declare the ** interface fixed, support it indefinitely, and remove this comment. */ /* ** Structures used by the virtual table interface */ typedef struct sqlite3_vtab sqlite3_vtab; typedef struct sqlite3_index_info sqlite3_index_info; typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; typedef struct sqlite3_module sqlite3_module; /* ** CAPI3REF: Virtual Table Object ** KEYWORDS: sqlite3_module {virtual table module} ** ** This structure, sometimes called a a "virtual table module", ** defines the implementation of a [virtual tables]. ** This structure consists mostly of methods for the module. ** ** ^A virtual table module is created by filling in a persistent ** instance of this structure and passing a pointer to that instance ** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. ** ^The registration remains valid until it is replaced by a different ** module or until the [database connection] closes. The content ** of this structure must not change while it is registered with ** any database connection. */ struct sqlite3_module { int iVersion; int (*xCreate)(sqlite3*, void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVTab, char**); int (*xConnect)(sqlite3*, void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVTab, char**); int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); int (*xDisconnect)(sqlite3_vtab *pVTab); int (*xDestroy)(sqlite3_vtab *pVTab); int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); int (*xClose)(sqlite3_vtab_cursor*); int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, int argc, sqlite3_value **argv); int (*xNext)(sqlite3_vtab_cursor*); int (*xEof)(sqlite3_vtab_cursor*); int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); int (*xBegin)(sqlite3_vtab *pVTab); int (*xSync)(sqlite3_vtab *pVTab); int (*xCommit)(sqlite3_vtab *pVTab); int (*xRollback)(sqlite3_vtab *pVTab); int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), void **ppArg); int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); }; /* ** CAPI3REF: Virtual Table Indexing Information ** KEYWORDS: sqlite3_index_info ** ** The sqlite3_index_info structure and its substructures is used as part ** of the [virtual table] interface to ** pass information into and receive the reply from the [xBestIndex] ** method of a [virtual table module]. The fields under **Inputs** are the ** inputs to xBestIndex and are read-only. xBestIndex inserts its ** results into the **Outputs** fields. ** ** ^(The aConstraint[] array records WHERE clause constraints of the form: ** **
        column OP expr
        ** ** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is ** stored in aConstraint[].op using one of the ** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ ** ^(The index of the column is stored in ** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the ** expr on the right-hand side can be evaluated (and thus the constraint ** is usable) and false if it cannot.)^ ** ** ^The optimizer automatically inverts terms of the form "expr OP column" ** and makes other simplifications to the WHERE clause in an attempt to ** get as many WHERE clause terms into the form shown above as possible. ** ^The aConstraint[] array only reports WHERE clause terms that are ** relevant to the particular virtual table being queried. ** ** ^Information about the ORDER BY clause is stored in aOrderBy[]. ** ^Each term of aOrderBy records a column of the ORDER BY clause. ** ** The [xBestIndex] method must fill aConstraintUsage[] with information ** about what parameters to pass to xFilter. ^If argvIndex>0 then ** the right-hand side of the corresponding aConstraint[] is evaluated ** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit ** is true, then the constraint is assumed to be fully handled by the ** virtual table and is not checked again by SQLite.)^ ** ** ^The idxNum and idxPtr values are recorded and passed into the ** [xFilter] method. ** ^[sqlite3_free()] is used to free idxPtr if and only if ** needToFreeIdxPtr is true. ** ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in ** the correct order to satisfy the ORDER BY clause so that no separate ** sorting step is required. ** ** ^The estimatedCost value is an estimate of the cost of doing the ** particular lookup. A full scan of a table with N entries should have ** a cost of N. A binary search of a table of N entries should have a ** cost of approximately log(N). */ struct sqlite3_index_info { /* Inputs */ int nConstraint; /* Number of entries in aConstraint */ struct sqlite3_index_constraint { int iColumn; /* Column on left-hand side of constraint */ unsigned char op; /* Constraint operator */ unsigned char usable; /* True if this constraint is usable */ int iTermOffset; /* Used internally - xBestIndex should ignore */ } *aConstraint; /* Table of WHERE clause constraints */ int nOrderBy; /* Number of terms in the ORDER BY clause */ struct sqlite3_index_orderby { int iColumn; /* Column number */ unsigned char desc; /* True for DESC. False for ASC. */ } *aOrderBy; /* The ORDER BY clause */ /* Outputs */ struct sqlite3_index_constraint_usage { int argvIndex; /* if >0, constraint is part of argv to xFilter */ unsigned char omit; /* Do not code a test for this constraint */ } *aConstraintUsage; int idxNum; /* Number used to identify the index */ char *idxStr; /* String, possibly obtained from sqlite3_malloc */ int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ int orderByConsumed; /* True if output is already ordered */ double estimatedCost; /* Estimated cost of using this index */ }; /* ** CAPI3REF: Virtual Table Constraint Operator Codes ** ** These macros defined the allowed values for the ** [sqlite3_index_info].aConstraint[].op field. Each value represents ** an operator that is part of a constraint term in the wHERE clause of ** a query that uses a [virtual table]. */ #define SQLITE_INDEX_CONSTRAINT_EQ 2 #define SQLITE_INDEX_CONSTRAINT_GT 4 #define SQLITE_INDEX_CONSTRAINT_LE 8 #define SQLITE_INDEX_CONSTRAINT_LT 16 #define SQLITE_INDEX_CONSTRAINT_GE 32 #define SQLITE_INDEX_CONSTRAINT_MATCH 64 /* ** CAPI3REF: Register A Virtual Table Implementation ** ** ^These routines are used to register a new [virtual table module] name. ** ^Module names must be registered before ** creating a new [virtual table] using the module and before using a ** preexisting [virtual table] for the module. ** ** ^The module name is registered on the [database connection] specified ** by the first parameter. ^The name of the module is given by the ** second parameter. ^The third parameter is a pointer to ** the implementation of the [virtual table module]. ^The fourth ** parameter is an arbitrary client data pointer that is passed through ** into the [xCreate] and [xConnect] methods of the virtual table module ** when a new virtual table is be being created or reinitialized. ** ** ^The sqlite3_create_module_v2() interface has a fifth parameter which ** is a pointer to a destructor for the pClientData. ^SQLite will ** invoke the destructor function (if it is not NULL) when SQLite ** no longer needs the pClientData pointer. ^The destructor will also ** be invoked if the call to sqlite3_create_module_v2() fails. ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData /* Client data for xCreate/xConnect */ ); SQLITE_API int sqlite3_create_module_v2( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData, /* Client data for xCreate/xConnect */ void(*xDestroy)(void*) /* Module destructor function */ ); /* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** ** Every [virtual table module] implementation uses a subclass ** of this object to describe a particular instance ** of the [virtual table]. Each subclass will ** be tailored to the specific needs of the module implementation. ** The purpose of this superclass is to define certain fields that are ** common to all module implementations. ** ** ^Virtual tables methods can set an error message by assigning a ** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should ** take care that any prior string is freed by a call to [sqlite3_free()] ** prior to assigning a new string to zErrMsg. ^After the error message ** is delivered up to the client application, the string will be automatically ** freed by sqlite3_free() and the zErrMsg field will be zeroed. */ struct sqlite3_vtab { const sqlite3_module *pModule; /* The module for this virtual table */ int nRef; /* NO LONGER USED */ char *zErrMsg; /* Error message from sqlite3_mprintf() */ /* Virtual table implementations will typically add additional fields */ }; /* ** CAPI3REF: Virtual Table Cursor Object ** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} ** ** Every [virtual table module] implementation uses a subclass of the ** following structure to describe cursors that point into the ** [virtual table] and are used ** to loop through the virtual table. Cursors are created using the ** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed ** by the [sqlite3_module.xClose | xClose] method. Cursors are used ** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods ** of the module. Each module implementation will define ** the content of a cursor structure to suit its own needs. ** ** This superclass exists in order to define fields of the cursor that ** are common to all implementations. */ struct sqlite3_vtab_cursor { sqlite3_vtab *pVtab; /* Virtual table of this cursor */ /* Virtual table implementations will typically add additional fields */ }; /* ** CAPI3REF: Declare The Schema Of A Virtual Table ** ** ^The [xCreate] and [xConnect] methods of a ** [virtual table module] call this interface ** to declare the format (the names and datatypes of the columns) of ** the virtual tables they implement. */ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); /* ** CAPI3REF: Overload A Function For A Virtual Table ** ** ^(Virtual tables can provide alternative implementations of functions ** using the [xFindFunction] method of the [virtual table module]. ** But global versions of those functions ** must exist in order to be overloaded.)^ ** ** ^(This API makes sure a global version of a function with a particular ** name and number of parameters exists. If no such function exists ** before this API is called, a new function is created.)^ ^The implementation ** of the new function always causes an exception to be thrown. So ** the new function is not good for anything by itself. Its only ** purpose is to be a placeholder function that can be overloaded ** by a [virtual table]. */ SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); /* ** The interface to the virtual-table mechanism defined above (back up ** to a comment remarkably similar to this one) is currently considered ** to be experimental. The interface might change in incompatible ways. ** If this is a problem for you, do not use the interface at this time. ** ** When the virtual-table mechanism stabilizes, we will declare the ** interface fixed, support it indefinitely, and remove this comment. */ /* ** CAPI3REF: A Handle To An Open BLOB ** KEYWORDS: {BLOB handle} {BLOB handles} ** ** An instance of this object represents an open BLOB on which ** [sqlite3_blob_open | incremental BLOB I/O] can be performed. ** ^Objects of this type are created by [sqlite3_blob_open()] ** and destroyed by [sqlite3_blob_close()]. ** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces ** can be used to read or write small subsections of the BLOB. ** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. */ typedef struct sqlite3_blob sqlite3_blob; /* ** CAPI3REF: Open A BLOB For Incremental I/O ** ** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located ** in row iRow, column zColumn, table zTable in database zDb; ** in other words, the same BLOB that would be selected by: ** **
        **     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
        ** 
        )^ ** ** ^If the flags parameter is non-zero, then the BLOB is opened for read ** and write access. ^If it is zero, the BLOB is opened for read access. ** ^It is not possible to open a column that is part of an index or primary ** key for writing. ^If [foreign key constraints] are enabled, it is ** not possible to open a column that is part of a [child key] for writing. ** ** ^Note that the database name is not the filename that contains ** the database but rather the symbolic name of the database that ** appears after the AS keyword when the database is connected using [ATTACH]. ** ^For the main database file, the database name is "main". ** ^For TEMP tables, the database name is "temp". ** ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set ** to be a null pointer.)^ ** ^This function sets the [database connection] error code and message ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related ** functions. ^Note that the *ppBlob variable is always initialized in a ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob ** regardless of the success or failure of this routine. ** ** ^(If the row that a BLOB handle points to is modified by an ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects ** then the BLOB handle is marked as "expired". ** This is true if any column of the row is changed, even a column ** other than the one the BLOB handle is open on.)^ ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for ** a expired BLOB handle fail with an return code of [SQLITE_ABORT]. ** ^(Changes written into a BLOB prior to the BLOB expiring are not ** rolled back by the expiration of the BLOB. Such changes will eventually ** commit if the transaction continues to completion.)^ ** ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of ** the opened blob. ^The size of a blob may not be changed by this ** interface. Use the [UPDATE] SQL command to change the size of a ** blob. ** ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces ** and the built-in [zeroblob] SQL function can be used, if desired, ** to create an empty, zero-filled blob in which to read or write using ** this interface. ** ** To avoid a resource leak, every open [BLOB handle] should eventually ** be released by a call to [sqlite3_blob_close()]. */ SQLITE_API int sqlite3_blob_open( sqlite3*, const char *zDb, const char *zTable, const char *zColumn, sqlite3_int64 iRow, int flags, sqlite3_blob **ppBlob ); /* ** CAPI3REF: Move a BLOB Handle to a New Row ** ** ^This function is used to move an existing blob handle so that it points ** to a different row of the same database table. ^The new row is identified ** by the rowid value passed as the second argument. Only the row can be ** changed. ^The database, table and column on which the blob handle is open ** remain the same. Moving an existing blob handle to a new row can be ** faster than closing the existing handle and opening a new one. ** ** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - ** it must exist and there must be either a blob or text value stored in ** the nominated column.)^ ^If the new row is not present in the table, or if ** it does not contain a blob or text value, or if another error occurs, an ** SQLite error code is returned and the blob handle is considered aborted. ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle ** always returns zero. ** ** ^This function sets the database handle error code and message. */ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); /* ** CAPI3REF: Close A BLOB Handle ** ** ^Closes an open [BLOB handle]. ** ** ^Closing a BLOB shall cause the current transaction to commit ** if there are no other BLOBs, no pending prepared statements, and the ** database connection is in [autocommit mode]. ** ^If any writes were made to the BLOB, they might be held in cache ** until the close operation if they will fit. ** ** ^(Closing the BLOB often forces the changes ** out to disk and so if any I/O errors occur, they will likely occur ** at the time when the BLOB is closed. Any errors that occur during ** closing are reported as a non-zero return value.)^ ** ** ^(The BLOB is closed unconditionally. Even if this routine returns ** an error code, the BLOB is still closed.)^ ** ** ^Calling this routine with a null pointer (such as would be returned ** by a failed call to [sqlite3_blob_open()]) is a harmless no-op. */ SQLITE_API int sqlite3_blob_close(sqlite3_blob *); /* ** CAPI3REF: Return The Size Of An Open BLOB ** ** ^Returns the size in bytes of the BLOB accessible via the ** successfully opened [BLOB handle] in its only argument. ^The ** incremental blob I/O routines can only read or overwriting existing ** blob content; they cannot change the size of a blob. ** ** This routine only works on a [BLOB handle] which has been created ** by a prior successful call to [sqlite3_blob_open()] and which has not ** been closed by [sqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. */ SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); /* ** CAPI3REF: Read Data From A BLOB Incrementally ** ** ^(This function is used to read data from an open [BLOB handle] into a ** caller-supplied buffer. N bytes of data are copied into buffer Z ** from the open BLOB, starting at offset iOffset.)^ ** ** ^If offset iOffset is less than N bytes from the end of the BLOB, ** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is ** less than zero, [SQLITE_ERROR] is returned and no data is read. ** ^The size of the blob (and hence the maximum value of N+iOffset) ** can be determined using the [sqlite3_blob_bytes()] interface. ** ** ^An attempt to read from an expired [BLOB handle] fails with an ** error code of [SQLITE_ABORT]. ** ** ^(On success, sqlite3_blob_read() returns SQLITE_OK. ** Otherwise, an [error code] or an [extended error code] is returned.)^ ** ** This routine only works on a [BLOB handle] which has been created ** by a prior successful call to [sqlite3_blob_open()] and which has not ** been closed by [sqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. ** ** See also: [sqlite3_blob_write()]. */ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); /* ** CAPI3REF: Write Data Into A BLOB Incrementally ** ** ^This function is used to write data into an open [BLOB handle] from a ** caller-supplied buffer. ^N bytes of data are copied from the buffer Z ** into the open BLOB, starting at offset iOffset. ** ** ^If the [BLOB handle] passed as the first argument was not opened for ** writing (the flags parameter to [sqlite3_blob_open()] was zero), ** this function returns [SQLITE_READONLY]. ** ** ^This function may only modify the contents of the BLOB; it is ** not possible to increase the size of a BLOB using this API. ** ^If offset iOffset is less than N bytes from the end of the BLOB, ** [SQLITE_ERROR] is returned and no data is written. ^If N is ** less than zero [SQLITE_ERROR] is returned and no data is written. ** The size of the BLOB (and hence the maximum value of N+iOffset) ** can be determined using the [sqlite3_blob_bytes()] interface. ** ** ^An attempt to write to an expired [BLOB handle] fails with an ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred ** before the [BLOB handle] expired are not rolled back by the ** expiration of the handle, though of course those changes might ** have been overwritten by the statement that expired the BLOB handle ** or by other independent statements. ** ** ^(On success, sqlite3_blob_write() returns SQLITE_OK. ** Otherwise, an [error code] or an [extended error code] is returned.)^ ** ** This routine only works on a [BLOB handle] which has been created ** by a prior successful call to [sqlite3_blob_open()] and which has not ** been closed by [sqlite3_blob_close()]. Passing any other pointer in ** to this routine results in undefined and probably undesirable behavior. ** ** See also: [sqlite3_blob_read()]. */ SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); /* ** CAPI3REF: Virtual File System Objects ** ** A virtual filesystem (VFS) is an [sqlite3_vfs] object ** that SQLite uses to interact ** with the underlying operating system. Most SQLite builds come with a ** single default VFS that is appropriate for the host computer. ** New VFSes can be registered and existing VFSes can be unregistered. ** The following interfaces are provided. ** ** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. ** ^Names are case sensitive. ** ^Names are zero-terminated UTF-8 strings. ** ^If there is no match, a NULL pointer is returned. ** ^If zVfsName is NULL then the default VFS is returned. ** ** ^New VFSes are registered with sqlite3_vfs_register(). ** ^Each new VFS becomes the default VFS if the makeDflt flag is set. ** ^The same VFS can be registered multiple times without injury. ** ^To make an existing VFS into the default VFS, register it again ** with the makeDflt flag set. If two different VFSes with the ** same name are registered, the behavior is undefined. If a ** VFS is registered with a name that is NULL or an empty string, ** then the behavior is undefined. ** ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. ** ^(If the default VFS is unregistered, another VFS is chosen as ** the default. The choice for the new VFS is arbitrary.)^ */ SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); /* ** CAPI3REF: Mutexes ** ** The SQLite core uses these routines for thread ** synchronization. Though they are intended for internal ** use by SQLite, code that links against SQLite is ** permitted to use any of these routines. ** ** The SQLite source code contains multiple implementations ** of these mutex routines. An appropriate implementation ** is selected automatically at compile-time. ^(The following ** implementations are available in the SQLite core: ** **
          **
        • SQLITE_MUTEX_OS2 **
        • SQLITE_MUTEX_PTHREAD **
        • SQLITE_MUTEX_W32 **
        • SQLITE_MUTEX_NOOP **
        )^ ** ** ^The SQLITE_MUTEX_NOOP implementation is a set of routines ** that does no real locking and is appropriate for use in ** a single-threaded application. ^The SQLITE_MUTEX_OS2, ** SQLITE_MUTEX_PTHREAD, and SQLITE_MUTEX_W32 implementations ** are appropriate for use on OS/2, Unix, and Windows. ** ** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex ** implementation is included with the library. In this case the ** application must supply a custom mutex implementation using the ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function ** before calling sqlite3_initialize() or any other public sqlite3_ ** function that calls sqlite3_initialize().)^ ** ** ^The sqlite3_mutex_alloc() routine allocates a new ** mutex and returns a pointer to it. ^If it returns NULL ** that means that a mutex could not be allocated. ^SQLite ** will unwind its stack and return an error. ^(The argument ** to sqlite3_mutex_alloc() is one of these integer constants: ** **
          **
        • SQLITE_MUTEX_FAST **
        • SQLITE_MUTEX_RECURSIVE **
        • SQLITE_MUTEX_STATIC_MASTER **
        • SQLITE_MUTEX_STATIC_MEM **
        • SQLITE_MUTEX_STATIC_MEM2 **
        • SQLITE_MUTEX_STATIC_PRNG **
        • SQLITE_MUTEX_STATIC_LRU **
        • SQLITE_MUTEX_STATIC_LRU2 **
        )^ ** ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) ** cause sqlite3_mutex_alloc() to create ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. ** The mutex implementation does not need to make a distinction ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does ** not want to. ^SQLite will only request a recursive mutex in ** cases where it really needs one. ^If a faster non-recursive mutex ** implementation is available on the host platform, the mutex subsystem ** might return such a mutex in response to SQLITE_MUTEX_FAST. ** ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return ** a pointer to a static preexisting mutex. ^Six static mutexes are ** used by the current version of SQLite. Future versions of SQLite ** may add additional static mutexes. Static mutexes are for internal ** use by SQLite only. Applications that use SQLite mutexes should ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or ** SQLITE_MUTEX_RECURSIVE. ** ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() ** returns a different mutex on every call. ^But for the static ** mutex types, the same mutex is returned on every call that has ** the same type number. ** ** ^The sqlite3_mutex_free() routine deallocates a previously ** allocated dynamic mutex. ^SQLite is careful to deallocate every ** dynamic mutex that it allocates. The dynamic mutexes must not be in ** use when they are deallocated. Attempting to deallocate a static ** mutex results in undefined behavior. ^SQLite never deallocates ** a static mutex. ** ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt ** to enter a mutex. ^If another thread is already within the mutex, ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] ** upon successful entry. ^(Mutexes created using ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. ** In such cases the, ** mutex must be exited an equal number of times before another thread ** can enter.)^ ^(If the same thread tries to enter any other ** kind of mutex more than once, the behavior is undefined. ** SQLite will never exhibit ** such behavior in its own use of mutexes.)^ ** ** ^(Some systems (for example, Windows 95) do not support the operation ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() ** will always return SQLITE_BUSY. The SQLite core only ever uses ** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^ ** ** ^The sqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. ^(The behavior ** is undefined if the mutex is not currently entered by the ** calling thread or is not currently allocated. SQLite will ** never do either.)^ ** ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or ** sqlite3_mutex_leave() is a NULL pointer, then all three routines ** behave as no-ops. ** ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. */ SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); /* ** CAPI3REF: Mutex Methods Object ** ** An instance of this structure defines the low-level routines ** used to allocate and use mutexes. ** ** Usually, the default mutex implementations provided by SQLite are ** sufficient, however the user has the option of substituting a custom ** implementation for specialized deployments or systems for which SQLite ** does not provide a suitable implementation. In this case, the user ** creates and populates an instance of this structure to pass ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. ** Additionally, an instance of this structure can be used as an ** output variable when querying the system for the current mutex ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. ** ** ^The xMutexInit method defined by this structure is invoked as ** part of system initialization by the sqlite3_initialize() function. ** ^The xMutexInit routine is called by SQLite exactly once for each ** effective call to [sqlite3_initialize()]. ** ** ^The xMutexEnd method defined by this structure is invoked as ** part of system shutdown by the sqlite3_shutdown() function. The ** implementation of this method is expected to release all outstanding ** resources obtained by the mutex methods implementation, especially ** those obtained by the xMutexInit method. ^The xMutexEnd() ** interface is invoked exactly once for each call to [sqlite3_shutdown()]. ** ** ^(The remaining seven methods defined by this structure (xMutexAlloc, ** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and ** xMutexNotheld) implement the following interfaces (respectively): ** **
          **
        • [sqlite3_mutex_alloc()]
        • **
        • [sqlite3_mutex_free()]
        • **
        • [sqlite3_mutex_enter()]
        • **
        • [sqlite3_mutex_try()]
        • **
        • [sqlite3_mutex_leave()]
        • **
        • [sqlite3_mutex_held()]
        • **
        • [sqlite3_mutex_notheld()]
        • **
        )^ ** ** The only difference is that the public sqlite3_XXX functions enumerated ** above silently ignore any invocations that pass a NULL pointer instead ** of a valid mutex handle. The implementations of the methods defined ** by this structure are not required to handle this case, the results ** of passing a NULL pointer instead of a valid mutex handle are undefined ** (i.e. it is acceptable to provide an implementation that segfaults if ** it is passed a NULL pointer). ** ** The xMutexInit() method must be threadsafe. ^It must be harmless to ** invoke xMutexInit() multiple times within the same process and without ** intervening calls to xMutexEnd(). Second and subsequent calls to ** xMutexInit() must be no-ops. ** ** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] ** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite ** memory allocation for a fast or recursive mutex. ** ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is ** called, but only if the prior call to xMutexInit returned SQLITE_OK. ** If xMutexInit fails in any way, it is expected to clean up after itself ** prior to returning. */ typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; struct sqlite3_mutex_methods { int (*xMutexInit)(void); int (*xMutexEnd)(void); sqlite3_mutex *(*xMutexAlloc)(int); void (*xMutexFree)(sqlite3_mutex *); void (*xMutexEnter)(sqlite3_mutex *); int (*xMutexTry)(sqlite3_mutex *); void (*xMutexLeave)(sqlite3_mutex *); int (*xMutexHeld)(sqlite3_mutex *); int (*xMutexNotheld)(sqlite3_mutex *); }; /* ** CAPI3REF: Mutex Verification Routines ** ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines ** are intended for use inside assert() statements. ^The SQLite core ** never uses these routines except inside an assert() and applications ** are advised to follow the lead of the core. ^The SQLite core only ** provides implementations for these routines when it is compiled ** with the SQLITE_DEBUG flag. ^External mutex implementations ** are only required to provide these routines if SQLITE_DEBUG is ** defined and if NDEBUG is not defined. ** ** ^These routines should return true if the mutex in their argument ** is held or not held, respectively, by the calling thread. ** ** ^The implementation is not required to provided versions of these ** routines that actually work. If the implementation does not provide working ** versions of these routines, it should at least provide stubs that always ** return true so that one does not get spurious assertion failures. ** ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then ** the routine should return 1. This seems counter-intuitive since ** clearly the mutex cannot be held if it does not exist. But the ** the reason the mutex does not exist is because the build is not ** using mutexes. And we do not want the assert() containing the ** call to sqlite3_mutex_held() to fail, so a non-zero return is ** the appropriate thing to do. ^The sqlite3_mutex_notheld() ** interface should also return 1 when given a NULL pointer. */ #ifndef NDEBUG SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); #endif /* ** CAPI3REF: Mutex Types ** ** The [sqlite3_mutex_alloc()] interface takes a single argument ** which is one of these integer constants. ** ** The set of static mutexes may change from one SQLite release to the ** next. Applications that override the built-in mutex logic must be ** prepared to accommodate additional static mutexes. */ #define SQLITE_MUTEX_FAST 0 #define SQLITE_MUTEX_RECURSIVE 1 #define SQLITE_MUTEX_STATIC_MASTER 2 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ #define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */ /* ** CAPI3REF: Retrieve the mutex for a database connection ** ** ^This interface returns a pointer the [sqlite3_mutex] object that ** serializes access to the [database connection] given in the argument ** when the [threading mode] is Serialized. ** ^If the [threading mode] is Single-thread or Multi-thread then this ** routine returns a NULL pointer. */ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); /* ** CAPI3REF: Low-Level Control Of Database Files ** ** ^The [sqlite3_file_control()] interface makes a direct call to the ** xFileControl method for the [sqlite3_io_methods] object associated ** with a particular database identified by the second argument. ^The ** name of the database is "main" for the main database or "temp" for the ** TEMP database, or the name that appears after the AS keyword for ** databases that are added using the [ATTACH] SQL command. ** ^A NULL pointer can be used in place of "main" to refer to the ** main database file. ** ^The third and fourth parameters to this routine ** are passed directly through to the second and third parameters of ** the xFileControl method. ^The return value of the xFileControl ** method becomes the return value of this routine. ** ** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes ** a pointer to the underlying [sqlite3_file] object to be written into ** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER ** case is a short-circuit path which does not actually invoke the ** underlying sqlite3_io_methods.xFileControl method. ** ** ^If the second parameter (zDbName) does not match the name of any ** open database file, then SQLITE_ERROR is returned. ^This error ** code is not remembered and will not be recalled by [sqlite3_errcode()] ** or [sqlite3_errmsg()]. The underlying xFileControl method might ** also return SQLITE_ERROR. There is no way to distinguish between ** an incorrect zDbName and an SQLITE_ERROR return from the underlying ** xFileControl method. ** ** See also: [SQLITE_FCNTL_LOCKSTATE] */ SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); /* ** CAPI3REF: Testing Interface ** ** ^The sqlite3_test_control() interface is used to read out internal ** state of SQLite and to inject faults into SQLite for testing ** purposes. ^The first parameter is an operation code that determines ** the number, meaning, and operation of all subsequent parameters. ** ** This interface is not for use by applications. It exists solely ** for verifying the correct operation of the SQLite library. Depending ** on how the SQLite library is compiled, this interface might not exist. ** ** The details of the operation codes, their meanings, the parameters ** they take, and what they do are all subject to change without notice. ** Unlike most of the SQLite API, this function is not guaranteed to ** operate consistently from one release to the next. */ SQLITE_API int sqlite3_test_control(int op, ...); /* ** CAPI3REF: Testing Interface Operation Codes ** ** These constants are the valid operation code parameters used ** as the first argument to [sqlite3_test_control()]. ** ** These parameters and their meanings are subject to change ** without notice. These values are for testing purposes only. ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 #define SQLITE_TESTCTRL_PENDING_BYTE 11 #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 #define SQLITE_TESTCTRL_ISKEYWORD 16 #define SQLITE_TESTCTRL_PGHDRSZ 17 #define SQLITE_TESTCTRL_SCRATCHMALLOC 18 #define SQLITE_TESTCTRL_LAST 18 /* ** CAPI3REF: SQLite Runtime Status ** ** ^This interface is used to retrieve runtime status information ** about the performance of SQLite, and optionally to reset various ** highwater marks. ^The first argument is an integer code for ** the specific parameter to measure. ^(Recognized integer codes ** are of the form [SQLITE_STATUS_MEMORY_USED | SQLITE_STATUS_...].)^ ** ^The current value of the parameter is returned into *pCurrent. ** ^The highest recorded value is returned in *pHighwater. ^If the ** resetFlag is true, then the highest record value is reset after ** *pHighwater is written. ^(Some parameters do not record the highest ** value. For those parameters ** nothing is written into *pHighwater and the resetFlag is ignored.)^ ** ^(Other parameters record only the highwater mark and not the current ** value. For these latter parameters nothing is written into *pCurrent.)^ ** ** ^The sqlite3_status() routine returns SQLITE_OK on success and a ** non-zero [error code] on failure. ** ** This routine is threadsafe but is not atomic. This routine can be ** called while other threads are running the same or different SQLite ** interfaces. However the values returned in *pCurrent and ** *pHighwater reflect the status of SQLite at different points in time ** and it is possible that another thread might change the parameter ** in between the times when *pCurrent and *pHighwater are written. ** ** See also: [sqlite3_db_status()] */ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); /* ** CAPI3REF: Status Parameters ** ** These integer constants designate various run-time status parameters ** that can be returned by [sqlite3_status()]. ** **
        ** ^(
        SQLITE_STATUS_MEMORY_USED
        **
        This parameter is the current amount of memory checked out ** using [sqlite3_malloc()], either directly or indirectly. The ** figure includes calls made to [sqlite3_malloc()] by the application ** and internal memory usage by the SQLite library. Scratch memory ** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in ** this parameter. The amount returned is the sum of the allocation ** sizes as reported by the xSize method in [sqlite3_mem_methods].
        )^ ** ** ^(
        SQLITE_STATUS_MALLOC_SIZE
        **
        This parameter records the largest memory allocation request ** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their ** internal equivalents). Only the value returned in the ** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
        )^ ** ** ^(
        SQLITE_STATUS_MALLOC_COUNT
        **
        This parameter records the number of separate memory allocations.
        )^ ** ** ^(
        SQLITE_STATUS_PAGECACHE_USED
        **
        This parameter returns the number of pages used out of the ** [pagecache memory allocator] that was configured using ** [SQLITE_CONFIG_PAGECACHE]. The ** value returned is in pages, not in bytes.
        )^ ** ** ^(
        SQLITE_STATUS_PAGECACHE_OVERFLOW
        **
        This parameter returns the number of bytes of page cache ** allocation which could not be satisfied 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.
        )^ ** ** ^(
        SQLITE_STATUS_PAGECACHE_SIZE
        **
        This parameter records the largest memory allocation request ** handed to [pagecache memory allocator]. Only the value returned in the ** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
        )^ ** ** ^(
        SQLITE_STATUS_SCRATCH_USED
        **
        This parameter returns the number of allocations used out of the ** [scratch memory allocator] configured using ** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not ** in bytes. Since a single thread may only have one scratch allocation ** outstanding at time, this parameter also reports the number of threads ** using scratch memory at the same time.
        )^ ** ** ^(
        SQLITE_STATUS_SCRATCH_OVERFLOW
        **
        This parameter returns the number of bytes of scratch memory ** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH] ** buffer and where forced to overflow to [sqlite3_malloc()]. The values ** returned include overflows because the requested allocation was too ** larger (that is, because the requested allocation was larger than the ** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer ** slots were available. **
        )^ ** ** ^(
        SQLITE_STATUS_SCRATCH_SIZE
        **
        This parameter records the largest memory allocation request ** handed to [scratch memory allocator]. Only the value returned in the ** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.
        )^ ** ** ^(
        SQLITE_STATUS_PARSER_STACK
        **
        This parameter records the deepest parser stack. It is only ** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].
        )^ **
        ** ** New status parameters may be added from time to time. */ #define SQLITE_STATUS_MEMORY_USED 0 #define SQLITE_STATUS_PAGECACHE_USED 1 #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 #define SQLITE_STATUS_SCRATCH_USED 3 #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 #define SQLITE_STATUS_MALLOC_SIZE 5 #define SQLITE_STATUS_PARSER_STACK 6 #define SQLITE_STATUS_PAGECACHE_SIZE 7 #define SQLITE_STATUS_SCRATCH_SIZE 8 #define SQLITE_STATUS_MALLOC_COUNT 9 /* ** CAPI3REF: Database Connection Status ** ** ^This interface is used to retrieve runtime status information ** about a single [database connection]. ^The first argument is the ** database connection object to be interrogated. ^The second argument ** is an integer constant, taken from the set of ** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros, that ** determines the parameter to interrogate. The set of ** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros is likely ** to grow in future releases of SQLite. ** ** ^The current value of the requested parameter is written into *pCur ** and the highest instantaneous value is written into *pHiwtr. ^If ** the resetFlg is true, then the highest instantaneous value is ** reset back down to the current value. ** ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a ** non-zero [error code] on failure. ** ** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. */ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); /* ** CAPI3REF: Status Parameters for database connections ** ** These constants are the available integer "verbs" that can be passed as ** the second argument to the [sqlite3_db_status()] interface. ** ** New verbs may be added in future releases of SQLite. Existing verbs ** might be discontinued. Applications should check the return code from ** [sqlite3_db_status()] to make sure that the call worked. ** The [sqlite3_db_status()] interface will return a non-zero error code ** if a discontinued or unsupported verb is invoked. ** **
        ** ^(
        SQLITE_DBSTATUS_LOOKASIDE_USED
        **
        This parameter returns the number of lookaside memory slots currently ** checked out.
        )^ ** ** ^(
        SQLITE_DBSTATUS_CACHE_USED
        **
        This parameter returns the approximate number of of bytes of heap ** memory used by all pager caches associated with the database connection.)^ ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. ** ** ^(
        SQLITE_DBSTATUS_SCHEMA_USED
        **
        This parameter returns the approximate number of of bytes of heap ** memory used to store the schema for all databases associated ** with the connection - main, temp, and any [ATTACH]-ed databases.)^ ** ^The full amount of memory used by the schemas is reported, even if the ** schema memory is shared with other database connections due to ** [shared cache mode] being enabled. ** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0. ** ** ^(
        SQLITE_DBSTATUS_STMT_USED
        **
        This parameter returns the approximate number of of bytes of heap ** and lookaside memory used by all prepared statements associated with ** the database connection.)^ ** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0. **
        **
        */ #define SQLITE_DBSTATUS_LOOKASIDE_USED 0 #define SQLITE_DBSTATUS_CACHE_USED 1 #define SQLITE_DBSTATUS_SCHEMA_USED 2 #define SQLITE_DBSTATUS_STMT_USED 3 #define SQLITE_DBSTATUS_MAX 3 /* Largest defined DBSTATUS */ /* ** CAPI3REF: Prepared Statement Status ** ** ^(Each prepared statement maintains various ** [SQLITE_STMTSTATUS_SORT | counters] that measure the number ** of times it has performed specific operations.)^ These counters can ** be used to monitor the performance characteristics of the prepared ** statements. For example, if the number of table steps greatly exceeds ** the number of table searches or result rows, that would tend to indicate ** that the prepared statement is using a full table scan rather than ** an index. ** ** ^(This interface is used to retrieve and reset counter values from ** a [prepared statement]. The first argument is the prepared statement ** object to be interrogated. The second argument ** is an integer code for a specific [SQLITE_STMTSTATUS_SORT | counter] ** to be interrogated.)^ ** ^The current value of the requested counter is returned. ** ^If the resetFlg is true, then the counter is reset to zero after this ** interface call returns. ** ** See also: [sqlite3_status()] and [sqlite3_db_status()]. */ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); /* ** CAPI3REF: Status Parameters for prepared statements ** ** These preprocessor macros define integer codes that name counter ** values associated with the [sqlite3_stmt_status()] interface. ** The meanings of the various counters are as follows: ** **
        **
        SQLITE_STMTSTATUS_FULLSCAN_STEP
        **
        ^This is the number of times that SQLite has stepped forward in ** a table as part of a full table scan. Large numbers for this counter ** may indicate opportunities for performance improvement through ** careful use of indices.
        ** **
        SQLITE_STMTSTATUS_SORT
        **
        ^This is the number of sort operations that have occurred. ** A non-zero value in this counter may indicate an opportunity to ** improvement performance through careful use of indices.
        ** **
        SQLITE_STMTSTATUS_AUTOINDEX
        **
        ^This is the number of rows inserted into transient indices that ** were created automatically in order to help joins run faster. ** A non-zero value in this counter may indicate an opportunity to ** improvement performance by adding permanent indices that do not ** need to be reinitialized each time the statement is run.
        ** **
        */ #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 #define SQLITE_STMTSTATUS_SORT 2 #define SQLITE_STMTSTATUS_AUTOINDEX 3 /* ** CAPI3REF: Custom Page Cache Object ** ** The sqlite3_pcache type is opaque. It is implemented by ** the pluggable module. The SQLite core has no knowledge of ** its size or internal structure and never deals with the ** sqlite3_pcache object except by holding and passing pointers ** to the object. ** ** See [sqlite3_pcache_methods] for additional information. */ typedef struct sqlite3_pcache sqlite3_pcache; /* ** CAPI3REF: Application Defined Page Cache. ** KEYWORDS: {page cache} ** ** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can ** register an alternative page cache implementation by passing in an ** instance of the sqlite3_pcache_methods structure.)^ ** In many applications, most of the heap memory allocated by ** SQLite is used for the page cache. ** By implementing a ** custom page cache using this API, an application can better control ** the amount of memory consumed by SQLite, the way in which ** that memory is allocated and released, and the policies used to ** determine exactly which parts of a database file are cached and for ** how long. ** ** The alternative page cache mechanism is an ** extreme measure that is only needed by the most demanding applications. ** The built-in page cache is recommended for most uses. ** ** ^(The contents of the sqlite3_pcache_methods structure are copied to an ** internal buffer by SQLite within the call to [sqlite3_config]. Hence ** the application may discard the parameter after the call to ** [sqlite3_config()] returns.)^ ** ** ^(The xInit() method is called once for each effective ** call to [sqlite3_initialize()])^ ** (usually only once during the lifetime of the process). ^(The xInit() ** method is passed a copy of the sqlite3_pcache_methods.pArg value.)^ ** The intent of the xInit() method is to set up global data structures ** required by the custom page cache implementation. ** ^(If the xInit() method is NULL, then the ** built-in default page cache is used instead of the application defined ** page cache.)^ ** ** ^The xShutdown() method is called by [sqlite3_shutdown()]. ** It can be used to clean up ** any outstanding resources before process shutdown, if required. ** ^The xShutdown() method may be NULL. ** ** ^SQLite automatically serializes calls to the xInit method, ** so the xInit method need not be threadsafe. ^The ** xShutdown method is only called from [sqlite3_shutdown()] so it does ** not need to be threadsafe either. All other methods must be threadsafe ** in multithreaded applications. ** ** ^SQLite will never invoke xInit() more than once without an intervening ** call to xShutdown(). ** ** ^SQLite invokes the xCreate() method to construct a new cache instance. ** SQLite will typically create one cache instance for each open database file, ** though this is not guaranteed. ^The ** first parameter, szPage, is the size in bytes of the pages that must ** be allocated by the cache. ^szPage will not be a power of two. ^szPage ** will the page size of the database file that is to be cached plus an ** increment (here called "R") of about 100 or 200. SQLite will use the ** extra R bytes on each page to store metadata about the underlying ** database page on disk. The value of R depends ** on the SQLite version, the target platform, and how SQLite was compiled. ** ^R is constant for a particular build of SQLite. ^The second argument to ** xCreate(), bPurgeable, is true if the cache being created will ** be used to cache database pages of a file stored on disk, or ** false if it is used for an in-memory database. The cache implementation ** does not have to do anything special based with the value of bPurgeable; ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will ** never invoke xUnpin() except to deliberately delete a page. ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to ** false will always have the "discard" flag set to true. ** ^Hence, a cache created with bPurgeable false will ** never contain any unpinned pages. ** ** ^(The xCachesize() method may be called at any time by SQLite to set the ** suggested maximum cache-size (number of pages stored by) the cache ** instance passed as the first argument. This is the value configured using ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable ** parameter, the implementation is not required to do anything with this ** value; it is advisory only. ** ** The xPagecount() method must return the number of pages currently ** stored in the cache, both pinned and unpinned. ** ** The xFetch() method locates a page in the cache and returns a pointer to ** the page, or a NULL pointer. ** A "page", in this context, means a buffer of szPage bytes aligned at an ** 8-byte boundary. The page to be fetched is determined by the key. ^The ** mimimum key value is 1. After it has been retrieved using xFetch, the page ** is considered to be "pinned". ** ** If the requested page is already in the page cache, then the page cache ** implementation must return a pointer to the page buffer with its content ** intact. If the requested page is not already in the cache, then the ** behavior of the cache implementation should use the value of the createFlag ** parameter to help it determined what action to take: ** ** **
        createFlag Behaviour when page is not already in cache **
        0 Do not allocate a new page. Return NULL. **
        1 Allocate a new page if it easy and convenient to do so. ** Otherwise return NULL. **
        2 Make every effort to allocate a new page. Only return ** NULL if allocating a new page is effectively impossible. **
        ** ** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite ** will only use a createFlag of 2 after a prior call with a createFlag of 1 ** failed.)^ In between the to xFetch() calls, SQLite may ** attempt to unpin one or more cache pages by spilling the content of ** pinned pages to disk and synching the operating system disk cache. ** ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page ** as its second argument. If the third parameter, discard, is non-zero, ** then the page must be evicted from the cache. ** ^If the discard parameter is ** zero, then the page may be discarded or retained at the discretion of ** page cache implementation. ^The page cache implementation ** may choose to evict unpinned pages at any time. ** ** The cache must not perform any reference counting. A single ** call to xUnpin() unpins the page regardless of the number of prior calls ** to xFetch(). ** ** The xRekey() method is used to change the key value associated with the ** page passed as the second argument. If the cache ** previously contains an entry associated with newKey, it must be ** discarded. ^Any prior cache entry associated with newKey is guaranteed not ** to be pinned. ** ** When SQLite calls the xTruncate() method, the cache must discard all ** existing cache entries with page numbers (keys) greater than or equal ** to the value of the iLimit parameter passed to xTruncate(). If any ** of these pages are pinned, they are implicitly unpinned, meaning that ** they can be safely discarded. ** ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). ** All resources associated with the specified cache should be freed. ^After ** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] ** handle invalid, and will not use it with any other sqlite3_pcache_methods ** functions. */ typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; struct sqlite3_pcache_methods { void *pArg; int (*xInit)(void*); void (*xShutdown)(void*); sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); void (*xCachesize)(sqlite3_pcache*, int nCachesize); int (*xPagecount)(sqlite3_pcache*); void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); void (*xUnpin)(sqlite3_pcache*, void*, int discard); void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); void (*xDestroy)(sqlite3_pcache*); }; /* ** CAPI3REF: Online Backup Object ** ** The sqlite3_backup object records state information about an ongoing ** online backup operation. ^The sqlite3_backup object is created by ** a call to [sqlite3_backup_init()] and is destroyed by a call to ** [sqlite3_backup_finish()]. ** ** See Also: [Using the SQLite Online Backup API] */ typedef struct sqlite3_backup sqlite3_backup; /* ** CAPI3REF: Online Backup API. ** ** The backup API copies the content of one database into another. ** It is useful either for creating backups of databases or ** for copying in-memory databases to or from persistent files. ** ** See Also: [Using the SQLite Online Backup API] ** ** ^Exclusive access is required to the destination database for the ** duration of the operation. ^However the source database is only ** read-locked while it is actually being read; it is not locked ** continuously for the entire backup operation. ^Thus, the backup may be ** performed on a live source database without preventing other users from ** reading or writing to the source database while the backup is underway. ** ** ^(To perform a backup operation: **
          **
        1. sqlite3_backup_init() is called once to initialize the ** backup, **
        2. sqlite3_backup_step() is called one or more times to transfer ** the data between the two databases, and finally **
        3. sqlite3_backup_finish() is called to release all resources ** associated with the backup operation. **
        )^ ** There should be exactly one call to sqlite3_backup_finish() for each ** successful call to sqlite3_backup_init(). ** ** sqlite3_backup_init() ** ** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the ** [database connection] associated with the destination database ** and the database name, respectively. ** ^The database name is "main" for the main database, "temp" for the ** temporary database, or the name specified after the AS keyword in ** an [ATTACH] statement for an attached database. ** ^The S and M arguments passed to ** sqlite3_backup_init(D,N,S,M) identify the [database connection] ** and database name of the source database, respectively. ** ^The source and destination [database connections] (parameters S and D) ** must be different or else sqlite3_backup_init(D,N,S,M) will file with ** an error. ** ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is ** returned and an error code and error message are store3d in the ** destination [database connection] D. ** ^The error code and message for the failed call to sqlite3_backup_init() ** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or ** [sqlite3_errmsg16()] functions. ** ^A successful call to sqlite3_backup_init() returns a pointer to an ** [sqlite3_backup] object. ** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and ** sqlite3_backup_finish() functions to perform the specified backup ** operation. ** ** sqlite3_backup_step() ** ** ^Function sqlite3_backup_step(B,N) will copy up to N pages between ** the source and destination databases specified by [sqlite3_backup] object B. ** ^If N is negative, all remaining source pages are copied. ** ^If sqlite3_backup_step(B,N) successfully copies N pages and there ** are still more pages to be copied, then the function resturns [SQLITE_OK]. ** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages ** from source to destination, then it returns [SQLITE_DONE]. ** ^If an error occurs while running sqlite3_backup_step(B,N), ** then an [error code] is returned. ^As well as [SQLITE_OK] and ** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], ** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. ** ** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if **
          **
        1. the destination database was opened read-only, or **
        2. the destination database is using write-ahead-log journaling ** and the destination and source page sizes differ, or **
        3. The destination database is an in-memory database and the ** destination and source page sizes differ. **
        )^ ** ** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then ** the [sqlite3_busy_handler | busy-handler function] ** is invoked (if one is specified). ^If the ** busy-handler returns non-zero before the lock is available, then ** [SQLITE_BUSY] is returned to the caller. ^In this case the call to ** sqlite3_backup_step() can be retried later. ^If the source ** [database connection] ** is being used to write to the source database when sqlite3_backup_step() ** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this ** case the call to sqlite3_backup_step() can be retried later on. ^(If ** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or ** [SQLITE_READONLY] is returned, then ** there is no point in retrying the call to sqlite3_backup_step(). These ** errors are considered fatal.)^ The application must accept ** that the backup operation has failed and pass the backup operation handle ** to the sqlite3_backup_finish() to release associated resources. ** ** ^The first call to sqlite3_backup_step() obtains an exclusive lock ** on the destination file. ^The exclusive lock is not released until either ** sqlite3_backup_finish() is called or the backup operation is complete ** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to ** sqlite3_backup_step() obtains a [shared lock] on the source database that ** lasts for the duration of the sqlite3_backup_step() call. ** ^Because the source database is not locked between calls to ** sqlite3_backup_step(), the source database may be modified mid-way ** through the backup process. ^If the source database is modified by an ** external process or via a database connection other than the one being ** used by the backup operation, then the backup will be automatically ** restarted by the next call to sqlite3_backup_step(). ^If the source ** database is modified by the using the same database connection as is used ** by the backup operation, then the backup database is automatically ** updated at the same time. ** ** sqlite3_backup_finish() ** ** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the ** application wishes to abandon the backup operation, the application ** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). ** ^The sqlite3_backup_finish() interfaces releases all ** resources associated with the [sqlite3_backup] object. ** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any ** active write-transaction on the destination database is rolled back. ** The [sqlite3_backup] object is invalid ** and may not be used following a call to sqlite3_backup_finish(). ** ** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no ** sqlite3_backup_step() errors occurred, regardless or whether or not ** sqlite3_backup_step() completed. ** ^If an out-of-memory condition or IO error occurred during any prior ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then ** sqlite3_backup_finish() returns the corresponding [error code]. ** ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() ** is not a permanent error and does not affect the return value of ** sqlite3_backup_finish(). ** ** sqlite3_backup_remaining(), sqlite3_backup_pagecount() ** ** ^Each call to sqlite3_backup_step() sets two values inside ** the [sqlite3_backup] object: the number of pages still to be backed ** up and the total number of pages in the source database file. ** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces ** retrieve these two values, respectively. ** ** ^The values returned by these functions are only updated by ** sqlite3_backup_step(). ^If the source database is modified during a backup ** operation, then the values are not updated to account for any extra ** pages that need to be updated or the size of the source database file ** changing. ** ** Concurrent Usage of Database Handles ** ** ^The source [database connection] may be used by the application for other ** purposes while a backup operation is underway or being initialized. ** ^If SQLite is compiled and configured to support threadsafe database ** connections, then the source database connection may be used concurrently ** from within other threads. ** ** However, the application must guarantee that the destination ** [database connection] is not passed to any other API (by any thread) after ** sqlite3_backup_init() is called and before the corresponding call to ** sqlite3_backup_finish(). SQLite does not currently check to see ** if the application incorrectly accesses the destination [database connection] ** and so no error code is reported, but the operations may malfunction ** nevertheless. Use of the destination database connection while a ** backup is in progress might also also cause a mutex deadlock. ** ** If running in [shared cache mode], the application must ** guarantee that the shared cache used by the destination database ** is not accessed while the backup is running. In practice this means ** that the application must guarantee that the disk file being ** backed up to is not accessed by any connection within the process, ** not just the specific connection that was passed to sqlite3_backup_init(). ** ** The [sqlite3_backup] object itself is partially threadsafe. Multiple ** threads may safely make multiple concurrent calls to sqlite3_backup_step(). ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() ** APIs are not strictly speaking threadsafe. If they are invoked at the ** same time as another thread is invoking sqlite3_backup_step() it is ** possible that they return invalid values. */ SQLITE_API sqlite3_backup *sqlite3_backup_init( sqlite3 *pDest, /* Destination database handle */ const char *zDestName, /* Destination database name */ sqlite3 *pSource, /* Source database handle */ const char *zSourceName /* Source database name */ ); SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); /* ** CAPI3REF: Unlock Notification ** ** ^When running in shared-cache mode, a database operation may fail with ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or ** individual tables within the shared-cache cannot be obtained. See ** [SQLite Shared-Cache Mode] for a description of shared-cache locking. ** ^This API may be used to register a callback that SQLite will invoke ** when the connection currently holding the required lock relinquishes it. ** ^This API is only available if the library was compiled with the ** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. ** ** See Also: [Using the SQLite Unlock Notification Feature]. ** ** ^Shared-cache locks are released when a database connection concludes ** its current transaction, either by committing it or rolling it back. ** ** ^When a connection (known as the blocked connection) fails to obtain a ** shared-cache lock and SQLITE_LOCKED is returned to the caller, the ** identity of the database connection (the blocking connection) that ** has locked the required resource is stored internally. ^After an ** application receives an SQLITE_LOCKED error, it may call the ** sqlite3_unlock_notify() method with the blocked connection handle as ** the first argument to register for a callback that will be invoked ** when the blocking connections current transaction is concluded. ^The ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] ** call that concludes the blocking connections transaction. ** ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, ** there is a chance that the blocking connection will have already ** concluded its transaction by the time sqlite3_unlock_notify() is invoked. ** If this happens, then the specified callback is invoked immediately, ** from within the call to sqlite3_unlock_notify().)^ ** ** ^If the blocked connection is attempting to obtain a write-lock on a ** shared-cache table, and more than one other connection currently holds ** a read-lock on the same table, then SQLite arbitrarily selects one of ** the other connections to use as the blocking connection. ** ** ^(There may be at most one unlock-notify callback registered by a ** blocked connection. If sqlite3_unlock_notify() is called when the ** blocked connection already has a registered unlock-notify callback, ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is ** called with a NULL pointer as its second argument, then any existing ** unlock-notify callback is canceled. ^The blocked connections ** unlock-notify callback may also be canceled by closing the blocked ** connection using [sqlite3_close()]. ** ** The unlock-notify callback is not reentrant. If an application invokes ** any sqlite3_xxx API functions from within an unlock-notify callback, a ** crash or deadlock may be the result. ** ** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always ** returns SQLITE_OK. ** ** Callback Invocation Details ** ** When an unlock-notify callback is registered, the application provides a ** single void* pointer that is passed to the callback when it is invoked. ** However, the signature of the callback function allows SQLite to pass ** it an array of void* context pointers. The first argument passed to ** an unlock-notify callback is a pointer to an array of void* pointers, ** and the second is the number of entries in the array. ** ** When a blocking connections transaction is concluded, there may be ** more than one blocked connection that has registered for an unlock-notify ** callback. ^If two or more such blocked connections have specified the ** same callback function, then instead of invoking the callback function ** multiple times, it is invoked once with the set of void* context pointers ** specified by the blocked connections bundled together into an array. ** This gives the application an opportunity to prioritize any actions ** related to the set of unblocked database connections. ** ** Deadlock Detection ** ** Assuming that after registering for an unlock-notify callback a ** database waits for the callback to be issued before taking any further ** action (a reasonable assumption), then using this API may cause the ** application to deadlock. For example, if connection X is waiting for ** connection Y's transaction to be concluded, and similarly connection ** Y is waiting on connection X's transaction, then neither connection ** will proceed and the system may remain deadlocked indefinitely. ** ** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock ** detection. ^If a given call to sqlite3_unlock_notify() would put the ** system in a deadlocked state, then SQLITE_LOCKED is returned and no ** unlock-notify callback is registered. The system is said to be in ** a deadlocked state if connection A has registered for an unlock-notify ** callback on the conclusion of connection B's transaction, and connection ** B has itself registered for an unlock-notify callback when connection ** A's transaction is concluded. ^Indirect deadlock is also detected, so ** the system is also considered to be deadlocked if connection B has ** registered for an unlock-notify callback on the conclusion of connection ** C's transaction, where connection C is waiting on connection A. ^Any ** number of levels of indirection are allowed. ** ** The "DROP TABLE" Exception ** ** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost ** always appropriate to call sqlite3_unlock_notify(). There is however, ** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, ** SQLite checks if there are any currently executing SELECT statements ** that belong to the same connection. If there are, SQLITE_LOCKED is ** returned. In this case there is no "blocking connection", so invoking ** sqlite3_unlock_notify() results in the unlock-notify callback being ** invoked immediately. If the application then re-attempts the "DROP TABLE" ** or "DROP INDEX" query, an infinite loop might be the result. ** ** One way around this problem is to check the extended error code returned ** by an sqlite3_step() call. ^(If there is a blocking connection, then the ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in ** the special "DROP TABLE/INDEX" case, the extended error code is just ** SQLITE_LOCKED.)^ */ SQLITE_API int sqlite3_unlock_notify( sqlite3 *pBlocked, /* Waiting connection */ void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ void *pNotifyArg /* Argument to pass to xNotify */ ); /* ** CAPI3REF: String Comparison ** ** ^The [sqlite3_strnicmp()] API allows applications and extensions to ** compare the contents of two buffers containing UTF-8 strings in a ** case-independent fashion, using the same definition of case independence ** that SQLite uses internally when comparing identifiers. */ SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); /* ** CAPI3REF: Error Logging Interface ** ** ^The [sqlite3_log()] interface writes a message into the error log ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. ** ^If logging is enabled, the zFormat string and subsequent arguments are ** used with [sqlite3_snprintf()] to generate the final output string. ** ** The sqlite3_log() interface is intended for use by extensions such as ** virtual tables, collating functions, and SQL functions. While there is ** nothing to prevent an application from calling sqlite3_log(), doing so ** is considered bad form. ** ** The zFormat string must not be NULL. ** ** To avoid deadlocks and other threading problems, the sqlite3_log() routine ** will not use dynamically allocated memory. The log message is stored in ** a fixed-length buffer on the stack. If the log message is longer than ** a few hundred characters, it will be truncated to the length of the ** buffer. */ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); /* ** CAPI3REF: Write-Ahead Log Commit Hook ** ** ^The [sqlite3_wal_hook()] function is used to register a callback that ** will be invoked each time a database connection commits data to a ** [write-ahead log] (i.e. whenever a transaction is committed in ** [journal_mode | journal_mode=WAL mode]). ** ** ^The callback is invoked by SQLite after the commit has taken place and ** the associated write-lock on the database released, so the implementation ** may read, write or [checkpoint] the database as required. ** ** ^The first parameter passed to the callback function when it is invoked ** is a copy of the third parameter passed to sqlite3_wal_hook() when ** registering the callback. ^The second is a copy of the database handle. ** ^The third parameter is the name of the database that was written to - ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter ** is the number of pages currently in the write-ahead log file, ** including those that were just committed. ** ** The callback function should normally return [SQLITE_OK]. ^If an error ** code is returned, that error will propagate back up through the ** SQLite code base to cause the statement that provoked the callback ** to report an error, though the commit will have still occurred. If the ** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value ** that does not correspond to any valid SQLite error code, the results ** are undefined. ** ** A single database handle may have at most a single write-ahead log callback ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any ** previously registered write-ahead log callback. ^Note that the ** [sqlite3_wal_autocheckpoint()] interface and the ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will ** those overwrite any prior [sqlite3_wal_hook()] settings. */ SQLITE_API void *sqlite3_wal_hook( sqlite3*, int(*)(void *,sqlite3*,const char*,int), void* ); /* ** CAPI3REF: Configure an auto-checkpoint ** ** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around ** [sqlite3_wal_hook()] that causes any database on [database connection] D ** to automatically [checkpoint] ** after committing a transaction if there are N or ** more frames in the [write-ahead log] file. ^Passing zero or ** a negative value as the nFrame parameter disables automatic ** checkpoints entirely. ** ** ^The callback registered by this function replaces any existing callback ** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback ** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism ** configured by this function. ** ** ^The [wal_autocheckpoint pragma] can be used to invoke this interface ** from SQL. ** ** ^Every new [database connection] defaults to having the auto-checkpoint ** enabled with a threshold of 1000 pages. The use of this interface ** is only necessary if the default setting is found to be suboptimal ** for a particular application. */ SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N); /* ** CAPI3REF: Checkpoint a database ** ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X ** on [database connection] D to be [checkpointed]. ^If X is NULL or an ** empty string, then a checkpoint is run on all databases of ** connection D. ^If the database connection D is not in ** [WAL | write-ahead log mode] then this interface is a harmless no-op. ** ** ^The [wal_checkpoint pragma] can be used to invoke this interface ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the ** [wal_autocheckpoint pragma] can be used to cause this interface to be ** run whenever the WAL reaches a certain size threshold. */ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); /* ** Undo the hack that converts floating point types to integer for ** builds on processors without floating point support. */ #ifdef SQLITE_OMIT_FLOATING_POINT # undef double #endif #if 0 } /* End of the 'extern "C"' block */ #endif #endif /* ** 2010 August 30 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* */ #ifndef _SQLITE3RTREE_H_ #define _SQLITE3RTREE_H_ #if 0 extern "C" { #endif typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; /* ** Register a geometry callback named zGeom that can be used as part of an ** R-Tree geometry query as follows: ** ** SELECT ... FROM WHERE MATCH $zGeom(... params ...) */ SQLITE_API int sqlite3_rtree_geometry_callback( sqlite3 *db, const char *zGeom, int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes), void *pContext ); /* ** A pointer to a structure of the following type is passed as the first ** argument to callbacks registered using rtree_geometry_callback(). */ struct sqlite3_rtree_geometry { void *pContext; /* Copy of pContext passed to s_r_g_c() */ int nParam; /* Size of array aParam[] */ double *aParam; /* Parameters passed to SQL geom function */ void *pUser; /* Callback implementation user data */ void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ }; #if 0 } /* end of the 'extern "C"' block */ #endif #endif /* ifndef _SQLITE3RTREE_H_ */ /************** End of sqlite3.h *********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include hash.h in the middle of sqliteInt.h ******************/ /************** Begin file hash.h ********************************************/ /* ** 2001 September 22 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This is the header file for the generic hash-table implemenation ** used in SQLite. */ #ifndef _SQLITE_HASH_H_ #define _SQLITE_HASH_H_ /* Forward declarations of structures. */ typedef struct Hash Hash; typedef struct HashElem HashElem; /* A complete hash table is an instance of the following structure. ** The internals of this structure are intended to be opaque -- client ** code should not attempt to access or modify the fields of this structure ** directly. Change this structure only by using the routines below. ** However, some of the "procedures" and "functions" for modifying and ** accessing this structure are really macros, so we can't really make ** this structure opaque. ** ** All elements of the hash table are on a single doubly-linked list. ** Hash.first points to the head of this list. ** ** There are Hash.htsize buckets. Each bucket points to a spot in ** the global doubly-linked list. The contents of the bucket are the ** element pointed to plus the next _ht.count-1 elements in the list. ** ** Hash.htsize and Hash.ht may be zero. In that case lookup is done ** by a linear search of the global list. For small tables, the ** Hash.ht table is never allocated because if there are few elements ** in the table, it is faster to do a linear search than to manage ** the hash table. */ struct Hash { unsigned int htsize; /* Number of buckets in the hash table */ unsigned int count; /* Number of entries in this table */ HashElem *first; /* The first element of the array */ struct _ht { /* the hash table */ int count; /* Number of entries with this hash */ HashElem *chain; /* Pointer to first entry with this hash */ } *ht; }; /* Each element in the hash table is an instance of the following ** structure. All elements are stored on a single doubly-linked list. ** ** Again, this structure is intended to be opaque, but it can't really ** be opaque because it is used by macros. */ struct HashElem { HashElem *next, *prev; /* Next and previous elements in the table */ void *data; /* Data associated with this element */ const char *pKey; int nKey; /* Key associated with this element */ }; /* ** Access routines. To delete, insert a NULL pointer. */ SQLITE_PRIVATE void sqlite3HashInit(Hash*); SQLITE_PRIVATE void *sqlite3HashInsert(Hash*, const char *pKey, int nKey, void *pData); SQLITE_PRIVATE void *sqlite3HashFind(const Hash*, const char *pKey, int nKey); SQLITE_PRIVATE void sqlite3HashClear(Hash*); /* ** Macros for looping over all elements of a hash table. The idiom is ** like this: ** ** Hash h; ** HashElem *p; ** ... ** for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){ ** SomeStructure *pData = sqliteHashData(p); ** // do something with pData ** } */ #define sqliteHashFirst(H) ((H)->first) #define sqliteHashNext(E) ((E)->next) #define sqliteHashData(E) ((E)->data) /* #define sqliteHashKey(E) ((E)->pKey) // NOT USED */ /* #define sqliteHashKeysize(E) ((E)->nKey) // NOT USED */ /* ** Number of entries in a hash table */ /* #define sqliteHashCount(H) ((H)->count) // NOT USED */ #endif /* _SQLITE_HASH_H_ */ /************** End of hash.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include parse.h in the middle of sqliteInt.h *****************/ /************** Begin file parse.h *******************************************/ #define TK_SEMI 1 #define TK_EXPLAIN 2 #define TK_QUERY 3 #define TK_PLAN 4 #define TK_BEGIN 5 #define TK_TRANSACTION 6 #define TK_DEFERRED 7 #define TK_IMMEDIATE 8 #define TK_EXCLUSIVE 9 #define TK_COMMIT 10 #define TK_END 11 #define TK_ROLLBACK 12 #define TK_SAVEPOINT 13 #define TK_RELEASE 14 #define TK_TO 15 #define TK_TABLE 16 #define TK_CREATE 17 #define TK_IF 18 #define TK_NOT 19 #define TK_EXISTS 20 #define TK_TEMP 21 #define TK_LP 22 #define TK_RP 23 #define TK_AS 24 #define TK_COMMA 25 #define TK_ID 26 #define TK_INDEXED 27 #define TK_ABORT 28 #define TK_ACTION 29 #define TK_AFTER 30 #define TK_ANALYZE 31 #define TK_ASC 32 #define TK_ATTACH 33 #define TK_BEFORE 34 #define TK_BY 35 #define TK_CASCADE 36 #define TK_CAST 37 #define TK_COLUMNKW 38 #define TK_CONFLICT 39 #define TK_DATABASE 40 #define TK_DESC 41 #define TK_DETACH 42 #define TK_EACH 43 #define TK_FAIL 44 #define TK_FOR 45 #define TK_IGNORE 46 #define TK_INITIALLY 47 #define TK_INSTEAD 48 #define TK_LIKE_KW 49 #define TK_MATCH 50 #define TK_NO 51 #define TK_KEY 52 #define TK_OF 53 #define TK_OFFSET 54 #define TK_PRAGMA 55 #define TK_RAISE 56 #define TK_REPLACE 57 #define TK_RESTRICT 58 #define TK_ROW 59 #define TK_TRIGGER 60 #define TK_VACUUM 61 #define TK_VIEW 62 #define TK_VIRTUAL 63 #define TK_REINDEX 64 #define TK_RENAME 65 #define TK_CTIME_KW 66 #define TK_ANY 67 #define TK_OR 68 #define TK_AND 69 #define TK_IS 70 #define TK_BETWEEN 71 #define TK_IN 72 #define TK_ISNULL 73 #define TK_NOTNULL 74 #define TK_NE 75 #define TK_EQ 76 #define TK_GT 77 #define TK_LE 78 #define TK_LT 79 #define TK_GE 80 #define TK_ESCAPE 81 #define TK_BITAND 82 #define TK_BITOR 83 #define TK_LSHIFT 84 #define TK_RSHIFT 85 #define TK_PLUS 86 #define TK_MINUS 87 #define TK_STAR 88 #define TK_SLASH 89 #define TK_REM 90 #define TK_CONCAT 91 #define TK_COLLATE 92 #define TK_BITNOT 93 #define TK_STRING 94 #define TK_JOIN_KW 95 #define TK_CONSTRAINT 96 #define TK_DEFAULT 97 #define TK_NULL 98 #define TK_PRIMARY 99 #define TK_UNIQUE 100 #define TK_CHECK 101 #define TK_REFERENCES 102 #define TK_AUTOINCR 103 #define TK_ON 104 #define TK_INSERT 105 #define TK_DELETE 106 #define TK_UPDATE 107 #define TK_SET 108 #define TK_DEFERRABLE 109 #define TK_FOREIGN 110 #define TK_DROP 111 #define TK_UNION 112 #define TK_ALL 113 #define TK_EXCEPT 114 #define TK_INTERSECT 115 #define TK_SELECT 116 #define TK_DISTINCT 117 #define TK_DOT 118 #define TK_FROM 119 #define TK_JOIN 120 #define TK_USING 121 #define TK_ORDER 122 #define TK_GROUP 123 #define TK_HAVING 124 #define TK_LIMIT 125 #define TK_WHERE 126 #define TK_INTO 127 #define TK_VALUES 128 #define TK_INTEGER 129 #define TK_FLOAT 130 #define TK_BLOB 131 #define TK_REGISTER 132 #define TK_VARIABLE 133 #define TK_CASE 134 #define TK_WHEN 135 #define TK_THEN 136 #define TK_ELSE 137 #define TK_INDEX 138 #define TK_ALTER 139 #define TK_ADD 140 #define TK_TO_TEXT 141 #define TK_TO_BLOB 142 #define TK_TO_NUMERIC 143 #define TK_TO_INT 144 #define TK_TO_REAL 145 #define TK_ISNOT 146 #define TK_END_OF_FILE 147 #define TK_ILLEGAL 148 #define TK_SPACE 149 #define TK_UNCLOSED_STRING 150 #define TK_FUNCTION 151 #define TK_COLUMN 152 #define TK_AGG_FUNCTION 153 #define TK_AGG_COLUMN 154 #define TK_CONST_FUNC 155 #define TK_UMINUS 156 #define TK_UPLUS 157 /************** End of parse.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ #include #include #include #include #include /* ** If compiling for a processor that lacks floating point support, ** substitute integer for floating-point */ #ifdef SQLITE_OMIT_FLOATING_POINT # define double sqlite_int64 # define float sqlite_int64 # define LONGDOUBLE_TYPE sqlite_int64 # ifndef SQLITE_BIG_DBL # define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50) # endif # define SQLITE_OMIT_DATETIME_FUNCS 1 # define SQLITE_OMIT_TRACE 1 # undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT # undef SQLITE_HAVE_ISNAN #endif #ifndef SQLITE_BIG_DBL # define SQLITE_BIG_DBL (1e99) #endif /* ** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0 ** afterward. Having this macro allows us to cause the C compiler ** to omit code used by TEMP tables without messy #ifndef statements. */ #ifdef SQLITE_OMIT_TEMPDB #define OMIT_TEMPDB 1 #else #define OMIT_TEMPDB 0 #endif /* ** The "file format" number is an integer that is incremented whenever ** the VDBE-level file format changes. The following macros define the ** the default file format for new databases and the maximum file format ** that the library can read. */ #define SQLITE_MAX_FILE_FORMAT 4 #ifndef SQLITE_DEFAULT_FILE_FORMAT # define SQLITE_DEFAULT_FILE_FORMAT 1 #endif /* ** Determine whether triggers are recursive by default. This can be ** changed at run-time using a pragma. */ #ifndef SQLITE_DEFAULT_RECURSIVE_TRIGGERS # define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0 #endif /* ** Provide a default value for SQLITE_TEMP_STORE in case it is not specified ** on the command-line */ #ifndef SQLITE_TEMP_STORE # define SQLITE_TEMP_STORE 1 #endif /* ** GCC does not define the offsetof() macro so we'll have to do it ** ourselves. */ #ifndef offsetof #define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD)) #endif /* ** Check to see if this machine uses EBCDIC. (Yes, believe it or ** not, there are still machines out there that use EBCDIC.) */ #if 'A' == '\301' # define SQLITE_EBCDIC 1 #else # define SQLITE_ASCII 1 #endif /* ** Integers of known sizes. These typedefs might change for architectures ** where the sizes very. Preprocessor macros are available so that the ** types can be conveniently redefined at compile-type. Like this: ** ** cc '-DUINTPTR_TYPE=long long int' ... */ #ifndef UINT32_TYPE # ifdef HAVE_UINT32_T # define UINT32_TYPE uint32_t # else # define UINT32_TYPE unsigned int # endif #endif #ifndef UINT16_TYPE # ifdef HAVE_UINT16_T # define UINT16_TYPE uint16_t # else # define UINT16_TYPE unsigned short int # endif #endif #ifndef INT16_TYPE # ifdef HAVE_INT16_T # define INT16_TYPE int16_t # else # define INT16_TYPE short int # endif #endif #ifndef UINT8_TYPE # ifdef HAVE_UINT8_T # define UINT8_TYPE uint8_t # else # define UINT8_TYPE unsigned char # endif #endif #ifndef INT8_TYPE # ifdef HAVE_INT8_T # define INT8_TYPE int8_t # else # define INT8_TYPE signed char # endif #endif #ifndef LONGDOUBLE_TYPE # define LONGDOUBLE_TYPE long double #endif typedef sqlite_int64 i64; /* 8-byte signed integer */ typedef sqlite_uint64 u64; /* 8-byte unsigned integer */ typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ typedef INT8_TYPE i8; /* 1-byte signed integer */ /* ** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value ** that can be stored in a u32 without loss of data. The value ** is 0x00000000ffffffff. But because of quirks of some compilers, we ** have to specify the value in the less intuitive manner shown: */ #define SQLITE_MAX_U32 ((((u64)1)<<32)-1) /* ** Macros to determine whether the machine is big or little endian, ** evaluated at runtime. */ #ifdef SQLITE_AMALGAMATION SQLITE_PRIVATE const int sqlite3one = 1; #else SQLITE_PRIVATE const int sqlite3one; #endif #if defined(i386) || defined(__i386__) || defined(_M_IX86)\ || defined(__x86_64) || defined(__x86_64__) # define SQLITE_BIGENDIAN 0 # define SQLITE_LITTLEENDIAN 1 # define SQLITE_UTF16NATIVE SQLITE_UTF16LE #else # define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0) # define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1) # define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE) #endif /* ** Constants for the largest and smallest possible 64-bit signed integers. ** These macros are designed to work correctly on both 32-bit and 64-bit ** compilers. */ #define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32)) #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) /* ** Round up a number to the next larger multiple of 8. This is used ** to force 8-byte alignment on 64-bit architectures. */ #define ROUND8(x) (((x)+7)&~7) /* ** Round down to the nearest multiple of 8 */ #define ROUNDDOWN8(x) ((x)&~7) /* ** Assert that the pointer X is aligned to an 8-byte boundary. This ** macro is used only within assert() to verify that the code gets ** all alignment restrictions correct. ** ** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the ** underlying malloc() implemention might return us 4-byte aligned ** pointers. In that case, only verify 4-byte alignment. */ #ifdef SQLITE_4_BYTE_ALIGNED_MALLOC # define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&3)==0) #else # define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0) #endif /* ** An instance of the following structure is used to store the busy-handler ** callback for a given sqlite handle. ** ** The sqlite.busyHandler member of the sqlite struct contains the busy ** callback for the database handle. Each pager opened via the sqlite ** handle is passed a pointer to sqlite.busyHandler. The busy-handler ** callback is currently invoked only from within pager.c. */ typedef struct BusyHandler BusyHandler; struct BusyHandler { int (*xFunc)(void *,int); /* The busy callback */ void *pArg; /* First arg to busy callback */ int nBusy; /* Incremented with each busy call */ }; /* ** Name of the master database table. The master database table ** is a special table that holds the names and attributes of all ** user tables and indices. */ #define MASTER_NAME "sqlite_master" #define TEMP_MASTER_NAME "sqlite_temp_master" /* ** The root-page of the master database table. */ #define MASTER_ROOT 1 /* ** The name of the schema table. */ #define SCHEMA_TABLE(x) ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME) /* ** A convenience macro that returns the number of elements in ** an array. */ #define ArraySize(X) ((int)(sizeof(X)/sizeof(X[0]))) /* ** The following value as a destructor means to use sqlite3DbFree(). ** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT. */ #define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3DbFree) /* ** When SQLITE_OMIT_WSD is defined, it means that the target platform does ** not support Writable Static Data (WSD) such as global and static variables. ** All variables must either be on the stack or dynamically allocated from ** the heap. When WSD is unsupported, the variable declarations scattered ** throughout the SQLite code must become constants instead. The SQLITE_WSD ** macro is used for this purpose. And instead of referencing the variable ** directly, we use its constant as a key to lookup the run-time allocated ** buffer that holds real variable. The constant is also the initializer ** for the run-time allocated buffer. ** ** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL ** macros become no-ops and have zero performance impact. */ #ifdef SQLITE_OMIT_WSD #define SQLITE_WSD const #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v))) #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config) SQLITE_API int sqlite3_wsd_init(int N, int J); SQLITE_API void *sqlite3_wsd_find(void *K, int L); #else #define SQLITE_WSD #define GLOBAL(t,v) v #define sqlite3GlobalConfig sqlite3Config #endif /* ** The following macros are used to suppress compiler warnings and to ** make it clear to human readers when a function parameter is deliberately ** left unused within the body of a function. This usually happens when ** a function is called via a function pointer. For example the ** implementation of an SQL aggregate step callback may not use the ** parameter indicating the number of arguments passed to the aggregate, ** if it knows that this is enforced elsewhere. ** ** When a function parameter is not used at all within the body of a function, ** it is generally named "NotUsed" or "NotUsed2" to make things even clearer. ** However, these macros may also be used to suppress warnings related to ** parameters that may or may not be used depending on compilation options. ** For example those parameters only used in assert() statements. In these ** cases the parameters are named as per the usual conventions. */ #define UNUSED_PARAMETER(x) (void)(x) #define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y) /* ** Forward references to structures */ typedef struct AggInfo AggInfo; typedef struct AuthContext AuthContext; typedef struct AutoincInfo AutoincInfo; typedef struct Bitvec Bitvec; typedef struct CollSeq CollSeq; typedef struct Column Column; typedef struct Db Db; typedef struct Schema Schema; typedef struct Expr Expr; typedef struct ExprList ExprList; typedef struct ExprSpan ExprSpan; typedef struct FKey FKey; typedef struct FuncDestructor FuncDestructor; typedef struct FuncDef FuncDef; typedef struct FuncDefHash FuncDefHash; typedef struct IdList IdList; typedef struct Index Index; typedef struct IndexSample IndexSample; typedef struct KeyClass KeyClass; typedef struct KeyInfo KeyInfo; typedef struct Lookaside Lookaside; typedef struct LookasideSlot LookasideSlot; typedef struct Module Module; typedef struct NameContext NameContext; typedef struct Parse Parse; typedef struct RowSet RowSet; typedef struct Savepoint Savepoint; typedef struct Select Select; typedef struct SrcList SrcList; typedef struct StrAccum StrAccum; typedef struct Table Table; typedef struct TableLock TableLock; typedef struct Token Token; typedef struct Trigger Trigger; typedef struct TriggerPrg TriggerPrg; typedef struct TriggerStep TriggerStep; typedef struct UnpackedRecord UnpackedRecord; typedef struct VTable VTable; typedef struct Walker Walker; typedef struct WherePlan WherePlan; typedef struct WhereInfo WhereInfo; typedef struct WhereLevel WhereLevel; /* ** Defer sourcing vdbe.h and btree.h until after the "u8" and ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque ** pointer types (i.e. FuncDef) defined above. */ /************** Include btree.h in the middle of sqliteInt.h *****************/ /************** Begin file btree.h *******************************************/ /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the sqlite B-Tree file ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. */ #ifndef _BTREE_H_ #define _BTREE_H_ /* TODO: This definition is just included so other modules compile. It ** needs to be revisited. */ #define SQLITE_N_BTREE_META 10 /* ** If defined as non-zero, auto-vacuum is enabled by default. Otherwise ** it must be turned on for each database using "PRAGMA auto_vacuum = 1". */ #ifndef SQLITE_DEFAULT_AUTOVACUUM #define SQLITE_DEFAULT_AUTOVACUUM 0 #endif #define BTREE_AUTOVACUUM_NONE 0 /* Do not do auto-vacuum */ #define BTREE_AUTOVACUUM_FULL 1 /* Do full auto-vacuum */ #define BTREE_AUTOVACUUM_INCR 2 /* Incremental vacuum */ /* ** Forward declarations of structure */ typedef struct Btree Btree; typedef struct BtCursor BtCursor; typedef struct BtShared BtShared; typedef struct BtreeMutexArray BtreeMutexArray; /* ** This structure records all of the Btrees that need to hold ** a mutex before we enter sqlite3VdbeExec(). The Btrees are ** are placed in aBtree[] in order of aBtree[]->pBt. That way, ** we can always lock and unlock them all quickly. */ struct BtreeMutexArray { int nMutex; Btree *aBtree[SQLITE_MAX_ATTACHED+1]; }; SQLITE_PRIVATE int sqlite3BtreeOpen( const char *zFilename, /* Name of database file to open */ sqlite3 *db, /* Associated database connection */ Btree **ppBtree, /* Return open Btree* here */ int flags, /* Flags */ int vfsFlags /* Flags passed through to VFS open */ ); /* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the ** following values. ** ** NOTE: These values must match the corresponding PAGER_ values in ** pager.h. */ #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */ #define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */ #define BTREE_MEMORY 4 /* This is an in-memory DB */ #define BTREE_SINGLE 8 /* The file contains at most 1 b-tree */ #define BTREE_UNORDERED 16 /* Use of a hash implementation is OK */ SQLITE_PRIVATE int sqlite3BtreeClose(Btree*); SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int); SQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int); SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*); SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree*); SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree*,int); SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree*); SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree*,int); SQLITE_PRIVATE int sqlite3BtreeGetReserve(Btree*); SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *, int); SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *); SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int); SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster); SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*); SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*); SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*); SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int); SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags); SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*); SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*); SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*); SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *, int, void(*)(void *)); SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *pBtree); SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock); SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *, int, int); SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *); SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *); SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *, Btree *); SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *); /* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR ** of the flags shown below. ** ** Every SQLite table must have either BTREE_INTKEY or BTREE_BLOBKEY set. ** With BTREE_INTKEY, the table key is a 64-bit integer and arbitrary data ** is stored in the leaves. (BTREE_INTKEY is used for SQL tables.) With ** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored ** anywhere - the key is the content. (BTREE_BLOBKEY is used for SQL ** indices.) */ #define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */ #define BTREE_BLOBKEY 2 /* Table has keys only - no data */ SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*); SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*); SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree*, int); SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue); SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value); /* ** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta ** should be one of the following values. The integer values are assigned ** to constants so that the offset of the corresponding field in an ** SQLite database header may be found using the following formula: ** ** offset = 36 + (idx * 4) ** ** For example, the free-page-count field is located at byte offset 36 of ** the database file header. The incr-vacuum-flag field is located at ** byte offset 64 (== 36+4*7). */ #define BTREE_FREE_PAGE_COUNT 0 #define BTREE_SCHEMA_VERSION 1 #define BTREE_FILE_FORMAT 2 #define BTREE_DEFAULT_CACHE_SIZE 3 #define BTREE_LARGEST_ROOT_PAGE 4 #define BTREE_TEXT_ENCODING 5 #define BTREE_USER_VERSION 6 #define BTREE_INCR_VACUUM 7 SQLITE_PRIVATE int sqlite3BtreeCursor( Btree*, /* BTree containing table to open */ int iTable, /* Index of root page */ int wrFlag, /* 1 for writing. 0 for read-only */ struct KeyInfo*, /* First argument to compare function */ BtCursor *pCursor /* Space to write cursor structure */ ); SQLITE_PRIVATE int sqlite3BtreeCursorSize(void); SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( BtCursor*, UnpackedRecord *pUnKey, i64 intKey, int bias, int *pRes ); SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor*, int*); SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, const void *pData, int nData, int nZero, int bias, int seekResult); SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes); SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt); SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt); SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); SQLITE_PRIVATE int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); SQLITE_PRIVATE void sqlite3BtreeSetCachedRowid(BtCursor*, sqlite3_int64); SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor*); SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*); SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); SQLITE_PRIVATE void sqlite3BtreeCacheOverflow(BtCursor *); SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *); SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); #ifndef NDEBUG SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*); #endif #ifndef SQLITE_OMIT_BTREECOUNT SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *, i64 *); #endif #ifdef SQLITE_TEST SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int); SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*); #endif #ifndef SQLITE_OMIT_WAL SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*); #endif /* ** If we are not using shared cache, then there is no need to ** use mutexes to access the BtShared structures. So make the ** Enter and Leave procedures no-ops. */ #ifndef SQLITE_OMIT_SHARED_CACHE SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*); SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3*); #else # define sqlite3BtreeEnter(X) # define sqlite3BtreeEnterAll(X) #endif #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*); SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*); SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*); SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3*); SQLITE_PRIVATE void sqlite3BtreeMutexArrayEnter(BtreeMutexArray*); SQLITE_PRIVATE void sqlite3BtreeMutexArrayLeave(BtreeMutexArray*); SQLITE_PRIVATE void sqlite3BtreeMutexArrayInsert(BtreeMutexArray*, Btree*); #ifndef NDEBUG /* These routines are used inside assert() statements only. */ SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree*); SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3*); #endif #else # define sqlite3BtreeLeave(X) # define sqlite3BtreeEnterCursor(X) # define sqlite3BtreeLeaveCursor(X) # define sqlite3BtreeLeaveAll(X) # define sqlite3BtreeMutexArrayEnter(X) # define sqlite3BtreeMutexArrayLeave(X) # define sqlite3BtreeMutexArrayInsert(X,Y) # define sqlite3BtreeHoldsMutex(X) 1 # define sqlite3BtreeHoldsAllMutexes(X) 1 #endif #endif /* _BTREE_H_ */ /************** End of btree.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include vdbe.h in the middle of sqliteInt.h ******************/ /************** Begin file vdbe.h ********************************************/ /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Header file for the Virtual DataBase Engine (VDBE) ** ** This header defines the interface to the virtual database engine ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. */ #ifndef _SQLITE_VDBE_H_ #define _SQLITE_VDBE_H_ /* ** A single VDBE is an opaque structure named "Vdbe". Only routines ** in the source file sqliteVdbe.c are allowed to see the insides ** of this structure. */ typedef struct Vdbe Vdbe; /* ** The names of the following types declared in vdbeInt.h are required ** for the VdbeOp definition. */ typedef struct VdbeFunc VdbeFunc; typedef struct Mem Mem; typedef struct SubProgram SubProgram; /* ** A single instruction of the virtual machine has an opcode ** and as many as three operands. The instruction is recorded ** as an instance of the following structure: */ struct VdbeOp { u8 opcode; /* What operation to perform */ signed char p4type; /* One of the P4_xxx constants for p4 */ u8 opflags; /* Mask of the OPFLG_* flags in opcodes.h */ u8 p5; /* Fifth parameter is an unsigned character */ int p1; /* First operand */ int p2; /* Second parameter (often the jump destination) */ int p3; /* The third parameter */ union { /* fourth parameter */ int i; /* Integer value if p4type==P4_INT32 */ void *p; /* Generic pointer */ char *z; /* Pointer to data for string (char array) types */ i64 *pI64; /* Used when p4type is P4_INT64 */ double *pReal; /* Used when p4type is P4_REAL */ FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ VdbeFunc *pVdbeFunc; /* Used when p4type is P4_VDBEFUNC */ CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ Mem *pMem; /* Used when p4type is P4_MEM */ VTable *pVtab; /* Used when p4type is P4_VTAB */ KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */ int *ai; /* Used when p4type is P4_INTARRAY */ SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ } p4; #ifdef SQLITE_DEBUG char *zComment; /* Comment to improve readability */ #endif #ifdef VDBE_PROFILE int cnt; /* Number of times this instruction was executed */ u64 cycles; /* Total time spent executing this instruction */ #endif }; typedef struct VdbeOp VdbeOp; /* ** A sub-routine used to implement a trigger program. */ struct SubProgram { VdbeOp *aOp; /* Array of opcodes for sub-program */ int nOp; /* Elements in aOp[] */ int nMem; /* Number of memory cells required */ int nCsr; /* Number of cursors required */ void *token; /* id that may be used to recursive triggers */ SubProgram *pNext; /* Next sub-program already visited */ }; /* ** A smaller version of VdbeOp used for the VdbeAddOpList() function because ** it takes up less space. */ struct VdbeOpList { u8 opcode; /* What operation to perform */ signed char p1; /* First operand */ signed char p2; /* Second parameter (often the jump destination) */ signed char p3; /* Third parameter */ }; typedef struct VdbeOpList VdbeOpList; /* ** Allowed values of VdbeOp.p4type */ #define P4_NOTUSED 0 /* The P4 parameter is not used */ #define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */ #define P4_STATIC (-2) /* Pointer to a static string */ #define P4_COLLSEQ (-4) /* P4 is a pointer to a CollSeq structure */ #define P4_FUNCDEF (-5) /* P4 is a pointer to a FuncDef structure */ #define P4_KEYINFO (-6) /* P4 is a pointer to a KeyInfo structure */ #define P4_VDBEFUNC (-7) /* P4 is a pointer to a VdbeFunc structure */ #define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */ #define P4_TRANSIENT (-9) /* P4 is a pointer to a transient string */ #define P4_VTAB (-10) /* P4 is a pointer to an sqlite3_vtab structure */ #define P4_MPRINTF (-11) /* P4 is a string obtained from sqlite3_mprintf() */ #define P4_REAL (-12) /* P4 is a 64-bit floating point value */ #define P4_INT64 (-13) /* P4 is a 64-bit signed integer */ #define P4_INT32 (-14) /* P4 is a 32-bit signed integer */ #define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */ #define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */ /* When adding a P4 argument using P4_KEYINFO, a copy of the KeyInfo structure ** is made. That copy is freed when the Vdbe is finalized. But if the ** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used. It still ** gets freed when the Vdbe is finalized so it still should be obtained ** from a single sqliteMalloc(). But no copy is made and the calling ** function should *not* try to free the KeyInfo. */ #define P4_KEYINFO_HANDOFF (-16) #define P4_KEYINFO_STATIC (-17) /* ** The Vdbe.aColName array contains 5n Mem structures, where n is the ** number of columns of data returned by the statement. */ #define COLNAME_NAME 0 #define COLNAME_DECLTYPE 1 #define COLNAME_DATABASE 2 #define COLNAME_TABLE 3 #define COLNAME_COLUMN 4 #ifdef SQLITE_ENABLE_COLUMN_METADATA # define COLNAME_N 5 /* Number of COLNAME_xxx symbols */ #else # ifdef SQLITE_OMIT_DECLTYPE # define COLNAME_N 1 /* Store only the name */ # else # define COLNAME_N 2 /* Store the name and decltype */ # endif #endif /* ** The following macro converts a relative address in the p2 field ** of a VdbeOp structure into a negative number so that ** sqlite3VdbeAddOpList() knows that the address is relative. Calling ** the macro again restores the address. */ #define ADDR(X) (-1-(X)) /* ** The makefile scans the vdbe.c source file and creates the "opcodes.h" ** header file that defines a number for each opcode used by the VDBE. */ /************** Include opcodes.h in the middle of vdbe.h ********************/ /************** Begin file opcodes.h *****************************************/ /* Automatically generated. Do not edit */ /* See the mkopcodeh.awk script for details */ #define OP_Goto 1 #define OP_Gosub 2 #define OP_Return 3 #define OP_Yield 4 #define OP_HaltIfNull 5 #define OP_Halt 6 #define OP_Integer 7 #define OP_Int64 8 #define OP_Real 130 /* same as TK_FLOAT */ #define OP_String8 94 /* same as TK_STRING */ #define OP_String 9 #define OP_Null 10 #define OP_Blob 11 #define OP_Variable 12 #define OP_Move 13 #define OP_Copy 14 #define OP_SCopy 15 #define OP_ResultRow 16 #define OP_Concat 91 /* same as TK_CONCAT */ #define OP_Add 86 /* same as TK_PLUS */ #define OP_Subtract 87 /* same as TK_MINUS */ #define OP_Multiply 88 /* same as TK_STAR */ #define OP_Divide 89 /* same as TK_SLASH */ #define OP_Remainder 90 /* same as TK_REM */ #define OP_CollSeq 17 #define OP_Function 18 #define OP_BitAnd 82 /* same as TK_BITAND */ #define OP_BitOr 83 /* same as TK_BITOR */ #define OP_ShiftLeft 84 /* same as TK_LSHIFT */ #define OP_ShiftRight 85 /* same as TK_RSHIFT */ #define OP_AddImm 20 #define OP_MustBeInt 21 #define OP_RealAffinity 22 #define OP_ToText 141 /* same as TK_TO_TEXT */ #define OP_ToBlob 142 /* same as TK_TO_BLOB */ #define OP_ToNumeric 143 /* same as TK_TO_NUMERIC*/ #define OP_ToInt 144 /* same as TK_TO_INT */ #define OP_ToReal 145 /* same as TK_TO_REAL */ #define OP_Eq 76 /* same as TK_EQ */ #define OP_Ne 75 /* same as TK_NE */ #define OP_Lt 79 /* same as TK_LT */ #define OP_Le 78 /* same as TK_LE */ #define OP_Gt 77 /* same as TK_GT */ #define OP_Ge 80 /* same as TK_GE */ #define OP_Permutation 23 #define OP_Compare 24 #define OP_Jump 25 #define OP_And 69 /* same as TK_AND */ #define OP_Or 68 /* same as TK_OR */ #define OP_Not 19 /* same as TK_NOT */ #define OP_BitNot 93 /* same as TK_BITNOT */ #define OP_If 26 #define OP_IfNot 27 #define OP_IsNull 73 /* same as TK_ISNULL */ #define OP_NotNull 74 /* same as TK_NOTNULL */ #define OP_Column 28 #define OP_Affinity 29 #define OP_MakeRecord 30 #define OP_Count 31 #define OP_Savepoint 32 #define OP_AutoCommit 33 #define OP_Transaction 34 #define OP_ReadCookie 35 #define OP_SetCookie 36 #define OP_VerifyCookie 37 #define OP_OpenRead 38 #define OP_OpenWrite 39 #define OP_OpenAutoindex 40 #define OP_OpenEphemeral 41 #define OP_OpenPseudo 42 #define OP_Close 43 #define OP_SeekLt 44 #define OP_SeekLe 45 #define OP_SeekGe 46 #define OP_SeekGt 47 #define OP_Seek 48 #define OP_NotFound 49 #define OP_Found 50 #define OP_IsUnique 51 #define OP_NotExists 52 #define OP_Sequence 53 #define OP_NewRowid 54 #define OP_Insert 55 #define OP_InsertInt 56 #define OP_Delete 57 #define OP_ResetCount 58 #define OP_RowKey 59 #define OP_RowData 60 #define OP_Rowid 61 #define OP_NullRow 62 #define OP_Last 63 #define OP_Sort 64 #define OP_Rewind 65 #define OP_Prev 66 #define OP_Next 67 #define OP_IdxInsert 70 #define OP_IdxDelete 71 #define OP_IdxRowid 72 #define OP_IdxLT 81 #define OP_IdxGE 92 #define OP_Destroy 95 #define OP_Clear 96 #define OP_CreateIndex 97 #define OP_CreateTable 98 #define OP_ParseSchema 99 #define OP_LoadAnalysis 100 #define OP_DropTable 101 #define OP_DropIndex 102 #define OP_DropTrigger 103 #define OP_IntegrityCk 104 #define OP_RowSetAdd 105 #define OP_RowSetRead 106 #define OP_RowSetTest 107 #define OP_Program 108 #define OP_Param 109 #define OP_FkCounter 110 #define OP_FkIfZero 111 #define OP_MemMax 112 #define OP_IfPos 113 #define OP_IfNeg 114 #define OP_IfZero 115 #define OP_AggStep 116 #define OP_AggFinal 117 #define OP_Checkpoint 118 #define OP_JournalMode 119 #define OP_Vacuum 120 #define OP_IncrVacuum 121 #define OP_Expire 122 #define OP_TableLock 123 #define OP_VBegin 124 #define OP_VCreate 125 #define OP_VDestroy 126 #define OP_VOpen 127 #define OP_VFilter 128 #define OP_VColumn 129 #define OP_VNext 131 #define OP_VRename 132 #define OP_VUpdate 133 #define OP_Pagecount 134 #define OP_MaxPgcnt 135 #define OP_Trace 136 #define OP_Noop 137 #define OP_Explain 138 /* The following opcode values are never used */ #define OP_NotUsed_139 139 #define OP_NotUsed_140 140 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c ** are encoded into bitvectors as follows: */ #define OPFLG_JUMP 0x0001 /* jump: P2 holds jmp target */ #define OPFLG_OUT2_PRERELEASE 0x0002 /* out2-prerelease: */ #define OPFLG_IN1 0x0004 /* in1: P1 is an input */ #define OPFLG_IN2 0x0008 /* in2: P2 is an input */ #define OPFLG_IN3 0x0010 /* in3: P3 is an input */ #define OPFLG_OUT2 0x0020 /* out2: P2 is an output */ #define OPFLG_OUT3 0x0040 /* out3: P3 is an output */ #define OPFLG_INITIALIZER {\ /* 0 */ 0x00, 0x01, 0x05, 0x04, 0x04, 0x10, 0x00, 0x02,\ /* 8 */ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x24, 0x24,\ /* 16 */ 0x00, 0x00, 0x00, 0x24, 0x04, 0x05, 0x04, 0x00,\ /* 24 */ 0x00, 0x01, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02,\ /* 32 */ 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00,\ /* 40 */ 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11,\ /* 48 */ 0x08, 0x11, 0x11, 0x11, 0x11, 0x02, 0x02, 0x00,\ /* 56 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01,\ /* 64 */ 0x01, 0x01, 0x01, 0x01, 0x4c, 0x4c, 0x08, 0x00,\ /* 72 */ 0x02, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\ /* 80 */ 0x15, 0x01, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,\ /* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x01, 0x24, 0x02, 0x02,\ /* 96 */ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 104 */ 0x00, 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00, 0x01,\ /* 112 */ 0x08, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02,\ /* 120 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 128 */ 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x02, 0x02,\ /* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\ /* 144 */ 0x04, 0x04,} /************** End of opcodes.h *********************************************/ /************** Continuing where we left off in vdbe.h ***********************/ /* ** Prototypes for the VDBE interface. See comments on the implementation ** for a description of what each of these routines does. */ SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(sqlite3*); SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int); SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int); SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int); SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); SQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp); SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1); SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2); SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3); SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5); SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr); SQLITE_PRIVATE void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N); SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int); SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe*, int); SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeDeleteObject(sqlite3*,Vdbe*); SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int,int,int); SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int); SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*); #ifdef SQLITE_DEBUG SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int); SQLITE_PRIVATE void sqlite3VdbeTrace(Vdbe*,FILE*); #endif SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*); SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int); SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*); SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int); SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetValue(Vdbe*, int, u8); SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int); #ifndef SQLITE_OMIT_TRACE SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*); #endif SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int); SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*); SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); #ifndef SQLITE_OMIT_TRIGGER SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); #endif #ifndef NDEBUG SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe*, const char*, ...); # define VdbeComment(X) sqlite3VdbeComment X SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe*, const char*, ...); # define VdbeNoopComment(X) sqlite3VdbeNoopComment X #else # define VdbeComment(X) # define VdbeNoopComment(X) #endif #endif /************** End of vdbe.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include pager.h in the middle of sqliteInt.h *****************/ /************** Begin file pager.h *******************************************/ /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the sqlite page cache ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. */ #ifndef _PAGER_H_ #define _PAGER_H_ /* ** Default maximum size for persistent journal files. A negative ** value means no limit. This value may be overridden using the ** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". */ #ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1 #endif /* ** The type used to represent a page number. The first page in a file ** is called page 1. 0 is used to represent "not a page". */ typedef u32 Pgno; /* ** Each open file is managed by a separate instance of the "Pager" structure. */ typedef struct Pager Pager; /* ** Handle type for pages. */ typedef struct PgHdr DbPage; /* ** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is ** reserved for working around a windows/posix incompatibility). It is ** used in the journal to signify that the remainder of the journal file ** is devoted to storing a master journal name - there are no more pages to ** roll back. See comments for function writeMasterJournal() in pager.c ** for details. */ #define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1)) /* ** Allowed values for the flags parameter to sqlite3PagerOpen(). ** ** NOTE: These values must match the corresponding BTREE_ values in btree.h. */ #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */ #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */ #define PAGER_MEMORY 0x0004 /* In-memory database */ /* ** Valid values for the second argument to sqlite3PagerLockingMode(). */ #define PAGER_LOCKINGMODE_QUERY -1 #define PAGER_LOCKINGMODE_NORMAL 0 #define PAGER_LOCKINGMODE_EXCLUSIVE 1 /* ** Numeric constants that encode the journalmode. */ #define PAGER_JOURNALMODE_QUERY (-1) /* Query the value of journalmode */ #define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */ #define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */ #define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */ #define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */ #define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */ #define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ /* ** The remainder of this file contains the declarations of the functions ** that make up the Pager sub-system API. See source code comments for ** a detailed description of each routine. */ /* Open and close a Pager connection. */ SQLITE_PRIVATE int sqlite3PagerOpen( sqlite3_vfs*, Pager **ppPager, const char*, int, int, int, void(*)(DbPage*) ); SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager); SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*); /* Functions used to configure a Pager object. */ SQLITE_PRIVATE void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *); SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u32*, int); SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager*, int); SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int); SQLITE_PRIVATE void sqlite3PagerSetSafetyLevel(Pager*,int,int,int); SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int); SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *, int); SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager*); SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager*); SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64); SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager*); /* Functions used to obtain and release page references. */ SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); #define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0) SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); SQLITE_PRIVATE void sqlite3PagerRef(DbPage*); SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*); /* Operations on page references. */ SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*); SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*); SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage*); SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *); SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *); /* Functions used to manage pager transactions and savepoints. */ SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*); SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int); SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*); SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager); SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*); SQLITE_PRIVATE int sqlite3PagerRollback(Pager*); SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n); SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager); SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager); SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager); SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager); SQLITE_PRIVATE int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen); SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager); /* Functions used to query pager state and configuration. */ SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager*); SQLITE_PRIVATE int sqlite3PagerRefcount(Pager*); SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager*); SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager*); SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager*); SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*); SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); SQLITE_PRIVATE int sqlite3PagerNosync(Pager*); SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); /* Functions used to truncate the database file. */ SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) SQLITE_PRIVATE void *sqlite3PagerCodec(DbPage *); #endif /* Functions to support testing and debugging. */ #if !defined(NDEBUG) || defined(SQLITE_TEST) SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage*); SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage*); #endif #ifdef SQLITE_TEST SQLITE_PRIVATE int *sqlite3PagerStats(Pager*); SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*); void disable_simulated_io_errors(void); void enable_simulated_io_errors(void); #else # define disable_simulated_io_errors() # define enable_simulated_io_errors() #endif #endif /* _PAGER_H_ */ /************** End of pager.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include pcache.h in the middle of sqliteInt.h ****************/ /************** Begin file pcache.h ******************************************/ /* ** 2008 August 05 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the sqlite page cache ** subsystem. */ #ifndef _PCACHE_H_ typedef struct PgHdr PgHdr; typedef struct PCache PCache; /* ** Every page in the cache is controlled by an instance of the following ** structure. */ struct PgHdr { void *pData; /* Content of this page */ void *pExtra; /* Extra content */ PgHdr *pDirty; /* Transient list of dirty pages */ Pgno pgno; /* Page number for this page */ Pager *pPager; /* The pager this page is part of */ #ifdef SQLITE_CHECK_PAGES u32 pageHash; /* Hash of page content */ #endif u16 flags; /* PGHDR flags defined below */ /********************************************************************** ** Elements above are public. All that follows is private to pcache.c ** and should not be accessed by other modules. */ i16 nRef; /* Number of users of this page */ PCache *pCache; /* Cache that owns this page */ PgHdr *pDirtyNext; /* Next element in list of dirty pages */ PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */ }; /* Bit values for PgHdr.flags */ #define PGHDR_DIRTY 0x002 /* Page has changed */ #define PGHDR_NEED_SYNC 0x004 /* Fsync the rollback journal before ** writing this page to the database */ #define PGHDR_NEED_READ 0x008 /* Content is unread */ #define PGHDR_REUSE_UNLIKELY 0x010 /* A hint that reuse is unlikely */ #define PGHDR_DONT_WRITE 0x020 /* Do not write content to disk */ /* Initialize and shutdown the page cache subsystem */ SQLITE_PRIVATE int sqlite3PcacheInitialize(void); SQLITE_PRIVATE void sqlite3PcacheShutdown(void); /* Page cache buffer management: ** These routines implement SQLITE_CONFIG_PAGECACHE. */ SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *, int sz, int n); /* Create a new pager cache. ** Under memory stress, invoke xStress to try to make pages clean. ** Only clean and unpinned pages can be reclaimed. */ SQLITE_PRIVATE void sqlite3PcacheOpen( int szPage, /* Size of every page */ int szExtra, /* Extra space associated with each page */ int bPurgeable, /* True if pages are on backing store */ int (*xStress)(void*, PgHdr*), /* Call to try to make pages clean */ void *pStress, /* Argument to xStress */ PCache *pToInit /* Preallocated space for the PCache */ ); /* Modify the page-size after the cache has been created. */ SQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *, int); /* Return the size in bytes of a PCache object. Used to preallocate ** storage space. */ SQLITE_PRIVATE int sqlite3PcacheSize(void); /* One release per successful fetch. Page is pinned until released. ** Reference counted. */ SQLITE_PRIVATE int sqlite3PcacheFetch(PCache*, Pgno, int createFlag, PgHdr**); SQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr*); SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */ SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr*); /* Make sure page is marked dirty */ SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr*); /* Mark a single page as clean */ SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache*); /* Mark all dirty list pages as clean */ /* Change a page number. Used by incr-vacuum. */ SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr*, Pgno); /* Remove all pages with pgno>x. Reset the cache if x==0 */ SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache*, Pgno x); /* Get a list of all dirty pages in the cache, sorted by page number */ SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache*); /* Reset and close the cache object */ SQLITE_PRIVATE void sqlite3PcacheClose(PCache*); /* Clear flags from pages of the page cache */ SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *); /* Discard the contents of the cache */ SQLITE_PRIVATE void sqlite3PcacheClear(PCache*); /* Return the total number of outstanding page references */ SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*); /* Increment the reference count of an existing page */ SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*); SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*); /* Return the total number of pages stored in the cache */ SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*); #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG) /* Iterate through all dirty pages currently stored in the cache. This ** interface is only available if SQLITE_CHECK_PAGES is defined when the ** library is built. */ SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)); #endif /* Set and get the suggested cache-size for the specified pager-cache. ** ** If no global maximum is configured, then the system attempts to limit ** the total number of pages cached by purgeable pager-caches to the sum ** of the suggested cache-sizes. */ SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *, int); #ifdef SQLITE_TEST SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *); #endif #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT /* Try to return memory used by the pcache module to the main memory heap */ SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int); #endif #ifdef SQLITE_TEST SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*); #endif SQLITE_PRIVATE void sqlite3PCacheSetDefault(void); #endif /* _PCACHE_H_ */ /************** End of pcache.h **********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include os.h in the middle of sqliteInt.h ********************/ /************** Begin file os.h **********************************************/ /* ** 2001 September 16 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This header file (together with is companion C source-code file ** "os.c") attempt to abstract the underlying operating system so that ** the SQLite library will work on both POSIX and windows systems. ** ** This header file is #include-ed by sqliteInt.h and thus ends up ** being included by every source file. */ #ifndef _SQLITE_OS_H_ #define _SQLITE_OS_H_ /* ** Figure out if we are dealing with Unix, Windows, or some other ** operating system. After the following block of preprocess macros, ** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER ** will defined to either 1 or 0. One of the four will be 1. The other ** three will be 0. */ #if defined(SQLITE_OS_OTHER) # if SQLITE_OS_OTHER==1 # undef SQLITE_OS_UNIX # define SQLITE_OS_UNIX 0 # undef SQLITE_OS_WIN # define SQLITE_OS_WIN 0 # undef SQLITE_OS_OS2 # define SQLITE_OS_OS2 0 # else # undef SQLITE_OS_OTHER # endif #endif #if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) # define SQLITE_OS_OTHER 0 # ifndef SQLITE_OS_WIN # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) # define SQLITE_OS_WIN 1 # define SQLITE_OS_UNIX 0 # define SQLITE_OS_OS2 0 # elif defined(__EMX__) || defined(_OS2) || defined(OS2) || defined(_OS2_) || defined(__OS2__) # define SQLITE_OS_WIN 0 # define SQLITE_OS_UNIX 0 # define SQLITE_OS_OS2 1 # else # define SQLITE_OS_WIN 0 # define SQLITE_OS_UNIX 1 # define SQLITE_OS_OS2 0 # endif # else # define SQLITE_OS_UNIX 0 # define SQLITE_OS_OS2 0 # endif #else # ifndef SQLITE_OS_WIN # define SQLITE_OS_WIN 0 # endif #endif /* ** Determine if we are dealing with WindowsCE - which has a much ** reduced API. */ #if defined(_WIN32_WCE) # define SQLITE_OS_WINCE 1 #else # define SQLITE_OS_WINCE 0 #endif /* ** Define the maximum size of a temporary filename */ #if SQLITE_OS_WIN # include # define SQLITE_TEMPNAME_SIZE (MAX_PATH+50) #elif SQLITE_OS_OS2 # if (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3) && defined(OS2_HIGH_MEMORY) # include /* has to be included before os2.h for linking to work */ # endif # define INCL_DOSDATETIME # define INCL_DOSFILEMGR # define INCL_DOSERRORS # define INCL_DOSMISC # define INCL_DOSPROCESS # define INCL_DOSMODULEMGR # define INCL_DOSSEMAPHORES # include # include # define SQLITE_TEMPNAME_SIZE (CCHMAXPATHCOMP) #else # define SQLITE_TEMPNAME_SIZE 200 #endif /* If the SET_FULLSYNC macro is not defined above, then make it ** a no-op */ #ifndef SET_FULLSYNC # define SET_FULLSYNC(x,y) #endif /* ** The default size of a disk sector */ #ifndef SQLITE_DEFAULT_SECTOR_SIZE # define SQLITE_DEFAULT_SECTOR_SIZE 512 #endif /* ** Temporary files are named starting with this prefix followed by 16 random ** alphanumeric characters, and no file extension. They are stored in the ** OS's standard temporary file directory, and are deleted prior to exit. ** If sqlite is being embedded in another program, you may wish to change the ** prefix to reflect your program's name, so that if your program exits ** prematurely, old temporary files can be easily identified. This can be done ** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line. ** ** 2006-10-31: The default prefix used to be "sqlite_". But then ** Mcafee started using SQLite in their anti-virus product and it ** started putting files with the "sqlite" name in the c:/temp folder. ** This annoyed many windows users. Those users would then do a ** Google search for "sqlite", find the telephone numbers of the ** developers and call to wake them up at night and complain. ** For this reason, the default name prefix is changed to be "sqlite" ** spelled backwards. So the temp files are still identified, but ** anybody smart enough to figure out the code is also likely smart ** enough to know that calling the developer will not help get rid ** of the file. */ #ifndef SQLITE_TEMP_FILE_PREFIX # define SQLITE_TEMP_FILE_PREFIX "etilqs_" #endif /* ** The following values may be passed as the second argument to ** sqlite3OsLock(). The various locks exhibit the following semantics: ** ** SHARED: Any number of processes may hold a SHARED lock simultaneously. ** RESERVED: A single process may hold a RESERVED lock on a file at ** any time. Other processes may hold and obtain new SHARED locks. ** PENDING: A single process may hold a PENDING lock on a file at ** any one time. Existing SHARED locks may persist, but no new ** SHARED locks may be obtained by other processes. ** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks. ** ** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a ** process that requests an EXCLUSIVE lock may actually obtain a PENDING ** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to ** sqlite3OsLock(). */ #define NO_LOCK 0 #define SHARED_LOCK 1 #define RESERVED_LOCK 2 #define PENDING_LOCK 3 #define EXCLUSIVE_LOCK 4 /* ** File Locking Notes: (Mostly about windows but also some info for Unix) ** ** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because ** those functions are not available. So we use only LockFile() and ** UnlockFile(). ** ** LockFile() prevents not just writing but also reading by other processes. ** A SHARED_LOCK is obtained by locking a single randomly-chosen ** byte out of a specific range of bytes. The lock byte is obtained at ** random so two separate readers can probably access the file at the ** same time, unless they are unlucky and choose the same lock byte. ** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range. ** There can only be one writer. A RESERVED_LOCK is obtained by locking ** a single byte of the file that is designated as the reserved lock byte. ** A PENDING_LOCK is obtained by locking a designated byte different from ** the RESERVED_LOCK byte. ** ** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available, ** which means we can use reader/writer locks. When reader/writer locks ** are used, the lock is placed on the same range of bytes that is used ** for probabilistic locking in Win95/98/ME. Hence, the locking scheme ** will support two or more Win95 readers or two or more WinNT readers. ** But a single Win95 reader will lock out all WinNT readers and a single ** WinNT reader will lock out all other Win95 readers. ** ** The following #defines specify the range of bytes used for locking. ** SHARED_SIZE is the number of bytes available in the pool from which ** a random byte is selected for a shared lock. The pool of bytes for ** shared locks begins at SHARED_FIRST. ** ** The same locking strategy and ** byte ranges are used for Unix. This leaves open the possiblity of having ** clients on win95, winNT, and unix all talking to the same shared file ** and all locking correctly. To do so would require that samba (or whatever ** tool is being used for file sharing) implements locks correctly between ** windows and unix. I'm guessing that isn't likely to happen, but by ** using the same locking range we are at least open to the possibility. ** ** Locking in windows is manditory. For this reason, we cannot store ** actual data in the bytes used for locking. The pager never allocates ** the pages involved in locking therefore. SHARED_SIZE is selected so ** that all locks will fit on a single page even at the minimum page size. ** PENDING_BYTE defines the beginning of the locks. By default PENDING_BYTE ** is set high so that we don't have to allocate an unused page except ** for very large databases. But one should test the page skipping logic ** by setting PENDING_BYTE low and running the entire regression suite. ** ** Changing the value of PENDING_BYTE results in a subtly incompatible ** file format. Depending on how it is changed, you might not notice ** the incompatibility right away, even running a full regression test. ** The default location of PENDING_BYTE is the first byte past the ** 1GB boundary. ** */ #ifdef SQLITE_OMIT_WSD # define PENDING_BYTE (0x40000000) #else # define PENDING_BYTE sqlite3PendingByte #endif #define RESERVED_BYTE (PENDING_BYTE+1) #define SHARED_FIRST (PENDING_BYTE+2) #define SHARED_SIZE 510 /* ** Wrapper around OS specific sqlite3_os_init() function. */ SQLITE_PRIVATE int sqlite3OsInit(void); /* ** Functions for accessing sqlite3_file methods */ SQLITE_PRIVATE int sqlite3OsClose(sqlite3_file*); SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset); SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset); SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file*, i64 size); SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file*, int); SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file*, i64 *pSize); SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file*, int); SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file*, int); SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut); SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file*,int,void*); #define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0 SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id); SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id); SQLITE_PRIVATE int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **); SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int, int, int); SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id); SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int); /* ** Functions for accessing sqlite3_vfs methods */ SQLITE_PRIVATE int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *); SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *, const char *, int); SQLITE_PRIVATE int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut); SQLITE_PRIVATE int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *); #ifndef SQLITE_OMIT_LOAD_EXTENSION SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *, const char *); SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *, int, char *); SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void); SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *, void *); #endif /* SQLITE_OMIT_LOAD_EXTENSION */ SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *, int, char *); SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *, int); SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64*); /* ** Convenience functions for opening and closing files using ** sqlite3_malloc() to obtain space for the file-handle structure. */ SQLITE_PRIVATE int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*); SQLITE_PRIVATE int sqlite3OsCloseFree(sqlite3_file *); #endif /* _SQLITE_OS_H_ */ /************** End of os.h **************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /************** Include mutex.h in the middle of sqliteInt.h *****************/ /************** Begin file mutex.h *******************************************/ /* ** 2007 August 28 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains the common header for all mutex implementations. ** The sqliteInt.h header #includes this file so that it is available ** to all source files. We break it out in an effort to keep the code ** better organized. ** ** NOTE: source files should *not* #include this header file directly. ** Source files should #include the sqliteInt.h file and let that file ** include this one indirectly. */ /* ** Figure out what version of the code to use. The choices are ** ** SQLITE_MUTEX_OMIT No mutex logic. Not even stubs. The ** mutexes implemention cannot be overridden ** at start-time. ** ** SQLITE_MUTEX_NOOP For single-threaded applications. No ** mutual exclusion is provided. But this ** implementation can be overridden at ** start-time. ** ** SQLITE_MUTEX_PTHREADS For multi-threaded applications on Unix. ** ** SQLITE_MUTEX_W32 For multi-threaded applications on Win32. ** ** SQLITE_MUTEX_OS2 For multi-threaded applications on OS/2. */ #if !SQLITE_THREADSAFE # define SQLITE_MUTEX_OMIT #endif #if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP) # if SQLITE_OS_UNIX # define SQLITE_MUTEX_PTHREADS # elif SQLITE_OS_WIN # define SQLITE_MUTEX_W32 # elif SQLITE_OS_OS2 # define SQLITE_MUTEX_OS2 # else # define SQLITE_MUTEX_NOOP # endif #endif #ifdef SQLITE_MUTEX_OMIT /* ** If this is a no-op implementation, implement everything as macros. */ #define sqlite3_mutex_alloc(X) ((sqlite3_mutex*)8) #define sqlite3_mutex_free(X) #define sqlite3_mutex_enter(X) #define sqlite3_mutex_try(X) SQLITE_OK #define sqlite3_mutex_leave(X) #define sqlite3_mutex_held(X) ((void)(X),1) #define sqlite3_mutex_notheld(X) ((void)(X),1) #define sqlite3MutexAlloc(X) ((sqlite3_mutex*)8) #define sqlite3MutexInit() SQLITE_OK #define sqlite3MutexEnd() #endif /* defined(SQLITE_MUTEX_OMIT) */ /************** End of mutex.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /* ** Each database file to be accessed by the system is an instance ** of the following structure. There are normally two of these structures ** in the sqlite.aDb[] array. aDb[0] is the main database file and ** aDb[1] is the database file used to hold temporary tables. Additional ** databases may be attached. */ struct Db { char *zName; /* Name of this database */ Btree *pBt; /* The B*Tree structure for this database file */ u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */ u8 safety_level; /* How aggressive at syncing data to disk */ Schema *pSchema; /* Pointer to database schema (possibly shared) */ }; /* ** An instance of the following structure stores a database schema. */ struct Schema { int schema_cookie; /* Database schema version number for this file */ Hash tblHash; /* All tables indexed by name */ Hash idxHash; /* All (named) indices indexed by name */ Hash trigHash; /* All triggers indexed by name */ Hash fkeyHash; /* All foreign keys by referenced table name */ Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */ u8 file_format; /* Schema format version for this file */ u8 enc; /* Text encoding used by this database */ u16 flags; /* Flags associated with this schema */ int cache_size; /* Number of pages to use in the cache */ }; /* ** These macros can be used to test, set, or clear bits in the ** Db.pSchema->flags field. */ #define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))==(P)) #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))!=0) #define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->flags|=(P) #define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->flags&=~(P) /* ** Allowed values for the DB.pSchema->flags field. ** ** The DB_SchemaLoaded flag is set after the database schema has been ** read into internal hash tables. ** ** DB_UnresetViews means that one or more views have column names that ** have been filled out. If the schema changes, these column names might ** changes and so the view will need to be reset. */ #define DB_SchemaLoaded 0x0001 /* The schema has been loaded */ #define DB_UnresetViews 0x0002 /* Some views have defined column names */ #define DB_Empty 0x0004 /* The file is empty (length 0 bytes) */ /* ** The number of different kinds of things that can be limited ** using the sqlite3_limit() interface. */ #define SQLITE_N_LIMIT (SQLITE_LIMIT_TRIGGER_DEPTH+1) /* ** Lookaside malloc is a set of fixed-size buffers that can be used ** to satisfy small transient memory allocation requests for objects ** associated with a particular database connection. The use of ** lookaside malloc provides a significant performance enhancement ** (approx 10%) by avoiding numerous malloc/free requests while parsing ** SQL statements. ** ** The Lookaside structure holds configuration information about the ** lookaside malloc subsystem. Each available memory allocation in ** the lookaside subsystem is stored on a linked list of LookasideSlot ** objects. ** ** Lookaside allocations are only allowed for objects that are associated ** with a particular database connection. Hence, schema information cannot ** be stored in lookaside because in shared cache mode the schema information ** is shared by multiple database connections. Therefore, while parsing ** schema information, the Lookaside.bEnabled flag is cleared so that ** lookaside allocations are not used to construct the schema objects. */ struct Lookaside { u16 sz; /* Size of each buffer in bytes */ u8 bEnabled; /* False to disable new lookaside allocations */ u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */ int nOut; /* Number of buffers currently checked out */ int mxOut; /* Highwater mark for nOut */ LookasideSlot *pFree; /* List of available buffers */ void *pStart; /* First byte of available memory space */ void *pEnd; /* First byte past end of available space */ }; struct LookasideSlot { LookasideSlot *pNext; /* Next buffer in the list of free buffers */ }; /* ** A hash table for function definitions. ** ** Hash each FuncDef structure into one of the FuncDefHash.a[] slots. ** Collisions are on the FuncDef.pHash chain. */ struct FuncDefHash { FuncDef *a[23]; /* Hash table for functions */ }; /* ** Each database connection is an instance of the following structure. ** ** The sqlite.lastRowid records the last insert rowid generated by an ** insert statement. Inserts on views do not affect its value. Each ** trigger has its own context, so that lastRowid can be updated inside ** triggers as usual. The previous value will be restored once the trigger ** exits. Upon entering a before or instead of trigger, lastRowid is no ** longer (since after version 2.8.12) reset to -1. ** ** The sqlite.nChange does not count changes within triggers and keeps no ** context. It is reset at start of sqlite3_exec. ** The sqlite.lsChange represents the number of changes made by the last ** insert, update, or delete statement. It remains constant throughout the ** length of a statement and is then updated by OP_SetCounts. It keeps a ** context stack just like lastRowid so that the count of changes ** within a trigger is not seen outside the trigger. Changes to views do not ** affect the value of lsChange. ** The sqlite.csChange keeps track of the number of current changes (since ** the last statement) and is used to update sqlite_lsChange. ** ** The member variables sqlite.errCode, sqlite.zErrMsg and sqlite.zErrMsg16 ** store the most recent error code and, if applicable, string. The ** internal function sqlite3Error() is used to set these variables ** consistently. */ struct sqlite3 { sqlite3_vfs *pVfs; /* OS Interface */ int nDb; /* Number of backends currently in use */ Db *aDb; /* All backends */ int flags; /* Miscellaneous flags. See below */ int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ int errCode; /* Most recent error code (SQLITE_*) */ int errMask; /* & result codes with this before returning */ u8 autoCommit; /* The auto-commit flag. */ u8 temp_store; /* 1: file 2: memory 0: default */ u8 mallocFailed; /* True if we have seen a malloc failure */ u8 dfltLockMode; /* Default locking-mode for attached dbs */ signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ u8 suppressErr; /* Do not issue error messages if true */ int nextPagesize; /* Pagesize after VACUUM if >0 */ int nTable; /* Number of tables in the database */ CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ i64 lastRowid; /* ROWID of most recent insert (see above) */ u32 magic; /* Magic number for detect library misuse */ int nChange; /* Value returned by sqlite3_changes() */ int nTotalChange; /* Value returned by sqlite3_total_changes() */ sqlite3_mutex *mutex; /* Connection mutex */ int aLimit[SQLITE_N_LIMIT]; /* Limits */ struct sqlite3InitInfo { /* Information used during initialization */ int iDb; /* When back is being initialized */ int newTnum; /* Rootpage of table being initialized */ u8 busy; /* TRUE if currently initializing */ u8 orphanTrigger; /* Last statement is orphaned TEMP trigger */ } init; int nExtension; /* Number of loaded extensions */ void **aExtension; /* Array of shared library handles */ struct Vdbe *pVdbe; /* List of active virtual machines */ int activeVdbeCnt; /* Number of VDBEs currently executing */ int writeVdbeCnt; /* Number of active VDBEs that are writing */ void (*xTrace)(void*,const char*); /* Trace function */ void *pTraceArg; /* Argument to the trace function */ void (*xProfile)(void*,const char*,u64); /* Profiling function */ void *pProfileArg; /* Argument to profile function */ void *pCommitArg; /* Argument to xCommitCallback() */ int (*xCommitCallback)(void*); /* Invoked at every commit. */ void *pRollbackArg; /* Argument to xRollbackCallback() */ void (*xRollbackCallback)(void*); /* Invoked at every commit. */ void *pUpdateArg; void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64); #ifndef SQLITE_OMIT_WAL int (*xWalCallback)(void *, sqlite3 *, const char *, int); void *pWalArg; #endif void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*); void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*); void *pCollNeededArg; sqlite3_value *pErr; /* Most recent error message */ char *zErrMsg; /* Most recent error message (UTF-8 encoded) */ char *zErrMsg16; /* Most recent error message (UTF-16 encoded) */ union { volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ double notUsed1; /* Spacer */ } u1; Lookaside lookaside; /* Lookaside malloc configuration */ #ifndef SQLITE_OMIT_AUTHORIZATION int (*xAuth)(void*,int,const char*,const char*,const char*,const char*); /* Access authorization function */ void *pAuthArg; /* 1st argument to the access auth function */ #endif #ifndef SQLITE_OMIT_PROGRESS_CALLBACK int (*xProgress)(void *); /* The progress callback */ void *pProgressArg; /* Argument to the progress callback */ int nProgressOps; /* Number of opcodes for progress callback */ #endif #ifndef SQLITE_OMIT_VIRTUALTABLE Hash aModule; /* populated by sqlite3_create_module() */ Table *pVTab; /* vtab with active Connect/Create method */ VTable **aVTrans; /* Virtual tables with open transactions */ int nVTrans; /* Allocated size of aVTrans */ VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */ #endif FuncDefHash aFunc; /* Hash table of connection functions */ Hash aCollSeq; /* All collating sequences */ BusyHandler busyHandler; /* Busy callback */ int busyTimeout; /* Busy handler timeout, in msec */ Db aDbStatic[2]; /* Static space for the 2 default backends */ Savepoint *pSavepoint; /* List of active savepoints */ int nSavepoint; /* Number of non-transaction savepoints */ int nStatement; /* Number of nested statement-transactions */ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ i64 nDeferredCons; /* Net deferred constraints this transaction. */ int *pnBytesFreed; /* If not NULL, increment this in DbFree() */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY /* The following variables are all protected by the STATIC_MASTER ** mutex, not by sqlite3.mutex. They are used by code in notify.c. ** ** When X.pUnlockConnection==Y, that means that X is waiting for Y to ** unlock so that it can proceed. ** ** When X.pBlockingConnection==Y, that means that something that X tried ** tried to do recently failed with an SQLITE_LOCKED error due to locks ** held by Y. */ sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */ sqlite3 *pUnlockConnection; /* Connection to watch for unlock */ void *pUnlockArg; /* Argument to xUnlockNotify */ void (*xUnlockNotify)(void **, int); /* Unlock notify callback */ sqlite3 *pNextBlocked; /* Next in list of all blocked connections */ #endif }; /* ** A macro to discover the encoding of a database. */ #define ENC(db) ((db)->aDb[0].pSchema->enc) /* ** Possible values for the sqlite3.flags. */ #define SQLITE_VdbeTrace 0x00000100 /* True to trace VDBE execution */ #define SQLITE_InternChanges 0x00000200 /* Uncommitted Hash table changes */ #define SQLITE_FullColNames 0x00000400 /* Show full column names on SELECT */ #define SQLITE_ShortColNames 0x00000800 /* Show short columns names */ #define SQLITE_CountRows 0x00001000 /* Count rows changed by INSERT, */ /* DELETE, or UPDATE and return */ /* the count using a callback. */ #define SQLITE_NullCallback 0x00002000 /* Invoke the callback once if the */ /* result set is empty */ #define SQLITE_SqlTrace 0x00004000 /* Debug print SQL as it executes */ #define SQLITE_VdbeListing 0x00008000 /* Debug listings of VDBE programs */ #define SQLITE_WriteSchema 0x00010000 /* OK to update SQLITE_MASTER */ #define SQLITE_NoReadlock 0x00020000 /* Readlocks are omitted when ** accessing read-only databases */ #define SQLITE_IgnoreChecks 0x00040000 /* Do not enforce check constraints */ #define SQLITE_ReadUncommitted 0x0080000 /* For shared-cache mode */ #define SQLITE_LegacyFileFmt 0x00100000 /* Create new databases in format 1 */ #define SQLITE_FullFSync 0x00200000 /* Use full fsync on the backend */ #define SQLITE_CkptFullFSync 0x00400000 /* Use full fsync for checkpoint */ #define SQLITE_RecoveryMode 0x00800000 /* Ignore schema errors */ #define SQLITE_ReverseOrder 0x01000000 /* Reverse unordered SELECTs */ #define SQLITE_RecTriggers 0x02000000 /* Enable recursive triggers */ #define SQLITE_ForeignKeys 0x04000000 /* Enforce foreign key constraints */ #define SQLITE_AutoIndex 0x08000000 /* Enable automatic indexes */ #define SQLITE_PreferBuiltin 0x10000000 /* Preference to built-in funcs */ #define SQLITE_LoadExtension 0x20000000 /* Enable load_extension */ /* ** Bits of the sqlite3.flags field that are used by the ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface. ** These must be the low-order bits of the flags field. */ #define SQLITE_QueryFlattener 0x01 /* Disable query flattening */ #define SQLITE_ColumnCache 0x02 /* Disable the column cache */ #define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ #define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ #define SQLITE_IndexCover 0x10 /* Disable index covering table */ #define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ #define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */ #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ /* ** Possible values for the sqlite.magic field. ** The numbers are obtained at random and have no special meaning, other ** than being distinct from one another. */ #define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ #define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */ #define SQLITE_MAGIC_SICK 0x4b771290 /* Error and awaiting close */ #define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */ #define SQLITE_MAGIC_ERROR 0xb5357930 /* An SQLITE_MISUSE error occurred */ /* ** Each SQL function is defined by an instance of the following ** structure. A pointer to this structure is stored in the sqlite.aFunc ** hash table. When multiple functions have the same name, the hash table ** points to a linked list of these structures. */ struct FuncDef { i16 nArg; /* Number of arguments. -1 means unlimited */ u8 iPrefEnc; /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */ u8 flags; /* Some combination of SQLITE_FUNC_* */ void *pUserData; /* User data parameter */ FuncDef *pNext; /* Next function with same name */ void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */ void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */ void (*xFinalize)(sqlite3_context*); /* Aggregate finalizer */ char *zName; /* SQL name of the function. */ FuncDef *pHash; /* Next with a different name but the same hash */ FuncDestructor *pDestructor; /* Reference counted destructor function */ }; /* ** This structure encapsulates a user-function destructor callback (as ** configured using create_function_v2()) and a reference counter. When ** create_function_v2() is called to create a function with a destructor, ** a single object of this type is allocated. FuncDestructor.nRef is set to ** the number of FuncDef objects created (either 1 or 3, depending on whether ** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor ** member of each of the new FuncDef objects is set to point to the allocated ** FuncDestructor. ** ** Thereafter, when one of the FuncDef objects is deleted, the reference ** count on this object is decremented. When it reaches 0, the destructor ** is invoked and the FuncDestructor structure freed. */ struct FuncDestructor { int nRef; void (*xDestroy)(void *); void *pUserData; }; /* ** Possible values for FuncDef.flags */ #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */ #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */ #define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */ #define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */ #define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */ /* ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are ** used to create the initializers for the FuncDef structures. ** ** FUNCTION(zName, nArg, iArg, bNC, xFunc) ** Used to create a scalar function definition of a function zName ** implemented by C function xFunc that accepts nArg arguments. The ** value passed as iArg is cast to a (void*) and made available ** as the user-data (sqlite3_user_data()) for the function. If ** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set. ** ** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) ** Used to create an aggregate function definition implemented by ** the C functions xStep and xFinal. The first four parameters ** are interpreted in the same way as the first 4 parameters to ** FUNCTION(). ** ** LIKEFUNC(zName, nArg, pArg, flags) ** Used to create a scalar function definition of a function zName ** that accepts nArg arguments and is implemented by a call to C ** function likeFunc. Argument pArg is cast to a (void *) and made ** available as the function user-data (sqlite3_user_data()). The ** FuncDef.flags variable is set to the value passed as the flags ** parameter. */ #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} #define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ pArg, 0, xFunc, 0, 0, #zName, 0, 0} #define LIKEFUNC(zName, nArg, arg, flags) \ {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName, 0, 0} #define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ {nArg, SQLITE_UTF8, nc*SQLITE_FUNC_NEEDCOLL, \ SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0,0} /* ** All current savepoints are stored in a linked list starting at ** sqlite3.pSavepoint. The first element in the list is the most recently ** opened savepoint. Savepoints are added to the list by the vdbe ** OP_Savepoint instruction. */ struct Savepoint { char *zName; /* Savepoint name (nul-terminated) */ i64 nDeferredCons; /* Number of deferred fk violations */ Savepoint *pNext; /* Parent savepoint (if any) */ }; /* ** The following are used as the second parameter to sqlite3Savepoint(), ** and as the P1 argument to the OP_Savepoint instruction. */ #define SAVEPOINT_BEGIN 0 #define SAVEPOINT_RELEASE 1 #define SAVEPOINT_ROLLBACK 2 /* ** Each SQLite module (virtual table definition) is defined by an ** instance of the following structure, stored in the sqlite3.aModule ** hash table. */ struct Module { const sqlite3_module *pModule; /* Callback pointers */ const char *zName; /* Name passed to create_module() */ void *pAux; /* pAux passed to create_module() */ void (*xDestroy)(void *); /* Module destructor function */ }; /* ** information about each column of an SQL table is held in an instance ** of this structure. */ struct Column { char *zName; /* Name of this column */ Expr *pDflt; /* Default value of this column */ char *zDflt; /* Original text of the default value */ char *zType; /* Data type for this column */ char *zColl; /* Collating sequence. If NULL, use the default */ u8 notNull; /* True if there is a NOT NULL constraint */ u8 isPrimKey; /* True if this column is part of the PRIMARY KEY */ char affinity; /* One of the SQLITE_AFF_... values */ #ifndef SQLITE_OMIT_VIRTUALTABLE u8 isHidden; /* True if this column is 'hidden' */ #endif }; /* ** A "Collating Sequence" is defined by an instance of the following ** structure. Conceptually, a collating sequence consists of a name and ** a comparison routine that defines the order of that sequence. ** ** There may two separate implementations of the collation function, one ** that processes text in UTF-8 encoding (CollSeq.xCmp) and another that ** processes text encoded in UTF-16 (CollSeq.xCmp16), using the machine ** native byte order. When a collation sequence is invoked, SQLite selects ** the version that will require the least expensive encoding ** translations, if any. ** ** The CollSeq.pUser member variable is an extra parameter that passed in ** as the first argument to the UTF-8 comparison function, xCmp. ** CollSeq.pUser16 is the equivalent for the UTF-16 comparison function, ** xCmp16. ** ** If both CollSeq.xCmp and CollSeq.xCmp16 are NULL, it means that the ** collating sequence is undefined. Indices built on an undefined ** collating sequence may not be read or written. */ struct CollSeq { char *zName; /* Name of the collating sequence, UTF-8 encoded */ u8 enc; /* Text encoding handled by xCmp() */ u8 type; /* One of the SQLITE_COLL_... values below */ void *pUser; /* First argument to xCmp() */ int (*xCmp)(void*,int, const void*, int, const void*); void (*xDel)(void*); /* Destructor for pUser */ }; /* ** Allowed values of CollSeq.type: */ #define SQLITE_COLL_BINARY 1 /* The default memcmp() collating sequence */ #define SQLITE_COLL_NOCASE 2 /* The built-in NOCASE collating sequence */ #define SQLITE_COLL_REVERSE 3 /* The built-in REVERSE collating sequence */ #define SQLITE_COLL_USER 0 /* Any other user-defined collating sequence */ /* ** A sort order can be either ASC or DESC. */ #define SQLITE_SO_ASC 0 /* Sort in ascending order */ #define SQLITE_SO_DESC 1 /* Sort in ascending order */ /* ** Column affinity types. ** ** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and ** 't' for SQLITE_AFF_TEXT. But we can save a little space and improve ** the speed a little by numbering the values consecutively. ** ** But rather than start with 0 or 1, we begin with 'a'. That way, ** when multiple affinity types are concatenated into a string and ** used as the P4 operand, they will be more readable. ** ** Note also that the numeric types are grouped together so that testing ** for a numeric type is a single comparison. */ #define SQLITE_AFF_TEXT 'a' #define SQLITE_AFF_NONE 'b' #define SQLITE_AFF_NUMERIC 'c' #define SQLITE_AFF_INTEGER 'd' #define SQLITE_AFF_REAL 'e' #define sqlite3IsNumericAffinity(X) ((X)>=SQLITE_AFF_NUMERIC) /* ** The SQLITE_AFF_MASK values masks off the significant bits of an ** affinity value. */ #define SQLITE_AFF_MASK 0x67 /* ** Additional bit values that can be ORed with an affinity without ** changing the affinity. */ #define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */ #define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */ #define SQLITE_NULLEQ 0x80 /* NULL=NULL */ /* ** An object of this type is created for each virtual table present in ** the database schema. ** ** If the database schema is shared, then there is one instance of this ** structure for each database connection (sqlite3*) that uses the shared ** schema. This is because each database connection requires its own unique ** instance of the sqlite3_vtab* handle used to access the virtual table ** implementation. sqlite3_vtab* handles can not be shared between ** database connections, even when the rest of the in-memory database ** schema is shared, as the implementation often stores the database ** connection handle passed to it via the xConnect() or xCreate() method ** during initialization internally. This database connection handle may ** then used by the virtual table implementation to access real tables ** within the database. So that they appear as part of the callers ** transaction, these accesses need to be made via the same database ** connection as that used to execute SQL operations on the virtual table. ** ** All VTable objects that correspond to a single table in a shared ** database schema are initially stored in a linked-list pointed to by ** the Table.pVTable member variable of the corresponding Table object. ** When an sqlite3_prepare() operation is required to access the virtual ** table, it searches the list for the VTable that corresponds to the ** database connection doing the preparing so as to use the correct ** sqlite3_vtab* handle in the compiled query. ** ** When an in-memory Table object is deleted (for example when the ** schema is being reloaded for some reason), the VTable objects are not ** deleted and the sqlite3_vtab* handles are not xDisconnect()ed ** immediately. Instead, they are moved from the Table.pVTable list to ** another linked list headed by the sqlite3.pDisconnect member of the ** corresponding sqlite3 structure. They are then deleted/xDisconnected ** next time a statement is prepared using said sqlite3*. This is done ** to avoid deadlock issues involving multiple sqlite3.mutex mutexes. ** Refer to comments above function sqlite3VtabUnlockList() for an ** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect ** list without holding the corresponding sqlite3.mutex mutex. ** ** The memory for objects of this type is always allocated by ** sqlite3DbMalloc(), using the connection handle stored in VTable.db as ** the first argument. */ struct VTable { sqlite3 *db; /* Database connection associated with this table */ Module *pMod; /* Pointer to module implementation */ sqlite3_vtab *pVtab; /* Pointer to vtab instance */ int nRef; /* Number of pointers to this structure */ VTable *pNext; /* Next in linked list (see above) */ }; /* ** Each SQL table is represented in memory by an instance of the ** following structure. ** ** Table.zName is the name of the table. The case of the original ** CREATE TABLE statement is stored, but case is not significant for ** comparisons. ** ** Table.nCol is the number of columns in this table. Table.aCol is a ** pointer to an array of Column structures, one for each column. ** ** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of ** the column that is that key. Otherwise Table.iPKey is negative. Note ** that the datatype of the PRIMARY KEY must be INTEGER for this field to ** be set. An INTEGER PRIMARY KEY is used as the rowid for each row of ** the table. If a table has no INTEGER PRIMARY KEY, then a random rowid ** is generated for each row of the table. TF_HasPrimaryKey is set if ** the table has any PRIMARY KEY, INTEGER or otherwise. ** ** Table.tnum is the page number for the root BTree page of the table in the ** database file. If Table.iDb is the index of the database table backend ** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that ** holds temporary tables and indices. If TF_Ephemeral is set ** then the table is stored in a file that is automatically deleted ** when the VDBE cursor to the table is closed. In this case Table.tnum ** refers VDBE cursor number that holds the table open, not to the root ** page number. Transient tables are used to hold the results of a ** sub-query that appears instead of a real table name in the FROM clause ** of a SELECT statement. */ struct Table { char *zName; /* Name of the table or view */ int iPKey; /* If not negative, use aCol[iPKey] as the primary key */ int nCol; /* Number of columns in this table */ Column *aCol; /* Information about each column */ Index *pIndex; /* List of SQL indexes on this table. */ int tnum; /* Root BTree node for this table (see note above) */ unsigned nRowEst; /* Estimated rows in table - from sqlite_stat1 table */ Select *pSelect; /* NULL for tables. Points to definition if a view. */ u16 nRef; /* Number of pointers to this Table */ u8 tabFlags; /* Mask of TF_* values */ u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ FKey *pFKey; /* Linked list of all foreign keys in this table */ char *zColAff; /* String defining the affinity of each column */ #ifndef SQLITE_OMIT_CHECK Expr *pCheck; /* The AND of all CHECK constraints */ #endif #ifndef SQLITE_OMIT_ALTERTABLE int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ #endif #ifndef SQLITE_OMIT_VIRTUALTABLE VTable *pVTable; /* List of VTable objects. */ int nModuleArg; /* Number of arguments to the module */ char **azModuleArg; /* Text of all module args. [0] is module name */ #endif Trigger *pTrigger; /* List of triggers stored in pSchema */ Schema *pSchema; /* Schema that contains this table */ Table *pNextZombie; /* Next on the Parse.pZombieTab list */ }; /* ** Allowed values for Tabe.tabFlags. */ #define TF_Readonly 0x01 /* Read-only system table */ #define TF_Ephemeral 0x02 /* An ephemeral table */ #define TF_HasPrimaryKey 0x04 /* Table has a primary key */ #define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */ #define TF_Virtual 0x10 /* Is a virtual table */ #define TF_NeedMetadata 0x20 /* aCol[].zType and aCol[].pColl missing */ /* ** Test to see whether or not a table is a virtual table. This is ** done as a macro so that it will be optimized out when virtual ** table support is omitted from the build. */ #ifndef SQLITE_OMIT_VIRTUALTABLE # define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0) # define IsHiddenColumn(X) ((X)->isHidden) #else # define IsVirtual(X) 0 # define IsHiddenColumn(X) 0 #endif /* ** Each foreign key constraint is an instance of the following structure. ** ** A foreign key is associated with two tables. The "from" table is ** the table that contains the REFERENCES clause that creates the foreign ** key. The "to" table is the table that is named in the REFERENCES clause. ** Consider this example: ** ** CREATE TABLE ex1( ** a INTEGER PRIMARY KEY, ** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) ** ); ** ** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". ** ** Each REFERENCES clause generates an instance of the following structure ** which is attached to the from-table. The to-table need not exist when ** the from-table is created. The existence of the to-table is not checked. */ struct FKey { Table *pFrom; /* Table containing the REFERENCES clause (aka: Child) */ FKey *pNextFrom; /* Next foreign key in pFrom */ char *zTo; /* Name of table that the key points to (aka: Parent) */ FKey *pNextTo; /* Next foreign key on table named zTo */ FKey *pPrevTo; /* Previous foreign key on table named zTo */ int nCol; /* Number of columns in this key */ /* EV: R-30323-21917 */ u8 isDeferred; /* True if constraint checking is deferred till COMMIT */ u8 aAction[2]; /* ON DELETE and ON UPDATE actions, respectively */ Trigger *apTrigger[2]; /* Triggers for aAction[] actions */ struct sColMap { /* Mapping of columns in pFrom to columns in zTo */ int iFrom; /* Index of column in pFrom */ char *zCol; /* Name of column in zTo. If 0 use PRIMARY KEY */ } aCol[1]; /* One entry for each of nCol column s */ }; /* ** SQLite supports many different ways to resolve a constraint ** error. ROLLBACK processing means that a constraint violation ** causes the operation in process to fail and for the current transaction ** to be rolled back. ABORT processing means the operation in process ** fails and any prior changes from that one operation are backed out, ** but the transaction is not rolled back. FAIL processing means that ** the operation in progress stops and returns an error code. But prior ** changes due to the same operation are not backed out and no rollback ** occurs. IGNORE means that the particular row that caused the constraint ** error is not inserted or updated. Processing continues and no error ** is returned. REPLACE means that preexisting database rows that caused ** a UNIQUE constraint violation are removed so that the new insert or ** update can proceed. Processing continues and no error is reported. ** ** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys. ** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the ** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign ** key is set to NULL. CASCADE means that a DELETE or UPDATE of the ** referenced table row is propagated into the row that holds the ** foreign key. ** ** The following symbolic values are used to record which type ** of action to take. */ #define OE_None 0 /* There is no constraint to check */ #define OE_Rollback 1 /* Fail the operation and rollback the transaction */ #define OE_Abort 2 /* Back out changes but do no rollback transaction */ #define OE_Fail 3 /* Stop the operation but leave all prior changes */ #define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */ #define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */ #define OE_Restrict 6 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */ #define OE_SetNull 7 /* Set the foreign key value to NULL */ #define OE_SetDflt 8 /* Set the foreign key value to its default */ #define OE_Cascade 9 /* Cascade the changes */ #define OE_Default 99 /* Do whatever the default action is */ /* ** An instance of the following structure is passed as the first ** argument to sqlite3VdbeKeyCompare and is used to control the ** comparison of the two index keys. */ struct KeyInfo { sqlite3 *db; /* The database connection */ u8 enc; /* Text encoding - one of the SQLITE_UTF* values */ u16 nField; /* Number of entries in aColl[] */ u8 *aSortOrder; /* Sort order for each column. May be NULL */ CollSeq *aColl[1]; /* Collating sequence for each term of the key */ }; /* ** An instance of the following structure holds information about a ** single index record that has already been parsed out into individual ** values. ** ** A record is an object that contains one or more fields of data. ** Records are used to store the content of a table row and to store ** the key of an index. A blob encoding of a record is created by ** the OP_MakeRecord opcode of the VDBE and is disassembled by the ** OP_Column opcode. ** ** This structure holds a record that has already been disassembled ** into its constituent fields. */ struct UnpackedRecord { KeyInfo *pKeyInfo; /* Collation and sort-order information */ u16 nField; /* Number of entries in apMem[] */ u16 flags; /* Boolean settings. UNPACKED_... below */ i64 rowid; /* Used by UNPACKED_PREFIX_SEARCH */ Mem *aMem; /* Values */ }; /* ** Allowed values of UnpackedRecord.flags */ #define UNPACKED_NEED_FREE 0x0001 /* Memory is from sqlite3Malloc() */ #define UNPACKED_NEED_DESTROY 0x0002 /* apMem[]s should all be destroyed */ #define UNPACKED_IGNORE_ROWID 0x0004 /* Ignore trailing rowid on key1 */ #define UNPACKED_INCRKEY 0x0008 /* Make this key an epsilon larger */ #define UNPACKED_PREFIX_MATCH 0x0010 /* A prefix match is considered OK */ #define UNPACKED_PREFIX_SEARCH 0x0020 /* A prefix match is considered OK */ /* ** Each SQL index is represented in memory by an ** instance of the following structure. ** ** The columns of the table that are to be indexed are described ** by the aiColumn[] field of this structure. For example, suppose ** we have the following table and index: ** ** CREATE TABLE Ex1(c1 int, c2 int, c3 text); ** CREATE INDEX Ex2 ON Ex1(c3,c1); ** ** In the Table structure describing Ex1, nCol==3 because there are ** three columns in the table. In the Index structure describing ** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed. ** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the ** first column to be indexed (c3) has an index of 2 in Ex1.aCol[]. ** The second column to be indexed (c1) has an index of 0 in ** Ex1.aCol[], hence Ex2.aiColumn[1]==0. ** ** The Index.onError field determines whether or not the indexed columns ** must be unique and what to do if they are not. When Index.onError=OE_None, ** it means this is not a unique index. Otherwise it is a unique index ** and the value of Index.onError indicate the which conflict resolution ** algorithm to employ whenever an attempt is made to insert a non-unique ** element. */ struct Index { char *zName; /* Name of this index */ int nColumn; /* Number of columns in the table used by this index */ int *aiColumn; /* Which columns are used by this index. 1st is 0 */ unsigned *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */ Table *pTable; /* The SQL table being indexed */ int tnum; /* Page containing root of this index in database file */ u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */ char *zColAff; /* String defining the affinity of each column */ Index *pNext; /* The next index associated with the same table */ Schema *pSchema; /* Schema containing this index */ u8 *aSortOrder; /* Array of size Index.nColumn. True==DESC, False==ASC */ char **azColl; /* Array of collation sequence names for index */ IndexSample *aSample; /* Array of SQLITE_INDEX_SAMPLES samples */ }; /* ** Each sample stored in the sqlite_stat2 table is represented in memory ** using a structure of this type. */ struct IndexSample { union { char *z; /* Value if eType is SQLITE_TEXT or SQLITE_BLOB */ double r; /* Value if eType is SQLITE_FLOAT or SQLITE_INTEGER */ } u; u8 eType; /* SQLITE_NULL, SQLITE_INTEGER ... etc. */ u8 nByte; /* Size in byte of text or blob. */ }; /* ** Each token coming out of the lexer is an instance of ** this structure. Tokens are also used as part of an expression. ** ** Note if Token.z==0 then Token.dyn and Token.n are undefined and ** may contain random values. Do not make any assumptions about Token.dyn ** and Token.n when Token.z==0. */ struct Token { const char *z; /* Text of the token. Not NULL-terminated! */ unsigned int n; /* Number of characters in this token */ }; /* ** An instance of this structure contains information needed to generate ** code for a SELECT that contains aggregate functions. ** ** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a ** pointer to this structure. The Expr.iColumn field is the index in ** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate ** code for that node. ** ** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the ** original Select structure that describes the SELECT statement. These ** fields do not need to be freed when deallocating the AggInfo structure. */ struct AggInfo { u8 directMode; /* Direct rendering mode means take data directly ** from source tables rather than from accumulators */ u8 useSortingIdx; /* In direct mode, reference the sorting index rather ** than the source table */ int sortingIdx; /* Cursor number of the sorting index */ ExprList *pGroupBy; /* The group by clause */ int nSortingColumn; /* Number of columns in the sorting index */ struct AggInfo_col { /* For each column used in source tables */ Table *pTab; /* Source table */ int iTable; /* Cursor number of the source table */ int iColumn; /* Column number within the source table */ int iSorterColumn; /* Column number in the sorting index */ int iMem; /* Memory location that acts as accumulator */ Expr *pExpr; /* The original expression */ } *aCol; int nColumn; /* Number of used entries in aCol[] */ int nColumnAlloc; /* Number of slots allocated for aCol[] */ int nAccumulator; /* Number of columns that show through to the output. ** Additional columns are used only as parameters to ** aggregate functions */ struct AggInfo_func { /* For each aggregate function */ Expr *pExpr; /* Expression encoding the function */ FuncDef *pFunc; /* The aggregate function implementation */ int iMem; /* Memory location that acts as accumulator */ int iDistinct; /* Ephemeral table used to enforce DISTINCT */ } *aFunc; int nFunc; /* Number of entries in aFunc[] */ int nFuncAlloc; /* Number of slots allocated for aFunc[] */ }; /* ** The datatype ynVar is a signed integer, either 16-bit or 32-bit. ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater ** than 32767 we have to make it 32-bit. 16-bit is preferred because ** it uses less memory in the Expr object, which is a big memory user ** in systems with lots of prepared statements. And few applications ** need more than about 10 or 20 variables. But some extreme users want ** to have prepared statements with over 32767 variables, and for them ** the option is available (at compile-time). */ #if SQLITE_MAX_VARIABLE_NUMBER<=32767 typedef i16 ynVar; #else typedef int ynVar; #endif /* ** Each node of an expression in the parse tree is an instance ** of this structure. ** ** Expr.op is the opcode. The integer parser token codes are reused ** as opcodes here. For example, the parser defines TK_GE to be an integer ** code representing the ">=" operator. This same integer code is reused ** to represent the greater-than-or-equal-to operator in the expression ** tree. ** ** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB, ** or TK_STRING), then Expr.token contains the text of the SQL literal. If ** the expression is a variable (TK_VARIABLE), then Expr.token contains the ** variable name. Finally, if the expression is an SQL function (TK_FUNCTION), ** then Expr.token contains the name of the function. ** ** Expr.pRight and Expr.pLeft are the left and right subexpressions of a ** binary operator. Either or both may be NULL. ** ** Expr.x.pList is a list of arguments if the expression is an SQL function, ** a CASE expression or an IN expression of the form " IN (, ...)". ** Expr.x.pSelect is used if the expression is a sub-select or an expression of ** the form " IN (SELECT ...)". If the EP_xIsSelect bit is set in the ** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is ** valid. ** ** An expression of the form ID or ID.ID refers to a column in a table. ** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is ** the integer cursor number of a VDBE cursor pointing to that table and ** Expr.iColumn is the column number for the specific column. If the ** expression is used as a result in an aggregate SELECT, then the ** value is also stored in the Expr.iAgg column in the aggregate so that ** it can be accessed after all aggregates are computed. ** ** If the expression is an unbound variable marker (a question mark ** character '?' in the original SQL) then the Expr.iTable holds the index ** number for that variable. ** ** If the expression is a subquery then Expr.iColumn holds an integer ** register number containing the result of the subquery. If the ** subquery gives a constant result, then iTable is -1. If the subquery ** gives a different answer at different times during statement processing ** then iTable is the address of a subroutine that computes the subquery. ** ** If the Expr is of type OP_Column, and the table it is selecting from ** is a disk table or the "old.*" pseudo-table, then pTab points to the ** corresponding table definition. ** ** ALLOCATION NOTES: ** ** Expr objects can use a lot of memory space in database schema. To ** help reduce memory requirements, sometimes an Expr object will be ** truncated. And to reduce the number of memory allocations, sometimes ** two or more Expr objects will be stored in a single memory allocation, ** together with Expr.zToken strings. ** ** If the EP_Reduced and EP_TokenOnly flags are set when ** an Expr object is truncated. When EP_Reduced is set, then all ** the child Expr objects in the Expr.pLeft and Expr.pRight subtrees ** are contained within the same memory allocation. Note, however, that ** the subtrees in Expr.x.pList or Expr.x.pSelect are always separately ** allocated, regardless of whether or not EP_Reduced is set. */ struct Expr { u8 op; /* Operation performed by this node */ char affinity; /* The affinity of the column or 0 if not a column */ u16 flags; /* Various flags. EP_* See below */ union { char *zToken; /* Token value. Zero terminated and dequoted */ int iValue; /* Integer value if EP_IntValue */ } u; /* If the EP_TokenOnly flag is set in the Expr.flags mask, then no ** space is allocated for the fields below this point. An attempt to ** access them will result in a segfault or malfunction. *********************************************************************/ Expr *pLeft; /* Left subnode */ Expr *pRight; /* Right subnode */ union { ExprList *pList; /* Function arguments or in " IN ( IN (