clrend.red 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. module rend; % CL REDUCE "back-end".
  2. % Copyright (c) 1993 RAND. All Rights Reserved.
  3. fluid '(lispsystem!*);
  4. lispsystem!* := '(cl);
  5. symbolic procedure delcp u;
  6. % Returns true if U is a semicolon, dollar sign, or other delimiter.
  7. % This definition replaces one in the BOOT file.
  8. u eq '!; or u eq '!$;
  9. symbolic procedure seprp u;
  10. % Returns true if U is a blank or other separator (eg, tab or ff).
  11. % This definition replaces one in the BOOT file.
  12. u eq '! or u eq '! or u eq !$eol!$;
  13. % Common LISP specific definitions.
  14. flag('(load),'opfn);
  15. % The next one is added since it is a familiar name for this operation.
  16. symbolic procedure prop u; symbol!-plist u;
  17. % A machine independent traceset. Tr and untr are defined in clend.lisp.
  18. symbolic procedure traceset1 u;
  19. if atom u then u
  20. else if car u eq 'setq
  21. then list('progn,
  22. list('prin2,mkquote cadr u),
  23. '(prin2 " := "),
  24. u,
  25. list('prin2t,cadr u))
  26. else traceset1 car u . traceset1 cdr u;
  27. symbolic procedure traceset u;
  28. if get(u,'original!-defn) then lprim list(u,"already traceset")
  29. else (if not x or not(eqcar(cdr x,'lambda)
  30. or eqcar(cdr x,'lambda!-closure))
  31. then lprim list(u,"has wrong form for traceset")
  32. else <<put(u,'original!-defn,x);
  33. remd u; % To prevent spurious messages.
  34. putd(u,car x,traceset1 cdr x)>>)
  35. where x=getd u;
  36. symbolic procedure untraceset u;
  37. (if x
  38. then <<remprop(u,'original!-defn);
  39. remd u; % To prevent spurious messages.
  40. putd(u,car x,cdr x)>>
  41. else lprim list(u,"not traceset"))
  42. where x=get(u,'original!-defn);
  43. symbolic procedure trst u; for each x in u do traceset x;
  44. symbolic procedure untrst u; for each x in u do untraceset x;
  45. deflist('((tr rlis) (untr rlis) (trst rlis) (untrst rlis)),'stat);
  46. % The following function is necessary in Common Lisp startup sequence,
  47. % since initial packages are not loaded with load-package.
  48. symbolic procedure fixup!-packages!*;
  49. for each x in '(rlisp clrend entry poly arith alg mathpr) do
  50. if not(x memq loaded!-packages!*)
  51. then <<loaded!-packages!* := x . loaded!-packages!*;
  52. if (x := get(x,'patchfn)) then eval list x>>;
  53. % The FACTOR module also requires a definition for GCTIME. Since this
  54. % is currently undefined in CL, we provide the following definition.
  55. symbolic procedure gctime; 0;
  56. % yesp1 is more or less equivalent to y-or-n-p.
  57. remflag('(yesp1),'lose);
  58. symbolic procedure yesp1; y!-or!-n!-p();
  59. flag('(yesp1),'lose);
  60. % The Common Lisp TOKEN function returns tokens rather than characters,
  61. % so CEDIT must be modified.
  62. remflag('(cedit),'lose);
  63. symbolic procedure cedit n;
  64. begin scalar x,ochan;
  65. if null terminalp() then rederr "Edit must be from a terminal";
  66. ochan := wrs nil;
  67. if n eq 'fn then x := reversip crbuf!*
  68. else if null n
  69. then if null crbuflis!*
  70. then <<statcounter := statcounter-1;
  71. rederr "No previous entry">>
  72. else x := cdar crbuflis!*
  73. else if (x := assoc(car n,crbuflis!*))
  74. then x := cedit0(cdr x,car n)
  75. else <<statcounter := statcounter-1;
  76. rederr list("Entry",car n,"not found")>>;
  77. crbuf!* := nil;
  78. % Following line changed for CL version.
  79. x := foreach y in x conc explodec y;
  80. terpri();
  81. editp x;
  82. terpri();
  83. x := cedit1 x;
  84. wrs ochan;
  85. if x eq 'failed then nil
  86. % Following changed for CL version.
  87. else
  88. crbuf1!* := compress(append('(!") ,
  89. append(x, '(!" ))));
  90. end;
  91. flag('(cedit),'lose);
  92. % FLOOR is already defined.
  93. flag('(floor),'lose);
  94. % CL doesn't like '(function ...) in defautoload (module entry).
  95. remflag('(mkfunction),'lose);
  96. smacro procedure mkfunction u; mkquote u;
  97. flag('(mkfunction),'lose);
  98. % This function is used in Rlisp '88.
  99. symbolic procedure igetv(u,v); getv(u,v);
  100. endmodule;
  101. end;