From 4d698389c727961f06f39f67ed408bfb0620de2f Mon Sep 17 00:00:00 2001 From: David Sagan Date: Sat, 27 Jul 2024 12:07:01 -0400 Subject: [PATCH] Fix Bmad parser to convert tab characters to blanks. (#1089) --- bmad/modules/mode3_mod.f90 | 6 +-- bmad/parsing/bmad_parser_mod.f90 | 6 ++- sim_utils/interfaces/sim_utils_interface.f90 | 5 ++ sim_utils/math/da2_mod.f90 | 2 +- sim_utils/math/fft_1d.f90 | 4 +- sim_utils/math/random_mod.f90 | 2 +- sim_utils/math/rotation_3d_mod.f90 | 2 +- sim_utils/math/spline_mod.f90 | 2 +- sim_utils/math/super_recipes_mod.f90 | 4 +- sim_utils/matrix/mat_eigen.f90 | 2 +- sim_utils/matrix/mat_symp_conj.f90 | 4 +- sim_utils/matrix/mat_symp_conj_i.f90 | 4 +- sim_utils/plot/quick_plot.f90 | 50 ++++++++++---------- sim_utils/string/detab.f90 | 27 +++++++++++ tao/code/tao_command.f90 | 34 ++++++------- tao/code/tao_help.f90 | 10 ++-- tao/code/tao_python_cmd.f90 | 11 +++-- tao/version/tao_version_mod.f90 | 2 +- 18 files changed, 108 insertions(+), 69 deletions(-) create mode 100644 sim_utils/string/detab.f90 diff --git a/bmad/modules/mode3_mod.f90 b/bmad/modules/mode3_mod.f90 index 89b7cd669d..8c5eddd1c7 100644 --- a/bmad/modules/mode3_mod.f90 +++ b/bmad/modules/mode3_mod.f90 @@ -477,7 +477,7 @@ subroutine eigen_decomp_6mat(mat, eval, evec, err_flag, tunes) CALL la_geev(A, eval_r, eval_i, VR=VR, INFO=i_error) eval = cmplx(eval_r, eval_i, rp) if ( i_error /= 0 ) THEN - call out_io (s_fatal$, r_name, "la_geev returned error: \i0\ ", i_error) + call out_io (s_error$, r_name, "la_geev returned error: \i0\ ", i_error) if (global_com%exit_on_error) call err_exit eval = 0.0d0 evec = 0.0d0 @@ -731,7 +731,7 @@ subroutine order_evecs_by_tune (evec, eval, mat_tunes, abz_tunes, err_flag) tz1 = count(abs(mat_tunes(1:3)) < 0.0001) tz2 = count(abs(abz(1:3)) < 0.0001) if (tz1 > 1 .or. tz1 /= tz2) then - call out_io (s_fatal$, r_name, "tunes is not fully populated.") + call out_io (s_error$, r_name, "tunes is not fully populated.") if (global_com%exit_on_error) call err_exit return endif @@ -753,7 +753,7 @@ subroutine order_evecs_by_tune (evec, eval, mat_tunes, abz_tunes, err_flag) val(6) = max(dtune(1,3), dtune(2,2), dtune(3,1)) if (minval(val, 1) > 0.1) then - call out_io (s_fatal$, r_name, "Unable to match input tunes with calculated tunes.", & + call out_io (s_error$, r_name, "Unable to match input tunes with calculated tunes.", & 'Input tunes: \3f14.5\ ', & 'Calculated tunes: \3f14.5\ ', r_array = [abz(1:3)/twopi, mat_tunes(1:3)/twopi]) return diff --git a/bmad/parsing/bmad_parser_mod.f90 b/bmad/parsing/bmad_parser_mod.f90 index c1f7c59124..7ce71fc1aa 100644 --- a/bmad/parsing/bmad_parser_mod.f90 +++ b/bmad/parsing/bmad_parser_mod.f90 @@ -2931,7 +2931,6 @@ recursive subroutine load_parse_line (action, ix_start, end_of_file, err_flag) character(*) action character(n_parse_line) :: line character(1) quote_mark, last_char -character(1), parameter :: tab = achar(9) logical :: end_of_file, flush_this, has_blank logical, optional :: err_flag @@ -2977,8 +2976,9 @@ recursive subroutine load_parse_line (action, ix_start, end_of_file, err_flag) ! With advance = 'no' an ios = 0 means that a full line has *not* been read. read (bp_com%current_file%f_unit, '(a)', iostat = bp_com%ios_next_chunk, & advance = 'no') bp_com%next_chunk + if (bp_com%ios_next_chunk == iostat_eor) then - ! Nothing to do + call detab(bp_com%next_chunk) else bp_com%next_chunk = '' endif @@ -3008,6 +3008,8 @@ recursive subroutine load_parse_line (action, ix_start, end_of_file, err_flag) elseif (bp_com%ios_next_chunk /= 0) then bp_com%next_chunk = '' endif + + call detab(bp_com%next_chunk) bp_com%current_file%i_line = bp_com%current_file%i_line + 1 endif diff --git a/sim_utils/interfaces/sim_utils_interface.f90 b/sim_utils/interfaces/sim_utils_interface.f90 index 2337c1b780..5dbbf4de78 100644 --- a/sim_utils/interfaces/sim_utils_interface.f90 +++ b/sim_utils/interfaces/sim_utils_interface.f90 @@ -134,6 +134,11 @@ subroutine date_and_time_stamp (string, numeric_month, include_zone) logical, optional :: numeric_month, include_zone end subroutine +subroutine detab(str) + implicit none + character(*) str +end subroutine + function determinant (mat) result (det) import implicit none diff --git a/sim_utils/math/da2_mod.f90 b/sim_utils/math/da2_mod.f90 index 22a28536cc..5b6b915d87 100644 --- a/sim_utils/math/da2_mod.f90 +++ b/sim_utils/math/da2_mod.f90 @@ -117,7 +117,7 @@ function da2_inverse(ta) result (ta_inv) n = ubound(ta, 1) if (ta(0,0) == 0) then - call out_io (s_fatal$, r_name, 'INVERSE OF TAYLOR SERIES WITH CONSTANT TERM ZERO IS NOT POSSIBLE') + call out_io (s_error$, r_name, 'INVERSE OF TAYLOR SERIES WITH CONSTANT TERM ZERO IS NOT POSSIBLE') if (global_com%exit_on_error) call err_exit return endif diff --git a/sim_utils/math/fft_1d.f90 b/sim_utils/math/fft_1d.f90 index 6a5b1e8fd7..8f23353dc2 100644 --- a/sim_utils/math/fft_1d.f90 +++ b/sim_utils/math/fft_1d.f90 @@ -16,7 +16,7 @@ subroutine fft_1d (arr, isign) -use output_mod, only: out_io, rp, global_com, s_fatal$, real_garbage$ +use output_mod, only: out_io, rp, global_com, s_error$, real_garbage$ use, intrinsic :: iso_c_binding implicit none @@ -35,7 +35,7 @@ subroutine fft_1d (arr, isign) case (-1) call dfftw_plan_dft_1d(plan, size(arr), arr, arr, FFTW_FORWARD, FFTW_ESTIMATE) case default - call out_io(s_fatal$, r_name, 'BAD ISIGN ARGUMENT.') + call out_io(s_error$, r_name, 'BAD ISIGN ARGUMENT.') if (global_com%exit_on_error) call err_exit arr = real_garbage$ return diff --git a/sim_utils/math/random_mod.f90 b/sim_utils/math/random_mod.f90 index 2e0623df56..26bd2262fb 100644 --- a/sim_utils/math/random_mod.f90 +++ b/sim_utils/math/random_mod.f90 @@ -736,7 +736,7 @@ subroutine super_sobseq (x, ran_state) end do if (j > sobseq_maxbit) then - call out_io (s_fatal$, r_name, 'SOBSEQ_MAXBIT TOO SMALL') + call out_io (s_error$, r_name, 'SOBSEQ_MAXBIT TOO SMALL') if (global_com%exit_on_error) call err_exit return endif diff --git a/sim_utils/math/rotation_3d_mod.f90 b/sim_utils/math/rotation_3d_mod.f90 index 2a01e06cc4..d8aa19739e 100644 --- a/sim_utils/math/rotation_3d_mod.f90 +++ b/sim_utils/math/rotation_3d_mod.f90 @@ -192,7 +192,7 @@ subroutine axis_angle_to_w_mat (axis, angle, w_mat) norm = norm2(axis) if (norm == 0) then w_mat = 0 - call out_io (s_fatal$, r_name, 'ZERO AXIS LENGTH WITH NON-ZERO ROTATION!') + call out_io (s_error$, r_name, 'ZERO AXIS LENGTH WITH NON-ZERO ROTATION!') if (global_com%exit_on_error) call err_exit return endif diff --git a/sim_utils/math/spline_mod.f90 b/sim_utils/math/spline_mod.f90 index 05005d5c0c..6cc0469de7 100644 --- a/sim_utils/math/spline_mod.f90 +++ b/sim_utils/math/spline_mod.f90 @@ -119,7 +119,7 @@ function create_a_spline (r0, r1, slope0, slope1) result (spline) dy = r1(2) - r0(2) if (dx == 0) then - call out_io (s_fatal$, r_name, 'X DISTANCE BETWEEN POINTS IS ZERO.') + call out_io (s_error$, r_name, 'X DISTANCE BETWEEN POINTS IS ZERO.') if (global_com%exit_on_error) call err_exit return endif diff --git a/sim_utils/math/super_recipes_mod.f90 b/sim_utils/math/super_recipes_mod.f90 index e37b8383ea..266bfc0b6a 100644 --- a/sim_utils/math/super_recipes_mod.f90 +++ b/sim_utils/math/super_recipes_mod.f90 @@ -854,7 +854,7 @@ end function func endif if ((fa > 0.0 .and. fb > 0.0) .or. (fa < 0.0 .and. fb < 0.0)) then - call out_io (s_fatal$, r_name, 'ROOT NOT BRACKETED!, \es12.4\ at \es12.4\ and \es12.4\ at \es12.4\ ', & + call out_io (s_error$, r_name, 'ROOT NOT BRACKETED!, \es12.4\ at \es12.4\ and \es12.4\ at \es12.4\ ', & r_array = [fa, a, fb, b]) x_zero = 1d100 status = -1 @@ -925,7 +925,7 @@ end function func fb = func(b, status); if (status /= 0) return end do -call out_io (s_fatal$, r_name, 'EXCEEDED MAXIMUM ITERATIONS!') +call out_io (s_error$, r_name, 'EXCEEDED MAXIMUM ITERATIONS!') status = -2 x_zero = b diff --git a/sim_utils/matrix/mat_eigen.f90 b/sim_utils/matrix/mat_eigen.f90 index 3341a7ac17..36e3fef373 100644 --- a/sim_utils/matrix/mat_eigen.f90 +++ b/sim_utils/matrix/mat_eigen.f90 @@ -66,7 +66,7 @@ subroutine mat_eigen (mat, eigen_val, eigen_vec, error, print_err) call la_geev(mat2, eval_r, eval_i, vr = vec, info = ier) error = (ier /= 0) if (error) then - if (logic_option(.true., print_err)) call out_io (s_fatal$, r_name, "la_geev returned error: \i0\ ", ier) + if (logic_option(.true., print_err)) call out_io (s_error$, r_name, "la_geev returned error: \i0\ ", ier) eigen_val = 0.0d0 eigen_vec = 0.0d0 return diff --git a/sim_utils/matrix/mat_symp_conj.f90 b/sim_utils/matrix/mat_symp_conj.f90 index 2b088984ac..98c45fa498 100644 --- a/sim_utils/matrix/mat_symp_conj.f90 +++ b/sim_utils/matrix/mat_symp_conj.f90 @@ -12,7 +12,7 @@ function mat_symp_conj(mat) result (mat_conj) -use output_mod, only: rp, out_io, s_fatal$, global_com +use output_mod, only: rp, out_io, s_error$, global_com implicit none @@ -29,7 +29,7 @@ function mat_symp_conj(mat) result (mat_conj) nn = size(mat, 1) if (mod(nn, 2) /= 0 .or. nn /= size(mat, 2)) then - call out_io (s_fatal$, r_name, 'ARRAY SIZE IS NOT EVEN!') + call out_io (s_error$, r_name, 'ARRAY SIZE IS NOT EVEN!') if (global_com%exit_on_error) call err_exit endif diff --git a/sim_utils/matrix/mat_symp_conj_i.f90 b/sim_utils/matrix/mat_symp_conj_i.f90 index fe1e87504c..61a338d261 100644 --- a/sim_utils/matrix/mat_symp_conj_i.f90 +++ b/sim_utils/matrix/mat_symp_conj_i.f90 @@ -12,7 +12,7 @@ function mat_symp_conj_i(mat) result (mat_conj) -use output_mod, only: rp, out_io, s_fatal$, global_com +use output_mod, only: rp, out_io, s_error$, global_com implicit none @@ -29,7 +29,7 @@ function mat_symp_conj_i(mat) result (mat_conj) nn = size(mat, 1) if (mod(nn, 2) /= 0 .or. nn /= size(mat, 2)) then - call out_io (s_fatal$, r_name, 'ARRAY SIZE IS NOT EVEN!') + call out_io (s_error$, r_name, 'ARRAY SIZE IS NOT EVEN!') if (global_com%exit_on_error) call err_exit endif diff --git a/sim_utils/plot/quick_plot.f90 b/sim_utils/plot/quick_plot.f90 index 424be7d65f..73ad47bcf9 100644 --- a/sim_utils/plot/quick_plot.f90 +++ b/sim_utils/plot/quick_plot.f90 @@ -334,7 +334,7 @@ subroutine qp_get_layout_attrib (who, x1, x2, y1, y2, units) character(*) who character(*), optional :: units -character(40) :: r_name = "qp_get_layout_attrib" +character(*), parameter :: r_name = "qp_get_layout_attrib" ! if (who == 'PAGE') then @@ -348,7 +348,7 @@ subroutine qp_get_layout_attrib (who, x1, x2, y1, y2, units) elseif (who == 'BORDER') then rect = qp_com%border else - call out_io (s_fatal$, r_name, 'BAD "WHO": ' // who) + call out_io (s_error$, r_name, 'BAD "WHO": ' // who) if (global_com%exit_on_error) call err_exit endif @@ -451,7 +451,7 @@ subroutine qp_save_state (buffer_basic) if (buffer_basic) call qp_save_state_basic if (ix_qp_com == size(qp_save_com)) then - call out_io (s_fatal$, r_name, 'TRYING TO SAVE TOO MANY STATES!') + call out_io (s_error$, r_name, 'TRYING TO SAVE TOO MANY STATES!') if (global_com%exit_on_error) call err_exit endif @@ -497,7 +497,7 @@ subroutine qp_restore_state if (qp_com%buffer) call qp_restore_state_basic() if (ix_qp_com == 0) then - call out_io (s_fatal$, r_name, 'NO STATE TO RESTORE!') + call out_io (s_error$, r_name, 'NO STATE TO RESTORE!') if (global_com%exit_on_error) call err_exit endif @@ -534,7 +534,7 @@ subroutine qp_pointer_to_axis (axis_str, axis_ptr) type (qp_axis_struct), pointer :: axis_ptr character(*) axis_str -character(20) :: r_name = 'qp_pointer_to_axis' +character(*), parameter :: r_name = 'qp_pointer_to_axis' ! @@ -551,7 +551,7 @@ subroutine qp_pointer_to_axis (axis_str, axis_ptr) elseif (axis_str == 'YY') then axis_ptr => qp_com%plot%yy else - call out_io (s_fatal$, r_name, 'INVALID AXIS: ' // axis_str) + call out_io (s_error$, r_name, 'INVALID AXIS: ' // axis_str) if (global_com%exit_on_error) call err_exit endif @@ -575,7 +575,7 @@ subroutine qp_use_axis (x, y) implicit none character(*), optional :: x, y -character(10) :: r_name = 'qp_use_axis' +character(*), parameter :: r_name = 'qp_use_axis' ! @@ -1119,7 +1119,7 @@ subroutine qp_calc_axis_scale (data_min, data_max, axis, niceness_score) case ('GENERAL', 'EXACT') ! Nothing to do case default - call out_io (s_fatal$, r_name, 'I DO NOT UNDERSTAND "AXIS%BOUNDS": ' // axis%bounds) + call out_io (s_error$, r_name, 'I DO NOT UNDERSTAND "AXIS%BOUNDS": ' // axis%bounds) if (global_com%exit_on_error) call err_exit end select @@ -2144,7 +2144,7 @@ subroutine qp_split_units_string (u_type, region, corner, units) character(*), optional :: units character(20) u character(8) dflt_units(3) -character(28) :: r_name = 'qp_split_units_string' +character(*), parameter :: r_name = 'qp_split_units_string' ! Default @@ -2179,7 +2179,7 @@ subroutine qp_split_units_string (u_type, region, corner, units) u_type = u(:ix) if (all(u_type /= ['DATA ', 'MM ', 'INCH ', 'POINTS', '% '])) then - call out_io (s_fatal$, r_name, 'BAD UNITS TYPE: "' // trim(units) // '"') + call out_io (s_error$, r_name, 'BAD UNITS TYPE: "' // trim(units) // '"') if (global_com%exit_on_error) call err_exit endif @@ -2190,7 +2190,7 @@ subroutine qp_split_units_string (u_type, region, corner, units) region = u(:ix) if (all(region /= ['PAGE ', 'BOX ', 'GRAPH'])) then - call out_io (s_fatal$, r_name, 'BAD REGION: "' // trim(units) // '"') + call out_io (s_error$, r_name, 'BAD REGION: "' // trim(units) // '"') if (global_com%exit_on_error) call err_exit endif @@ -2201,13 +2201,13 @@ subroutine qp_split_units_string (u_type, region, corner, units) corner = u(:ix) if (all(corner /= ['LB', 'LT', 'RB', 'RT'])) then - call out_io (s_fatal$, r_name, 'BAD CORNER: "' // trim(units) // '"') + call out_io (s_error$, r_name, 'BAD CORNER: "' // trim(units) // '"') if (global_com%exit_on_error) call err_exit endif call string_trim (u(ix+1:), u, ix) if (ix /= 0) then - call out_io (s_fatal$, r_name, 'EXTRA CHARACTERS IN UNITS: "' // trim(units) // '"') + call out_io (s_error$, r_name, 'EXTRA CHARACTERS IN UNITS: "' // trim(units) // '"') if (global_com%exit_on_error) call err_exit endif @@ -2485,7 +2485,7 @@ subroutine qp_draw_symbols (x, y, units, type, height, color, fill_pattern, line ! if (size(x) /= size(y)) then - call out_io (s_fatal$, r_name, 'X, Y COORD VECTORS HAVE UNEQUAL LENGTH!') + call out_io (s_error$, r_name, 'X, Y COORD VECTORS HAVE UNEQUAL LENGTH!') if (global_com%exit_on_error) call err_exit endif @@ -2568,12 +2568,12 @@ subroutine qp_draw_graph (x_dat, y_dat, x_lab, y_lab, title, draw_line, symbol_e ! Error check if (qp_com%plot%xx%max == qp_com%plot%xx%min) then - call out_io (s_fatal$, r_name, 'X_MAX = X_MIN') + call out_io (s_error$, r_name, 'X_MAX = X_MIN') if (global_com%exit_on_error) call err_exit endif if (qp_com%plot%yy%max == qp_com%plot%yy%min) then - call out_io (s_fatal$, r_name, 'Y_MAX = Y_MIN') + call out_io (s_error$, r_name, 'Y_MAX = Y_MIN') if (global_com%exit_on_error) call err_exit endif @@ -2764,12 +2764,12 @@ subroutine qp_draw_histogram (x_dat, y_dat, fill_color, fill_pattern, line_color ! error check if (qp_com%plot%xx%max == qp_com%plot%xx%min) then - call out_io (s_fatal$, r_name, 'X_MAX = X_MIN') + call out_io (s_error$, r_name, 'X_MAX = X_MIN') if (global_com%exit_on_error) call err_exit endif if (qp_com%plot%yy%max == qp_com%plot%yy%min) then - call out_io (s_fatal$, r_name, 'Y_MAX = Y_MIN') + call out_io (s_error$, r_name, 'Y_MAX = Y_MIN') if (global_com%exit_on_error) call err_exit endif @@ -3584,7 +3584,7 @@ subroutine qp_draw_text_no_set (text, x, y, units, justify, angle) x1 = x1 - dx y1 = y1 - dy elseif (justify(2:2) /= 'B') then - call out_io (s_fatal$, r_name, 'UNKNOWN "JUSTIFY": ' // justify) + call out_io (s_error$, r_name, 'UNKNOWN "JUSTIFY": ' // justify) if (global_com%exit_on_error) call err_exit endif endif @@ -3644,7 +3644,7 @@ function qp_justify (justify) result (horiz_justy) elseif (justify(1:1) == 'R') then horiz_justy = 1.0 elseif (justify(1:1) /= 'L') then - call out_io (s_fatal$, r_name, 'BAD "JUSTIFY": ' // justify) + call out_io (s_error$, r_name, 'BAD "JUSTIFY": ' // justify) if (global_com%exit_on_error) call err_exit endif endif @@ -3940,7 +3940,7 @@ subroutine qp_set_line (who, line) elseif (who == 'LEGEND') then qp_com%legend_line = line else - call out_io (s_fatal$, r_name, 'UNKNOWN LINE "WHO": ' // who) + call out_io (s_error$, r_name, 'UNKNOWN LINE "WHO": ' // who) if (global_com%exit_on_error) call err_exit endif @@ -3993,7 +3993,7 @@ subroutine qp_get_line_attrib (style, line) elseif (style == 'LEGEND') then line = qp_com%legend_line else - call out_io (s_fatal$, r_name, 'UNKNOWN LINE "STYLE": ' // style) + call out_io (s_error$, r_name, 'UNKNOWN LINE "STYLE": ' // style) if (global_com%exit_on_error) call err_exit endif @@ -4051,7 +4051,7 @@ subroutine qp_set_line_attrib (style, width, color, pattern, clip) elseif (style == 'LEGEND') then this => qp_com%legend_line else - call out_io (s_fatal$, r_name, 'UNKNOWN LINE "STYLE": ' // style) + call out_io (s_error$, r_name, 'UNKNOWN LINE "STYLE": ' // style) if (global_com%exit_on_error) call err_exit endif @@ -4194,7 +4194,7 @@ subroutine qp_get_text_attrib (who, height, color, background, & elseif (who == "AXIS_LABEL") then call qp_get_this_text_attrib (qp_com%axis_label) else - call out_io (s_fatal$, r_name, 'BAD "WHO": "' // trim(who) // '"' ) + call out_io (s_error$, r_name, 'BAD "WHO": "' // trim(who) // '"' ) if (global_com%exit_on_error) call err_exit endif @@ -4288,7 +4288,7 @@ subroutine qp_set_text_attrib (who, height, color, background, & elseif (who == "AXIS_LABEL") then call qp_set_this_text_attrib (qp_com%axis_label) else - call out_io (s_fatal$, r_name, 'BAD "WHO": "' // trim(who) // '"' ) + call out_io (s_error$, r_name, 'BAD "WHO": "' // trim(who) // '"' ) if (global_com%exit_on_error) call err_exit endif diff --git a/sim_utils/string/detab.f90 b/sim_utils/string/detab.f90 new file mode 100644 index 0000000000..e932fdd42f --- /dev/null +++ b/sim_utils/string/detab.f90 @@ -0,0 +1,27 @@ +!+ +! Subroutine detab(str) +! +! Routine to replace tab characters with a single blank spaces. +! +! Input: +! str -- character(*): String with possible tabs. +! +! Output: +! str -- character(*): String with blank spaces substituted. +!- + +subroutine detab(str) + +implicit none + +character(*) str +character(1), parameter :: tab = achar(9) +integer i + +! + +do i = 1, len(str) + if (str(i:i) == tab) str(i:i) = ' ' +enddo + +end subroutine diff --git a/tao/code/tao_command.f90 b/tao/code/tao_command.f90 index 113f3aee6f..ca2b377980 100644 --- a/tao/code/tao_command.f90 +++ b/tao/code/tao_command.f90 @@ -47,9 +47,9 @@ subroutine tao_command (command_line, err_flag, err_is_fatal) character(40) gang_str, switch, word, except, branch_str, what character(16) cmd_name, set_word, axis_name -character(16) :: cmd_names(43) = [character(16):: & +character(16) :: cmd_names(44) = [character(16):: & 'alias', 'call', 'change', 'clear', 'clip', 'continue', 'create', 'cut_ring', 'derivative', & - 'end_file', 'exit', 'flatten', 'help', 'json', 'ls', 'misalign', 'pause', 'place', & + 'end_file', 'exit', 'flatten', 'help', 'json', 'ls', 'misalign', 'pause', 'pipe', 'place', & 'plot', 'ptc', 'python', 'quit', 're_execute', 'read', 'reinitialize', 'reset', & 'restore', 'run_optimizer', 'scale', 'set', 'show', 'single_mode', 'spawn', 'taper', & 'timer', 'use', 'veto', 'view', 'wave', 'write', 'x_axis', 'x_scale', 'xy_scale'] @@ -266,7 +266,7 @@ subroutine tao_command (command_line, err_flag, err_is_fatal) integer, dimension(4) :: id integer :: jd,nd,ns character(:), allocatable :: ds - character((len_trim(cmd_word(3))*11)/7+21+len_trim(cmd_word(2))) :: py_cmd + character((len_trim(cmd_word(3))*11)/7+21+len_trim(cmd_word(2))) :: pipe_cmd type (tao_d2_data_array_struct), dimension(:), allocatable :: d2_array ! Check if the data exists @@ -293,28 +293,28 @@ subroutine tao_command (command_line, err_flag, err_is_fatal) end do if (id(2).eq.0.or.id(2).ne.id(3).or.id(3).ne.id(4)) go to 70000 nd = id(2) - ! Start constructing the python command - write(py_cmd,'(a,i0)') 'data_d2_create '//trim(cmd_word(2))//'^^', nd + ! Start constructing the pipe command + write(pipe_cmd,'(a,i0)') 'data_d2_create '//trim(cmd_word(2))//'^^', nd ! Parse the arrays id(1)=1 jd = 1 do jd=1,nd id(2) = index(ds(id(1):),'[') + id(1) - 1 if (id(2).le.id(1).or.id(2).eq.ns) go to 70000 - py_cmd = trim(py_cmd)//'^^'//trim(adjustl(ds(id(1):id(2)-1))) + pipe_cmd = trim(pipe_cmd)//'^^'//trim(adjustl(ds(id(1):id(2)-1))) id(3) = scan(ds(id(2)+1:),':') + id(2) if (id(3).le.id(2)+1.or.id(3).eq.ns) go to 70000 if (.not.is_integer(ds(id(2)+1:id(3)-1))) go to 70000 - py_cmd = trim(py_cmd)//'^^'//trim(adjustl(ds(id(2)+1:id(3)-1))) + pipe_cmd = trim(pipe_cmd)//'^^'//trim(adjustl(ds(id(2)+1:id(3)-1))) id(4) = scan(ds(id(3)+1:),']') + id(3) if (id(4).le.id(3)+1) go to 70000 if (.not.is_integer(ds(id(3)+1:id(4)-1))) go to 70000 - py_cmd = trim(py_cmd)//'^^'//trim(adjustl(ds(id(3)+1:id(4)-1))) + pipe_cmd = trim(pipe_cmd)//'^^'//trim(adjustl(ds(id(3)+1:id(4)-1))) if (id(4).eq.ns) exit if (ds(id(4)+1:id(4)+1).ne.' ') go to 70000 id(1) = verify(ds(id(4)+1:),' ') + id(4) end do - call tao_python_cmd(py_cmd) + call tao_python_cmd(pipe_cmd) end block return 70000 call out_io(s_error$, r_name, 'Correct form is "create data d2_name x[i:j] ..."') @@ -461,6 +461,14 @@ subroutine tao_command (command_line, err_flag, err_is_fatal) call tao_pause_cmd (time) return +!-------------------------------- +! PIPE / PYTHON + +case ('pipe', 'python') + + call tao_python_cmd (cmd_line) + return + !-------------------------------- ! PLACE @@ -498,14 +506,6 @@ subroutine tao_command (command_line, err_flag, err_is_fatal) call tao_ptc_cmd (cmd_word(1), cmd_word(2)) return -!-------------------------------- -! PYTHON - -case ('python') - - call tao_python_cmd (cmd_line) - return - !-------------------------------- ! RE_EXECUTE diff --git a/tao/code/tao_help.f90 b/tao/code/tao_help.f90 index 7ccc018795..2eecd3a10a 100644 --- a/tao/code/tao_help.f90 +++ b/tao/code/tao_help.f90 @@ -30,7 +30,7 @@ subroutine tao_help (what1, what2, lines, n_lines) character(200) line, file_name, full_file_name character(*), optional, allocatable :: lines(:) -logical blank_line_before, in_example, has_subbed, python_search +logical blank_line_before, in_example, has_subbed, pipe_search ! This help system depends upon parsing one of three files: ! tao/doc/single-mode.tex @@ -42,11 +42,11 @@ subroutine tao_help (what1, what2, lines, n_lines) ! Help depends upon if we are in single mode or not. ! Determine what file to open and starting tag. -python_search = .false. +pipe_search = .false. if (index('python', trim(what1)) == 1 .and. what2 /= '') then file_name = '$TAO_DIR/code/tao_python_cmd.f90' - python_search = .true. + pipe_search = .true. elseif (s%com%single_mode) then file_name = '$TAO_DIR/doc/single-mode.tex' else @@ -55,7 +55,7 @@ subroutine tao_help (what1, what2, lines, n_lines) call fullfilename (file_name, full_file_name) -if (python_search) then +if (pipe_search) then start_tag = '!%% ' // what2 elseif (what1 == '' .or. what1 == 'help-list') then start_tag = '%% command_table' @@ -77,7 +77,7 @@ subroutine tao_help (what1, what2, lines, n_lines) ! Python search -if (python_search) then +if (pipe_search) then n = len_trim(start_tag) ! Find start of desired comment block do diff --git a/tao/code/tao_python_cmd.f90 b/tao/code/tao_python_cmd.f90 index 820d9df0f9..c3280be9d9 100644 --- a/tao/code/tao_python_cmd.f90 +++ b/tao/code/tao_python_cmd.f90 @@ -9213,7 +9213,7 @@ subroutine this_floor_plan2 (graph, ele, ashape, label_name, y1, y2) type (ele_struct), pointer :: ele1, ele2 type (floor_position_struct) floor, floor1, floor2 -real(rp) y1, y2 +real(rp) y1, y2, off1, off2 integer line_width character(40) color, label_name, shape_shape @@ -9233,26 +9233,31 @@ subroutine this_floor_plan2 (graph, ele, ashape, label_name, y1, y2) line_width = ashape%line_width endif +off1 = y1 * s%plot_page%floor_plan_shape_scale +off2 = y2 * s%plot_page%floor_plan_shape_scale + floor%r = [0.0_rp, 0.0_rp, 0.0_rp] floor1 = coords_local_curvilinear_to_floor (floor, ele, .true.) floor%r = [0.0_rp, 0.0_rp, ele%value(l$)] floor2 = coords_local_curvilinear_to_floor (floor, ele, .true.) + call tao_floor_to_screen_coords (graph, floor1, end1) call tao_floor_to_screen_coords (graph, floor2, end2) + if (ele%key == sbend$) then nl=incr(nl); write (li(nl), '(2(i0, a), 2a, 6(es14.7, a), (i0, a), 2a, 2(es10.2, a), 4a, 4(es14.7, a))') & ele%ix_branch, ';', ele%ix_ele, ';', & trim(key_name(ele%key)), ';', end1%r(1), ';', end1%r(2), ';', end1%theta, ';', & end2%r(1), ';', end2%r(2), ';', end2%theta, ';', & - line_width, ';', trim(shape_shape), ';', y1, ';', y2, ';', trim(color), ';', trim(label_name), ';', & + line_width, ';', trim(shape_shape), ';', off1, ';', off2, ';', trim(color), ';', trim(label_name), ';', & ele%value(l$), ';', ele%value(angle$), ';', ele%value(e1$), ';', ele%value(e2$) else nl=incr(nl); write (li(nl), '(2(i0, a), 2a, 6(es14.7, a), (i0, a), 2a, 2(es10.2, a), 4a)') & ele%ix_branch, ';', ele%ix_ele, ';', & trim(key_name(ele%key)), ';', end1%r(1), ';', end1%r(2), ';', end1%theta, ';', & end2%r(1), ';', end2%r(2), ';', end2%theta, ';', & - line_width, ';', trim(shape_shape), ';', y1, ';', y2, ';', trim(color), ';', trim(label_name) + line_width, ';', trim(shape_shape), ';', off1, ';', off2, ';', trim(color), ';', trim(label_name) endif end subroutine this_floor_plan2 diff --git a/tao/version/tao_version_mod.f90 b/tao/version/tao_version_mod.f90 index 5c1a3a9347..77fbf8b33b 100644 --- a/tao/version/tao_version_mod.f90 +++ b/tao/version/tao_version_mod.f90 @@ -6,5 +6,5 @@ !- module tao_version_mod -character(*), parameter :: tao_version_date = "2024/07/24 20:44:28" +character(*), parameter :: tao_version_date = "2024/07/26 21:59:14" end module