XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P4 P4
    • 12
    • None
    • hotspot
    • None
    • b18

      Tranform the assignments from ifs.

      Here is the script used:

      {
              macros[1] = "NSK_VERIFY"
              macros[2] = "NSK_JNI_VERIFY"
              macros[3] = "NSK_JVMTI_VERIFY"

              indentation = gensub(/([ ]*).*/, "\\1" , "g", $0)

              pattern = ".*NULL)(.*)"
              suffix = gensub(pattern, "\\1" , "g", $0)

              comparator = gensub(/.* (..) NULL.*/, "\\1", "g", $0)

              for (m in macros) {
                      macro = macros[m]

                      pattern = macro "((.* = .* .. NULL))"
                      if ($0 ~ pattern) {
                              pattern = "(.*" macro "\\().*"
                              prefix = gensub(pattern, "\\1", "g", $0)

                              pattern = ".*" macro "\\(\\((.*)\\) .. NULL)).*"
                              assignment = gensub(pattern, "\\1" , "g", $0)

                              dest = gensub(/(.*) =.*/, "\\1" , "g", assignment)

                              print indentation assignment ";"
                              print prefix dest " " comparator " NULL)" suffix
                              next
                      }
              }

              if ($0 ~ "((.* = .* .. NULL))") {
                      assignment = gensub(/.*\(\((.*)) .. NULL).*/, "\\1" , "g", $0)
                      prefix = gensub(/(.*if \().*/, "\\1", "g", $0)

                      dest = gensub(/(.*) =.*/, "\\1" , "g", assignment)

                      print indentation assignment ";"
                      print prefix dest " " comparator " NULL)" suffix
                      next
              }

              # No macro...
              print $0
      }

            jcbeyler Jean Christophe Beyler
            jcbeyler Jean Christophe Beyler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: