# HG changeset patch # User Mychaela Falconia # Date 1510963291 0 # Node ID 64bb50fc470f8331e42bb0a1199aae3b8ed6b526 # Parent 90c475877d344235a13ae7fc79f0754f6cc2a9e4 librftab reader: implemented reading of Tx ramps tables diff -r 90c475877d34 -r 64bb50fc470f librftab/rftablerd.c --- a/librftab/rftablerd.c Fri Nov 17 23:48:49 2017 +0000 +++ b/librftab/rftablerd.c Sat Nov 18 00:01:31 2017 +0000 @@ -112,6 +112,29 @@ } static +expect_keyword(kw) + char *kw; +{ + char *field; + int rc; + + rc = get_field(&field); + if (rc < 0) + return(ERROR_USAGE); + if (!rc) { + printf("error: %s is too short for table format %s\n", + filename, format); + return(ERROR_USAGE); + } + if (strcmp(field, kw)) { + printf("%s line %d: expected %s keyword\n", filename, lineno, + kw); + return(ERROR_USAGE); + } + return(0); +} + +static ensure_eof() { char *field; @@ -186,6 +209,36 @@ } static +read_tx_ramps() +{ + int i, j, rc; + + if (maxsize < 512) { + printf("error: tx-ramps table not allowed in this context\n"); + return(ERROR_USAGE); + } + for (i = 0; i < 16; i++) { + rc = expect_keyword("ramp-up"); + if (rc) + return(rc); + for (j = 0; j < 16; j++) { + rc = process_number(1); + if (rc) + return(rc); + } + rc = expect_keyword("ramp-down"); + if (rc) + return(rc); + for (j = 0; j < 16; j++) { + rc = process_number(1); + if (rc) + return(rc); + } + } + return ensure_eof(); +} + +static read_tx_levels() { int i, rc; @@ -306,6 +359,7 @@ {"afcparams", read_afcparams}, {"agc-global-params", read_agc_global_params}, {"il2agc", read_il2agc}, + {"tx-ramps", read_tx_ramps}, {"tx-levels", read_tx_levels}, {"tx-calchan", read_tx_calchan}, {"tx-caltemp", read_tx_caltemp},