23 #if defined (HAVE_CONFIG_H) 46 {
return x == 0 ||
x == 1; }
67 {
return x == 0 ||
x == 1; }
81 char *
tmp =
new char [len+1];
94 int new_len =
name.length () +
value.length () + 2;
99 char *new_item =
static_cast<char *
> (std::malloc (new_len));
101 sprintf (new_item,
"%s=%s",
name.c_str (),
value.c_str ());
124 int grow_size = 1024;
125 int max_size = grow_size;
127 char *buf =
static_cast<char *
> (std::malloc (max_size));
133 if (std::fgets (bufptr, grow_size,
f))
137 if (len == grow_size - 1)
139 int tmp = bufptr - buf + grow_size - 1;
141 max_size += grow_size;
142 buf =
static_cast<char *
> (std::realloc (buf, max_size));
145 if (*(bufptr-1) ==
'\n')
151 else if (bufptr[len-1] !=
'\n')
153 bufptr[len++] =
'\n';
203 template <
typename T>
214 if (c1 ==
'n' || c1 ==
'N')
217 if (c2 ==
'f' || c2 ==
'F')
218 val = std::numeric_limits<T>::infinity ();
220 is.setstate (std::ios::failbit);
223 is.setstate (std::ios::failbit);
230 if (c1 ==
'a' || c1 ==
'A')
233 if (c2 ==
'n' || c2 ==
'N')
234 val = std::numeric_limits<T>::quiet_NaN ();
238 if (c2 != std::istream::traits_type::eof ())
243 is.setstate (std::ios::failbit);
248 (*current_liboctave_error_handler) (
"read_inf_nan_na: invalid character '%c'");
256 template <
typename T>
264 std::ios::streampos pos =
is.tellg ();
283 if (c2 ==
'i' || c2 ==
'I' || c2 ==
'n' || c2 ==
'N')
284 val = read_inf_nan_na<T> (
is, c2);
291 if (neg && !
is.fail ())
298 val = read_inf_nan_na<T> (
is, c1);
307 std::ios::iostate status =
is.rdstate ();
308 if (status & std::ios::failbit)
314 val = -std::numeric_limits<T>::infinity ();
316 val = std::numeric_limits<T>::infinity ();
317 is.clear (status & ~std::ios::failbit);
324 is.setstate (status);
331 template <
typename T>
338 std::complex<T> cx = 0.0;
347 re = octave_read_value<T> (
is);
352 im = octave_read_value<T> (
is);
356 cx = std::complex<T> (re, im);
358 is.setstate (std::ios::failbit);
363 is.setstate (std::ios::failbit);
368 cx = octave_read_value<double> (
is);
376 return octave_read_fp_value<double> (
is);
381 return octave_read_cx_fp_value<double> (
is);
386 return octave_read_fp_value<float> (
is);
391 return octave_read_cx_fp_value<float> (
is);
402 os << (
d < 0 ?
"-Inf" :
"Inf");
425 os << (
d < 0 ?
"-Inf" :
"Inf");
void octave_write_double(std::ostream &os, double d)
std::complex< T > octave_read_cx_fp_value(std::istream &is)
void octave_putenv(const std::string &name, const std::string &value)
std::string octave_fgets(FILE *f)
identity matrix If supplied two scalar respectively For allows like xample val
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
void octave_write_complex(std::ostream &os, const Complex &c)
int octave_putenv_wrapper(char *str)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
OCTAVE_API double octave_read_value(std::istream &is)
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the special constant used to designate missing values Note that NA always compares not equal to NA(NA !=NA). To find NA values
nd deftypefn *std::string name
char * strsave(const char *s)
T read_inf_nan_na(std::istream &is, char c0)
T::size_type strlen(const typename T::value_type *str)
double octave_read_fp_value(std::istream &is)
charNDArray max(char d, const charNDArray &m)
void octave_write_float(std::ostream &os, float d)
bool xtoo_large_for_float(double x)
ColumnVector imag(const ComplexColumnVector &a)
std::complex< float > FloatComplex
std::complex< double > Complex
void octave_write_float_complex(std::ostream &os, const FloatComplex &c)
ColumnVector real(const ComplexColumnVector &a)
write the output to stdout if nargout is
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
nd group nd example For each display the value
bool xis_one_or_zero(double x)
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
bool xis_int_or_inf_or_nan(double x)
std::string octave_fgetl(FILE *f)