ppSubroutine.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Filename: ppSubroutine.h
  2. // Created by: drose (10Oct00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef PPSUBROUTINE_H
  6. #define PPSUBROUTINE_H
  7. #include "ppremake.h"
  8. #include <vector>
  9. #include <map>
  10. ///////////////////////////////////////////////////////////////////
  11. // Class : PPSubroutine
  12. // Description : This represents a named subroutine defined via the
  13. // #defsub .. #end sequence that may be invoked at any
  14. // time via #call. All subroutine definitions are
  15. // global.
  16. ////////////////////////////////////////////////////////////////////
  17. class PPSubroutine {
  18. public:
  19. vector<string> _formals;
  20. vector<string> _lines;
  21. public:
  22. static void define_sub(const string &name, PPSubroutine *sub);
  23. static const PPSubroutine *get_sub(const string &name);
  24. static void define_func(const string &name, PPSubroutine *sub);
  25. static const PPSubroutine *get_func(const string &name);
  26. typedef map<string, PPSubroutine *> Subroutines;
  27. static Subroutines _subroutines;
  28. static Subroutines _functions;
  29. };
  30. #endif