📄 tdc_base.h
字号:
/*
+------------------------------------------------------------------------------
| File: tdc_base.h
+------------------------------------------------------------------------------
| Copyright Condat AG 2002, 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
| Condat AG.
+------------------------------------------------------------------------------
| Purpose:
|
+------------------------------------------------------------------------------
*/
#if defined TDC_PRECOMPILE && !defined TDC_BASE_TDC_H
#define TDC_BASE_TDC_H
//#line 1 "tdc_base.tdc_x" //TODO verify still needed //tdc_i.pl can not handle a file including it self simulate another file
#include "tdc_base.tdc_h"
//#line 2 "tdc_base.tdc_x"
//extern TDC_PRECOMPILE__force_linesync; //force #line ...
#endif //defined TDC_PRECOMPILE && !defined TDC_BASE_TDC_H
#ifndef TDC_BASE_H
#define TDC_BASE_H
//Constants comming from macros.h -> used in cc.doc
#define NOT_PRESENT_8BIT 0xff
#define NOT_PRESENT_16BIT 0xffff
#define NOT_PRESENT_32BIT 0xffffffffl
//#define TDC_USE_ALLOC_DEBUG_COUNTER //memory leak detection
#define TDC_DEBUG
//tdc_test_header_begin
#ifndef TDC_TEST_I_CPP
#include <assert.h>
#include <setjmp.h>
#include <stddef.h>
#include <typeinfo.h>
#include <malloc.h>
#include <string.h>
#endif
#pragma warning(disable:4786)
//tdc_test_header_end
#define FALSE 0
#define TRUE 1
#define TDC_NO_PROFILING
#define TDC_PORT
//============================================================================
#if TDC_DEBUG_DOT_COMPLETE
struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1
{
int i;
};
void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1A()
{
T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s;
s.
i;
}
#else
#endif
//============================================================================
#ifndef TDC_PART
#define TDC_SIZE 99999L // number of structs per compilation
/* VC6 can not handle more than 30000 types at the times but this has not
so much to do with this, here we are trying to minimize the overall
memory usage during compilation, this is a problem for the umts asn1 file
the big isue is that determin this number is not an excat sicense since
VC give NO hint on whic entry is coursing this problem if it ocour during
pass2 of the compilation */
#define TDC_PART 0L // which struct part to compile in this session
#define TDC_ENUM_PART 1 // if enum part is to be compiled in this session
#elif TDC_PART == -1
#define TDC_ENUM_PART 1 // if enum part is to be compiled in this session
#else
#define TDC_ENUM_PART 0 // if enum part is to be compiled in this session
#endif
#ifndef TDC_DESCRIPTOR
#define NO_TDC_DESCRIPTOR
#else //TDC_DESCRIPTOR
#define __T_TDC_INTERFACE_MESSAGE__
#define __T_TDC_INTERFACE_PRIMITIVE__
#endif //TDC_DESCRIPTOR
#if DOT_COMPLETE
#define TDC_DOT_COMPLETE_HIDE(code)
struct T_TDC_EMPTY {};
#else//DOT_COMPLETE
#define TDC_DOT_COMPLETE_HIDE(code) code
#endif//DOT_COMPLETE
///tdc_test_header_begin
#ifndef M_TDC_DOC
#if DOT_COMPLETE
void TDC_NOTHING() {} // generate code for breakpoint
size_t TDC_LENGTHOF(array) {}
void TDC_DYNAMIC_DEAD_CODE() {} // program execution is not suposed to reach this point
#else //DOT_COMPLETE
void tdc_nothing();
#define TDC_NOTHING() /* generate code for breakpoint */\
tdc_nothing()
#define TDC_DYNAMIC_DEAD_CODE() tdc_dynamic_dead_code() // program execution is not suposed to reach this point
#define TDC_LENGTHOF(array) (size_t(sizeof array / sizeof *array))
#define M_TDC_STRING1(text) #text
#define M_TDC_STRING(text) M_TDC_STRING1(text) /* expand macros before stringify */
#endif //DOT_COMPLETE
#endif //M_TDC_DOC
// macro to show pragma message with file name and line number when compiling (see M_TDC_MESSAGE_DEMO below)
#define M_TDC_MESSAGE(text) message(__FILE__ "(" M_TDC_STRING(__LINE__) ") : message: \'" text "\'")
#ifdef M_TDC_MESSAGE_DEMO
// e.g. show how a macro is expanded
#define MY(X) MY_##X
#pragma M_TDC_MESSAGE(M_TDC_STRING(MY(Y)))
// compiler output: \gpf\inc\tdc_base.h(130) : message: 'MY_Y'
#endif
// values for IN_CLASS macro argument
#define M_TDC_IN_CLASS(code) code
#define M_TDC_NOT_IN_CLASS(code)
#define M_TDC_NOT_M_TDC_IN_CLASS(code)
#define M_TDC_NOT_M_TDC_NOT_IN_CLASS(code) code
// values for WITH_BODY macro argument
#define M_TDC_WITH_BODY(code) code
#define M_TDC_WITHOUT_BODY(code) ;
// temporary removed multiline comments in multiline macros (some compilers have problems with "/* \\\n */")
#define M_TDC_COMMENT(code) ;
/* for testing macros
these macros is only used when tdc.dsw has the active project set to "tdc_lib - Win32 Precompile"
*/
#define TDC_MACRO_BEGIN_(name,line)
#define TDC_MACRO_(name,line)
#define TDC_MACRO_END_()
///tdc_test_header_end
#ifndef USE_TDC_TEST_I_II//{{ // during testing we see this part in the preprocessed file tdc_test_i.ii
struct T_TDC_BASE_DOT_COMPLETE_TEST
{
int i; //HINT
};
#define TBD tdc_tbd();
#ifndef TDC_DEBUG
#define IF_TDC_DEBUG(code)
#else
#define IF_TDC_DEBUG(code) code
#endif
#ifndef TDC_TEST_PROFILE
#define TDC_PURE_BODY(code)\
= 0;
#else
#define TDC_PURE_BODY(code)\
{\
tdc_pure_body();\
code\
}\
#endif
#if TDC_DEBUG_DOT_COMPLETE
void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1C()
{
T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s;
s.
i;
}
#else
#endif
void tdc_cursor_trace (char* file, int line, char* format, ...);
void tdc_trace (char* format, ...);
void tdc_trace_fail (char* format, ...);
extern "C" void tdc_usi_trace (char* format, ...);
void tdc_internal_error (char* format, ...);
void tdc_user_error (char* format, ...);
void tdc_check_array_assignment(const void* that, const void* address);
void tdc_check_pointer (void* pointer);
// some error reporting functions, which have no argument becourse they have to be called from a lot of places
void tdc_tbd(); // this facility is yet to be defined i.e. implemented
void tdc_pure_body();
void tdc_dynamic_dead_code(); // program execution is not suposed to reach this point
void tdc_missing_h_file(); // use of AIM/SAP not included
//============================================================================
#if TDC_DEBUG_DOT_COMPLETE
void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1D()
{
T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s;
s.
i;
}
#else
#endif
//----------------------------------------------------------------------------
//tdc_test_header_begin
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
#ifdef M_TDC_DOC
/*
The definitions in this sections is only present to be able to generate call graphs to be used
in documentation (call graphs are generated with SourceInsight 3.5)
*/
// Naming convention template tree
#define BASE() MAIN() PART()
#define MAIN() all_unions() PRIM_and_MSG() XXX()
#define all_unions() PRMITIVE_UNION() MESSAGE_UNION()
#define XXX() XXX_PRMITIVE_UNION() XXX_MESSAGE_UNION()
#define PRIM_and_MSG() PRIM() MSG()
#define PART() COMP() VAR()
#define COMP() STRUCT() UNION()
#define VAR() INT() ENUM()
#define ENUM() PENUM() MENM()
#define PRMITIVE_UNION()
#define MESSAGE_UNION()
#define XXX_PRMITIVE_UNION()
#define XXX_MESSAGE_UNION()
#define PRIM()
#define MSG()
#define STRUCT() PSTRUCT() MSTRUCT()
#define UNION() PUNION() PUNION()
#define PSTRUCT()
#define MSTRUCT()
#define PUNION()
#define PUNION()
#define PENUM()
#define MENM()
#define INT()
// base entries
/*
#define M_TDC_BASE\
M_TDC_FORWARD_BASE(SHORT_NAME, T_HANDLE)\
M_TDC_INSTANCE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE_, T_INSTANCE, T_HANDLE_)\
M_TDC_INTERFACE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE_, T_HANDLE)\
M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\
M_TDC_FORWARD_BASE(SHORT_NAME, T_HANDLE)\
//*/
//TDC keywords
void TDC_keywords()
{
FAIL();
PASS();
SEND(primitive);
AWAIT(primitive);
START_TIMEOUT(timeout);
WAIT_TIMEOUT();
MUTE(timeout);
COMMAND(command);
TIMEOUT(timeout);
PARKING(enable);
ALT() //dummy "()"to force call graph
{
ON(await);
OTHERWISE();
}
TRAP() //dummy "()"to force call graph
{
}
ONFAIL() //dummy "()"to force call graph
{
}
}
#endif
//----------------------------------------------------------------------------
#if DOT_COMPLETE_DEFINES
#define CCC(COMMENT)
//----------------------------------------------------------------------------
// macros to generate dummy functions body
//----------------------------------------------------------------------------
#define M_TDC_TYPE_NAME\
//for(;;); /* no error for missing return */
#define T_TDC_TYPE_NAME
//----------------------------------------------------------------------------
// macros to repeat stuff that is similar in many descriptor classes
//----------------------------------------------------------------------------
#define M_TDC_FORWARD_PRIM(SAP,SHORT_NAME)
#define M_TDC_FORWARD_PSTRUCT(SHORT_NAME)
#define M_TDC_FORWARD_PUNION(SHORT_NAME)
#define M_TDC_FORWARD_SDU(SHORT_NAME)
#define M_TDC_FORWARD_PENUM(SHORT_NAME)
//-----
#define M_TDC_FORWARD_MSG(SHORT_NAME)
#define M_TDC_FORWARD_MSTRUCT(SHORT_NAME)
#define M_TDC_FORWARD_MUNION(SHORT_NAME)
#define M_TDC_FORWARD_MENUM(SHORT_NAME)
//-----
#define M_TDC_FORWARD_INT(SHORT_NAME)
#define M_TDC_FORWARD_XXX_PRIMITIVE_UNION(SAP)
#define M_TDC_FORWARD_XXX_MESSAGE_UNION(MSG)
#define M_TDC_FORWARD_PRIMITIVE()
#define M_TDC_FORWARD_MESSAGE()
//----------------------------------------------------------------------------
// macros to repeat stuff that is similar in many descriptor classes
//----------------------------------------------------------------------------
#define M_TDC_DESCRIPTOR_PRIM_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_PUNION_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_SDU_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_PENUM_ADDITIONAL(SHORT_NAME)
//-----
#define M_TDC_DESCRIPTOR_MSG_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_MSTRUCT_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_MUNION_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_MENUM_ADDITIONAL(SHORT_NAME)
//-----
#define M_TDC_DESCRIPTOR_INT_ADDITIONAL(SHORT_NAME)
#define M_TDC_DESCRIPTOR_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP)
#define M_TDC_DESCRIPTOR_XXX_MESSAGE_UNION_ADDITIONAL(MSG)
#define M_TDC_CREATE_DEFAULT_PRIMITIVE_DESCRIPTOR_CLASS(SAP)
#define M_TDC_DESCRIPTOR_PRIMITIVE_ADDITIONAL()
#define M_TDC_CREATE_DEFAULT_MESSAGE_DESCRIPTOR_CLASS(MSG)
#define M_TDC_DESCRIPTOR_MESSAGE_ADDITIONAL()
//----------------------------------------------------------------------------
// macros to repeat stuff that is similar in many interface classes
//----------------------------------------------------------------------------
#ifndef TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST //{{
#define TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST
struct T_TDC_INTERFACE_DOT_COMPLETE_TEST
{
typedef char T_HANDLE;
};
#endif //}}TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST
//-----
#define M_TDC_INTERFACE_PRIM_ADDITIONAL(SHORT_NAME)
#define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)
#define M_TDC_INTERFACE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)
#define M_TDC_INTERFACE_SDU_ADDITIONAL(SHORT_NAME)
#define M_TDC_INTERFACE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)
//-----
#define M_TDC_INTERFACE_MSG_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)
#define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -