text:
# Julia wrapper for header: /opt/local/include/gdal_pam.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0

function GDALGetDataTypeSize(arg1::GDALDataType)
    ccall((:GDALGetDataTypeSize,libgdal),Cint,(GDALDataType,),arg1)
end

function GDALDataTypeIsComplex(arg1::GDALDataType)
    ccall((:GDALDataTypeIsComplex,libgdal),Cint,(GDALDataType,),arg1)
end

function GDALGetDataTypeName(arg1::GDALDataType)
    ccall((:GDALGetDataTypeName,libgdal),Ptr{Uint8},(GDALDataType,),arg1)
end

function GDALGetDataTypeByName(arg1::Ptr{Uint8})
    ccall((:GDALGetDataTypeByName,libgdal),GDALDataType,(Ptr{Uint8},),arg1)
end

function GDALDataTypeUnion(arg1::GDALDataType,arg2::GDALDataType)
    ccall((:GDALDataTypeUnion,libgdal),GDALDataType,(GDALDataType,GDALDataType),arg1,arg2)
end

function GDALGetAsyncStatusTypeName(arg1::GDALAsyncStatusType)
    ccall((:GDALGetAsyncStatusTypeName,libgdal),Ptr{Uint8},(GDALAsyncStatusType,),arg1)
end

function GDALGetAsyncStatusTypeByName(arg1::Ptr{Uint8})
    ccall((:GDALGetAsyncStatusTypeByName,libgdal),GDALAsyncStatusType,(Ptr{Uint8},),arg1)
end

function GDALGetColorInterpretationName(arg1::GDALColorInterp)
    ccall((:GDALGetColorInterpretationName,libgdal),Ptr{Uint8},(GDALColorInterp,),arg1)
end

function GDALGetColorInterpretationByName(pszName::Ptr{Uint8})
    ccall((:GDALGetColorInterpretationByName,libgdal),GDALColorInterp,(Ptr{Uint8},),pszName)
end

function GDALGetPaletteInterpretationName(arg1::GDALPaletteInterp)
    ccall((:GDALGetPaletteInterpretationName,libgdal),Ptr{Uint8},(GDALPaletteInterp,),arg1)
end

function GDALAllRegister()
    ccall((:GDALAllRegister,libgdal),Void,())
end

function GDALCreate(hDriver::GDALDriverH,arg1::Ptr{Uint8},arg2::Cint,arg3::Cint,arg4::Cint,arg5::GDALDataType,arg6::Ptr{Ptr{Uint8}})
    ccall((:GDALCreate,libgdal),GDALDatasetH,(GDALDriverH,Ptr{Uint8},Cint,Cint,Cint,GDALDataType,Ptr{Ptr{Uint8}}),hDriver,arg1,arg2,arg3,arg4,arg5,arg6)
end

function GDALCreateCopy(arg1::GDALDriverH,arg2::Ptr{Uint8},arg3::GDALDatasetH,arg4::Cint,arg5::Ptr{Ptr{Uint8}},arg6::GDALProgressFunc,arg7::Ptr{Void})
    ccall((:GDALCreateCopy,libgdal),GDALDatasetH,(GDALDriverH,Ptr{Uint8},GDALDatasetH,Cint,Ptr{Ptr{Uint8}},GDALProgressFunc,Ptr{Void}),arg1,arg2,arg3,arg4,arg5,arg6,arg7)
end

function GDALIdentifyDriver(pszFilename::Ptr{Uint8},papszFileList::Ptr{Ptr{Uint8}})
    ccall((:GDALIdentifyDriver,libgdal),GDALDriverH,(Ptr{Uint8},Ptr{Ptr{Uint8}}),pszFilename,papszFileList)
end

function GDALOpen(pszFilename::Ptr{Uint8},eAccess::GDALAccess)
    ccall((:GDALOpen,libgdal),GDALDatasetH,(Ptr{Uint8},GDALAccess),pszFilename,eAccess)
end

function GDALOpenShared(arg1::Ptr{Uint8},arg2::GDALAccess)
    ccall((:GDALOpenShared,libgdal),GDALDatasetH,(Ptr{Uint8},GDALAccess),arg1,arg2)
end

function GDALDumpOpenDatasets(arg1::Ptr{FILE})
    ccall((:GDALDumpOpenDatasets,libgdal),Cint,(Ptr{FILE},),arg1)
end

function GDALGetDriverByName(arg1::Ptr{Uint8})
    ccall((:GDALGetDriverByName,libgdal),GDALDriverH,(Ptr{Uint8},),arg1)
end

function GDALGetDriverCount()
    ccall((:GDALGetDriverCount,libgdal),Cint,())
end

function GDALGetDriver(arg1::Cint)
    ccall((:GDALGetDriver,libgdal),GDALDriverH,(Cint,),arg1)
end

function GDALDestroyDriver(arg1::GDALDriverH)
    ccall((:GDALDestroyDriver,libgdal),Void,(GDALDriverH,),arg1)
end

function GDALRegisterDriver(arg1::GDALDriverH)
    ccall((:GDALRegisterDriver,libgdal),Cint,(GDALDriverH,),arg1)
end

function GDALDeregisterDriver(arg1::GDALDriverH)
    ccall((:GDALDeregisterDriver,libgdal),Void,(GDALDriverH,),arg1)
end

function GDALDestroyDriverManager()
    ccall((:GDALDestroyDriverManager,libgdal),Void,())
end

function GDALDeleteDataset(arg1::GDALDriverH,arg2::Ptr{Uint8})
    ccall((:GDALDeleteDataset,libgdal),CPLErr,(GDALDriverH,Ptr{Uint8}),arg1,arg2)
end

function GDALRenameDataset(arg1::GDALDriverH,pszNewName::Ptr{Uint8},pszOldName::Ptr{Uint8})
    ccall((:GDALRenameDataset,libgdal),CPLErr,(GDALDriverH,Ptr{Uint8},Ptr{Uint8}),arg1,pszNewName,pszOldName)
end

function GDALCopyDatasetFiles(arg1::GDALDriverH,pszNewName::Ptr{Uint8},pszOldName::Ptr{Uint8})
    ccall((:GDALCopyDatasetFiles,libgdal),CPLErr,(GDALDriverH,Ptr{Uint8},Ptr{Uint8}),arg1,pszNewName,pszOldName)
end

function GDALValidateCreationOptions(arg1::GDALDriverH,papszCreationOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALValidateCreationOptions,libgdal),Cint,(GDALDriverH,Ptr{Ptr{Uint8}}),arg1,papszCreationOptions)
end

function GDALGetDriverShortName(arg1::GDALDriverH)
    ccall((:GDALGetDriverShortName,libgdal),Ptr{Uint8},(GDALDriverH,),arg1)
end

function GDALGetDriverLongName(arg1::GDALDriverH)
    ccall((:GDALGetDriverLongName,libgdal),Ptr{Uint8},(GDALDriverH,),arg1)
end

function GDALGetDriverHelpTopic(arg1::GDALDriverH)
    ccall((:GDALGetDriverHelpTopic,libgdal),Ptr{Uint8},(GDALDriverH,),arg1)
end

function GDALGetDriverCreationOptionList(arg1::GDALDriverH)
    ccall((:GDALGetDriverCreationOptionList,libgdal),Ptr{Uint8},(GDALDriverH,),arg1)
end

function GDALInitGCPs(arg1::Cint,arg2::Ptr{GDAL_GCP})
    ccall((:GDALInitGCPs,libgdal),Void,(Cint,Ptr{GDAL_GCP}),arg1,arg2)
end

function GDALDeinitGCPs(arg1::Cint,arg2::Ptr{GDAL_GCP})
    ccall((:GDALDeinitGCPs,libgdal),Void,(Cint,Ptr{GDAL_GCP}),arg1,arg2)
end

function GDALDuplicateGCPs(arg1::Cint,arg2::Ptr{GDAL_GCP})
    ccall((:GDALDuplicateGCPs,libgdal),Ptr{GDAL_GCP},(Cint,Ptr{GDAL_GCP}),arg1,arg2)
end

function GDALGCPsToGeoTransform(nGCPCount::Cint,pasGCPs::Ptr{GDAL_GCP},padfGeoTransform::Ptr{Cdouble},bApproxOK::Cint)
    ccall((:GDALGCPsToGeoTransform,libgdal),Cint,(Cint,Ptr{GDAL_GCP},Ptr{Cdouble},Cint),nGCPCount,pasGCPs,padfGeoTransform,bApproxOK)
end

function GDALInvGeoTransform(padfGeoTransformIn::Ptr{Cdouble},padfInvGeoTransformOut::Ptr{Cdouble})
    ccall((:GDALInvGeoTransform,libgdal),Cint,(Ptr{Cdouble},Ptr{Cdouble}),padfGeoTransformIn,padfInvGeoTransformOut)
end

function GDALApplyGeoTransform(arg1::Ptr{Cdouble},arg2::Cdouble,arg3::Cdouble,arg4::Ptr{Cdouble},arg5::Ptr{Cdouble})
    ccall((:GDALApplyGeoTransform,libgdal),Void,(Ptr{Cdouble},Cdouble,Cdouble,Ptr{Cdouble},Ptr{Cdouble}),arg1,arg2,arg3,arg4,arg5)
end

function GDALComposeGeoTransforms(padfGeoTransform1::Ptr{Cdouble},padfGeoTransform2::Ptr{Cdouble},padfGeoTransformOut::Ptr{Cdouble})
    ccall((:GDALComposeGeoTransforms,libgdal),Void,(Ptr{Cdouble},Ptr{Cdouble},Ptr{Cdouble}),padfGeoTransform1,padfGeoTransform2,padfGeoTransformOut)
end

function GDALGetMetadataDomainList(hObject::GDALMajorObjectH)
    ccall((:GDALGetMetadataDomainList,libgdal),Ptr{Ptr{Uint8}},(GDALMajorObjectH,),hObject)
end

function GDALGetMetadata(arg1::GDALMajorObjectH,arg2::Ptr{Uint8})
    ccall((:GDALGetMetadata,libgdal),Ptr{Ptr{Uint8}},(GDALMajorObjectH,Ptr{Uint8}),arg1,arg2)
end

function GDALSetMetadata(arg1::GDALMajorObjectH,arg2::Ptr{Ptr{Uint8}},arg3::Ptr{Uint8})
    ccall((:GDALSetMetadata,libgdal),CPLErr,(GDALMajorObjectH,Ptr{Ptr{Uint8}},Ptr{Uint8}),arg1,arg2,arg3)
end

function GDALGetMetadataItem(arg1::GDALMajorObjectH,arg2::Ptr{Uint8},arg3::Ptr{Uint8})
    ccall((:GDALGetMetadataItem,libgdal),Ptr{Uint8},(GDALMajorObjectH,Ptr{Uint8},Ptr{Uint8}),arg1,arg2,arg3)
end

function GDALSetMetadataItem(arg1::GDALMajorObjectH,arg2::Ptr{Uint8},arg3::Ptr{Uint8},arg4::Ptr{Uint8})
    ccall((:GDALSetMetadataItem,libgdal),CPLErr,(GDALMajorObjectH,Ptr{Uint8},Ptr{Uint8},Ptr{Uint8}),arg1,arg2,arg3,arg4)
end

function GDALGetDescription(arg1::GDALMajorObjectH)
    ccall((:GDALGetDescription,libgdal),Ptr{Uint8},(GDALMajorObjectH,),arg1)
end

function GDALSetDescription(arg1::GDALMajorObjectH,arg2::Ptr{Uint8})
    ccall((:GDALSetDescription,libgdal),Void,(GDALMajorObjectH,Ptr{Uint8}),arg1,arg2)
end

function GDALGetDatasetDriver(arg1::GDALDatasetH)
    ccall((:GDALGetDatasetDriver,libgdal),GDALDriverH,(GDALDatasetH,),arg1)
end

function GDALGetFileList(arg1::GDALDatasetH)
    ccall((:GDALGetFileList,libgdal),Ptr{Ptr{Uint8}},(GDALDatasetH,),arg1)
end

function GDALClose(arg1::GDALDatasetH)
    ccall((:GDALClose,libgdal),Void,(GDALDatasetH,),arg1)
end

function GDALGetRasterXSize(arg1::GDALDatasetH)
    ccall((:GDALGetRasterXSize,libgdal),Cint,(GDALDatasetH,),arg1)
end

function GDALGetRasterYSize(arg1::GDALDatasetH)
    ccall((:GDALGetRasterYSize,libgdal),Cint,(GDALDatasetH,),arg1)
end

function GDALGetRasterCount(arg1::GDALDatasetH)
    ccall((:GDALGetRasterCount,libgdal),Cint,(GDALDatasetH,),arg1)
end

function GDALGetRasterBand(arg1::GDALDatasetH,arg2::Cint)
    ccall((:GDALGetRasterBand,libgdal),GDALRasterBandH,(GDALDatasetH,Cint),arg1,arg2)
end

function GDALAddBand(hDS::GDALDatasetH,eType::GDALDataType,papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALAddBand,libgdal),CPLErr,(GDALDatasetH,GDALDataType,Ptr{Ptr{Uint8}}),hDS,eType,papszOptions)
end

function GDALBeginAsyncReader(hDS::GDALDatasetH,nXOff::Cint,nYOff::Cint,nXSize::Cint,nYSize::Cint,pBuf::Ptr{Void},nBufXSize::Cint,nBufYSize::Cint,eBufType::GDALDataType,nBandCount::Cint,panBandMap::Ptr{Cint},nPixelSpace::Cint,nLineSpace::Cint,nBandSpace::Cint,papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALBeginAsyncReader,libgdal),GDALAsyncReaderH,(GDALDatasetH,Cint,Cint,Cint,Cint,Ptr{Void},Cint,Cint,GDALDataType,Cint,Ptr{Cint},Cint,Cint,Cint,Ptr{Ptr{Uint8}}),hDS,nXOff,nYOff,nXSize,nYSize,pBuf,nBufXSize,nBufYSize,eBufType,nBandCount,panBandMap,nPixelSpace,nLineSpace,nBandSpace,papszOptions)
end

function GDALEndAsyncReader(hDS::GDALDatasetH,hAsynchReaderH::GDALAsyncReaderH)
    ccall((:GDALEndAsyncReader,libgdal),Void,(GDALDatasetH,GDALAsyncReaderH),hDS,hAsynchReaderH)
end

function GDALDatasetRasterIO(hDS::GDALDatasetH,eRWFlag::GDALRWFlag,nDSXOff::Cint,nDSYOff::Cint,nDSXSize::Cint,nDSYSize::Cint,pBuffer::Ptr{Void},nBXSize::Cint,nBYSize::Cint,eBDataType::GDALDataType,nBandCount::Cint,panBandCount::Ptr{Cint},nPixelSpace::Cint,nLineSpace::Cint,nBandSpace::Cint)
    ccall((:GDALDatasetRasterIO,libgdal),CPLErr,(GDALDatasetH,GDALRWFlag,Cint,Cint,Cint,Cint,Ptr{Void},Cint,Cint,GDALDataType,Cint,Ptr{Cint},Cint,Cint,Cint),hDS,eRWFlag,nDSXOff,nDSYOff,nDSXSize,nDSYSize,pBuffer,nBXSize,nBYSize,eBDataType,nBandCount,panBandCount,nPixelSpace,nLineSpace,nBandSpace)
end

function GDALDatasetAdviseRead(hDS::GDALDatasetH,nDSXOff::Cint,nDSYOff::Cint,nDSXSize::Cint,nDSYSize::Cint,nBXSize::Cint,nBYSize::Cint,eBDataType::GDALDataType,nBandCount::Cint,panBandCount::Ptr{Cint},papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALDatasetAdviseRead,libgdal),CPLErr,(GDALDatasetH,Cint,Cint,Cint,Cint,Cint,Cint,GDALDataType,Cint,Ptr{Cint},Ptr{Ptr{Uint8}}),hDS,nDSXOff,nDSYOff,nDSXSize,nDSYSize,nBXSize,nBYSize,eBDataType,nBandCount,panBandCount,papszOptions)
end

function GDALGetProjectionRef(arg1::GDALDatasetH)
    ccall((:GDALGetProjectionRef,libgdal),Ptr{Uint8},(GDALDatasetH,),arg1)
end

function GDALSetProjection(arg1::GDALDatasetH,arg2::Ptr{Uint8})
    ccall((:GDALSetProjection,libgdal),CPLErr,(GDALDatasetH,Ptr{Uint8}),arg1,arg2)
end

function GDALGetGeoTransform(arg1::GDALDatasetH,arg2::Ptr{Cdouble})
    ccall((:GDALGetGeoTransform,libgdal),CPLErr,(GDALDatasetH,Ptr{Cdouble}),arg1,arg2)
end

