lpri.red 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. module lpri; % Functions for printing diagnostic and error messages.
  2. % Author: Anthony C. Hearn.
  3. % Copyright (c) 1987 The RAND Corporation. All rights reserved.
  4. fluid '(!*defn !*echo !*fort !*int !*msg !*nat !*protfg);
  5. global '(cursym!* erfg!* ofl!* outl!*);
  6. symbolic procedure lpri u;
  7. begin
  8. a: if null u then return nil;
  9. prin2 car u;
  10. prin2 " ";
  11. u := cdr u;
  12. go to a
  13. end;
  14. symbolic procedure lpriw (u,v);
  15. begin scalar x;
  16. u := u . if v and atom v then list v else v;
  17. if ofl!* and (!*fort or not !*nat or !*defn) then go to c;
  18. terpri();
  19. a: lpri u;
  20. terpri();
  21. if null x then go to b;
  22. wrs cdr x;
  23. return nil;
  24. b: if null ofl!* then return nil;
  25. c: x := ofl!*;
  26. wrs nil;
  27. go to a
  28. end;
  29. symbolic procedure lprim u;
  30. !*msg and lpriw("***",u);
  31. symbolic procedure lprie u;
  32. begin scalar x;
  33. if !*int then go to a;
  34. x:= !*defn;
  35. !*defn := nil;
  36. a: erfg!* := t;
  37. lpriw ("*****",u);
  38. if null !*int then !*defn := x
  39. end;
  40. symbolic procedure printty u;
  41. begin scalar ofl;
  42. if null !*fort and !*nat then print u;
  43. if null ofl!* then return nil;
  44. ofl := ofl!*;
  45. wrs nil;
  46. print u;
  47. wrs cdr ofl
  48. end;
  49. symbolic procedure rerror(packagename,number,message);
  50. rederr message;
  51. symbolic procedure rederr u;
  52. begin if not !*protfg then lprie u; error1() end;
  53. symbolic procedure symerr(u,v);
  54. begin scalar x;
  55. erfg!* := t;
  56. if numberp cursym!* or not(x := get(cursym!*,'prtch))
  57. then x := cursym!*;
  58. terpri();
  59. if !*echo then terpri();
  60. outl!* := reversip!*(car outl!* . '!$!$!$ . cdr outl!*);
  61. comm1 t;
  62. a: if null outl!* then go to b;
  63. prin2 car outl!*;
  64. outl!* := cdr outl!*;
  65. go to a;
  66. b: terpri();
  67. if null v then rerror('rlisp,5,u)
  68. else rerror('rlisp,6,
  69. x . ("invalid" .
  70. (if u then list("in",u,"statement") else nil)))
  71. end;
  72. symbolic procedure typerr(u,v); rerror('rlisp,6,list(u,"invalid as",v));
  73. endmodule;
  74. end;