R/utils.get.fun.name.R

Defines functions .get.fun.name .test.get.fun.name

#..................................................................
#
# Esta unidad funciona MAL
#
# NO USAR DE MOMENTO, la idea está ahí pero no consigo generalizarla bien
#
#..................................................................





.test.get.fun.name <- function(exclude.print = TRUE, DEBUG = F) {
  print(.get.fun.name(exclude.print=exclude.print,DEBUG = DEBUG))
}


.get.fun.name <- function(exclude.print = TRUE, DEBUG = FALSE) {

  callingFun = as.list(sys.call(-1))[[1]]
  calledFun = as.list(sys.call())[[1]]

    print(callingFun)
  if (exclude.print & callingFun == "print") callingFun = as.list(sys.call(-2))[[1]]

  # callingFun <- deparse(callingFun)
  # if(is.list(callingFun) | is.call(callingFun)) {
  #   # callingFun <- callingFun[[3]]
  #
  # }
  if(DEBUG) {
    print(class(callingFun))
    message(paste(deparse(callingFun), " is calling ", calledFun, sep=""))
  }


  return(callingFun)

  # args <- formals(.current.call)
  # args$... <- NULL
}
feranpre/feR documentation built on Nov. 22, 2022, 2:29 a.m.