亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chapter 11 preprocessor directives -- valvano.htm

?? 嵌入式系統中c的開發
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0058)http://www.ece.utexas.edu/~valvano/embed/chap11/chap11.htm -->
<HTML><HEAD><TITLE>Chapter 11: Preprocessor Directives -- Valvano</TITLE>
<META http-equiv=content-type content=text/html;charset=iso-8859-1>
<META content="MSHTML 5.50.3825.1300" name=GENERATOR>
<META 
content="StarMax HD:Microsoft Office 98:Templates:Web Pages:Blank Web Page" 
name=Template></HEAD>
<BODY vLink=#800080 link=#0000ff>
<P><!--Developing Embedded Software in C using ICC11/ICC12/Hiware by Jonathan W. Valvano--><B><FONT 
face="Times New Roman,Times" size=4>Chapter 11: Preprocessor 
Directives</FONT></B></P>
<P><B><I><FONT face=Helvetica,Arial>What's in Chapter 11?</FONT></I></B></P>
<DIR>
<P><A 
href="http://www.ece.utexas.edu/~valvano/embed/chap11/chap11.htm#MACRO">Using 
#define to create macros</A><FONT face=Monaco><BR></FONT><A 
href="http://www.ece.utexas.edu/~valvano/embed/chap11/chap11.htm#DEFINITIONS">Using 
#ifdef to implement conditional compilation</A><FONT face=Monaco><BR></FONT><A 
href="http://www.ece.utexas.edu/~valvano/embed/chap11/chap11.htm#INTERPRETER">Using 
#include to load other software modules</A><FONT face=Monaco><BR></FONT><A 
href="http://www.ece.utexas.edu/~valvano/embed/chap11/chap11.htm#PRAGMA">Using 
#pragma to write interrupt software</A></P></DIR>
<P><FONT face="Times New Roman,Times">C compilers incorporate a preprocessing 
phase that alters the source code in various ways before passing it on for 
compiling. Four capabilities are provided by this facility in C. They are: 
</FONT></P>
<UL>
  <P><FONT face="Times New Roman,Times">macro processing <BR>inclusion of text 
  from other files <BR>conditional compiling <BR>in-line assembly language 
  </FONT></P></UL>
<P><FONT face="Times New Roman,Times">The preprocessor is controlled by 
directives which are not part of the C language proper. Each directive begins 
with a <B>#</B>character and is written on a line by itself. Only the 
preprocessor sees these directive lines since it deletes them from the code 
stream after processing them. </FONT></P>
<P><FONT face="Times New Roman,Times">Depending on the compiler, the 
preprocessor may be a separate program or it may be integrated into the compiler 
itself. C has an integrated preprocessor that operates at the front end of its 
single pass algorithm. </FONT></P>
<P><FONT face="Times New Roman,Times"><B><A 
name=MACRO></A></B></FONT><B><I><FONT face=Helvetica,Arial>Macro 
Processing</FONT></I></B></P>
<P><FONT face="Times New Roman,Times">We use macros for three reasons. 1) To 
save time we can define a macro for long sequences that we will need to repeat 
many times. 2) To clarify the meaning of the software we can define a macro 
giving a symbolic name to a hard-to-understand sequence. The I/O port #define 
macros are good examples of this reason. 3) To make the software easy to change, 
we can define a macro such that changing the macro definition, automatically 
updates the entire software. </FONT></P>
<UL>
  <P><CODE>#define Name CharacterString?... </CODE></P></UL>
<P><FONT face="Times New Roman,Times">define names which stand for arbitrary 
strings of text. After such a definition, the preprocessor replaces each 
occurrence of <I>Name</I> (except in string constants and character constants) 
in the source text with <I>CharacterString?...</I>. As C implements this 
facility, the term macro is misleading, since parameterized substitutions are 
not supported. That is, <I>CharacterString?...</I> does not change from one 
substitution to another according to parameters provided with <I>Name</I> in the 
source text. </FONT></P>
<P><FONT face="Times New Roman,Times">C accepts macro definitions only at the 
global level. </FONT></P>
<P><FONT face="Times New Roman,Times">The <I>Name</I> part of a macro definition 
must conform to the standard C naming conventions as described in <A 
href="http://www.ece.utexas.edu/~valvano/embed/chap2/chap2.htm">Chapter 2</A>. 
<I>CharacterString?...</I> begins with the first printable character following 
<I>Name</I> and continues through the last printable character of the line or 
until a comment is reached. </FONT></P>
<P><FONT face="Times New Roman,Times">If <I>CharacterString?...</I> is missing, 
occurrences of <I>Name</I> are simply squeezed out of the text. Name matching is 
based on the whole name (up to 8 characters); part of a name will not match. 
Thus the directive </FONT></P>
<UL>
  <P><CODE>#define size 10</CODE></P></UL>
