home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / educatio / xcoral16.zip / BUFFER.H < prev    next >
C/C++ Source or Header  |  1993-01-15  |  2KB  |  65 lines

  1. /*
  2. ** Copyright 1989, 1992 by Lionel Fournigault
  3. **
  4. ** Permission to use, copy, and distribute for non-commercial purposes,
  5. ** is hereby granted without fee, providing that the above copyright
  6. ** notice appear in all copies and that both the copyright notice and this
  7. ** permission notice appear in supporting documentation.
  8. ** The software may be modified for your own purposes, but modified versions
  9. ** may not be distributed.
  10. ** This software is provided "as is" without any expressed or implied warranty.
  11. **
  12. **
  13. */
  14.  
  15. #ifndef _BUF_H_
  16. #define _BUF_H_
  17.  
  18. #define SIZEOF_BUFFER    50000
  19. #define PSIZE        0x2000
  20. #define NEW        0
  21. #define INSERT        1
  22.  
  23. typedef struct {
  24.     char *top;    /* Debut du buffer */
  25.     char *l_cur;    /* debut du trou (left cursor) */
  26.     char *r_cur;    /* fin du trou (right cursor) */
  27.     char *bottom;    /* fin du buffer */
  28. } Buf;
  29.  
  30. /*
  31.  *    Public
  32.  */
  33. extern     Buf *GetBuffer ( /* int size */ );
  34. extern     void DeleteBuffer ( /* Buf *buf */ );
  35. extern     int LoadFileInBuffer ( /* Buf *buf, FILE *fd, int len, int flag */ );
  36. extern    int WriteCurrentFile ( /* Buf *buf, FILE *fd */ );
  37. extern     int MoveHole ( /* Buf *buf, int n */ );
  38. extern    void HoleToRight ( /* Buf *buf */ );
  39. extern    void HoleToLeft ( /* Buf *buf */ );
  40. extern    void InsertNchar ( /* Buf *buf, char *s, int n */ );
  41. extern    void DeleteNchar ( /* Buf *buf, int n */ );
  42. extern    char *GetCurrentLine ( /* Buf *buf, int len */ );
  43. extern    char *GetForwardLine ( /* Buf *buf, int n, int len */ );
  44. extern    char *GetBackwardLine ( /* Buf *buf, int n, int len */ );
  45. extern    int GetNcFromLeft ( /* Buf *buf */ );
  46. extern    int GetNcFromRight ( /* Buf *buf */ );
  47. extern     int MoveToLine ( /* Buf *buf, int n */ );
  48. extern    int GetNumberOfLineInBuf ( /* Buf *buf */ );
  49. extern    char *DeleteLines ( /* Buf *buf, int n, int *len, int *dn */ );
  50. extern    int GetNewLine ( /* char *t, int len */ );
  51. extern    void GetCurrentChar ( /* Buf *buf,  char *c */ );
  52. extern    void GetPrevChar ( /* Buf *buf, char *c */ );
  53. extern    void ClearBuffer ( /* buf */ );
  54.  
  55. #define RightBuf(buf)    (buf -> r_cur + 1)
  56. #define TopBuf(buf)        (buf -> top)
  57. #define LeftBuf(buf)    (buf -> l_cur - 1)
  58. #define BottomBuf(buf)    (buf -> bottom)
  59.  
  60. #endif /* _BUF_H_ */
  61.  
  62.  
  63.  
  64.  
  65.