Skip to content

fix: update examples to the one-parameter nec_geometry_complete - #129

Open
charlieh0tel wants to merge 1 commit into
tmolteno:masterfrom
charlieh0tel:fix-example-geometry-complete-arity
Open

fix: update examples to the one-parameter nec_geometry_complete#129
charlieh0tel wants to merge 1 commit into
tmolteno:masterfrom
charlieh0tel:fix-example-geometry-complete-arity

Conversation

@charlieh0tel

Copy link
Copy Markdown

nec_geometry_complete() dropped its unused second parameter — CHANGELOG: "nec_geometry_complete() now takes only one parameter. The second parameter was unused." The Python examples and the test harness were updated with it; the C and Ruby examples were not.

The result is that example/test_nec.c does not compile against the shipped libnecpp.h:

example/test_nec.c:24:20: error: too many arguments to function 'nec_geometry_complete'
   24 |   NEC_ERROR_HANDLE(nec_geometry_complete(nec, 1, 0));
      |                    ^~~~~~~~~~~~~~~~~~~~~
src/libnecpp.h:201:6: note: declared here
  201 | long nec_geometry_complete(nec_context* in_context, int gpflag);

Three call sites in example/test_nec.c, one in example/test.rb.

Verification

With this change test_nec.c builds clean under -Wall and runs correctly against the installed library:

Gain: 8.407404, -1.958237 +/- 16.108164 dB
Impedance: 595.415366, -354.438287
Gain: 6.328267, 2.175237 +/- 3.240539 dB

Found while building nec2++ to WebAssembly — the examples are the natural reference for the C API, so the first thing tried was the first thing that didn't compile.

nec_geometry_complete() dropped its unused second parameter (CHANGELOG,
"nec_geometry_complete() now takes only one parameter"), but the C and Ruby
examples were not updated with it. example/test_nec.c does not compile against
the shipped libnecpp.h:

    error: too many arguments to function 'nec_geometry_complete'
       24 |   NEC_ERROR_HANDLE(nec_geometry_complete(nec, 1, 0));
    libnecpp.h:201: note: declared here
      201 | long nec_geometry_complete(nec_context* in_context, int gpflag);

Three call sites in test_nec.c and one in test.rb. The Python examples and the
test harness were already updated.

With this, test_nec.c builds clean under -Wall and runs: the seven-wire
antenna reports Z = 595.415366 - j354.438287 and 6.328267 dB max gain.
@charlieh0tel

Copy link
Copy Markdown
Author

Closing — opened prematurely on my side; I'll route this through my own fork first.

@charlieh0tel

Copy link
Copy Markdown
Author

Reopened — this is active. Disregard the closing note above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant