• 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
        • Printer
          • Ps
          • Basic-printing
          • Verilog-printing
          • Printing-locally
          • Formatted-printing
          • Accessing-printed-output
          • Vl-printedlist
          • Json-printing
            • Json-encoders
              • Vl-jp-module
              • Vl-jp-warning
              • Vl-jp-constint
              • Vl-jp-vardecl
              • Jp-sym-main
              • Vl-jp-fundecl
              • Vl-jp-taskdecl
              • Vl-jp-modinst
              • Vl-jp-gateinst
              • Vl-jp-portdecl
              • Vl-jp-modport-port
              • Vl-jp-interfaceport
              • Vl-jp-expr
              • Vl-jp-assign
              • Jp-str
                • Jp-col-after-printing-string-aux
                • Vl-jp-warninglist
                • Vl-jp-vardecllist
                • Vl-jp-taskdecllist
                • Vl-jp-regularportlist
                • Vl-jp-portdecllist
                • Vl-jp-plainarglist
                • Vl-jp-paramvaluelist
                • Vl-jp-paramdecllist
                • Vl-jp-paramdecl
                • Vl-jp-packeddimensionlist
                • Vl-jp-namedparamvaluelist
                • Vl-jp-namedarglist
                • Vl-jp-modport-portlist
                • Vl-jp-modinstlist
                • Vl-jp-modelementlist
                • Vl-jp-interfaceportlist
                • Vl-jp-initiallist
                • Vl-jp-genelementlist
                • Vl-jp-gateinstlist
                • Vl-jp-fwdtypedef
                • Vl-jp-fundecllist
                • Vl-jp-enumitemlist
                • Jp-nat
                • Vl-jp-weirdint
                • Vl-jp-repeateventcontrol
                • Vl-jp-regularport
                • Vl-jp-rangelist
                • Vl-jp-portlist
                • Vl-jp-plainarg
                • Vl-jp-namedparamvalue
                • Vl-jp-namedarg
                • Vl-jp-modulelist
                • Vl-jp-modport
                • Vl-jp-location
                • Vl-jp-initial
                • Vl-jp-importlist
                • Vl-jp-import
                • Vl-jp-genvarlist
                • Vl-jp-genvar
                • Vl-jp-gatestrength
                • Vl-jp-gatedelay
                • Vl-jp-eventcontrol
                • Vl-jp-evatomlist
                • Vl-jp-enumitem
                • Vl-jp-enumbasetype
                • Vl-jp-assignlist
                • Vl-jp-alwayslist
                • Vl-jp-always
                • Vl-jp-aliaslist
                • Vl-jp-alias
                • Jp-object
                • Vl-jp-time
                • Vl-jp-sysfunname
                • Vl-jp-range
                • Vl-jp-evatom
                • Vl-jp-delaycontrol
                • Vl-jp-basictype
                • Vl-jp-typename
                • Vl-jp-tagname
                • Vl-jp-string
                • Vl-jp-real
                • Vl-jp-keyguts
                • Vl-jp-id
                • Vl-jp-hidpiece
                • Vl-jp-funname
                • Vl-jp-extint
                • Vl-jp-arguments
                • Vl-jp-paramvalue
                • Vl-jp-packeddimension
                • Vl-jp-maybe-packeddimension
                • Vl-jp-maybe-nettypename
                • Vl-jp-maybe-direction
                • Vl-jp-maybe-cstrength
                • Jp-timeunit
                • Jp-keygutstype
                • Jp-bool
                • Jp-bitlist
                • Jp-bit
                • Jp-bignat
                • Jp-basictypekind
                • Vl-jp-randomqualifier
                • Vl-jp-port
                • Vl-jp-nettypename
                • Vl-jp-maybe-gatedelay
                • Vl-jp-maybe-exprtype
                • Vl-jp-lifetime
                • Vl-jp-gatetype
                • Vl-jp-exprtype
                • Vl-jp-evatomtype
                • Vl-jp-dstrength
                • Vl-jp-direction
                • Vl-jp-deassign-type
                • Vl-jp-cstrength
                • Vl-jp-coretypename
                • Vl-jp-casetype
                • Vl-jp-casecheck
                • Vl-jp-assign-type
                • Vl-jp-alwaystype
                • Jp-maybe-string
                • Jp-maybe-nat
                • Jp-sym
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Jp-str

    Jp-col-after-printing-string-aux

    Fast way to figure out the new column after printing a JSON string with proper encoding.

    Signature
    (jp-col-after-printing-string-aux col x n xl) → new-col
    Arguments
    col — Current column we're at.
        Guard (natp col).
    x — String we're about to print, not yet reversed.
        Guard (stringp x).
    n — Current position in X.
        Guard (natp n).
    xl — Pre-computed length of X.
        Guard (natp xl).
    Returns
    new-col — Type (natp new-col).

    Definitions and Theorems

    Function: jp-col-after-printing-string-aux

    (defun jp-col-after-printing-string-aux (col x n xl)
      (declare (xargs :guard (and (natp col)
                                  (stringp x)
                                  (natp n)
                                  (natp xl))))
      (declare (type (integer 0 *) col n xl)
               (type string x))
      (declare (xargs :guard (and (<= n xl) (= xl (length x)))))
      (let ((__function__ 'jp-col-after-printing-string-aux))
        (declare (ignorable __function__))
        (b* (((when (mbe :logic (zp (- (nfix xl) (nfix n)))
                         :exec (= n xl)))
              (lnfix col))
             ((the (unsigned-byte 8) code)
              (char-code (char x n)))
             ((when (or (<= code 31) (>= code 127)))
              (jp-col-after-printing-string-aux (+ 6 col)
                                                x (+ 1 (lnfix n))
                                                xl)))
          (jp-col-after-printing-string-aux (+ 1 col)
                                            x (+ 1 (lnfix n))
                                            xl))))

    Theorem: natp-of-jp-col-after-printing-string-aux

    (defthm natp-of-jp-col-after-printing-string-aux
      (b* ((new-col (jp-col-after-printing-string-aux col x n xl)))
        (natp new-col))
      :rule-classes :type-prescription)