Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I manually generate text files for entire project to diff in Visual FoxPro (e.g. .sca, .vca, etc.)

The challenge is that I'm checking my FoxPro code into source control (using Mercurial, but that's not the focus of this question) and would like a quick way to get the FoxPro SCCTEXT output alongside the binary output without using the Tools > Options > Projects > Active source control provider functionality.

For an example of the kind of output I'm looking to generate, the VFPX source contains many of these text .sca, .vca, etc. files. Is there any way to generate these files on demand?

like image 344
Kit Roed Avatar asked May 25 '11 13:05

Kit Roed


2 Answers

Rather than setting a source control provider, you can hack scctext.prg (which ships with VFP) and use a project hook to generate the files - see http://paulmcnett.com/scX.php for an example implementation using Subversion.

Edit: Have you looked at the Alternate SCCText on Codeplex

Also see http://www.foxpert.com/docs/cvs.en.htm for another perspective.

like image 57
stuartd Avatar answered Sep 28 '22 15:09

stuartd


Here is the code I use to genereate SCCText files for every file in my Project file. Just open your Project (to make sure it is the Active Project, then run this prg file).

(Updated 2011-06-10: Added a new feature that will only build new SCC text files if the DateTime of the original source file is newer than the existing SCC file. Essentially, this new version only generates a new SCC file if the VFP source file has been changed since the last time this was run.)

lnResponse = MessageBox('Run SSCText to generate ascii code files?', 3, 'Generate SCC files?')

If lnResponse <> 6
    Return
EndIf

*Clear All
*Release All
Set ClassLib to && Must clear them out, cause we're about to generate ascii files of them

lnCount = DoSCCTextOnProject()

? Chr(10)+Chr(13)
? 'Done. ' + Str(lnCount) + ' files processed.'

*----------------------------------------------------------------------
Procedure DoSCCTextOnProject

Local loFile, loProject, lnCount

lcSCCText = Home(1) + 'SCCText.prg'
lnCount = 0
If !File(lcSCCText)
    Messagebox('Unable to find file ' + lcSCCText, 16, 'Error')
    Return 0
Endif

Try
    loProject = _vfp.ActiveProject
Catch To loEx
Endtry

If Type('loEx') = 'O'
    Messagebox('There are no active projects', 64, 'Error')
    Return 0
Endif

lcSkipFiles = 'LIST-FILES-TO-SKIP-HERE'

For Each loFile In loProject.Files

    If Inlist(loFile.Type, 'V', 'K', 'R') and ;
         !InList(Upper(JustFname(loFile.name)), Upper(lcSkipFiles)) ;
         and Fdate(loFile.name, 1) > SCCFileDateTime(loFile.name)
                ? 'Generating: ' + loFile.Name
                Do (lcSCCText) With loFile.Name
                lnCount = lnCount + 1 
    Endif
Endfor 

Return lnCount

*------------------------------------------------------------------
Procedure SCCFileDateTime(tcFile)

    lcSCCFilename = Upper(Strtran(Upper(tcFile), '.SCX', '.SCA'))
    lcSCCFilename = Strtran(lcSCCFilename, '.VCX', '.VCA')
    lcSCCFilename = Strtran(lcSCCFilename, '.FRX', '.FRA')

    If File(lcSCCFilename)
        Return Fdate(lcSCCFilename, 1)
    Else
        Return {^1900-01-01 00:00:00}
    EndIf
EndProc
like image 25
MattSlay Avatar answered Sep 28 '22 15:09

MattSlay