fluid-global.red 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. %
  2. % FLUID-GLOBAL.RED - Fluid and Global declarations
  3. %
  4. % Author: Eric Benson
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 17 August 1981
  9. % Copyright (c) 1981 University of Utah
  10. %
  11. % <PSL.INTERP>FLUID-GLOBAL.RED.3, 10-Sep-82 09:18:04, Edit by BENSON
  12. % Uses indicator VARTYPE instead of TYPE
  13. % <PSL.INTERP>FLUID-GLOBAL.RED.3, 22-Jan-82 12:35:25, Edit by BENSON
  14. % GlobalP now only checks for variables, not functions
  15. % The functions dealing with FLUID and GLOBAL declarations use the property
  16. % list indicator TYPE, which is also used by PUTD and GETD.
  17. % Not true anymore!
  18. % Non-Standard Lisp functions used:
  19. % ErrorPrintF -- in IO.RED
  20. CompileTime flag('(DeclareFluidOrGlobal DeclareFluidOrGlobal1),
  21. 'InternalFunction);
  22. lisp procedure DeclareFluidOrGlobal(IDList, FG);
  23. for each U in IDList do DeclareFluidOrGlobal1(U, FG);
  24. lisp procedure DeclareFluidOrGlobal1(U, FG);
  25. if not IDP U then NIL else
  26. begin scalar X;
  27. X := get(U, 'VARTYPE);
  28. return if null X then
  29. << put(U, 'VARTYPE, FG);
  30. if UnBoundP U then Set(U, NIL) >>
  31. else if X eq FG then NIL
  32. else ErrorPrintF("*** %p %r cannot become %p",
  33. X, U, FG);
  34. end;
  35. lisp procedure Fluid IDList; %. Declare all in IDList as fluid vars
  36. DeclareFluidOrGlobal(IDList, 'FLUID);
  37. lisp procedure Fluid1 U; %. Declare U fluid
  38. DeclareFluidOrGlobal1(U, 'FLUID);
  39. lisp procedure FluidP U; %. Is U a fluid variable?
  40. get(U, 'VARTYPE) = 'FLUID;
  41. lisp procedure Global IDList; %. Declare all in IDList as global vars
  42. DeclareFluidOrGlobal(IDList, 'GLOBAL);
  43. lisp procedure Global1 U; %. Declare U global
  44. DeclareFluidOrGlobal1(U, 'GLOBAL);
  45. lisp procedure GlobalP U; %. Is U a global variable
  46. get(U, 'VARTYPE) = 'GLOBAL;
  47. lisp procedure UnFluid IDList; %. Undeclare all in IDList as fluid
  48. for each U in IDList do UnFluid1 U;
  49. lisp procedure UnFluid1 U;
  50. if FluidP U then RemProp(U, 'VARTYPE);
  51. END;