Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Lifecycle Solutions (steve huntington)
Decrease font size
Increase font size
Topic Title: regex m{\*/} or m{/\*}
Topic Summary: Logiscope perl checker doesn't recognize '/*'
Created On: 2-Nov-2005 22:39
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Ian Barnard, on Monday, August 7, 2006 10:25 PM

Answer:
Terrence

As you are using C rulechecker, your rule is probably working on the (sort-of) preprocessed file available through the hash %TabPreprocessFile, in which case there are no c-style comments to detect. Look in the RuleCheckerC.pdf for the bit about @cList to get the raw source-file names so your perl rule can process these. Use @CList instead of %TabPreprocessFile.

If your script starts like this:

foreach $key (keys %TabPreprocessFile) {
&lookForTab ($key, $TabPreprocessFile{$key}) ;
}


sub lookForTab {
...


It should instead look like this:

for $pathName (@cList) {
print "Checking $pathName\n"
open(C, "<$pathName") || warn "$pathName: cannot read: $!\n";
# Do something with the content of the file.
...
close(F);
}

You can always put print statements in your rule to display what is being checked; the output will appear on the command line or on the Build tab of the GUI.

HTH
Ian
 2-Nov-2005 22:39
User is offline View Users Profile Print this message


Terrence Carpenter

Posts: 25
Joined: 10-Jul-2003

I'm trying to write a rule for the perl checker and I need to check if a line in a C file has a comment. It recognizes c++ style, m{//}, OK but not C style, m{/\*}. If I try the regex with standalone perl it works OK. Can you suggest something to try?

How To Reproduce
----------------------
if ( $line =~ m#/\*# ) {
do something;
{

Terry Carpenter

-------------------------
Terry Carpenter
Report this to a Moderator Report this to a Moderator
 24-Mar-2006 17:51
User is offline View Users Profile Print this message


Ian Barnard

Posts: 91
Joined: 4-Jul-2002

Answer Answer
Terrence

As you are using C rulechecker, your rule is probably working on the (sort-of) preprocessed file available through the hash %TabPreprocessFile, in which case there are no c-style comments to detect. Look in the RuleCheckerC.pdf for the bit about @cList to get the raw source-file names so your perl rule can process these. Use @CList instead of %TabPreprocessFile.

If your script starts like this:

foreach $key (keys %TabPreprocessFile) {
&lookForTab ($key, $TabPreprocessFile{$key}) ;
}


sub lookForTab {
...


It should instead look like this:

for $pathName (@cList) {
print "Checking $pathName\n"
open(C, "<$pathName") || warn "$pathName: cannot read: $!\n";
# Do something with the content of the file.
...
close(F);
}

You can always put print statements in your rule to display what is being checked; the output will appear on the command line or on the Build tab of the GUI.

HTH
Ian

-------------------------
=============
Ian Barnard
Principal Consultant
Telelogic UK, an IBM company
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Lifecycle Solutions forum.
There are currently 1 users logged in.
The most users ever online was 14 on 29-Jul-2008 at 13:55.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.