@@ -24,7 +24,7 @@ head_split(char* buf, struct char_p_array* list)
2424 replace (list -> p [j ], '@' , ' ' );
2525 return list -> curr ;
2626}
27-
27+
2828static int
2929sdds_get_parm (SDDS_TABLE * SDDS_table , struct table * tfs_table )
3030{
@@ -128,15 +128,15 @@ sdds_readt(char *filename, char *tfsname)
128128 }
129129 }
130130
131- /* open the file and read the SDDS header */
131+ /* open the file and read the SDDS header */
132132 if (SDDS_InitializeInput (& SDDS_table , filename ) != 1 ) {
133133 SDDS_PrintErrors (stdout ,SDDS_VERBOSE_PrintErrors );
134134 }
135135
136- /* read and process each data table in the data set */
136+ /* read and process each data table in the data set */
137137 while (SDDS_ReadTable (& SDDS_table ) > 0 ) { // (lb = not used
138- /* set all rows and all columns to initially be "of interest" */
139- SDDS_SetColumnFlags (& SDDS_table , 1 );
138+ /* set all rows and all columns to initially be "of interest" */
139+ SDDS_SetColumnFlags (& SDDS_table , 1 );
140140 SDDS_SetRowFlags (& SDDS_table , 1 );
141141
142142 }
@@ -153,7 +153,7 @@ sdds_readt(char *filename, char *tfsname)
153153
154154 narr = 0 ;
155155
156- for (i1 = 0 ;i1 < nall ;i1 ++ ){
156+ for (i1 = 0 ;i1 < nall ;i1 ++ ){
157157 if (sdds_pat != NULL ) {
158158 if (get_option ("debug" )) printf ("Check %d patterns\n" ,sdds_pat -> curr );
159159 for (i2 = 0 ; i2 < sdds_pat -> curr ; i2 ++ ) {
@@ -170,23 +170,23 @@ sdds_readt(char *filename, char *tfsname)
170170 }
171171 }
172172
173- for (i1 = 0 ;i1 < narr ;i1 ++ ){
174- if ((SDDS_CheckArray (& SDDS_table , c1 [i1 ], NULL ,
173+ for (i1 = 0 ;i1 < narr ;i1 ++ ){
174+ if ((SDDS_CheckArray (& SDDS_table , c1 [i1 ], NULL ,
175175 0 , stderr )) != SDDS_CHECK_OKAY ) {
176- fprintf (stderr , "array %s is not in the data file" ,c1 [i1 ]);
177- exit (1 );
178- }
176+ fprintf (stderr , "array %s is not in the data file" ,c1 [i1 ]);
177+ exit (1 );
178+ }
179179
180180 arr = SDDS_GetArray (& SDDS_table , c1 [i1 ], NULL );
181181 arrdim [i1 ] = (long )arr -> definition -> dimensions ;
182182 arrtyp [i1 ] = (long )arr -> definition -> type ;
183- arrele [i1 ] = (long )arr -> elements ;
184-
183+ arrele [i1 ] = (long )arr -> elements ;
184+
185185 /* check whether type is valid and compatible with TFS */
186186 if ((arrtyp [i1 ] < 1 ) || (arrtyp [i1 ] > SDDS_STRING )) {
187187 fatal_error ("Type not valid or compatible for: " ,c1 [i1 ]);
188188 }
189-
189+
190190 /* check whether array dimension and size is compatible with TFS */
191191 if (arrdim [i1 ] != 1 ) {
192192 fatal_error ("Array is 2-Dimensional: " ,c1 [i1 ]);
@@ -203,20 +203,20 @@ sdds_readt(char *filename, char *tfsname)
203203 if (arrtyp [i1 ] == SDDS_STRING ) datstr [i1 ] = (char * * )arr -> data ;
204204
205205 for (i3 = 0 ;i3 < arr -> elements ;i3 ++ ){
206- datmp = (double * )arr -> data ;
207- datmpl = (long * )arr -> data ;
208- datmps = (short * )arr -> data ;
209- datmpf = (float * )arr -> data ;
206+ datmp = (double * )arr -> data ;
207+ datmpl = (long * )arr -> data ;
208+ datmps = (short * )arr -> data ;
209+ datmpf = (float * )arr -> data ;
210210 if (get_option ("debug" )) {
211211 if (arrtyp [i1 ] != SDDS_STRING ) printf ("data: %e %e \n" ,(double )datmp [i3 ],datmp [i3 ]);
212212 if (arrtyp [i1 ] == SDDS_STRING ) printf ("data: %s \n" ,datstr [i1 ][i3 ]);
213213 }
214- if (arrtyp [i1 ] == SDDS_DOUBLE ) datd [i1 ][i3 ] = (double )datmp [i3 ];
214+ if (arrtyp [i1 ] == SDDS_DOUBLE ) datd [i1 ][i3 ] = (double )datmp [i3 ];
215215 /* for float data: convert to double float */
216- if (arrtyp [i1 ] == SDDS_FLOAT ) datd [i1 ][i3 ] = datmpf [i3 ];
216+ if (arrtyp [i1 ] == SDDS_FLOAT ) datd [i1 ][i3 ] = datmpf [i3 ];
217217 /* for integer data: convert to double float */
218- if (arrtyp [i1 ] == SDDS_LONG ) datd [i1 ][i3 ] = datmpl [i3 ];
219- if (arrtyp [i1 ] == SDDS_SHORT ) datd [i1 ][i3 ] = datmps [i3 ];
218+ if (arrtyp [i1 ] == SDDS_LONG ) datd [i1 ][i3 ] = datmpl [i3 ];
219+ if (arrtyp [i1 ] == SDDS_SHORT ) datd [i1 ][i3 ] = datmps [i3 ];
220220 }
221221 if (get_option ("debug" )) {
222222 printf ("For TFS table: %s %ld %ld %d\n" ,c1 [i1 ],arrdim [i1 ],arrtyp [i1 ],tfs_sdds_types [arrtyp [i1 ]]);
@@ -238,7 +238,7 @@ sdds_readt(char *filename, char *tfsname)
238238 tfs_table_cols[3] = c1[3];
239239 strcpy(&tfs_table_cols[narr]," ");
240240 */
241-
241+
242242 tfstab = make_table (tfsname , tfsname , (const char * const * )tfs_table_cols , tfs_table_types , 5000 );
243243 add_to_table_list (tfstab , table_register );
244244
@@ -266,7 +266,7 @@ sdds_readt(char *filename, char *tfsname)
266266 */
267267 augment_count (tfsname );
268268 }
269-
269+
270270
271271
272272 if (get_option ("debug" )) printf ("--> %d %d\n" ,tfstab -> curr ,tfstab -> num_cols );
@@ -309,22 +309,22 @@ treat_tfs_header_set(SDDS_TABLE *SDDS_table, struct table* t)
309309
310310 if (strcmp (head_buf -> p [2 ],"%ld" ) == 0 ) {
311311 sscanf (head_buf -> p [3 ],"%ld" ,& lbuf );
312- if (!SDDS_SetParameters (SDDS_table , SDDS_SET_BY_NAME |SDDS_PASS_BY_VALUE ,
312+ if (!SDDS_SetParameters (SDDS_table , SDDS_SET_BY_NAME |SDDS_PASS_BY_VALUE ,
313313 head_buf -> p [1 ], lbuf , NULL )) {
314314 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
315315 exit (1 );
316316 }
317317 } else if (strcmp (head_buf -> p [2 ],"%le" ) == 0 ) {
318318 sscanf (head_buf -> p [3 ],"%le" ,& dbuf );
319- if (!SDDS_SetParameters (SDDS_table , SDDS_SET_BY_NAME |SDDS_PASS_BY_VALUE ,
319+ if (!SDDS_SetParameters (SDDS_table , SDDS_SET_BY_NAME |SDDS_PASS_BY_VALUE ,
320320 head_buf -> p [1 ], dbuf , NULL )) {
321321 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
322322 exit (1 );
323323 }
324324 } else {
325325 strcpy (dumc ,head_buf -> p [3 ]);
326326 replace (dumc , '\"' , ' ' );
327- if (!SDDS_SetParameters (SDDS_table , SDDS_SET_BY_NAME |SDDS_PASS_BY_VALUE ,
327+ if (!SDDS_SetParameters (SDDS_table , SDDS_SET_BY_NAME |SDDS_PASS_BY_VALUE ,
328328 head_buf -> p [1 ], dumc , NULL )) {
329329 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
330330 exit (1 );
@@ -350,7 +350,7 @@ treat_tfs_header_define(SDDS_TABLE *SDDS_table, struct table* t)
350350 for (j = 0 ; j < t -> header -> curr ; j ++ ) {
351351 if (get_option ("debug" )) printf ("header: %s\n" , t -> header -> p [j ]);
352352 pre_split (t -> header -> p [j ], l_wrk , 0 );
353- head_split (l_wrk -> c ,head_buf ); // i = not used
353+ head_split (l_wrk -> c ,head_buf ); // i = not used
354354 if (get_option ("debug" )) printf ("curr: %d\n" ,head_buf -> curr );
355355
356356 if (head_buf -> curr > 0 ) {
@@ -371,7 +371,7 @@ treat_tfs_header_define(SDDS_TABLE *SDDS_table, struct table* t)
371371
372372 return (head_buf -> curr );
373373}
374-
374+
375375static int
376376sdds_writet_sel (char * filename , struct table * tfstab )
377377{
@@ -395,15 +395,15 @@ sdds_writet_sel(char *filename, struct table *tfstab)
395395 {
396396 -1 , SDDS_LONG , SDDS_DOUBLE , SDDS_STRING
397397 };
398-
398+
399399 /* set up to put data into file "atest.out" */
400400 if (!SDDS_InitializeOutput (& SDDS_table , SDDS_ASCII , 1 , NULL , NULL , filename )) {
401401 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
402402 exit (1 );
403403 }
404-
405404
406- /* */
405+
406+ /* */
407407 if (get_option ("debug" )) {
408408 printf ("tfs table with %d columns \n" ,tfstab -> num_cols );
409409 printf ("tfs table with %d rows \n" ,tfstab -> curr );
@@ -416,9 +416,9 @@ sdds_writet_sel(char *filename, struct table *tfstab)
416416
417417 for (j1 = 0 ; j1 < col -> curr ; j1 ++ ) {
418418 /* define data arrays from TFS columns*/
419- if (SDDS_DefineArray (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
420- NULL , NULL , NULL , NULL ,
421- sdds_tfs_types [tfstab -> columns -> inform [col -> i [j1 ]]], 0 , 1 , NULL )< 0 ) {
419+ if (SDDS_DefineArray (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
420+ NULL , NULL , NULL , NULL ,
421+ sdds_tfs_types [tfstab -> columns -> inform [col -> i [j1 ]]], 0 , 1 , NULL )< 0 ) {
422422 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
423423 exit (1 );
424424 }
@@ -469,7 +469,7 @@ sdds_writet_sel(char *filename, struct table *tfstab)
469469 pl [j2 ] = da1 [pos [j1 ]][j2 ];
470470 if (get_option ("debug" )) printf (" %ld\n" ,pl [j2 ]);
471471 }
472- if (!SDDS_SetArrayVararg (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
472+ if (!SDDS_SetArrayVararg (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
473473 SDDS_POINTER_ARRAY , pl ,tfstab -> curr )) {
474474 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
475475 exit (1 );
@@ -486,7 +486,7 @@ sdds_writet_sel(char *filename, struct table *tfstab)
486486 }
487487 /* for row->i[j2] == 1 ==> row is selected, not implemented */
488488 }
489- if (!SDDS_SetArrayVararg (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
489+ if (!SDDS_SetArrayVararg (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
490490 SDDS_POINTER_ARRAY , & da1 [pos [j1 ]][0 ],tfstab -> curr )) {
491491 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
492492 exit (1 );
@@ -497,7 +497,7 @@ sdds_writet_sel(char *filename, struct table *tfstab)
497497 for (j2 = 0 ;j2 < tfstab -> curr ; j2 ++ ) {
498498 if (get_option ("debug" )) printf (" %s\n" ,tfstab -> s_cols [pos [j1 ]][j2 ]);
499499 }
500- if (!SDDS_SetArrayVararg (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
500+ if (!SDDS_SetArrayVararg (& SDDS_table , tfstab -> columns -> names [col -> i [j1 ]],
501501 SDDS_POINTER_ARRAY , & sa1 [pos [j1 ]][0 ],tfstab -> curr )) {
502502 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
503503 exit (1 );
@@ -514,7 +514,7 @@ sdds_writet_sel(char *filename, struct table *tfstab)
514514 SDDS_PrintErrors (stderr , SDDS_VERBOSE_PrintErrors );
515515 exit (1 );
516516 }
517-
517+
518518 return (0 );
519519}
520520
@@ -531,8 +531,8 @@ set_selected_rows_tab(struct table* t, struct command_list* select, struct comma
531531 {
532532 for (j = 0 ; j < t -> curr ; j ++ )
533533 {
534- if (t -> row_out -> i [j ] == 0 ) t -> row_out -> i [ j ]
535- = pass_select_el (t -> p_nodes [j ]-> p_elem , select -> commands [i ]);
534+ if (t -> row_out -> i [j ] == 0 )
535+ t -> row_out -> i [ j ] = pass_select_el (t -> p_nodes [j ]-> p_elem , select -> commands [i ]);
536536 if (t -> row_out -> i [j ] == 1 ) n ++ ;
537537 }
538538 }
@@ -543,8 +543,8 @@ set_selected_rows_tab(struct table* t, struct command_list* select, struct comma
543543 {
544544 for (j = 0 ; j < t -> curr ; j ++ )
545545 {
546- if (t -> row_out -> i [j ] == 1 ) t -> row_out -> i [ j ]
547- = 1 - pass_select (t -> s_cols [0 ][j ], deselect -> commands [i ]);
546+ if (t -> row_out -> i [j ] == 1 )
547+ t -> row_out -> i [ j ] = 1 - pass_select (t -> s_cols [0 ][j ], deselect -> commands [i ]);
548548 if (t -> row_out -> i [j ] == 1 ) n ++ ;
549549 }
550550 }
@@ -575,7 +575,7 @@ sel_table(char* tname, struct table* t)
575575 set_selected_rows_tab (t , scl , dscl );
576576 }
577577}
578-
578+
579579static int
580580sdds_ior (struct in_cmd * cmd )
581581{
@@ -591,16 +591,16 @@ sdds_ior(struct in_cmd* cmd)
591591 }
592592 printf ("access SDDS table: %s %s\n" ,sdds_table_file ,tfs_table_name );
593593 i = sdds_readt (sdds_table_file ,tfs_table_name );
594- return ( i ) ;
594+ return i ;
595595}
596596
597- static int
597+ static int
598598sdds_iow (struct in_cmd * cmd )
599599{
600- char * sdds_table_file ;
600+ char * sdds_table_file = 0 ;
601601 char * tfs_table_name ;
602602 struct table * tfs_table = 0 ;
603- int i , pos ;
603+ int i ;
604604 if ((sdds_table_file = command_par_string ("file" ,cmd -> clone )) == NULL ) {
605605 fatal_error ("No file name to write SDDS table " ,"\n" );
606606 }
@@ -611,10 +611,10 @@ sdds_iow(struct in_cmd* cmd)
611611 mycpy (c_dum -> c , tfs_table_name );
612612 tfs_table = find_table (c_dum -> c );
613613
614- printf ("create SDDS table: %s %d \n" ,sdds_table_file , pos );
614+ printf ("create SDDS table: %s\n" ,sdds_table_file );
615615 sel_table (tfs_table_name , tfs_table );
616616 i = sdds_writet_sel (sdds_table_file ,tfs_table );
617- return ( i ) ;
617+ return i ;
618618}
619619
620620// public interface
0 commit comments