test: icc_i386.h Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# icc_i386.h

Go to the documentation of this file.

    00001 #ifndef ICC_I386_H
    00002 #define ICC_I386_H
    00003 #include "windows.h"
    00004
    00005 #ifdef  __cplusplus
    00006 extern "C"
    00007 {
    00008 #endif
    00009
    00010 // ColorProfile errors - can be later added to global Errors
    00011 //
    00012 typedef enum
    00013 {
    00014     CP_NULL_POINTER_ERR = 10000,
    00015     CP_MEMORY_ALLOC_ERR,
    00016     CP_FILE_OPEN_ERR,
    00017     CP_FILE_READ_ERR,
    00018     CP_FORMAT_ERR,
    00019     CP_OUT_OF_RANGE_ERR,
    00020     CP_NO_MEMORY_ERR,
    00021     CP_NOT_FOUND_ERR,
    00022     CP_POSTSCRIPT_ERR
    00023 } cpError;
    00024
    00025
    00026 /*------------------------------------------------------------------------*/
    00027 //          Application specific data
    00028 //
    00029 //  We use here the same concept that is used in WINSOCK 1.1 specifications.
    00030 //  All the data that come from the ColorProfile are in "network" format,
    00031 //   and we deal with that data using "host" format. The "host" byte order can
    00032 //   be either big- or little-endian, the size of the integers and floats
    00033 //   may vary too, we only require that all "host" type data must have
    00034 //   the precision  equal or higher of the "network" data.
    00035 //  The platfornm-specific implementation must provide macros or functions
    00036 //   to convert from  "network" to "host" representation.
    00037 //  Currently we do not write data into profile, so no conversion
    00038 //   from "host" to "network" is  required.
    00039 //
    00040 //  The basic types that should be defined to work with ColorProfiles are:
    00041 //
    00042 //      BOOL    -   any size variable that can hold either TRUE or FALSE
    00043 //      BYTES   -   exactly 8-bit
    00044 //      SINT    -   signed int capable of holding at least 32 bits
    00045 //      SFLOAT  -   signed float capable of holding at least 32 bits
    00046 //      CSIG    -   entity that can hold at least 32 bits of signature
    00047 //                      in host format
    00048 //      ATTRIB  -   entity that can hold at least 64 bits of attributes
    00049 //                      in host format
    00050 //      MEMPTR  -   Pointer to the memory block which can refernce more
    00051 //                      than 64K of BYTES
    00052 //
    00053 //
    00054 /*------------------------------------------------------------------------*/
    00055
    00056 #ifndef     BOOL
    00057 typedef     int             BOOL;       // Any variable that can hold
    00058 #endif                                  //  a boolean TRUE/FALSE
    00059
    00060 typedef     unsigned char   BYTES;      // Exactly 8 bits
    00061
    00062 typedef     short           SHORT;      // Exactly 16 bits signed int
    00063
    00064 typedef     unsigned short  USHORT;     // Exactly 16 bits unsigned signed int
    00065
    00066 typedef     signed long     SINT;       // The signed integer type that can
    00067                                         //  hold more than 32768( > 16bits)
    00068
    00069 typedef     float           SFLOAT;     // The type that can hold a floating
    00070                                         //  or fixed point variable
    00071                                         //  at least with 5 digits after point,
    00072                                         //  both positive and negtive
    00073
    00074 typedef     unsigned long   CSIG;       // Type that can hold a Signature -
    00075                                         //  32-bits or more
    00076
    00077 typedef     unsigned long   ATTRIB[2];  // Type that can hold attributes,
    00078                                         // it's more than or equal to 64 bits
    00079
    00080 typedef     BYTES __huge    *MEMPTR;    // Pointer to the memory that can
    00081                                         // access more than 64K BYTES
    00082 typedef     MEMPTR __huge   *PMEMPTR;
    00083
    00084 typedef     SHORT __huge    *PSHORT;
    00085 typedef     USHORT __huge   *PUSHORT;
    00086 typedef     SFLOAT __huge   *PFLOAT;
    00087 #define     EXTERN          __loadds __far __pascal
    00088
    00089
    00090 /*------------------------------------------------------------------------*/
    00091 //  Pointers to the platform-specific data types.
    00092 //
    00093 /*------------------------------------------------------------------------*/
    00094
    00095 // Those pointers are platform and OS specific. For all 16-bit apps
    00096 //   we have to explicitly declare those pointers as __far for them
    00097 //   to be able to point to the data in case DS !=SS.
    00098 // Pointers that will be used to sequentially access the
    00099 //   data (like anypointer[i]  and so on) must be declared  __huge
    00100 //   in order to provide correct passing of 64K selector boundary.
    00101 // For NT apps and other 32-bit apps all pointers are 32-bits, so no
    00102 //   __far and __huge declaration is necessary.
    00103
    00104 typedef     BYTES   __far   *LPBYTES;
    00105 typedef     SINT    __far   *LPSINT;
    00106 typedef     SFLOAT  __far   *LPSFLOAT;
    00107 typedef     CSIG    __far   *LPCSIG;
    00108 typedef     ATTRIB  __far   *LPATTRIB;
    00109 typedef     MEMPTR  __far   *LPMEMPTR;
    00110
    00111 typedef     icProfile       __huge *lpcpProfile;
    00112 typedef     icHeader        __huge *lpcpHeader;
    00113 typedef     icTagList       __huge *lpcpTagList;
    00114 typedef     icTag           __huge *lpcpTag;
    00115 typedef     icTagBase       __huge *lpcpTagBase;
    00116
    00117 typedef     icCurveType     __huge *lpcpCurveType;
    00118 typedef     icLut16Type     __huge *lpcpLut16Type;
    00119 typedef     icLut8Type      __huge *lpcpLut8Type;
    00120 typedef     icXYZType       __huge *lpcpXYZType;
    00121
    00122
    00123 //===========================================================================
    00124 //    Macros to convert from Color Profile to Platform-specific
    00125 //          data representation.
    00126 //  We assume here that all data in ColorProfile are accessed through
    00127 //      pointer to BYTES. The only valid way to use those macros
    00128 //      is to call them this way:
    00129 //          MEMPTR lpMem;
    00130 //          ...
    00131 //          lpMem = ..........;
    00132 //          z = XtoY(lpMem);
    00133
    00134 #define     ui8toSINT(a)    ((SINT) (a))
    00135 #define     ui16toSINT(a)   ((SINT) ( ( ((a)[0]<<8) & 0x00FF00) | \
    00136                                       (  (a)[1] & 0x00FF)))
    00137 #define     ui32toSINT(a)   ((SINT) ( ( (((SINT)(a)[0])<<24) & 0x00FF000000) | \
    00138                                       ( (((SINT)(a)[1])<<16) & 0x00FF0000  ) | \
    00139                                       ( (       (a)[2] <<8)  & 0x00FF00    ) | \
    00140                                       (         (a)[3]       & 0x00FF      )))
    00141
    00142 #define     si8toSINT(a)    ((SINT) (a))
    00143 #define     si16toSINT(a)   ((SINT) (   ((SINT)(a)[0])<<8 | \
    00144                                       (        (a)[1] & 0x00FF)))
    00145 #define     si32toSINT(a)   ((SINT) (   ((SINT)(a)[0])<<24                | \
    00146                                     (  (((SINT)(a)[1])<<16) & 0x00FF0000) | \
    00147                                     (  (       (a)[2] <<8)  & 0x00FF00  ) | \
    00148                                     (          (a)[3] & 0x00FF          )))
    00149
    00150 #define     ui8f8toSFLOAT(a)   ((SFLOAT)(  (a)[0] + (a)[1]/256.0) )
    00151 #define     ui16f16toSFLOAT(a) ((SFLOAT)(  (a)[0]*256.0         + \
    00152                                            (a)[1]               + \
    00153                                          ( (a)[2]               + \
    00154                                            (a)[3]/256.0 ) /256.0 ))
    00155
    00156
    00157 #define     si16f16toSFLOAT(a) ( ((SFLOAT)( ((SINT)(a)[0])<<24                | \
    00158                                           ((((SINT)(a)[1])<<16) & 0x00FF0000) | \
    00159                                           (       ((a)[2] <<8)  & 0x00FF00  ) | \
    00160                                           (        (a)[3]        & 0x00FF   )   \
    00161                                  )) /65536.0)
    00162
    00163
    00164 #define     SigtoCSIG(a)    ((CSIG) ( ( (((SINT)(a)[0])<<24) & 0x00FF000000) | \
    00165                                       ( (((SINT)(a)[1])<<16) & 0x00FF0000  ) | \
    00166                                       ( (       (a)[2] <<8)  & 0x00FF00    ) | \
    00167                                       (         (a)[3]       & 0x00FF      )  ) )
    00168
    00169
    00170 #ifdef  __cplusplus
    00171 }
    00172 #endif
    00173
    00174 #endif  //  ICC_I386_H