Tizen 2.0 Release
[external/epson-laser-printer-escpage.git] / lib / epson-escpr-mem.h
1 /*_______________________________   epson-escpr-mem.h   ________________________________*/\r
2 \r
3 /*       1         2         3         4         5         6         7         8        */\r
4 /*34567890123456789012345678901234567890123456789012345678901234567890123456789012345678*/\r
5 /*******************************************|********************************************/\r
6 /*\r
7 *   Copyright (c) 2009  Seiko Epson Corporation                 All rights reserved.\r
8 *\r
9 *   Copyright protection claimed includes all forms and matters of\r
10 *   copyrightable material and information now allowed by statutory or judicial\r
11 *   law or hereinafter granted, including without limitation, material generated\r
12 *   from the software programs which are displayed on the screen such as icons,\r
13 *   screen display looks, etc.\r
14 *\r
15 */\r
16 /*******************************************|********************************************/\r
17 /*                                                                                      */\r
18 /*                             Epson memory Module Definitions                          */\r
19 /*                                                                                      */\r
20 /*******************************************|********************************************/\r
21 #ifndef _EPSON_ESPCR_MEM_H_\r
22 #define _EPSON_ESPCR_MEM_H_\r
23 #ifdef    __cplusplus\r
24 extern "C" {\r
25 #endif    /* def __cplusplus    */\r
26 \r
27 \r
28 /*------------------------------- Global Compiler Switch -------------------------------*/\r
29 /*******************************************|********************************************/\r
30 \r
31 /*------------------------------------  Includes   -------------------------------------*/\r
32 /*******************************************|********************************************/\r
33 #include "epson-typedefs.h"\r
34 #include "epson-escpr-pvt.h"\r
35 \r
36 \r
37 /*------------------------------  Import Debug utility   -------------------------------*/\r
38 /*******************************************|********************************************/\r
39 #ifdef GCOMSW_DEBUG\r
40 #include "epson-escpr-dbg.h"\r
41 #else\r
42 /* Redefine Debug macros */\r
43 #define EPS_ALLOC( s )      epsCmnFnc.memAlloc((EPS_UINT32)s)\r
44 #define EPS_FREE( p )       epsCmnFnc.memFree( p )\r
45 #define EPS_RETURN(e)           return e;\r
46 #define EPS_RETURN_VOID         return;\r
47         \r
48 #define EPS_MEM_INIT    \r
49 #define EPS_MEM_RESET_PEAK\r
50 #define EPS_MEM_REPORT_PEAK\r
51 #define EPS_MEM_GET_PEAK        (0)\r
52 #define EPS_MEM_REPORT_LEAK \r
53 \r
54 #define EPS_DBGPRINT( f )\r
55 #define EPS_DUMP( p, s )\r
56 #define EPS_DUMP_STR( str )\r
57 \r
58 #define EPS_LOG_INITIALIZE(f, m)\r
59 #define EPS_LOG_TREMINATE\r
60 #define EPS_LOG_FUNCIN          \r
61 #define EPS_LOG_FUNCOUT(e)      \r
62 \r
63 #define DECRALE_DMP_FILE\r
64 #define EPS_DF_OPEN( fn )\r
65 #define EPS_DF_CLOSE\r
66 #define EPS_DF_WRITE( p, s )\r
67 #endif\r
68 \r
69 /*----------------------------------  Generic Macros   ---------------------------------*/\r
70 /*******************************************|********************************************/\r
71 \r
72 #define EPS_SAFE_RELEASE( p )   \\r
73         if( NULL != p ){                        \\r
74                 EPS_FREE( p );                  \\r
75                 p = NULL;                               \\r
76         }\r
77 \r
78 /*---------------------------------- CPU Endian-ness -----------------------------------*/\r
79 /*******************************************|********************************************/\r
80 typedef enum _EPS_ENDIAN {\r
81     EPS_ENDIAN_NOT_TESTED = 1000,\r
82     EPS_ENDIAN_BIG,\r
83     EPS_ENDIAN_LITTLE\r
84 } EPS_ENDIAN;\r
85 \r
86 typedef enum _EPS_BYTE_SIZE {\r
87     EPS_2_BYTES   = 2000,\r
88     EPS_4_BYTES   = 4000\r
89 } EPS_BYTE_SIZE;\r
90 \r
91 \r
92 #define EPS_SWP_ORDER16(data) (EPS_INT16)((((data) >>  8) & 0x00FF    )|(((data) <<  8) & 0xFF00    ) )\r
93 #define EPS_SWP_ORDER32(data) (EPS_INT32)((((data) >> 24) & 0x000000FF)|(((data) >>  8) & 0x0000FF00) | \\r
94                           (((data) <<  8) & 0x00FF0000)|(((data) << 24) & 0xFF000000) )\r
95 \r
96 \r
97 /*-----------------------------------  Definitions  ------------------------------------*/\r
98 /*******************************************|********************************************/\r
99     /*** Max, Min                                                                       */\r
100     /*** -------------------------------------------------------------------------------*/\r
101 #define Max(a,b) ( ((a) > (b)) ? (a) : (b))\r
102 #define Min(a,b) ( ((a) < (b)) ? (a) : (b))\r
103 \r
104     /*** memcpy macro for readability                                                   */\r
105     /*** -------------------------------------------------------------------------------*/\r
106 #define COPY_BYTES(des,src,size)    memcpy(des,src,size); des+=size;\r
107 \r
108 \r
109 /*--------------------------  Public Function Declarations   ---------------------------*/\r
110 /*******************************************|********************************************/\r
111 extern void*            memRealloc                      (void*, EPS_UINT32, EPS_UINT32                  );\r
112 \r
113 extern EPS_INT8*        memStrStr                       (EPS_INT8*, const EPS_INT8*, EPS_BOOL                   );\r
114 extern EPS_INT8*        memStrStrWithLen        (EPS_INT8*, EPS_UINT32, const EPS_INT8*         );\r
115 \r
116 extern void         memSetEndian        (EPS_ENDIAN, EPS_BYTE_SIZE, EPS_UINT32, EPS_UINT8*);\r
117 extern void         memInspectEndian    (void                                           );\r
118 extern EPS_INT32        memGetBitCount          (EPS_INT32                                      );\r
119 extern EPS_UINT8        memSearchWhiteColorVal(EPS_UINT8, EPS_UINT8*, EPS_UINT16                        );\r
120 \r
121 #define EPS_MEM_GROW(t, p, pCurSize, nNewSize)                                          \\r
122                 /*EPS_DBGPRINT(("GROW %d->%d\n", *pCurSize, (nNewSize)))*/      \\r
123                 if(*pCurSize < (nNewSize)){                                                                     \\r
124                         p = (t)memRealloc(p, *pCurSize, (nNewSize));                    \\r
125                         *pCurSize = (nNewSize);                                                                 \\r
126                 }\r
127                 \r
128 #ifdef    __cplusplus\r
129 }\r
130 #endif    /* def __cplusplus    */\r
131 \r
132 #endif    /* def _EPSON_ESPCR_MEM_H_ */\r
133 \r
134 /*_______________________________   epson-escpr-mem.h   ________________________________*/\r
135   \r
136 /*34567890123456789012345678901234567890123456789012345678901234567890123456789012345678*/\r
137 /*       1         2         3         4         5         6         7         8        */\r
138 /*******************************************|********************************************/\r
139 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
140 /***** End of File *** End of File *** End of File *** End of File *** End of File ******/\r
141 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r