You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
576 B

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace SuperBASIC
  5. {
  6. class Library
  7. {
  8. internal List<IFunction> functions;
  9. internal List<int> arities;
  10. internal Dictionary<string, int> nameResolution;
  11. public Library()
  12. {
  13. functions = new List<IFunction>();
  14. arities = new List<int>();
  15. nameResolution = new Dictionary<string, int>();
  16. }
  17. public int AddFunction(IFunction fn, int arity, string name)
  18. {
  19. int idx = functions.Count;
  20. functions.Add(fn);
  21. arities.Add(arity);
  22. nameResolution[name] = idx;
  23. return idx;
  24. }
  25. }
  26. }