Mercurial > octave
diff src/defun.cc @ 3606:89f958b5358f
[project @ 2000-03-08 09:30:05 by jwe]
author | jwe |
---|---|
date | Wed, 08 Mar 2000 09:30:07 +0000 |
parents | b80bbb43a1a9 |
children | 7cb85d5c7aad |
line wrap: on
line diff
--- a/src/defun.cc Tue Mar 07 05:09:29 2000 +0000 +++ b/src/defun.cc Wed Mar 08 09:30:07 2000 +0000 @@ -27,7 +27,7 @@ #include <iostream> #include <string> -#include "defun-int.h" +#include "defun.h" #include "dynamic-ld.h" #include "error.h" #include "help.h" @@ -35,6 +35,7 @@ #include "ov-builtin.h" #include "ov-dld-fcn.h" #include "ov-mapper.h" +#include "oct-obj.h" #include "pager.h" #include "symtab.h" #include "variables.h" @@ -159,6 +160,47 @@ alias.c_str ()); } +#if 0 +// This is insufficient to really make it possible to define an alias +// for function. There are a number of subtle problems related to +// automatically reloading functions. +DEFUN (alias, args, , + "alias (alias, name)") +{ + octave_value retval; + + int nargin = args.length (); + + if (nargin == 2) + { + string alias = args(0).string_value (); + string name = args(1).string_value (); + + if (! error_state) + { + symbol_record *sr_name = lookup_by_name (name, false); + + if (sr_name && sr_name->is_function ()) + { + symbol_record *sr_alias = global_sym_tab->lookup (alias, true); + + if (sr_alias) + sr_alias->alias (sr_name); + else + error ("alias: unable to insert `%s' in symbol table", + alias.c_str ()); + } + else + error ("alias: function `%s' does not exist", name.c_str ()); + } + } + else + print_usage ("alias"); + + return retval; +} +#endif + /* ;;; Local Variables: *** ;;; mode: C++ ***