CCS下makefile的编写_第1页
CCS下makefile的编写_第2页
CCS下makefile的编写_第3页
CCS下makefile的编写_第4页
CCS下makefile的编写_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、CCS makefile文件编写前期预备知识Alternation and Grouping1 | 用法 PUBLIC|PRIVATE :表示匹配单词为PUBLIC或者PRIVATE 2 空格以用法 PUBLIC (void|DWORD) :3 表示一行的开始处, t 表跟着多个空格或tabs.例子:PUBLIC t+(void|int|long|DWORD) It matches, at the beginning of a line, the word "PUBLIC", followed by one or more spaces or tabs, followed

2、by any one of the following words: "void", "int", "long" or "DWORD". Beginning and Ending of LinePUBLIC: 一行开头是PUBLIC。)$: 一行结尾是圆括号。)$ 这一行就只有一个圆括号。Character ClassesAEIOUYaeiouy : matches any vowel, whether upper or lower case.0-9will match any character between

3、0 and 9. 如果不用在开头字母上, 放中间表示 it just adds the up-caret to that class. You may use it as a shorthand method of saying "match any characters except for the following: rather than specifying a large character class. For example,$.|()*+? matches anything except the eleven characters following the up-

4、caret. Escape Sequences 转义字符Escape Meaningn Newline (<CR><LF> or <LF>, depending on how it is defined for the document)t Tabb Ctrl-H (backspace)r Carriage returnf form feednnn Octal value between 0 and 0377.xnn Hexadecimal digit between 0x00 and 0xFFm The literal character m.Note:

5、When using escape sequences in C language source code, each backslash must also be escaped with another backslash. The resulting pattern specification is often unaesthetic.Iteration Qualifiersthe * matches any number of occurrences, the + matches one or more, and the ? matches zero or one.特例:t* The

6、example above will match any number of consecutive tabs, including none. By itself, it is not very useful to match none of something. As part of a larger regular expression, it could be quite useful. For our purposes here, the following might be preferable:t+ This example matches one or more consecu

7、tive tabs. The tab is represented as t, and the plus sign says "one or more of the previous." To match whitespace, we need to match spaces too. We don't know what order the spaces and tabs will come in, and we don't know how many there will be. These are signs that we need a charac

8、ter class. t+ The example above uses a character class containing a space and a tab. The + sign following it means that this Regular Expression will match any combination of spaces and tabs, so long as there is at least one space or tab.If you wanted to match the whitespace within a function call, w

9、here you knew there might be one space or tab, or there might be none, your expression could look like this:( t? This example searches for a left parenthesis followed by zero or one spaces or tabs. Since the left parenthesis is a metacharacter it is necessary to escape or quote it with a preceding b

10、ackslash. The t we have used before to represent a tab character. The question mark says "zero or one of the preceding."Matching a CharacterThe basic unit of a regular expression is matching a single character. You can match a single character in one of three ways:Literally,Ambiguously, or

11、With a Character Class.You may match a character literally by using the character itself or the appropriate escape sequence. If matching a character literally is too limiting, you may match ambiguously, by using the dot ( . ) metacharacter. If a literal character is too narrow a match and the dot is

12、 too broad a match, a character class can be used for anything inbetween.Placing the CursorThe escape sequence that specifies cursor position is c. An example of its use follows:singletonsc.*This example places the cursor at the beginning of whatever text is contained between the left and right squa

13、re brackets. The square brackets are metacharacters and are therefore escaped. This cursor positioning facilitates editing the contents of the square brackets.Reference Groups and Replacement StringsRegex ExamplesRegular Expressions TipsRegular Expression SyntaxCharacter Description Marks the next c

14、haracter as special. To define a special character in a regular expression, precede the special character with the backslash character.Example: The regular expression /n/ matches the character n. The regular expression /n/ matches a linefeed or newline character. Matches the beginning of input or li

15、ne. In this implementation, this character cannot be defined in character set.$ Matches the end of input or line. In this implementation this character cannot be defined in a character set.* Matches the preceding character zero or more times. In this implementation cannot be defined if only one char

16、acter is specified in the regular expression. That means that /zo*/ matches z and zoo, but /z*/ will match nothing because only one character has been specified.+ Matches the preceding character one or more times.? Matches the preceding character zero or one time. In this implementation cannot be de

17、fined if only one character is specified in the regular expression. Matches any single character except 'n'.(pattern) Matches the pattern and remembers the match. The matched substring can be retrieved by using '0'-'9' in the regular expression, where '0'-'9'

18、are the numbers of the pattern.Example: Regular expression '(re).*0s+ion' will match 'regular expression'. First, the pattern ?re)?matches the first two letters of 憆egular expression?and the pattern is remembered with index 0. The pattern '*' matches 'gular exp' in &#

19、39;regular expression'. The pattern 慭0?retrieves the pattern that has been remembered with index 0, and this 're' matches the second occurrence of 're' in 'regular expression'. Finally, the pattern 's+ion' matches 'ssion'.x|y Matches either the character &

20、#39;x' or 'y'. You can combine more than two characters. Example: 'x|y|z'.n Means the preceding character will match exactly n times (nonnegative). n, Means the preceding character will match at least n times (nonnegative).n,m Means the preceding character will match at least n t

