Indentation

This commit is contained in:
Shahram Najm 2019-08-23 12:10:45 +01:00
parent c6c0f831bc
commit 20ea673a21
1 changed files with 59 additions and 62 deletions

View File

@ -138,82 +138,79 @@ static void init_class(grib_accessor_class* c)
static void init(grib_accessor* a,const long l, grib_arguments* c)
{
grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a;
int n = 0;
self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
self->type = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a;
int n = 0;
self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
self->type = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
}
static int unpack_long (grib_accessor* a, long* val, size_t *len)
static int unpack_long(grib_accessor* a, long* val, size_t *len)
{
grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a;
int ret = 0;
long paramId = 0;
grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a;
int ret = 0;
long paramId = 0;
if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->paramId,&paramId)) != GRIB_SUCCESS)
return ret;
if (paramId > 129000 && paramId < 129999 )
*val = paramId - 129000;
else if (paramId > 200000 && paramId < 200999 )
*val = paramId - 200000;
else if (paramId > 211000 && paramId < 211999 )
*val = paramId - 1000;
else
*val = paramId;
if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->paramId,&paramId)) != GRIB_SUCCESS)
return ret;
if (paramId > 129000 && paramId < 129999 )
*val = paramId - 129000;
else if (paramId > 200000 && paramId < 200999 )
*val = paramId - 200000;
else if (paramId > 211000 && paramId < 211999 )
*val = paramId - 1000;
else
*val = paramId;
return ret;
}
static int pack_long(grib_accessor* a, const long* val, size_t *len)
{
grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a;
long type = 0;
long table=128;
long paramId = *val;
long param;
grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a;
long type = 0;
long table=128;
long paramId = *val;
long param;
grib_get_long(grib_handle_of_accessor(a), self->type,&type);
grib_get_long(grib_handle_of_accessor(a), self->type,&type);
if (type==33 || type==35) {
if (paramId>1000) {
table=paramId/1000;
param=paramId-table*1000;
paramId=param;
}
switch (table) {
case 210 :
paramId+=211000;
break;
case 128:
paramId+=200000;
break;
default:
break;
}
}
if (type == 50 || type == 52 ) {
if (paramId>1000) {
table=paramId/1000;
param=paramId-table*1000;
paramId=param;
}
switch (table) {
case 128:
paramId+=129000;
break;
default:
break;
}
}
if (type==33 || type==35) {
if (paramId>1000) {
table=paramId/1000;
param=paramId-table*1000;
paramId=param;
}
switch (table) {
case 210 :
paramId+=211000;
break;
case 128:
paramId+=200000;
break;
default:
break;
}
}
if (type == 50 || type == 52 ) {
if (paramId>1000) {
table=paramId/1000;
param=paramId-table*1000;
paramId=param;
}
switch (table) {
case 128:
paramId+=129000;
break;
default:
break;
}
}
return grib_set_long_internal(grib_handle_of_accessor(a),self->paramId,paramId);
return grib_set_long_internal(grib_handle_of_accessor(a),self->paramId,paramId);
}
static int get_native_type(grib_accessor* a){
return GRIB_TYPE_LONG;
return GRIB_TYPE_LONG;
}