diff --git a/.gitignore b/.gitignore index 0b5553415..819a650cb 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,5 @@ build/ *.back converted/ *.pyc +*-tmp.cc +*-tmp.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9c184901b..759fcf361 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -405,440 +405,440 @@ list( APPEND eccodes_src_files ) list( APPEND eccodes_src_files - converted/eccodes/accessor/Long.cc - converted/eccodes/accessor/Dictionary.cc - converted/eccodes/accessor/Time.h - converted/eccodes/accessor/Divdouble.h - converted/eccodes/accessor/Generic.h - converted/eccodes/accessor/DataG2shsimplePacking.h - converted/eccodes/accessor/G1HalfByteCodeflag.cc - converted/eccodes/accessor/Size.h - converted/eccodes/accessor/OctetNumber.h - converted/eccodes/accessor/UnpackBufrValues.h - converted/eccodes/accessor/Bytes.cc - converted/eccodes/accessor/G1forecastmonth.cc - converted/eccodes/accessor/SectionPadding.cc - converted/eccodes/accessor/ValidityTime.cc - converted/eccodes/accessor/G1monthlydate.h - converted/eccodes/accessor/GdsNotPresentBitmap.cc - converted/eccodes/accessor/Concept.h - converted/eccodes/accessor/NonAlpha.h - converted/eccodes/accessor/Padtomultiple.h - converted/eccodes/accessor/AbstractVector.h - converted/eccodes/accessor/BufrExtractSubsets.cc - converted/eccodes/accessor/Array.cc - converted/eccodes/accessor/SimplePackingError.cc - converted/eccodes/accessor/GdsIsPresent.h - converted/eccodes/accessor/Sexagesimal2decimal.h - converted/eccodes/accessor/Scale.h - converted/eccodes/accessor/Int64LittleEndian.cc - converted/eccodes/accessor/ChangeAlternativeRowScanning.h - converted/eccodes/accessor/Constant.cc - converted/eccodes/accessor/NonAlpha.cc - converted/eccodes/accessor/G1forecastmonth.h - converted/eccodes/accessor/Uint32LittleEndian.h - converted/eccodes/accessor/DataPngPacking.cc - converted/eccodes/accessor/ChangeScanningDirection.cc - converted/eccodes/accessor/FromScaleFactorScaledValue.cc - converted/eccodes/accessor/Evaluate.cc - converted/eccodes/accessor/DataG1secondaryBitmap.cc - converted/eccodes/accessor/G2MarsLabeling.h - converted/eccodes/accessor/When.cc - converted/eccodes/accessor/OctahedralGaussian.h - converted/eccodes/accessor/Budgdate.h - converted/eccodes/accessor/Uint32LittleEndian.cc - converted/eccodes/accessor/Statistics.cc - converted/eccodes/accessor/Data2orderPacking.cc - converted/eccodes/accessor/Latitudes.h - converted/eccodes/accessor/BufrSimpleThinning.h - converted/eccodes/accessor/BufrExtractAreaSubsets.h - converted/eccodes/accessor/OctetNumber.cc - converted/eccodes/accessor/Latlonvalues.h - converted/eccodes/accessor/BufrStringValues.cc - converted/eccodes/accessor/Bitmap.cc - converted/eccodes/accessor/CodetableTitle.h - converted/eccodes/accessor/Double.cc - converted/eccodes/accessor/Sum.cc - converted/eccodes/accessor/DataG2complexPacking.cc - converted/eccodes/accessor/Latlonvalues.cc - converted/eccodes/accessor/StepInUnits.h - converted/eccodes/accessor/Label.h - converted/eccodes/accessor/G1endOfIntervalMonthly.h - converted/eccodes/accessor/G2level.cc - converted/eccodes/accessor/DataDummyField.h - converted/eccodes/accessor/MarsParam.cc - converted/eccodes/accessor/Md5Sum.cc - converted/eccodes/accessor/BufrElementsTable.cc - converted/eccodes/accessor/Laplacian.h - converted/eccodes/accessor/DataShUnpacked.cc - converted/eccodes/accessor/DataApplyBoustrophedonic.cc - converted/eccodes/accessor/FromScaleFactorScaledValue.h - converted/eccodes/accessor/G2Chemical.cc - converted/eccodes/accessor/Sexagesimal2decimal.cc - converted/eccodes/accessor/DataApplyBitmap.h - converted/eccodes/accessor/UnsignedBits.cc - converted/eccodes/accessor/G2bitmapPresent.h - converted/eccodes/accessor/GtsHeader.h - converted/eccodes/accessor/IfsParam.cc - converted/eccodes/accessor/SpectralTruncation.cc - converted/eccodes/accessor/HashArray.h - converted/eccodes/accessor/Nearest.cc - converted/eccodes/accessor/G2bitmap.cc - converted/eccodes/accessor/HashArray.cc - converted/eccodes/accessor/LocalDefinition.h - converted/eccodes/accessor/Budgdate.cc - converted/eccodes/accessor/DataSecondaryBitmap.h - converted/eccodes/accessor/ChangeAlternativeRowScanning.cc - converted/eccodes/accessor/BufrDataElement.h - converted/eccodes/accessor/ValidityDate.h - converted/eccodes/accessor/NumberOfValuesDataRawPacking.cc - converted/eccodes/accessor/DataG1secondOrderGeneralPacking.h - converted/eccodes/accessor/SectionPointer.cc - converted/eccodes/accessor/Int8.cc - converted/eccodes/accessor/DataSimplePacking.cc - converted/eccodes/accessor/CountTotal.h - converted/eccodes/accessor/G2date.cc - converted/eccodes/accessor/ToString.h - converted/eccodes/accessor/LongVector.cc - converted/eccodes/accessor/DataG2simplePacking.h - converted/eccodes/accessor/Int64.h - converted/eccodes/accessor/GdsIsPresent.cc - converted/eccodes/accessor/G2lon.h - converted/eccodes/accessor/SectionPointer.h - converted/eccodes/accessor/ScaleValues.cc - converted/eccodes/accessor/DataShPacked.h - converted/eccodes/accessor/Scale.cc - converted/eccodes/accessor/BufrDataArray.h - converted/eccodes/accessor/SectionPadding.h - converted/eccodes/accessor/OffsetFile.h - converted/eccodes/accessor/Blob.cc - converted/eccodes/accessor/Codetable.h - converted/eccodes/accessor/Padding.cc - converted/eccodes/accessor/Int16LittleEndian.h - converted/eccodes/accessor/Unsigned.h - converted/eccodes/accessor/DataG1secondOrderConstantWidthPacking.cc - converted/eccodes/accessor/NumberOfCodedValues.cc - converted/eccodes/accessor/DataApplyGdsnotpresent.cc - converted/eccodes/accessor/UnexpandedDescriptors.h - converted/eccodes/accessor/Ksec1expver.h - converted/eccodes/accessor/Int32LittleEndian.h - converted/eccodes/accessor/Times.h - converted/eccodes/accessor/DataG1simplePacking.cc - converted/eccodes/accessor/Round.cc - converted/eccodes/accessor/Uint32.h - converted/eccodes/accessor/DataApplyBoustrophedonicBitmap.cc - converted/eccodes/accessor/OffsetValues.h - converted/eccodes/accessor/DecimalPrecision.h - converted/eccodes/accessor/CheckInternalVersion.cc - converted/eccodes/accessor/Blob.h - converted/eccodes/accessor/Getenv.cc - converted/eccodes/accessor/Codeflag.cc - converted/eccodes/accessor/SecondOrderBitsPerValue.h - converted/eccodes/accessor/Int16.h - converted/eccodes/accessor/Uint64.cc - converted/eccodes/accessor/BufrdcExpandedDescriptors.cc - converted/eccodes/accessor/Nearest.h - converted/eccodes/accessor/GdsNotPresentBitmap.h - converted/eccodes/accessor/UnsignedBits.h - converted/eccodes/accessor/DataRawPacking.h - converted/eccodes/accessor/G2stepRange.h - converted/eccodes/accessor/Iterator.cc - converted/eccodes/accessor/BufrExtractSubsets.h - converted/eccodes/accessor/DataG1secondOrderConstantWidthPacking.h - converted/eccodes/accessor/GlobalGaussian.h - converted/eccodes/accessor/Constant.h - converted/eccodes/accessor/Round.h - converted/eccodes/accessor/ScaleValues.h - converted/eccodes/accessor/GaussianGridName.h - converted/eccodes/accessor/Variable.cc - converted/eccodes/accessor/Md5Sum.h - converted/eccodes/accessor/Signed.cc - converted/eccodes/accessor/PackBufrValues.cc - converted/eccodes/accessor/GaussianGridName.cc - converted/eccodes/accessor/DataApplyBitmap.cc - converted/eccodes/accessor/CountTotal.cc - converted/eccodes/accessor/Int16LittleEndian.cc - converted/eccodes/accessor/Pad.cc - converted/eccodes/accessor/SmartTable.h - converted/eccodes/accessor/DataG2simplePackingWithPreprocessing.cc - converted/eccodes/accessor/G1dayOfTheYearDate.h - converted/eccodes/accessor/IfsParam.h - converted/eccodes/accessor/SectionLength.cc - converted/eccodes/accessor/Pad.h - converted/eccodes/accessor/LatlonIncrement.cc - converted/eccodes/accessor/Data2orderPacking.h - converted/eccodes/accessor/Divdouble.cc - converted/eccodes/accessor/ToInteger.h - converted/eccodes/accessor/Bit.h - converted/eccodes/accessor/Codetable.cc - converted/eccodes/accessor/Group.cc - converted/eccodes/accessor/DataG1secondOrderGeneralExtendedPacking.cc - converted/eccodes/accessor/Int16.cc - converted/eccodes/accessor/SmartTableColumn.cc - converted/eccodes/accessor/DataRawPacking.cc - converted/eccodes/accessor/StepHumanReadable.h - converted/eccodes/accessor/DataSecondaryBitmap.cc - converted/eccodes/accessor/GtsHeader.cc - converted/eccodes/accessor/DataPngPacking.h - converted/eccodes/accessor/MarsParam.h - converted/eccodes/accessor/Message.h converted/eccodes/accessor/AbstractLongVector.cc - converted/eccodes/accessor/MarsStep.h - converted/eccodes/accessor/CountMissing.cc - converted/eccodes/accessor/BufrDataElement.cc - converted/eccodes/accessor/ExpandedDescriptors.h - converted/eccodes/accessor/DataG2complexPacking.h - converted/eccodes/accessor/Trim.h - converted/eccodes/accessor/Transient.h - converted/eccodes/accessor/G2Chemical.h - converted/eccodes/accessor/Transient.cc - converted/eccodes/accessor/Longitudes.cc - converted/eccodes/accessor/Long.h - converted/eccodes/accessor/CodetableUnits.cc - converted/eccodes/accessor/Bit.cc - converted/eccodes/accessor/Int32.cc - converted/eccodes/accessor/Variable.h - converted/eccodes/accessor/DataG1secondOrderGeneralPacking.cc - converted/eccodes/accessor/G1fcperiod.cc - converted/eccodes/accessor/Uint16LittleEndian.h - converted/eccodes/accessor/Section.h - converted/eccodes/accessor/ReferenceValueError.cc - converted/eccodes/accessor/ValidityTime.h - converted/eccodes/accessor/TransientDarray.cc - converted/eccodes/accessor/DecimalPrecision.cc - converted/eccodes/accessor/GlobalGaussian.cc - converted/eccodes/accessor/Sprintf.cc - converted/eccodes/accessor/TransientDarray.h - converted/eccodes/accessor/Padtoeven.cc - converted/eccodes/accessor/Position.cc - converted/eccodes/accessor/G1numberOfCodedValuesShComplex.h - converted/eccodes/accessor/DataG2secondaryBitmap.cc - converted/eccodes/accessor/BufrGroup.h - converted/eccodes/accessor/DataShPacked.cc - converted/eccodes/accessor/Suppressed.h - converted/eccodes/accessor/LibraryVersion.cc - converted/eccodes/accessor/DataG1secondaryBitmap.h - converted/eccodes/accessor/DataG1simplePacking.h - converted/eccodes/accessor/G2MarsLabeling.cc - converted/eccodes/accessor/ProjString.cc - converted/eccodes/accessor/StepHumanReadable.cc - converted/eccodes/accessor/DataApplyGdsnotpresent.h - converted/eccodes/accessor/Ibmfloat.h - converted/eccodes/accessor/Label.cc - converted/eccodes/accessor/Concept.cc - converted/eccodes/accessor/ToDouble.h - converted/eccodes/accessor/G1verificationdate.h - converted/eccodes/accessor/ClosestDate.cc - converted/eccodes/accessor/Missing.h - converted/eccodes/accessor/Uint16LittleEndian.cc - converted/eccodes/accessor/DataShsimplePacking.h - converted/eccodes/accessor/LongVector.h - converted/eccodes/accessor/CountFile.h - converted/eccodes/accessor/Ascii.h - converted/eccodes/accessor/BufrStringValues.h - converted/eccodes/accessor/OffsetValues.cc - converted/eccodes/accessor/Int32.h - converted/eccodes/accessor/ChangeScanningDirection.h - converted/eccodes/accessor/Spd.cc - converted/eccodes/accessor/Sum.h - converted/eccodes/accessor/G2bitmap.h - converted/eccodes/accessor/G1numberOfCodedValuesShSimple.cc - converted/eccodes/accessor/NumberOfCodedValues.h - converted/eccodes/accessor/Values.h - converted/eccodes/accessor/Lookup.cc - converted/eccodes/accessor/Generic.cc - converted/eccodes/accessor/Padto.cc - converted/eccodes/accessor/G1fcperiod.h - converted/eccodes/accessor/Latitudes.cc - converted/eccodes/accessor/G2date.h - converted/eccodes/accessor/G1numberOfCodedValuesShSimple.h - converted/eccodes/accessor/Uint16.h - converted/eccodes/accessor/DataG2bifourierPacking.cc - converted/eccodes/accessor/BufrExtractDatetimeSubsets.cc - converted/eccodes/accessor/BufrSimpleThinning.cc - converted/eccodes/accessor/G1HalfByteCodeflag.h - converted/eccodes/accessor/StepInUnits.cc - converted/eccodes/accessor/Element.h - converted/eccodes/accessor/BitsPerValue.cc - converted/eccodes/accessor/G2level.h - converted/eccodes/accessor/DataG1secondOrderRowByRowPacking.h - converted/eccodes/accessor/DataSimplePacking.h - converted/eccodes/accessor/Dictionary.h - converted/eccodes/accessor/G2stepRange.cc - converted/eccodes/accessor/Group.h - converted/eccodes/accessor/DataComplexPacking.cc - converted/eccodes/accessor/G1numberOfCodedValuesShComplex.cc - converted/eccodes/accessor/G2latlon.h - converted/eccodes/accessor/G1bitmap.cc - converted/eccodes/accessor/OctahedralGaussian.cc - converted/eccodes/accessor/G1area.cc - converted/eccodes/accessor/Int64.cc - converted/eccodes/accessor/G2lon.cc - converted/eccodes/accessor/Ascii.cc - converted/eccodes/accessor/G1date.cc - converted/eccodes/accessor/Trim.cc - converted/eccodes/accessor/Laplacian.cc - converted/eccodes/accessor/Uint64LittleEndian.h - converted/eccodes/accessor/RdbtimeGuessDate.h - converted/eccodes/accessor/Section.cc - converted/eccodes/accessor/ToString.cc - converted/eccodes/accessor/Statistics.h - converted/eccodes/accessor/ToDouble.cc - converted/eccodes/accessor/G1stepRange.h - converted/eccodes/accessor/ExpandedDescriptors.cc - converted/eccodes/accessor/Assert.cc - converted/eccodes/accessor/G1MessageLength.cc - converted/eccodes/accessor/NumberOfPoints.h - converted/eccodes/accessor/DataG1secondOrderGeneralExtendedPacking.h - converted/eccodes/accessor/When.h - converted/eccodes/accessor/G2grid.h - converted/eccodes/accessor/JulianDay.cc - converted/eccodes/accessor/Times.cc - converted/eccodes/accessor/Ibmfloat.cc - converted/eccodes/accessor/Array.h - converted/eccodes/accessor/Size.cc - converted/eccodes/accessor/MarsStep.cc - converted/eccodes/accessor/Bytes.h - converted/eccodes/accessor/DataApplyBoustrophedonicBitmap.h - converted/eccodes/accessor/DataG2secondaryBitmap.h - converted/eccodes/accessor/Dirty.h - converted/eccodes/accessor/Padto.h - converted/eccodes/accessor/Raw.h - converted/eccodes/accessor/UnpackBufrValues.cc - converted/eccodes/accessor/Unsigned.cc - converted/eccodes/accessor/Suppressed.cc - converted/eccodes/accessor/Element.cc - converted/eccodes/accessor/G1Section4Length.h - converted/eccodes/accessor/ClosestDate.h - converted/eccodes/accessor/Lookup.h - converted/eccodes/accessor/BufrExtractDatetimeSubsets.h converted/eccodes/accessor/AbstractLongVector.h - converted/eccodes/accessor/Codeflag.h - converted/eccodes/accessor/G1verificationdate.cc - converted/eccodes/accessor/Uint16.cc - converted/eccodes/accessor/G1Section4Length.cc - converted/eccodes/accessor/JulianDate.h - converted/eccodes/accessor/BufrdcExpandedDescriptors.h - converted/eccodes/accessor/DataComplexPacking.h - converted/eccodes/accessor/Double.h - converted/eccodes/accessor/DataJpeg2000Packing.cc - converted/eccodes/accessor/Message.cc - converted/eccodes/accessor/DataG1shsimplePacking.cc - converted/eccodes/accessor/G2endStep.cc - converted/eccodes/accessor/BufrElementsTable.h - converted/eccodes/accessor/DataRunLengthPacking.cc - converted/eccodes/accessor/Padtomultiple.cc - converted/eccodes/accessor/SelectStepTemplate.cc - converted/eccodes/accessor/G2Aerosol.h - converted/eccodes/accessor/PackBufrValues.h - converted/eccodes/accessor/G1monthlydate.cc - converted/eccodes/accessor/Uint32.cc - converted/eccodes/accessor/CodetableTitle.cc - converted/eccodes/accessor/DataRunLengthPacking.h - converted/eccodes/accessor/BufrDataArray.cc - converted/eccodes/accessor/SmartTable.cc - converted/eccodes/accessor/Longitudes.h - converted/eccodes/accessor/ProjString.h - converted/eccodes/accessor/Bits.cc - converted/eccodes/accessor/G1endOfIntervalMonthly.cc - converted/eccodes/accessor/BitsPerValue.h - converted/eccodes/accessor/DataApplyBoustrophedonic.h - converted/eccodes/accessor/G2grid.cc - converted/eccodes/accessor/G1date.h - converted/eccodes/accessor/DataG1complexPacking.h - converted/eccodes/accessor/DataG22orderPacking.cc - converted/eccodes/accessor/Signed.h - converted/eccodes/accessor/DataCcsdsPacking.cc - converted/eccodes/accessor/MessageCopy.h - converted/eccodes/accessor/Uint64LittleEndian.cc - converted/eccodes/accessor/Evaluate.h - converted/eccodes/accessor/CheckInternalVersion.h - converted/eccodes/accessor/Missing.cc - converted/eccodes/accessor/UnexpandedDescriptors.cc - converted/eccodes/accessor/CodetableUnits.h - converted/eccodes/accessor/G2Eps.cc - converted/eccodes/accessor/DataShsimplePacking.cc - converted/eccodes/accessor/DataG1complexPacking.cc - converted/eccodes/accessor/Int32LittleEndian.cc - converted/eccodes/accessor/Padtoeven.h - converted/eccodes/accessor/BufrExtractAreaSubsets.cc - converted/eccodes/accessor/LibraryVersion.h - converted/eccodes/accessor/DataShUnpacked.h - converted/eccodes/accessor/SignedBits.cc - converted/eccodes/accessor/OffsetFile.cc - converted/eccodes/accessor/G2latlon.cc - converted/eccodes/accessor/ReferenceValueError.h - converted/eccodes/accessor/DataG1shsimplePacking.h - converted/eccodes/accessor/RdbtimeGuessDate.cc - converted/eccodes/accessor/DataDummyField.cc - converted/eccodes/accessor/DataG1secondOrderRowByRowPacking.cc converted/eccodes/accessor/AbstractVector.cc - converted/eccodes/accessor/DataG2shsimplePacking.cc - converted/eccodes/accessor/Time.cc - converted/eccodes/accessor/G2bitmapPresent.cc - converted/eccodes/accessor/HeadersOnly.cc - converted/eccodes/accessor/G1bitmap.h - converted/eccodes/accessor/SmartTableColumn.h - converted/eccodes/accessor/Vector.h - converted/eccodes/accessor/NumberOfPointsGaussian.cc + converted/eccodes/accessor/AbstractVector.h + converted/eccodes/accessor/Array.cc + converted/eccodes/accessor/Array.h + converted/eccodes/accessor/Ascii.cc + converted/eccodes/accessor/Ascii.h + converted/eccodes/accessor/Assertion.cc + converted/eccodes/accessor/Assertion.h + converted/eccodes/accessor/Bit.cc + converted/eccodes/accessor/Bit.h + converted/eccodes/accessor/Bitmap.cc converted/eccodes/accessor/Bitmap.h - converted/eccodes/accessor/DataG2bifourierPacking.h - converted/eccodes/accessor/ToInteger.cc - converted/eccodes/accessor/JulianDay.h - converted/eccodes/accessor/Assert.h - converted/eccodes/accessor/CountFile.cc - converted/eccodes/accessor/StatisticsSpectral.h - converted/eccodes/accessor/G1stepRange.cc - converted/eccodes/accessor/Spd.h - converted/eccodes/accessor/NumberOfValues.h - converted/eccodes/accessor/SimplePackingError.h - converted/eccodes/accessor/G1MessageLength.h - converted/eccodes/accessor/LocalDefinition.cc - converted/eccodes/accessor/NumberOfValuesDataRawPacking.h - converted/eccodes/accessor/Dirty.cc - converted/eccodes/accessor/ValidityDate.cc - converted/eccodes/accessor/SpectralTruncation.h - converted/eccodes/accessor/Iterator.h - converted/eccodes/accessor/StatisticsSpectral.cc - converted/eccodes/accessor/SignedBits.h - converted/eccodes/accessor/DataCcsdsPacking.h - converted/eccodes/accessor/Sprintf.h - converted/eccodes/accessor/JulianDate.cc - converted/eccodes/accessor/Raw.cc - converted/eccodes/accessor/G1area.h - converted/eccodes/accessor/Position.h - converted/eccodes/accessor/DataG2simplePacking.cc - converted/eccodes/accessor/Getenv.h - converted/eccodes/accessor/Uint8.h - converted/eccodes/accessor/DataG22orderPacking.h - converted/eccodes/accessor/G2Eps.h - converted/eccodes/accessor/NumberOfPointsGaussian.h - converted/eccodes/accessor/Uint64.h - converted/eccodes/accessor/Ksec1expver.cc - converted/eccodes/accessor/Ieeefloat.h - converted/eccodes/accessor/Values.cc - converted/eccodes/accessor/Int64LittleEndian.h - converted/eccodes/accessor/DataJpeg2000Packing.h - converted/eccodes/accessor/BufrGroup.cc - converted/eccodes/accessor/NumberOfValues.cc - converted/eccodes/accessor/MessageCopy.cc - converted/eccodes/accessor/LatlonIncrement.h - converted/eccodes/accessor/G2Aerosol.cc - converted/eccodes/accessor/NumberOfPoints.cc + converted/eccodes/accessor/Bits.cc converted/eccodes/accessor/Bits.h + converted/eccodes/accessor/BitsPerValue.cc + converted/eccodes/accessor/BitsPerValue.h + converted/eccodes/accessor/Blob.cc + converted/eccodes/accessor/Blob.h + converted/eccodes/accessor/Budgdate.cc + converted/eccodes/accessor/Budgdate.h + converted/eccodes/accessor/BufrDataArray.cc + converted/eccodes/accessor/BufrDataArray.h + converted/eccodes/accessor/BufrDataElement.cc + converted/eccodes/accessor/BufrDataElement.h + converted/eccodes/accessor/BufrElementsTable.cc + converted/eccodes/accessor/BufrElementsTable.h + converted/eccodes/accessor/BufrExtractAreaSubsets.cc + converted/eccodes/accessor/BufrExtractAreaSubsets.h + converted/eccodes/accessor/BufrExtractDatetimeSubsets.cc + converted/eccodes/accessor/BufrExtractDatetimeSubsets.h + converted/eccodes/accessor/BufrExtractSubsets.cc + converted/eccodes/accessor/BufrExtractSubsets.h + converted/eccodes/accessor/BufrGroup.cc + converted/eccodes/accessor/BufrGroup.h + converted/eccodes/accessor/BufrSimpleThinning.cc + converted/eccodes/accessor/BufrSimpleThinning.h + converted/eccodes/accessor/BufrStringValues.cc + converted/eccodes/accessor/BufrStringValues.h + converted/eccodes/accessor/BufrdcExpandedDescriptors.cc + converted/eccodes/accessor/BufrdcExpandedDescriptors.h + converted/eccodes/accessor/Bytes.cc + converted/eccodes/accessor/Bytes.h + converted/eccodes/accessor/ChangeAlternativeRowScanning.cc + converted/eccodes/accessor/ChangeAlternativeRowScanning.h + converted/eccodes/accessor/ChangeScanningDirection.cc + converted/eccodes/accessor/ChangeScanningDirection.h + converted/eccodes/accessor/CheckInternalVersion.cc + converted/eccodes/accessor/CheckInternalVersion.h + converted/eccodes/accessor/ClosestDate.cc + converted/eccodes/accessor/ClosestDate.h + converted/eccodes/accessor/Codeflag.cc + converted/eccodes/accessor/Codeflag.h + converted/eccodes/accessor/Codetable.cc + converted/eccodes/accessor/Codetable.h + converted/eccodes/accessor/CodetableTitle.cc + converted/eccodes/accessor/CodetableTitle.h + converted/eccodes/accessor/CodetableUnits.cc + converted/eccodes/accessor/CodetableUnits.h + converted/eccodes/accessor/Concept.cc + converted/eccodes/accessor/Concept.h + converted/eccodes/accessor/Constant.cc + converted/eccodes/accessor/Constant.h + converted/eccodes/accessor/CountFile.cc + converted/eccodes/accessor/CountFile.h + converted/eccodes/accessor/CountMissing.cc converted/eccodes/accessor/CountMissing.h - converted/eccodes/accessor/Uint8.cc - converted/eccodes/accessor/Padding.h - converted/eccodes/accessor/HeadersOnly.h - converted/eccodes/accessor/Vector.cc - converted/eccodes/accessor/Ieeefloat.cc - converted/eccodes/accessor/G1dayOfTheYearDate.cc - converted/eccodes/accessor/SectionLength.h - converted/eccodes/accessor/Int8.h - converted/eccodes/accessor/SecondOrderBitsPerValue.cc + converted/eccodes/accessor/CountTotal.cc + converted/eccodes/accessor/CountTotal.h + converted/eccodes/accessor/Data2orderPacking.cc + converted/eccodes/accessor/Data2orderPacking.h + converted/eccodes/accessor/DataApplyBitmap.cc + converted/eccodes/accessor/DataApplyBitmap.h + converted/eccodes/accessor/DataApplyBoustrophedonic.cc + converted/eccodes/accessor/DataApplyBoustrophedonic.h + converted/eccodes/accessor/DataApplyBoustrophedonicBitmap.cc + converted/eccodes/accessor/DataApplyBoustrophedonicBitmap.h + converted/eccodes/accessor/DataApplyGdsnotpresent.cc + converted/eccodes/accessor/DataApplyGdsnotpresent.h + converted/eccodes/accessor/DataCcsdsPacking.cc + converted/eccodes/accessor/DataCcsdsPacking.h + converted/eccodes/accessor/DataComplexPacking.cc + converted/eccodes/accessor/DataComplexPacking.h + converted/eccodes/accessor/DataDummyField.cc + converted/eccodes/accessor/DataDummyField.h + converted/eccodes/accessor/DataG1complexPacking.cc + converted/eccodes/accessor/DataG1complexPacking.h + converted/eccodes/accessor/DataG1secondOrderConstantWidthPacking.cc + converted/eccodes/accessor/DataG1secondOrderConstantWidthPacking.h + converted/eccodes/accessor/DataG1secondOrderGeneralExtendedPacking.cc + converted/eccodes/accessor/DataG1secondOrderGeneralExtendedPacking.h + converted/eccodes/accessor/DataG1secondOrderGeneralPacking.cc + converted/eccodes/accessor/DataG1secondOrderGeneralPacking.h + converted/eccodes/accessor/DataG1secondOrderRowByRowPacking.cc + converted/eccodes/accessor/DataG1secondOrderRowByRowPacking.h + converted/eccodes/accessor/DataG1secondaryBitmap.cc + converted/eccodes/accessor/DataG1secondaryBitmap.h + converted/eccodes/accessor/DataG1shsimplePacking.cc + converted/eccodes/accessor/DataG1shsimplePacking.h + converted/eccodes/accessor/DataG1simplePacking.cc + converted/eccodes/accessor/DataG1simplePacking.h + converted/eccodes/accessor/DataG22orderPacking.cc + converted/eccodes/accessor/DataG22orderPacking.h + converted/eccodes/accessor/DataG2bifourierPacking.cc + converted/eccodes/accessor/DataG2bifourierPacking.h + converted/eccodes/accessor/DataG2complexPacking.cc + converted/eccodes/accessor/DataG2complexPacking.h + converted/eccodes/accessor/DataG2secondaryBitmap.cc + converted/eccodes/accessor/DataG2secondaryBitmap.h + converted/eccodes/accessor/DataG2shsimplePacking.cc + converted/eccodes/accessor/DataG2shsimplePacking.h + converted/eccodes/accessor/DataG2simplePacking.cc + converted/eccodes/accessor/DataG2simplePacking.h + converted/eccodes/accessor/DataG2simplePackingWithPreprocessing.cc converted/eccodes/accessor/DataG2simplePackingWithPreprocessing.h - converted/eccodes/accessor/SelectStepTemplate.h + converted/eccodes/accessor/DataJpeg2000Packing.cc + converted/eccodes/accessor/DataJpeg2000Packing.h + converted/eccodes/accessor/DataPngPacking.cc + converted/eccodes/accessor/DataPngPacking.h + converted/eccodes/accessor/DataRawPacking.cc + converted/eccodes/accessor/DataRawPacking.h + converted/eccodes/accessor/DataRunLengthPacking.cc + converted/eccodes/accessor/DataRunLengthPacking.h + converted/eccodes/accessor/DataSecondaryBitmap.cc + converted/eccodes/accessor/DataSecondaryBitmap.h + converted/eccodes/accessor/DataShPacked.cc + converted/eccodes/accessor/DataShPacked.h + converted/eccodes/accessor/DataShUnpacked.cc + converted/eccodes/accessor/DataShUnpacked.h + converted/eccodes/accessor/DataShsimplePacking.cc + converted/eccodes/accessor/DataShsimplePacking.h + converted/eccodes/accessor/DataSimplePacking.cc + converted/eccodes/accessor/DataSimplePacking.h + converted/eccodes/accessor/DecimalPrecision.cc + converted/eccodes/accessor/DecimalPrecision.h + converted/eccodes/accessor/Dictionary.cc + converted/eccodes/accessor/Dictionary.h + converted/eccodes/accessor/Dirty.cc + converted/eccodes/accessor/Dirty.h + converted/eccodes/accessor/Divdouble.cc + converted/eccodes/accessor/Divdouble.h + converted/eccodes/accessor/Double.cc + converted/eccodes/accessor/Double.h + converted/eccodes/accessor/Element.cc + converted/eccodes/accessor/Element.h + converted/eccodes/accessor/Evaluate.cc + converted/eccodes/accessor/Evaluate.h + converted/eccodes/accessor/ExpandedDescriptors.cc + converted/eccodes/accessor/ExpandedDescriptors.h + converted/eccodes/accessor/FromScaleFactorScaledValue.cc + converted/eccodes/accessor/FromScaleFactorScaledValue.h + converted/eccodes/accessor/G1HalfByteCodeflag.cc + converted/eccodes/accessor/G1HalfByteCodeflag.h + converted/eccodes/accessor/G1MessageLength.cc + converted/eccodes/accessor/G1MessageLength.h + converted/eccodes/accessor/G1Section4Length.cc + converted/eccodes/accessor/G1Section4Length.h + converted/eccodes/accessor/G1area.cc + converted/eccodes/accessor/G1area.h + converted/eccodes/accessor/G1bitmap.cc + converted/eccodes/accessor/G1bitmap.h + converted/eccodes/accessor/G1date.cc + converted/eccodes/accessor/G1date.h + converted/eccodes/accessor/G1dayOfTheYearDate.cc + converted/eccodes/accessor/G1dayOfTheYearDate.h + converted/eccodes/accessor/G1endOfIntervalMonthly.cc + converted/eccodes/accessor/G1endOfIntervalMonthly.h + converted/eccodes/accessor/G1fcperiod.cc + converted/eccodes/accessor/G1fcperiod.h + converted/eccodes/accessor/G1forecastmonth.cc + converted/eccodes/accessor/G1forecastmonth.h + converted/eccodes/accessor/G1monthlydate.cc + converted/eccodes/accessor/G1monthlydate.h + converted/eccodes/accessor/G1numberOfCodedValuesShComplex.cc + converted/eccodes/accessor/G1numberOfCodedValuesShComplex.h + converted/eccodes/accessor/G1numberOfCodedValuesShSimple.cc + converted/eccodes/accessor/G1numberOfCodedValuesShSimple.h + converted/eccodes/accessor/G1stepRange.cc + converted/eccodes/accessor/G1stepRange.h + converted/eccodes/accessor/G1verificationdate.cc + converted/eccodes/accessor/G1verificationdate.h + converted/eccodes/accessor/G2Aerosol.cc + converted/eccodes/accessor/G2Aerosol.h + converted/eccodes/accessor/G2Chemical.cc + converted/eccodes/accessor/G2Chemical.h + converted/eccodes/accessor/G2Eps.cc + converted/eccodes/accessor/G2Eps.h + converted/eccodes/accessor/G2MarsLabeling.cc + converted/eccodes/accessor/G2MarsLabeling.h + converted/eccodes/accessor/G2bitmap.cc + converted/eccodes/accessor/G2bitmap.h + converted/eccodes/accessor/G2bitmapPresent.cc + converted/eccodes/accessor/G2bitmapPresent.h + converted/eccodes/accessor/G2date.cc + converted/eccodes/accessor/G2date.h + converted/eccodes/accessor/G2endStep.cc converted/eccodes/accessor/G2endStep.h + converted/eccodes/accessor/G2grid.cc + converted/eccodes/accessor/G2grid.h + converted/eccodes/accessor/G2latlon.cc + converted/eccodes/accessor/G2latlon.h + converted/eccodes/accessor/G2level.cc + converted/eccodes/accessor/G2level.h + converted/eccodes/accessor/G2lon.cc + converted/eccodes/accessor/G2lon.h + converted/eccodes/accessor/G2stepRange.cc + converted/eccodes/accessor/G2stepRange.h + converted/eccodes/accessor/GaussianGridName.cc + converted/eccodes/accessor/GaussianGridName.h + converted/eccodes/accessor/GdsIsPresent.cc + converted/eccodes/accessor/GdsIsPresent.h + converted/eccodes/accessor/GdsNotPresentBitmap.cc + converted/eccodes/accessor/GdsNotPresentBitmap.h + converted/eccodes/accessor/Generic.cc + converted/eccodes/accessor/Generic.h + converted/eccodes/accessor/Getenv.cc + converted/eccodes/accessor/Getenv.h + converted/eccodes/accessor/GlobalGaussian.cc + converted/eccodes/accessor/GlobalGaussian.h + converted/eccodes/accessor/Group.cc + converted/eccodes/accessor/Group.h + converted/eccodes/accessor/GtsHeader.cc + converted/eccodes/accessor/GtsHeader.h + converted/eccodes/accessor/HashArray.cc + converted/eccodes/accessor/HashArray.h + converted/eccodes/accessor/HeadersOnly.cc + converted/eccodes/accessor/HeadersOnly.h + converted/eccodes/accessor/Ibmfloat.cc + converted/eccodes/accessor/Ibmfloat.h + converted/eccodes/accessor/Ieeefloat.cc + converted/eccodes/accessor/Ieeefloat.h + converted/eccodes/accessor/IfsParam.cc + converted/eccodes/accessor/IfsParam.h + converted/eccodes/accessor/Int16.cc + converted/eccodes/accessor/Int16.h + converted/eccodes/accessor/Int16LittleEndian.cc + converted/eccodes/accessor/Int16LittleEndian.h + converted/eccodes/accessor/Int32.cc + converted/eccodes/accessor/Int32.h + converted/eccodes/accessor/Int32LittleEndian.cc + converted/eccodes/accessor/Int32LittleEndian.h + converted/eccodes/accessor/Int64.cc + converted/eccodes/accessor/Int64.h + converted/eccodes/accessor/Int64LittleEndian.cc + converted/eccodes/accessor/Int64LittleEndian.h + converted/eccodes/accessor/Int8.cc + converted/eccodes/accessor/Int8.h + converted/eccodes/accessor/Iterator.cc + converted/eccodes/accessor/Iterator.h + converted/eccodes/accessor/JulianDate.cc + converted/eccodes/accessor/JulianDate.h + converted/eccodes/accessor/JulianDay.cc + converted/eccodes/accessor/JulianDay.h + converted/eccodes/accessor/Ksec1expver.cc + converted/eccodes/accessor/Ksec1expver.h + converted/eccodes/accessor/Label.cc + converted/eccodes/accessor/Label.h + converted/eccodes/accessor/Laplacian.cc + converted/eccodes/accessor/Laplacian.h + converted/eccodes/accessor/Latitudes.cc + converted/eccodes/accessor/Latitudes.h + converted/eccodes/accessor/LatlonIncrement.cc + converted/eccodes/accessor/LatlonIncrement.h + converted/eccodes/accessor/Latlonvalues.cc + converted/eccodes/accessor/Latlonvalues.h + converted/eccodes/accessor/LibraryVersion.cc + converted/eccodes/accessor/LibraryVersion.h + converted/eccodes/accessor/LocalDefinition.cc + converted/eccodes/accessor/LocalDefinition.h + converted/eccodes/accessor/Long.cc + converted/eccodes/accessor/Long.h + converted/eccodes/accessor/LongVector.cc + converted/eccodes/accessor/LongVector.h + converted/eccodes/accessor/Longitudes.cc + converted/eccodes/accessor/Longitudes.h + converted/eccodes/accessor/Lookup.cc + converted/eccodes/accessor/Lookup.h + converted/eccodes/accessor/MarsParam.cc + converted/eccodes/accessor/MarsParam.h + converted/eccodes/accessor/MarsStep.cc + converted/eccodes/accessor/MarsStep.h + converted/eccodes/accessor/Md5Sum.cc + converted/eccodes/accessor/Md5Sum.h + converted/eccodes/accessor/Message.cc + converted/eccodes/accessor/Message.h + converted/eccodes/accessor/MessageCopy.cc + converted/eccodes/accessor/MessageCopy.h + converted/eccodes/accessor/Missing.cc + converted/eccodes/accessor/Missing.h + converted/eccodes/accessor/Nearest.cc + converted/eccodes/accessor/Nearest.h + converted/eccodes/accessor/NonAlpha.cc + converted/eccodes/accessor/NonAlpha.h + converted/eccodes/accessor/NumberOfCodedValues.cc + converted/eccodes/accessor/NumberOfCodedValues.h + converted/eccodes/accessor/NumberOfPoints.cc + converted/eccodes/accessor/NumberOfPoints.h + converted/eccodes/accessor/NumberOfPointsGaussian.cc + converted/eccodes/accessor/NumberOfPointsGaussian.h + converted/eccodes/accessor/NumberOfValues.cc + converted/eccodes/accessor/NumberOfValues.h + converted/eccodes/accessor/NumberOfValuesDataRawPacking.cc + converted/eccodes/accessor/NumberOfValuesDataRawPacking.h + converted/eccodes/accessor/OctahedralGaussian.cc + converted/eccodes/accessor/OctahedralGaussian.h + converted/eccodes/accessor/OctetNumber.cc + converted/eccodes/accessor/OctetNumber.h + converted/eccodes/accessor/OffsetFile.cc + converted/eccodes/accessor/OffsetFile.h + converted/eccodes/accessor/OffsetValues.cc + converted/eccodes/accessor/OffsetValues.h + converted/eccodes/accessor/PackBufrValues.cc + converted/eccodes/accessor/PackBufrValues.h + converted/eccodes/accessor/Pad.cc + converted/eccodes/accessor/Pad.h + converted/eccodes/accessor/Padding.cc + converted/eccodes/accessor/Padding.h + converted/eccodes/accessor/Padto.cc + converted/eccodes/accessor/Padto.h + converted/eccodes/accessor/Padtoeven.cc + converted/eccodes/accessor/Padtoeven.h + converted/eccodes/accessor/Padtomultiple.cc + converted/eccodes/accessor/Padtomultiple.h + converted/eccodes/accessor/Position.cc + converted/eccodes/accessor/Position.h + converted/eccodes/accessor/ProjString.cc + converted/eccodes/accessor/ProjString.h + converted/eccodes/accessor/Raw.cc + converted/eccodes/accessor/Raw.h + converted/eccodes/accessor/RdbtimeGuessDate.cc + converted/eccodes/accessor/RdbtimeGuessDate.h + converted/eccodes/accessor/ReferenceValueError.cc + converted/eccodes/accessor/ReferenceValueError.h + converted/eccodes/accessor/Round.cc + converted/eccodes/accessor/Round.h + converted/eccodes/accessor/Scale.cc + converted/eccodes/accessor/Scale.h + converted/eccodes/accessor/ScaleValues.cc + converted/eccodes/accessor/ScaleValues.h + converted/eccodes/accessor/SecondOrderBitsPerValue.cc + converted/eccodes/accessor/SecondOrderBitsPerValue.h + converted/eccodes/accessor/Section.cc + converted/eccodes/accessor/Section.h + converted/eccodes/accessor/SectionLength.cc + converted/eccodes/accessor/SectionLength.h + converted/eccodes/accessor/SectionPadding.cc + converted/eccodes/accessor/SectionPadding.h + converted/eccodes/accessor/SectionPointer.cc + converted/eccodes/accessor/SectionPointer.h + converted/eccodes/accessor/SelectStepTemplate.cc + converted/eccodes/accessor/SelectStepTemplate.h + converted/eccodes/accessor/Sexagesimal2decimal.cc + converted/eccodes/accessor/Sexagesimal2decimal.h + converted/eccodes/accessor/Signed.cc + converted/eccodes/accessor/Signed.h + converted/eccodes/accessor/SignedBits.cc + converted/eccodes/accessor/SignedBits.h + converted/eccodes/accessor/SimplePackingError.cc + converted/eccodes/accessor/SimplePackingError.h + converted/eccodes/accessor/Size.cc + converted/eccodes/accessor/Size.h + converted/eccodes/accessor/SmartTable.cc + converted/eccodes/accessor/SmartTable.h + converted/eccodes/accessor/SmartTableColumn.cc + converted/eccodes/accessor/SmartTableColumn.h + converted/eccodes/accessor/Spd.cc + converted/eccodes/accessor/Spd.h + converted/eccodes/accessor/SpectralTruncation.cc + converted/eccodes/accessor/SpectralTruncation.h + converted/eccodes/accessor/Sprintf.cc + converted/eccodes/accessor/Sprintf.h + converted/eccodes/accessor/Statistics.cc + converted/eccodes/accessor/Statistics.h + converted/eccodes/accessor/StatisticsSpectral.cc + converted/eccodes/accessor/StatisticsSpectral.h + converted/eccodes/accessor/StepHumanReadable.cc + converted/eccodes/accessor/StepHumanReadable.h + converted/eccodes/accessor/StepInUnits.cc + converted/eccodes/accessor/StepInUnits.h + converted/eccodes/accessor/Sum.cc + converted/eccodes/accessor/Sum.h + converted/eccodes/accessor/Suppressed.cc + converted/eccodes/accessor/Suppressed.h + converted/eccodes/accessor/Time.cc + converted/eccodes/accessor/Time.h + converted/eccodes/accessor/Times.cc + converted/eccodes/accessor/Times.h + converted/eccodes/accessor/ToDouble.cc + converted/eccodes/accessor/ToDouble.h + converted/eccodes/accessor/ToInteger.cc + converted/eccodes/accessor/ToInteger.h + converted/eccodes/accessor/ToString.cc + converted/eccodes/accessor/ToString.h + converted/eccodes/accessor/Transient.cc + converted/eccodes/accessor/Transient.h + converted/eccodes/accessor/TransientDarray.cc + converted/eccodes/accessor/TransientDarray.h + converted/eccodes/accessor/Trim.cc + converted/eccodes/accessor/Trim.h + converted/eccodes/accessor/Uint16.cc + converted/eccodes/accessor/Uint16.h + converted/eccodes/accessor/Uint16LittleEndian.cc + converted/eccodes/accessor/Uint16LittleEndian.h + converted/eccodes/accessor/Uint32.cc + converted/eccodes/accessor/Uint32.h + converted/eccodes/accessor/Uint32LittleEndian.cc + converted/eccodes/accessor/Uint32LittleEndian.h + converted/eccodes/accessor/Uint64.cc + converted/eccodes/accessor/Uint64.h + converted/eccodes/accessor/Uint64LittleEndian.cc + converted/eccodes/accessor/Uint64LittleEndian.h + converted/eccodes/accessor/Uint8.cc + converted/eccodes/accessor/Uint8.h + converted/eccodes/accessor/UnexpandedDescriptors.cc + converted/eccodes/accessor/UnexpandedDescriptors.h + converted/eccodes/accessor/UnpackBufrValues.cc + converted/eccodes/accessor/UnpackBufrValues.h + converted/eccodes/accessor/Unsigned.cc + converted/eccodes/accessor/Unsigned.h + converted/eccodes/accessor/UnsignedBits.cc + converted/eccodes/accessor/UnsignedBits.h + converted/eccodes/accessor/ValidityDate.cc + converted/eccodes/accessor/ValidityDate.h + converted/eccodes/accessor/ValidityTime.cc + converted/eccodes/accessor/ValidityTime.h + converted/eccodes/accessor/Values.cc + converted/eccodes/accessor/Values.h + converted/eccodes/accessor/Variable.cc + converted/eccodes/accessor/Variable.h + converted/eccodes/accessor/Vector.cc + converted/eccodes/accessor/Vector.h + converted/eccodes/accessor/When.cc + converted/eccodes/accessor/When.h ) if(UNIX) diff --git a/src/convert.py b/src/convert.py index c6c201917..6d52a0d8e 100755 --- a/src/convert.py +++ b/src/convert.py @@ -142,7 +142,8 @@ class Function: def cannot_convert(self): self._lines.insert(1, "#ifdef CANNOT_CONVERT_CODE") self._lines.insert(-1, "#endif") - self._lines.insert(-1, "throw EccodesException(GRIB_NOT_IMPLEMENTED);") + if self._name != "destroy": + self._lines.insert(-1, "throw EccodesException(GRIB_NOT_IMPLEMENTED);") class FunctionDelegate: @@ -264,6 +265,7 @@ class Class: substitute_re_top_level = { r"^#define\s+(\w+)\s+(-?\d+)?!(\.|e|E)": r"const long \1 = \2;", r"^#define\s+(\w+)\s+(-?\d+\.\d+([eE]-?\d+)?)": r"const double \1 = \2;", + r'\bgrib_inline_strcmp\b': 'strcmp', } def __init__( @@ -288,9 +290,9 @@ class Class: self._factory_name = factory_name self._members = members self._functions = functions - - self._body_includes = includes self._implements = implements + self._body_includes = includes + self._forward_declarations = [] if super is None: self._super, _ = self.tidy_class_name(class_) @@ -411,6 +413,9 @@ class Class: raise Exception(f"Cannot convert method {name}") def cannot_convert_top_level(self, name): + if name not in self._top_level_code: + print(list(self._top_level_code.keys())) + raise Exception(f"Cannot convert top level {name}") self._top_level_code[name] = ( ["#ifdef CANNOT_CONVERT_CODE"] + self._top_level_code[name] + ["#endif"] ) @@ -425,6 +430,9 @@ class Class: if not ok: raise Exception(f"Cannot convert member {name}") + def add_forward_declaration(self, name): + self._forward_declarations.append(name) + @property def name(self): return self._name @@ -503,6 +511,10 @@ class Class: def static_functions(self): return self._static_functions + @property + def forward_declarations(self): + return self._forward_declarations + def dump(self): self.dump_header() self.dump_body() @@ -518,14 +530,33 @@ class Class: def save(self, ext, content): target = os.path.join(ARGS.target, *self.namespaces, f"{self.name}.{ext}") - os.makedirs(os.path.dirname(target), exist_ok=True) LOG.info("Writting %s", target) - with open(target, "w") as f: + + tmp = os.path.join(ARGS.target, *self.namespaces, f"{self.name}-tmp.{ext}") + os.makedirs(os.path.dirname(target), exist_ok=True) + + with open(tmp, "w") as f: f.write(content) - ret = os.system(f"clang-format -i {target}") + ret = os.system(f"clang-format -i {tmp}") assert ret == 0 + # So we don't recomplie everything + if os.path.exists(target): + with open(target) as f: + old = f.read() + with open(tmp) as f: + new = f.read() + if old == new: + LOG.info("No change") + os.unlink(tmp) + return + + LOG.info("Updating %s", target) + os.rename(tmp, target) + + + def dump_header(self): template = env.get_template(f"{self._class}.h.j2") self.save("h", template.render(c=self)) @@ -622,9 +653,11 @@ class Accessor(Class): rename = { "Gen": "Generic", "Md5": "Md5Sum", # We rename because of macos case insensitive file system + "Assert": "Assertion", # Name clash with assert.h } substitute_re = { + r'\bgrib_inline_strcmp\b': 'strcmp', r"\bgrib_handle_of_accessor\(this\)": "this->handle()", r"\bget_accessors\(this\)": "this->get_accessors()", r"\bselect_area\(this\)": "this->select_area()", @@ -636,7 +669,12 @@ class Accessor(Class): r"\bcompute_byte_count\(this\)": "this->compute_byte_count()", r"\bselect_datetime\(this\)": "this->select_datetime()", r"\bapply_thinning\(this\)": "this->apply_thinning()", - r"\bgrib_accessor_get_native_type\(this\)": "this->native_type()", + r"\bconcept_evaluate\(this\)": "this->concept_evaluate()", + r"\bnew_bif_trunc\(this\)": "this->new_bif_trunc()", + r"\bget_table_codes\(this\)": "this->get_table_codes()", + + r"\bload_table\(this\)": "this->load_table()", + r"\bgrib_accessor_get_native_type\(this\)": "this->get_native_type()", r"\bget_native_type\(this\)": "this->get_native_type()", r"\bgrib_byte_offset\((\w+)\s*\)": r"\1->byte_offset()", r"\bgrib_byte_count\((\w+)\s*\)": r"\1->byte_count()", @@ -652,6 +690,7 @@ class Accessor(Class): r"\bgrib_unpack_bytes\((\w+)\s*,": r"\1->unpack_bytes(", r"\bgrib_value_count\((\w+)\s*,": r"\1->value_count(", r"\bgrib_update_size\((\w+)\s*,": r"\1->update_size(", + r"\bgrib_unpack_string_array\((\w+)\s*,": r"\1->unpack_string_array(", r"\bgrib_is_missing_internal\((\w+)\)": r"\1->is_missing()", r"\bpreferred_size\(this,": r"this->preferred_size(", r"\bvalue_count\((\w+),": r"\1->value_count(", @@ -679,6 +718,7 @@ class Accessor(Class): r"\bgrib_find_accessor\b": "Accessor::find", r"\bgrib_pack_long\(this->(\w+),": r"this->\1->pack_long(", r"\bgrib_value_count\(this->(\w+),": r"this->\1->value_count(", + r"\bgrib_pack_bytes\(this->(\w+),": r"this->\1->pack_bytes(", r"\bAccessor::find\(this->handle\(\),": r"Accessor::find(", # Temp stuff for making sure we still compile r"\bgrib_optimize_decimal_factor\(this,": r"grib_optimize_decimal_factor(this->as_grib_accessor_while_converting(),", @@ -688,6 +728,16 @@ class Accessor(Class): r"\badd_many_bitstream\(&ctx, this,": r"add_many_bitstream(&ctx, this->as_grib_accessor_while_converting(),", r"\badd_bitstream\(&ctx, this,": r"add_bitstream(&ctx, this->as_grib_accessor_while_converting(),", r"\baccessor_raw_get_offset\(this->(\w+)": r"accessor_raw_get_offset(this->\1->as_grib_accessor_while_converting()", + r"\bgrib_accessor_class_expanded_descriptors_set_do_expand\((\w+)": r"grib_accessor_class_expanded_descriptors_set_do_expand(\1->as_grib_accessor_while_converting()", + + r"\bgrib_is_missing_string\((\w+)": r"grib_is_missing_string(\1->as_grib_accessor_while_converting()", + r"\bgrib_is_missing_long\((\w+)": r"grib_is_missing_long(\1->as_grib_accessor_while_converting()", + r"\bgrib_is_missing_double\((\w+)": r"grib_is_missing_double(\1->as_grib_accessor_while_converting()", +r"\baccessor_bufr_data_array_set_unpackMode\((\w+)": r"accessor_bufr_data_array_set_unpackMode(\1->as_grib_accessor_while_converting()", + +r"\baction_concept_get_nofail\((\w+)": r"action_concept_get_nofail(\1->as_grib_accessor_while_converting()", +r"\baction_concept_get_concept\((\w+)": r"action_concept_get_concept(\1->as_grib_accessor_while_converting()", + } def class_to_type(self): diff --git a/src/cpp/eccodes/accessor/Accessor.h b/src/cpp/eccodes/accessor/Accessor.h index 0be1a86db..2f2c36c71 100644 --- a/src/cpp/eccodes/accessor/Accessor.h +++ b/src/cpp/eccodes/accessor/Accessor.h @@ -19,6 +19,7 @@ const int TRUE = 1; const int FALSE = 0; +inline int grib_inline_strcmp(const char* a, const char* b) { return strcmp(a, b); } // See https://github.com/ecmwf/mir/blob/develop/src/mir/repres/Representation.cc // for a similar approach diff --git a/src/grib_accessor_class_codetable.cc b/src/grib_accessor_class_codetable.cc index dfc05ff62..7cc66d775 100644 --- a/src/grib_accessor_class_codetable.cc +++ b/src/grib_accessor_class_codetable.cc @@ -158,8 +158,7 @@ grib_accessor_class* grib_accessor_class_codetable = &_grib_accessor_class_codet /* END_CLASS_IMP */ -static int grib_load_codetable(grib_context* c, const char* filename, - const char* recomposed_name, size_t size, grib_codetable* t); +static int grib_load_codetable(grib_context* c, const char* filename, const char* recomposed_name, size_t size, grib_codetable* t); static void init(grib_accessor* a, const long len, grib_arguments* params) { @@ -276,14 +275,14 @@ static void dump_codetable(grib_codetable* atable) } } #endif -static grib_codetable* load_table(grib_accessor_codetable* self) +static grib_codetable* load_table(grib_accessor* a) { + grib_accessor_codetable* self = (grib_accessor_codetable*)a; size_t size = 0; grib_handle* h = ((grib_accessor*)self)->parent->h; grib_context* c = h->context; grib_codetable* t = NULL; grib_codetable* next = NULL; - grib_accessor* a = (grib_accessor*)self; char* filename = 0; char recomposed[1024] = {0,}; char localRecomposed[1024] = {0,}; @@ -541,7 +540,7 @@ static void dump(grib_accessor* a, grib_dumper* dumper) long value; if (!self->table_loaded) { - self->table = load_table(self); /* may return NULL */ + self->table = load_table(a); /* may return NULL */ self->table_loaded = 1; } table = self->table; @@ -604,7 +603,7 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len) return err; if (!self->table_loaded) { - self->table = load_table(self); /* may return NULL */ + self->table = load_table(a); /* may return NULL */ self->table_loaded = 1; } table = self->table; @@ -655,7 +654,7 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t* len) #endif if (!self->table_loaded) { - self->table = load_table(self); /* may return NULL */ + self->table = load_table(a); /* may return NULL */ self->table_loaded = 1; } table = self->table; @@ -778,7 +777,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) rlen = 1; /* ECC-480 Performance: avoid func call overhead of grib_value_count */ if (!self->table_loaded) { - self->table = load_table(self); /* may return NULL */ + self->table = load_table(a); /* may return NULL */ self->table_loaded = 1; } diff --git a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc b/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc index 1c218bad4..7deb5fbaa 100644 --- a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc +++ b/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc @@ -49,7 +49,8 @@ MEMBERS=double* dvalues MEMBERS=float* fvalues MEMBERS=size_t size - + MEMBERS=int double_dirty + MEMBERS=int float_dirty END_CLASS_DEF diff --git a/src/grib_accessor_class_data_g2bifourier_packing.cc b/src/grib_accessor_class_data_g2bifourier_packing.cc index 04d76cb3a..8dc83650e 100644 --- a/src/grib_accessor_class_data_g2bifourier_packing.cc +++ b/src/grib_accessor_class_data_g2bifourier_packing.cc @@ -500,9 +500,11 @@ static void free_bif_trunc(bif_trunc_t* bt, grib_accessor* a) grib_context_free(gh->context, bt); } -static bif_trunc_t* new_bif_trunc(grib_accessor* a, grib_accessor_data_g2bifourier_packing* self) +static bif_trunc_t* new_bif_trunc(grib_accessor* a) { int ret; + grib_accessor_data_g2bifourier_packing* self = (grib_accessor_data_g2bifourier_packing*)a; + grib_handle* gh = grib_handle_of_accessor(a); bif_trunc_t* bt = (bif_trunc_t*)grib_context_malloc(gh->context, sizeof(bif_trunc_t)); @@ -641,7 +643,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) if ((ret = grib_value_count(a, &count)) != GRIB_SUCCESS) goto cleanup; - bt = new_bif_trunc(a, self); + bt = new_bif_trunc(a); if (bt == NULL) { ret = GRIB_INTERNAL_ERROR; @@ -742,7 +744,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) goto cleanup; } - bt = new_bif_trunc(a, self); + bt = new_bif_trunc(a); if (bt == NULL) { long makeTemplate = 0; diff --git a/src/grib_accessor_class_expanded_descriptors.cc b/src/grib_accessor_class_expanded_descriptors.cc index 4cceae5d8..d944e7d35 100644 --- a/src/grib_accessor_class_expanded_descriptors.cc +++ b/src/grib_accessor_class_expanded_descriptors.cc @@ -216,8 +216,7 @@ static char* descriptor_type_name(int dtype) } #endif -static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_descriptors_array* expanded, - change_coding_params* ccp, int* err) +static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_descriptors_array* expanded, change_coding_params* ccp, int* err) { int k, j, i; grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; diff --git a/src/grib_accessor_class_variable.cc b/src/grib_accessor_class_variable.cc index 3d5aa6766..b03a06c30 100644 --- a/src/grib_accessor_class_variable.cc +++ b/src/grib_accessor_class_variable.cc @@ -236,27 +236,27 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) static int unpack_double(grib_accessor* a, double* val, size_t* len) { - grib_accessor_variable* ac = (grib_accessor_variable*)a; + grib_accessor_variable* self = (grib_accessor_variable*)a; if (*len < 1) { grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); *len = 0; return GRIB_ARRAY_TOO_SMALL; } - *val = ac->dval; + *val = self->dval; *len = 1; return GRIB_SUCCESS; } static int unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_variable* ac = (grib_accessor_variable*)a; + grib_accessor_variable* self = (grib_accessor_variable*)a; if (*len < 1) { grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); *len = 0; return GRIB_ARRAY_TOO_SMALL; } - *val = (long)ac->dval; + *val = (long)self->dval; *len = 1; return GRIB_SUCCESS; } diff --git a/src/j2/accessor.cc.j2 b/src/j2/accessor.cc.j2 index 8d02090cd..48fa85aa5 100644 --- a/src/j2/accessor.cc.j2 +++ b/src/j2/accessor.cc.j2 @@ -19,11 +19,12 @@ {% for n in c.namespaces %}namespace {{ n }} { {% endfor %} -// top level code '-start-' +// start top level code '-start-' {% for line in c.top_level_code['-start-'] %}{{ line }} {% endfor %} {% for m in c.static_functions %} +// start top level code '{{ m.name }}' {% for line in c.top_level_code[m.name] %}{{ line }} {% endfor %} static {{ m.return_type }} {{ m.name }}({{ m.args_declaration }}) { @@ -78,7 +79,7 @@ const char* {{ c.name }}::className() const { return "{{ c.name }}"; } -/* top level code -end- */ +// top level code '-end-' {% for line in c.top_level_code['-end-'] %}{{ line }} {% endfor %} diff --git a/src/j2/accessor.h.j2 b/src/j2/accessor.h.j2 index 5c8c513ca..8a54b2d9d 100644 --- a/src/j2/accessor.h.j2 +++ b/src/j2/accessor.h.j2 @@ -16,10 +16,13 @@ #include {{ i }} {% endfor %} - {% for n in c.namespaces %}namespace {{ n }} { {% endfor %} +{% for f in c.forward_declarations %} +{{ f }}; +{% endfor %} + class {{ c.name }} : public {{ c.super }} { public: diff --git a/src/patches/grib_accessor_class_assert.py b/src/patches/grib_accessor_class_assert.py new file mode 100644 index 000000000..7ea7b410e --- /dev/null +++ b/src/patches/grib_accessor_class_assert.py @@ -0,0 +1,2 @@ +def patch(klass): + klass.cannot_convert_method("notify_change") diff --git a/src/patches/grib_accessor_class_bufr_data_array.py b/src/patches/grib_accessor_class_bufr_data_array.py new file mode 100644 index 000000000..1fb62d795 --- /dev/null +++ b/src/patches/grib_accessor_class_bufr_data_array.py @@ -0,0 +1,2 @@ +def patch(klass): + klass.cannot_convert_top_level("restart_bitmap") diff --git a/src/patches/grib_accessor_class_bufr_data_element.py b/src/patches/grib_accessor_class_bufr_data_element.py index 2eb0e4f71..fd3e57d91 100644 --- a/src/patches/grib_accessor_class_bufr_data_element.py +++ b/src/patches/grib_accessor_class_bufr_data_element.py @@ -1,2 +1,4 @@ def patch(klass): klass.cannot_convert_top_level("init") + klass.cannot_convert_method("destroy") + klass.cannot_convert_method("make_clone") diff --git a/src/patches/grib_accessor_class_bufrdc_expanded_descriptors.py b/src/patches/grib_accessor_class_bufrdc_expanded_descriptors.py new file mode 100644 index 000000000..a3793618c --- /dev/null +++ b/src/patches/grib_accessor_class_bufrdc_expanded_descriptors.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.mark_mutable("expandedDescriptorsAccessor_") + diff --git a/src/patches/grib_accessor_class_codetable.py b/src/patches/grib_accessor_class_codetable.py new file mode 100644 index 000000000..6e8696bdc --- /dev/null +++ b/src/patches/grib_accessor_class_codetable.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_method("load_table") + diff --git a/src/patches/grib_accessor_class_codetable_title.py b/src/patches/grib_accessor_class_codetable_title.py new file mode 100644 index 000000000..54409d75d --- /dev/null +++ b/src/patches/grib_accessor_class_codetable_title.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_method("unpack_string") + diff --git a/src/patches/grib_accessor_class_codetable_units.py b/src/patches/grib_accessor_class_codetable_units.py new file mode 100644 index 000000000..54409d75d --- /dev/null +++ b/src/patches/grib_accessor_class_codetable_units.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_method("unpack_string") + diff --git a/src/patches/grib_accessor_class_concept.py b/src/patches/grib_accessor_class_concept.py new file mode 100644 index 000000000..54409d75d --- /dev/null +++ b/src/patches/grib_accessor_class_concept.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_method("unpack_string") + diff --git a/src/patches/grib_accessor_class_data_g1second_order_general_extended_packing.py b/src/patches/grib_accessor_class_data_g1second_order_general_extended_packing.py index fa9ab4910..7b8679546 100644 --- a/src/patches/grib_accessor_class_data_g1second_order_general_extended_packing.py +++ b/src/patches/grib_accessor_class_data_g1second_order_general_extended_packing.py @@ -1,3 +1,8 @@ def patch(klass): + klass.cannot_convert_method("destroy") klass.mark_mutable("size_") + klass.mark_mutable("fvalues_") + klass.mark_mutable("dvalues_") + klass.mark_mutable("double_dirty_") + klass.mark_mutable("float_dirty_") diff --git a/src/patches/grib_accessor_class_data_g2bifourier_packing.py b/src/patches/grib_accessor_class_data_g2bifourier_packing.py new file mode 100644 index 000000000..3e7bac501 --- /dev/null +++ b/src/patches/grib_accessor_class_data_g2bifourier_packing.py @@ -0,0 +1,2 @@ +def patch(klass): + klass.add_forward_declaration("typedef struct bif_trunc_t bif_trunc_t") diff --git a/src/patches/grib_accessor_class_data_g2simple_packing_with_preprocessing.py b/src/patches/grib_accessor_class_data_g2simple_packing_with_preprocessing.py new file mode 100644 index 000000000..bceed3c42 --- /dev/null +++ b/src/patches/grib_accessor_class_data_g2simple_packing_with_preprocessing.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_method("unpack_double") + diff --git a/src/patches/grib_accessor_class_g1_message_length.py b/src/patches/grib_accessor_class_g1_message_length.py index aa8f1a185..2b1ceefc8 100644 --- a/src/patches/grib_accessor_class_g1_message_length.py +++ b/src/patches/grib_accessor_class_g1_message_length.py @@ -1,4 +1,4 @@ def patch(klass): - return - klass.cannot_convert_method("pack_double") + klass.cannot_convert_method("unpack_long") + klass.cannot_convert_method("pack_long") diff --git a/src/patches/grib_accessor_class_gen.py b/src/patches/grib_accessor_class_gen.py index 79c7502d4..8d2c526ad 100644 --- a/src/patches/grib_accessor_class_gen.py +++ b/src/patches/grib_accessor_class_gen.py @@ -1,3 +1,14 @@ def patch(klass): + klass.cannot_convert_method("init") klass.cannot_convert_method("unpack_long") - + klass.cannot_convert_method("pack_double") + klass.cannot_convert_method("pack_long") + klass.cannot_convert_method("pack_string") + klass.cannot_convert_method("next") + klass.cannot_convert_method("unpack") + klass.cannot_convert_method("pack_double_array_as_long") + klass.cannot_convert_method("unpack_string_array") + klass.cannot_convert_method("unpack_string") + klass.cannot_convert_method("notify_change") + klass.cannot_convert_method("destroy") + klass.cannot_convert_method("pack_string_array") diff --git a/src/patches/grib_accessor_class_iterator.py b/src/patches/grib_accessor_class_iterator.py new file mode 100644 index 000000000..b1fa887f8 --- /dev/null +++ b/src/patches/grib_accessor_class_iterator.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_top_level("-end-") + diff --git a/src/patches/grib_accessor_class_lookup.py b/src/patches/grib_accessor_class_lookup.py new file mode 100644 index 000000000..a03e9377c --- /dev/null +++ b/src/patches/grib_accessor_class_lookup.py @@ -0,0 +1,4 @@ +def patch(klass): + klass.cannot_convert_method("post_init") + klass.cannot_convert_method("notify_change") + diff --git a/src/patches/grib_accessor_class_section.py b/src/patches/grib_accessor_class_section.py new file mode 100644 index 000000000..0242cdcfb --- /dev/null +++ b/src/patches/grib_accessor_class_section.py @@ -0,0 +1,7 @@ +def patch(klass): + klass.cannot_convert_method("init") + klass.cannot_convert_method("destroy") + klass.cannot_convert_method("update_size") + klass.cannot_convert_method("next") + klass.cannot_convert_method("byte_count") + klass.cannot_convert_method("sub_section") diff --git a/src/patches/grib_accessor_class_section_length.py b/src/patches/grib_accessor_class_section_length.py new file mode 100644 index 000000000..a6371d1c9 --- /dev/null +++ b/src/patches/grib_accessor_class_section_length.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_method("init") + diff --git a/src/patches/grib_accessor_class_smart_table.py b/src/patches/grib_accessor_class_smart_table.py index 395e1443a..079b6ab2d 100644 --- a/src/patches/grib_accessor_class_smart_table.py +++ b/src/patches/grib_accessor_class_smart_table.py @@ -1,6 +1,8 @@ def patch(klass): # Redefined :-( klass.mark_mutable("dirty_") + klass.mark_mutable("tableCodesSize_") + klass.mark_mutable("table_") + klass.mark_mutable("tableCodes_") klass.cannot_convert_method("init") - - + klass.cannot_convert_method("destroy") diff --git a/src/patches/grib_accessor_class_smart_table_column.py b/src/patches/grib_accessor_class_smart_table_column.py new file mode 100644 index 000000000..afbcd9dd4 --- /dev/null +++ b/src/patches/grib_accessor_class_smart_table_column.py @@ -0,0 +1,4 @@ +def patch(klass): + klass.cannot_convert_method("unpack_long") + klass.cannot_convert_method("destroy") + klass.cannot_convert_method("unpack_string_array") diff --git a/src/patches/grib_accessor_class_to_double.py b/src/patches/grib_accessor_class_to_double.py new file mode 100644 index 000000000..236715988 --- /dev/null +++ b/src/patches/grib_accessor_class_to_double.py @@ -0,0 +1,4 @@ +def patch(klass): + klass.cannot_convert_method("string_length") + + diff --git a/src/patches/grib_accessor_class_transient_darray.py b/src/patches/grib_accessor_class_transient_darray.py new file mode 100644 index 000000000..cbf4c874a --- /dev/null +++ b/src/patches/grib_accessor_class_transient_darray.py @@ -0,0 +1,3 @@ +def patch(klass): + klass.cannot_convert_method("destroy") + diff --git a/src/patches/grib_accessor_class_variable.py b/src/patches/grib_accessor_class_variable.py new file mode 100644 index 000000000..b08865f45 --- /dev/null +++ b/src/patches/grib_accessor_class_variable.py @@ -0,0 +1,4 @@ +def patch(klass): + klass.cannot_convert_method("destroy") + klass.cannot_convert_top_level("dump") + klass.cannot_convert_method("make_clone") diff --git a/src/patches/grib_accessor_class_when.py b/src/patches/grib_accessor_class_when.py index 7ea7b410e..e0389f4fd 100644 --- a/src/patches/grib_accessor_class_when.py +++ b/src/patches/grib_accessor_class_when.py @@ -1,2 +1,3 @@ def patch(klass): klass.cannot_convert_method("notify_change") + # klass.cannot_convert_method("concept_evaluate")