function GDALSetGeoTransform(arg1::GDALDatasetH,arg2::Ptr{Cdouble})
    ccall((:GDALSetGeoTransform,libgdal),CPLErr,(GDALDatasetH,Ptr{Cdouble}),arg1,arg2)
end

function GDALGetGCPCount(arg1::GDALDatasetH)
    ccall((:GDALGetGCPCount,libgdal),Cint,(GDALDatasetH,),arg1)
end

function GDALGetGCPProjection(arg1::GDALDatasetH)
    ccall((:GDALGetGCPProjection,libgdal),Ptr{Uint8},(GDALDatasetH,),arg1)
end

function GDALGetGCPs(arg1::GDALDatasetH)
    ccall((:GDALGetGCPs,libgdal),Ptr{GDAL_GCP},(GDALDatasetH,),arg1)
end

function GDALSetGCPs(arg1::GDALDatasetH,arg2::Cint,arg3::Ptr{GDAL_GCP},arg4::Ptr{Uint8})
    ccall((:GDALSetGCPs,libgdal),CPLErr,(GDALDatasetH,Cint,Ptr{GDAL_GCP},Ptr{Uint8}),arg1,arg2,arg3,arg4)
end

function GDALGetInternalHandle(arg1::GDALDatasetH,arg2::Ptr{Uint8})
    ccall((:GDALGetInternalHandle,libgdal),Ptr{Void},(GDALDatasetH,Ptr{Uint8}),arg1,arg2)
end

function GDALReferenceDataset(arg1::GDALDatasetH)
    ccall((:GDALReferenceDataset,libgdal),Cint,(GDALDatasetH,),arg1)
end

function GDALDereferenceDataset(arg1::GDALDatasetH)
    ccall((:GDALDereferenceDataset,libgdal),Cint,(GDALDatasetH,),arg1)
end

function GDALBuildOverviews(arg1::GDALDatasetH,arg2::Ptr{Uint8},arg3::Cint,arg4::Ptr{Cint},arg5::Cint,arg6::Ptr{Cint},arg7::GDALProgressFunc,arg8::Ptr{Void})
    ccall((:GDALBuildOverviews,libgdal),CPLErr,(GDALDatasetH,Ptr{Uint8},Cint,Ptr{Cint},Cint,Ptr{Cint},GDALProgressFunc,Ptr{Void}),arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
end

function GDALGetOpenDatasets(hDS::Ptr{Ptr{GDALDatasetH}},pnCount::Ptr{Cint})
    ccall((:GDALGetOpenDatasets,libgdal),Void,(Ptr{Ptr{GDALDatasetH}},Ptr{Cint}),hDS,pnCount)
end

function GDALGetAccess(hDS::GDALDatasetH)
    ccall((:GDALGetAccess,libgdal),Cint,(GDALDatasetH,),hDS)
end

function GDALFlushCache(hDS::GDALDatasetH)
    ccall((:GDALFlushCache,libgdal),Void,(GDALDatasetH,),hDS)
end

function GDALCreateDatasetMaskBand(hDS::GDALDatasetH,nFlags::Cint)
    ccall((:GDALCreateDatasetMaskBand,libgdal),CPLErr,(GDALDatasetH,Cint),hDS,nFlags)
end

function GDALDatasetCopyWholeRaster(hSrcDS::GDALDatasetH,hDstDS::GDALDatasetH,papszOptions::Ptr{Ptr{Uint8}},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALDatasetCopyWholeRaster,libgdal),CPLErr,(GDALDatasetH,GDALDatasetH,Ptr{Ptr{Uint8}},GDALProgressFunc,Ptr{Void}),hSrcDS,hDstDS,papszOptions,pfnProgress,pProgressData)
end

function GDALRasterBandCopyWholeRaster(hSrcBand::GDALRasterBandH,hDstBand::GDALRasterBandH,papszOptions::Ptr{Ptr{Uint8}},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALRasterBandCopyWholeRaster,libgdal),CPLErr,(GDALRasterBandH,GDALRasterBandH,Ptr{Ptr{Uint8}},GDALProgressFunc,Ptr{Void}),hSrcBand,hDstBand,papszOptions,pfnProgress,pProgressData)
end

function GDALRegenerateOverviews(hSrcBand::GDALRasterBandH,nOverviewCount::Cint,pahOverviewBands::Ptr{GDALRasterBandH},pszResampling::Ptr{Uint8},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALRegenerateOverviews,libgdal),CPLErr,(GDALRasterBandH,Cint,Ptr{GDALRasterBandH},Ptr{Uint8},GDALProgressFunc,Ptr{Void}),hSrcBand,nOverviewCount,pahOverviewBands,pszResampling,pfnProgress,pProgressData)
end

function GDALGetRasterDataType(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterDataType,libgdal),GDALDataType,(GDALRasterBandH,),arg1)
end

function GDALGetBlockSize(arg1::GDALRasterBandH,pnXSize::Ptr{Cint},pnYSize::Ptr{Cint})
    ccall((:GDALGetBlockSize,libgdal),Void,(GDALRasterBandH,Ptr{Cint},Ptr{Cint}),arg1,pnXSize,pnYSize)
end

function GDALRasterAdviseRead(hRB::GDALRasterBandH,nDSXOff::Cint,nDSYOff::Cint,nDSXSize::Cint,nDSYSize::Cint,nBXSize::Cint,nBYSize::Cint,eBDataType::GDALDataType,papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALRasterAdviseRead,libgdal),CPLErr,(GDALRasterBandH,Cint,Cint,Cint,Cint,Cint,Cint,GDALDataType,Ptr{Ptr{Uint8}}),hRB,nDSXOff,nDSYOff,nDSXSize,nDSYSize,nBXSize,nBYSize,eBDataType,papszOptions)
end

function GDALRasterIO(hRBand::GDALRasterBandH,eRWFlag::GDALRWFlag,nDSXOff::Cint,nDSYOff::Cint,nDSXSize::Cint,nDSYSize::Cint,pBuffer::Ptr{Void},nBXSize::Cint,nBYSize::Cint,eBDataType::GDALDataType,nPixelSpace::Cint,nLineSpace::Cint)
    ccall((:GDALRasterIO,libgdal),CPLErr,(GDALRasterBandH,GDALRWFlag,Cint,Cint,Cint,Cint,Ptr{Void},Cint,Cint,GDALDataType,Cint,Cint),hRBand,eRWFlag,nDSXOff,nDSYOff,nDSXSize,nDSYSize,pBuffer,nBXSize,nBYSize,eBDataType,nPixelSpace,nLineSpace)
end

function GDALReadBlock(arg1::GDALRasterBandH,arg2::Cint,arg3::Cint,arg4::Ptr{Void})
    ccall((:GDALReadBlock,libgdal),CPLErr,(GDALRasterBandH,Cint,Cint,Ptr{Void}),arg1,arg2,arg3,arg4)
end

function GDALWriteBlock(arg1::GDALRasterBandH,arg2::Cint,arg3::Cint,arg4::Ptr{Void})
    ccall((:GDALWriteBlock,libgdal),CPLErr,(GDALRasterBandH,Cint,Cint,Ptr{Void}),arg1,arg2,arg3,arg4)
end

function GDALGetRasterBandXSize(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterBandXSize,libgdal),Cint,(GDALRasterBandH,),arg1)
end

function GDALGetRasterBandYSize(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterBandYSize,libgdal),Cint,(GDALRasterBandH,),arg1)
end

function GDALGetRasterAccess(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterAccess,libgdal),GDALAccess,(GDALRasterBandH,),arg1)
end

function GDALGetBandNumber(arg1::GDALRasterBandH)
    ccall((:GDALGetBandNumber,libgdal),Cint,(GDALRasterBandH,),arg1)
end

function GDALGetBandDataset(arg1::GDALRasterBandH)
    ccall((:GDALGetBandDataset,libgdal),GDALDatasetH,(GDALRasterBandH,),arg1)
end

function GDALGetRasterColorInterpretation(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterColorInterpretation,libgdal),GDALColorInterp,(GDALRasterBandH,),arg1)
end

function GDALSetRasterColorInterpretation(arg1::GDALRasterBandH,arg2::GDALColorInterp)
    ccall((:GDALSetRasterColorInterpretation,libgdal),CPLErr,(GDALRasterBandH,GDALColorInterp),arg1,arg2)
end

function GDALGetRasterColorTable(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterColorTable,libgdal),GDALColorTableH,(GDALRasterBandH,),arg1)
end

function GDALSetRasterColorTable(arg1::GDALRasterBandH,arg2::GDALColorTableH)
    ccall((:GDALSetRasterColorTable,libgdal),CPLErr,(GDALRasterBandH,GDALColorTableH),arg1,arg2)
end

function GDALHasArbitraryOverviews(arg1::GDALRasterBandH)
    ccall((:GDALHasArbitraryOverviews,libgdal),Cint,(GDALRasterBandH,),arg1)
end

function GDALGetOverviewCount(arg1::GDALRasterBandH)
    ccall((:GDALGetOverviewCount,libgdal),Cint,(GDALRasterBandH,),arg1)
end

function GDALGetOverview(arg1::GDALRasterBandH,arg2::Cint)
    ccall((:GDALGetOverview,libgdal),GDALRasterBandH,(GDALRasterBandH,Cint),arg1,arg2)
end

function GDALGetRasterNoDataValue(arg1::GDALRasterBandH,arg2::Ptr{Cint})
    ccall((:GDALGetRasterNoDataValue,libgdal),Cdouble,(GDALRasterBandH,Ptr{Cint}),arg1,arg2)
end

function GDALSetRasterNoDataValue(arg1::GDALRasterBandH,arg2::Cdouble)
    ccall((:GDALSetRasterNoDataValue,libgdal),CPLErr,(GDALRasterBandH,Cdouble),arg1,arg2)
end

function GDALGetRasterCategoryNames(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterCategoryNames,libgdal),Ptr{Ptr{Uint8}},(GDALRasterBandH,),arg1)
end

function GDALSetRasterCategoryNames(arg1::GDALRasterBandH,arg2::Ptr{Ptr{Uint8}})
    ccall((:GDALSetRasterCategoryNames,libgdal),CPLErr,(GDALRasterBandH,Ptr{Ptr{Uint8}}),arg1,arg2)
end

function GDALGetRasterMinimum(arg1::GDALRasterBandH,pbSuccess::Ptr{Cint})
    ccall((:GDALGetRasterMinimum,libgdal),Cdouble,(GDALRasterBandH,Ptr{Cint}),arg1,pbSuccess)
end

function GDALGetRasterMaximum(arg1::GDALRasterBandH,pbSuccess::Ptr{Cint})
    ccall((:GDALGetRasterMaximum,libgdal),Cdouble,(GDALRasterBandH,Ptr{Cint}),arg1,pbSuccess)
end

function GDALGetRasterStatistics(arg1::GDALRasterBandH,bApproxOK::Cint,bForce::Cint,pdfMin::Ptr{Cdouble},pdfMax::Ptr{Cdouble},pdfMean::Ptr{Cdouble},pdfStdDev::Ptr{Cdouble})
    ccall((:GDALGetRasterStatistics,libgdal),CPLErr,(GDALRasterBandH,Cint,Cint,Ptr{Cdouble},Ptr{Cdouble},Ptr{Cdouble},Ptr{Cdouble}),arg1,bApproxOK,bForce,pdfMin,pdfMax,pdfMean,pdfStdDev)
end

function GDALComputeRasterStatistics(arg1::GDALRasterBandH,bApproxOK::Cint,pdfMin::Ptr{Cdouble},pdfMax::Ptr{Cdouble},pdfMean::Ptr{Cdouble},pdfStdDev::Ptr{Cdouble},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALComputeRasterStatistics,libgdal),CPLErr,(GDALRasterBandH,Cint,Ptr{Cdouble},Ptr{Cdouble},Ptr{Cdouble},Ptr{Cdouble},GDALProgressFunc,Ptr{Void}),arg1,bApproxOK,pdfMin,pdfMax,pdfMean,pdfStdDev,pfnProgress,pProgressData)
end

function GDALSetRasterStatistics(hBand::GDALRasterBandH,dfMin::Cdouble,dfMax::Cdouble,dfMean::Cdouble,dfStdDev::Cdouble)
    ccall((:GDALSetRasterStatistics,libgdal),CPLErr,(GDALRasterBandH,Cdouble,Cdouble,Cdouble,Cdouble),hBand,dfMin,dfMax,dfMean,dfStdDev)
end

function GDALGetRasterUnitType(arg1::GDALRasterBandH)
    ccall((:GDALGetRasterUnitType,libgdal),Ptr{Uint8},(GDALRasterBandH,),arg1)
end

function GDALSetRasterUnitType(hBand::GDALRasterBandH,pszNewValue::Ptr{Uint8})
    ccall((:GDALSetRasterUnitType,libgdal),CPLErr,(GDALRasterBandH,Ptr{Uint8}),hBand,pszNewValue)
end

function GDALGetRasterOffset(arg1::GDALRasterBandH,pbSuccess::Ptr{Cint})
    ccall((:GDALGetRasterOffset,libgdal),Cdouble,(GDALRasterBandH,Ptr{Cint}),arg1,pbSuccess)
end

function GDALSetRasterOffset(hBand::GDALRasterBandH,dfNewOffset::Cdouble)
    ccall((:GDALSetRasterOffset,libgdal),CPLErr,(GDALRasterBandH,Cdouble),hBand,dfNewOffset)
end

function GDALGetRasterScale(arg1::GDALRasterBandH,pbSuccess::Ptr{Cint})
    ccall((:GDALGetRasterScale,libgdal),Cdouble,(GDALRasterBandH,Ptr{Cint}),arg1,pbSuccess)
end

function GDALSetRasterScale(hBand::GDALRasterBandH,dfNewOffset::Cdouble)
    ccall((:GDALSetRasterScale,libgdal),CPLErr,(GDALRasterBandH,Cdouble),hBand,dfNewOffset)
end

function GDALComputeRasterMinMax(hBand::GDALRasterBandH,bApproxOK::Cint,adfMinMax::Ptr{Cdouble})
    ccall((:GDALComputeRasterMinMax,libgdal),Void,(GDALRasterBandH,Cint,Ptr{Cdouble}),hBand,bApproxOK,adfMinMax)
end

function GDALFlushRasterCache(hBand::GDALRasterBandH)
    ccall((:GDALFlushRasterCache,libgdal),CPLErr,(GDALRasterBandH,),hBand)
end

function GDALGetRasterHistogram(hBand::GDALRasterBandH,dfMin::Cdouble,dfMax::Cdouble,nBuckets::Cint,panHistogram::Ptr{Cint},bIncludeOutOfRange::Cint,bApproxOK::Cint,pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALGetRasterHistogram,libgdal),CPLErr,(GDALRasterBandH,Cdouble,Cdouble,Cint,Ptr{Cint},Cint,Cint,GDALProgressFunc,Ptr{Void}),hBand,dfMin,dfMax,nBuckets,panHistogram,bIncludeOutOfRange,bApproxOK,pfnProgress,pProgressData)
end

function GDALGetDefaultHistogram(hBand::GDALRasterBandH,pdfMin::Ptr{Cdouble},pdfMax::Ptr{Cdouble},pnBuckets::Ptr{Cint},ppanHistogram::Ptr{Ptr{Cint}},bForce::Cint,pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALGetDefaultHistogram,libgdal),CPLErr,(GDALRasterBandH,Ptr{Cdouble},Ptr{Cdouble},Ptr{Cint},Ptr{Ptr{Cint}},Cint,GDALProgressFunc,Ptr{Void}),hBand,pdfMin,pdfMax,pnBuckets,ppanHistogram,bForce,pfnProgress,pProgressData)
end

function GDALSetDefaultHistogram(hBand::GDALRasterBandH,dfMin::Cdouble,dfMax::Cdouble,nBuckets::Cint,panHistogram::Ptr{Cint})
    ccall((:GDALSetDefaultHistogram,libgdal),CPLErr,(GDALRasterBandH,Cdouble,Cdouble,Cint,Ptr{Cint}),hBand,dfMin,dfMax,nBuckets,panHistogram)
end

function GDALGetRandomRasterSample(arg1::GDALRasterBandH,arg2::Cint,arg3::Ptr{Cfloat})
    ccall((:GDALGetRandomRasterSample,libgdal),Cint,(GDALRasterBandH,Cint,Ptr{Cfloat}),arg1,arg2,arg3)
end

function GDALGetRasterSampleOverview(arg1::GDALRasterBandH,arg2::Cint)
    ccall((:GDALGetRasterSampleOverview,libgdal),GDALRasterBandH,(GDALRasterBandH,Cint),arg1,arg2)
end

