glovars.c 485 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdlib.h>
  2. #include "objects.h"
  3. #include "glovars.h"
  4. struct global *glovars = NULL;
  5. struct global *
  6. glo_lookup(scm nm)
  7. {
  8. struct global *g;
  9. if (!glovars) return NULL;
  10. for(g = glovars; g; g = g->next) {
  11. if (g->name == nm)
  12. return g;
  13. }
  14. return NULL;
  15. }
  16. void
  17. glo_define(scm name, scm arity, scm value)
  18. {
  19. struct global *link = malloc(sizeof(struct global));
  20. link->val = value;
  21. link->name = name;
  22. link->arity = arity;
  23. link->next = glovars;
  24. glovars = link;
  25. }