@@ -192,7 +192,7 @@ function parse_R(d::Dict, cmd::String; O::Bool=false, del::Bool=true, RIr::Bool=
192192 end
193193
194194 (O && opt_R == " " ) && (opt_R = " -R" )
195- if (! already_know && opt_R != " " && opt_R != " -R" && ! IamInset[ 1 ] && ! noGlobalR) # Save limits in numeric
195+ if (! already_know && opt_R != " " && opt_R != " -R" && ! IamInset. active && ! noGlobalR) # Save limits in numeric
196196 bak = IamModern[]
197197 try
198198 limits = opt_R2num (opt_R)
@@ -489,7 +489,7 @@ function parse_J(d::Dict, cmd::String; default::String="", map::Bool=true, O::Bo
489489 opt_J, mnemo = build_opt_J (val) # mnemo = true when the projection name used a mnemonic for the projection
490490 elseif (IamModern[] && ((val = is_in_dict (d, [:figscale :fig_scale :scale :figsize :fig_size ])) === nothing ))
491491 # Subplots do not rely in the classic default mechanism
492- (IamInset[ 1 ] && ! IamInset[ 2 ] && ! contains (cmd, " -J" )) && (cmd *= CTRL. pocket_J[1 ]:: String ) # Workaround GMT bug (#7005)
492+ (IamInset. active && ! IamInset. has_J && ! contains (cmd, " -J" )) && (cmd *= CTRL. pocket_J[1 ]:: String ) # Workaround GMT bug (#7005)
493493 return cmd, " "
494494 end
495495 if (CTRL. proj_linear[1 ]) # Otherwise (CTRL.proj_linear[1] == false), trust it
@@ -2835,16 +2835,16 @@ end
28352835Put VAL in the next empty slot in the pocket_call vector. So far only 2 slots
28362836"""
28372837function put_pocket_call (val)
2838- (CTRL . pocket_call[1 ] === nothing ) ? (CTRL . pocket_call[1 ] = val) : (CTRL . pocket_call[2 ] = val)
2838+ (pocket_call[][ 1 ] === nothing ) ? (pocket_call[][ 1 ] = val) : (pocket_call[] [2 ] = val)
28392839end
28402840"""
28412841 val get_pocket_call() -> Any
28422842
28432843Pop the contents of the first non-empty slot in the pocket_call vector stack
28442844"""
28452845function get_pocket_call ()
2846- val = CTRL . pocket_call[1 ] # Should error if val is nothing or are there concievable correct cases?
2847- CTRL . pocket_call[1 ] = CTRL . pocket_call[2 ]; CTRL . pocket_call[2 ] = nothing
2846+ val = pocket_call[] [1 ] # Should error if val is nothing or are there concievable correct cases?
2847+ pocket_call[][ 1 ] = pocket_call[][ 2 ]; pocket_call[] [2 ] = nothing
28482848 return val
28492849end
28502850
@@ -3235,9 +3235,9 @@ function helper3_axes(arg, primo::String, axe::String)::String
32353235 @warn (" Argument of the custom annotations must be an N-array or a NamedTuple" ); return " "
32363236 end
32373237
3238- temp:: String = " GMTjl_custom_" * primo * " _" * TMPDIR_USR[ 2 ] * TMPDIR_USR[ 3 ]
3238+ temp:: String = " GMTjl_custom_" * primo * " _" * TMPDIR_USR. username * TMPDIR_USR. pid_suffix
32393239 (axe != " " ) && (temp *= axe)
3240- fname = joinpath (TMPDIR_USR[ 1 ] , temp * " .txt" )
3240+ fname = joinpath (TMPDIR_USR. dir , temp * " .txt" )
32413241 fid = open (fname, " w" )
32423242 if (label != [" " ])
32433243 for k = 1 : n_annot
@@ -4111,7 +4111,7 @@ function dbg_print_cmd(d::Dict, cmd::Vector{String})
41114111
41124112 if (Vd >= 2 ) # Delete these first before reporting
41134113 delete! (d, [[:show ], [:leg , :legend , :l ], [:box_pos ], [:leg_pos ], [:figname ], [:name ], [:savefig ]])
4114- CTRL . pocket_call[3 ] = nothing # This is mostly for testing purposes, but potentially needed elsewhere.
4114+ pocket_call[] [3 ] = nothing # This is mostly for testing purposes, but potentially needed elsewhere.
41154115 CTRL. limits[1 : 12 ] = zeros (12 )
41164116 # Some times an automtic CPT has been generated by the Vd'ed cmd but when that happens MUST debug it
41174117 # CURRENT_CPT[] = GMTcpt() # Can't do this because it would f. plot(..., colorbar=true)
@@ -4182,12 +4182,12 @@ function showfig(d::Dict{Symbol, Any}, fname_ps::String, fname_ext::String, opt_
41824182 if (fname_ps != " " && isPluto) # A patch attempt to an undebugable Pluto thing
41834183 (K) && close_PS_file (fname_ps) # Close the PS file first
41844184 gmt (pscvt_cmd * fname_ps * " -Tg *" )
4185- out = TMPDIR_USR[ 1 ] * " /" * " GMTjl_" * TMPDIR_USR[ 2 ] * TMPDIR_USR[ 3 ] * " .png"
4185+ out = TMPDIR_USR. dir * " /" * " GMTjl_" * TMPDIR_USR. username * TMPDIR_USR. pid_suffix * " .png"
41864186 opt_T, fname_ps = " " , " "
41874187 end
41884188
41894189 # When we are in Jupyter or Pluto, the image may already be in a raster format by a previous call to 'gmt end'
4190- (isJupyter[] || isPluto) && (fname_ps = TMPDIR_USR[ 1 ] * " /" * " GMTjl_" * TMPDIR_USR[ 2 ] * TMPDIR_USR[ 3 ] * " ." * FMT[]; opt_T = " " )
4190+ (isJupyter[] || isPluto) && (fname_ps = TMPDIR_USR. dir * " /" * " GMTjl_" * TMPDIR_USR. username * TMPDIR_USR. pid_suffix * " ." * FMT[]; opt_T = " " )
41914191
41924192 if (opt_T != " " )
41934193 (K) && close_PS_file (fname_ps) # Close the PS file first
@@ -4215,7 +4215,7 @@ function showfig(d::Dict{Symbol, Any}, fname_ps::String, fname_ext::String, opt_
42154215 end
42164216 CTRL. limits .= 0.0 ; CTRL. figsize .= 0.0 ; CTRL. proj_linear[1 ] = true ; # Reset these for safety
42174217 CTRL. pocket_J[1 ], CTRL. pocket_J[2 ], CTRL. pocket_J[3 ], CTRL. pocket_J[4 ] = " " , " " , " " , " " ;
4218- CTRL. pocket_R[1 : 2 ] .= " " ; isJupyter[] = false ; CTRL . pocket_call .= nothing
4218+ CTRL. pocket_R[1 : 2 ] .= " " ; isJupyter[] = false ; pocket_call[] .= nothing
42194219 CURRENT_VIEW[] = " "
42204220 return retPluto ? WrapperPluto (out) : nothing # retPluto should make it all way down to base so that Plut displays it
42214221end
@@ -4453,9 +4453,9 @@ function finish_PS_module(d::Dict, cmd::Vector{String}, opt_extra::String, K::Bo
44534453
44544454 orig_J:: String = " " # To use in the case of a double Cartesian/Geog frame.
44554455 fi = 1
4456- if (CTRL . pocket_call[3 ] != = nothing ) # Case where we want to run a "pre command" whose data is in pocket_call[3]
4457- P = (isa (CTRL . pocket_call[3 ], String)) ? gmt (cmd[1 ]) : gmt (cmd[1 ], CTRL . pocket_call[3 ])
4458- CTRL . pocket_call[3 ] = nothing # Reset
4456+ if (pocket_call[] [3 ] != = nothing ) # Case where we want to run a "pre command" whose data is in pocket_call[3]
4457+ P = (isa (pocket_call[][ 3 ], String)) ? gmt (cmd[1 ]) : gmt (cmd[1 ], pocket_call[] [3 ])
4458+ pocket_call[] [3 ] = nothing # Reset
44594459 fi = 2 # First index, the one that the args... respect, start at 2
44604460 end
44614461
@@ -4482,23 +4482,23 @@ function finish_PS_module(d::Dict, cmd::Vector{String}, opt_extra::String, K::Bo
44824482 continue
44834483 elseif (k >= 1 + fi && ! first_was_psclip && (is_pscoast || is_basemap || is_plot) && (args1_is_I || args1_is_G || args1_is_D))
44844484 orig_J, orig_R = finish_PS_module_barr_2 (d, args[1 ], cmd, k, is_plot, orig_J)
4485- elseif (k >= 1 + fi && k2_no_pocket && ! is_psscale && ! is_pscoast && ! is_basemap && ! is_text && (CTRL . pocket_call[1 ] != = nothing ))
4485+ elseif (k >= 1 + fi && k2_no_pocket && ! is_psscale && ! is_pscoast && ! is_basemap && ! is_text && (pocket_call[] [1 ] != = nothing ))
44864486 # For nested calls that need to pass data
44874487 P = gmt (cmd[k], get_pocket_call ())
44884488 continue
44894489 elseif (startswith (cmd[k], " psclip" ) || is_text) # Pure (unique) psclip requires args. Compose cmd not
4490- P = (CTRL . pocket_call[1 ] != = nothing ) ? gmt (cmd[k], get_pocket_call ()) :
4490+ P = (pocket_call[] [1 ] != = nothing ) ? gmt (cmd[k], get_pocket_call ()) :
44914491 (length (cmd) > 1 ) ? gmt (cmd[k]) : gmt (cmd[k], args... )
44924492 continue
44934493 elseif (startswith (cmd[k], " inset" )) # Here we have an already made inset ps file waiting to be included
4494- finset = searchdir (TMPDIR_USR[ 1 ] , " GMTjl__inset__" )[1 ] # Even if there are more we only want the first
4495- add2PSfile (TMPDIR_USR[ 1 ] * " /" * finset, isfile= true ) # Add the partial inset ps in main ps file.
4496- rm (TMPDIR_USR[ 1 ] * " /" * finset) # Crutial to delete after use to not be picked in a eventual next round
4494+ finset = searchdir (TMPDIR_USR. dir , " GMTjl__inset__" )[1 ] # Even if there are more we only want the first
4495+ add2PSfile (TMPDIR_USR. dir * " /" * finset, isfile= true ) # Add the partial inset ps in main ps file.
4496+ rm (TMPDIR_USR. dir * " /" * finset) # Crutial to delete after use to not be picked in a eventual next round
44974497 continue
44984498 end
44994499 (k == 2 ) && (k2_no_pocket = true ) # For other k's this has to be neutral.
45004500 # Allow also plot data from a nested call to plot
4501- cond = ! (k > fi && is_plot && (CTRL . pocket_call[1 ] != = nothing ))
4501+ cond = ! (k > fi && is_plot && (pocket_call[] [1 ] != = nothing ))
45024502 # Next line means cases like 'plot(D, marker=:circ, ms="4p", lt=0.5, plot=(data=...))' where data in 'D'
45034503 # must be used twice before we pass to the next 'plot' (a nested call).
45044504 ! cond && is_plot && (k == fi + 1 ) && (k < n_cmds) && contains (cmd[k], " -S" ) && (cond = true )
@@ -4510,7 +4510,7 @@ function finish_PS_module(d::Dict, cmd::Vector{String}, opt_extra::String, K::Bo
45104510 IamModern[] && (orig_J = " " ) # setting orig_J to "" is a way of avoiding next line that is not for modern mode.
45114511 (orig_J != " " ) && (gmt (" psxy -T -J" * orig_J * " -R" * orig_R * " -O -K" * apenda * output); orig_J = " " )
45124512 end
4513- CTRL . pocket_call[1 ] = nothing ; CTRL . pocket_call[2 ] = nothing # For the case it was not yet empty
4513+ pocket_call[][ 1 ] = nothing ; pocket_call[] [2 ] = nothing # For the case it was not yet empty
45144514
45154515 finish_PS_module_barr_last (d, cmd, fname, fname_ext, opt_extra, output, opt_T, K, P) # returns P
45164516end
0 commit comments