亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美日韩综合在线免费观看| 99精品久久免费看蜜臀剧情介绍| 亚洲精品高清视频在线观看| 亚洲成人av一区二区三区| 免费成人深夜小野草| 精品一区在线看| 色偷偷成人一区二区三区91 | 国产一区二区三区香蕉| 9i在线看片成人免费| 日韩免费视频线观看| 有码一区二区三区| 欧美巨大另类极品videosbest | 91精品国产一区二区三区香蕉| 中文字幕一区二区三区在线播放| 亚洲一区二区免费视频| av在线播放不卡| 亚洲一区二区三区影院| 日韩三级精品电影久久久 | 国产成人av电影免费在线观看| 欧美剧在线免费观看网站| 黑人巨大精品欧美一区| 制服丝袜国产精品| 亚洲成av人影院| 久久人人97超碰com| 日本亚洲最大的色成网站www| 欧美日韩免费在线视频| 欧美a一区二区| 国产欧美精品一区二区色综合朱莉 | 99久久综合狠狠综合久久| 欧美一区二区视频网站| 免费成人在线观看视频| 久久免费精品国产久精品久久久久| 国产美女视频一区| 亚洲激情校园春色| 久久伊99综合婷婷久久伊| 一区二区三区中文字幕在线观看| 国产成人免费视频网站高清观看视频| 日韩午夜激情电影| 色先锋资源久久综合| 国模一区二区三区白浆| 亚洲自拍偷拍网站| 中文字幕免费观看一区| av色综合久久天堂av综合| 另类欧美日韩国产在线| 精品国产青草久久久久福利| 久久9热精品视频| 亚洲国产综合视频在线观看| 欧美肥妇free| 一本到三区不卡视频| 国产99一区视频免费| 日韩国产高清在线| 亚洲精品国产一区二区精华液 | 国产人久久人人人人爽| 91精选在线观看| 日本高清成人免费播放| 亚洲综合自拍偷拍| 欧美—级在线免费片| 精品少妇一区二区三区在线播放| 久久99精品久久久久久久久久久久| 亚洲一区在线观看免费观看电影高清 | 国产精品一线二线三线精华| 亚洲国产精品国自产拍av| 欧美mv和日韩mv的网站| 日韩一区二区在线观看视频播放| 91高清在线观看| www..com久久爱| 床上的激情91.| 无吗不卡中文字幕| 久久一夜天堂av一区二区三区| 日韩写真欧美这视频| 91麻豆精品久久久久蜜臀| 欧美色倩网站大全免费| 欧美视频自拍偷拍| 狠狠色狠狠色综合系列| 麻豆精品视频在线观看| 久久综合色8888| 久久综合网色—综合色88| 精品久久五月天| 久久亚洲一级片| 国产日韩三级在线| 国产精品你懂的在线| 777午夜精品视频在线播放| 777午夜精品免费视频| 日韩欧美美女一区二区三区| 日韩午夜电影av| 欧美不卡一区二区三区| 国产亚洲欧美日韩日本| 欧美高清性hdvideosex| 91精品国产乱码久久蜜臀| 日韩三级.com| 国产片一区二区三区| 国产精品国产三级国产专播品爱网 | 国产精品全国免费观看高清| 国产精品福利一区二区| 亚洲综合区在线| 蜜臀av性久久久久蜜臀aⅴ| 久久av资源网| proumb性欧美在线观看| 欧美性受xxxx| 日韩欧美中文一区| 亚洲国产精品成人综合色在线婷婷 | 国产成人一区二区精品非洲| av不卡在线播放| 欧美日韩亚洲丝袜制服| 精品免费日韩av| 亚洲欧洲成人自拍| 日韩av中文在线观看| 国产精品91一区二区| 色综合久久久久久久久久久| 这里是久久伊人| 中文字幕一区在线观看| 丝瓜av网站精品一区二区 | 国产精品一二三四五| 91在线视频播放地址| 91精品国产综合久久蜜臀 | 中文字幕一区不卡| 婷婷亚洲久悠悠色悠在线播放 | 久久精品国产秦先生| 99精品视频一区二区三区| 欧美一区二区视频免费观看| 国产精品卡一卡二| 免费成人在线视频观看| av网站一区二区三区| 欧美一级二级在线观看| 亚洲欧美视频在线观看视频| 亚洲日本韩国一区| 一区二区日韩av| 国产乱理伦片在线观看夜一区| 欧美视频完全免费看| 欧美国产激情二区三区| 奇米精品一区二区三区在线观看一| 99在线精品观看| 2017欧美狠狠色| 水蜜桃久久夜色精品一区的特点 | 亚洲国产日韩在线一区模特 | 国产美女视频91| 4438x成人网最大色成网站| 亚洲精品免费播放| 国产精品亚洲视频| 日韩一区二区在线观看视频| 亚洲综合色婷婷| 91玉足脚交白嫩脚丫在线播放| 色综合色狠狠综合色| 欧美极品aⅴ影院| 国产在线一区观看| 日韩视频免费观看高清完整版在线观看| 亚洲最大成人综合| 色噜噜久久综合| 中文字幕日本不卡| 国产69精品久久99不卡| 久久亚洲精精品中文字幕早川悠里 | 久久99精品国产麻豆不卡| 91 com成人网| 亚洲国产成人av网| 日本道免费精品一区二区三区| 国产精品麻豆久久久| 国产乱人伦偷精品视频免下载 | 蜜臀91精品一区二区三区| 欧美巨大另类极品videosbest| 一区二区三区欧美视频| 91成人免费电影| 亚洲国产cao| 精品视频色一区| 亚洲3atv精品一区二区三区| 欧美性色黄大片| 亚洲成av人片在www色猫咪| 欧美三级视频在线观看| 亚洲国产精品精华液网站| 欧美精品乱码久久久久久| 午夜电影久久久| 91精品国产综合久久久久| 奇米影视一区二区三区小说| 日韩精品一区二区三区中文不卡 | 国产精品第五页| 色欲综合视频天天天| 亚洲激情网站免费观看| 欧美中文字幕一区二区三区亚洲| 欧美α欧美αv大片| 久久97超碰国产精品超碰| 亚洲精品一区二区精华| 国产精品综合一区二区| 久久精品夜色噜噜亚洲a∨| 懂色av一区二区三区蜜臀| 国产精品国产a| 欧美午夜精品电影| 免费成人在线观看| 中文字幕精品一区二区三区精品| 97精品超碰一区二区三区| 亚洲综合丝袜美腿| 欧美一区二区成人6969| 国产精品亚洲视频| 日韩伦理免费电影| 欧美精品v日韩精品v韩国精品v| 裸体一区二区三区| 中文字幕第一区二区| 在线观看日韩国产| 美女视频黄 久久| 国产精品全国免费观看高清| 欧美亚洲一区三区| 极品销魂美女一区二区三区|