home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 71 / CDROM71.ISO / internet / navoff / data1.cab / Sources / src / htsbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-04-01  |  3.8 KB  |  146 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche, Yann Philippot and other contributors
  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. and other contributors (see the greetings file)
  31.  
  32. Please visit our Website: http://www.httrack.com
  33. */
  34.  
  35.  
  36. /* ------------------------------------------------------------ */
  37. /* File: Basic definitions                                      */
  38. /*       Used in .c files for basic (malloc() ..) definitions   */
  39. /* Author: Xavier Roche                                         */
  40. /* ------------------------------------------------------------ */
  41.  
  42. #ifndef HTS_BASICH
  43. #define HTS_BASICH
  44.  
  45. #include "htsglobal.h"
  46.  
  47. // size_t et mode_t
  48. #include <stdio.h>
  49. #if HTS_WIN
  50. #else
  51. #include <fcntl.h>
  52. #endif
  53.  
  54. #if HTS_WIN
  55. #else
  56.  #define min(a,b) ((a)>(b)?(b):(a))
  57.  #define max(a,b) ((a)>(b)?(a):(b))
  58. #endif
  59.  
  60. // teste ΘgalitΘ de 2 chars, case insensitive
  61. #define hichar(a) ((((a)>='a') && ((a)<='z')) ? ((a)-('a'-'A')) : (a))
  62. #define streql(a,b) (hichar(a)==hichar(b))
  63.  
  64. // is this MIME an hypertext MIME (text/html) or any html/js-style ?
  65. #define HTS_HYPERTEXT_DEFAULT_MIME "text/html"
  66. #define is_hypertext_mime(a) \
  67.    ( (strfield2((a),"text/html")!=0)\
  68.   || (strfield2((a),"application/x-javascript")!=0) )\
  69.  
  70.  
  71. // caractΦre maj
  72. #define isUpperLetter(a) ( ((a) >= 'A') && ((a) <= 'Z') )
  73.  
  74. // conversion Θventuelle / vers antislash
  75. #if HTS_WIN
  76. char* antislash(char* s);
  77. #else
  78. #define antislash(A) (A)
  79. #endif
  80.  
  81.  
  82. // functions
  83. #if HTS_PLATFORM!=3
  84. #ifdef __cplusplus
  85. extern "C" {
  86. #endif
  87. #if HTS_PLATFORM!=2
  88. #if HTS_PLATFORM!=1
  89.  int   open      (const char *, int, ...);
  90. #endif
  91.  //int   read      (int,const char*,int);
  92.  //int   write     (int,char*,int);
  93. #endif
  94. #if HTS_PLATFORM!=1
  95.  int   close     (int);
  96.  void* calloc    (size_t,size_t);
  97.  void* malloc    (size_t);
  98.  void* realloc   (void*,size_t);
  99.  void  free      (void*);
  100. #endif
  101. #if HTS_WIN==0
  102.  void  bzero     (char*,unsigned int);
  103.  void  bcopy     (const char*,char*,unsigned int);
  104.  //int   strcasecmp(const char*,const char*);
  105. #endif
  106.  //int   strlen    (const char *);
  107. #if HTS_WIN
  108.  //int   mkdir     (const char*);
  109. #else
  110.  int   mkdir     (const char*,mode_t);
  111.  //int   isdigit   (char);
  112.  //int   isalpha   (char);
  113.  //int   isalnum   (char);
  114. #endif
  115. #ifdef __cplusplus
  116. }
  117. #endif
  118. #endif
  119.  
  120.  
  121. #if HTS_WIN
  122. #define  bzero(a,b) memset(a,0,b)
  123. #define  bcopy(a,b,c) memcpy(b,a,c)
  124. #endif
  125.  
  126. // tracer malloc()
  127. #if HTS_TRACE_MALLOC
  128. #define malloct(A)    hts_malloc(A,0)
  129. #define calloct(A,B)  hts_malloc(A,B)
  130. #define freet(A)      hts_free(A)
  131. #define realloct(A,B) hts_realloc(A,B)
  132. void  hts_freeall();
  133. void* hts_malloc    (size_t,size_t);
  134. void  hts_free      (void*);
  135. void* hts_realloc   (void*,size_t);
  136. #else
  137. #define malloct(A)    malloc(A)
  138. #define calloct(A,B)  calloc(A,B)
  139. #define freet(A)      free(A)
  140. #define realloct(A,B) realloc(A,B)
  141. #endif
  142.  
  143.  
  144. #endif
  145.  
  146.