Back to index

lightning-sunbird  0.9+nobinonly
morkConfig.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-  */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1999
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef _MORKCONFIG_
00039 #define _MORKCONFIG_ 1
00040 
00041 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
00042 
00043 // { %%%%% begin debug mode options in Mork %%%%%
00044 #define MORK_DEBUG 1
00045 // } %%%%% end debug mode options in Mork %%%%%
00046 
00047 #ifdef MORK_DEBUG
00048 #define MORK_MAX_CODE_COMPILE 1
00049 #endif
00050 
00051 // { %%%%% begin platform defs peculiar to Mork %%%%%
00052 
00053 //#define XP_MAC 1
00054 
00055 #ifdef XP_MACOSX
00056 #define MORK_MAC 1
00057 #endif
00058 
00059 #ifdef XP_OS2
00060 #define MORK_OS2 1
00061 #endif
00062 
00063 #ifdef XP_WIN
00064 #define MORK_WIN 1
00065 #endif
00066 
00067 #ifdef XP_UNIX
00068 #define MORK_UNIX 1
00069 #endif
00070 
00071 #ifdef XP_BEOS
00072 #define MORK_BEOS 1
00073 #endif
00074 
00075 // } %%%%% end platform defs peculiar to Mork %%%%%
00076 
00077 #if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_BEOS) || defined(MORK_OS2)
00078 #include <stdio.h> 
00079 #include <ctype.h> 
00080 #include <errno.h> 
00081 #include <string.h> 
00082 #ifdef HAVE_MEMORY_H
00083 #include <memory.h> 
00084 #endif
00085 #ifdef HAVE_UNISTD_H
00086 #include <unistd.h>  /* for SEEK_SET, SEEK_END */
00087 #endif
00088 
00089 #include "nsDebug.h" 
00090 
00091 #define MORK_ISPRINT(c) isprint(c) 
00092 
00093 #define MORK_FILETELL(file) ftell(file) 
00094 #define MORK_FILESEEK(file, where, how) fseek(file, where, how) 
00095 #define MORK_FILEREAD(outbuf, insize, file) fread(outbuf, 1, insize, file) 
00096 #if defined(MORK_WIN)
00097 void mork_fileflush(FILE * file);
00098 #define MORK_FILEFLUSH(file) mork_fileflush(file) 
00099 #else
00100 #define MORK_FILEFLUSH(file) fflush(file) 
00101 #endif /*MORK_WIN*/
00102 
00103 #if defined(MORK_OS2)
00104 FILE* mork_fileopen(const char* name, const char* mode);
00105 #define MORK_FILEOPEN(file, how) mork_fileopen(file, how) 
00106 #else
00107 #define MORK_FILEOPEN(file, how) fopen(file, how) 
00108 #endif
00109 #define MORK_FILECLOSE(file) fclose(file) 
00110 #endif /*MORK_WIN*/
00111 
00112 /* ===== separating switchable features ===== */
00113 
00114 #define MORK_ENABLE_ZONE_ARENAS 1 /* using morkZone for pooling */
00115 
00116 //#define MORK_ENABLE_PROBE_MAPS 1 /* use smaller hash tables */
00117 
00118 #define MORK_BEAD_OVER_NODE_MAPS 1 /* use bead not node maps */
00119 
00120 /* ===== pooling ===== */
00121 
00122 #if defined(HAVE_64BIT_OS)
00123 #define MORK_CONFIG_ALIGN_8 1 /* must have 8 byte alignment */
00124 #else
00125 #define MORK_CONFIG_PTR_SIZE_4 1 /* sizeof(void*) == 4 */
00126 #endif
00127 
00128 // #define MORK_DEBUG_HEAP_STATS 1 /* analyze per-block heap usage */
00129 
00130 /* ===== ===== ===== ===== line characters ===== ===== ===== ===== */
00131 #define mork_kCR 0x0D
00132 #define mork_kLF 0x0A
00133 #define mork_kVTAB '\013'
00134 #define mork_kFF '\014'
00135 #define mork_kTAB '\011'
00136 #define mork_kCRLF "\015\012"     /* A CR LF equivalent string */
00137 
00138 #if defined(MORK_MAC)
00139 #  define mork_kNewline             "\015"
00140 #  define mork_kNewlineSize 1
00141 #else
00142 #  if defined(MORK_WIN) || defined(MORK_OS2)
00143 #    define mork_kNewline           "\015\012"
00144 #    define mork_kNewlineSize       2
00145 #  else
00146 #    if defined(MORK_UNIX) || defined(MORK_BEOS)
00147 #      define mork_kNewline         "\012"
00148 #      define mork_kNewlineSize     1
00149 #    endif /* MORK_UNIX || MORK_BEOS */
00150 #  endif /* MORK_WIN */
00151 #endif /* MORK_MAC */
00152 
00153 // { %%%%% begin assertion macro %%%%%
00154 extern void mork_assertion_signal(const char* inMessage);
00155 #define MORK_ASSERTION_SIGNAL(Y) mork_assertion_signal(Y)
00156 #define MORK_ASSERT(X) if (!(X)) MORK_ASSERTION_SIGNAL(#X)
00157 // } %%%%% end assertion macro %%%%%
00158 
00159 #define MORK_LIB(return) return /*API return declaration*/
00160 #define MORK_LIB_IMPL(return) return /*implementation return declaration*/
00161 
00162 // { %%%%% begin standard c utility methods %%%%%
00163 
00164 #if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_BEOS) || defined(MORK_OS2)
00165 #define MORK_USE_C_STDLIB 1
00166 #endif /*MORK_WIN*/
00167 
00168 #ifdef MORK_USE_C_STDLIB
00169 #define MORK_MEMCMP(src1,src2,size)  memcmp(src1,src2,size)
00170 #define MORK_MEMCPY(dest,src,size)   memcpy(dest,src,size)
00171 #define MORK_MEMMOVE(dest,src,size)  memmove(dest,src,size)
00172 #define MORK_MEMSET(dest,byte,size)  memset(dest,byte,size)
00173 #define MORK_STRCPY(dest,src)        strcpy(dest,src)
00174 #define MORK_STRCMP(one,two)         strcmp(one,two)
00175 #define MORK_STRNCMP(one,two,length) strncmp(one,two,length)
00176 #define MORK_STRLEN(string)          strlen(string)
00177 #endif /*MORK_USE_C_STDLIB*/
00178 
00179 #ifdef MORK_PROVIDE_STDLIB
00180 MORK_LIB(mork_i4) mork_memcmp(const void* a, const void* b, mork_size inSize);
00181 MORK_LIB(void) mork_memcpy(void* dst, const void* src, mork_size inSize);
00182 MORK_LIB(void) mork_memmove(void* dst, const void* src, mork_size inSize);
00183 MORK_LIB(void) mork_memset(void* dst, int inByte, mork_size inSize);
00184 MORK_LIB(void) mork_strcpy(void* dst, const void* src);
00185 MORK_LIB(mork_i4) mork_strcmp(const void* a, const void* b);
00186 MORK_LIB(mork_i4) mork_strncmp(const void* a, const void* b, mork_size inSize);
00187 MORK_LIB(mork_size) mork_strlen(const void* inString);
00188 
00189 #define MORK_MEMCMP(src1,src2,size)  mork_memcmp(src1,src2,size)
00190 #define MORK_MEMCPY(dest,src,size)   mork_memcpy(dest,src,size)
00191 #define MORK_MEMMOVE(dest,src,size)  mork_memmove(dest,src,size)
00192 #define MORK_MEMSET(dest,byte,size)  mork_memset(dest,byte,size)
00193 #define MORK_STRCPY(dest,src)        mork_strcpy(dest,src)
00194 #define MORK_STRCMP(one,two)         mork_strcmp(one,two)
00195 #define MORK_STRNCMP(one,two,length) mork_strncmp(one,two,length)
00196 #define MORK_STRLEN(string)          mork_strlen(string)
00197 #endif /*MORK_PROVIDE_STDLIB*/
00198 
00199 // } %%%%% end standard c utility methods %%%%%
00200 
00201 //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
00202 
00203 #endif /* _MORKCONFIG_ */
00204