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

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

?? chapter 11 preprocessor directives -- valvano.htm

?? DevelopingEmbeddedSoftwareinC 嵌入式開發叢書 很不錯的
?? 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一区二区三区免费野_久草精品视频
亚洲男人的天堂av| 亚洲久草在线视频| 26uuu亚洲综合色欧美| 欧美一级日韩不卡播放免费| 在线区一区二视频| 91精品国产乱码久久蜜臀| 91精品国产综合久久精品app | 国产成人在线视频网址| 激情小说欧美图片| 色悠久久久久综合欧美99| 欧美猛男男办公室激情| 国产亚洲成年网址在线观看| 亚洲免费在线视频一区 二区| 亚洲一区在线视频观看| 久久99精品国产麻豆婷婷| 懂色av中文字幕一区二区三区| 91色porny蝌蚪| 宅男在线国产精品| 国产精品福利一区二区三区| 亚洲成人一区二区| 国产99精品国产| 欧美日韩国产美| 中文字幕视频一区二区三区久| 亚洲免费在线看| 天天影视色香欲综合网老头| 成人久久久精品乱码一区二区三区| 91激情五月电影| 国产精品乱人伦一区二区| 日本欧美在线看| 日韩欧美国产不卡| av在线免费不卡| 一区二区三区在线观看欧美| 91国产免费看| 日韩电影在线观看一区| 欧美日韩国产成人在线免费| 久久福利资源站| 国产精品色婷婷| 色94色欧美sute亚洲线路一久| 亚洲日本在线天堂| 欧美日韩视频不卡| 久草精品在线观看| 久久久不卡网国产精品二区| 国产一区二区在线观看视频| 欧美久久一二区| 久久99九九99精品| 国产精品电影一区二区| 欧美精品乱码久久久久久| 日韩电影在线观看一区| 久久亚洲影视婷婷| eeuss国产一区二区三区| 亚洲欧美成人一区二区三区| 欧美二区在线观看| 国产不卡在线一区| 天天综合天天做天天综合| 国产精品美女www爽爽爽| 欧美在线不卡视频| 国产在线国偷精品免费看| ㊣最新国产の精品bt伙计久久| 日本道在线观看一区二区| 国产麻豆视频精品| 天天影视涩香欲综合网| 亚洲三级理论片| 欧美精品一区二区三区视频| 欧美日韩一本到| 本田岬高潮一区二区三区| 韩国成人精品a∨在线观看| 亚洲国产中文字幕| 一区二区三区在线观看视频 | 国产日产精品一区| 2024国产精品视频| 欧美精选一区二区| 99精品欧美一区二区三区综合在线| 国产69精品一区二区亚洲孕妇 | 国产亚洲一区字幕| 欧美国产一区视频在线观看| 中文字幕日本乱码精品影院| 中文字幕在线不卡视频| 亚洲图片欧美综合| 男人的天堂亚洲一区| 欧美国产一区在线| 精品成人私密视频| 欧美国产日韩a欧美在线观看| 久久精品亚洲精品国产欧美 | |精品福利一区二区三区| 久久亚洲精品小早川怜子| 久久久久久**毛片大全| 精品国产免费人成在线观看| 欧美岛国在线观看| 亚洲国产精品黑人久久久| 亚洲国产欧美一区二区三区丁香婷| 亚洲精品美腿丝袜| 亚洲人吸女人奶水| 天堂影院一区二区| 精品一区二区精品| 丁香激情综合五月| 欧美三级三级三级爽爽爽| 久久一留热品黄| 亚洲成人资源在线| av电影在线不卡| 欧美亚洲图片小说| 中文字幕欧美日本乱码一线二线 | 国产盗摄视频一区二区三区| 在线免费视频一区二区| 欧美一区二区三区四区高清| 自拍偷拍欧美精品| 麻豆久久久久久| 在线中文字幕不卡| 国产香蕉久久精品综合网| 亚洲最新在线观看| 成人不卡免费av| 精品福利av导航| 亚洲午夜激情网页| 92国产精品观看| 中文av字幕一区| 国产一区二区精品久久91| 欧美一区二区三区免费在线看 | 欧美麻豆精品久久久久久| 久久久不卡网国产精品一区| 国产揄拍国内精品对白| 国产欧美精品一区二区三区四区| 精品一区二区三区日韩| 国产精品你懂的| 成人午夜在线播放| 日韩精品电影一区亚洲| 日韩一区二区三区高清免费看看 | 麻豆国产欧美一区二区三区| 国产亚洲视频系列| 91黄色免费版| 成人黄色777网| 国产精品中文欧美| 亚洲三级在线看| 欧美在线小视频| 国产一区二区三区国产| 国产精品黄色在线观看| 在线看日韩精品电影| 日韩国产欧美三级| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 亚洲国产一区视频| 欧美卡1卡2卡| 成人aaaa免费全部观看| 五月婷婷另类国产| 中文在线一区二区 | 91视频免费看| 国内精品免费**视频| 一区二区不卡在线播放 | 日韩精品一区二区三区老鸭窝 | 国产老女人精品毛片久久| 亚洲男同性视频| 欧美电视剧免费观看| av一二三不卡影片| 麻豆成人久久精品二区三区小说| 国产精品美女久久久久久| 欧美日韩免费电影| 99久久夜色精品国产网站| 精品一区二区三区视频| 久久精品国产一区二区三| 亚洲图片一区二区| 国产精品福利影院| 国产精品国产三级国产有无不卡| 精品国产髙清在线看国产毛片| 在线电影一区二区三区| 欧美亚洲一区二区三区四区| 99久久精品国产精品久久| av男人天堂一区| 91蜜桃免费观看视频| 色婷婷av一区二区三区大白胸| 94色蜜桃网一区二区三区| 日本丶国产丶欧美色综合| 欧美日韩国产高清一区| 精品国产乱码久久久久久老虎| 国产精品沙发午睡系列990531| 亚洲国产日日夜夜| 国产综合色产在线精品| 日本国产一区二区| 国产日韩欧美精品在线| 午夜精品成人在线| caoporn国产精品| 2020国产精品自拍| 亚洲午夜日本在线观看| 成人综合在线视频| 成人av手机在线观看| 色94色欧美sute亚洲线路一ni | 精品欧美久久久| 国产亚洲精品精华液| 国产精品九色蝌蚪自拍| 亚洲黄色片在线观看| 六月丁香综合在线视频| 成人视屏免费看| 欧美日韩中文国产| 欧美成人午夜电影| 亚洲视频一区二区免费在线观看| 午夜av一区二区| 成人黄色小视频| 日韩欧美专区在线| 国产精品欧美经典| 精品影视av免费| 欧美日韩一卡二卡三卡| 国产精品人妖ts系列视频| 麻豆精品视频在线观看| 色综合色狠狠天天综合色|