Back to index

lightning-sunbird  0.9+nobinonly
xp.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) 1998
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 the GNU General Public License Version 2 or later (the "GPL"), or
00026  * 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 __XP_H__
00039 #define __XP_H__
00040 
00041 /*****************************************************/
00042 
00043 #ifdef XP_WIN
00044 
00045   #include <windows.h>
00046 
00047 #endif
00048 
00049 /*****************************************************/
00050 
00051 
00052 #ifdef XP_MAC
00053        #include <all.h>
00054 #endif
00055        
00056 #if (defined XP_MAC || defined XP_UNIX)
00057 
00058        typedef unsigned char       BYTE;
00059        
00060        #define strcmpi  strcmp
00061 
00062 #endif
00063 
00064 
00065 /*****************************************************/
00066 
00067 #ifdef XP_UNIX
00068        #include <stdio.h>
00069        #include <string.h>       /* strcat() */
00070   #include <sys/types.h>    /* stat() */
00071   #include <sys/stat.h>
00072   #include <stdlib.h>       /* atoi() */
00073   #include <assert.h>       /* assert() */
00074   #include <ctype.h>        /* isprint() */
00075 
00076        #ifndef FALSE
00077        #define FALSE                 false
00078        #endif
00079          
00080        #ifndef TRUE
00081        #define TRUE                  true
00082        #endif
00083 
00084   #ifndef HIBYTE
00085   #define HIBYTE(x)       ((((u_int)(x)) & 0xff00)>>8)
00086   #endif
00087 
00088   #ifndef LOBYTE
00089   #define LOBYTE(x)       (((u_int)(x)) & 0x00ff)
00090   #endif
00091 
00092   #ifndef XP_EXPORT_API
00093   #define XP_EXPORT_API
00094   #endif
00095 
00096 #endif
00097 
00098 /*****************************************************/
00099 
00100 #ifdef XP_WIN
00101 
00102   #define XP_HFILE        HFILE
00103   #define XP_HLIB         HINSTANCE
00104 
00105   #define XP_EXPORT_API   WINAPI
00106 
00107 #else
00108 
00109   #define XP_HFILE        FILE*
00110 
00111   #ifndef DWORD
00112   #define DWORD           unsigned long
00113   #endif
00114 
00115   #ifndef UINT
00116   #define UINT            unsigned int
00117   #endif
00118 
00119   #ifndef WORD
00120   #define WORD            unsigned short
00121   #endif
00122 
00123   #ifndef BOOL
00124   #define BOOL                bool
00125   #endif
00126 
00127   #if (defined XP_UNIX)                   /* For IRIX */
00128     #ifndef bool
00129     #define bool              unsigned char
00130     #endif
00131   #endif
00132 
00133 #endif
00134 
00135 
00136 
00137 /*****************************************************/
00138 
00139 #ifndef _MAX_PATH
00140   #define _MAX_PATH       256
00141 #endif
00142 
00143 #ifdef XP_WIN
00144   #define DIR_SEPARATOR "\\"
00145 #endif
00146 
00147 #ifdef XP_UNIX
00148   #define DIR_SEPARATOR "/"
00149 #endif
00150 
00151 #ifdef XP_MAC
00152   #define DIR_SEPARATOR ":"
00153 #endif
00154   
00155 /*****************************************************/
00156 
00157 // File utilities
00158 BOOL XP_IsFile(char * szFileName);
00159 XP_HFILE XP_CreateFile(char * szFileName);
00160 XP_HFILE XP_OpenFile(char * szFileName);
00161 void XP_CloseFile(XP_HFILE hFile);
00162 void XP_DeleteFile(char * szFileName);
00163 DWORD XP_WriteFile(XP_HFILE hFile, void * pBuf, int iSize);
00164 void XP_FlushFileBuffers(XP_HFILE hFile);
00165 
00166 
00167 // misc
00168 void * XP_GetSymbol(XP_HLIB hLib, char * szProcName);
00169 
00170 #endif