• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Std/io
      • Oslib
      • Bridge
      • Clex
        • Example-lexer
        • Sin
          • Strin-p
          • Sin$c
            • Line-and-column-tracking
              • Lc-nthcdr-str
              • Line-after-nthcdr
              • Col-after-nthcdr
              • Lc-nthcdr
              • Lc-nthcdr-str-fast
              • Sin$c-okp
              • Sin$c-init
              • Sin$c-nthcdr
              • Sin$c-cdr
              • Sin$c-firstn
              • Sin$c-count-charset
              • Sin$c-nth
              • Sin$c-matches-p
              • Sin$c-imatches-p
              • Sin$c-find
              • Sin$c-len
              • Sin$c-endp
              • Sin$c-car
              • Sin$corr
              • Sin$c-get-line
              • Sin$c-get-file
              • Sin$c-get-col
          • Matching-functions
          • Def-sin-progress
        • Tshell
        • Unsound-eval
        • Hacker
        • ACL2s-interface
        • Startup-banner
        • Command-line
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Line-and-column-tracking

    Lc-nthcdr-str-fast

    Fixnum optimized version of lc-nthcdr-str.

    Signature
    (lc-nthcdr-str-fast n x pos xl line col) → (mv * * *)
    Arguments
    n — How many characters to advance.
        Guard (natp n).
    x — String we're processing.
        Guard (stringp x).
    pos — Current index into x.
        Guard (natp pos).
    xl — Pre-computed length of x.
        Guard (equal xl (length x)).
    line — Current line number.
        Guard (natp line).
    col — Current column number.
        Guard (natp col).

    Definitions and Theorems

    Function: lc-nthcdr-str-fast

    (defun lc-nthcdr-str-fast (n x pos xl line col)
     (declare (xargs :guard (and (natp n)
                                 (stringp x)
                                 (natp pos)
                                 (natp line)
                                 (natp col)
                                 (equal xl (length x)))))
     (declare (type (unsigned-byte 60)
                    pos xl line col n)
              (type string x))
     (declare (xargs :guard (and (<= pos xl)
                                 (<= line pos)
                                 (<= col pos))))
     (let ((__function__ 'lc-nthcdr-str-fast))
      (declare (ignorable __function__))
      (mbe
        :logic
        (lc-nthcdr-str n x pos xl line col)
        :exec
        (b* (((when (or (zp n) (eql pos xl)))
              (mv pos line col))
             ((the character char1) (char x pos))
             ((the (unsigned-byte 60) n) (- n 1))
             ((the (unsigned-byte 60) pos)
              (+ 1 pos)))
          (if (eql char1 #\Newline)
              (lc-nthcdr-str-fast n x pos
                                  xl (the (unsigned-byte 60) (+ 1 line))
                                  0)
            (lc-nthcdr-str-fast n x pos xl line
                                (the (unsigned-byte 60) (+ 1 col))))))))