[译]查找孤立的资源常量
By robot-v1.0
本文链接 https://www.kyfws.com/applications/find-orphaned-resource-constants-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 2 分钟阅读 - 898 个词 阅读量 0[译]查找孤立的资源常量
原文地址:https://www.codeproject.com/Articles/6040/Find-Orphaned-Resource-Constants
原文作者:strtdusty
译文由本站 robot-v1.0 翻译
前言
A Perl script to help locate #define’s in your Resource.h file that are no longer referenced by your VS project.
一个Perl脚本,可帮助您在Resource.h文件中找到VS项目不再引用的#define.
介绍(Introduction)
您可能已经注意到,使用Visual Studio 6.0的资源编辑器时,它不能很好地保持资源文件的清洁.如果您从编辑器中删除资源,则通常不会删除关联的资源(You may have noticed that when using Visual Studio 6.0’s resource editor, it doesn’t do a great job of keeping your resource files clean. If you delete a resource from the editor, it doesn’t usually delete the associated) #define
在你的(in your)资源.h(resource.h).虽然这不是一个大问题(除非您用尽了有效范围内的常量),但它始终困扰着我.我写了一个Perl脚本,它将查看您的(. While this isn’t a huge problem (unless you are running out of constants in the valid ranges), it has always bugged me. I wrote a Perl script which will look at your).dsp(.dsp*)*,解析关联的源文件,然后尝试匹配您在您的文件中定义的常量(*, parse though the associated source files, and try to match the constants defined in your*)*资源.h(*Resource.h*)*文件.任何不匹配的常量将被写入输出文件(*file. Any constants that are not matched will be written to an output file*)*Orphans.txt(*Orphans.txt*)*.(*.*)
使用方法:(To use:)
- 您必须已安装Perl.(You must have Perl installed.)
- 拨打电话:(Call using:)
> Perl FindOrphanedResources.pl <full path to dsp> [<Resource.h file>="Resource.h"]
可能的问题:我意识到DSP中未包含的文件可能正在使用Resource文件中定义的常量.因为我想不出什么好方法来找到所有(Possible problems: I realize that files not included in the DSP may be using the constants defined in the Resource file. Since I couldn’t think of any good way to find all the files that) #include
(在链的某处)((somewhere down the chain) the)*资源.h(resource.h)*文件,我只使用DSP中的文件.您可能要验证项目中的任何文件确实没有使用所标识的常量.该脚本至少会为您缩小列表范围.(file, I stuck with just those in the DSP. You may want to verify that the constants identified are truly not being used by any files in your projects. This script will at least narrow down the list for you.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VC7.0 VC7.1 C++ VC6 WinXP Win2003 Windows Win2K Visual-Studio Dev 新闻 翻译