function GDALFillRaster(hBand::GDALRasterBandH,dfRealValue::Cdouble,dfImaginaryValue::Cdouble)
    ccall((:GDALFillRaster,libgdal),CPLErr,(GDALRasterBandH,Cdouble,Cdouble),hBand,dfRealValue,dfImaginaryValue)
end

function GDALComputeBandStats(hBand::GDALRasterBandH,nSampleStep::Cint,pdfMean::Ptr{Cdouble},pdfStdDev::Ptr{Cdouble},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALComputeBandStats,libgdal),CPLErr,(GDALRasterBandH,Cint,Ptr{Cdouble},Ptr{Cdouble},GDALProgressFunc,Ptr{Void}),hBand,nSampleStep,pdfMean,pdfStdDev,pfnProgress,pProgressData)
end

function GDALOverviewMagnitudeCorrection(hBaseBand::GDALRasterBandH,nOverviewCount::Cint,pahOverviews::Ptr{GDALRasterBandH},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALOverviewMagnitudeCorrection,libgdal),CPLErr,(GDALRasterBandH,Cint,Ptr{GDALRasterBandH},GDALProgressFunc,Ptr{Void}),hBaseBand,nOverviewCount,pahOverviews,pfnProgress,pProgressData)
end

function GDALGetDefaultRAT(hBand::GDALRasterBandH)
    ccall((:GDALGetDefaultRAT,libgdal),GDALRasterAttributeTableH,(GDALRasterBandH,),hBand)
end

function GDALSetDefaultRAT(arg1::GDALRasterBandH,arg2::GDALRasterAttributeTableH)
    ccall((:GDALSetDefaultRAT,libgdal),CPLErr,(GDALRasterBandH,GDALRasterAttributeTableH),arg1,arg2)
end

function GDALAddDerivedBandPixelFunc(pszName::Ptr{Uint8},pfnPixelFunc::GDALDerivedPixelFunc)
    ccall((:GDALAddDerivedBandPixelFunc,libgdal),CPLErr,(Ptr{Uint8},GDALDerivedPixelFunc),pszName,pfnPixelFunc)
end

function GDALGetMaskBand(hBand::GDALRasterBandH)
    ccall((:GDALGetMaskBand,libgdal),GDALRasterBandH,(GDALRasterBandH,),hBand)
end

function GDALGetMaskFlags(hBand::GDALRasterBandH)
    ccall((:GDALGetMaskFlags,libgdal),Cint,(GDALRasterBandH,),hBand)
end

function GDALCreateMaskBand(hBand::GDALRasterBandH,nFlags::Cint)
    ccall((:GDALCreateMaskBand,libgdal),CPLErr,(GDALRasterBandH,Cint),hBand,nFlags)
end

function GDALARGetNextUpdatedRegion(hARIO::GDALAsyncReaderH,dfTimeout::Cdouble,pnXBufOff::Ptr{Cint},pnYBufOff::Ptr{Cint},pnXBufSize::Ptr{Cint},pnYBufSize::Ptr{Cint})
    ccall((:GDALARGetNextUpdatedRegion,libgdal),GDALAsyncStatusType,(GDALAsyncReaderH,Cdouble,Ptr{Cint},Ptr{Cint},Ptr{Cint},Ptr{Cint}),hARIO,dfTimeout,pnXBufOff,pnYBufOff,pnXBufSize,pnYBufSize)
end

function GDALARLockBuffer(hARIO::GDALAsyncReaderH,dfTimeout::Cdouble)
    ccall((:GDALARLockBuffer,libgdal),Cint,(GDALAsyncReaderH,Cdouble),hARIO,dfTimeout)
end

function GDALARUnlockBuffer(hARIO::GDALAsyncReaderH)
    ccall((:GDALARUnlockBuffer,libgdal),Void,(GDALAsyncReaderH,),hARIO)
end

function GDALGeneralCmdLineProcessor(nArgc::Cint,ppapszArgv::Ptr{Ptr{Ptr{Uint8}}},nOptions::Cint)
    ccall((:GDALGeneralCmdLineProcessor,libgdal),Cint,(Cint,Ptr{Ptr{Ptr{Uint8}}},Cint),nArgc,ppapszArgv,nOptions)
end

function GDALSwapWords(pData::Ptr{Void},nWordSize::Cint,nWordCount::Cint,nWordSkip::Cint)
    ccall((:GDALSwapWords,libgdal),Void,(Ptr{Void},Cint,Cint,Cint),pData,nWordSize,nWordCount,nWordSkip)
end

function GDALCopyWords(pSrcData::Ptr{Void},eSrcType::GDALDataType,nSrcPixelOffset::Cint,pDstData::Ptr{Void},eDstType::GDALDataType,nDstPixelOffset::Cint,nWordCount::Cint)
    ccall((:GDALCopyWords,libgdal),Void,(Ptr{Void},GDALDataType,Cint,Ptr{Void},GDALDataType,Cint,Cint),pSrcData,eSrcType,nSrcPixelOffset,pDstData,eDstType,nDstPixelOffset,nWordCount)
end

function GDALCopyBits(pabySrcData::Ptr{GByte},nSrcOffset::Cint,nSrcStep::Cint,pabyDstData::Ptr{GByte},nDstOffset::Cint,nDstStep::Cint,nBitCount::Cint,nStepCount::Cint)
    ccall((:GDALCopyBits,libgdal),Void,(Ptr{GByte},Cint,Cint,Ptr{GByte},Cint,Cint,Cint,Cint),pabySrcData,nSrcOffset,nSrcStep,pabyDstData,nDstOffset,nDstStep,nBitCount,nStepCount)
end

function GDALLoadWorldFile(arg1::Ptr{Uint8},arg2::Ptr{Cdouble})
    ccall((:GDALLoadWorldFile,libgdal),Cint,(Ptr{Uint8},Ptr{Cdouble}),arg1,arg2)
end

function GDALReadWorldFile(arg1::Ptr{Uint8},arg2::Ptr{Uint8},arg3::Ptr{Cdouble})
    ccall((:GDALReadWorldFile,libgdal),Cint,(Ptr{Uint8},Ptr{Uint8},Ptr{Cdouble}),arg1,arg2,arg3)
end

function GDALWriteWorldFile(arg1::Ptr{Uint8},arg2::Ptr{Uint8},arg3::Ptr{Cdouble})
    ccall((:GDALWriteWorldFile,libgdal),Cint,(Ptr{Uint8},Ptr{Uint8},Ptr{Cdouble}),arg1,arg2,arg3)
end

function GDALLoadTabFile(arg1::Ptr{Uint8},arg2::Ptr{Cdouble},arg3::Ptr{Ptr{Uint8}},arg4::Ptr{Cint},arg5::Ptr{Ptr{GDAL_GCP}})
    ccall((:GDALLoadTabFile,libgdal),Cint,(Ptr{Uint8},Ptr{Cdouble},Ptr{Ptr{Uint8}},Ptr{Cint},Ptr{Ptr{GDAL_GCP}}),arg1,arg2,arg3,arg4,arg5)
end

function GDALReadTabFile(arg1::Ptr{Uint8},arg2::Ptr{Cdouble},arg3::Ptr{Ptr{Uint8}},arg4::Ptr{Cint},arg5::Ptr{Ptr{GDAL_GCP}})
    ccall((:GDALReadTabFile,libgdal),Cint,(Ptr{Uint8},Ptr{Cdouble},Ptr{Ptr{Uint8}},Ptr{Cint},Ptr{Ptr{GDAL_GCP}}),arg1,arg2,arg3,arg4,arg5)
end

function GDALLoadOziMapFile(arg1::Ptr{Uint8},arg2::Ptr{Cdouble},arg3::Ptr{Ptr{Uint8}},arg4::Ptr{Cint},arg5::Ptr{Ptr{GDAL_GCP}})
    ccall((:GDALLoadOziMapFile,libgdal),Cint,(Ptr{Uint8},Ptr{Cdouble},Ptr{Ptr{Uint8}},Ptr{Cint},Ptr{Ptr{GDAL_GCP}}),arg1,arg2,arg3,arg4,arg5)
end

function GDALReadOziMapFile(arg1::Ptr{Uint8},arg2::Ptr{Cdouble},arg3::Ptr{Ptr{Uint8}},arg4::Ptr{Cint},arg5::Ptr{Ptr{GDAL_GCP}})
    ccall((:GDALReadOziMapFile,libgdal),Cint,(Ptr{Uint8},Ptr{Cdouble},Ptr{Ptr{Uint8}},Ptr{Cint},Ptr{Ptr{GDAL_GCP}}),arg1,arg2,arg3,arg4,arg5)
end

function GDALLoadRPBFile(pszFilename::Ptr{Uint8},papszSiblingFiles::Ptr{Ptr{Uint8}})
    ccall((:GDALLoadRPBFile,libgdal),Ptr{Ptr{Uint8}},(Ptr{Uint8},Ptr{Ptr{Uint8}}),pszFilename,papszSiblingFiles)
end

function GDALLoadRPCFile(pszFilename::Ptr{Uint8},papszSiblingFiles::Ptr{Ptr{Uint8}})
    ccall((:GDALLoadRPCFile,libgdal),Ptr{Ptr{Uint8}},(Ptr{Uint8},Ptr{Ptr{Uint8}}),pszFilename,papszSiblingFiles)
end

function GDALWriteRPBFile(pszFilename::Ptr{Uint8},papszMD::Ptr{Ptr{Uint8}})
    ccall((:GDALWriteRPBFile,libgdal),CPLErr,(Ptr{Uint8},Ptr{Ptr{Uint8}}),pszFilename,papszMD)
end

function GDALLoadIMDFile(pszFilename::Ptr{Uint8},papszSiblingFiles::Ptr{Ptr{Uint8}})
    ccall((:GDALLoadIMDFile,libgdal),Ptr{Ptr{Uint8}},(Ptr{Uint8},Ptr{Ptr{Uint8}}),pszFilename,papszSiblingFiles)
end

function GDALWriteIMDFile(pszFilename::Ptr{Uint8},papszMD::Ptr{Ptr{Uint8}})
    ccall((:GDALWriteIMDFile,libgdal),CPLErr,(Ptr{Uint8},Ptr{Ptr{Uint8}}),pszFilename,papszMD)
end

function GDALDecToDMS(arg1::Cdouble,arg2::Ptr{Uint8},arg3::Cint)
    ccall((:GDALDecToDMS,libgdal),Ptr{Uint8},(Cdouble,Ptr{Uint8},Cint),arg1,arg2,arg3)
end

function GDALPackedDMSToDec(arg1::Cdouble)
    ccall((:GDALPackedDMSToDec,libgdal),Cdouble,(Cdouble,),arg1)
end

function GDALDecToPackedDMS(arg1::Cdouble)
    ccall((:GDALDecToPackedDMS,libgdal),Cdouble,(Cdouble,),arg1)
end

function GDALVersionInfo(arg1::Ptr{Uint8})
    ccall((:GDALVersionInfo,libgdal),Ptr{Uint8},(Ptr{Uint8},),arg1)
end

function GDALCheckVersion(nVersionMajor::Cint,nVersionMinor::Cint,pszCallingComponentName::Ptr{Uint8})
    ccall((:GDALCheckVersion,libgdal),Cint,(Cint,Cint,Ptr{Uint8}),nVersionMajor,nVersionMinor,pszCallingComponentName)
end

function GDALExtractRPCInfo(arg1::Ptr{Ptr{Uint8}},arg2::Ptr{GDALRPCInfo})
    ccall((:GDALExtractRPCInfo,libgdal),Cint,(Ptr{Ptr{Uint8}},Ptr{GDALRPCInfo}),arg1,arg2)
end

function GDALCreateColorTable(arg1::GDALPaletteInterp)
    ccall((:GDALCreateColorTable,libgdal),GDALColorTableH,(GDALPaletteInterp,),arg1)
end

function GDALDestroyColorTable(arg1::GDALColorTableH)
    ccall((:GDALDestroyColorTable,libgdal),Void,(GDALColorTableH,),arg1)
end

function GDALCloneColorTable(arg1::GDALColorTableH)
    ccall((:GDALCloneColorTable,libgdal),GDALColorTableH,(GDALColorTableH,),arg1)
end

function GDALGetPaletteInterpretation(arg1::GDALColorTableH)
    ccall((:GDALGetPaletteInterpretation,libgdal),GDALPaletteInterp,(GDALColorTableH,),arg1)
end

function GDALGetColorEntryCount(arg1::GDALColorTableH)
    ccall((:GDALGetColorEntryCount,libgdal),Cint,(GDALColorTableH,),arg1)
end

function GDALGetColorEntry(arg1::GDALColorTableH,arg2::Cint)
    ccall((:GDALGetColorEntry,libgdal),Ptr{GDALColorEntry},(GDALColorTableH,Cint),arg1,arg2)
end

function GDALGetColorEntryAsRGB(arg1::GDALColorTableH,arg2::Cint,arg3::Ptr{GDALColorEntry})
    ccall((:GDALGetColorEntryAsRGB,libgdal),Cint,(GDALColorTableH,Cint,Ptr{GDALColorEntry}),arg1,arg2,arg3)
end

function GDALSetColorEntry(arg1::GDALColorTableH,arg2::Cint,arg3::Ptr{GDALColorEntry})
    ccall((:GDALSetColorEntry,libgdal),Void,(GDALColorTableH,Cint,Ptr{GDALColorEntry}),arg1,arg2,arg3)
end

function GDALCreateColorRamp(hTable::GDALColorTableH,nStartIndex::Cint,psStartColor::Ptr{GDALColorEntry},nEndIndex::Cint,psEndColor::Ptr{GDALColorEntry})
    ccall((:GDALCreateColorRamp,libgdal),Void,(GDALColorTableH,Cint,Ptr{GDALColorEntry},Cint,Ptr{GDALColorEntry}),hTable,nStartIndex,psStartColor,nEndIndex,psEndColor)
end

function GDALCreateRasterAttributeTable()
    ccall((:GDALCreateRasterAttributeTable,libgdal),GDALRasterAttributeTableH,())
end

function GDALDestroyRasterAttributeTable(arg1::GDALRasterAttributeTableH)
    ccall((:GDALDestroyRasterAttributeTable,libgdal),Void,(GDALRasterAttributeTableH,),arg1)
end

function GDALRATGetColumnCount(arg1::GDALRasterAttributeTableH)
    ccall((:GDALRATGetColumnCount,libgdal),Cint,(GDALRasterAttributeTableH,),arg1)
end

function GDALRATGetNameOfCol(arg1::GDALRasterAttributeTableH,arg2::Cint)
    ccall((:GDALRATGetNameOfCol,libgdal),Ptr{Uint8},(GDALRasterAttributeTableH,Cint),arg1,arg2)
end

function GDALRATGetUsageOfCol(arg1::GDALRasterAttributeTableH,arg2::Cint)
    ccall((:GDALRATGetUsageOfCol,libgdal),GDALRATFieldUsage,(GDALRasterAttributeTableH,Cint),arg1,arg2)
end

function GDALRATGetTypeOfCol(arg1::GDALRasterAttributeTableH,arg2::Cint)
    ccall((:GDALRATGetTypeOfCol,libgdal),GDALRATFieldType,(GDALRasterAttributeTableH,Cint),arg1,arg2)
end

function GDALRATGetColOfUsage(arg1::GDALRasterAttributeTableH,arg2::GDALRATFieldUsage)
    ccall((:GDALRATGetColOfUsage,libgdal),Cint,(GDALRasterAttributeTableH,GDALRATFieldUsage),arg1,arg2)
end

function GDALRATGetRowCount(arg1::GDALRasterAttributeTableH)
    ccall((:GDALRATGetRowCount,libgdal),Cint,(GDALRasterAttributeTableH,),arg1)
end

function GDALRATGetValueAsString(arg1::GDALRasterAttributeTableH,arg2::Cint,arg3::Cint)
    ccall((:GDALRATGetValueAsString,libgdal),Ptr{Uint8},(GDALRasterAttributeTableH,Cint,Cint),arg1,arg2,arg3)
end

function GDALRATGetValueAsInt(arg1::GDALRasterAttributeTableH,arg2::Cint,arg3::Cint)
    ccall((:GDALRATGetValueAsInt,libgdal),Cint,(GDALRasterAttributeTableH,Cint,Cint),arg1,arg2,arg3)
end

function GDALRATGetValueAsDouble(arg1::GDALRasterAttributeTableH,arg2::Cint,arg3::Cint)
    ccall((:GDALRATGetValueAsDouble,libgdal),Cdouble,(GDALRasterAttributeTableH,Cint,Cint),arg1,arg2,arg3)
end

function GDALRATSetValueAsString(arg1::GDALRasterAttributeTableH,arg2::Cint,arg3::Cint,arg4::Ptr{Uint8})
    ccall((:GDALRATSetValueAsString,libgdal),Void,(GDALRasterAttributeTableH,Cint,Cint,Ptr{Uint8}),arg1,arg2,arg3,arg4)
