Mercurial > octave
diff libinterp/corefcn/variables.cc @ 23703:6eb5f6199a5a
move mlock, munlock, and mislocked to interpreter class
* interpreter.h, interpreter.cc (interperter::mlock,
interperter::munlock, interperter::mislocked): New functions.
* variables (mlock, munlock, mislocked): Deprecate. Forward to
interpreter methods. Change all uses.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 26 Jun 2017 18:38:40 -0400 |
parents | d396b5fd9199 |
children | c495549e9a94 |
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc Mon Jun 26 18:05:53 2017 -0400 +++ b/libinterp/corefcn/variables.cc Mon Jun 26 18:38:40 2017 -0400 @@ -1903,55 +1903,6 @@ return do_who (interp, argc, argv, nargout == 1, true); } -oid -mlock (void) -{ - octave::call_stack& cs = octave::__get_call_stack__ ("mlock"); - - octave_function *fcn = cs.current (); - - if (! fcn) - error ("mlock: invalid use outside a function"); - - fcn->lock (); -} - -void -munlock (const std::string& nm) -{ - octave::symbol_table& symtab = octave::__get_symbol_table__ ("munlock"); - - octave_value val = symtab.find_function (nm); - - if (val.is_defined ()) - { - octave_function *fcn = val.function_value (); - - if (fcn) - fcn->unlock (); - } -} - -bool -mislocked (const std::string& nm) -{ - bool retval = false; - - octave::symbol_table& symtab = octave::__get_symbol_table__ ("mislocked"); - - octave_value val = symtab.find_function (nm); - - if (val.is_defined ()) - { - octave_function *fcn = val.function_value (); - - if (fcn) - retval = fcn->islocked (); - } - - return retval; -} - DEFMETHOD (mlock, interp, args, , doc: /* -*- texinfo -*- @deftypefn {} {} mlock () @@ -1993,7 +1944,7 @@ { std::string name = args(0).xstring_value ("munlock: FCN must be a string"); - munlock (name); + interp.munlock (name); } else { @@ -2031,7 +1982,7 @@ { std::string name = args(0).xstring_value ("mislocked: FCN must be a string"); - retval = mislocked (name); + retval = interp.mislocked (name); } else { @@ -2674,6 +2625,30 @@ // The following functions are deprecated. void +mlock (void) +{ + octave::interpreter& interp = octave::__get_interpreter__ ("mlock"); + + interp.mlock (); +} + +void +munlock (const std::string& nm) +{ + octave::interpreter& interp = octave::__get_interpreter__ ("mlock"); + + return interp.munlock (nm); +} + +bool +mislocked (const std::string& nm) +{ + octave::interpreter& interp = octave::__get_interpreter__ ("mlock"); + + return interp.mislocked (nm); +} + +void bind_ans (const octave_value& val, bool print) { octave::tree_evaluator& tw = octave::__get_evaluator__ ("bind_ans");