• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
        • Mlib
        • Server
        • Kit
          • Vl-model
          • Vl-json
          • Vl-gather
            • Vl-gather-opts-p
              • Parse-vl-gather-opts
                • Parse-vl-gather-opts-long
                  • Parse-vl-gather-opts-aux
                  • Parse-vl-gather-opts-bundle
                  • Parse-vl-gather-opts-short->long-list
                  • Parse-vl-gather-opts-short->long
                • Vl-gather-opts
                • Make-vl-gather-opts
                • Change-vl-gather-opts
                • Honsed-vl-gather-opts
                • Make-honsed-vl-gather-opts
                • *vl-gather-opts-usage*
                • Vl-gather-opts->strict
                • Vl-gather-opts->start-files
                • Vl-gather-opts->search-path
                • Vl-gather-opts->search-exts
                • Vl-gather-opts->readme
                • Vl-gather-opts->output
                • Vl-gather-opts->mem
                • Vl-gather-opts->include-dirs
                • Vl-gather-opts->help
                • Vl-gather-opts->edition
                • Vl-gather-opts->defines
            • Vl-server
            • Vl-pp
            • Vl-lint
            • Vl-main
            • Vl-toolkit-other-command
            • Vl-help
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Parse-vl-gather-opts

    Parse-vl-gather-opts-long

    Signature
    (parse-vl-gather-opts-long getopt::longname getopt::explicit-val 
                               args getopt::acc getopt::seen) 
     
      → 
    (mv getopt::errmsg getopt::acc rest)
    Arguments
    getopt::longname — Longname we've just found, e.g., "foo" if we've just seen --foo=bar.
        Guard (stringp getopt::longname).
    getopt::explicit-val — Any explicit value passed to this option, e.g., "bar" if we've just seen --foo=bar, or NIL if we've just seen --foo.
        Guard (or (not getopt::explicit-val) (stringp getopt::explicit-val)).
    args — Remaining arguments past longname.
        Guard (string-listp args).
    getopt::acc — Structure we're updating.
        Guard (vl-gather-opts-p getopt::acc).
    getopt::seen — List of longnames that we've seen so far.
        Guard (string-listp getopt::seen).
    Returns
    getopt::errmsg — NIL on success or an error message.
    getopt::acc — Updated structure.
        Type (vl-gather-opts-p getopt::acc), given (force (vl-gather-opts-p getopt::acc)).
    rest — Rest after this one.
        Type (string-listp rest), given (force (string-listp args)).

    Definitions and Theorems

    Function: parse-vl-gather-opts-long

    (defun parse-vl-gather-opts-long
           (getopt::longname getopt::explicit-val
                             args getopt::acc getopt::seen)
     (declare (xargs :guard (and (stringp getopt::longname)
                                 (or (not getopt::explicit-val)
                                     (stringp getopt::explicit-val))
                                 (string-listp args)
                                 (vl-gather-opts-p getopt::acc)
                                 (string-listp getopt::seen))))
     (let ((__function__ 'parse-vl-gather-opts-long))
      (declare (ignorable __function__))
      (cond
       ((equal getopt::longname "help")
        (b* (((when (member-equal getopt::longname getopt::seen))
              (mv (msg "Option --~s0 given multiple times"
                       getopt::longname)
                  getopt::acc args))
             ((mv getopt::err value rest)
              (getopt::parse-plain (cat "--" getopt::longname)
                                   getopt::explicit-val args))
             ((when getopt::err)
              (mv getopt::err getopt::acc args))
             (getopt::acc (change-vl-gather-opts getopt::acc
                                                 :help value)))
          (mv nil getopt::acc rest)))
       ((equal getopt::longname "readme")
        (b* (((when (member-equal getopt::longname getopt::seen))
              (mv (msg "Option --~s0 given multiple times"
                       getopt::longname)
                  getopt::acc args))
             ((mv getopt::err value rest)
              (getopt::parse-plain (cat "--" getopt::longname)
                                   getopt::explicit-val args))
             ((when getopt::err)
              (mv getopt::err getopt::acc args))
             (getopt::acc (change-vl-gather-opts getopt::acc
                                                 :readme value)))
          (mv nil getopt::acc rest)))
       ((equal getopt::longname "output")
        (b* (((when (member-equal getopt::longname getopt::seen))
              (mv (msg "Option --~s0 given multiple times"
                       getopt::longname)
                  getopt::acc args))
             ((mv getopt::err value rest)
              (getopt::parse-string (cat "--" getopt::longname)
                                    getopt::explicit-val args))
             ((when getopt::err)
              (mv getopt::err getopt::acc args))
             (getopt::acc (change-vl-gather-opts getopt::acc
                                                 :output value)))
          (mv nil getopt::acc rest)))
       ((equal getopt::longname "search")
        (b*
         (((mv getopt::err value rest)
           (getopt::parse-string (cat "--" getopt::longname)
                                 getopt::explicit-val args))
          ((when getopt::err)
           (mv getopt::err getopt::acc args))
          (getopt::old-value (vl-gather-opts->search-path getopt::acc))
          (value (acl2::rcons value getopt::old-value))
          (getopt::acc (change-vl-gather-opts getopt::acc
                                              :search-path value)))
         (mv nil getopt::acc rest)))
       ((equal getopt::longname "incdir")
        (b*
         (((mv getopt::err value rest)
           (getopt::parse-string (cat "--" getopt::longname)
                                 getopt::explicit-val args))
          ((when getopt::err)
           (mv getopt::err getopt::acc args))
          (getopt::old-value (vl-gather-opts->include-dirs getopt::acc))
          (value (acl2::rcons value getopt::old-value))
          (getopt::acc (change-vl-gather-opts getopt::acc
                                              :include-dirs value)))
         (mv nil getopt::acc rest)))
       ((equal getopt::longname "searchext")
        (b*
         (((mv getopt::err value rest)
           (getopt::parse-string (cat "--" getopt::longname)
                                 getopt::explicit-val args))
          ((when getopt::err)
           (mv getopt::err getopt::acc args))
          (getopt::old-value (vl-gather-opts->search-exts getopt::acc))
          (value (acl2::rcons value getopt::old-value))
          (getopt::acc (change-vl-gather-opts getopt::acc
                                              :search-exts value)))
         (mv nil getopt::acc rest)))
       ((equal getopt::longname "define")
        (b* (((mv getopt::err value rest)
              (getopt::parse-string (cat "--" getopt::longname)
                                    getopt::explicit-val args))
             ((when getopt::err)
              (mv getopt::err getopt::acc args))
             (getopt::old-value (vl-gather-opts->defines getopt::acc))
             (value (cons value getopt::old-value))
             (getopt::acc (change-vl-gather-opts getopt::acc
                                                 :defines value)))
          (mv nil getopt::acc rest)))
       ((equal getopt::longname "edition")
        (b* (((when (member-equal getopt::longname getopt::seen))
              (mv (msg "Option --~s0 given multiple times"
                       getopt::longname)
                  getopt::acc args))
             ((mv getopt::err value rest)
              (vl-parse-edition (cat "--" getopt::longname)
                                getopt::explicit-val args))
             ((when getopt::err)
              (mv getopt::err getopt::acc args))
             (getopt::acc (change-vl-gather-opts getopt::acc
                                                 :edition value)))
          (mv nil getopt::acc rest)))
       ((equal getopt::longname "strict")
        (b* (((when (member-equal getopt::longname getopt::seen))
              (mv (msg "Option --~s0 given multiple times"
                       getopt::longname)
                  getopt::acc args))
             ((mv getopt::err value rest)
              (getopt::parse-plain (cat "--" getopt::longname)
                                   getopt::explicit-val args))
             ((when getopt::err)
              (mv getopt::err getopt::acc args))
             (getopt::acc (change-vl-gather-opts getopt::acc
                                                 :strict value)))
          (mv nil getopt::acc rest)))
       ((equal getopt::longname "mem")
        (b* (((when (member-equal getopt::longname getopt::seen))
              (mv (msg "Option --~s0 given multiple times"
                       getopt::longname)
                  getopt::acc args))
             ((mv getopt::err value rest)
              (getopt::parse-pos (cat "--" getopt::longname)
                                 getopt::explicit-val args))
             ((when getopt::err)
              (mv getopt::err getopt::acc args))
             (getopt::acc (change-vl-gather-opts getopt::acc
                                                 :mem value)))
          (mv nil getopt::acc rest)))
       (t (mv (msg "Unrecognized option --~s0"
                   getopt::longname)
              getopt::acc args)))))

    Theorem: vl-gather-opts-p-of-parse-vl-gather-opts-long.acc

    (defthm vl-gather-opts-p-of-parse-vl-gather-opts-long.acc
      (implies (force (vl-gather-opts-p getopt::acc))
               (b* (((mv getopt::?errmsg
                         getopt::?acc common-lisp::?rest)
                     (parse-vl-gather-opts-long
                          getopt::longname getopt::explicit-val
                          args getopt::acc getopt::seen)))
                 (vl-gather-opts-p getopt::acc)))
      :rule-classes :rewrite)

    Theorem: string-listp-of-parse-vl-gather-opts-long.rest

    (defthm string-listp-of-parse-vl-gather-opts-long.rest
      (implies (force (string-listp args))
               (b* (((mv getopt::?errmsg
                         getopt::?acc common-lisp::?rest)
                     (parse-vl-gather-opts-long
                          getopt::longname getopt::explicit-val
                          args getopt::acc getopt::seen)))
                 (string-listp rest)))
      :rule-classes :rewrite)

    Theorem: parse-vl-gather-opts-long-makes-progress

    (defthm parse-vl-gather-opts-long-makes-progress
     (<=
      (len
       (mv-nth
        2
        (parse-vl-gather-opts-long getopt::longname getopt::explicit-val
                                   args getopt::acc getopt::seen)))
      (len args))
     :rule-classes ((:rewrite) (:linear)))