end

function GDALRATSetValueAsInt(arg1::GDALRasterAttributeTableH,arg2::Cint,arg3::Cint,arg4::Cint)
    ccall((:GDALRATSetValueAsInt,libgdal),Void,(GDALRasterAttributeTableH,Cint,Cint,Cint),arg1,arg2,arg3,arg4)
end

function GDALRATSetValueAsDouble(arg1::GDALRasterAttributeTableH,arg2::Cint,arg3::Cint,arg4::Cdouble)
    ccall((:GDALRATSetValueAsDouble,libgdal),Void,(GDALRasterAttributeTableH,Cint,Cint,Cdouble),arg1,arg2,arg3,arg4)
end

function GDALRATChangesAreWrittenToFile(hRAT::GDALRasterAttributeTableH)
    ccall((:GDALRATChangesAreWrittenToFile,libgdal),Cint,(GDALRasterAttributeTableH,),hRAT)
end

function GDALRATValuesIOAsDouble(hRAT::GDALRasterAttributeTableH,eRWFlag::GDALRWFlag,iField::Cint,iStartRow::Cint,iLength::Cint,pdfData::Ptr{Cdouble})
    ccall((:GDALRATValuesIOAsDouble,libgdal),CPLErr,(GDALRasterAttributeTableH,GDALRWFlag,Cint,Cint,Cint,Ptr{Cdouble}),hRAT,eRWFlag,iField,iStartRow,iLength,pdfData)
end

function GDALRATValuesIOAsInteger(hRAT::GDALRasterAttributeTableH,eRWFlag::GDALRWFlag,iField::Cint,iStartRow::Cint,iLength::Cint,pnData::Ptr{Cint})
    ccall((:GDALRATValuesIOAsInteger,libgdal),CPLErr,(GDALRasterAttributeTableH,GDALRWFlag,Cint,Cint,Cint,Ptr{Cint}),hRAT,eRWFlag,iField,iStartRow,iLength,pnData)
end

function GDALRATValuesIOAsString(hRAT::GDALRasterAttributeTableH,eRWFlag::GDALRWFlag,iField::Cint,iStartRow::Cint,iLength::Cint,papszStrList::Ptr{Ptr{Uint8}})
    ccall((:GDALRATValuesIOAsString,libgdal),CPLErr,(GDALRasterAttributeTableH,GDALRWFlag,Cint,Cint,Cint,Ptr{Ptr{Uint8}}),hRAT,eRWFlag,iField,iStartRow,iLength,papszStrList)
end

function GDALRATSetRowCount(arg1::GDALRasterAttributeTableH,arg2::Cint)
    ccall((:GDALRATSetRowCount,libgdal),Void,(GDALRasterAttributeTableH,Cint),arg1,arg2)
end

function GDALRATCreateColumn(arg1::GDALRasterAttributeTableH,arg2::Ptr{Uint8},arg3::GDALRATFieldType,arg4::GDALRATFieldUsage)
    ccall((:GDALRATCreateColumn,libgdal),CPLErr,(GDALRasterAttributeTableH,Ptr{Uint8},GDALRATFieldType,GDALRATFieldUsage),arg1,arg2,arg3,arg4)
end

function GDALRATSetLinearBinning(arg1::GDALRasterAttributeTableH,arg2::Cdouble,arg3::Cdouble)
    ccall((:GDALRATSetLinearBinning,libgdal),CPLErr,(GDALRasterAttributeTableH,Cdouble,Cdouble),arg1,arg2,arg3)
end

function GDALRATGetLinearBinning(arg1::GDALRasterAttributeTableH,arg2::Ptr{Cdouble},arg3::Ptr{Cdouble})
    ccall((:GDALRATGetLinearBinning,libgdal),Cint,(GDALRasterAttributeTableH,Ptr{Cdouble},Ptr{Cdouble}),arg1,arg2,arg3)
end

function GDALRATInitializeFromColorTable(arg1::GDALRasterAttributeTableH,arg2::GDALColorTableH)
    ccall((:GDALRATInitializeFromColorTable,libgdal),CPLErr,(GDALRasterAttributeTableH,GDALColorTableH),arg1,arg2)
end

function GDALRATTranslateToColorTable(arg1::GDALRasterAttributeTableH,nEntryCount::Cint)
    ccall((:GDALRATTranslateToColorTable,libgdal),GDALColorTableH,(GDALRasterAttributeTableH,Cint),arg1,nEntryCount)
end

function GDALRATDumpReadable(arg1::GDALRasterAttributeTableH,arg2::Ptr{FILE})
    ccall((:GDALRATDumpReadable,libgdal),Void,(GDALRasterAttributeTableH,Ptr{FILE}),arg1,arg2)
end

function GDALRATClone(arg1::GDALRasterAttributeTableH)
    ccall((:GDALRATClone,libgdal),GDALRasterAttributeTableH,(GDALRasterAttributeTableH,),arg1)
end

function GDALRATGetRowOfValue(arg1::GDALRasterAttributeTableH,arg2::Cdouble)
    ccall((:GDALRATGetRowOfValue,libgdal),Cint,(GDALRasterAttributeTableH,Cdouble),arg1,arg2)
end

function GDALSetCacheMax(nBytes::Cint)
    ccall((:GDALSetCacheMax,libgdal),Void,(Cint,),nBytes)
end

function GDALGetCacheMax()
    ccall((:GDALGetCacheMax,libgdal),Cint,())
end

function GDALGetCacheUsed()
    ccall((:GDALGetCacheUsed,libgdal),Cint,())
end

function GDALSetCacheMax64(nBytes::GIntBig)
    ccall((:GDALSetCacheMax64,libgdal),Void,(GIntBig,),nBytes)
end

function GDALGetCacheMax64()
    ccall((:GDALGetCacheMax64,libgdal),GIntBig,())
end

function GDALGetCacheUsed64()
    ccall((:GDALGetCacheUsed64,libgdal),GIntBig,())
end

function GDALFlushCacheBlock()
    ccall((:GDALFlushCacheBlock,libgdal),Cint,())
end

function GDALDatasetGetVirtualMem(hDS::GDALDatasetH,eRWFlag::GDALRWFlag,nXOff::Cint,nYOff::Cint,nXSize::Cint,nYSize::Cint,nBufXSize::Cint,nBufYSize::Cint,eBufType::GDALDataType,nBandCount::Cint,panBandMap::Ptr{Cint},nPixelSpace::Cint,nLineSpace::GIntBig,nBandSpace::GIntBig,nCacheSize::Csize_t,nPageSizeHint::Csize_t,bSingleThreadUsage::Cint,papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALDatasetGetVirtualMem,libgdal),Ptr{CPLVirtualMem},(GDALDatasetH,GDALRWFlag,Cint,Cint,Cint,Cint,Cint,Cint,GDALDataType,Cint,Ptr{Cint},Cint,GIntBig,GIntBig,Csize_t,Csize_t,Cint,Ptr{Ptr{Uint8}}),hDS,eRWFlag,nXOff,nYOff,nXSize,nYSize,nBufXSize,nBufYSize,eBufType,nBandCount,panBandMap,nPixelSpace,nLineSpace,nBandSpace,nCacheSize,nPageSizeHint,bSingleThreadUsage,papszOptions)
end

function GDALRasterBandGetVirtualMem(hBand::GDALRasterBandH,eRWFlag::GDALRWFlag,nXOff::Cint,nYOff::Cint,nXSize::Cint,nYSize::Cint,nBufXSize::Cint,nBufYSize::Cint,eBufType::GDALDataType,nPixelSpace::Cint,nLineSpace::GIntBig,nCacheSize::Csize_t,nPageSizeHint::Csize_t,bSingleThreadUsage::Cint,papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALRasterBandGetVirtualMem,libgdal),Ptr{CPLVirtualMem},(GDALRasterBandH,GDALRWFlag,Cint,Cint,Cint,Cint,Cint,Cint,GDALDataType,Cint,GIntBig,Csize_t,Csize_t,Cint,Ptr{Ptr{Uint8}}),hBand,eRWFlag,nXOff,nYOff,nXSize,nYSize,nBufXSize,nBufYSize,eBufType,nPixelSpace,nLineSpace,nCacheSize,nPageSizeHint,bSingleThreadUsage,papszOptions)
end

function GDALGetVirtualMemAuto(hBand::GDALRasterBandH,eRWFlag::GDALRWFlag,pnPixelSpace::Ptr{Cint},pnLineSpace::Ptr{GIntBig},papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALGetVirtualMemAuto,libgdal),Ptr{CPLVirtualMem},(GDALRasterBandH,GDALRWFlag,Ptr{Cint},Ptr{GIntBig},Ptr{Ptr{Uint8}}),hBand,eRWFlag,pnPixelSpace,pnLineSpace,papszOptions)
end

function GDALDatasetGetTiledVirtualMem(hDS::GDALDatasetH,eRWFlag::GDALRWFlag,nXOff::Cint,nYOff::Cint,nXSize::Cint,nYSize::Cint,nTileXSize::Cint,nTileYSize::Cint,eBufType::GDALDataType,nBandCount::Cint,panBandMap::Ptr{Cint},eTileOrganization::GDALTileOrganization,nCacheSize::Csize_t,bSingleThreadUsage::Cint,papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALDatasetGetTiledVirtualMem,libgdal),Ptr{CPLVirtualMem},(GDALDatasetH,GDALRWFlag,Cint,Cint,Cint,Cint,Cint,Cint,GDALDataType,Cint,Ptr{Cint},GDALTileOrganization,Csize_t,Cint,Ptr{Ptr{Uint8}}),hDS,eRWFlag,nXOff,nYOff,nXSize,nYSize,nTileXSize,nTileYSize,eBufType,nBandCount,panBandMap,eTileOrganization,nCacheSize,bSingleThreadUsage,papszOptions)
end

function GDALRasterBandGetTiledVirtualMem(hBand::GDALRasterBandH,eRWFlag::GDALRWFlag,nXOff::Cint,nYOff::Cint,nXSize::Cint,nYSize::Cint,nTileXSize::Cint,nTileYSize::Cint,eBufType::GDALDataType,nCacheSize::Csize_t,bSingleThreadUsage::Cint,papszOptions::Ptr{Ptr{Uint8}})
    ccall((:GDALRasterBandGetTiledVirtualMem,libgdal),Ptr{CPLVirtualMem},(GDALRasterBandH,GDALRWFlag,Cint,Cint,Cint,Cint,Cint,Cint,GDALDataType,Csize_t,Cint,Ptr{Ptr{Uint8}}),hBand,eRWFlag,nXOff,nYOff,nXSize,nYSize,nTileXSize,nTileYSize,eBufType,nCacheSize,bSingleThreadUsage,papszOptions)
end

function GDALRegister_GDB()
    ccall((:GDALRegister_GDB,libgdal),Void,())
end

function GDALRegister_GTiff()
    ccall((:GDALRegister_GTiff,libgdal),Void,())
end

function GDALRegister_GXF()
    ccall((:GDALRegister_GXF,libgdal),Void,())
end

function GDALRegister_OGDI()
    ccall((:GDALRegister_OGDI,libgdal),Void,())
end

function GDALRegister_HFA()
    ccall((:GDALRegister_HFA,libgdal),Void,())
end

function GDALRegister_AAIGrid()
    ccall((:GDALRegister_AAIGrid,libgdal),Void,())
end

function GDALRegister_GRASSASCIIGrid()
    ccall((:GDALRegister_GRASSASCIIGrid,libgdal),Void,())
end

function GDALRegister_AIGrid()
    ccall((:GDALRegister_AIGrid,libgdal),Void,())
end

function GDALRegister_AIGrid2()
    ccall((:GDALRegister_AIGrid2,libgdal),Void,())
end

function GDALRegister_CEOS()
    ccall((:GDALRegister_CEOS,libgdal),Void,())
end

function GDALRegister_SAR_CEOS()
    ccall((:GDALRegister_SAR_CEOS,libgdal),Void,())
end

function GDALRegister_SDTS()
    ccall((:GDALRegister_SDTS,libgdal),Void,())
end

function GDALRegister_ELAS()
    ccall((:GDALRegister_ELAS,libgdal),Void,())
end

function GDALRegister_EHdr()
    ccall((:GDALRegister_EHdr,libgdal),Void,())
end

function GDALRegister_GenBin()
    ccall((:GDALRegister_GenBin,libgdal),Void,())
end

function GDALRegister_PAux()
    ccall((:GDALRegister_PAux,libgdal),Void,())
end

function GDALRegister_ENVI()
    ccall((:GDALRegister_ENVI,libgdal),Void,())
end

function GDALRegister_DOQ1()
    ccall((:GDALRegister_DOQ1,libgdal),Void,())
end

function GDALRegister_DOQ2()
    ccall((:GDALRegister_DOQ2,libgdal),Void,())
end

function GDALRegister_DTED()
    ccall((:GDALRegister_DTED,libgdal),Void,())
end

function GDALRegister_MFF()
    ccall((:GDALRegister_MFF,libgdal),Void,())
end

function GDALRegister_HKV()
    ccall((:GDALRegister_HKV,libgdal),Void,())
end

function GDALRegister_PNG()
    ccall((:GDALRegister_PNG,libgdal),Void,())
end

function GDALRegister_DDS()
    ccall((:GDALRegister_DDS,libgdal),Void,())
end

function GDALRegister_GTA()
    ccall((:GDALRegister_GTA,libgdal),Void,())
end

function GDALRegister_JPEG()
    ccall((:GDALRegister_JPEG,libgdal),Void,())
end

function GDALRegister_JPEG2000()
    ccall((:GDALRegister_JPEG2000,libgdal),Void,())
end

function GDALRegister_JP2KAK()
    ccall((:GDALRegister_JP2KAK,libgdal),Void,())
end

function GDALRegister_JPIPKAK()
    ccall((:GDALRegister_JPIPKAK,libgdal),Void,())
end

function GDALRegister_MEM()
    ccall((:GDALRegister_MEM,libgdal),Void,())
end

function GDALRegister_JDEM()
    ccall((:GDALRegister_JDEM,libgdal),Void,())
end

function GDALRegister_RASDAMAN()
    ccall((:GDALRegister_RASDAMAN,libgdal),Void,())
end

function GDALRegister_GRASS()
    ccall((:GDALRegister_GRASS,libgdal),Void,())
end

function GDALRegister_PNM()
    ccall((:GDALRegister_PNM,libgdal),Void,())
end

function GDALRegister_GIF()
    ccall((:GDALRegister_GIF,libgdal),Void,())
end

function GDALRegister_BIGGIF()
    ccall((:GDALRegister_BIGGIF,libgdal),Void,())
end

function GDALRegister_Envisat()
    ccall((:GDALRegister_Envisat,libgdal),Void,())
end

function GDALRegister_FITS()
    ccall((:GDALRegister_FITS,libgdal),Void,())
end

function GDALRegister_ECW()
    ccall((:GDALRegister_ECW,libgdal),Void,())
end

function GDALRegister_JP2ECW()
    ccall((:GDALRegister_JP2ECW,libgdal),Void,())
end

function GDALRegister_ECW_JP2ECW()
    ccall((:GDALRegister_ECW_JP2ECW,libgdal),Void,())
end

function GDALRegister_FujiBAS()
    ccall((:GDALRegister_FujiBAS,libgdal),Void,())
end

function GDALRegister_FIT()
    ccall((:GDALRegister_FIT,libgdal),Void,())
end

function GDALRegister_VRT()
    ccall((:GDALRegister_VRT,libgdal),Void,())
end

function GDALRegister_USGSDEM()
    ccall((:GDALRegister_USGSDEM,libgdal),Void,())
end

function GDALRegister_FAST()
    ccall((:GDALRegister_FAST,libgdal),Void,())
end

function GDALRegister_HDF4()
    ccall((:GDALRegister_HDF4,libgdal),Void,())
end

function GDALRegister_HDF4Image()
    ccall((:GDALRegister_HDF4Image,libgdal),Void,())
end

function GDALRegister_L1B()
    ccall((:GDALRegister_L1B,libgdal),Void,())
end

function GDALRegister_LDF()
    ccall((:GDALRegister_LDF,libgdal),Void,())
end

function GDALRegister_BSB()
    ccall((:GDALRegister_BSB,libgdal),Void,())
end

function GDALRegister_XPM()
    ccall((:GDALRegister_XPM,libgdal),Void,())
end

function GDALRegister_BMP()
    ccall((:GDALRegister_BMP,libgdal),Void,())
end

function GDALRegister_GSC()
    ccall((:GDALRegister_GSC,libgdal),Void,())
end

function GDALRegister_NITF()
    ccall((:GDALRegister_NITF,libgdal),Void,())
