t3.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "a.h"
  10. /*
  11. * Section 3 - page control (mostly irrelevant).
  12. */
  13. /* page offset */
  14. void
  15. po(int o)
  16. {
  17. nr(L(".o0"), getnr(L(".o")));
  18. nr(L(".o"), o);
  19. }
  20. void
  21. r_po(int argc, Rune **argv)
  22. {
  23. if(argc == 1){
  24. po(getnr(L(".o0")));
  25. return;
  26. }
  27. if(argv[1][0] == '+')
  28. po(getnr(L(".o"))+evalscale(argv[1]+1, 'v'));
  29. else if(argv[1][0] == '-')
  30. po(getnr(L(".o"))-evalscale(argv[1]+1, 'v'));
  31. else
  32. po(evalscale(argv[1], 'v'));
  33. }
  34. /* .ne - need vertical space */
  35. /* .mk - mark current vertical place */
  36. /* .rt - return upward */
  37. void
  38. t3init(void)
  39. {
  40. nr(L(".o"), eval(L("1i")));
  41. nr(L(".o0"), eval(L("1i")));
  42. nr(L(".p"), eval(L("11i")));
  43. addreq(L("pl"), r_warn, -1);
  44. addreq(L("bp"), r_nop, -1);
  45. addreq(L("pn"), r_warn, -1);
  46. addreq(L("po"), r_po, -1);
  47. addreq(L("ne"), r_nop, -1);
  48. addreq(L("mk"), r_nop, -1);
  49. addreq(L("rt"), r_warn, -1);
  50. }