亚洲欧美第一页_禁久久精品乱码_粉嫩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 content=text/html;charset=iso-8859-1 http-equiv=content-type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<META 
content="StarMax HD:Microsoft Office 98:Templates:Web Pages:Blank Web Page" 
name=Template></HEAD>
<BODY link=#0000ff vLink=#800080>
<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一区二区三区免费野_久草精品视频
亚洲天堂a在线| 国产麻豆欧美日韩一区| 久久爱www久久做| 色综合天天综合| 欧美va在线播放| 亚洲电影第三页| 成人免费高清视频| 欧美videofree性高清杂交| 亚洲一区二区三区小说| 国产精品综合二区| 日韩一区二区电影在线| 一区二区三区视频在线观看| 国产精品456露脸| 精品国内二区三区| 另类专区欧美蜜桃臀第一页| 欧美在线高清视频| 亚洲欧美视频在线观看| 国产精品1区二区.| 久久久99精品久久| 精品亚洲国内自在自线福利| 欧美日本高清视频在线观看| 夜夜嗨av一区二区三区| 91女人视频在线观看| 国产精品色哟哟| 风间由美性色一区二区三区| 精品国产乱码久久久久久闺蜜| 日本怡春院一区二区| 欧美精品电影在线播放| 亚洲主播在线播放| 欧美在线你懂得| 亚洲一区二区精品视频| 欧美无砖专区一中文字| 亚洲网友自拍偷拍| 欧美日韩久久不卡| 五月婷婷综合网| 欧美熟乱第一页| 亚洲成年人网站在线观看| 欧美在线观看禁18| 日韩国产精品久久久| 欧美男同性恋视频网站| 午夜精品福利一区二区三区av| 在线免费观看视频一区| 亚洲成人综合网站| 日韩欧美精品在线| 国产一区不卡在线| 欧美国产一区二区在线观看| hitomi一区二区三区精品| 亚洲男女一区二区三区| 欧美日韩国产色站一区二区三区| 日韩不卡免费视频| 久久久久久免费毛片精品| 成人小视频在线观看| 一区二区三区蜜桃| 91精品国产乱| 成人一区二区三区| 午夜精品久久久| 久久老女人爱爱| 91亚洲永久精品| 蜜桃一区二区三区在线观看| 国产欧美日韩亚州综合| 91浏览器在线视频| 麻豆国产精品视频| 亚洲图片另类小说| 日韩三级在线免费观看| 成人激情免费视频| 香港成人在线视频| 欧美极品xxx| 欧美卡1卡2卡| 91日韩一区二区三区| 精品一区二区三区在线视频| 中文字幕一区二区视频| 欧美一区二区美女| av成人老司机| 精品一区二区三区日韩| 亚洲欧洲av一区二区三区久久| 91精品国产一区二区人妖| 成人h版在线观看| 麻豆一区二区三区| 亚洲一区二区视频在线观看| 久久久久久久久久久黄色| 91久久国产最好的精华液| 国产精品一区二区三区99| 亚洲国产成人av网| 最好看的中文字幕久久| 欧美成人bangbros| 欧美影院精品一区| 99久久婷婷国产综合精品电影| 青草av.久久免费一区| 一区二区三区在线观看国产| 国产无遮挡一区二区三区毛片日本| 欧美日韩免费在线视频| 色偷偷88欧美精品久久久| 国产成人精品一区二| 久久精品99国产精品日本| 亚州成人在线电影| 亚洲一区av在线| 亚洲老妇xxxxxx| 国产精品久久久久aaaa| 国产网站一区二区三区| 久久青草国产手机看片福利盒子 | 艳妇臀荡乳欲伦亚洲一区| 国产欧美日韩另类一区| 日韩欧美在线观看一区二区三区| 色94色欧美sute亚洲线路二 | 国产精品久久久久久久久动漫| 精品国产伦一区二区三区观看方式 | 日本色综合中文字幕| 亚洲精品国久久99热| 国产精品视频第一区| 国产女人水真多18毛片18精品视频| 日韩欧美电影一区| 精品999在线播放| 精品国精品国产| 精品久久久影院| 久久婷婷色综合| 国产网红主播福利一区二区| 国产日韩精品视频一区| 久久久久国产一区二区三区四区| 久久理论电影网| 国产精品污污网站在线观看| 国产精品久久一级| 一区二区三区视频在线看| 亚洲欧美激情一区二区| 亚洲一区二区三区四区在线| 亚洲综合精品自拍| 日本成人在线网站| 国产真实乱偷精品视频免| 国产成人一区在线| 色综合久久久久综合99| 欧美三日本三级三级在线播放| 欧美精品一级二级三级| 欧美成人乱码一区二区三区| 欧美精品一区二区三区蜜臀| 国产精品色在线观看| 亚洲午夜免费电影| 奇米综合一区二区三区精品视频 | 欧美日韩视频不卡| 日韩一区二区在线看片| 亚洲国产精品成人综合| 依依成人精品视频| 国内精品自线一区二区三区视频| 成人黄色片在线观看| 欧美性感一类影片在线播放| 欧美大胆一级视频| 国产精品国产馆在线真实露脸 | 亚洲高清一区二区三区| 久久99国产精品免费网站| 成人免费福利片| 欧美日韩国产一级| 国产欧美精品区一区二区三区| 亚洲一区二区在线播放相泽| 久久成人免费日本黄色| 色噜噜狠狠色综合中国| 日韩欧美国产综合在线一区二区三区| 国产亚洲欧美日韩日本| 一区二区三区加勒比av| 国产在线看一区| 欧美日韩亚洲综合在线| 欧美国产日韩一二三区| 日本在线不卡一区| 色婷婷综合久久久中文一区二区| 日韩精品最新网址| 亚洲地区一二三色| zzijzzij亚洲日本少妇熟睡| 欧美电影免费观看高清完整版在线 | 国产精品丝袜久久久久久app| 无码av免费一区二区三区试看| 成人av动漫在线| 久久品道一品道久久精品| 五月婷婷欧美视频| 99国产精品久久久久久久久久久| 日韩精品一区二区三区视频在线观看| 亚洲精品乱码久久久久久久久| 国产精华液一区二区三区| 日韩精品一区二区三区蜜臀 | 国产一区二区导航在线播放| 欧美精品色综合| 有坂深雪av一区二区精品| 国产高清成人在线| 欧美成人一区二区三区片免费 | 最新热久久免费视频| 国产精品一线二线三线| 日韩欧美自拍偷拍| 日韩专区一卡二卡| 欧美三级韩国三级日本三斤| 亚洲人快播电影网| 99re成人精品视频| 国产精品国产三级国产| www.日韩av| 亚洲色图另类专区| 91在线一区二区三区| 国产精品久久久久三级| 成人蜜臀av电影| 国产精品久久久爽爽爽麻豆色哟哟| 国产成a人亚洲| 国产欧美日韩卡一| www.成人在线| 亚洲乱码国产乱码精品精小说 | 色综合亚洲欧洲| 亚洲欧美另类久久久精品|