buffer-position.sl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %
  3. % BUFFER-POSITION.SL - Buffer Position Objects
  4. %
  5. % Author: Alan Snyder
  6. % Hewlett-Packard/CRC
  7. % Date: 6 July 1982
  8. %
  9. % This file implements objects that store buffer positions.
  10. %
  11. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  12. (CompileTime (load fast-int))
  13. (de buffer-position-create (line-number column-number)
  14. (cons line-number column-number))
  15. (de buffer-position-line (bp)
  16. (car bp))
  17. (de buffer-position-column (bp)
  18. (cdr bp))
  19. (de buffer-position-equal (bp1 bp2)
  20. (and (= (car bp1) (car bp2)) (= (cdr bp1) (cdr bp2))))
  21. (de buffer-position-compare (bp1 bp2)
  22. (cond ((< (buffer-position-line bp1) (buffer-position-line bp2)) -1)
  23. ((> (buffer-position-line bp1) (buffer-position-line bp2)) 1)
  24. ((< (buffer-position-column bp1) (buffer-position-column bp2)) -1)
  25. ((> (buffer-position-column bp1) (buffer-position-column bp2)) 1)
  26. (t 0)))
  27. (de buffer-position-lessp (bp1 bp2)
  28. (<= (buffer-position-compare bp1 bp2) 0))