/************************************************************************
* File Name : FN_FileName.c/ FN_FileName.h
* Copyright : 2003-2008 XXXX Corporation, All Rights Reserved.
* Module Name : Draw Engine/Display
*
* CPU : ARM7
* RTOS : Tron
*
* Create Date : 2008/10/01
* Author/Corporation : WhoAmI/your company name
**
Abstract Description : Place some description here.
**
———————–Revision History———————————
* No Version Date Revised By Item Description
* 1 V0.95 08.05.18 WhoAmI abcdefghijklm WhatUDo
*
************************************************************************/
【规则7-2】各个源文件必须有一个头文件说明,头文件各部分的书写顺序下:
其中Multi-Include-Prevent Section 是用来防止头文件被重复包含的。
如下例:
#ifndef __FN_FILENAME_H
#define __FN_FILENAME_H
#endif
其中“FN_FILENAME”一般为本头文件名大写,这样可以有效避免重复,因为同一工程
中不可能存在两个同名的头文件。
/************************************************************************
* File Name : FN_FileName.h
* Copyright : 2003-2008 XXXX Corporation, All Rights Reserved.
* Module Name : Draw Engine/Display
*
* CPU : ARM7
* RTOS : Tron
*
* Create Date : 2008/10/01
* Author/Corporation : WhoAmI/your company name
**
Abstract Description : Place some description here.
**
—————————————-Revision History———————————
* No Version Date Revised By Item Description
* 1 V0.95 08.05.18 WhoAmI abcdefghijklm WhatUDo
*
************************************************************************/
/************************************************************************
* Multi-Include-Prevent Section
************************************************************************/
#ifndef __FN_FILENAME_H
#define __FN_FILENAME_H
/************************************************************************
* Debug switch Section
************************************************************************/
#define D_DISP_BASE
/************************************************************************
* Include File Section
************************************************************************/
#include “IncFile.h”
/************************************************************************
* Macro Define Section
************************************************************************/
#define MAX_TIMER_OUT (4)
/************************************************************************
* Struct Define Section
************************************************************************/
typedef struct CM_RadiationDose
{
unsigned char ucCtgID;
char cPatId_a[MAX_PATI_LEN];
}CM_RadiationDose_st, *CM_RadiationDose_pst;
/************************************************************************
* Prototype Declare Section
************************************************************************/
unsigned intMD_guiGetScanTimes(void);
…… #endif
【规则7-3】源文件各部分的书写顺序如下:
/*************************************************************************
* File Name : FN_FileName.c
* Copyright : 2003-2008 XXXX Corporation, All Rights Reserved.
* Module Name : Draw Engine/Display
*
* CPU : ARM7
* RTOS : Tron
*
* Create Date : 2003/10/01
* Author/Corporation : WhoAmI/your company name
**
Abstract Description : Place some description here.
**
———————–Revision History———————————
* No Version Date Revised By Item Description
* 1 V0.95 00.05.18 WhoAmI abcdefghijklm WhatUDo
*
************************************************************************/
/************************************************************************
* Debug switch Section
************************************************************************/
#define D_DISP_BASE
/************************************************************************
* Include File Section
************************************************************************/
#include “IncFile.h”
/************************************************************************
* Macro Define Section
************************************************************************/
#define MAX_TIMER_OUT (4)
/************************************************************************
* Struct Define Section
************************************************************************/
typedef struct CM_RadiationDose
{
unsigned char ucCtgID;
char cPatId_a[MAX_PATI_LEN];
}CM_RadiationDose_st, *pCM_RadiationDose_st;
/************************************************************************
* Prototype Declare Section
************************************************************************/
unsigned int MD_guiGetScanTimes(void);
/************************************************************************
* Global Variable Declare Section
************************************************************************/
extern unsigned int MD_guiHoldBreathStatus;
/************************************************************************
* File Static Variable Define Section
************************************************************************/
static unsigned int nuiNaviSysStatus;
/************************************************************************
* Function Define Section
************************************************************************/
【规则7-4】需要对外公开的常量放在头文件中,不需要对外公开的常量放在定义文件
的头部。
>> 本文固定链接: http://www.vcgood.com/archives/3610