<P><FONT face="Times New Roman,Times">will change</FONT></P>
<UL>
  <P><CODE>short data[size];</CODE></P></UL>
<P><FONT face="Times New Roman,Times">into</FONT></P>
<UL>
  <P><CODE>short data[10];</CODE></P></UL>
<P>&nbsp;</P>
<P><FONT face="Times New Roman,Times">but it will have no effect on</FONT></P>
<UL>
  <P><CODE>short data[size1];</CODE></P></UL>
<P><FONT face="Times New Roman,Times">Replacement is also performed on 
subsequent <B>#define</B> directives, so that new symbols may be defined in 
terms of preceding ones. </FONT></P>
<P><FONT face="Times New Roman,Times">The most common use of <B>#define</B> 
directives is to give meaningful names to constants; i.e., to define so called 
<I>manifest constants</I>. However, we may replace a name with anything at all, 
a commonly occurring expression or sequence of statements for instance. To 
disable interrupt during a critical section we could implement.</FONT></P>
<DIR>
<P><CODE>#define START_CRITICAL asm(" tpa\n staa %SaveSP\n sei")<BR>#define 
END_CRITICAL asm( ldaa %SaveSP\n tap")<BR>void function(void) {unsigned char 
SaveSP;<BR>&nbsp;&nbsp;&nbsp;&nbsp;START_CRITICAL; /* make atomic, entering 
critical section */<BR>&nbsp;&nbsp;&nbsp;&nbsp; /* we have exclusive access to 
global variables */<BR>&nbsp;&nbsp;&nbsp;&nbsp;END_CRITICAL; /* end critical 
section */<BR>}</CODE></P></DIR>
<ADDRESS><FONT face="Times New Roman,Times">Listing 11.1: Example of 
#define</FONT></ADDRESS>
<P>&nbsp;</P>
<P><FONT face="Times New Roman,Times"><B><A name=CONDITION></A>Conditional 
Compiling</B></FONT></P>
<P><FONT face="Times New Roman,Times">This preprocessing feature lets us 
designate parts of a program which may or may not be compiled depending on 
whether or not certain symbols have been defined. In this way it is possible to 
write into a program optional features which are chosen for inclusion or 
exclusion by simply adding or removing <B>#define </B>directives at the 
beginning of the program. </FONT></P>
<P><FONT face="Times New Roman,Times">When the preprocessor encounters 
</FONT></P>
<UL>
  <P><CODE>#ifdef Name</CODE><FONT face="Times New Roman,Times"> </FONT></P></UL>
<P><FONT face="Times New Roman,Times">it looks to see if the designated name has 
been defined. If not, it throws away the following source lines until it finds a 
matching </FONT></P>
<UL>
  <P><CODE>#else </CODE></P></UL>
<P><FONT face="Times New Roman,Times">or </FONT></P>
<UL>
  <P><CODE>#endif </CODE></P></UL>
