Mercurial > hg > octave-nkf
annotate liboctave/lo-utils.h @ 12556:88558b8eb8a7
Add deprecated entry for cquad() pointing to quadcc().
HG Enter commit message. Lines beginning with 'HG:' are removed.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Thu, 31 Mar 2011 09:57:11 -0700 |
parents | fd0a3ac60b0e |
children | 72c96de7a403 |
rev | line source |
---|---|
1967 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 John W. Eaton |
1967 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1967 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1967 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_liboctave_utils_h) | |
24 #define octave_liboctave_utils_h 1 | |
25 | |
2926 | 26 #include <cstdio> |
27 | |
9469
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
28 #include <iostream> |
2926 | 29 #include <string> |
30 | |
11512
e4e82740e9cd
prototype fixes for C language files
John W. Eaton <jwe@octave.org>
parents:
11211
diff
changeset
|
31 #include "lo-cutils.h" |
4130 | 32 #include "oct-cmplx.h" |
33 | |
11010
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
34 extern OCTAVE_API bool xis_int_or_inf_or_nan (double x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
35 extern OCTAVE_API bool xis_one_or_zero (double x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
36 extern OCTAVE_API bool xis_zero (double x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
37 extern OCTAVE_API bool xtoo_large_for_float (double x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
38 |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
39 extern OCTAVE_API bool xis_int_or_inf_or_nan (float x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
40 extern OCTAVE_API bool xis_one_or_zero (float x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
41 extern OCTAVE_API bool xis_zero (float x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
42 extern OCTAVE_API bool xtoo_large_for_float (float x); |
9478b216752e
simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents:
11006
diff
changeset
|
43 |
6108 | 44 extern OCTAVE_API char *strsave (const char *); |
2926 | 45 |
10180 | 46 extern OCTAVE_API void |
47 octave_putenv (const std::string&, const std::string&); | |
2926 | 48 |
6108 | 49 extern OCTAVE_API std::string octave_fgets (std::FILE *); |
50 extern OCTAVE_API std::string octave_fgetl (std::FILE *); | |
2926 | 51 |
6108 | 52 extern OCTAVE_API std::string octave_fgets (std::FILE *, bool& eof); |
53 extern OCTAVE_API std::string octave_fgetl (std::FILE *, bool& eof); | |
3970 | 54 |
9469
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
55 template <typename T> |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
56 T |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
57 octave_read_value (std::istream& is) |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
58 { |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
59 T retval; |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
60 is >> retval; |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
61 return retval; |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
62 } |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
63 |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
64 template <> OCTAVE_API double octave_read_value (std::istream& is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
65 template <> OCTAVE_API Complex octave_read_value (std::istream& is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
66 template <> OCTAVE_API float octave_read_value (std::istream& is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
67 template <> OCTAVE_API FloatComplex octave_read_value (std::istream& is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
68 |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
69 // The next four functions are provided for backward compatibility. |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
70 inline double |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
71 octave_read_double (std::istream& is) |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
72 { |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
73 return octave_read_value<double> (is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
74 } |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
75 |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
76 inline Complex |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
77 octave_read_complex (std::istream& is) |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
78 { |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
79 return octave_read_value<Complex> (is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
80 } |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
81 |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
82 inline float |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
83 octave_read_float (std::istream& is) |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
84 { |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
85 return octave_read_value<float> (is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
86 } |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
87 |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
88 inline FloatComplex |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
89 octave_read_float_complex (std::istream& is) |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
90 { |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
91 return octave_read_value<FloatComplex> (is); |
c6edba80dfae
sanity checks for loading sparse matrices
John W. Eaton <jwe@octave.org>
parents:
8950
diff
changeset
|
92 } |
4130 | 93 |
10180 | 94 extern OCTAVE_API void |
95 octave_write_double (std::ostream& os, double dval); | |
96 | |
97 extern OCTAVE_API void | |
98 octave_write_complex (std::ostream& os, const Complex& cval); | |
4130 | 99 |
10180 | 100 extern OCTAVE_API void |
101 octave_write_float (std::ostream& os, float dval); | |
102 | |
103 extern OCTAVE_API void | |
104 octave_write_float_complex (std::ostream& os, const FloatComplex& cval); | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
105 |
1967 | 106 #endif |