GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-builtin.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_ov_builtin_h)
24 #define octave_ov_builtin_h 1
25 
26 #include "octave-config.h"
27 
28 #include <string>
29 
30 #include "ov-fcn.h"
31 #include "ov-typeinfo.h"
32 
33 class octave_value;
34 class octave_value_list;
35 class jit_type;
36 
37 // Builtin functions.
38 
39 class
42 {
43 public:
44 
45  octave_builtin (void) : octave_function (), f (0), file (), jtype (0) { }
46 
48 
49  octave_builtin (fcn ff, const std::string& nm = "",
50  const std::string& ds = "")
51  : octave_function (nm, ds), f (ff), file (), jtype (0) { }
52 
53  octave_builtin (fcn ff, const std::string& nm, const std::string& fnm,
54  const std::string& ds)
55  : octave_function (nm, ds), f (ff), file (fnm), jtype (0) { }
56 
57  ~octave_builtin (void) { }
58 
59  std::string src_file_name (void) const { return file; }
60 
62  const std::list<octave_value_list>& idx)
63  {
64  octave_value_list tmp = subsref (type, idx, 1);
65  return tmp.length () > 0 ? tmp(0) : octave_value ();
66  }
67 
68  octave_value_list subsref (const std::string& type,
69  const std::list<octave_value_list>& idx,
70  int nargout);
71 
72  octave_value_list subsref (const std::string& type,
73  const std::list<octave_value_list>& idx,
74  int nargout,
75  const std::list<octave_lvalue>* lvalue_list);
76 
77  octave_function *function_value (bool = false) { return this; }
78 
79  bool is_builtin_function (void) const { return true; }
80 
81  octave_value_list
82  do_multi_index_op (int nargout, const octave_value_list& args);
83 
84  octave_value_list
85  do_multi_index_op (int nargout, const octave_value_list& args,
86  const std::list<octave_lvalue>* lvalue_list);
87 
88  jit_type *to_jit (void) const;
89 
90  void stash_jit (jit_type& type);
91 
92  fcn function (void) const;
93 
94  static const std::list<octave_lvalue> *curr_lvalue_list;
95 
96 protected:
97 
98  // A pointer to the actual function.
99  fcn f;
100 
101  // The name of the file where this function was defined.
103 
104  // A pointer to the jit type that represents the function.
106 
107 private:
108 
109  // No copying!
110 
111  octave_builtin (const octave_builtin& ob);
112 
113  octave_builtin& operator = (const octave_builtin& ob);
114 
116 };
117 
118 #endif
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:120
bool is_builtin_function(void) const
Definition: ov-builtin.h:79
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
octave_idx_type length(void) const
Definition: ovl.h:96
idx subsref(val, idx) esult
Definition: ov.cc:3080
jit_type * jtype
Definition: ov-builtin.h:105
std::string src_file_name(void) const
Definition: ov-builtin.h:59
octave_function * fcn
Definition: ov-class.cc:1743
std::string file
Definition: ov-builtin.h:102
JNIEnv void * args
Definition: ov-java.cc:67
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:148
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:941
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)
Definition: ov-usr-fcn.cc:935
static const std::list< octave_lvalue > * curr_lvalue_list
Definition: ov-builtin.h:94
#define OCTINTERP_API
Definition: mexproto.h:69
double tmp
Definition: data.cc:6300
idx type
Definition: ov.cc:3129
octave_builtin(fcn ff, const std::string &nm="", const std::string &ds="")
Definition: ov-builtin.h:49
octave_builtin(fcn ff, const std::string &nm, const std::string &fnm, const std::string &ds)
Definition: ov-builtin.h:53
octave_function * function_value(bool=false)
Definition: ov-builtin.h:77
~octave_builtin(void)
Definition: ov-builtin.h:57
octave_builtin(void)
Definition: ov-builtin.h:45
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
Definition: utils.cc:854
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-builtin.h:61