Mercurial > hg > octave-thorsten
comparison src/input.cc @ 3707:58140935c812
[project @ 2000-07-28 09:40:52 by jwe]
author | jwe |
---|---|
date | Fri, 28 Jul 2000 09:40:54 +0000 |
parents | 4b1a93f83264 |
children | b65077dfa1b1 |
comparison
equal
deleted
inserted
replaced
3706:6581e686f83f | 3707:58140935c812 |
---|---|
502 read_as_string++; | 502 read_as_string++; |
503 | 503 |
504 std::string prompt ("debug> "); | 504 std::string prompt ("debug> "); |
505 | 505 |
506 if (nargin > 0) | 506 if (nargin > 0) |
507 { | 507 { |
508 prompt = args(0).string_value (); | 508 prompt = args(0).string_value (); |
509 | 509 |
510 if (error_state) | 510 if (error_state) |
511 { | 511 { |
512 error ("input: unrecognized argument"); | 512 error ("input: unrecognized argument"); |
513 return retval; | 513 return retval; |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 again: | 517 again: |
518 | 518 |
519 flush_octave_stdout (); | 519 flush_octave_stdout (); |
636 | 636 |
637 static void | 637 static void |
638 restore_command_history (void *) | 638 restore_command_history (void *) |
639 { | 639 { |
640 command_history::ignore_entries (! Vsaving_history); | 640 command_history::ignore_entries (! Vsaving_history); |
641 } | |
642 | |
643 octave_value | |
644 do_keyboard (const octave_value_list& args) | |
645 { | |
646 octave_value retval; | |
647 | |
648 int nargin = args.length (); | |
649 | |
650 assert (nargin == 0 || nargin == 1); | |
651 | |
652 unwind_protect::begin_frame ("do_keyboard"); | |
653 | |
654 // XXX FIXME XXX -- we shouldn't need both the | |
655 // command_history object and the | |
656 // Vsaving_history variable... | |
657 command_history::ignore_entries (false); | |
658 | |
659 unwind_protect::add (restore_command_history, 0); | |
660 | |
661 unwind_protect_bool (Vsaving_history); | |
662 | |
663 Vsaving_history = true; | |
664 | |
665 retval = get_user_input (args, true, 0); | |
666 | |
667 unwind_protect::run_frame ("do_keyboard"); | |
668 | |
669 return retval; | |
641 } | 670 } |
642 | 671 |
643 DEFUN (keyboard, args, , | 672 DEFUN (keyboard, args, , |
644 "-*- texinfo -*-\n\ | 673 "-*- texinfo -*-\n\ |
645 @deftypefn {Built-in Function} {} keyboard (@var{prompt})\n\ | 674 @deftypefn {Built-in Function} {} keyboard (@var{prompt})\n\ |
658 octave_value_list retval; | 687 octave_value_list retval; |
659 | 688 |
660 int nargin = args.length (); | 689 int nargin = args.length (); |
661 | 690 |
662 if (nargin == 0 || nargin == 1) | 691 if (nargin == 0 || nargin == 1) |
663 { | 692 do_keyboard (args); |
664 unwind_protect::begin_frame ("keyboard"); | |
665 | |
666 // XXX FIXME XXX -- we shouldn't need both the | |
667 // command_history object and the | |
668 // Vsaving_history variable... | |
669 command_history::ignore_entries (false); | |
670 | |
671 unwind_protect::add (restore_command_history, 0); | |
672 | |
673 unwind_protect_bool (Vsaving_history); | |
674 | |
675 Vsaving_history = true; | |
676 | |
677 retval = get_user_input (args, true, 0); | |
678 | |
679 unwind_protect::run_frame ("keyboard"); | |
680 } | |
681 else | 693 else |
682 print_usage ("keyboard"); | 694 print_usage ("keyboard"); |
683 | 695 |
684 return retval; | 696 return retval; |
685 } | 697 } |