SourceSafe Keyword Expansion Template

We use Visual SourceSafe's keyword expansion. Each of our project's source files has (or should if we remember) the following header when we add it to source control.

// TEST.CPP : implementation file
//
/* $Log: /TEST/TEST.CPP $
*/     
This macro inserts the template into .H and .CPP files.

Sub AddSSHeader()
'DESCRIPTION: Insert the source safe keyword expansion comments at the top of source file

 strName = UCase(ActiveDocument.Name)
 pos = Instr(strName, ".")

 if (pos < 1) then
  Exit Sub
 end if
  
 strExt = Mid(strName, pos)

 if (strExt = ".CPP") then
  strDesc = "implementation file"
 else 
  if (strExt = ".H") then
   strDesc = "header file"
  else
   exit sub       
  end if
 end if

 ActiveDocument.Selection.StartOfDocument

 ' Check for existing keyword expansion
 for i = 1 to 20
  ActiveDocument.Selection.SelectLine

 if Instr(ActiveDocument.Selection, "/* $Log:") > 0 then
  MsgBox "File already has keyword expansion."
  exit sub
 end if  

  ActiveDocument.Selection.LineDown
 next

 strFullName = ActiveDocument.FullName
 pos = Instr(strFullName, ":")

 if (pos > 0) then
  strFullName = Mid(strFullName, pos + 1)
 end if

 ActiveDocument.Selection.StartOfDocument
 ActiveDocument.Selection = "// " + strName + " : " + strDesc + vbCrLf 
 ActiveDocument.Selection = "//" + vbCrLf
 ActiveDocument.Selection = "/* $Log: " + UCase(Replace(strFullName, 
 "\", "/")) + " $" + vbCrLf
 ActiveDocument.Selection = "*/" + vbCrLf + vbCrLf

end sub

Date Last Updated: February 3, 1999



Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 23, 2014 @ 12:00 p.m. ET / 9:00 a.m. PT Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this eSeminar to learn why physical appliances are preferable to …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds