tools/typelist.R

txt <- readLines('tools/typelist.h.in')
m <- regexpr("CURLOPT_\\w+", txt)
opts <- regmatches(txt, m)
i <- match(opts, curl:::curl_symbol_data$name)
table <- curl:::curl_symbol_data[i, ]
for(i in seq_len(nrow(table))){
  name <- table$name[i]
  value <- table$value[i]
  txt <- gsub(paste0(name, " "), sprintf("/*%s*/ %d ", name, value), fixed = TRUE, txt)
}
#txt <- gsub('[ ]+\\\\', '  \\\\', txt)
header <- "/* This file is autogenerated from typelist.h.in */"
writeLines(c(header, txt), "src/typelist.h")
jeroenooms/curl documentation built on March 28, 2024, 2:40 a.m.