defconst.red 900 B

12345678910111213141516171819202122232425262728293031323334
  1. %
  2. % DEFCONST.RED - Definition and use of symbolic constants
  3. %
  4. % Author: Eric Benson
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 8 January 1982
  9. % Copyright (c) 1982 University of Utah
  10. %
  11. % DefConst is used to define a value for a name, to be used in const(Name)
  12. macro procedure DefConst Form; %. DefConst(Name, Value, ...);
  13. begin scalar ResultForm;
  14. ResultForm := list 'ProgN;
  15. Form := cdr Form;
  16. while not null Form do
  17. << ResultForm := list('EvDefConst, MkQuote car Form, MkQuote cadr Form)
  18. . ResultForm;
  19. Form := cddr Form >>;
  20. return ReversIP ResultForm;
  21. end;
  22. flag('(DefConst), 'Eval);
  23. lisp procedure EvDefConst(ConstName, ConstValue);
  24. put(ConstName, 'Const, ConstValue);
  25. macro procedure Const Form;
  26. get(cadr Form, 'Const) or StdError BldMsg("Unknown const form %r", Form);
  27. END;