home *** CD-ROM | disk | FTP | other *** search
/ PC Open 48 / pcopen48.iso / Internet / HtTrack / DATA1.CAB / Sources / src / htsbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-21  |  3.7 KB  |  145 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche, Yann Philippot
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  
  20.  
  21. Important notes:
  22.  
  23. - We hereby ask people using this source NOT to use it in purpose of grabbing
  24. emails addresses, or collecting any other private information on persons.
  25. This would disgrace our work, and spoil the many hours we spent on it.
  26.  
  27.  
  28. This project has been developed by Xavier Roche and Yann Philippot,
  29. from the company Serianet at Caen, France (http://www.serianet.com)
  30.  
  31. Please visit our Website: http://www.httrack.com
  32. */
  33.  
  34.  
  35. /* ------------------------------------------------------------ */
  36. /* File: Basic definitions                                      */
  37. /*       Used in .c files for basic (malloc() ..) definitions   */
  38. /* Author: Xavier Roche                                         */
  39. /* ------------------------------------------------------------ */
  40.  
  41. #ifndef HTS_BASICH
  42. #define HTS_BASICH
  43.  
  44. #include "htsglobal.h"
  45.  
  46. // size_t et mode_t
  47. #include <stdio.h>
  48. #if HTS_WIN
  49. #else
  50. #include <fcntl.h>
  51. #endif
  52.  
  53. #if HTS_WIN
  54. #else
  55.  #define min(a,b) ((a)>(b)?(b):(a))
  56.  #define max(a,b) ((a)>(b)?(a):(b))
  57. #endif
  58.  
  59. // teste ΘgalitΘ de 2 chars, case insensitive
  60. #define hichar(a) ((((a)>='a') && ((a)<='z')) ? ((a)-('a'-'A')) : (a))
  61. #define streql(a,b) (hichar(a)==hichar(b))
  62.  
  63. // is this MIME an hypertext MIME (text/html) or any html/js-style ?
  64. #define HTS_HYPERTEXT_DEFAULT_MIME "text/html"
  65. #define is_hypertext_mime(a) \
  66.    ( (strfield2((a),"text/html")!=0)\
  67.   || (strfield2((a),"application/x-javascript")!=0) )\
  68.  
  69.  
  70. // caractΦre maj
  71. #define isUpperLetter(a) ( ((a) >= 'A') && ((a) <= 'Z') )
  72.  
  73. // conversion Θventuelle / vers antislash
  74. #if HTS_WIN
  75. char* antislash(char* s);
  76. #else
  77. #define antislash(A) (A)
  78. #endif
  79.  
  80.  
  81. // functions
  82. #if HTS_PLATFORM!=3
  83. #ifdef __cplusplus
  84. extern "C" {
  85. #endif
  86. #if HTS_PLATFORM!=2
  87. #if HTS_PLATFORM!=1
  88.  int   open      (const char *, int, ...);
  89. #endif
  90.  //int   read      (int,const char*,int);
  91.  //int   write     (int,char*,int);
  92. #endif
  93. #if HTS_PLATFORM!=1
  94.  int   close     (int);
  95.  void* calloc    (size_t,size_t);
  96.  void* malloc    (size_t);
  97.  void* realloc   (void*,size_t);
  98.  void  free      (void*);
  99. #endif
  100. #if HTS_WIN==0
  101.  void  bzero     (char*,unsigned int);
  102.  void  bcopy     (const char*,char*,unsigned int);
  103.  //int   strcasecmp(const char*,const char*);
  104. #endif
  105.  //int   strlen    (const char *);
  106. #if HTS_WIN
  107.  //int   mkdir     (const char*);
  108. #else
  109.  int   mkdir     (const char*,mode_t);
  110.  //int   isdigit   (char);
  111.  //int   isalpha   (char);
  112.  //int   isalnum   (char);
  113. #endif
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. #endif
  118.  
  119.  
  120. #if HTS_WIN
  121. #define  bzero(a,b) memset(a,0,b)
  122. #define  bcopy(a,b,c) memcpy(b,a,c)
  123. #endif
  124.  
  125. // tracer malloc()
  126. #if HTS_TRACE_MALLOC
  127. #define malloct(A)    hts_malloc(A,0)
  128. #define calloct(A,B)  hts_malloc(A,B)
  129. #define freet(A)      hts_free(A)
  130. #define realloct(A,B) hts_realloc(A,B)
  131. void  hts_freeall();
  132. void* hts_malloc    (size_t,size_t);
  133. void  hts_free      (void*);
  134. void* hts_realloc   (void*,size_t);
  135. #else
  136. #define malloct(A)    malloc(A)
  137. #define calloct(A,B)  calloc(A,B)
  138. #define freet(A)      free(A)
  139. #define realloct(A,B) realloc(A,B)
  140. #endif
  141.  
  142.  
  143. #endif
  144.  
  145.