21、imes and at most m times (both nonnegative).xyz A character set. Matches any one of the enclosed characters.xyz A non-matching character set. Matches any character that is not in the set.b Matches a word boundary, that is, the boundary between any character excluding space characters (" fnrtv&q

22、uot;) and non-space characters.B Matches a non-word boundary. Matches any boundary between space characters or between non-space characters.d Matches any digit /0-9/D Matches any non-digit.e Marks the start position of text to extract; used in conjunction with E.E Marks the end position of text to e

23、xtract; used in conjunction with e. If the E is not supplied, the end of line ($) will be used as the end position.f Matches a formfeed.n Matches a newline character.r Matches a carridge return character.s Matches any white space character.S Matches any non-white space character.t Matches a tab char

24、acter.v Matches any vertical tab character.w Matches any word character including underscore. A-Za-z0-9_W Matches any non-word character (any character that does not match w).num Where num is a value between 0 and 9. Matches remembered pattern. (See description of pattern.)/n/ Where n is a value bet

25、ween 1 and 255. Matches supplied in n ASCII code.Examples"FINDe.+" Matches "FIND.+" but only returns the characters after "FIND""Finde.+ETheRest" Matches "Find.+TheRest" but only returns the characters between "Find" and "TheRest"

26、."SOURCE=e.+$" Extracts all source files after the SOURCE=macro definition. ".+.objs*:e.+$" Extracts all the source dependencies in a makefile."w+s*=e.+$" Extracts all macro definitions.Searching for control characters (binary/hex data)Control characters can be used in

27、both search and replacement patterns. Any byte value can be specified as part of a pattern. Perform the following steps to search for or replace binary or hex values.1. Go to Edit 郌ind (or Find/Replace, Find in Files, Replace in Files).2. Turn on Regular Expressions in the appropriate dialog.3. Then

28、 use the x notation to specify hexadecimal values.Examples:To search for the form feed character, use this string:x0c(That's backslash x zero c.)Make sure there are two digits following the x.To search for two consecutive bytes by hexadecimal value, string them together like this:x0cx0dIf you ar

29、e replacing EOL characters, the following information will help to understand how CodeWright views and deals with End of Line characters.Generally, using 'n' for matching or replacing line ends is the suggested method in CodeWright (the '' must be doubled when used in code). However,

30、 a special case is made for searching for and replacing hexadecimal 0D and 0A characters. Since thesecharacters make up ends of lines, some rules had to be established to avoid disrupting partial line-end sequences when searching for and replacing them. When searching for 0D and 0A hex characters, k

31、eep the following in mind:?穃x0a will match a solo (without a preceding 0x0D) 0x0A but not the pair.?穃x0d will match a solo (without a following 0x0A) 0x0D but not the pair.?n will match a solo 0x0A or a 0x0D,0x0A pair.?Replacing "x0d" with "n" would be good for converting a Macin

32、tosh file (opened with autodetect file type off).?Replacing "n" with "n" is a good way to convert Unix files to MS-DOS files or vice-versa, if the buffer flag for Unix EOLs is set appropriately in Options 郋ditor|郘anguage郞ptions.See Hex Mode for more information on hex editing.Spe

33、cial CharactersCharacter Meaning. Matches any single character, except a newline* Matches any number of occurrences (even zero) of the expression that precedes it.+ Matches one or more occurrences of the preceding expression.? Matches zero or one occurrence of the preceding expression. and Defines t

34、he beginning and end of a character class.( and ) Defines the beginning and end of a group of expressions. Groups expressions into larger units and dictates precedence. Each group is also a Reference Group that may be pasted into a replacement string.| Alternation. Allows matching the expression on

35、the left or on the right of the operator.$ Matches the end of a line. Two meanings: Matches the beginning of a line. Complement operator when the first character in a character class. Used for escaping metacharacters and non-printing characters.c The position in the pattern at which the cursor is pl

36、aced at the end of a successful search.CodeSizeTune - Using External MakefilesYou can use an external makefile with CodeSizeTune. However, to be successfully used, you must make modifications to the makefile so that the PBC_CMDFILE macro is added to the build options.For example, if the gmake comman

37、d to build the program is:gmake makefile.mak TARG=c6xWhen running CodeSizeTune, the command line would be:gmake makefile.mak TARG=c6x PBC_CMDFILE=-C:TEMPPBCVariantOptsUsing Regular ExpressionsA regular expression defines a specific text pattern that can be used to be locate and retrieve specific sec

38、tions of text. For example, nat.* is a regular expression which searches for all occurrences of "nat" followed by one or more characters (e.g. nathan, nate, natalie, etc.). There are many more regular expression characters, however, these are the most commonly used ones.Regular Expressions

39、 By ExampleAdding Regular Expressions to Makefile ImportIn this exercise, you will learn how to specify the source files you wish to import within the makefile importing utility. The makefile utility will scan the makefile you are importing, looking for the source files you specify. In this exercise

40、, you will configure the makefile utility to scan for source files and include files. Specification is done using regular expressions as in the previous exercise.1. Add the default regular expression "SOURCEe.+$" (without the quotes) to the Added Expression section by clicking the Add button. In this instance, "SOURCEe.+$" indicates that CCS will search the makefile for all lines containing source file information (e.g.SOURCE=<path>). The "" and "$" characters indicate that these lines must have no additional or extraneous text.2. In the Re

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论