From efd63397acfae905ee2d8031fd84d3a821a04fce Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 29 Nov 2019 06:26:37 -0800 Subject: getopts: rename add method to add-opt. The reason for this rename is that add is a public symbol in the usr package, thanks to the build macro. This will interfere with an upcoming feature under which options appear directly as struct slots, defined by symbols. If a user defines an --add option using the symbol add, it will clash with the add method. But add-opt will be sys:add-opt. * share/txr/stdlib/getopts.tl (opts add): Rename to add-opt. (sys:opt-processor parse-long, sys:opt-processor parse-shorts): Follow rename. --- share/txr/stdlib/getopts.tl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/txr/stdlib/getopts.tl b/share/txr/stdlib/getopts.tl index f155b238..d0aaca12 100644 --- a/share/txr/stdlib/getopts.tl +++ b/share/txr/stdlib/getopts.tl @@ -149,7 +149,7 @@ (set o.arg val) (error "opts: cannot set option ~s to ~s: no such option" key val))) -(defmeth opts add (me opt) +(defmeth opts add-opt (me opt) (whenlet ((n opt.desc.short)) (set [me.opt-hash n] opt)) (whenlet ((n opt.desc.long)) @@ -175,14 +175,14 @@ ((null od) (sys:opt-err "unrecognized option: --~a" opt)) ((and arg od.arg-p) - opts.(add (new (sys:opt-parsed opt arg od)))) + opts.(add-opt (new (sys:opt-parsed opt arg od)))) ((stringp arg) (sys:opt-err "option --~a doesn't take an argument" opt)) (od.arg-p (iflet ((arg (pop opts.out-args))) - opts.(add (new (sys:opt-parsed opt arg od))) + opts.(add-opt (new (sys:opt-parsed opt arg od))) (sys:opt-err "option --~a requires an argument" opt))) - (t opts.(add (new (sys:opt-parsed opt arg od)))))))) + (t opts.(add-opt (new (sys:opt-parsed opt arg od)))))))) (defmeth sys:opt-processor parse-shorts (me opts) (each ((o (split-str opts #//))) @@ -195,7 +195,7 @@ (unless opts.out-args (sys:opt-err "option -~a requires an argument" o)) (pop opts.out-args)))) - opts.(add (new (sys:opt-parsed o arg od)))) + opts.(add-opt (new (sys:opt-parsed o arg od)))) (sys:opt-err "unrecognized option: -~a" o)))) (defmeth sys:opt-processor parse-opts (me args) -- cgit v1.2.3