eval-when.red 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. %
  2. % EVAL-WHEN.RED - Funny business to make things happen at different times
  3. %
  4. % Author: Eric Benson
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 30 August 1981
  9. % Copyright (c) 1981 University of Utah
  10. %
  11. % Functions flagged IGNORE are evaluated immediately when invoked at the top
  12. % level while compiling to a file. Those flagged EVAL are evaled immediately
  13. % and also passed to the file. These functions are defined to make those
  14. % actions more visible and mnemonic.
  15. macro procedure CommentOutCode U; %. Comment out a single expression
  16. NIL;
  17. lisp procedure CompileTime U; %. Evaluate at compile time only
  18. U; % just return the already evaluated argument
  19. flag('(CommentOutCode CompileTime), 'IGNORE);
  20. % The functions above need only be present at compile time. Those below must
  21. % be present at both compile and load time to be effective.
  22. lisp procedure BothTimes U; %. Evaluate at compile and load time
  23. U;
  24. flag('(BothTimes), 'EVAL);
  25. lisp procedure LoadTime U; %. Evaluate at load time only
  26. U;
  27. PutD('StartupTime, 'EXPR, cdr GetD 'LoadTime);
  28. % StartupTime is kernel hack
  29. RemFlag('(LoadTime), 'IGNORE); % just to be sure it doesn't
  30. RemFlag('(LoadTime), 'EVAL); % happen until load time
  31. END;