Skip to content

Commit

Permalink
Merge pull request #11 from morganw3/master
Browse files Browse the repository at this point in the history
Return RFCTYPE_NUM as string to be consistent with other RFC interfac…
  • Loading branch information
piersharding authored Sep 17, 2018
2 parents 52530c9 + c56dd6e commit 32875a8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/RSAP.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ void get_field_value(DATA_CONTAINER_HANDLE hcont, RFC_FIELD_DESC fieldDesc, SEXP
// set the column type
switch (fieldDesc.type) {
case RFCTYPE_FLOAT:
case RFCTYPE_NUM:
case RFCTYPE_BCD:
SET_VECTOR_ELT(value, fld, allocVector(REALSXP, 1));
break;
Expand All @@ -616,6 +615,7 @@ void get_field_value(DATA_CONTAINER_HANDLE hcont, RFC_FIELD_DESC fieldDesc, SEXP
case RFCTYPE_STRING:
case RFCTYPE_XSTRING:
case RFCTYPE_CHAR:
case RFCTYPE_NUM:
default:
SET_VECTOR_ELT(value, fld, allocVector(STRSXP, 1));
break;
Expand All @@ -626,9 +626,6 @@ void get_field_value(DATA_CONTAINER_HANDLE hcont, RFC_FIELD_DESC fieldDesc, SEXP
case RFCTYPE_FLOAT:
REAL(VECTOR_ELT(value, fld))[0] = REAL(get_float_value(hcont, fieldDesc.name))[0];
break;
case RFCTYPE_NUM:
REAL(VECTOR_ELT(value, fld))[0] = REAL(get_num_value(hcont, fieldDesc.name, fieldDesc.nucLength))[0];
break;
case RFCTYPE_BCD:
REAL(VECTOR_ELT(value, fld))[0] = REAL(get_bcd_value(hcont, fieldDesc.name))[0];
break;
Expand Down Expand Up @@ -671,6 +668,7 @@ void get_field_value(DATA_CONTAINER_HANDLE hcont, RFC_FIELD_DESC fieldDesc, SEXP
SET_STRING_ELT(VECTOR_ELT(value, fld), 0, get_xstring_value(hcont, fieldDesc.name));
break;
case RFCTYPE_CHAR:
case RFCTYPE_NUM:
default:
SET_STRING_ELT(VECTOR_ELT(value, fld), 0, get_char_value(hcont, fieldDesc.name, fieldDesc.nucLength));
break;
Expand Down Expand Up @@ -736,7 +734,6 @@ SEXP get_table_value(RFC_TABLE_HANDLE tableHandle){
// set the column type
switch (fieldDesc.type) {
case RFCTYPE_FLOAT:
case RFCTYPE_NUM:
case RFCTYPE_BCD:
SET_VECTOR_ELT(value, fld, allocVector(REALSXP, tabLen));
break;
Expand All @@ -759,6 +756,7 @@ SEXP get_table_value(RFC_TABLE_HANDLE tableHandle){
case RFCTYPE_STRING:
case RFCTYPE_XSTRING:
case RFCTYPE_CHAR:
case RFCTYPE_NUM:
default:
SET_VECTOR_ELT(value, fld, allocVector(STRSXP, tabLen));
break;
Expand Down Expand Up @@ -787,9 +785,6 @@ SEXP get_table_value(RFC_TABLE_HANDLE tableHandle){
case RFCTYPE_FLOAT:
REAL(VECTOR_ELT(value, fld))[r] = REAL(get_float_value(tableHandle, fieldDesc.name))[0];
break;
case RFCTYPE_NUM:
REAL(VECTOR_ELT(value, fld))[r] = REAL(get_num_value(tableHandle, fieldDesc.name, fieldDesc.nucLength))[0];
break;
case RFCTYPE_BCD:
REAL(VECTOR_ELT(value, fld))[r] = REAL(get_bcd_value(tableHandle, fieldDesc.name))[0];
break;
Expand Down Expand Up @@ -832,6 +827,7 @@ SEXP get_table_value(RFC_TABLE_HANDLE tableHandle){
SET_STRING_ELT(VECTOR_ELT(value, fld), r, get_xstring_value(tableHandle, fieldDesc.name));
break;
case RFCTYPE_CHAR:
case RFCTYPE_NUM:
default:
SET_STRING_ELT(VECTOR_ELT(value, fld), r, get_char_value(tableHandle, fieldDesc.name, fieldDesc.nucLength));
break;
Expand Down

0 comments on commit 32875a8

Please sign in to comment.