home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / mutt / builtin / case.mut < prev    next >
Text File  |  1995-01-14  |  1KB  |  53 lines

  1. ;; case.mut
  2. ;; Case Conversion Routines.
  3. ;; Should be the same routine names and functionality as GNU Emacs.
  4. ;; Differences:
  5. ;;   If a mark is in the region being cased, it will be moved to the front
  6. ;;    of the region because the region is deleted ie I don't change the
  7. ;;    text in place.
  8. ;; C Durland 2/91    Public Domain
  9.  
  10. (include me.mh)
  11.  
  12. (const
  13.   LOWER-CASE    0
  14.   UPPER-CASE    1
  15.   CAPITALIZE    2
  16. )
  17.  
  18. (defun
  19.   case-region (int op mark1 mark2) HIDDEN
  20.   {
  21.     (int bag)
  22.     (byte type)(small-int left-edge width height)(int size)    ;; RegionInfo
  23.  
  24.     (region-stats (loc type) mark1 mark2 TRUE)
  25.  
  26.     (bag (create-bag))
  27.     (append-to-bag bag APPEND-CHARACTERS size)
  28.     (case-bag op bag)
  29.     (arg-prefix size)(delete-character)
  30.     (insert-bag bag)
  31.     (free-bag bag)
  32.   }
  33.   downcase-region   { (case-region LOWER-CASE THE-DOT THE-MARK) }
  34.   upcase-region        { (case-region UPPER-CASE THE-DOT THE-MARK) }
  35.   capitalize-region { (case-region CAPITALIZE THE-DOT THE-MARK) }
  36. )
  37.  
  38. (defun
  39.   case-word (int n op)
  40.   {
  41.     (int mark1 mark2)
  42.  
  43.     (mark1 (create-mark)) (mark2 (create-mark))
  44.     (set-mark mark1)
  45.     (arg-prefix n)(next-word)(set-mark mark2)
  46.     (case-region op mark1 mark2)
  47.     (free-mark mark1 mark2)
  48.   }
  49.   downcase-word      { (case-word (arg-prefix) LOWER-CASE) }
  50.   upcase-word      { (case-word (arg-prefix) UPPER-CASE) }
  51.   capitalize-word { (case-word (arg-prefix) CAPITALIZE) }
  52. )
  53.