bufioI.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these librararies and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: bufioI.h /main/5 1995/10/26 12:36:33 rswiston $ */
  24. #ifndef _DtHelpbufioI_h
  25. #define _DtHelpbufioI_h
  26. #include <stdio.h> /* for FILE */
  27. #ifndef NULL
  28. #define NULL 0
  29. #endif
  30. #define BUFFILESIZE 4096
  31. #define BUFFILEEOF -1
  32. typedef unsigned char BufChar;
  33. typedef struct _buffile {
  34. BufChar *bufp;
  35. int left;
  36. BufChar buffer[BUFFILESIZE];
  37. int (*io)(/* BufFilePtr f */);
  38. int (*skip)(/* BufFilePtr f, int count */);
  39. int (*close)(/* BufFilePtr f */);
  40. char *hidden;
  41. } BufFileRec, *BufFilePtr;
  42. typedef struct _compressInfo{
  43. int fd;
  44. int size;
  45. } CECompressInfo, *CECompressInfoPtr;
  46. extern BufFilePtr __DtBufFileCreate ();
  47. extern BufFilePtr _DtHelpCeBufFilePushZ ();
  48. extern BufFilePtr _DtHelpCeBufFileOpenWr ();
  49. extern int _DtHelpCeBufFileFlush ();
  50. #define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : (*(f)->io) (f))
  51. #define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = (c) : (*(f)->io) (c,f))
  52. #define BufFilePutBack(c,f) { (f)->left++; *(--(f)->bufp) = (c); }
  53. #define BufFileSkip(f,c) ((*(f)->skip) (f, c))
  54. #define FileStream(f) ((FILE *)(f)->hidden)
  55. extern void _DtHelpCeBufFileClose (
  56. BufFilePtr f,
  57. int doClose);
  58. extern BufFilePtr _DtHelpCeBufFileCreate (
  59. char *hidden,
  60. int (*io)(),
  61. int (*skip)(),
  62. int (*close)());
  63. extern int _DtHelpCeBufFileRd (
  64. BufFilePtr f,
  65. char *buffer,
  66. int request_size);
  67. extern BufFilePtr _DtHelpCeBufFileRdWithFd (
  68. int fd);
  69. extern BufFilePtr _DtHelpCeBufFileRdRawZ (
  70. CECompressInfoPtr file_info);
  71. extern BufFilePtr _DtHelpCeCreatePipeBufFile (
  72. FILE *stream);
  73. extern int _DtHelpCeUncompressFile (
  74. char *in_file,
  75. char *out_file);
  76. #ifndef TRUE
  77. #define TRUE 1
  78. #endif
  79. #ifndef FALSE
  80. #define FALSE 0
  81. #endif
  82. #endif /* _DtHelpbufioI_h */