annotate liboctave/util/glob-match.cc @ 16570:d5ae5aa80d42

preserve pending command line input when running commands from GUI actions * QTerminal.h, QTerminal.cc (QTerminal::relay_command): Delete. * file-editor-tab.cc (file_editor_tab::run_file_callback): New argument, bp_info. Save pending command line input and execute command. (file_editor_tab::run_file): Use octave_link to execute file. * main-window.h, main-window.cc (main_window::execute_command_in_terminal): Rename from main_window::handle_command_double_clicked. Post event through octave_link to execute command. (main_window::construct_octave_qt_link): Connect _octave_qt_link::execute_command_in_terminal_signal to main_window::execute_command_in_terminal. (main_window::execute_command_callback): New function. (main_window::relay_command_signal): Delete signal. Remove all uses. * octave-qt-link.h, octave-qt-link.cc (octave_qt_link::do_execute_command_in_terminal): New function. (octave_qt_link::execute_command_in_terminal_signal): New signal. * terminal-dock-widget.h, terminal-dock-widget.cc (terminal_dock_widget::relay_command_signal): Delete signal. Remove all uses. * octave-link.h (octave_link::execute_command_in_terminal, octave_link::do_execute_command_in_terminal): New functions. * cmd-edit.h, cmd-edit.cc (command_editor::pre_input_hook_set): New variable. (gnu_readline::previous_pre_input_hook, command_editor::intial_input): New member variables. (command_editor::restore_pre_input_hook, command_editor::do_get_current_line, command_editor::do_replace_line, command_editor::set_pre_input_hook, gnu_readline::do_get_current_line, gnu_readline::do_replace_line, gnu_readline::set_pre_input_hook, command_editor::set_initial_input, gnu_readline::restore_pre_input_hook, default_command_editor::do_get_current_line, default_command_editor::do_replace_line, command_editor::insert_initial_input, command_editor::pre_input_handler, command_editor::get_current_line, command_editor::replace_line, command_editor::add_pre_input_hook, command_editor::do_insert_initial_input, command_editor::set_pre_input_hook, command_editor::restore_pre_input_hook): New functions. (command_editor::readline): Handle initial input. (command_editor::interrupt): Give argument a default value. * oct-rl-edit.h, oct-rl-edit.c (octave_rl_copy_line, octave_rl_replace_line, octave_rl_set_pre_input_hook, octave_rl_get_pre_input_hook): New functions. (rl_pre_input_hook_fcn_ptr): New typedef.
author John W. Eaton <jwe@octave.org>
date Thu, 25 Apr 2013 17:57:55 -0400
parents 648dabbb4c6b
children d63878346099
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
1 /*
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
3 Copyright (C) 1996-2012 John W. Eaton
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
4
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
6
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
10 option) any later version.
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
11
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
15 for more details.
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
16
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
19 <http://www.gnu.org/licenses/>.
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
20
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
21 */
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
22
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
24 #include <config.h>
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
25 #endif
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
26
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
27 #include <fnmatch.h>
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
28
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2924
diff changeset
29 #include "glob-match.h"
10148
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
30 #include "oct-glob.h"
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
31
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
32 bool
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
33 glob_match::match (const std::string& str) const
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
34 {
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
35 return octave_fnmatch (pat, str, fnmatch_flags);
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
36 }
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
37
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
38 string_vector
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
39 glob_match::glob (void) const
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
40 {
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
41 return octave_glob (pat);
deba43069023 don't install oct-glob.h
John W. Eaton <jwe@octave.org>
parents: 10138
diff changeset
42 }
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
43
10138
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
44 int
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
45 glob_match::opts_to_fnmatch_flags (unsigned int xopts) const
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
46 {
10138
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
47 int retval = 0;
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
48
10138
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
49 if (xopts & pathname)
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
50 retval |= FNM_PATHNAME;
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
51
10138
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
52 if (xopts & noescape)
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
53 retval |= FNM_NOESCAPE;
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
54
10138
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
55 if (xopts & period)
805a83ecd3da avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents: 9994
diff changeset
56 retval |= FNM_PERIOD;
2924
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
57
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
58 return retval;
50edcdd3ec22 [project @ 1997-05-03 20:21:03 by jwe]
jwe
parents:
diff changeset
59 }