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
data-conv.cc
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 (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <cctype>
28 #include <cstdlib>
29 
30 #include <iostream>
31 #include <limits>
32 #include <vector>
33 
34 #include "byte-swap.h"
35 #include "data-conv.h"
36 #include "lo-error.h"
37 #include "lo-ieee.h"
38 #include "oct-locbuf.h"
39 
40 #if defined (OCTAVE_HAVE_LONG_LONG_INT)
41 # define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \
42  do \
43  { \
44  int sz = BITS / std::numeric_limits<unsigned char>::digits; \
45  if (sizeof (TQ char) == sz) \
46  VAL = oct_data_conv::dt_ ## Q ## char; \
47  else if (sizeof (TQ short) == sz) \
48  VAL = oct_data_conv::dt_ ## Q ## short; \
49  else if (sizeof (TQ int) == sz) \
50  VAL = oct_data_conv::dt_ ## Q ## int; \
51  else if (sizeof (TQ long) == sz) \
52  VAL = oct_data_conv::dt_ ## Q ## long; \
53  else if (sizeof (TQ long long) == sz) \
54  VAL = oct_data_conv::dt_ ## Q ## longlong; \
55  else \
56  VAL = oct_data_conv::dt_unknown; \
57  } \
58  while (0)
59 #else
60 # define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \
61  do \
62  { \
63  int sz = BITS / std::numeric_limits<unsigned char>::digits; \
64  if (sizeof (TQ char) == sz) \
65  VAL = oct_data_conv::dt_ ## Q ## char; \
66  else if (sizeof (TQ short) == sz) \
67  VAL = oct_data_conv::dt_ ## Q ## short; \
68  else if (sizeof (TQ int) == sz) \
69  VAL = oct_data_conv::dt_ ## Q ## int; \
70  else if (sizeof (TQ long) == sz) \
71  VAL = oct_data_conv::dt_ ## Q ## long; \
72  else \
73  VAL = oct_data_conv::dt_unknown; \
74  } \
75  while (0)
76 #endif
77 
78 #define FIND_SIZED_FLOAT_TYPE(VAL, BITS) \
79  do \
80  { \
81  int sz = BITS / std::numeric_limits<unsigned char>::digits; \
82  if (sizeof (float) == sz) \
83  VAL = oct_data_conv::dt_float; \
84  else if (sizeof (double) == sz) \
85  VAL = oct_data_conv::dt_double; \
86  else \
87  VAL = oct_data_conv::dt_unknown; \
88  } \
89  while (0)
90 
91 // I'm not sure it is worth the trouble, but let's use a lookup table
92 // for the types that are supposed to be a specific number of bits
93 // wide. Given the macros above, this should work as long as
94 // std::numeric_limits<unsigned char>::digits is a multiple of 8 and
95 // there are types with the right sizes.
96 //
97 // The sized data type lookup table has the following format:
98 //
99 // bits
100 // +----+----+----+----+
101 // | 8 | 16 | 32 | 64 |
102 // +----+----+----+----+
103 // signed integer | | | | |
104 // +----+----+----+----+
105 // unsigned integer | | | | |
106 // +----+----+----+----+
107 // floating point | | | | |
108 // +----+----+----+----+
109 //
110 // So, the 0,3 element is supposed to contain the oct_data_conv enum
111 // value corresponding to the correct native data type for a signed
112 // 32-bit integer.
113 
114 static void
116 {
117  int bits = 8;
118 
119  for (int i = 0; i < 4; i++)
120  {
121  FIND_SIZED_INT_TYPE (table[0][i], bits, , );
122 
123  FIND_SIZED_INT_TYPE (table[1][i], bits, unsigned, u);
124 
125  FIND_SIZED_FLOAT_TYPE (table[2][i], bits);
126 
127  bits *= 2;
128  }
129 }
130 
131 static std::string
133 {
134  size_t n = str.length ();
135 
136  size_t k = 0;
137 
138  std::string s (n, ' ');
139 
140  for (size_t i = 0; i < n; i++)
141  if (! isspace (str[i]))
142  s[k++] = tolower (str[i]);
143 
144  s.resize (k);
145 
146  return s;
147 }
148 
149 #define GET_SIZED_INT_TYPE(T, U) \
150  do \
151  { \
152  switch (sizeof (T)) \
153  { \
154  case 1: \
155  retval = dt_ ## U ## int8; \
156  break; \
157  \
158  case 2: \
159  retval = dt_ ## U ## int16; \
160  break; \
161  \
162  case 4: \
163  retval = dt_ ## U ## int32; \
164  break; \
165  \
166  case 8: \
167  retval = dt_ ## U ## int64; \
168  break; \
169  \
170  default: \
171  retval = dt_unknown; \
172  break; \
173  } \
174  } \
175  while (0)
176 
177 size_t
179 {
180  size_t retval = -1;
181 
182  switch (dt)
183  {
185  retval = sizeof (int8_t);
186  break;
187 
189  retval = sizeof (uint8_t);
190  break;
191 
193  retval = sizeof (int16_t);
194  break;
195 
197  retval = sizeof (uint16_t);
198  break;
199 
201  retval = sizeof (int32_t);
202  break;
203 
205  retval = sizeof (uint32_t);
206  break;
207 
209  retval = sizeof (int64_t);
210  break;
211 
213  retval = sizeof (uint64_t);
214  break;
215 
218  retval = sizeof (float);
219  break;
220 
222  retval = sizeof (double);
223  break;
224 
226  retval = sizeof (char);
227  break;
228 
230  retval = sizeof (signed char);
231  break;
232 
234  retval = sizeof (unsigned char);
235  break;
236 
238  retval = sizeof (short);
239  break;
240 
242  retval = sizeof (unsigned short);
243  break;
244 
246  retval = sizeof (int);
247  break;
248 
250  retval = sizeof (unsigned int);
251  break;
252 
254  retval = sizeof (long);
255  break;
256 
258  retval = sizeof (unsigned long);
259  break;
260 
262  retval = sizeof (long long);
263  break;
264 
266  retval = sizeof (unsigned long long);
267  break;
268 
270  retval = sizeof (bool);
271  break;
272 
274  default:
275  abort ();
276  break;
277  }
278 
279  return retval;
280 }
281 
284 {
286 
287  static bool initialized = false;
288 
289  static data_type sized_type_table[3][4];
290 
291  if (! initialized)
292  {
293  init_sized_type_lookup_table (sized_type_table);
294 
295  initialized = true;
296  }
297 
298  std::string s = strip_spaces (str);
299 
300  if (s == "int8" || s == "integer*1")
301  retval = dt_int8;
302  else if (s == "uint8")
303  retval = dt_uint8;
304  else if (s == "int16" || s == "integer*2")
305  retval = dt_int16;
306  else if (s == "uint16")
307  retval = dt_uint16;
308  else if (s == "int32" || s == "integer*4")
309  retval = dt_int32;
310  else if (s == "uint32")
311  retval = dt_uint32;
312  else if (s == "int64" || s == "integer*8")
313  retval = dt_int64;
314  else if (s == "uint64")
315  retval = dt_uint64;
316  else if (s == "single" || s == "float32" || s == "real*4")
317  retval = dt_single;
318  else if (s == "double" || s == "float64" || s == "real*8")
319  retval = dt_double;
320  else if (s == "char" || s == "char*1")
321  retval = dt_char;
322  else if (s == "schar" || s == "signedchar")
323  retval = dt_schar;
324  else if (s == "uchar" || s == "unsignedchar")
325  retval = dt_uchar;
326  else if (s == "short")
327  GET_SIZED_INT_TYPE (short, );
328  else if (s == "ushort" || s == "unsignedshort")
329  GET_SIZED_INT_TYPE (unsigned short, u);
330  else if (s == "int")
331  GET_SIZED_INT_TYPE (int, );
332  else if (s == "uint" || s == "unsignedint")
333  GET_SIZED_INT_TYPE (unsigned int, u);
334  else if (s == "long")
335  GET_SIZED_INT_TYPE (long, );
336  else if (s == "ulong" || s == "unsignedlong")
337  GET_SIZED_INT_TYPE (unsigned long, u);
338  else if (s == "longlong")
339  GET_SIZED_INT_TYPE (long long, );
340  else if (s == "ulonglong" || s == "unsignedlonglong")
341  GET_SIZED_INT_TYPE (unsigned long long, u);
342  else if (s == "float")
343  {
344  if (sizeof (float) == sizeof (double))
345  retval = dt_double;
346  else
347  retval = dt_single;
348  }
349  else if (s == "logical")
350  retval = dt_logical;
351  else
352  (*current_liboctave_error_handler) ("invalid data type specified");
353 
354  if (retval == dt_unknown)
355  (*current_liboctave_error_handler)
356  ("unable to find matching native data type for %s", s.c_str ());
357 
358  return retval;
359 }
360 
361 void
363  oct_data_conv::data_type& input_type,
364  oct_data_conv::data_type& output_type)
365 {
366  block_size = 1;
367  input_type = dt_uchar;
368  output_type = dt_double;
369 
370  bool input_is_output = false;
371 
372  std::string s = strip_spaces (str);
373 
374  size_t pos = 0;
375 
376  if (s[0] == '*')
377  input_is_output = true;
378  else
379  {
380  size_t len = s.length ();
381 
382  while (pos < len && isdigit (s[pos]))
383  pos++;
384 
385  if (pos > 0)
386  {
387  if (s[pos] == '*')
388  {
389  block_size = atoi (s.c_str ());
390  s = s.substr (pos+1);
391  }
392  else
394  ("invalid repeat count in '%s'", str.c_str ());
395  }
396  }
397 
398  pos = s.find ('=');
399 
400  if (pos != std::string::npos)
401  {
402  if (s[pos+1] == '>')
403  {
404  std::string s1;
405 
406  if (input_is_output)
407  {
408  s1 = s.substr (1, pos-1);
409 
410  (*current_liboctave_warning_with_id_handler)
411  ("Octave:fread-precision-syntax",
412  "warning: ignoring leading * in fread precision");
413  }
414  else
415  s1 = s.substr (0, pos);
416 
417  input_type = string_to_data_type (s1);
418  output_type = string_to_data_type (s.substr (pos+2));
419  }
420  else
422  ("fread: invalid precision specified");
423  }
424  else
425  {
426  if (input_is_output)
427  s = s.substr (1);
428 
429  input_type = string_to_data_type (s);
430 
431  if (input_is_output)
432  output_type = input_type;
433  }
434 }
435 
436 void
438  oct_data_conv::data_type& output_type)
439 {
440  block_size = 1;
441  output_type = dt_double;
442 
443  std::string s = strip_spaces (str);
444 
445  size_t pos = 0;
446 
447  size_t len = s.length ();
448 
449  while (pos < len && isdigit (s[pos]))
450  pos++;
451 
452  if (pos > 0)
453  {
454  if (s[pos] == '*')
455  {
456  block_size = atoi (s.c_str ());
457  s = s.substr (pos+1);
458  }
459  else
461  ("invalid repeat count in '%s'", str.c_str ());
462  }
463 
464  output_type = string_to_data_type (s);
465 }
466 
469 {
471 
472  switch (dt)
473  {
475  retval = "int8";
476  break;
477 
479  retval = "uint8";
480  break;
481 
483  retval = "int16";
484  break;
485 
487  retval = "uint16";
488  break;
489 
491  retval = "int32";
492  break;
493 
495  retval = "uint32";
496  break;
497 
499  retval = "int64";
500  break;
501 
503  retval = "uint64";
504  break;
505 
507  retval = "single";
508  break;
509 
511  retval = "double";
512  break;
513 
515  retval = "char";
516  break;
517 
519  retval = "signed char";
520  break;
521 
523  retval = "unsigned char";
524  break;
525 
527  retval = "short";
528  break;
529 
531  retval = "unsigned short";
532  break;
533 
535  retval = "int";
536  break;
537 
539  retval = "unsigned int";
540  break;
541 
543  retval = "long";
544  break;
545 
547  retval = "unsigned long";
548  break;
549 
551  retval = "long long";
552  break;
553 
555  retval = "unsigned long long";
556  break;
557 
559  retval = "float";
560  break;
561 
563  retval = "logical";
564  break;
565 
567  default:
568  retval = "unknown";
569  break;
570  }
571 
572  return retval;
573 }
574 
575 #define LS_DO_READ(TYPE, swap, data, size, len, stream) \
576  do \
577  { \
578  if (len > 0) \
579  { \
580  OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
581  std::streamsize n_bytes = size * static_cast<std::streamsize> (len); \
582  stream.read (reinterpret_cast<char *> (ptr), n_bytes); \
583  if (swap) \
584  swap_bytes< size > (ptr, len); \
585  for (octave_idx_type i = 0; i < len; i++) \
586  data[i] = ptr[i]; \
587  } \
588  } \
589  while (0)
590 
591 // Have to use copy here to avoid writing over data accessed via
592 // Matrix::data ().
593 
594 #define LS_DO_WRITE(TYPE, data, size, len, stream) \
595  do \
596  { \
597  if (len > 0) \
598  { \
599  char tmp_type = type; \
600  stream.write (&tmp_type, 1); \
601  OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
602  for (octave_idx_type i = 0; i < len; i++) \
603  ptr[i] = static_cast<TYPE> (data[i]); \
604  std::streamsize n_bytes = size * static_cast<std::streamsize> (len); \
605  stream.write (reinterpret_cast<char *> (ptr), n_bytes); \
606  } \
607  } \
608  while (0)
609 
610 // Loading variables from files.
611 
612 OCTAVE_NORETURN static
613 void
615 {
616  (*current_liboctave_error_handler)
617  ("unrecognized floating point format requested");
618 }
619 
620 // But first, some data conversion routines.
621 
622 // Currently, we only handle conversions for the IEEE types. To fix
623 // that, make more of the following routines work.
624 
625 // FIXME: assumes sizeof (Complex) == 8
626 // FIXME: assumes sizeof (double) == 8
627 // FIXME: assumes sizeof (float) == 4
628 
629 static void
631 {
632  swap_bytes<8> (d, len);
633 }
634 
635 static void
637 {
638  swap_bytes<4> (d, len);
639 }
640 
641 static void
643 {
644  swap_bytes<8> (d, len);
645 }
646 
647 static void
649 {
650  swap_bytes<4> (d, len);
651 }
652 
653 void
657 {
658  switch (to_fmt)
659  {
661  switch (from_fmt)
662  {
664  break;
665 
668  break;
669 
670  default:
672  break;
673  }
674  break;
675 
677  switch (from_fmt)
678  {
681  break;
682 
684  break;
685 
686  default:
688  break;
689  }
690  break;
691 
692  default:
693  (*current_liboctave_error_handler)
694  ("impossible state reached in file '%s' at line %d",
695  __FILE__, __LINE__);
696  break;
697  }
698 }
699 
700 void
704 {
705  switch (to_fmt)
706  {
708  switch (from_fmt)
709  {
711  break;
712 
715  break;
716 
717  default:
719  break;
720  }
721  break;
722 
724  switch (from_fmt)
725  {
728  break;
729 
731  break;
732 
733  default:
735  break;
736  }
737  break;
738 
739  default:
740  (*current_liboctave_error_handler)
741  ("impossible state reached in file '%s' at line %d",
742  __FILE__, __LINE__);
743  break;
744  }
745 }
746 
747 void
751 {
752  switch (sz)
753  {
754  case sizeof (float):
755  do_float_format_conversion (data, len, from_fmt, to_fmt);
756  break;
757 
758  case sizeof (double):
759  do_double_format_conversion (data, len, from_fmt, to_fmt);
760  break;
761 
762  default:
763  (*current_liboctave_error_handler)
764  ("impossible state reached in file '%s' at line %d",
765  __FILE__, __LINE__);
766  break;
767  }
768 }
769 
770 void
771 read_doubles (std::istream& is, double *data, save_type type,
772  octave_idx_type len, bool swap,
774 {
775  switch (type)
776  {
777  case LS_U_CHAR:
778  LS_DO_READ (uint8_t, swap, data, 1, len, is);
779  break;
780 
781  case LS_U_SHORT:
782  LS_DO_READ (uint16_t, swap, data, 2, len, is);
783  break;
784 
785  case LS_U_INT:
786  LS_DO_READ (uint32_t, swap, data, 4, len, is);
787  break;
788 
789  case LS_CHAR:
790  LS_DO_READ (int8_t, swap, data, 1, len, is);
791  break;
792 
793  case LS_SHORT:
794  LS_DO_READ (int16_t, swap, data, 2, len, is);
795  break;
796 
797  case LS_INT:
798  LS_DO_READ (int32_t, swap, data, 4, len, is);
799  break;
800 
801  case LS_FLOAT:
802  {
803  OCTAVE_LOCAL_BUFFER (float, ptr, len);
804  std::streamsize n_bytes = 4 * static_cast<std::streamsize> (len);
805  is.read (reinterpret_cast<char *> (ptr), n_bytes);
806  do_float_format_conversion (ptr, len, fmt);
807  for (octave_idx_type i = 0; i < len; i++)
808  data[i] = ptr[i];
809  }
810  break;
811 
812  case LS_DOUBLE: // No conversion necessary.
813  {
814  std::streamsize n_bytes = 8 * static_cast<std::streamsize> (len);
815  is.read (reinterpret_cast<char *> (data), n_bytes);
816  do_double_format_conversion (data, len, fmt);
817 
818  for (int i = 0; i < len; i++)
819  data[i] = __lo_ieee_replace_old_NA (data[i]);
820  }
821  break;
822 
823  default:
824  is.clear (std::ios::failbit | is.rdstate ());
825  break;
826  }
827 }
828 
829 void
830 read_floats (std::istream& is, float *data, save_type type,
831  octave_idx_type len, bool swap,
833 {
834  switch (type)
835  {
836  case LS_U_CHAR:
837  LS_DO_READ (uint8_t, swap, data, 1, len, is);
838  break;
839 
840  case LS_U_SHORT:
841  LS_DO_READ (uint16_t, swap, data, 2, len, is);
842  break;
843 
844  case LS_U_INT:
845  LS_DO_READ (uint32_t, swap, data, 4, len, is);
846  break;
847 
848  case LS_CHAR:
849  LS_DO_READ (int8_t, swap, data, 1, len, is);
850  break;
851 
852  case LS_SHORT:
853  LS_DO_READ (int16_t, swap, data, 2, len, is);
854  break;
855 
856  case LS_INT:
857  LS_DO_READ (int32_t, swap, data, 4, len, is);
858  break;
859 
860  case LS_FLOAT: // No conversion necessary.
861  {
862  std::streamsize n_bytes = 4 * static_cast<std::streamsize> (len);
863  is.read (reinterpret_cast<char *> (data), n_bytes);
864  do_float_format_conversion (data, len, fmt);
865  }
866  break;
867 
868  case LS_DOUBLE:
869  {
870  OCTAVE_LOCAL_BUFFER (double, ptr, len);
871  std::streamsize n_bytes = 8 * static_cast<std::streamsize> (len);
872  is.read (reinterpret_cast<char *> (ptr), n_bytes);
873  do_double_format_conversion (ptr, len, fmt);
874  for (octave_idx_type i = 0; i < len; i++)
875  data[i] = ptr[i];
876  }
877  break;
878 
879  default:
880  is.clear (std::ios::failbit | is.rdstate ());
881  break;
882  }
883 }
884 
885 void
886 write_doubles (std::ostream& os, const double *data, save_type type,
887  octave_idx_type len)
888 {
889  switch (type)
890  {
891  case LS_U_CHAR:
892  LS_DO_WRITE (uint8_t, data, 1, len, os);
893  break;
894 
895  case LS_U_SHORT:
896  LS_DO_WRITE (uint16_t, data, 2, len, os);
897  break;
898 
899  case LS_U_INT:
900  LS_DO_WRITE (uint32_t, data, 4, len, os);
901  break;
902 
903  case LS_CHAR:
904  LS_DO_WRITE (int8_t, data, 1, len, os);
905  break;
906 
907  case LS_SHORT:
908  LS_DO_WRITE (int16_t, data, 2, len, os);
909  break;
910 
911  case LS_INT:
912  LS_DO_WRITE (int32_t, data, 4, len, os);
913  break;
914 
915  case LS_FLOAT:
916  LS_DO_WRITE (float, data, 4, len, os);
917  break;
918 
919  case LS_DOUBLE: // No conversion necessary.
920  {
921  char tmp_type = static_cast<char> (type);
922  os.write (&tmp_type, 1);
923  std::streamsize n_bytes = 8 * static_cast<std::streamsize> (len);
924  os.write (reinterpret_cast<const char *> (data), n_bytes);
925  }
926  break;
927 
928  default:
929  (*current_liboctave_error_handler)
930  ("unrecognized data format requested");
931  break;
932  }
933 }
934 
935 void
936 write_floats (std::ostream& os, const float *data, save_type type,
937  octave_idx_type len)
938 {
939  switch (type)
940  {
941  case LS_U_CHAR:
942  LS_DO_WRITE (uint8_t, data, 1, len, os);
943  break;
944 
945  case LS_U_SHORT:
946  LS_DO_WRITE (uint16_t, data, 2, len, os);
947  break;
948 
949  case LS_U_INT:
950  LS_DO_WRITE (uint32_t, data, 4, len, os);
951  break;
952 
953  case LS_CHAR:
954  LS_DO_WRITE (int8_t, data, 1, len, os);
955  break;
956 
957  case LS_SHORT:
958  LS_DO_WRITE (int16_t, data, 2, len, os);
959  break;
960 
961  case LS_INT:
962  LS_DO_WRITE (int32_t, data, 4, len, os);
963  break;
964 
965  case LS_FLOAT: // No conversion necessary.
966  {
967  char tmp_type = static_cast<char> (type);
968  os.write (&tmp_type, 1);
969  std::streamsize n_bytes = 4 * static_cast<std::streamsize> (len);
970  os.write (reinterpret_cast<const char *> (data), n_bytes);
971  }
972  break;
973 
974  case LS_DOUBLE:
975  LS_DO_WRITE (double, data, 8, len, os);
976  break;
977 
978  default:
979  (*current_liboctave_error_handler)
980  ("unrecognized data format requested");
981  break;
982  }
983 }
save_type
Definition: data-conv.h:85
static void init_sized_type_lookup_table(oct_data_conv::data_type table[3][4])
Definition: data-conv.cc:115
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:936
double __lo_ieee_replace_old_NA(double x)
Definition: lo-ieee.cc:101
#define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q)
Definition: data-conv.cc:60
#define LS_DO_WRITE(TYPE, data, size, len, stream)
Definition: data-conv.cc:594
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
Definition: lo-error.c:38
for large enough k
Definition: lu.cc:606
void swap_bytes< 8 >(void *ptr)
Definition: byte-swap.h:68
static OCTAVE_NORETURN void err_unrecognized_float_fmt(void)
Definition: data-conv.cc:614
void write_doubles(std::ostream &os, const double *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:886
#define LS_DO_READ(TYPE, swap, data, size, len, stream)
Definition: data-conv.cc:575
u
Definition: lu.cc:138
static void IEEE_little_float_to_IEEE_big_float(void *d, octave_idx_type len)
Definition: data-conv.cc:648
void read_floats(std::istream &is, float *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
Definition: data-conv.cc:830
s
Definition: file-io.cc:2682
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 F77_DBLE * d
bool swap
Definition: load-save.cc:725
void do_double_format_conversion(void *data, octave_idx_type len, octave::mach_info::float_format from_fmt, octave::mach_info::float_format to_fmt)
Definition: data-conv.cc:654
static void IEEE_big_double_to_IEEE_little_double(void *d, octave_idx_type len)
Definition: data-conv.cc:630
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:60
static void IEEE_big_float_to_IEEE_little_float(void *d, octave_idx_type len)
Definition: data-conv.cc:636
#define FIND_SIZED_FLOAT_TYPE(VAL, BITS)
Definition: data-conv.cc:78
void read_doubles(std::istream &is, double *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
Definition: data-conv.cc:771
std::string str
Definition: hash.cc:118
octave_value retval
Definition: data.cc:6294
idx type
Definition: ov.cc:3129
static std::string data_type_as_string(data_type dt)
Definition: data-conv.cc:468
sz
Definition: data.cc:5342
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
issues an error eealso double
Definition: ov-bool-mat.cc:594
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:200
void do_float_format_conversion(void *data, octave_idx_type len, octave::mach_info::float_format from_fmt, octave::mach_info::float_format to_fmt)
Definition: data-conv.cc:701
static data_type string_to_data_type(const std::string &s)
Definition: data-conv.cc:283
write the output to stdout if nargout is
Definition: load-save.cc:1576
#define GET_SIZED_INT_TYPE(T, U)
Definition: data-conv.cc:149
static size_t data_type_size(data_type dt)
Definition: data-conv.cc:178
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
static std::string strip_spaces(const std::string &str)
Definition: data-conv.cc:132
static void IEEE_little_double_to_IEEE_big_double(void *d, octave_idx_type len)
Definition: data-conv.cc:642