HTFWrite.h
上传用户:zlh9724
上传日期:2007-01-04
资源大小:1991k
文件大小:4k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. /*                                                                         ANSI C FILE Stream
  2.                               WRTING TO A FILE USING ANSI C
  3.                                              
  4.  */
  5. /*
  6. **      (c) COPYRIGHT MIT 1995.
  7. **      Please first read the full copyright statement in the file COPYRIGH.
  8. */
  9. /*
  10.    It is useful to have both FWriter and Writer for environments in which fdopen() doesn't
  11.    exist for example. The module contains the following parts:
  12.    
  13.       Basic Utility Streams
  14.       
  15.       An ANSI C File Writer Stream
  16.       
  17.       Various Converters using the File Writer Stream
  18.       
  19.    This module is implemented by HTFWrite.c, and it is a part of the  W3C Reference
  20.    Library.
  21.    
  22.  */
  23. #ifndef HTFWRITE_H
  24. #define HTFWRITE_H
  25. #include "HTStream.h"
  26. #include "HTFormat.h"
  27. /*
  28. Basic Utility Streams
  29.    These streams can be plugged in everywhere in a stream pipe.
  30.    
  31.   BLACK HOLE STREAM
  32.   
  33.    This stream simply absorbs data without doing anything what so ever. The
  34.    HTBlackHoleConverter declaration can be used in the stream stack as a converter.
  35.    
  36.  */
  37. extern HTStream * HTBlackHole (void);
  38. extern HTConverter HTBlackHoleConverter;
  39. /*
  40.   THROUGH LINE
  41.   
  42.    This stream just pumps data right through.
  43.    
  44.  */
  45. extern HTConverter HTThroughLine;
  46. /*
  47.   GENERIC ERROR STREAM
  48.   
  49.    The Error stream simply returns HT_ERROR on all methods. This can be used to stop a
  50.    stream as soon as data arrives, for example from the network.
  51.    
  52.  */
  53. extern HTStream * HTErrorStream (void);
  54. /*
  55. An ANSI C File Writer Stream
  56.    This function puts up a new stream given an open file descripter. If the file is not to
  57.    be closed afterwards, then set leave_open = NO.
  58.    
  59.  */
  60. extern HTStream * HTFWriter_new (HTRequest * request,
  61.                                  FILE * fp,
  62.                                  BOOL leave_open);
  63. /*
  64. Various Converters using the File Writer Stream
  65.    This is a set of functions that can be registered as converters. They all use the basic
  66.    ANSI C file writer stream for writing out to the local file system.
  67.    
  68.  */
  69. extern HTConverter HTSaveAndExecute, HTSaveLocally, HTSaveAndCallback;
  70. /*
  71.   HTSaveLocally          Saves a file to local disk. This can for example be used to dump
  72.                          date objects of unknown media types to local disk. The stream
  73.                          prompts for a file name for the temporary file.
  74.                          
  75.   HTSaveAndExecute       Creates temporary file, writes to it and then executes system
  76.                          command (maybe an external viewer) when EOF has been reached. The
  77.                          stream finds a suitable name of the temporary file which
  78.                          preserves the suffix. This way, the system command can find out
  79.                          the file type from the name of the temporary file name.
  80.                          
  81.   HTSaveAndCallback      This stream works exactly like the HTSaveAndExecutestream but in
  82.                          addition when EOF has been reached, it checks whether a callback
  83.                          function has been associated with the request object in which
  84.                          case, this callback is being called. This can be use by the
  85.                          application to do some processing after the system command has
  86.                          terminated. The callback function is called with the file name of
  87.                          the temporary file as parameter.
  88.                          
  89.   LOCATION OF TEMPORARY FILES
  90.   
  91.    The destination for temporary files can be managed by the following functions:
  92.    
  93.  */
  94. extern BOOL  HTTmp_setRoot              (CONST char * tmp_root);
  95. extern CONST char * HTTmp_getRoot       (void);
  96. extern void  HTTmp_freeRoot             (void);
  97. /*
  98.    The HTTmp_freeRoot is called by the HTLibTerminate function. The default value is
  99.    defined in HTReq.html
  100.    
  101.  */
  102. #endif
  103. /*
  104.    End of declaration module */