comparison src/variables.cc @ 5930:a703198cb8b8

[project @ 2006-08-15 06:06:15 by jwe]
author jwe
date Tue, 15 Aug 2006 06:06:16 +0000
parents e6c29de3be38
children c9f0839c583f
comparison
equal deleted inserted replaced
5929:e6c29de3be38 5930:a703198cb8b8
704 #endif 704 #endif
705 705
706 return retval; 706 return retval;
707 } 707 }
708 708
709 static octave_value
710 do_isglobal (const octave_value_list& args)
711 {
712 octave_value retval = false;
713
714 int nargin = args.length ();
715
716 if (nargin != 1)
717 {
718 print_usage ();
719 return retval;
720 }
721
722 std::string name = args(0).string_value ();
723
724 if (error_state)
725 {
726 error ("isglobal: expecting std::string argument");
727 return retval;
728 }
729
730 symbol_record *sr = curr_sym_tab->lookup (name);
731
732 retval = (sr && sr->is_linked_to_global ());
733
734 return retval;
735 }
736
709 DEFUN (isglobal, args, , 737 DEFUN (isglobal, args, ,
710 "-*- texinfo -*-\n\ 738 "-*- texinfo -*-\n\
711 @deftypefn {Built-in Function} {} isglobal (@var{name})\n\ 739 @deftypefn {Built-in Function} {} isglobal (@var{name})\n\
712 Return 1 if @var{name} is globally visible. Otherwise, return 0. For\n\ 740 Return 1 if @var{name} is globally visible. Otherwise, return 0. For\n\
713 example,\n\ 741 example,\n\
719 @result{} 1\n\ 747 @result{} 1\n\
720 @end group\n\ 748 @end group\n\
721 @end example\n\ 749 @end example\n\
722 @end deftypefn") 750 @end deftypefn")
723 { 751 {
724 octave_value retval = false; 752 return do_isglobal (args);
725 753 }
726 int nargin = args.length (); 754
727 755 DEFUN (is_global, args, ,
728 if (nargin != 1) 756 "-*- texinfo -*-\n\
729 { 757 @deftypefn {Built-in Function} {} isglobal (@var{name})\n\
730 print_usage (); 758 This function has been deprecated. Use isglobal instead.\n\
731 return retval; 759 @end deftypefn")
732 } 760 {
733 761 return do_isglobal (args);
734 std::string name = args(0).string_value ();
735
736 if (error_state)
737 {
738 error ("isglobal: expecting std::string argument");
739 return retval;
740 }
741
742 symbol_record *sr = curr_sym_tab->lookup (name);
743
744 retval = (sr && sr->is_linked_to_global ());
745
746 return retval;
747 } 762 }
748 763
749 int 764 int
750 symbol_exist (const std::string& name, const std::string& type) 765 symbol_exist (const std::string& name, const std::string& type)
751 { 766 {