Skip to content

Commit

Permalink
create runtime functions for all backends
Browse files Browse the repository at this point in the history
  • Loading branch information
BeastyBlacksmith committed Jan 16, 2024
1 parent 2e3b6f5 commit 94f5d69
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions src/abstract_backend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const _backendSymbol = Dict{DataType,Symbol}(NoBackend => :none)
const _backendType = Dict{Symbol,DataType}(:none => NoBackend)
const _backend_packages = Dict{Symbol,Symbol}()
const _initialized_backends = Set{Symbol}()
const _backends = Symbol[]
const _backends = (:gr, :unicodeplots, :pgfplotsx, :pythonplot, :plotlyjs, :inspectdr, :gaston)

const _plots_deps = let toml = Pkg.TOML.parsefile(normpath(@__DIR__, "..", "Project.toml"))
merge(toml["deps"], toml["extras"])
Expand Down Expand Up @@ -141,26 +141,15 @@ end
# -- Create backend init functions by hand as the corresponding structs do not
# exist yet

function gr(; kw...)
default(; reset = false, kw...)
backend(:gr)
end
export gr

function unicodeplots(; kw...)
default(; reset = false, kw...)
backend(:unicodeplots)
end
export unicodeplots

function pgfplotsx(; kw...)
default(; reset = false, kw...)
backend(:pgfplotsx)
for be in _backends
@eval begin
function $be(; kw...)
default(; reset = false, kw...)
backend(Symbol($be))
end
export $be
end
end
export pgfplotsx

# Consider moving to a macro:
# $sym(; kw...) = (default(; reset = false, kw...); backend($T()))

# ---------------------------------------------------------
# create the various `is_xxx_supported` and `supported_xxxs` methods
Expand Down

0 comments on commit 94f5d69

Please sign in to comment.