cdg_enter.h

来自「是一个手机功能的模拟程序」· C头文件 代码 · 共 124 行

H
124
字号

/*
+------------------------------------------------------------------------------
|  File:       cdg_enter.h
+------------------------------------------------------------------------------
|                 Copyright Texas Instruments AG Berlin 2002-2003, Berlin
|                 All rights reserved.
|
|                 This file is confidential and a trade secret of Condat AG.
|                 The receipt of or possession of this file does not convey
|                 any rights to reproduce or disclose its contents or to
|                 manufacture, use, or sell anything it may describe, in
|                 whole, or in part, without the specific written consent of
|                 Texas Instruments AG Berlin.
+------------------------------------------------------------------------------
| Purpose:    Check the SrcFileTime of the cdginc header files at link time.
|             
|             The macros in this file help to detect version mismatch between 
|             header files included for build of different libraries. 
|             Example of a linker error: 
|             xx_tdc_3_constraints.obj : error LNK2001: 
|             unresolved external symbol 
|             "char  BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002" 
|             (?BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002@@3DA)
|             \gpf\util\teststack\bin\test_xx_tdc\xx_tdc.dll : 
|                                  fatal error LNK1120: 1 unresolved externals
|             Error executing link.exe.
| 
|             The first group of macros (protected by CDG_ENTER) are necessary 
|             to build the strings of type "BadLibVersionCheck__xxx".
|  
|             They need in turn other macros which are set in the *.h files of 
|             cdginc, tdcinc or message_san.h directory.
|             (e.g. CDG_ENTER__M_XX_VAL_H__FILE_TYPE) 
|
|             The check is done only for the header files of TDC, where 
|             ENABLE__CDG_ENTER__SANITY_CHECK is switched on.
|
+------------------------------------------------------------------------------
*/
#ifndef CDG_ENTER
#define CDG_ENTER


/* we need a 2 stage approach to expand A and B before concatting them */
#define CDG_ENTER_CONCATx(A,B) A##B
#define CDG_ENTER_CONCAT(A,B) CDG_ENTER_CONCATx(A,B)
#define CDG_ENTER_CONCAT3x(A,B,C) A##B##C
#define CDG_ENTER_CONCAT3(A,B,C) CDG_ENTER_CONCAT3x(A,B,C)
#define CDG_ENTER_CONCAT4x(A,B,C,D) A##B##C##D
#define CDG_ENTER_CONCAT4(A,B,C,D) CDG_ENTER_CONCAT4x(A,B,C,D)

/* we need a 2 stage approach to expand A before stringifying it */
#define CDG_ENTER_STRINGx(A) #A
#define CDG_ENTER_STRING(A) CDG_ENTER_STRINGx(A)

#define CDG_ENTER_GET_PRAGMA(PRAGMA) CDG_ENTER_CONCAT3(CDG_ENTER_,CDG_ENTER__FILENAME,__##PRAGMA)

/* CDG_ENTER_GET_FILE_TYPE is on the form: 
  CDG_ENTER_FILE_TYPE__TDCINC
                       <-FT-> 

  FT = CDG_ENTER_GET_PRAGMA(_FILE_TYPE) = CDG_ENTER__P_XX_CCD_DSC_CPP__FILE_TYPE = TDCINC
*/
#define CDG_ENTER_GET_FILE_TYPE CDG_ENTER_CONCAT(CDG_ENTER_FILE_TYPE__,CDG_ENTER_GET_PRAGMA(FILE_TYPE))

/* CDG_ENTER_SANITY_NAME is on the form:
  BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002
                  <-- FILENAME  -->   <--   SRC_FILE_TIME   -->       
*/
#if 0
#define CDG_ENTER_SANITY_NAME CDG_ENTER_CONCAT4(BadLibVersionCheck___,CDG_ENTER__FILENAME,___,CDG_ENTER_GET_PRAGMA(LAST_MODIFIED))
#else
#define CDG_ENTER_SANITY_NAME CDG_ENTER_CONCAT4(BadLibVersionCheck___,CDG_ENTER__FILENAME,___,CDG_ENTER_GET_PRAGMA(SRC_FILE_TIME))
#endif

/* create an enumerate sequence of the known file types so we can test which one we have with a '#if A == B' line */
#define CDG_ENTER_FILE_TYPE__CDGINC 1
#define CDG_ENTER_FILE_TYPE__TDCINC 2
#define CDG_ENTER_FILE_TYPE__TDCINC_DSC 3
#define CDG_ENTER_FILE_TYPE__TDCINC_MAIN 4
#endif 

/*
 * The check will be done only for TDC files, where 
 * ENABLE__CDG_ENTER__SANITY_CHECK is switched on.
 */
#if (CDG_ENTER_GET_FILE_TYPE == CDG_ENTER_FILE_TYPE__TDCINC) 
#define ENABLE__CDG_ENTER__SANITY_CHECK 
#endif

#ifdef CDG_ENTER_DEBUG
#pragma message (CDG_ENTER_STRING(CDG_ENTER__FILENAME))
#pragma message (CDG_ENTER_STRING(CDG_ENTER_SANITY_NAME))
#pragma message (CDG_ENTER_STRING(CDG_ENTER_GET_FILE_TYPE))
#endif

#ifdef ENABLE__CDG_ENTER__SANITY_CHECK 
  #ifdef CDG_ENTER_DEFINE_SANITY
  /* this part goes into ccddata.lib and tdcinc.lib */
  char CDG_ENTER_SANITY_NAME;
  #else
    #ifdef CDG_ENTER_DEBUG
    #pragma message (CDG_ENTER_STRING(CDG_ENTER_CONCAT(BadLibVersionCheck___,CDG_ENTER__FILENAME)))
    #endif
  /* this part goes into 
    every stack file using a cdginc .h or .val files (ones for every file used)
    and similar for tdc

    expands to e.g. 
      extern char BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002
  */
  extern char CDG_ENTER_SANITY_NAME;
  /* Originally it was this but since no one actually uses this stuff (we only have 
    it for the linker to check that versions match) we can save memory by only 
    storing the 8 lower bits.

    expands to e.g. 
      static char BadLibVersionCheck____P_XX_TDC_3_VAL_H = (char)(&BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002);
  */
  static char CDG_ENTER_CONCAT(BadLibVersionCheck___,CDG_ENTER__FILENAME) = (char)(&CDG_ENTER_SANITY_NAME);
  #endif
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?