pcp
[Top] [All Lists]

Re: [pcp] pcp updates: getopts (wip)

To: Stan Cox <scox@xxxxxxxxxx>
Subject: Re: [pcp] pcp updates: getopts (wip)
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Thu, 6 Mar 2014 03:59:44 -0500 (EST)
Cc: PCP Mailing List <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <1468197943.21641874.1394092709858.JavaMail.zimbra@xxxxxxxxxx>
References: <1468197943.21641874.1394092709858.JavaMail.zimbra@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: ILpNlaAhJP1rO/KFCk1jML2wH37XBflm6fO6
Thread-topic: pcp updates: getopts (wip)
Hi Stan,

Could I get you (and any other interested parties!) to review
these changes?  This git tree is likely to receive a git rebase
at some point soon, so please don't pull it into a precious
branch (like scox/dev in pcpfans) - perhaps a new clone/branch
just for reviewing would be the go.

I'd be particularly interested in any thoughts on how to plug
this stuff into python clients, in the simplest fashion possible.
We will need the ctypes function/type wrappers, of course, but
going beyond that...?

I'd like to get to the point that the simple uptime.py example
could gain just one or two lines of code, and somehow (?) be
able to pass command line state directly to the pmContext class
(probably has to be during construction?).

Or some wrapper, that makes it equally trivial for a high-level
client to easily enable all those options - i.e. with no option
handling code, if the tool chooses - just passing argc/argv in
*somewhere*, and have the pmContext created correctly with any
and all standard (-h/-a/-S/... etc) arguments given.

Thanks!


> Changes committed to git://oss.sgi.com/nathans/pcp.git dev
> 
>  qa/728                       |   90 +++
>  qa/728.out                   |  572 ++++++++++++++++++++
>  qa/group                     |    1
>  qa/src/.gitignore            |    1
>  qa/src/GNUlocaldefs          |    7
>  qa/src/getoptions.c          |  226 ++++++++
>  src/include/pcp/pmapi.h      |  127 ++++
>  src/libpcp/src/GNUmakefile   |    2
>  src/libpcp/src/check-statics |    1
>  src/libpcp/src/exports       |    7
>  src/libpcp/src/getopt.c      | 1209
>  +++++++++++++++++++++++++++++++++++++++++++
>  11 files changed, 2230 insertions(+), 13 deletions(-)
> 
> commit cdd1b323287434c74853f1460257ac8176777ffd
> Author: Nathan Scott <nathans@xxxxxxxxxx>
> Date:   Thu Mar 6 17:51:15 2014 +1100
> 
>     Initial code for pmGetOptions common PMAPI option parsing
>     
>     Early code providing option parsing interfaces to abstract the
>     common getopt handling boilerplate code for PMAPI clients.  It
>     also provides for long-options on all platforms.  Refer to the
>     qa/src/getoptions.c for some test code (and qa/728).
>     
>     Missing at this stage are man pages, more comprehensive testing,
>     the python API, sample programs (uptime.py!) and then we can get
>     started on the journey toward converting all the existing client
>     tools over to using this API.

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>