<P><FONT face="Times New Roman,Times">directive. The <B>#endif </B>directive 
delimits the section of text controlled by <B>#ifdef</B>, and the <B>#else</B> 
directive permits us to split conditional text into true and false parts. The 
first part (<B>#ifdef...#else</B>) is compiled only if the designated name is 
defined, and the second (<B>#else...#endif</B>) only if it is not defined. 
</FONT></P>
<P><FONT face="Times New Roman,Times">The converse of <B>#ifdef</B> is the 
</FONT></P>
<UL>
  <P><CODE>#ifndef Name </CODE></P></UL>
<P><FONT face="Times New Roman,Times">directive. This directive also takes 
matching <B>#else</B> and <B>#endif</B> directives. In this case, however, if 
the designated name is not defined, then the first (<B>#ifndef...#else</B>) or 
only (<B>#ifndef...#endif</B>) section of text is compiled; otherwise, the 
second (<B>#else...#endif</B>), if present, is compiled. </FONT></P>
<P><FONT face="Times New Roman,Times">Nesting of these directives is allowed; 
and there is no limit on the depth of nesting. It is possible, for instance, to 
write something like </FONT></P>
<P><CODE>#ifdef ABC<BR>... /* ABC */<BR>#ifndef DEF<BR>... /* ABC and not DEF 
*/<BR>#else<BR>... /* ABC and DEF */<BR>#endif<BR>... /* ABC */<BR>#else<BR>... 
/* not ABC */<BR>#ifdef HIJ<BR>... /* not ABC but HIJ */<BR>#endif<BR>... /* not 
ABC */<BR>#endif</CODE></P>
<ADDRESS><FONT face="Times New Roman,Times">Listing 11.2: Examples on 
conditional compilation</FONT></ADDRESS>
<P><FONT face="Times New Roman,Times">where the ellipses represent conditionally 
compiled code, and the comments indicate the conditions under which the various 
sections of code are compiled.</FONT></P>
<P><FONT face="Times New Roman,Times">A good application of conditional 
compilation is inserting debugging instrumemts. In this example the only purpose 
of writing to PORTC is assist in performance debugging. Once the system is 
debugged,we can remove all the debugging code, simply by deleting the 
</FONT><CODE>#define Debug 1</CODE><FONT face="Times New Roman,Times"> 
line.</FONT></P>
<P><CODE>#define Debug 1<BR>int Sub(int j){ int i;<BR>#ifdef 
Debug<BR>&nbsp;&nbsp;&nbsp;&nbsp;PORTC|=0x01; /* PC0 set when Sub is entered 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久久| 欧美日韩电影在线播放| 亚洲精品你懂的| 日韩小视频在线观看专区| 97se亚洲国产综合自在线观| 日本va欧美va瓶| 久久综合av免费| 欧美一区二区在线看| 91久久香蕉国产日韩欧美9色| 国产在线精品一区二区夜色| 日韩高清在线一区| 午夜精品福利视频网站| 亚洲久草在线视频| 成人欧美一区二区三区| 国产精品萝li| 亚洲欧洲日韩女同| 亚洲天堂成人网| 91在线国内视频| 日日摸夜夜添夜夜添亚洲女人| 一区二区欧美精品| 亚洲一区二区视频在线观看| 亚洲视频网在线直播| 自拍偷拍亚洲激情| 亚洲一区在线观看免费| 午夜在线电影亚洲一区| 国产成人精品免费| 国产精品18久久久| 波多野洁衣一区| 91网站黄www| 欧美日韩一区 二区 三区 久久精品| 在线这里只有精品| 欧美群妇大交群中文字幕| 欧美精品三级在线观看| 欧美日韩久久久一区| 日本韩国一区二区三区| 欧美日韩在线观看一区二区 | 日韩一卡二卡三卡| 欧美三级韩国三级日本三斤| 欧美日韩在线电影| 欧美一级理论片| 久久久激情视频| 成人欧美一区二区三区1314| 亚洲一区二区精品3399| 日日夜夜免费精品| 国内精品伊人久久久久av影院| 国产呦萝稀缺另类资源| 精品中文字幕一区二区 | 日本韩国欧美一区| 777xxx欧美| 欧美激情一区二区三区不卡| 国产精品超碰97尤物18| 欧美激情一区二区三区在线| 中文在线免费一区三区高中清不卡| 亚洲视频免费看| 秋霞电影网一区二区| 国产成人免费在线| 欧美在线影院一区二区| 日韩视频一区二区| 国产精品久久久久久久久免费桃花| 亚洲欧美另类小说| 国产露脸91国语对白| 色天天综合色天天久久| 日韩精品一区二区三区在线观看| 91精品久久久久久久久99蜜臂| 欧美激情综合在线| 天堂成人国产精品一区| 国产精品一二三| 91福利国产成人精品照片| 久久久www免费人成精品| 国产亚洲一二三区| 秋霞av亚洲一区二区三| 色综合色狠狠综合色| 久久久美女艺术照精彩视频福利播放| 亚洲精品视频自拍| 国产成人aaa| 精品免费日韩av| 午夜日韩在线观看| 日本高清免费不卡视频| 中文字幕一区二区三区不卡| 国产精品色婷婷| 亚洲国产日韩精品| 91玉足脚交白嫩脚丫在线播放| 人人狠狠综合久久亚洲| 美女一区二区久久| 欧美日本一区二区三区| 国产精品视频一二三| 韩国成人福利片在线播放| 色香色香欲天天天影视综合网| 欧美二区三区的天堂| 日韩欧美成人激情| 五月激情综合网| 欧美中文字幕亚洲一区二区va在线| 亚洲一区二区免费视频| 色综合久久久久综合体桃花网| 中文字幕av不卡| av电影一区二区| 中文字幕不卡一区| 99在线热播精品免费| 国产精品天干天干在观线| 丝袜诱惑制服诱惑色一区在线观看| 国产精品1024久久| 国产精品水嫩水嫩| 成人高清在线视频| 亚洲女女做受ⅹxx高潮| 91极品视觉盛宴| 偷拍自拍另类欧美| 欧美日本精品一区二区三区| 天堂午夜影视日韩欧美一区二区| 欧美理论在线播放| 久久99这里只有精品| 久久精品视频网| 91性感美女视频| 天使萌一区二区三区免费观看| 欧美日韩一本到| 久久66热偷产精品| 中文字幕一区在线| 在线观看日韩毛片| 亚洲成人午夜影院| 日韩女同互慰一区二区| 国产成人亚洲综合a∨婷婷| 国产精品久久久久影院色老大| 91福利社在线观看| 激情文学综合丁香| 成人欧美一区二区三区小说 | 成人av动漫网站| 国内精品免费在线观看| 久久精品噜噜噜成人av农村| 日韩三级av在线播放| 国产成人自拍在线| 久久在线免费观看| 日本久久电影网| 国产一区福利在线| 亚洲一区免费视频| 久久嫩草精品久久久久| 欧美在线观看视频在线| 激情图区综合网| 亚洲国产精品久久一线不卡| 亚洲精品一区二区三区蜜桃下载 | 91精品国产全国免费观看| 黄页视频在线91| 亚洲成在线观看| 中文字幕的久久| 日韩午夜中文字幕| 欧美在线观看视频一区二区| 国产精品综合网| 日本美女一区二区三区| 国产精品麻豆视频| 亚洲成av人片一区二区三区| 久久久精品国产免大香伊| 欧美视频一区二区三区在线观看| 成人美女在线视频| 日本在线播放一区二区三区| 成人免费在线播放视频| 国产色综合一区| 欧美一区二区不卡视频| 69堂亚洲精品首页| 日韩欧美一区二区在线视频| 91精品国产综合久久精品性色| 91福利在线观看| 欧美日韩综合不卡| 欧美精品电影在线播放| 91麻豆精品国产综合久久久久久 | 欧美日韩精品二区第二页| 欧美性猛交xxxxxx富婆| 在线观看亚洲成人| 欧美区在线观看| 欧美第一区第二区| 久久午夜色播影院免费高清| 国产天堂亚洲国产碰碰| 国产精品久久夜| 99九九99九九九视频精品| 成人黄色国产精品网站大全在线免费观看 | 3d动漫精品啪啪1区2区免费| 3d动漫精品啪啪| 国产亚洲女人久久久久毛片| 国产精品污www在线观看| 亚洲女与黑人做爰| 日韩电影在线一区| 福利电影一区二区三区| 欧美性极品少妇| 26uuu精品一区二区三区四区在线| 国产精品毛片久久久久久| 亚洲成av人片一区二区梦乃| 久久成人久久爱| 91免费观看视频在线| 欧美一区二区视频在线观看| 中文字幕电影一区| 午夜欧美电影在线观看| 国产在线精品一区二区三区不卡| 91丨九色丨尤物| 日韩精品一区二区三区四区| 亚洲欧洲精品天堂一级| 日本一区中文字幕| 99热这里都是精品| 日韩免费一区二区三区在线播放| 在线视频一区二区三| 精品日韩欧美一区二区| 亚洲三级在线免费观看| 久久精品国产一区二区| 91福利资源站|