Logo Search packages:      
Sourcecode: dballe version File versions

F77_INTEGER_FUNCTION() idba_setc ( INTEGER(handle)  ,
CHARACTER(parameter)  ,
TRAIL(value)   
)

Set one character value into the input record

Parameters:
handle Handle to a DBALLE session
parameter Parameter to set. It can be the code of a WMO variable prefixed by "B" (such as "B01023"); the code of a QC value prefixed by "*B" (such as "*B01023") or a keyword among the ones defined in dba_record_keywords
value The value to assign to the parameter
Returns:
The error indicator for the function

Definition at line 1154 of file simple.c.

References dba_error_notfound, dba_record_keyword_byname(), DBA_RUN_OR_RETURN, DBA_STRING_TO_VAR, and dba_varcode_alias_resolve().

{
      GENPTR_INTEGER(handle)
      GENPTR_CHARACTER(parameter)
      GENPTR_CHARACTER(value)
      GENPTR_INTEGER(err)
      char parm[20];
      char* p;
      char val[255];
      dba_record rec;
      dba_varcode code = 0;

      cnfImpn(parameter, parameter_length, 19, parm); parm[19] = 0;
      cnfImpn(value, value_length, 254, val); val[254] = 0;

      switch (parm[0])
      {
            case '*':
                  rec = STATE.qcinput;
                  p = parm + 1;
                  break;
            default:
                  rec = STATE.input;
                  p = parm;
                  break;
      }

      if (p[0] != 'B' && (code = dba_varcode_alias_resolve(p)) == 0)
      {
            dba_keyword param = dba_record_keyword_byname(p);
            if (param == DBA_KEY_ERROR)
                  return dba_error_notfound("looking for misspelled parameter \"%s\"", p);

            if (val[0] == 0)
                  return dba_record_key_unset(rec, param);
            else
                  switch (param)
                  {
                        case DBA_KEY_LAT:
                        case DBA_KEY_LON:
                              DBA_RUN_OR_RETURN(dba_record_key_unset(rec, DBA_KEY_ANA_ID));
                              break;
                        case DBA_KEY_ANA_ID:
                              DBA_RUN_OR_RETURN(dba_record_key_unset(rec, DBA_KEY_LAT));
                              DBA_RUN_OR_RETURN(dba_record_key_unset(rec, DBA_KEY_LON));
                              break;
                        default: break;
                  }

            return dba_record_key_setc(rec, param, val);
      } else {
            if (code == 0)
                  code = DBA_STRING_TO_VAR(p + 1);

            if (val[0] == 0)
                  return dba_record_var_unset(rec, code);

            return dba_record_var_setc(rec, code, val);
      }
}


Generated by  Doxygen 1.6.0   Back to index