function varargout = eval(tryVal,catchVal)
%EVAL for opaque strings.

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.1 $ $Date: 2000/06/20 21:00:24 $

tryVal = fromOpaque(tryVal);

if nargin==2,
  catchVal = fromOpaque(catchVal);
  if nargout>0,
    varargout{1:nargout} = eval(tryVal,'eval(catchVal,''error(lasterr)'')');
  else
    eval(tryVal,'eval(catchVal,''error(lasterr)'')');
  end
else
  if nargout>0,
    varargout{1:nargout} = eval(tryVal);
  else
    eval(tryVal);
  end
end

function z = fromOpaque(x)
z=x;

if isjava(z)
  z = char(z);
end

if isa(z,'opaque')
 error(sprintf('Conversion to char from %s is not possible.', class(x)));
end
