diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-11-28 17:16:00 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-11-28 17:16:00 -0800 |
commit | 14b727861ffad78a82ea00980eba24b5f90d7325 (patch) | |
tree | 615a1af6b7ed20b8377eec7d2124ae350ef833da /struct.c | |
parent | bce263cf9df425b896b62e24589ccebf6e703a88 (diff) | |
download | txr-14b727861ffad78a82ea00980eba24b5f90d7325.tar.gz txr-14b727861ffad78a82ea00980eba24b5f90d7325.tar.bz2 txr-14b727861ffad78a82ea00980eba24b5f90d7325.zip |
getopts: move opts object into opt-processor.
The methods of sys:opt-processor pass down an argument called
out which is an opts instance that is created in parse-opts.
In this patch, we move that argument into a new slot of the
sys:opt-processor object, named opts. We instantiate the opts
structure in the getopts function instead. The motivation here
is that (meth sys:opt-processor parse-opts) doesn't know which
type of opts object it is working with; its user is now
responsible for instantiating the object and installing it as
the opts slot.
* share/txr/stdlib/getopts.tl (sys:opt-processor): New
slot, opts.
(sys:opt-processor (parse-long, parse-shorts): Drop out
argument; refer to me.opts instead of it.
(sys:opt-processor parse-opts): Don't instantiate opts object
here, and don't pass it to parse-long and parse-shorts which
no longer take that argument. Rather, rely on it already being
installed into the opts slot.
(getopts): Instantiate opts here, and specify it as the opts
slot of the sys:opt-processor object also being instantiated
here.
Diffstat (limited to 'struct.c')
0 files changed, 0 insertions, 0 deletions