23 #if defined (HAVE_CONFIG_H)
158 "end_unwind_protect",
178 "unwind_protect_cleanup",
206 size_t sz = names.size ();
211 for (std::list<std::string>::const_iterator
p = names.begin ();
212 p != names.end ();
p++)
227 const int bif_len = bif.
numel ();
230 const int cfl_len = cfl.
numel ();
233 const int lcl_len = lcl.
numel ();
236 const int ffl_len = ffl.
numel ();
239 const int afl_len = afl.
numel ();
242 const int lfl_len = lfl.
numel ();
245 = key_len + bif_len + cfl_len + lcl_len + ffl_len + afl_len + lfl_len;
253 for (i = 0; i < key_len; i++)
256 for (i = 0; i < bif_len; i++)
259 for (i = 0; i < cfl_len; i++)
262 for (i = 0; i < lcl_len; i++)
265 for (i = 0; i < ffl_len; i++)
268 for (i = 0; i < afl_len; i++)
271 for (i = 0; i < lfl_len; i++)
280 const size_t p1 = msg.find (
'\n');
283 const size_t p2 = t.find (
"<html");
285 return (p2 != std::string::npos);
291 p1 = msg.find (
'\n');
295 if (p1 == std::string::npos)
298 size_t p2 = t.find (
"-*- texinfo -*-");
300 return (p2 != std::string::npos);
327 ?
"command-line function" :
"built-in function";
352 typedef std::pair<std::streampos, std::streamoff> txt_limits_type;
353 typedef std::map<std::string, txt_limits_type> help_txt_map_type;
355 static help_txt_map_type help_txt_map;
356 static bool initialized =
false;
359 symbol_found =
false;
369 std::ifstream
file (fname.c_str (), std::ios::in | std::ios::binary);
372 error (
"failed to open docstrings file: %s", fname.c_str ());
378 error (
"invalid built-in-docstrings file!");
381 size_t bufsize = 1000;
384 while (!
file.eof ())
389 while (
file && (c =
file.get ()) != std::istream::traits_type::eof ())
391 if (c ==
'\n' || c ==
'\r')
405 && (c =
file.get ()) != std::istream::traits_type::eof ()
406 && c !=
'\n' && c !=
'\r')
411 && (c =
file.get ()) != std::istream::traits_type::eof ()
412 && c ==
'\n' && c ==
'\r')
418 std::streampos beg =
file.tellg ();
427 len =
file.tellg () - beg - 1;
431 len =
file.tellg () - beg - 1;
435 help_txt_map[
name] = txt_limits_type (beg, len);
441 help_txt_map_type::const_iterator it = help_txt_map.find (nm);
443 if (it != help_txt_map.end ())
445 txt_limits_type txt_limits = it->second;
447 std::streampos beg = txt_limits.first;
448 std::streamoff len = txt_limits.second;
452 std::ifstream
file (fname.c_str (), std::ios::in | std::ios::binary);
455 error (
"failed to open docstrings file: %s", fname.c_str ());
459 size_t txt_len = len;
462 file.read (buf, txt_len);
488 bool external_doc = h.compare (0, 12,
"external-doc") == 0;
490 if (! found || external_doc)
494 if (external_doc && h.length () > 12 && h[12] ==
':')
495 tmp_nm = h.substr (13);
530 bool symbol_found =
false;
531 text =
raw_help (name, symbol_found);
533 format =
"Not found";
539 format =
"Not documented";
552 format =
"plain text";
568 if (
args.length () != 1)
571 const std::string name =
args(0).xstring_value (
"get_help_text: NAME must be a string");
575 do_get_help_text (name, text, format);
577 return ovl (text, format);
584 bool symbol_found =
false;
590 format =
"Not found";
596 format =
"Not documented";
609 format =
"plain text";
625 if (
args.length () != 1)
628 const std::string fname =
args(0).xstring_value (
"get_help_text_from_file: NAME must be a string");
632 do_get_help_text_from_file (fname, text, format);
634 return ovl (text, format);
640 DEFUN (__operators__, , ,
652 DEFUN (__keywords__, , ,
664 DEFUN (__builtins__, , ,
692 if (
args.length () != 0)
708 const std::map<std::string, octave_value>
h = parent_fcn->
subfunctions ();
710 size_t sz = names.size ();
715 for (std::list<std::string>::const_iterator
p = names.begin ();
716 p != names.end ();
p++)
718 std::map<std::string, octave_value>::const_iterator q = h.find (*
p);
720 ! q->second.user_function_value ()->is_nested_function ())
759 if (name.find_first_of (
'.') == std::string::npos)
772 type =
"command-line function";
776 type =
"built-in function";
796 if (name.size () > 1 && name[name.size () - 1] ==
'.')
831 Cell names (1, nargin);
833 Cell types (1, nargin);
835 for (
int i = 0; i <
nargin; i++)
859 if (filename.find (dir) == 0)
861 const int dir_len = dir.size ();
862 const int filename_len = filename.size ();
867 for (
int i = dir_len; i < filename_len; i++)
871 return (num_seps <= max_allowed_seps);
894 if (
args.length () == 0)
904 std::string dir =
args(0).xstring_value (
"__list_functions__: DIRECTORY argument must be a string");
static const string_vector operator_names(operators)
virtual std::map< std::string, octave_value > subfunctions(void) const
For example cd octave end example noindent changes the current working directory to file
static std::list< std::string > cmdline_function_names(void)
The value of lines which begin with a space character are not saved in the history list A value of all commands are saved on the history list
void assign(const std::string &k, const Cell &val)
std::string Vinfo_program
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
octave_idx_type numel(void) const
Number of elements in the array.
identity matrix If supplied two scalar respectively For allows like xample val
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
bool is_defined(void) const
std::string doc_string(void) const
static std::string find_file(const std::string &file)
static bool raw_help_from_file(const std::string &nm, std::string &h, std::string &file, bool &symbol_found)
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
string_vector autoloaded_functions(void)
std::string raw_help(const std::string &nm, bool &symbol_found)
#define SET_INTERNAL_VARIABLE(NM)
static const string_vector keyword_names(keywords)
static std::list< std::string > variable_names(scope_id scope=xcurrent_scope)
static const char *const operators[]
std::string Vbuilt_in_docstrings_file
virtual std::string src_file_name(void) const
std::string get_help_from_file(const std::string &nm, bool &symbol_found, std::string &full_file)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
std::string Vdoc_cache_file
static bool looks_like_html(const std::string &msg)
static string_vector files(const std::string &dir, bool omit_exts=false)
static octave_value find_function(const std::string &name, const octave_value_list &args=octave_value_list(), bool local_funcs=true)
void resize(octave_idx_type n, const std::string &rfv="")
static std::string Vmakeinfo_program
static string_vector local_functions(void)
OCTAVE_EXPORT octave_value_list search each directory of the loadpath for element of the cell array and return the first that matches If the second optional argument return a cell array containing the list of all files that have the same name in the path If no files are found
static std::string make_absolute(const std::string &s, const std::string &dot_path=get_current_directory())
static string_vector fcn_names(void)
static octave_user_code * caller_user_code(size_t nskip=0)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
std::string Vtexi_macros_file
static octave_user_code * debug_user_code(void)
nd deftypefn *octave_map m
std::complex< double > w(std::complex< double > z, double relerr=0)
string_vector & append(const std::string &s)
OCTINTERP_API std::string do_which(const std::string &name)
void resize(const dim_vector &dv, const T &rfv)
virtual symbol_table::scope_id parent_fcn_scope(void) const
virtual std::list< std::string > subfunction_names(void) const
bool is_user_script(void) const
string_vector & sort(bool make_uniq=false)
virtual bool is_user_function(void) const
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
static octave_user_function * get_curr_fcn(scope_id scope=xcurrent_scope)
#define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM)
static bool raw_help_from_symbol_table(const std::string &nm, std::string &h, std::string &w, bool &symbol_found)
static bool looks_like_texinfo(const std::string &msg, size_t &p1)
octave_function * function_value(bool silent=false) const
charNDArray max(char d, const charNDArray &m)
virtual std::string fcn_file_name(void) const
OCTAVE_EXPORT octave_value_list the first data row corresponds to an index of zero The a spreadsheet style form such as the file is read until end of file is reached The such as text
static std::string find_fcn_file(const std::string &fcn, const std::string &pack_name="")
virtual bool is_subfunction(void) const
otherwise an error message is printed The permission mask is a UNIX concept used when creating new objects on a file system such as files
=val(i)}if ode{val(i)}occurs in table i
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
string_vector make_name_list(void)
static bool Vsuppress_verbose_help_message
static bool raw_help_from_docstrings_file(const std::string &nm, std::string &h, bool &symbol_found)
static const char *const keywords[]
Vector representing the dimensions (size) of an Array.
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
static std::list< std::string > built_in_function_names(void)
static bool is_dir_sep(char c)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))