Wiki Home

Vcxs Compare


Namespace: B2B

Vcxs Compare is a class browser add-in (Browser Add Ins) by Vlad Tokarev
which allows you to see the difference between
two VCX's, 2 classes or 2 SCX`s.

Vcxs Compare (vcomp.zip) can be found at http://groups.yahoo.com/group/addin

Vcomp.zip contains five files:
Vcomp.prg - This Class Browser add-in
Vcomp.h - A header file for Vcomp.prg
Install.prg - Installation of this Class Browser add-in.
Remove.prg - Uninstallation of this add-in.
Readme.txt -


05-nov-2004 - Addin 'Sorting' can work with fields
'Methods', 'Properties' and 'Reserved3' now.

12-nov-04 - It can compare by Visual Source Safe also.
See the example of Visual Source Safe Integration below.

16-nov-04 - Added case with "Examdiff.exe" (http://www.prestosoft.com)

See also Vcx Diff , Carls Vcx Utils , Scc Text , Vcx To Vss

*
* Header file for VComp.prg
*
*
* Vladimir Tokarev, Russia.
* http://groups.yahoo.com/group/addin
* 13-nov-2004


#DEFINE cc_ADDIN_FILENAME               'VComp.prg'
#DEFINE cc_ADDIN_NAME                   'VCXs (SCXs) compare'
#DEFINE cc_ADDIN_COMMENT                ''

#DEFINE cc_FIRST_PRG_FILE               'Vcx2Prg1.prg'
#DEFINE cc_SECOND_PRG_FILE              'Vcx2Prg2.prg'
#DEFINE cc_LOG_FILE                     'VComp.log'
* same name as in Sorting.h
* (Sorting - A Class Browser Add-In that can sort all properties and
* procedures in .VCX or .SCX)
#DEFINE cc_ADDIN_SORTING_NAME           'Sort properties & procedures'
* same name as in VcxToPrg.h
* (works Browser`s ExportClass() if .F.)
#DEFINE cc_ADDIN_VCXTOPRG_NAME          'VcxToPrg'
#DEFINE cl_DOADDIN_VCXTOPRG             .F.

* Compares by Visual Source Safe if .T.  (default - FC.EXE)
#DEFINE cl_VSS                          .F.
#DEFINE cc_VSS_CMD_FILE                 'VComp.bat'
* a path to the VSS`s database
#DEFINE cc_VSS_DB_PATH                  'D:\TEMP\qwerty'
* a path to VSS`s modules SS.exe, SSexp.exe
#DEFINE cc_VSS_PATH                     'D:\VS\VSS\win32'
* a temporary project
#DEFINE cc_VSS_PROJECT                  'VComp'
#DEFINE cc_VSS_USER                     'Admin'
* Run SSexp.exe
#DEFINE cl_VSS_EXPLORER                 .T.

#DEFINE cl_EXAMDIFF                     .F.
* a path to the ExamDiff.exe module
#DEFINE cc_EXAMDIFF_PATH                'G:\TOOLS\EXAMDIFF'


#DEFINE cn_ADDIN_DOS_CODEPAGE           866
#DEFINE cn_ADDIN_WIN_CODEPAGE           1251


#DEFINE cc_ADDIN_MSG_NotINSTALLED       'VComp Add-In not installed.'
#DEFINE cc_ADDIN_MSG_NotUnINSTALLED     'VComp Add-In not uninstalled.'
#DEFINE cc_ADDIN_MSG_PLEASE_LOCATE      'Please locate VComp.PRG'
#DEFINE cc_ADDIN_MSG_NOT_REGISTED       'Could not register "VComp.PRG".'+CHR(13)+'This Addin not installed.'


* VComp - a Class Browser Add-in.
* Shows the difference between 2 VCX's (SCX`s).
* It can do this with:
* - FC.EXE
* - Visual Source Safe
* - ExamDiff  (http://www.prestosoft.com  FreeWare version 1.6k)
* See also a function VcxDiff.prg , an add-in VComp.prg
*
* (Add-in 'Sorting' can sort fields 'Properties',
* 'Protected', 'Methods' and 'Reserved3'.)
* (Code was written with font Fixedsys 10 Pt)
*
* Vladimir Tokarev, Russia.
* http://groups.yahoo.com/group/addin
* 16-nov-2004


#INCLUDE VComp.h

LPARAMETERS toBrowser
IF VARTYPE(toBrowser) <> 'O'
  ? 'Usage:  Run a file "Install.PRG"'
  RETURN .F.
ENDIF
IF NOT toBrowser.lVCXSCXMode
  RETURN .F.
ENDIF

LOCAL ;
  lcCmd,;
  lcSaveSafety,;
  lcViewCodeFileName,;
  llWinCodePage,;
  lcCurrentDir,;
  lcAddinDir,;
  lcCmdFile,;
  lcVssDbPath,;
  lcVssPath,;
  lcVssProject,;
  lcVssUser,;
  lcPrgFile1,;
  lcPrgFile2,;
  lcLogFile,;
  llVssExplorer

IF VARTYPE(glVcFlag) <> 'L'
  RELEASE glVcFlag
  PUBLIC glVcFlag
ENDIF
IF VARTYPE(gcVcFileName) <> 'C'
  RELEASE gcVcFileName
  PUBLIC gcVcFileName
ENDIF
IF VARTYPE(gnVcWindowState) <> 'N'
  RELEASE gnVcWindowState
  PUBLIC gnVcWindowState
ENDIF


* Disables 'AddInfo' add-in if _Screen.lAddInfo = .F.
IF TYPE('_Screen.lAddInfo') <> 'L'
  _Screen.AddProperty('lAddInfo', .F.)
ENDIF

* Add-in 'VcxToPrg' does not do 'MODIFY COMMAND...' if _Screen.lVcxToPrg=.F.
IF TYPE('_Screen.lVcxToPrg') <> 'L'
  _Screen.AddProperty('lVcxToPrg', .F.)
ENDIF


WITH toBrowser
  _Screen.lAddInfo = .F.
  _Screen.lVcxToPrg = .F.

  IF NOT glVcFlag
    WAIT WINDOW 'Processing a file N1 ...' NOWAIT
    glVcFlag = .T.
    gcVcFileName = .cFileName
    gnVcWindowState = .WindowState
    .WindowState = 0
    .DoAddIn(cc_ADDIN_SORTING_NAME)
    IF cl_DOADDIN_VCXTOPRG
      lcViewCodeFileName = .cViewCodeFileName
      .cViewCodeFileName = cc_FIRST_PRG_FILE
      .DoAddIn(cc_ADDIN_VCXTOPRG_NAME)
      .cViewCodeFileName = lcViewCodeFileName
    ELSE
      .ExportClass(, cc_FIRST_PRG_FILE)
    ENDIF
    .StartNewWindow()
    WAIT WINDOW 'Choose a file (class) N2 and start the Add-In ...' NOWAIT
  ELSE
    WAIT WINDOW 'Processing a file N2 ...' NOWAIT
    IF NOT gcVcFileName == .cFileName
      .DoAddIn(cc_ADDIN_SORTING_NAME)
    ENDIF
    IF cl_DOADDIN_VCXTOPRG
      lcViewCodeFileName = .cViewCodeFileName
      .cViewCodeFileName = cc_SECOND_PRG_FILE
      .DoAddIn(cc_ADDIN_VCXTOPRG_NAME)
      .cViewCodeFileName = lcViewCodeFileName
    ELSE
      .ExportClass(, cc_SECOND_PRG_FILE)
    ENDIF
    .Release()
    .WindowState = gnVcWindowState
    RELEASE glVcFlag
    RELEASE gcVcFileName
    RELEASE gnVcWindowState

    WAIT CLEAR
    lcCmd = 'RUN fc /N ' + ;
      cc_FIRST_PRG_FILE + ' ' + ;
      cc_SECOND_PRG_FILE + ' > ' + ;
      cc_LOG_FILE

    DO CASE
      CASE cl_VSS   && Visual Source Safe
        llWinCodePage = .T.
        lcCurrentDir = FULLPATH('')
        lcAddinDir = ADDBS(JUSTPATH(SYS(16)))
        IF ' ' $ lcAddinDir
          lcCmdFile = '"' + lcAddinDir + STRTRAN(ALLTRIM(cc_VSS_CMD_FILE),'"') + '"'
        ELSE
          lcCmdFile = lcAddinDir + ALLTRIM(cc_VSS_CMD_FILE)
        ENDIF
        lcVssDbPath = ALLTRIM(cc_VSS_DB_PATH)
        lcVssPath = ADDBS(cc_VSS_PATH)
        lcVssProject = ALLTRIM(cc_VSS_PROJECT)
        lcVssUser = ALLTRIM(cc_VSS_USER)
        IF ' ' $ lcCurrentDir
          lcPrgFile1 = '"' + lcCurrentDir + ;
            STRTRAN(ALLTRIM(cc_FIRST_PRG_FILE),'"') + '"'
          lcPrgFile2 = '"' + lcCurrentDir + ;
            STRTRAN(ALLTRIM(cc_SECOND_PRG_FILE),'"') + '"'
          lcLogFile = '"' + lcCurrentDir + ;
            STRTRAN(ALLTRIM(cc_LOG_FILE),'"') + '"'
        ELSE
          lcPrgFile1 = lcCurrentDir + ALLTRIM(cc_FIRST_PRG_FILE)
          lcPrgFile2 = lcCurrentDir + ALLTRIM(cc_SECOND_PRG_FILE)
          lcLogFile = lcCurrentDir + ALLTRIM(cc_LOG_FILE)
        ENDIF
        llVssExplorer = cl_VSS_EXPLORER

        IF FILE(lcLogFile)
          DELETE FILE (lcLogFile)
        ENDIF

* Creates a command file for VSS

        IF CreateFile(;
            lcCmdFile,;
            lcVssDbPath,;
            LOWER(lcVssPath),;
            lcVssProject,;
            lcVssUser,;
            lcPrgFile1,;
            lcPrgFile2,;
            lcLogFile,;
            llVssExplorer)
          lcCmd = 'RUN ' + lcCmdFile
        ENDIF

      CASE cl_EXAMDIFF
        llWinCodePage = .T.
        lcCmd = 'RUN ' + ADDBS(cc_EXAMDIFF_PATH) + 'ExamDiff ' + ;
          cc_FIRST_PRG_FILE + ' ' + ;
          cc_SECOND_PRG_FILE
    ENDCASE
    &lcCmd


    IF NOT llWinCodePage
      lcSaveSafety = SET('safety')
      SET SAFETY OFF
      STRTOFILE(CPCONVERT(cn_ADDIN_DOS_CODEPAGE, cn_ADDIN_WIN_CODEPAGE, ;
        FILETOSTR(cc_LOG_FILE)), cc_LOG_FILE)
      SET SAFETY &lcSaveSafety
    ENDIF

    IF NOT llVssExplorer
*       MODIFY FILE (cc_LOG_FILE) AS 866
      MODIFY FILE (cc_LOG_FILE)
    ENDIF


    IF FILE(cc_FIRST_PRG_FILE)
      DELETE FILE (cc_FIRST_PRG_FILE)
    ENDIF
    IF FILE(cc_SECOND_PRG_FILE)
      DELETE FILE (cc_SECOND_PRG_FILE)
    ENDIF
*     IF FILE(cc_LOG_FILE)
*       DELETE FILE (cc_LOG_FILE)
*     ENDIF
  ENDIF   && NOT glVcFlag

  _Screen.lAddInfo = .T.
  _Screen.lVcxToPrg = .T.
ENDWITH   && toBrowser

RETURN


*******************
FUNCTION CreateFile   && Creates a command file for VSS
LPARAMETERS tcCmdFile, tcVssDbPath, tcVssPath, tcVssProject, tcVssUser, ;
  tcPrgFile1, tcPrgFile2, tcLogFile, tlVssExplorer
LOCAL ;
  lcAddin,;
  lcVssDbStr,;
  lcLogFileStr

lcAddin = JUSTSTEM(cc_ADDIN_FILENAME)

SET TEXTMERGE TO (tcCmdFile) NOSHOW
SET TEXTMERGE ON
IF (_text = -1)
  SET TEXTMERGE OFF
  SET TEXTMERGE TO
  RETURN .F.
ELSE
  \\Rem VSS`s command file
  \Rem Made by a Class Browser add-in "<>"
  \@echo off

  lcVssDbStr = ''
  IF NOT EMPTY(tcVssDbPath)
    \set SSDIR=<>
    lcVssDbStr = '-s' + UPPER(tcVssDbPath)
    IF ' ' $ lcVssDbStr
      lcVssDbStr = '"' + STRTRAN(lcVssDbStr, '"') +'"'
    ENDIF
  ENDIF

  lcLogFileStr = '[email protected]' + tcLogFile
  IF ' ' $ lcLogFileStr
    lcLogFileStr = '"' + STRTRAN(lcLogFileStr, '"') +'"'
  ENDIF

  \<>SS.exe WorkFold <>

* $/<> is not an existing filename or project
* Exit code: 100

  \<>SS.exe Destroy $/<> -y<> -i-Y
  \<>SS.exe Create $/<> -y<> -i- -s
  \<>SS.exe Add <> -y<> -i- -k -w
  \<>SS.exe Diff $/<>/<> <> -y<> -dv <>
  IF tlVssExplorer
    \<>SSexp.exe -y<> <>
  ENDIF
  \<>SS.exe CheckIn * -y<> -p$/<> -w

* Current project is $/<>
* Destroy cannot be undone; information will be lost permanently!
* Continue anyway?(Y/N)Y
* <>
* Current project invalid; changing to root project
* Exit code: 0

* Current project is $/<>
* Destroy cannot be undone; information will be lost permanently!
* Continue anyway?(Y/N)Y
* You have $/.../...prg checked out; deleting it will cancel the check out.
* Continue?(Y/N)Y
* <>
* Exit code: 0

  \<>SS.exe Destroy $/<> -y<> -i-Y
  \Rem eof
  \
ENDIF   && if (_text = -1)
SET TEXTMERGE OFF
SET TEXTMERGE TO
ENDFUNC   && CreateFile


* SS Diff VSS files [-B] [-D] [-H] [-I] [-I-] [-N] [-O] [-V] [-Y] [-?]
* -B Create a brief difference report.
* The -B option provides a brief difference report. It checks to see if
* the specified files are different and is faster than computing actual
* line differences. This can be useful in batch files and scripts that
* react differently when a file has been modified.

* -D  [width] Specify the format of the difference display.
* The -D option controls how VSS displays the differences. A file
* difference can be displayed in one of three manners:
* V (visual)  shows the entire file, with annotations for the changes.
* This display shows differences side-by-side.
* S (SourceSafe)  displays a list of lines that were added, deleted,
* changed, and optimized for readability; for example, an inserted
* line might be displayed as follows: 27  Ins: hello, world
* U (UNIX)  display gives similar information in the standard format used
* by the UNIX diff utility: 26a27 > hello, world
* Immediately after the V, S, or U in the -D option, you can specify
* a number indicating the line width. If you specify more characters
* than your screen permits, long lines wrap, which may affect the
* readability of the display.

* -DX [ - |number of lines] Specify the number of displayed context lines.
* Finally, X controls how many context lines VSS displays around each
* change. Seeing these lines may help you understand why a change was
* made. X by itself shows three lines of context;
* X- shows no context; X followed by a number specifies how many lines
* to show.
* -DV35 Visual display, 35-character width
* -DX Three context lines
* -DU70X5 UNIX-style display, 70-character width, five context lines

* -I [C|E|S|W] Specify which informational messages are ignored.
* (C)ase: The letter A is considered the same as the letter a, and so on,
* and a change of one to the other is not reported.
* (W)hite space: Any change in spacing or tabbing is ignored; only the
* insertion or deletion of functional characters is reported.
* (E)nd-of-line character: Every line is not reported as a change
* simply because of differences on a different operating system.
* (S)mall changes: Small changes are ignored.
* The default setting, -IE, ignores end-of-line characters and reports any
* other difference as a change.

* You can set the SSUSER environment variable on your computer to your
* user name to avoid the logon prompt each time you enter a command
* from the command prompt.

**************************************************
*- MODULE`s HISTORY:
*-------------------
* 02-nov-04  written
* 12-nov-04  it can use VSS
* 13-nov-04  ExamDiff.exe
* 16-nov-04  add comments


Hey fellow differ ;)

Can you give us (me) the steps for adding this to the class browser? - cfk

Step 1 - Download from http://groups.yahoo.com/group/addin add-in "Sorting".
Step 2 - Unzip it to a directory on your system.
Step 3 - Start a file "Install.prg".
Steps 4,5,6 do with add-in "Vcomp". -- vt

Category Development Tools, Category Developer Productivity, Category VFP IDE, Category Code Samples, Category File Comparison Tools, Category Source Code Control, Category Configuration Management, Category Visual Studio
( Topic last updated: 2004.11.16 08:51:55 PM )