Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port rpcgen to mercury for hg_proc_cb_t function generation #776

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chuckcranor
Copy link
Collaborator

Port sunrpc rpcgen to mercury to allow mercury users to generate hg_proc_cb_t functions from .x files (as an additional alternative to hand coding or using the boost preprocessor macros). The mercury version of rpcgen (hg_rpcgen) parses standard .x files (though it ignores the 'program' section) and emits code that uses the mercury proc API.

The port includes:

  • rpcgen itself, in util/rpc_gen (hg_info is moved to util/hg_info)
  • mercury proc versions of helper xdr functions like xdr_array() in src/proc_extra. we update the legacy string functions in src/proc_extra to use hg_proc_string() for a backend.
  • a new unit test in Testing/unit/hg/test_hg_rpcgen.c

The unit test's input .x file (Testing/unit/hg/test_hg_rpcgen.x) also documents the the .x file syntax.

@soumagne
Copy link
Member

@chuckcranor could you please rebase your PR on top of latest master? the CI got unfortunately broken when github runners were moved to latest ubuntu and I just fixed them. Thanks!

@chuckcranor chuckcranor force-pushed the hg_rpcgen branch 2 times, most recently from 0e3c410 to 2987eb8 Compare January 22, 2025 21:10
Port sunrpc rpcgen to mercury to allow mercury users to generate
hg_proc_cb_t functions from .x files (as an additional alternative
to hand coding or using the boost preprocessor macros).  The
mercury version of rpcgen (hg_rpcgen) parses standard .x files
(though it ignores the 'program' section) and emits code that
uses the mercury proc API.

The port includes:
  - rpcgen itself, in util/rpc_gen (hg_info is moved to util/hg_info)
  - mercury proc versions of helper xdr functions like xdr_array()
    in src/proc_extra.  we update the legacy string functions in
    src/proc_extra to use hg_proc_string() for a backend.
  - a new unit test in Testing/unit/hg/test_hg_rpcgen.c

The unit test's input .x file (Testing/unit/hg/test_hg_rpcgen.x)
also documents the the .x file syntax.

Note that the hg_rpcgen reinitialize() code has been updated to
free() previously allocated parse tree memory rather than discard
(leak) it.  To do this, the char* strings in parse.h were changed
to tokens (since the token type/kind value can be used to determine
if the token string was allocated with malloc() or not).
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.

2 participants