telepathygabble/inc/libgabble_wsd_macros.h
branchRCL_3
changeset 8 3404599e4dda
parent 7 46cc8e302e43
equal deleted inserted replaced
7:46cc8e302e43 8:3404599e4dda
     1 /*
       
     2  * libgabble_wsd_macros.h - Header 
       
     3  * Copyright (C) 2006 Collabora Ltd.
       
     4  *   @author Ole Andre Vadla Ravnaas <ole.andre.ravnaas@collabora.co.uk>
       
     5  * 
       
     6 
       
     7  * This library is free software; you can redistribute it and/or
       
     8  * modify it under the terms of the GNU Lesser General Public
       
     9  * License as published by the Free Software Foundation; either
       
    10  * version 2.1 of the License, or (at your option) any later version.
       
    11  *
       
    12  * This library is distributed in the hope that it will be useful,
       
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    15  * Lesser General Public License for more details.
       
    16  *
       
    17  * You should have received a copy of the GNU Lesser General Public
       
    18  * License along with this library; if not, write to the Free Software
       
    19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    20  */
       
    21 
       
    22 #ifndef _LIBGABBLEMACROS_WSD_DEFS_H_
       
    23 #define _LIBGABBLEMACROS_WSD_DEFS_H_
       
    24 
       
    25 #if (defined(SYMBIAN) && (defined(__WINSCW__) || defined(__WINS__)))
       
    26 #if EMULATOR
       
    27 #undef EMULATOR
       
    28 #endif
       
    29 #ifdef GET_WSD_VAR_NAME
       
    30 #undef GET_WSD_VAR_NAME
       
    31 #endif
       
    32 
       
    33 #define EMULATOR (defined(SYMBIAN) && (defined(__WINSCW__) || defined(__WINS__)))
       
    34 #define GET_WSD_VAR_NAME(var,filename,prefix) 	_##prefix##_##filename##_##var
       
    35 
       
    36 #define RETURN_WSD_VAR(var,filename,prefix) (libgabble_ImpurePtr()->GET_WSD_VAR_NAME(var,filename,prefix))
       
    37 
       
    38 #define GET_WSD_VAR_FROM_TLS(var,filename,type,prefix)\
       
    39 type *_##prefix##_##filename##_##var()\
       
    40 {\
       
    41 	return (&RETURN_WSD_VAR(var,filename,prefix));\
       
    42 }
       
    43 
       
    44 #define GET_WSD_ARRAY_FROM_TLS(var,filename,type,prefix)\
       
    45 type *_##prefix##_##filename##_##var()\
       
    46 {\
       
    47 	return (RETURN_WSD_VAR(var,filename,prefix));\
       
    48 }
       
    49 
       
    50 #define VARIABLE_DECL(var,varprefix,filename,datatype)\
       
    51 datatype GET_WSD_VAR_NAME(var,filename,varprefix);
       
    52 
       
    53 #define VARIABLE_DECL_ARRAY(var,prefix,filename,datatype,size) \
       
    54 datatype GET_WSD_VAR_NAME(var,filename,prefix)[size];
       
    55 
       
    56 #define VARIABLE_DECL_2DARRAY(var,prefix,filename,datatype,size,size1) \
       
    57 datatype GET_WSD_VAR_NAME(var,filename,prefix)[size][size1];
       
    58 
       
    59 
       
    60 #define GET_STATIC_VAR_FROM_TLS(var,filename,type) 		GET_WSD_VAR_FROM_TLS(var,filename,type,s)
       
    61 
       
    62 #define GET_GLOBAL_VAR_FROM_TLS(var,filename,type) 	GET_WSD_VAR_FROM_TLS(var,filename,type,g)
       
    63 
       
    64 #define GET_STATIC_ARRAY_FROM_TLS(var,filename,type) 	GET_WSD_ARRAY_FROM_TLS(var,filename,type,s)
       
    65 
       
    66 #define GET_GLOBAL_ARRAY_FROM_TLS(var,filename,type) 	GET_WSD_ARRAY_FROM_TLS(var,filename,type,g)
       
    67 
       
    68 #endif
       
    69 #endif		//_LIBGABBLEMACROS_WSD_DEFS_H_