Mercurial > hg > octave-lojdl
changeset 2100:49cdc5b183bc
[project @ 1996-04-28 11:26:32 by jwe]
author | jwe |
---|---|
date | Sun, 28 Apr 1996 11:29:34 +0000 |
parents | dcf899227c24 |
children | c64b49a4cba3 |
files | src/pager.cc src/user-prefs.cc src/user-prefs.h |
diffstat | 3 files changed, 78 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pager.cc +++ b/src/pager.cc @@ -38,6 +38,7 @@ #include "oct-obj.h" #include "pager.h" #include "sighandlers.h" +#include "unwind-prot.h" #include "user-prefs.h" pid_t octave_pager_pid = -1; @@ -56,6 +57,8 @@ static sig_handler *saved_sigint_handler = 0; +static int really_flush_to_pager = 0; + static void do_sync (const char *msg) { @@ -108,15 +111,20 @@ int octave_pager_buf::sync (void) { - sputc ('\0'); - - char *buf = eback (); + if (really_flush_to_pager + || (user_pref.page_screen_output && user_pref.page_output_immediately) + || ! user_pref.page_screen_output) + { + sputc ('\0'); - do_sync (buf); + char *buf = eback (); + + do_sync (buf); - octave_diary << buf; + octave_diary << buf; - seekoff (0, ios::beg); + seekoff (0, ios::beg); + } return 0; } @@ -185,6 +193,12 @@ void flush_octave_stdout (void) { + begin_unwind_frame ("flush_octave_stdout"); + + unwind_protect_int (really_flush_to_pager); + + really_flush_to_pager = 1; + octave_stdout.flush (); if (external_pager) @@ -200,6 +214,8 @@ saved_sigint_handler = 0; } } + + run_unwind_frame ("flush_octave_stdout"); } static void @@ -344,6 +360,9 @@ DEFVAR (PAGER, default_pager (), 0, sv_pager_binary, "path to pager binary"); + DEFVAR (page_output_immediately, 1.0, 0, page_output_immediately, + "if possible, send output intended for the screen through the pager"); + DEFVAR (page_screen_output, 1.0, 0, page_screen_output, "if possible, send output intended for the screen through the pager"); }
--- a/src/user-prefs.cc +++ b/src/user-prefs.cc @@ -61,6 +61,7 @@ user_pref.ok_to_lose_imaginary_part = 0; user_pref.output_max_field_width = 0; user_pref.output_precision = 0; + user_pref.page_output_immediately = 0; user_pref.page_screen_output = 0; user_pref.prefer_column_vectors = 0; user_pref.prefer_zero_one_indexing = 0; @@ -170,8 +171,8 @@ int define_all_return_values (void) { - user_pref.define_all_return_values = - check_preference ("define_all_return_values"); + user_pref.define_all_return_values + = check_preference ("define_all_return_values"); return 0; } @@ -186,8 +187,7 @@ int do_fortran_indexing (void) { - user_pref.do_fortran_indexing = - check_preference ("do_fortran_indexing"); + user_pref.do_fortran_indexing = check_preference ("do_fortran_indexing"); liboctave_dfi_flag = user_pref.do_fortran_indexing; @@ -206,8 +206,8 @@ int echo_executing_commands (void) { - user_pref.echo_executing_commands = - check_preference ("echo_executing_commands"); + user_pref.echo_executing_commands + = check_preference ("echo_executing_commands"); return 0; } @@ -219,8 +219,8 @@ int empty_list_elements_ok (void) { - user_pref.empty_list_elements_ok = - check_preference ("empty_list_elements_ok"); + user_pref.empty_list_elements_ok + = check_preference ("empty_list_elements_ok"); return 0; } @@ -231,8 +231,8 @@ int gnuplot_has_multiplot (void) { - user_pref.gnuplot_has_multiplot = - check_preference ("gnuplot_has_multiplot"); + user_pref.gnuplot_has_multiplot + = check_preference ("gnuplot_has_multiplot"); return 0; } @@ -294,8 +294,8 @@ int implicit_str_to_num_ok (void) { - user_pref.implicit_str_to_num_ok = - check_preference ("implicit_str_to_num_ok"); + user_pref.implicit_str_to_num_ok + = check_preference ("implicit_str_to_num_ok"); return 0; } @@ -307,8 +307,21 @@ int ok_to_lose_imaginary_part (void) { - user_pref.ok_to_lose_imaginary_part = - check_preference ("ok_to_lose_imaginary_part"); + user_pref.ok_to_lose_imaginary_part + = check_preference ("ok_to_lose_imaginary_part"); + + return 0; +} + + +// If output is going to the pager, should we send it as soon as it is +// available, or wait until we are ready to prompt for input? + +int +page_output_immediately (void) +{ + user_pref.page_output_immediately + = check_preference ("page_output_immediately"); return 0; } @@ -336,8 +349,8 @@ int prefer_column_vectors (void) { - user_pref.prefer_column_vectors = - check_preference ("prefer_column_vectors"); + user_pref.prefer_column_vectors + = check_preference ("prefer_column_vectors"); liboctave_pcv_flag = user_pref.prefer_column_vectors; @@ -354,8 +367,8 @@ int prefer_zero_one_indexing (void) { - user_pref.prefer_zero_one_indexing = - check_preference ("prefer_zero_one_indexing"); + user_pref.prefer_zero_one_indexing + = check_preference ("prefer_zero_one_indexing"); liboctave_pzo_flag = user_pref.prefer_zero_one_indexing; @@ -374,8 +387,7 @@ int print_answer_id_name (void) { - user_pref.print_answer_id_name = - check_preference ("print_answer_id_name"); + user_pref.print_answer_id_name = check_preference ("print_answer_id_name"); return 0; } @@ -386,8 +398,8 @@ int print_empty_dimensions (void) { - user_pref.print_empty_dimensions = - check_preference ("print_empty_dimensions"); + user_pref.print_empty_dimensions + = check_preference ("print_empty_dimensions"); return 0; } @@ -399,8 +411,8 @@ int propagate_empty_matrices (void) { - user_pref.propagate_empty_matrices = - check_preference ("propagate_empty_matrices"); + user_pref.propagate_empty_matrices + = check_preference ("propagate_empty_matrices"); return 0; } @@ -421,8 +433,8 @@ int resize_on_range_error (void) { - user_pref.resize_on_range_error = - check_preference ("resize_on_range_error"); + user_pref.resize_on_range_error + = check_preference ("resize_on_range_error"); liboctave_rre_flag = user_pref.resize_on_range_error; @@ -436,8 +448,8 @@ int return_last_computed_value (void) { - user_pref.return_last_computed_value = - check_preference ("return_last_computed_value"); + user_pref.return_last_computed_value + = check_preference ("return_last_computed_value"); return 0; } @@ -459,8 +471,7 @@ int silent_functions (void) { - user_pref.silent_functions = - check_preference ("silent_functions"); + user_pref.silent_functions = check_preference ("silent_functions"); return 0; } @@ -520,8 +531,8 @@ int treat_neg_dim_as_zero (void) { - user_pref.treat_neg_dim_as_zero = - check_preference ("treat_neg_dim_as_zero"); + user_pref.treat_neg_dim_as_zero + = check_preference ("treat_neg_dim_as_zero"); return 0; } @@ -538,8 +549,8 @@ int warn_assign_as_truth_value (void) { - user_pref.warn_assign_as_truth_value = - check_preference ("warn_assign_as_truth_value"); + user_pref.warn_assign_as_truth_value + = check_preference ("warn_assign_as_truth_value"); return 0; } @@ -552,8 +563,8 @@ int warn_comma_in_global_decl (void) { - user_pref.warn_comma_in_global_decl = - check_preference ("warn_comma_in_global_decl"); + user_pref.warn_comma_in_global_decl + = check_preference ("warn_comma_in_global_decl"); return 0; } @@ -575,8 +586,8 @@ int warn_function_name_clash (void) { - user_pref.warn_function_name_clash = - check_preference ("warn_function_name_clash"); + user_pref.warn_function_name_clash + = check_preference ("warn_function_name_clash"); return 0; } @@ -589,8 +600,8 @@ int warn_missing_semicolon (void) { - user_pref.warn_missing_semicolon = - check_preference ("warn_missing_semicolon"); + user_pref.warn_missing_semicolon + = check_preference ("warn_missing_semicolon"); return 0; }
--- a/src/user-prefs.h +++ b/src/user-prefs.h @@ -40,6 +40,7 @@ int ok_to_lose_imaginary_part; int output_max_field_width; int output_precision; + int page_output_immediately; int page_screen_output; int prefer_column_vectors; int prefer_zero_one_indexing; @@ -96,6 +97,7 @@ extern int ignore_function_time_stamp (void); extern int implicit_str_to_num_ok (void); extern int ok_to_lose_imaginary_part (void); +extern int page_output_immediately (void); extern int page_screen_output (void); extern int prefer_column_vectors (void); extern int prefer_zero_one_indexing (void);