end

function GDALRegister_RPFTOC()
    ccall((:GDALRegister_RPFTOC,libgdal),Void,())
end

function GDALRegister_ECRGTOC()
    ccall((:GDALRegister_ECRGTOC,libgdal),Void,())
end

function GDALRegister_MrSID()
    ccall((:GDALRegister_MrSID,libgdal),Void,())
end

function GDALRegister_MG4Lidar()
    ccall((:GDALRegister_MG4Lidar,libgdal),Void,())
end

function GDALRegister_PCIDSK()
    ccall((:GDALRegister_PCIDSK,libgdal),Void,())
end

function GDALRegister_BT()
    ccall((:GDALRegister_BT,libgdal),Void,())
end

function GDALRegister_DODS()
    ccall((:GDALRegister_DODS,libgdal),Void,())
end

function GDALRegister_GMT()
    ccall((:GDALRegister_GMT,libgdal),Void,())
end

function GDALRegister_netCDF()
    ccall((:GDALRegister_netCDF,libgdal),Void,())
end

function GDALRegister_LAN()
    ccall((:GDALRegister_LAN,libgdal),Void,())
end

function GDALRegister_CPG()
    ccall((:GDALRegister_CPG,libgdal),Void,())
end

function GDALRegister_AirSAR()
    ccall((:GDALRegister_AirSAR,libgdal),Void,())
end

function GDALRegister_RS2()
    ccall((:GDALRegister_RS2,libgdal),Void,())
end

function GDALRegister_ILWIS()
    ccall((:GDALRegister_ILWIS,libgdal),Void,())
end

function GDALRegister_PCRaster()
    ccall((:GDALRegister_PCRaster,libgdal),Void,())
end

function GDALRegister_IDA()
    ccall((:GDALRegister_IDA,libgdal),Void,())
end

function GDALRegister_NDF()
    ccall((:GDALRegister_NDF,libgdal),Void,())
end

function GDALRegister_RMF()
    ccall((:GDALRegister_RMF,libgdal),Void,())
end

function GDALRegister_BAG()
    ccall((:GDALRegister_BAG,libgdal),Void,())
end

function GDALRegister_HDF5()
    ccall((:GDALRegister_HDF5,libgdal),Void,())
end

function GDALRegister_HDF5Image()
    ccall((:GDALRegister_HDF5Image,libgdal),Void,())
end

function GDALRegister_MSGN()
    ccall((:GDALRegister_MSGN,libgdal),Void,())
end

function GDALRegister_MSG()
    ccall((:GDALRegister_MSG,libgdal),Void,())
end

function GDALRegister_RIK()
    ccall((:GDALRegister_RIK,libgdal),Void,())
end

function GDALRegister_Leveller()
    ccall((:GDALRegister_Leveller,libgdal),Void,())
end

function GDALRegister_SGI()
    ccall((:GDALRegister_SGI,libgdal),Void,())
end

function GDALRegister_SRTMHGT()
    ccall((:GDALRegister_SRTMHGT,libgdal),Void,())
end

function GDALRegister_DIPEx()
    ccall((:GDALRegister_DIPEx,libgdal),Void,())
end

function GDALRegister_ISIS3()
    ccall((:GDALRegister_ISIS3,libgdal),Void,())
end

function GDALRegister_ISIS2()
    ccall((:GDALRegister_ISIS2,libgdal),Void,())
end

function GDALRegister_PDS()
    ccall((:GDALRegister_PDS,libgdal),Void,())
end

function GDALRegister_IDRISI()
    ccall((:GDALRegister_IDRISI,libgdal),Void,())
end

function GDALRegister_Terragen()
    ccall((:GDALRegister_Terragen,libgdal),Void,())
end

function GDALRegister_WCS()
    ccall((:GDALRegister_WCS,libgdal),Void,())
end

function GDALRegister_WMS()
    ccall((:GDALRegister_WMS,libgdal),Void,())
end

function GDALRegister_HTTP()
    ccall((:GDALRegister_HTTP,libgdal),Void,())
end

function GDALRegister_SDE()
    ccall((:GDALRegister_SDE,libgdal),Void,())
end

function GDALRegister_GSAG()
    ccall((:GDALRegister_GSAG,libgdal),Void,())
end

function GDALRegister_GSBG()
    ccall((:GDALRegister_GSBG,libgdal),Void,())
end

function GDALRegister_GS7BG()
    ccall((:GDALRegister_GS7BG,libgdal),Void,())
end

function GDALRegister_GRIB()
    ccall((:GDALRegister_GRIB,libgdal),Void,())
end

function GDALRegister_INGR()
    ccall((:GDALRegister_INGR,libgdal),Void,())
end

function GDALRegister_ERS()
    ccall((:GDALRegister_ERS,libgdal),Void,())
end

function GDALRegister_PALSARJaxa()
    ccall((:GDALRegister_PALSARJaxa,libgdal),Void,())
end

function GDALRegister_DIMAP()
    ccall((:GDALRegister_DIMAP,libgdal),Void,())
end

function GDALRegister_GFF()
    ccall((:GDALRegister_GFF,libgdal),Void,())
end

function GDALRegister_COSAR()
    ccall((:GDALRegister_COSAR,libgdal),Void,())
end

function GDALRegister_TSX()
    ccall((:GDALRegister_TSX,libgdal),Void,())
end

function GDALRegister_ADRG()
    ccall((:GDALRegister_ADRG,libgdal),Void,())
end

function GDALRegister_SRP()
    ccall((:GDALRegister_SRP,libgdal),Void,())
end

function GDALRegister_COASP()
    ccall((:GDALRegister_COASP,libgdal),Void,())
end

function GDALRegister_BLX()
    ccall((:GDALRegister_BLX,libgdal),Void,())
end

function GDALRegister_LCP()
    ccall((:GDALRegister_LCP,libgdal),Void,())
end

function GDALRegister_PGCHIP()
    ccall((:GDALRegister_PGCHIP,libgdal),Void,())
end

function GDALRegister_TMS()
    ccall((:GDALRegister_TMS,libgdal),Void,())
end

function GDALRegister_EIR()
    ccall((:GDALRegister_EIR,libgdal),Void,())
end

function GDALRegister_GEOR()
    ccall((:GDALRegister_GEOR,libgdal),Void,())
end

function GDALRegister_TIL()
    ccall((:GDALRegister_TIL,libgdal),Void,())
end

function GDALRegister_R()
    ccall((:GDALRegister_R,libgdal),Void,())
end

function GDALRegister_Rasterlite()
    ccall((:GDALRegister_Rasterlite,libgdal),Void,())
end

function GDALRegister_EPSILON()
    ccall((:GDALRegister_EPSILON,libgdal),Void,())
end

function GDALRegister_PostGISRaster()
    ccall((:GDALRegister_PostGISRaster,libgdal),Void,())
end

function GDALRegister_NWT_GRD()
    ccall((:GDALRegister_NWT_GRD,libgdal),Void,())
end

function GDALRegister_NWT_GRC()
    ccall((:GDALRegister_NWT_GRC,libgdal),Void,())
end

function GDALRegister_SAGA()
    ccall((:GDALRegister_SAGA,libgdal),Void,())
end

function GDALRegister_KMLSUPEROVERLAY()
    ccall((:GDALRegister_KMLSUPEROVERLAY,libgdal),Void,())
end

function GDALRegister_GTX()
    ccall((:GDALRegister_GTX,libgdal),Void,())
end

function GDALRegister_LOSLAS()
    ccall((:GDALRegister_LOSLAS,libgdal),Void,())
end

function GDALRegister_Istar()
    ccall((:GDALRegister_Istar,libgdal),Void,())
end

function GDALRegister_NTv2()
    ccall((:GDALRegister_NTv2,libgdal),Void,())
end

function GDALRegister_CTable2()
    ccall((:GDALRegister_CTable2,libgdal),Void,())
end

function GDALRegister_JP2OpenJPEG()
    ccall((:GDALRegister_JP2OpenJPEG,libgdal),Void,())
end

function GDALRegister_XYZ()
    ccall((:GDALRegister_XYZ,libgdal),Void,())
end

function GDALRegister_HF2()
    ccall((:GDALRegister_HF2,libgdal),Void,())
end

function GDALRegister_PDF()
    ccall((:GDALRegister_PDF,libgdal),Void,())
end

function GDALRegister_JPEGLS()
    ccall((:GDALRegister_JPEGLS,libgdal),Void,())
end

function GDALRegister_MAP()
    ccall((:GDALRegister_MAP,libgdal),Void,())
end

function GDALRegister_OZI()
    ccall((:GDALRegister_OZI,libgdal),Void,())
end

function GDALRegister_ACE2()
    ccall((:GDALRegister_ACE2,libgdal),Void,())
end

function GDALRegister_CTG()
    ccall((:GDALRegister_CTG,libgdal),Void,())
end

function GDALRegister_E00GRID()
    ccall((:GDALRegister_E00GRID,libgdal),Void,())
end

function GDALRegister_SNODAS()
    ccall((:GDALRegister_SNODAS,libgdal),Void,())
end

function GDALRegister_WEBP()
    ccall((:GDALRegister_WEBP,libgdal),Void,())
end

function GDALRegister_ZMap()
    ccall((:GDALRegister_ZMap,libgdal),Void,())
end

function GDALRegister_NGSGEOID()
    ccall((:GDALRegister_NGSGEOID,libgdal),Void,())
end

function GDALRegister_MBTiles()
    ccall((:GDALRegister_MBTiles,libgdal),Void,())
end

function GDALRegister_ARG()
    ccall((:GDALRegister_ARG,libgdal),Void,())
end

function GDALRegister_IRIS()
    ccall((:GDALRegister_IRIS,libgdal),Void,())
end

function GDALRegister_KRO()
    ccall((:GDALRegister_KRO,libgdal),Void,())
end

function GDALOpenInternal(pszFilename::Ptr{Uint8},eAccess::GDALAccess,papszAllowedDrivers::Ptr{Ptr{Uint8}})
    ccall((:GDALOpenInternal,libgdal),GDALDatasetH,(Ptr{Uint8},GDALAccess,Ptr{Ptr{Uint8}}),pszFilename,eAccess,papszAllowedDrivers)
end

function GetGDALDriverManager()
    ccall((:GetGDALDriverManager,libgdal),Ptr{Cint},())
end

function GDALRegenerateOverviewsMultiBand(nBands::Cint,papoSrcBands::Ptr{Ptr{Cint}},nOverviews::Cint,papapoOverviewBands::Ptr{Ptr{Ptr{Cint}}},pszResampling::Ptr{Uint8},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALRegenerateOverviewsMultiBand,libgdal),CPLErr,(Cint,Ptr{Ptr{Cint}},Cint,Ptr{Ptr{Ptr{Cint}}},Ptr{Uint8},GDALProgressFunc,Ptr{Void}),nBands,papoSrcBands,nOverviews,papapoOverviewBands,pszResampling,pfnProgress,pProgressData)
end

function HFAAuxBuildOverviews(pszOvrFilename::Ptr{Uint8},poParentDS::Ptr{Cint},ppoDS::Ptr{Ptr{Cint}},nBands::Cint,panBandList::Ptr{Cint},nNewOverviews::Cint,panNewOverviewList::Ptr{Cint},pszResampling::Ptr{Uint8},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:HFAAuxBuildOverviews,libgdal),CPLErr,(Ptr{Uint8},Ptr{Cint},Ptr{Ptr{Cint}},Cint,Ptr{Cint},Cint,Ptr{Cint},Ptr{Uint8},GDALProgressFunc,Ptr{Void}),pszOvrFilename,poParentDS,ppoDS,nBands,panBandList,nNewOverviews,panNewOverviewList,pszResampling,pfnProgress,pProgressData)
end

function GTIFFBuildOverviews(pszFilename::Ptr{Uint8},nBands::Cint,papoBandList::Ptr{Ptr{Cint}},nOverviews::Cint,panOverviewList::Ptr{Cint},pszResampling::Ptr{Uint8},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GTIFFBuildOverviews,libgdal),CPLErr,(Ptr{Uint8},Cint,Ptr{Ptr{Cint}},Cint,Ptr{Cint},Ptr{Uint8},GDALProgressFunc,Ptr{Void}),pszFilename,nBands,papoBandList,nOverviews,panOverviewList,pszResampling,pfnProgress,pProgressData)
end

function GDALDefaultBuildOverviews(hSrcDS::Ptr{Cint},pszBasename::Ptr{Uint8},pszResampling::Ptr{Uint8},nOverviews::Cint,panOverviewList::Ptr{Cint},nBands::Cint,panBandList::Ptr{Cint},pfnProgress::GDALProgressFunc,pProgressData::Ptr{Void})
    ccall((:GDALDefaultBuildOverviews,libgdal),CPLErr,(Ptr{Cint},Ptr{Uint8},Ptr{Uint8},Cint,Ptr{Cint},Cint,Ptr{Cint},GDALProgressFunc,Ptr{Void}),hSrcDS,pszBasename,pszResampling,nOverviews,panOverviewList,nBands,panBandList,pfnProgress,pProgressData)
end

function GDALBandGetBestOverviewLevel(poBand::Ptr{Cint},arg1::Cint)
    ccall((:GDALBandGetBestOverviewLevel,libgdal),Cint,(Ptr{Cint},Cint),poBand,arg1)
end

function GDALOvLevelAdjust(nOvLevel::Cint,nXSize::Cint)
    ccall((:GDALOvLevelAdjust,libgdal),Cint,(Cint,Cint),nOvLevel,nXSize)
end

function GDALFindAssociatedAuxFile()
    ccall((:GDALFindAssociatedAuxFile,libgdal),Ptr{Cint},())
end

function GDALParseGMLCoverage(psTree::Ptr{CPLXMLNode},pnXSize::Ptr{Cint},pnYSize::Ptr{Cint},padfGeoTransform::Ptr{Cdouble},ppszProjection::Ptr{Ptr{Uint8}})
    ccall((:GDALParseGMLCoverage,libgdal),CPLErr,(Ptr{CPLXMLNode},Ptr{Cint},Ptr{Cint},Ptr{Cdouble},Ptr{Ptr{Uint8}}),psTree,pnXSize,pnYSize,padfGeoTransform,ppszProjection)
end

function GDALCheckDatasetDimensions(nXSize::Cint,nYSize::Cint)
    ccall((:GDALCheckDatasetDimensions,libgdal),Cint,(Cint,Cint),nXSize,nYSize)
end

function GDALCheckBandCount(nBands::Cint,bIsZeroAllowed::Cint)
    ccall((:GDALCheckBandCount,libgdal),Cint,(Cint,Cint),nBands,bIsZeroAllowed)
end

function GDALReadWorldFile2(pszBaseFilename::Ptr{Uint8},pszExtension::Ptr{Uint8},padfGeoTransform::Ptr{Cdouble},papszSiblingFiles::Ptr{Ptr{Uint8}},ppszWorldFileNameOut::Ptr{Ptr{Uint8}})
    ccall((:GDALReadWorldFile2,libgdal),Cint,(Ptr{Uint8},Ptr{Uint8},Ptr{Cdouble},Ptr{Ptr{Uint8}},Ptr{Ptr{Uint8}}),pszBaseFilename,pszExtension,padfGeoTransform,papszSiblingFiles,ppszWorldFileNameOut)
end

function GDALReadTabFile2(pszBaseFilename::Ptr{Uint8},padfGeoTransform::Ptr{Cdouble},ppszWKT::Ptr{Ptr{Uint8}},pnGCPCount::Ptr{Cint},ppasGCPs::Ptr{Ptr{GDAL_GCP}},papszSiblingFiles::Ptr{Ptr{Uint8}},ppszTabFileNameOut::Ptr{Ptr{Uint8}})
    ccall((:GDALReadTabFile2,libgdal),Cint,(Ptr{Uint8},Ptr{Cdouble},Ptr{Ptr{Uint8}},Ptr{Cint},Ptr{Ptr{GDAL_GCP}},Ptr{Ptr{Uint8}},Ptr{Ptr{Uint8}}),pszBaseFilename,padfGeoTransform,ppszWKT,pnGCPCount,ppasGCPs,papszSiblingFiles,ppszTabFileNameOut)
end

function GDALNullifyOpenDatasetsList()
    ccall((:GDALNullifyOpenDatasetsList,libgdal),Void,())
end

function GDALGetphDMMutex()
    ccall((:GDALGetphDMMutex,libgdal),Ptr{Ptr{Void}},())
end

function GDALGetphDLMutex()
    ccall((:GDALGetphDLMutex,libgdal),Ptr{Ptr{Void}},())
end

function GDALNullifyProxyPoolSingleton()
    ccall((:GDALNullifyProxyPoolSingleton,libgdal),Void,())
end

