3 static void fstr2cstr(
char *cstr,
9 if ( cstr != fstr ) strncpy( cstr, fstr, len );
11 for ( i=len-1; i>=0; i-- ) {
12 if ( cstr[i] !=
' ' ) {
20 static void cstr2fstr(
char *fstr,
26 if ( fstr != cstr ) strncpy( fstr, cstr, len );
28 for ( i=0; i<len; i++ )
29 if ( cstr[i] ==
'\0' )
break;
31 for ( ; i < len; i++ )
45 fstr2cstr(_fname, fname, len);
65 fstr2cstr(_filetype, filetype, len);
68 fstr2cstr(_key, key, len);
71 fstr2cstr(_val, val, len);
89 fstr2cstr(_varname, varname, len);
129 fstr2cstr(_key, key, len);
134 cstr2fstr(value, _value, len);
148 fstr2cstr(_key, key, l);
164 fstr2cstr(_key, key, l);
180 fstr2cstr(_key, key, l);
197 fstr2cstr(_key, key, len);
200 fstr2cstr(_value, value, len);
215 fstr2cstr(_key, key, key_len);
231 fstr2cstr(_key, key, l);
247 fstr2cstr(_key, key, l);
260 fstr2cstr(_time_units, time_units, len);
280 fstr2cstr(_vname, vname, len);
283 fstr2cstr(_key, key, len);
286 fstr2cstr(_val, val, len);
304 int32_t dim_name_len)
313 fstr2cstr(_name, name, len);
316 fstr2cstr(_desc, desc, len);
319 fstr2cstr(_units, units, len);
322 fstr2cstr(_dim_name, dim_name, len);
324 *error =
file_put_axis( *fid, _name, _desc, _units, _dim_name, *dtype, val, *size, *precision );
340 int32_t dim_name_len)
350 fstr2cstr(_name, name, len);
353 fstr2cstr(_desc, desc, len);
356 fstr2cstr(_units, units, len);
358 _dim_names = (
char**) malloc(
sizeof(
char*)*(*ndims));
360 for ( i=0; i<*ndims; i++ ) {
361 _dim_names[i] = (
char*) malloc(
sizeof(
char)*(
File_HSHORT+1));
362 fstr2cstr(_dim_names[i], dim_names+i*dim_name_len, len);
391 fstr2cstr(_varname, varname, len);
394 fstr2cstr(_desc, desc, len);
397 fstr2cstr(_units, units, len);
399 _dims = (
char**) malloc(
sizeof(
char*)*(*ndims));
401 for ( i=0; i<*ndims; i++ ) {
402 _dims[i] = (
char*) malloc(
sizeof(
char)*(
File_HSHORT+1));
403 fstr2cstr(_dims[i], dims+i*dims_len, len);
406 *error =
file_add_variable( vid, *fid, _varname, _desc, _units, _dims, *ndims, *dtype, *tint, *tavg );
408 for ( i=0; i<*ndims; i++ )
421 *error =
file_write_data( *fid, *vid, var, *t_start, *t_end, *precision );
char dim_name[File_HSHORT *MAX_RANK]
char description[File_HMID]
char time_units[File_HMID]
char varname[File_HSHORT]