show_std.awk 605 B

123456789101112131415161718
  1. {
  2. buf = $0;
  3. match(buf, "std::[a-z_]*");
  4. while (RSTART > 0)
  5. {
  6. symbol = substr(buf, RSTART + 5, RLENGTH - 5);
  7. if (symbol == "map" || symbol == "string" || symbol == "vector")
  8. symbol = "#include <" symbol ">";
  9. else if (symbol == "binary_search" || symbol == "lower_bound" || symbol == "min" || symbol == "max" || symbol == "sort" || symbol == "unique")
  10. symbol = "#include <algorithm>";
  11. else if (symbol == "make_pair" || symbol == "pair")
  12. symbol = "#include <utility>";
  13. print symbol;
  14. buf = substr(buf, RSTART + RLENGTH);
  15. match(buf, "std::[a-z_]*");
  16. }
  17. }