首 页 | 新 闻 | Symbian | Windows Mobile| J2ME | 下载中心 | 游戏策划 | 购书指南 | 移动开发视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> Tools SDK >> 文章正文
Integrating LeaveScan into Codewarrior 3.x
作者:佚名    文章来源:newlc    更新时间:2007-1-5 19:20:26

LeaveScan is a command-line utility developped by Symbian Ltd that checks that your code respects the naming conventions for leaving functions.

This article will show you how to integrate it and use it directly from Nokia Codewarrior (version 3.x is required).

1. Download LeaveScan

The utility is available for download on Symbian web site. Download the LeaveScan.exe file and install it in:

C:\Program Files\Symbian OS Tools\LeaveScan

The same technique can be used to integrate the SymScan which detect a few more issues but is more verbose.

2. Create a tool entry in Codewarrior

Go to the installation directory of your Codewarrior IDE and locate the Nokia x86 Compiler.cwcomp file and make a copy of it called LeaveScan.cwcomp.

If you are using Codewarrior 3.1 and installed it in its default location, the file should be in:

C:\Program Files\Nokia\CodeWarrior for Symbian v3.1\Bin\Plugins\Support\CompilerDescriptors\Symbian\

Open the new file "LeaveScan.cwcomp" in a text editor and make the following changes:

Find the following text in the file (around line 88):

...
<!-- End of Compiler Definition -->
<struct>
...

Right after the "End of Compiler Definition" comment, add the following text:

<struct>
<!-- +++++++++++++++Leave Scan++++++++++++++ -->
<setting uuid-alias="." entry="toolSymbolicCommandDef">
<simple>${var:TOOL_NAME} "${source.name}"</simple>
</setting>
<setting uuid-alias="." entry="toolType">
<simple>kToolLeaveScan</simple>
</setting>
<setting uuid-alias="." entry="toolDisplayName">
<simple>Symbian Leave Scan tool</simple>
</setting>
<setting uuid-alias="." entry="toolExecutableName">
<simple>C:\Program Files\Symbian OS Tools\LeaveScan\leavescan.exe</simple>
</setting>
<setting uuid-alias="." entry="parseStdOut">
<simple>true</simple>
</setting>
<setting uuid-alias="." entry="parseStdErr">
<simple>false</simple>
</setting>
<setting uuid-alias="." entry="defaultSwitch">
<simple></simple>
</setting>
<setting uuid-alias="." entry="outputParser">
<simple>kGCCMessageFormatParser</simple>
</setting>
</struct>

This adds a tool call defintion that can be executed during compilation.

3. Setup the new tool

In the same file, find the following text (line 51):

<setting uuid-alias="." entry="postActionIdentifiers">
<array inheritance="none">
<simple>kToolSize</simple>
</array>
</setting>

and add a line after the kTookSize call:

<simple>kToolLeaveScan</simple> :

The new block shall now look like:

<setting uuid-alias="." entry="postActionIdentifiers">
<array inheritance="none">
<simple>kToolSize</simple>
<simple>kToolLeaveScan</simple>
</array>
</setting>

This makes a call to the leavescan utility after a successful call to the compiler and size tool.

Now you can save the file and choose the tool you just created.

4. Set up your project target

Open up a project’s WINSCW target settings and navigate to the Code Generation | Symbian Compiler preference, change the compiler option from Nokia x86 Compiler to LeaveScan:

(PNG)

A warning message will now be emitted each time a leaving function does not have a trailing L in its name:

(PNG)

5. Enjoy...

... or fix your code. (and now you have no excuses for mis-naming your functions!

Zip - 2 kb
Nokia x86 + LeaveScan.cwcomp.zip

This article is an update of Tim’s post on Forum Nokia
相关文章:
How to reset the alternate makmake entry in Codewarrior
Codewarrior: how to avoid the "Too Many Include Paths" error when using the UIQ 2.1 SDK
Speed-up your builds with concurrent compilation
Getting Started with Metrowerks Codewarrior
Managing Subprojects with Codewarrior
How to compile for WINSCW without a CodeWarrior or Visual Studio IDE
How to change the color of a CEikLabel
A simple text console