Skip to content

Commit

Permalink
Merge pull request #296 from yeesian/fix/mac-m1
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion authored Apr 30, 2022
2 parents 21e2300 + 524caf5 commit e401e00
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
keywords = ["GDAL", "IO"]
license = "MIT"
desc = "A high level API for GDAL - Geospatial Data Abstraction Library"
version = "0.8.4"
version = "0.8.5"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
43 changes: 28 additions & 15 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ if VERSION < v"1.5"
end

"""
@convert(<T1>::<T2>,
@convert(<T1>::<T2>,
<conversions>
)
Generate `convert` functions both ways between ArchGDAL Enum of typeids (e.g. `ArchGDAL.OGRFieldType`)
Generate `convert` functions both ways between ArchGDAL Enum of typeids (e.g. `ArchGDAL.OGRFieldType`)
and other types or typeids.
ArchGDAL uses Enum types, listing typeids of various data container used in GDAL/OGR object model.
Some of these types are used to implement concrete types in julia through parametric composite types
ArchGDAL uses Enum types, listing typeids of various data container used in GDAL/OGR object model.
Some of these types are used to implement concrete types in julia through parametric composite types
based on those Enum of typeids (e.g. `Geometry` and `IGeometry` types with `OGRwkbGeometryType`)
Other types or typeids can be:
- GDAL CEnum.Cenum typeids (e.g. `GDAL.OGRFieldType`),
- Base primitive DataType types (e.g. `Bool`),
- GDAL CEnum.Cenum typeids (e.g. `GDAL.OGRFieldType`),
- Base primitive DataType types (e.g. `Bool`),
- other parametric composite types (e.g. `ImageCore.Normed`)
# Arguments
- `(<T1>::<T2>)::Expr`: source and target supertypes, where `T1<:Enum` and `T2<:CEnum.Cenum || T2::Type{DataType} || T2::UnionAll}``
- `(<stype1>::<stype2>)::Expr`: source and target subtypes or type ids with `stype1::T1` and
- `stype2::T2 where T2<:CEnum.Cenum` or
- `stype2::T2 where T2::Type{DataType}` or
- `(<stype1>::<stype2>)::Expr`: source and target subtypes or type ids with `stype1::T1` and
- `stype2::T2 where T2<:CEnum.Cenum` or
- `stype2::T2 where T2::Type{DataType}` or
- `stype2<:T2`where T2<:UnionAll
- ...
**Note:** In the case where the mapping is not bijective, the last declared typeid of subtype is used.
Example:
**Note:** In the case where the mapping is not bijective, the last declared typeid of subtype is used.
Example:
```
@convert(
OGRFieldType::DataType,
Expand All @@ -56,7 +56,7 @@ will generate a `convert` functions giving:
GF_Write::GDAL.GF_Write,
)
```
does the equivalent of
does the equivalent of
```
const GDALRWFlag_to_GDALRWFlag_map = ImmutableDict(
GF_Read => GDAL.GF_Read,
Expand All @@ -66,7 +66,7 @@ Base.convert(::Type{GDAL.GDALRWFlag}, ft::GDALRWFlag) =
GDALRWFlag_to_GDALRWFlag_map[ft]
const GDALRWFlag_to_GDALRWFlag_map = ImmutableDict(
GDAL.GF_Read => GF_Read,
GDAL.GF_Read => GF_Read,
GDAL.GF_Write => GF_Write
)
Base.convert(::Type{GDALRWFlag}, ft::GDAL.GDALRWFlag) =
Expand All @@ -82,7 +82,7 @@ Base.convert(::Type{GDALRWFlag}, ft::GDAL.GDALRWFlag) =
does the equivalent of
```
const OGRFieldType_to_DataType_map = ImmutableDict(
OFTInteger => Bool,
OFTInteger => Bool,
OFTInteger => Int16,
)
Base.convert(::Type{DataType}, ft::OGRFieldType) =
Expand Down Expand Up @@ -229,7 +229,20 @@ macro cplwarn(code, message)
end

macro cplprogress(progressfunc)
@cfunction($(esc(progressfunc)), Cint, (Cdouble, Cstring, Ptr{Cvoid}))
@static if Sys.ARCH == :aarch64
@warn "User provided progress functions are unsupported on this architecture."
return @cfunction(
GDAL.gdaldummyprogress,
Cint,
(Cdouble, Cstring, Ptr{Cvoid})
)
else
return @cfunction(
$(esc(progressfunc)),
Cint,
(Cdouble, Cstring, Ptr{Cvoid})
)
end
end

# """
Expand Down

2 comments on commit e401e00

@evetion
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/59407

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.5 -m "<description of version>" e401e0079d97dac9d4755a4bc9dce345a9c5bf81
git push origin v0.8.5

Please sign in to comment.