Paper/visitBarOnly.R

library(RCIndex)
genVisitor = 
function()
{  
    inBar = FALSE
    
    update =
      function(cur, parent) {
        if(cur$kind == CXCursor_FunctionDecl) {
          if(inBar) {
            cat("quitting having reached the routine", getName(cur), "\n") 
            return(CXChildVisit_Break)
          }
          
          if(getName(cur) == "bar") {
            inBar <<- TRUE
            return(CXChildVisit_Recurse)
          } else
            return(CXChildVisit_Continue)
        } else {
             # processing the cursors within the bar routine.
          print(cur$kind)
          return(CXChildVisit_Recurse)
        }
      }
}
if(FALSE) {
 visitTU("../inst/exampleCode/mutateArg.c",  genVisitor())
}
omegahat/RClangSimple documentation built on Aug. 17, 2024, 10:23 a.m.