onoff.red 965 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. %
  2. % ONOFF.RED - Macros for setting/resetting flags, with SIMPFG hook
  3. %
  4. % Author: Martin Griss
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 21 July 1982
  9. % Copyright (c) 1982 University of Utah
  10. %
  11. % ONOFF.RED - ON and OFF for Bare PSL
  12. % MLG, from PU:RLISP-PARSER.RED
  13. lisp procedure OnOff!*(IdList, U);
  14. %
  15. % IdList is list of variables without !* prefix, U is T or NIL
  16. %
  17. begin scalar Y;
  18. for each X in IdList do
  19. if not IDP X then NonIDError(X, if null U then 'OFF else 'ON)
  20. else
  21. << Set(MkFlagVar X, U);
  22. if (Y := Atsoc(U, get(X, 'SIMPFG))) then Eval second Y >>;
  23. end;
  24. lisp procedure MkFlagVar U; % Should be redefined in PACKAGE.RED
  25. Intern Concat("*", ID2String U); % to lambda-bind current pkg to GLOBAL
  26. macro procedure ON U;
  27. list('OnOff!*, MkQuote cdr U, T);
  28. macro procedure OFF U;
  29. list('OnOff!*, MkQuote cdr U, NIL);
  30. flag('(ON OFF), 'IGNORE);
  31. END;