home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libpics / htutils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  10.0 KB  |  271 lines

  1.  
  2. /*  W3 Copyright statement 
  3. Copyright 1995 by: Massachusetts Institute of Technology (MIT), INRIA</H2>
  4.  
  5. This W3C software is being provided by the copyright holders under the
  6. following license. By obtaining, using and/or copying this software,
  7. you agree that you have read, understood, and will comply with the
  8. following terms and conditions: 
  9.  
  10. Permission to use, copy, modify, and distribute this software and its
  11. documentation for any purpose and without fee or royalty is hereby
  12. granted, provided that the full text of this NOTICE appears on
  13. <EM>ALL</EM> copies of the software and documentation or portions
  14. thereof, including modifications, that you make. 
  15.  
  16. <B>THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
  17. REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF EXAMPLE,
  18. BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR
  19. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR
  20. THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
  21. THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
  22. COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE
  23. OR DOCUMENTATION.
  24.  
  25. The name and trademarks of copyright holders may NOT be used
  26. in advertising or publicity pertaining to the software without
  27. specific, written prior permission.  Title to copyright in this
  28. software and any associated documentation will at all times remain
  29. with copyright holders. 
  30. */
  31. /*                                        W3C Reference Library libwww General Purpose Macros
  32.                                   GENERAL PURPOSE MACROS
  33.                                              
  34.  */
  35. /*
  36. **      (c) COPYRIGHT MIT 1995.
  37. **      Please first read the full copyright statement in the file COPYRIGH.
  38. */
  39. /*
  40.  
  41.    This module is a part of the W3C Reference Library. See also the system dependent file
  42.    sysdep module for system specific information.
  43.    
  44.  */
  45. #ifndef HTUTILS_H
  46. #define HTUTILS_H
  47. /*
  48.  
  49. DEBUG MESSAGE CONTROL
  50.  
  51.    This is the global flag for setting the WWWTRACEoptions. The verbose mode is no longer
  52.    a simple boolean but a bit field so that it is possible to see parts of the output
  53.    messages.
  54.    
  55.  */
  56. #ifndef DEBUG
  57. #define DEBUG   /* No one ever turns this off as trace is too important */
  58. #endif
  59. /*
  60.  
  61.   Definition of the Global Trace Flag
  62.   
  63.    The global trace flag variable is available everywhere.
  64.    
  65.  */
  66. #ifdef DEBUG
  67. #ifdef WWW_WIN_DLL
  68. extern int *            WWW_TraceFlag;   /* In DLLs, we need the indirection */
  69. #define WWWTRACE        (*WWW_TraceFlag)
  70. #else
  71. extern int              WWW_TraceFlag;       /* Global flag for all W3 trace */
  72. #define WWWTRACE        (WWW_TraceFlag)
  73. #endif /* WWW_WIN_DLL */
  74. #else
  75. #define WWWTRACE        0
  76. #endif /* DEBUG */
  77. /*
  78.  
  79.    The WWWTRACEdefine outputs messages if verbose mode is active according to the
  80.    following rules:
  81.    
  82.  */
  83. typedef enum _HTTraceFlags {
  84.     SHOW_UTIL_TRACE     = 0x1,                          /*                 1 */
  85.     SHOW_APP_TRACE      = 0x2,                          /*                10 */
  86.     SHOW_CACHE_TRACE    = 0x4,                          /*               100 */
  87.     SHOW_SGML_TRACE     = 0x8,                          /*              1000 */
  88.     SHOW_BIND_TRACE     = 0x10,                         /*            1.0000 */
  89.     SHOW_THREAD_TRACE   = 0x20,                         /*           10.0000 */
  90.     SHOW_STREAM_TRACE   = 0x40,                         /*          100.0000 */
  91.     SHOW_PROTOCOL_TRACE = 0x80,                         /*         1000.0000 */
  92.     SHOW_MEM_TRACE      = 0x100,                        /*       1.0000.0000 */
  93.     SHOW_URI_TRACE      = 0x200,                        /*      10.0000.0000 */
  94.     SHOW_AUTH_TRACE     = 0x400,                        /*     100.0000.0000 */
  95.     SHOW_ANCHOR_TRACE   = 0x800,                        /*    1000.0000.0000 */
  96.     SHOW_PICS_TRACE     = 0x1000,                       /*  1.0000.0000.0000 */
  97.     SHOW_CORE_TRACE     = 0x2000,                       /* 10.0000.0000.0000 */
  98.     SHOW_ALL_TRACE      = 0x3FFF                        /* 11.1111.1111.1111 */
  99. } HTTraceFlags;
  100. /*
  101.  
  102.    The flags are made so that they can serve as a group flag for correlated trace
  103.    messages, e.g. showing messages for SGML and HTML at the same time.
  104.    
  105.  */
  106. #define UTIL_TRACE      (WWWTRACE & SHOW_UTIL_TRACE)
  107. #define APP_TRACE       (WWWTRACE & SHOW_APP_TRACE)
  108. #define CACHE_TRACE     (WWWTRACE & SHOW_CACHE_TRACE)
  109. #define SGML_TRACE      (WWWTRACE & SHOW_SGML_TRACE)
  110. #define BIND_TRACE      (WWWTRACE & SHOW_BIND_TRACE)
  111. #define THD_TRACE       (WWWTRACE & SHOW_THREAD_TRACE)
  112. #define STREAM_TRACE    (WWWTRACE & SHOW_STREAM_TRACE)
  113. #define PROT_TRACE      (WWWTRACE & SHOW_PROTOCOL_TRACE)
  114. #define MEM_TRACE       (WWWTRACE & SHOW_MEM_TRACE)
  115. #define URI_TRACE       (WWWTRACE & SHOW_URI_TRACE)
  116. #define AUTH_TRACE      (WWWTRACE & SHOW_AUTH_TRACE)
  117. #define ANCH_TRACE      (WWWTRACE & SHOW_ANCHOR_TRACE)
  118. #define PICS_TRACE      (WWWTRACE & SHOW_PICS_TRACE)
  119. #define CORE_TRACE      (WWWTRACE & SHOW_CORE_TRACE)
  120. /*
  121.  
  122.   Destination for Trace Messages
  123.   
  124.    You can send trace messages to various destinations depending on the type of your
  125.    application. By default, on Unix the messages are sent to stderr using fprintf() and if
  126.    we are on Windows and have a windows applications then register a HTTraceCallback
  127.    function. This is done with HTTrace_setCallback. It tells HTTrace to call a
  128.    HTTraceCallback. If your compiler has problems with va_list, then you may forget about
  129.    registering the callback and instead macro HTTrace as follows: #define HTTrace
  130.    MyAppSpecificTrace
  131.    
  132.  */
  133. typedef int (*HTTraceCallback)();  /* jhines--7/9/97 */
  134. /* typedef int HTTraceCallback(const char * fmt, va_list pArgs); */
  135.  
  136. extern void HTTrace_setCallback(HTTraceCallback * pCall);
  137. extern HTTraceCallback * HTTrace_getCallback(void);
  138.  
  139. extern int HTTrace(const char * fmt, ...);
  140. /*
  141.  
  142. MACROS FOR FUNCTION DECLARATIONS
  143.  
  144.  */
  145. /* --- BEGIN removed by mharmsen@netscape.com on 7/9/97 --- */
  146. /* #define PUBLIC                  /* Accessible outside this module     */
  147. /* #define PRIVATE static          /* Accessible only within this module */
  148. /* --- END removed by mharmsen@netscape.com on 7/9/97 --- */
  149. /*
  150.  
  151. OFTEN USED INTERGER MACROS
  152.  
  153.   Min and Max functions
  154.   
  155.  */
  156. #ifndef HTMIN
  157. #define HTMIN(a,b) ((a) <= (b) ? (a) : (b))
  158. #define HTMAX(a,b) ((a) >= (b) ? (a) : (b))
  159. #endif
  160. /*
  161.  
  162.   Double abs function
  163.   
  164.  */
  165. #ifndef HTDABS
  166. #define HTDABS(a) ((a) < 0.0 ? (-(a)) : (a))
  167. #endif
  168. /*
  169.  
  170. RETURN CODES FOR PROTOCOL MODULES AND STREAMS
  171.  
  172.    Theese are the codes returned from the protocol modules, and the stream modules.
  173.    Success are (>=0) and failure are (<0)
  174.    
  175.  */
  176. #define HT_OK                   0       /* Generic success */
  177. #define HT_ALL                  1       /* Used by Net Manager */
  178.  
  179. #define HT_CONTINUE             29991   /* Continue an operation */
  180. #define HT_CLOSED               29992   /* The socket was closed */
  181. #define HT_PERSISTENT           29993   /* Wait for persistent connection */
  182. #define HT_IGNORE               29994   /* Ignore this in the Net manager */
  183. #define HT_NO_DATA              29995   /* OK but no data was loaded */
  184. #define HT_RELOAD               29996   /* If we must reload the document */
  185. #define HT_PERM_REDIRECT        29997   /* Redo the retrieve with a new URL */
  186. #define HT_TEMP_REDIRECT        29998   /* Redo the retrieve with a new URL */
  187. #define HT_LOADED               29999   /* Instead of a socket */
  188.  
  189. #define HT_ERROR                -1      /* Generic failure */
  190.  
  191. #define HT_NO_ACCESS            -10     /* Access not available */
  192. #define HT_FORBIDDEN            -11     /* Access forbidden */
  193. #define HT_RETRY                -13     /* If service isn't available */
  194. #define HT_NO_PROXY_ACCESS      -14     /* No proxy access */
  195.  
  196. #define HT_INTERNAL             -100    /* Weird -- should never happen. */
  197.  
  198. #define HT_WOULD_BLOCK          -29997  /* If we are in a select */
  199. #define HT_INTERRUPTED          -29998  /* Note the negative value! */
  200. #define HT_PAUSE                -29999  /* If we want to pause a stream */
  201. /*
  202.  
  203. UPPER- AND LOWERCASE MACROS
  204.  
  205.    The problem here is that toupper(x) is not defined officially unless isupper(x) is.
  206.    These macros are CERTAINLY needed on #if defined(pyr) || define(mips) or BDSI
  207.    platforms. For safefy, we make them mandatory.
  208.    
  209.  */
  210. /* --- BEGIN removed by mharmsen@netscape.com on 7/9/97 --- */
  211. /* #ifndef TOLOWER */
  212. /* #define TOLOWER(c) tolower(c) */
  213. /* #define TOUPPER(c) toupper(c) */
  214. /* #endif */
  215. /* --- END removed by mharmsen@netscape.com on 7/9/97 --- */
  216. /*
  217.  
  218. MAX AND MIN VALUES FOR INTEGERS AND FLOATING POINT
  219.  
  220.  */
  221. #ifdef FLT_EPSILON                                  /* The ANSI C way define */
  222. #define HT_EPSILON FLT_EPSILON
  223. #else
  224. #define HT_EPSILON 0.00000001
  225. #endif
  226. /*
  227.  
  228. WHITE CHARACTERS
  229.  
  230.    Is character _c_ white space?
  231.    
  232.  */
  233. /* --- BEGIN replaced by mharmsen@netscape.com on 7/9/97 --- */
  234. /* #define WHITE(c) isspace(c) */
  235. #define WHITE(c) XP_IS_SPACE(c)
  236. /* --- END replaced by mharmsen@netscape.com on 7/9/97 --- */
  237. /*
  238.  
  239. THE LOCAL EQUIVALENTS OF CR AND LF
  240.  
  241.    We can check for these after net ascii text has been converted to the local
  242.    representation. Similarly, we include them in strings to be sent as net ascii after
  243.    translation.
  244.    
  245.  */
  246. /* --- BEGIN removed by mharmsen@netscape.com on 7/9/97 --- */
  247. /* #define LF   FROMASCII('\012')  /* ASCII line feed LOCAL EQUIVALENT */
  248. /* #define CR   FROMASCII('\015')  /* Will be converted to ^M for transmission */
  249. /* --- END removed by mharmsen@netscape.com on 7/9/97 --- */
  250. /*
  251.  
  252. LIBRARY DYNAMIC MEMORY MAGEMENT
  253.  
  254.    The Library has it's own dynamic memory API which is declared in memory management
  255.    module.
  256.    
  257.  */
  258. #include "htmemory.h"
  259. /*
  260.  
  261.  */
  262. #endif /* HT_UTILS.h */
  263. /*
  264.  
  265.    
  266.    ___________________________________
  267.    
  268.                            @(#) $Id: htutils.h,v 3.1 1998/03/28 03:32:08 ltabb Exp $
  269.                                                                                           
  270.     */
  271.