Back to index

lightning-sunbird  0.9+nobinonly
mozce_defs.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is MOZCE Lib.
00015  *
00016  * The Initial Developer of the Original Code is Doug Turner <dougt@meer.net>.
00017 
00018  * Portions created by the Initial Developer are Copyright (C) 2005
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #ifndef _MOZCE_DEFS
00038 #define _MOZCE_DEFS
00039 
00040 #ifndef MOZCE_STATIC_BUILD
00041 #ifdef MOZCE_SHUNT_EXPORTS
00042 #define MOZCE_SHUNT_API __declspec(dllexport)
00043 #else
00044 #define MOZCE_SHUNT_API __declspec(dllimport)
00045 #endif
00046 #else
00047 #define MOZCE_SHUNT_API
00048 #endif
00049 
00050 //#define USE_NC_LOGGING 1
00051 
00052 #define NOMINMAX
00053 
00054 #ifndef XP_WIN
00055 #define XP_WIN
00056 #endif
00057 
00058 #ifndef XP_WIN32
00059 #define XP_WIN32 1
00060 #endif
00061 
00062 #include <windows.h>
00063 
00064 #ifdef HINSTANCE_ERROR
00065 #undef HINSTANCE_ERROR
00066 #endif
00067 #define HINSTANCE_ERROR -1
00068 
00069 #if defined(min)
00070 #undef min
00071 #endif
00072 
00073 #if defined(max)
00074 #undef max
00075 #endif
00076 
00077 #ifdef IDI_APPLICATION
00078 #undef IDI_APPLICATION
00079 #endif
00080 #ifdef RC_INVOKED
00081 #define IDI_APPLICATION 32512
00082 #else
00083 #define IDI_APPLICATION MAKEINTRESOURCE(32512)
00084 #endif
00085 
00087 // Various Definations
00089 
00090 // for errors.h
00091 
00092 #ifdef EPERM
00093 #undef EPERM
00094 #endif
00095 #define       EPERM         1      /* Operation not permitted */
00096 
00097 #ifdef ENOENT
00098 #undef ENOENT
00099 #endif
00100 #define       ENOENT        2      /* No such file or directory */
00101 
00102 #ifdef ESRCH
00103 #undef ESRCH
00104 #endif
00105 #define       ESRCH         3      /* No such process */
00106 
00107 #ifdef EINTR
00108 #undef EINTR
00109 #endif
00110 #define       EINTR         4      /* Interrupted system call */
00111 
00112 #ifdef EIO
00113 #undef EIO
00114 #endif
00115 #define       EIO           5      /* Input/output error */
00116 
00117 #ifdef ENXIO
00118 #undef ENXIO
00119 #endif
00120 #define       ENXIO         6      /* Device not configured */
00121 
00122 #ifdef E2BIG
00123 #undef E2BIG
00124 #endif
00125 #define       E2BIG         7      /* Argument list too long */
00126 
00127 #ifdef ENOEXEC
00128 #undef ENOEXEC
00129 #endif
00130 #define       ENOEXEC              8      /* Exec format error */
00131 
00132 #ifdef EBADF
00133 #undef EBADF
00134 #endif
00135 #define       EBADF         9      /* Bad file descriptor */
00136 
00137 #ifdef ECHILD
00138 #undef ECHILD
00139 #endif
00140 #define       ECHILD        10     /* No child processes */
00141 
00142 #ifdef EDEADLK
00143 #undef EDEADLK
00144 #endif
00145 #define       EDEADLK              11     /* Resource deadlock avoided */
00146 
00147 #ifdef was
00148 #undef was
00149 #endif
00150                             /* 11 was EAGAIN */
00151 
00152 #ifdef ENOMEM
00153 #undef ENOMEM
00154 #endif
00155 #define       ENOMEM        12     /* Cannot allocate memory */
00156 
00157 #ifdef EACCES
00158 #undef EACCES
00159 #endif
00160 #define       EACCES        13     /* Permission denied */
00161 
00162 #ifdef EFAULT
00163 #undef EFAULT
00164 #endif
00165 #define       EFAULT        14     /* Bad address */
00166 
00167 #ifdef ENOTBLK
00168 #undef ENOTBLK
00169 #endif
00170 #define       ENOTBLK              15     /* Block device required */
00171 
00172 #ifdef EBUSY
00173 #undef EBUSY
00174 #endif
00175 #define       EBUSY         16     /* Device busy */
00176 
00177 #ifdef EEXIST
00178 #undef EEXIST
00179 #endif
00180 #define       EEXIST        17     /* File exists */
00181 
00182 #ifdef EXDEV
00183 #undef EXDEV
00184 #endif
00185 #define       EXDEV         18     /* Cross-device link */
00186 
00187 #ifdef ENODEV
00188 #undef ENODEV
00189 #endif
00190 #define       ENODEV        19     /* Operation not supported by device */
00191 
00192 #ifdef ENOTDIR
00193 #undef ENOTDIR
00194 #endif
00195 #define       ENOTDIR              20     /* Not a directory */
00196 
00197 #ifdef EISDIR
00198 #undef EISDIR
00199 #endif
00200 #define       EISDIR        21     /* Is a directory */
00201 
00202 #ifdef EINVAL
00203 #undef EINVAL
00204 #endif
00205 #define       EINVAL        22     /* Invalid argument */
00206 
00207 #ifdef ENFILE
00208 #undef ENFILE
00209 #endif
00210 #define       ENFILE        23     /* Too many open files in system */
00211 
00212 #ifdef EMFILE
00213 #undef EMFILE
00214 #endif
00215 #define       EMFILE        24     /* Too many open files */
00216 
00217 #ifdef ENOTTY
00218 #undef ENOTTY
00219 #endif
00220 #define       ENOTTY        25     /* Inappropriate ioctl for device */
00221 
00222 #ifdef ETXTBSY
00223 #undef ETXTBSY
00224 #endif
00225 #define       ETXTBSY              26     /* Text file busy */
00226 
00227 #ifdef EFBIG
00228 #undef EFBIG
00229 #endif
00230 #define       EFBIG         27     /* File too large */
00231 
00232 #ifdef ENOSPC
00233 #undef ENOSPC
00234 #endif
00235 #define       ENOSPC        28     /* No space left on device */
00236 
00237 #ifdef ESPIPE
00238 #undef ESPIPE
00239 #endif
00240 #define       ESPIPE        29     /* Illegal seek */
00241 
00242 #ifdef EROFS
00243 #undef EROFS
00244 #endif
00245 #define       EROFS         30     /* Read-only file system */
00246 
00247 #ifdef EMLINK
00248 #undef EMLINK
00249 #endif
00250 #define       EMLINK        31     /* Too many links */
00251 
00252 #ifdef EPIPE
00253 #undef EPIPE
00254 #endif
00255 #define       EPIPE         32     /* Broken pipe */
00256 
00257 #ifdef EDOM
00258 #undef EDOM
00259 #endif
00260 #define       EDOM          33     /* Numerical argument out of domain */
00261 
00262 #ifdef ERANGE
00263 #undef ERANGE
00264 #endif
00265 #define       ERANGE        34     /* Result too large */
00266 
00267 #ifdef EAGAIN
00268 #undef EAGAIN
00269 #endif
00270 #define       EAGAIN        35     /* Resource temporarily unavailable */
00271 
00272 #ifdef ENOTEMPTY
00273 #undef ENOTEMPTY
00274 #endif
00275 #define       ENOTEMPTY   39       /* Directory not empty */
00276 
00277 
00278 // in winsock.h
00279 
00280 #ifdef EBADRPC
00281 #undef EBADRPC
00282 #endif
00283 #define       EBADRPC              72     /* RPC struct is bad */
00284 
00285 #ifdef ERPCMISMATCH
00286 #undef ERPCMISMATCH
00287 #endif
00288 #define       ERPCMISMATCH  73     /* RPC version wrong */
00289 
00290 #ifdef EPROGUNAVAIL
00291 #undef EPROGUNAVAIL
00292 #endif
00293 #define       EPROGUNAVAIL  74     /* RPC prog. not avail */
00294 
00295 #ifdef EPROGMISMATCH
00296 #undef EPROGMISMATCH
00297 #endif
00298 #define       EPROGMISMATCH 75     /* Program version wrong */
00299 
00300 #ifdef EPROCUNAVAIL
00301 #undef EPROCUNAVAIL
00302 #endif
00303 #define       EPROCUNAVAIL  76     /* Bad procedure for program */
00304 
00305 #ifdef ENOLCK
00306 #undef ENOLCK
00307 #endif
00308 #define       ENOLCK        77     /* No locks available */
00309 
00310 #ifdef ENOSYS
00311 #undef ENOSYS
00312 #endif
00313 #define       ENOSYS        78     /* Function not implemented */
00314 
00315 #ifdef EOVERFLOW
00316 #undef EOVERFLOW
00317 #endif
00318 #define       EOVERFLOW     79     /* Value too large to be stored in data type */
00319 
00320 // From cderr.h
00321 #ifdef FNERR_INVALIDFILENAME
00322 #undef FNERR_INVALIDFILENAME
00323 #endif
00324 #define FNERR_INVALIDFILENAME  0x3002
00325 
00326 // From signal.h
00327 #define SIGABRT         0
00328 #define SIGSEGV         1
00329 #define _SIGCOUNT       2 /* LAST ONE, SIZES BUFFER */
00330 
00331 // From stdio.h
00332 
00333 #define _MAX_FNAME     256
00334 
00335 #define BUFSIZ 512
00336 #define O_RDONLY       0x0000  // open for reading only
00337 #define O_WRONLY       0x0001  // open for writing only
00338 #define O_RDWR         0x0002  // open for reading and writing
00339 #define O_APPEND       0x0008  // writes done at eof
00340 
00341 #define O_TEXT         0x4000  // file mode is text (translated)
00342 #define O_BINARY       0x8000  // file mode is binary (untranslated)
00343 
00344 #define O_CREAT        0x0100  // create and open file
00345 #define O_TRUNC        0x0200  // open and truncate
00346 #define O_EXCL         0x0400  // open only if file doesn't already exist
00347 
00348 #define _O_TEMPORARY    0x0040  // temporary file bit
00349 
00350 #define _O_CREAT        O_CREAT
00351 #define _O_TRUNC        O_TRUNC
00352 #define _O_WRONLY       O_WRONLY
00353 
00354 // From stdlib.h
00355 #define _MAX_PATH       MAX_PATH
00356 
00357 // From sys/types.h
00358 typedef int ptrdiff_t;
00359 typedef long _off_t;
00360 typedef long off_t;
00361 
00362 // From sys/stat.h
00363 #if !defined(_STAT_DEFINED)
00364 #define _STAT_DEFINED
00365 #define _S_IFDIR    0040000 /* stat, is a directory */
00366 #define _S_IFREG    0100000 /* stat, is a normal file */
00367 #define _S_IREAD    0000400 /* stat, can read */
00368 #define _S_IWRITE   0000200 /* stat, can write */
00369 #define       _S_IEXEC      0000100
00370 
00371 struct mozce_stat
00372 {
00373     unsigned short st_mode;
00374     _off_t st_size;
00375     time_t st_ctime;
00376     time_t st_atime;
00377     time_t st_mtime;
00378 };
00379 
00380 #define _stat mozce_stat
00381 #define stat mozce_stat
00382 #endif /* _STAT_DEFINED */
00383 
00384 #ifdef HANDLE_FLAG_INHERIT
00385 #undef HANDLE_FLAG_INHERIT
00386 #endif
00387 #define HANDLE_FLAG_INHERIT 0x00000001
00388 
00389 // From time.h
00390 
00391 #define _TM_DEFINED
00392 struct tm {
00393     int tm_sec;
00394     int tm_min;
00395     int tm_hour;
00396     int tm_mday;
00397     int tm_mon;
00398     int tm_year;
00399     int tm_wday;
00400     int tm_yday;
00401     int tm_isdst;
00402 };
00403 
00404 
00405 typedef struct mozce_GLYPHMETRICS 
00406 { 
00407   UINT  gmBlackBoxX; 
00408   UINT  gmBlackBoxY; 
00409   POINT gmptGlyphOrigin; 
00410   short gmCellIncX; 
00411   short gmCellIncY; 
00412 } mozce_GLYPHMETRICS;
00413 
00414 typedef struct mozce_PANOSE { 
00415   BYTE bFamilyType; 
00416   BYTE bSerifStyle; 
00417   BYTE bWeight; 
00418   BYTE bProportion; 
00419   BYTE bContrast; 
00420   BYTE bStrokeVariation; 
00421   BYTE bArmStyle; 
00422   BYTE bLetterform; 
00423   BYTE bMidline; 
00424   BYTE bXHeight; 
00425 } mozce_PANOSE;
00426 
00427 typedef struct mozce_OUTLINETEXTMETRIC 
00428 { 
00429   UINT   otmSize; 
00430   TEXTMETRIC otmTextMetrics; 
00431   BYTE   otmFiller; 
00432   mozce_PANOSE otmPanoseNumber; 
00433   UINT   otmfsSelection; 
00434   UINT   otmfsType; 
00435   int    otmsCharSlopeRise; 
00436   int    otmsCharSlopeRun; 
00437   int    otmItalicAngle; 
00438   UINT   otmEMSquare; 
00439   int    otmAscent; 
00440   int    otmDescent; 
00441   UINT   otmLineGap; 
00442   UINT   otmsCapEmHeight; 
00443   UINT   otmsXHeight; 
00444   RECT   otmrcFontBox; 
00445   int    otmMacAscent; 
00446   int    otmMacDescent; 
00447   UINT   otmMacLineGap; 
00448   UINT   otmusMinimumPPEM; 
00449   POINT  otmptSubscriptSize; 
00450   POINT  otmptSubscriptOffset; 
00451   POINT  otmptSuperscriptSize; 
00452   POINT  otmptSuperscriptOffset; 
00453   UINT   otmsStrikeoutSize; 
00454   int    otmsStrikeoutPosition; 
00455   int    otmsUnderscoreSize; 
00456   int    otmsUnderscorePosition; 
00457   PSTR   otmpFamilyName; 
00458   PSTR   otmpFaceName; 
00459   PSTR   otmpStyleName; 
00460   PSTR   otmpFullName; 
00461 } mozce_OUTLINETEXTMETRIC;
00462 
00463 
00464 #define SW_SHOWMINIMIZED 2 
00465 #define GGO_METRICS 0
00466 #define GGO_GLYPH_INDEX 1
00467 
00468 /****************************************************************************
00469 **  exdispid.h
00470 **
00471 **  ??? Wondering what these really should be.
00472 ****************************************************************************/
00473 #define DISPID_QUIT                     (__LINE__ + 3000) /* 103 */
00474 #define DISPID_PROGRESSCHANGE           (__LINE__ + 3000) /* 108 */
00475 #define DISPID_WINDOWMOVE               (__LINE__ + 3000) /* 109 */
00476 #define DISPID_WINDOWRESIZE             (__LINE__ + 3000) /* 110 */
00477 #define DISPID_WINDOWACTIVATE           (__LINE__ + 3000) /* 111 */
00478 
00479 #define CBM_INIT 4
00480 
00481 #ifndef MM_TEXT
00482 #define MM_TEXT             1
00483 #endif
00484 
00485 #ifndef SM_CYVTHUMB
00486 #define SM_CYVTHUMB 9
00487 #endif
00488 
00489 #ifndef SM_CXHTHUMB
00490 #define SM_CXHTHUMB 10
00491 #endif
00492 
00493 #ifndef DFCS_SCROLLSIZEGRIP
00494 #define DFCS_SCROLLSIZEGRIP     0x0008
00495 #endif
00496 
00497 
00498 #ifndef RDW_NOINTERNALPAINT
00499 #define RDW_NOINTERNALPAINT 0
00500 #endif
00501 
00502 #ifndef LR_LOADFROMFILE
00503 #define LR_LOADFROMFILE 0
00504 #endif
00505 
00506 #ifndef MA_NOACTIVATE
00507 #define MA_NOACTIVATE 1
00508 #endif
00509 
00510 #ifndef MA_ACTIVATE
00511 #define MA_ACTIVATE 1
00512 #endif
00513 
00514 #ifndef WM_MOUSEACTIVATE
00515 #define WM_MOUSEACTIVATE WM_ACTIVATE
00516 #endif
00517 
00518 #ifndef GCL_HBRBACKGROUND
00519 #define GCL_HBRBACKGROUND (-10)
00520 #endif
00521 
00522 typedef struct WINDOWPLACEMENT
00523 {
00524   UINT  length;
00525   UINT  flags;
00526   UINT  showCmd;
00527   POINT ptMinPosition;
00528   POINT ptMaxPosition;
00529   RECT  rcNormalPosition;
00530 } WINDOWPLACEMENT, *PWINDOWPLACEMENT, *LPWINDOWPLACEMENT;
00531 
00532 typedef void (*_sigsig)(int inSignal);
00533 
00534 
00535 typedef struct mozce_FIXED { 
00536   WORD  fract; 
00537   short value; 
00538 } mozce_FIXED; 
00539 
00540 typedef struct mozce_MAT2 { 
00541   mozce_FIXED eM11; 
00542   mozce_FIXED eM12; 
00543   mozce_FIXED eM21; 
00544   mozce_FIXED eM22; 
00545 } mozce_MAT2; 
00546 
00547 
00548 #if UNDER_CE<501
00549 
00550 // These are already defined the 5.0 SDK.  You will needed
00551 // these defines if you are using another SDK
00552 
00553 #ifdef _BLENDFUNCTION
00554 #undef _BLENDFUNCTION
00555 #endif
00556 
00557 #ifdef BLENDFUNCTION
00558 #undef BLENDFUNCTION
00559 #endif
00560 
00561 #ifdef PBLENDFUNCTION
00562 #undef PBLENDFUNCTION
00563 #endif
00564 
00565 typedef struct _BLENDFUNCTION
00566 {
00567     BYTE   BlendOp;
00568     BYTE   BlendFlags;
00569     BYTE   SourceConstantAlpha;
00570     BYTE   AlphaFormat;
00571 }BLENDFUNCTION,*PBLENDFUNCTION;
00572 
00573 #endif
00574 
00575 
00576 //
00577 // currentlly defined blend function
00578 //
00579 
00580 #define AC_SRC_OVER                 0x00
00581 
00582 //
00583 // alpha format flags
00584 //
00585 
00586 #define AC_SRC_ALPHA                0x01
00587 
00588   
00589 struct color{
00590        unsigned char Red;
00591        unsigned char Green;
00592        unsigned char Blue;
00593        double Alpha;
00594 };
00595 
00596 
00597 // if using WINCE 5.0 SDK, you need these:
00598 #define LPRASPBDLG void*
00599 #define LPRASDIALDLG void*
00600 
00601 #endif