comparison src/toplev.cc @ 2077:2d03b8eb891d

[project @ 1996-04-24 00:21:21 by jwe]
author jwe
date Wed, 24 Apr 1996 00:21:32 +0000
parents 18365b6332a8
children 4d43f960f2cc
comparison
equal deleted inserted replaced
2076:36800cb7fe04 2077:2d03b8eb891d
682 return retval; 682 return retval;
683 } 683 }
684 684
685 DEFALIAS (shell_cmd, system); 685 DEFALIAS (shell_cmd, system);
686 686
687 static SLStack<string> octave_atexit_functions;
688
689 void
690 do_octave_atexit (void)
691 {
692 while (! octave_atexit_functions.empty ())
693 {
694 Octave_object fcn = octave_atexit_functions.pop ();
695
696 feval (fcn, 0);
697 }
698 }
699
700 DEFUN(atexit, args, ,
701 "atexit (NAME): register NAME as a function to call when Octave exits\n\
702 \n\
703 Functions are called with no arguments in the reverse of the order in
704 which they were registered with atexit()")
705 {
706 Octave_object retval;
707
708 #if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT)
709 int nargin = args.length ();
710
711 if (nargin == 1)
712 {
713 string arg = args(0).string_value ();
714
715 if (! error_state)
716 octave_atexit_functions.push (arg);
717 else
718 error ("atexit: argument must be a string");
719 }
720 else
721 print_usage ("atexit");
722 #else
723 error ("atexit: not supported on this system");
724 #endif
725
726 return retval;
727 }
728
687 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE) 729 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE)
688 int debug_new_delete = 0; 730 int debug_new_delete = 0;
689 731
690 typedef void (*vfp)(void); 732 typedef void (*vfp)(void);
691 extern vfp __new_handler; 733 extern vfp __new_handler;