function GDALGetAPIPROXYDriver()
    ccall((:GDALGetAPIPROXYDriver,libgdal),Ptr{Cint},())
end

function GDALSetResponsiblePIDForCurrentThread(responsiblePID::GIntBig)
    ccall((:GDALSetResponsiblePIDForCurrentThread,libgdal),Void,(GIntBig,),responsiblePID)
end

function GDALGetResponsiblePIDForCurrentThread()
    ccall((:GDALGetResponsiblePIDForCurrentThread,libgdal),GIntBig,())
end

function GDALFindAssociatedFile()
    ccall((:GDALFindAssociatedFile,libgdal),Cint,())
end

function EXIFExtractMetadata(arg1::Ptr{Ptr{Uint8}})
    ccall((:EXIFExtractMetadata,libgdal),CPLErr,(Ptr{Ptr{Uint8}},),arg1)
end

function GDALSerializeGCPListToXML(psParentNode::Ptr{CPLXMLNode},pasGCPList::Ptr{GDAL_GCP},nGCPCount::Cint,pszGCPProjection::Ptr{Uint8})
    ccall((:GDALSerializeGCPListToXML,libgdal),Void,(Ptr{CPLXMLNode},Ptr{GDAL_GCP},Cint,Ptr{Uint8}),psParentNode,pasGCPList,nGCPCount,pszGCPProjection)
end

function GDALDeserializeGCPListFromXML(psGCPList::Ptr{CPLXMLNode},ppasGCPList::Ptr{Ptr{GDAL_GCP}},pnGCPCount::Ptr{Cint},ppszGCPProjection::Ptr{Ptr{Uint8}})
    ccall((:GDALDeserializeGCPListFromXML,libgdal),Void,(Ptr{CPLXMLNode},Ptr{Ptr{GDAL_GCP}},Ptr{Cint},Ptr{Ptr{Uint8}}),psGCPList,ppasGCPList,pnGCPCount,ppszGCPProjection)
end

function PamParseHistogram(psHistItem::Ptr{CPLXMLNode},pdfMin::Ptr{Cdouble},pdfMax::Ptr{Cdouble},pnBuckets::Ptr{Cint},ppanHistogram::Ptr{Ptr{Cint}},pbIncludeOutOfRange::Ptr{Cint},pbApproxOK::Ptr{Cint})
    ccall((:PamParseHistogram,libgdal),Cint,(Ptr{CPLXMLNode},Ptr{Cdouble},Ptr{Cdouble},Ptr{Cint},Ptr{Ptr{Cint}},Ptr{Cint},Ptr{Cint}),psHistItem,pdfMin,pdfMax,pnBuckets,ppanHistogram,pbIncludeOutOfRange,pbApproxOK)
end

function PamFindMatchingHistogram(psSavedHistograms::Ptr{CPLXMLNode},dfMin::Cdouble,dfMax::Cdouble,nBuckets::Cint,bIncludeOutOfRange::Cint,bApproxOK::Cint)
    ccall((:PamFindMatchingHistogram,libgdal),Ptr{CPLXMLNode},(Ptr{CPLXMLNode},Cdouble,Cdouble,Cint,Cint,Cint),psSavedHistograms,dfMin,dfMax,nBuckets,bIncludeOutOfRange,bApproxOK)
end

function PamHistogramToXMLTree(dfMin::Cdouble,dfMax::Cdouble,nBuckets::Cint,panHistogram::Ptr{Cint},bIncludeOutOfRange::Cint,bApprox::Cint)
    ccall((:PamHistogramToXMLTree,libgdal),Ptr{CPLXMLNode},(Cdouble,Cdouble,Cint,Ptr{Cint},Cint,Cint),dfMin,dfMax,nBuckets,panHistogram,bIncludeOutOfRange,bApprox)
end

function PamGetProxy(arg1::Ptr{Uint8})
    ccall((:PamGetProxy,libgdal),Ptr{Uint8},(Ptr{Uint8},),arg1)
end

function PamAllocateProxy(arg1::Ptr{Uint8})
    ccall((:PamAllocateProxy,libgdal),Ptr{Uint8},(Ptr{Uint8},),arg1)
end

function PamDeallocateProxy(arg1::Ptr{Uint8})
    ccall((:PamDeallocateProxy,libgdal),Ptr{Uint8},(Ptr{Uint8},),arg1)
end

function PamCleanProxyDB()
    ccall((:PamCleanProxyDB,libgdal),Void,())
end


text:
mutable struct SumBatchedCache{Ta,Tb,Tc}
    σᵢₙ::Ta
    out::Tc
    δℒ::Tb
    valid::Bool
end

cache(::typeof(sum_autobatch), arr_T, in_T, in_sz, batch_sz)  =
    SumBatchedCache(similar(arr_T, in_T, prod(in_sz), batch_sz),
              similar(arr_T, in_T, 1, batch_sz),
              similar(arr_T, in_T, 1, prod(in_sz), batch_sz),
              false)

batch_size(c::SumBatchedCache) = size(c.out, 2)

function sum_autobatch(c::SumBatchedCache, x::AbstractMatrix)
    σ = copyto!(c.σᵢₙ, x)

    sum!(c.out, c.σᵢₙ)

    return c.out
end

function backprop(∇, l::typeof(sum_autobatch), c::SumBatchedCache, δℒ::Number)
    c.δℒ .= δℒ

    return c.δℒ
end

ext: jl


text:
struct Initialize <: AbstractEvent
  bev :: BaseEvent
  function Initialize(env::Environment)
    new(BaseEvent(env))
  end
end

mutable struct Process <: DiscreteProcess
  bev :: BaseEvent
  fsmi :: ResumableFunctions.FiniteStateMachineIterator
  target :: AbstractEvent
  resume :: Function
  function Process(func::Function, env::Environment, args::Any...)
    proc = new()
    proc.bev = BaseEvent(env)
    proc.fsmi = func(env, args...)
    proc.target = schedule(Initialize(env))
    proc.resume = @callback execute(proc.target, proc)
    proc
  end
end

macro process(expr)
  expr.head != :call && error("Expression is not a function call!")
  esc(:(Process($(expr.args...))))
end

function execute(ev::AbstractEvent, proc::Process)
  try
    env = environment(ev)
    set_active_process(env, proc)
    target = proc.fsmi(value(ev))
    reset_active_process(env)
    if proc.fsmi._state == 0xff
      schedule(proc; value=target)
    else
      proc.target = state(target) == processed ? timeout(env; value=value(target)) : target
      proc.resume = @callback execute(proc.target, proc)
    end
  catch exc
    rethrow(exc)
  end
end

struct Interrupt <: AbstractEvent
  bev :: BaseEvent
  function Interrupt(env::Environment)
    new(BaseEvent(env))
  end
end

function execute_interrupt(ev::Interrupt, proc::Process)
  remove_callback(proc.resume, proc.target)
  execute(ev, proc)
end

function interrupt(proc::Process, cause::Any=nothing)
  env = environment(proc)
  if proc.fsmi._state != 0xff
    proc.target isa Initialize && schedule(proc.target; priority=typemax(Int8))
    target = schedule(Interrupt(env); priority=typemax(Int8), value=InterruptException(active_process(env), cause))
    @callback execute_interrupt(target, proc)
  end
  timeout(env; priority=typemax(Int8))
end


text:
module SquareGreedImages

using Images, Reel

using ...PCG.Geometry: Size, Point
using ...PCG.Types: Recorder
using ...PCG.Storages
using ...PCG.Storages.LinearStorages
using ...PCG.Topologies
using ...PCG.Topologies.SquareGreedTopologies
using ...PCG.Universes
using ...PCG.Universes: Universe
using ...PCG.Operations
using ...PCG.Recorders.GreedImages

export SquareSprite

SquareSprite(color, cell_size::Size) = Sprite(color, fill(color, (Int64(cell_size.y), Int64(cell_size.x))))

function GreedImages.node_position(recorder::GreedImageRecorder, index::SquareGreedIndex, canvas_size::Size)
    point = (Point(index) - Point(1.0, 1.0)) * recorder.cell_size
    return ceil(Int64, point) + Point(1, 1)
end

function GreedImages.canvas_size(topology::SquareGreedTopology, recorder::GreedImageRecorder)::Size
    return ceil(Int64, Size(topology.width, topology.height) * recorder.cell_size)
end

end

max_stars_repo_name: Tiendil/pcg-julia

max_issues_repo_name: Tiendil/pcg-julia

max_forks_repo_name: Tiendil/pcg-julia


text:
l_loss_train = []
l_loss_val = []
l_loss_test = []
l_grad = []
l_loss_network = []

iter = 1
loss_val_movingavg = Inf
no_change = 0

cb = function (p, loss_train, loss_val, loss_test, g_norm)
    global l_loss_train, l_loss_val, l_grad, l_loss_network, iter
    push!(l_loss_train, loss_train)
    push!(l_loss_val, loss_val)
    push!(l_loss_test, loss_test)

    push!(l_loss_network, loss_network(p))
    push!(l_grad, g_norm)
    @save string(ckpt_path, "/mymodel.bson") p opt l_loss_train l_loss_val l_loss_test l_grad l_loss_network iter

    @suppress_err if (iter % n_plot == 0)
        if parsed_args["disable-display"]
            println([iter loss_train loss_val loss_test g_norm loss_p])
        else
            l_exp = randperm(n_exp)[1:1]
            println("update plot for ", l_exp)
            for i_exp in l_exp
                cbi(p, i_exp)
            end
            cbloss()
            cbp(p, "_tracking")
        end
    end
    iter += 1;
end

if is_restart
    @load string(ckpt_path, "/mymodel.bson") p opt l_loss_train l_loss_val l_grad iter l_loss_test l_loss_network;
    iter += 1;
end

checkconvergence = function ()
    # TODO: write in log file rather than saved in RAM
    global loss_val_movingavg, no_change
    loss_val_movingavg_new = mean(l_loss_val[max(1, end-n_iter_buffer):end])  # TODO: no check bounds

    if (iter > n_iter_burnin) & (loss_val_movingavg < loss_val_movingavg_new)
        no_change += 1
        if (no_change > n_iter_tol) | (iter > n_iter_max)
            return true
        end
    else
        no_change = 0
        loss_val_movingavg = loss_val_movingavg_new
    end
    return false
end


text:
function InterSatellitesRangeBuilder(arg0::CorrelatedRandomVectorGenerator, arg1::ObservableSatellite, arg2::ObservableSatellite, arg3::jboolean, arg4::jdouble, arg5::jdouble)
    return InterSatellitesRangeBuilder((CorrelatedRandomVectorGenerator, ObservableSatellite, ObservableSatellite, jboolean, jdouble, jdouble), arg0, arg1, arg2, arg3, arg4, arg5)
end

function build(obj::InterSatellitesRangeBuilder, arg0::Vector{SpacecraftState})
    return jcall(obj, "build", InterSatellitesRange, (Vector{SpacecraftState},), arg0)
end


text:
using Test
using StaticArrays: SVector
using LinearAlgebra: dot
using QuantumLattices.Prerequisites: Float
using QuantumLattices.Essentials.DegreesOfFreedom
using QuantumLattices.Essentials.Spatials: PID, Point, pidtype, rcoord, icoord
using QuantumLattices.Mathematics.AlgebraOverFields: ID, idpropertynames
import QuantumLattices.Interfaces: dimension, decompose, update!, sequence, reset!
import QuantumLattices.Essentials.DegreesOfFreedom: script, latexsuperscript, latexsubscript

struct DID <: IID nambu::Int end
Base.adjoint(sl::DID) = DID(3-sl.nambu)

struct DIndex{S} <: Index{PID{S}, DID}
    scope::S
    site::Int
    nambu::Int
end
Base.fieldnames(::Type{<:DIndex}) = (:scope, :site, :nambu)
Base.union(::Type{P}, ::Type{I}) where {P<:PID, I<:DID} = DIndex{fieldtype(P, :scope)}
function Base.angle(id::OID{<:DIndex}, vectors::AbstractVector{<:AbstractVector{Float}}, values::AbstractVector{Float})
    phase=  (length(vectors) == 1) ? 2pi*dot(decompose(id.icoord, vectors[1]), values) :
            (length(vectors) == 2) ? 2pi*dot(decompose(id.icoord, vectors[1], vectors[2]), values) :
            (length(vectors) == 3) ? 2pi*dot(decompose(id.icoord, vectors[1], vectors[2], vectors[3]), values) :
            error("angle error: not supported number of input basis vectors.")
    (id.index.nambu == 1) ? phase : -phase
end

script(oid::OID{<:DIndex}, ::Val{:site}) = oid.index.site
script(oid::OID{<:DIndex}, ::Val{:nambu}) = (oid.index.nambu == 2) ? "\\dagger" : ""

struct DFock <: Internal{DID}
    atom::Int
    nnambu::Int
end
dimension(f::DFock) = f.nnambu
Base.getindex(f::DFock, i::Int) = DID(i)

struct DOperator{V<:Number, I<:ID{OID}} <: Operator{V, I}
    value::V
    id::I
end
latexformat(DOperator, LaTeX{(:nambu,), (:site,)}('d'))

@testset "Index" begin
    index = DIndex(PID('S', 4), DID(1))
    @test index|>pidtype == PID{Char}
    @test index|>typeof|>pidtype == PID{Char}
    @test index|>iidtype == DID
    @test index|>typeof|>iidtype == DID
    @test index|>pid == PID('S', 4)
    @test index|>iid == DID(1)
    @test index|>adjoint == DIndex('S', 4, 2)
    @test union(PID, IID) == Index{PID, IID}
    @test union(index|>pidtype, index|>iidtype) == index|>typeof
end

@testset "IndexToTuple" begin
    index = DIndex(PID('S', 4), DID(1))
    @test directindextotuple(index) == ('S', 4, 1)
    filteredindextotuple = FilteredAttributes(DIndex)
    @test filteredindextotuple == FilteredAttributes(:scope, :site, :nambu)
    @test isequal(filteredindextotuple, FilteredAttributes(:scope, :site, :nambu))
    @test filteredindextotuple|>length == 3
    @test filteredindextotuple|>typeof|>length == 3
    @test filteredindextotuple(index) == ('S', 4, 1)
    @test filter(attr->(attr ≠ :scope), filteredindextotuple)(index) == (4, 1)
    @test filter(attr->(attr ≠ :nambu), filteredindextotuple)(index) == ('S', 4)
    @test filter(attr->(attr ∉ (:site, :nambu)), filteredindextotuple)(index) == ('S',)
end

@testset "Internal" begin
    it = DFock(1, 2)
    @test it|>eltype == DID
    @test it|>typeof|>eltype == DID
    @test it == deepcopy(it)
    @test isequal(it, deepcopy(it))
    @test it|>string == "DFock(atom=1, nnambu=2)"
    @test it|>collect == [DID(1), DID(2)]
end

@testset "IDFConfig" begin
    config = IDFConfig{DFock}(pid->DFock((pid.site-1)%2+1, 2), [PID(1, 1), PID(1, 2)])
    @test convert(Dict, config) == Dict(PID(1, 1)=>DFock(1, 2), PID(1, 2)=>DFock(2, 2))
    reset!(config, (PID(2, 1), PID(2, 2)))
    @test convert(Dict, config) == Dict(PID(2, 1)=>DFock(1, 2), PID(2, 2)=>DFock(2, 2))
end

@testset "Table" begin
    by = filter(attr->(attr ≠ :nambu), FilteredAttributes(DIndex))

    table = Table([DIndex(1, 1, 1), DIndex(1, 1, 2)])
    @test table == Dict(DIndex(1, 1, 1)=>1, DIndex(1, 1, 2)=>2)
    table = Table([DIndex(1, 1, 1), DIndex(1, 1, 2)], by)
    @test table == Dict(DIndex(1, 1, 1)=>1, DIndex(1, 1, 2)=>1)

    config = IDFConfig{DFock}(pid->DFock((pid.site-1)%2+1, 2), [PID(1, 1), PID(1, 2)])
    inds1 = (DIndex(PID(1, 1), iid) for iid in DFock(1, 2))|>collect
    inds2 = (DIndex(PID(1, 2), iid) for iid in DFock(2, 2))|>collect
    @test Table(config) == Table([inds1; inds2])
    @test Table(config, by) == Table([inds1; inds2], by)
    @test Table(config) == union(Table(inds1), Table(inds2))
    @test Table(config, by)|>reverse == Dict(1=>Set([DIndex(1, 1, 1), DIndex(1, 1, 2)]), 2=>Set([DIndex(1, 2, 1), DIndex(1, 2, 2)]))

    table = Table(config)
    @test reset!(empty(table), [inds1; inds2]) == table
    @test reset!(empty(table), config) == table
end

