@@ -1838,7 +1838,7 @@ function parse_params(d::Dict, cmd::String; del::Bool=true)::String
18381838end
18391839
18401840# ---------------------------------------------------------------------------------------------------
1841- function add_opt_pen (d:: Dict , symbs:: Union{Nothing, VMs} ; opt:: String = " " , del:: Bool = true ):: String
1841+ function add_opt_pen (d:: Dict , @nospecialize ( symbs:: Union{Nothing, VMs} ) ; opt:: String = " " , del:: Bool = true ):: String
18421842 # Build a pen option. Input can be either a full hard core string or spread in lw (or lt), lc, ls, etc or a tuple
18431843
18441844 (SHOW_KWARGS[]) && return print_kwarg_opts (symbs, " NamedTuple | Tuple | String | Number" ) # Just print the options
@@ -2308,9 +2308,9 @@ end
23082308# ---------------------------------------------------------------------------------------------------
23092309function add_opt (d:: Dict , cmd:: String , opt:: String , mapa:: NamedTuple ):: String
23102310 # Thin wrapper: convert NT to Dict to compile _add_opt only once
2311- _add_opt_1 (d, cmd, opt, nt2dict (mapa))
2311+ _add_opt_1 (d, cmd, opt, Dict {Symbol,Any} ( nt2dict (mapa) ))
23122312end
2313- function _add_opt_1 (d:: Dict , cmd:: String , opt:: String , mapa:: Dict ):: String
2313+ function _add_opt_1 (d:: Dict , cmd:: String , opt:: String , mapa:: Dict{Symbol,Any} ):: String
23142314 cmd_:: String = " "
23152315 for k in keys (mapa)
23162316 ((val_ = find_in_dict (d, [k], false )[1 ]) === nothing ) && continue # This mapa key was not used
@@ -2339,11 +2339,11 @@ end
23392339function add_opt (d:: Dict , cmd:: String , opt:: String , symbs:: VMs , mapa; grow_mat= nothing , del:: Bool = true , expand:: Bool = false , expand_str:: Bool = false ):: String
23402340 # Thin wrapper: convert NamedTuple mapa to Dict to avoid recompilation for each distinct NT type
23412341 mapa_is_nt = isa (mapa, NamedTuple)
2342- _mapa = mapa_is_nt ? nt2dict (mapa) : mapa
2343- _add_opt_2 (d, cmd, opt, symbs, _mapa; grow_mat= grow_mat , del= del , expand= expand , expand_str= expand_str, mapa_is_nt = mapa_is_nt)
2342+ _mapa = mapa_is_nt ? Dict {Symbol,Any} ( nt2dict (mapa)) : ( mapa === nothing ? Dict {Symbol,Any} () : mapa)
2343+ _add_opt_2 (d, cmd, opt, vec ( symbs) , _mapa, grow_mat, del, expand, expand_str, mapa_is_nt)
23442344end
23452345
2346- function _add_opt_2 (d:: Dict , cmd:: String , opt:: String , symbs:: VMs , mapa; grow_mat= nothing , del:: Bool = true , expand:: Bool = false , expand_str:: Bool = false , mapa_is_nt:: Bool = false ):: String
2346+ function _add_opt_2 (d:: Dict , cmd:: String , opt:: String , symbs:: Vector{Symbol} , @nospecialize ( mapa), @nospecialize ( grow_mat) , del:: Bool , expand:: Bool , expand_str:: Bool , mapa_is_nt:: Bool ):: String
23472347 # Scan the D Dict for SYMBS keys and if found create the new option OPT and append it to CMD
23482348 # If DEL == false we do not remove the found key.
23492349 # 'grow_mat=mat', is a special case to append to a matrix (can't realy be done in Julia)
@@ -2598,7 +2598,7 @@ function _add_opt_3(d::Dict, cmd::String, opt::String, symbs::VMs, need_symb::Sy
25982598 opt = string (opt,val)
25992599 to_slot = false
26002600 end
2601- cmd = _add_opt_2 (d, cmd, opt, symbs, nt_opts_d; mapa_is_nt = true )
2601+ cmd = _add_opt_2 (d, cmd, opt, vec ( symbs) , nt_opts_d, nothing , true , false , false , true )
26022602 elseif (isa (val, Array{<: Real }) || isa (val, GDtype) || isa (val, GMTcpt) || typeof (val) <: AbstractRange )
26032603 if (typeof (val) <: AbstractRange ) val = collect (val) end
26042604 cmd = string (cmd, " -" , opt)
@@ -2717,18 +2717,18 @@ function add_opt_fill(d::Dict, opt::String="")
27172717 add_opt_fill (d, [collect (keys (d))[1 ]], opt) # Use ONLY when len(d) == 1
27182718end
27192719add_opt_fill (d:: Dict , symbs:: VMs , opt= " " ) = add_opt_fill (" " , d, symbs, opt)
2720- function add_opt_fill (cmd:: String , d:: Dict , symbs:: VMs , opt= " " , del:: Bool = true ):: String
2720+ function add_opt_fill (cmd:: String , d:: Dict , @nospecialize ( symbs:: VMs ) , opt:: String = " " , del:: Bool = true ):: String
27212721 # Deal with the area fill attributes option. Normally, -G
27222722 (SHOW_KWARGS[]) && return print_kwarg_opts (symbs, " NamedTuple | Tuple | Array | String | Number" )
27232723 ((val = find_in_dict (d, symbs, del)[1 ]) === nothing ) && return cmd
27242724 isa (val, AbstractDict) && (val = Base. invokelatest (dict2nt, val))
27252725 (val == true && symbs == [:G :fill ]) && (val= " #0072BD" ) # Let fill=true mean a default color
27262726 (val == " " && symbs == [:G :fill ]) && return cmd # Let fill="" mean no fill (handy for proggy reasons)
2727- (opt != " " ) && (opt = string (" -" , opt))
2727+ (opt != = " " ) && (opt = string (" -" , opt))
27282728 return add_opt_fill (val, cmd, opt)
27292729end
27302730
2731- function add_opt_fill (@nospecialize (val), cmd:: String = " " , opt= " " ):: String
2731+ function add_opt_fill (@nospecialize (val), cmd:: String = " " , opt:: String = " " ):: String
27322732 # This method can be called directy with VAL as a NT or a string
27332733 if (isa (val, Tuple) && length (val) == 2 && (isa (val[1 ], Tuple) || isa (val[1 ], NamedTuple)))
27342734 # wiggle, for example, may want to repeat the call to fill (-G). Then we expect a Tuple of -G's
@@ -2737,7 +2737,7 @@ function add_opt_fill(@nospecialize(val), cmd::String="", opt="")::String
27372737 elseif (isvector (val) && length (val) == 2 && isa (val[1 ], String))
27382738 # The above case works but may be uggly sometimes; e.g. fill=(("red+p",), ("blue+n",))
27392739 # So accept also a vector of strings and do not try to interpret its contents. Ex: fill(["red+p", "blue+n"]
2740- (opt != " " && ! startswith (opt, " -" )) && (opt = string (" -" , opt))
2740+ (opt != = " " && ! startswith (opt, " -" )) && (opt = string (" -" , opt))
27412741 cmd = cmd * opt * val[1 ]:: String * opt * val[2 ]:: String
27422742 elseif (isa (val, NamedTuple))
27432743 d2:: Dict = nt2dict (val)
0 commit comments