generate_gl_func_alias.py 747 B

1234567891011121314151617181920212223242526272829
  1. import os
  2. from sys import argv
  3. sc_dir = os.path.dirname(os.path.realpath(argv[0]))
  4. os.chdir(sc_dir)
  5. hg_tag = "PLTF_GL_FUNC_ALIAS_H_"
  6. lines: list[str] = [
  7. f"#ifndef {hg_tag}\n",
  8. f"#define {hg_tag}\n"
  9. ]
  10. with open("./src/pltf/internal/gl_func_decl.h", "r") as f:
  11. header = f.readlines()
  12. for h_line in header:
  13. h_split = h_line.split(" ")
  14. for token in h_split:
  15. if token[0] == "g" and token[1] == "l":
  16. token = token.removesuffix(");")
  17. line = f"#define {token} pltf_{token}\n"
  18. lines.append(line)
  19. lines.append(f"#endif // {hg_tag}\n")
  20. # for line in lines:
  21. # print(line)
  22. with open("./src/pltf/internal/gl_func_alias.h", "w") as f:
  23. f.writelines(lines)