@testset "OID" begin
    oid = OID(DIndex(1, 1, 1), rcoord=SVector(0.0, -0.0), icoord=SVector(0.0, 0.0), seq=1)
    @test oid' == OID(DIndex(1, 1, 2), rcoord=SVector(0.0, 0.0), icoord=SVector(0.0, 0.0), seq=1)
    @test hash(oid, UInt(1)) == hash(OID(DIndex(1, 1, 1), rcoord=SVector(0.0, 0.0), icoord=SVector(0.0, 0.0), seq=1), UInt(1))
    @test idpropertynames(ID{OID}) == (:indexes, :rcoords, :icoords, :seqs)
    @test fieldnames(OID) == (:index, :rcoord, :icoord, :seq)
    @test string(oid) == "OID(DIndex(1, 1, 1), [0.0, 0.0], [0.0, 0.0], 1)"
    @test ID(oid', oid)' == ID(oid', oid)
    @test isHermitian(ID(oid', oid)) == true
    @test isHermitian(ID(oid, oid)) == false
    @test oidtype(DID, Point{2, PID{Char}}, Nothing, Val(true)) == OID{DIndex{Char}, SVector{2, Float}, SVector{2, Float}, Nothing}
    @test oidtype(DID, Point{2, PID{Char}}, Table{DIndex{Char}}, Val(true)) == OID{DIndex{Char}, SVector{2, Float}, SVector{2, Float}, Int}
    @test oidtype(DID, Point{2, PID{Char}}, Nothing, Val(false)) == OID{DIndex{Char}, Nothing, Nothing, Nothing}
    @test oidtype(DID, Point{2, PID{Char}}, Table{DIndex{Char}}, Val(false)) == OID{DIndex{Char}, Nothing, Nothing, Int}
end

@testset "Operator" begin
    @test latexformat(DOperator) == LaTeX{(:nambu,), (:site,)}('d')

    opt = DOperator(1.0im, (DIndex(1, 2, 2), DIndex(1, 1, 1)), rcoords=(SVector(1.0, 0.0), SVector(0.0, 0.0)), icoords=(SVector(2.0, 0.0), SVector(0.0, 0.0)), seqs=(2, 1))
    @test opt' == DOperator(-1.0im, (DIndex(1, 1, 2), DIndex(1, 2, 1)), rcoords=(SVector(0.0, 0.0), SVector(1.0, 0.0)), icoords=(SVector(0.0, 0.0), SVector(2.0, 0.0)), seqs=(1, 2))
    @test isHermitian(opt) == false
    @test string(opt) == "DOperator(1.0im, ID(OID(DIndex(1, 2, 2), [1.0, 0.0], [2.0, 0.0], 2), OID(DIndex(1, 1, 1), [0.0, 0.0], [0.0, 0.0], 1)))"
    @test twist(opt, [[1.0, 0.0], [0.0, 1.0]], [0.1, 0.0]) ≈ replace(opt, value=1.0im*conj(exp(2im*pi*0.2)))
    @test sequence(opt) == (2, 1)
    @test sequence(opt, Dict(DIndex(1, 2, 2)=>3, DIndex(1, 1, 1)=>4)) == (3, 4)

    opt = DOperator(1.0, (DIndex(1, 1, 2), DIndex(1, 1, 1)), rcoords=(SVector(0.5, 0.5), SVector(0.5, 0.5)), icoords=(SVector(1.0, 1.0), SVector(1.0, 1.0)), seqs=(1, 1))
    @test opt' == opt
    @test isHermitian(opt) == true

    opt = DOperator(1.0, (DIndex(1, 1, 2), DIndex(1, 1, 1)), rcoords=(SVector(0.5, 0.5), SVector(0.0, 0.5)), icoords=(SVector(1.0, 1.0), SVector(0.0, 1.0)), seqs=(1, 1))
    @test rcoord(opt) == SVector(0.5, 0.0)
    @test icoord(opt) == SVector(1.0, 0.0)

    opt = DOperator(1.0, ID(OID(DIndex(1, 1, 2), SVector(0.5, 0.0), SVector(1.0, 0.0), 1)))
    @test rcoord(opt) == SVector(0.5, 0.0)
    @test icoord(opt) == SVector(1.0, 0.0)
end

@testset "Operators" begin
    opt1 = DOperator(1.0im, (DIndex(1, 2, 2), DIndex(1, 1, 1)), rcoords=(SVector(1.0, 0.0), SVector(0.0, 0.0)), icoords=(SVector(2.0, 0.0), SVector(0.0, 0.0)), seqs=(2, 1))
    opt2 = DOperator(1.0, (DIndex(1, 1, 2), DIndex(1, 1, 1)), rcoords=(SVector(0.0, 0.0), SVector(0.0, 0.0)), icoords=(SVector(0.0, 0.0), SVector(0.0, 0.0)), seqs=(1, 1))
    opts = Operators(opt1, opt2)
    @test summary(opts) == "Operators{$(opts|>valtype)}"
    @test opts' == Operators(opt1', opt2')
    @test opts' + opts == Operators(opt1, opt1', opt2*2)
    @test isHermitian(opts) == false
    @test isHermitian(opts'+opts) == true
end

@testset "LaTeX" begin
    latex = LaTeX{(:nambu,), (:site,)}('c')
    @test latexsuperscript(latex|>typeof) == (:nambu,)
    @test latexsubscript(latex|>typeof) == (:site,)

    oid = OID(DIndex('d', 1, 2), rcoord=SVector(0.0, 0.0), icoord=SVector(1.0, 0.0), seq=1)
    @test script(oid, Val(:rcoord)) == "[0.0, 0.0]"
    @test script(oid, Val(:icoord)) == "[1.0, 0.0]"
    @test script(oid, latex, Val(:B)) == 'c'
    @test script(oid, latex, Val(:SP)) == ("\\dagger",)
    @test script(oid, latex, Val(:SB)) == (1,)
    @test repr(oid, latex) == "c^{\\dagger}_{1}"

    opt = DOperator(1.0, (DIndex('d', 2, 2), DIndex('d', 1, 1)), rcoords=(SVector(1.0, 0.0), SVector(0.0, 0.0)), icoords=(SVector(2.0, 0.0), SVector(0.0, 0.0)), seqs=(2, 1))
    @test repr(opt, LaTeX{(:nambu,), (:site,)}('c')) == "c^{\\dagger}_{2}c^{}_{1}"
    @test repr(opt, LaTeX{(:nambu,), (:site,)}()) == "d^{\\dagger}_{2}d^{}_{1}"
    @test repr(opt, LaTeX{(:nambu,), (:rcoord,)}()) == "d^{\\dagger}_{[1.0, 0.0]}d^{}_{[0.0, 0.0]}"
    @test repr(opt) == "d^{\\dagger}_{2}d^{}_{1}"

    opts = Operators(DOperator(1.0-1.0im, (DIndex('d', 2, 2), DIndex('d', 1, 1))), DOperator(-1.0, (DIndex('d', 1, 2), DIndex('d', 1, 1))))
    @test repr(opts, LaTeX{(:nambu,), (:site,)}('c')) == "(1.0-1.0im)c^{\\dagger}_{2}c^{}_{1}-c^{\\dagger}_{1}c^{}_{1}"

    io = IOBuffer()
    show(io, MIME"text/latex"(), opt)
    @test String(take!(io)) == "\$d^{\\dagger}_{2}d^{}_{1}\$"
    show(io, MIME"text/latex"(), opts)
    @test String(take!(io)) == "\$(1.0-1.0im)d^{\\dagger}_{2}d^{}_{1}-d^{\\dagger}_{1}d^{}_{1}\$"
end

@testset "Boundary" begin
    opt = DOperator(4.5, (DIndex('a', 1, 2), DIndex('b', 2, 1)), rcoords=(SVector(0.5, 0.5), SVector(1.5, 1.5)), icoords=(SVector(0.0, 0.0), SVector(1.0, 1.0)), seqs=(1, 2))
    bound = Boundary{(:θ₁, :θ₂)}([0.1, 0.2], [[1.0, 0.0], [0.0, 1.0]])
    @test (bound == deepcopy(bound)) && isequal(bound, deepcopy(bound))
    @test angle(bound, opt) ≈ 0.6pi
    @test bound(opt) ≈ replace(opt, value=4.5*exp(2im*pi*0.3))
    update!(bound, θ₁=0.3)
    @test bound(opt) ≈ replace(opt, value=4.5*exp(2im*pi*0.5))
    bound = Boundary()
    @test angle(bound, opt) == 0
    @test bound(opt) == opt
    @test update!(bound) == bound
end


text:
module ImplicitFields

using DataStructures

list_fields(obj::Any) = fieldnames(obj)
get_field(obj::Any, field::Symbol) = getfield(obj, field)
get_field(obj::Any, field::Void) = obj

function resolve(expr, args...; kwargs...)
    # Build the resolution context, mapping symbols
    # to a container=>field pair:
    context = DefaultDict(Symbol, Vector{Tuple{Any,Any}}, ()->[])

    # args expose their fields directly:
    for obj in args
        for field in list_fields(obj)
            push!(context[field], (obj, field))
        end
    end

    # kwargs expose their fields with a suffix to disambiguate them:
    for (suffix, obj) in kwargs
        for field in list_fields(obj)
            push!(context[Symbol("$(field)_$(suffix)")], (obj, field))
        end
        # also expose the object itself:
        push!(context[suffix], (obj, nothing))
    end

    # Walk the AST and perform the replacements:
    return replace(expr, context)
end
export(resolve)

function replace(s::Symbol, subst)
    if haskey(subst, s)
        matches = subst[s]
        (obj, field) = first(matches)
        if length(matches) > 1
            warn("""Resolving $s to $((obj, field)), but it is ambiguous with """,
                    join(matches[2:end], ", ", " and "))
        end
        return get_field(obj, field)
    end
    return s
end

function replace(expr::Expr, subst)
    args = map(expr.args) do arg
        replace(arg, subst)
    end
    return Expr(expr.head, args...)
end

replace(obj::Any, subst) = obj

end # module


text:
"""
    magic_number(n::Int64))

A magic number has to build as the power of 5 or the sum of unique powers of 5. First few
magic numbers are:
    1. 5
    2. 5^2 = 25
    3. 5 + 25 = 30
    4. 5^3 = 125
    5. 125 + 5 = 130

# Arguments
- `n::Int64`: Integer value of the number, which has to become a magic number

# Examples
```julia-repl
julia> import ClassicAlgorithmsCollections
julia> ClassicAlgorithmsCollections.magic_number(5)
130
```
"""
function magic_number(n::Int64)

    pow = 1
    result = 0

    while n != 0
        pow *= 5
        if n & 1 % Bool
            result += pow
        end
        n >>= 1
    end
    return result
end

max_stars_repo_name: Anselmoo/ClassicAlgorithmsCollections

max_issues_repo_name: Anselmoo/ClassicAlgorithmsCollections

max_forks_repo_name: Anselmoo/ClassicAlgorithmsCollections


text:
@doc raw"""
    ExponentialSmoothing(
        y::Vector{Fl};
        trend::Bool = false,
        damped_trend::Bool = false,
        seasonal::Int = 0
    ) where Fl

Linear exponential smoothing models. These models are also known as ETS in the literature.
This model is estimated using the Kalman filter for linear Gaussian state space models, for this
reason the possible models are the following ETS with additive errors:
 * ETS(A, N, N)
 * ETS(A, A, N)
 * ETS(A, Ad, N)
 * ETS(A, N, A)
 * ETS(A, A, A)
 * ETS(A, Ad, A)

Other softwares have use the augmented least squares approach and have all the possible ETS
combinations. The Kalman filter approach might be slower than others but have the advantages of
filtering the components.

# References
 * Hyndman, Rob, Anne B. Koehler, J. Keith Ord, and Ralph D. Snyder.
   Forecasting with exponential smoothing: the state space approach.
   Springer Science & Business Media, 2008.
 * Hyndman, Robin John; Athanasopoulos, George.
   Forecasting: Principles and Practice.
   2nd ed. OTexts, 2018.
"""
mutable struct ExponentialSmoothing <: StateSpaceModel
    hyperparameters::HyperParameters
    trend::Bool
    damped_trend::Bool
    seasonal::Int
    system::LinearUnivariateTimeInvariant
    results::Results

    function ExponentialSmoothing(y::Vector{Fl};
                                  trend::Bool = false,
                                  damped_trend::Bool = false,
                                  seasonal::Int = 0
                                  ) where Fl
        @assert seasonal != 1 "seasonal must be different than 1"
        if damped_trend
            @assert trend
        end
        # Define system matrices
        Z = build_Z(Fl, trend, seasonal)
        T = build_T(Fl, trend, seasonal)
        R = zeros(Fl, size(T, 1), 1)
        R[1] = 1
        d = zero(Fl)
        c = zeros(Fl, size(T, 1))
        H = zero(Fl)
        Q = ones(Fl, 1, 1)

        system = LinearUnivariateTimeInvariant{Fl}(y, Z, T, R, d, c, H, Q)

        # Define hyperparameters names
        names = build_names(trend, damped_trend, seasonal)
        hyperparameters = HyperParameters{Fl}(names)

        return new(hyperparameters, trend, damped_trend,
                   seasonal, system, Results{Fl}())
    end
end

num_states(trend::Bool, seasonal::Int) = 2 + trend + seasonal

function build_Z(Fl::DataType, trend::Bool, seasonal::Int)
    n_states = num_states(trend, seasonal)
    Z = zeros(Fl, n_states)
    Z[1:2] .= 1
    if seasonal > 0
        Z[3 + trend] = 1
    end
    return Z
end

function build_T(Fl::DataType, trend::Bool, seasonal::Int)
    n_states = num_states(trend, seasonal)
    T = zeros(Fl, n_states, n_states)
    T[2, 2] = 1
    if trend
        T[2:3, 3] .= 1
    end
    if seasonal > 0
        T[3 + trend, end] = 1
        for i in 3+trend+1:n_states
            T[i, i-1] = 1
        end
    end
    return T
end

function build_names(trend::Bool, damped_trend::Bool, seasonal::Int)
    names = String["sigma2", "smoothing_level"]
    if trend
        push!(names, "smoothing_trend")
        if damped_trend
            push!(names, "damping_trend")
        end
    end
    if seasonal > 0
        push!(names, "smoothing_seasonal")
    end
    push!(names, "initial_level")
    if trend
        push!(names, "initial_trend")
    end
    if seasonal > 0
        for i in 1:seasonal - 1
            push!(names, "initial_seasonal_$i")
        end
    end
    return names
end

function diff_es(y::Vector{Fl}, s::Int) where Fl
    # Seasonal differencing
    y = y[s:end] - y[1:end-s+1]
    return y
end

function default_filter(model::ExponentialSmoothing)
    Fl = typeof_model_elements(model)
    n_states = num_states(model.trend, model.seasonal)
    steadystate_tol = Fl(1e-5)
    a1 = zeros(Fl, n_states)
    P1 = Fl(1e6) .* Matrix{Fl}(I, n_states, n_states)
    skip_llk = 0
    return UnivariateKalmanFilter(a1, P1, skip_llk, steadystate_tol)
end

function initial_hyperparameters!(model::ExponentialSmoothing)
    Fl = typeof_model_elements(model)
    observations = model.system.y[findall(!isnan, model.system.y)]
    observed_variance = var(observations)
    initial_hyperparameters = Dict{String,Fl}(
        "sigma2" => observed_variance,
        "smoothing_level" => Fl(0.1),
        "initial_level" => observations[1]
    )
    if model.trend
        initial_hyperparameters["smoothing_trend"] = Fl(0.01)
        initial_hyperparameters["initial_trend"] = observations[2] - observations[1]
        if model.damped_trend
            initial_hyperparameters["damping_trend"] = Fl(0.97)
        end
    end
    if model.seasonal > 0
        # If the model is seasonal we update the initial_level and initial_trend
        initial_hyperparameters["smoothing_seasonal"] = Fl(0.01)
        # TODO this might be wrong for missing observations in the first s observations
        initial_hyperparameters["initial_level"] = mean(observations[1:model.seasonal - 1])
        if model.trend
            obs = diff_es(observations, model.seasonal)
            initial_hyperparameters["initial_trend"] = obs[2] - obs[1]
        end
        for i in 1:model.seasonal - 1
            initial_hyperparameters["initial_seasonal_$i"] = observations[i] -
                                                             mean(observations[1:model.seasonal - 1])
        end
    end
    set_initial_hyperparameters!(model, initial_hyperparameters)
    return model
end

function constrain_hyperparameters!(model::ExponentialSmoothing)
    Fl = typeof_model_elements(model)
    constrain_variance!(model, "sigma2")
    constrain_box!(model, "smoothing_level", Fl(0.0001), Fl(0.9999))
    constrain_identity!(model, "initial_level")
    if model.trend
        ub = min(Fl(0.9999), get_constrained_value(model, "smoothing_level"))
        constrain_box!(model, "smoothing_trend", Fl(0.0001), ub)
        constrain_identity!(model, "initial_trend")
        if model.damped_trend
            constrain_box!(model, "damping_trend", Fl(0.8), Fl(0.98))
        end
    end
    if model.seasonal > 0
        ub = min(Fl(0.9999), 1 - get_constrained_value(model, "smoothing_level"))
        constrain_box!(model, "smoothing_seasonal", Fl(0.0001), ub)
        for i in 1:model.seasonal - 1
            constrain_identity!(model, "initial_seasonal_$i")
        end
    end
    return model
end

function unconstrain_hyperparameters!(model::ExponentialSmoothing)
    Fl = typeof_model_elements(model)
    unconstrain_variance!(model, "sigma2")
    unconstrain_box!(model, "smoothing_level", Fl(0.0001), Fl(0.9999))
    unconstrain_identity!(model, "initial_level")
    if model.trend
        ub = min(Fl(0.9999), get_constrained_value(model, "smoothing_level"))
        unconstrain_box!(model, "smoothing_trend", Fl(0.0001), ub)
        unconstrain_identity!(model, "initial_trend")
        if model.damped_trend
            unconstrain_box!(model, "damping_trend", Fl(0.8), Fl(0.98))
        end
    end
    if model.seasonal > 0
        ub = min(Fl(0.9999), 1 - get_constrained_value(model, "smoothing_level"))
        unconstrain_box!(model, "smoothing_seasonal", Fl(0.0001), ub)
        for i in 1:model.seasonal - 1
            unconstrain_identity!(model, "initial_seasonal_$i")
        end
    end
    return model
end

function fill_model_system!(model::ExponentialSmoothing)
    model.system.Q[1] = get_constrained_value(model, "sigma2")
    i = 1
    model.system.R[i] = 1 - get_constrained_value(model, "smoothing_level")
    i += 1
    model.system.R[i] = get_constrained_value(model, "smoothing_level")
    i += 1
    if model.trend
        model.system.R[i] = get_constrained_value(model, "smoothing_trend")
        i += 1
        if model.damped_trend
            model.system.T[2:3, 3] .= get_constrained_value(model, "damping_trend")
        end
    end
    if model.seasonal > 0
        model.system.R[1] -= get_constrained_value(model, "smoothing_seasonal")
        model.system.R[i] = get_constrained_value(model, "smoothing_seasonal")
    end
    return model
end

function fill_model_filter!(filter::KalmanFilter, model::ExponentialSmoothing)
    Fl = typeof_model_elements(model)
    initial_level = get_constrained_value(model, "initial_level")
    initial_state = [0; initial_level]
    if model.trend
        initial_trend = get_constrained_value(model, "initial_trend")
        initial_state = vcat(initial_state, initial_trend)
    end
    if model.seasonal > 0
        initial_seasonal = Fl[]
        for i in 1:model.seasonal - 1
            push!(initial_seasonal, get_constrained_value(model, "initial_seasonal_$i"))
        end
        last_initial_seasonal = -sum(initial_seasonal)
        push!(initial_seasonal, last_initial_seasonal)
        initial_state = vcat(initial_state, initial_seasonal)
    end
    filter.kalman_state.a = model.system.T * initial_state
    filter.kalman_state.P = model.system.R * model.system.Q * model.system.R'
    return nothing
end

has_exogenous(model::ExponentialSmoothing) = false

function reinstantiate(model::ExponentialSmoothing, y::Vector{Fl}) where Fl
    return ExponentialSmoothing(y;
                trend = model.trend,
                damped_trend = model.damped_trend,
                seasonal = model.seasonal
            )
end

function model_name(model::ExponentialSmoothing)
    E = "A"
    T = model.trend ?
        model.damped_trend ? "Ad" : "A" :
        "N"
    S = model.seasonal > 0 ? "A" : "N"
    return "ETS($E,$T,$S)"
end

function dict_components(model::ExponentialSmoothing)
    dict_components = OrderedDict{String, Int}()
    i = 2
    dict_components["Trend"] = i
    i += 1
    if model.trend
        dict_components["Slope"] = i
        i += 1
    end
    if model.seasonal > 0
        dict_components["Seasonal"] = i
    end
    return dict_components
end

@doc raw"""
    auto_ets(y::Vector{Fl}; seasonal::Int = 0) where Fl

Automatically fits the best [`ExponentialSmoothing`](@ref) model according to the best AIC
between the models:
 * ETS(A, N, N)
 * ETS(A, A, N)
 * ETS(A, Ad, N)

If the user provides the time series seasonality it will search between the models
 * ETS(A, N, A)
 * ETS(A, A, A)
 * ETS(A, Ad, A)

# References
 * Hyndman, Robin John; Athanasopoulos, George.
 Forecasting: Principles and Practice.
 2nd ed. OTexts, 2018.
"""
function auto_ets(y::Vector{Fl}; seasonal::Int = 0) where Fl
    models = StateSpaceModel[]
    models_aic = Fl[]
    @assert seasonal != 1 "seasonal must be different than 1"
    m1 = ExponentialSmoothing(y; trend = false, damped_trend = false, seasonal = seasonal)
    fit!(m1)
    push!(models, m1)
    push!(models_aic, m1.results.aic)
    m2 = ExponentialSmoothing(y; trend = true, damped_trend = false, seasonal = seasonal)
    fit!(m2)
    push!(models, m2)
    push!(models_aic, m2.results.aic)
    m3 = ExponentialSmoothing(y; trend = true, damped_trend = true, seasonal = seasonal)
    fit!(m3)
    push!(models, m3)
    push!(models_aic, m3.results.aic)
    best_aic_idx = findmin(models_aic)[2] # index of the best BIC
    return models[best_aic_idx]
end


text:
#=
my_stack:
- Julia version: 1.5.0
- Author: shisa
- Date: 2020-08-18
=#

module MyStack
    # variables
    const stack_size = 100
    stack_num = 0
    stack_data = [0 for i in 1:stack_size]

    function push(n)
        global stack_num
        if stack_num < stack_size
            stack_num += 1
            stack_data[stack_num] = n
            println("Push $(n) : $(stack_data[1:stack_num])")
            return true
        else
            println("Push $(n) : Stack is full")
            return false
        end
    end

    function pop()
        global stack_num
        if stack_num > 0
            pop_data = stack_data[stack_num]
            stack_num -= 1
            println("Pop $(pop_data) : $(stack_data[1:stack_num])")
            return true
        else
            return false
        end
    end

    function main()
        # push 1~10 to stack
        for i in 1:10
            push(i)
        end
        # pop 6 times
        for i in 1:6
            pop()
        end
        # pop until stack become empty
        while stack_num > 0
            pop()
        end
        println("Stack is empty")
    end
end

if abspath(PROGRAM_FILE) == @__FILE__
    using .MyStack
    @time MyStack.main()
end

max_stars_repo_name: ShisatoYano/JuliaPractice

max_issues_repo_name: ShisatoYano/JuliaPractice

max_forks_repo_name: ShisatoYano/JuliaPractice


text:
using DataDrivenDiffEq
using ModelingToolkit

using LinearAlgebra
using SafeTestsets
using Random

@info "Loading OrdinaryDiffEq"
using OrdinaryDiffEq

using Test
@info "Finished loading packages"

const GROUP = get(ENV, "GROUP", "All")

@time begin
    if GROUP == "All" || GROUP == "DataDrivenDiffEq" || GROUP == "Standard"
        @testset "Basis" begin include("./basis/basis.jl") end
        @testset "Basis Generators" begin include("./basis/generators.jl") end

        @testset "DataDrivenProblem" begin
            include("./problem/problem.jl")
            include("./problem/samplers.jl")
        end

        @testset "Sparse Identification" begin
            @testset "Pendulum" begin include("./sindy/pendulum.jl") end
            @testset "Michaelis Menten" begin include("./sindy/michaelis_menten.jl") end
            @testset "Cartpole" begin include("./sindy/cartpole.jl") end
        end

        @testset "Koopman" begin
            @testset "Linear Autonomous" begin include("./dmd/linear_autonomous.jl") end
            @testset "Linear Forced" begin include("./dmd/linear_forced.jl") end
            @testset "Nonlinear Autonomous" begin include("./dmd/nonlinear_autonomous.jl") end
            @testset "Nonlinear Forced" begin include("./dmd/nonlinear_forced.jl") end
        end
    end
    if GROUP == "All" || GROUP == "Optional"

        @info "Loading Flux"
        using Flux
        @info "Loading Symbolic Regression"
        using SymbolicRegression

        @testset "Symbolic Regression" begin
            @testset "OccamNet" begin include("./symbolic_regression/occamnet.jl") end
            @testset "SymbolicRegression" begin include("./symbolic_regression/symbolic_regression.jl") end
        end
    end

    if GROUP == "All" || GROUP == "Docs"
        @info "Testing documentation examples"

        @safetestset "Documentation" begin
            excludes = ["8_symbolic_regression.jl"]
            example_dir = joinpath(@__DIR__, "..", "docs", "examples")

            function test_literate_script(file, path)
                f_path = joinpath(path, file)
                !isfile(f_path) && return
                fname, fext = split(file, ".")
                !(fext == "jl") && return
                f_mod = gensym(string(fname))
                # This is similar to SafeTestsets, but works for my case
                eval(quote
                        @eval module $f_mod
                            using Test
                            @testset $fname begin
                                include($f_path)
                            end
                        end
                        nothing
                end)
            end

            # Check each example and create a unique testset
            for f in readdir(example_dir)
                f ∈ excludes && continue
                test_literate_script(f, example_dir)
            end

        end
    end

    # These are excluded right now, until the deps are figured out
    #if GROUP == "Integration" || GROUP == "All"
    #    @safetestset "Partial Lotka Volterra Discovery " begin include("./applications/partial_lotka_volterra.jl") end
    #end
end


text:
eval(quote
    using .ModelingToolkit: get_variables,
                            gradient,
                            simplify,
                            Operation

   """
       _vec(vars::NTuple{L, Union{<:Operation, <:Vector{Operation}}}) where {L}

   Transform a tuple of operations into one vector of operations.

   ### Input

   - `vars` -- tuple where each element is either an `Operation` or a vector of operations

   ### Output

   A vector of `Operation` obtained by concatenating each tuple component.

   ## Examples

   ```julia
   julia> vars = @variables x[1:2] y
   (Operation[x₁, x₂], y)

   julia> LazySets._vec(vars)
   3-element Array{Operation,1}:
    x₁
    x₂
    y
   ```
   """
    function _vec(vars::NTuple{L, Union{<:Operation, <:Vector{Operation}}}) where {L}
        return collect(reduce(vcat, vars))
    end

    # case with a single variable
    _vec(vars::Tuple{Operation}) = [vars[1]]

end)

eval(load_modeling_toolkit_hyperplane())
eval(load_modeling_toolkit_halfspace())
eval(load_modeling_toolkit_hpolyhedron())
eval(load_modeling_toolkit_hpolytope())


text:
"""
Plot reciepes for ElectricFields, Simulations, etc.
"""
module Plotting

using ..Common
using RecipesBase
using LaTeXStrings

include("1D/Plotting1D.jl")
include("2D/Plotting2D.jl")
# include("3D/Plotting3D.jl")

# @recipe f(e::VectorField; by=abs2) = e, by
# @recipe f(by::Function,e::VectorField) = e,by
# @recipe f(e::VectorField,sim::Simulation) = sim,e
# @recipe f(e::VectorField,sim::Simulation,by::Function) = sim,e,by
# @recipe f(sim::Simulation,by::Function,e::VectorField) = sim,e,by
# @recipe f(e::VectorField,by::Function,sim::Simulation) = sim,e,by
# @recipe f(by::Function,sim::Simulation,e::VectorField) = sim,e,by
# @recipe f(by::Function,e::VectorField,sim::Simulation) = sim,e,by

end


text:
struct EmpiricalPattern <: AbstractPattern
    labels::Vector{Int64}
    realizations::Vector{Dict{Symbol, Vector{Float64}}}
    δh::Float64
end

# return realization count
realcount(p::EmpiricalPattern) = length(p.realizations)

# return realizations
reals(p::EmpiricalPattern) = p.realizations
reals(p::EmpiricalPattern, name::Symbol) = getindex.(reals(p), name)

# sample from realizations
sample(p::EmpiricalPattern) = sample(reals(p))
sample(p::EmpiricalPattern, n::Int64) = sample(reals(p), n)

# return base pattern labels
labels(p::EmpiricalPattern) = p.labels

# variable names
Base.names(p::EmpiricalPattern) = collect(keys(first(reals(p))))

# stack multiple patterns in a single layer
function stack(ps::Vector{<:AbstractPattern})
    # sample single realization for every pattern
    reals = sample.(ps)

    # stack layers into a single layer
    stack(reals)
end

function stack(lyr::Vector{Dict{Symbol,Vector{Float64}}})
    stacked = eltype(lyr)()

    for key in keys(first(lyr))
        properties = getindex.(lyr, key)
        stacked[key] = vcat(properties...)
    end
    stacked
end

# show methods
function Base.show(io::IO, p::EmpiricalPattern)
    print(io, "EmpiricalPattern($(join(labels(p),"-")))")
end

function Base.show(io::IO, ::MIME"text/plain", p::EmpiricalPattern)
    println(io, p)
    println(io, "  Sampling rate Δh:  ", p.δh)
    println(io, "  Variables:         ", join(names(p), ", "))
    println(io, "  Realization count: ", realcount(p))
end


text:
using DrWatson
@quickactivate "MinimizeSR"

include("SubFunction/Subsampling_1D.jl")
include("SubFunction/Opt_SpectralRatio_SA.jl")

ns = 300;  # number of sources
p = 5;     # subsampling factor

# initial by using optimally-jittered subsampling
Ind1 = Subsampling_1D(ns,p);

r = 0.2;   #To be relocated ratio of the sources
Ind3, Initial_SR, Final_SR = Opt_SpectralRatio_SA(ns, Ind1, r, p); # Spectral ratio Optimization

println(string("Initial_SR ="), Initial_SR)
println(string("Final_SR ="), Final_SR)


text:
# Julia wrapper for header: /usr/include/scip/pub_table.h
# Automatically generated using Clang.jl wrap_c

function SCIPtableGetData(table)
    ccall((:SCIPtableGetData, libscip), Ptr{SCIP_TABLEDATA}, (Ptr{SCIP_TABLE},), table)
end

function SCIPtableSetData(table, tabledata)
    ccall((:SCIPtableSetData, libscip), Cvoid, (Ptr{SCIP_TABLE}, Ptr{SCIP_TABLEDATA}), table, tabledata)
end

function SCIPtableGetName(table)
    ccall((:SCIPtableGetName, libscip), Cstring, (Ptr{SCIP_TABLE},), table)
end

function SCIPtableGetDesc(table)
    ccall((:SCIPtableGetDesc, libscip), Cstring, (Ptr{SCIP_TABLE},), table)
end

function SCIPtableGetPosition(table)
    ccall((:SCIPtableGetPosition, libscip), Cint, (Ptr{SCIP_TABLE},), table)
end

function SCIPtableGetEarliestStage(table)
    ccall((:SCIPtableGetEarliestStage, libscip), SCIP_STAGE, (Ptr{SCIP_TABLE},), table)
end

function SCIPtableIsActive(table)
    ccall((:SCIPtableIsActive, libscip), UInt32, (Ptr{SCIP_TABLE},), table)
end

function SCIPtableIsInitialized(table)
    ccall((:SCIPtableIsInitialized, libscip), UInt32, (Ptr{SCIP_TABLE},), table)
end


text:
# License for this file: MIT (expat)
# Copyright 2017-2018, DLR Institute of System Dynamics and Control
#
# This file is part of module
#   ModiaMath.Result (ModiaMath/Result/_module.jl)
#

function plot(result, names::AbstractString; heading::AbstractString="", grid::Bool=true, xAxis="time", figure::Int=1, prefix::AbstractString="", reuse::Bool=false, maxLegend::Integer=10)
    println("... ModiaMath.plot(..): Call is ignored, since PyPlot not available.")
end

function plot(result, names::Tuple; heading::AbstractString="", grid::Bool=true, xAxis="time", figure::Int=1, prefix::AbstractString="", reuse::Bool=false, maxLegend::Integer=10)
    println("... ModiaMath.plot(..): Call is ignored, since PyPlot not available.")
end

function plot(result, names::AbstractMatrix; heading::AbstractString="", grid::Bool=true, xAxis="time", figure::Int=1, prefix::AbstractString="", reuse::Bool=false, maxLegend::Integer=10)
    println("... ModiaMath.plot(..): Call is ignored, since PyPlot not available.")
end