comparison libinterp/corefcn/utils.cc @ 31110:670a0d878af1

eliminate WHO arguments from interpreter-private functions * interpreter-private.h, inpterpreter-private.cc (__get_interpreter__, __get_dynamic_loader__, __get_error_system__, __get_gh_manager__, __get_help_system__, __get_input_system__, __get_load_path__, __get_load_save_system__, __get_event_manager__, __get_output_system__, __get_type_info__, __get_symbol_table__, __get_current_scope__, __require_current_scope__, __get_evaluator__, __get_bp_table__, __get_child_list__, __get_cdef_manager__, __get_display_info__, __get_gtk_manager__): Eliminate WHO argument. Previously, it was never displayed by __get_interpreter__. And, as pointed out by Petter Tomner in patch #10216, passing a std::string object could have performance issues. (__get_interpreter__): Eliminate useless call to error. Display message to std::cerr then abort.
author John W. Eaton <jwe@octave.org>
date Wed, 22 Jun 2022 12:48:59 -0400
parents c9788d7f6e65
children
comparison
equal deleted inserted replaced
31109:90549b20fb28 31110:670a0d878af1
691 std::string nm = name; 691 std::string nm = name;
692 692
693 if (! suffix.empty ()) 693 if (! suffix.empty ())
694 nm.append (suffix); 694 nm.append (suffix);
695 695
696 load_path& lp = __get_load_path__ ("file_in_path"); 696 load_path& lp = __get_load_path__ ();
697 697
698 return sys::env::make_absolute (lp.find_file (nm)); 698 return sys::env::make_absolute (lp.find_file (nm));
699 } 699 }
700 700
701 std::string find_data_file_in_load_path (const std::string& fcn, 701 std::string find_data_file_in_load_path (const std::string& fcn,
715 bool local_file_ok 715 bool local_file_ok
716 = fs.exists () && (fs.is_reg () || ! require_regular_file); 716 = fs.exists () && (fs.is_reg () || ! require_regular_file);
717 717
718 if (! local_file_ok) 718 if (! local_file_ok)
719 { 719 {
720 load_path& lp = __get_load_path__ ("find_data_file_in_load_path"); 720 load_path& lp = __get_load_path__ ();
721 721
722 // Not directly found; search load path. 722 // Not directly found; search load path.
723 std::string tmp = sys::env::make_absolute (lp.find_file (fname)); 723 std::string tmp = sys::env::make_absolute (lp.find_file (fname));
724 724
725 if (! tmp.empty ()) 725 if (! tmp.empty ())
752 if (fs.exists () && ! fs.is_dir ()) 752 if (fs.exists () && ! fs.is_dir ())
753 retval = name; 753 retval = name;
754 } 754 }
755 else if (len > 2 && name[len - 2] == '.' && name[len - 1] == 'm') 755 else if (len > 2 && name[len - 2] == '.' && name[len - 1] == 'm')
756 { 756 {
757 load_path& lp = __get_load_path__ ("fcn_file_in_path"); 757 load_path& lp = __get_load_path__ ();
758 758
759 retval = lp.find_fcn_file (name.substr (0, len-2)); 759 retval = lp.find_fcn_file (name.substr (0, len-2));
760 } 760 }
761 else 761 else
762 { 762 {
763 std::string fname = name; 763 std::string fname = name;
764 std::size_t pos = name.find_first_of ('>'); 764 std::size_t pos = name.find_first_of ('>');
765 if (pos != std::string::npos) 765 if (pos != std::string::npos)
766 fname = name.substr (0, pos); 766 fname = name.substr (0, pos);
767 767
768 load_path& lp = __get_load_path__ ("fcn_file_in_path"); 768 load_path& lp = __get_load_path__ ();
769 769
770 retval = lp.find_fcn_file (fname); 770 retval = lp.find_fcn_file (fname);
771 } 771 }
772 } 772 }
773 773
781 { 781 {
782 std::string retval; 782 std::string retval;
783 783
784 if (! dir.empty ()) 784 if (! dir.empty ())
785 { 785 {
786 load_path& lp = __get_load_path__ ("contents_file_in_path"); 786 load_path& lp = __get_load_path__ ();
787 787
788 std::string tcontents 788 std::string tcontents
789 = sys::file_ops::concat (lp.find_dir (dir), "Contents.m"); 789 = sys::file_ops::concat (lp.find_dir (dir), "Contents.m");
790 790
791 sys::file_stat fs (tcontents); 791 sys::file_stat fs (tcontents);
1533 return; 1533 return;
1534 1534
1535 // Allow free access to graphics resources while the interpreter thread 1535 // Allow free access to graphics resources while the interpreter thread
1536 // is asleep 1536 // is asleep
1537 1537
1538 gh_manager& gh_mgr = __get_gh_manager__ ("sleep"); 1538 gh_manager& gh_mgr = __get_gh_manager__ ();
1539 1539
1540 if (do_graphics_events) 1540 if (do_graphics_events)
1541 gh_mgr.unlock (); 1541 gh_mgr.unlock ();
1542 1542
1543 if (math::isinf (seconds)) 1543 if (math::isinf (seconds))