友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!阅读过程发现任何错误请告诉我们,谢谢!! 报告错误
九色书籍 返回本书目录 我的书架 我的书签 TXT全本下载 进入书吧 加入书签

[免费下载 c语言深度解剖[1]-第23章

按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!



: 
2003…2008XXXXCorporation;AllRightsReserved。 
* 
ModuleName 
: 
DrawEngine/Display 
* 
* 
CPU 
: 
ARM7 
* 
RTOS 
: 
Tron 
* 
* 
CreateDate 
: 
2008/10/01 
* 
Author/Corporation 
: 
WhoAmI/yourpanyname 
* 
* 
AbstractDescription 
: 
Placesomedescriptionhere。 
* 
*…RevisionHistory… 
No 
Version 
Date 
RevisedBy 
Item 
Description 
* 
1 
V0。95 
08。05。18 
WhoAmI 
abcdefghijklm 
WhatUDo 
* 
************************************************************************/
【规则7…2】各个源文件必须有一个头文件说明,头文件各部分的书写顺序下:

No。 
Item 
1 
Header 
File 
Header 
Section 
2 
Multi…Include…Prevent 
Section 
3 
Debug 
Switch 
Section 
4 
Include 
File 
Section 
5 
Macro 
Define 
Section 
6 
Structure 
Define 
Section 
7 
PrototypeDeclareSection 


其中 
Multi…Include…PreventSection是用来防止头文件被重复包含的。
如下例: 


#ifndef 
__FN_FILENAME_H 
#define__FN_FILENAME_H 
#endif
其中“FN_FILENAME”一般为本头文件名大写,这样可以有效避免重复,因为同一工程
中不可能存在两个同名的头文件。 



/************************************************************************ 


* 
FileName 
: 
FN_FileName。h 
* 
Copyright 
: 
2003…2008XXXXCorporation;AllRightsReserved。 
* 
ModuleName 
: 
DrawEngine/Display 
* 
* 
CPU 
: 
ARM7 
* 
RTOS 
: 
Tron 
* 
* 
CreateDate 
: 
2008/10/01 
* 
Author/Corporation 
: 
WhoAmI/yourpanyname 
* 
* 
AbstractDescription 
: 
Placesomedescriptionhere。 
* 
*RevisionHistory… 
No 
Version 
Date 
RevisedBy 
Item 
Description 
* 
1 
V0。95 
08。05。18 
WhoAmI 
abcdefghijklm 
WhatUDo 
* 
************************************************************************/ 
/************************************************************************ 
* 
Multi…Include…PreventSection 
************************************************************************/ 
#ifndef 
__FN_FILENAME_H 
#define 
__FN_FILENAME_H 
/************************************************************************ 


* 
DebugswitchSection 
************************************************************************/ 
#define 
D_DISP_BASE 
/************************************************************************ 


* 
IncludeFileSection 
************************************************************************/ 
#include 
〃IncFile。h〃 
/************************************************************************ 


* 
MacroDefineSection 
************************************************************************/ 
#define 
MAX_TIMER_OUT 
(4) 
/************************************************************************ 


* 
Struct 
DefineSection 
************************************************************************/ 
typedef 
structCM_RadiationDose 
{ 
unsignedcharucCtgID; 
charcPatId_a'MAX_PATI_LEN'; 
}CM_RadiationDose_st;*CM_RadiationDose_pst; 


/************************************************************************ 


* 
PrototypeDeclareSection 
************************************************************************/ 
unsignedintMD_guiGetScanTimes(void); 
… 
… 
#endif 

【规则7…3】源文件各部分的书写顺序如下: 


No。 
Item 
1 
Source 
File 
Header 
Section 
2 
Debug 
Switch 
Section 
3 
Include 
File 
Section 
4 
Macro 
Define 
Section 
5 
Structure 
Define 
Section 
6 
Prototype 
Declare 
Section 
7 
Global 
Variable 
Declare 
Section 
8 
File 
Static 
Variable 
Define 
Section 
9 
Function 
Define 
Section 


/************************************************************************* 


* 
File 
Name 
: 
FN_FileName。c 
* 
Copyright 
: 
2003…2008XXXXCorporation;AllRightsReserved。 
* 
ModuleName 
: 
DrawEngine/Display 
* 
* 
CPU 
: 
ARM7 
* 
RTOS 
: 
Tron 
* 
* 
CreateDate 
: 
2003/10/01 
* 
Author/Corporation 
: 
WhoAmI/yourpanyname 
* 
* 
Abstract 
Description 
: 
Place 
some 
description 
here。 
* 
*…RevisionHistory… 
No 
Version 
Date 
Revised 
By 
Item 
Description 
* 
1 
V0。95 
00。05。18 
WhoAmI 
abcdefghijklm 
WhatUDo 
* 
************************************************************************/ 
/************************************************************************ 


* 
DebugswitchSection 
************************************************************************/ 
#define 
D_DISP_BASE 
/************************************************************************ 


* 
Include 
File 
Section 
************************************************************************/ 
#include 
〃IncFile。h〃 
/************************************************************************ 


* 
MacroDefineSection 
************************************************************************/ 
#define 
MAX_TIMER_OUT 
(4) 
/************************************************************************ 



* 
Struct 
Define 
Section 
************************************************************************/ 
typedef 
structCM_RadiationDose 
{ 
unsignedchar 
ucCtgID; 
char 
cPatId_a'MAX_PATI_LEN'; 
}CM_RadiationDose_st; 
*pCM_RadiationDose_st; 


/************************************************************************ 


* 
PrototypeDeclareSection 
************************************************************************/ 
unsigned 
int 
MD_guiGetScanTimes(void); 
/************************************************************************ 


* 
GlobalVariableDeclareSection 
************************************************************************/ 
extern 
unsigned 
intMD_guiHoldBreathStatus; 
/************************************************************************ 


* 
File 
Static 
Variable 
Define 
Section 
************************************************************************/ 
static 
unsignedint 
nuiNaviSysStatus; 
/************************************************************************ 


* 
Function 
Define 
Section 
************************************************************************/
【规则7…4】需要对外公开的常量放在头文件中,不需要对外公开的常量放在定义文件

的头部。

7。2,文件名命名的规则
【规则7…5】文件标识符分为两部分,即文件名前缀和后缀。文件名前缀的最前面要使

用范围限定符——模块名(文件名)缩写;

【规则7…6】采用小写字母命名文件,避免使用一些比较通俗的文件名,如:public。c等。


16
返回目录 上一页 回到顶部 0 0
未阅读完?加入书签已便下次继续阅读!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!