@@ -40,23 +40,22 @@ std::stringstream accept_comma_and_complex_default_format(std::stringstream & is
40
40
if (parIn->Type () == GDL_STRING) return std::stringstream (is.str ());
41
41
42
42
bool debug = false ;
43
- if (debug) std::cout << " the raw full input :" << is.str () << std::endl;
43
+ if (debug) std::cout << " the raw full input (1) :" << is.str () << std::endl;
44
44
45
- // for Complex, compting cases is complex since (12) eq (12,12) eq 12 ... count 1
45
+ // for Complex, counting cases is complex since (12) eq (12,12) eq 12 ... count 1
46
46
int flag_cplx = 0 ;
47
47
if ((parIn->Type () == GDL_COMPLEX) || (parIn->Type () == GDL_COMPLEXDBL)) flag_cplx = 1 ;
48
- // int open_brace=0;
49
- // int loop=0;
50
-
48
+ SizeT NToTransfer=parIn->N_Elements ();
49
+ if (parIn->Type () == GDL_STRUCT) NToTransfer=parIn->ToTransfer ();
51
50
std::stringstream temp;
52
51
char c;
53
52
int loop = 0 ;
54
53
int open_brace = 0 ;
55
54
// repeat as many elements necessary, but no more!
56
55
// for (SizeT ielem=0; ielem < (*par)->N_Elements(); ++ielem ) {
57
- if (debug) std::cout << " nb elems : " << parIn-> N_Elements () << std::endl;
56
+ if (debug) std::cout << " nb elems : " << NToTransfer << std::endl;
58
57
59
- for (int ielem = 0 ; ielem < parIn-> N_Elements () ; ++ielem) {
58
+ for (int ielem = 0 ; ielem < NToTransfer ; ++ielem) {
60
59
61
60
loop++;
62
61
while (is.get (c)) { // remove starting blanks, commas, tabs, newlines
@@ -88,7 +87,7 @@ std::stringstream accept_comma_and_complex_default_format(std::stringstream & is
88
87
temp.put (' ' ); // put a spearator between values
89
88
90
89
// this is a security if the input is really badly formatted
91
- if (loop > 5 * parIn-> N_Elements () ) break ;
90
+ if (loop > 5 * NToTransfer ) break ;
92
91
93
92
} // for loop
94
93
@@ -102,22 +101,24 @@ std::stringstream accept_comma_and_complex_default_format(std::istream *is, Base
102
101
assert (parIn->Type () != GDL_STRING);
103
102
104
103
bool debug = false ;
104
+ if (debug) std::cout << " the raw full input (2):" << is << std::endl;
105
105
106
- // for Complex, compting cases is complex since (12) eq (12,12) eq 12 ... count 1
106
+ // for Complex, counting cases is complex since (12) eq (12,12) eq 12 ... count 1
107
107
int flag_cplx = 0 ;
108
108
if ((parIn->Type () == GDL_COMPLEX) || (parIn->Type () == GDL_COMPLEXDBL)) flag_cplx = 1 ;
109
- // int open_brace=0;
110
- // int loop=0;
109
+ SizeT NToTransfer=parIn->N_Elements ();
110
+ if (parIn->Type () == GDL_STRUCT) NToTransfer=parIn->ToTransfer ();
111
+
111
112
112
113
std::stringstream temp;
113
114
char c;
114
115
int loop = 0 ;
115
116
int open_brace = 0 ;
116
117
// repeat as many elements necessary, but no more!
117
118
// for (SizeT ielem=0; ielem < (*par)->N_Elements(); ++ielem ) {
118
- if (debug) std::cout << " nb elems : " << parIn-> N_Elements () << std::endl;
119
+ if (debug) std::cout << " nb elems : " << NToTransfer << std::endl;
119
120
120
- for (int ielem = 0 ; ielem < parIn-> N_Elements () ; ++ielem) {
121
+ for (int ielem = 0 ; ielem < NToTransfer ; ++ielem) {
121
122
122
123
loop++;
123
124
while (is->get (c)) { // remove starting blanks, commas, tabs, newlines
@@ -149,7 +150,7 @@ std::stringstream accept_comma_and_complex_default_format(std::istream *is, Base
149
150
temp.put (' ' ); // put a spearator between values
150
151
151
152
// this is a security if the input is really badly formatted
152
- if (loop > 5 * parIn-> N_Elements () ) break ;
153
+ if (loop > 5 * NToTransfer ) break ;
153
154
154
155
} // for loop
155
156
0 commit comments