home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / util / vim-2.0.lha / Vim-2.0 / src / macros.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-15  |  1.3 KB  |  56 lines

  1. /* vi:ts=4:sw=4
  2.  *
  3.  * VIM - Vi IMproved
  4.  *
  5.  * Code Contributions By:    Bram Moolenaar            mool@oce.nl
  6.  *                            Tim Thompson            twitch!tjt
  7.  *                            Tony Andrews            onecom!wldrdg!tony 
  8.  *                            G. R. (Fred) Walter        watmath!watcgl!grwalter 
  9.  */
  10.  
  11. /*
  12.  * macros.h: macro definitions for often used code
  13.  */
  14.  
  15. /*
  16.  * pchar(lp, c) - put character 'c' at position 'lp'
  17.  */
  18. #define pchar(lp, c) (*(nr2ptr((lp).lnum) + (lp).col) = (c))
  19.  
  20. /*
  21.  * Position comparisons
  22.  */
  23. #define lt(a, b) (((a).lnum != (b).lnum) \
  24.                    ? ((a).lnum < (b).lnum) : ((a).col < (b).col))
  25.  
  26. #define ltoreq(a, b) (((a).lnum != (b).lnum) \
  27.                    ? ((a).lnum < (b).lnum) : ((a).col <= (b).col))
  28.  
  29. #define equal(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
  30.  
  31. /*
  32.  * buf1line() - return TRUE if there is only one line in file buffer
  33.  */
  34. #define buf1line() (line_count == 1)
  35.  
  36. /*
  37.  * lineempty() - return TRUE if the line is empty
  38.  */
  39. #define lineempty(p) (*nr2ptr(p) == NUL)
  40.  
  41. /*
  42.  * bufempty() - return TRUE if the file buffer is empty
  43.  */
  44. #define bufempty() (buf1line() && lineempty((linenr_t)1))
  45.  
  46. /*
  47.  * On some systems toupper()/tolower() only work on lower/uppercase characters
  48.  */
  49. #if defined(sequent) || defined(DOMAIN) || !defined(__STDC__)
  50. # define TO_UPPER(c)    (islower(c) ? toupper(c) : (c))
  51. # define TO_LOWER(c)    (isupper(c) ? tolower(c) : (c))
  52. #else
  53. # define TO_UPPER        toupper
  54. # define TO_LOWER        tolower
  55. #endif
  56.