diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2bc64c2..d1245ae 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -31,22 +31,25 @@ Stuff is a bit scattered, so this is where to look up. 1. Please create a fork at github - See this [guide](https://www.dataschool.io/how-to-contribute-on-github/) for setting up and using a fork - If allready forked, pull the recent state, or get most recent version otherwise. -0. On top of _FoxBin2Prg.prg_ there are two version numbers: +2. On top of _FoxBin2Prg.prg_ there are two version numbers: `#DEFINE DN_FB2PRG_VERSION 1.19` `#DEFINE DC_FB2PRG_VERSION_REAL '1.19.60'` -1. Please set the **minor** part of _DC_FB2PRG_VERSION_REAL_ to a new number. +3. Please set the **minor** part of _DC_FB2PRG_VERSION_REAL_ to a new number. **Do not** alter the **1.19** part. This is written to the text files. Alteration might force that the files must be newly commited, what is not everybodies taste. -3. Add a meaningfull description of the change in the changes list on top of _FoxBin2Prg.prg_. +4. Add a meaningfull description of the change in the changes list on top of _FoxBin2Prg.prg_. The most recent entries for changes in the middle of this section around _* _, The most recent bugs are listed above _* _ -4. Alter version in _README.md_ -4. Add a description to _docs\ChangeLog.md_ -6. Please alter the footer of *.md files touched to recent date. -4. If a change to the config files is made please add the description to the various properties (multi lang) +5. Alter version in _README.md_ +6. Add a description to _docs\ChangeLog.md_ +7. If a change to the config files is made please add the description to the various properties (multi lang) - _C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_cfg:_ for general settings - _C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_tab_cfg:_ for settings per table -4. Create a template _foxbin2prg.cfg.txt_ for general settings or _foxbin2prg.dbf.cfg.txt_ for the settings per table. +8. If a change to the parameters is made, change _C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_ properties. +9. For changed functionality, add descriptive text on the appropriate _.md_ file in _docs_ folder. +10. Please alter the footer of \*.md files touched to recent date. +11. **The follwing steps are not neccesary, if you use *VPXDeployment* to create a new version that is applicable for Thor use.** +12. Create a template _foxbin2prg.cfg.txt_ for general settings or _foxbin2prg.dbf.cfg.txt_ for the settings per table. - Do this even if no change to the setting to change the version number inside this files. - Or change version number in those files manually - **Note**. If you are not on an English comp, set the value _Language: EN_ in your local _foxbin2prg.cfg_ to create English files. @@ -56,30 +59,46 @@ Stuff is a bit scattered, so this is where to look up. DO FoxBin2Prg.prg WITH "-c","foxbin2prg.cfg.txt" DO FoxBin2Prg.prg WITH "-t","foxbin2prg.dbc.txt" ``` -5. If a change to the parameters is made, change _C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_ properties. -4. For changed functionality, add descriptive text on the appropriate _.md_ file in _docs_ folder. -2. Alter the version number for the EXE to the version used above. -0. Compile to EXE **in VFP9 SP2** -8. Change Thor ([see below](#thor-conventions)) -8. commit -9. push to your fork -0. create a pull request -1. +13. Alter the version number for the EXE to the version used above. +14. Compile to EXE **in VFP9 SP2** +15. Change Thor ([see below](#thor-conventions)) +16. commit +17. push to your fork +18. create a pull request ## Thor conventions This project is part of [VFPX](https://vfpx.github.io/) and published via [Thor](https://github.com/VFPX/Thor). +Some steps must be done to create the information for Thor +### Using VFPXDeployment +The standard procedure to create the Thor files is runing VFPXDeployment via Thor. +1. If you add or remove files to FoxBin2Prg, that you need in the release: + - alter *BuildProcess/installedfiles.txt*, see [here](https://github.com/VFPX/VFPXDeployment/blob/main/docs/Documentation.md#installedfilestxt) + - open the *Helper/Clean_ThorFolder.prg* file + - navigate to *Get_CompareFiles procedure* + - alter the TEXT .. ENDTEXT section to remove all files deleted and add new files, check the block for examples. + - There is a programm *Helper/GetRevisions.prg* to create the list, but this need to run VFPXDeployment one time to create the INSTALLEDFILES directory before. +2. Run VFPXDeployment. It will set version number to EXE, compile, set several documentation and create the files for Thor. +3. commit +4. push to your fork +5. create a pull request + +### Without VFPXDeployment +If you do not use VFPXDeployment There are some considerations to make to add a new version to Thor. Please check [Supporting Thor Updater](https://vfpx.github.io/thorupdate/) In special: - Update _Project.txt_, in special the version number -- and run the script included, or - - add files to _FoxBin2Prg.zip_, namely - - FoxBin2Prg.prg, - - FoxBin2Prg.exe, - - the config files templates - - Update the version number in _FoxBin2PrgVersion.txt_ +- update the *Helper/Clean_ThorFolder.prg* file, see above +- add files to _FoxBin2Prg.zip_, namely + - FoxBin2Prg.prg, + - FoxBin2Prg.exe, + - the config files templates + - Clean_ThorFolder.prg +- Update the version number in _FoxBin2PrgVersion.txt_ +- Update the changelog in _FoxBin2PrgVersion.txt_ +- the use of CreateThorUpdate.ps1 is not longer recommended. Thanks ---- -Last changed: _2023/08/06_ ![Picture](../docs/pictures/vfpxpoweredby_alternative.gif) +Last changed: _2023/08/08_ ![Picture](../docs/pictures/vfpxpoweredby_alternative.gif) diff --git a/BuildProcess/Substitute.txt b/BuildProcess/Substitute.txt new file mode 100644 index 0000000..1c33352 --- /dev/null +++ b/BuildProcess/Substitute.txt @@ -0,0 +1,2 @@ +#List of additional files that will be substituded when running VFPXDeployment for FoxBin2PRG +docs\ChangeLog.md \ No newline at end of file diff --git a/BuildProcess/VersionTemplate.txt b/BuildProcess/VersionTemplate.txt index 1e84f0a..5870cea 100644 --- a/BuildProcess/VersionTemplate.txt +++ b/BuildProcess/VersionTemplate.txt @@ -20,10 +20,27 @@ with toUpdateObject .VersionNumber = '{VERSION} - {VERSIONDATE}' .AvailableVersion = '{APPNAME}-{VERSION}-update-{VERSIONDATE}' .Notes = GetNotes() -<> .RegisterWithThor = GetRegisterWithThor() + .RegisterWithThor = GetRegisterWithThor() endwith return toUpdateObject + +procedure GetRegisterWithThor + local lcCommand + text to lcCommand noshow +lcBase = EXECSCRIPT(_SCREEN.cThorDispatcher, 'Thor_Proc_GetFoxBin2PrgFolder') +IF FILE(m.lcBase+"clean_copied_memo.prg") THEN +*remove old crap + DO m.lcBase+"clean_thorfolder.prg" WITH lcBase +ENDIF &&FILE(m.lcBase+"clean_copied_memo.prg") + +DELETE FILE (m.lcBase+"clean_thorfolder.*") + + endtext + + return lcCommand +endproc &&GetRegisterWithThor + * Get the notes for the project.@@@ Edit this code as necessary. If you specify * the name of a change log file as the ChangeLog setting in ProjectSettings.txt, * the contents of that file are substituted for the CHANGELOG placeholder so diff --git a/BuildProcess/buildme.prg b/BuildProcess/buildme.prg index 29959d1..13058ee 100644 --- a/BuildProcess/buildme.prg +++ b/BuildProcess/buildme.prg @@ -15,7 +15,8 @@ DO foxbin2prg.prg WITH lcVerno *Set Thor verno pcVersion = m.lcVerno -pcPJXFile = "foxbin2prg.pjx" +pcFullVersion = m.lcVerno +pcPJXFile = pcPJXFile &&"foxbin2prg.pjx" *Set FoxBin2Prg.exe verno For lnProject = 1 To _vfp.Projects.Count If Upper(Fullpath(m.pcPJXFile))==Upper(_vfp.Projects(m.lnProject).Name) Then diff --git a/BuildProcess/projectsettings.txt b/BuildProcess/projectsettings.txt index 187fe4f..f77226c 100644 --- a/BuildProcess/projectsettings.txt +++ b/BuildProcess/projectsettings.txt @@ -65,6 +65,9 @@ AppFile = FoxBin2Prg.exe *Remove all files from InstalledFiles folder if InstalledFiles.txt is given *Clear_InstalledFiles = No +*add a gitignore to InstalledFiles directory to not add this directory to git repository +gitIgnore_InstalledFiles = Yes + *A different name for version file used to publish info on the remote server. *A help with old projects using a different name for the version file *VersionFile_Remote = {AppID}Version.txt \ No newline at end of file diff --git a/Helper/Read_InstallFiles.prg b/Helper/Read_InstallFiles.prg new file mode 100644 index 0000000..a00eacc --- /dev/null +++ b/Helper/Read_InstallFiles.prg @@ -0,0 +1,153 @@ +LPARAMETERS; + tcDirectory + +*set step on +tcDirectory = EXECSCRIPT(_SCREEN.cThorDispatcher, 'Thor_Proc_GetFoxBin2PrgFolder') +DO CASE + CASE VARTYPE(tcDirectory)#'C' + CASE !INLIST(UPPER(tcDirectory),'?','/?','-?','/Help','-Help') + OTHERWISE + tcDirectory = JUSTFNAME(SYS(16)) + InfoScreen(tcDirectory) + RETURN +ENDCASE + +ADDPROPERTY(_SCREEN,'gvX1',tcDirectory) + +CLEAR ALL + +LOCAL; + lcDir,; + lcExt,; + lcErr,; + lcOldPath,; + lcDirectory,; + llNewGUID,; + lcResult + + +lcDirectory = _SCREEN.gvX1 +REMOVEPROPERTY(_SCREEN,'gvX1') + +lcOldPath = FULLPATH(CURDIR()) + +DO CASE + CASE EMPTY(lcDirectory) + lcDir = '' + CASE !DIRECTORY(lcDirectory) AND !FILE(lcDirectory) + lcDir = '' + CASE DIRECTORY(lcDirectory) + lcDir = ADDBS(lcDirectory) + OTHERWISE + MESSAGEBOX('Nicht unterstützter Dateityp.') + RETURN +ENDCASE + +IF EMPTY(lcDir) THEN + CLEAR + lcDir = GETDIR('','','',64) + IF ALLTRIM(lcDir)=='' THEN + RETURN + ENDIF &&ALLTRIM(lcDir)=='' +ENDIF &&EMPTY(lcDir) + +PUBLIC; + poRegExp + +*!* poRegExp = CREATEOBJECT('VBScript.RegExp') +*!* WITH poRegExp +*!* .IgnoreCase = .T. +*!* .GLOBAL = .T. +*!* .MultiLine = .T. +*!* ENDWITH &&poRegExp + +lcErr = '' +lcResult = '' +ScanDir(lcDir,@lcErr,lcDir,@lcResult) +_CLIPTEXT = lcResult + +IF !EMPTY(lcErr) THEN + MESSAGEBOX('Fehler in der Zwischenablage gespeichert',0+48) + _CLIPTEXT = SUBSTR(lcErr,3) +ENDIF &&!EMPTY(lcErr) +poRegExp = .NULL. +RELEASE; + poRegExp + +CD (lcOldPath) + +RETURN lcResult + +PROCEDURE InfoScreen + LPARAMETERS; + tcProgram + + LOCAL; + lcTemp AS CHARACTER,; + lnOldMemoW AS INTEGER + + TEXT TO lcTEMP NOSHOW textmerge +<> +Creates a list of files in a given subdirectory with subdirectories. +Usage: +<> [/?] [cDirectory] + /? Displays this text + cDirectory optional directory to start from, subdirectories will be included +Return is in clipboard + ENDTEXT + + lnOldMemoW = SET("Memowidth") + SET MEMOWIDTH TO 100 + ?lcTemp FONT 'Courier',6 + SET MEMOWIDTH TO lnOldMemoW +ENDPROC &&InfoScreen + +PROCEDURE ScanDir + LPARAMETERS; + tcDir,; + tcErr,; + tcDir2,; + tcResult + + LOCAL; + lnLoop1,; + lcOldDir + + LOCAL ARRAY; + laDir(1) + +* SET STEP ON + lcOldDir = FULLPATH(CURDIR()) + CD (tcDir) + FOR lnLoop1 = 1 TO ADIR(laDir,'','D') + IF INLIST(laDir(lnLoop1,1),'.','..') THEN + LOOP + ENDIF &&INLIST(laDir(lnLoop1,1),'.','..') + ScanDir(ADDBS(tcDir+laDir(lnLoop1,1)),@tcErr,tcDir2,@tcResult) + ENDFOR &&lnLoop1 + Dir_Action(tcDir,@tcErr,tcDir2,@tcResult) + + CD (lcOldDir) +ENDPROC &&ScanDir + +PROCEDURE Dir_Action + LPARAMETERS; + tcDir,; + tcErr,; + tcDir2,; + tcResult + + LOCAL; + lnStart AS INTEGER + + LOCAL ARRAY; + laDir(1) + + tcDir2 = STRTRAN(tcDir,tcDir2,'') + + FOR lnStart = 1 TO ADIR(laDir,'*.*') + tcResult = tcResult+0h0d0a+laDir(lnStart,1) + ENDFOR &&lnStart + + RETURN +ENDPROC &&Dir_Action diff --git a/Helper/clean_thorfolder.prg b/Helper/clean_thorfolder.prg new file mode 100644 index 0000000..519b1d3 --- /dev/null +++ b/Helper/clean_thorfolder.prg @@ -0,0 +1,469 @@ +LPARAMETERS; +tcDirectory + +DO CASE + CASE VARTYPE(tcDirectory)#'C' + CASE !INLIST(UPPER(tcDirectory),'?','/?','-?','/Help','-Help') + OTHERWISE + tcDirectory = JUSTFNAME(SYS(16)) + InfoScreen(tcDirectory) + RETURN +ENDCASE + +ADDPROPERTY(_SCREEN,'gvX1',tcDirectory) + +CLEAR ALL + +LOCAL; + lcDir,; + lcExt,; + lcErr,; + lcOldPath,; + lcDirectory,; + llNewGUID + +LOCAL ARRAY; + laActual(1) + +lcDirectory = _SCREEN.gvX1 +REMOVEPROPERTY(_SCREEN,'gvX1') + +lcOldPath = FULLPATH(CURDIR()) + +DO CASE + CASE EMPTY(lcDirectory) + lcDir = '' + CASE !DIRECTORY(lcDirectory) AND !FILE(lcDirectory) + lcDir = '' + CASE DIRECTORY(lcDirectory) + lcDir = ADDBS(lcDirectory) + OTHERWISE + MESSAGEBOX('Nicht unterstützter Dateityp.') + RETURN +ENDCASE + +IF EMPTY(lcDir) THEN + CLEAR + lcDir = GETDIR('','','',64) + IF ALLTRIM(lcDir)=='' THEN + RETURN + ENDIF &&ALLTRIM(lcDir)=='' +ENDIF &&EMPTY(lcDir) + +PUBLIC; + poRegExp + +*!* poRegExp = CREATEOBJECT('VBScript.RegExp') +*!* WITH poRegExp +*!* .IgnoreCase = .T. +*!* .GLOBAL = .T. +*!* .MultiLine = .T. +*!* ENDWITH &&poRegExp + +lcErr = '' +lcResult = '' +Get_CompareFiles(@laActual) +ScanDir(lcDir,@lcErr,lcDir,@laActual) +CD +IF !EMPTY(lcErr) THEN + MESSAGEBOX('Fehler in der Zwischenablage gespeichert',0+48) + _CLIPTEXT = SUBSTR(lcErr,3) +ENDIF &&!EMPTY(lcErr) +poRegExp = .NULL. +RELEASE; + poRegExp + +CD (lcOldPath) + +PROCEDURE InfoScreen + LPARAMETERS; + tcProgram + + LOCAL; + lcTemp AS CHARACTER,; + lnOldMemoW AS INTEGER + + TEXT TO lcTEMP NOSHOW textmerge +<> +Removes files from old installation out og Thor installation directroy for FoxBin2Prg +Compares with a list of files, change proc Get_CompareFiles to add or remove files. +Run Read_InstallFiles.prg against INSTALLEDFILES directory to get the list of files. +Usage: +<> [/?] [cDirectory] + /? Displays this text + cDirectory optional directory to start from, subdirectories will be included + ENDTEXT + lnOldMemoW = SET("Memowidth") + SET MEMOWIDTH TO 100 + ?lcTemp FONT 'Courier',6 + SET MEMOWIDTH TO lnOldMemoW +ENDPROC &&InfoScreen + +PROCEDURE ScanDir + LPARAMETERS; + tcDir,; + tcErr,; + tcDir2,; + taActual + + LOCAL; + lnLoop1,; + lcOldDir + + LOCAL ARRAY; + laDir(1) + +* SET STEP ON + lcOldDir = FULLPATH(CURDIR()) + CD (tcDir) + FOR lnLoop1 = 1 TO ADIR(laDir,'','D') + IF INLIST(laDir(lnLoop1,1),'.','..') THEN + LOOP + ENDIF &&INLIST(laDir(lnLoop1,1),'.','..') + ScanDir(ADDBS(tcDir+laDir(lnLoop1,1)),@tcErr,tcDir2,@taActual) + ENDFOR &&lnLoop1 + Dir_Action(tcDir,@tcErr,tcDir2,@taActual) + CD (lcOldDir) +ENDPROC &&ScanDir + +PROCEDURE Dir_Action + LPARAMETERS; + tcDir,; + tcErr,; + tcDir2,; + taActual + + LOCAL; + lnStart AS INTEGER + + EXTERNAL ARRAY; + taActual + + LOCAL ARRAY; + laDir(1) + + tcDir2 = STRTRAN(tcDir,tcDir2,'') + + FOR lnStart = 1 TO ADIR(laDir,'*.*') + IF EMPTY(ASCAN(taActual,tcDir2+laDir(lnStart,1))) THEN + DELETE FILE JUSTFNAME(laDir(lnStart,1)) + ENDIF &&EMPTY(ASCAN(taActual,tcDir2+laDir(lnStart,1))) + + ENDFOR &&lnStart + + DIMENSION ; + laDir(1) + + laDir = .F. + ADIR(laDir,'*.*') + IF EMPTY(laDir(1,1)) THEN + CD .. + TRY + RMDIR JUSTFNAME(JUSTPATH(m.tcDir)) + CATCH +*incase there is a folder, the cheap ignore + ?m.tcDir + ENDTRY + ENDIF &&EMPTY(laDir(1,1)) + + RETURN +ENDPROC &&Dir_Action + +PROCEDURE Get_CompareFiles + LPARAMETERS; + taActual + + EXTERNAL ARRAY; + taActual + + LOCAL; + lcTemp AS STRING + + TEXT TO lctemp NOSHOW +CONFIG\CONFIG.FPW +WINMERGEPORTABLE\APP\APPINFO\LAUNCHER\SPLASH.JPG +WINMERGEPORTABLE\APP\APPINFO\LAUNCHER\WINMERGEPORTABLE.INI +WINMERGEPORTABLE\APP\APPINFO\APPICON.ICO +WINMERGEPORTABLE\APP\APPINFO\APPICON_128.PNG +WINMERGEPORTABLE\APP\APPINFO\APPICON_16.PNG +WINMERGEPORTABLE\APP\APPINFO\APPICON_32.PNG +WINMERGEPORTABLE\APP\APPINFO\APPINFO.INI +WINMERGEPORTABLE\APP\APPINFO\INSTALLER.INI +WINMERGEPORTABLE\APP\DEFAULTDATA\SETTINGS\WINMERGE.REG +WINMERGEPORTABLE\APP\WINMERGE\DOCS\CHANGELOG.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-BASQUE.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-BRAZILIAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-BULGARIAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-CATALAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-CHINESESIMPLIFIED.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-CHINESETRADITIONAL.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-CROATIAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-DUTCH.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-FRENCH.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-GALICIAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-GREEK.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-JAPANESE.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-ROMANIAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-SERBIAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-SPANISH.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-SWEDISH.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-TURKISH.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README-UKRAINIAN.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\README.TXT +WINMERGEPORTABLE\APP\WINMERGE\DOCS\RELEASENOTES.HTML +WINMERGEPORTABLE\APP\WINMERGE\DOCS\WINMERGE.CHM +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\ADAMULTI.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\ASPNET.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\CSHARP_LOOSE.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\DELPHI.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\FILEFILTER.TMPL +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\FRONTPAGE.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\MASM.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\MERGE_GNUC_LOOSE.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\MERGE_VB_LOOSE.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\MERGE_VC_LOOSE.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\MICROSOFT_VISUAL_FOXPRO_FOXBIN2PRG.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\SOURCECONTROL.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\SYMBIAN.FLT +WINMERGEPORTABLE\APP\WINMERGE\FILTERS\XML_HTML.FLT +WINMERGEPORTABLE\APP\WINMERGE\LANG\AF.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\AR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\AST.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\AZ.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\BA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\BE.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\BG.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\BN.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\BR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\CA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\CS.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\CY.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\DA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\DE.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\EL.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\EN.TTT +WINMERGEPORTABLE\APP\WINMERGE\LANG\EO.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\ES.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\ET.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\EU.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\EXT.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\FA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\FI.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\FR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\FUR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\FY.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\GL.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\GU.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\HE.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\HI.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\HR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\HU.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\HY.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\ID.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\IO.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\IS.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\IT.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\JA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\KA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\KK.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\KO.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\KU-CKB.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\KU.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\LT.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\LV.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\MK.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\MN.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\MR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\MS.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\NB.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\NE.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\NL.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\NN.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\PA-IN.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\PL.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\PS.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\PT-BR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\PT.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\RO.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\RU.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SI.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SK.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SL.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SQ.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SR-SPC.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SR-SPL.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\SV.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\TA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\TH.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\TR.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\TT.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\UG.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\UK.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\UZ.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\VA.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\VI.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\ZH-CN.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANG\ZH-TW.TXT +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\BASQUE.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\BRAZILIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\BULGARIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\CATALAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\CHINESESIMPLIFIED.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\CHINESETRADITIONAL.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\CROATIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\CZECH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\DANISH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\DUTCH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\FRENCH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\GALICIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\GERMAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\GREEK.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\HUNGARIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\ITALIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\JAPANESE.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\KOREAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\NORWEGIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\PERSIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\POLISH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\PORTUGUESE.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\ROMANIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\RUSSIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\SERBIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\SLOVAK.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\SLOVENIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\SPANISH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\SWEDISH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\TURKISH.PO +WINMERGEPORTABLE\APP\WINMERGE\LANGUAGES\UKRAINIAN.PO +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\COMPAREMSEXCELFILES.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\COMPAREMSWORDFILES.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\DISPLAYXMLFILES.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\EDITOR ADDIN.SCT +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\IGNORECOLUMNS.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\IGNORECOMMENTSC.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\IGNOREFIELDSCOMMA.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\IGNOREFIELDSTAB.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\IGNORELEADINGLINENUMBERS.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\INSERT DATETIME.SCT +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\WATCHBEGINNINGOFLOG.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGEPLUGINS\WATCHENDOFLOG.DLL +WINMERGEPORTABLE\APP\WINMERGE\7Z.DLL +WINMERGEPORTABLE\APP\WINMERGE\7ZIP_PAD.XML +WINMERGEPORTABLE\APP\WINMERGE\CONTRIBUTORS.TXT +WINMERGEPORTABLE\APP\WINMERGE\FILES.TXT +WINMERGEPORTABLE\APP\WINMERGE\IGNORESECTIONMARKERS.INI +WINMERGEPORTABLE\APP\WINMERGE\LIBEXPAT.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z910U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z911.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z911U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z912.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z912U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z913.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z913U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z914.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z914U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z915.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z915U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z916.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z916U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z917.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z917U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z918.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z918U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z919.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z919U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z920.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGE7Z920U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MERGELANG.DLL +WINMERGEPORTABLE\APP\WINMERGE\MFC90.DLL +WINMERGEPORTABLE\APP\WINMERGE\MFC90U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MFCM90.DLL +WINMERGEPORTABLE\APP\WINMERGE\MFCM90U.DLL +WINMERGEPORTABLE\APP\WINMERGE\MICROSOFT.VC90.CRT.MANIFEST +WINMERGEPORTABLE\APP\WINMERGE\MICROSOFT.VC90.MFC.MANIFEST +WINMERGEPORTABLE\APP\WINMERGE\MSVCM90.DLL +WINMERGEPORTABLE\APP\WINMERGE\MSVCP90.DLL +WINMERGEPORTABLE\APP\WINMERGE\MSVCR90.DLL +WINMERGEPORTABLE\APP\WINMERGE\PCRE.DLL +WINMERGEPORTABLE\APP\WINMERGE\WINMERGEU.EXE +WINMERGEPORTABLE\DATA\SETTINGS\WINMERGE.REG +WINMERGEPORTABLE\DATA\SETTINGS\WINMERGEPORTABLESETTINGS.INI +WINMERGEPORTABLE\OTHER\HELP\IMAGES\DONATION_BUTTON.PNG +WINMERGEPORTABLE\OTHER\HELP\IMAGES\FAVICON.ICO +WINMERGEPORTABLE\OTHER\HELP\IMAGES\HELP_BACKGROUND_FOOTER.PNG +WINMERGEPORTABLE\OTHER\HELP\IMAGES\HELP_BACKGROUND_HEADER.PNG +WINMERGEPORTABLE\OTHER\HELP\IMAGES\HELP_LOGO_TOP.PNG +WINMERGEPORTABLE\OTHER\SOURCE\APPNAMEPORTABLE.INI +WINMERGEPORTABLE\OTHER\SOURCE\LAUNCHERLICENSE.TXT +WINMERGEPORTABLE\OTHER\SOURCE\PORTABLEAPPS.COMINSTALLERCUSTOM.NSH +WINMERGEPORTABLE\OTHER\SOURCE\README.TXT +WINMERGEPORTABLE\HELP.HTML +WINMERGEPORTABLE\WINMERGEPORTABLE.EXE +.GITIGNORE +CONVERT_VFP9_BIN_2_PRG.VBS +CONVERT_VFP9_PRG_2_BIN.VBS +FB2P_DIFF.EXE +FILENAME_CAPS.CFG +FILENAME_CAPS.EXE +FOXBIN2PRG.CFG.TXT +FOXBIN2PRG.DBF.CFG.TXT +FOXBIN2PRG.EXE +FOXBIN2PRG.ICO +FOXBIN2PRG.JPG +FOXBIN2PRG.PRG +FOXBIN2PRGVERSIONFILE.TXT +FOXBIN2PRG_KEYWORDS.CDX +FOXBIN2PRG_KEYWORDS.DBF +LICENSE +NORMALIZE_FILENAMES.VBS +PROPS_ALL.TXT +PROPS_CHECKBOX.TXT +PROPS_COLLECTION.TXT +PROPS_COMBOBOX.TXT +PROPS_COMMANDBUTTON.TXT +PROPS_COMMANDGROUP.TXT +PROPS_CONTAINER.TXT +PROPS_CONTROL.TXT +PROPS_CURSOR.TXT +PROPS_CURSORADAPTER.TXT +PROPS_DATAENVIRONMENT.TXT +PROPS_EDITBOX.TXT +PROPS_FORM.TXT +PROPS_FORMSET.TXT +PROPS_GRID.TXT +PROPS_GRID_COLUMN.TXT +PROPS_GRID_HEADER.TXT +PROPS_HYPERLINK.TXT +PROPS_IMAGE.TXT +PROPS_LABEL.TXT +PROPS_LINE.TXT +PROPS_LISTBOX.TXT +PROPS_OLEBOUND.TXT +PROPS_OPTIONGROUP.TXT +PROPS_OPTIONGROUP_OPTION.TXT +PROPS_PAGEFRAME.TXT +PROPS_PAGEFRAME_PAGE.TXT +PROPS_PRE_V1_19_22.TXT +PROPS_PROJECTHOOK.TXT +PROPS_RELATION.TXT +PROPS_REPORTLISTENER.TXT +PROPS_SEPARATOR.TXT +PROPS_SHAPE.TXT +PROPS_SPINNER.TXT +PROPS_TEXTBOX.TXT +PROPS_TIMER.TXT +PROPS_TOOLBAR.TXT +PROPS_XMLADAPTER.TXT +PROPS_XMLFIELD.TXT +PROPS_XMLTABLE.TXT +README.MD +VFP9_FOXBIN2PRG.VBS +FOXBIN2PRG.CFG +CLEAN_THORFOLDER.PRG +CLEAN_THORFOLDER.FXP + ENDTEXT &&lcTemp + + ALINES(taActual,lcTemp) +ENDPROC &&Get_CompareFiles + diff --git a/INSTALLEDFILES/license b/INSTALLEDFILES/license new file mode 100644 index 0000000..892f2c8 --- /dev/null +++ b/INSTALLEDFILES/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2014 Fernando D. Bozzo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 27672ef..d53b31f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# FoxBin2Prg v1.19.79 +# FoxBin2Prg 1.19.79 **Binary/Text Converting program for Microsoft Visual FoxPro** ## Lutz Scheffler @@ -12,15 +12,12 @@ The spanish documentation is not longer maintained - it would fade. For fast access a quick run is [introduced](#use-foxbin2prg), more [complex](./docs/FoxBin2Prg_Run.md#usage-1), and a large [documentation](./docs/FoxBin2Prg.md) exists too. If you do not access FoxBin2Prg via [Thor](https://github.com/VFPX/Thor) remind yourself to compile the exe first. ---- --- If you like to value my work, support the Geeks at [![Virtual Fox Fest!](https://virtualfoxfest.com/images/ZoomFoxSmall.png)](https://virtualfoxfest.com/) or [![Southwest Fox!](http://www.swfox.net/images/KokoWhite.jpg)](https://www.swfox.net). I also do not reject invitations to a beer, next time in Gilbert. --- ---- - If you like to see Fernandos blog, or value his work: - Blog: http://fdbozzo.blogspot.com.es/ @@ -32,7 +29,6 @@ If you like to see Fernandos blog, or value his work: ## Contribution See [contribution](./.github/CONTRIBUTING.md) ---- --- ## What is FOXBIN2PRG? @@ -148,7 +144,7 @@ See [issue #93](https://github.com/fdbozzo/foxbin2prg/issues/93). ## Usage For usage see [documentation](./docs/FoxBin2Prg.md) -Last changed: _2023/08/06_ ![Picture](./docs/pictures/vfpxpoweredby_alternative.gif) +Last changed: _2023-08-09_ ![Picture](./docs/pictures/vfpxpoweredby_alternative.gif) Rework Thor_Update_FoxBin2Prg.prg, GetNotes() useless or to much. diff --git a/ThorUpdater/FoxBin2Prg.zip b/ThorUpdater/FoxBin2Prg.zip index b203940..f4def15 100644 Binary files a/ThorUpdater/FoxBin2Prg.zip and b/ThorUpdater/FoxBin2Prg.zip differ diff --git a/ThorUpdater/FoxBin2Prg3.zip b/ThorUpdater/FoxBin2Prg3.zip deleted file mode 100644 index e353365..0000000 Binary files a/ThorUpdater/FoxBin2Prg3.zip and /dev/null differ diff --git a/ThorUpdater/FoxBin2PrgVersion.txt b/ThorUpdater/FoxBin2PrgVersion.txt index 1efdca0..da6b1c6 100644 --- a/ThorUpdater/FoxBin2PrgVersion.txt +++ b/ThorUpdater/FoxBin2PrgVersion.txt @@ -3,22 +3,21 @@ lparameters toUpdateObject * Set the properties of the passed updater object. with toUpdateObject - .VersionNumber = '1.19.80 - 20230808' - .AvailableVersion = 'FoxBin2PRG-1.19.80-update-20230808' + .VersionNumber = '1.19.79 - 20230809' + .AvailableVersion = 'FoxBin2PRG-1.19.79-update-20230809' .Notes = GetNotes() - .RegisterWithThor = GetRegisterWithThor() -* .RegisterWithThor = "SET STEP ON"+0h0d0a+"*"+NVL(EXECSCRIPT(_SCREEN.cThorDispatcher, 'Thor_Proc_GetFoxBin2PrgFolder'),'fail') + .RegisterWithThor = GetRegisterWithThor() endwith return toUpdateObject + procedure GetRegisterWithThor local lcCommand text to lcCommand noshow -SET STEP ON lcBase = EXECSCRIPT(_SCREEN.cThorDispatcher, 'Thor_Proc_GetFoxBin2PrgFolder') IF FILE(m.lcBase+"clean_copied_memo.prg") THEN -*old crap - DO m.lcBase+"clean_thorfolder.prg" +*remove old crap + DO m.lcBase+"clean_thorfolder.prg" WITH lcBase ENDIF &&FILE(m.lcBase+"clean_copied_memo.prg") DELETE FILE (m.lcBase+"clean_thorfolder.*") @@ -471,4 +470,4 @@ return lcNotes * "FoxBin2PRG" is a Component. No procedure GetRegisterWithThor created by VFPX Deployment -*created by VFPX Deployment, 06.08.2023 21:23:17 \ No newline at end of file +*created by VFPX Deployment, 09.08.2023 12:53:03 \ No newline at end of file diff --git a/docs/FoxBin2Prg_Changes.md b/docs/FoxBin2Prg_Changes.md deleted file mode 100644 index dc9b973..0000000 --- a/docs/FoxBin2Prg_Changes.md +++ /dev/null @@ -1,428 +0,0 @@ -# FoxBin2Prg Change log -Documentation of FoxBin2Prg - A Binary to Text converter for MS Visual Foxpro 9 - -## Purpose of this document -List of Changes, Bugfixes and modifications. - -For settings, API and other realted stuff see [Internals](./FoxBin2Prg_Internals.md). - -The original document was created by [Fernando D. Bozzo](https://github.com/fdbozzo) whom I like to thank for the great project. -Pictures are taken from the original project. -As far as possible these are the original documents. Changes are added where functionality is changed. - ----- -## Table of contents -- [Remark](#remark) -- [Full Change History](#full-change-history) - -For recent verisons see -![Picture](./pictures/FoxBin2Prg_Full_Change_History_vfpxreleasesmall.png) [FoxBin2PRG](https://github.com/fdbozzo/foxbin2prg) - -## Full Change History -This page is not only to get the history of the changes, but to keep a permanent list of people that have contributed to enhance FoxBin2Prg and that I feel as part of the ADN of this tool. - -It's my way of thanking them for their contribution. - -_**Note:** you can click on the version number for downloading this version from GitHub, or you can get all the code history directly from the GitHub repository, which is more easy to search._ - -| Rel.Date | Developer | Version | Details | -| - | - | - | - | -| 2023/08/04 | LScheffler | [v1.19.79](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.79) | **Bug Fix**: Bin2Text: Forms with ole controls conversion error (also: any vcx) #95 (KestasL) | -| 2023/03/20 | LScheffler | [v1.19.78](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.78) | **Enhancement**: Text2Bin on PJX errors out for projects with an attach icon that has a drive letter on its path. #93 (ericbarte) | -| | | | **Enhancement**: Documentation enhanced | -| 2023/03/16 | LScheffler | [v1.19.77](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.77) | **Bug Fix**: Bin2Txt Operation on VCX loses leading spaces in Property Values #90 (JoergSchneider) | -| | | | **Bug Fix**: Txt2Bin Operation on VCX looses double ampersand in Property Values #91 (LScheffler) | -| 2022/11/09 | LScheffler | Docu | **Enhancement**: Documentation for git on handling line endings | -| 2022/06/13 | LScheffler | [v1.19.76](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.76) | **Bug Fix**: On operation per folder, change of folder must change configuration (JoergSchneider) | -| 2022/06/08 | LScheffler | [v1.19.75](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.75) | **Bug Fix**: Multiple text2bin and bin2text conversion on MNX causes space grow (JoergSchneider) | -| | | | **Enhancement**: Typo in German (JoergSchneider) | -| 2022/05/13 | bjornhoeksel | [v1.19.74](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.74) | **Bug Fix**: Fix menu bars with shortcuts keys like KEY F6, "F6"; are lost. (DanLauer) | -| 2022/04/08 | LScheffler | [v1.19.73](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.73) | **Bug Fix**: Problem converting trailing spaces on line end in memo (again) (bjornhoeksel) | -| 2022/04/07 | LScheffler | [v1.19.72](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.72) | **Bug Fix**: Problem converting trailing spaces on line end in memo (bjornhoeksel) | -| | | | **Bug Fix**: Problem converting intentionally trailing spaces to VarChar/VarBinary (LScheffler) | -| | | | **Bug Fix**: Bug Fix: Problem on using "DBF_Conversion_Support" on table configuration file (LScheffler) | -| | | | **Enhancement**: Documentation in config file enhanced | -| | | | **Enhancement**: Added parameter "?" to show interactive help ("interactive" still works) | -| 2022/03/30 | bjornhoeksel | [v1.19.71](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.71) | **Bug Fix**: Convert menu mn2 to mnx with skip for that contains a string with ; sign is missing part after that sign in mnx. (bjornhoeksel) | -| 2022/03/16 | LScheffler | [v1.19.70](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.70) | **Bug Fix**: Last bar in menu files are in some situations not converted correctly back in the mnx file. (bjornhoeksel) | -| | | | **Enhancement**: Buglist internal of FoxBin2Prg reordered | -| | | | **Enhancement**: Enhancement to documentation | -| 2022/02/25 | LScheffler | [v1.19.69](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.69) | **Bug Fix**: Missing class when building text file from corrupted VCX (bjornhoeksel) | -| 2022/02/23 | LScheffler | [v1.19.69](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.69) | **Bug Fix**: Recreating a class while an object with same name exists in VCX fails (bjornhoeksel) | -| | | | **Enhancement**: Template configuration files FOXBIN2PRG.DBF.TXT and FOXBIN2PRG.DBF.CFG.TXT in English | -| | | | **Enhancement**: Examples and template for config files enhanced | -| | | | **Enhancement**: Notice in contribution file to creating files above in English | -| | | | **Enhancement**: Started reworking double documentation | -| 2022/01/18 | LScheffler | [v1.19.68](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.68) | **Bug Fix**: Converting MN2 to MNX ignores the programmer-defined "Pad Name" found in "Prompt Options" screen (Jimrnelson) | -| | | | **Enhancement**: Minor links in readme.html | -| 2021/08/20 | LScheffler | [v1.19.67](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.67) | **Bug Fix**: Double classes in VCX (LScheffler) | -| | | | **Enhancement**: Templates and documentation for config files reworked | -| 2021/08/20 | LScheffler | [v1.19.66](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.66) | **Bug Fix**: Incorrect version showing for v1.19.65 (siara-cc) | -| | | | **Enhancement**: Incorrect links on documentation (siara-cc) | -| 2021/05/20 | LScheffler | [v1.19.65](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.65) | **Bug Fix**: Parameters -cCt not working from command line. (LScheffler) | -| 2021/04/22 | LScheffler | [v1.19.64](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.64) | **Bug Fix**: onverting MN2 to MNX ignores the programmer-defined bar # found in "Prompt Options" screen. (Jimrnelson) | -| | | | **Bug Fix**: Converting MN2 to MNX ignores the programmer-defined Pad Name found in "Prompt Options" screen. (LScheffler) | -| 2021/04/12 | LScheffler | [v1.19.63](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.63) | **Bug Fix**: Tables without indexes cause an error that the __Table ## is not marked as belonging to the ## database.__ (jstagerGH) | -| 2021/03/30 | LScheffler | [v1.19.62](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.62) | **Enhancement**: Debug logging, level of config file. | -| | | | **Bug Fix**: *_Conversion_Support options not read from config file. | -| | | | **Bug Fix**: Extension shift options not read from config file. (Sergej s-s-a) | -| | | | **Bug Fix**: RedirectFilePerDBCToMain option was defined wrong in configuration example | -| 2021/03/23 | LScheffler | [v1.19.61](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.61) | **Bug Fix**: Missnamed property. | -| 2021/03/22 | LScheffler | [v1.19.60](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.60) | **Enhancement**: FoxBin2Prg template and debug output: Completed and ordered, order synched, grouped and groups named at template. | -| | | | **Enhancement**: Option BackgroundImage was read, but not in template | -| | | | **Enhancement**: -cC options learned to create default FoxBin2Prg._cfg file | -| | | | **Enhancement**: -t Option learned to create default \._cfg file, if table is open. | -| | | | **Enhancement**: Handling of additional non structural index per DBF in Bin2Text and Text2Bin. See [Config per DBF](./FoxBin2Prg_Internals.md#configuration-per-table). | -| | | | **Enhancement**: Debug-Logging for Index | -| | | | **Bug Fix**: DBF_Conversion_Condition was read, but never used | -| | | | **Bug Fix**: DBF_Conversion_Order sets an index that later would be stored as structural index | -| | | | **Bug Fix**: config options with text value fail, if line comment is set | -| | | | **Bug Fix**: issue #53 Variable lnFileCount in get_filesfromdirectory (msueping) | -| 2021/03/09 | LScheffler | v1.19.59 | **Feature**: Logging of settings as settings object passed to execute method (Option debug > 0) | -| | | | **Feature**: Added option to create config file template based on current values of a directory | -| | | | **Bug Fix**: RedirectClassType = 2, Path was set wrong in special config | -| | | | **Bug Fix**: RedirectClassType = 2, UseClassPerFile = 2 failed | -| | | | **Doc**: Improved, Better description of ClassPerFileCheck, tcOutputFolder. | -| 2021/03/04 | Doug Hennig | [v1.19.58](https://github.com/fdbozzo/foxbin2prg/releases/tag/v1.19.58) | **Feature**: Added support for writing to a different folder than the source code using a new tcOutputFolder parameter | -| | | | **Feature**: Added a configuration option: HomeDir, which determines if HomeDir is saved in PJ2 files (the default is 1 for Yes) | -| 2021/03/05 | LScheffler | v1.19.57 | **Bug Fix**: RedirectClassType = 2 mixed up PATH | -| | | | **Doc**: Improved | -| 2021/03/04 | LScheffler | v1.19.56 | **Feature**: New value 2 for option RedirectClassType = 2, just process the single class for input in form file[.baseclass].class.vc2 | -| | | | **Bug Fix**:
Inputfile in form classlib.class.vc2 AND RedirectClassType = 1 and Execute param tcRecompile = 1
generates classlib.class.vcx and tries to recompile classlib.vcx
fails silent if classlib.vcx exists (compiles wrong lib), with message if not. | -| 2021/03/03 | LScheffler | v1.19.55 | **Doc**: Documentation from CodePlex integrated | -| | | | **Feature**: added option to create config file template | -| | | | **Doc**: Info screen-doc improved | -| | | | **Doc**: German translation improved | -| 2021/03/03 | LScheffler | v1.19.54 | **Bug Fix**: DBF_Conversion_Condition, problem with macro expansion | -| 2021/02/20 | LScheffler | | **Feature**: inserted option DBF_IncludeDeleted to allow including deleted records of DBF | -| 2021/02/19 | LScheffler | | **Feature**: inserted option DBF_BinChar_Base64 to allow processing of NoCPTrans fields in non base64 way | -| 2021/02/15 | LScheffler | | **Feature**: inserted option ItemPerDBCCheck to split DBC processing from vcx / scx | -| | | | **Feature**: inserted option RedirectFilePerDBCToMain to split DBC processing from vcx / scx | -| 2021/02/14 | LScheffler | | **Feature**: inserted option UseFilesPerDBC to split DBC processing from vcx / scx | -| 2021/02/23 | LScheffler | v1.19.53 | **Doc**: For Info screen and config-template, usage of MEM and FRX added | -| | | | **Bug Fix**: conversion prg -> vcx, files per class could create one class multiple times | -| 2021/02/15 | | | **Bug Fix**: processing directory, flush log file after loop instead of file | -| 2021/02/14 | LScheffler | v1.19.52 | **Bug Fix**: conversion prg -> dbf, fields with .NULL. value are incorectly recreated | -| | | | **Doc**: minor translations | -| | | | **Bug Fix**: conversion dbf -> prg, error if only test mode (toFoxBin2Prg.l_ProcessFiles is false) | -| 2020/04/01 | FDBOZZO | [v1.19.51.6](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.51.6) | Add some fixes to existent ut_tests | -| | | | **Bug Fix**: At least one of the class-per-file files do not have CR_LF at the end, then when assembling the class or form some structures (ENDIF/ENDCASE/ENDDEF/etc) can be joined with the next, making them erroneous (Ryan Harris) | -| | | | **Bug Fix**: Incompatible with VFPA (#36) (Eric Selje) | -| | | | **Bug Fix**: DBF conversion fails if some field name is a reserved keyword like UNIQUE (DAJU78) | -| | | | **Bug Fix**: VCX/SCX properties named "note" are not properly converted (Tracy Pearson) | -| | DH | | **Bug Fix**: Manejo de AutoIncrement incompatible con Project Explorer (Dan Lauer) [Fixed by Doug Hennig] | -| 2019/02/24 | FDBOZZO | [v1.19.51.5](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.51.5) | **Feature**: Issue#32 Make FoxBin2Prg more COM friendly when using ESC key (Tracy Pearson) | -| 2018/07/31 | FDBOZZO | [v1.19.51.4](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.51.4) | **Bug Fix**: Issue#26 The alphabetic ordering of ADD OBJECT's objects can cause that some objects be created in erroneous order, causing unexpected behavior (Jochen Kauz) | -| 2018/07/09 | FDBOZZO | [v1.19.51.3](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.51.3) | **Bug Fix**: Error 1098, Cannot find ... [ENDT] that closes ... [TEXT] Issue#26 when there is a field named TEXT as first line-word (KIRIDES) | -| 2018/06/20 | FDBOZZO | [v1.19.51.2](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.51.2) | **Bug Fix**: When converting to text a DBF that belongs to a DBC with events disabled, conversion fails (Jairo ArgĂźelles / Juan C. Perdomo) | -| 2018/05/12 | FDBOZZO | [v1.19.51.1](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.51.1) | **Bug Fix**: If capitalization is used on a DBC view info, then related information is not exported correctly or entirely, so could be lost (SkySurfer1) | -| 2018/03/26 | FDBOZZO | [v1.19.51](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.51) | Add LOG info about config.fpw used and CodePage | -| | | | Enhanced HELP dialog info when running FoxBin2Prg with double-click | -| | | | **Feature**: FKY file structure support (MACRO file exporting only to text fk2) | -| | | | **Feature**: MEM file structure support (MEMORY file exporting only to text me2) | -| | | | **Feature**: Added automatic default language recognition for the supported ones (FR,DE,ES,EN) | -| 2018/03/15 | FDBOZZO | [v1.19.50.3](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.50.3) | **Bug Fix**: When adding some non-VFP text files like html,css,etc, in the text section of the project, FoxBin2Prg does not keep this selection when regenerating the PJX, leaving them in the files section (Darko Kezic) | -| 2018/03/13 | FDBOZZO | [v1.19.50.2](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.50.2) | **Bug Fix**: Regenerating pjm,"*" when CFG's extension:pj2=pjm does not regenerate all pjx included files (Darko Kezic) | -| 2018/03/12 | FDBOZZO | [v1.19.50.1](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.50.1) | **Bug Fix**: When using the CFG configuration "extension: pj2=pjm" treat the pjm as pj2 and not as SourceSafe-compatible pjm (Darko Kezic) | -| 2018/03/06 | FDBOZZO | [v1.19.50](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.50) | Added a new CFG "BodyDevInfo" switch to control the DevInfo body data of PJX. It is disabled by default because DevInfo normally have compiled data that can be regenerated and causes many differences on source control tools | -| | | | New PRG_Compat_Level CFG value to make generated SC2/VC2 code more PRG compatible | -| | | | **Bug Fix**: PJX homedir related fields do not always are sincronized | -| | | | Workaround to export DBF metadata without the security part of the DBC blocking it, when DBCEvents are enabled. | -| 2018/02/03 | FDBOZZO | [v1.19.49.8](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.8) | **Bug Fix**: When converting a VCX corrupted with duplicated objects to text, "The specified key already exists" error is thrown (Kirides) | -| 2018/01/11 | FDBOZZO | [v1.19.49.7](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.7) | **Bug Fix**: When converting a DBF an error is thrown if there is a field called X or I (Francisco Prieto) | -| 2018/01/04 | FDBOZZO | [v1.19.49.6](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.6) | **BugFix vcx/scx**: FoxBin2Prg should ignore the records that VFP Designer ignores (Doug Hennig / https://github.com/fdbozzo/foxbin2prg/issues/15) | -| | | | **BugFix vcx/scx**: FoxBin2Prg encodes MemberData property with CR/LF, which can cause "property '_memberdata' value is too long" error (Doug Hennig / https://github.com/fdbozzo/foxbin2prg/issues/16) | -| 2017/12/20 | FDBOZZO | [v1.19.49.5](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.5) | **BugFix DBF**: When FoxBin2PRG converts a DB2 file to a DBF file and imports the data (using DBF_Conversion_Support = 8), tabs at the start of lines in memo fields are lost (Doug Hennig / https://github.com/fdbozzo/foxbin2prg/issues/13) | -| 2017/12/04 | FDBOZZO | [v1.19.49.4](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.4) | **Bug Fix VCX**: When using ClassPerFile in API Mode and importing single classes, sometimes their names get unquoted, throwing errors / Reported by Lutz Scheffler (https://github.com/fdbozzo/foxbin2prg/issues/11) | -| 2017/12/03 | FDBOZZO | [v1.19.49.3](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.3) | **Bug Fix**: "Double" field types are explicitly defined with 0 decimals when no decimals are defined (Jerry Stager) | -| 2017/12/03 | FDBOZZO | [v1.19.49.2](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.2) | **Bug Fix**: ClassPerFile export didn't work correctly starting from v1.19.49 / Reported by Lutz Scheffler (https://github.com/fdbozzo/foxbin2prg/issues/9) | -| 2017/06/25 | FDBOZZO | [v1.19.49.1](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49.1) | **Bug Fix**: DEVINFO field is only used when doing PJX conversions. On other files throw errors | -| 2017/04/26 | FDBOZZO | [v1.19.49](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.49) | Replace Scripting.FileSystemObject MoveFile with Win32API equivalent | -| | | | Added support for using temporal CFG file for low-level API operations | -| | | | **Bug Fix**: Single-class export with "classlib.vcx::classname" syntax did not export (Lutz Scheffler) | -| | | | Added single-class import support ("library.vcx::classname::import") | -| | | | Added new single-class export syntax ("library.vcx::classname::export") | -| | | | Both single-class syntaxes doesn't require a CFG configuration | -| | | | **Bug Fix**: Partially corrupted frx/lbx info generated when using "&&" string inside field expressions (Alejandro A Sosa) | -| | | | sys(2023) secure temp: When sys(2023) points to "program files", then getenv("temp") is used | -| | | | Add more options to config.fpw to minimize interference from existent configs | -| | | | **Feature**: Save the contents of User field (Doug Hennig). Note: DevInfo is already supported | -| 2016/07/24 | FDBOZZO | [v1.19.48](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.48) | **Bug Fix**: ControlSource of OLE Objects containing quotes are not well regenerated from FR2 (Nathan Brown) | -| | FDBOZZO | Preview-5 | **Bug Fix**: When a binary is regenerated from a PJ2 file containing files with parenthesis and spaces, the error "Error 36, Command contains unrecognized phrase/keyword" occurs (Nathan Brown) | -| | FDBOZZO | Preview-4 | **Defect Fix**: When fixing the multi-line memo bug, introduced a new defect on which a single-line memo is not decoded correctly (Nathan Brown) | -| | FDBOZZO | Preview-3 | **Bug Fix**: Bug Fix db2: When reading a miltuline-memo with old db2 data, an index out of range error occurs | -| | FDBOZZO || **Bug Fix** db2: When using ExcludeDBFAutoincNextval: 1 setting in FoxBin2Prg.cfg and at the same time the data import with an AutoInc field, then error "Error 2088, Field is read-only" occurs (Nathan Brown) | -|| FDBOZZO | Preview-2 | **Bug Fix**: DBF conversion restrictions are not always respected when using particular CFGs for DBFs (Nathan Brown) | -|| AndyGK63 | Preview-1 | **Bug Fix**: Error message 'variable tcOutputFile not found' (german version) (Andy Kasper) | -|| AndyGK63 || **Bug Fix**: Menu location 'Before' always changed to 'after' when convert (Andy Kasper) | -| 2016/06/09 | FDBOZZO | [v1.19.47](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.47) | **Bug Fix**: Added multi-line support for memo data when importing/exporting | -|| FDBOZZO || **Feature**: Added support for appending data from DB2 to DBF with the new value DBFConversionSupport=8. All datatypes except General. (Walter Nicholls) | -|| DougHennig || **Bug Fix**: Added variable declaration in vbs scripy (Doug Hennig) | -|| DougHennig || **Bug Fix**: Fixed incorrectly named variable in vbs script (Doug Hennig) | -|| DougHennig || **Bug Fix**: Added missing assignment in vbs script (Doug Hennig) | -|| DougHennig || **Enhancement**: Put double quotes around path in case in contains single quote in vbs scripts (Doug Hennig) | -|| FDBOZZO || **Bug Fix**: Added "+16" to Debug flags to maintain internal defaults to not generate timestamps on xx2 files in vbs scripts | -|| FDBOZZO || **Bug Fix**: When a filename "\*" is specified with a type "\*", an automatic regeneration of all binary files is made from text files (Alejandro Sosa) | -| 2016/02/07 | FDBOZZO | [v1.19.46](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.46) | **Bug Fix**: set\_UserValue() method causes error when trying to get information about another error and the VFP binary table can not be opened (ie, because corrupted memo) | -|||| **Feature**: Added internal support for querying directory cfg information, with a new optional parameter, for API methods that require it (ie: get\_Ext2FromExt, hasSupport\*) | -|||| **Feature**: Convert FUNCTION to PROCEDURE for maintaining compatibility with the way that VFP save methods on binaries | -|||| **New fb2p\_diff.exe**: Allow a quick Diff of VFP9 binaries, for those that don't need converting to text manually | -|||| **Bug Fix**: When processing a directory or a project with all the files, sometimes an "Alias already in use" error may occur (Dave Crozier) | -|||| **Bug Fix mnx**: When menu options contains '&&' in their texts, menu binary is corrupted when regenerated (Walter Nichols) | -|||| **Bug Fix fb2p\_diff.exe**: When calling fb2p\_diff.exe from a directory out of FoxBin2Prg dir, an error is thrown because FoxBin2Prg is not found (Mike Potjer) | -|||| **Feature**: In some environments and under some conditions WSscript.Shell object can cause problems, so now it's replaced with Win32 native functions (AurĂŠlien Dellieux) | -|||| **Bug Fix frx/lbx**: Ordering of report objects changes the ZOrder of near objects that can overlap, which can cause bad visualization and printing (Ryan Harris) | -|||| **Bug Fix frx/lbx**: When regenerating reports or labels with multiline texts center or right aligned, alignment is not completely right (Ryan Harris) | -|||| **Bug Fix frx/lbx**: When grouping objects in design mode, generating text and regenerating binary cause the lost of the grouping (does not affect data) (Lutz Scheffler) | -|| RALFXWAGNER || **Bug Fix Pjx**: SPR and MPR files are not correctly identified in the PJX Project info (Ralf Wagner) | -|||| **Bug Fix Pj2**: An error is thrown when regenerating a PJX from a PJ2 when some file have parenthesis in it's name (EddieC) | -|||| **Feature (dbf)**: New ExcludeDBFAutoincNextval parameter for minimizing DB2 differences (edyshor) | -|||| **Bug Fix**: When processing a file on root dir, a 2062 error occurs (AurĂŠlien Dellieux) | -| 2015/06/21 | FDBOZZO | [v1.19.45](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.45) | **Bug Fix mnx**: When a menu that uses single quotes or an expression in the option's MESSAGE is exported to text, when regenerating the menu from the text there are parts of the message that are cut off (Mike Potjer) | -|||| **Bug Fix**: When processing multiple PJ2 files, an error "variable llError not defined" can occur (Lutz Scheffler) | -|||| **Bug Fix pjx/pj2**: PJX/PJ2 projects that references files from other disk units throw errors for those files when processing with "\*" or "\*-" options (Matt Slay) | -|||| **Bug Fix**: When processing multiple-files, sometimes encountered errores are not reported | -|||| **Feature (API-PJX)**: New loadModule() method that returns the internal FoxBin2Prg Project object when the full name of an existent project file is specified | -|||| **Feature (API-PJX)**: New getFilesNotFound() method for the FoxBin2Prg's Project object, that returns the count of files referenced in the project that are not found on disk and an array with all the existence state of each file | -| 2015/05/31 | FDBOZZO | [v1.19.44](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.44) | **Bug Fix**: In certain PCs FoxBin2Prg does not return error codes when called from an external program, so another terminating method is implemented (Ralf Wagner) | -|||| **Feature**: Allow exporting DBF data when using DBF\_Conversion\_Support:1 and optional individual CFG files | -|||| **Bug Fix**: A previous bug fix on cascading errors management caused reseting the error status, making that sometimes errors don't get reported | -| 2015/05/10 | FDBOZZO | [v1.19.43](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.43) | **Feature**: Added new CFG setting "RemoveZOrderSetFromProps" for removing ZOrderSet property when you want to maintain the original class ZOrder always, avoid unnecesary differences and fix some visual on top/on bottom control problems (Ryan Harris) | -|||| **Feature**: Do not allow progressbar window become the default output window of ? command (Lutz Scheffler) | -|||| **Bug Fix**: Fixed VFP9 SP1 validation message | -|||| **Bug Fix**: FoxBin2Prg PRG2BIN does not return error codes (Ralf Wagner) | -|||| **Bug Fix**: FoxBin2Prg sometimes generates an OLE error when executed for second time on a file with problems (Fidel Charny) | -|||| Some enhancements in security of DLL declarations and On Escape management | -|||| **Defect Fix**: Accesing DataSessionID property throws an error because of the change of internal classes between custom and session | -|||| **Bug Fix**: When a form have AutoCenter=.T., there are times that when regenerating the binary and executing it does not shows centered (Esteban Herrero) | -| 2015/04/16 | FDBOZZO | [v1.19.42](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.42) | **Feature**: Added VFP 9 SP1 runtime validation | -|||| **Bug Fix**: Broken SourceSafe compatibility because an error is thrown when querying for file support (Tuvia Vinitsky) | -|||| **Bug Fix scx/vcx**: Process only one TEXT/ENDTEXT nesting level because TEXT/ENDTEXT can't be nested (Lutz Scheffler) | -|||| **Feature**: Make some error descriptions more informative and precise (Lutz Scheffler) | -|||| **Feature (API)**: Allow specifying inputFile with relative path (Lutz Scheffler) | -|||| **Bug Fix scx**: Metadata of Dataenvironment not properly generated when Dataenvironment is renamed | -|||| **Bug Fix**: Added PJX/PJ2 generation when specifying "file.pjx", "\*" (Lutz Scheffler) | -|||| Some enhancements in german translations (Lutz Scheffler) | -|||| **Feature**: Added multiprocessing of projects (\*.pjx, \*.pj2) when specifying "file.pjx", "\*" (Lutz Scheffler) | -|||| Change FoxBin2Prg base class from custom to session (Lutz Scheffler) | -|||| **Feature**: Allow processing all project files without converting the PJX/2, with "\*-" (Lutz Scheffler) | -|||| **Bug Fix pjx/pj2**: If end of line (CR+LF) is used on pjx's "Build" properties data, generated pj2 is malformed | -|||| **Feature**: Default foxbin2prg.cfg configuration file renamed to foxbin2prg.cfg.txt to no overwrite user cfg (Lutz Scheffler) | -|||| **Feature**: Added DOS errOut output support and implemented in writeErrorLog when logging errors | -|||| **Feature**: Added full support for \*? file masks for multi-processing files of the same extension | -|||| **Feature (API)**: Added new parameter to allow alternative main CFG (Lutz Scheffler) | -|||| **Feature (API)**: Added new get\_Processed() method for obtaining information about processed files (Lutz Scheffler) | -|||| **Feature**: Added new file processing output to DOS stdOut (Lutz Scheffler) | -|||| **Bug Fix**: Fixed processing cancelation with Esc key | -|||| **Feature**: Sort table/view fields alphabetically to facilitate diffing and merging, while maintaining a list with the original field order for correct DBC regeneration (Ryan Harris) | -|||| **Feature**: Apply ClassPerFile to DBC connections, tables, views and SPs (Ryan Harris) | -|||| **Bug Fix mnx**: Empty Pad name is not kept when regenerating a menu defined with and empty Pad name (Lutz Scheffler) | -|||| **Feature (API)**: New property "lProcessFiles" that allow setting to .F. when using foxbin2prg as object to get Processing file info with getProcessed method without actual processing | -|||| **Bug Fix frx/lbx**: Trimmed some extra CR,LF,TAB from FR2/LB2 tag that where included in previous versions (Ryan Harris) | -|||| **Bug Fix scx/vcx/dbc**: Delete ERR files when processing with UseClassPerFile switch (Ryan Harris) | -|||| **Feature**: Implemented CFG inheritance between directories | -|||| **Feature (API)**: New method get\_DirSettings() that returns the CFG settings object for the indicated directory (Lutz Scheffler) | -|||| **Feature**: Allow generation of text for a single class of a librery when using ClassPerFile (Lutz Scheffler) | -|||| **Feature (API)**: Renowned method names to English to facilitate international understanding (Mike Potjer) | -| 2015/01/18 | FDBOZZO | [v1.19.41](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.41) | **Bug Fix db2**: Erroneous detection of Invalid Table when size is less than 328 bytes. Lower limit was changed to 65 bytes. | -|||| **Bug Fix vcx/scx**: Erroneous detection of PROCEDURE/ENDPROC structures when used as parameters of LPARAMETERS and start in new line (Ryan Harris) | -| 2015/01/11 | FDBOZZO | [v1.19.40](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.40) | **Enhancement frx/lbx**: Clean ASCII 0 from expression field for Dataenvironment, Cursors and Relations | -|||| **Bug fix frx/lbx**: When using Dataenvironment with more than one cursor, remaining cursors are lost | -|||| **Feature**: Added new configuration "ShowProgressbar:2" to activate the progressbar only when a directory is selected and deactivate it for individual files (Jim Nelson) | -|||| **Bug fix dbf**: Error 12, variable "tcOutputFile" is not found when DBFConversionSupport=4 and output file is the same as existent one (Mike Potjer) | -|||| **Feature scx/vcx/sc2/vc2**: Added new code checking to find duplicated object names for the same class and container to notify those cases of file corruption | -|||| **Bug Fix**: "Error 2183: Operation requires that SET MULTILOCKS is set to ON" in some DBF convertions | -| 2015/01/01 | FDBOZZO | [v1.19.39](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.39) | **Bug fix vbs**: vbs scripts does not show FoxBin2Prg process errors correctly | -|||| When using BIN2PRG or PRG2BIN keywords with FoxBin2Prg command line, allow processing one file (Mike Potjer) | -|||| Add keyword SHOWMSG and use INTERACTIVE keyword for an interactive dialog (Mike Potjer) | -|||| When processing a directory from commandline with foxbin2prg alone and the INTERACTIVE keyword, show a dialog to ask what to process (Mike Potjer) | -|||| **Bug fix dc2**: DisplayClass and DisplayClassLibrary values got the wrong value "Default" and not the corresponding own values (Christopher Kurth/Ryan Harris) | -|||| Deleted recompilation scripts for language, because it is an automatic selection now | -| 2014/12/13 | FDBOZZO | [v1.19.38](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.38) | **Feature**: Now is possible to use FoxBin2Prg for batch conversions directly from the File Explorer (see README.txt), without the need of vbs scripts, that sometimes can make trouble or are not permitted by IT department (Francisco Prieto) | -|||| **Feature**: Enhanced Multilanguage support by 3 ways: 1-Automatic DEFAULT (depending on VERSION(3)); 2-By parameter, using the new method ChangeLanguage(); 3-Using the new setting "Language" in foxbin2prg.cfg | -|||| **Feature**: Detection of duplicated methods on vc2/sc2 files to notify those cases of vcx/scx file corruption (Álvaro CastrillĂłn) | -| 2014/11/30 | FDBOZZO | [v1.19.37](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.37) | **Feature**: Added Class per file support, configurable with UseClassPerFile:1 (Ryan Harris/Lutz Scheffler/Álvaro CastrillĂłn) | -|||| **Feature**: foxbin2prg.cfg configuration options can now have "&&" comments at the right of the values (edyshor) | -|||| **Feature**: Added support for the new "ClearDBFLastUpdate" setting in FoxBin2Prg.cfg, activated by default to minimize DB2 differences (edyshor) | -|||| **Feature**: Enhanced progressbar indication, with more detailed information | -|||| **Feature**: vcx/scx broken properties autofix because an erroneous manual user edition on the vcx/scx | -|||| **Feature**: vcx/scx autofix por Hidden and Protected duplicated properties (some type of corruption or bad manual user edit) | -|||| **Feature**: Added a validation for FRX to notify the user if it is not a VFP 9 REPORT | -|||| **Feature**: Batch convertions can now be interrupted with the Esc key | -|||| **Bug Fix dbf**: "Error 1903, String is too long to fit" when converting long DBF files with "DBFConversionSupport:4" to text (edyshor) | -|||| **Bug Fix vcx/scx**: Sometimes some properties get the description of a similarly named property | -|||| **Bug Fix vcx/scx**: Hidden and Protected properties are not ordered alphabetically | -|||| Various Code Optimizations for enhancing processing performance | -| 2014/10/08 | FDBOZZO | [v1.19.36](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.36) | **Bug fix mnx**: When generating mn2 text view, menu all pad IDs are generated as \_000000000 (bug introduced in v1.19.35) | -|||| **Enhancement**: New "VFP9\_FoxBin2Prg.vbs" script for "SendTo" menu, that replaces FoxBin2Prg.exe in this menu and adds a process status message | -| 2014/10/05 | FDBOZZO | [v1.19.35](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.35) | **Enhancement**: Always generate the same Timestamp and UniqueID for binaries, for minimizing differences when regenerating them (Marcio Gomez G.) | -| 2014/09/19 | FDBOZZO | [v1.19.34](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.34) | **Bug Fix**: If run from VFP Command Window and there is a file in use, an error is thrown because can't capitalize source file (Jim Nelson) | -| 2014/08/29 | FDBOZZO | [v1.19.33](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.33) | **Bug Fix mnx**: Menu doesn't generate well when there is a Bar of #BAR type without a name (Peter Hipp) | -|||| **Bug Fix mnx**: If a menu option have an associated Procedure with 1 line of code, the Procedure is converted to Command (Peter Hipp) | -| 2014/08/26 | FDBOZZO | [v1.19.32](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.32) | If exists a property called "text" it is confused with a text/endtext structure (Peter Hipp) | -| 2014/08/22 | FDBOZZO | [v1.19.31](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.31) | Trash cleanup code on binary methods, normally added by tools like ReFox and others | -|||| Added EXE version number when generating a debug LOG file | -|||| Enhanced recognition of #IF..#ENDIF instructions when there are spaces between # symbol and the command name | -|||| Added capitalization normalization for input files | -|||| Added new c\_Language property for querying actual compiled language (EN,ES,DE,etc) | -| 2014/08/10 | FDBOZZO | [v1.19.30](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.30) | **Bug Fix vcx/scx**: Bad EndText (from Text/EndText block) detection when the previous line ends with "," or ";" (Jim Nelson) | -|||| Bug Fix vcx/scx: Some methods are not alphabetically sorted in some inheritance situations (Ryan Harris) | -|||| Added FoxUnit test cases to bug fix confirmation of both | -| 2014/08/01 | FDBOZZO | [v1.19.29](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.29) | **Bug Fix vcx/scx**: Bad Text (from Text/EndText block) detection when there is a line that begins with a "text" field and previous line end with "," in regards of ";" (M\_N\_M) | -|||| Optimizations and refactoring | -| 2014/07/26 | FDBOZZO | [v1.19.28](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.28) | **Feature**: Added new options in foxbin2prg.cfg (DBF_Conversion_Included, DBF_Conversion_Excluded) and in filename.dbf.cfg (DBF\_Conversion\_Order, DBF\_Conversion\_Condition) for exporting DBFs data to text when DBF_Conversion_Support is 4 (Edyshor) | -| 2014/07/18 | DH/FDBOZZO | [v1.19.27](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.27) | **Feature**: Added support for exporting DBF data for DIFF when using DBF\_Conversion\_Support: 4 in foxbin2prg.cfg (It's intended just for DIFF small DBFs, as config ones, not for true Data export. Binary fields are not exported and there is not an Import Data feature) (Doug Hennig) | -| 2014/07/06 | FDBOZZO | [v1.19.26](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.26) | **Feature**: Take out asterisks between "ENDPROC" and "PROCEDURE", analyzed in that exact order, to regenerate binary without errors. (Daniel SĂĄnchez) | -|||| **Feature**: Add the l\_DropNullCharsFromCode configuration option, enabled by default, to allow taking out NULLs from source code. (Matt Slay) | -|||| **Bug Fix cfg**: ExtraBackupLevel does not work when using multi-configuration | -| 2014/06/25 | FDBOZZO | [v1.19.25](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.25) | When processing one or multiple files with vbs scripts, show a message indicating the status of the generation, and show the error log if any error occurs (Pedro GutiĂŠrrez M.) | -|||| Code cleaning and normalization | -|||| ClearUniqueID is True by default for tx2 files | -|||| OptimizeByFilestamp is False by default, to avoid possible automatic modifications made by VFP when opening a form or a classlib | -|||| New AllowMultiConfig switch enabled by default, that allow a foxbin2prg.CFG file per directory, overriding main CFG (Mario Peschke) | -| 2014/06/15 | FDBOZZO | [v1.19.24](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.24) | **Bug Fix scx/vcx**: The absence of AGAIN keyword on some USE commands throws "tabla in use" error if used the PRG version from VFP command window (Matt Slay) | -|||| **Bug Fix scx/vcx**: A table field called "text" that begins the line can be confused with the TEXT/ENDTEXT structure and can wrong recognize the rest of the code (Mario Peschke) | -|||| **Bug Fix scx/vcx**: GetTimeStamp internal method throwse an error when day or month have just 1 digit (happen from v1.19.23) | -|||| New "run\_aftercreate\_db2" event that permits execution of an external program when using FoxBin2Prg as object (for example, to export table data) | -|||| New FoxUnit Unit Tests to verify new functionality and "text" bug fix | -|||| Added foxbin2prg\_de.h file translation of most messages to German (Mario Peschke) | -| 2014/06/07 | FDBOZZO | [v1.19.23](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.23) | Timestamps and UniqueIds values are back on binaries, and they are just cleaned up on tx2 files if NoTimestamps and ClearUniqueID flags are set. This minimizes some differences on the binary side | -|||| Added sccdata default value when regenerating PJX binary (which is automatically completed on the PJX when opened anyway) | -|||| Fixed timestamp evaluation for "OptimizeByFilestamp" optimization that evaluates just .??X files, and now .??T (memo) filestamps are evaluated too | -|||| Fixed missing BorderColor property on props\_optiongroup.txt file | -|||| Fixed missing Stretch property on props\_image.txt file (Kenny Vermassen) | -|||| Fixed missing Enabled property on props\_image.txt file | -| 2014/05/17 | FDBOZZO | [v1.19.22](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.22) | **Bug Fix vcx/scx**: Picture property of a form class does not show the image. Does not happen with control pictures (Fidel Charny) | -|||| **Bug Fix scx/vcx**: Incorrect detection of PROCEDURE/ENDPROC/TEXT/ENDTEXT that can cause lost of some methods in some circunstantes (Andres Mendoza) | -|||| **Bug Fix scx/vcx**: Some options from the optiongroup control loose there width when subclassed from a class with autosize=.T. (Miguel Duran) | -|||| Added evaluation and generation of properties by classtype, when applicable | -|||| Added support of property evaluation from external file (props\_\*.txt) | -|||| Added enhanced Unit Tests of bitmap comparisons of screen captures before/after (the original is compared with the regenerated of the regenerated binary, for more accuracy) | -|||| A lot of garbage collect optimizations all over the code | -|||| Added Unit Testing of configuration by defaults, by file and by parameters | -|||| Added Unit Testing for checking the generation of classes, forms, reports and menus | -|||| Added new switch OptimizeByFilestamp (active by default) for making possible deactivation of this regeneration optimization by file timestamp, in case someone wants to force regeneration allways | -| 2014/05/01 | FDBOZZO | [v1.19.21](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.21) | Added support to convert to text or binary all files of a project from pjx or pj2 (Matt Slay) | -|||| Added optimization on the search of the capitalization program when processing projects | -|||| Added keyword AGAIN on table openings, for enhancing concurrence (Jim Nelson) | -|||| Added optimization based on file timestamps for regenerating only newer binaries and tx2 files (Matt Slay) | -|||| Added English translation in foxbin2prg\_en.h for the LOG message of new timestamp optimization | -|||| section simplification: Methods and arrays doesn't require preceding \* and ^ symbols anymore. | -| 2014/04/17 | FDBOZZO | [v1.19.20](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.20) | **New**: CDX filename in DB2 files have relative paths now. This help show less differences when regenerating DB2 files from different paths | -| 2014/04/02 | FDBOZZO | [v1.19.19](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.19) | **New**: DBF Hook run\_AfterCreateTable that let intercalate a personalized process between DBF creation and index creation when processing a DB2 file (example program in tests\demo\_hook\_dbf.prg included) (Fidel Charny) | -| 2014/03/25 | FDBOZZO | [v1.19.18](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.18) | **Bug Fix vcx/scx**: Image controls with stretched icons or images, get redimensioned to original size when regenerating binary (Arturo Ramos) | -|||| Bug Fix vcx/scx: Library level comments are not kept (Ryan Harris) | -| 2014/03/16 | FDBOZZO | [v1.19.17](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.17) | **Bug Fix frx/lbx**: Double-quoted expressiones make fx2/lb2 files corrupt (Ryan Harris) | -|||| **Bug Fix frx/lbx**: Multiline Comments are lost (Ryan Harris) | -|||| **frx/lbx tag2 field enhance**: when used for tooltips, real values are shown in regards of b64 normal encoding | -|||| **Bug Fix mnx**: Multiline Comments on Bars/Pads makes MN2 file corrupt (Ryan Harris) | -|||| **Bug Fix mnx**: Some procedures doesn't generate correctly (Ryan Harris) | -|||| English translation file foxbin2prg\_en.h syntax corrected (Ryan Harris) | -|||| **Bug Fix vcx/scx**: Lowercase saved Dataenvironment property causes Reserved2 value to be not calculated | -|||| **Bug Fix frx**: character on print condition on field makes fr2 file corrupt | -|||| **Bug Fix mnx**: Using double-quotes on prompt option fields makes mn2 file invalid (Ryan Harris) | -| 2014/03/10 | FDBOZZO | [v1.19.16](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.16) | **Bug Fix vcx/scx**: properties loose there hidden/protected visibility when no default value assigned (Ryan Harris) | -|||| **Bug Fix vcx/scx**: character value with length >255 in addobject property regenerates with tag included (Ryan Harris) | -|||| **Bug Fix vcx/scx**: When regenerating binari file with empty procedure makes FoxPro crash when trying to modify it on IDE | -|||| **Bug Fix scx/vcx**: Binary can be corrupted if the class have a multiline comment (Tested on: Ffc\\_frxcursor.vcx) | -|||| **Bug Fix**: If \_memberdata contains CR inside there values, they can be lost when regenerating tx2 text files | -|||| **Bug Fix**: Property values with spaces at the right loose this spaces | -|||| **Bug Fix**: When 2 or more methods share the same name (ej: met and met2) tx2 text file gets corrupted (Ryan Harris) | -| 2014/03/04 | FDBOZZO | [v1.19.15](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.15) | **Bug Fix**: OLE information cleared when a legacy TX2 is processed | -|||| Bug Fix: Default value of NoTimestamp = 0 ==> Now is 1, as should be | -|||| Bug Fix: DBFs backlink info cleared when DBC is recreated (Ryan Harris) | -|||| Feature: Lowercase capitalization in tx2 filename headers to minimize differences | -| 2014/03/01 | FDBOZZO | [v1.19.14](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.14) | Load of configuration is optimized (foxbin2prg.cfg) to read cfg only once for a massive processing of multiple conversions | -|||| .vbs scripts have been modified to respect the conversion support configuration defined in foxbin2prg.cfg configuration file | -|||| 2 new functions where added to enhance and encapsulate the external use of the evaluation of the conversion support (requires previous call to EvaluarConfiguracion()). Used on .vbs scripts | -|||| ExtraBackupLevels Regression: when no defined value, no backup is made | -|||| New default value ClearUniqueID = 1 in foxbin2prg.cfg for minimizing differences in the SCM | -| 2014/02/26 | FDBOZZO | [v1.19.13](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.13) | **Bug Fix**: If NoTimestamp setting of foxbin2prg.cfg is changed, opposite value is evaluated (Ryan Harris) | -|||| Encapsulated foxbin2prg.cfg file for enhancing FoxUnit automated testing | -|||| Internal change of property l\_UseTimestamps by l\_NoTimestamps | -|||| With ExtraBackupLevels setting you can now deactivate backups if setting to 0 (Ryan Harris proposal) | -|||| foxbin2prg.log file checking dropped, to activate the log file use foxbin2prg.cfg setting Debug=1 | -|||| In TX2 header files show the file without path, because genereting it from different places makes unnecesary differences in Diff (Ryan Harris proposal) | -|||| Created a lot of FoxUnit automated tests to check all settings of foxbin2prg.cfg configuration file | -| 2014/02/23 | FDBOZZO | [v1.19.12](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.12) | Generation of VC2/SC2 with new header metadata for centralizing uniqueid, timestamp and ZOrder and big reduce of differences in a diff/merge (enhancement proposed by Ryan Harris) | -|||| BINARY regeneration from the new metadata header (remains compatible with old VC2/SC2) | -|||| FoxUnit test cases fixed for the new functionality | -|||| Cleaning, Refactorization and optimization of Code | -|||| Presentation enhancement of VC2/SC2 file headers | -| 2014/02/13 | FDBOZZO | [v1.19.11](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.11) | WITH/ENDWITH optimizations with a conversion performance gain up to 16% more fast | -|||| Bug Fix: Just one level of #IF was contemplated, throwing an error if more levels are nested | -|||| Bug Fix: When regenerating the PJX, default home directory not always was correct | -|||| New FoxUnit automated test added to check bug fix of nested #IF | -| 2014/02/09 | FDBOZZO | [v1.19.10](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.10) | Added parametrization to enable configuration support for each kind of binary (0=None, 1=Only TX2, 2=TX2 and Binary) | -|||| Fixed default NoTimestamps setting | -|||| Adjusted some FoxUnit test cases | -|||| EXPERIMENTAL: Added new configuration parameter "ClearUniqueID" in foxbin2prg.cfg for Clearing UniqueID in binaries and text versions. Works well and apparently FoxProdoesn't make use of it, but more testing is required | -| 2014/02/08 | FDBOZZO | [v1.19.9](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.9) | New configuration items in foxbin2prg.cfg | -|||| Localization Bug: When recompiling with localization file foxbin2prg\_en.h renamed to foxbin2prg.h, syntax error occurs | -|||| Debug information of .LOG files enhanced | -|||| New parametrization for the number of backups, now just one .BAK by default (earlier was 10) | -|||| Enabled configuration file foxbin2prg.cfg by default | -|||| Change in default behavior: Now Timestamps are disabled by default. You can change this on foxbin2prg.cfg | -| 2014/02/03 | FDBOZZO | [v1.19.8](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.8-pĂşblica) | **Bug fix**: ActivePage error when executing a regenerated binary with a PageFrame / New FoxUnit test to test solution | -|||| Added cNoTimestamps='1' to batch conversion vbs scripts | -| 2014/02/02 | FDBOZZO | [v1.19.7](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.7-pĂşblica) | Added Ole encapsulation in just 1 place | -|||| Adjusted Blocksize of generated binaries | -|||| New cNoTimestamps parameter. If '1' is given, then no timestamps are generated (useful for diff/merge) | -| 2014/01/31 | FDBOZZO | [v1.19.6](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.6-pĂşblica) | Added SourceSafe support (SCCAPI) for Diff and Merge | -|||| SCX bug fix: Dataenvironment sometimes doesn't regenerates correctly | -|||| Functionality change: Automatic recompilation enabled by default again because some methods doesn't show on form edit. Can be deactivated passing '0' to cRecompile param | -| 2014/01/26 | FDBOZZO | [v1.19.5](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.5-pĂşblica) | Added Multilanguage support and Localization file for English. To use it rename the new file foxbin2prg\_en.h to foxbin2prg.h and recompile | -| 2014/01/24 | FDBOZZO | [v1.19.4](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.4-pĂşblica) | New "Recompile" parameter for recompiling from PJX directory (if provided) | -|||| **Functionality change**: Now FoxBin2Prg does not recompile bins for default, because it do on bin dir and that can throw compilation errors. Use new parameter if needed or recompile by your own | -|||| DBC: Added support for multiline "comment" property | -|||| VBS Batch scripts: Added progress bar | -| 2014/01/18 | FDBOZZO | [v1.19.3](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.3-pĂşblica) | Change on TXT timestamps to preserve empty values that can save a lot of differences when diff/merging. Previously empty timestamps get converted to datetime | -|||| Optimization on TXT generation of ZOrders | -| 2014/01/13 | FDBOZZO | [v1.19.2](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.2-pĂşblica) | Fix on PJX regeneration caused for something missing in the last change of "Autor" to "Author" | -| 2014/01/08 | FDBOZZO | [v1.19.1](https://github.com/fdbozzo/foxbin2prg/tree/v1.19.1-pĂşblica) | Small change on TX2 headers to drop the "Generated" timestamp that causes innecesary differences / Updated the EXE version with the correct one | -| 2014/01/08 | FDBOZZO | [v1.19](https://github.com/fdbozzo/foxbin2prg/tree/v1.19-pĂşblica) | Added new debug flag on .vbs scripts to show a "End process" message for batch processing | -|||| **Bug Fix**: scx/vcx Improper order of Reserved3 props cause event access to not fire | -|||| **Bug Fix**: dbf Improper index generated when the type is Candidate | -|||| Added support for converting SourceSafe PJM to FoxBin PJ2 | -|||| Added validation for Menus when converting from older versions, so user can convert it to VFP 9 format first | -|||| Change in MN2 property: "Autor" was changed to "Author". You can add the missing letter to MN2 or regenerate | -| 2014/01/07 | FDBOZZO | [v1.18.1](https://github.com/fdbozzo/foxbin2prg/tree/v1.18.1) | Added a vbs script (NormalizeFileNames.vbs) for FileNames normalizing in batch mode, and updated FileNameCaps.exe and the call on FoxBin2Prg | -| 2014/01/06 | FDBOZZO | [v1.18](https://github.com/fdbozzo/foxbin2prg/tree/v1.18-pĂşblica) | **bug fix**: mnx Generation of DO Procedure or Command when no Procedure or Command available to call when empty option is created (Fidel Charny) | -|||| Added support for DBFs earlier than VFP 9 for generating DB2 text, but DBF regeneration is in VFP 9 version! | -|||| dbf bug fix: DBFs linked to a DBC that use long field names throw error when regenerating DBFs | -|||| dbf bug fix: Some view info is lost when generating text from DBC | -| 2014/01/03 | FDBOZZO | [v1.17](https://github.com/fdbozzo/foxbin2prg/tree/v1.17-pĂşblica) | **bug fix**: mnx Location value is lost and some menus doesn't render properly (Fidel Charny) | -|||| Added 2 VB scripts (ConvertVFP9BIN2PRG.vbs and ConvertVFP9PRG2BIN.vbs) for batch converting of dirs and files if a shortcut is placed on "SendTo" user folder | -|||| Added new Unit Testing cases for menus | -| 2014/01/02 | FDBOZZO | [v1.16](https://github.com/fdbozzo/foxbin2prg/tree/v1.16-pĂşblica) | Added support for Menus (MNX) | -| 2013/12/18 | FDBOZZO | [v1.15](https://github.com/fdbozzo/foxbin2prg/tree/v1.15-pĂşblica) | Added support for DBF, DBC and CDX binaries | -| 2013/12/15 | FDBOZZO | [v1.14](https://github.com/fdbozzo/foxbin2prg/tree/v1.14-pĂşblica) | **bug fix**: scx autocenter property do nothing (Arturo Ramos) | -|||| scx bug fix: Last COMMENT record is lost (Fidel Charny) | -| 2013/12/08 | FDBOZZO | [v1.13](https://github.com/fdbozzo/foxbin2prg/tree/v1.13---pĂşblica) | **bug fix**: frx/lbx "Error 1924, TOREG is not an object" on some reports (Fidel Charny) | -| 2013/12/08 | FDBOZZO | [v1.12](https://github.com/fdbozzo/foxbin2prg/tree/v1.12---pĂşblica) | Added support for Reports (FRX) and Labels (LBX) | -| 2013/12/08 | FDBOZZO | [v1.11](https://github.com/fdbozzo/foxbin2prg/tree/v1.11---pĂşblica) | **bug fix**: vcx/scx \_memberdata value corrupted when the value is a long one (Edgar Kummers) | -| 2013/12/07 | FDBOZZO | [v1.10](https://github.com/fdbozzo/foxbin2prg/tree/v1.10---pĂşblica) | **bug fix**: vcx/scx when there are methods with the same name, there code is assigned to erroneous objects (Fidel Charny) | -| 2013/12/07 | FDBOZZO | [v1.9](https://github.com/fdbozzo/foxbin2prg/tree/v1.9---pĂşblica) | **bug fix**: vcx/scx last fix keep loosing some properties (Fidel Charny) | -| 2013/12/06 | FDBOZZO | [v1.8](https://github.com/fdbozzo/foxbin2prg/tree/v1.8---pĂşblica) | **bug fix**: vcx/scx last fix keep loosing some properties (Fidel Charny) | -|||| sort function encapsulated and reused on BIN and TXT generation for safety | -| 2013/12/03 | FDBOZZO | [v1.7](https://github.com/fdbozzo/foxbin2prg/tree/v1.7---pĂşblica) | **bug fix**: vcx/scx some properties get lost and picture clause is not displayed if "Name" is not the last property on memo (Fidel Charny) | -|||| Added verification of readOnly files and report this to Log file in debug mode | -| 2013/12/02 | FDBOZZO | [v1.6](https://github.com/fdbozzo/foxbin2prg/tree/v1.6---pĂşblica) | Complete refactoring of BIN and TXT generation | -|||| Changes of various algorithms | -|||| scx/vcx bug fix: Array properties didn't save (Fidel Charny) | -|||| Unit testing cases with FoxUnit | -| 2013/11/27 | FDBOZZO | [v1.5](https://github.com/fdbozzo/foxbin2prg/tree/v1.5---pĂşblica) | **Bug fix**: On some forms dataenvironment didn't regenerate appropiately (Luis MartĂ­nez) | -| 2013/11/27 | FDBOZZO | [v1.4](https://github.com/fdbozzo/foxbin2prg/tree/v1.4---pĂşblica) | Added mask support | -|||| Added support for extension configuration on file foxbin2prg.cfg, so one can use "vca" instead of "vc2", etc | -|||| Added support for a new parameter for Log generation | -| 2013/11/24 | FDBOZZO | [v1.3](https://github.com/fdbozzo/foxbin2prg/tree/v1.3---pĂşblica) | Bug fixes, code cleaning, refactoring | -| 2013/11/24 | FDBOZZO | [v1.2](https://github.com/fdbozzo/foxbin2prg/tree/v1.2---pĂşblica) | Bug fixes, code cleaning, refactoring | -| 2013/11/22 | FDBOZZO | [v1.1](https://github.com/fdbozzo/foxbin2prg/tree/v1.1---pĂşblica) | Bug fixes | -| 2013/11/22 | FDBOZZO | [v1.0](https://github.com/fdbozzo/foxbin2prg/tree/v1.0---pĂşblica) | Initial creation of clases on prg and support of VCX/SCX/PJX files | - ----- -![VFPX logo](https://vfpx.github.io/images/vfpxbanner_small.gif) -This project is part of [VFPX](https://vfpx.github.io/). - ----- -Last changed: _2023/08/04_ ![Picture](./pictures/vfpxpoweredby_alternative.gif) \ No newline at end of file diff --git a/foxbin2prg.exe b/foxbin2prg.exe index 25e2b07..cda421f 100644 Binary files a/foxbin2prg.exe and b/foxbin2prg.exe differ diff --git a/foxbin2prg.pjt b/foxbin2prg.pjt index 308552e..0d0d4fe 100644 Binary files a/foxbin2prg.pjt and b/foxbin2prg.pjt differ diff --git a/foxbin2prg.pjx b/foxbin2prg.pjx index 63d3a14..dd5b09d 100644 Binary files a/foxbin2prg.pjx and b/foxbin2prg.pjx differ diff --git a/foxbin2prg.prg b/foxbin2prg.prg index 1400798..c2b1a89 100644 --- a/foxbin2prg.prg +++ b/foxbin2prg.prg @@ -305,7 +305,6 @@ * 16/03/2023 LScheffler v1.19.77 Bug Fix: Txt2Bin Operation on VCX looses double ampersand in Property Values #91 (LScheffler) * 20/03/2023 LScheffler v1.19.78 Enhancement: Text2Bin on PJX errors out for projects with an attach icon that has a drive letter on its path. #93 (ericbarte) * 04/08/2023 LScheffler v1.19.79 Bug Fix: Bin2Text: Forms with ole controls conversion error (also: any vcx) -* 06/08/2023 LScheffler v1.19.79 Enhancement: Added option to return version number * * *--------------------------------------------------------------------------------------------------- @@ -534,12 +533,6 @@ * -t Create config template "tcType" for config-per-table file * tcType (v! IN ) file to create *--------------------------------------------------------------------------------------------------- -*** LScheffler 2023-08-06: added option to output version number -* Usage 2 -* PARAMETERS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) -* tc_InputFile (c! IN ) Modus (case sensitive) -* -VERNO Return versio number (DC_FB2PRG_VERSION_REAL) -*--------------------------------------------------------------------------------------------------- Lparameters tc_InputFile, tcType, tcTextName, tlGenText, tcDontShowErrors, tcDebug, tcDontShowProgress, tcOriginalFileName ; , tcRecompile, tcNoTimestamps, tcCFG_File, tcOutputFolder @@ -779,17 +772,6 @@ Local lnResp, loEx As Exception tc_InputFile = Evl(tc_InputFile,'') tcType = Evl(tcType,'') -*!* Changed by: LScheffler 06.08.2023 -*!* change date="{^2023-08-06,14:29:00}" -* added option to return version number -If Atc('-VERNO','-'+tc_InputFile) > 0 - tc_InputFile = DC_FB2PRG_VERSION_REAL - RETURN DC_FB2PRG_VERSION_REAL -Endif &&Atc('-VERNO','-'+tc_InputFile) > 0 - -*!* /Changed by: LScheffler 06.08.2023 - - *!* Changed by: LScheffler 15.2.2021 *!* change date="{^2021-02-15,18:44:00}" * added option to create config files @@ -16998,12 +16980,11 @@ Define Class c_conversor_vcx_a_prg As c_conversor_bin_a_prg loLang = _Screen.o_FoxBin2Prg_Lang With This As c_conversor_vcx_a_prg Of 'FOXBIN2PRG.PRG' - - Use (.c_InputFile) Shared Again Noupdate Alias _TABLAORIG *SF 20230804 *issue #95, [Kestutis Laurinavicius] prevent change ole codepage *set NOCPTRANS for the vcx SET NOCPTRANS TO ole + Use (.c_InputFile) Shared Again Noupdate Alias _TABLAORIG If toFoxBin2Prg.n_UseClassPerFile = 0 Or Empty(toFoxBin2Prg.c_ClassToConvert) Then *-- Exportar la librería entera a texto @@ -30920,6 +30901,7 @@ Define Class CL_LANG As Custom <<>>cNoTimestamps: Indicates if timestamp of several file types must be cleared ('1' or empty) or not ('0') <<>>cCFG_File: Indicates a CFG filename for not using the default on foxbin2prg directory <<>>cOutputFolder: The output folder to write to. If it isn't specified, the same folder as the source is used. + <<>> <<>>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <<>> <<>>FOXBIN2PRG.EXE [c|C|t [OutFileName]] @@ -30932,13 +30914,6 @@ Define Class CL_LANG As Custom <<>> If OutFileName is not given a FoxBin2Prg._cfg config file will be created at default folder <<>>-t (t) Creates a template table-config-file (like .dbf.cfg) <<>> If OutFileName is not given, and a table is open a .dbf._cfg config file will be created at table folder. - <<>>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <<>> - <<>>FOXBIN2PRG.EXE [VERNO] - <<>>DO FOXBIN2PRG.EXE WITH [VERNO] - <<>> - <<>>-- Parameter details: - <<>>-VERNO (VERNO) Return version number of FoxBin2Prg <<>> <<>> ENDTEXT @@ -30955,7 +30930,7 @@ Define Class CL_LANG As Custom <<>> 2., optional FOXBIN2PRG.CFG in folder of FOXBIN2PRG.EXE <<>> 3., optional FOXBIN2PRG.CFG in root of working directory <<>> 4., optional FOXBIN2PRG.CFG in every folder up to the working directory - <<>> 5., optional Special settings per single DBF's Syntax: .dbf.cfg in tables folder) + <<>> 5., optional Special settings per single DBF's Syntax: .dbf.cfg in tables folder) <<>> 6., Parameter calling FOXBIN2PRG.EXE. <<>> <<>> Some Parameter calling FOXBIN2PRG.EXE overturn this settings (except Defaults) @@ -31215,6 +31190,7 @@ Define Class CL_LANG As Custom <<>>cNoTimestamps: Indica si se debe anular el timestamp ('1' o vacío) o no ('0') <<>>cCFG_File: Indica un nombre de archivo CFG para no usar el predeterminado en el directorio de foxbin2prg <<>>cOutputFolder: The output folder to write to. If it isn't specified, the same folder as the source is used. + <<>> <<>>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <<>> <<>>FOXBIN2PRG.EXE [c|C|t [OutFileName]] @@ -31227,14 +31203,6 @@ Define Class CL_LANG As Custom <<>> If OutFileName is not given a FoxBin2Prg._cfg config file will be created at default folder <<>>-t (t) Creates a template table-config-file (like .dbf.cfg) <<>> If OutFileName is not given, and a table is open a .dbf._cfg config file will be created at table folder. - <<>>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <<>> - <<>>FOXBIN2PRG.EXE [VERNO] - <<>>DO FOXBIN2PRG.EXE WITH [VERNO] - <<>> - <<>>-- Parameter details: - <<>>-VERNO (VERNO) Return version number of FoxBin2Prg - <<>> <<>> ENDTEXT *** DH 2021-03-04: added HomeDir to text @@ -31250,7 +31218,7 @@ Define Class CL_LANG As Custom <<>> 2., optional FOXBIN2PRG.CFG in folder of FOXBIN2PRG.EXE <<>> 3., optional FOXBIN2PRG.CFG in root of working directory <<>> 4., optional FOXBIN2PRG.CFG in every folder up to the working directory - <<>> 5., optional Special settings per single DBF's Syntax: .dbf.cfg in tables folder) + <<>> 5., optional Special settings per single DBF's Syntax: .dbf.cfg in tables folder) <<>> 6., Parameter calling FOXBIN2PRG.EXE. <<>> <<>> Some Parameter calling FOXBIN2PRG.EXE overturn this settings (except Defaults) @@ -31523,14 +31491,6 @@ Define Class CL_LANG As Custom <<>>-t (t) Erzeugt eine Vorlage für eine Tabellen-Config-Datei (wie .dbf.cfg) <<>> Wird OutFileName nicht angegeben und ist eine Tabelle offen, <<>> so wird eine Konfigurationsdatei .dbf._cfg im Verzeichnis der Tabelle angelegt. - <<>>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <<>> - <<>>FOXBIN2PRG.EXE [VERNO] - <<>>DO FOXBIN2PRG.EXE WITH [VERNO] - <<>> - <<>>-- Parameter: - <<>>-VERNO (VERNO) Debe dies Versionnummer zurück. - <<>> <<>> ENDTEXT *** DH 2021-03-04: added HomeDir to text @@ -31546,7 +31506,7 @@ Define Class CL_LANG As Custom <<>> 2., optional FOXBIN2PRG.CFG im Vereichnis aus dem FOXBIN2PRG.EXE startet <<>> 3., optional FOXBIN2PRG.CFG in der Wurzel des Arbeitsverzeichnises <<>> 4., optional FOXBIN2PRG.CFG in jedem Verzeichnis bis zum Arbeitsverzeichnis - <<>> 5., optional Es können spezielle Einstellungen für einzelne DBF's erzeugt werden (Syntax: .dbf.cfg im Verzeichnis der Tabelle) + <<>> 5., optional Es können spezielle Einstellungen für einzelne DBF's erzeugt werden (Syntax: .dbf.cfg im Verzeichnis der Tabelle) <<>> 6., Parameter des Aufrufs von FOXBIN2PRG.EXE. <<>> <<>> Einige Parameter im Aufruf von FOXBIN2PRG.EXE übersteueren diese Vorgaben (bis auf die Defaults) @@ -31677,7 +31637,7 @@ Define Class CL_LANG As Custom ENDTEXT TEXT TO .C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_tab_cfg TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 <<>>################################################################################################################ - <<>>-- Individuelle DBF Konfigurations-Datei (Syntax: .dbf.cfg im Verzeichnis der Tabelle) Defaults siehe FoxBin2prg.cfg + <<>>-- Individual DBF configuration file (Syntax: .dbf.cfg im Verzeichnis der Tabelle) Defaults siehe FoxBin2prg.cfg <<>>Version: <<_Screen.c_FB2PRG_EXE_Version>> <<>>**************************************************************************************************************** <<>> @@ -31831,6 +31791,7 @@ Define Class CL_LANG As Custom <<>>cNoTimestamps: Indicates if timestamp of several file types must be cleared ('1' or empty) or not ('0') <<>>cCFG_File: Indicates a CFG filename for not using the default on foxbin2prg directory <<>>cOutputFolder: The output folder to write to. If it isn't specified, the same folder as the source is used. + <<>> <<>>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <<>> <<>>FOXBIN2PRG.EXE [c|C|t [OutFileName]] @@ -31843,13 +31804,6 @@ Define Class CL_LANG As Custom <<>> If OutFileName is not given a FoxBin2Prg._cfg config file will be created at default folder <<>>-t (t) Creates a template table-config-file (like .dbf.cfg) <<>> If OutFileName is not given, and a table is open a .dbf._cfg config file will be created at table folder. - <<>>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <<>> - <<>>FOXBIN2PRG.EXE [VERNO] - <<>>DO FOXBIN2PRG.EXE WITH [VERNO] - <<>> - <<>>-- Parameter details: - <<>>-VERNO (VERNO) Return version number of FoxBin2Prg <<>> <<>> ENDTEXT @@ -31866,7 +31820,7 @@ Define Class CL_LANG As Custom <<>> 2., optional FOXBIN2PRG.CFG in folder of FOXBIN2PRG.EXE <<>> 3., optional FOXBIN2PRG.CFG in root of working directory <<>> 4., optional FOXBIN2PRG.CFG in every folder up to the working directory - <<>> 5., optional Special settings per single DBF's Syntax: .dbf.cfg in tables folder) + <<>> 5., optional Special settings per single DBF's Syntax: .dbf.cfg in tables folder) <<>> 6., Parameter calling FOXBIN2PRG.EXE. <<>> <<>> Some Parameter calling FOXBIN2PRG.EXE overturn this settings (except Defaults) diff --git a/foxbin2prg.prg.x b/foxbin2prg.prg.x new file mode 100644 index 0000000..6a9f2ab --- /dev/null +++ b/foxbin2prg.prg.x @@ -0,0 +1,33449 @@ +#DEFINE DN_FB2PRG_VERSION 1.19 +#DEFINE DC_FB2PRG_VERSION_REAL '1.19.79' + +*--------------------------------------------------------------------------------------------------- +* Module.........: FOXBIN2PRG.PRG - FOR VISUAL FOXPRO 9.0 +* Author.........: Fernando D. Bozzo (mailto:fdbozzo@gmail.com) - http://fdbozzo.blogspot.com +* Project info...: https://vfpx.codeplex.com/wikipage?title=FoxBin2Prg +* Creation Date..: 2013/11/04 +* +* LICENCE: +* This work is licensed under the Creative Commons Attribution 4.0 International License. +* To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. +* +* LICENCIA: +* Esta obra está sujeta a la licencia Reconocimiento-CompartirIgual 4.0 Internacional de Creative Commons. +* Para ver una copia de esta licencia, visite http://creativecommons.org/licenses/by-sa/4.0/deed.es_ES. +* +*--------------------------------------------------------------------------------------------------- +* DESCRIPCIÓN....: CONVIERTE EL ARCHIVO VCX/SCX/PJX INDICADO A UN "PRG HÍBRIDO" PARA POSTERIOR RECONVERSIÓN. +* * EL PRG HÍBRIDO ES UN PRG CON ALGUNAS SECCIONES BINARIAS (OLE DATA, ETC) +* * EL OBJETIVO ES PODER USARLO COMO REEMPLAZO DEL SCCTEXT.PRG, PODER HACER MERGE +* DEL CÓDIGO DIRECTAMENTE SOBRE ESTE NUEVO PRG Y GUARDARLO EN UNA HERRAMIENTA DE SCM +* COMO CVS O SIMILAR SIN NECESIDAD DE GUARDAR LOS BINARIOS ORIGINALES. +* * EXTENSIONES GENERADAS: VC2, SC2, PJ2 (...o VCA, SCA, PJA con archivo conf.) +* * CONFIGURACIÓN: SI SE CREA UN ARCHIVO FOXBIN2PRG.CFG, SE PUEDEN CAMBIAR LAS EXTENSIONES +* PARA PODER USARLO CON SOURCESAFE PONIENDO LAS EQUIVALENCIAS ASÍ: +* +* extension: VC2=VCA +* extension: SC2=SCA +* extension: PJ2=PJA +* +* USO/USE: +* DO FOXBIN2PRG.PRG WITH "\FILE.VCX" && Genera "\FILE.VC2" (BIN TO PRG CONVERSION) +* DO FOXBIN2PRG.PRG WITH "\FILE.VC2" && Genera "\FILE.VCX" (PRG TO BIN CONVERSION) +* +* DO FOXBIN2PRG.PRG WITH "\FILE.SCX" && Genera "\FILE.SC2" (BIN TO PRG CONVERSION) +* DO FOXBIN2PRG.PRG WITH "\FILE.SC2" && Genera "\FILE.SCX" (PRG TO BIN CONVERSION) +* +* DO FOXBIN2PRG.PRG WITH "\FILE.PJX" && Genera "\FILE.PJ2" (BIN TO PRG CONVERSION) +* DO FOXBIN2PRG.PRG WITH "\FILE.PJ2" && Genera "\FILE.PJX" (PRG TO BIN CONVERSION) +* +* DO FOXBIN2PRG.PRG WITH "-c", cOutputFile && Generate a configuration (FoxBin2Prg.cfg) template +* +*--------------------------------------------------------------------------------------------------- +* +* 04/11/2013 FDBOZZO v1.0 Creación inicial de las clases y soporte de los archivos VCX/SCX/PJX +* 22/11/2013 FDBOZZO v1.1 Corrección de bugs +* 23/11/2013 FDBOZZO v1.2 Corrección de bugs, limpieza de código y refactorización +* 24/11/2013 FDBOZZO v1.3 Corrección de bugs, limpieza de código y refactorización +* 27/11/2013 FDBOZZO v1.4 Agregado soporte comodines *.VCX, configuración de extensiones (vca), parámetro p/log +* 27/11/2013 FDBOZZO v1.5 Arreglo bug que no generaba form completo +* 01/12/2013 FDBOZZO v1.6 Refactorización completa generación BIN y PRG, cambio de algoritmos, arreglo de bugs, Unit Testing con FoxUnit +* 02/12/2013 FDBOZZO v1.7 Arreglo bug "Name", barra de progreso, agregado mensaje de ayuda si se llama sin parámetros, verificación y logueo de archivos READONLY con debug activa +* 03/12/2013 FDBOZZO v1.8 Arreglo bug "Name" (otra vez), sort encapsulado y reutilizado para versiones TEXTO y BIN por seguridad +* 06/12/2013 FDBOZZO v1.9 Arreglo bug pérdida de propiedades causado por una mejora anterior +* 06/12/2013 FDBOZZO v1.10 Arreglo del bug de mezcla de métodos de una clase con la siguiente +* 07/12/2013 FDBOZZO v1.11 Arreglo del bug de _amembers detectado por Edgar K.con la clase BlowFish.vcx (http://www.tortugaproductiva.galeon.com/docs/blowfish/index.html) +* 07/12/2013 FDBOZZO v1.12 Agregado soporte preliminar de conversión de reportes y etiquetas (FRX/LBX) +* 08/12/2013 FDBOZZO v1.13 Arreglo bug "Error 1924, TOREG is not an object" +* 15/12/2013 FDBOZZO v1.14 Arreglo de bug AutoCenter y registro COMMENT en regeneración de forms +* 08/12/2013 FDBOZZO v1.15 Agregado soporte preliminar de conversión de tablas, índices y bases de datos (DBF,CDX,DBC) +* 18/12/2013 FDBOZZO v1.16 Agregado soporte para menús (MNX) +* 03/01/2014 FDBOZZO v1.17 Agregado Unit Testing de menús y arreglo de las incidencias del menu +* 05/01/2013 FDBOZZO v1.18 Agregado soporte para generar estructuras TEXTO de DBFs anteriores a VFP 9, pero los binarios a VFP 9 // Arreglado bug de datos faltantes en campos de vistas // Arreglado bug mnx +* 08/01/2014 FDBOZZO v1.19 Arreglo bug SCX-VCX: Orden incorrecto en Reserved3 ocaciona que no se disparen eventos ACCESS (y probablemente ASIGN) +* 08/01/2014 FDBOZZO v1.19 Arreglo bug DBF: Tipo de índice generado incorrecto en DB2 cuando es Candidate +* 08/01/2014 FDBOZZO v1.19 Agregado soporte para convertir PJM a PJ2 +* 08/01/2014 FDBOZZO v1.19 Agregada validación al convertir Menús con estructura anterior a VFP9 +* 08/01/2014 FDBOZZO v1.19 Cambiada la propiedad "Autor" por "Author" en los archivos MN2 +* 08/01/2014 FDBOZZO v1.19.1 Cambio en los headers de los archivos TX2 para quitar el timestamp "Generated" que causa diferencias innecesarias +* 08/01/2014 FDBOZZO v1.19.2 Arreglo de bug PJ2: Al regenerar da un error por buscar "Autor" en vez de "Author" +* 08/01/2014 FDBOZZO v1.19.3 Cambio en los timestamps de los TXT para mantener los valores vacíos que generaban muchísimas diferencias +* 22/01/2014 FDBOZZO v1.19.4 Nuevo parámetro Recompile para forzar la recompilación. Ahora por defecto el binario no se recompila para ganar velocidad y evitar errores. Debe recompilar manualmente. +* 22/01/2014 FDBOZZO v1.19.4 DBC: Agregado soporte para comentarios multilínea (propiedad Comment) +* 26/01/2014 FDBOZZO v1.19.5 Agregado soporte multiidioma y traducción al Inglés +* 01/02/2014 FDBOZZO v1.19.6 Agregada compatibilidad con SourceSafe para Diff y Merge +* 02/02/2014 FDBOZZO v1.19.7 Encapsulación de objetos OLE en el propio control o clase // Blocksize ajustado +* 03/02/2014 FDBOZZO v1.19.8 Arreglo bug pageframe (error activePage) +* 08/02/2014 FDBOZZO v1.19.9 Nuevos items de config.en foxbin2prg.cfg / Bug en Localización / Mejora log / Parametrización Nş backups / Timestamps desactivados por defecto +* 09/02/2014 FDBOZZO v1.19.10 Parametrización soporte de tipo de conversión por archivo / ClearUniqueID +* 13/02/2014 FDBOZZO v1.19.11 Optimizaciones WITH/ENDWITH (16%+velocidad) / Arreglo bug #IF anidados +* 21/02/2014 FDBOZZO v1.19.12 Centralizar ZOrder controles en metadata de cabecera de clase para minimizar diferencias / También mover UniqueIDs y Timestamps a metadata +* 26/02/2014 FDBOZZO v1.19.13 Arreglo bug TimeStamp en archivo cfg / ExtraBackupLevels se puede desactivar / Optimizaciones / Casos FoxUnit +* 01/03/2014 FDBOZZO v1.19.14 Arreglo bug regresion cuando no se define ExtraBackupLevels no hace backups / Optimización carga cfg en batch +* 04/03/2014 FDBOZZO v1.19.15 Arreglo bugs: OLE TX2 legacy / NoTimestamp=0 / DBFs backlink +* 07/03/2014 FDBOZZO v1.19.16 Arreglo bugs: Propiedades y métodos Hidden/Protected que no se generan /// Crash métodos vacíos +* 16/03/2014 FDBOZZO v1.19.17 Arreglo bugs frx/lbx: Expresiones con comillas // comment multilínea // Mejora tag2 para Tooltips // Arreglo bugs mnx +* 22/03/2014 FDBOZZO v1.19.18 Arreglo bug vcx/scx: Las imágenes no mantienen sus dimensiones programadas y asumen sus dimensiones reales // El comentario a nivel de librería se pierde +* 29/03/2014 FDBOZZO v1.19.19 Nueva característica: Hooks al regenerar DBF para poder realizar procesos intermedios, como la carga de datos del DBF regenerado desde una fuente externa +* 17/04/2014 FDBOZZO v1.19.20 Relativización de directorios de CDX dentro de los DB2 para minimizar diferencias +* 29/04/2014 FDBOZZO v1.19.21 Agregada posibilidad de convertir un proyecto entero a tx2 // Optimizaciones en generación según timestamps // AGAIN en aperturas // Simplificación sección PAM +* 08/05/2014 FDBOZZO v1.19.22 Arreglo bug vcx/scx: La propiedad Picture de una clase form se pierde y no muestra la imagen +* 27/05/2014 FDBOZZO v1.19.23 Arreglo bug vcx/scx: Redimensionamiento incorrecto de imagenes en ciertas situaciones (props_image.txt y props_optiongroup.txt actualizados) +* 09/06/2014 FDBOZZO v1.19.24 Arreglo bug vcx/scx: La falta de AGAIN en algunos comandos USE provoca error de "tabla en uso" si se usa el PRG desde la ventana de comandos +* 14/06/2014 FDBOZZO v1.19.24 Arreglo bug vcx/scx: Un campo de tabla llamado "text" que comienza la línea puede confundirse con la estructura TEXT/ENDTEXT y reconocer mal el resto del código +* 16/06/2014 FDBOZZO v1.19.25 Mejora: Agregado soporte de configuraciones (CFG) por directorio que, si existen, se usan en lugar del principal (Mario Peschke) +* 17/06/2014 FDBOZZO v1.19.25 Mejora: Si durante la generación de binarios o de textos se producen errores, mostrar un mensaje avisando de ello (Pedro Gutiérrez M.) +* 06/07/2014 FDBOZZO v1.19.26 Mejora: Cuando se convierten binarios a texto, los CHR(0) pasan también, pudiendo provocar falsa detección como binario. Se agrega opción para quitar los NULLs. (Matt Slay) +* 27/06/2014 FDBOZZO v1.19.26 Mejora: Si el campo memo "methods" de los vcx/scx contiene asteriscos fuera de lugar (que no debería), FoxBin2Prg lo procesa igualmente. (Daniel Sánchez) +* 06/07/2014 FDBOZZO v1.19.26 Bug Fix cfg: ExtraBackupLevel no se tiene en cuenta cuando se usa multi-configuración +* 02/06/2014 DH/FDBOZZO v1.19.27 Mejora: Agregado soporte para exportar datos para DIFF (no para importar) +* 21/07/2014 FDBOZZO v1.19.28 Mejora: Agregada funcionalidad para filtrado de tablas y datos cuando se elige DBF_Conversion_Support:4 (Edyshor) +* 29/07/2014 FDBOZZO v1.19.29 Arreglo bug vcx/scx: Un campo de tabla llamado "text" que comienza la línea puede confundirse con la estructura TEXT/ENDTEXT y reconocer mal el resto del código +* 07/08/2014 FDBOZZO v1.19.30 Arreglo bug vcx/scx: Cuando la línea anterior a un ENDTEXT termina en ";" o "," no se reconoce como ENDTEXT sino como continuación (Jim Nelson) +* 08/08/2014 FDBOZZO v1.19.30 Arreglo bug vcx/vct v1.19.29: En ciertos casos de herencia no se mantiene el orden alfabetico de algunos metodos (Ryan Harris) +* 17/08/2014 FDBOZZO v1.19.31 Agregada versión del EXE cuando se genera LOG de depuración +* 20/08/2014 FDBOZZO v1.19.31 Mejora vcx/scx: Mejorado el reconocimiento de instrucciones #IF..#ENDIF cuando hay espacios entre # y el nombre de función +* 20/08/2014 FDBOZZO v1.19.31 Mejora: Ajuste de capitalización de los archivos origen, así ya no hay que hacerlo manualmente +* 25/08/2014 FDBOZZO v1.19.32 Arreglo bug vcx/vct v1.19.31: Una propiedad llamada "text" es confundida con la estructura text/endtext (Peter Hipp) +* 27/08/2014 FDBOZZO v1.19.33 Arreglo bug mnx v1.19.32: Si se crea un menú con una opción de tipo #Bar vacía, el menú se genera mal (Peter Hipp) +* 29/08/2014 FDBOZZO v1.19.33 Arreglo bug mnx v1.19.32: Si una opción tiene asociado un Procedure de 1 línea, no se mantiene como Procedure y se convierte a Command (Peter Hipp) +* 19/09/2014 FDBOZZO v1.19.34 Arreglo bug: Si se ejecuta FoxBin2Prg desde ventana de comandos FoxPro para un proyecto y hay algún archivo abierto o cacheado, se produce un error al intentar capitalizar el archivo de entrada (Jim Nelson) +* 26/09/2014 FDBOZZO v1.19.35 Mejora: Generar siempre el mismo Timestamp y UniqueID para los binarios minimizaría los cambios al regenerarlos (Marcio Gomez G.) +* 08/10/2014 FDBOZZO v1.19.36 Arreglo bug: Al generar el mn2 el identificador queda vacío (bug introducido en v1.19.35) +* 19/11/2014 FDBOZZO v1.19.37 Mejora: Las configuraciones de foxbin2prg.cfg no permiten comentarios && al final (edyshor) +* 19/11/2014 FDBOZZO v1.19.37 Arreglo bug: "String is too long to fit" cuando se procesa un DBF grande con DBF_Conversion_Support = 4 (edyshor) +* 19/11/2014 FDBOZZO v1.19.37 Mejora dbf: Nuevo parámetro ClearDBFLastUpdate para evitar diferencias por este dato (edyshor) +* 21/10/2014 FDBOZZO v1.19.37 Mejora: Permitir generar una clase por archivo (Ryan Harris/LScheffler) +* 29/11/2014 FDBOZZO v1.19.37 Arreglo bug scx/vcx: Algunas propiedades a veces tomaban la descripción de otras propiedades similares +* 29/11/2014 FDBOZZO v1.19.37 Arreglo bug scx/vcx: Las propiedades "Protected" y "Hidden" no siempre estaban ordenadas alfabéticamente +* 30/10/2014 FDBOZZO v1.19.37 Mejora: Optimizaciones en velocidad de proceso para scx/vcx/dbf +* 30/11/2014 FDBOZZO v1.19.37 Mejora: Indicador de avance de proceso más informativo +* 30/11/2014 FDBOZZO v1.19.37 Mejora: Se puede cancelar el proceso con la tecla Esc +* 30/11/2014 FDBOZZO v1.19.37 Mejora: Agregado control para detectar reportes no compatibles con VFP 9 +* 04/12/2014 FDBOZZO v1.19.38 Mejora: Permitir hacer conversiones masivas bin2prg y prg2bin sin los scripts vbs (Francisco Prieto) +* 06/12/2014 FDBOZZO v1.19.38 Mejora: Rediseńo de la Internacionalización. Ahora la selección es automática al cargar y no requiere recompilar. +* 12/12/2014 FDBOZZO v1.19.38 Mejora: Detección de métodos duplicados para notificar casos de corrupción (Álvaro Castrillón) +* 18/12/2014 FDBOZZO v1.19.39 Mejora: Cuando se usan las claves BIN2PRG o PRG2BIN permitir procesar un archivo solo (Mike Potjer) +* 18/12/2014 FDBOZZO v1.19.39 Mejora: Agregar la clave SHOWMSG y dejar INTERACTIVE para un diálogo interactivo (Mike Potjer) +* 18/12/2014 FDBOZZO v1.19.39 Mejora: Cuando se procesa un directorio con foxbin2prg.exe solo y la clave INTERACTIVE, mostrar un diálogo para preguntar qué procesar (Mike Potjer) +* 18/12/2014 FDBOZZO v1.19.39 Bug fix vbs: Los scripts vbs no muestren los errores del proceso de FoxBin2Prg +* 30/12/2014 FDBOZZO v1.19.39 Bug fix dc2: Los datos de DisplayClass y DisplayClassLibrary tenían el valor de "Default" en vez del propio (Christopher Kurth/Ryan Harris) +* 04/01/2015 FDBOZZO v1.19.40 Bug fix frx/lbx: Cuando se usa el entorno de datos, solo se está guardando un cursor, y si hay más se pierden +* 06/01/2015 FDBOZZO v1.19.40 Mejora: Permitir configurar la barra de progreso para que solamente aparezca cuando se procesan múltiples archivos y no cuando se procesa solo 1 (Jim Nelson) +* 07/01/2015 FDBOZZO v1.19.40 Bug fix db2: [Error 12, Variable "TCOUTPUTFILE" is not found] cuando DBF_Conversion_Support=4 y el archivo de salida es igual al generado (Mike Potjer) +* 07/01/2015 FDBOZZO v1.19.40 Mejora scx/vcx: Detección de nombres de objeto duplicados para notificar casos de corrupción +* 13/01/2015 FDBOZZO v1.19.41 Bug Fix scx/vcx: Detección errónea de estructuras PROCEDURE/ENDPROC cuando se usan como parámetros en LPARAMETERS (Ryan Harris) +* 13/01/2015 FDBOZZO v1.19.41 Bug Fix db2: Detección errónea de tabla inválida cuando el tamańo es inferior a 328 bytes. Límite mínimo cambiado a 65 bytes. +* 20/01/2015 FDBOZZO v1.19.42 Mejora: Validación de versión de Visual FoxPro SP1, para evitar problemas ajenos a FoxBin2Prg +* 04/02/2015 FDBOZZO v1.19.42 Mejora dc2: Permitir ordenar los campos de vistas y tablas alfabéticamente y mantener en una lista aparte el orden real, para facilitar el diff y el merge (Ryan Harris) +* 22/01/2015 FDBOZZO v1.19.42 Bug Fix: Compatibilidad con SourceSafe rota porque se genera un error al realizar la consulta para soporte de archivo (Tuvia Vinitsky) +* 25/02/2015 FDBOZZO v1.19.42 Bug Fix scx/vcx: Procesar solo un nivel de text/endtext, ya que no se admiten más niveles (LScheffler) +* 25/02/2015 FDBOZZO v1.19.42 Mejora: Hacer algunos mensajes de error más descriptivos (LScheffler) +* 03/03/2015 FDBOZZO v1.19.42 Mejora: Mejoras en la traducción al alemán (LScheffler) +* 03/03/2015 FDBOZZO v1.19.42 Mejora: Permitir definir el archivo de entrada con un path relativo (LScheffler) +* 03/03/2015 FDBOZZO v1.19.42 Bug Fix scx: Metadato del Dataenvironment no se genera bien cuando el Dataenvironment es renombrado +* 03/03/2015 FDBOZZO v1.19.42 Bug Fix scx: Agregada la generación del PJX/PJ2 cuando se indica "file.pjx", "*" (LScheffler) +* 03/03/2015 FDBOZZO v1.19.42 Mejora: Agregado soporte multi-proyecto (*.PJX, *.PJ2) cuando se especifica "file.pjx", "*" (LScheffler) +* 05/03/2015 FDBOZZO v1.19.42 Mejora: Cambiada la clase de base de FoxBin2Prg de custom a session (LScheffler) +* 05/03/2015 FDBOZZO v1.19.42 Mejora: Permitir procesar los archivos de un proyecto sin convertir el PJX/2, usando *- (LScheffler) +* 06/03/2015 FDBOZZO v1.19.42 Bug Fix pjx: Permitir usar fin de linea (CR/LF) en los atributos de versión del PJX +* 10/03/2015 FDBOZZO v1.19.42 Mejora API: Agregado soporte de errOut e implementado en writeErrorLog +* 10/03/2015 FDBOZZO v1.19.42 Mejora: Agregado soporte total de comodines *? en nombres de archivo para procesar múltiples archivos de la misma extensión (LScheffler) +* 10/03/2015 FDBOZZO v1.19.42 Mejora API: Nuevo parámetro para permitir un CFG alternativo (LScheffler) +* 10/03/2015 FDBOZZO v1.19.42 Mejora API: Nuevo método get_Processed() para obtener información de los archivos procesados (LScheffler) +* 10/03/2015 FDBOZZO v1.19.42 Mejora: Nueva salida de archivos procesados a stdOut (LScheffler) +* 10/03/2015 FDBOZZO v1.19.42 Bug Fix: Arreglada la cancelación del procesamiento con tecla Esc +* 22/03/2015 FDBOZZO v1.19.42 Mejora: Ordenar los campos de vistas y tablas alfabéticamente y mantener en una lista aparte el orden real, para facilitar el diff y el merge (Ryan Harris) +* 22/03/2015 FDBOZZO v1.19.42 Mejora: Aplicar ClassPerFile a las conexiones, tablas, vistas y stored procedures de los DBC (Ryan Harris) +* 23/03/2015 FDBOZZO v1.19.42 Bug Fix mnx: No se mantiene el Pad vacío al regenerar el menú cuando se define un menu con un Pad sin nombre (LScheffler) +* 25/03/2015 FDBOZZO v1.19.42 Mejora API: Nueva propiedad l_ProcessFiles que permite obtener la lista de archivos a procesar sin procesarlos realmente usando el valor .F. +* 25/03/2015 FDBOZZO v1.19.42 Bug Fix frx/lbx: Arreglo de CR,LF,TAB sobrantes en algunos archivos FR2/LB2 agregados en versiones anteriores (Ryan Harris) +* 02/04/2015 FDBOZZO v1.19.42 Mejora: Herencia de CFGs entre directorios +* 12/04/2015 FDBOZZO v1.19.42 Mejora API: Crear un método API get_DirSettings() para obtener información de seteos del directorio indicado (LScheffler) +* 13/04/2015 FDBOZZO v1.19.42 Mejora: Permitir generar texto de una clase de una librería (LScheffler) +* 16/04/2015 FDBOZZO v1.19.42 Mejora API: Renombrados los nombres de los métodos al Inglés para facilitar su entendimiento internacional (Mike Potjer) +* 23/04/2015 FDBOZZO v1.19.43 Mejora: Nueva configuración "RemoveZOrderSetFromProps" para quitar la propiedad ZOrderSet de los objetos que cambian constantemente, provocan diferencias y a veces dan problemas de objeto encima/debajo (Ryan Harris) +* 23/04/2015 FDBOZZO v1.19.43 Mejora: Hacer que la progressbar no se convierta en la ventana de salida por defecto de los ? (LScheffler) +* 28/04/2015 FDBOZZO v1.19.43 Bug Fix: FoxBin2Prg no retorna códigos de error cuando se llama como programa externo (Ralf Wagner) +* 29/04/2015 FDBOZZO v1.19.43 Bug Fix: FoxBin2Prg a veces genera errores OLE cuando se ejecuta más de una vez en modo objeto sobre un archivo con errores (Fidel Charny) +* 10/05/2015 FDBOZZO v1.19.43 Bug Fix: Cuando un form tiene AutoCenter=.T., hay veces en que al regenerar el binario y ejecutarlo no se muestra centrado (Esteban H) +* 14/05/2015 FDBOZZO v1.19.44 Bug Fix: En ciertos PCs FoxBin2Prg no retorna códigos de error cuando se llama como programa externo (Ralf Wagner) +* 18/05/2015 FDBOZZO v1.19.44 Mejora: Permitir la exportación de datos de DBFs cuando se usa DBF_Conversion_Support:1 y CFG individual opcional +* 31/05/2015 FDBOZZO v1.19.44 Bug Fix: Un arreglo previo en el manejo de errores en cascada provocó un reseteo del último estado de error de proceso, haciendo que a veces los errores no se reporten. +* 01/06/2015 FDBOZZO v1.19.45 Bug Fix: Cuando se exporta a texto un menu que usa comillas simples o una expresión en el mensaje de las opciones, al regenerar el binario se recortan partes del mensaje de esas opciones (Mike Potjer) +* 09/06/2015 FDBOZZO v1.19.45 Bug Fix: Cuando se procesan múltiples archivos PJ2, puede ocurrir un error de "variable llError no definida" (LScheffler) +* 15/06/2015 FDBOZZO v1.19.45 Bug Fix pjx,*/pj2,*: Los proyectos PJX/PJ2 que referencian archivos de otras unidades de disco causan errores ne esos archivos al procesar con las opciones "*" o "*-" (Matt Slay) +* 22/06/2015 FDBOZZO v1.19.46 Bug Fix: Arreglo de bug en método set_UserValue() cuando se intenta obtener información de un error que no puede abrir la tabla (por ej, porque el memo está corrupto) +* 22/06/2015 FDBOZZO v1.19.46 Mejora: Agregado soporte interno para consulta de información de cfg de directorio, mediante nuevo parámetro opcional, para los métodos API que lo requieren (por ej: get_Ext2FromExt, hasSupport*) +* 29/07/2015 FDBOZZO v1.19.46 Bug Fix: Cuando se procesa un directorio o un proyecto con todos los archivos, a veces puede ocurrir el error "Alias already in use" (Dave Crozier) +* 01/09/2015 FDBOZZO v1.19.46 Bug Fix mnx: Cuando se usa '&&' en los textos de las opciones, se corrompe el binario del menú al regenerarlo (Walter Nichols) +* 14/09/2015 FDBOZZO v1.19.46 Mejora: El objeto WSscript.Shell da problemas en algunos entornos o bajo ciertas condiciones, por lo que se reemplaza por llamadas Win32 nativas (Aurélien Dellieux) +* 15/09/2015 FDBOZZO v1.19.46 Bug Fix Frx/Lbx : El ordenamiento de registros de los reportes cambia el orden Z de los objetos próximos que se solapan, pudiendo causar que se visualicen mal (Ryan Harris) +* 18/09/2015 FDBOZZO v1.19.46 Bug Frx/Lbx: Cuando se regeneran reportes o etiquetas con textos multilinea alineados al centro o a la derecha, la alineación no es completamente correcta (Ryan Harris) +* 29/10/2015 FDBOZZO v1.19.46 Bug Frx/Lbx: Cuando se agrupan controles en diseńo y se convierte a texto, al regenerar se pierden las agrupaciones (LScheffler) +* 04/11/2015 RALFXWAGNER v1.19.46 Bug Fix Pjx: Los archivos SPR y MPR no estan bien representados en la información del proyecto (Ralf Wagner) +* 25/11/2015 FDBOZZO v1.19.46 Bug Fix Pj2: Se genera un error al regenerar un PJX desde un PJ2 donde algún archivo contiene paréntesis (EddieC) +* 25/11/2015 FDBOZZO v1.19.46 Mejora dbf: Nuevo parámetro ExcludeDBFAutoincNextval para evitar diferencias por este dato (edyshor) +* 04/02/2016 FDBOZZO v1.19.46 Bug Fix: Cuando se procesa un archivo en el directorio raiz, se genera un error 2062 (Aurélien Dellieux) +* 10/02/2016 FDBOZZO v1.19.47 Bug Fix: Cuando se indica como nombre de archivo "*" y como tipo "*", se regeneran automáticamente todos los archivos binarios desde los archivos de texto (Alejandro Sosa) +* 25/05/2016 FDBOZZO v1.19.47 Mejora DBF-Data: Permitir importar datos de los DB2 a los DBF con el nuevo valor DBF_Conversion_Support=8. Todos los tipos de datos excepto General. (Walter Nicholls) +* 24/06/2016 AndyGK63 v1.19.48 Bug Fix: Error en variable usada en una de las traducciones al Alemán (Andy Kasper) +* 24/06/2016 AndyGK63 v1.19.48 Bug Fix: Posición de menú BEFORE siempre cambiada a AFTER al convertir (Andy Kasper) +* 30/06/2016 FDBOZZO v1.19.48 Bug Fix: No se respetan algunas restricciones de conversión para DBFs cuando se usan CFGs particulares por tabla (Nathan Brown) +* 09/07/2016 FDBOZZO v1.19.48 Bug Fix db2: Cuando se lee un memo multilínea de un db2 con datos antiguo, se produce un error de índice fuera de rango +* 10/07/2016 FDBOZZO v1.19.48 Bug Fix db2: Cuando se usa ExcludeDBFAutoincNextval: 1 en FoxBin2Prg.cfg y a la vez la importación de datos de una tabla con campo AutoInc, se produce el error "Error 2088, Field is read-only" (Nathan Brown) +* 10/07/2016 FDBOZZO v1.19.48 Fix defecto db2: Cuando se arregló el bug del memo multi-línea, se introdujo un nuevo defecto por el cual un memo de linea-simple se decodifica mal (Nathan Brown) +* 11/07/2016 FDBOZZO v1.19.48 Bug Fix pj2: Cuando se regenera el binario de un PJ2 con archivos en una ruta con paréntesis y espacios, se genera un error "Error 36, Command contains unrecognized phrase/keyword" (Nathan Brown) +* 11/07/2016 FDBOZZO v1.19.48 Bug Fix frx: Los ControlSource de objetos OLE que contienen comillas se generan mal (Nathan Brown) +* 23/03/2017 FDBOZZO v1.19.49 Bug Fix vcx: No funciona la generación de una clase individual con "classlib.vcx::classname" (LScheffler) +* 25/03/2017 FDBOZZO v1.19.49 Mejora vcx: Poder importar una clase (VC2 generado con ClassPerFile) en un VCX existente (LScheffler) +* 26/03/2017 FDBOZZO v1.19.49 Mejora cfg: Se permite indicar un archivo CFG por parámetro de cualquier directorio para anular los CFG predeterminados de los subdirectorios, para casos especiales donde sea necesario +* 28/03/2017 FDBOZZO v1.19.49 Mejora vcx: Implementada sintaxis para importar o exportar clases individuales usando "classlibrary.vcx::classname::import" y "classlibrary.vcx::classname::export" +* 11/04/2017 FDBOZZO v1.19.49 Bug Fix frx: Cuando dentro de una expresión se usa "&&", se corrompe el registro del FRX generado (Alejandro A Sosa) +* 11/04/2017 FDBOZZO v1.19.49 Mejora cfg : En modo objeto permitir indicar un objeto CFG en lugar de un archivo CFG (LScheffler) +* 12/04/2017 DH&FDBOZZO v1.19.49 Bug Fix & Report pjx: No se estaba guardando el campo User en los archivos PJX (Doug Hennig) +* 25/06/2017 FDBOZZO v1.19.49.1 Bug Fix tx2 v1.19.49: El campo DEVINFO usado en los PJX se estaba usando en los demás binarios, dando errores +* 02/12/2017 FDBOZZO v1.19.49.2 Bug Fix tx2 v1.19.49: No exporta los objetos a TX2 cuando se usa ClassPerFile (LScheffler) +* 03/12/2017 JS&FDBOZZO v1.19.49.3 Bug Fix db2: Los campos "Double" asumen 2 decimales cuando se definen con 0 decimales (Jerry Stager) +* 04/12/2017 FDBOZZO v1.19.49.4 Cuando se usa ClassPerFile an Modo API y se importan clases simples, a veces sus nombres se toman sin comillas, provocando errores (LScheffler) +* 20/12/2017 DH&FDBOZZO v1.19.49.5 Bug Fix dbf: Cuando se importan datos de un DB2 a DBF (con DBF_Conversion_Support = 8), los tabs al inicio de los memo se pierden (Doug Hennig) +* 04/01/2018 FDBOZZO v1.19.49.6 Bug Fix vcx/scx: FoxBin2Prg debería ignorar los registros que el diseńador de FoxPro ignora (Doug Hennig) +* 04/01/2018 FDBOZZO v1.19.49.6 Bug Fix vcx/scx: Cuando se regenera la propiedad _MemberData se agregan CR/LF por cada miembro, pudiendo provocar un error de "valor muy largo" (Doug Hennnig) +* 11/01/2018 FDBOZZO v1.19.49.7 Bug Fix: Cuando se convierte la estructura de un DBF puede dar error si existe un campo llamado I o X (Francisco Prieto) +* 30/01/2018 FDBOZZO v1.19.49.8 Bug Fix: Cuando se convierte a texto una libreria corrupta con registros duplicados, se genera el error "The specified key already exists" (Kirides) +* 03/03/2018 FDBOZZO v1.19.50 Mejora: La información DevInfo de los PJX estará inhabilitada por defecto y se podrá activar con el nuevo switch BodyDevInfo +* 03/03/2018 FDBOZZO v1.19.50 Mejora: Nueva opción de configuración "PRG_Compat_Level": 0=Legacy, 1=Usar HELPSTRING para comentarios de métodos de clase en vez de "&&" +* 03/03/2018 FDBOZZO v1.19.50 Mejora: Permitir exportar a texto la información de DBFs cuya apertura está protegida por eventos del DBC +* 12/03/2018 FDBOZZO v1.19.50.1 Bug Fix: Cuando se usa la equivalencia "extension: pj2=pjm" se debe manejar el pjm como un pj2 y no como un pjm de SourceSafe (Darko Kezic) +* 15/03/2018 FDBOZZO v1.19.50.3 Bug Fix: Cuando se agregan archivos de texto no-VFP, como html,css,etc, en la sección de Text del proyecto, FoxBin2Prg no mantiene esta selección al regenerar el PJX, dejándolos en la sección Files (Darko Kezic) +* 16/03/2018 FDBOZZO v1.19.51 Mejora: Agregado soporte para archivos de macros (.FKY) +* 25/03/2018 FDBOZZO v1.19.51 Mejora: Agregado soporte para archivos de memoria (.MEM) +* 05/05/2018 SSF1&FDB v1.19.51.1 Bug Fix: Si se usa capitalización en la información de las vistas, entonces la información relacionada no se exporta correctamente o completamente y puede perderse (SkySurfer1) +* 20/06/2018 FDBOZZO v1.19.51.2 Bug Fix: Cuando se exporta un DBF que pertenece a un DBC sin eventos, falla (Jairo Argüelles/Juan C.Perdomo) +* 09/07/2018 FDBOZZO v1.19.51.3 Bug Fix: Error 1098, Cannot find ... [ENDT] that closes ... [TEXT] Issue#26 when there is a field named TEXT as first line-word (KIRIDES) +* 10/07/2018 FDBOZZO v1.19.51.4 Bug Fix: El ordenamiento alfabético de los objetos de los ADD OBJECT puede causar que algunos objetos se creen en el orden erróneo, provocando comportamientos inesperados (Jochen Kauz) +* 14/02/2019 TRACY_P v1.19.51.5 Enhancement: Make FoxBin2Prg more COM friendly when using ESC key (Tracy Pearson) +* 01/04/2020 RHARRIS v1.19.51.6 Bug Fix: Si alguno de los archivos-por-clase no tiene CR_LF al final, al ensamblar la clase se pueden superponer instrucciones de forma inválida (Ryan Harris) +* 01/04/2020 FDBOZZO v1.19.51.6 Bug Fix: Incompatible with VFPA (#36) (Eric Selje) +* 01/04/2020 DH v1.19.51 Bug Fix: Manejo de AutoIncrement incompatible con Project Explorer (Dan Lauer) +* 01/04/2020 FDBOZZO v1.19.51 Bug Fix: La conversión de tablas falla si algún campo contiene una palabra reservada como UNIQUE (DAJU78) +* 01/04/2020 FDBOZZO v1.19.51 Bug Fix: No se respetan las propiedades de VCX/SCX con nombre "note" (Tracy Pearson) +* 14/02/2021 LScheffler v1.19.52 Bug Fix: conversion dbf -> prg, error if only test mode (toFoxBin2Prg.l_ProcessFiles is false) +* 14/02/2021 LScheffler v1.19.52 Bug Fix: conversion prg -> dbf, fields with .NULL. value are incorectly recreated +* 15/02/2021 LScheffler v1.19.53 Bug Fix: processing directory, flush log file after loop instead of file +* 16/02/2021 LScheffler v1.19.53 Bug Fix: conversion prg -> vcx, files per class could create one class multiple times +* 03/03/2021 LScheffler v1.19.54 Bug Fix: DBF_Conversion_Condition, problem with macro expansion +* 14/02/2021 LScheffler v1.19.55 Enhancement: inserted option UseFilesPerDBC to split DBC processing from vcx / scx +* 15/02/2021 LScheffler v1.19.55 Enhancement: inserted option RedirectFilePerDBCToMain to split DBC processing from vcx / scx +* 15/02/2021 LScheffler v1.19.55 Enhancement: inserted option ItemPerDBCCheck to split DBC processing from vcx / scx +* the three above are straight forward, so no extra comment are within the code +* 19/02/2021 LScheffler v1.19.55 Enhancement: inserted option DBF_BinChar_Base64 to allow processing of NoCPTrans fields in non base64 way +* 20/02/2021 LScheffler v1.19.55 Enhancement: inserted option DBF_IncludeDeleted to allow including deleted records of DBF +* 21/02/2021 LScheffler v1.19.55 Enhancement: German translation improved +* 21/02/2021 LScheffler v1.19.55 Enhancement: Info screen-doc improved +* 21/02/2021 LScheffler v1.19.55 Enhancement: added option to create config file template +* 23/02/2021 LScheffler v1.19.55 Enhancement: inserted option OldFilesPerDBC to define the use splitting of DBC like version pre 1.20.0 +* 04/03/2021 LScheffler v1.19.56 Bug Fix: Inputfile in form classlib.class.vc2 AND RedirectClassType = 1 and Execute param tcRecompile = 1 +* generates classlib.class.vcx and tries to recompile classlib.vcx +* fails silent if classlib.vcx exists (compiles wrong lib), with message if not. +* 04/03/2021 LScheffler v1.19.56 Enhancement: New value for RedirectClassType = 2, just process the single class of classlib.class.vc2 +* 05/03/2021 LScheffler v1.19.57 Bug Fix: For RedirectClassType = 2, Path was set wrong +* 2021-03-04 DH v1.19.58 Enhancement: added support for writing to a different folder than the source code (Doug Hennig) +* 2021-03-04 DH v1.19.58 Enhancement: added configuration item: HomeDir, which determines if HomeDir is saved in PJ2 files (Doug Hennig) +* 09/03/2021 LScheffler v1.19.59 Bug Fix: For RedirectClassType = 2, Path was set wrong +* 09/03/2021 LScheffler v1.19.59 Doc: Improved, Better description of ClassPerFileCheck. +* 09/03/2021 LScheffler v1.19.59 Bug Fix: RedirectClassType = 2, UseClassPerFile = 2 failed. +* 09/03/2021 LScheffler v1.19.59 Enhancement: Added option to create config file template based on current values of a directory +* 09/03/2021 LScheffler v1.19.59 Enhancement: Log settings object handed to execute (Debug > 0) +* 22/03/2021 LScheffler v1.19.60 Enhancement: -cC options learned to create default FoxBin2Prg._cfg file +* 22/03/2021 LScheffler v1.19.60 Enhancement: -t Option learned to create default ._cfg file, if table is open. +* 22/03/2021 LScheffler v1.19.60 Enhancement: Handling of additional non structural index per DBF in Bin2Text and Text2Bin see config per DBF +* 22/03/2021 LScheffler v1.19.60 Enhancement: Debug-Logging for Index +* 22/03/2021 LScheffler v1.19.60 Bug Fix: DBF_Conversion_Condition was read, but never used +* 22/03/2021 LScheffler v1.19.60 Bug Fix: DBF_Conversion_Order sets an index that later would be stored as structural index +* 22/03/2021 LScheffler v1.19.60 Bug Fix: config options with text value fail, if line comment is set +* 22/03/2021 LScheffler v1.19.60 Enhancement: FoxBin2Prg template and debug output ordered and completed, order synched, grouped and groups named +* 22/03/2021 LScheffler v1.19.60 Enhancement: Option BackgroundImage was read, but not in template +* 22/03/2021 LScheffler v1.19.60 Bug Fix: issue #53 Variable lnFileCount in get_filesfromdirectory +* 23/03/2021 LScheffler v1.19.61 Bug Fix: missnamed property +* 30/03/2021 LScheffler v1.19.62 Bug Fix: *_Conversion_Support options not read from config file +* 30/03/2021 LScheffler v1.19.62 Bug Fix: Extension shift options not read from config file +* 30/03/2021 LScheffler v1.19.62 Bug Fix: RedirectFilePerDBCToMain option was defined wrong in configuration example +* 30/03/2021 LScheffler v1.19.62 Enhancement: Debug logging, level of config file. +* 12/04/2021 LScheffler v1.19.63 Bug Fix: Tables without indexes cause an error that the "Table ## is not marked as belonging to the ## database" (jstagerGH) +* 12/04/2021 LScheffler v1.19.63 Docu: Readme reworked (mattslay) +* 22/04/2021 LScheffler v1.19.64 Bug Fix: Converting MN2 to MNX ignores the programmer-defined bar # found in "Prompt Options" screen (Jimrnelson) +* 22/04/2021 LScheffler v1.19.64 Bug Fix: Converting MN2 to MNX ignores the programmer-defined Pad Name found in "Prompt Options" screen (LScheffler) +* 20/05/2021 LScheffler v1.19.65 Bug Fix: Options "-cCt" are not usable on command line base EXE. "cCt" are allowed too now +* 30/08/2021 LScheffler v1.19.66 Bug Fix: Incorrect version showing for v1.19.65 (siara-cc) +* This creates wrong version in generated config files too +* 07/12/2021 LScheffler v1.19.67 Bug Fix: Double classes in VCX +* 12/04/2021 LScheffler v1.19.67 Docu: examples and template for config files reworked +* 18/01/2022 LScheffler v1.19.68 Docu: Minor links in readme.html +* 18/01/2022 LScheffler v1.19.68 Bug Fix: Converting MN2 to MNX ignores the programmer-defined "Pad Name" found in "Prompt Options" screen (Jimrnelson) +* 23/02/2022 LScheffler v1.19.69 Bug Fix: Creating a class, when an object is named equal to this class (bjornhoeksel) +* 23/02/2022 LScheffler v1.19.69 Docu: examples and template for config files reworked to English, Contribution.md reworked +* 25/02/2022 LScheffler v1.19.69 Bug Fix: Missing class when building text file from corrupted VCX (bjornhoeksel) +* 25/02/2022 LScheffler v1.19.69 github: added tags to bring links in docu to work +* 25/02/2022 LScheffler v1.19.69 Docu: examples and template for config files enhanced +* 16/03/2022 LScheffler v1.19.70 Bug Fix: Last bar in menu files are in some situations not converted correctly back in the mnx file. (bjornhoeksel) +* 16/03/2022 LScheffler v1.19.70 Docu: Bug list below +* 30/03/2022 bjornhoeksel v1.19.71 Bug Fix: Convert menu mn2 to mnx with skip for that contains a string with ; sign is missing part after that sign in mnx. (bjornhoeksel) +* 06/04/2022 LScheffler v1.19.72 Bug Fix: Problem on using "DBF_Conversion_Support" on table configuration file (LScheffler) +* 06/04/2022 LScheffler v1.19.72 Bug Fix: Problem converting intentionally trailing spaces to VarChar/VarBinary (LScheffler) +* 06/04/2022 LScheffler v1.19.72 Bug Fix: Problem converting trailing spaces on line end in memo (bjornhoeksel) +* 07/04/2022 LScheffler v1.19.72 Enhancement: Documentation in config file enhanced +* 07/04/2022 LScheffler v1.19.72 Enhancement: Added parameter "?" to show interactive help ("interactive" still works) +* 08/04/2022 LScheffler v1.19.73 Bug Fix: Problem converting trailing spaces on line end in memo again (bjornhoeksel) +* 13/05/2022 bjornhoeksel v1.19.74 Bug Fix: Fix menu bars with shortcuts keys like KEY F6, "F6"; are lost. (DanLauer) +* 08/06/2022 LScheffler v1.19.75 Enhancement: Typo in German (JoergSchneider) +* 08/06/2022 LScheffler v1.19.75 Bug Fix: Multiple text2bin and bin2text conversion on MNX causes space grow (JoergSchneider) +* 13/06/2022 LScheffler v1.19.76 Bug Fix: On operation per folder, change of folder must change configuration (JoergSchneider) +* 16/03/2023 LScheffler v1.19.77 Bug Fix: Bin2Txt Operation on VCX loses leading spaces in Property Values #90 (JoergSchneider) +* 16/03/2023 LScheffler v1.19.77 Bug Fix: Txt2Bin Operation on VCX looses double ampersand in Property Values #91 (LScheffler) +* 20/03/2023 LScheffler v1.19.78 Enhancement: Text2Bin on PJX errors out for projects with an attach icon that has a drive letter on its path. #93 (ericbarte) +* 04/08/2023 LScheffler v1.19.79 Bug Fix: Bin2Text: Forms with ole controls conversion error (also: any vcx) +* 06/08/2023 LScheffler v1.19.79 Enhancement: Added option to return version number +* +* +*--------------------------------------------------------------------------------------------------- +* +* 23/11/2013 Luis Martínez REPORTE BUG scx v1.4: En algunos forms solo se generaba el dataenvironment (arreglado en v.1.5) +* 27/11/2013 Fidel Charny REPORTE BUG vcx v1.5: Error en el guardado de ciertas propiedades de array (arreglado en v.1.6) +* 02/12/2013 Fidel Charny REPORTE BUG scx v1.6: Se pierden algunas propiedades y no muestra picture si "Name" no es la última (arreglado en v.1.7) +* 03/12/2013 Fidel Charny REPORTE BUG scx v1.7: Se siguen perdiendo algunas propiedades por implementación defectuosa del arreglo anterior (arreglado en v.1.8) +* 03/12/2013 Fidel Charny REPORTE BUG scx v1.8: Se siguen perdiendo algunas propiedades por implementación defectuosa de una mejora anterior (arreglado en v.1.9) +* 06/12/2013 Fidel Charny REPORTE BUG scx v1.9: Cuando hay métodos que tienen el mismo nombre, aparecen mezclados en objetos a los que no corresponden (arreglado en v.1.10) +* 07/12/2013 Edgar Kummers REPORTE BUG vcx v1.10: Cuando se parsea una clase con un _memberdata largo, se parsea mal y se corrompe el valor (arreglado en v.1.11) +* 08/12/2013 Fidel Charny REPORTE BUG frx v1.12: Cuando se convierten algunos reportes da "Error 1924, TOREG is not an object" (arreglado en v.1.13) +* 14/12/2013 Arturo Ramos REPORTE BUG scx v1.13: La regeneración de los forms (SCX) no respeta la propiedad AutoCenter, estando pero no funcionando. (arreglado en v.1.14) +* 14/12/2013 Fidel Charny REPORTE BUG scx v1.13: La regeneración de los forms (SCX) no regenera el último registro COMMENT (arreglado en v.1.14) +* 01/01/2014 Fidel Charny REPORTE BUG mnx v1.16: El menú no siempre respeta la posición original LOCATION y a veces se genera mal el MNX (se arregla en v1.17) +* 05/01/2014 Fidel Charny REPORTE BUG mnx v1.17: Se genera cláusula "DO" o llamada Command cuando no Procedure ni Command que llamar // Diferencia de Case en NAME (se arregla en v1.18) +* 20/02/2014 Ryan Harris PROPUESTA DE MEJORA v1.19.11: Centralizar los ZOrder de los controles en metadata de cabecera de la clase para minimizar diferencias +* 23/02/2014 Ryan Harris BUG cfg v1.19.12: Si se define NoTimestamp en FoxBin2Prg.cfg, se toma el valor opuesto (solucionado en v1.19.13) +* 27/02/2014 BUG REGRESION v1.19.13: Si no se define ExtraBackupLevels no se generan backups (solucionado en v1.19.14) +* 06/03/2014 Ryan Harris REPORTE BUG vcx/scx v1.19.15: Algunas propiedades no mantienen su visibilidad Hidden/Protected // Orden de properties defTop,defLeft,etc +* 10/03/2014 Ryan Harris REPORTE BUG frx/lbx v1.19.16: Las expresiones con comillas corrompen el fx2/lb2 // La propiedad Comment se pierde si es multilínea (solucionado en v1.19.17) +* 10/03/2014 Ryan Harris REPORTE BUG mnx v1.19.16: Al usar comentarios multilínea en las opciones, se corrompe el MN2 y el MNX regenerado (solucionado en v1.19.17) +* 20/03/2014 Arturo Ramos REPORTE BUG vcx/scx v1.19.17: Las imágenes no mantienen sus dimensiones programadas y asumen sus dimensiones reales (Solucionado en v1.19.18) +* 24/03/2014 Ryan Harris REPORTE BUG vcx/scx v1.19.17: El comentario a nivel de librería se pierde (Solucionado en v1.19.18) +* 29/04/2014 Matt Slay MEJORA v1.19.20: Posibilidad de convertir un proyecto entero a tx2 // Optimización de generación según timestamps (Agregado en v1.19.21) +* 30/04/2014 Jim Nelson MEJORA v1.19.20: Agregado de AGAIN en apertura de tablas (Agregado en v1.19.21) +* 07/05/2014 Fidel Charny REPORTE BUG vcx/scx v1.19.21: La propiedad Picture de una clase form se pierde y no muestra la imagen. No ocurre con la propiedad Picture de los controles (Arreglado en v1.19.22) +* 09/05/2014 Miguel Durán REPORTE BUG vcx/scx v1.19.21: Algunas opciones del optiongroup pierden el width cuando se subclasan de una clase con autosize=.T. (Arreglado en v1.19.22) +* 13/05/2014 Andrés Mendoza REPORTE BUG vcx/scx v1.19.21: Los métodos que contengan líneas o variables que comiencen con TEXT, provocan que los siguientes métodos queden mal indentados y se dupliquen vacíos (Arreglado en v1.19.22) +* 27/05/2014 Kenny Vermassen REPORTE BUG img v1.19.22: La propiedad Stretch no estaba incluida en la lista de propiedades props_image.txt, lo que provocaba un mal redimensionamiento de las imagenes en ciertas situaciones (Arreglado en v1.19.23) +* 09/06/2014 Matt Slay REPORTE BUG vcx/scx v1.19.23: La falta de AGAIN en algunos comandos USE provoca error de "tabla en uso" si se usa el PRG desde la ventana de comandos (Arreglado en v1.19.24) +* 13/06/2014 Mario Peschke REPORTE BUG vcx/scx v1.19.23: Los campos de tabla con nombre "text" a veces provocan corrupción del binario generado (Arreglado en v1.19.24) +* 16/06/2014 Mario Peschke MEJORA v1.19.24: Agregado soporte de configuraciones (CFG) por directorio que, si existen, se usan en lugar del CFG principal (Agregado en v1.19.25) +* 17/06/2014 Pedro Gutiérrez M. MEJORA v1.19.24: Si durante la generación de binarios o de textos se producen errores, mostrar un mensaje avisando de ello (Agregado en v1.19.25) +* 02/07/2014 Matt Slay MEJORA v1.19.25: Se filtran algunos CHR(0) de los binarios al tx2, provocando que a veces no sea reconocido como texto. Deberían poderse quitar los NULLs (Arreglado en v1.19.26) +* 27/06/2014 Daniel Sánchez MEJORA v1.19.25: Si el campo memo "methods" de los vcx/scx contiene asteriscos fuera de lugar (que no debería), FoxBin2Prg falla. Debería poder procesarlo igual. +* 02/06/2014 Doug Hennig MEJORA v1.19.22: Agregada funcionalidad para exportar los datos de las tablas al archivo db2 (Agregado en v1.19.27) +* 21/07/2014 Edyshor PROPUESTA DE MEJORA db2 v1.19.27: Sería útil poder filtrar tablas y datos cuando se elige DBF_Conversion_Support:4 (Agregado en v1.19.28) +* 29/07/2014 M_N_M REPORTE BUG vcx/scx v1.19.28: Los campos de tabla con nombre "text" a veces provocan corrupción del binario generado (Arreglado en v1.19.29) +* 07/08/2014 Jim Nelson REPORTE BUG vcx/scx v1.19.29: Cuando la línea anterior a un ENDTEXT termina en ";" o "," no se reconoce como ENDTEXT sino como continuación (Arreglado en v1.19.30) +* 08/08/2014 Ryan Harris REPORTE BUG vcx/scx v1.19.29: En ciertos casos de herencia no se mantiene el orden alfabetico de algunos metodos (solucionado en v1.19.30) +* 25/08/2014 Peter Hipp REPORTE BUG vcx/scx v1.19.31: Una propiedad llamada "text" es confundida con la estructura text/endtext (solucionado en v1.19.32) +* 27/08/2014 Peter Hipp REPORTE BUG mnx v1.19.32: Si se crea un menú con una opción de tipo #Bar vacía, el menú se genera mal (solucionado en v1.19.33) +* 28/08/2014 Peter Hipp REPORTE BUG mnx v1.19.32: Si una opción tiene asociado un Procedure de 1 línea, no se mantiene como Procedure y se convierte a Command (solucionado en v1.19.33) +* 19/09/2014 Jim Nelson REPORTE BUG v1.19.33: Si se ejecuta FoxBin2Prg desde ventana de comandos FoxPro para un proyecto y hay algún archivo abierto o cacheado, se produce un error (solucionado en v1.19.34) +* 26/09/2014 Marcio Gomez G. MEJORA v1.19.34: Generar siempre el mismo Timestamp y UniqueID para los binarios minimizaría los cambios al regenerarlos (Agregado en v1.19.35) +* 19/11/2014 edyshor MEJORA cfg v1.19.36: DBF_Conversion_Excluded no permite comentarios && al final (Agregado en v1.19.37) +* 19/11/2014 edyshor REPORTE BUG dbf v1.19.36: "String is too long to fit" cuando se procesa un DBF grande con DBF_Conversion_Support = 4 (Agregado en v1.19.37) +* 19/11/2014 edyshor MEJORA dbf v1.19.36: Nuevo parámetro ClearDBFLastUpdate para evitar diferencias por este dato (Agregado en v1.19.37) +* 14/10/2014 LScheffler MEJORA v1.19.36: Permitir generar una clase por archivo (pregunta) (Agregado en v1.19.37) +* 21/10/2014 Ryan Harris MEJORA v1.19.36: Permitir generar una clase por archivo (sugerencia) (Agregado en v1.19.37) +* 04/12/2014 Francisco Prieto MEJORA v1.19.36: Permitir hacer conversiones masivas bin2prg y prg2bin sin los scripts vbs (Agregado en v1.19.38) +* 12/12/2014 Álvaro Castrillón MEJORA v1.19.36: Detección de métodos duplicados para notificar casos de corrupción (Agregado en v1.19.38) +* 16/12/2014 Mike Potjer Mejora v1.19.38: Cuando se usan las claves BIN2PRG o PRG2BIN permitir procesar un archivo solo (Agregado en v1.19.39) +* 16/12/2014 Mike Potjer Mejora v1.19.38: Agregar la clave SHOWMSG y dejar INTERACTIVE para un diálogo interactivo (Agregado en v1.19.39) +* 16/12/2014 Mike Potjer Mejora v1.19.38: Cuando se procesa un directorio con foxbin2prg.exe solo y la clave INTERACTIVE, mostrar un diálogo para preguntar qué procesar (Agregado en v1.19.39) +* 30/12/2014 Ryan Harris Reporte bug dbc v1.19.38: Los datos de DisplayClass y DisplayClassLibrary tenían el valor de "Default" en vez del propio (Agregado en v1.19.39) +* 06/01/2015 Jim Nelson Mejora v1.19.39: Permitir configurar la barra de progreso para que solamente aparezca cuando se procesan múltiples archivos y no cuando se procesa solo 1 (Agregado en v1.19.40) +* 06/01/2015 Mike Potjer Reporte bug db2: [Error 12, Variable "TCOUTPUTFILE" is not found] cuando DBF_Conversion_Support=4 y el archivo de salida es igual al generado (Agregado en v1.19.40) +* 13/01/2015 Ryan Harris Reporte bug vcx/scx v1.19.40: Detección errónea de estructuras PROCEDURE/ENDPROC cuando se usan como parámetros LPARAMETERS en línea aparte (Arreglado en v1.19.41) +* 24/01/2015 Ryan Harris Mejora dc2 v1.19.41: Permitir ordenar los campos de vistas y tablas alfabéticamente y mantener en una lista aparte el orden real, para facilitar el diff y el merge (Agregado en v1.19.42) +* 24/01/2015 Ryan Harris Mejora dc2 v1.19.41: Aplicar ClassPerFile a las conexiones, tablas, vistas y stored procedures de los DBC (Agregado en v1.19.42) +* 22/01/2015 Tuvia Vinitsky Reporte bug v1.19.41: Compatibilidad con SourceSafe rota porque se genera un error al realizar la consulta para soporte de archivo (Arreglado en v1.19.42) +* 25/02/2015 LScheffler Reporte de Bug scx/vcx v1.19.41: Procesar solo un nivel de text/endtext, ya que no se admiten más niveles (Arreglado en v1.19.42) +* 25/02/2015 LScheffler Mejora v1.19.41: Hacer algunos mensajes de error más descriptivos (Agregado en v1.19.42) +* 03/03/2015 LScheffler Mejora v1.19.41: Mejoras en la traducción al alemán (Agregado en v1.19.42) +* 03/03/2015 LScheffler Mejora v1.19.41: Permitir definir el archivo de entrada con un path relativo (Agregado en v1.19.42) +* 03/03/2015 LScheffler Reporte bug scx v1.19.41: Agregada la generación del PJX/PJ2 cuando se indica "file.pjx", "*" (Agregado en v1.19.42) +* 03/03/2015 LScheffler Mejora v1.19.41: Permitir proceso multi-proyecto (*.PJX, *.PJ2) cuando se especifica "file.pjx", "*" (Agregado en v1.19.42) +* 05/03/2015 LScheffler Mejora v1.19.41: Cambiar clase de base de FoxBin2Prg de custom a session (Agregado en v1.19.42) +* 05/03/2015 LScheffler Mejora v1.19.41: Permitir procesar los archivos de un proyecto sin convertir el PJX/2 (Agregado en v1.19.42) +* 10/03/2015 LScheffler Mejora v1.19.41: Permitir configurar un CFG alternativo (Agregado en v1.19.42) +* 10/03/2015 LScheffler Mejora v1.19.41: Crear un método API get_Processed() para obtener información de los archivos procesados (Agregado en v1.19.42) +* 10/03/2015 LScheffler Mejora v1.19.41: Permitir salida de archivos procesados a stdOut (Agregado en v1.19.42) +* 23/03/2015 LScheffler Reporte bug mnx v1.19.41: No se mantiene el Pad vacío al regenerar el menú cuando se define un menu con un Pad sin nombre (Arreglado en v1.19.42) +* 24/03/2015 Ryan Harris Reporte bug frx/lbx v1.19.41: Hay algunos CR,LF,TAB sobrantes en las etiquetas tag de algunos archivos FR2/LB2 (Arreglado en v1.19.42) +* 24/03/2015 Ryan Harris Mejora v1.19.41: Borrar archivos ERR al procesar, cuando se usa UseClassPerFile (Agregado en v1.19.42) +* 10/04/2015 LScheffler Mejora v1.19.41: Crear un método API get_DirSettings() para obtener información de seteos del directorio indicado (Agregado en v1.19.42) +* 12/04/2015 LScheffler Mejora v1.19.41: Permitir generar texto de una clase de una librería (Agregado en v1.19.42) +* 15/04/2015 Mike Potjer Sugerencia v1.19.41: Los nombres de los métodos en Inglés facilitarían su entendimiento a más personas (Agregado en v1.19.42) +* 22/04/2015 Ryan Harris Mejora v1.19.42: Permitir que FoxBin quite los ZOrderProps de los objetos que cambian constantemente, provocan diferencias y a veces dan problemas de objeto encima/debajo (Agregado en v1.19.43) +* 23/04/2015 LScheffler Mejora v1.19.42: Hacer que la progressbar no se convierta en la ventana de salida por defecto de los ? (Agregado en v1.19.43) +* 28/04/2015 Ralf Wagner Reporte bug v1.19.42: FoxBin2Prg no retorna códigos de error cuando se llama como programa externo (Arreglado en v1.19.43) +* 29/04/2015 Fidel Charny Reporte bug v1.19.42: FoxBin2Prg a veces genera errores OLE cuando se ejecuta más de una vez en modo objeto sobre un archivo con errores (Arreglado en v1.19.43) +* 10/05/2015 Esteban Herrero Reporte bug v1.19.42: Cuando un form tiene AutoCenter=.T., hay veces en que al regenerar el binario y ejecutarlo no se muestra centrado (Arreglado en v1.19.43) +* 29/04/2015 Ralf Wagner Reporte bug v1.19.43: En ciertos PCs FoxBin2Prg no retorna códigos de error cuando se llama como programa externo (Arreglado en v1.19.44) +* 01/06/2015 Mike Potjer Reporte bug v1.19.44: Cuando se exporta a texto un menu que usa comillas simples o una expresión en el mensaje de las opciones, al regenerar el binario se recortan partes del mensaje de esas opciones (Arreglado en v1.19.45) +* 09/06/2015 LScheffler Reporte bug v1.19.44: Cuando se procesan múltiples archivos PJ2, puede ocurrir un error de "variable llError no definida" (Arreglado en v1.19.45) +* 13/06/2015 Matt Slay Reporte bug v1.19.44: Los proyectos PJX/PJ2 que referencian archivos de otras unidades de disco causan errores ne esos archivos al procesar con las opciones "*" o "*-" (Arreglado en v1.19.45) +* 29/07/2015 Dave Crozier Reporte bug v1.19.45: Cuando se procesa un directorio o un proyecto con todos los archivos, a veces puede ocurrir el error "Alias already in use" (Arreglado en v1.19.46) +* 29/07/2015 Walter Nicholls Mejora DBF-Data v1.19.45: Permitir exportar e importar datos de los DBF +* 28/08/2015 Walter Nicholls Reporte bug: Cuando se usa '&&' en los textos de las opciones, se corrompe el binario del menú al regenerarlo (Arreglado en v1.19.46) +* 09/09/2015 Aurélien Dellieux Mejora v1.19.45: El objeto WSscript.Shell da problemas en algunos entornos o bajo ciertas condiciones (Cambiado en v1.19.46) +* 11/09/2015 Ryan Harris Reporte bug Frx/Lbx v1.19.45: El ordenamiento de registros de los reportes cambia el orden Z de los objetos próximos que se solapan, pudiendo causar que se visualicen mal (Arreglado en v1.19.46) +* 17/09/2015 Ryan Harris Reporte bug Frx/Lbx v1.19.45: Cuando se regeneran reportes o etiquetas con textos multilinea alineados al centro o a la derecha, la alineación no es completamente correcta (Arreglado en v1.19.46) +* 11/10/2015 LScheffler Reporte bug Frx/Lbx v1.19.45: Cuando se agrupan controles en diseńo y se convierte a texto, al regenerar se pierden las agrupaciones (Arreglado en v1.19.46 Preview-7) +* 04/11/2015 Ralf Wagner Reporte bug Pjx v1.19.45: Los archivos SPR y MPR no estan bien representados en la información del proyecto (Arreglado en v1.19.46 Preview-8) +* 20/11/2015 EddieC Reporte bug Pjx v1.19.45: Se genera un error al regenerar un PJX desde un PJ2 donde algún archivo contiene paréntesis (Arreglado en v1.19.46 Preview-9) +* 24/11/2015 edyshor Mejora dbf v1.19.45: Nuevo parámetro ExcludeDBFAutoincNextval para evitar diferencias por este dato (Agregado en v1.19.46 Preview-9) +* 01/02/2016 Aurélien Dellieux Reporte bug v1.19.45: Cuando se procesa un archivo en el directorio raiz, se genera un error 2062 (Arreglado en v1.19.46 Preview-10) +* 10/02/2016 Alejandro Sosa Reporte bug v1.19.46: Cuando se indica como nombre de archivo "*" y como tipo "*", se regeneran automáticamente todos los archivos binarios desde los archivos de texto (Arreglado en v1.19.47 Preview-1) +* 24/06/2016 Andy Kasper Reporte bug v1.19.47: Error en variable usada en una de las traducciones al Alemán (Arreglado en v1.19.48 Preview-1) +* 24/06/2016 Andy Kasper Reporte bug v1.19.47: Posición de menú BEFORE siempre cambiada a AFTER al convertir (Arreglado en v1.19.48 Preview-1) +* 30/06/2016 Nathan Brown Reporte bug v1.19.47: No se respetan algunas restricciones de conversión para DBFs cuando se usan CFGs particulares por tabla (Arreglado en v1.19.48 Preview-2) +* 30/06/2016 Nathan Brown Reporte bug v1.19.47: Cuando se usa ExcludeDBFAutoincNextval: 1 en FoxBin2Prg.cfg y a la vez la importación de datos de una tabla con campo AutoInc, se produce el error "Error 2088, Field is read-only" (Arreglado en v1.19.48 Preview-3) +* 10/07/2016 Nathan Brown Reporte defecto v1.19.48-Preview3: Cuando se arregló el bug del memo multi-línea, se introdujo un nuevo defecto por el cual un memo de linea-simple se decodifica mal (Arreglado en v1.19.48 Preview-4) +* 11/07/2016 Nathan Brown Reporte bug pj2 v1.19.48-Preview4: Cuando se regenera el binario de un PJ2 con archivos en una ruta con paréntesis y espacios, se genera un error "Error 36, Command contains unrecognized phrase/keyword" (Arreglado en v1.19.48 Preview-5) +* 11/07/2016 Nathan Brown Reporte bug frx v1.19.48-Preview5: Los ControlSource de objetos OLE que contienen comillas se generan mal (Arreglado en v1.19.48 Preview-6) +* 23/03/2017 LScheffler Reporte bug vcx v1.19.48: No funciona la generación de una clase individual con "classlib.vcx::classname" (Arreglado en v1.19.49) +* 23/03/2017 LScheffler Mejora vcx v1.19.48: Poder importar una clase (VC2 generado con ClassPerFile) en un VCX existente (Agragado en v1.19.49) +* 30/03/2017 Alejandro A Sosa Reporte bug frx v1.19.48: Cuando dentro de una expresión se usa "&&", se corrompe el registro del FRX generado (Arreglado en v1.19.49) +* 28/03/2017 LScheffler Mejora cfg v1.19.48: En modo objeto permitir indicar un objeto CFG en lugar de un archivo CFG (Agragado en v1.19.49) +* 06/04/2017 Doug Hennig Reporte Bug y arreglo parcial PJX v1.19.48: No se estaba guardando el campo User en los archivos PJX (Agregado en v1.19.49) +* 28/11/2017 LScheffler Reporte Bug vx2 v1.19.49: No exporta los objetos a VX2 cuando se usa ClassPerFile (Arreglado en v1.19.49.2) +* 31/08/2017 Jerry Stager Reporte bug db2 v1.19.48: Los campos "Double" asumen 2 decimales cuando se definen con 0 decimales (Agregado en v1.19.49.3) +* 03/12/2017 LScheffler Reporte Bug vx2 v1.19.49: Cuando se usa ClassPerFile an Modo API y se importan clases simples, a veces sus nombres se toman sin comillas, provocando errores (Arreglado en v1.19.49.4) +* 18/12/2017 Doug Hennnig Reporte Bug dbf v1.19.49: Cuando se importan datos de un DB2 a DBF (con DBF_Conversion_Support = 8), los tabs al inicio de los memo se pierden (Arreglado en v1.19.49.5) +* 04/01/2018 Doug Hennnig Reporte Bug vcx/scx v1.19.49: FoxBin2Prg debería ignorar los registros que el diseńador de FoxPro ignora (Arreglado en v1.19.49.6) +* 04/01/2018 Doug Hennnig Reporte Bug vcx/scx v1.19.49: Cuando se regenera la propiedad _MemberData se agregan CR/LF por cada miembro, pudiendo provocar un error de "valor muy largo" (Arreglado en v1.19.49.6) +* 11/01/2018 Francisco Prieto Reporte Bug v1.19.49: Cuando se convierte la estructura de un DBF puede dar error si existe un campo llamado I o X (Arreglado en v1.19.49.7) +* 30/01/2018 Kirides Reporte Bug v1.19.49: Cuando se convierte a texto una libreria corrupta con registros duplicados, se genera el error "The specified key already exists" (Arreglado en v1.19.49.9) +* 12/03/2018 Darko Kezic Reporte Bug v1.19.50: Cuando se usa la equivalencia "extension: pj2=pjm" se debe manejar el pjm como un pj2 y no como un pjm de SourceSafe (Arreglado en v1.19.50.1) +* 15/03/2018 Darko Kezic Reporte Bug v1.19.50: Cuando se agregan archivos de texto no-VFP, como html,css,etc, en la sección de Text del proyecto, FoxBin2Prg no mantiene esta selección al regenerar el PJX, dejándolos en la sección Files (Arreglado en v1.19.50.3) +* 05/05/2018 SkySurfer1 Reporte Bug v1.19.51: Si se usa capitalización en la información de las vistas, entonces la información relacionada no se exporta correctamente o completamente y puede perderse (Arreglado en v1.19.51.1) +* 20/06/2018 Jairo A/Juan CP Reporte Bug v1.19.51: Cuando se exporta un DBF que pertenece a un DBC sin eventos, falla (Arreglado en v1.19.51.2) +* 09/07/2018 KIRIDES Reporte Bug v1.19.51: Error 1098, Cannot find ... [ENDT] that closes ... [TEXT] Issue#26 when there is a field named TEXT as first line-word (Se arregla en v1.19.51.3) +* 10/07/2018 Jochen Kauz Reporte Bug v1.19.51: El ordenamiento alfabético de los objetos de los ADD OBJECT puede causar que algunos objetos se creen en el orden erróneo, provocando comportamientos inesperados (Se arregla en v1.19.51.3) +* 14/03/2019 Tracy Pearson Reporte Bug v1.19.51: No se respetan las propiedades de VCX/SCX con nombre "note" (Se arregla en v1.19.51.6) +* 18/04/2019 DAJU78 Reporte Bug v1.19.51: La conversión de tablas falla si algún campo contiene una palabra reservada como UNIQUE (Se arregla en v1.19.51.6) +* 19/07/2019 Dan Lauer Reporte Bug v1.19.51: Manejo de AutoIncrement incompatible con Project Explorer (Arreglado en v1.19.49.6, con solución de Doug Hennnig) +* 13/11/2019 Eric Selje Reporte Bug v1.19.51: Incompatible with VFPA (#36) (Se arregla en v1.19.51.6) +* 31/03/2020 Ryan Harris Reporte Bug v1.19.51: Si alguno de los archivos-por-clase no tiene CR_LF al final, al ensamblar la clase se pueden superponer instrucciones de forma inválida (Se arregla en v1.19.51.6) +* 01/04/2020 FDBOZZO Bug report v1.19.51 No se respetan las propiedades de VCX/SCX con nombre "note" (Tracy Pearson) +* 14/02/2021 LScheffler Bug report v1.19.51 conversion dbf -> prg, error if only test mode (toFoxBin2Prg.l_ProcessFiles is false) +* 14/02/2021 LScheffler Bug report v1.19.51 conversion prg -> dbf, fields with .NULL. value are incorectly recreated +* 15/02/2021 LScheffler Bug report v1.19.52 processing directory, flush log file after loop instead of file +* 16/02/2021 LScheffler Bug report v1.19.52 conversion prg -> vcx, files per class could create one class multiple times +* 03/03/2021 LScheffler Bug report v1.19.53 DBF_Conversion_Condition, problem with macro expansion +* 04/03/2021 LScheffler Bug report v1.19.55 Inputfile in form classlib.class.vc2 AND RedirectClassType = 1 and Execute param tcRecompile = 1 +* generates classlib.class.vcx and tries to recompile classlib.vcx +* fails silent if classlib.vcx exists (compiles wrong lib), with message if not. +* 05/03/2021 LScheffler Bug report v1.19.56 For RedirectClassType = 2, Path was set wrong +* 09/03/2021 LScheffler Bug report v1.19.57 For RedirectClassType = 2, Path was set wrong +* 09/03/2021 LScheffler Bug report v1.19.57 RedirectClassType = 2, UseClassPerFile = 2 failed. +* 22/03/2021 LScheffler Bug report v1.19.59 DBF_Conversion_Condition was read, but never used +* 22/03/2021 LScheffler Bug report v1.19.59 DBF_Conversion_Order sets an index that later would be stored as structural index +* 22/03/2021 LScheffler Bug report v1.19.59 config options with text value fail, if line comment is set +* 16/03/2021 msueping BUG REPORT v1.19.57 Variable lnFileCount in get_filesfromdirectory +* 30/03/2021 Sergej s-s-a BUG REPORT v1.19.61 Ignoring extention in foxbin2prg.cfg +* 08/04/2021 jstagerGH BUG REPORT v1.19.62 Tables without indexes cause an error that the "Table ## is not marked as belonging to the ## database" +* 22/04/2021 LScheffler BUG REPORT v1.19.63 Converting MN2 to MNX ignores the programmer-defined Pad Name found in "Prompt Options" screen +* 21/04/2021 Jimrnelson BUG REPORT v1.19.63 Converting MN2 to MNX ignores the programmer-defined bar # found in "Prompt Options" screen +* 17/05/2021 LScheffler BUG REPORT v1.19.64 Options "-cCt" are not usable on command line base EXE. +* 05/08/2021 siara-cc BUG REPORT v1.19.65 Incorrect version number shown. +* 05/08/2021 siara-cc BUG REPORT v1.19.65 Tags missing on github. +* 05/08/2021 siara-cc BUG REPORT v1.19.65 Incorrect links on documentation. +* 05/11/2021 LScheffler BUG REPORT v1.19.66 Double classes in VCX +* 18/01/2022 Jimrnelson BUG REPORT v1.19.67 Converting MN2 to MNX ignores the programmer-defined "Pad Name" found in "Prompt Options" screen +* 23/02/2022 bjornhoeksel Bug REPORT v1.19.68 Missing class when building text file from corrupted VCX +* 23/02/2022 bjornhoeksel Bug REPORT v1.19.68 Creating a class, when an object is named equal to this class +* 16/03/2022 bjornhoeksel Bug REPORT v1.19.69 Last bar in menu files are in some situations not converted correctly back in the mnx file. +* 30/03/2022 bjornhoeksel Bug REPORT v1.19.70 Convert menu mn2 to mnx with skip for that contains a string with ; sign is missing part after that sign in mnx. + +* 05/04/2022 bjornhoeksel Bug REPORT v1.19.71 Problem converting trailing spaces to text on memos. +* 06/04/2022 LScheffler Bug REPORT v1.19.71 Problem on using "DBF_Conversion_Support" on table configuration file (LScheffler) +* 06/04/2022 LScheffler Bug REPORT v1.19.71 Problem converting intentionally trailing spaces to VarChar/VarBinary. +* 06/04/2022 bjornhoeksel Bug REPORT v1.19.71 Problem converting trailing spaces on line end in memo (bjornhoeksel) +* 08/04/2022 bjornhoeksel Bug REPORT v1.19.72 Problem converting trailing spaces on line end in memo (again) (bjornhoeksel) +* 13/05/2022 DanLauer Bug REPORT v1.19.73 Fix menu bars with shortcuts keys like KEY F6, "F6"; are lost. +* 08/06/2022 JoergSchneider Bug REPORT v1.19.74 Typo in German (JoergSchneider) +* 08/06/2022 JoergSchneider Bug REPORT v1.19.74 Multiple text2bin and bin2text conversion on MNX causes space grow (JoergSchneider) +* 10/06/2022 JoergSchneider Bug REPORT v1.19.75 On operation per folder, change of folder must change configuration (JoergSchneider) +* 16/03/2023 JoergSchneider Bug REPORT v1.19.76 Bin2Txt Operation on VCX loses leading spaces in Property Values #90 (JoergSchneider) +* 16/03/2023 LScheffler Bug REPORT v1.19.76 Txt2Bin Operation on VCX looses double ampersand in Property Values #91 (LScheffler) +* 17/03/2023 ericbarte Bug REPORT v1.19.76 Text2Bin on PJX errors out for projects with an attach icon that has a drive letter on its path. #93 (ericbarte) +* 04/08/2023 KestasL Bug REPORT v1.19.78 Bin2Text: Forms with ole controls conversion error (also: any vcx) +* +* +*--------------------------------------------------------------------------------------------------- +* TRAMIENTOS ESPECIALES DE ASIGNACIONES DE PROPIEDADES: +* PROPIEDAD ARREGLO Y EJEMPLO +*------------------------- -------------------------------------------------------------------------------------- +* _memberdata Se separan las definiciones en lineas para evitar una sola muy larga +* +*--------------------------------------------------------------------------------------------------- +*** LScheffler 2021-03-08: added optional set of parameters, config file +* Usage 1 +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (v! IN ) Nombre completo (fullpath) del archivo a convertir o nombre del directorio a procesar +* - En modo compatibilidad con Visual SourceSafe, se usa para preguntar el tipo de soporte de conversión para el tipo de archivo indicado +* tcType (v? IN ) Tipo de archivo de entrada +* - Si se indica "BIN2PRG", se procesa el directorio indicado para generar los TX2 +* - Si se indica "PRG2BIN", se procesa el directorio indicado para generar los BIN +* - Si se indica "SIMERR_I0", se simula un error de validación en el archivo de entrada +* - Si se indica "SIMERR_I1", se simula un error de programa en el archivo de entrada +* - Si se indica "SIMERR_O1", se simula un error de programa en el archivo de salida +* - Si se indica "*" y tc_InputFile es un PJX, se procesa todo el proyecto +* - En modo compatibilidad con Visual SourceSafe, indica el tipo de archivo a convertir +* tcTextName (v? IN ) Nombre del archivo texto. (Solo para compatibilidad con Visual SourceSafe) +* tlGenText (v? IN ) .T.=Genera Texto, .F.=Genera Binario. (Solo para compatibilidad con Visual SourceSafe) +* tcDontShowErrors (v? IN ) '1' para NO mostrar errores con MESSAGEBOX +* tcDebug (v? IN ) '1' para depurar en el sitio donde ocurre el error (solo modo desarrollo) +* tcDontShowProgress (v? IN ) '1' para NO mostrar la ventana de progreso +* tcOriginalFileName (v? IN ) Sirve para los casos en los que inputFile es un nombre temporal y se quiere generar +* el nombre correcto dentro de la versión texto (por ej: en los PJ2 y las cabeceras) +* tcRecompile (v? IN ) Indica recompilar ('1') el binario una vez regenerado. [Cambio de funcionamiento por defecto] +* Este cambio es para ganar tiempo, velocidad y seguridad. Además la recompilación que hace FoxBin2Prg +* se hace desde el directorio del archivo, con lo que las referencias relativas pueden +* generar errores de compilación, típicamente los #include. +* NOTA: Si en vez de '1' se indica un Path (p.ej, el del proyecto, se usará como base para recompilar +* tcNoTimestamps (v? IN ) Indica si se debe anular el timestamp ('1') o no ('0' ó vacío) +* tcCFG_File (v? IN ) Indica si se debe usar un archivo de configuración distinto al predeterminado +*** DH 2021-03-04: added tcOutputFolder parameter +* tcOutputFolder (v? IN ) The output folder to write to (optional: if it isn't specified, the same folder as the source is used) +*--------------------------------------------------------------------------------------------------- +* Ej: DO FOXBIN2PRG.PRG WITH "C:\DESA\INTEGRACION\LIBRERIA.VCX" +*--------------------------------------------------------------------------------------------------- +*** DH 2021-03-04: added tcOutputFolder parameter +*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +*** LScheffler 2021-03-08: added optional set of parameters, config file +* Usage 2 +* PARAMETERS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (c! IN ) Modus (case sensitive) +* -c Create config template "tcType" with default values +* -C Create config "tcType" with values of directory named by outputfile +* -t Create config template "tcType" for config-per-table file +* tcType (v! IN ) file to create +*--------------------------------------------------------------------------------------------------- +*** LScheffler 2023-08-06: added option to output version number +* Usage 2 +* PARAMETERS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (c! IN ) Modus (case sensitive) +* -VERNO Return versio number (DC_FB2PRG_VERSION_REAL) +*--------------------------------------------------------------------------------------------------- +Lparameters tc_InputFile, tcType, tcTextName, tlGenText, tcDontShowErrors, tcDebug, tcDontShowProgress, tcOriginalFileName ; + , tcRecompile, tcNoTimestamps, tcCFG_File, tcOutputFolder + +*-- NO modificar! / Do NOT change! +#Define C_CMT_I '*--' +#Define C_CMT_F '--*' +#Define C_CLASSCOMMENTS_I '*' +#Define C_CLASSCOMMENTS_F '*' +#Define C_LEN_CLASSCOMMENTS_I Len(C_CLASSCOMMENTS_I) +#Define C_LEN_CLASSCOMMENTS_F Len(C_CLASSCOMMENTS_F) +#Define C_CLASSDATA_I '*< CLASSDATA:' +#Define C_CLASSDATA_F '/>' +#Define C_LEN_CLASSDATA_I Len(C_CLASSDATA_I) +#Define C_EXTERNAL_CLASS_I '*< EXTERNAL_CLASS:' +#Define C_EXTERNAL_CLASS_F '/>' +#Define C_LEN_EXTERNAL_CLASS_I Len(C_EXTERNAL_CLASS_I) +#Define C_EXTERNAL_MEMBER_I '*< EXTERNAL_MEMBER:' +#Define C_EXTERNAL_MEMBER_F '/>' +#Define C_LEN_EXTERNAL_MEMBER_I Len(C_EXTERNAL_MEMBER_I) +#Define C_OBJECTDATA_I '*< OBJECTDATA:' +#Define C_OBJECTDATA_F '/>' +#Define C_LEN_OBJECTDATA_I Len(C_OBJECTDATA_I) +#Define C_OLE_I '*< OLE:' +#Define C_OLE_F '/>' +#Define C_LEN_OLE_I Len(C_OLE_I) +#Define C_DEFINED_PAM_I '*' +#Define C_DEFINED_PAM_F '*' +#Define C_LEN_DEFINED_PAM_I Len(C_DEFINED_PAM_I) +#Define C_LEN_DEFINED_PAM_F Len(C_DEFINED_PAM_F) +*SF 16.03.2023 +*mark property value section in classes, objects and forms +#Define C_DEFINED_PROPVAL_I '*' +#Define C_DEFINED_PROPVAL_F '*' +#Define C_LEN_DEFINED_PROPVAL_I Len(C_DEFINED_PROPVAL_I) +#Define C_LEN_DEFINED_PROPVAL_F Len(C_DEFINED_PROPVAL_F) +*/SF 16.03.2023 +#Define C_END_OBJECT_I '*< END OBJECT:' +#Define C_END_OBJECT_F '/>' +#Define C_LEN_END_OBJECT_I Len(C_END_OBJECT_I) +#Define C_FB2PRG_META_I '*< FOXBIN2PRG:' +#Define C_FB2PRG_META_F '/>' +#Define C_LIBCOMMENT_I '*< LIBCOMMENT:' +#Define C_LIBCOMMENT_F '/>' +#Define C_DEFINE_CLASS 'DEFINE CLASS' +#Define C_ENDDEFINE 'ENDDEFINE' +#Define C_TEXT 'TEXT' +#Define C_ENDTEXT 'ENDTEXT' +#Define C_PROCEDURE 'PROCEDURE' +#Define C_ENDPROC 'ENDPROC' +#Define C_WITH 'WITH' +#Define C_ENDWITH 'ENDWITH' +#Define C_SRV_HEAD_I '*' +#Define C_SRV_HEAD_F '*' +#Define C_SRV_DATA_I '*' +#Define C_SRV_DATA_F '*' +#Define C_DEVINFO_I '*' +#Define C_DEVINFO_F '*' +#Define C_BUILDPROJ_I '*' +#Define C_BUILDPROJ_F '*' +#Define C_PROJPROPS_I '*' +#Define C_PROJPROPS_F '*' +#Define C_FILE_META_I '*< FileMetadata:' +#Define C_FILE_META_F '/>' +#Define C_FILE_CMTS_I '*' +#Define C_FILE_CMTS_F '*' +#Define C_FILE_EXCL_I '*' +#Define C_FILE_EXCL_F '*' +#Define C_FILE_TXT_I '*' +#Define C_FILE_TXT_F '*' +#Define C_FB2P_VALUE_I '' +#Define C_FB2P_VALUE_F '' +#Define C_LEN_FB2P_VALUE_I Len(C_FB2P_VALUE_I) +#Define C_LEN_FB2P_VALUE_F Len(C_FB2P_VALUE_F) +#Define C_VFPDATA_I '' +#Define C_VFPDATA_F '' +#Define C_MEMBERDATA_I C_VFPDATA_I +#Define C_MEMBERDATA_F C_VFPDATA_F +#Define C_LEN_MEMBERDATA_I Len(C_MEMBERDATA_I) +#Define C_LEN_MEMBERDATA_F Len(C_MEMBERDATA_F) +#Define C_DATA_I '' +#Define C_TAG_REPORTE 'Reportes' +#Define C_TAG_REPORTE_I '<' + C_TAG_REPORTE + '>' +#Define C_TAG_REPORTE_F '' +#Define C_DBF_HEAD_I '' +#Define C_LEN_DBF_HEAD_I Len(C_DBF_HEAD_I) +#Define C_LEN_DBF_HEAD_F Len(C_DBF_HEAD_F) +#Define C_CDXIDX_I '' && SF written, but not read +#Define C_CDXIDX_F '' && SF written, but not read +#Define C_CDX_I '' && SF written, but not read +#Define C_CDX_Type_ 'Type="' +#Define C_CDX_Type_Struct 'Structural' +#Define C_CDX_Type_Compound 'Compound' +#Define C_CDX_Type_IDX 'Standalone' +#Define C_CDX_File_ 'File="' +#Define C_INDEXES_I '' && SF Read / write, no len, used w/o äDEFINE too, len +#Define C_INDEXES_F '' && SF Read / write, no len, used w/o äDEFINE too, len +#Define C_INDEX_I '' && SF used for read, not write? +#Define C_INDEX_F '' && SF used for read, not write? +*#Define C_LEN_CDX_I Len(C_CDX_I) && SF not used; deactivated +*#Define C_LEN_CDX_F Len(C_CDX_F) && SF not used; deactivated +*#Define C_LEN_INDEX_I Len(C_INDEX_I) && SF not used (possibly do to errornous definition of #DEFINE); deactivated +*#Define C_LEN_INDEX_F Len(C_INDEX_F) && SF not used (possibly do to errornous definition of #DEFINE); deactivated +#Define C_DATABASE_I '' +#Define C_DATABASE_F '' +#Define C_STORED_PROC_I '' +#Define C_TABLE_I '' +#Define C_TABLE_F '
' +#Define C_TABLES_I '' +#Define C_TABLES_F '' +#Define C_VIEW_I '' +#Define C_VIEW_F '' +#Define C_VIEWS_I '' +#Define C_VIEWS_F '' +#Define C_FIELD_ORDER_I '' +#Define C_FIELD_ORDER_F '' +#Define C_FIELD_I '' +#Define C_FIELD_F '' +#Define C_FIELDS_I '' +#Define C_FIELDS_F '' +#Define C_CONNECTION_I '' +#Define C_CONNECTION_F '' +#Define C_CONNECTIONS_I '' +#Define C_CONNECTIONS_F '' +#Define C_RELATION_I '' +#Define C_RELATION_F '' +#Define C_RELATIONS_I '' +#Define C_RELATIONS_F '' +#Define C_PROC_CODE_I '*' +#Define C_PROC_CODE_F '*' +#Define C_SETUPCODE_I '*' +#Define C_SETUPCODE_F '*' +#Define C_CLEANUPCODE_I '*' +#Define C_CLEANUPCODE_F '*' +#Define C_MENUCODE_I '*' +#Define C_MENUCODE_F '*' +#Define C_MENUTYPE_I '*' +#Define C_MENUTYPE_F '' +#Define C_MENULOCATION_I '*' +#Define C_MENULOCATION_F '' +*-- +#Define C_TAB Chr(9) +#Define C_CR Chr(13) +#Define C_LF Chr(10) +#Define C_NULL_CHAR Chr(0) +#Define CR_LF C_CR + C_LF +#Define C_MPROPHEADER Replicate( Chr(1), 517 ) + +*** DH 06/02/2014: added additional constants +#Define C_RECORDS_I '' +#Define C_RECORDS_F '' +#Define C_RECORD_I '' && *** FDBOZZO 2016/06/06: Quitado el REGNUM para evitar diferencias innecesarias +#Define C_RECORD_F '' +#Define C_DEL_RECORD_I '' && *** LScheffler 2021/02/20: Deleted Record, just mark like this, no fuzz with field name +#Define C_DEL_RECORD_F '' +#Define C_RECNO_I '' +#Define C_RECNO_F '' + +*-- Fin / End + +*-- From FOXPRO.H +*-- File Object Type Property +#Define FILETYPE_DATABASE "d" && Database (.DBC) +#Define FILETYPE_FREETABLE "D" && Free table (.DBF) +#Define FILETYPE_QUERY "Q" && Query (.QPR) +#Define FILETYPE_FORM "K" && Form (.SCX) +#Define FILETYPE_REPORT "R" && Report (.FRX) +#Define FILETYPE_LABEL "B" && Label (.LBX) +#Define FILETYPE_CLASSLIB "V" && Class Library (.VCX) +#Define FILETYPE_PROGRAM "P" && Program (.PRG) +#Define FILETYPE_PROJECT "J" && Project (.PJX) [NON STANDARD!] +#Define FILETYPE_APILIB "L" && API Library (.FLL) +#Define FILETYPE_APPLICATION "Z" && Application (.APP) +#Define FILETYPE_MENU "M" && Menu (.MNX) +#Define FILETYPE_TEXT "T" && Text (.TXT, .H., etc.) +#Define FILETYPE_OTHER "x" && Other file types not enumerated above + +*-- Menu OBJTYPE constants +#Define C_OBJTYPE_MENUTYPE_DEFAULT 1 +#Define C_OBJTYPE_MENUTYPE_BARorPOPUP 2 +#Define C_OBJTYPE_MENUTYPE_OPTION 3 +#Define C_OBJTYPE_MENUTYPE_SHORTCUT 4 +#Define C_OBJTYPE_MENUTYPE_MENUBARONTOP 5 + +*-- Menu OBJCODE constants +#Define C_OBJCODE_MENUBARPOPUP_MENUPAD 0 +#Define C_OBJCODE_MENUBARPOPUP_MENUBAR 1 +#Define C_OBJCODE_MENUDEFAULT_DEFAULT 22 +#Define C_OBJCODE_MENUOPTION_COMMAND 67 +#Define C_OBJCODE_MENUOPTION_SUBMENU 77 +#Define C_OBJCODE_MENUOPTION_BARNUM 78 +#Define C_OBJCODE_MENUOPTION_PROCEDURE 80 + +*-- Menu Location constants +#Define C_MENULOCATION_REPLACE 0 +#Define C_MENULOCATION_APPEND 1 +#Define C_MENULOCATION_BEFORE 2 +#Define C_MENULOCATION_AFTER 3 + +*-- Server Object Instancing Property +#Define SERVERINSTANCE_SINGLEUSE 1 && Single use server +#Define SERVERINSTANCE_NOTCREATABLE 2 && Instances creatable only inside Visual FoxPro +#Define SERVERINSTANCE_MULTIUSE 3 && Multi-use server + +*-- FileTypes for ADIR() +#Define C_FILETYPE_DIRECTORY "D" +#Define C_FILETYPE_FILE "F" +#Define C_FILETYPE_QUERYSUPPORT "Q" +*-- Fin / End + +*-- Predefine 64MB of RAM +Sys(3050,1,64*1024*1024) +Sys(3050,2,64*1024*1024) + +If _vfp.StartMode > 0 Then + Sys(2450,1) && Set Application Search Path Order to APP/EXE 1st when not in Dev-Mode +Endif + +Local loCnv As c_foxbin2prg Of 'FOXBIN2PRG.PRG' +Local lnResp, loEx As Exception + +*SET COVERAGE TO c:\desa\foxbin2prg\foxbin2prg_coverage.log +*SYS(2030,1) && Enable system component debugging +*SYS(2335,0) && Unnatended server mode +*IF PCOUNT() > 1 && Saltear las querys de SourceSafe sobre soporte de archivos +* SET STEP ON +* MESSAGEBOX( SYS(5)+CURDIR(),64+4096,PROGRAM(),5000) +*ENDIF + +*MESSAGEBOX( 'tc_InputFile = ' + TRANSFORM(tc_InputFile) + C_CR ; ++ 'tcType = ' + TRANSFORM(tcType) ) + +*-- En el caso de recibir "BIN2PRG" o "PRG2BIN" en el primer parámetro, los invierto. +tc_InputFile = Evl(tc_InputFile,'') +tcType = Evl(tcType,'') + +*!* Changed by: LScheffler 06.08.2023 +*!* change date="{^2023-08-06,14:29:00}" +* added option to return version number +If Atc('-VERNO','-'+tc_InputFile) > 0 + tc_InputFile = DC_FB2PRG_VERSION_REAL + RETURN DC_FB2PRG_VERSION_REAL +Endif &&Atc('-VERNO','-'+tc_InputFile) > 0 + +*!* /Changed by: LScheffler 06.08.2023 + + +*!* Changed by: LScheffler 15.2.2021 +*!* change date="{^2021-02-15,18:44:00}" +* added option to create config files +If Atc('-BIN2PRG','-'+tc_InputFile) > 0 Or Atc('-PRG2BIN','-'+tc_InputFile) > 0 ; + OR Atc('-SHOWMSG','-'+tc_InputFile) > 0; + Or Atc('-INTERACTIVE','-'+tc_InputFile) > 0 Or Atc('-?','-'+tc_InputFile) > 0 ; + OR Atc('-SIMERR_I0','-'+tc_InputFile) > 0 Or Atc('-SIMERR_I1','-'+tc_InputFile) > 0 ; + OR Atc('-SIMERR_O1','-'+tc_InputFile) > 0; + OR Upper(tc_InputFile)=='-C' Or tc_InputFile=='-t' ; + OR Upper(tc_InputFile)=='C' Or tc_InputFile=='t' Then + pcParamX = tc_InputFile + tc_InputFile = tcType + tcType = pcParamX + Release pcParamX +Endif + +* only 2 paras for -cCt +Do Case + Case Pcount()=1 And ( tcType == '-t' Or tcType == 't' ) And !Empty( Dbf() ) + tc_InputFile = Dbf() + '._cfg' + + Case Pcount()=1 And ( Upper( tcType ) =='-C' Or Upper( tcType ) =='C' ) + tc_InputFile = 'FoxBin2PRG._cfg' + + Case Pcount()#2 And ( Upper( tcType ) =='-C' Or tcType =='-t' Or Upper( tcType ) =='C' Or tcType =='t' ) + tc_InputFile = "" + tcType = "" + +Endcase +*!* /Changed by: LScheffler 15.2.2021 + +Try + loEx = Null + loCnv = Createobject("c_foxbin2prg") +*** DH 2021-03-04: handle tcOutputFolder + If Not Empty(tcOutputFolder) + loCnv.cOutputFolder = tcOutputFolder + Endif &¬ empty(tcOutputFolder) +*** DH 2021-03-04: end of new code + + lnResp = loCnv.execute( tc_InputFile, tcType, tcTextName, tlGenText, tcDontShowErrors, tcDebug ; + , tcDontShowProgress, Null, @loEx, .F., tcOriginalFileName, tcRecompile, tcNoTimestamps ; + , .F., .F., .F., tcCFG_File ) + Catch To loEx +*-- Esto solo es para errores en el INIT, ya que los demás se deben capturar y tratar antes. + lnResp = loEx.ErrorNo + Messagebox( 'Error ' + Transform(loEx.ErrorNo) + ', ' + loEx.Message + C_CR ; + + loEx.Procedure + ', Line ' + Transform(loEx.Lineno) + C_CR ; + + loEx.Details ; + , 0+16+4096 ; + , '' ; + , 60000 ) +Endtry + +AddProperty(_Screen, 'ExitCode', lnResp) +*SET COVERAGE TO + +If _vfp.StartMode <> 4 Or Not Sys(16) == Sys(16,0) && 4 = Visual FoxPro was started as a distributable .app or .exe file. + Store Null To loEx, loCnv + Release loEx, loCnv + Return lnResp && lnResp contiene un código de error, pero invocado desde SourceSafe puede contener el tipo de soporte de archivo (0,1,2). +Endif + +If Empty(lnResp) + Store Null To loEx, loCnv + Release loEx, loCnv + Quit +Endif + +Store Null To loEx, loCnv +Release loEx, loCnv + +*-- Muy útil para procesos batch que capturan el código de error +*KillMode 1 +*DECLARE ExitProcess IN Win32API INTEGER ExitCode && To read returned error code with ERRORLEVEL from Windows +*ExitProcess(1) && Esta debe ser de las últimas instrucciones + +*KillMode 2 - This one works better. +Declare Integer OpenProcess In Win32API Integer dwDesiredAccess, Integer bInheritHandle, Integer dwProcessID +lnHandle = OpenProcess(1, 1, _vfp.ProcessID) +Declare Integer TerminateProcess In Win32API Integer hProcess, Integer uExitCode +=TerminateProcess(lnHandle,1) + +*KillMode 3 +*lcComputer = [.] +*loCIMV2 = GETOBJECT( [winmgmts:{impersonationLevel=impersonate}!\\] + lcComputer + [\root\cimv2] ) +*loProcCols = loCIMV2.ExecQuery( [select * from Win32_Process where processid=] + TRANSFORM(_VFP.PROCESSID) + [] ) +*loCIMV2 = NULL +*loProcCols.ItemIndex(0).TERMINATE(1) + + + + +Define Class c_foxbin2prg As Session + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + + +*!* ;&& SF -> String to long +*!* + [] ; +*!* + [] ; +*!* + [] ; +*!* + [] ; +*!* + [] ; +*!* + [] ; +*!* + [] ; +*!* + [] ; +*!* + [] ; +*!* + [] ; + + Dimension a_ProcessedFiles(1, 6) + Protected n_CFG_Actual, l_Main_CFG_Loaded, o_Configuration, l_CFG_CachedAccess +*-- + n_FB2PRG_Version = DN_FB2PRG_VERSION + c_FB2PRG_Version_Real = DC_FB2PRG_VERSION_REAL +*-- + c_Language = '' && EN, FR, ES, DE + c_Language_In = '(auto)' + c_SimulateError = '' && SIMERR_I0, SIMERR_I1, SIMERR_O1 + c_loc_processing_file = '' + c_loc_process_progress = '' + c_FB2PRG_EXE_Version = '' + c_Foxbin2prg_FullPath = '' + c_Foxbin2prg_ConfigFile = '' + c_CurDir = '' + c_TempDir = Sys(2023) + c_InputFile = '' + c_ClassToConvert = '' && Guarda el nombre de la clase a convertir, indicada en tcInputFile como "archivo.vcx::clase" + c_ClassOperationType = '' && (I)mport o (E)xport. Se usa solo para manejar clases individuales. + c_OriginalFileName = '' + c_LogFile = '' + c_ErrorLogFile = '' + c_TextLog = '' + c_OutputFile = '' + c_Recompile = '1' + c_Type = '' + t_InputFile_TimeStamp = {//::} + t_OutputFile_TimeStamp = {//::} + lFileMode = .F. + n_ExisteCapitalizacion = -1 + l_CFG_CachedAccess = .F. + n_CFG_EvaluateFromParam = 0 + n_Debug = 0 + n_BodyDevInfo = 0 && Indica si se debe incluir el campo DevInfo en el cuerpo de los pjx/pj2 + l_Error = .F. && Indicador de errores del proceso actual + l_Errors = .F. && Indicador de error de la sesión actual, acumulativo de todos los procesos + c_TextErr = '' + l_Test = .F. + l_ShowErrors = .T. + n_ShowProgressbar = 1 + n_ForceWriteIfReadOnly = 0 + l_AutoClearProcessedFiles = .T. && Por defecto limpia archivos procesados entre ejecución y ejecución + l_ProcessFiles = .T. && Por defecto procesa los archivos. En .F. sirve para obtener sus nombres sin reescribirlos. + l_CancelWithEscKey = .T. + l_RemoveNullCharsFromCode = .T. + l_RemoveZOrderSetFromProps = .F. + l_Recompile = .T. + n_PRG_Compat_Level = 0 && 0=COMPATIBLE WITH FoxBin2Prg v1.19.49 and earlier, 1=Include HELPSTRING + n_ExcludeDBFAutoincNextval = 0 +*!* Changed by: LScheffler 21.02.2021 +*!* change date="{^2021-02-21,10:57:00}" +* additional options controlling +* - splitt of DBC separated from VCX/SCX +* - new operations of DBF + l_OldFilesPerDBC = .T. + n_UseFilesPerDBC = 0 + l_RedirectFilePerDBCToMain = .F. + l_ItemPerDBCCheck = .F. + l_DBF_BinChar_Base64 = .T. + l_DBF_IncludeDeleted = .F. +*!* /Changed by: LScheffler 21.02.2021 +*!* Changed by: LScheffler 19.03.2023 +* additional options controlling +* files in non subpath of the PJX + n_CheckFileInPath = 0 +*!* /Changed by: LScheffler 19.03.2023 + n_UseClassPerFile = 0 + n_PRG_Compat_Level = 0 && 0=COMPATIBLE WITH FoxBin2Prg v1.19.49 and earlier, 1=Include HELPSTRING + n_ExcludeDBFAutoincNextval = 0 + l_ClassPerFileCheck = .F. + l_RedirectClassPerFileToMain = .F. + n_RedirectClassType = 0 && 0=Redireccionar Todas las clases, 1=Redireccionar solo la clase indicada + l_NoTimestamps = .T. + c_BackgroundImage = '' + l_ClearUniqueID = .T. + l_ClearDBFLastUpdate = .T. + n_OptimizeByFilestamp = 0 + l_MethodSort_Enabled = .T. && Para Unit Testing se puede cambiar a .F. para buscar diferencias + l_PropSort_Enabled = .T. && Para Unit Testing se puede cambiar a .F. para buscar diferencias + l_ReportSort_Enabled = .F. && Para Unit Testing. 11/09/2015 - Cambiad a .F. porque cambia el ZOrder de los objetos (Ryan Harris) + l_StdOutHabilitado = .T. + l_Main_CFG_Loaded = .F. + n_ExtraBackupLevels = 1 + n_ClassTimeStamp = 1130668032 && 2013/11/04 20:00:00 + n_CFG_Actual = 0 + n_ID = 0 + n_FileHandle = 0 + n_Order_View_Fields = 1 + n_ProcessedFiles = 0 && Contador usado para los archivos file.class.ext + n_ProcessedFilesCount = 0 && Contador genérico de procesados + o_Conversor = Null + o_Frm_Avance = Null + o_WSH = Null + o_FSO = Null && Scripting.FileSystemObject + o_TextStream = Null && Scripting.TextStream + o_FNC = Null && Filename_caps object + o_Configuration = Null + run_AfterCreateTable = '' + run_AfterCreate_DB2 = '' + c_PJ2 = 'PJ2' && PJX + c_VC2 = 'VC2' && VCX + c_SC2 = 'SC2' && SCX + c_FR2 = 'FR2' && FRX + c_LB2 = 'LB2' && LBX + c_MN2 = 'MN2' && MNX + c_DB2 = 'DB2' && DBF + c_DC2 = 'DC2' && DBC + c_FK2 = 'FK2' && FKY + c_ME2 = 'ME2' && MEM + n_PJX_Conversion_Support = 2 + n_VCX_Conversion_Support = 2 + n_SCX_Conversion_Support = 2 + n_FRX_Conversion_Support = 2 + n_LBX_Conversion_Support = 2 + n_MNX_Conversion_Support = 2 + n_DBC_Conversion_Support = 2 + n_DBF_Conversion_Support = 1 + n_FKY_Conversion_Support = 1 + n_MEM_Conversion_Support = 1 + c_DBF_Conversion_Included = '' + c_DBF_Conversion_Excluded = '' +*** DH 2021-03-04: added cOutputFolder and n_HomeDir properties + cOutputFolder = '' && the folder to write files to (blank = same folder as source file) + n_HomeDir = 1 && 0 = don't save HomeDir in PJ2, 1 = save HomeDir in PJ2 + + Procedure Init + Lparameters tcCFG_File, tcCancelWithEscKey + + #If .F. + Local This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Local lcSys16, lnPosProg, lc_Foxbin2prg_EXE, laValues(1,5), lcPicturePath, laDir(1,5) ; + , lcLang + Set Deleted On + Set Date YMD + Set Hours To 24 + Set Century On + Set Safety Off + Set Multilocks On + Set TablePrompt Off + Set Point To '.' + Set Separator To ',' + tcCancelWithEscKey = Evl(tcCancelWithEscKey, '') + + If Not Empty(tcCancelWithEscKey) + This.l_CancelWithEscKey = ( tcCancelWithEscKey == '1' ) + Endif + + This.declareDLL() + +* Check if SYS(2023) point to "Program Files" + If Atc("\PROGRAM FILES", This.c_TempDir) > 0 Or Atc("\ARCHIVOS DE PROGRAMA", This.c_TempDir) > 0 + This.c_TempDir = Getenv("TEMP") + Endif + + This.c_LogFile = Addbs( This.c_TempDir ) + 'FoxBin2Prg_Debug.LOG' + This.c_ErrorLogFile = Addbs( This.c_TempDir ) + 'FoxBin2Prg_Error.LOG' + + If Adir(laDir, This.c_ErrorLogFile) > 0 Then + If Adir(laDir, This.c_ErrorLogFile + '.BAK') > 0 Then + This.changeFileAttribute( This.c_ErrorLogFile + '.BAK', '-R-S-H' ) + Erase (This.c_ErrorLogFile + '.BAK') + Endif + + This.changeFileAttribute( This.c_ErrorLogFile, '-R-S-H' ) + Rename (This.c_ErrorLogFile) To (This.c_ErrorLogFile + '.BAK') + Endif + + If Adir(laDir, This.c_LogFile) > 0 Then + Erase (This.c_LogFile + '.BAK') + Rename (This.c_LogFile) To (This.c_LogFile + '.BAK') + Endif + + lcSys16 = Sys(16) + If Left(lcSys16,10) == 'PROCEDURE ' + lnPosProg = At(" ", lcSys16, 2) + 1 + Else + lnPosProg = 1 + Endif + + This.c_CurDir = Sys(5) + Curdir() && Directorio actual, que no necesariamente es donde está FoxBin2Prg + This.c_Foxbin2prg_FullPath = Substr( lcSys16, lnPosProg ) + This.c_Foxbin2prg_ConfigFile = Evl( tcCFG_File, Forceext( This.c_Foxbin2prg_FullPath, 'CFG' ) ) + This.c_BackgroundImage = This.get_AbsolutePath( Addbs(Justpath(This.c_Foxbin2prg_FullPath)) + 'foxbin2prg.jpg' ) + lc_Foxbin2prg_EXE = Forceext( This.c_Foxbin2prg_FullPath, 'EXE' ) +*!* Changed by: LScheffler 30.8.2021 +*!* +*!* Changed by: LScheffler
+*!* https://github.com/fdbozzo/foxbin2prg/issues/69 / Incorrect version showing for v1.19.65 +*!* Set version number to This.c_FB2PRG_Version_Real and ignore Exe +*!*
+*!*
+ +* This.c_FB2PRG_EXE_Version = 'v' + Iif( Agetfileversion( laValues, lc_Foxbin2prg_EXE ) = 0, Transform(This.c_FB2PRG_Version_Real), laValues(11) ) + This.c_FB2PRG_EXE_Version = 'v' + Transform(This.c_FB2PRG_Version_Real) + +*!* /Changed by LScheffler 30.8.2021 + + AddProperty(_Screen, 'c_FB2PRG_EXE_Version', This.c_FB2PRG_EXE_Version) + AddProperty(_Screen, 'ExitCode', 0) + + This.writeLog( Replicate( '*', 100 ) ) + This.writeLog( 'FoxBin2Prg INIT -', 2 ) + This.writeLog( Replicate( '*', 100 ) ) + This.writeLog( 'FoxBin2Prg: [' + This.c_Foxbin2prg_FullPath + '] (EXE Version: ' + This.c_FB2PRG_EXE_Version + ', FoxPro Version: ' + Version(4) + ')' ) + This.writeLog( Textmerge( '- Internal CFG: <> / External CFG: <> / CodePage Used: <>)' ) ) + +* Get default language info +* ISO 639-2 Language Codes: https://www.loc.gov/standards/iso639-2/php/code_list.php + lcLang = This.getLocaleInfo(0x00000067) && ie: spa + + Do Case + Case lcLang = 'spa' + lcLang = 'ES' + Case Inlist(lcLang, 'den', 'deu', 'ger', 'gmh', 'goh', 'gsw', 'nds') + lcLang = 'DE' + Case Inlist(lcLang, 'cpf', 'fra', 'fre', 'frm', 'fro') + lcLang = 'FR' + Otherwise && Default: EN + lcLang = 'EN' + Endcase + + This.changeLanguage(lcLang) + + This.o_FSO = Createobject("Scripting.FileSystemObject") +*THIS.o_WSH = CREATEOBJECT("WScript.Shell") + This.o_Configuration = Createobject("COLLECTION") + This.evaluateConfiguration() + Release lcSys16, lnPosProg, lc_Foxbin2prg_EXE, laValues + Return + Endproc + + + Procedure Destroy + Try + Local lcFileCDX + lcFileCDX = Forcepath( "TABLABIN.CDX", Justpath(This.c_InputFile) ) + + Erase ( lcFileCDX ) + + This.writeLog( 'FoxBin2Prg UNLOAD -', 2 ) + This.writeLog( Replicate( '*', 100 ) ) + This.writeLog( ) + This.writeLog_Flush() + This.unloadProgressbarForm() + This.o_Configuration = Null + This.o_WSH = Null + This.o_FSO = Null + If Vartype(_Screen.o_FoxBin2Prg_Lang) = "O" Then + _Screen.o_FoxBin2Prg_Lang = Null + Endif + Catch + + Finally + This.o_FSO = Null + This.o_WSH = Null + This.o_FNC = Null +*-- Funciones para changeFileAttributes + Clear Dlls fb2p_SetFileAttributes, fb2p_GetFileAttributes +*-- Funciones para escribir en StdOut + Clear Dlls fb2p_GetStdHandle, fb2p_WriteFile +*-- Funciones para changeFileTime + Clear Dlls fb2p_SetFileTime, fb2p_GetFileAttributesEx, fb2p_LocalFileTimeToFileTime ; + , fb2p_FileTimeToSystemTime, fb2p_SystemTimeToFileTime, fb2p_lopen, fb2p_lclose + Endtry + + Return + Endproc + + + Procedure addProcessedFile +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFile (v? IN ) Path del archivo (ej: 'C:\DESA\pruebas varias\lib.vcx') +* tcInOutType (v? IN ) Archivo de entrada o de salida ("I"=Input file, "O"=Output file) +* tcProcessed (v? IN ) Procesado ("P0"=Not Processed, "P1"=Processed) +* tcHasErrors (v? IN ) Tuvo Errores ("E0"=No Errors, "E1"=Has Errors) +* tcSupported (v? IN ) Archivo soportado ("S0"=Unsupported, "S1"=Supported) +* tcExpanded (v? IN ) Tipo de archivo ("X0"=Normal file, "X1"=Expanded multipart file) +*--------------------------------------------------------------------------------------------------- + Lparameters tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded + + Local llAdded + + If Not Empty(tcFile) Then + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' +*-- Buscar si fue procesado antes + If Not .wasProcessed(tcFile) Then + .n_ProcessedFiles = .n_ProcessedFiles + 1 + Dimension .a_ProcessedFiles(.n_ProcessedFiles, 6) + .a_ProcessedFiles(.n_ProcessedFiles, 1) = tcFile + .a_ProcessedFiles(.n_ProcessedFiles, 2) = Evl(tcInOutType, '') + .a_ProcessedFiles(.n_ProcessedFiles, 3) = Evl(tcProcessed, '') + .a_ProcessedFiles(.n_ProcessedFiles, 4) = Evl(tcHasErrors, '') + .a_ProcessedFiles(.n_ProcessedFiles, 5) = Evl(tcSupported, '') + .a_ProcessedFiles(.n_ProcessedFiles, 6) = Evl(tcExpanded, '') + llAdded = .T. + Endif + Endwith + Endif + + Return llAdded + Endproc + + + Procedure wasProcessed +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFileMask (v! IN ) Fullpath del archivo del que se desea saber si se procesó +*--------------------------------------------------------------------------------------------------- + Lparameters tcFile, tnID + + tnID = 0 + + If This.n_ProcessedFiles = 0 + Return .F. + Endif + + tnID = Ascan( This.a_ProcessedFiles, tcFile, 1, 0, 1, 1+2+4 ) + + Return (tnID > 0) + Endproc + + + Procedure updateProgressbar + Lparameters tcTexto, tnValor, tnTotal, tnTipo + + Try +*-- Si o_Frm_Avance se habilitó de forma externa, n_ShowProgressbar podría ser 0 para controlarlo desde fuera. + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If Vartype(.o_Frm_Avance) = "O" Then +*-- Cuando esta rutina se invoca desde el script, este método es el #1 y no puede cancelarse todavía + If .o_Frm_Avance.l_Cancelled And Program(-1) > 1 Then + Error 1799 + Endif + .o_Frm_Avance.updateProgressbar( tcTexto, tnValor, tnTotal, tnTipo ) + Endif + Endwith + + Catch + Throw + Endtry + Endproc + + + Procedure changeLanguage + Lparameters tcLanguageId + _Screen.AddProperty( "o_FoxBin2Prg_Lang", Createobject("CL_LANG", tcLanguageId) ) +*-- Localized properties + This.c_Language = _Screen.o_FoxBin2Prg_Lang.C_LANGUAGE_LOC + This.c_loc_processing_file = _Screen.o_FoxBin2Prg_Lang.C_PROCESSING_LOC + This.c_loc_process_progress = _Screen.o_FoxBin2Prg_Lang.C_PROCESS_PROGRESS_LOC + Endproc + + + Procedure clearProcessedFiles +*-- Limpia las estadísticas de archivos procesados que se usan para optimizar +*-- el procesamiento y evitar el reproceso de los mismos archivos, por ejemplo, +*-- de un mismo VCX compartido por 2 ó más proyectos. + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + .n_ProcessedFilesCount = 0 + .n_ProcessedFiles = 0 + Dimension .a_ProcessedFiles(1, 6) + .a_ProcessedFiles = '' +*-- Los errores previos también se limpian. + .l_Error = .F. + .l_Errors = .F. + Endwith + Endproc + + + Procedure declareDLL +*-- Funciones para escribir en StdOut + Declare Integer 'GetStdHandle' In WIN32API As fb2p_GetStdHandle Integer nHandleType + Declare Integer 'WriteFile' In WIN32API As fb2p_WriteFile Integer hFile, String @ cBuffer, Integer nBytes, Integer @ nBytes2, Integer @ nBytes3 +*-- Funciones para changeFileTime + Declare Integer 'SetFileTime' In WIN32API As fb2p_SetFileTime Integer hFile, String lpCreationTime, String lpLastAccessTime, String lpLastWriteTime + Declare Integer 'GetFileAttributesEx' In Win32API As fb2p_GetFileAttributesEx String lpFileName, Integer fInfoLevelId, String @ lpFileInformation + Declare Integer 'LocalFileTimeToFileTime' In Win32API As fb2p_LocalFileTimeToFileTime String LOCALFILETIME, String @ FILETIME + Declare Integer 'FileTimeToSystemTime' In Win32API As fb2p_FileTimeToSystemTime String FILETIME, String @ SYSTEMTIME + Declare Integer 'SystemTimeToFileTime' In Win32API As fb2p_SystemTimeToFileTime String lpSYSTEMTIME, String @ FILETIME + Declare Integer '_lopen' In Win32API As fb2p_lopen String lpFileName, Integer iReadWrite + Declare Integer '_lclose' In Win32API As fb2p_lclose Integer hFile +*-- Funciones para changeFileAttributes + Declare SHORT 'SetFileAttributes' In Win32API As fb2p_SetFileAttributes String tcFileName, Integer dwFileAttributes + Declare Integer 'GetFileAttributes' In Win32API As fb2p_GetFileAttributes String tcFileName +*-- + Endproc + + + Procedure get_AbsolutePath + Lparameters tc_InputFile, tc_FullPath + +*-- Ajusto la ruta si no es absoluta + tc_InputFile = Evl(tc_InputFile,'') + tc_FullPath = Evl(tc_FullPath, This.c_Foxbin2prg_FullPath) + + If Not Empty( Justext(tc_FullPath) ) Then +*-- Se indicó PATH+archivo.ext + tc_FullPath = Justpath(tc_FullPath) + Endif + + tc_FullPath = Addbs( tc_FullPath ) + + If Len(tc_InputFile) > 1 ; + AND Left(Ltrim(tc_InputFile),2) <> '\\' ; + AND Substr(Ltrim(tc_InputFile),2,1) <> ':' Then + tc_InputFile = Fullpath(tc_InputFile, tc_FullPath) + Endif + + Return tc_InputFile + Endproc + + + Function get_l_ConfigEvaluated + Return This.l_Main_CFG_Loaded + Endfunc + + + Function get_l_CFG_CachedAccess + Return This.l_CFG_CachedAccess + Endfunc + + + Function get_Processed +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taProcessed (@! OUT) Array donde se devolverá la información de los archivos de la máscara indicada +* tcFileMask (v? IN ) Máscara de archivo a buscar (nombre, "*", "?") +*--------------------------------------------------------------------------------------------------- +* ESTRUCTURA DEL ARRAY DEVUELTO: +* col(1) tcFile - Path del archivo (ej: 'C:\DESA\pruebas varias\lib.vcx') +* col(2) tcInOutType - Archivo de entrada o de salida ("I"=Input file, "O"=Output file) +* col(3) tcProcessed - Procesado ("P0"=Not Processed, "P1"=Processed) +* col(4) tcHasErrors - Tuvo Errores ("E0"=No Errors, "E1"=Has Errors) +* col(5) tcSupported - Archivo soportado ("S0"=Unsupported, "S1"=Supported) +* col(6) tcExpanded - Tipo de archivo ("X0"=Normal file, "X1"=Expanded multipart file) +*--------------------------------------------------------------------------------------------------- + Lparameters taProcessed, tcFileMask + + External Array taProcessed + + Local lnCount, I + lnCount = 0 + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + tcFileMask = Evl(tcFileMask, '*') + + For I = 1 To .n_ProcessedFiles + If Like( tcFileMask, Justfname(.a_ProcessedFiles(m.I,1)) ) Then + lnCount = lnCount + 1 + Dimension taProcessed(lnCount,6) + taProcessed(lnCount,1) = .a_ProcessedFiles(m.I,1) + taProcessed(lnCount,2) = .a_ProcessedFiles(m.I,2) + taProcessed(lnCount,3) = .a_ProcessedFiles(m.I,3) + taProcessed(lnCount,4) = .a_ProcessedFiles(m.I,4) + taProcessed(lnCount,5) = .a_ProcessedFiles(m.I,5) + taProcessed(lnCount,6) = .a_ProcessedFiles(m.I,6) + Endif + Endfor + Endwith + + Return lnCount + Endfunc + + + Procedure n_Debug_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_Debug + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_Debug, This.n_Debug ) + Endif + Endproc + + + Procedure n_BodyDevInfo_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_BodyDevInfo + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_BodyDevInfo, This.n_BodyDevInfo ) + Endif + Endproc + + + Procedure l_ShowErrors_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_ShowErrors + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_ShowErrors, This.l_ShowErrors ) + Endif + Endproc + + + Procedure n_ShowProgressbar_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_ShowProgressbar + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_ShowProgressbar, This.n_ShowProgressbar ) + Endif + Endproc + + + Procedure l_NoTimestamps_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_NoTimestamps + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_NoTimestamps, This.l_NoTimestamps ) + Endif + Endproc + + +*!* Changed by: LScheffler 19.03.2023 +* additional options controlling +* files in non subpath of the PJX + Procedure n_CheckFileInPath_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_CheckFileInPath + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_CheckFileInPath, This.n_CheckFileInPath ) + Endif + Endproc +*!* /Changed by: LScheffler 19.03.2023 + + Procedure n_UseClassPerFile_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_UseClassPerFile + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_UseClassPerFile, This.n_UseClassPerFile ) + Endif + Endproc + +*!* Changed by: LScheffler 21.02.2021 +*!* change date="{^2021-02-21,10:57:00}" +* additional options controlling +* - splitt of DBC separated from VCX/SCX +* - new operations of DBF + Procedure l_OldFilesPerDBC_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_OldFilesPerDBC + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_OldFilesPerDBC, This.l_OldFilesPerDBC ) + Endif + Endproc + + + Procedure n_UseFilesPerDBC_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_UseFilesPerDBC + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_UseFilesPerDBC, This.n_UseFilesPerDBC ) + Endif + Endproc + + + Procedure l_RedirectFilePerDBCToMain_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_RedirectFilePerDBCToMain + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_RedirectFilePerDBCToMain, This.l_RedirectFilePerDBCToMain ) + Endif + Endproc + + + Procedure l_ItemPerDBCCheck_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_ItemPerDBCCheck + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_ItemPerDBCCheck, This.l_ItemPerDBCCheck ) + Endif + Endproc + + + Procedure l_DBF_BinChar_Base64_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_DBF_BinChar_Base64 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_DBF_BinChar_Base64, This.l_DBF_BinChar_Base64 ) + Endif + Endproc + + + Procedure l_DBF_IncludeDeleted_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_DBF_IncludeDeleted + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_DBF_IncludeDeleted, This.l_DBF_IncludeDeleted ) + Endif + Endproc + + + Procedure c_Language_In_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_Language_In + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_Language_In, This.c_Language_In ) + Endif + Endproc +*!* /Changed by: LScheffler 21.02.2021 + + + Procedure l_RedirectClassPerFileToMain_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_RedirectClassPerFileToMain + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_RedirectClassPerFileToMain, This.l_RedirectClassPerFileToMain ) + Endif + Endproc + + + Procedure n_RedirectClassType_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_RedirectClassType + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_RedirectClassType, This.n_RedirectClassType ) + Endif + Endproc + + + Procedure l_RemoveNullCharsFromCode_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_RemoveNullCharsFromCode + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_RemoveNullCharsFromCode, This.l_RemoveNullCharsFromCode ) + Endif + Endproc + + + Procedure l_RemoveZOrderSetFromProps_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_RemoveZOrderSetFromProps + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_RemoveZOrderSetFromProps, This.l_RemoveZOrderSetFromProps ) + Endif + Endproc + + + Procedure l_ClassPerFileCheck_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_ClassPerFileCheck + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_ClassPerFileCheck, This.l_ClassPerFileCheck ) + Endif + Endproc + + + Procedure l_ClearUniqueID_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_ClearUniqueID + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_ClearUniqueID, This.l_ClearUniqueID ) + Endif + Endproc + + + Procedure l_ClearDBFLastUpdate_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.l_ClearDBFLastUpdate + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).l_ClearDBFLastUpdate, This.l_ClearDBFLastUpdate ) + Endif + Endproc + + + Procedure n_OptimizeByFilestamp_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_OptimizeByFilestamp + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_OptimizeByFilestamp, This.n_OptimizeByFilestamp ) + Endif + Endproc + + + Procedure n_ExtraBackupLevels_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_ExtraBackupLevels + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_ExtraBackupLevels, This.n_ExtraBackupLevels ) + Endif + Endproc + + + Procedure c_VC2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_VC2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_VC2, This.c_VC2 ) + Endif + Endproc + + + Procedure c_SC2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_SC2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_SC2, This.c_SC2 ) + Endif + Endproc + + + Procedure c_PJ2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_PJ2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_PJ2, This.c_PJ2 ) + Endif + Endproc + + + Procedure c_FR2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_FR2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_FR2, This.c_FR2 ) + Endif + Endproc + + + Procedure c_LB2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_LB2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_LB2, This.c_LB2 ) + Endif + Endproc + + + Procedure c_DB2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_DB2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_DB2, This.c_DB2 ) + Endif + Endproc + + + Procedure c_DC2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_DC2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_DC2, This.c_DC2 ) + Endif + Endproc + + + Procedure c_MN2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_MN2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_MN2, This.c_MN2 ) + Endif + Endproc + + + Procedure c_FK2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_FK2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_FK2, This.c_FK2 ) + Endif + Endproc + + + Procedure c_ME2_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_ME2 + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_ME2, This.c_ME2 ) + Endif + Endproc + + + Procedure n_PJX_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_PJX_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_PJX_Conversion_Support, This.n_PJX_Conversion_Support ) + Endif + Endproc + + + Procedure n_VCX_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_VCX_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_VCX_Conversion_Support, This.n_VCX_Conversion_Support ) + Endif + Endproc + + + Procedure n_SCX_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_SCX_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_SCX_Conversion_Support, This.n_SCX_Conversion_Support ) + Endif + Endproc + + + Procedure n_FRX_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_FRX_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_FRX_Conversion_Support, This.n_FRX_Conversion_Support ) + Endif + Endproc + + + Procedure n_LBX_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_LBX_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_LBX_Conversion_Support, This.n_LBX_Conversion_Support ) + Endif + Endproc + + + Procedure n_DBC_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_DBC_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_DBC_Conversion_Support, This.n_DBC_Conversion_Support ) + Endif + Endproc + + + Procedure n_DBF_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_DBF_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_DBF_Conversion_Support, This.n_DBF_Conversion_Support ) + Endif + Endproc + + + Procedure n_MNX_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_MNX_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_MNX_Conversion_Support, This.n_MNX_Conversion_Support ) + Endif + Endproc + + + Procedure n_FKY_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_FKY_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_FKY_Conversion_Support, This.n_FKY_Conversion_Support ) + Endif + Endproc + + + Procedure n_MEM_Conversion_Support_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_MEM_Conversion_Support + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_MEM_Conversion_Support, This.n_MEM_Conversion_Support ) + Endif + Endproc + + + Procedure c_DBF_Conversion_Included_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_DBF_Conversion_Included + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_DBF_Conversion_Included, This.c_DBF_Conversion_Included ) + Endif + Endproc + + + Procedure c_DBF_Conversion_Excluded_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_DBF_Conversion_Excluded + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_DBF_Conversion_Excluded, This.c_DBF_Conversion_Excluded ) + Endif + Endproc + + + Procedure c_BackgroundImage_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.c_BackgroundImage + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).c_BackgroundImage, This.c_BackgroundImage ) + Endif + Endproc + + + Procedure n_ExcludeDBFAutoincNextval_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_ExcludeDBFAutoincNextval + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_ExcludeDBFAutoincNextval, This.n_ExcludeDBFAutoincNextval ) + Endif + Endproc + + + Procedure n_PRG_Compat_Level_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_PRG_Compat_Level + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_PRG_Compat_Level, This.n_PRG_Compat_Level ) + Endif + Endproc + + +*** DH 2021-03-04: added n_HomeDir_Access + Procedure n_HomeDir_ACCESS + If This.n_CFG_Actual = 0 Or Isnull( This.o_Configuration( This.n_CFG_Actual ) ) + Return This.n_HomeDir + Else + Return Nvl( This.o_Configuration( This.n_CFG_Actual ).n_HomeDir, This.n_HomeDir ) + Endif + Endproc +*** DH 2021-03-04: end of new code + + + Procedure changeFileAttribute +* Using Win32 Functions in Visual FoxPro +* example=103 +* Changing file attributes + Lparameters tcFileName, tcAttrib + tcAttrib = Upper(tcAttrib) + + #Define FILE_ATTRIBUTE_READONLY 1 + #Define FILE_ATTRIBUTE_HIDDEN 2 + #Define FILE_ATTRIBUTE_SYSTEM 4 + #Define FILE_ATTRIBUTE_DIRECTORY 16 + #Define FILE_ATTRIBUTE_ARCHIVE 32 + #Define FILE_ATTRIBUTE_NORMAL 128 + #Define FILE_ATTRIBUTE_TEMPORARY 512 + #Define FILE_ATTRIBUTE_COMPRESSED 2048 + + Try + Local loEx As Exception, dwFileAttributes, dwFileAttributes_Orig, lnRet + lnRet = 0 + +* read current attributes for this file + dwFileAttributes = fb2p_GetFileAttributes(tcFileName) + dwFileAttributes_Orig = dwFileAttributes + + If dwFileAttributes = -1 +* the file does not exist + Exit + Endif + + If dwFileAttributes > 0 + If '+R' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_READONLY) + Endif + If '+A' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_ARCHIVE) + Endif + If '+S' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_SYSTEM) + Endif + If '+H' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_HIDDEN) + Endif + If '+D' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_DIRECTORY) + Endif + If '+N' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_NORMAL) + Endif + If '+T' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_TEMPORARY) + Endif + If '+C' $ tcAttrib + dwFileAttributes = Bitor(dwFileAttributes, FILE_ATTRIBUTE_COMPRESSED) + Endif + + If '-R' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_READONLY) = FILE_ATTRIBUTE_READONLY + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_READONLY + Endif + If '-A' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_ARCHIVE) = FILE_ATTRIBUTE_ARCHIVE + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_ARCHIVE + Endif + If '-S' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_SYSTEM) = FILE_ATTRIBUTE_SYSTEM + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_SYSTEM + Endif + If '-H' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_HIDDEN) = FILE_ATTRIBUTE_HIDDEN + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_HIDDEN + Endif + If '-D' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_DIRECTORY + Endif + If '-N' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_NORMAL) = FILE_ATTRIBUTE_NORMAL + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_NORMAL + Endif + If '-T' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_TEMPORARY) = FILE_ATTRIBUTE_TEMPORARY + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_TEMPORARY + Endif + If '-C' $ tcAttrib And Bitand(dwFileAttributes, FILE_ATTRIBUTE_COMPRESSED) = FILE_ATTRIBUTE_COMPRESSED + dwFileAttributes = dwFileAttributes - FILE_ATTRIBUTE_COMPRESSED + Endif + +* setting selected attributes + lnRet = fb2p_SetFileAttributes(tcFileName, dwFileAttributes) + Endif + + Catch To loEx + Throw + + Finally + This.writeLog( C_TAB + Lower(Program()) + ' >> [' + tcFileName + '] lnRet = ' + Transform(lnRet) + ', dwFileAttributes_Orig = ' + Transform(dwFileAttributes_Orig) ) + Release tcFileName, tcAttrib, dwFileAttributes + Endtry + + Return lnRet + Endproc + + + Procedure changeFileTime +*--------------------------------------------------------------------------------------------------- +* CAMBIAR LA FECHA/HORA DE UN ARCHIVO +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFileName (v! IN ) Nombre del archivo +* tcTimeType (v? IN ) C=Creation time, W=Last Write, A=Last Access +* tnYear (v? IN ) Ańo (>=1800) +* tnMonth (v? IN ) Mes (1-12) +* tnDay (v? IN ) Día (1-31) +* tnHour (v? IN ) Hora (0-23) +* tnMinute (v? IN ) Minuto (0-59) +* tnSec (v? IN ) Segundo (0-59) +* tnThou (v? IN ) ż? (0-999) +*--------------------------------------------------------------------------------------------------- + Lparameters m.tcFileName, m.tcTimeType, m.tnYear, m.tnMonth, m.tnDay, m.tnHour, m.tnMinute, m.tnSec, m.tnThou + + #Define OF_READWRITE 2 + + Local m.lpFileInformation, m.cS, m.nPar, m.fh, M.lpFileInformation, m.lpSysTime, m.cCreation ; + , M.cLastAccess, m.cLastWrite, m.cBuffTime, m.cBuffTime1, M.cTT,m.nYear1, m.nMonth1, m.nDay1, m.nHour1 ; + , M.nMinute1, m.nSec1, m.nThou1, llRetorno + + Try + m.nPar = Pcount() + + If m.nPar < 1 + Exit + Endif + + m.cTT = Iif( m.nPar >= 2 And Vartype(m.tcTimeType) = "C" And Not Empty(m.tcTimeType), Lower(Substr(m.tcTimeType,1,1)), "c" ) + m.nYear1 = Iif( m.nPar >= 3 And Vartype(m.tnYear) $ "FIN" And m.tnYear >= 1800, Round(m.tnYear,0), -1 ) + m.nMonth1 = Iif( m.nPar >= 4 And Vartype(m.tnMonth) $ "FIN" And Between(m.tnMonth,1,12), Round(m.tnMonth,0), -1 ) + m.nDay1 = Iif( m.nPar >= 5 And Vartype(m.tnDay) $ "FIN" And Between(m.tnDay,1,31), Round(m.tnDay,0), -1 ) + m.nHour1 = Iif( m.nPar >= 6 And Vartype(m.tnHour) $ "FIN" And Between(m.tnHour,0,23), Round(m.tnHour,0), -1 ) + m.nMinute1 = Iif( m.nPar >= 7 And Vartype(m.tnMinute) $ "FIN" And Between(m.tnMinute,0,59), Round(m.tnMinute,0), -1 ) + m.nSec1 = Iif( m.nPar >= 8 And Vartype(m.tnSec) $ "FIN" And Between(m.tnSec,0,59), Round(m.tnSec,0), -1 ) + m.nThou1 = Iif( m.nPar >= 9 And Vartype(m.tnThou) $ "FIN" And Between(m.tnThou,0,999), Round(m.tnThou,0), -1 ) + m.lpFileInformation = Replicate( Chr(0), 53 ) && just a buffer + m.lpSysTime = Replicate( Chr(0), 16 ) && just a buffer + + If fb2p_GetFileAttributesEx(m.tcFileName, 0, @lpFileInformation) = 0 + Exit + Endif + + m.cCreation = Substr(m.lpFileInformation,5,8) + m.cLastAccess = Substr(m.lpFileInformation,13,8) + m.cLastWrite = Substr(m.lpFileInformation,21,8) + m.cBuffTime = Iif(m.cTT="w",m.cLastWrite, Iif(m.cTT="a",m.cLastAccess,m.cCreation)) + + fb2p_FileTimeToSystemTime(m.cBuffTime, @lpSysTime) + + m.lpSysTime = ; + IIF( m.nYear1 >= 0, BinToC(m.nYear1,"2RS"), Substr(m.lpSysTime,1,2) ) ; + + Iif( m.nMonth1 >= 0, BinToC(m.nMonth1,"2RS"), Substr(m.lpSysTime,3,2) ) ; + + Substr(m.lpSysTime,5,2) ; + + Iif( m.nDay1 >= 0, BinToC(m.nDay1,"2RS"), Substr(m.lpSysTime,7,2) ) ; + + Iif( m.nHour1 >= 0, BinToC(m.nHour1,"2RS"), Substr(m.lpSysTime,9,2) ) ; + + Iif( m.nMinute1 >= 0, BinToC(m.nMinute1,"2RS"), Substr(m.lpSysTime,11,2) ) ; + + Iif( m.nSec1 >= 0, BinToC(m.nSec1,"2RS"), Substr(m.lpSysTime,13,2) ) ; + + Iif( m.nThou1 >= 0, BinToC(m.nThou1,"2RS"), Substr(m.lpSysTime,15,2) ) + + fb2p_SystemTimeToFileTime(m.lpSysTime,@cBuffTime) + m.cBuffTime1 = m.cBuffTime + fb2p_LocalFileTimeToFileTime(m.cBuffTime1,@cBuffTime) + + Do Case + Case m.cTT = "w" + m.cLastWrite=m.cBuffTime + Case m.cTT = "a" + m.cLastAccess=m.cBuffTime + Otherwise && "c" + m.cCreation=m.cBuffTime + Endcase + + m.fh = fb2p_lopen (m.tcFileName, OF_READWRITE) + + If m.fh < 0 + Exit + Endif + + fb2p_SetFileTime (m.fh,m.cCreation, m.cLastAccess, m.cLastWrite) + fb2p_lclose(m.fh) + llRetorno = .T. + Endtry + + Return llRetorno + Endproc + + + Procedure compileFoxProBinary + Lparameters tcFileName + Local lcType + + tcFileName = Evl(tcFileName, This.c_OutputFile) + lcType = Upper(Justext(tcFileName)) + + Do Case + Case lcType = 'VCX' + Compile Classlib (tcFileName) + + Case lcType = 'SCX' + Compile Form (tcFileName) + + Case lcType = 'FRX' + Compile Report (tcFileName) + + Case lcType = 'LBX' + Compile Label (tcFileName) + + Case lcType = 'DBC' + Compile Database (tcFileName) + + Endcase + + Release tcFileName, lcType + Return + Endproc + + + Procedure doBackup +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toEx (@? IN ) Objeto Exception con información del error +* tlRelanzarError (v? IN ) Indica si se debe relanzar el error +* tcBakFile_1 (@? OUT) Nombre del archivo backup 1 (vcx,scx,pjx,frx,lbx,dbf,dbc,mnx,vc2,sc2,pj2,etc) +* tcBakFile_2 (@? OUT) Nombre del archivo backup 2 (vct,sct,pjt,frt,lbt,fpt,dct,mnt,etc) +* tcBakFile_3 (@? OUT) Nombre del archivo backup 3 (cdx,dcx,etc) +* tcOutputFile (v? IN ) Nombre del archivo de salida. Si no se indica se asume .c_OutputFile +*--------------------------------------------------------------------------------------------------- + Lparameters toEx, tlRelanzarError, tcBakFile_1, tcBakFile_2, tcBakFile_3, tcOutputFile + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lcNext_Bak, lcExt_1, lcExt_2, lcExt_3, tcOutputFile_Ext1, tcOutputFile_Ext2, tcOutputFile_Ext3, laDir(1,5) ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + Store '' To tcBakFile_1, tcBakFile_2, tcBakFile_3, lcExt_1, lcExt_2, lcExt_3 ; + , tcOutputFile_Ext1, tcOutputFile_Ext2, tcOutputFile_Ext3 + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If .n_ExtraBackupLevels > 0 Then + loLang = _Screen.o_FoxBin2Prg_Lang + tcOutputFile = Evl( tcOutputFile, .c_OutputFile ) + lcNext_Bak = .getNext_BAK( tcOutputFile ) + lcExt_1 = Justext( tcOutputFile ) + tcBakFile_1 = Forceext(tcOutputFile, lcExt_1 + lcNext_Bak) + + Do Case + Case Inlist( lcExt_1, .c_PJ2, .c_VC2, .c_SC2, .c_FR2, .c_LB2, .c_DB2, .c_DC2, .c_MN2, .c_FK2, .c_ME2, 'PJM' ) +*-- Extensiones TEXTO + + Case lcExt_1 = 'DBF' +*-- DBF + lcExt_2 = 'FPT' + lcExt_3 = 'CDX' + tcBakFile_2 = Forceext(tcOutputFile, lcExt_2 + lcNext_Bak) + tcBakFile_3 = Forceext(tcOutputFile, lcExt_3 + lcNext_Bak) + + Case lcExt_1 = 'DBC' +*-- DBC + lcExt_2 = 'DCT' + lcExt_3 = 'DCX' + tcBakFile_2 = Forceext(tcOutputFile, lcExt_2 + lcNext_Bak) + tcBakFile_3 = Forceext(tcOutputFile, lcExt_3 + lcNext_Bak) + + Case Inlist( lcExt_1, 'PJX', 'VCX', 'SCX', 'FRX', 'LBX', 'MNX' ) +*-- PJX, VCX, SCX, FRX, LBX, MNX + lcExt_2 = Left(lcExt_1,2) + 'T' + tcBakFile_2 = Forceext(tcOutputFile, lcExt_2 + lcNext_Bak) + + Otherwise +*-- PKY, MEM + + Endcase + + If Not Empty(lcExt_1) + tcOutputFile_Ext1 = Forceext(tcOutputFile, lcExt_1) + + If Adir( laDir, tcOutputFile_Ext1 ) > 0 Then +*-- LOG + Do Case + Case Empty(lcExt_2) + .writeLog( C_TAB + loLang.C_BACKUP_OF_LOC + tcOutputFile_Ext1 ) + Case Empty(lcExt_3) + .writeLog( C_TAB + loLang.C_BACKUP_OF_LOC + tcOutputFile_Ext1 + '/' + lcExt_2 ) + Otherwise + .writeLog( C_TAB + loLang.C_BACKUP_OF_LOC + tcOutputFile_Ext1 + '/' + lcExt_2 + '/' + lcExt_3 ) + Endcase + +*-- COPIA BACKUP + Copy File ( tcOutputFile_Ext1 ) To ( tcBakFile_1 ) + + If Not Empty(lcExt_2) + tcOutputFile_Ext2 = Forceext(tcOutputFile, lcExt_2) + + If Adir( laDir, tcOutputFile_Ext2 ) > 0 Then + Copy File ( tcOutputFile_Ext2 ) To ( tcBakFile_2 ) + Endif + Endif + + If Not Empty(lcExt_3) + tcOutputFile_Ext3 = Forceext(tcOutputFile, lcExt_3) + + If Adir( laDir, tcOutputFile_Ext3 ) > 0 Then + Copy File ( tcOutputFile_Ext3 ) To ( tcBakFile_3 ) + Endif + Endif + Endif + Endif + Endif + Endwith && THIS + + Catch To toEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + If tlRelanzarError + Throw + Endif + + Finally + Release toEx, tlRelanzarError, tcBakFile_1, tcBakFile_2, tcBakFile_3 ; + , lcNext_Bak, lcExt_1, lcExt_2, lcExt_3, tcOutputFile_Ext1, tcOutputFile_Ext2, tcOutputFile_Ext3 ; + , tcOutputFile + Endtry + + Return + Endproc + + + Procedure loadProgressbarForm + If Vartype(This.o_Frm_Avance) <> "O" Then + This.o_Frm_Avance = Createobject("frm_avance", This) + This.o_Frm_Avance.Show() + Endif + Endproc + + + Procedure unloadProgressbarForm + Lparameters tlForceUnload + If (tlForceUnload Or This.n_ShowProgressbar <> 0) And Vartype(This.o_Frm_Avance) = "O" Then + This.o_Frm_Avance.Hide() + This.o_Frm_Avance.Release() + This.o_Frm_Avance = Null + Endif + Endproc + + + Procedure evaluateConfiguration +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcDontShowProgress (v? IN ) '1' para inhabilitar la barra de progreso +* tcDontShowErrors (v? IN ) '1' para no mostrar mensajes de error (MESSAGEBOX) +* tcNoTimestamps (v? IN ) Indica si se debe anular el timestamp ('1') o no ('0' ó vacío) +* tcDebug (v? IN ) '1' para habilitar modo debug (SOLO DESARROLLO) +* tcRecompile (v? IN ) Indica recompilar ('1') el binario una vez regenerado. [Cambio de funcionamiento por defecto] +* Este cambio es para ganar tiempo, velocidad y seguridad. Además la recompilación que hace FoxBin2Prg +* se hace desde el directorio del archivo, con lo que las referencias relativas pueden +* generar errores de compilación, típicamente los #include. +* NOTA: Si en vez de '1' se indica un Path (p.ej, el del proyecto, se usará como base para recompilar +* tcExtraBackupLevels (v? IN ) Indica la cantidad de niveles de backup a realizar (por defecto '1') +* tcClearUniqueID (v? IN ) Indica si se debe limpiar el UniqueID ('1') o no ('0' ó vacío) +* tcOptimizeByFilestamp (v? IN ) Indica si se debe optimizar por filestamp mayor o igual ('1'), solo igual ('2') o no optimizar ('0' ó vacío) +* tc_InputFile (v! IN ) Nombre completo (fullpath) del archivo a convertir o nombre del directorio a procesar +* tc_InputFile_Type (@? IN ) Tipo de archivo de entrada: (D)irectory, (F)ile, (Q)uerySupport +* toParentCFG (@? IN ) (Uso interno) Si se pasa un valor, el nuevo CFG copiará primero sus valores de aquí para heredarlos +* tl_ForceLog (v? IN ) Force logging of settings. used on cfg setting as object +*-------------------------------------------------------------------------------------------------------------- + Lparameters tcDontShowProgress, tcDontShowErrors, tcNoTimestamps, tcDebug, tcRecompile, tcExtraBackupLevels ; + , tcClearUniqueID, tcOptimizeByFilestamp, tc_InputFile, tcInputFile_Type, toParentCFG, tl_ForceLog + + #If .F. + Local toParentCFG As CL_CFG Of 'FOXBIN2PRG.PRG' + #Endif + + Local lcConfigFile, llExiste_CFG_EnDisco, laConfig(1), I, lcConfData, lcExt, lcValue, lc_CFG_Path, lcConfigLine, laDirInfo(1,5) ; + , lnDirs, laDirs(1), llMasterEval, lcProp ; + , lo_CFG As CL_CFG Of 'FOXBIN2PRG.PRG' ; + , loCFG_Manual As CL_CFG Of 'FOXBIN2PRG.PRG' ; + , lo_Configuration As Collection ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loEx As Exception + + Try + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + Store 0 To lnKey + loLang = _Screen.o_FoxBin2Prg_Lang + tcRecompile = Evl(tcRecompile, .c_Recompile) + lcConfigFile = .c_Foxbin2prg_ConfigFile + tc_InputFile = Evl(tc_InputFile, .c_InputFile) + tcInputFile_Type = Evl(tcInputFile_Type,'') + lo_Configuration = .o_Configuration + + If Vartype(lcConfigFile) = "O" + loCFG_Manual = lcConfigFile && lcConfigFile is an object CFG generated by get_DirSettings() + toParentCFG = loCFG_Manual + lcConfigFile = Fullpath('Personalized-CFG-Object', tc_InputFile) + loCFG_Manual.c_Foxbin2prg_ConfigFile = 'Personalized-CFG-Object' + Else + loCFG_Manual = Null + Endif + + If Vartype(toParentCFG) <> 'O' Then + toParentCFG = Null + Endif + + If Isnull(toParentCFG) Then + .c_InputFile = tc_InputFile + Endif + +*-- Determino el tipo de InputFile (Archivo o Directorio) + If Empty(tcInputFile_Type) And Not Empty(tc_InputFile) + Do Case + Case Len(tc_InputFile) = 1 + tcInputFile_Type = C_FILETYPE_QUERYSUPPORT + + Case Adir(laDirInfo, tc_InputFile, "D") = 1 And Substr( laDirInfo(1,5), 5, 1 ) = "D" + tcInputFile_Type = C_FILETYPE_DIRECTORY + + Otherwise + tcInputFile_Type = C_FILETYPE_FILE + Endcase + Endif + + If .l_Main_CFG_Loaded And Not Empty(tc_InputFile) And Not tcInputFile_Type == C_FILETYPE_QUERYSUPPORT Then + If .n_CFG_EvaluateFromParam = 1 +* Si se indicó por parámetro (modo objeto), usarlo como Maestro +* Se saltea solo esta evaluación, y luego se usa la variable para determinar el Nş de CFG a usar. + .n_CFG_EvaluateFromParam = -1 && Luego se cambia por el Nş de CFG que corresponda. + Else + If tcInputFile_Type == C_FILETYPE_DIRECTORY Then +* INDICÓ DIRECTORIO + If Isnull(loCFG_Manual) +*lcConfigFile = FULLPATH( 'foxbin2prg.cfg', ADDBS(tc_InputFile) ) + lcConfigFile = Fullpath( Justfname(lcConfigFile), Addbs(tc_InputFile) ) + Endif + Else +* INDICÓ ARCHIVO + If Isnull(loCFG_Manual) +*lcConfigFile = FULLPATH( 'foxbin2prg.cfg', tc_InputFile ) + lcConfigFile = Fullpath( Justfname(lcConfigFile), tc_InputFile ) + Endif + Endif + Endif + Endif + + lo_Configuration = .o_Configuration + .n_CFG_Actual = 0 + .l_CFG_CachedAccess = .F. + lc_CFG_Path = Upper( Justpath( lcConfigFile ) ) + lo_CFG = This + +*-- Búsqueda del CFG del PATH indicado en la caché + If .l_Main_CFG_Loaded + + If lo_Configuration.Count > 0 Then + If .n_CFG_EvaluateFromParam > 1 +* Especial: Si hay una configuración de bloqueo (CFG Manual), se usa + .n_CFG_Actual = .n_CFG_EvaluateFromParam + Else +* Normalmente se buscará el CFG del directorio analizado + .n_CFG_Actual = lo_Configuration.GetKey( lc_CFG_Path ) && 0 = No hay CFG cacheada, >0 = Hay CFG cacheada + Endif + + If .n_CFG_Actual > 0 Then + lo_CFG = lo_Configuration.Item(.n_CFG_Actual) + .l_CFG_CachedAccess = .T. + + If Not Isnull(loCFG_Manual) +* Si le paso un objeto CFG, prevalece sobre el guardado + lo_CFG.CopyFrom(@loCFG_Manual) + Endif + Endif + Endif + +*-- Si no se pasó un CFG padre y no hay CFGs o no encuentra el del PATH indicado, analizo la jararquía + If Isnull(toParentCFG) And (lo_Configuration.Count = 0 Or .n_CFG_Actual = 0) Then + llMasterEval = .T. + toParentCFG = This + + If Left( lc_CFG_Path, 2 ) == '\\' Then +*lnDirs = OCCURS( '\', lc_CFG_Path ) - 3 + lnDirs = Occurs( '\', lc_CFG_Path ) - 2 + Else + lnDirs = Occurs( '\', lc_CFG_Path ) + Endif + + If lnDirs > 0 Then + Dimension laDirs(lnDirs) + +*-- Creo el array con los PATH intermedios + For I = lnDirs To 1 Step -1 + If m.I = lnDirs Then + laDirs(m.I) = Justpath(lc_CFG_Path) + Else + laDirs(m.I) = Justpath(laDirs(m.I+1)) + Endif + Endfor + + If lnDirs = 1 And laDirs(1) = lc_CFG_Path +*-- Cuando no hay PATH intermedios, salteo esta parte para que más abajo lo agregue. 04/02/2016. FDBOZZO +*-- Ejemplo: Puede pasar cuando se convierte un archivo en C:\ u otro disco RAIZ. + Else +*-- Ahora evalúo las configuraciones de los PATH intermedios desde la raíz en adelante +*-- y mantengo la última configuración CFG Padre en toParentCFG para usarla como base. + For I = 1 To lnDirs + .evaluateConfiguration( '', '', '', '', '', '', '', '', laDirs(m.I), C_FILETYPE_DIRECTORY, @toParentCFG) + Endfor + Endif + + .l_CFG_CachedAccess = .F. + .n_CFG_Actual = 0 + Endif + Endif + Endif + + Do Case + Case .n_CFG_Actual = 0 +*-- Si no se encontró un CFG cacheado, se busca si existe un archivo CFG en disco + llExiste_CFG_EnDisco = ( Adir( laDirInfo, lcConfigFile ) = 1 ) + + If Not llExiste_CFG_EnDisco + .l_CFG_CachedAccess = .T. && Es cacheado porque sin archivo CFG usa config.interna + Endif + + Case Isnull( .o_Configuration( .n_CFG_Actual ) ) +*-- Si existe una configuración y es NULL, es la predeterminada. +*-- Este es el primer objeto CFG en cargarse cuando se inicializa FoxBin2Prg, +*-- y corresponde a la ruta de instalación del EXE (ej: c:\desa\foxbin2prg\foxbin2prg.cfg) + lo_CFG = This + + Endcase + + If .l_Main_CFG_Loaded + If .l_CFG_CachedAccess And .n_CFG_Actual > 0 Then + toParentCFG = lo_CFG + .writeLog( '> ' + Upper(loLang.C_USING_THIS_SETTINGS_LOC) + ': ' + lo_CFG.c_Foxbin2prg_ConfigFile + ' => ' + tc_InputFile + ; + ' CFG_Actual:' + Transform(.n_CFG_Actual) + Icase(.n_CFG_Actual=1, ' [MASTER]', ' [SECONDARY]') ) + Else + lo_CFG = Createobject('CL_CFG') + lo_Configuration.Add( lo_CFG, lc_CFG_Path ) + .n_CFG_Actual = lo_Configuration.Count + .writeLog( '> ' + Upper(loLang.C_CACHING_CONFIG_FOR_DIRECTORY_LOC) + ': ' + lc_CFG_Path + ; + ' CFG_Actual:' + Transform(.n_CFG_Actual) + Icase(.n_CFG_Actual=1, ' [MASTER]', ' [SECONDARY]') ) + + If Not Isnull(toParentCFG) + lo_CFG.CopyFrom(@toParentCFG) + toParentCFG = lo_CFG + .writeLog( C_TAB + '- ' + loLang.C_INHERITING_FROM_LOC + ': ' + lo_CFG.c_Foxbin2prg_ConfigFile ) + Endif + Endif + + Else + lo_Configuration.Add( Null, lc_CFG_Path ) && La NULL se carga solo cuando no hay Main_CFG_loaded todavía. + .n_CFG_Actual = lo_Configuration.Count + Endif + +*-- NOTA: SOLO LOS QUE NO VENGAN DE PARÁMETROS EXTERNOS DEBEN ASIGNARSE A lo_CFG AQUÍ. + If llExiste_CFG_EnDisco And Not .l_CFG_CachedAccess Then + .writeLog() + .writeLog( '> ' + loLang.C_READING_CFG_VALUES_FROM_DISK_LOC + ':' ) + .writeLog( C_TAB + loLang.C_CONFIGFILE_LOC + ' ' + lcConfigFile ) + + lo_CFG.c_Foxbin2prg_ConfigFile = lcConfigFile + + For I = 1 To Alines( laConfig, Filetostr( lcConfigFile ), 1+4 ) + .set_Line( @lcConfigLine, @laConfig, m.I ) + .get_SeparatedLineAndComment( @lcConfigLine ) + laConfig(m.I) = Lower( lcConfigLine ) + + Do Case + Case Empty( laConfig(m.I) ) Or Inlist( Left( laConfig(m.I), 1 ), '*', '#', '/', "'" ) + Loop + +*settings for internal work, not processing +* Depricated: + Case Left( laConfig(m.I), 17 ) == Lower('DontShowProgress:') + lcValue = Alltrim( Substr( laConfig(m.I), 18 ) ) + If Not Inlist( Transform(tcDontShowProgress), '0', '1', '2' ) And Inlist( lcValue, '0', '1', '2' ) Then + tcDontShowProgress = lcValue + lo_CFG.n_ShowProgressbar = Icase(lcValue=='0',1, lcValue=='1',0, 2) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > tcDontShowProgress: ' + Transform(tcDontShowProgress) ) + Endif + + Case Left( laConfig(m.I), 9 ) == Lower('Language:') +*-- CASO ESPECIAL: El lenguaje no se guarda en lo_CFG, porque es un seteo Global. + lcValue = Alltrim( Substr( laConfig(m.I), 10 , At('&'+'&',laConfig(m.I)) - 10 ) ) + .changeLanguage(lcValue) + lo_CFG.c_Language_In = m.lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > Language: ' + Transform(lcValue) + ' (' + .c_Language + ')' ) + + Case Left( laConfig(m.I), 16 ) == Lower('ShowProgressbar:') + lcValue = Alltrim( Substr( laConfig(m.I), 17 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_ShowProgressbar = Int( Val(lcValue) ) + tcDontShowProgress = '' + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > ShowProgressbar: ' + lcValue ) + Endif + + Case Left( laConfig(m.I), 15 ) == Lower('DontShowErrors:') +*-- Priorizo si tcDontShowErrors NO viene con "0" como parámetro, ya que los scripts vbs +*-- los utilizan para sobreescribir la configuración por defecto de foxbin2prg.cfg + lcValue = Alltrim( Substr( laConfig(m.I), 16 ) ) + If Not Inlist( Transform(tcDontShowErrors), '0', '1' ) And Inlist( lcValue, '0', '1' ) Then + tcDontShowErrors = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > tcDontShowErrors: ' + Transform(tcDontShowErrors) ) + Endif + + Case Left( laConfig(m.I), 18 ) == Lower('ExtraBackupLevels:') + lcValue = Alltrim( Substr( laConfig(m.I), 19 ) ) + If Not Isdigit( Transform(tcExtraBackupLevels) ) And Isdigit( lcValue ) Then + tcExtraBackupLevels = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > tcExtraBackupLevels: ' + Transform(tcExtraBackupLevels) ) + Endif + + Case Left( laConfig(m.I), 16 ) == Lower('BackgroundImage:') + lcValue = Alltrim( Substr( laConfig(m.I), 17 ) ) + Do Case + Case Empty(lcValue) + lo_CFG.c_BackgroundImage = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > BackgroundImage: (Empty)' ) + + Case Adir( laDirInfo, lcValue ) > 0 + lo_CFG.c_BackgroundImage = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > BackgroundImage: ' + Transform(lo_CFG.c_BackgroundImage) ) + + Otherwise + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > BackgroundImage: File not found: ' + Transform(lo_CFG.c_BackgroundImage) ) + + Endcase + Case Left( laConfig(m.I), 6 ) == Lower('Debug:') + lcValue = Alltrim( Substr( laConfig(m.I), 7 ) ) + If Not Inlist( Transform(tcDebug), '0', '1' ) And Inlist( lcValue, '0', '1' ) Then + tcDebug = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > tcDebug: ' + Transform(tcDebug) ) + Endif + +*** DH 2021-03-04: handle n_HomeDir configuration setting + Case Left( laConfig(m.I), 8 ) == Lower('HomeDir:') + lcValue = Alltrim( Substr( laConfig(m.I), 9 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.n_HomeDir = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > HomeDir: ' + Transform(lo_CFG.n_HomeDir) ) + Endif +*** DH 2021-03-04: end of new code +************** +*Conversion operation by type + Case Left( laConfig(m.I), 23 ) == Lower('PJX_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_PJX_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > PJX_Conversion_Support: ' + Transform(lo_CFG.n_PJX_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('VCX_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_VCX_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > VCX_Conversion_Support: ' + Transform(lo_CFG.n_VCX_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('SCX_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_SCX_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > SCX_Conversion_Support: ' + Transform(lo_CFG.n_SCX_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('FRX_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_FRX_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > FRX_Conversion_Support: ' + Transform(lo_CFG.n_FRX_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('LBX_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_LBX_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > LBX_Conversion_Support: ' + Transform(lo_CFG.n_LBX_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('MNX_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_MNX_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > MNX_Conversion_Support: ' + Transform(lo_CFG.n_MNX_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('DBF_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2', '4', '8' ) Then + lo_CFG.n_DBF_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > DBF_Conversion_Support: ' + Transform(lo_CFG.n_DBF_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('DBC_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_DBC_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > DBC_Conversion_Support: ' + Transform(lo_CFG.n_DBC_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('FKY_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.n_FKY_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > FKY_Conversion_Support: ' + Transform(lo_CFG.n_FKY_Conversion_Support) ) + Endif + + Case Left( laConfig(m.I), 23 ) == Lower('MEM_Conversion_Support:') + lcValue = Alltrim( Substr( laConfig(m.I), 24 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.n_MEM_Conversion_Support = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > MEM_Conversion_Support: ' + Transform(lo_CFG.n_MEM_Conversion_Support) ) + Endif + + +*-------- setting for container files (not pjx) -------- +*Classes and forms ( vcx / scx) + +*!* Changed by: LScheffler 19.03.2023 +* additional options controlling +* files in non subpath of the PJX + Case Left( laConfig(m.I), 16 ) == Lower('CheckFileInPath:') + lcValue = Alltrim( Substr( laConfig(m.I), 17 ) ) + If Inlist( lcValue, '0', '1', '2', '3' ) Then + lo_CFG.n_CheckFileInPath = Int( Val(lcValue) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > CheckFileInPath: ' + Transform(lcValue) ) + Endif +*!* /Changed by: LScheffler 19.03.2023 + +*!* Changed by: LScheffler 21.02.2021 +*!* change date="{^2021-02-21,10:57:00}" +* additional options controlling +* - splitt of DBC separated from VCX/SCX +* - new operations of DBF + Case Left( laConfig(m.I), 16 ) == Lower('UseClassPerFile:') + lcValue = Alltrim( Substr( laConfig(m.I), 17 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_UseClassPerFile = Int( Val(lcValue) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > UseClassPerFile: ' + Transform(lcValue) ) + If !lo_CFG.l_OldFilesPerDBC Then + lo_CFG.n_UseFilesPerDBC = lo_CFG.n_UseClassPerFile + .writeLog( C_TAB + Justfname(lcConfigFile) + ' => UseFilesPerDBC: ' + Transform(lcValue) ) + Endif + Endif + + Case Left( laConfig(m.I), 18 ) == Lower('ClassPerFileCheck:') + lcValue = Alltrim( Substr( laConfig(m.I), 19 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_ClassPerFileCheck = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > ClassPerFileCheck: ' + Transform(lcValue) ) + If !lo_CFG.l_OldFilesPerDBC Then + lo_CFG.l_ItemPerDBCCheck = lo_CFG.l_ClassPerFileCheck + .writeLog( C_TAB + Justfname(lcConfigFile) + ' => ItemPerDBCCheck: ' + Transform(lcValue) ) + Endif + Endif + + Case Left( laConfig(m.I), 27 ) == Lower('RedirectClassPerFileToMain:') + lcValue = Alltrim( Substr( laConfig(m.I), 28 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_RedirectClassPerFileToMain = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > RedirectClassPerFileToMain: ' + Transform(lcValue) ) + If !lo_CFG.l_OldFilesPerDBC Then + lo_CFG.l_RedirectFilePerDBCToMain = lo_CFG.l_RedirectClassPerFileToMain + .writeLog( C_TAB + Justfname(lcConfigFile) + ' => RedirectFilePerDBCToMain: ' + Transform(lcValue) ) + Endif + Endif +*!* /Changed by: LScheffler 21.02.2021 + +*!* Changed by: LScheffler 04.3.2021 +*!* change date="{^2021-03-04,13:12:00}" +* new value 2, just add one class + Case Left( laConfig(m.I), 18 ) == Lower('RedirectClassType:') + lcValue = Alltrim( Substr( laConfig(m.I), 19 ) ) + If Inlist( lcValue, '0', '1', '2' ) Then + lo_CFG.n_RedirectClassType = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > RedirectClassType: ' + Transform(lcValue) ) + Endif +*!* /Changed by: LScheffler 04.3.2021 + +*Databases + Case Left( laConfig(m.I), 15 ) == Lower('OldFilesPerDBC:') + lcValue = Alltrim( Substr( laConfig(m.I), 16 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_OldFilesPerDBC = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > OldFilesPerDBC: ' + Transform(lcValue) ) + If !lo_CFG.l_OldFilesPerDBC Then + lo_CFG.n_UseFilesPerDBC = lo_CFG.n_UseClassPerFile + lo_CFG.l_RedirectFilePerDBCToMain = lo_CFG.l_RedirectClassPerFileToMain + lo_CFG.l_ItemPerDBCCheck = lo_CFG.l_ClassPerFileCheck + .writeLog( C_TAB + Justfname(lcConfigFile) + ' ==> UseFilesPerDBC: ' + Transform(lcValue) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' ==> RedirectFilePerDBCToMain: ' + Transform(lcValue) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' ==> ItemPerDBCCheck: ' + Transform(lcValue) ) + Endif + Endif + + Case Left( laConfig(m.I), 15 ) == Lower('UseFilesPerDBC:') + lcValue = Alltrim( Substr( laConfig(m.I), 16 ) ) + If lo_CFG.l_OldFilesPerDBC And Inlist( lcValue, '0', '1' ) Then + lo_CFG.n_UseFilesPerDBC = Int( Val(lcValue) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > UseFilesPerDBC: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(m.I), 25 ) == Lower('RedirectFilePerDBCToMain:') + lcValue = Alltrim( Substr( laConfig(m.I), 26 ) ) + If lo_CFG.l_OldFilesPerDBC And Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_RedirectFilePerDBCToMain = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > RedirectFilePerDBCToMain: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(m.I), 16 ) == Lower('ItemPerDBCCheck:') + lcValue = Alltrim( Substr( laConfig(m.I), 17 ) ) + If lo_CFG.l_OldFilesPerDBC And Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_ItemPerDBCCheck = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > ItemPerDBCCheck: ' + Transform(lcValue) ) + Endif +*/-------- setting for container files (not pjx) -------- + +*general files + Case Left( laConfig(m.I), 13 ) == Lower('NoTimestamps:') + lcValue = Alltrim( Substr( laConfig(m.I), 14 ) ) + If Not Inlist( Transform(tcNoTimestamps), '0', '1' ) And Inlist( lcValue, '0', '1' ) Then + tcNoTimestamps = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > tcNoTimestamps: ' + Transform(tcNoTimestamps) ) + Endif + + Case Left( laConfig(m.I), 14 ) == Lower('ClearUniqueID:') + lcValue = Alltrim( Substr( laConfig(m.I), 15 ) ) + If Not Inlist( Transform(tcClearUniqueID), '0', '1' ) And Inlist( lcValue, '0', '1' ) Then + tcClearUniqueID = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > ClearUniqueID: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(m.I), 20 ) == Lower('OptimizeByFilestamp:') + lcValue = Alltrim( Substr( laConfig(m.I), 21 ) ) + If Not Inlist( Transform(tcOptimizeByFilestamp), '0', '1', '2' ) And Inlist( lcValue, '0', '1', '2' ) Then + tcOptimizeByFilestamp = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > OptimizeByFilestamp: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(m.I), 24 ) == Lower('RemoveNullCharsFromCode:') + lcValue = Alltrim( Substr( laConfig(m.I), 25 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_RemoveNullCharsFromCode = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > RemoveNullCharsFromCode: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(m.I), 25 ) == Lower('RemoveZOrderSetFromProps:') + lcValue = Alltrim( Substr( laConfig(m.I), 26 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_RemoveZOrderSetFromProps = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > RemoveZOrderSetFromProps: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(I), 17 ) == Lower('PRG_Compat_Level:') + lcValue = Alltrim( Substr( laConfig(I), 18 ) ) + lo_CFG.n_PRG_Compat_Level = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > PRG_Compat_Level: ' + Transform(lo_CFG.n_PRG_Compat_Level) ) + +*pjx special + Case Left( laConfig(m.I), 12 ) == Lower('BodyDevInfo:') + lcValue = Alltrim( Substr( laConfig(m.I), 13 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.n_BodyDevInfo = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > BodyDevInfo: ' + Transform(lo_CFG.n_BodyDevInfo) ) + Endif + + + +*dbf special + Case Left( laConfig(m.I), 19 ) == Lower('ClearDBFLastUpdate:') + lcValue = Alltrim( Substr( laConfig(m.I), 20 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_ClearDBFLastUpdate = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > ClearDBFLastUpdate: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(m.I), 25 ) == Lower('ExcludeDBFAutoincNextval:') + lcValue = Alltrim( Substr( laConfig(m.I), 26 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.n_ExcludeDBFAutoincNextval = Int( Val( lcValue ) ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > ExcludeDBFAutoincNextval: ' + Transform(lo_CFG.n_ExcludeDBFAutoincNextval) ) + Endif + + Case Left( laConfig(m.I), 24 ) == Lower('DBF_Conversion_Included:') + lcValue = Alltrim( Substr( laConfig(m.I), 25 , At('&'+'&',laConfig(m.I)) - 25 ) ) + If Not Empty(lcValue) Then + lo_CFG.c_DBF_Conversion_Included = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > DBF_Conversion_Included: ' + Transform(lo_CFG.c_DBF_Conversion_Included) ) + Endif + + Case Left( laConfig(m.I), 24 ) == Lower('DBF_Conversion_Excluded:') + lcValue = Alltrim( Substr( laConfig(m.I), 25 , At('&'+'&',laConfig(m.I)) - 25 ) ) + If Not Empty(lcValue) Then + lo_CFG.c_DBF_Conversion_Excluded = lcValue + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > DBF_Conversion_Excluded: ' + Transform(lo_CFG.c_DBF_Conversion_Excluded) ) + Endif + + Case Left( laConfig(m.I), 19 ) == Lower('DBF_BinChar_Base64:') + lcValue = Alltrim( Substr( laConfig(m.I), 20 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_DBF_BinChar_Base64 = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > DBF_BinChar_Base64: ' + Transform(lcValue) ) + Endif + + Case Left( laConfig(m.I), 19 ) == Lower('DBF_IncludeDeleted:') + lcValue = Alltrim( Substr( laConfig(m.I), 20 ) ) + If Inlist( lcValue, '0', '1' ) Then + lo_CFG.l_DBF_IncludeDeleted = ( Transform(lcValue) == '1' ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > DBF_IncludeDeleted: ' + Transform(lcValue) ) + Endif + +*Text file extensions + Case Left( laConfig(m.I), 10 ) == Lower('Extension:') + lcConfData = Alltrim( Substr( laConfig(m.I), 11 ) ) + lcExt = Alltrim( Getwordnum( lcConfData, 1, '=' ) ) + lcProp = 'c_' + lcExt + If Pemstatus( lo_CFG, lcProp, 5 ) + lcValue = Upper( Alltrim( Getwordnum( lcConfData, 2, '=' ) ) ) + lo_CFG.AddProperty( lcProp, lcValue ) +*.writeLog( 'Reconfiguración de extensión:' + ' ' + lcExt + ' a ' + lcValue ) + .writeLog( C_TAB + Justfname(lcConfigFile) + ' > ' + loLang.C_EXTENSION_RECONFIGURATION_LOC + ' ' + lcExt + ' -> ' + lcValue ) + Endif + + + Endcase + Endfor + + .writeLog( ) + + Endif && llExiste_CFG_EnDisco + +*-- ESTOS SE EVALÚAN FUERA DEL IF PORQUE NO DEPENDEN DEL CFG +*-- Y PUEDEN VENIR TAMBIÉN DE PARÁMETROS EXTERNOS. + If Inlist( Transform(tcDontShowProgress), '0', '1', '2' ) Then + lo_CFG.n_ShowProgressbar = Icase(tcDontShowProgress=='0',1, tcDontShowProgress=='1',0, 2) + Endif + If Inlist( Transform(tcDontShowErrors), '0', '1' ) Then + lo_CFG.l_ShowErrors = Not (Transform(tcDontShowErrors) == '1') + Endif +*IF NOT .l_Main_CFG_Loaded + lo_CFG.l_Recompile = (Empty(tcRecompile) Or Transform(tcRecompile) == '1' Or Directory(tcRecompile)) +*ENDIF + If Inlist( Transform(tcNoTimestamps), '0', '1' ) Then + lo_CFG.l_NoTimestamps = Not (Transform(tcNoTimestamps) == '0') + Endif + If Inlist( Transform(tcClearUniqueID), '0', '1' ) Then + lo_CFG.l_ClearUniqueID = Not (Transform(tcClearUniqueID) == '0') + Endif + If Inlist( Transform(tcDebug), '0', '1', '2' ) Then + lo_CFG.n_Debug = Int(Val(tcDebug)) + Endif + tcExtraBackupLevels = Evl( tcExtraBackupLevels, Transform( .n_ExtraBackupLevels ) ) + If Isdigit(tcExtraBackupLevels) + lo_CFG.n_ExtraBackupLevels = Int( Val( Transform(tcExtraBackupLevels) ) ) + Endif + If Inlist( Transform(tcOptimizeByFilestamp), '0', '1', '2' ) Then + lo_CFG.n_OptimizeByFilestamp = Int(Val(tcOptimizeByFilestamp)) + Endif + + .l_Main_CFG_Loaded = .T. + + If llMasterEval +* Si se inidicó un archivo CFG por parámetro (modo objeto), aqui se bloquea +* al Nş de configuración correspondiente. + If .n_CFG_EvaluateFromParam = -1 + .n_CFG_EvaluateFromParam = .n_CFG_Actual + Endif + Else +*-- Si no es llMasterEval, es porque esta llamada es cíclica desde este mismo método, +*-- y no hay parámetros para evaluar, ya que se mandan todos vacíos desde el inicial. + If Not tl_ForceLog Then + Exit + Endif &&NOT tl_ForceLog + Endif +* SF + + .writeLog( '> ' + loLang.C_USING_THIS_SETTINGS_LOC + ':' ) +*internal info, just what is read to this moment + .writeLog( C_TAB + 'CFG_Actual: ' + Transform(.n_CFG_Actual) + Icase(.n_CFG_Actual=1, ' [MASTER]', ' [SECONDARY]') ) + .writeLog( C_TAB + 'CFG_CachedAccess: ' + Transform(.l_CFG_CachedAccess) ) + .writeLog( C_TAB + 'tc_InputFile: ' + Transform(Evl(tc_InputFile,'') ) ) + .writeLog( C_TAB + 'Foxbin2prg_ConfigFile: ' + Transform(Evl(lo_CFG.c_Foxbin2prg_ConfigFile, '(Internal defaults)') ) ) + +*settings for internal work, not processing + .writeLog( C_TAB + 'Language: ' + Transform(.c_Language) + ' (' + .c_Language_In + ')' ) + .writeLog( C_TAB + 'ShowProgressbar: ' + Transform(.n_ShowProgressbar) ) + .writeLog( C_TAB + 'ShowErrors: ' + Transform(.l_ShowErrors) ) + .writeLog( C_TAB + 'ExtraBackupLevels: ' + Transform(.n_ExtraBackupLevels) ) + Do Case + Case Empty ( .c_BackgroundImage ) + .writeLog( C_TAB + 'BackgroundImage: ' + '(Empty)' ) + + Case Lower( Justfname ( .c_BackgroundImage ) ) == 'foxbin2prg.jpg' + .writeLog( C_TAB + 'BackgroundImage: ' + Transform(.c_BackgroundImage) + '(Internal default)' ) + + Otherwise + .writeLog( C_TAB + 'BackgroundImage: ' + Transform(.c_BackgroundImage) ) + + Endcase + .writeLog( C_TAB + 'Debug: ' + Transform(.n_Debug) ) + +* LScheffler, 2021/030/06: added DH HomeDir option + .writeLog( C_TAB + 'HomeDir: ' + Transform(.n_HomeDir) ) + +*Conversion operation by type + .writeLog( C_TAB + 'PJX_Conversion_Support ' + Transform(.n_PJX_Conversion_Support) ) + .writeLog( C_TAB + 'VCX_Conversion_Support ' + Transform(.n_VCX_Conversion_Support) ) + .writeLog( C_TAB + 'SCX_Conversion_Support ' + Transform(.n_SCX_Conversion_Support) ) + .writeLog( C_TAB + 'FRX_Conversion_Support ' + Transform(.n_FRX_Conversion_Support) ) + .writeLog( C_TAB + 'LBX_Conversion_Support ' + Transform(.n_LBX_Conversion_Support) ) + .writeLog( C_TAB + 'MNX_Conversion_Support ' + Transform(.n_MNX_Conversion_Support) ) + .writeLog( C_TAB + 'DBF_Conversion_Support ' + Transform(.n_DBF_Conversion_Support) ) + .writeLog( C_TAB + 'DBC_Conversion_Support ' + Transform(.n_DBC_Conversion_Support) ) + .writeLog( C_TAB + 'FKY_Conversion_Support ' + Transform(.n_FKY_Conversion_Support) ) + .writeLog( C_TAB + 'MEM_Conversion_Support ' + Transform(.n_MEM_Conversion_Support) ) + +*!* Changed by: LScheffler 19.03.2023 +* additional options controlling +* files in non subpath of the PJX +*setting for PJX files + .writeLog( C_TAB + 'CheckFileInPath: ' + Transform(.n_CheckFileInPath) ) +*!* /Changed by: LScheffler 19.03.2023 + +*setting for container files (not pjx) +*Classes and forms ( vcx / scx) + .writeLog( C_TAB + 'UseClassPerFile: ' + Transform(.n_UseClassPerFile) ) + .writeLog( C_TAB + 'ClassPerFileCheck: ' + Transform(.l_ClassPerFileCheck) ) + .writeLog( C_TAB + 'RedirectClassPerFileToMain: ' + Transform(.l_RedirectClassPerFileToMain) ) + .writeLog( C_TAB + 'RedirectClassType: ' + Transform(.n_RedirectClassType) ) + +*Databases +*!* Changed by: LScheffler 21.02.2021 +*!* change date="{^2021-02-21,10:57:00}" +* additional options controlling +* - split of DBC separated from VCX/SCX +* - new operations of DBF + .writeLog( C_TAB + 'OldFilesPerDBC: ' + Transform(.l_OldFilesPerDBC) ) + .writeLog( C_TAB + 'UseFilesPerDBC: ' + Transform(.n_UseFilesPerDBC) ) + .writeLog( C_TAB + 'RedirectFilePerDBCToMain: ' + Transform(.l_RedirectFilePerDBCToMain) ) + .writeLog( C_TAB + 'ItemPerDBCCheck: ' + Transform(.l_ItemPerDBCCheck) ) + .writeLog( C_TAB + 'DBF_BinChar_Base64: ' + Transform(.l_DBF_BinChar_Base64) ) + .writeLog( C_TAB + 'DBF_IncludeDeleted: ' + Transform(.l_DBF_IncludeDeleted) ) +*!* /Changed by: LScheffler 21.02.2021 + +*general files + .writeLog( C_TAB + 'NoTimestamps: ' + Transform(.l_NoTimestamps) ) + .writeLog( C_TAB + 'ClearUniqueID: ' + Transform(.l_ClearUniqueID) ) + .writeLog( C_TAB + 'OptimizeByFilestamp: ' + Transform(.n_OptimizeByFilestamp) ) + .writeLog( C_TAB + 'RemoveNullCharsFromCode: ' + Transform(.l_RemoveNullCharsFromCode) ) + .writeLog( C_TAB + 'RemoveZOrderSetFromProps: ' + Transform(.l_RemoveZOrderSetFromProps) ) + .writeLog( C_TAB + 'PRG_Compat_Level: ' + Transform(.n_PRG_Compat_Level) ) + +*Parameter only: + .writeLog( C_TAB + 'Recompile: ' + Transform(.l_Recompile) + ' (' + tcRecompile + ')' ) + +*pjx special + .writeLog( C_TAB + 'BodyDevInfo: ' + Transform(.n_BodyDevInfo) ) + +*dbf special + .writeLog( C_TAB + 'ClearDBFLastUpdate: ' + Transform(.l_ClearDBFLastUpdate) ) + .writeLog( C_TAB + 'ExcludeDBFAutoincNextval: ' + Transform(.n_ExcludeDBFAutoincNextval) ) + .writeLog( C_TAB + 'DBF_Conversion_Included ' + Transform(.c_DBF_Conversion_Included) ) + .writeLog( C_TAB + 'DBF_Conversion_Excluded ' + Transform(.c_DBF_Conversion_Excluded) ) + .writeLog( C_TAB + 'DBF_BinChar_Base64: ' + Transform(.l_DBF_BinChar_Base64) ) + .writeLog( C_TAB + 'DBF_IncludeDeleted: ' + Transform(.l_DBF_IncludeDeleted) ) + +*Text file extensions + .writeLog( C_TAB + 'extension: VC2 ' + Transform(.c_VC2) ) + .writeLog( C_TAB + 'extension: SC2 ' + Transform(.c_SC2) ) + .writeLog( C_TAB + 'extension: FR2 ' + Transform(.c_FR2) ) + .writeLog( C_TAB + 'extension: LB2 ' + Transform(.c_LB2) ) + .writeLog( C_TAB + 'extension: MN2 ' + Transform(.c_MN2) ) + .writeLog( C_TAB + 'extension: DB2 ' + Transform(.c_DB2) ) + .writeLog( C_TAB + 'extension: DC2 ' + Transform(.c_DC2) ) + .writeLog( C_TAB + 'extension: FK2 ' + Transform(.c_FK2) ) + .writeLog( C_TAB + 'extension: ME2 ' + Transform(.c_ME2) ) + + .writeLog( ) + Endwith && THIS + + Catch To loEx + loEx.UserValue = loEx.UserValue + 'lcConfigFile = [' + Transform(lcConfigFile) + ']' + CR_LF + loEx.UserValue = loEx.UserValue + 'lc_CFG_Path = [' + Transform(lc_CFG_Path) + ']' + CR_LF + loEx.UserValue = loEx.UserValue + 'lcValue = [' + Transform(lcValue) + ']' + CR_LF + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To lo_Configuration, lo_CFG, loEx + Release tcDontShowProgress, tcDontShowErrors, tcNoTimestamps, tcDebug, tcRecompile, tcExtraBackupLevels ; + , tcClearUniqueID, tcOptimizeByFilestamp, tc_InputFile ; + , lcConfigFile, llExiste_CFG_EnDisco, laConfig, I, lcConfData, lcExt, lcValue, lc_CFG_Path ; + , lo_CFG, lo_Configuration, loEx + + Endtry + + Return + Endproc + + + Function comparedFilesAreEqual +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFilename1 (v! IN ) Nombre del archivo1 a comparar +* tcFilename2 (v! IN ) Nombre del archivo2 a comparar +* tcStrFileName2 (v! IN ) ***NO IMPLEMENTADO*** Contenido del archivo2 a comparar +*--------------------------------------------------------------------------------------------------- + Lparameters tcFilename1, tcFilename2, tcStrFileName2 + + Local lnComparacion, lnLen1, lnLen2, lnHandle1, lnHandle2, lnTipoComp, lnChunkSize ; + , loEx As Exception + + Try + Store -1 To lnComparacion, lnHandle1, lnHandle2 + lnTipoComp = 0 + lnChunkSize = 65535 + + Do Case + Case Not Empty(tcFilename1) And Not Empty(tcFilename2) + lnTipoComp = 1 + lnHandle1 = Fopen( tcFilename1 ) + + If lnHandle1 = -1 + Exit + Endif + + lnHandle2 = Fopen( tcFilename2 ) + + If lnHandle2 = -1 + Exit + Endif + + lnLen1 = Fseek( lnHandle1, 0, 2 ) + lnLen2 = Fseek( lnHandle2, 0, 2 ) + +*-- Comparación de tamańo + If lnLen1 <> lnLen2 Then + lnComparacion = 0 && Son distintos + Exit + Endif + +*-- Comparación de contenido + Fseek( lnHandle1, 0, 0 ) + Fseek( lnHandle2, 0, 0 ) + + Do While Not ( Feof(lnHandle1) Or Feof(lnHandle2) ) +*IF NOT SYS( 2007, FREAD( lnHandle1, lnChunkSize ), -1, 1 ) == SYS( 2007, FREAD( lnHandle2, lnChunkSize ), -1, 1 ) THEN + If Not Fread( lnHandle1, lnChunkSize ) == Fread( lnHandle2, lnChunkSize ) Then + lnComparacion = 0 && Son distintos + Exit + Endif + Enddo + + If lnComparacion = 0 Then + Exit + Endif + + lnComparacion = 1 && Son iguales + + Endcase + + Catch To loEx + lnComparacion = -1 && Error + Throw + + Finally + Do Case + Case lnTipoComp = 1 + Fclose( lnHandle1 ) + Fclose( lnHandle2 ) + + Endcase + + Endtry + + Return lnComparacion + Endfunc + + + Function filenameFoundInFilter +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFilename (v! IN ) Nombre del archivo a evaluar +* tcFilters (v! IN ) Filtros a evaluar (*,??E.*,R*.*) +*--------------------------------------------------------------------------------------------------- + Lparameters tcFileName, tcFilters + + Local llFound, laFiltros(1) + tcFileName = Upper(tcFileName) + + For I = 1 To Alines( laFiltros, tcFilters + ',', 1+4, ',' ) + If Like( Upper(laFiltros(m.I)), tcFileName ) + llFound = .T. + Exit + Endif + Endfor + + Release tcFileName, tcFilters, laFiltros + Return llFound + Endfunc + + + Procedure get_DBF_Configuration(tc_InputFile As String, to_out_DBF_CFG As Object, tlGenerateLog As Boolean) As Integer +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (@! IN ) Ruta al archivo con Extensión para comprobar si tiene soporte de conversión +* to_out_DBF_CFG (@? OUT) Objeto CFG del DBF indicado, con las propiedades que contenga el CFG y sus valores +* RETORNO (v? OUT) Devuelve 0 si no existe el archivo CFG y 1 si lo encuentra +*--------------------------------------------------------------------------------------------------- + #If .F. + Local to_out_DBF_CFG As CL_DBF_CFG Of 'FOXBIN2PRG.PRG' + #Endif + + Local lcTableCFG, lnFileCount, laDirFile(1,5), I, lcConfigItem, lcValue + lcTableCFG = tc_InputFile + '.CFG' + lnFileCount = Adir(laDirFile, lcTableCFG) + + If lnFileCount = 1 + + to_out_DBF_CFG = Createobject("CL_DBF_CFG") + + If tlGenerateLog Then + This.writeLog() + This.writeLog(' > Found DBF configuration file: ' + lcTableCFG) + Endif + + For I = 1 To Alines( laConfig, Filetostr( lcTableCFG ), 1+4 ) + lcConfigItem = Lower( laConfig(m.I) ) + + Do Case + Case Inlist( Left( lcConfigItem, 1 ), '*', '#', '/', "'" ) + Loop + + Case Left( lcConfigItem, 23 ) == Lower('DBF_Conversion_Support:') + to_out_DBF_CFG.n_DBF_Conversion_Support = Int( Val( Substr( laConfig(m.I), 24 ) ) ) + If tlGenerateLog Then + This.writeLog(' ' + Justfname(lcTableCFG) + ' > DBF_Conversion_Support: ' + Transform(to_out_DBF_CFG.n_DBF_Conversion_Support) ) + Endif + + Case Left( lcConfigItem, 21 ) == Lower('DBF_Conversion_Order:') + to_out_DBF_CFG.DBF_Conversion_Order = Alltrim( Substr( laConfig(m.I), 22 , At('&'+'&',laConfig(m.I)) - 22 ) ) + If tlGenerateLog Then + This.writeLog(' ' + Justfname(lcTableCFG) + ' > DBF_Conversion_Order: ' + to_out_DBF_CFG.DBF_Conversion_Order ) + Endif + + Case Left( lcConfigItem, 25 ) == Lower('DBF_Conversion_Condition:') + to_out_DBF_CFG.DBF_Conversion_Condition = Alltrim( Substr( laConfig(m.I), 26 , At('&'+'&',laConfig(m.I)) - 26 ) ) + If tlGenerateLog Then + This.writeLog(' ' + Justfname(lcTableCFG) + ' > DBF_Conversion_Condition: ' + to_out_DBF_CFG.DBF_Conversion_Condition ) + Endif + +*!* Changed by: LScheffler 18.03.2021 +*!* change date="{^2021-03-18,10:57:00}" +* additional options controlling +* - new operations of DBF, additional list of non structural index files + Case Left( lcConfigItem, 14 ) == Lower('DBF_IndexList:') + to_out_DBF_CFG.DBF_IndexList = Substr( laConfig(m.I), 15 , At('&'+'&',laConfig(m.I)) - 15 ) + If tlGenerateLog Then + This.writeLog(' ' + Justfname(lcTableCFG) + ' >DBF_IndexList: ' + Transform(to_out_DBF_CFG.DBF_IndexList) ) + Endif +*!* /Changed by: LScheffler 18.03.2021 + +*!* Changed by: LScheffler 21.02.2021 +*!* change date="{^2021-02-21,10:57:00}" +* additional options controlling +* - new operations of DBF +*!* /Changed by: LScheffler 21.02.2021 + Case Left( lcConfigItem, 19 ) == Lower('DBF_BinChar_Base64:') + lcValue = Alltrim( Substr( laConfig(m.I), 20 ) ) + If Inlist( m.lcValue, '0', '1' ) Then + to_out_DBF_CFG.l_DBF_BinChar_Base64 = ( Transform(m.lcValue ) == '1' ) + If tlGenerateLog Then + This.writeLog(' ' + Justfname(lcTableCFG) + ' > DBF_BinChar_Base64: ' + Transform(to_out_DBF_CFG.l_DBF_BinChar_Base64) ) + Endif + Endif + + Case Left( lcConfigItem, 19 ) == Lower('DBF_IncludeDeleted:') + lcValue = Alltrim( Substr( laConfig(m.I), 20 ) ) + If Inlist( m.lcValue, '0', '1' ) Then + to_out_DBF_CFG.l_DBF_IncludeDeleted = ( Transform( m.lcValue ) == '1' ) + If tlGenerateLog Then + This.writeLog(' ' + Justfname(lcTableCFG) + ' > DBF_IncludeDeleted: ' + Transform(to_out_DBF_CFG.l_DBF_IncludeDeleted) ) + Endif + Endif +*!* /Changed by: LScheffler 21.02.2021 + + Endcase + Endfor + + If tlGenerateLog Then + This.writeLog() + Endif + + Endif + + Return lnFileCount + Endproc + + + Procedure get_Ext2FromExt +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcExt (@! IN ) Extensión para comprobar si tiene soporte de conversión +* tcDir (@? IN ) Directorio del que devolver su configuración +* RETORNO (v? OUT) .T. si tiene soporte de conversión, .F. si no lo tiene +*--------------------------------------------------------------------------------------------------- + Lparameters tcExt, tcDir + + Local lcExt2 + tcExt = Upper(tcExt) + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If Not Empty(tcDir) + .evaluateConfiguration( '', '', '', '', '', '', '', '', tcDir, 'D' ) + Endif + + lcExt2 = Icase( tcExt == 'PJX', .c_PJ2 ; + , tcExt == 'VCX', .c_VC2 ; + , tcExt == 'SCX', .c_SC2 ; + , tcExt == 'FRX', .c_FR2 ; + , tcExt == 'LBX', .c_LB2 ; + , tcExt == 'MNX', .c_MN2 ; + , tcExt == 'DBF', .c_DB2 ; + , tcExt == 'DBC', .c_DC2 ; + , tcExt ) + Endwith && THIS + + Release tcExt + Return lcExt2 + Endproc + + + Procedure hasSupport_Bin2Prg(tcFileName As String, tcDir As String) As Boolean +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFilename (@! IN ) Extensión para comprobar si el archivo tiene soporte de conversión +* tcDir (@? IN ) Directorio del que devolver su configuración +* RETORNO (v? OUT) .T. si tiene soporte de conversión, .F. si no lo tiene +*--------------------------------------------------------------------------------------------------- + Local llhasSupport, lcExt, lcDir ; + , loDBF_CFG As CL_DBF_CFG Of 'FOXBIN2PRG.PRG' + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + loDBF_CFG = Null + lcExt = Upper(Justext('.' + tcFileName)) + +*!* Changed by: LScheffler 13.6.2022 +*!* +*!* Changed by: LScheffler
+*!* https://github.com/fdbozzo/foxbin2prg/issues/56 / Configfile is ignored if foldername has "." v1.19.74 +*!* On operation per folder, change of folder must change configuration +*!* this method does not recieve tcDir in such case +*!*
+*!*
+ +*!* If '\' $ tcFileName And lcExt == 'DBF' Then +*!* lcDir = Justpath(tcFileName) +*!* .get_DBF_Configuration(tcFileName, @loDBF_CFG) +*!* Else +*!* lcDir = tcDir +*!* ENDIF + + Do Case + Case '\' $ tcFileName And lcExt == 'DBF' + lcDir = Justpath(tcFileName) + .get_DBF_Configuration(tcFileName, @loDBF_CFG) + Case Not Empty(tcDir) + lcDir = tcDir + Case Vartype( tcFileName ) = "C" + lcDir = Justpath( tcFileName ) + Endcase + +*!* /Changed by: LScheffler 13.6.2022 + + If Not Empty(lcDir) + .evaluateConfiguration( '', '', '', '', '', '', '', '', lcDir, 'D' ) + Endif + + llhasSupport = Icase( lcExt == 'PJX', .n_PJX_Conversion_Support > 0 ; + , lcExt == 'VCX', .n_VCX_Conversion_Support > 0 ; + , lcExt == 'SCX', .n_SCX_Conversion_Support > 0 ; + , lcExt == 'FRX', .n_FRX_Conversion_Support > 0 ; + , lcExt == 'LBX', .n_LBX_Conversion_Support > 0 ; + , lcExt == 'MNX', .n_MNX_Conversion_Support > 0 ; + , lcExt == 'DBC', .n_DBC_Conversion_Support > 0 ; + , lcExt == 'DBF', Not Isnull(loDBF_CFG) And loDBF_CFG.n_DBF_Conversion_Support > 0 Or .n_DBF_Conversion_Support > 0 ; + , lcExt == 'FKY', .n_FKY_Conversion_Support > 0 ; + , lcExt == 'MEM', .n_MEM_Conversion_Support > 0 ; + , .F. ) + Endwith && THIS + + Return llhasSupport + Endproc + + + Procedure hasSupport_Prg2Bin(tcFileName As String, tcDir As String) As Boolean +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFilename (@! IN ) Extensión para comprobar si el archivo tiene soporte de conversión +* tcDir (@? IN ) Directorio del que devolver su configuración +* RETORNO (v? OUT) .T. si tiene soporte de conversión, .F. si no lo tiene +*--------------------------------------------------------------------------------------------------- + Local llhasSupport, lcExt, lcDir ; + , loDBF_CFG As CL_DBF_CFG Of 'FOXBIN2PRG.PRG' + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + loDBF_CFG = Null + lcExt = Upper(Justext('.' + tcFileName)) + +*!* Changed by: LScheffler 13.6.2022 +*!* +*!* Changed by: LScheffler
+*!* https://github.com/fdbozzo/foxbin2prg/issues/56 / Configfile is ignored if foldername has "." v1.19.74 +*!* On operation per folder, change of folder must change configuration +*!* this method does not recieve tcDir in such case +*!*
+*!*
+ +*!* If '\' $ tcFileName And lcExt == .c_DB2 Then +*!* lcDir = Justpath(tcFileName) +*!* .get_DBF_Configuration(tcFileName, @loDBF_CFG) +*!* Else +*!* lcDir = tcDir +*!* Endif + + Do Case + Case '\' $ tcFileName And lcExt == .c_DB2 + lcDir = Justpath(tcFileName) + .get_DBF_Configuration(tcFileName, @loDBF_CFG) + Case Not Empty(tcDir) + lcDir = tcDir + Case Vartype( tcFileName ) = "C" + lcDir = Justpath( tcFileName ) + Endcase + +*!* /Changed by: LScheffler 13.6.2022 + + If Not Empty(lcDir) + .evaluateConfiguration( '', '', '', '', '', '', '', '', lcDir, 'D' ) + Endif + + llhasSupport = Icase( lcExt == .c_PJ2, .n_PJX_Conversion_Support = 2 ; + , lcExt == .c_VC2, .n_VCX_Conversion_Support = 2 ; + , lcExt == .c_SC2, .n_SCX_Conversion_Support = 2 ; + , lcExt == .c_FR2, .n_FRX_Conversion_Support = 2 ; + , lcExt == .c_LB2, .n_LBX_Conversion_Support = 2 ; + , lcExt == .c_MN2, .n_MNX_Conversion_Support = 2 ; + , lcExt == .c_FK2, .n_FKY_Conversion_Support = 2 ; + , lcExt == .c_ME2, .n_MEM_Conversion_Support = 2 ; + , lcExt == .c_DB2, Not Isnull(loDBF_CFG) And Inlist(loDBF_CFG.n_DBF_Conversion_Support, 2, 8) ; + OR (Inlist(.n_DBF_Conversion_Support, 2, 8) ; + AND (Isnull(loDBF_CFG) Or Not Inlist(loDBF_CFG.n_DBF_Conversion_Support, 1, 4))) ; + , lcExt == .c_DC2, .n_DBC_Conversion_Support = 2 ; + , .F. ) + Endwith && THIS + + Return llhasSupport + Endproc + + + Procedure conversionSupportType(tcFileName As String, tlGenerarLog As Boolean) As Integer +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcFilename (@! IN ) Extensión para comprobar si el archivo tiene soporte de conversión +* RETORNO (v? OUT) Devuelve el código de soporte +*--------------------------------------------------------------------------------------------------- + Local lnSupportType, lcExt, lcDir, lcFilename ; + , loDBF_CFG As CL_DBF_CFG Of 'FOXBIN2PRG.PRG' + + Try + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + loDBF_CFG = Null + lcExt = Upper(Justext('.' + tcFileName)) + + If '\' $ tcFileName And Inlist(lcExt, .c_DB2, 'DBF') Then + lcFilename = Forceext(tcFileName, 'DBF') + lcDir = Justpath(lcFilename) + .get_DBF_Configuration(lcFilename, @loDBF_CFG, tlGenerarLog) + Else + lcDir = Sys(5) + Curdir() + Endif + + If Not Empty(lcDir) + .evaluateConfiguration( '', '', '', '', '', '', '', '', lcDir, 'D' ) + Endif + + lnSupportType = Icase( ; + INLIST(lcExt, .c_PJ2, 'PJX'), .n_PJX_Conversion_Support ; + , Inlist(lcExt, .c_VC2, 'VCX'), .n_VCX_Conversion_Support ; + , Inlist(lcExt, .c_SC2, 'SCX'), .n_SCX_Conversion_Support ; + , Inlist(lcExt, .c_FR2, 'FRX'), .n_FRX_Conversion_Support ; + , Inlist(lcExt, .c_LB2, 'LBX'), .n_LBX_Conversion_Support ; + , Inlist(lcExt, .c_MN2, 'MNX'), .n_MNX_Conversion_Support ; + , Inlist(lcExt, .c_FK2, 'FKY'), .n_FKY_Conversion_Support ; + , Inlist(lcExt, .c_ME2, 'MEM'), .n_MEM_Conversion_Support ; + , Inlist(lcExt, .c_DB2, 'DBF'), Icase( Isnull(loDBF_CFG) Or loDBF_CFG.n_DBF_Conversion_Support = 0, .n_DBF_Conversion_Support, loDBF_CFG.n_DBF_Conversion_Support ) ; + , Inlist(lcExt, .c_DC2, 'DBC'), .n_DBC_Conversion_Support ; + , 0 ) + + lnSupportType = Int(lnSupportType) + Endwith && THIS + + Finally + Store Null To loDBF_CFG + Release loDBF_CFG + Endtry + + Return lnSupportType + Endproc + + + Procedure execute +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (v! IN ) Nombre completo (fullpath) del archivo a convertir o nombre del directorio a procesar +* - En modo compatibilidad con Visual SourceSafe, se usa para preguntar el tipo de soporte de conversión para el tipo de archivo indicado +* tcType (v? IN ) Tipo de archivo de entrada. Compatibilidad con SCCTEXT.PRG +* - Si se indica "*" y tc_InputFile es un PJX, se procesan todos los archivos del proyecto y el PJX/2 +* - Si se indica "*-" y tc_InputFile es un PJX, se procesan todos los archivos del proyecto sin el PJX/2 +* - Si se indica "BIN2PRG", se procesa el directorio indicado en tc_InputFile para generar los TX2 +* - Si se indica "PRG2BIN", se procesa el directorio indicado en tc_InputFile para generar los BIN +* - En modo compatibilidad con Visual SourceSafe, indica el tipo de archivo a convertir +* tcTextName (v? IN ) Nombre del archivo texto. (Solo para compatibilidad con Visual SourceSafe) +* tlGenText (v? IN ) .T.=Genera Texto, .F.=Genera Binario. (Solo para compatibilidad con Visual SourceSafe) +* tcDontShowErrors (v? IN ) '1' para no mostrar mensajes de error (MESSAGEBOX) +* tcDebug (v? IN ) '1' para habilitar modo debug (SOLO DESARROLLO) +* tcDontShowProgress (v? IN ) '1' para inhabilitar la barra de progreso +* toModulo (@? OUT) Referencia de objeto del módulo generado (para Unit Testing) +* toEx (@? OUT) Objeto con información del error +* tlRelanzarError (v? IN ) Indica si el error debe relanzarse o no +* tcOriginalFileName (v? IN ) Sirve para los casos en los que inputFile es un nombre temporal y se quiere generar +* el nombre correcto dentro de la versión texto (por ej: en los PJ2 y las cabeceras) +* tcRecompile (v? IN ) Indica recompilar ('1') el binario una vez regenerado. [Cambio de funcionamiento por defecto] +* Este cambio es para ganar tiempo, velocidad y seguridad. Además la recompilación que hace FoxBin2Prg +* se hace desde el directorio del archivo, con lo que las referencias relativas pueden +* generar errores de compilación, típicamente los #include. +* NOTA: Si en vez de '1' se indica un Path (p.ej, el del proyecto, se usará como base para recompilar +* tcNoTimestamps (v? IN ) Indica si se debe anular el timestamp ('1') o no ('0' ó vacío) +* tcBackupLevels (v? IN ) Indica la cantidad de niveles de backup a realizar (por defecto '1') +* tcClearUniqueID (v? IN ) Indica si se debe limpiar el UniqueID ('1') o no ('0' ó vacío) +* tcOptimizeByFilestamp (v? IN ) Indica si se debe optimizar por filestamp mayor o igual ('1'), solo igual ('2') o no optimizar ('0' ó vacío) +* tcCFG_File (v? IN ) Indica si se debe usar un archivo de configuración distinto al predeterminado +*-------------------------------------------------------------------------------------------------------------- + Lparameters tc_InputFile, tcType, tcTextName, tlGenText, tcDontShowErrors, tcDebug, tcDontShowProgress ; + , toModulo, toEx As Exception, tlRelanzarError, tcOriginalFileName, tcRecompile, tcNoTimestamps ; + , tcBackupLevels, tcClearUniqueID, tcOptimizeByFilestamp, tcCFG_File + + Try + Local I, lcPath, lnCodError, lcFileSpec, lcFile, laFiles(1,5), laDirInfo(1,5), lcInputFile_Type, lc_OldSetNotify ; + , lnFileCount, lcErrorInfo, lcErrorFile, lnPCount, laParams(1), lnConversionOption, lnErrorIcon, llError ; + , lcOldSetEscape, lcOldOnEscape, llEscKeyRestored, lcType ; + , loEx As Exception ; + , loCFG As CL_CFG Of 'FOXBIN2PRG.PRG' ; + , loFSO As Scripting.FileSystemObject ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loFrm_Interactive As frm_interactive Of 'FOXBIN2PRG.PRG' ; + , loFrm_Main As frm_main Of 'FOXBIN2PRG.PRG' ; + , loDBF_CFG As CL_DBF_CFG Of 'FOXBIN2PRG.PRG' ; + , loWSH As WScript.Shell ; + , lnVFPVersion + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + lc_OldSetNotify = Set("Notify") + Set Notify Off + lnCodError = 0 + loLang = _Screen.o_FoxBin2Prg_Lang + loFSO = .o_FSO + loWSH = .o_WSH + loCFG = Null + lnPCount = 0 + lcInputFile_Type = '' + .l_Error = .F. + lcType = Evl(tcType,'') + tcType = Upper( lcType ) + llEscKeyRestored = .T. + lnVFPVersion = Version(5) + .declareDLL() + + If This.l_CancelWithEscKey Then + lcOldSetEscape = Set("Escape") + lcOldOnEscape = On("Escape") + On Escape Error 1799 + Set Escape On + llEscKeyRestored = .F. + Endif + + Do Case + Case lnVFPVersion = 900 And Int( Val( Substr( Version(4), Rat('.', Version(4)) + 1 ) ) ) < 3504 + Error loLang.C_INCORRECT_VFP9_VERSION__MISSING_SP1_LOC + + Case lnVFPVersion < 900 + Error loLang.C_INCORRECT_VFP9_VERSION__MISSING_SP1_LOC + + Case '\' $ tcType + Error loLang.C_INVALID_PARAMETER_LOC + ':' + CR_LF ; + + 'tcType = "' + tcType + '"' + CR_LF ; + + CR_LF ; + + loLang.C_ALLOWED_VALUES_ARE_LOC + ': ' + CR_LF ; + + '*, *-, -BIN2PRG, -PRG2BIN, -SHOWMSG, -SIMERR_I0, -SIMERR_I1, -SIMERR_O1' + + Otherwise +* OK all versions from 900(3504) and up. For VFPA Guys :) + Endcase + + Do Case + Case Atc('-SIMERR_I0','-'+tcType) > 0 + .c_SimulateError = 'SIMERR_I0' + Case Atc('-SIMERR_I1','-'+tcType) > 0 + .c_SimulateError = 'SIMERR_I1' + Case Atc('-SIMERR_O1','-'+tcType) > 0 + .c_SimulateError = 'SIMERR_O1' + Endcase + + If .l_AutoClearProcessedFiles Then + .clearProcessedFiles() && Para evitar acumular procesos anteriores + Endif + +*-- Funciona y lee los parámetros, pero no le veo un caso de uso claro, ya que si se eligen +*-- varios directorios de proyecto, la compilación será errónea. 12/12/2014 +*.readInputVFPParams( @laParams, @lnPCount ) + +*IF lnPCount > 0 THEN +* .writeLog( 'Params.Externos: ' + TRANSFORM(lnPCount,'@L ##') ) +* FOR I = 1 TO lnPCount +* .writeLog( 'Param.' + TRANSFORM(m.I,'@L ##') + ' [' + laParams(m.I) + ']' ) +* ENDFOR +* EXIT +*ENDIF + + +*-- Reconocimiento de la clase indicada +*-- Ej: [c:\desa\test\library.vcx::classname] + If '::' $ tc_InputFile Then + tc_InputFile = Strtran(tc_InputFile, '::', '|') + .c_ClassOperationType = Evl( Upper( Left( Alltrim( Getwordnum( tc_InputFile, 3, '|' ) ), 1) ), 'E') + .c_ClassToConvert = Lower( Alltrim( Getwordnum( tc_InputFile, 2, '|' ) ) ) +* CUIDADO!, evaluar esta última, que si no las anteriores no evalúan. + tc_InputFile = Lower( Alltrim( Getwordnum( tc_InputFile, 1, '|' ) ) ) + Else + .c_ClassOperationType = '' + Endif + + If Vartype(tcCFG_File) = "O" +* Validar el objeto + loCFG = tcCFG_File + If Not (loCFG.Class == Proper('CL_CFG')) + Error 'CFG object: Invalid class. Please, generate it with get_DirSettings()' + Endif + + .c_Foxbin2prg_ConfigFile = loCFG + .n_CFG_EvaluateFromParam = 1 + + Else + .c_Foxbin2prg_ConfigFile = Evl( tcCFG_File, .c_Foxbin2prg_ConfigFile ) + .n_CFG_EvaluateFromParam = (Iif(Empty(tcCFG_File), 0, 1)) + Endif + +*-- Ajusto la ruta si no es absoluta + tc_InputFile = .get_AbsolutePath( tc_InputFile, .c_CurDir ) + +*-- Determino el tipo de InputFile (Archivo o Directorio) + If Empty(lcInputFile_Type) And Not Empty(tc_InputFile) + Do Case + Case Len(tc_InputFile) = 1 + lcInputFile_Type = C_FILETYPE_QUERYSUPPORT + + Case Adir(laDirInfo, tc_InputFile, "D") = 1 And Substr( laDirInfo(1,5), 5, 1 ) = "D" +*-- Ejemplo: "c:\desa\" + lcInputFile_Type = C_FILETYPE_DIRECTORY + + Otherwise +*-- Ejemplo: "c:\desa\*.scx", "c:\desa\file.ext", (lista de archivos) + lcInputFile_Type = C_FILETYPE_FILE + Endcase + Endif + + If Empty(tcRecompile) And Not Empty(lcInputFile_Type) And Not lcInputFile_Type == C_FILETYPE_QUERYSUPPORT Then + If lcInputFile_Type == C_FILETYPE_DIRECTORY Then + tcRecompile = tc_InputFile + Else + tcRecompile = Justpath( tc_InputFile ) + Endif + Endif + + tcRecompile = Evl(tcRecompile,'1') + .c_Recompile = tcRecompile + + .writeLog( Replicate( '*', 100 ) ) + .writeLog( loLang.C_MAIN_EXECUTION_LOC, 2 ) + .writeLog( Replicate( '*', 100 ) ) + .writeLog( '> ' + loLang.C_EXTERNAL_PARAMETERS_LOC + ':' ) + .writeLog( C_TAB + 'tc_InputFile: ' + Transform( Evl(tc_InputFile, '(empty) -> Will use Default [' + .c_InputFile + ']' ) ) ) + .writeLog( C_TAB + 'tcType: ' + Transform( Evl(lcType, '(empty)' ) ) ) + .writeLog( C_TAB + 'tcTextName: ' + Transform( Evl(tcTextName, '(empty)' ) ) ) + .writeLog( C_TAB + 'tlGenText: ' + Transform( Evl(tlGenText, '(empty)' ) ) ) + .writeLog( C_TAB + 'tcDontShowErrors: ' + Transform( Evl(tcDontShowErrors, '(empty) -> Will use Default [' + Transform(.l_ShowErrors) + ']' ) ) ) + .writeLog( C_TAB + 'tcDebug: ' + Transform( Evl(tcDebug, '(empty) -> Will use Default [' + Transform(.n_Debug) + ']' ) ) ) + .writeLog( C_TAB + 'tcDontShowProgress: ' + Transform( Evl(tcDontShowProgress, '(empty) -> Will use Default [' + Transform(.n_ShowProgressbar) + ']' ) ) ) + .writeLog( C_TAB + 'tlRelanzarError: ' + Transform( Evl(tlRelanzarError, '(empty)' ) ) ) + .writeLog( C_TAB + 'tcOriginalFileName: ' + Transform( Evl(tcOriginalFileName, '(empty) -> Will use Default [' + .c_OriginalFileName + ']' ) ) ) + .writeLog( C_TAB + 'tcRecompile: ' + Transform( Evl(tcRecompile, '(empty) -> Will use Default [' + .c_Recompile + ']' ) ) ) + .writeLog( C_TAB + 'tcNoTimestamps: ' + Transform( Evl(tcNoTimestamps, '(empty) -> Will use Default [' + Transform(.l_NoTimestamps) + ']' ) ) ) + .writeLog( C_TAB + 'tcBackupLevels: ' + Transform( Evl(tcBackupLevels, '(empty) -> Will use Default [' + Transform(.n_ExtraBackupLevels) + ']' ) ) ) + .writeLog( C_TAB + 'tcClearUniqueID: ' + Transform( Evl(tcClearUniqueID, '(empty) -> Will use Default [' + Transform(.l_ClearUniqueID) + ']' ) ) ) + .writeLog( C_TAB + 'tcOptimizeByFilestamp: ' + Transform( Evl(tcOptimizeByFilestamp, '(empty) -> Will use Default [' + Transform(.n_OptimizeByFilestamp) + ']' ) ) ) + .writeLog( ) + +*-- ARCHIVO DE CONFIGURACIÓN PRINCIPAL + +*!* Changed by: LScheffler 09.3.2021 +*!* change date="{^2021-03-09,08:06:00}" +* log settings for tcCFG_File - cfg as object + .evaluateConfiguration( @tcDontShowProgress, @tcDontShowErrors, @tcNoTimestamps, @tcDebug, @tcRecompile, @tcBackupLevels ; + , @tcClearUniqueID, @tcOptimizeByFilestamp, @tc_InputFile, @lcInputFile_Type, , Vartype(tcCFG_File) = "O" ) +*!* /Changed by: LScheffler 09.3.2021 + +*!* Changed by: LScheffler 04.3.2021 +*!* change date="{^2021-03-04,13:25:00}" +* for Input file in the form file[.baseclass].class.vc2 (normaly sc2 too, but no support in old code) +* allow to import only the class to file.VCX with n_RedirectClassType = 2 +* n_RedirectClassType = 0 will import all classes of file.VCX (as just handing file.vc2) +* n_RedirectClassType = 1 will import the class to single lib file[.baseclass].class.VCX + Do Case + Case ( Lower(m.lcType)=='-c' Or Lower(m.lcType)=='c' ) +* not handled + Case ( m.lcType=='-t' Or m.lcType=='t' ) +* not handled + Case .n_RedirectClassType # 2 +* not handled + Case !Empty(.c_ClassToConvert) +* not otherwise + Case .n_UseClassPerFile = 0 +* not handled + Case Occurs('.',m.tc_InputFile) > .n_UseClassPerFile +* we must have more dots then UseClassPerFile, because there is an extension + +*class + .c_ClassToConvert = Lower( Justext( Juststem( m.tc_InputFile ) ) ) +*remove class + tc_InputFile = Lower( Justpath( m.tc_InputFile ) + '\' + Juststem( Juststem( m.tc_InputFile ) ) + '.' + Justext( m.tc_InputFile ) ) +*remove baseclass + If .n_UseClassPerFile = 2 +*remove baseclass + tc_InputFile = Lower( Justpath( m.tc_InputFile ) + '\' + Juststem( Juststem( m.tc_InputFile ) ) + '.' + Justext( m.tc_InputFile ) ) + Endif +* count anything then -BIN2PRG as import + .c_ClassOperationType = Iif( Atc('-BIN2PRG','-'+tcType) > 0 , 'E', 'I') + + Otherwise +* not handled + Endcase +*!* /Changed by: LScheffler 04.3.2021 + +* Redefinir nombre archivo de entrada según el tipo de conversión (IMPORT/EXPORT) + If .c_ClassOperationType = 'I' +* En el caso de importar, debo cambiar la sintaxis de tc_InputFile para poder usar +* la conversión existente de clase vc2. +* Esto deja un archivo con sintaxis "classlib.vcx::classname::import" en "classlib.classname.vc2" + If .n_UseClassPerFile = 2 + tc_InputFile = Forceext(tc_InputFile, '') + '.*.' + .c_ClassToConvert + '.' + .c_VC2 + + If Adir(laFiles, tc_InputFile) = 1 + tc_InputFile = Fullpath( laFiles(1,1), tc_InputFile ) + Endif + + Else && Asumo .n_UseClassPerFile = 1 + tc_InputFile = Forceext(tc_InputFile, '') + '.' + .c_ClassToConvert + '.' + .c_VC2 + + Endif + Endif + + loLang = _Screen.o_FoxBin2Prg_Lang + + Do Case + Case Version(5) < 900 +*-- 'ĄFOXBIN2PRG es solo para Visual FoxPro 9.0!' + Messagebox( loLang.C_FOXBIN2PRG_JUST_VFP_9_LOC, 0+64+4096, 'FoxBin2Prg ' + This.c_FB2PRG_EXE_Version + ': ' + loLang.C_FOXBIN2PRG_WARN_CAPTION_LOC + ' (' + .c_Language + ')', 60000 ) + lnCodError = 1 + +*!* Changed by: LScheffler 15.2.2021 +*!* change date="{^2021-02-15,18:44:00}" +* added option to create config files + Case ( m.lcType=='-t' Or m.lcType=='t' ) And ( Vartype( m.tc_InputFile )='C' And !Empty( m.tc_InputFile ) ) + loLang = _Screen.o_FoxBin2Prg_Lang + Strtofile( Strtran( Strtran( '*' + m.loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_tab_cfg, 0h0D0A, 0h0D0A + '*'), 0h0D0A + '*' + 0h0D0A, 0h0D0A0D0A), m.tc_InputFile ) + + Case ( m.lcType=='-c' Or m.lcType=='c' ) + tc_InputFile = Iif( Vartype( m.tc_InputFile )='C' And !Empty( m.tc_InputFile ), m.tc_InputFile, 'FoxBin2Prg._cfg' ) + loLang = _Screen.o_FoxBin2Prg_Lang + Strtofile( Strtran( '*' + Strtran( m.loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_cfg, 0h0D0A, 0h0D0A + '*'), 0h0D0A + '*' + 0h0D0A, 0h0D0A0D0A), m.tc_InputFile ) +*!* /Changed by: LScheffler 15.2.2021 + +*!* Changed by: LScheffler 07.3.2021 +*!* change date="{^2021-03-07,18:44:00}" +* added option to create config files with values + Case ( m.lcType=='-C' Or m.lcType=='C' ) + Local; + lcText As String,; + lcValue As String,; + lcReturn As String,; + lnLines As Number,; + lnLine As Number,; + lnOptions As Number,; + lnOption As Number + + lnOptions = 49 + + Local Array; + laLines(1),; + laOptions(m.lnOptions,3) + + tc_InputFile = Iif( Vartype( m.tc_InputFile )='C' And !Empty( m.tc_InputFile ), m.tc_InputFile, 'FoxBin2Prg._cfg' ) + loLang = _Screen.o_FoxBin2Prg_Lang + lcText = Strtran( '*' + Strtran( m.loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_cfg, 0h0D0A, 0h0D0A + '*'), 0h0D0A + '*' + 0h0D0A, 0h0D0A0D0A) + lnLines = Alines(laLines,m.lcText) + +*now for each option + laOptions(01,1) = "*ShowProgressbar:" && 0=Don't show, 1=Allways show, 2= Show only for multi-file processing + laOptions(01,2) = ".n_ShowProgressbar" + laOptions(01,3) = 0 + laOptions(02,1) = "*DontShowErrors:" && 0,1 Show message errors by default + laOptions(02,2) = ".l_ShowErrors" + laOptions(02,3) = 3 + laOptions(03,1) = "*NoTimestamps:" && 0,1 Clear timestamps by default for minimize differences + laOptions(03,2) = ".l_NoTimestamps" + laOptions(03,3) = 1 + laOptions(04,1) = "*Debug:" && 0,1 Don't Activate individual .Log by default + laOptions(04,2) = ".n_Debug" + laOptions(04,3) = 0 + laOptions(05,1) = "*BodyDevInfo:" && 0,1 [0=Don't keep DevInfo for body pjx records], 1=Keep DevInfo + laOptions(05,2) = ".n_BodyDevInfo" + laOptions(05,3) = 0 + laOptions(06,1) = "*ExtraBackupLevels:" && n By default 1 BAK is created. With this you can make more .N.BAK, or none + laOptions(06,2) = ".n_ExtraBackupLevels" + laOptions(06,3) = 0 + laOptions(07,1) = "*ClearUniqueID:" && 0,1 0=Keep UniqueID in text files, 1=Clear Unique ID. Useful for Diff and Merge + laOptions(07,2) = ".l_ClearUniqueID" + laOptions(07,3) = 1 + laOptions(08,1) = "*ClearDBFLastUpdate:" && 0,1 0=Keep DBF LastUpdate, 1=Clear DBF LastUpdate. Useful for Diff. + laOptions(08,2) = ".l_ClearDBFLastUpdate" + laOptions(08,3) = 1 + laOptions(09,1) = "*OptimizeByFilestamp:" && 0,1,2 1=Optimize file regeneration depending on file timestamp. Dangerous while working with branches! + laOptions(09,2) = ".n_OptimizeByFilestamp" + laOptions(09,3) = 0 + laOptions(10,1) = "*RemoveNullCharsFromCode:" && 0,1 1=.t. 1=Drop NULL chars from source code + laOptions(10,2) = ".l_RemoveNullCharsFromCode" + laOptions(10,3) = 1 + laOptions(11,1) = "*RemoveZOrderSetFromProps:" && 0,1 1=.t. 0=Do not remove ZOrderSet property from object, 1=Remove ZOrderSet property from object + laOptions(11,2) = ".l_RemoveZOrderSetFromProps" + laOptions(11,3) = 1 + laOptions(12,1) = "*Language:" && Language of shown messages and LOGs. EN=English, FR=French, ES=Espańol, DE=German, Not defined = AUTOMATIC [DEFAULT] + laOptions(12,2) = ".c_Language_In" + laOptions(12,3) = 0 + laOptions(13,1) = "*ExcludeDBFAutoincNextval:" && 0,1 [0=Do not exclude this value from db2], 1=Exclude this value from db2 + laOptions(13,2) = ".n_ExcludeDBFAutoincNextval" + laOptions(13,3) = 0 + laOptions(14,1) = "*PRG_Compat_Level:" && n [0=Legacy], 1=Use HELPSTRING as Class Procedure comment + laOptions(14,2) = ".n_PRG_Compat_Level" + laOptions(14,3) = 0 + laOptions(15,1) = "*HomeDir:" && 0,1 0 = don't save HomeDir in PJ2, [1 = save HomeDir in PJ2] + laOptions(15,2) = ".n_HomeDir" + laOptions(15,3) = 0 + laOptions(16,1) = "*PJX_Conversion_Support:" && n 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) + laOptions(16,2) = ".n_PJX_Conversion_Support" + laOptions(16,3) = 0 + laOptions(17,1) = "*VCX_Conversion_Support:" && n 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) + laOptions(17,2) = ".n_VCX_Conversion_Support" + laOptions(17,3) = 0 + laOptions(18,1) = "*SCX_Conversion_Support:" && n 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) + laOptions(18,2) = ".n_SCX_Conversion_Support" + laOptions(18,3) = 0 + laOptions(19,1) = "*FRX_Conversion_Support:" && n 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) + laOptions(19,2) = ".n_FRX_Conversion_Support" + laOptions(19,3) = 0 + laOptions(20,1) = "*LBX_Conversion_Support:" && n 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) + laOptions(20,2) = ".n_LBX_Conversion_Support" + laOptions(20,3) = 0 + laOptions(21,1) = "*DBC_Conversion_Support:" && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) + laOptions(21,2) = ".n_DBC_Conversion_Support" + laOptions(21,3) = 0 + laOptions(22,1) = "*DBF_Conversion_Support:" && n 0=No support, 1=Generate Header TXT only (Diff), 2=Generate Header TXT and BIN (Merge/Only Structure!), 4=Generate TXT with DATA (Diff), 8=Export and Import DATA (Merge/Structure & Data) + laOptions(22,2) = ".n_DBF_Conversion_Support" + laOptions(22,3) = 0 + laOptions(23,1) = "*MNX_Conversion_Support:" && n 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) + laOptions(23,2) = ".n_MNX_Conversion_Support" + laOptions(23,3) = 0 + laOptions(24,1) = "*FKY_Conversion_Support:" && n 0=No support, 1=Generate TXT only (Diff) + laOptions(24,2) = ".n_FKY_Conversion_Support" + laOptions(24,3) = 0 + laOptions(25,1) = "*MEM_Conversion_Support:" && 0=No support, 1=Generate TXT only (Diff) + laOptions(25,2) = ".n_MEM_Conversion_Support" + laOptions(25,3) = 0 + laOptions(26,1) = "*DBF_Conversion_Included:" && n If DBF_Conversion_Support:4, you can specify multiple filemasks: www,fb2p_free.dbf + laOptions(26,2) = ".c_DBF_Conversion_Included" + laOptions(26,3) = 5 + laOptions(27,1) = "*DBF_Conversion_Excluded:" && n If DBF_Conversion_Support:4, you can specify multiple filemasks: www,fb2p_free.dbf + laOptions(27,2) = ".c_DBF_Conversion_Excluded" + laOptions(27,3) = 4 + laOptions(28,1) = "*OldFilesPerDBC:" && 0,1 1=.t. 1=Turns the File per DBC options on, 0 uses the old UseClassPerFile etc settings. + laOptions(28,2) = ".l_OldFilesPerDBC" + laOptions(28,3) = 1 + laOptions(29,1) = "*UseFilesPerDBC:" && 0,1 0=One database dc2 file, 1=Multiple file.*.*.dc2 files + laOptions(29,2) = ".n_UseFilesPerDBC" + laOptions(29,3) = 0 + laOptions(30,1) = "*RedirectFilePerDBCToMain:" && 0,1 1=.t. 0=Don't redirect to file.dc2, 1=Redirect to file.tx2 when selecting file.item.*.dc2 + laOptions(30,2) = ".l_RedirectFilePerDBCToMain" + laOptions(30,3) = 1 + laOptions(31,1) = "*ItemPerDBCCheck:" && 0,1 1=.t. 0=Don't check file.item.*.dc2 inclusion, 1=Check file.item.*.dc2 inclusion + laOptions(31,2) = ".l_ItemPerDBCCheck" + laOptions(31,3) = 1 + laOptions(32,1) = "*DBF_BinChar_Base64:" && 0,1 1=.t. 0=For character type fields, if NoCPTrans 0=do not transform, 1=use Base64 transform (default) + laOptions(32,2) = ".l_DBF_BinChar_Base64" + laOptions(32,3) = 1 + laOptions(33,1) = "*DBF_IncludeDeleted:" && 0,1 1=.t. 0=Do not include deleted records (default), 1=Include deleted records + laOptions(33,2) = ".l_DBF_IncludeDeleted" + laOptions(33,3) = 1 + laOptions(34,1) = "*CheckFileInPath:" && n 0=Default,no check. Determines 2Txt deals with files not in the subfolders of the PJX + laOptions(34,2) = ".n_CheckFileInPath" + laOptions(34,3) = 0 + laOptions(35,1) = "*UseClassPerFile:" && n 0=One library tx2 file, 1=Multiple file.class.tx2 files, 2=Multiple file.baseclass.class.tx2 files + laOptions(35,2) = ".n_UseClassPerFile" + laOptions(35,3) = 0 + laOptions(36,1) = "*RedirectClassPerFileToMain:" && 0,1 1=.t. 0=Don't redirect to file.tx2, 1=Redirect to file.tx2 when selecting file.class.tx2 + laOptions(36,2) = ".l_RedirectClassPerFileToMain" + laOptions(36,3) = 1 + laOptions(37,1) = "*RedirectClassType:" && 0,1,2 For classes created with UseClassPerFile>0 in the form file[.baseclass].class.tx2 + laOptions(37,2) = ".n_RedirectClassType" + laOptions(37,3) = 0 + laOptions(38,1) = "*ClassPerFileCheck:" && 0,1 1=.t. 0=Don't check file.class.tx2 inclusion, 1=Check file.class.tx2 inclusion + laOptions(38,2) = ".l_ClassPerFileCheck" + laOptions(38,3) = 1 + laOptions(39,1) = "*extension: pj2=" && ext Text file to PJX + laOptions(39,2) = ".c_pj2" + laOptions(39,3) = 2 + laOptions(40,1) = "*extension: vc2=" && ext Text file to VCX + laOptions(40,2) = ".c_vc2" + laOptions(40,3) = 2 + laOptions(41,1) = "*extension: sc2=" && ext Text file to SCX + laOptions(41,2) = ".c_sc2" + laOptions(41,3) = 2 + laOptions(42,1) = "*extension: fr2=" && ext Text file to FRX + laOptions(42,2) = ".c_fr2" + laOptions(42,3) = 2 + laOptions(43,1) = "*extension: lb2=" && ext Text file to LBX + laOptions(43,2) = ".c_lb2" + laOptions(43,3) = 2 + laOptions(44,1) = "*extension: mn2=" && ext Text file to MNX + laOptions(44,2) = ".c_mn2" + laOptions(44,3) = 2 + laOptions(45,1) = "*extension: db2=" && ext Text file to DBF + laOptions(45,2) = ".c_db2" + laOptions(45,3) = 2 + laOptions(46,1) = "*extension: dc2=" && ext Text file to DBC + laOptions(46,2) = ".c_dc2" + laOptions(46,3) = 2 + laOptions(47,1) = "*extension: fk2=" && ext Text file to FKY + laOptions(47,2) = ".c_fk2" + laOptions(47,3) = 2 + laOptions(48,1) = "*extension: me2=" && ext Text file to MEM + laOptions(48,2) = ".c_me2" + laOptions(48,3) = 2 + laOptions(49,1) = "*BackgroundImage:" && ext Text file to MEM + laOptions(49,2) = ".c_BackgroundImage" + laOptions(49,3) = 6 + + For lnOption = 1 To m.lnOptions + lnLine = Ascan( m.laLines , m.laOptions( m.lnOption, 1 ), 1, -1, 1, 4) + If m.lnLine >0 Then + lcText = m.laLines( m.lnLine ) + lcValue = Strextract( m.lcText , m.laOptions( m.lnOption, 1 ), '&'+'&' ,1 , 3) + Do Case + Case m.laOptions( m.lnOption, 3 ) = 0 + lcReturn = Padr(' ' + Transform( Evaluate( m.laOptions( m.lnOption, 2 ) ) ), Len(m.lcValue) + 1 ) + + Case m.laOptions( m.lnOption, 3 ) = 1 + lcReturn = Padr(' ' + Iif ( Evaluate( m.laOptions( m.lnOption, 2 )), '1', '0' ), Len(m.lcValue) + 1 ) + + Case m.laOptions( m.lnOption, 3 ) = 2 + lcReturn = Padr(Evaluate( m.laOptions( m.lnOption, 2 )), Len(m.lcValue) + 1 ) + + Case m.laOptions( m.lnOption, 3 ) = 3 + lcReturn = Padr(' ' + Iif ( Evaluate( m.laOptions( m.lnOption, 2 )), '0', '1' ), Len(m.lcValue) + 1 ) + + Case m.laOptions( m.lnOption, 3 ) = 4 + lcReturn = ' ' + Transform( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) + lcReturn = Padr( m.lcReturn , Max( Len ( m.lcReturn )+1, Len( m.lcValue ) + 1 ) ) + + Case m.laOptions( m.lnOption, 3 ) = 5 + If Empty( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) + lcReturn = ' *' + + Else &&Empty( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) + lcReturn = ' ' + Transform( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) + + Endif &&Empty( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) + lcReturn = Padr( m.lcReturn , Max( Len ( m.lcReturn )+1, Len( m.lcValue ) + 1 ) ) + + Case m.laOptions( m.lnOption, 3 ) = 6 + If Lower( Justfname ( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) ) == 'foxbin2prg.jpg' Then + lcReturn = '' + + Else &&LOWER( JUSTFNAME ( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) ) == 'foxbin2prg.jpg' + lcReturn = ' ' + Transform( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) + + Endif &&LOWER( JUSTFNAME ( Evaluate( m.laOptions( m.lnOption, 2 ) ) ) ) == 'foxbin2prg.jpg' + lcReturn = Padr( m.lcReturn , Max( Len ( m.lcReturn )+1, Len( m.lcValue ) + 1 ) ) + + Otherwise +* not defined. loop + Loop + + Endcase + laLines( m.lnLine ) = Substr(Strtran(m.laLines( m.lnLine ) , m.lcValue, m.lcReturn), 2 ) + + Endif &&lnLine >0 + + Endfor &&lnOption + + lcText = '' + + lnLines = m.lnLines+1 + Dimension; + M.laLines( m.lnLines ) + + Ains(m.laLines,4) + laLines( 4 ) = Textmerge( m.loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_Header4 ) + For lnLine = 1 To m.lnLines + lcText = m.lcText+ m.laLines( m.lnLine )+0h0D0A + Endfor &&lnLine + + Strtofile( m.lcText, m.tc_InputFile ) + +*!* /Changed by: LScheffler 07.3.2021 + + Case Empty(tc_InputFile) +*-- (Ejemplo de sintaxis y uso) +*MESSAGEBOX( loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC, 0+64+4096, 'FoxBin2Prg ' + THIS.c_FB2PRG_EXE_Version + ': ' + loLang.C_FOXBIN2PRG_SYNTAX_INFO_LOC + ' (' + .c_Language + ')', 60000 ) + loFrm_Main = Createobject('frm_main', This) + loFrm_Main.Show() + Read Events + lnCodError = 0 + + Otherwise +*-- EJECUCIÓN NORMAL + + + If (Atc('-INTERACTIVE', ('-' + tcType)) > 0 Or Atc('-?', ('-' + tcType)) > 0 ); + AND Atc('-BIN2PRG', ('-' + tcType)) = 0 And Atc('-PRG2BIN', ('-' + tcType)) = 0 ; + AND lcInputFile_Type == C_FILETYPE_DIRECTORY Then +*-- Se seleccionó un directorio y se puede elegir: Bin2Txt, Txt2Bin y Nada + .writeLog( loLang.C_INTERACTIVE_DIRECTORY_SELECTION_LOC ) + loFrm_Interactive = Createobject('frm_interactive', This) + loFrm_Interactive.Show() + Read Events + lnConversionOption = loFrm_Interactive.n_ConversionType + + If loFrm_Interactive.l_FileTimeStampOptimization + If .n_OptimizeByFilestamp = 0 Then + .n_OptimizeByFilestamp = 2 + Endif + Else + .n_OptimizeByFilestamp = 0 + Endif + + loFrm_Interactive.Release() + loFrm_Interactive = Null + + Do Case + Case lnConversionOption = 1 && Bin2Txt + tcType = tcType + '-BIN2PRG' + + Case lnConversionOption = 2 && Txt2Bin + tcType = tcType + '-PRG2BIN' + + Otherwise && None + Error 1799 && Conversion Cancelled + Endcase + Endif + +*-- Evaluación de FileSpec de entrada + Do Case + Case Atc('-BIN2PRG', ('-' + tcType)) = 0 And Atc('-PRG2BIN', ('-' + tcType)) = 0 ; + AND lcInputFile_Type == C_FILETYPE_FILE ; + AND ( '*' $ Justext( tc_InputFile ) Or '?' $ Justext( tc_InputFile ) ) + + If .l_ShowErrors +*MESSAGEBOX( 'No se admiten extensiones * o ? porque es peligroso (se pueden pisar binarios con archivo xx2 vacíos).', 0+48+4096, 'FOXBIN2PRG: ERROR!!', 60000 ) + Messagebox( loLang.C_ASTERISK_EXT_NOT_ALLOWED_LOC, 0+48+4096, 'FoxBin2Prg ' + This.c_FB2PRG_EXE_Version + ': ' + loLang.C_FOXBIN2PRG_ERROR_CAPTION_LOC, 60000 ) + Exit + Else + Error loLang.C_ASTERISK_EXT_NOT_ALLOWED_LOC + Endif + + + Case lcInputFile_Type == C_FILETYPE_FILE And ( '*' $ Juststem( tc_InputFile ) Or '?' $ Juststem( tc_InputFile ) ) +*-- SE QUIEREN TODOS LOS ARCHIVOS DE UNA EXTENSIÓN + lcFileSpec = Fullpath( tc_InputFile ) + .c_LogFile = Addbs( Justpath( lcFileSpec ) ) + Strtran( Justfname( lcFileSpec ), '*', '_ALL' ) + '.LOG' + + If .n_Debug > 0 Then + Erase ( .c_LogFile ) + Endif + + If Evl(tcType,'0') <> '*' Then + If .n_ShowProgressbar <> 0 And .l_ProcessFiles Then + .loadProgressbarForm() + Endif + + Do Case + Case .l_Recompile And Len(tcRecompile) > 3 And Directory(tcRecompile) + Cd (tcRecompile) + Case tcRecompile == '1' + Cd (Justpath(lcFileSpec)) + Endcase + Endif + + lnFileCount = Adir( laFiles, lcFileSpec, '', 1 ) + + For I = 1 To lnFileCount + toModulo = Null + lcFile = Forcepath( laFiles(m.I,1), Justpath( lcFileSpec ) ) + + Do Case + Case Upper( Justext( Evl(tc_InputFile,'') ) ) == 'PJX' And Left(Evl(tcType,'0'),1) == '*' +*-- SE QUIEREN CONVERTIR A TEXTO TODOS LOS ARCHIVOS DE UNO O MÁS PROYECTOS PJX +*-- Filespec: "*.PJX", "*" + .evaluate_Full_PJX(lcFile, tcRecompile, @toModulo, @toEx, tcOriginalFileName, .c_LogFile, tcType) + + Case Upper( Justext( Evl(tc_InputFile,'') ) ) == .c_PJ2 And Left(Evl(tcType,'0'),1) == '*' +*-- SE QUIEREN CONVERTIR A BINARIO TODOS LOS ARCHIVOS DE UNO O MÁS PROYECTOS PJ2 +*-- Filespec: "*.PJ2", "*" + .evaluate_Full_PJ2(lcFile, tcRecompile, @toModulo, @toEx, tcOriginalFileName, .c_LogFile, tcType) + + Case Atc('-BIN2PRG', ('-' + tcType)) > 0 +*-- SE QUIEREN CONVERTIR A TEXTO TODOS LOS ARCHIVOS DE UN DIRECTORIO +*-- Filespec: "*.*" + If .hasSupport_Bin2Prg(lcFile) Then + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + lcFile + '...', m.I, lnFileCount, 0 ) + lnCodError = .convert( lcFile, @toModulo, @toEx, .F., tcOriginalFileName ) + .writeLog_Flush() + + Do Case + Case lnCodError = 1799 && Conversion Cancelled + Error 1799 + + Case lnCodError > 0 + .doWriteErrorLog( @toEx ) + llError = .T. + .l_Error = .F. + Endcase + Endif + + Case Atc('-PRG2BIN', ('-' + tcType)) > 0 +*-- SE QUIEREN CONVERTIR A BINARIO TODOS LOS ARCHIVOS DE UN DIRECTORIO +*-- Filespec: "*.*" + If .hasSupport_Prg2Bin(lcFile) Then + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + lcFile + '...', m.I, lnFileCount, 0 ) + lnCodError = .convert( lcFile, @toModulo, @toEx, .F., tcOriginalFileName ) + .writeLog_Flush() + + Do Case + Case lnCodError = 1799 && Conversion Cancelled + Error 1799 + + Case lnCodError > 0 + .doWriteErrorLog( @toEx ) + llError = .T. + .l_Error = .F. + Endcase + Endif + + Case Empty( Justext( Evl(tc_InputFile,'') ) ) +*-- NO SE INDICÓ NINGUNA EXTENSIÓN + Error loLang.C_INVALID_PARAMETER_LOC + ': cInputFile = "' + tc_InputFile + '"' + + Otherwise +*-- DEMÁS ARCHIVOS +*-- Filespec: "*.EXT" + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + lcFile + '...', m.I, lnFileCount, 0 ) + lnCodError = .convert( lcFile, @toModulo, @toEx, .T., tcOriginalFileName ) + .writeLog_Flush() + + Do Case + Case lnCodError = 1799 && Conversion Cancelled + Error 1799 + + Case lnCodError > 0 + .doWriteErrorLog( @toEx ) + Endcase + Endcase + Endfor && I = 1 TO lnFileCount + + If llError + .l_Error = .T. + Endif + + Exit + + + Case Atc('-BIN2PRG', ('-' + tcType)) > 0 + .writeLog( '> ' + loLang.C_OPTION_LOC + ': BIN2PRG' ) + + If .n_ShowProgressbar <> 0 And .l_ProcessFiles Then + .loadProgressbarForm() + .o_Frm_Avance.Caption = Strtran( .o_Frm_Avance.Caption, '> -', '(Bin>Txt) -' ) + Endif + + Do Case + Case lcInputFile_Type == C_FILETYPE_DIRECTORY +*-- CONVERSION BIN2PRG DE UN DIRECTORIO Y SUBDIRECTORIOS + .writeLog( '> InputFile ' + loLang.C_IS_A_DIRECTORY_LOC ) + .writeLog() + + Do Case + Case .l_Recompile And Len(tcRecompile) > 3 And Directory(tcRecompile) + Cd (tcRecompile) + Case .l_Recompile + Cd (tc_InputFile) + Endcase + + .c_LogFile = Addbs(tc_InputFile) + tcType + '.LOG' + + If .n_Debug > 0 Then + Erase ( .c_LogFile ) + Endif + + .get_FilesFromDirectory( tc_InputFile, @laFiles, @lnFileCount ) + + For I = 1 To lnFileCount + toModulo = Null + lcFile = laFiles(m.I) + + If Not .hasSupport_Bin2Prg( lcFile ) Or Not Adir(laDirInfo, lcFile) > 0 Then + Loop + Endif + + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + lcFile + '...', m.I, lnFileCount, 0 ) + lnCodError = .convert( lcFile, @toModulo, @toEx, .F., tcOriginalFileName ) +*!* Changed by: LScheffler 15.2.2021 +*!* change date="{^2021-02-15,06:57:00}" +* flushing the log after each file let us only see last file +* why ever, it should be appended, but we simply move +* .writeLog_Flush() after ENDFOR + +* .writeLog_Flush() + + Do Case + Case lnCodError = 1799 && Conversion Cancelled + Error 1799 + + Case lnCodError > 0 + .doWriteErrorLog( @toEx ) + Endcase + Endfor && I = 1 TO lnFileCount + .writeLog_Flush() +*!* /Changed by: LScheffler 15.2.2021 + + .updateProgressbar( loLang.C_END_OF_PROCESS_LOC, lnFileCount, lnFileCount, 0 ) + Exit + + Case Not .hasSupport_Bin2Prg( tc_InputFile ) Or Not Adir(laDirInfo, tc_InputFile) > 0 + .writeLog( '> InputFile ' + loLang.C_IS_UNSUPPORTED_LOC ) + .writeLog() + Exit + + Endcase + + + Case Atc('-PRG2BIN', ('-' + tcType)) > 0 + .writeLog( '> ' + loLang.C_OPTION_LOC + ': PRG2BIN' ) + + If .n_ShowProgressbar <> 0 And .l_ProcessFiles Then + .loadProgressbarForm() + .o_Frm_Avance.Caption = Strtran( .o_Frm_Avance.Caption, '> -', '(Txt>Bin) -' ) + Endif + + Do Case + Case lcInputFile_Type == C_FILETYPE_DIRECTORY +*-- CONVERSION PRG2BIN DE UN DIRECTORIO Y SUBDIRECTORIOS + .writeLog( '> InputFile ' + loLang.C_IS_A_DIRECTORY_LOC ) + .writeLog() + + Do Case + Case .l_Recompile And Len(tcRecompile) > 3 And Directory(tcRecompile) + Cd (tcRecompile) + Case .l_Recompile + Cd (tc_InputFile) + Endcase + + .c_LogFile = Addbs(tc_InputFile) + tcType + '.LOG' + + If .n_Debug > 0 Then + Erase ( .c_LogFile ) + Endif + + .get_FilesFromDirectory( tc_InputFile, @laFiles, @lnFileCount ) + + + For I = 1 To lnFileCount + toModulo = Null + lcFile = laFiles(m.I) + + If Not .hasSupport_Prg2Bin( lcFile ) Or Not Adir(laDirInfo, lcFile) > 0 Then + Loop + Endif + + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + lcFile + '...', m.I, lnFileCount, 0 ) + lnCodError = .convert( lcFile, @toModulo, @toEx, .F., tcOriginalFileName ) +*!* Changed by: LScheffler 15.2.2021 +*!* change date="{^2021-02-15,06:57:00}" +* flushing the log after each file let us only see last file +* why ever, it should be appended, but we simply move +* .writeLog_Flush() after ENDFOR + +* .writeLog_Flush() + + Do Case + Case lnCodError = 1799 && Conversion Cancelled + Error 1799 + + Case lnCodError > 0 + .doWriteErrorLog( @toEx ) + Endcase + Endfor && I = 1 TO lnFileCount + .writeLog_Flush() +*!* /Changed by: LScheffler 15.2.2021 + + .updateProgressbar( loLang.C_END_OF_PROCESS_LOC, lnFileCount, lnFileCount, 0 ) + Exit + + Case Not .hasSupport_Prg2Bin( tc_InputFile ) Or Not Adir(laDirInfo, tc_InputFile) > 0 + .writeLog( '> InputFile ' + loLang.C_IS_UNSUPPORTED_LOC ) + .writeLog() + Exit + + Endcase + + + Endcase + +*-- UN ARCHIVO INDIVIDUAL O CONSULTA DE SOPORTE DE ARCHIVO + If lcInputFile_Type = C_FILETYPE_QUERYSUPPORT +*-- Consulta de soporte de conversión (compatibilidad con SourceSafe) +*-- SourceSafe consulta el tipo de soporte de cada archivo antes del Checkin/Checkout +*-- para saber si se puede hacer Diff y Merge. +*-- Para los códigos de tipo de archivo ver ayuda de "Type Property" + Do Case + Case tc_InputFile $ FILETYPE_PROJECT && PJX (J no exite en FoxPro, es un valor inventado para evitar conflicto con los tipos existentes) + lnCodError = .n_PJX_Conversion_Support + + Case tc_InputFile == FILETYPE_CLASSLIB + lnCodError = .n_X_Conversion_Support + + Case tc_InputFile == FILETYPE_FORM + lnCodError = .n_SCX_Conversion_Support + + Case tc_InputFile == FILETYPE_REPORT + lnCodError = .n_FRX_Conversion_Support + + Case tc_InputFile == FILETYPE_LABEL + lnCodError = .n_LBX_Conversion_Support + + Case tc_InputFile == FILETYPE_MENU + lnCodError = .n_MNX_Conversion_Support + + Case tc_InputFile == FILETYPE_DATABASE + lnCodError = .n_DBC_Conversion_Support + + Case tc_InputFile == FILETYPE_FREETABLE + lnCodError = .n_DBF_Conversion_Support + + Otherwise + lnCodError = -1 && No support. + Endcase + + Else + + Do Case + Case Upper( Justext( Evl(tc_InputFile,'') ) ) == 'PJX' And Left(Evl(tcType,'0'),1) == '*' +*-- SE QUIEREN CONVERTIR A TEXTO TODOS LOS ARCHIVOS DE UN PROYECTO PJX + .evaluate_Full_PJX(tc_InputFile, tcRecompile, @toModulo, @toEx, @tcOriginalFileName, '', tcType) + Exit + + Case Upper( Justext( Evl(tc_InputFile,'') ) ) == .c_PJ2 And Left(Evl(tcType,'0'),1) == '*' +*-- SE QUIEREN CONVERTIR A BINARIO TODOS LOS ARCHIVOS DE UN PROYECTO PJ2 + .evaluate_Full_PJ2(tc_InputFile, tcRecompile, @toModulo, @toEx, @tcOriginalFileName, '', tcType) + Exit + + Case Inlist( Evl(tcType,'0') ; + , FILETYPE_DATABASE ; + , FILETYPE_FREETABLE ; + , FILETYPE_QUERY ; + , FILETYPE_FORM ; + , FILETYPE_REPORT ; + , FILETYPE_LABEL ; + , FILETYPE_CLASSLIB ; + , FILETYPE_PROGRAM ; + , FILETYPE_PROJECT ; + , FILETYPE_APILIB ; + , FILETYPE_APPLICATION ; + , FILETYPE_MENU ; + , FILETYPE_TEXT ; + , FILETYPE_OTHER ) ; + AND Evl(tcTextName,'0') <> '0' +*-- COMPATIBILIDAD CON SOURCESAFE. 30/01/2014 + If tlGenText + .writeLog( '> ' + loLang.C_SOURCESAFE_COMPATIBILITY_MODE_LOC + ': ' + loLang.C_BINARY_TO_TEXT_LOC ) + Else +*-- Create BINARIO desde versión TEXTO +*-- Como el archivo de entrada siempre es el binario cuando se usa SCCAPI, +*-- para regenerar el binario (tlGenText=.F.) se debe usar como +*-- archivo de entrada tcTextName en su lugar. Aquí los intercambio. + tc_InputFile = tcTextName + .l_Recompile = .T. + .writeLog( '> ' + loLang.C_SOURCESAFE_COMPATIBILITY_MODE_LOC + ': ' + loLang.C_TEXT_TO_BINARY_LOC ) + Endif + Endcase + + If Adir(laDirInfo, tc_InputFile) > 0 + If .n_ShowProgressbar <> 0 And .l_ProcessFiles Then + .loadProgressbarForm() + Endif + + .writeLog( '> InputFile ' + loLang.C_IS_A_FILE_LOC ) + .writeLog() + tc_InputFile = Locfile(tc_InputFile) + + Do Case + Case .l_Recompile And Len(tcRecompile) > 3 And Directory(tcRecompile) + Cd (tcRecompile) + Case tcRecompile == '1' + Cd (Justpath(tc_InputFile)) + Endcase + + .c_LogFile = tc_InputFile + '.LOG' + + If .n_Debug > 0 Then + Erase ( .c_LogFile ) + Endif + + lnCodError = .convert( tc_InputFile, @toModulo, @toEx, .T., tcOriginalFileName ) +*.updateProgressbar( loLang.C_END_OF_PROCESS_LOC, 1, 1, 0 ) + Endif + Endif + + Endcase + Endwith && THIS + + Catch To toEx + If Not llEscKeyRestored And This.l_CancelWithEscKey Then + If Empty(lcOldOnEscape) + On Escape + Else + On Escape &lcOldOnEscape. + Endif + + If Empty(lcOldSetEscape) + Set Escape Off + Else + Set Escape &lcOldSetEscape. + Endif + llEscKeyRestored = .T. + Endif + + lnCodError = toEx.ErrorNo + lnErrorIcon = 64 + + If Vartype(loLang) <> 'O' Then + loLang = Createobject("CL_LANG","EN") + Endif + + If lnCodError <> 1799 Then && Conversion Cancelled + toEx.UserValue = toEx.UserValue + 'FoxBin2Prg: [' + This.c_Foxbin2prg_FullPath + '] (EXE Version: ' + This.c_FB2PRG_EXE_Version + ')' + CR_LF + lnErrorIcon = 16 + Endif + + If Atc('-SHOWMSG', ('-' + tcType)) > 0 Then + If lnCodError <> 1799 Then && Conversion Cancelled + toEx.UserValue = toEx.UserValue + 'lcInputFile_Type = [' + Transform(lcInputFile_Type) + ']' + CR_LF + Endif + This.l_ShowErrors = .F. && La opción "SHOWMSG" muestra su propio mensaje + Endif + + If lnCodError <> 1799 Then && Conversion Cancelled + toEx.UserValue = toEx.UserValue + 'tc_InputFile = [' + Transform(tc_InputFile) + ']' + CR_LF + Endif + + This.doWriteErrorLog( @toEx, @lcErrorInfo ) + + If This.n_Debug > 0 Then + If _vfp.StartMode = 0 + Set Step On + Endif + Endif + + If tlRelanzarError + Throw + Endif + + Finally + If Not llEscKeyRestored And This.l_CancelWithEscKey Then + If Empty(lcOldOnEscape) + On Escape + Else + On Escape &lcOldOnEscape. + Endif + + If Empty(lcOldSetEscape) + Set Escape Off + Else + Set Escape &lcOldSetEscape. + Endif + llEscKeyRestored = .T. + Endif + + If Vartype(loLang) <> 'O' Then + loLang = Createobject("CL_LANG","EN") + Endif + + Use In (Select("TABLABIN")) + This.writeLog_Flush() + This.unloadProgressbarForm() + Cd (Justpath(This.c_CurDir)) + + Do Case + Case Evl( lcInputFile_Type, C_FILETYPE_QUERYSUPPORT ) <> C_FILETYPE_QUERYSUPPORT ; + AND Atc('-SHOWMSG', ('-' + tcType)) > 0 ; + OR This.l_ShowErrors And lnCodError > 0 And Not Isnull(toEx) + This.writeErrorLog_Flush() + + Do Case + Case lnCodError = 1098 && User Error + Messagebox( toEx.Message, 0+64+4096, 'FoxBin2Prg ' + This.c_FB2PRG_EXE_Version, 60000 ) +*loWSH.Run( THIS.c_ErrorLogFile, 3 ) + This.wscriptshell_run( This.c_ErrorLogFile, 3 ) + + Case lnCodError = 1799 && Conversion Cancelled + Messagebox( loLang.C_CONVERSION_CANCELLED_BY_USER_LOC + '!', 0+64+4096, 'FoxBin2Prg ' + This.c_FB2PRG_EXE_Version, 60000 ) + + Case This.l_Errors + If Adir(laDirInfo, This.c_ErrorLogFile) > 0 Then + Messagebox( loLang.C_END_OF_PROCESS_LOC + '! (' + loLang.C_WITH_ERRORS_LOC + ')', 0+48+4096, 'FoxBin2Prg ' + This.c_FB2PRG_EXE_Version, 60000 ) +*loWSH.Run( THIS.c_ErrorLogFile, 3 ) + This.wscriptshell_run( This.c_ErrorLogFile, 3 ) + Else + Messagebox( loLang.C_END_OF_PROCESS_LOC + '! (' + loLang.C_WITH_ERRORS_LOC + ')' + CR_LF + "[Warning: Can't show Error LOG file because does not exist!]", 0+48+4096, 'FoxBin2Prg ' + This.c_FB2PRG_EXE_Version, 60000 ) + Endif + + Otherwise + Messagebox( loLang.C_END_OF_PROCESS_LOC + '', 0+64+4096, 'FoxBin2Prg ' + This.c_FB2PRG_EXE_Version, 60000 ) + + Endcase + + Endcase + + If Empty(lnCodError) And This.l_Errors + lnCodError = 1098 + Endif + + Set Notify &lc_OldSetNotify. + Store Null To loFSO, loWSH, loDBF_CFG + Release I, lcPath, lcFileSpec, lcFile, laFiles, lnFileCount, lcErrorInfo, lcErrorFile, loEx, loFSO + Endtry + + Return lnCodError + Endproc + + + Procedure evaluate_Full_PJX +*-------------------------------------------------------------------------------------------------------------- +* SE QUIEREN CONVERTIR A TEXTO TODOS LOS ARCHIVOS DE UN PROYECTO PJX +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (v! IN ) Nombre del archivo de entrada +* tcRecompile (v? IN ) Indica recompilar ('1') el binario una vez regenerado. [Cambio de funcionamiento por defecto] +* Este cambio es para ganar tiempo, velocidad y seguridad. Además la recompilación que hace FoxBin2Prg +* se hace desde el directorio del archivo, con lo que las referencias relativas pueden +* generar errores de compilación, típicamente los #include. +* NOTA: Si en vez de '1' se indica un Path (p.ej, el del proyecto, se usará como base para recompilar +* toModulo (@? OUT) Referencia de objeto del módulo generado (para Unit Testing) +* toEx (@? OUT) Objeto con información del error +* tcOriginalFileName (v? IN ) Sirve para los casos en los que inputFile es un nombre temporal y se quiere generar +* el nombre correcto dentro de la versión texto (por ej: en los PJ2 y las cabeceras) +* tcLogFile (v? IN ) Nombre del log a usar +* tcType (v? IN ) Tipo de archivo de entrada. Compatibilidad con SCCTEXT.PRG +* - Si se indica "*" y tc_InputFile es un PJX, se procesan todos los archivos del proyecto y el PJX/2 +* - Si se indica "*-" y tc_InputFile es un PJX, se procesan todos los archivos del proyecto sin el PJX/2 +*-------------------------------------------------------------------------------------------------------------- + Lparameters tc_InputFile, tcRecompile, toModulo, toEx, tcOriginalFileName, tcLogFile, tcType + + Local lcFileSpec, lnFileCount, laFiles(1,1), lcFile, lnCodError, I, lnFileCount, llError, laDirInfo(1,5) ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loEx As Exception + + Try + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + lcFileSpec = Fullpath( tc_InputFile ) + + If .n_ShowProgressbar <> 0 And .l_ProcessFiles Then + .loadProgressbarForm() + .o_Frm_Avance.Caption = Strtran( .o_Frm_Avance.Caption, '> -', '(Bin>Txt) -' ) + Endif + + If Empty(tcLogFile) + .c_LogFile = Addbs( Justpath( lcFileSpec ) ) + Strtran( Justfname( lcFileSpec ), '*', '_ALL' ) + '.LOG' + + If .n_Debug > 0 Then + Erase ( .c_LogFile ) + Endif + Endif + + .writeLog( '> ' + loLang.C_CONVERT_ALL_FILES_IN_A_PROJECT_LOC + ': ' + loLang.C_BINARY_TO_TEXT_LOC ) + + Do Case + Case .l_Recompile And Len(tcRecompile) > 3 And Directory(tcRecompile) + Cd (tcRecompile) + Case tcRecompile == '1' + Cd (Justpath(lcFileSpec)) + Endcase + + Select 0 + Use (tc_InputFile) Shared Again Noupdate Alias TABLABIN + lnFileCount = 0 + + Scan For Not Deleted() And Type <> 'H' + lnFileCount = lnFileCount + 1 + Dimension laFiles(lnFileCount,1) + laFiles(lnFileCount,1) = .get_AbsolutePath( Alltrim( Name, 0, ' ', Chr(0) ), Addbs( Justpath( lcFileSpec ) ) ) + Endscan + + Use In (Select("TABLABIN")) + +*-- Convierto primero el proyecto + If tcType <> '*-' Then + lcFile = tc_InputFile + lnCodError = .convert( lcFile, toModulo, @toEx, .T., tcOriginalFileName ) + .writeLog_Flush() + Endif + +*-- Luego convierto los archivos incluidos + For I = 1 To lnFileCount + lcFile = laFiles(m.I,1) + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + lcFile + '...', m.I, lnFileCount, 0 ) + + If .hasSupport_Bin2Prg( Upper(Justext(lcFile)) ) And Adir( laDirInfo, lcFile ) > 0 Then + lnCodError = .convert( lcFile, toModulo, @toEx, .F., tcOriginalFileName ) + .writeLog_Flush() + + Do Case + Case lnCodError = 1799 && Conversion Cancelled + Error 1799 + + Case lnCodError > 0 + .doWriteErrorLog( @toEx ) + llError = .T. + .l_Error = .F. + Endcase + Else +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If .addProcessedFile( lcFile, 'I', 'P0', 'E0', 'S0', 'X0' ) + .updateProcessedFile() + Endif + Endif + + .writeLog_Flush() + + If llError + .l_Error = .T. + Endif + Endfor + Endwith + + Catch To loEx + Throw + + Finally + Store Null To loLang + Release loLang + Endtry + Endproc + + + Procedure evaluate_Full_PJ2 +*-------------------------------------------------------------------------------------------------------------- +* SE QUIEREN CONVERTIR A BINARIO TODOS LOS ARCHIVOS DE UN PROYECTO PJ2 +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (v! IN ) Nombre del archivo de entrada +* tcRecompile (v? IN ) Indica recompilar ('1') el binario una vez regenerado. [Cambio de funcionamiento por defecto] +* Este cambio es para ganar tiempo, velocidad y seguridad. Además la recompilación que hace FoxBin2Prg +* se hace desde el directorio del archivo, con lo que las referencias relativas pueden +* generar errores de compilación, típicamente los #include. +* NOTA: Si en vez de '1' se indica un Path (p.ej, el del proyecto, se usará como base para recompilar +* toModulo (@? OUT) Referencia de objeto del módulo generado (para Unit Testing) +* toEx (@? OUT) Objeto con información del error +* tcOriginalFileName (v? IN ) Sirve para los casos en los que inputFile es un nombre temporal y se quiere generar +* el nombre correcto dentro de la versión texto (por ej: en los PJ2 y las cabeceras) +* tcLogFile (v? IN ) Nombre del log a usar +* tcType (v? IN ) Tipo de archivo de entrada. Compatibilidad con SCCTEXT.PRG +* - Si se indica "*" y tc_InputFile es un PJX, se procesan todos los archivos del proyecto y el PJX/2 +* - Si se indica "*-" y tc_InputFile es un PJX, se procesan todos los archivos del proyecto sin el PJX/2 +*-------------------------------------------------------------------------------------------------------------- + Lparameters tc_InputFile, tcRecompile, toModulo, toEx, tcOriginalFileName, tcLogFile, tcType + + Local lcFileSpec, lnFileCount, laFiles(1,1), lcFile, lnCodError, I, lnFileCount, llError, laDirInfo(1,5) ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loEx As Exception + + Try + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + lcFileSpec = Fullpath( tc_InputFile ) + + If .n_ShowProgressbar <> 0 And .l_ProcessFiles Then + .loadProgressbarForm() + .o_Frm_Avance.Caption = Strtran( .o_Frm_Avance.Caption, '> -', '(Txt>Bin) -' ) + Endif + + If Empty(tcLogFile) + .c_LogFile = Addbs( Justpath( lcFileSpec ) ) + Strtran( Justfname( lcFileSpec ), '*', '_ALL' ) + '.LOG' + + If .n_Debug > 0 Then + Erase ( .c_LogFile ) + Endif + Endif + + .writeLog( '> ' + loLang.C_CONVERT_ALL_FILES_IN_A_PROJECT_LOC + ': ' + loLang.C_TEXT_TO_BINARY_LOC ) + + Do Case + Case .l_Recompile And Len(tcRecompile) > 3 And Directory(tcRecompile) + Cd (tcRecompile) + Case tcRecompile == '1' + Cd (Justpath(lcFileSpec)) + Endcase + + lnFileCount = Alines( laFiles, Strextract( Filetostr(tc_InputFile), C_BUILDPROJ_I, C_BUILDPROJ_F ), 1+4 ) + + For I = lnFileCount To 1 Step -1 + If '.ADD(' $ laFiles(m.I) + lcFile = .get_AbsolutePath( Strextract( laFiles(m.I), ".ADD('", "')" ), Addbs( Justpath( lcFileSpec ) ) ) + laFiles(m.I) = Forceext( lcFile, .get_Ext2FromExt( Upper(Justext(lcFile)) ) ) + Else + lnFileCount = lnFileCount - 1 + Adel( laFiles, m.I ) + Dimension laFiles(lnFileCount) + Endif + Endfor + +*-- Convierto primero el proyecto + If tcType <> '*-' Then + lcFile = tc_InputFile + lnCodError = .convert( lcFile, toModulo, @toEx, .T., tcOriginalFileName ) + .writeLog_Flush() + Endif + +*-- Luego convierto los archivos incluidos + For I = 1 To lnFileCount + lcFile = laFiles(m.I) + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + lcFile + '...', m.I, lnFileCount, 0 ) + + If .hasSupport_Prg2Bin( Upper(Justext(lcFile)) ) And Adir( laDirInfo, lcFile ) > 0 Then + lnCodError = .convert( lcFile, toModulo, @toEx, .F., tcOriginalFileName ) + .writeLog_Flush() + + Do Case + Case lnCodError = 1799 && Conversion Cancelled + Error 1799 + + Case lnCodError > 0 + .doWriteErrorLog( @toEx ) + llError = .T. + .l_Error = .F. + Endcase + Else +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If .addProcessedFile( lcFile, 'I', 'P0', 'E0', 'S0', 'X0' ) + .updateProcessedFile() + Endif + Endif + + .writeLog_Flush() + + If llError + .l_Error = .T. + Endif + Endfor + Endwith + + Catch To loEx + Throw + + Finally + Store Null To loLang + Release loLang + Endtry + Endproc + + + Hidden Procedure doWriteErrorLog + Lparameters toEx As Exception, tcErrorInfo + + Local loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If toEx.ErrorNo = 1799 Then && Conversion Cancelled + tcErrorInfo = loLang.C_CONVERSION_CANCELLED_BY_USER_LOC + Else + tcErrorInfo = .exception2Str(@toEx) + CR_LF + loLang.C_SOURCEFILE_LOC + Transform(.c_InputFile) + CR_LF + Endif + + AddProperty(_Screen, 'ExitCode', toEx.ErrorNo) + +*-- Escribo la información de error en la variable log de errores + .writeErrorLog( Replicate('-', 100), 1 ) + .writeLog( tcErrorInfo ) + .writeErrorLog( tcErrorInfo ) + .writeErrorLog( ) + +*-- Escribo la información de error en el archivo log de errores + Try + Strtofile( tcErrorInfo, Evl( .c_InputFile, 'foxbin2prg_errorlog' ) + '.ERR' ) + Catch + Endtry + Endwith + + Return + Endproc + + + Protected Procedure convert +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (v! IN ) Nombre del archivo de entrada +* toModulo (@? OUT) Referencia de objeto del módulo generado (para Unit Testing) +* toEx (@? OUT) Objeto con información del error +* tlRelanzarError (v? IN ) Indica si el error debe relanzarse o no +* tcOriginalFileName (v? IN ) Sirve para los casos en los que inputFile es un nombre temporal y se quiere generar +* el nombre correcto dentro de la versión texto (por ej: en los PJ2 y las cabeceras) +*-------------------------------------------------------------------------------------------------------------- + Lparameters tc_InputFile, toModulo, toEx As Exception, tlRelanzarError, tcOriginalFileName + + Try + Local lnCodError, lcErrorInfo, laDirFile(1,5), lcExtension, lnFileCount, laFiles(1,1), I ; + , ltFilestamp, lcExtA, lcExtB, laEvents(1,1), lcForceAttribs, lnIDInputFile ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loConversor As c_conversor_base Of 'FOXBIN2PRG.PRG' ; + , loFSO As Scripting.FileSystemObject ; + , loDBF_CFG As CL_DBF_CFG Of 'FOXBIN2PRG.PRG' + lnCodError = 0 + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + loFSO = .o_FSO + loLang = _Screen.o_FoxBin2Prg_Lang + lcForceAttribs = '+N' + .c_InputFile = Fullpath( tc_InputFile ) + .l_Error = .F. + lcExtension = Upper( Justext(.c_InputFile) ) + + .writeLog( Replicate( '*', 100 ) ) + .writeLog( 'CONVERSION PROCESS', 2 ) + .writeLog( Replicate( '*', 100 ) ) + + If Adir( laDirFile, .c_InputFile, '', 1 ) = 0 +*ERROR 'No se encontró el archivo [' + .c_InputFile + ']' + Error loLang.C_FILE_NOT_FOUND_LOC + ' [' + .c_InputFile + ']' + Endif + + .c_InputFile = loFSO.GetAbsolutePathName( Forcepath( laDirFile(1,1), Justpath(.c_InputFile) ) ) + +*-- VERIFICO SI HAY ARCHIVO DE CONFIGURACIÓN SECUNDARIO + .evaluateConfiguration() + + If .n_ForceWriteIfReadOnly = 1 Then + lcForceAttribs = lcForceAttribs + '-R' + Endif + +*!* Changed by: LScheffler 03.03.2021 +*!* change date="{^2021-03-03,11:38:00}" +* Added option for DBC split + +*-- OPTIMIZACIÓN VC2/SC2: VERIFICO SI EL ARCHIVO BASE FUE PROCESADO PARA DESCARTAR REPROCESOS + If Inlist(lcExtension,"SCX","VCX",.c_VC2,.c_SC2); + AND (.n_UseClassPerFile > 0 And .l_RedirectClassPerFileToMain ; + OR Not Empty(.c_ClassToConvert)) + + Do Case + + Case .n_RedirectClassType = 1 Or Not Empty(.c_ClassToConvert) && Redireccionar solo esta clase + If Occurs('.', Juststem(.c_InputFile)) = 0 Then + lc_BaseFile = .c_InputFile + Else + lc_BaseFile = Forcepath( Forceext( Juststem( Juststem(.c_InputFile) ), Justext(.c_InputFile)) , Justpath(.c_InputFile) ) + Endif + + Case .n_UseClassPerFile = 1 And Inlist(lcExtension,.c_VC2,.c_SC2) + If Occurs('.', Juststem(.c_InputFile)) = 0 Then + lc_BaseFile = .c_InputFile + Else + lc_BaseFile = Forcepath( Forceext( Juststem( Juststem(.c_InputFile) ), Justext(.c_InputFile)) , Justpath(.c_InputFile) ) + Endif + +*-- Verifico si se debe forzar la redirección al archivo principal + If '.' $ Juststem(.c_InputFile) + .c_InputFile = lc_BaseFile + Endif +** LScheffler, Problem, Fehler: DC2 hier nicht, das muss anders mit UseFilesPerDBC + Case .n_UseClassPerFile = 2 And Inlist(lcExtension,.c_VC2,.c_SC2) + If Occurs('.', Juststem(.c_InputFile)) = 0 Then + lc_BaseFile = .c_InputFile + Else + lc_BaseFile = Forcepath( Forceext( Juststem( Juststem( Juststem(.c_InputFile) ) ), Justext(.c_InputFile)) , Justpath(.c_InputFile) ) + Endif + +*-- Verifico si se debe forzar la redirección al archivo principal + If '.' $ Juststem(.c_InputFile) + .c_InputFile = lc_BaseFile + Endif + + Endcase + Endif + +***************************** + +*-- OPTIMIZACIÓN DC2: VERIFICO SI EL ARCHIVO BASE FUE PROCESADO PARA DESCARTAR REPROCESOS + If Inlist(lcExtension,"DBC",.c_DC2); + AND .n_UseFilesPerDBC > 0 And .l_RedirectFilePerDBCToMain; + AND .n_UseFilesPerDBC = 1 + + If Occurs('.', Juststem(.c_InputFile)) = 0 Then + lc_BaseFile = .c_InputFile + Else + lc_BaseFile = Forcepath( Forceext( Juststem( Juststem( Juststem(.c_InputFile) ) ), Justext(.c_InputFile)) , Justpath(.c_InputFile) ) + Endif + +*-- Verifico si se debe forzar la redirección al archivo principal + If '.' $ Juststem(.c_InputFile) + .c_InputFile = lc_BaseFile + Endif + + Endif + +*!* /Changed by: LScheffler 03.03.2021 + + Erase ( .c_InputFile + '.ERR' ) + + If Not Empty(tcOriginalFileName) + tcOriginalFileName = loFSO.GetAbsolutePathName( tcOriginalFileName ) + Endif + + .c_OriginalFileName = Evl( tcOriginalFileName, .c_InputFile ) + + If Upper( Justext(.c_OriginalFileName) ) = 'PJM' And .c_PJ2 <> 'PJM' + .c_OriginalFileName = Forceext(.c_OriginalFileName,'pjx') + Endif + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If Not .addProcessedFile( .c_InputFile, 'I', 'P1', 'E0', 'S1', 'X0' ) Then +*.writeLog( 'OPTIMIZACIÓN: El archivo Base [' + JUSTFNAME(lc_BaseFile) + '] ya fue procesado, por lo que no se procesará [' + JUSTFNAME(.c_InputFile) + ']' ) + .writeLog( C_TAB + C_TAB + '* ' + Textmerge( loLang.C_CLASSPERFILE_OPTIMIZATION_BASE_ALREADY_PROCESSED_LOC ) ) + Exit + Endif + +*.updateProcessedFile() + lnIDInputFile = .n_ProcessedFiles + + .writeLog( C_TAB + 'c_OriginalFileName: ' + .c_OriginalFileName ) + .writeLog( ) + + If Not Adir(laDirFile, .c_InputFile) > 0 Then + Error loLang.C_FILE_DOESNT_EXIST_LOC + ' [' + .c_InputFile + ']' + Endif + + .normalizeFileCapitalization( .T. ) + + Do Case + Case lcExtension = 'VCX' + If Not Inlist(.n_VCX_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_VC2 ) + loConversor = Createobject( 'c_conversor_vcx_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_VC2 ), lcForceAttribs ) + + Case lcExtension = 'SCX' + If Not Inlist(.n_SCX_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_SC2 ) + loConversor = Createobject( 'c_conversor_scx_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_SC2 ), lcForceAttribs ) + + Case lcExtension = 'PJX' + If Not Inlist(.n_PJX_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_PJ2 ) + loConversor = Createobject( 'c_conversor_pjx_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_PJ2 ), lcForceAttribs ) + + Case lcExtension = 'PJM' And .c_PJ2 <> 'PJM' + If Not Inlist(.n_PJX_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_PJ2 ) + loConversor = Createobject( 'c_conversor_pjm_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_PJ2 ), lcForceAttribs ) + + Case lcExtension = 'FRX' + If Not Inlist(.n_FRX_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_FR2 ) + loConversor = Createobject( 'c_conversor_frx_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_FR2 ), lcForceAttribs ) + + Case lcExtension = 'LBX' + If Not Inlist(.n_LBX_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_LB2 ) + loConversor = Createobject( 'c_conversor_frx_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_LB2 ), lcForceAttribs ) + + Case lcExtension = 'DBF' + lnFileCount = .get_DBF_Configuration( Forceext(.c_InputFile, 'DBF'), @loDBF_CFG ) + If Not Inlist(.n_DBF_Conversion_Support, 1, 2, 4, 8) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_DB2 ) + loConversor = Createobject( 'c_conversor_dbf_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_DB2 ), lcForceAttribs ) + + Case lcExtension = 'DBC' + If Not Inlist(.n_DBC_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_DC2 ) + loConversor = Createobject( 'c_conversor_dbc_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_DC2 ), lcForceAttribs ) + + Case lcExtension = 'MNX' + If Not Inlist(.n_MNX_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_MN2 ) + loConversor = Createobject( 'c_conversor_mnx_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_MN2 ), lcForceAttribs ) + + Case lcExtension = 'FKY' + If Not Inlist(.n_FKY_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_FK2 ) + loConversor = Createobject( 'c_conversor_fky_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_FK2 ), lcForceAttribs ) + + Case lcExtension = 'MEM' + If Not Inlist(.n_MEM_Conversion_Support, 1, 2) + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, .c_ME2 ) + loConversor = Createobject( 'c_conversor_mem_a_prg' ) + .changeFileAttribute( Forceext( .c_InputFile, .c_ME2 ), lcForceAttribs ) + + Case lcExtension = .c_VC2 + If .n_VCX_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + If Empty(.c_ClassToConvert) + .c_OutputFile = Forceext( .c_InputFile, 'VCX' ) + Else +* Si se usó la sintaxis "classlib.vcx::clase::import", se define el OutputFile +* con la Base "classlib.vcx" y no con el archivo entero. + .c_OutputFile = Forceext( lc_BaseFile, 'VCX' ) + Endif + loConversor = Createobject( 'c_conversor_prg_a_vcx' ) + .changeFileAttribute( Forceext( .c_InputFile, 'VCX' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'VCT' ), lcForceAttribs ) + + Case lcExtension = .c_SC2 + If .n_SCX_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'SCX' ) + loConversor = Createobject( 'c_conversor_prg_a_scx' ) + .changeFileAttribute( Forceext( .c_InputFile, 'SCX' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'SCT' ), lcForceAttribs ) + + Case lcExtension = .c_PJ2 + If .n_PJX_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'PJX' ) + loConversor = Createobject( 'c_conversor_prg_a_pjx' ) + .changeFileAttribute( Forceext( .c_InputFile, 'PJX' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'PJT' ), lcForceAttribs ) + + Case lcExtension = .c_FR2 + If .n_FRX_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'FRX' ) + loConversor = Createobject( 'c_conversor_prg_a_frx' ) + .changeFileAttribute( Forceext( .c_InputFile, 'FRX' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'FRT' ), lcForceAttribs ) + + Case lcExtension = .c_LB2 + If .n_LBX_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'LBX' ) + loConversor = Createobject( 'c_conversor_prg_a_frx' ) + .changeFileAttribute( Forceext( .c_InputFile, 'LBX' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'LBT' ), lcForceAttribs ) + + Case lcExtension = .c_DB2 + If Inlist(.n_DBF_Conversion_Support, 2, 8) Or Adir(laDirFile, Forceext(.c_InputFile, 'DBF') + '.CFG') = 1 Then +*-- Soporte txt-2-bin habilitado + Else + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'DBF' ) + loConversor = Createobject( 'c_conversor_prg_a_dbf' ) + .changeFileAttribute( Forceext( .c_InputFile, 'DBF' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'FPT' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'CDX' ), lcForceAttribs ) + + Case lcExtension = .c_DC2 + If .n_DBC_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'DBC' ) + loConversor = Createobject( 'c_conversor_prg_a_dbc' ) + .changeFileAttribute( Forceext( .c_InputFile, 'DBC' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'DCX' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'DCT' ), lcForceAttribs ) + + Case lcExtension = .c_MN2 + If .n_MNX_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'MNX' ) + loConversor = Createobject( 'c_conversor_prg_a_mnx' ) + .changeFileAttribute( Forceext( .c_InputFile, 'MNX' ), lcForceAttribs ) + .changeFileAttribute( Forceext( .c_InputFile, 'MNT' ), lcForceAttribs ) + + Case lcExtension = .c_FK2 + If .n_FKY_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'FKY' ) + loConversor = Createobject( 'c_conversor_prg_a_fky' ) + .changeFileAttribute( Forceext( .c_InputFile, 'FKY' ), lcForceAttribs ) + + Case lcExtension = .c_ME2 + If .n_MEM_Conversion_Support <> 2 + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endif + .c_OutputFile = Forceext( .c_InputFile, 'MEM' ) + loConversor = Createobject( 'c_conversor_prg_a_mem' ) + .changeFileAttribute( Forceext( .c_InputFile, 'MEM' ), lcForceAttribs ) + + Otherwise +*ERROR 'El archivo [' + .c_InputFile + '] no está soportado' + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + + Endcase + +*** DH 2021-03-04: handle cOutputFolder + loConversor.cOutputFolder = This.cOutputFolder + +*-- Optimización: Comparación de los timestamps de InputFile y OutputFile para saber +*-- si el OutputFile se debe regenerar o no. + lnFileCount = Adir( laFiles, Forceext( .c_InputFile, '*' ), '', 1 ) + Store {//::} To .t_InputFile_TimeStamp, .t_OutputFile_TimeStamp, ltFilestamp + + If lnFileCount > 0 Then +*-- Busca el archivo de entrada original + I = Ascan( laFiles, Justfname(.c_InputFile), 1, 0, 1, 1+2+4+8 ) + If m.I > 0 Then + .t_InputFile_TimeStamp = Datetime( Year(laFiles(m.I,3)), Month(laFiles(m.I,3)), Day(laFiles(m.I,3)) ; + , Val(Left(laFiles(m.I,4),2)), Val(Substr(laFiles(m.I,4),4,2)), Val(Right(laFiles(m.I,4),2)) ) + Endif + + If Adir( laDirFile, .c_OutputFile ) > 0 Then + I = Ascan( laFiles, Justfname(.c_OutputFile), 1, 0, 1, 1+2+4+8 ) + If m.I > 0 Then + .t_OutputFile_TimeStamp = Datetime( Year(laFiles(m.I,3)), Month(laFiles(m.I,3)), Day(laFiles(m.I,3)) ; + , Val(Left(laFiles(m.I,4),2)), Val(Substr(laFiles(m.I,4),4,2)), Val(Right(laFiles(m.I,4),2)) ) + Endif + + lcExtA = Upper(Justext(.c_OutputFile)) + + Do Case + Case Inlist(lcExtA, 'SCX', 'VCX', 'MNX', 'FRX', 'LBX') + lcExtB = Icase(lcExtA = 'SCX', 'SCT' ; + , lcExtA = 'VCX', 'VCT' ; + , lcExtA = 'MNX', 'MNT' ; + , lcExtA = 'FRX', 'FRT' ; + , lcExtA = 'LBX', 'LBT') + I = Ascan( laFiles, Justfname( Forceext(.c_OutputFile, lcExtB) ), 1, 0, 1, 1+2+4+8 ) + If m.I > 0 Then + ltFilestamp = Datetime( Year(laFiles(m.I,3)), Month(laFiles(m.I,3)), Day(laFiles(m.I,3)) ; + , Val(Left(laFiles(m.I,4),2)), Val(Substr(laFiles(m.I,4),4,2)), Val(Right(laFiles(m.I,4),2)) ) + Endif + + Endcase + +*-- Tomo el máximo timestamp de los archivos de salida (??X/??T) + .t_OutputFile_TimeStamp = Max( .t_OutputFile_TimeStamp, ltFilestamp ) + Endif + Endif + + Do Case + Case .n_UseClassPerFile = 0 And .n_OptimizeByFilestamp = 1 And .t_InputFile_TimeStamp < .t_OutputFile_TimeStamp +*-- Optimizado: El Origen es anterior al Destino - No hace falta regenerar +*.writeLog( '> El archivo de salida [<>] no se regenera porque su timestamp es más nuevo que el de entrada.' ) + .writeLog( C_TAB + C_TAB + '* ' + Textmerge(loLang.C_OUTPUTFILE_TIMESTAMP_NEWER_THAN_INPUTFILE_TIMESTAMP_LOC) ) + + Case .n_UseClassPerFile = 0 And .n_OptimizeByFilestamp = 2 And .t_InputFile_TimeStamp = .t_OutputFile_TimeStamp +*-- Optimizado: El Origen es igual al Destino - No hace falta regenerar +*.writeLog( '> El archivo de salida [<>] no se regenera porque su timestamp es igual que el de entrada.' ) + .writeLog( C_TAB + C_TAB + '* ' + Textmerge(loLang.C_OUTPUTFILE_TIMESTAMP_EQUAL_THAN_INPUTFILE_TIMESTAMP_LOC) ) + + Otherwise + .c_Type = Upper(Justext(.c_OutputFile)) + loConversor.c_InputFile = .c_InputFile + loConversor.c_OutputFile = .c_OutputFile + loConversor.c_LogFile = .c_LogFile + loConversor.n_Debug = .n_Debug + loConversor.l_Test = .l_Test + loConversor.n_FB2PRG_Version = .n_FB2PRG_Version + loConversor.l_MethodSort_Enabled = .l_MethodSort_Enabled + loConversor.l_PropSort_Enabled = .l_PropSort_Enabled + loConversor.l_ReportSort_Enabled = .l_ReportSort_Enabled + loConversor.c_OriginalFileName = .c_OriginalFileName + loConversor.c_Foxbin2prg_FullPath = .c_Foxbin2prg_FullPath +*-- + .updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + .c_InputFile + '...', 0, 0, 0 ) + + If Aevents( laEvents, loConversor ) = 0 Then + Bindevent( loConversor, 'updateProgressbar', This, 'updateProgressbar' ) + Endif + + loConversor.convert( @toModulo, .F., This ) + + If loConversor.l_Error Then + .l_Error = .T. + Endif + + .n_ProcessedFilesCount = .n_ProcessedFilesCount + 1 + .writeLog() + .writeLog(loConversor.c_TextLog) && Recojo el LOG que haya generado el conversor + +*-- Logueo los errores + If Not Empty(loConversor.c_TextErr) Then + .writeErrorLog( Replicate( '-', 100 ), 1 ) + .writeErrorLog( loLang.C_ERRORS_FOUND_IN_FILE_LOC + ' [' + .c_InputFile + '] ' ) + .writeErrorLog( loConversor.c_TextErr ) + .writeErrorLog( ) + Endif + Endcase + + .normalizeFileCapitalization() + Endwith && THIS AS c_foxbin2prg OF 'FOXBIN2PRG.PRG' + + Catch To toEx + lnCodError = toEx.ErrorNo +*lcErrorInfo = THIS.exception2Str(toEx) + CR_LF + CR_LF + loLang.C_SOURCEFILE_LOC + THIS.c_InputFile + +*-- updateProcessedFile( tcProcessed, tcHasErrors, tcSupported, tcReserved ) + This.updateProcessedFile( lnIDInputFile, '', '', 'E1' ) + + If This.n_Debug > 0 Then + If _vfp.StartMode = 0 + Set Step On + Endif + Endif + If tlRelanzarError && Usado en Unit Testing + Throw + Endif + + Finally + If Aevents( laEvents, loConversor ) > 0 Then + Unbindevents( loConversor ) + Endif + + Store Null To loConversor, loFSO + + If lnCodError = 0 And This.l_Error Then + This.updateProcessedFile( lnIDInputFile, '', '', 'E1' ) + Else +*THIS.updateProcessedFile( lnIDInputFile ) + Endif + + Release lcErrorInfo, laDirFile, lcExtension, lnFileCount, laFiles, I ; + , ltFilestamp, lcExtA, lcExtB ; + , loConversor, loFSO + Endtry + + Return lnCodError + Endproc + + + Procedure get_DirSettings +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcDir (@? IN ) Directorio del que devolver su configuración +* RETORNO (@? OUT) Objeto CFG +*--------------------------------------------------------------------------------------------------- + Lparameters tcDir + + If Not Empty(tcDir) + This.evaluateConfiguration( '', '', '', '', '', '', '', '', tcDir, 'D' ) + Endif + + If This.n_CFG_Actual = 0 Then + loCFG = Null + Else + loCFG = This.o_Configuration(This.n_CFG_Actual) + Endif + + If Isnull(loCFG) Then + loCFG = Createobject('CL_CFG') + loCFG.CopyFrom(This) + Endif + + Return loCFG + Endproc + + + Procedure get_PROGRAM_HEADER + Local lcText + lcText = '' + +*-- Cabecera del PRG e inicio de DEF_CLASS + TEXT TO lcText ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + *-------------------------------------------------------------------------------------------------------------------------------------------------------- + * (ES) AUTOGENERADO - ĄĄATENCIÓN!! - ĄĄNO PENSADO PARA EJECUTAR!! USAR SOLAMENTE PARA INTEGRAR CAMBIOS Y ALMACENAR CON HERRAMIENTAS SCM!! + * (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!! + *-------------------------------------------------------------------------------------------------------------------------------------------------------- + <> Version="<>" SourceFile="<>" <> (Solo para binarios VFP 9 / Only for VFP 9 binaries) + * + ENDTEXT + + Return lcText + Endproc + + + Procedure getNext_BAK +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_OutputFilename (v! IN ) Nombre del archivo de salida a crear el backup +*-------------------------------------------------------------------------------------------------------------- + Lparameters tcOutputFileName + Local lcNext_Bak, I, laDirInfo(1,5) + lcNext_Bak = '.BAK' + + For I = 1 To This.n_ExtraBackupLevels + If m.I = 1 + If Not Adir( laDirInfo, tcOutputFileName + '.BAK' ) > 0 Then + lcNext_Bak = '.BAK' + Exit + Endif + Else + If Not Adir( laDirInfo, tcOutputFileName + '.' + Padl(m.I-1,1,'0') + '.BAK' ) > 0 Then + lcNext_Bak = '.' + Padl(m.I-1,1,'0') + '.BAK' + Exit + Endif + Endif + Endfor + + Return lcNext_Bak + Endproc + + + Procedure get_SeparatedLineAndComment +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcLine (!@ IN/OUT) Línea a separar del comentario +* tcComment (@? OUT) Comentario +* tlDeepCommentAnalysis (v? IN ) Indica realizar un análisis profundo de comentarios (para detectar casos complejos de código con '&&' embebido) +*--------------------------------------------------------------------------------------------------- + Lparameters tcLine As String, tcComment As String, tlDeepCommentAnalysis As Boolean + Local ln_AT_Cmt + tcComment = '' + ln_AT_Cmt = At( '&'+'&', tcLine) + + If ln_AT_Cmt > 0 + If tlDeepCommentAnalysis Then + Local laSeparador(3,3), lcSeparadoresIzq, lcSeparadoresDer, lcStr, lnAT_Amp, lnAT1, lnAT2, lnLen, I, X + + lcStr = tcLine &&EVL(tcStr, [DEFINE BAR 2 OF OpciónAsub PROMPT "Opción A&]+[&2" &]+[& Comentario Opción A-2]) + laSeparador(1,1) = '"' + laSeparador(1,2) = '"' + laSeparador(1,3) = 2 + laSeparador(2,1) = "'" + laSeparador(2,2) = "'" + laSeparador(2,3) = 2 + laSeparador(3,1) = '[' + laSeparador(3,2) = ']' + laSeparador(3,3) = 1 + lcSeparadoresIzq = laSeparador(1,1) + laSeparador(2,1) + laSeparador(3,1) + lcSeparadoresDer = laSeparador(1,2) + laSeparador(2,2) + laSeparador(3,2) + lnLen = Len(lcStr) + +*-- Anular subcadenas para luego encontrar comentarios '&&' (y analizar solo si existe al menos un '&&') + X = 1 + lnAT1 = At(laSeparador(m.X,1), lcStr) + +*-- Funcionamiento: +*-- La anulación de subcadenas se hace comenzando desde la primer comilla doble ["], y luego se va +*-- cancelando hasta la siguiente. A partir de ahi, se busca carácter a carácter el siguiente separador +*-- izquierdo de cadena ( '"[ ), se busca su pareja derecha y se cancela el texto entre ambos. +*-- La anulación de subcadenas es temporal, solo para determinar la verdadera posición del comentario, +*-- por ejemplo, esto: +*-- DEFINE BAR 2 OF OpciónAsub PROMPT ""+var+'aa'+["bb]+"Opción A&&2" && Comentario Opción A-2 +*-- se convierte temporalmente en esto: +*-- DEFINE BAR 2 OF OpciónAsub PROMPT XX+var+XXXX+XXXXX+XXXXXXXXXXXXX && Comentario Opción A-2 +*-- lo que facilita encontrar el comentario '&&' real. +*-- Si se encuentra algún separador de cadena que no cierre, se genera un error 10 (Syntax Error). + If lnAT1 > 0 Then + For I = lnAT1+1 To lnLen + If m.X > 0 Then + lnAT2 = At(laSeparador(m.X,2), lcStr, laSeparador(m.X,3)) + + If lnAT2 > 0 Then + lcStr = Stuff(lcStr, lnAT1, lnAT2-lnAT1+1, Replicate('X',lnAT2-lnAT1+1)) + Else + ln_AT_Cmt = At( '&'+'&', lcStr) + + If ln_AT_Cmt = 0 Or ln_AT_Cmt < lnAT1 +*-- No tiene comentario '&&' real, o sí lo tiene y además contiene un delimitador de cadena como parte del comentario + Exit + Else + Error 'Closing string delimiter <' + laSeparador(m.X,2) + '> not found: ' + tcLine + Endif + Endif + Endif + +*-- Verifico si el carácter es un separador de cadenas: '"[ + X = At( Substr(lcStr, m.I, 1), lcSeparadoresIzq) + + If m.X > 0 Then + lnAT1 = At(laSeparador(m.X,1), lcStr) + Endif + Endfor + Endif + + ln_AT_Cmt = At( '&'+'&', lcStr) + Endif && tlDeepCommentAnalysis + + If ln_AT_Cmt > 0 + tcComment = Ltrim( Substr( tcLine, ln_AT_Cmt + 2 ) ) + tcLine = Rtrim( Left( tcLine, ln_AT_Cmt - 1 ), 0, Chr(9), ' ' ) && Quito TABS y espacios + Endif + + Endif + + Return (ln_AT_Cmt > 0) + Endproc + + + Procedure normalizeFileCapitalization + Lparameters tl_NormalizeInputFile, tcFileName + + Try + Local lcPath, lcEXE_CAPS, lcOutputFile, llRelanzarError, lcType, laDirInfo(1,5) ; + , loEx As Exception ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loFSO As Scripting.FileSystemObject + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If Not .l_ProcessFiles + Exit + Endif + + loLang = _Screen.o_FoxBin2Prg_Lang + lcPath = Justpath(.c_Foxbin2prg_FullPath) + lcEXE_CAPS = Forcepath( 'filename_caps.exe', lcPath ) + loFSO = .o_FSO + llRelanzarError = Not tl_NormalizeInputFile + + If tl_NormalizeInputFile + tcFileName = Evl( tcFileName, .c_InputFile ) + lcType = Upper( Justext( tcFileName ) ) + Else + tcFileName = Evl( tcFileName, .c_OutputFile ) + lcType = .c_Type + Endif + + Do Case + Case .n_ExisteCapitalizacion = -1 +*-- La primera vez vale -1, hace la verificación por única vez y cachea la respuesta + If File(lcEXE_CAPS) +*.writeLog( '* Se ha encontrado el programa de capitalización de nombres [' + lcEXE_CAPS + ']' ) + .writeLog( C_TAB + Textmerge(loLang.C_NAMES_CAPITALIZATION_PROGRAM_FOUND_LOC) ) + Set Procedure To (lcEXE_CAPS) Additive + .o_FNC = Createobject( 'cl_FileName_Caps' ) + Release Procedure (lcEXE_CAPS) + + .n_ExisteCapitalizacion = 1 + Else +*-- No existe el programa de capitalización, así que no se capitalizan los nombres. +*.writeLog( '* No se ha encontrado el programa de capitalización de nombres [' + lcEXE_CAPS + ']' ) + .writeLog( C_TAB + Textmerge(loLang.C_NAMES_CAPITALIZATION_PROGRAM_NOT_FOUND_LOC) ) + .n_ExisteCapitalizacion = 0 + Exit + Endif + + Case .n_ExisteCapitalizacion = 0 +*-- Segunda pasada en adelante: No hay programa de capitalización + Exit + + Otherwise +*-- Segunda pasada en adelante: Hay programa de capitalización + + Endcase + +*-- Normalizar archivo(s) de entrada. El primero siempre se normaliza (??2, ??X, DBF, DBC) + .renameFile( tcFileName, lcEXE_CAPS, loFSO, llRelanzarError ) + + Do Case + Case lcType = 'PJX' + .renameFile( Forceext(tcFileName,'PJT'), lcEXE_CAPS, loFSO, llRelanzarError ) + + Case lcType = 'VCX' + .renameFile( Forceext(tcFileName,'VCT'), lcEXE_CAPS, loFSO, llRelanzarError ) + + Case lcType = 'SCX' + .renameFile( Forceext(tcFileName,'SCT'), lcEXE_CAPS, loFSO, llRelanzarError ) + + Case lcType = 'FRX' + .renameFile( Forceext(tcFileName,'FRT'), lcEXE_CAPS, loFSO, llRelanzarError ) + + Case lcType = 'LBX' + .renameFile( Forceext(tcFileName,'LBT'), lcEXE_CAPS, loFSO, llRelanzarError ) + + Case lcType = 'DBF' + If Adir( laDirInfo, Forceext(tcFileName,'FPT') ) > 0 Then + .renameFile( Forceext(tcFileName,'FPT'), lcEXE_CAPS, loFSO, llRelanzarError ) + Endif + If Adir( laDirInfo, Forceext(tcFileName,'CDX') ) > 0 Then + .renameFile( Forceext(tcFileName,'CDX'), lcEXE_CAPS, loFSO, llRelanzarError ) + Endif + + Case lcType = 'DBC' + .renameFile( Forceext(tcFileName,'DCX'), lcEXE_CAPS, loFSO, llRelanzarError ) + .renameFile( Forceext(tcFileName,'DCT'), lcEXE_CAPS, loFSO, llRelanzarError ) + + Case lcType = 'MNX' + .renameFile( Forceext(tcFileName,'MNT'), lcEXE_CAPS, loFSO, llRelanzarError ) + + Endcase + + Endwith && THIS + + Catch To loEx + Throw + + Finally + loFSO = Null + Release lcPath, lcEXE_CAPS, lcOutputFile, llRelanzarError, lcType, loFSO + + Endtry + + Return + Endproc + + + Procedure get_FilesFromDirectory + Lparameters tcDir, taFiles, tnFileCount + External Array taFiles + + Local laFiles(1), I, lnFiles ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + If Type("ALEN(laFiles)") # "N" Or Empty(tnFileCount) + tnFileCount = 0 + Dimension taFiles(1) + Endif + + tcDir = Addbs(tcDir) + + If Directory(tcDir) + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + .updateProgressbar( loLang.C_SCANNING_FILE_AND_DIR_INFO_LOC + ' ' + tcDir + '...', 0, 0, 0 ) + lnFiles = Adir( laFiles, tcDir + '*.*', 'D', 1) + +*-- Busco los archivos + For I = 1 To lnFiles + If Substr( laFiles(m.I,5), 5, 1 ) == 'D' + Loop + Endif + + tnFileCount = tnFileCount + 1 + Dimension taFiles(tnFileCount) + taFiles(tnFileCount) = tcDir + laFiles(m.I,1) + Endfor + +*-- Busco los subdirectorios + For I = 1 To lnFiles + If Not Substr( laFiles(m.I,5), 5, 1 ) == 'D' Or Left(laFiles(m.I,1), 1) == '.' + Loop + Endif + .get_FilesFromDirectory( tcDir + laFiles(m.I,1), @taFiles, @tnFileCount ) + Endfor + Endwith + Endif + Endproc + + + Procedure loadModule +*-------------------------------------------------------------------------------------------------------------- +* CARGA EL MÓDULO INDICADO EN tc_InputFile Y DEVUELVE SU REFERENCIA DE OBJETO EN toModulo +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tc_InputFile (v! IN ) Nombre del archivo de entrada +* toModulo (@? OUT) Referencia de objeto del módulo generado (para Unit Testing) +* toEx (@? OUT) Objeto con información del error +* tlRelanzarError (v? IN ) Indica si el error debe relanzarse o no +* tcOriginalFileName (v? IN ) Sirve para los casos en los que inputFile es un nombre temporal y se quiere generar +* el nombre correcto dentro de la versión texto (por ej: en los PJ2 y las cabeceras) +*-------------------------------------------------------------------------------------------------------------- + Lparameters tc_InputFile, toModulo, toEx As Exception, tlRelanzarError, tcOriginalFileName + + Try + Local lnCodError, lcErrorInfo, laDirFile(1,5), lcExtension, lnFileCount, laFiles(1,1), I ; + , ltFilestamp, lcExtA, lcExtB, laEvents(1,1), lnIDInputFile ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loConversor As c_conversor_base Of 'FOXBIN2PRG.PRG' ; + , loFSO As Scripting.FileSystemObject + lnCodError = 0 + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + Store Null To toModulo + lc_OldSetNotify = Set("Notify") + Set Notify Off + loFSO = .o_FSO + loLang = _Screen.o_FoxBin2Prg_Lang + .c_InputFile = Fullpath( tc_InputFile ) + .l_Error = .F. + lcExtension = Upper( Justext(.c_InputFile) ) + + .writeLog( Replicate( '*', 100 ) ) + .writeLog( 'LOAD MODULE', 2 ) + .writeLog( Replicate( '*', 100 ) ) + + If Adir( laDirFile, .c_InputFile, '', 1 ) = 0 +*ERROR 'No se encontró el archivo [' + .c_InputFile + ']' + Error loLang.C_FILE_NOT_FOUND_LOC + ' [' + .c_InputFile + ']' + Endif + + .c_InputFile = loFSO.GetAbsolutePathName( Forcepath( laDirFile(1,1), Justpath(.c_InputFile) ) ) + +*-- VERIFICO SI HAY ARCHIVO DE CONFIGURACIÓN SECUNDARIO + .evaluateConfiguration() + + + If Not Empty(tcOriginalFileName) + tcOriginalFileName = loFSO.GetAbsolutePathName( tcOriginalFileName ) + Endif + + .c_OriginalFileName = Evl( tcOriginalFileName, .c_InputFile ) + + If Upper( Justext(.c_OriginalFileName) ) = 'PJM' And .c_PJ2 <> 'PJM' + .c_OriginalFileName = Forceext(.c_OriginalFileName,'pjx') + Endif + + lnIDInputFile = .n_ProcessedFiles + + .writeLog( C_TAB + 'c_OriginalFileName: ' + .c_OriginalFileName ) + .writeLog( ) + + If Not Adir(laDirFile, .c_InputFile) > 0 Then + Error loLang.C_FILE_DOESNT_EXIST_LOC + ' [' + .c_InputFile + ']' + Endif + + Do Case + Case lcExtension = 'VCX' + loConversor = Createobject( 'c_conversor_vcx_a_prg' ) + + Case lcExtension = 'SCX' + loConversor = Createobject( 'c_conversor_scx_a_prg' ) + + Case lcExtension = 'PJX' + loConversor = Createobject( 'c_conversor_pjx_a_prg' ) + + Case lcExtension = 'PJM' And .c_PJ2 <> 'PJM' + loConversor = Createobject( 'c_conversor_pjm_a_prg' ) + + Case lcExtension = 'FRX' + loConversor = Createobject( 'c_conversor_frx_a_prg' ) + + Case lcExtension = 'LBX' + loConversor = Createobject( 'c_conversor_frx_a_prg' ) + + Case lcExtension = 'DBF' + loConversor = Createobject( 'c_conversor_dbf_a_prg' ) + + Case lcExtension = 'DBC' + loConversor = Createobject( 'c_conversor_dbc_a_prg' ) + + Case lcExtension = 'MNX' + loConversor = Createobject( 'c_conversor_mnx_a_prg' ) + + Case lcExtension = .c_VC2 + loConversor = Createobject( 'c_conversor_prg_a_vcx' ) + + Case lcExtension = .c_SC2 + loConversor = Createobject( 'c_conversor_prg_a_scx' ) + + Case lcExtension = .c_PJ2 + loConversor = Createobject( 'c_conversor_prg_a_pjx' ) + + Case lcExtension = .c_FR2 + loConversor = Createobject( 'c_conversor_prg_a_frx' ) + + Case lcExtension = .c_LB2 + loConversor = Createobject( 'c_conversor_prg_a_frx' ) + + Case lcExtension = .c_DB2 + loConversor = Createobject( 'c_conversor_prg_a_dbf' ) + + Case lcExtension = .c_DC2 + loConversor = Createobject( 'c_conversor_prg_a_dbc' ) + + Case lcExtension = .c_MN2 + loConversor = Createobject( 'c_conversor_prg_a_mnx' ) + + Otherwise +*ERROR 'El archivo [' + .c_InputFile + '] no está soportado' + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + + Endcase + + .c_Type = Upper(Justext(.c_OutputFile)) + loConversor.c_InputFile = .c_InputFile + loConversor.c_OutputFile = .c_OutputFile + loConversor.c_LogFile = .c_LogFile + loConversor.n_Debug = .n_Debug + loConversor.l_Test = .l_Test + loConversor.n_FB2PRG_Version = .n_FB2PRG_Version + loConversor.l_MethodSort_Enabled = .l_MethodSort_Enabled + loConversor.l_PropSort_Enabled = .l_PropSort_Enabled + loConversor.l_ReportSort_Enabled = .l_ReportSort_Enabled + loConversor.c_OriginalFileName = .c_OriginalFileName + loConversor.c_Foxbin2prg_FullPath = .c_Foxbin2prg_FullPath +*-- +*.updateProgressbar( loLang.C_PROCESSING_LOC + ' ' + .c_InputFile + '...', 0, 0, 0 ) + +*IF AEVENTS( laEvents, loConversor ) = 0 THEN +* BINDEVENT( loConversor, 'updateProgressbar', THIS, 'updateProgressbar' ) +*ENDIF + + loConversor.loadModule( @toModulo, .F., This ) + + If loConversor.l_Error Then + .l_Error = .T. + Endif + +*.n_ProcessedFilesCount = .n_ProcessedFilesCount + 1 + .writeLog() + .writeLog(loConversor.c_TextLog) && Recojo el LOG que haya generado el conversor + +*-- Logueo los errores + If Not Empty(loConversor.c_TextErr) Then + .writeErrorLog( Replicate( '-', 100 ), 1 ) + .writeErrorLog( loLang.C_ERRORS_FOUND_IN_FILE_LOC + ' [' + .c_InputFile + '] ' ) + .writeErrorLog( loConversor.c_TextErr ) + .writeErrorLog( ) + Endif + + Endwith && THIS AS c_foxbin2prg OF 'FOXBIN2PRG.PRG' + + Catch To toEx + lnCodError = toEx.ErrorNo +*lcErrorInfo = THIS.exception2Str(toEx) + CR_LF + CR_LF + loLang.C_SOURCEFILE_LOC + THIS.c_InputFile + +*-- updateProcessedFile( tcProcessed, tcHasErrors, tcSupported, tcReserved ) +*THIS.updateProcessedFile( lnIDInputFile, '', '', 'E1' ) + + If This.n_Debug > 0 Then + If _vfp.StartMode = 0 + Set Step On + Endif + Endif + If tlRelanzarError && Usado en Unit Testing + Throw + Endif + + Finally + Set Notify &lc_OldSetNotify. + +*IF AEVENTS( laEvents, loConversor ) > 0 THEN +* UNBINDEVENTS( loConversor ) +*ENDIF + + Store Null To loConversor, loFSO + +*IF lnCodError = 0 AND THIS.l_Error THEN +* THIS.updateProcessedFile( lnIDInputFile, '', '', 'E1' ) +*ELSE +* *THIS.updateProcessedFile( lnIDInputFile ) +*ENDIF + + Release lcErrorInfo, laDirFile, lcExtension, lnFileCount, laFiles, I ; + , ltFilestamp, lcExtA, lcExtB ; + , loConversor, loFSO + Endtry + + Return lnCodError + Endproc + + + Procedure readInputVFPParams + Lparameters taParams, tnPCount + External Array taParams +*----------------------------------------------------------------------------- +* Obtengo la linea completa de comandos +* Adaptado de http://www.news2news.com/vfp/?example=51&function=78 +* Facilitado por Mario Lopez en el foro FoxPro de Google Espańol - 23/12/2013 +* https://groups.google.com/d/msg/publicesvfoxpro/llS-kTNrG9M/LA4D3fd152IJ +*----------------------------------------------------------------------------- + Declare Integer GetCommandLine In kernel32 + Declare Integer GlobalSize In kernel32 Integer Hmem + Declare RtlMoveMemory In kernel32 As CopyMemory String @Destination, Integer Source, Integer nLength + + Local lnAddress, lnBufsize, lsBuffer + lnAddress = GetCommandLine() && returns an address in memory + lnBufsize = GlobalSize(lnAddress) + +* allocating and filling a buffer + If lnBufsize <> 0 + lsBuffer = Replicate(Chr(0), lnBufsize) + = CopyMemory(@lsBuffer, lnAddress, lnBufsize) + Endif + + lsBuffer = Strtran(lsBuffer, '"'+Chr(0), '"'+Chr(13)+Chr(10)) + lsBuffer = Strtran(lsBuffer, '" ', '"'+Chr(13)+Chr(10), 1, 1) + lsBuffer = Strtran(lsBuffer, Chr(0), ' ') + tnPCount = Alines( taParams, lsBuffer, 4 ) + + If tnPCount > 1 Then + Adel( taParams, 1 ) + tnPCount = tnPCount - 1 + Dimension taParams(tnPCount) + Endif + + Return + Endproc + + + + Procedure renameFile + Lparameters tcFileName, tcEXE_CAPS, toFSO As Scripting.FileSystemObject, tlRelanzarError + + Local lcLog, laFile(1,5) ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + lcLog = '' + .o_FNC.Capitalize( tcFileName, '', 'F', @lcLog, tlRelanzarError, '1' ) + + If .n_Debug >= 2 Then + lcLog = Substr(lcLog,3) + .writeLog() + .writeLog( C_TAB + Textmerge(loLang.C_REQUESTING_CAPITALIZATION_OF_FILE_LOC) ) + .writeLog( lcLog ) + Endif + Endwith + Endproc + + + + Procedure renameTmpFile2Tx2File + Lparameters tcFileName + + Local lcTmpFile, loFSO As Scripting.FileSystemObject, loEx As Exception + + Try +*loFSO = THIS.o_FSO + lcTmpFile = tcFileName + '.TMP' + This.changeFileAttribute( tcFileName, '+N' ) + Erase (tcFileName) + Rename (lcTmpFile) To (tcFileName) + + Catch To loEx + Throw + + Finally +*loFSO = NULL + Endtry + + Return + Endproc + + + + Procedure set_Line + Lparameters tcLine, taCodeLines, I + tcLine = Ltrim( taCodeLines(m.I), 0, Chr(9), ' ' ) + Endproc + + + Procedure errOut +*-- DEVOLUCIÓN DE SALIDA A ERROUT (-12) + Lparameters tcTexto + + Try + If This.l_StdOutHabilitado + Local loException As Exception, lcOutput, lnOutHandle, lnBytesWritten, lnOverlappedIO + lcOutput = Evl(tcTexto,'') + CR_LF + lnOutHandle = fb2p_GetStdHandle(-12) && CAPTURAR ERROR DESDE CONSOLA: FOXBIN2PRG.EXE PARAMS 2>&1 | FIND /V "" + lnBytesWritten = 0 + lnOverlappedIO = 0 + fb2p_WriteFile(lnOutHandle, @lcOutput, Len(lcOutput), @lnBytesWritten, @lnOverlappedIO) + Endif + + Catch To loException + This.l_StdOutHabilitado = .F. + + Endtry + + Return + Endproc + + + Procedure stdOut +*-- DEVOLUCIÓN DE SALIDA A STDOUT (-11) + Lparameters tcTexto + + Try + If This.l_StdOutHabilitado + Local loException As Exception, lcOutput, lnOutHandle, lnBytesWritten, lnOverlappedIO + lcOutput = Evl(tcTexto,'') + CR_LF + lnOutHandle = fb2p_GetStdHandle(-11) && CAPTURAR STDOUT DESDE CONSOLA: FOXBIN2PRG.EXE PARAMS | FIND /V "" + lnBytesWritten = 0 + lnOverlappedIO = 0 + fb2p_WriteFile(lnOutHandle, @lcOutput, Len(lcOutput), @lnBytesWritten, @lnOverlappedIO) + Endif + + Catch To loException + This.l_StdOutHabilitado = .F. + + Endtry + + Return + Endproc + + + Procedure updateProcessedFile +*--------------------------------------------------------------------------------------------------- +* ACTUALIZA ALGUNOS DATOS DEL ARCHIVO PROCESADO ACTUAL +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tnID (v? IN ) ID del archivo a actualizar. Si no se indica se asume el actual. +* tcInOutType (v? IN ) Archivo de entrada o de salida ("I"=Input file, "O"=Output file) +* tcProcessed (v? IN ) Procesado ("P0"=Not Processed, "P1"=Processed) +* tcHasErrors (v? IN ) Tuvo Errores ("E0"=No Errors, "E1"=Has Errors) +* tcSupported (v? IN ) Archivo soportado ("S0"=Unsupported, "S1"=Supported) +* tcExpanded (v? IN ) Tipo de archivo ("X0"=Normal file, "X1"=Expanded multipart file) +*--------------------------------------------------------------------------------------------------- + Lparameters tnID, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded + + Try + Local loEx As Exception + + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If .n_ProcessedFiles = 0 Then + Exit + Endif + tnID = Evl(tnID, .n_ProcessedFiles) + If Not Empty(tcInOutType) + .a_ProcessedFiles(tnID, 2) = Evl(tcProcessed, '') + Endif + If Not Empty(tcProcessed) + .a_ProcessedFiles(tnID, 3) = Evl(tcProcessed, '') + Endif + If Not Empty(tcHasErrors) + .a_ProcessedFiles(tnID, 4) = Evl(tcHasErrors, '') + Endif + If Not Empty(tcSupported) + .a_ProcessedFiles(tnID, 5) = Evl(tcSupported, '') + Endif + .stdOut( .a_ProcessedFiles(tnID,2) ; + + ',' + .a_ProcessedFiles(tnID,3) ; + + ',' + .a_ProcessedFiles(tnID,4) ; + + ',' + .a_ProcessedFiles(tnID,5) ; + + ',' + .a_ProcessedFiles(tnID,6) ; + + ',' + Lower(.a_ProcessedFiles(tnID,1)) ) + Endwith + + Catch To loEx + If This.n_Debug > 0 Then + If _vfp.StartMode = 0 + Set Step On + Endif + Endif + Throw + + Endtry + Endproc + + + Procedure writeErrorLog + Lparameters tcText, tnTimeStamp + + Try + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' +*-- Según el valor de nTimestamp: +*-- 0 = Sin timestamp +*-- 1 = Timestamp por delante +*-- 2 = Timestamp por detrás + .c_TextErr = .c_TextErr ; + + Iif( Evl(tnTimeStamp,0) = 1, Ttoc(Datetime(),3) + ' ', '' ) ; + + Evl(tcText,'') ; + + Iif( Evl(tnTimeStamp,0) = 2, ' ' + Ttoc(Datetime(),3), '' ) ; + + CR_LF + + .errOut(tcText) + .l_Error = .T. + .l_Errors = .T. + Endwith + Catch + Endtry + Endproc + + + Procedure writeErrorLog_Flush + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If Not Empty(.c_TextErr) + Strtofile( .c_TextErr + CR_LF, .c_ErrorLogFile, 1 ) + Endif + .c_TextErr = '' + Endwith + Endproc + + + + Procedure writeLog + Lparameters tcText, tnTimeStamp + + Try + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' +*-- Según el valor de nTimestamp: +*-- 0 = Sin timestamp +*-- 1 = Timestamp por delante +*-- 2 = Timestamp por detrás + .c_TextLog = .c_TextLog ; + + Iif( Evl(tnTimeStamp,0) = 1, Ttoc(Datetime(),3) + ' ', '' ) ; + + Evl(tcText,'') ; + + Iif( Evl(tnTimeStamp,0) = 2, ' ' + Ttoc(Datetime(),3), '' ) ; + + CR_LF + Endwith + Catch + Endtry + Endproc + + + Procedure writeLog_Flush + With This As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + If .n_Debug > 0 And Not Empty(.c_TextLog) + Strtofile( .c_TextLog + CR_LF, .c_LogFile, 1 ) + Endif + .c_TextLog = '' + Endwith + Endproc + + + + Hidden Procedure exception2Str + Lparameters toEx As Exception + Local lcError + lcError = 'Error ' + Transform(toEx.ErrorNo) + ', ' + toEx.Message + CR_LF ; + + toEx.Procedure + ', ' + Transform(toEx.Lineno) + CR_LF + + If Not Empty(toEx.LineContents) And toEx.ErrorNo <> 1098 + lcError = lcError + toEx.LineContents + CR_LF + Endif + + If Not Empty(toEx.UserValue) + lcError = lcError + Evl(toEx.UserValue,'') + Endif + + Return lcError + Endproc + + + Procedure unique_ID + Lparameters tcValType + + tcValType = Evl(tcValType,'C') + This.n_ID = Int( This.n_ID + 1 ) + + If tcValType = 'N' + Return This.n_ID + Else + Return '_' + Transform( This.n_ID, '@L #########' ) + Endif + Endproc + + + Function wscriptshell_run +* Modificación basada en la rutina RunExitCode.prg de William GC Steinford (nov 2002) +* pero compatible con el método Run de WScript.Shell para su reemplazo cuando no es posible usarlo. +* http://fox.wikis.com/wc.dll?Wiki~ProcessExitCode +*----------------------------------------------------------------------------------------------- +* 'Run' Parameter Documentation at: https://msdn.microsoft.com/en-us/library/d5fk67ky%28v=vs.84%29.aspx +*----------------------------------------------------------------------------------------------- + Lparameters tcCmdLine, tnWindowStyle, tbWaitOnReturn, tlDebug +* ? WScriptShell_Run("c:\windows\system32\cmd.exe /c dir c:\*.* > \temp\dir.txt") + + Local lnWfSO, ln_dwFlags, ln_wShowWindow, lcStartInfo, lcProcessInfo, ln_hProcess, ln_hThread ; + , lnExitCode, ln_dwProcessId, ln_dwThreadId, tcProgFile, laDirFile(1,5) + + Try + Declare SHORT CreateProcess In WIN32API ; + STRING lpszModuleName, ; + STRING @lpszCommandLine, ; + STRING lpSecurityAttributesProcess, ; + STRING lpSecurityAttributesThread, ; + SHORT bInheritHandles, ; + INTEGER dwCreateFlags, ; + STRING lpvEnvironment, ; + STRING lpszStartupDir, ; + STRING @lpStartInfo, ; + STRING @lpProcessInfo + + Declare Long WaitForSingleObject In WIN32API Integer hHandle, Long dwMilliseconds + Declare Integer GetExitCodeProcess In WIN32API Integer ln_hProcess, Integer @ lnExitCode + Declare Integer CloseHandle In kernel32.Dll Integer hObject +*DECLARE INTEGER ShellExecuteEx IN Shell32 STRING @lpExecInfo + Declare Long ShellExecuteEx In shell32.Dll String @ + Declare Long HeapAlloc In WIN32API Long, Long, Long + Declare Long HeapFree In WIN32API Long, Long, Long + Declare Long GetProcessHeap In WIN32API +*DECLARE LONG WaitForSingleObject IN WIN32API LONG, LONG + Declare Long TerminateProcess In WIN32API Long, Long + +* NOTA: Las constantes para VFP se pueden consultar en http://www.news2news.com/vfp/w32constants.php + + #Define SEE_MASK_NOCLOSEPROCESS 0x00000040 + #Define WAIT_MILLISECOND 3000 + + #Define SW_SHOW 5 + #Define STILL_ACTIVE 0x103 + #Define cnINFINITE 0xFFFFFFFF + #Define cnHalfASecond 500 && milliseconds + #Define cnTimedOut 0x0102 + +*-- Constantes para WaitForSingleObject + #Define WAIT_ABANDONED 0x00000080 + #Define WAIT_OBJECT_0 0x00000000 + #Define WAIT_TIMEOUT 0x00000102 + #Define WAIT_FAILED 0xFFFFFFFF + + tcProgFile = Evl(tcProgFile, Null) + tcCmdLine = Evl(tcCmdLine, Null) + + Do Case + Case Vartype(tbWaitOnReturn) = "L" + Case Vartype(tbWaitOnReturn) = "N" + tbWaitOnReturn = (tbWaitOnReturn=1) + Otherwise + Error 'Invalid value for tbWaitOnReturn parameter' + Endcase + + If Vartype(tnWindowStyle) # "N" Or Not Between(tnWindowStyle, 0, 10) Then + tnWindowStyle = 10 + Endif + + ln_dwFlags = 1 + ln_wShowWindow = tnWindowStyle + +* DOCUMENTACIÓN estructura _STARTUPINFO: +* creates the STARTUP structure to specify main window +* properties if a new window is created for a new process + +*| typedef struct _STARTUPINFO { +*| DWORD cb; 4 +*| LPTSTR lpReserved; 4 +*| LPTSTR lpDesktop; 4 +*| LPTSTR lpTitle; 4 +*| DWORD dwX; 4 +*| DWORD dwY; 4 +*| DWORD dwXSize; 4 +*| DWORD dwYSize; 4 +*| DWORD dwXCountChars; 4 +*| DWORD dwYCountChars; 4 +*| DWORD dwFillAttribute; 4 +*| DWORD dwFlags; 4 +*| WORD wShowWindow; 2 +*| WORD cbReserved2; 2 +*| LPBYTE lpReserved2; 4 +*| HANDLE hStdInput; 4 +*| HANDLE hStdOutput; 4 +*| HANDLE hStdError; 4 +*| } STARTUPINFO, *LPSTARTUPINFO; total: 68 bytes + lcStartInfo = BinToC(68,'4RS') ; + + BinToC(0,'4RS') + BinToC(0,'4RS') + BinToC(0,'4RS') ; + + BinToC(0,'4RS') + BinToC(0,'4RS') + BinToC(0,'4RS') + BinToC(0,'4RS') ; + + BinToC(0,'4RS') + BinToC(0,'4RS') + BinToC(0,'4RS') ; + + BinToC(ln_dwFlags,'4RS') ; + + BinToC(ln_wShowWindow,'2RS') ; + + BinToC(0,'2RS') + BinToC(0,'4RS') ; + + BinToC(0,'4RS') + BinToC(0,'4RS') + BinToC(0,'4RS') + + lcProcessInfo = Replicate( Chr(0), 16 ) + +* DOCUMENTACIÓN estructura _PROCESS_INFORMATION: +* https://msdn.microsoft.com/en-us/library/windows/desktop/ms684873%28v=vs.85%29.aspx +* typedef struct _PROCESS_INFORMATION { +* HANDLE hProcess; +* HANDLE hThread; +* DWORD dwProcessId; +* DWORD dwThreadId; +* } PROCESS_INFORMATION; +* + + If CreateProcess( tcProgFile, tcCmdLine,0,0,0,0,0,0, lcStartInfo, @lcProcessInfo ) = 0 + +*-- Segundo intento: Si se definió un archivo (ej: un TXT,LOG,etc) intento lanzarlo +*-- con la aplicación predeterminada + If Adir(laDirFile, tcCmdLine) = 1 Then + Local lcInfo, lnHeap, lnLen, lnPtr + +*-- Ejemplo adaptado de: http://www.foxite.com/archives/0000316611.htm + lnLen = Len(tcCmdLine) + 1 + lnHeap = GetProcessHeap() + lnPtr = HeapAlloc(lnHeap, 0x8, 5 + lnLen) + Sys(2600, lnPtr, 5, [open] + Chr(0)) + Sys(2600, lnPtr+5, lnLen, tcCmdLine + Chr(0)) + +* DOCUMENTACIÓN estructura _SHELLEXECUTEINFO: +* https://msdn.microsoft.com/en-us/library/windows/desktop/bb759784%28v=vs.85%29.aspx +*typedef struct _SHELLEXECUTEINFO { +* DWORD cbSize; 4 +* ULONG fMask; 4 +* HWND hwnd; 4 +* LPCTSTR lpVerb; 4 +* LPCTSTR lpFile; 4 +* LPCTSTR lpParameters; 4 +* LPCTSTR lpDirectory; 4 +* int nShow; 4 +* HINSTANCE hInstApp; 4 +* LPVOID lpIDList; 4 +* LPCTSTR lpClass; 4 +* HKEY hkeyClass; 4 +* DWORD dwHotKey; 4 +* union { +* HANDLE hIcon; +* HANDLE hMonitor; +* } DUMMYUNIONNAME; 4 +* HANDLE hProcess; 4 +*} SHELLEXECUTEINFO, *LPSHELLEXECUTEINFO; +* + + lcInfo = ; + BINTOC(60, [4RS]) + ; + BINTOC(SEE_MASK_NOCLOSEPROCESS, [4RS]) + ; + BINTOC(0, [4RS]) + ; + BINTOC(lnPtr, [4RS]) + ; + BINTOC(lnPtr+5, [4RS]) + ; + BINTOC(0, [4RS]) + ; + BINTOC(0, [4RS]) + ; + BINTOC(1, [4RS]) + ; + REPLICATE(Chr(0), 28) + + If ShellExecuteEx(@lcInfo) = 0 + If tlDebug + ? "Could not call process" + Endif + lnExitCode = -1 + Exit + Else + HeapFree(lnHeap, 0, lnPtr) + ln_hProcess = CToBin(Right(lcInfo, 4), [4RS]) + ln_hThread = 0 + + If tlDebug + ? "Process handle = "+Transform(ln_hProcess) + ? "Thread handle = "+Transform(ln_hThread) + Endif + +*IF lnProcess != 0 +* WaitForSingleObject(ln_hProcess, WAIT_MILLISECOND) +* IF tlDebug +* ? "Terminating process!" +* ENDIF +* TerminateProcess(ln_hProcess, 0) +*ENDIF + Endif + + Else + If tlDebug + ? "Could not create process" + Endif + lnExitCode = -1 + Exit + Endif + Else + +* Process and thread handles returned in ProcInfo structure + ln_hProcess = CToBin( Left( lcProcessInfo, 4 ), '4RS' ) + ln_hThread = CToBin( Substr( lcProcessInfo, 5, 4 ), '4RS' ) + ln_dwProcessId = CToBin( Substr( lcProcessInfo, 9, 4 ), '4RS' ) + ln_dwThreadId = CToBin( Substr( lcProcessInfo, 13, 4 ), '4RS' ) + + If tlDebug + ? "Process handle = "+Transform(ln_hProcess) + ? "Thread handle = "+Transform(ln_hThread) + ? "Process handle id = "+Transform(ln_dwProcessId) + ? "Thread handle id = "+Transform(ln_dwThreadId) + Endif + Endif + + If tbWaitOnReturn Then +* // Give the process time to execute and finish + lnExitCode = STILL_ACTIVE + + Do While lnExitCode = STILL_ACTIVE +*lnWfSO = WaitForSingleObject(ln_hProcess, cnHalfASecond) + lnWfSO = WaitForSingleObject(ln_hProcess, cnINFINITE) + + If tlDebug + ? 'lnWfSO = ' + Transform(lnWfSO) + Endif + + If GetExitCodeProcess(ln_hProcess, @lnExitCode) <> 0 + Do Case + Case lnExitCode = STILL_ACTIVE + If tlDebug + ? "Process is still active" + Endif + Otherwise + If tlDebug + ? "Exit code = "+ Transform( lnExitCode ) + Endif + Endcase + Else + If tlDebug + ? "GetExitCodeProcess() failed" + Endif + lnExitCode = -2 + Endif + + DoEvents + Enddo + Else + lnExitCode = 0 + Endif + +*-- DOCUMENTACIÓN sobre cierre procesos/threads: +*-- https://msdn.microsoft.com/en-us/library/windows/desktop/ms682512%28v=vs.85%29.aspx + =CloseHandle(ln_hProcess) + =CloseHandle(ln_hThread) + + If tlDebug + ? '> FUNCTION RETURN VALUE = ' + Endif + Endtry + + Return lnExitCode + Endfunc + + + Function FERROR_Message(tcFileName As String) + Local lcMsg, lnError + tcFileName = Evl(tcFileName,'') + lnError = Ferror() + + Do Case + Case lnError = 2 + lcMsg = 'File not found' + Case lnError = 4 + lcMsg = 'Too many files open (out of file handles)' + Case lnError = 5 + lcMsg = 'Access denied' + Case lnError = 6 + lcMsg = 'Invalid file handle given' + Case lnError = 8 + lcMsg = 'Out of memory' + Case lnError = 25 + lcMsg = [Seek error (can't seek before the start of a file)] + Case lnError = 29 + lcMsg = 'Disk full' + Case lnError = 31 + lcMsg = 'Error opening file' + Otherwise + lcMsg = 'Unrecognized error trying to open the file ' + tcFileName + Endcase + + Return lcMsg + Endfunc + + + Function getLocaleInfo + Lparameters tnSetting, tcLocale + #Define C_NULL Chr(0) + Local lcLocale, lnLen, lcBuffer, lnReturn, lcReturn + + If Vartype(tcLocale) = 'C' And Not Empty(tcLocale) + lcLocale = Strconv(tcLocale, 5) + C_NULL + Else + lcLocale = .Null. + Endif + + Declare Integer GetLocaleInfoEx In Win32API ; + string locale, Long Type, String @Buffer, Integer Len + lnLen = 255 + lcBuffer = Space(lnLen) + lnReturn = GetLocaleInfoEx(lcLocale, tnSetting, @lcBuffer, lnLen) + lcReturn = Strconv(Left(lcBuffer, 2 * (lnReturn - 1)), 6) + Return lcReturn + Endfunc + + +Enddefine + + +Define Class frm_avance As Form + Height = 110 + Width = 628 + ShowWindow = 2 + DoCreate = .T. + AllowOutput = .F. + AutoCenter = .T. + BorderStyle = 2 + ControlBox = .F. + BackColor = Rgb(255,255,255) + nMax_value = 100 + nMax_value2 = 100 + nSecsAtStart = (Seconds()) + nLastSecCount = 0 + nValue = 0 + nValue2 = 0 + l_Cancelled = .F. + Name = "frm_avance" + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + + Add Object shp_base As Shape With ; + Top = 28, ; + Left = 12, ; + Height = 13, ; + Width = 604, ; + Curvature = 8, ; + BorderWidth = 8, ; + BackColor = 14215910, ; + BorderColor = 14215910, ; + Name = "shp_base" + + Add Object shp_avance As Shape With ; + Top = 28, ; + Left = 12, ; + Height = 13, ; + Width = 36, ; + Curvature = 8, ; + BackColor = 6734335, ; + BorderColor = 10476031, ; + BorderWidth = 1, ; + Name = "shp_Avance" + + Add Object shp_base2 As Shape With ; + Top = 64, ; + Left = 12, ; + Height = 13, ; + Width = 604, ; + Curvature = 8, ; + BorderWidth = 0, ; + BackColor = 14215910, ; + BorderColor = 14215910, ; + Name = "shp_base2" + + Add Object shp_avance2 As Shape With ; + Top = 64, ; + Left = 12, ; + Height = 13, ; + Width = 36, ; + Curvature = 8, ; + BackColor = 6734335, ; + BorderColor = 10476031, ; + BorderWidth = 1, ; + Name = "shp_Avance2" + + Add Object cmdCancel As CommandButton With ; + Top = 84, ; + Left = 252, ; + Height = 21, ; + Width = 100, ; + Caption = "Cancel", ; + Enabled = .F., ; + Name = "cmdCancel" + + Add Object lin_1 As Shape With ; + Top = 28, ; + Left = 32, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_1" + + Add Object lin_2 As Shape With ; + Top = 28, ; + Left = 52, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_2" + + Add Object lin_3 As Shape With ; + Top = 28, ; + Left = 72, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_3" + + Add Object lin_4 As Shape With ; + Top = 28, ; + Left = 92, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_4" + + Add Object lin_5 As Shape With ; + Top = 28, ; + Left = 112, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_5" + + Add Object lin_6 As Shape With ; + Top = 28, ; + Left = 132, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_6" + + Add Object lin_7 As Shape With ; + Top = 28, ; + Left = 152, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_7" + + Add Object lin_8 As Shape With ; + Top = 28, ; + Left = 172, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_8" + + Add Object lin_9 As Shape With ; + Top = 28, ; + Left = 192, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_9" + + Add Object lin_10 As Shape With ; + Top = 28, ; + Left = 212, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_10" + + Add Object lin_11 As Shape With ; + Top = 28, ; + Left = 232, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_11" + + Add Object lin_12 As Shape With ; + Top = 28, ; + Left = 252, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_12" + + Add Object lin_13 As Shape With ; + Top = 28, ; + Left = 272, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_13" + + Add Object lin_14 As Shape With ; + Top = 28, ; + Left = 292, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_14" + + Add Object lin_15 As Shape With ; + Top = 28, ; + Left = 312, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_15" + + Add Object lin_16 As Shape With ; + Top = 28, ; + Left = 332, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_16" + + Add Object lin_17 As Shape With ; + Top = 28, ; + Left = 352, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_17" + + Add Object lin_18 As Shape With ; + Top = 28, ; + Left = 372, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_18" + + Add Object lin_19 As Shape With ; + Top = 28, ; + Left = 392, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_19" + + Add Object lin_20 As Shape With ; + Top = 28, ; + Left = 412, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_20" + + Add Object lin_21 As Shape With ; + Top = 28, ; + Left = 432, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_21" + + Add Object lin_22 As Shape With ; + Top = 28, ; + Left = 452, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_22" + + Add Object lin_23 As Shape With ; + Top = 28, ; + Left = 472, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_23" + + Add Object lin_24 As Shape With ; + Top = 28, ; + Left = 492, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_24" + + Add Object lin_25 As Shape With ; + Top = 28, ; + Left = 512, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_25" + + Add Object lin_26 As Shape With ; + Top = 28, ; + Left = 532, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_26" + + Add Object lin_27 As Shape With ; + Top = 28, ; + Left = 552, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_27" + + Add Object lin_28 As Shape With ; + Top = 28, ; + Left = 572, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_28" + + Add Object lin_29 As Shape With ; + Top = 28, ; + Left = 592, ; + Height = 53, ; + Width = 0, ; + BorderColor = 16777215, ; + Name = "lin_29" + + Add Object lbl_tarea As Label With ; + BackStyle = 0, ; + Caption = ".", ; + Height = 17, ; + Left = 12, ; + Top = 8, ; + Width = 604, ; + Name = "lbl_Tarea" + + Add Object lbl_tarea2 As Label With ; + BackStyle = 0, ; + Caption = ".", ; + Height = 17, ; + Left = 12, ; + Top = 44, ; + Width = 604, ; + Name = "lbl_Tarea2" + + Add Object 'lblStartTime' As Label With ; + BackStyle = 0, ; + Caption = "Start time: __/__/____ __:__:__", ; + Height = 17, ; + Left = 12, ; + Name = "lblStartTime", ; + Top = 88, ; + Width = 176 + + Add Object 'lblElapsedTime' As Label With ; + BackStyle = 0, ; + Caption = "Elapsed Time: __:__:__", ; + Height = 17, ; + Left = 480, ; + Name = "lblElapsedTime", ; + Top = 88, ; + Width = 136 + + Procedure updateProgressbar + Lparameters tcTexto, tnValor, tnTotal, tnTipo + + With Thisform As frm_avance Of foxbin2prg.prg + Local lnSecs + + lnSecs = Seconds() + + If lnSecs - .nLastSecCount > 0 Then + .lblElapsedTime.Caption = 'Elapsed Time: ' + Ttoc( {^2000-1-1,00:00:00} + lnSecs - .nSecsAtStart, 2 ) + .nLastSecCount = lnSecs + Endif + +*-- Habilita el botón de cancelar una vez que se comienzan a pasar valores + If Not Empty(tnValor) Then + If Not .cmdCancel.Enabled Then + .cmdCancel.Enabled = .T. + Endif + DoEvents + Endif + + Do Case + Case tnTipo = 0 + If Not Empty(tcTexto) Then + .lbl_tarea.Caption = tcTexto + Endif + + .nValue2 = 0 + + If tnTotal > 0 Then + .nMax_value = tnTotal + .nValue = tnValor + Endif + + Case tnTipo = 1 + If Not Empty(tcTexto) Then + .lbl_tarea2.Caption = tcTexto + Endif + + If tnTotal > 0 Then + .nMax_value2 = tnTotal + .nValue2 = tnValor + Endif + + Case tnTipo = 2 + If Not Empty(tcTexto) Then + .lbl_tarea2.Caption = tcTexto + Endif + + If tnTotal > 0 Then + .nMax_value2 = tnTotal + .nValue2 = tnValor + Endif + + Endcase + Endwith && THIS + + Return + Endproc + + + Procedure nValue_assign + Lparameters vNewVal + + With This + .nValue = m.vNewVal + .shp_avance.Width = m.vNewVal * .shp_base.Width / .nMax_value + Endwith + Endproc + + + Procedure Init + Lparameters toFoxBin2Prg + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + Local Thisform As frm_avance Of foxbin2prg.prg + #Endif + + Local laDirInfo(1,5), loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + If Vartype(toFoxBin2Prg) = "O" Then + If Type("_SCREEN.o_FoxBin2Prg_Lang") = "O" Then + loLang = _Screen.o_FoxBin2Prg_Lang + Thisform.Caption = 'FoxBin2Prg ' + _Screen.c_FB2PRG_EXE_Version + ' > - ' + loLang.C_PROCESS_PROGRESS_LOC + ' (' + loLang.C_PRESS_ESC_TO_CANCEL + ')' + Endif + +*IF ADIR( laDirInfo, FORCEEXT( toFoxBin2Prg.c_Foxbin2prg_FullPath, 'ICO' ) ) > 0 THEN + If File( Forceext( toFoxBin2Prg.c_Foxbin2prg_FullPath, 'ICO' ) ) Then + Thisform.Icon = Forceext( toFoxBin2Prg.c_Foxbin2prg_FullPath, 'ICO' ) + Endif + +*IF ADIR( laDirInfo, toFoxBin2Prg.c_BackgroundImage ) > 0 THEN + If File( toFoxBin2Prg.c_BackgroundImage ) Then + Clear Resources + Thisform.Picture = toFoxBin2Prg.c_BackgroundImage + Endif + Endif + + Thisform.nValue = 0 + Thisform.nValue2 = 0 + Thisform.nLastSecCount = Seconds() + Endproc + + + Procedure nValue2_assign + Lparameters vNewVal + + With This + .nValue2 = m.vNewVal + .shp_avance2.Width = m.vNewVal * .shp_base2.Width / .nMax_value2 + Endwith + Endproc + + + Procedure cmdCancel.Click + Thisform.l_Cancelled = .T. + Endproc + + + Procedure lblStartTime.Init + This.Caption = "Start Time: " + Ttoc(Datetime()) + Endproc + +Enddefine + + + +Define Class frm_interactive As Form + Height = 114 + Width = 380 + ShowWindow = 2 + DoCreate = .T. + AllowOutput = .F. + AutoCenter = .T. + BorderStyle = 2 + Caption = "FoxBin2Prg" + Closable = .T. + ControlBox = .T. + AlwaysOnTop = .T. + MaxButton = .F. + MinButton = .F. + BackColor = Rgb(255,255,255) + n_ConversionType = 3 + l_FileTimeStampOptimization = .F. + Name = "frm_interactive" + _MemberData = [] ; + + [] ; + + [] ; + + [] + + + Add Object chk_FileTimeStampOptimization As Checkbox With ; + Alignment = 0, ; + BackStyle = 0, ; + Caption = "chk_FileTimeStampOptimization", ; + ControlSource = "THISFORM.l_FileTimeStampOptimization", ; + Enabled = .T., ; + Height = 17, ; + Left = 40, ; + Name = "chk_FileTimeStampOptimization", ; + Top = 92, ; + Width = 300, ; + Visible = .F. + + + Add Object lbl_title As Label With ; + WordWrap = .T., ; + Alignment = 2, ; + BackStyle = 0, ; + Caption = "lbl_title", ; + Height = 36, ; + Left = 12, ; + Top = 16, ; + Width = 356, ; + KeyPreview = .T., ; + Name = "lbl_Title" + + + Add Object cmd_Bin2Prg As CommandButton With ; + Top = 58, ; + Left = 40, ; + Height = 27, ; + Width = 92, ; + Caption = "cmd_Bin2Prg", ; + Name = "cmd_Bin2Prg" + + + Add Object cmd_Prg2Bin As CommandButton With ; + Top = 58, ; + Left = 144, ; + Height = 27, ; + Width = 92, ; + Caption = "cmd_Prg2Bin", ; + Name = "cmd_Prg2Bin" + + + Add Object cmd_None As CommandButton With ; + Top = 58, ; + Left = 248, ; + Height = 27, ; + Width = 92, ; + Caption = "cmd_None", ; + Cancel = .T., ; + Name = "cmd_None" + + + Procedure Init + Lparameters toFoxBin2Prg + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Local laDirInfo(1,5), loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + If Vartype(toFoxBin2Prg) = "O" Then + If Vartype(_Screen.o_FoxBin2Prg_Lang) = "O" Then + loLang = _Screen.o_FoxBin2Prg_Lang + + If Pemstatus(_Screen, 'c_FB2PRG_EXE_Version', 5) Then + Thisform.Caption = 'FoxBin2Prg ' + _Screen.c_FB2PRG_EXE_Version + ' - ' + loLang.C_CONVERT_FOLDER_LOC + Endif + + Thisform.chk_FileTimeStampOptimization.Caption = loLang.C_USE_FILE_TIMESTAMP_OPTIMIZATION_LOC + Thisform.lbl_title.Caption = loLang.C_CONVERT_FOLDER_QUESTION_LOC + Thisform.cmd_Bin2Prg.Caption = loLang.C_BINARY_TO_TEXT_LOC + Thisform.cmd_Prg2Bin.Caption = loLang.C_TEXT_TO_BINARY_LOC + Thisform.cmd_None.Caption = loLang.C_CONVERT_FOLDER_NONE_LOC + Endif + + Thisform.l_FileTimeStampOptimization = (toFoxBin2Prg.n_OptimizeByFilestamp <> 0) + + If Adir( laDirInfo, Forceext( toFoxBin2Prg.c_Foxbin2prg_FullPath, 'ICO' ) ) > 0 Then + Thisform.Icon = Forceext( toFoxBin2Prg.c_Foxbin2prg_FullPath, 'ICO' ) + Endif + Endif + Endproc + + + Procedure QueryUnload + Thisform.n_ConversionType = 3 + Nodefault + Thisform.do_selection() + + Endproc + + Procedure do_selection + Thisform.Hide() + Clear Events + Endproc + + + Procedure cmd_Bin2Prg.Click +*-- Selección + Thisform.n_ConversionType = 1 + Thisform.do_selection() + Endproc + + + Procedure cmd_Prg2Bin.Click +*-- Selección + Thisform.n_ConversionType = 2 + Thisform.do_selection() + Endproc + + + Procedure cmd_None.Click +*-- Selección + Thisform.n_ConversionType = 3 + Thisform.do_selection() + Endproc + + +Enddefine + + + +Define Class frm_main As Form + AllowOutput = .F. + AlwaysOnTop = .T. + AutoCenter = .T. + BackColor = (Rgb(255,255,255)) + BorderStyle = 3 + Caption = "FoxBin2Prg " + Closable = .T. + ControlBox = .T. + DoCreate = .T. + Height = 800 + KeyPreview = .T. + MaxButton = .T. + MinButton = .F. + MinHeight = 800 + MinWidth = 1024 + Name = "FRM_MAIN" + ShowWindow = 2 + Width = 1024 + + Add Object 'edt_Help' As EditBox With ; + Anchor = 1+2+4+8, ; + BackStyle = 0, ; + BorderStyle = 0, ; + DisabledForeColor = (Rgb(0,0,0)), ; + Enabled = .T., ; + FontName = "Courier New", ; + FontSize = 9, ; + Height = 744, ; + Left = 12, ; + Name = "edt_Help", ; + ReadOnly = .T., ; + ScrollBars = 2, ; + Top = 12, ; + Width = 996 + + Add Object 'cmd_Close' As CommandButton With ; + Anchor = 4+8, ; + Cancel = .T., ; + Caption = "Close", ; + Height = 27, ; + Left = 924, ; + Name = "cmd_Close", ; + Top = 764, ; + Width = 84 + + Procedure Init + Lparameters toFoxBin2Prg + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Local laDirInfo(1,5), loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + If Vartype(toFoxBin2Prg) = "O" Then + If Vartype(_Screen.o_FoxBin2Prg_Lang) = "O" Then + loLang = _Screen.o_FoxBin2Prg_Lang + + If Pemstatus(_Screen, 'c_FB2PRG_EXE_Version', 5) Then + Thisform.Caption = 'FoxBin2Prg ' + _Screen.c_FB2PRG_EXE_Version + ' - ' + loLang.C_FOXBIN2PRG_SYNTAX_INFO_LOC + Endif + + Thisform.edt_help.Value = loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC+0h0D0A+; + STRTRAN(loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_cfg,'&'+'&','')+0h0D0A+; + STRTRAN(loLang.C_FOXBIN2PRG_SYNTAX_INFO_EXAMPLE_LOC_tab_cfg,'&'+'&','') + + Endif + + If Adir( laDirInfo, Forceext( toFoxBin2Prg.c_Foxbin2prg_FullPath, 'ICO' ) ) > 0 Then + Thisform.Icon = Forceext( toFoxBin2Prg.c_Foxbin2prg_FullPath, 'ICO' ) + Endif + Endif + + Endproc + + Procedure QueryUnload + Clear Events + Nodefault + + Endproc + + Procedure cmd_Close.Click + Thisform.Hide() + Clear Events + + Endproc + +Enddefine + + + +Define Class c_conversor_base As Custom + #If .F. + Local This As c_conversor_base Of 'FOXBIN2PRG.PRG' + #Endif + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + + + Dimension a_SpecialProps(1), a_SpecialProps_Chk(1), a_SpecialProps_Coll(1) ; + , a_SpecialProps_Cbo(1), a_SpecialProps_Cmg(1), a_SpecialProps_Cmd(1), a_SpecialProps_Cur(1) ; + , a_SpecialProps_CA(1), a_SpecialProps_DE(1), a_SpecialProps_Edt(1), a_SpecialProps_Frs(1) ; + , a_SpecialProps_Grd(1), a_SpecialProps_Grc(1), a_SpecialProps_Grh(1), a_SpecialProps_Hlk(1) ; + , a_SpecialProps_Img(1), a_SpecialProps_Lbl(1), a_SpecialProps_Lin(1), a_SpecialProps_Lst(1) ; + , a_SpecialProps_Ole(1), a_SpecialProps_Opg(1), a_SpecialProps_Opb(1), a_SpecialProps_Phk(1) ; + , a_SpecialProps_Rel(1), a_SpecialProps_Rls(1), a_SpecialProps_Sep(1), a_SpecialProps_Shp(1) ; + , a_SpecialProps_Spn(1), a_SpecialProps_Txt(1), a_SpecialProps_Tmr(1), a_SpecialProps_Tbr(1) ; + , a_SpecialProps_XMLAda(1), a_SpecialProps_XMLFld(1), a_SpecialProps_XMLTbl(1) + + n_Debug = 0 + l_Error = .F. + l_Test = .F. + c_InputFile = '' + c_OutputFile = '' + lFileMode = .F. + n_ClassTimeStamp = 0 + n_FB2PRG_Version = 1.0 + c_Foxbin2prg_FullPath = '' + c_Type = '' + c_CurDir = '' + c_LogFile = '' + c_TextLog = '' + c_TextErr = '' + l_MethodSort_Enabled = .T. + l_PropSort_Enabled = .T. + l_ReportSort_Enabled = .T. + c_OriginalFileName = '' + c_ClaseActual = '' + oFSO = Null + n_Methods_LineNo = 0 && Número de línea del error dentro de "Methods" +*** DH 2021-03-04: added cOutputFolder property + cOutputFolder = '' + + + + Procedure Init + Local lcSys16, lnPosProg + + Set Deleted On + Set Date YMD + Set Hours To 24 + Set Century On + Set Safety Off + Set Multilocks On + Set TablePrompt Off +*!* Changed by: LScheffler 21.02.2021 +*!* change date="{^2021-02-21,10:57:00}" +* Operation set to standard value +* anywhere else it will respect this to, +* so it's in the general settings or not + +* SET BLOCKSIZE TO 0 + +*!* /Changed by: LScheffler 21.02.2021 + + Set Exact On + If Not Empty( On("ESCAPE") ) Then + Set Escape On + Endif + + Public C_FB2PRG_CODE + C_FB2PRG_CODE = '' && Contendrá todo el código generado + This.c_CurDir = Sys(5) + Curdir() + This.oFSO = Createobject( "Scripting.FileSystemObject") + lcSys16 = Sys(16) + + If Left(lcSys16,10) == 'PROCEDURE ' + lnPosProg = At(" ", lcSys16, 2) + 1 + Else + lnPosProg = 1 + Endif + + This.c_Foxbin2prg_FullPath = Substr( lcSys16, lnPosProg ) + This.sortSpecialProps() + Release lcSys16, lnPosProg + Return + Endproc + + + + Procedure Destroy + Local loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + C_FB2PRG_CODE = '' + Use In (Select("TABLABIN")) + Use In (Select("foxbin2prg_keywords")) + +*-- Esta comprobación es por los TESTS, que a veces no cargan o_FoxBin2Prg_Lang + If Vartype(_Screen.o_FoxBin2Prg_Lang) = "O" Then + loLang = _Screen.o_FoxBin2Prg_Lang + This.writeLog( loLang.C_CONVERTER_UNLOAD_LOC ) + Endif + + This.oFSO = Null + Endproc + + + + Procedure analyzeAssignmentOf_TAG +*-- DETALLES: Este método está pensado para leer los tags FB2P_VALUE y MEMBERDATA, que tienen esta sintaxis: +* +* _memberdata = +* +* && XML Metadata for customizable properties +* +* Este es un valor especial +* +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcPropName (v! IN ) Nombre de la propiedad +* tcValue (v! IN ) Valor (o inicio del valor) de la propiedad +* taProps (!@ IN ) El array con las líneas del código donde buscar +* tnProp_Count (!@ IN ) Cantidad de líneas de código +* I (!@ IN ) Línea actualmente evaluada +* tcTAG_I (v! IN ) TAG de inicio +* tcTAG_F (v! IN ) TAG de fin +* tnLEN_TAG_I (v! IN ) Longitud del tag de inicio +* tnLEN_TAG_F (v! IN ) Longitud del tag de fin +*-------------------------------------------------------------------------------------------------------------- + Lparameters tcPropName, tcValue, taProps, tnProp_Count, I, tcTAG_I, tcTAG_F, tnLEN_TAG_I, tnLEN_TAG_F + + External Array taProps + + Local llBloqueEncontrado, loEx As Exception + + Try + If Left( tcValue, tnLEN_TAG_I) == tcTAG_I + llBloqueEncontrado = .T. + Local lcLine, lnArrayCols + + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + +*-- Propiedad especial + If tcTAG_F $ tcValue && El fin de tag está "inline" + .denormalizePropertyValue( @tcPropName, @tcValue, '' ) + Exit + Endif + + tcValue = '' + lnArrayCols = Alen(taProps,2) + + For I = m.I + 1 To tnProp_Count + If lnArrayCols = 0 + lcLine = Ltrim( taProps(m.I), 0, ' ', Chr(9) ) && Quito espacios y TABS de la izquierda + Else + lcLine = Ltrim( taProps(m.I,1), 0, ' ', Chr(9) ) && Quito espacios y TABS de la izquierda + Endif + + Do Case + Case Left( lcLine, tnLEN_TAG_F ) == tcTAG_F +*-- + tcValue = tcTAG_I + Substr( tcValue, 3 ) + tcTAG_F + .denormalizePropertyValue( @tcPropName, @tcValue, '' ) + I = m.I + 1 + Exit + + Case tcTAG_F $ lcLine +*-- Data-Data-Data- + tcValue = tcTAG_I + Substr( tcValue, 3 ) + Left( lcLine, At( tcTAG_F, lcLine )-1 ) + tcTAG_F + .denormalizePropertyValue( @tcPropName, @tcValue, '' ) + I = m.I + 1 + Exit + + Otherwise +*-- Data + tcValue = tcValue + CR_LF + lcLine + Endcase + Endfor + + Endwith && THIS + + I = m.I - 1 + + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcPropName, tcValue, taProps, tnProp_Count, I, tcTAG_I, tcTAG_F, tnLEN_TAG_I, tnLEN_TAG_F, loEx + Endtry + + Return llBloqueEncontrado + Endproc + + + Procedure updateProgressbar + Lparameters tcTexto, tnValor, tnTotal, tnTipo + Endproc + + + + Procedure findMethodsObjectByName + Lparameters tcNombreObjeto, toClase +*-- Caso 1: Un método de un objeto de la clase +*-- findMethodsObjectByName( 'command1', loClase ) +*-- Caso 2: Un método de un objeto heredado que no está definido en esta librería +*-- findMethodsObjectByName( 'cnt_descripcion.Cntlista.cmgAceptarCancelar.cmdCancelar', loClase ) + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnObjeto, I, X, N, lcRutaDelNombre ; + , loObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + Store 0 To N, lnObjeto + +*-- El método puede pertenecer a esta clase, a un objeto de esta clase, +*-- o a un objeto heredado que no está definido en esta clase, sino en otra, +*-- y para la cual la ruta a buscar es parcial. +*-- Por ejemplo, el caso 2 puede que el objeto que hay sea 'cnt_descripcion.Cntlista' +*-- y el botón sea heredado, pero se le haya redefinido su método Click aquí. + For X = Occurs( '.', tcNombreObjeto + '.' ) To 1 Step -1 + N = N + 1 + lcRutaDelNombre = Left( tcNombreObjeto, Rat( '.', tcNombreObjeto + '.', N ) - 1 ) + For I = 1 To toClase._AddObject_Count + loObjeto = toClase._AddObjects(m.I) + +*-- Busco tanto el [nombre] del método como [class.nombre]+[nombre] del método + If Lower(loObjeto._Nombre) == Lower(toClase._ObjName) + '.' + lcRutaDelNombre ; + OR Lower(loObjeto._Nombre) == lcRutaDelNombre + lnObjeto = m.I + Exit + Endif + + loObjeto = Null + Endfor + If lnObjeto > 0 + Exit + Endif + Endfor + + Catch To loEx + lnCodError = loEx.ErrorNo + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcNombreObjeto, toClase, I, X, N, lcRutaDelNombre, loObjeto + Endtry + + Return lnObjeto + Endproc + + + + Function verifyValidExpression + Lparameters tcAsignacion, tnCodError, tcExpNormalizada + Local llError, loEx As Exception + + Try + tcExpNormalizada = Normalize( tcAsignacion ) + + Catch To loEx + llError = .T. + tnCodError = loEx.ErrorNo + + Finally + Release tcAsignacion, tnCodError, tcExpNormalizada, loEx + Endtry + + Return Not llError + Endfunc + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (!@ OUT) Objeto generado de clase correspondiente con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (!@ IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toModulo, toEx As Exception, toFoxBin2Prg + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + Local loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang +*THIS.writeLog( '' ) + This.writeLog( C_TAB + loLang.C_CONVERTING_FILE_LOC + ' ' + This.c_OutputFile + '...' ) + Release toModulo, toEx, toFoxBin2Prg, loLang + Return + Endproc + + + Procedure currentLineIsPreviousLineContinuation + Lparameters taCodeLines, I + + Local lcPrevLine, llIsContinuation + +*-- Analizo la línea anterior para saber si termina con ";" o "," y la actual es continuación + If m.I > 1 + lcPrevLine = taCodeLines(m.I-1) + Else + lcPrevLine = '' + Endif + + This.get_SeparatedLineAndComment( @lcPrevLine ) + + If Inlist( Right( lcPrevLine,1 ), ';', ',' ) && Esta línea es continuación de la anterior + llIsContinuation = .T. + Endif + + Release taCodeLines, I, lcPrevLine + + Return llIsContinuation + Endproc + + + Procedure isIndicatedToken + Lparameters tcLine, ta_ID_Bloques, tnLen_IDFinBQ, X, tnIniFin + Local llEncontrado, lcWord, lcWord2, lcLine, lnWordCount + + Try +*-- Pre-normalización + lcLine = tcLine + + If tnIniFin = 1 +*-- TOKENS DE INICIO + If Upper( Left( lcLine, ta_ID_Bloques(m.X,3) ) ) == ta_ID_Bloques(m.X,1) +*-- Evaluar casos especiales + lcWord = Upper( Alltrim(Getwordnum(lcLine,1) ) ) + + If ta_ID_Bloques(m.X,1) == 'TEXT' Then + lcLine = Upper( lcLine ) + ' ' + lnWordCount = Getwordcount(lcLine) + + If lnWordCount >= 2 + lcWord2 = Alltrim(Getwordnum(lcLine,2) ) + Endif + + Do Case + Case Not lcWord == 'TEXT' + Exit + +*CASE UPPER( LEFT( CHRTRAN( lcLine, ' ', '' ), 5 ) ) == 'TEXT=' +* EXIT + Case lnWordCount >= 2 + If lcWord2 == "TO" +* OK, es TEXT TO... + Else +* Luego de TEXT sigue cualquier otra cosa, así que puede ser +* un campo, variable, etc, que lo han llamado TEXT. + Exit + Endif + + Otherwise +* OK, es TEXT sin más. + Endcase + Endif + + llEncontrado = .T. + Endif + Else +*-- TOKENS DE FIN + If Upper( Left( lcLine, ta_ID_Bloques(m.X,4) ) ) == ta_ID_Bloques(m.X,2) && Fin de bloque encontrado (#ENDI, ENDTEXT, etc) +*-- Evaluar casos especiales + lcWord = Upper( Alltrim(Getwordnum(lcLine,1) ) ) + + If ta_ID_Bloques(m.X,2) == 'ENDT' And Not lcWord == Left( 'ENDTEXT', Len(lcWord) ) + Exit + Endif + + llEncontrado = .T. + Endif + Endif + + Finally + Release tcLine, ta_ID_Bloques, tnLen_IDFinBQ, X, tnIniFin, lcLine + Endtry + + Return llEncontrado + Endproc + + + Procedure decode_SpecialCodes_1_31 +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcText (!@ IN ) Decodifica los primeros 31 caracteres ASCII de {nCode} a CHR(nCode) +*--------------------------------------------------------------------------------------------------- + Lparameters tcText + Local I + For I = 0 To 31 + tcText = Strtran( tcText, '{' + Transform(m.I) + '}', Chr(m.I) ) + Endfor + Release I + Return tcText + Endproc + + + + Procedure decode_SpecialCodes_CR_LF +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcText (!@ IN ) Decodifica los caracteres ASCII 10 y 13 de {nCode} a CHR(nCode) +*--------------------------------------------------------------------------------------------------- + Lparameters tcText + tcText = Strtran( Strtran( tcText, '{10}', Chr(10) ), '{13}', Chr(13) ) + Return tcText + Endproc + + + + Procedure denormalizeAssignment + Lparameters tcAsignacion + Local lcPropName, lcValor, lnCodError, lcExpNormalizada, lnPos, lcComentario + + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + .get_SeparatedPropAndValue( @tcAsignacion, @lcPropName, @lcValor ) + lcComentario = '' + .denormalizePropertyValue( @lcPropName, @lcValor, @lcComentario ) + tcAsignacion = lcPropName + ' = ' + lcValor + Endwith + + Release lcPropName, lcValor, lnCodError, lcExpNormalizada, lnPos, lcComentario + Return tcAsignacion + Endproc + + + + Procedure denormalizePropertyValue +*-- Este método se ejecuta cuando se regenera el binario desde el tx2 + Lparameters tcProp, tcValue, tcComentario + Local lnCodError, lnPos, lcValue + tcComentario = '' + +*-- Ajustes de algunos casos especiales + Do Case + Case tcProp == '_memberdata' +*-- Me quedo con lo importante y quito los CHR(0) y longitud que a veces agrega al inicio + lcValue = '' + + For I = 1 To Occurs( '/>', tcValue ) +* issue#16: memberdata property should be saved in compressed format + lcValue = lcValue + Chrtran( Strextract( tcValue, '', m.I, 1+4 ), CR_LF, ' ' ) + Endfor + +* issue#16: memberdata property should be saved in compressed format + TEXT TO tcValue TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + <> + ENDTEXT + + If Len(lcValue) > 255 + tcValue = C_MPROPHEADER + Str( Len(tcValue), 8 ) + tcValue + Else + tcValue = Chrtran( tcValue, CR_LF, '' ) + Endif + + Case Left( tcValue, C_LEN_FB2P_VALUE_I ) == C_FB2P_VALUE_I +*-- Valor especial Fox con cabecera CHR(1): Debo agregarla y desnormalizar el valor + tcValue = Strtran( Strtran( Strextract( tcValue, C_FB2P_VALUE_I, C_FB2P_VALUE_F, 1, 1 ), ' ', C_CR ), ' ', C_LF ) + tcValue = C_MPROPHEADER + Str( Len(tcValue), 8 ) + tcValue + + Endcase + + Release tcProp, tcComentario, lnCodError, lnPos, lcValue + Return tcValue + Endproc + + + + Procedure denormalizeXMLValue + Lparameters tcValor +*-- DESNORMALIZA EL TEXTO INDICADO, EXPANDIENDO LOS SÍMBOLOS XML ESPECIALES. + Local lnPos, lnPos2, lnAscii + tcValor = Strtran(tcValor, Chr(38)+'gt;', '>') && > + tcValor = Strtran(tcValor, Chr(38)+'lt;', '<') && < + tcValor = Strtran(tcValor, Chr(38)+'quot;', Chr(34)) && " + tcValor = Strtran(tcValor, Chr(38)+'apos;', Chr(39)) && ' + tcValor = Strtran(tcValor, Chr(38)+'amp;', Chr(38)) && & + +*-- Obtengo los Hex + Do While .T. + lnPos = At( Chr(38)+'#x', tcValor ) + If lnPos = 0 + Exit + Endif + lnPos2 = lnPos + 1 + At( ';', Substr( tcValor, lnPos + 2, 4 ) ) + lnAscii = Evaluate( '0' + Substr( tcValor, lnPos + 3, lnPos2 - lnPos - 3 ) ) + tcValor = Stuff(tcValor, lnPos, lnPos2 - lnPos + 1, Chr(lnAscii)) && ASCII + Enddo + +*-- Obtengo los Dec + Do While .T. + lnPos = At( Chr(38)+'#', tcValor ) + If lnPos = 0 + Exit + Endif + lnPos2 = lnPos + 1 + At( ';', Substr( tcValor, lnPos + 2, 4 ) ) + lnAscii = Evaluate( Substr( tcValor, lnPos + 2, lnPos2 - lnPos - 2 ) ) + tcValor = Stuff(tcValor, lnPos, lnPos2 - lnPos + 1, Chr(lnAscii)) && ASCII + Enddo + + Release lnPos, lnPos2, lnAscii + Return tcValor + Endproc + + + + Procedure encode_SpecialCodes_1_31 +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcText (!@ IN ) Decodifica los primeros 31 caracteres ASCII de CHR(nCode) a {nCode} +*--------------------------------------------------------------------------------------------------- + Lparameters tcText + Local I + For I = 0 To 31 + tcText = Strtran( tcText, Chr(m.I), '{' + Transform(m.I) + '}' ) + Endfor + Release I + Return tcText + Endproc + + + + Procedure encode_SpecialCodes_CR_LF +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcText (!@ IN ) Codifica los caracteres ASCII 10 y 13 de CHR(nCode) a {nCode} +*--------------------------------------------------------------------------------------------------- + Lparameters tcText + tcText = Strtran( Strtran( tcText, Chr(10), '{10}' ), Chr(13), '{13}' ) + Return tcText + Endproc + + + + Hidden Procedure exception2Str + Lparameters toEx As Exception + Local lcError + lcError = 'Error ' + Transform(toEx.ErrorNo) + ', ' + toEx.Message + Chr(13) + Chr(13) ; + + toEx.Procedure + ', ' + Transform(toEx.Lineno) + Chr(13) + Chr(13) ; + + toEx.LineContents + Release toEx + Return lcError + Endproc + + + + Procedure fileTypeCode + Lparameters tcExtension, tcOriginalType + tcExtension = Upper(tcExtension) + Return Icase( tcExtension = 'DBC', 'd' ; + , tcExtension = 'DBF', Evl(tcOriginalType, 'D') ; + , tcExtension = 'QPR', 'Q' ; + , tcExtension = 'SCX', 'K' ; + , tcExtension = 'FRX', 'R' ; + , tcExtension = 'LBX', 'B' ; + , tcExtension = 'VCX', 'V' ; + , tcExtension = 'PRG', 'P' ; + , tcExtension = 'FLL', 'L' ; + , tcExtension = 'APP', 'Z' ; + , tcExtension = 'EXE', 'Z' ; + , tcExtension = 'MNX', 'M' ; + , tcExtension = 'TXT', 'T' ; + , tcExtension = 'FPW', 'T' ; + , tcExtension = 'H', 'T' ; + , tcExtension = 'SPR', 'E' ; + , tcExtension = 'MPR', 'P' ; + , Evl(tcOriginalType, 'x') ) + Endproc + + + Function getTimeStamp +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tnTimeStamp (v! IN ) Timestamp en formato numérico +*--------------------------------------------------------------------------------------------------- + Lparameters tnTimeStamp +*-- CONVIERTE UN DATO TIMESTAMP NUMERICO USADO POR LOS ARCHIVOS SCX/VCX/etc. EN TIPO DATETIME + Try + Local lcTimeStamp,lnYear,lnMonth,lnDay,lnHour,lnMinutes,lnSeconds,lcTime,lnHour,ltTimeStamp,lnResto ; + ,lcTimeStamp_Ret, laDirInfo[1,5], loEx As Exception + + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + lcTimeStamp_Ret = '' + + If Empty(tnTimeStamp) + If .lFileMode + If Adir(laDirInfo,.c_InputFile)=0 + Exit + Endif + + ltTimeStamp = Evaluate( '{^' + Dtoc(laDirInfo(1,3)) + ' ' + Transform(laDirInfo(1,4)) + '}' ) + +*-- En mi arreglo, si la hora pasada tiene 32 segundos o más, redondeo al siguiente minuto, ya que +*-- la descodificación posterior de getTimeStamp tiene ese margen de error. + If Sec(m.ltTimeStamp) >= 32 + ltTimeStamp = m.ltTimeStamp + 28 + Endif + + lcTimeStamp_Ret = Ttoc( ltTimeStamp ) + Exit + Endif + + tnTimeStamp = .n_ClassTimeStamp + + If Empty(tnTimeStamp) + Exit + Endif + Endif + +*-- YYYY YYYM MMMD DDDD HHHH HMMM MMMS SSSS + lnResto = tnTimeStamp + lnYear = Int( lnResto / 2**25 + 1980) + lnResto = lnResto % 2**25 + lnMonth = Int( lnResto / 2**21 ) + lnResto = lnResto % 2**21 + lnDay = Int( lnResto / 2**16 ) + lnResto = lnResto % 2**16 + lnHour = Int( lnResto / 2**11 ) + lnResto = lnResto % 2**11 + lnMinutes = Int( lnResto / 2**5 ) + lnResto = lnResto % 2**5 + lnSeconds = lnResto + + lcTimeStamp = Padl(lnYear,4,'0') + "/" + Padl(lnMonth,2,'0') + "/" + Padl(lnDay,2,'0') + " " ; + + Padl(lnHour,2,'0') + ":" + Padl(lnMinutes,2,'0') + ":" + Padl(lnSeconds,2,'0') + + ltTimeStamp = Evaluate( "{^" + lcTimeStamp + "}" ) + + lcTimeStamp_Ret = Ttoc( ltTimeStamp ) + Endwith + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Endtry + + Return lcTimeStamp_Ret + Endfunc + + + Procedure get_ListNamesWithValuesFrom_InLine_MetadataTag +*-- OBTENGO EL ARRAY DE DATOS Y VALORES DE LA LINEA DE METADATOS INDICADA +*-- NOTA: Los valores NO PUEDEN contener comillas dobles en su valor, ya que generaría un error al parsearlos. +*-- Ejemplo: +*< FileMetadata: Type="V" Cpid="1252" Timestamp="1131901580" ID="1129207528" ObjRev="544" /> +*< OLE: Nombre="frm_form.Pageframe1.Page1.Cnt_controles_h.Olecontrol1" Parent="frm_form.Pageframe1.Page1.Cnt_controles_h" ObjName="Olecontrol1" Checksum="1685567300" Value="0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPg...ADAP7AAAA==" /> +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcLineWithMetadata (!@ IN ) Línea con metadatos y un tag de metadatos +* taPropsAndValues (!@ OUT) Array a devolver con las propiedades y valores encontrados +* tnPropsAndValues_Count (!@ OUT) Cantidad de propiedades encontradas +* tcLeftTag (v! IN ) TAG de inicio de los metadatos +* tcRightTag (v! IN ) TAG de fin de los metadatos +*-------------------------------------------------------------------------------------------------------------- + Lparameters tcLineWithMetadata, taPropsAndValues, tnPropsAndValues_Count, tcLeftTag, tcRightTag + + External Array taPropsAndValues + + Local lcMetadatos, I, lcVirtualMeta, lnPos1, lnPos2, lnLastPos, lnCantComillas ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , loEx As Exception + + Try + loLang = _Screen.o_FoxBin2Prg_Lang + Store '' To lcVirtualMeta + Store 0 To lnPos1, lnPos2, lnLastPos, tnPropsAndValues_Count, I + + lcMetadatos = Alltrim( Strextract( tcLineWithMetadata, tcLeftTag, tcRightTag, 1, 1) ) + + If Empty(lcMetadatos) +* Puede que la línea esté separada con un CR erróneo. El usuario debe revisarlo + Error (Textmerge("Can't identify Metadata TAG '<>'. May be the Source line have an extra CR/LF?")) + Endif + + lnCantComillas = Occurs( '"', lcMetadatos ) + + If lnCantComillas % 2 <> 0 && Valido que las comillas "" sean pares +*ERROR "Error de datos: No se puede parsear porque las comillas no son pares en la línea [" + lcMetadatos + "]" + Error (Textmerge(loLang.C_DATA_ERROR_CANT_PARSE_UNPAIRING_DOUBLE_QUOTES_LOC)) + Endif + + lnLastPos = 1 + Dimension taPropsAndValues( lnCantComillas / 2, 2 ) + +*------------------------------------------------------------------------------------- +* IMPORTANTE!! +* ------------ +* SI SE SEPARAN LAS IGUALDADES CON ESPACIOS, ÉSTAS DEJAN DE RECONOCERSE!! (prop = "valor" en vez de prop="valor") +* TENER EN CUENTA AL GENERAR EL TEXTO O AL MODIFICARLO MANUALMENTE AL MERGEAR +*------------------------------------------------------------------------------------- + For I = 1 To lnCantComillas Step 2 + tnPropsAndValues_Count = tnPropsAndValues_Count + 1 + +* Type="V" Cpid="1252" +* ^ ^ => Posiciones del par de comillas dobles + lnPos1 = At( '"', lcMetadatos, m.I ) + lnPos2 = At( '"', lcMetadatos, m.I + 1 ) + +* Type="V" Cpid="1252" +* ^ ^ ^ => LastPos, lnPos1 y lnPos2 + taPropsAndValues(tnPropsAndValues_Count,1) = Alltrim( Getwordnum( Substr( lcMetadatos, lnLastPos, lnPos1 - lnLastPos ), 1, '=' ) ) + taPropsAndValues(tnPropsAndValues_Count,2) = Substr( lcMetadatos, lnPos1 + 1, lnPos2 - lnPos1 - 1 ) + + lnLastPos = lnPos2 + 1 + Endfor + + Catch To loEx + loEx.UserValue = loEx.UserValue + Textmerge('I=<>, lcMetadatos="<>", tcLineWithMetadata="<>"') + CR_LF + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcLineWithMetadata, taPropsAndValues, tnPropsAndValues_Count, tcLeftTag, tcRightTag ; + , lcMetadatos, I, lcVirtualMeta, lnPos1, lnPos2, lnLastPos, lnCantComillas + + Endtry + + Return + Endproc + + + Procedure get_SeparatedLineAndComment +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcLine (!@ IN/OUT) Línea a separar del comentario +* tcComment (@? OUT) Comentario +* tlDeepCommentAnalysis (v? IN ) Indica realizar un análisis profundo de comentarios (para detectar casos complejos de código con '&&' embebido) +*--------------------------------------------------------------------------------------------------- + Lparameters tcLine As String, tcComment As String, tlDeepCommentAnalysis As Boolean + Local ln_AT_Cmt + tcComment = '' + ln_AT_Cmt = At( '&'+'&', tcLine) + + If ln_AT_Cmt > 0 + If tlDeepCommentAnalysis Then + Local laSeparador(3,3), lcSeparadoresIzq, lcSeparadoresDer, lcStr, lnAT_Amp, lnAT1, lnAT2, lnLen, I, X + + lcStr = tcLine &&EVL(tcStr, [DEFINE BAR 2 OF OpciónAsub PROMPT "Opción A&]+[&2" &]+[& Comentario Opción A-2]) + laSeparador(1,1) = '"' + laSeparador(1,2) = '"' + laSeparador(1,3) = 2 + laSeparador(2,1) = "'" + laSeparador(2,2) = "'" + laSeparador(2,3) = 2 + laSeparador(3,1) = '[' + laSeparador(3,2) = ']' + laSeparador(3,3) = 1 + lcSeparadoresIzq = laSeparador(1,1) + laSeparador(2,1) + laSeparador(3,1) + lcSeparadoresDer = laSeparador(1,2) + laSeparador(2,2) + laSeparador(3,2) + lnLen = Len(lcStr) + +*-- Anular subcadenas para luego encontrar comentarios '&&' (y analizar solo si existe al menos un '&&') + X = 1 + lnAT1 = At(laSeparador(m.X,1), lcStr) + +*-- Funcionamiento: +*-- La anulación de subcadenas se hace comenzando desde la primer comilla doble ["], y luego se va +*-- cancelando hasta la siguiente. A partir de ahi, se busca carácter a carácter el siguiente separador +*-- izquierdo de cadena ( '"[ ), se busca su pareja derecha y se cancela el texto entre ambos. +*-- La anulación de subcadenas es temporal, solo para determinar la verdadera posición del comentario, +*-- por ejemplo, esto: +*-- DEFINE BAR 2 OF OpciónAsub PROMPT ""+var+'aa'+["bb]+"Opción A&&2" && Comentario Opción A-2 +*-- se convierte temporalmente en esto: +*-- DEFINE BAR 2 OF OpciónAsub PROMPT XX+var+XXXX+XXXXX+XXXXXXXXXXXXX && Comentario Opción A-2 +*-- lo que facilita encontrar el comentario '&&' real. +*-- Si se encuentra algún separador de cadena que no cierre, se genera un error 10 (Syntax Error). + If lnAT1 > 0 Then + For I = lnAT1+1 To lnLen + If m.X > 0 Then + lnAT2 = At(laSeparador(m.X,2), lcStr, laSeparador(m.X,3)) + + If lnAT2 > 0 Then + lcStr = Stuff(lcStr, lnAT1, lnAT2-lnAT1+1, Replicate('X',lnAT2-lnAT1+1)) + Else + ln_AT_Cmt = At( '&'+'&', lcStr) + + If ln_AT_Cmt = 0 Or ln_AT_Cmt < lnAT1 +*-- No tiene comentario '&&' real, o sí lo tiene y además contiene un delimitador de cadena como parte del comentario + Exit + Else + Error 'Closing string delimiter <' + laSeparador(m.X,2) + '> not found: ' + tcLine + Endif + Endif + Endif + +*-- Verifico si el carácter es un separador de cadenas: '"[ + X = At( Substr(lcStr, m.I, 1), lcSeparadoresIzq) + + If m.X > 0 Then + lnAT1 = At(laSeparador(m.X,1), lcStr) + Endif + Endfor + Endif + + ln_AT_Cmt = At( '&'+'&', lcStr) + Endif && tlDeepCommentAnalysis + + If ln_AT_Cmt > 0 + tcComment = Ltrim( Substr( tcLine, ln_AT_Cmt + 2 ) ) + tcLine = Rtrim( Left( tcLine, ln_AT_Cmt - 1 ), 0, Chr(9), ' ' ) && Quito TABS y espacios + Endif + + Endif + + Return (ln_AT_Cmt > 0) + Endproc + + + Procedure get_SeparatedPropAndValue +*-- Devuelve el valor separado de la propiedad. +*-- Si se indican más de 3 parámetros, evalúa el valor completo a través de las líneas de código (valores multi-línea) +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcAsignacion (v! IN ) Asignación completa con variable, igualdad y valor +* tcPropName (@! OUT) Nombre de la variable +* tcValue (@? OUT) Valor +* toClase (v! IN ) +* taCodeLines (@! IN ) Líneas de código a analizar +* tnCodeLines (v! IN ) Cantidad de líneas de código +* I (@! IN/OUT) Línea actual +*-------------------------------------------------------------------------------------------------------------- + Lparameters tcAsignacion, tcPropName, tcValue, toClase, taCodeLines, tnCodeLines, I + Local ln_AT_Cmt + Store '' To tcPropName, tcValue + +*-- EVALUAR UNA ASIGNACIÓN ESPECÍFICA INLINE + If '=' $ tcAsignacion + ln_AT_Cmt = At( '=', tcAsignacion) + tcPropName = Alltrim( Left( tcAsignacion, ln_AT_Cmt - 2 ), 0, ' ', Chr(9) ) && Quito espacios y TABS +*!* Changed by: LScheffler 16.3.2023 +*!* +*!* Changed by: LScheffler
+*!* Problems with property values with leading and trailing spaces +*!* and with double ampersand in value +*!* we just do not LTRIM so we keep the leading space here +*!* and we start after the space after the equal sign.
+*!* see issues #90, #91 +*!*
+*!*
+ +* tcValue = Ltrim( Substr( tcAsignacion, ln_AT_Cmt + 2 ) ) + tcValue = Substr( tcAsignacion, ln_AT_Cmt + 2 ) + +*!* /Changed by: LScheffler 16.3.2023 + + If Pcount() > 3 +*-- EVALUAR UNA ASIGNACIÓN QUE PUEDE SER MULTILÍNEA (memberdata, fb2p_value, etc) + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + Do Case + Case .analyzeAssignmentOf_TAG( @tcPropName, @tcValue, @taCodeLines, tnCodeLines, @m.I ; + , C_FB2P_VALUE_I, C_FB2P_VALUE_F, C_LEN_FB2P_VALUE_I, C_LEN_FB2P_VALUE_F ) +*-- FB2P_VALUE + + Case .analyzeAssignmentOf_TAG( @tcPropName, @tcValue, @taCodeLines, tnCodeLines, @m.I ; + , C_MEMBERDATA_I, C_MEMBERDATA_F, C_LEN_MEMBERDATA_I, C_LEN_MEMBERDATA_F ) +*-- MEMBERDATA + + Otherwise +*-- Propiedad normal + .denormalizePropertyValue( @tcPropName, @tcValue, '' ) + + Endcase + Endwith && THIS + Endif + Endif + + Release tcAsignacion, tcPropName, tcValue, toClase, taCodeLines, tnCodeLines, I, ln_AT_Cmt + Return + Endproc + + + Procedure get_ValueFromNullTerminatedValue + Lparameters tcNullTerminatedValue + Local lcValue, lnNullPos + lnNullPos = At(Chr(0), tcNullTerminatedValue ) + If lnNullPos = 0 + lcValue = Chrtran( tcNullTerminatedValue, ['], ["] ) + Else + lcValue = Chrtran( Left( tcNullTerminatedValue, lnNullPos - 1 ), ['], ["] ) + Endif + lcValue = This.encode_SpecialCodes_CR_LF(lcValue) + Release tcNullTerminatedValue, lnNullPos + Return lcValue + Endproc + + + + Procedure identifyCodeBlocks + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toModulo + Endproc + + + Procedure identifyExclusionBlocks + Lparameters taCodeLines, tnCodeLines, ta_ID_Bloques, taLineasExclusion, tnBloquesExclusion, taBloquesExclusion +* LOS BLOQUES DE EXCLUSIÓN SON AQUELLOS QUE TIENEN TEXT/ENDTEXT OF #IF/#ENDIF Y SE USAN PARA NO BUSCAR +* INSTRUCCIONES COMO "DEFINE CLASS" O "PROCEDURE" EN LOS MISMOS. +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (!@ IN ) El array con las líneas del código de texto donde buscar +* tnCodeLines (@? IN ) Cantidad de líneas de código +* ta_ID_Bloques (@? IN ) Array de pares de identificadores (2 cols). Ej: '#IF .F.','#ENDI' ; 'TEXT','ENDTEXT' ; etc +* taLineasExclusion (@? OUT) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@? OUT) Cantidad de bloques de exclusión +*-------------------------------------------------------------------------------------------------------------- + External Array ta_ID_Bloques, taLineasExclusion + + Try + Local lnBloques, I, X, lnPrimerID, lnLen_IDFinBQ, lnID_Bloques_Count, lcWord, lnAnidamientos, lcLine, lcPrevLine ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + Dimension taLineasExclusion(tnCodeLines), taBloquesExclusion(1,2) + Store 0 To tnBloquesExclusion, lnPrimerID, I, X + + If tnCodeLines > 1 + If Empty(ta_ID_Bloques) + Dimension ta_ID_Bloques(2,4) + ta_ID_Bloques(1,1) = '#IF' + ta_ID_Bloques(1,2) = '#ENDI' + ta_ID_Bloques(1,3) = Len( ta_ID_Bloques(1,1) ) + ta_ID_Bloques(1,4) = Len( ta_ID_Bloques(1,2) ) + ta_ID_Bloques(2,1) = 'TEXT' + ta_ID_Bloques(2,2) = 'ENDT' + ta_ID_Bloques(2,3) = Len( ta_ID_Bloques(2,1) ) + ta_ID_Bloques(2,4) = Len( ta_ID_Bloques(2,2) ) + lnID_Bloques_Count = Alen( ta_ID_Bloques, 1 ) + Endif + +*-- Búsqueda del ID de inicio de bloque + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + For I = 1 To tnCodeLines +* Reduzco los espacios. Ej: '#IF .F. && cmt' ==> '#IF .F.&&cmt' +*lcLine = LTRIM( STRTRAN( STRTRAN( CHRTRAN( taCodeLines(m.I), CHR(9), ' ' ), ' ', ' ' ), ' ', ' ' ) ) + lcLine = Ltrim( taCodeLines(m.I), 0, Chr(9), ' ' ) + + If .lineIsOnlyCommentAndNoMetadata( @lcLine ) +*-- Optimización: Excluyo las líneas que solo son comentarios + taLineasExclusion(m.I) = .T. +*-- + Loop + Endif + + lcLine = Upper( Left( lcLine,1 ) ) + Upper( Ltrim( Substr( lcLine, 2 ) ) ) + lnPrimerID = 0 + + For X = 1 To lnID_Bloques_Count + lnLen_IDFinBQ = Len( ta_ID_Bloques(m.X,2) ) + If .isIndicatedToken( @lcLine, @ta_ID_Bloques, lnLen_IDFinBQ, m.X, 1 ) ; + AND Not .currentLineIsPreviousLineContinuation( @taCodeLines, m.I ) + lnPrimerID = m.X + lnAnidamientos = 1 + Exit + Endif + Endfor + + If lnPrimerID > 0 && Se ha identificado un ID de bloque excluyente + tnBloquesExclusion = tnBloquesExclusion + 1 + Dimension taBloquesExclusion(tnBloquesExclusion,2) + taBloquesExclusion(tnBloquesExclusion,1) = m.I + taLineasExclusion(m.I) = .T. + +* Búsqueda del ID de fin de bloque + For I = m.I + 1 To tnCodeLines +* Reduzco los espacios. Ej: '#IF .F. && cmt' ==> '#IF .F.&&cmt' +*lcLine = LTRIM( STRTRAN( STRTRAN( CHRTRAN( taCodeLines(m.I), CHR(9), ' ' ), ' ', ' ' ), ' ', ' ' ) ) +*lcLine = LTRIM( CHRTRAN( taCodeLines(m.I), CHR(9), ' ' ) ) + lcLine = Ltrim( taCodeLines(m.I), 0, Chr(9), ' ' ) + taLineasExclusion(m.I) = .T. + + If .lineIsOnlyCommentAndNoMetadata( @lcLine ) + Loop + Endif + + lcLine = Upper( Left( lcLine,1 ) ) + Upper( Ltrim( Substr( lcLine, 2 ) ) ) + + Do Case + Case lnPrimerID = 1 And .isIndicatedToken( @lcLine, @ta_ID_Bloques, 0, m.X, 1 ) ; + AND Not .currentLineIsPreviousLineContinuation( @taCodeLines, m.I ) +*-- Busca el primer marcador (#IF) NOTA: No busco [TEXT] porque no se pueden anidar. + lnAnidamientos = lnAnidamientos + 1 + + Case .isIndicatedToken( @lcLine, @ta_ID_Bloques, 0, m.X, 2 ) +*-- Busca el segundo marcador (#ENDIF o ENDTEXT) + lnAnidamientos = lnAnidamientos - 1 + + If lnAnidamientos = 0 + taBloquesExclusion(tnBloquesExclusion,2) = m.I + Exit + Endif + Endcase + Endfor + +*-- Validación + If Empty(taBloquesExclusion(tnBloquesExclusion,2)) +*ERROR 'No se ha encontrado el marcador de fin [' + ta_ID_Bloques(lnPrimerID,2) ; ++ '] que cierra al marcador de inicio [' + ta_ID_Bloques(lnPrimerID,1) ; ++ '] de la línea ' + TRANSFORM(taBloquesExclusion(tnBloquesExclusion,1)) + .n_Methods_LineNo = taBloquesExclusion(tnBloquesExclusion,1) + Error (Textmerge(loLang.C_END_MARKER_NOT_FOUND_LOC)) + Endif + Endif + Endfor + Endwith && THIS + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release taCodeLines, tnCodeLines, ta_ID_Bloques, taLineasExclusion, tnBloquesExclusion, taBloquesExclusion, loLang ; + , lnBloques, I, X, lnPrimerID, lnID_Bloques_Count, lcWord, lnAnidamientos, lcLine, lcPrevLine + Endtry + + Return + Endproc + + + + Procedure excludedLine + Lparameters tn_Linea, tnBloquesExclusion, taLineasExclusion + + Return taLineasExclusion(tn_Linea) + Endproc + + + + Procedure lineIsOnlyCommentAndNoMetadata +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcLine (!@ IN/OUT) Línea a separar del comentario +* tcComment (@? OUT) Comentario +* tlDoNotSeparateLineAndComment (v? IN ) Indica o separar la línea de código del comentario +* tlDeepCommentAnalysis (v? IN ) Indica realizar un análisis profundo de comentarios (para detectar casos complejos de código con '&&' embebido) +*--------------------------------------------------------------------------------------------------- +* NOTA: Recordar que esta función suele usarse junto a Set_Line(), que quita TABS y espacios a la izquierda. +*--------------------------------------------------------------------------------------------------- + Lparameters tcLine As String, tcComment As String, tlDoNotSeparateLineAndComment As Boolean, tlDeepCommentAnalysis As Boolean + Local lllineIsOnlyCommentAndNoMetadata, ln_AT_Cmt + + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + If tlDoNotSeparateLineAndComment + tcComment = '' + Else + .get_SeparatedLineAndComment( @tcLine, @tcComment, tlDeepCommentAnalysis ) + Endif + + Do Case + Case Left(tcLine,2) == '*<' + tcComment = tcLine + + Case Empty(tcLine) Or Left(tcLine, 1) == '*' ; + OR Upper(Left(tcLine + ' ', 5)) == 'NOTE ' ; && Vacía o Comentarios + And Not Upper(Left(tcLine + ' ', 6)) == 'NOTE =' && Excluir asignaciones +* + lllineIsOnlyCommentAndNoMetadata = .T. + + Endcase + Endwith + + Release tcLine, tcComment, ln_AT_Cmt + Return lllineIsOnlyCommentAndNoMetadata + Endproc + + + + Procedure loadModule +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (!@ OUT) Objeto generado de clase correspondiente con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (!@ IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toModulo, toEx As Exception, toFoxBin2Prg + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif +*LOCAL loLang as CL_LANG OF 'FOXBIN2PRG.PRG' +*loLang = _SCREEN.o_FoxBin2Prg_Lang +*THIS.writeLog( C_TAB + loLang.C_CONVERTING_FILE_LOC + ' ' + THIS.c_OutputFile + '...' ) +*RELEASE loLang + Return + Endproc + + + + Procedure normalizeAssignment + Lparameters tcAsignacion, tcComentario + Local lcPropName, lcValor, lnCodError, lcExpNormalizada, lnPos + + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + .get_SeparatedPropAndValue( @tcAsignacion, @lcPropName, @lcValor ) + tcComentario = '' + .normalizePropertyValue( @lcPropName, @lcValor, @tcComentario ) + tcAsignacion = lcPropName + ' = ' + lcValor + Endwith + + Release tcComentario, lcPropName, lcValor, lnCodError, lcExpNormalizada, lnPos + Return tcAsignacion + Endproc + + + + Procedure normalizePropertyValue +*-- Este método se ejecuta cuando se genera el tx2 desde el binario + Lparameters tcProp, tcValue, tcComentario + Local lcValue, I + tcComentario = '' + +*-- Limpieza de caracteres sin uso +*IF INLIST(tcValue, '..\', '..\..\' ) THEN +* MESSAGEBOX( 'Encontrado valor "' + tcValue + '" en propiedad "' + tcProp, 4096, PROGRAM() ) +* tcValue = '' +*ENDIF + +*-- Ajustes de algunos casos especiales + Do Case + Case tcProp == '_memberdata' + lcValue = '' + + For I = 1 To Occurs( '/>', tcValue ) +*TEXT TO lcValue TEXTMERGE ADDITIVE NOSHOW FLAGS 1+2 PRETEXT 1+2 +* <<>> <', m.I, 1+4 ), CR_LF, ' ' )>> +*ENDTEXT + lcValue = lcValue + Chr(13) + Chr(10) + Chr(9) + Chr(9) + Chr(9) + Chrtran( Strextract( tcValue, '', m.I, 1+4 ), CR_LF, ' ' ) + Endfor + + TEXT TO tcValue TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + + <> + <<>> + ENDTEXT + + Case Left( tcValue, C_LEN_FB2P_VALUE_I ) == C_FB2P_VALUE_I +*-- Valor especial Fox con cabecera CHR(1): Debo quitarla y normalizar el valor + tcValue = C_FB2P_VALUE_I ; + + Strtran( Strtran( Strtran( Strtran( ; + STREXTRACT( tcValue, C_FB2P_VALUE_I, C_FB2P_VALUE_F, 1, 1 ) ; + , CR_LF, ' +10;' ), C_CR, ' ' ), C_LF, ' ' ), ' +10;', CR_LF ) ; + + C_FB2P_VALUE_F + + + Endcase + + Release tcProp, lcValue, I, tcComentario + Return tcValue + Endproc + + + + Procedure normalizeXMLValue + Lparameters tcValor +*-- NORMALIZA EL TEXTO INDICADO, COMPRIMIENDO LOS SÍMBOLOS XML ESPECIALES. + tcValor = Strtran(tcValor, Chr(38), Chr(38) + 'amp;') && reemplaza & por & && + tcValor = Strtran(tcValor, Chr(39), Chr(38) + 'apos;') && reemplaza ' por ' && + tcValor = Strtran(tcValor, Chr(34), Chr(38) + 'quot;') && reemplaza " por " && + tcValor = Strtran(tcValor, '<', Chr(38) + 'lt;') && reemplaza < por < && + tcValor = Strtran(tcValor, '>', Chr(38) + 'gt;') && reemplaza > por > && + tcValor = Strtran(tcValor, Chr(13)+Chr(10), Chr(10)) && reeemplaza CR+LF por LF + tcValor = Chrtran(tcValor, Chr(13), Chr(10)) && reemplaza CR por LF + + Return tcValor + Endproc + + + + Function rowTimeStamp(ltDateTime) +* Generate a FoxPro 3.0-style row timestamp +*-- CONVIERTE UN DATO TIPO DATETIME EN TIMESTAMP NUMERICO USADO POR LOS ARCHIVOS SCX/VCX/etc. + Local lcTimeValue, tnTimeStamp + + Try + If Empty(ltDateTime) + tnTimeStamp = 0 + Exit + Endif + + If Vartype(m.ltDateTime) <> 'T' + m.ltDateTime = Datetime() + Endif + + tnTimeStamp = ( Year(m.ltDateTime) - 1980) * 2^25 ; + + Month(m.ltDateTime) * 2^21 ; + + Day(m.ltDateTime) * 2^16 ; + + Hour(m.ltDateTime) * 2^11 ; + + Minute(m.ltDateTime) * 2^5 ; + + Sec(m.ltDateTime) + Endtry + + Return Int(tnTimeStamp) + Endfunc + + + Procedure set_UserValue + Lparameters toEx As Exception + Endproc + + + Procedure sortPropsAndValues_SetAndGetSCXPropNames +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcOperation (v! IN ) Operación a realizar ("SETNAME" o "GETNAME") +* tcPropName (v! IN ) Nombre de la propiedad +*-------------------------------------------------------------------------------------------------------------- + Lparameters tcOperation, tcPropName + + Try + Local lcPropName, lcClass, lnPos ; + , loEx As Exception ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + lcPropName = tcPropName + tcOperation = Upper(Evl(tcOperation,'')) + + Do Case + Case tcOperation == 'GETNAME' + lcPropName = Substr(tcPropName,5) + + Case Not tcOperation == 'SETNAME' + Error loLang.C_ONLY_SETNAME_AND_GETNAME_RECOGNIZED_LOC + + Case lcPropName == 'Name' && System "Name" property + lcPropName = 'A999' + lcPropName + + Otherwise +*-- Soporte de evaluación de propiedades por clase evaluada + With This + #If .F. &&USED("foxbin2prg_keywords") THEN + lcClass = Icase( .c_ClaseActual == 'grid', 'all' ; + , .c_ClaseActual == 'form', 'all' ; + , .c_ClaseActual == 'pageframe', 'all' ; + , .c_ClaseActual == 'control', 'all' ; + , .c_ClaseActual == 'container', 'all' ; + , .c_ClaseActual == 'toolbar', 'all' ; + , .c_ClaseActual ) + + lnPos = Iif( Seek( Padr(lcClass,15) + Padr(lcPropName,30), 'foxbin2prg_keywords' ), foxbin2prg_keywords.i_order, 0 ) + + #Else + Do Case + Case .c_ClaseActual == 'checkbox' + lnPos = Ascan( .a_SpecialProps_Chk, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'collection' + lnPos = Ascan( .a_SpecialProps_Coll, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'combobox' + lnPos = Ascan( .a_SpecialProps_Cbo, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'commandgroup' + lnPos = Ascan( .a_SpecialProps_Cmg, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'commandbutton' + lnPos = Ascan( .a_SpecialProps_Cmd, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'cursor' + lnPos = Ascan( .a_SpecialProps_Cur, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'cursoradapter' + lnPos = Ascan( .a_SpecialProps_CA, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'dataenvironment' + lnPos = Ascan( .a_SpecialProps_DE, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'editbox' + lnPos = Ascan( .a_SpecialProps_Edt, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'formset' + lnPos = Ascan( .a_SpecialProps_Frs, lcPropName, 1, 0, 1, 1+2+4 ) + +*-- Comento la clase grid, porque puede contener a todos los controles, como un form +*CASE .c_ClaseActual == 'grid' +* lnPos = ASCAN( .a_SpecialProps_Grd, lcPropName, 1, 0, 1, 1+2+4 ) + +*-- Comento la clase form, porque puede contener a todos los controles, como un form +*CASE .c_ClaseActual == 'form' +* lnPos = ASCAN( .a_SpecialProps_Frm, lcPropName, 1, 0, 1, 1+2+4 ) + +*-- Comento la clase pageframe, porque puede contener a todos los controles, como un form +*CASE .c_ClaseActual == 'pageframe' +* lnPos = ASCAN( .a_SpecialProps_Pgf, lcPropName, 1, 0, 1, 1+2+4 ) + +*-- Comento la clase control, porque puede contener a todos los controles, como un form +*CASE .c_ClaseActual == 'control' +* lnPos = ASCAN( .a_SpecialProps_Ctl, lcPropName, 1, 0, 1, 1+2+4 ) + +*-- Comento la clase container, porque puede contener a todos los controles, como un form +*CASE .c_ClaseActual == 'container' +* lnPos = ASCAN( .a_SpecialProps_Cnt, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'column' + lnPos = Ascan( .a_SpecialProps_Grc, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'header' + lnPos = Ascan( .a_SpecialProps_Grh, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'hyperlink' + lnPos = Ascan( .a_SpecialProps_Hlk, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'image' + lnPos = Ascan( .a_SpecialProps_Img, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'label' + lnPos = Ascan( .a_SpecialProps_Lbl, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'line' + lnPos = Ascan( .a_SpecialProps_Lin, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'listbox' + lnPos = Ascan( .a_SpecialProps_Lst, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'olebound' + lnPos = Ascan( .a_SpecialProps_Ole, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'optiongroup' + lnPos = Ascan( .a_SpecialProps_Opg, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'optionbutton' + lnPos = Ascan( .a_SpecialProps_Opb, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'projecthook' + lnPos = Ascan( .a_SpecialProps_Phk, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'relation' + lnPos = Ascan( .a_SpecialProps_Rel, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'reportlistener' + lnPos = Ascan( .a_SpecialProps_Rls, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'separator' + lnPos = Ascan( .a_SpecialProps_Sep, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'shape' + lnPos = Ascan( .a_SpecialProps_Shp, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'spinner' + lnPos = Ascan( .a_SpecialProps_Spn, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'textbox' + lnPos = Ascan( .a_SpecialProps_Txt, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'timer' + lnPos = Ascan( .a_SpecialProps_Tmr, lcPropName, 1, 0, 1, 1+2+4 ) + +*-- Comento la clase toolbar, porque puede contener a todos los controles, como un form +*CASE .c_ClaseActual == 'toolbar' +* lnPos = ASCAN( .a_SpecialProps_Tbr, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'xmladapter' + lnPos = Ascan( .a_SpecialProps_XMLAda, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'xmlfield' + lnPos = Ascan( .a_SpecialProps_XMLFld, lcPropName, 1, 0, 1, 1+2+4 ) + + Case .c_ClaseActual == 'xmltable' + lnPos = Ascan( .a_SpecialProps_XMLTbl, lcPropName, 1, 0, 1, 1+2+4 ) + + Otherwise + lnPos = Ascan( .a_SpecialProps, lcPropName, 1, 0, 1, 1+2+4 ) + Endcase + #Endif + +*IF lnPos2 <> lnPos +* ERROR 'lnPos y lnPos2 no coinciden para "' + .c_ClaseActual + '.' + lcPropName + '"! lnPos=' + TRANSFORM(lnPos) + ', lnPos2=' + TRANSFORM(lnPos2) +*ENDIF + +*-- Genera una propiedad con el formato "A nnn Propiedad", donde los valores más altos quedan al final, +*-- de modo que primero van las props nativas, luego las del usuario y al final "name", que es especial. +*-- Ej: "A004ScaleMode", ..., "A998UserProp", "A999Name" + lcPropName = 'A' + Padl( Evl(lnPos,998), 3, '0' ) + lcPropName + Endwith && THIS + Endcase + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcOperation, tcPropName, lnPos, loEx + Endtry + + Return lcPropName + Endproc + + + Procedure sortPropsAndValues +* KNOWLEDGE BASE: +* 02/12/2013 FDBOZZO Fidel Charny me pasó un ejemplo donde se pierden propiedades físicamente +* si se ordenan alfabéticamente en un ADD OBJECT. Pierde "picture" y otras más. +* Pareciera que la última debe ser "Name". +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taPropsAndValues (!@ IN ) El array con las propiedades y valores del objeto o clase +* tnPropsAndValues_Count (v! IN ) Cantidad de propiedades +* tnSortType (v! IN ) Tipo de sort: +* 0=Solo separar propiedades de clase y de objetos (.) +* 1=Sort completo de propiedades (para la versión TEXTO) +* 2=Sort completo de propiedades con "Name" al final (para la versión BIN) +*-------------------------------------------------------------------------------------------------------------- + Lparameters taPropsAndValues, tnPropsAndValues_Count, tnSortType + + External Array taPropsAndValues + + Try + Local I, X, lnArrayCols, laPropsAndValues(1,2), lcPropName, lcSortedMemo, lcMethods ; + , lnSelect, lcObjName + lnArrayCols = Alen( taPropsAndValues, 2 ) + lnSelect = Select() + Dimension laPropsAndValues( tnPropsAndValues_Count, lnArrayCols ) + Acopy( taPropsAndValues, laPropsAndValues ) + + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' + If m.tnSortType > 0 +* CON SORT: +* - A las que no tienen '.' les pongo 'A' por delante, y al resto 'B' por delante para que queden al final + +* ATENCIÓN: 10/07/2018 +* Cuando hay ADD OBJECT multicontenedor (obj.obj.obj...), el reordenamiento +* puede producir dańos colaterales, como objetos mal colocados. +* (Era de esperar: No todo se puede ordenar alfabéticamente) +* Un solución de compromiso podría ser al menos mantener juntos los objetos de mismo nombre, +* que en la práctica pueden estar todos mezclados. Al menos eso no rompería nada. +* VER: https://github.com/fdbozzo/foxbin2prg/issues/28 +* +* PASO 1: Obtener los nombres únicos y asignarles un código de orden + Create Cursor C_OBJ (OBJNAME C(50), IORDER I Autoinc) + Index On OBJNAME Tag OBJNAME + +* PASO 2: Configurar las prioridades de ordenamiento (primero props, luego objs) + For I = 1 To m.tnPropsAndValues_Count + If '.' $ laPropsAndValues(m.I,1) + If m.tnSortType = 2 +* Genera obj+props para BIN + lcObjName = Getwordnum(laPropsAndValues(m.I,1), 1, '.') + + If Not Seek(Lower(lcObjName), "C_OBJ") + Insert Into C_OBJ (OBJNAME) Values (Lower(lcObjName)) + Endif + + laPropsAndValues(m.I,1) = 'B' + Padl(C_OBJ.IORDER,3,'0') ; + + Juststem(laPropsAndValues(m.I,1)) + '.' ; + + .sortPropsAndValues_SetAndGetSCXPropNames( 'SETNAME', Justext(laPropsAndValues(m.I,1)) ) + +*laPropsAndValues(m.I,1) = 'B000' + lcObjName + '.' ; ++ .sortPropsAndValues_SetAndGetSCXPropNames( 'SETNAME', JUSTEXT(laPropsAndValues(m.I,1)) ) + Else +* Genera obj+props para TX2 + lcObjName = Getwordnum(laPropsAndValues(m.I,1), 1, '.') + + If Not Seek(Lower(lcObjName), "C_OBJ") + Insert Into C_OBJ (OBJNAME) Values (Lower(lcObjName)) + Endif + + laPropsAndValues(m.I,1) = 'B' + Padl(C_OBJ.IORDER,3,'0') ; + + Juststem(laPropsAndValues(m.I,1)) + '.' ; + + Justext(laPropsAndValues(m.I,1)) + +*laPropsAndValues(m.I,1) = 'B' + PADL(I,3,'0') + laPropsAndValues(m.I,1) + Endif + Else + If m.tnSortType = 2 +* Genera obj+props para BIN + laPropsAndValues(m.I,1) = .sortPropsAndValues_SetAndGetSCXPropNames( 'SETNAME', laPropsAndValues(m.I,1) ) + Else +* Genera obj+props para TX2 + laPropsAndValues(m.I,1) = 'A000' + laPropsAndValues(m.I,1) + Endif + Endif + Endfor + +* Paso 3: Ordenar según la prioridad previa + If .l_PropSort_Enabled + Asort( laPropsAndValues, 1, -1, 0, 1) + Endif + + +* Paso 4: Quitar metadatos y rearmar array + For I = 1 To m.tnPropsAndValues_Count +*-- Quitar caracteres agregados antes del SORT + If '.' $ laPropsAndValues(m.I,1) + If m.tnSortType = 2 +* Genera obj+props para BIN + taPropsAndValues(m.I,1) = Juststem( Substr( laPropsAndValues(m.I,1), 2+3 ) ) + '.' ; + + .sortPropsAndValues_SetAndGetSCXPropNames( 'GETNAME', Justext(laPropsAndValues(m.I,1)) ) + Else +* Genera obj+props para TX2 + taPropsAndValues(m.I,1) = Substr( laPropsAndValues(m.I,1), 2+3 ) + Endif + Else + If m.tnSortType = 2 +* Genera obj+props para BIN + taPropsAndValues(m.I,1) = .sortPropsAndValues_SetAndGetSCXPropNames( 'GETNAME', laPropsAndValues(m.I,1) ) + Else +* Genera obj+props para TX2 + taPropsAndValues(m.I,1) = Substr( laPropsAndValues(m.I,1), 2+3 ) + Endif + Endif + + taPropsAndValues(m.I,2) = laPropsAndValues(m.I,2) + + If lnArrayCols >= 3 + taPropsAndValues(m.I,3) = laPropsAndValues(m.I,3) + Endif + Endfor + + Else && m.tnSortType = 0 +*-- SIN SORT: Creo 2 arrays, el bueno y el temporal, y al terminar agrego el temporal al bueno. +*-- Debo separar las props.normales de las de los objetos (ocurre cuando es un ADD OBJECT) + X = 0 + +*-- PRIMERO las que no tienen punto + For I = 1 To m.tnPropsAndValues_Count + If Empty( laPropsAndValues(m.I,1) ) + Loop + Endif + + If Not '.' $ laPropsAndValues(m.I,1) + X = m.X + 1 + taPropsAndValues(m.X,1) = laPropsAndValues(m.I,1) + taPropsAndValues(m.X,2) = laPropsAndValues(m.I,2) + If lnArrayCols >= 3 + taPropsAndValues(m.X,3) = laPropsAndValues(m.I,3) + Endif + Endif + Endfor + +*-- LUEGO las demás props. + For I = 1 To m.tnPropsAndValues_Count + If Empty( laPropsAndValues(m.I,1) ) + Loop + Endif + + If '.' $ laPropsAndValues(m.I,1) + X = m.X + 1 + taPropsAndValues(m.X,1) = laPropsAndValues(m.I,1) + taPropsAndValues(m.X,2) = laPropsAndValues(m.I,2) + If lnArrayCols >= 3 + taPropsAndValues(m.X,3) = laPropsAndValues(m.I,3) + Endif + Endif + Endfor + Endif + Endwith && THIS AS C_CONVERSOR_BASE OF 'FOXBIN2PRG.PRG' + + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release taPropsAndValues, tnPropsAndValues_Count, tnSortType ; + , I, X, lnArrayCols, laPropsAndValues, lcPropName, lcSortedMemo, lcMethods + Use In (Select("C_OBJ")) + Select (lnSelect) + Endtry + + Return + Endproc + + + + Procedure sortSpecialProps + Try + Local I, loEx As Exception, lcPropsFile + lcPropsFile = '' + + With This As conversor_base Of "FOXBIN2PRG.PRG" +*-- (TODAS) => Antes era solo FORM + #If .F. +*-- 03/04/2015 FDBOZZO +*-- Quise comparar la velocidad de los ASCAN(array) contra un SEEK a una tabla de propiedades con índice, y resulta que para +*-- unas 1500 propiedades casi no hay diferencias (10 segundos en unos 1600 archivos) :( + Use (Fullpath( 'foxbin2prg_keywords', .c_Foxbin2prg_FullPath )) Shared Noupdate Again In 0 Order PK && C_CLASS+C_KEYWORD + #Else + I = 0 + + lcPropsFile = Forcepath( "props_all.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_checkbox.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Chk, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_collection.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Coll, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_combobox.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Cbo, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_commandgroup.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Cmg, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_commandbutton.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Cmd, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_cursor.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Cur, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_cursoradapter.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_CA, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_dataenvironment.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_DE, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_editbox.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Edt, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_formset.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Frs, Filetostr( lcPropsFile ), 1+4 ) + +*lcPropsFile = FORCEPATH( "props_grid.txt", JUSTPATH( .c_Foxbin2prg_FullPath ) ) +*I = ALINES( .a_SpecialProps_Grd, FILETOSTR( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_grid_column.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Grc, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_grid_header.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Grh, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_hyperlink.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Hlk, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_image.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Img, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_label.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Lbl, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_line.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Lin, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_listbox.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Lst, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_olebound.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Ole, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_optiongroup.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Opg, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_optiongroup_option.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Opb, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_projecthook.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Phk, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_relation.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Rel, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_reportlistener.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Rls, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_separator.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Sep, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_shape.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Shp, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_spinner.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Spn, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_textbox.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Txt, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_timer.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_Tmr, Filetostr( lcPropsFile ), 1+4 ) + +*lcPropsFile = FORCEPATH( "props_toolbar.txt", JUSTPATH( .c_Foxbin2prg_FullPath ) ) +*I = ALINES( .a_SpecialProps_Tbr, FILETOSTR( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_xmladapter.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_XMLAda, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_xmlfield.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_XMLFld, Filetostr( lcPropsFile ), 1+4 ) + + lcPropsFile = Forcepath( "props_xmltable.txt", Justpath( .c_Foxbin2prg_FullPath ) ) + I = Alines( .a_SpecialProps_XMLTbl, Filetostr( lcPropsFile ), 1+4 ) + #Endif + + Endwith + + Catch To loEx + loEx.UserValue = 'lcPropsFile = ' + lcPropsFile + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Endtry + + Return + Endproc + + + Procedure writeLog + Lparameters tcText, tnTimeStamp + + Try + With This As c_conversor_base Of 'FOXBIN2PRG.PRG' +*-- Según el valor de nTimestamp: +*-- 0 = Sin timestamp +*-- 1 = Timestamp por delante +*-- 2 = Timestamp por detrás + .c_TextLog = .c_TextLog ; + + Iif( Evl(tnTimeStamp,0) = 1, Ttoc(Datetime(),3) + ' ', '' ) ; + + Evl(tcText,'') ; + + Iif( Evl(tnTimeStamp,0) = 2, ' ' + Ttoc(Datetime(),3), '' ) ; + + CR_LF + Endwith + Catch + Endtry + Endproc + + + Procedure writeErrorLog + Lparameters tcText + + Try + With This As conversor_base Of "FOXBIN2PRG.PRG" + .c_TextErr = .c_TextErr + Evl(tcText,'') + CR_LF + .l_Error = .T. + Endwith + Catch + Endtry + Endproc + + +Enddefine + + + + +Define Class c_conversor_prg_a_bin As c_conversor_base + #If .F. + Local This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + #Endif + + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (!@ OUT) Objeto generado de clase correspondiente con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (!@ IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toModulo, toEx As Exception, toFoxBin2Prg + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + DoDefault( @toModulo, @toEx, @toFoxBin2Prg ) + Endproc + + + + Function get_ValueByName_FromListNamesWithValues +*-- ASIGNO EL VALOR DEL ARRAY DE DATOS Y VALORES PARA LA PROPIEDAD INDICADA + Lparameters tcPropName, tcValueType, taPropsAndValues + Local lnPos, luPropValue + + lnPos = Ascan( taPropsAndValues, tcPropName, 1, 0, 1, 1+2+4+8) + + If lnPos = 0 Or Empty( taPropsAndValues( lnPos, 2 ) ) +*-- Valores no encontrados o vacíos + luPropValue = '' + Else + luPropValue = taPropsAndValues( lnPos, 2 ) + Endif + + Do Case + Case tcValueType = 'I' + luPropValue = Cast( luPropValue As Integer ) + + Case tcValueType = 'N' + luPropValue = Cast( luPropValue As Double ) + + Case tcValueType = 'T' + luPropValue = Cast( luPropValue As Datetime ) + + Case tcValueType = 'D' + luPropValue = Cast( luPropValue As Date ) + + Case tcValueType = 'E' + luPropValue = Evaluate( luPropValue ) + + Otherwise && Asumo 'C' para lo demás + luPropValue = luPropValue + + Endcase + + Release tcPropName, tcValueType, taPropsAndValues, lnPos + Return luPropValue + Endfunc + + + + + Procedure analyzeCodeBlock_FoxBin2Prg +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toModulo, tcLine, taCodeLines, I, tnCodeLines + + Local llBloqueEncontrado, laPropsAndValues(1,2), lnPropsAndValues_Count + + If Upper( Left( tcLine + ' ', Len(C_FB2PRG_META_I) + 1 ) ) == C_FB2PRG_META_I + ' ' + With This As c_conversor_prg_a_bin Of foxbin2prg.prg + llBloqueEncontrado = .T. + +*-- Metadatos del módulo + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @tcLine, @laPropsAndValues, @lnPropsAndValues_Count, C_FB2PRG_META_I, C_FB2PRG_META_F ) + toModulo._Version = .get_ValueByName_FromListNamesWithValues( 'Version', 'N', @laPropsAndValues ) + toModulo._SourceFile = .get_ValueByName_FromListNamesWithValues( 'SourceFile', 'C', @laPropsAndValues ) + Endwith + Endif + + Release toModulo, tcLine, taCodeLines, I, tnCodeLines + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_LIBCOMMENT +*------------------------------------------------------ +*-- Analiza el bloque * +*------------------------------------------------------ + Lparameters toModulo, tcLine, taCodeLines, I, tnCodeLines + + Local llBloqueEncontrado, laPropsAndValues(1,2), lnPropsAndValues_Count + + If Upper( Left( tcLine, Len(C_LIBCOMMENT_I) ) ) == C_LIBCOMMENT_I + llBloqueEncontrado = .T. + +*-- Metadatos del módulo + toModulo._Comment = Alltrim( Strextract( tcLine, C_LIBCOMMENT_I, C_LIBCOMMENT_F ) ) + Endif + + Release toModulo, tcLine, taCodeLines, I, tnCodeLines, laPropsAndValues, lnPropsAndValues_Count + Return llBloqueEncontrado + Endproc + + + + + Procedure createProject + Lparameters tcTableOrCursor && 'TABLE' or 'CURSOR' + + Local lcCursorName + tcTableOrCursor = Evl( tcTableOrCursor, 'TABLE' ) + lcCursorName = Icase( tcTableOrCursor = 'TABLE', This.c_OutputFile, 'TABLABIN' ) + + Create &tcTableOrCursor. (lcCursorName) ; + ( Name M ; + , Type C(1) ; + , Id N(10) ; + , Timestamp N(10) ; + , OUTFILE M ; + , HomeDir M ; + , EXCLUDE L ; + , MAINPROG L ; + , SAVECODE L ; + , Debug L ; + , Encrypt L ; + , NOLOGO L ; + , CMNTSTYLE N(1) ; + , OBJREV N(5) ; + , DEVINFO M ; + , SYMBOLS M ; + , Object M ; + , CKVAL N(6) ; + , CPID N(5) ; + , OSTYPE C(4) ; + , OSCREATOR C(4) ; + , COMMENTS M ; + , RESERVED1 M ; + , RESERVED2 M ; + , SCCDATA M ; + , Local L ; + , Key C(32) ; + , User M ) + + If tcTableOrCursor = 'TABLE' Then + Use (This.c_OutputFile) Alias TABLABIN Again Shared + Endif + + Endproc + + + + Procedure createProject_RecordHeader + Lparameters toProject + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Insert Into TABLABIN ; + ( Name ; + , Type ; + , Timestamp ; + , OUTFILE ; + , HomeDir ; + , SAVECODE ; + , Debug ; + , Encrypt ; + , NOLOGO ; + , CMNTSTYLE ; + , OBJREV ; + , DEVINFO ; + , Object ; + , RESERVED1 ; + , RESERVED2 ; + , SCCDATA ; + , Local ; + , User ; + , Key ) ; + VALUES ; + ( Upper( Forcepath( Evl(This.c_OriginalFileName,This.c_OutputFile), toProject._HomeDir) ) + Chr(0) ; + , 'H' ; + , 0 ; + , '' + Chr(0) ; + , Lower(toProject._HomeDir) + Chr(0) ; + , toProject._SaveCode ; + , toProject._Debug ; + , toProject._Encrypted ; + , toProject._NoLogo ; + , toProject._CmntStyle ; + , 260 ; + , toProject.getRowDeviceInfo() ; + , Lower(toProject._HomeDir) + Chr(0) ; + , Upper( Forcepath( Evl(This.c_OriginalFileName,This.c_OutputFile), toProject._HomeDir) ) + Chr(0) ; + , toProject._ServerHead.getRowServerInfo() ; + , toProject._SccData ; + , .T. ; + , Strconv(toProject._User,14) ; + , Upper( Juststem( This.c_OutputFile) ) ) + + Endproc + + + + Procedure createClasslib + Lparameters tcTableOrCursor && 'TABLE' or 'CURSOR' + + Local lcCursorName + tcTableOrCursor = Evl( tcTableOrCursor, 'TABLE' ) + lcCursorName = Icase( tcTableOrCursor = 'TABLE', This.c_OutputFile, 'TABLABIN' ) + + Create &tcTableOrCursor. (lcCursorName) ; + ( PLATFORM C(8) ; + , UNIQUEID C(10) ; + , Timestamp N(10) ; + , Class M ; + , CLASSLOC M ; + , BaseClass M ; + , OBJNAME M ; + , Parent M ; + , PROPERTIES M ; + , Protected M ; + , METHODS M ; + , OBJCODE M NoCPTrans ; + , OLE M ; + , OLE2 M ; + , RESERVED1 M ; + , RESERVED2 M ; + , RESERVED3 M ; + , RESERVED4 M ; + , RESERVED5 M ; + , RESERVED6 M ; + , RESERVED7 M ; + , RESERVED8 M ; + , User M ) + + If tcTableOrCursor = 'TABLE' Then + Use (This.c_OutputFile) Alias TABLABIN Again Shared + Endif + + Endproc + + + + Procedure createClasslib_RecordHeader + Lparameters toModulo + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + #Endif + + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , RESERVED1 ; + , RESERVED7 ) ; + VALUES ; + ( 'COMMENT' ; + , 'Class' ; + , 'VERSION = 3.00' ; + , toModulo._Comment ) + + Endproc + + + + Procedure createForm + Lparameters tcTableOrCursor && 'TABLE' or 'CURSOR' + + Local lcCursorName + tcTableOrCursor = Evl( tcTableOrCursor, 'TABLE' ) + lcCursorName = Icase( tcTableOrCursor = 'TABLE', This.c_OutputFile, 'TABLABIN' ) + + Create &tcTableOrCursor. (lcCursorName) ; + ( PLATFORM C(8) ; + , UNIQUEID C(10) ; + , Timestamp N(10) ; + , Class M ; + , CLASSLOC M ; + , BaseClass M ; + , OBJNAME M ; + , Parent M ; + , PROPERTIES M ; + , Protected M ; + , METHODS M ; + , OBJCODE M NoCPTrans ; + , OLE M ; + , OLE2 M ; + , RESERVED1 M ; + , RESERVED2 M ; + , RESERVED3 M ; + , RESERVED4 M ; + , RESERVED5 M ; + , RESERVED6 M ; + , RESERVED7 M ; + , RESERVED8 M ; + , User M ) + + If tcTableOrCursor = 'TABLE' Then + Use (This.c_OutputFile) Alias TABLABIN Again Shared + Endif + + Endproc + + + + Procedure createForm_RecordHeader + Lparameters toModulo + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + #Endif + + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , RESERVED1 ; + , RESERVED7 ) ; + VALUES ; + ( 'COMMENT' ; + , 'Screen' ; + , 'VERSION = 3.00' ; + , toModulo._Comment ) + + Endproc + + + + Procedure createReport + Lparameters tcTableOrCursor && 'TABLE' or 'CURSOR' + + Local lcCursorName + tcTableOrCursor = Evl( tcTableOrCursor, 'TABLE' ) + lcCursorName = Icase( tcTableOrCursor = 'TABLE', This.c_OutputFile, 'TABLABIN' ) + + Create &tcTableOrCursor. (lcCursorName) ; + ( 'PLATFORM' C(8) ; + , 'UNIQUEID' C(10) ; + , 'TIMESTAMP' N(10) ; + , 'OBJTYPE' N(2) ; + , 'OBJCODE' N(3) ; + , 'NAME' M ; + , 'EXPR' M ; + , 'VPOS' N(9,3) ; + , 'HPOS' N(9,3) ; + , 'HEIGHT' N(9,3) ; + , 'WIDTH' N(9,3) ; + , 'STYLE' M ; + , 'PICTURE' M ; + , 'ORDER' M NoCPTrans ; + , 'UNIQUE' L ; + , 'COMMENT' M ; + , 'ENVIRON' L ; + , 'BOXCHAR' C(1) ; + , 'FILLCHAR' C(1) ; + , 'TAG' M ; + , 'TAG2' M NoCPTrans ; + , 'PENRED' N(5) ; + , 'PENGREEN' N(5) ; + , 'PENBLUE' N(5) ; + , 'FILLRED' N(5) ; + , 'FILLGREEN' N(5) ; + , 'FILLBLUE' N(5) ; + , 'PENSIZE' N(5) ; + , 'PENPAT' N(5) ; + , 'FILLPAT' N(5) ; + , 'FONTFACE' M ; + , 'FONTSTYLE' N(3) ; + , 'FONTSIZE' N(3) ; + , 'MODE' N(3) ; + , 'RULER' N(1) ; + , 'RULERLINES' N(1) ; + , 'GRID' L ; + , 'GRIDV' N(2) ; + , 'GRIDH' N(2) ; + , 'FLOAT' L ; + , 'STRETCH' L ; + , 'STRETCHTOP' L ; + , 'TOP' L ; + , 'BOTTOM' L ; + , 'SUPTYPE' N(1) ; + , 'SUPREST' N(1) ; + , 'NOREPEAT' L ; + , 'RESETRPT' N(2) ; + , 'PAGEBREAK' L ; + , 'COLBREAK' L ; + , 'RESETPAGE' L ; + , 'GENERAL' N(3) ; + , 'SPACING' N(3) ; + , 'DOUBLE' L ; + , 'SWAPHEADER' L ; + , 'SWAPFOOTER' L ; + , 'EJECTBEFOR' L ; + , 'EJECTAFTER' L ; + , 'PLAIN' L ; + , 'SUMMARY' L ; + , 'ADDALIAS' L ; + , 'OFFSET' N(3) ; + , 'TOPMARGIN' N(3) ; + , 'BOTMARGIN' N(3) ; + , 'TOTALTYPE' N(2) ; + , 'RESETTOTAL' N(2) ; + , 'RESOID' N(3) ; + , 'CURPOS' L ; + , 'SUPALWAYS' L ; + , 'SUPOVFLOW' L ; + , 'SUPRPCOL' N(1) ; + , 'SUPGROUP' N(2) ; + , 'SUPVALCHNG' L ; + , 'SUPEXPR' M ; + , 'USER' M ) + + If tcTableOrCursor = 'TABLE' Then + Use (This.c_OutputFile) Alias TABLABIN Again Shared + Endif + + Endproc + + + + Procedure createMenu + Lparameters tcTableOrCursor && 'TABLE' or 'CURSOR' + + Local lcCursorName + tcTableOrCursor = Evl( tcTableOrCursor, 'TABLE' ) + lcCursorName = Icase( tcTableOrCursor = 'TABLE', This.c_OutputFile, 'TABLABIN' ) + + Create &tcTableOrCursor. (lcCursorName) ; + ( 'OBJTYPE' Numeric(2) ; + , 'OBJCODE' Numeric(2) ; + , 'NAME' Memo ; + , 'PROMPT' Memo ; + , 'COMMAND' Memo ; + , 'MESSAGE' Memo ; + , 'PROCTYPE' Numeric(1) ; + , 'PROCEDURE' Memo ; + , 'SETUPTYPE' Numeric(1) ; + , 'SETUP' Memo ; + , 'CLEANTYPE' Numeric(1) ; + , 'CLEANUP' Memo ; + , 'MARK' Character(1) ; + , 'KEYNAME' Memo ; + , 'KEYLABEL' Memo ; + , 'SKIPFOR' Memo ; + , 'NAMECHANGE' Logical ; + , 'NUMITEMS' Numeric(2) ; + , 'LEVELNAME' Character(10) ; + , 'ITEMNUM' Character(3) ; + , 'COMMENT' Memory(4) ; + , 'LOCATION' Numeric(2) ; + , 'SCHEME' Numeric(2) ; + , 'SYSRES' Numeric(1) ; + , 'RESNAME' Memory(4) ) + + If tcTableOrCursor = 'TABLE' Then + Use (This.c_OutputFile) Alias TABLABIN Again Shared + Endif + + Endproc + + + + Procedure writeBinaryFile + Lparameters toModulo + Endproc + + + + Procedure classProps2Memo +*-------------------------------------------------------------------------------------------------------------- +* ARMA EL MEMO DE PROPERTIES CON LAS PROPIEDADES Y SUS VALORES +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toClase (!@ IN ) Objeto de la Clase +* toFoxBin2Prg (@? IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- + Lparameters toClase, toFoxBin2Prg + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + +*-- ESTRUCTURA A ANALIZAR: Propiedades normales, con CR codificado () y con CR+LF () +* HEIGHT = 2.73 +* NAME = "c1" +* prop1 = .F. && Mi prop 1 +* prop_especial_cr = Este es el valor 1 Este el 2 Y Este bajo Shift_Enter el 3 +* prop_especial_crlf = +* Este es el valor 1 +* Este el 2 +* Y Este bajo Shift_Enter el 3 +* +* WIDTH = 27.40 +* _MEMBERDATA = +* +* +* && XML Metadata for customizable properties +*-- Fin: ESTRUCTURA A ANALIZAR: + + Try + Local I, lcMemo, laPropsAndValues(1,2), lnPropsAndValues_Count + lcMemo = '' + + If toClase._Prop_Count > 0 + With This As c_conversor_prg_a_bin Of foxbin2prg.prg + .updateProgressbar( 'Generating Props for Class ' + toClase._Nombre + '...', 0, 1, 2 ) + .c_ClaseActual = Lower(toClase._BaseClass) + Dimension laPropsAndValues( toClase._Prop_Count, 3 ) + Acopy( toClase._Props, laPropsAndValues ) + lnPropsAndValues_Count = toClase._Prop_Count + +*-- REORDENO LAS PROPIEDADES + .sortPropsAndValues( @laPropsAndValues, lnPropsAndValues_Count, 2 ) + + +*-- ARMO EL MEMO A DEVOLVER + For I = 1 To lnPropsAndValues_Count +* +* Skip ZOrderSet if configured to +* + If toFoxBin2Prg.l_RemoveZOrderSetFromProps And Atc( '.ZOrderSet.', '.' + laPropsAndValues(m.I, 1) + '.' ) > 0 Then + Loop + Endif + lcMemo = lcMemo + laPropsAndValues(m.I,1) + ' = ' + laPropsAndValues(m.I,2) + CR_LF + Endfor + Endwith + Endif && toClase._Prop_Count > 0 + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toClase, I, laPropsAndValues, lnPropsAndValues_Count + Endtry + + Return lcMemo + Endproc + + + + Procedure objectProps2Memo +*-- ARMA EL MEMO DE PROPERTIES CON LAS PROPIEDADES Y SUS VALORES + Lparameters toObjeto, toClase + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' ; + , toObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + #Endif + + Local lcMemo, I, laPropsAndValues(1,2) + lcMemo = '' + + If toObjeto._Prop_Count > 0 + With This As c_conversor_prg_a_bin Of foxbin2prg.prg + .c_ClaseActual = Lower(toObjeto._BaseClass) + Dimension laPropsAndValues( toObjeto._Prop_Count, 2 ) + Acopy( toObjeto._Props, laPropsAndValues ) + + +*-- REORDENO LAS PROPIEDADES + .sortPropsAndValues( @laPropsAndValues, toObjeto._Prop_Count, 2 ) + + +*-- ARMO EL MEMO A DEVOLVER + For I = 1 To toObjeto._Prop_Count + lcMemo = lcMemo + laPropsAndValues(m.I,1) + ' = ' + laPropsAndValues(m.I,2) + CR_LF + Endfor + Endwith + Endif + + Release toObjeto, toClase, I, laPropsAndValues + Return lcMemo + Endproc + + + + Procedure classMethods2Memo + Lparameters toClase + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local lcMemo, I, X, lcNombreObjeto ; + , loProcedure As CL_PROCEDURE Of 'FOXBIN2PRG.PRG' + lcMemo = '' + +*-- Recorrer los métodos + With This As c_conversor_prg_a_bin Of foxbin2prg.prg + For I = 1 To toClase._Procedure_Count + loProcedure = Null + loProcedure = toClase._Procedures(m.I) + + If loProcedure._ProcLine_Count > 0 Then + .updateProgressbar( 'Generating Procedure ' + toClase._Nombre + '.' + loProcedure._Nombre + '...', m.I, toClase._Procedure_Count, 2 ) + + If '.' $ loProcedure._Nombre +*-- cboNombre.InteractiveChange ==> No debe acortarse por ser método modificado de combobox heredado de la clase +*-- cntDatos.txtEdad.Valid ==> Debe acortarse si cntDatos es un objeto existente + lcNombreObjeto = Left( loProcedure._Nombre, At('.', loProcedure._Nombre) - 1 ) + + If .findMethodsObjectByName( lcNombreObjeto, toClase ) = 0 + TEXT TO lcMemo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + <> <> + ENDTEXT +*lcMemo = lcMemo + C_PROCEDURE + ' ' + loProcedure._Nombre + Else + TEXT TO lcMemo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + <> <> + ENDTEXT +*lcMemo = lcMemo + C_PROCEDURE + ' ' + SUBSTR( loProcedure._Nombre, AT('.', loProcedure._Nombre) + 1 ) + Endif + Else + TEXT TO lcMemo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + <> <> + ENDTEXT +*lcMemo = lcMemo + C_PROCEDURE + ' ' + loProcedure._Nombre + Endif + +*-- Incluir las líneas del método +*.updateProgressbar( 'Generating Lines of Procedure ' + toClase._Nombre + '.' + loProcedure._Nombre + '...', m.I, toClase._Procedure_Count, 2 ) + For X = 1 To loProcedure._ProcLine_Count +*TEXT TO lcMemo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 +* <> +*ENDTEXT + lcMemo = lcMemo + Chr(13) + Chr(10) + loProcedure._ProcLines(m.X) + Endfor + + TEXT TO lcMemo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <> + <<>> + ENDTEXT + Endif + Endfor + Endwith + + loProcedure = Null + Release toClase, I, X, lcNombreObjeto, loProcedure + Return lcMemo + Endproc + + + + Procedure objectMethods2Memo + Lparameters toObjeto, toClase + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' ; + , toObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + #Endif + + Local lcMemo, I, X, lcNombreObjeto ; + , loProcedure As CL_PROCEDURE Of 'FOXBIN2PRG.PRG' + lcMemo = '' + +*-- Recorrer los métodos + This.updateProgressbar( 'Generating Object Methods for ' + toClase._Nombre + '.' + toObjeto._ObjName + '...', 0, 1, 2 ) + For I = 1 To toObjeto._Procedure_Count + loProcedure = Null + loProcedure = toObjeto._Procedures(m.I) + + TEXT TO lcMemo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + <> <> + ENDTEXT + +*-- Incluir las líneas del método + For X = 1 To loProcedure._ProcLine_Count + lcMemo = lcMemo + Chr(13) + Chr(10) + loProcedure._ProcLines(m.X) + Endfor + + TEXT TO lcMemo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <> + <<>> + ENDTEXT + Endfor + + loProcedure = Null + Release toObjeto, toClase, I, X, lcNombreObjeto, loProcedure + Return lcMemo + Endproc + + + + Procedure getClassPropertyComment +*-- Devuelve el comentario (columna 2 del array toClase._Props) de la propiedad indicada, +*-- buscándola en la columna 2 por su nombre. + Lparameters tcPropName As String, toClase + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local I, lcComentario + lcComentario = '' + + For I = 1 To toClase._Prop_Count + If Rtrim( Getwordnum( toClase._Props(m.I,1), 1, '=' ) ) == tcPropName + lcComentario = toClase._Props( m.I, 2 ) + Exit + Endif + Endfor + + Release tcPropName, toClase, I + Return lcComentario + Endproc + + + + Procedure getClassMethodComment +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcLine (@! IN/OUT) Línea a separar del comentario (En este punto, el único comentario puede ser un HELPSTRING) +* tcComment (@? OUT) Comentario +*--------------------------------------------------------------------------------------------------- + Lparameters tcLine As String, tcComment As String + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local lnATC + tcComment = '' + lnATC = Atc("HELPSTRING", tcLine) + + If lnATC > 0 + tcComment = Alltrim(Substr(tcLine, lnATC + 10 )) + +* Quitar comillas + tcComment = Substr(tcComment, 2, Len(tcComment) - 2) + + tcLine = Rtrim(Left(tcLine, lnATC - 1 ), 0, Chr(9), Chr(0), ' ') + Endif + + Return tcComment + Endproc + + + + Procedure getTextFrom_BIN_FileStructure + Try + Local lcStructure, lnSelect + lnSelect = Select() + Select 0 + Use (This.c_InputFile) Shared Again Alias _TABLABIN + Copy Structure Extended To ( Forcepath( '_FRX_STRUC.DBF', Addbs( This.c_TempDir ) ) ) +**** CONTINUAR SI ES NECESARIO - SIN USO POR AHORA /// DO NOT USE - NOT IMPLEMENTED! + + Catch To loEx + Throw + + Finally + Use In (Select("_TABLABIN")) + Select (lnSelect) + Endtry + + Return lcStructure + Endproc + + + + + Procedure defined_PAM2Memo +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toClase (!@ IN ) Objeto de la Clase +*-------------------------------------------------------------------------------------------------------------- + Lparameters toClase + Return toClase._Defined_PAM + Endproc + + + + + Procedure strip_Dimensions + Lparameters tcSeparatedCommaVars + Local lnPos1, lnPos2, I + + For I = Occurs( '[', tcSeparatedCommaVars ) To 1 Step -1 + lnPos1 = At( '[', tcSeparatedCommaVars, m.I ) + lnPos2 = At( ']', tcSeparatedCommaVars, m.I ) + tcSeparatedCommaVars = Stuff( tcSeparatedCommaVars, lnPos1, lnPos2 - lnPos1 + 1, '' ) + Endfor + + Release tcSeparatedCommaVars, lnPos1, lnPos2, I + Return + Endproc + + + + + Procedure hiddenAndProtected_PAM + Lparameters toClase + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local lcMemo, I, lcPAM, lcComentario + lcMemo = '' + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + .evaluate_PAM( @lcMemo, toClase._ProtectedProps, 'property', 'protected' ) + .evaluate_PAM( @lcMemo, toClase._HiddenProps, 'property', 'hidden' ) + .evaluate_PAM( @lcMemo, toClase._ProtectedMethods, 'method', 'protected' ) + .evaluate_PAM( @lcMemo, toClase._HiddenMethods, 'method', 'hidden' ) + Endwith && THIS + + Release toClase, I, lcPAM, lcComentario + Return lcMemo + Endproc + + + + + Procedure evaluate_PAM + Lparameters tcMemo As String, tcPAM As String, tcPAM_Type As String, tcPAM_Visibility As String + + Local lcPAM, I + + For I = 1 To Occurs( ',', tcPAM + ',' ) + lcPAM = Alltrim( Getwordnum( tcPAM, m.I, ',' ) ) + + If Not Empty(lcPAM) + If Evl(tcPAM_Visibility, 'normal') == 'hidden' + lcPAM = lcPAM + '^' + Endif + + tcMemo = tcMemo + lcPAM + CR_LF + Endif + Endfor + + Release tcMemo, tcPAM, tcPAM_Type, tcPAM_Visibility, lcPAM, I + Return + Endproc + + + + + Procedure insert_Object + Lparameters toClase, toObjeto, toFoxBin2Prg + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + Local toObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + #Endif + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + If Not .l_Test + Local lcPropsMemo, lcMethodsMemo + lcPropsMemo = .objectProps2Memo( toObjeto, toClase ) + lcMethodsMemo = .objectMethods2Memo( toObjeto, toClase ) + + If Empty(toObjeto._TimeStamp) + toObjeto._TimeStamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(toObjeto._UniqueID) + toObjeto._UniqueID = toFoxBin2Prg.unique_ID() + Endif + +*-- Inserto el objeto + If Justext(toFoxBin2Prg.c_InputFile) = toFoxBin2Prg.c_PJ2 +* Solo los PJX/PJ2 tienen el campo DEVINFO + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , Timestamp ; + , Class ; + , CLASSLOC ; + , BaseClass ; + , OBJNAME ; + , Parent ; + , PROPERTIES ; + , Protected ; + , METHODS ; + , OLE ; + , OLE2 ; + , RESERVED1 ; + , RESERVED2 ; + , RESERVED3 ; + , RESERVED4 ; + , RESERVED5 ; + , RESERVED6 ; + , RESERVED7 ; + , RESERVED8 ; + , User ; + , DEVINFO ) ; + VALUES ; + ( 'WINDOWS' ; + , toObjeto._UniqueID ; + , toObjeto._TimeStamp ; + , toObjeto._Class ; + , toObjeto._ClassLib ; + , toObjeto._BaseClass ; + , toObjeto._ObjName ; + , toObjeto._Parent ; + , lcPropsMemo ; + , '' ; + , lcMethodsMemo ; + , toObjeto._Ole ; + , toObjeto._Ole2 ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , Strconv(toObjeto._User,14) ; + , Strconv(toObjeto._DevInfo,14) ) + Else + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , Timestamp ; + , Class ; + , CLASSLOC ; + , BaseClass ; + , OBJNAME ; + , Parent ; + , PROPERTIES ; + , Protected ; + , METHODS ; + , OLE ; + , OLE2 ; + , RESERVED1 ; + , RESERVED2 ; + , RESERVED3 ; + , RESERVED4 ; + , RESERVED5 ; + , RESERVED6 ; + , RESERVED7 ; + , RESERVED8 ; + , User ) ; + VALUES ; + ( 'WINDOWS' ; + , toObjeto._UniqueID ; + , toObjeto._TimeStamp ; + , toObjeto._Class ; + , toObjeto._ClassLib ; + , toObjeto._BaseClass ; + , toObjeto._ObjName ; + , toObjeto._Parent ; + , lcPropsMemo ; + , '' ; + , lcMethodsMemo ; + , toObjeto._Ole ; + , toObjeto._Ole2 ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , Strconv(toObjeto._User,14) ) + Endif + Endif + Endwith && THIS + + Release toClase, toObjeto, toFoxBin2Prg, lcPropsMemo, lcMethodsMemo + Return + Endproc + + + + + Procedure insert_AllObjects +*-- Recorro primero los objetos con ZOrder definido, y luego los demás +*-- NOTA: Como consecuencia de una integración de código, puede que se hayan agregado objetos nuevos (desconocidos), +*-- pero todo lo demás tiene un ZOrder definido, que es el número de registro original * 100. + Lparameters toClase, toFoxBin2Prg + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local N, X, lcObjName, loObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + loObjeto = Null + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + If toClase._AddObject_Count > 0 + N = 0 + +*-- Armo array con el orden Z de los objetos + Dimension laObjNames( toClase._AddObject_Count, 2 ) + + For X = 1 To toClase._AddObject_Count + loObjeto = toClase._AddObjects( m.X ) + + If Empty(loObjeto._TimeStamp) + loObjeto._TimeStamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(loObjeto._UniqueID) + loObjeto._UniqueID = toFoxBin2Prg.unique_ID() + Endif + + laObjNames( m.X, 1 ) = loObjeto._Nombre + laObjNames( m.X, 2 ) = loObjeto._ZOrder + loObjeto = Null + Endfor + + Asort( laObjNames, 2, -1, 0, 1 ) + + +*-- Escribo los objetos en el orden Z + For X = 1 To toClase._AddObject_Count + lcObjName = laObjNames( m.X, 1 ) + + For Each loObjeto In toClase._AddObjects FoxObject +*-- Verifico que sea el objeto que corresponde + If loObjeto._WriteOrder = 0 And Lower(loObjeto._Nombre) == Lower(lcObjName) + N = N + 1 + loObjeto._WriteOrder = N + .insert_Object( @toClase, @loObjeto, @toFoxBin2Prg ) + Exit + Endif + Endfor + Endfor + + +*-- Recorro los objetos Desconocidos + For Each loObjeto In toClase._AddObjects FoxObject + If loObjeto._WriteOrder = 0 + .insert_Object( @toClase, @loObjeto, @toFoxBin2Prg ) + Endif + Endfor + + Endif && toClase._AddObject_Count > 0 + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + loObjeto = Null + Release toClase, toFoxBin2Prg, N, X, lcObjName, loObjeto + + Endtry + + Return + Endproc + + + + + Procedure set_Line + Lparameters tcLine, taCodeLines, I + tcLine = Ltrim( taCodeLines(m.I), 0, Chr(9), ' ' ) + Endproc + + + + + Procedure analyzeProcedureLines + Lparameters toClase, toObjeto, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto, tc_Comentario ; + , taLineasExclusion, tnBloquesExclusion + + External Array taCodeLines + + #If .F. + Local toObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llEsProcedureDeClase ; + , loProcedure As CL_PROCEDURE Of 'FOXBIN2PRG.PRG' ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + loProcedure = Null + + If '.' $ tcProcedureAbierto And Vartype(toObjeto) = 'O' And toObjeto._Procedure_Count > 0 + loProcedure = toObjeto._Procedures(toObjeto._Procedure_Count) + Else + llEsProcedureDeClase = .T. + loProcedure = toClase._Procedures(toClase._Procedure_Count) + Endif + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + If Not .excludedLine( m.I, tnBloquesExclusion, @taLineasExclusion ) ; + AND Not .lineIsOnlyCommentAndNoMetadata( @tcLine, @tc_Comentario ) + + Do Case + Case Upper( Left( tcLine + ' ', 8 ) ) == 'ENDPROC ' ; && Fin del PROCEDURE + Or Upper( Left( tcLine + ' ', 8 ) ) == 'ENDFUNC ' && Fin de la FUNCTION + + tcProcedureAbierto = '' + Exit + + Case Upper( Left( tcLine + ' ', 10 ) ) == 'ENDDEFINE ' && Fin de bloque (ENDDEFINE) encontrado + If llEsProcedureDeClase +*ERROR 'Error de anidamiento de estructuras. Se esperaba ENDPROC y se encontró ENDDEFINE en la clase ' ; ++ toClase._Nombre + ' (' + loProcedure._Nombre + ')' ; ++ ', línea ' + TRANSFORM(m.I) + ' del archivo ' + .c_InputFile + Error (Textmerge(loLang.C_STRUCTURE_NESTING_ERROR_ENDPROC_EXPECTED_LOC)) + Else +*ERROR 'Error de anidamiento de estructuras. Se esperaba ENDPROC y se encontró ENDDEFINE en la clase ' ; ++ toClase._Nombre + ' (' + toObjeto._Nombre + '.' + loProcedure._Nombre + ')' ; ++ ', línea ' + TRANSFORM(m.I) + ' del archivo ' + .c_InputFile + Error (Textmerge(loLang.C_STRUCTURE_NESTING_ERROR_ENDPROC_EXPECTED_2_LOC)) + Endif + Endcase + Endif + +*-- Quito 2 TABS de la izquierda (si se puede y si el integrador/desarrollador no la lió quitándolos) + Do Case + Case Left( taCodeLines(m.I),2 ) = C_TAB + C_TAB + loProcedure.add_Line( Substr(taCodeLines(m.I), 3) ) + Case Left( taCodeLines(m.I),1 ) = C_TAB + loProcedure.add_Line( Substr(taCodeLines(m.I), 2) ) + Otherwise + loProcedure.add_Line( taCodeLines(m.I) ) + Endcase + Endfor + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + loProcedure = Null + Release toClase, toObjeto, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto, tc_Comentario ; + , taLineasExclusion, tnBloquesExclusion, llEsProcedureDeClase, loProcedure + + Endtry + + Return + Endproc + + + + + Procedure analyzeCodeBlock_ADD_OBJECT +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (!@ IN ) Objeto del Modulo +* toClase (!@ IN ) Objeto de la Clase +* tcLine (!@ IN ) Línea de datos en evaluación +* taCodeLines (!@ IN ) El array con las líneas del código de texto donde buscar +* I (!@ IN ) Número de línea en evaluación +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* toFoxBin2Prg (?@ IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- + Lparameters toModulo, toClase, tcLine, I, taCodeLines, tnCodeLines, toFoxBin2Prg + + External Array taCodeLines + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + Local toObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado + + If Upper( Left( tcLine, 11 ) ) == 'ADD OBJECT ' +*-- Estructura a reconocer: ADD OBJECT 'frm_a.Check1' AS check [WITH] + With This As c_conversor_prg_a_bin Of foxbin2prg.prg + Local laPropsAndValues(1,2), lnPropsAndValues_Count, Z, lcProp, lcValue, lcNombre, lcObjName, lnPos ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + llBloqueEncontrado = .T. + loLang = _Screen.o_FoxBin2Prg_Lang + tcLine = Chrtran( tcLine, ['], ["] ) + + If Empty(toClase._Fin_Cab) + toClase._Fin_Cab = m.I-1 + toClase._Ini_Cuerpo = m.I + Endif + + toObjeto = Null + lcNombre = Alltrim( Chrtran( Strextract(tcLine, 'ADD OBJECT ', ' AS ', 1, 1), ['"], [] ) ) + lcObjName = Justext( '.' + lcNombre ) + .updateProgressbar( 'Analyzing Block Add Object ' + toClase._Nombre + '.' + lcObjName + '...', m.I, tnCodeLines, 1 ) + + If toClase.l_ObjectMetadataInHeader + For Z = 1 To toClase._AddObject_Count + If Lower(toClase._AddObjects(m.Z)._Nombre) == Lower(lcNombre) Then + toObjeto = toClase._AddObjects(m.Z) + Exit + Endif + Endfor + Endif + + If Isnull(toObjeto) + Z = 0 + toObjeto = Createobject('CL_OBJETO') +*-- Luego se reasigna el ZOrder, pero si no lo hace, se pone último como si se acabara de agregar. +*-- Puede pasar si se agrega manualmente al TX2 y se olvida agregar la metadata OBJECTDATA. + toObjeto._ZOrder = 9999 + toObjeto._Nombre = lcNombre + Endif + + toObjeto._ObjName = lcObjName + + If '.' $ toObjeto._Nombre + toObjeto._Parent = toClase._ObjName + '.' + Juststem( toObjeto._Nombre ) + Else + toObjeto._Parent = toClase._ObjName + Endif + + toObjeto._Nombre = toObjeto._Parent + '.' + toObjeto._ObjName + toObjeto._Class = Alltrim( Strextract(tcLine + ' WITH', ' AS ', ' WITH', 1, 1) ) + +*-- Chequeo de nombre de objeto repetido para el mismo contenedor + If toClase._aPathObjName_Count > 0 + lnPos = Ascan( toClase._aPathObjNames, toObjeto._Nombre, 1, 0, 1, 1+2+4+8 ) + + If lnPos > 0 Then +*-- ERROR: Objeto Duplicado + .writeErrorLog( '* ' + loLang.C_DUPLICATED_OBJECT_LOC + ' "' + toClase._Class + '.' + toObjeto._Nombre ; + + '" @line ' + Transform(m.I) + ', (1st.Line:' + Transform(toClase._aPathObjNames(lnPos,2)) + ')' ) + Endif + Endif + + If Not toClase.l_ObjectMetadataInHeader Or m.Z=0 + toClase.add_Object( toObjeto ) + Endif + + toClase.add_PathObjName(toObjeto._Nombre, m.I) + +*-- Propiedades del ADD OBJECT + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + If Upper( Left( tcLine, C_LEN_END_OBJECT_I) ) == C_END_OBJECT_I && Fin del ADD OBJECT y METADATOS +*< END OBJECT: baseclass = "olecontrol" Uniqueid = "_3X50L3I7V" OLEObject = "C:\WINDOWS\system32\FOXTLIB.OCX" checksum = "4101493921" /> + + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @tcLine, @laPropsAndValues, @lnPropsAndValues_Count ; + , C_END_OBJECT_I, C_END_OBJECT_F ) + + toObjeto._ClassLib = .get_ValueByName_FromListNamesWithValues( 'ClassLib', 'C', @laPropsAndValues ) + toObjeto._BaseClass = .get_ValueByName_FromListNamesWithValues( 'BaseClass', 'C', @laPropsAndValues ) + + If Not toClase.l_ObjectMetadataInHeader + toObjeto._UniqueID = .get_ValueByName_FromListNamesWithValues( 'UniqueID', 'C', @laPropsAndValues ) + toObjeto._TimeStamp = Int( .rowTimeStamp( .get_ValueByName_FromListNamesWithValues( 'TimeStamp', 'T', @laPropsAndValues ) ) ) + toObjeto._ZOrder = .get_ValueByName_FromListNamesWithValues( 'ZOrder', 'I', @laPropsAndValues ) + Endif + + toObjeto._Ole2 = .get_ValueByName_FromListNamesWithValues( 'OLEObject', 'C', @laPropsAndValues ) + toObjeto._Ole = Strconv( .get_ValueByName_FromListNamesWithValues( 'Value', 'C', @laPropsAndValues ), 14 ) + + If Not Empty( toObjeto._Ole2 ) && Le agrego "OLEObject = " delante + toObjeto._Ole2 = 'OLEObject = ' + toObjeto._Ole2 + CR_LF + Endif + +*-- Ubico el objeto ole por su nombre (parent+objname), que no se repite. + If Empty(toObjeto._Ole) && Si _Ole está vacío es porque el propio control no tiene la info y está en la cabecera (antiguo guardado) + If toModulo.existeObjetoOLE( toObjeto._Nombre, @m.Z ) + toObjeto._Ole = toModulo._Ole_Objs(m.Z)._Value + Endif + Endif + + Exit + Endif + + If Right(tcLine, 3) == ', ;' && VALOR INTERMEDIO CON ", ;" + .get_SeparatedPropAndValue( Left(tcLine, Len(tcLine) - 3), @lcProp, @lcValue, toClase, @taCodeLines, @tnCodeLines, @m.I ) + +* +* Skip ZOrderSet if configured to +* + If toFoxBin2Prg.l_RemoveZOrderSetFromProps And Atc( '.ZOrderSet.', '.' + lcProp + '.' ) > 0 Then + Loop + Endif + toObjeto.add_Property( @lcProp, @lcValue ) + Else && VALOR FINAL SIN ", ;" (JUSTO ANTES DEL ) + .get_SeparatedPropAndValue( tcLine, @lcProp, @lcValue, toClase, @taCodeLines, @tnCodeLines, @m.I ) + +* +* Skip ZOrderSet if configured to +* + If toFoxBin2Prg.l_RemoveZOrderSetFromProps And Atc( '.ZOrderSet.', '.' + lcProp + '.' ) > 0 Then + Loop + Endif + toObjeto.add_Property( @lcProp, @lcValue ) + Endif + + Endfor + Endwith && THIS + Endif + + Catch To loEx + loEx.UserValue = loEx.UserValue + Textmerge('Source line=<>') + CR_LF + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toModulo, toClase, tcLine, I, taCodeLines, tnCodeLines ; + , laPropsAndValues, lnPropsAndValues_Count, Z, lcProp, lcValue, lcNombre, lcObjName + Endtry + + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_DEFINED_PAM +*-------------------------------------------------------------------------------------------------------------- +* 07/01/2014 FDBOZZO Los *métodos deben ir siempre al final, si no los eventos ACCESS no se ejecutan! +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toClase (!@ IN ) Objeto de la Clase +* tcLine (!@ IN ) Línea de datos en evaluación +* taCodeLines (!@ IN ) El array con las líneas del código de texto donde buscar +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* I (!@ IN ) Número de línea en evaluación +*-------------------------------------------------------------------------------------------------------------- + Lparameters toClase, tcLine, taCodeLines, tnCodeLines, I + +*-- ESTRUCTURA A ANALIZAR (también se admite sin los símbolos ^ y *): +* +*m: *metodovacio_con_comentarios && Este método no tiene código, pero tiene comentarios. A ver que pasa! +*m: *mimetodo && Mi metodo +*p: prop1 && Mi prop 1 +*p: prop_especial_cr && +*a: ^array_1_d[1,0] && Array 1 dimensión (1) +*a: ^array_2_d[1,2] && Array una dimension (1,2) +*p: _memberdata && XML Metadata for customizable properties +* + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcDefinedPAM, lnPos, lnPos2, lcPAM_Name, lcItem, lcMethods, lcPAM_Type + + If Left( tcLine, C_LEN_DEFINED_PAM_I) == C_DEFINED_PAM_I + llBloqueEncontrado = .T. + Store '' To lcDefinedPAM, lcItem, lcMethods + + With This As c_conversor_prg_a_bin Of foxbin2prg.prg + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case Left( tcLine, C_LEN_DEFINED_PAM_F ) == C_DEFINED_PAM_F + I = m.I + 1 + Exit + + Otherwise + lnPos = At( ':', tcLine, 1 ) + lnPos2 = At( '&'+'&', tcLine ) + lcPAM_Type = Left(tcLine,3) && *p:, *a:, *m: + + If lnPos2 > 0 +*-- Con comentarios + lcPAM_Name = Lower( Alltrim( Substr( tcLine, lnPos+1, lnPos2 - lnPos - 1 ), 0, ' ', Chr(9) ) ) + lcItem = lcPAM_Name + ' ' + Substr( tcLine, lnPos2 + 3 ) + CR_LF + + Else +*-- Sin comentarios + lcPAM_Name = Lower( Alltrim( Substr( tcLine, lnPos+1 ), 0, ' ', Chr(9) ) ) + lcItem = lcPAM_Name + Iif( lcPAM_Type == '*p:' , '', ' ') + CR_LF + + Endif + +*-- Separo propiedades y métodos + If lcPAM_Type == '*m:' + If Left(lcItem,1) == '*' + lcMethods = lcMethods + lcItem + Else + lcMethods = lcMethods + '*' + lcItem + Endif + Else + If lcPAM_Type == '*a:' And Left(lcItem,1) <> '^' + lcDefinedPAM = lcDefinedPAM + '^' + lcItem + Else + lcDefinedPAM = lcDefinedPAM + lcItem + Endif + Endif + Endcase + Endfor + Endwith && THIS + +*-- Junto propiedades y los métodos al final. + toClase._Defined_PAM = lcDefinedPAM + lcMethods + I = m.I - 1 + Endif + + Catch To loEx + lnCodError = loEx.ErrorNo + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toClase, tcLine, taCodeLines, tnCodeLines, I ; + , lcDefinedPAM, lnPos, lnPos2, lcPAM_Name, lcItem, lcMethods, lcPAM_Type + Endtry + + Return llBloqueEncontrado + Endproc + +*!* Changed by: LScheffler 16.3.2023 +*!* +*!* Changed by: LScheffler
+*!* get the newly introduced Class-property-value-block +*!*
+*!*
+ + Procedure analyzeCodeBlock_DEFINED_PROPVAL + +*-------------------------------------------------------------------------------------------------------------- +* 16/03/2023 LutzScheffler old version (pre v1.19.77) stored the comment on the property value, so it was impossible to to keep && in value +* the method is basically a copy of analyzeCodeBlock_DEFINED_PAM +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toClase (!@ IN ) Objeto de la Clase +* tcLine (!@ IN ) Línea de datos en evaluación +* taCodeLines (!@ IN ) El array con las líneas del código de texto donde buscar +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* I (!@ IN ) Número de línea en evaluación +*-------------------------------------------------------------------------------------------------------------- + Lparameters toClase, tcLine, taCodeLines, tnCodeLines, I + +*-- Structur to store properties without comment +*(versions older then 1.19.77 are without this section, and values with trailing inline) +* +*Property = Property_Value +*Number: +*prop1 = 0 +*String: +*prop2 = Number +*String with leading and trailing space: +*prop3 = with spaces +*String with inline comment: +*prop4 = with && text +*Property = Property_Expression (in Property sheet as =....) +*prop5 = (Expression after =) +*_memberdata +*_memberdata = .. +* +*sf 20230809 +SET STEP ON + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcPAM_Type + LOCAL lcProp, lcValue + + + If Left( tcLine, C_LEN_DEFINED_PROPVAL_I) == C_DEFINED_PROPVAL_I + llBloqueEncontrado = .T. + + With This As c_conversor_prg_a_bin Of foxbin2prg.prg + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case Left( tcLine, C_LEN_DEFINED_PROPVAL_F ) == C_DEFINED_PROPVAL_F + I = m.I + 1 + Exit + + Otherwise + .get_SeparatedPropAndValue( tcLine, @lcProp, @lcValue, @toClase, @taCodeLines, tnCodeLines, @m.I ) + toClase.add_Property( @lcProp, @lcValue, "" ) + + Endcase + Endfor + Endwith && THIS + +*-- Junto propiedades y los métodos al final. + I = m.I - 1 + Endif + + Catch To loEx + lnCodError = loEx.ErrorNo + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toClase, tcLine, taCodeLines, tnCodeLines, I + Endtry + + Return llBloqueEncontrado + Endproc + +*!* /Changed by: LScheffler 16.3.2023 + + + Procedure analyzeCodeBlock_DEFINE_CLASS +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (!@ IN ) Objeto del Modulo +* toClase (!@ IN ) Objeto de la Clase +* tcLine (!@ IN ) Línea de datos en evaluación +* taCodeLines (!@ IN ) El array con las líneas del código de texto donde buscar +* I (!@ IN ) Número de línea en evaluación +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* tcProcedureAbierto (!v IN ) Nombre del Procedure abierto +* taLineasExclusion (!@ IN ) Array de líneas de exclusión +* tnBloquesExclusion (!@ IN ) Cantidad de líneas de exclusión +* tc_Comentario (!v IN ) Comentario +* toFoxBin2Prg (@? IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- + Lparameters toModulo, toClase, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto ; + , taLineasExclusion, tnBloquesExclusion, tc_Comentario, toFoxBin2Prg + + External Array taCodeLines, tnBloquesExclusion, taLineasExclusion + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + +*toModulo + If Upper(Left(tcLine + ' ', 13)) == C_DEFINE_CLASS + ' ' + Try + llBloqueEncontrado = .T. + Local Z, lcProp, lcValue, loEx As Exception ; + , llCLASSMETADATA_Completed, llPROTECTED_Completed, llHIDDEN_Completed, llDEFINED_PAM_Completed ; + , llINCLUDE_Completed, llCLASS_PROPERTY_Completed, llOBJECTMETADATA_Completed ; + , llCLASSCOMMENTS_Completed ; + , loObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + loLang = _Screen.o_FoxBin2Prg_Lang + Store '' To tcProcedureAbierto + toClase = Createobject('CL_CLASE') + toClase._Nombre = Lower( Alltrim( Strextract( tcLine, 'DEFINE CLASS ', ' AS ', 1, 1 ) ) ) + toClase._ObjName = Lower( toClase._Nombre ) + toClase._Definicion = Alltrim( tcLine ) + If Not ' OF ' $ Upper(tcLine) && Puede no tener "OF libreria.vcx" + toClase._Class = Alltrim( Chrtran( Strextract( tcLine + ' OLEPUBLIC', ' AS ', ' OLEPUBLIC', 1, 1 ), ["'], [] ) ) + Else + toClase._Class = Alltrim( Chrtran( Strextract( tcLine + ' OF ', ' AS ', ' OF ', 1, 1 ), ["'], [] ) ) + Endif + toClase._ClassLoc = Lower( Alltrim( Chrtran( Strextract( tcLine + ' OLEPUBLIC', ' OF ', ' OLEPUBLIC', 1, 1 ), ["'], [] ) ) ) + toClase._OlePublic = ' OLEPUBLIC' $ Upper(tcLine) + toClase._Comentario = tc_Comentario + toClase._Inicio = m.I + toClase._Ini_Cab = m.I + 1 + + toModulo.add_Class( toClase ) + +*-- Ubico el objeto ole por su nombre (parent+objname), que no se repite. + If toModulo.existeObjetoOLE( toClase._Nombre, @m.Z ) + toClase._Ole = toModulo._Ole_Objs(m.Z)._Value + Endif + +* Búsqueda del ID de fin de bloque (ENDDEFINE) + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + For I = toClase._Ini_Cab To tnCodeLines + tc_Comentario = '' + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @tcLine, @tc_Comentario ) + Loop + + Case .analyzeCodeBlock_PROCEDURE( @toModulo, @toClase, @loObjeto, @tcLine, @taCodeLines, @m.I, @tnCodeLines ; + , @tcProcedureAbierto, @tc_Comentario, @taLineasExclusion, @tnBloquesExclusion ) +*-- OJO: Esta se analiza primero a propósito, solo porque no puede estar detrás de PROTECTED y HIDDEN + Store .T. To llCLASSCOMMENTS_Completed ; + , llCLASS_PROPERTY_Completed ; + , llPROTECTED_Completed ; + , llHIDDEN_Completed ; + , llINCLUDE_Completed ; + , llCLASSMETADATA_Completed ; + , llOBJECTMETADATA_Completed ; + , llDEFINED_PAM_Completed + + + Case Not llPROTECTED_Completed And .analyzeCodeBlock_PROTECTED( @toClase, @tcLine ) + llPROTECTED_Completed = .T. + + + Case Not llHIDDEN_Completed And .analyzeCodeBlock_HIDDEN( @toClase, @tcLine ) + llHIDDEN_Completed = .T. + + + Case Not llINCLUDE_Completed And .c_Type <> "SCX" And .analyzeCodeBlock_INCLUDE( @toModulo, @toClase, @tcLine, @taCodeLines ; + , @m.I, @tnCodeLines, @tcProcedureAbierto ) + llINCLUDE_Completed = .T. + + + Case Not llCLASSCOMMENTS_Completed And .analyzeCodeBlock_CLASSCOMMENTS( @toClase, @tcLine ,@taCodeLines, tnCodeLines, @m.I ) + llCLASSCOMMENTS_Completed = .T. + + + Case Not llCLASSMETADATA_Completed And .analyzeCodeBlock_CLASSMETADATA( @toClase, @tcLine ) + llCLASSMETADATA_Completed = .T. + + + Case Not llOBJECTMETADATA_Completed And .analyzeCodeBlock_OBJECTMETADATA( @toClase, @tcLine ) +* No se usa flag porque puede haber múltiples ObjectMetadata. + + + Case Not llDEFINED_PAM_Completed And .analyzeCodeBlock_DEFINED_PAM( @toClase, @tcLine, @taCodeLines, tnCodeLines, @m.I ) + llDEFINED_PAM_Completed = .T. + + Case Not llCLASS_PROPERTY_Completed And .analyzeCodeBlock_DEFINED_PROPVAL( @toClase, @tcLine, @taCodeLines, tnCodeLines, @m.I ) + llCLASS_PROPERTY_Completed = .T. + + + Case .analyzeCodeBlock_ADD_OBJECT( @toModulo, @toClase, @tcLine, @m.I, @taCodeLines, @tnCodeLines, @toFoxBin2Prg ) + Store .T. To llCLASSCOMMENTS_Completed ; + , llCLASS_PROPERTY_Completed ; + , llPROTECTED_Completed ; + , llHIDDEN_Completed ; + , llINCLUDE_Completed ; + , llCLASSMETADATA_Completed ; + , llOBJECTMETADATA_Completed ; + , llDEFINED_PAM_Completed + + + Case .analyzeCodeBlock_ENDDEFINE( @toClase, @tcLine, @m.I, @tcProcedureAbierto ) + Exit + + + Case Not llCLASS_PROPERTY_Completed And Empty( toClase._Fin_Cab ) +*-- Propiedades de la CLASE +*-- +*-- NOTA: Las propiedades se agregan tal cual, incluso aunque estén separadas en +*-- varias líneas (memberdata y fb2p_value), ya que luego se ensamblan en classProps2Memo(). +* + .get_SeparatedPropAndValue( tcLine, @lcProp, @lcValue, @toClase, @taCodeLines, tnCodeLines, @m.I ) + toClase.add_Property( @lcProp, @lcValue, Rtrim(tc_Comentario) ) + + + Otherwise +*-- Las líneas que pasan por aquí deberían estar vacías y ser de relleno del embellecimiento + + Endcase + + Endfor + +*-- Validación + If Empty( toClase._Fin ) +*ERROR 'No se ha encontrado el marcador de fin [ENDDEFINE] ' ; ++ 'que cierra al marcador de inicio [DEFINE CLASS] ' ; ++ 'de la línea ' + TRANSFORM( toClase._Inicio ) + ' ' ; ++ 'para el identificador [' + toClase._Nombre + ']' + Error (Textmerge(loLang.C_ENDDEFINE_MARKER_NOT_FOUND_LOC)) + Endif + + toClase._PROPERTIES = .classProps2Memo( @toClase, @toFoxBin2Prg ) + toClase._PROTECTED = .hiddenAndProtected_PAM( @toClase ) + toClase._METHODS = .classMethods2Memo( @toClase ) + toClase._RESERVED1 = Iif( .c_Type = 'SCX', '', 'Class' ) + toClase._RESERVED2 = Iif( .c_Type = 'VCX' Or Proper(toClase._Class) == 'Dataenvironment', Transform( toClase._AddObject_Count + 1 ), '' ) + toClase._RESERVED3 = .defined_PAM2Memo( @toClase ) + toClase._RESERVED4 = toClase._ClassIcon + toClase._RESERVED5 = toClase._ProjectClassIcon + toClase._RESERVED6 = toClase._Scale + toClase._RESERVED7 = toClase._Comentario + toClase._RESERVED8 = toClase._includeFile + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toModulo, toClase, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto ; + , taLineasExclusion, tnBloquesExclusion, tc_Comentario, Z, lcProp, lcValue, loEx ; + , llCLASSMETADATA_Completed, llPROTECTED_Completed, llHIDDEN_Completed, llDEFINED_PAM_Completed ; + , llINCLUDE_Completed, llCLASS_PROPERTY_Completed, llOBJECTMETADATA_Completed ; + , llCLASSCOMMENTS_Completed, loObjeto + Endtry + Endif + + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_ENDDEFINE + Lparameters toClase, tcLine, I, tcProcedureAbierto + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + If Upper( Left( tcLine + ' ', 10 ) ) == C_ENDDEFINE + ' ' && Fin de bloque (ENDDEF / ENDPROC) encontrado + llBloqueEncontrado = .T. + toClase._Fin = m.I + + If Empty( toClase._Ini_Cuerpo ) + toClase._Ini_Cuerpo = m.I-1 + Endif + + toClase._Fin_Cuerpo = m.I-1 + + If Empty( toClase._Fin_Cab ) + toClase._Fin_Cab = m.I-1 + Endif + + Store '' To tcProcedureAbierto + Endif + + Release toClase, tcLine, I, tcProcedureAbierto + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_HIDDEN + Lparameters toClase, tcLine + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + If Upper(Left(tcLine, 7)) == 'HIDDEN ' + llBloqueEncontrado = .T. +* LScheffler 20221201. reset to original state of #87 +*t-zuidema, 2022/11/25 +*old + toClase._HiddenProps = Lower( Alltrim( Substr( tcLine, 8 ) ) ) +*new of t-zuidema +* toClase._HiddenProps = Alltrim( Substr( tcLine, 8 ) ) +*/t-zuidema, 2022/11/25 +*/LScheffler 20221201 + Endif + + Release toClase, tcLine + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_INCLUDE + Lparameters toModulo, toClase, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto + Local llBloqueEncontrado + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + If Upper(Left(tcLine, 9)) == '#INCLUDE ' + llBloqueEncontrado = .T. + If This.c_Type = 'SCX' + toModulo._includeFile = Lower( Alltrim( Chrtran( Substr( tcLine, 10 ), ["'], [] ) ) ) + Else + toClase._includeFile = Lower( Alltrim( Chrtran( Substr( tcLine, 10 ), ["'], [] ) ) ) + Endif + Endif + + Release toModulo, toClase, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_CLASSCOMMENTS + Lparameters toClase, tcLine ,taCodeLines, tnCodeLines, I + + External Array taCodeLines + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado + + If Left( tcLine, C_LEN_CLASSCOMMENTS_I ) == C_CLASSCOMMENTS_I + llBloqueEncontrado = .T. + toClase._Comentario = '' + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case Left( tcLine, C_LEN_CLASSCOMMENTS_F ) == C_CLASSCOMMENTS_F + I = m.I + 1 + Exit + + Otherwise + toClase._Comentario = toClase._Comentario + CR_LF + Substr( tcLine, 2 ) && Le quito el '*' inicial + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + + If Not Empty(toClase._Comentario) + toClase._Comentario = Substr( toClase._Comentario, 3 ) + CR_LF && Quito el primer CR+LF + Endif + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toClase, tcLine ,taCodeLines, tnCodeLines, I + Endtry + + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_CLASSMETADATA + Lparameters toClase, tcLine + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + If Upper(Left(tcLine, C_LEN_CLASSDATA_I)) == C_CLASSDATA_I && METADATA de la CLASE +*< CLASSDATA: Baseclass="custom" Timestamp="2013/11/19 11:51:04" Scale="Foxels" Uniqueid="_3WF0VSTN1" ProjectClassIcon="container.ico" ClassIcon="toolbar.ico" /> + Local laPropsAndValues(1,2), lnPropsAndValues_Count + llBloqueEncontrado = .T. + With This + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @tcLine, @laPropsAndValues, @lnPropsAndValues_Count, C_CLASSDATA_I, C_CLASSDATA_F ) + + toClase._BaseClass = .get_ValueByName_FromListNamesWithValues( 'BaseClass', 'C', @laPropsAndValues ) + toClase._TimeStamp = Int( .rowTimeStamp( .get_ValueByName_FromListNamesWithValues( 'TimeStamp', 'T', @laPropsAndValues ) ) ) + toClase._Scale = .get_ValueByName_FromListNamesWithValues( 'Scale', 'C', @laPropsAndValues ) + toClase._UniqueID = .get_ValueByName_FromListNamesWithValues( 'UniqueID', 'C', @laPropsAndValues ) + toClase._ProjectClassIcon = .get_ValueByName_FromListNamesWithValues( 'ProjectClassIcon', 'C', @laPropsAndValues ) + toClase._ClassIcon = .get_ValueByName_FromListNamesWithValues( 'ClassIcon', 'C', @laPropsAndValues ) + toClase._Ole2 = .get_ValueByName_FromListNamesWithValues( 'OLEObject', 'C', @laPropsAndValues ) + If Empty(toClase._Ole) + toClase._Ole = Strconv( .get_ValueByName_FromListNamesWithValues( 'Value', 'C', @laPropsAndValues ), 14 ) + Endif + Endwith && THIS + + If Not Empty( toClase._Ole2 ) && Le agrego "OLEObject = " delante + toClase._Ole2 = 'OLEObject = ' + toClase._Ole2 + CR_LF + Endif + Endif + + Release toClase, tcLine, laPropsAndValues, lnPropsAndValues_Count + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_EXTERNAL_CLASS +*------------------------------------------------------ +*-- Analiza el bloque *< EXTERNAL_CLASS: Name="nombre-clase" Baseclass="clase-base" /> +*------------------------------------------------------ + Lparameters toModulo, tcLine, taCodeLines, I, tnCodeLines + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + If Upper(Left(tcLine, C_LEN_EXTERNAL_CLASS_I)) == C_EXTERNAL_CLASS_I + Local laPropsAndValues(1,2), lnPropsAndValues_Count + llBloqueEncontrado = .T. + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @tcLine, @laPropsAndValues, @lnPropsAndValues_Count, C_EXTERNAL_CLASS_I, C_EXTERNAL_CLASS_F ) + + toModulo._ExternalClasses_Count = toModulo._ExternalClasses_Count + 1 + Dimension toModulo._ExternalClasses( toModulo._ExternalClasses_Count, 2 ) + toModulo._ExternalClasses( toModulo._ExternalClasses_Count, 1 ) = .get_ValueByName_FromListNamesWithValues( 'Name', 'C', @laPropsAndValues ) + toModulo._ExternalClasses( toModulo._ExternalClasses_Count, 2 ) = .get_ValueByName_FromListNamesWithValues( 'Baseclass', 'C', @laPropsAndValues ) ; + + '.' + toModulo._ExternalClasses( toModulo._ExternalClasses_Count, 1 ) + Endwith && THIS + Endif + + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_EXTERNAL_MEMBER +*------------------------------------------------------ +*-- Analiza el bloque *< EXTERNAL_MEMBER: Name="nombre-miembro" Type="tipo-de-miembro" /> +*------------------------------------------------------ + Lparameters toDatabase, tcLine, taCodeLines, I, tnCodeLines + + #If .F. + Local toDatabase As CL_DBC Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + If Upper(Left(tcLine, C_LEN_EXTERNAL_MEMBER_I)) == C_EXTERNAL_MEMBER_I + Local laPropsAndValues(1,2), lnPropsAndValues_Count + llBloqueEncontrado = .T. + + With This + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @tcLine, @laPropsAndValues, @lnPropsAndValues_Count, C_EXTERNAL_MEMBER_I, C_EXTERNAL_MEMBER_F ) + + toDatabase._ExternalClasses_Count = toDatabase._ExternalClasses_Count + 1 + Dimension toDatabase._ExternalClasses( toDatabase._ExternalClasses_Count, 2 ) + toDatabase._ExternalClasses( toDatabase._ExternalClasses_Count, 1 ) = .get_ValueByName_FromListNamesWithValues( 'Type', 'C', @laPropsAndValues ) ; + + '.' + .get_ValueByName_FromListNamesWithValues( 'Name', 'C', @laPropsAndValues ) +*toDatabase._ExternalClasses( toDatabase._ExternalClasses_Count, 2 ) = .get_ValueByName_FromListNamesWithValues( 'Type', 'C', @laPropsAndValues ) + Endwith && THIS + Endif + + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_OBJECTMETADATA + Lparameters toClase, tcLine + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + If Upper(Left(tcLine, C_LEN_OBJECTDATA_I)) == C_OBJECTDATA_I && METADATA del ADD OBJECT +*< OBJECTDATA: ObjName="txtValor" Timestamp="2013/11/19 11:51:04" Uniqueid="_3WF0VSTN1" /> + Local laPropsAndValues(1,2), lnPropsAndValues_Count, loObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + llBloqueEncontrado = .T. + toClase.l_ObjectMetadataInHeader = .T. + + loObjeto = Null + loObjeto = Createobject('CL_OBJETO') + toClase.add_Object( loObjeto ) + + With This + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @tcLine, @laPropsAndValues, @lnPropsAndValues_Count, C_OBJECTDATA_I, C_OBJECTDATA_F ) + loObjeto._Nombre = .get_ValueByName_FromListNamesWithValues( 'ObjPath', 'C', @laPropsAndValues ) + loObjeto._TimeStamp = Int( .rowTimeStamp( .get_ValueByName_FromListNamesWithValues( 'TimeStamp', 'T', @laPropsAndValues ) ) ) + loObjeto._UniqueID = .get_ValueByName_FromListNamesWithValues( 'UniqueID', 'C', @laPropsAndValues ) + Endwith && THIS + + loObjeto = Null + Release toClase, tcLine, laPropsAndValues, lnPropsAndValues_Count, loObjeto + Endif + + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_OLE_DEF + Lparameters toModulo, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto + Local llBloqueEncontrado + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + #Endif + + If Left( tcLine + ' ', C_LEN_OLE_I + 1 ) == C_OLE_I + ' ' + llBloqueEncontrado = .T. +*-- Se encontró una definición de objeto OLE +*< OLE: Nombre="frm_d.ole_ImageControl2" parent="frm_d" objname="ole_ImageControl2" checksum="4171274922" value="b64-value" /> + Local laPropsAndValues(1,2), lnPropsAndValues_Count ; + , loOle As CL_OLE Of 'FOXBIN2PRG.PRG' + loOle = Null + loOle = Createobject('CL_OLE') + + With This + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @tcLine, @laPropsAndValues, @lnPropsAndValues_Count, C_OLE_I, C_OLE_F ) + + loOle._Nombre = .get_ValueByName_FromListNamesWithValues( 'Nombre', 'C', @laPropsAndValues ) + loOle._Parent = .get_ValueByName_FromListNamesWithValues( 'Parent', 'C', @laPropsAndValues ) + loOle._ObjName = .get_ValueByName_FromListNamesWithValues( 'ObjName', 'C', @laPropsAndValues ) + loOle._CheckSum = .get_ValueByName_FromListNamesWithValues( 'CheckSum', 'C', @laPropsAndValues ) + loOle._Value = Strconv( .get_ValueByName_FromListNamesWithValues( 'Value', 'C', @laPropsAndValues ), 14 ) + Endwith + + toModulo.add_OLE( loOle ) + + If Empty( loOle._Value ) +*-- Si el objeto OLE no tiene VALUE, es porque hay otro con el mismo contenido y no se duplicó para preservar espacio. +*-- Busco el VALUE del duplicado que se guardó y lo asigno nuevamente + For Z = 1 To toModulo._Ole_Obj_count - 1 + If toModulo._Ole_Objs(m.Z)._CheckSum == loOle._CheckSum And Not Empty( toModulo._Ole_Objs(m.Z)._Value ) + loOle._Value = toModulo._Ole_Objs(m.Z)._Value + Exit + Endif + Endfor + Endif + + loOle = Null + Release loOle, laPropsAndValues, lnPropsAndValues_Count + Endif + + Release toModulo, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_PROCEDURE + Lparameters toModulo, toClase, toObjeto, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto ; + , tc_Comentario, taLineasExclusion, tnBloquesExclusion + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + Do Case + Case Upper( Left( tcLine, 20 ) ) == 'PROTECTED PROCEDURE ' +*-- Estructura a reconocer: PROTECTED PROCEDURE nombre_del_procedimiento + llBloqueEncontrado = .T. + tcProcedureAbierto = Alltrim( Substr( tcLine, 21 ) ) + .getClassMethodComment( @tcProcedureAbierto, @tc_Comentario ) + .evaluateProcedureDefinition( @toClase, m.I, @tc_Comentario, tcProcedureAbierto, 'protected', @toObjeto ) + + + Case Upper( Left( tcLine, 17 ) ) == 'HIDDEN PROCEDURE ' +*-- Estructura a reconocer: HIDDEN PROCEDURE nombre_del_procedimiento + llBloqueEncontrado = .T. + tcProcedureAbierto = Alltrim( Substr( tcLine, 18 ) ) + .getClassMethodComment( @tcProcedureAbierto, @tc_Comentario ) + .evaluateProcedureDefinition( @toClase, m.I, @tc_Comentario, tcProcedureAbierto, 'hidden', @toObjeto ) + + Case Upper( Left( tcLine, 10 ) ) == 'PROCEDURE ' +*-- Estructura a reconocer: PROCEDURE [objeto.]nombre_del_procedimiento + llBloqueEncontrado = .T. + tcProcedureAbierto = Alltrim( Substr( tcLine, 11 ) ) + .getClassMethodComment( @tcProcedureAbierto, @tc_Comentario ) + .evaluateProcedureDefinition( @toClase, m.I, @tc_Comentario, tcProcedureAbierto, 'normal', @toObjeto ) + + Case Upper( Left( tcLine, 19 ) ) == 'PROTECTED FUNCTION ' +*-- Estructura a reconocer: PROTECTED PROCEDURE nombre_del_procedimiento + llBloqueEncontrado = .T. + tcProcedureAbierto = Alltrim( Substr( tcLine, 20 ) ) + .getClassMethodComment( @tcProcedureAbierto, @tc_Comentario ) + .evaluateProcedureDefinition( @toClase, m.I, @tc_Comentario, tcProcedureAbierto, 'protected', @toObjeto ) + + + Case Upper( Left( tcLine, 16 ) ) == 'HIDDEN FUNCTION ' +*-- Estructura a reconocer: HIDDEN FUNCTION nombre_del_procedimiento + llBloqueEncontrado = .T. + tcProcedureAbierto = Alltrim( Substr( tcLine, 17 ) ) + .getClassMethodComment( @tcProcedureAbierto, @tc_Comentario ) + .evaluateProcedureDefinition( @toClase, m.I, @tc_Comentario, tcProcedureAbierto, 'hidden', @toObjeto ) + + Case Upper( Left( tcLine, 9 ) ) == 'FUNCTION ' +*-- Estructura a reconocer: FUNCTION [objeto.]nombre_del_procedimiento + llBloqueEncontrado = .T. + tcProcedureAbierto = Alltrim( Substr( tcLine, 10 ) ) + .getClassMethodComment( @tcProcedureAbierto, @tc_Comentario ) + .evaluateProcedureDefinition( @toClase, m.I, @tc_Comentario, tcProcedureAbierto, 'normal', @toObjeto ) + + Endcase + + If llBloqueEncontrado +*-- Evalúo todo el contenido del PROCEDURE + .updateProgressbar( 'Analyzing Procedure ' + toClase._Nombre + '.' + tcProcedureAbierto + '...', m.I, tnCodeLines, 1 ) + .analyzeProcedureLines( @toClase, @toObjeto, @tcLine, @taCodeLines, @m.I, @tnCodeLines, @tcProcedureAbierto ; + , @tc_Comentario, @taLineasExclusion, @tnBloquesExclusion ) + Endif + Endwith + + Release toModulo, toClase, toObjeto, tcLine, taCodeLines, I, tnCodeLines, tcProcedureAbierto ; + , tc_Comentario, taLineasExclusion, tnBloquesExclusion + Return llBloqueEncontrado + Endproc + + + + + Procedure analyzeCodeBlock_PROTECTED + Lparameters toClase, tcLine + + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + #Endif + + Local llBloqueEncontrado + + If Upper(Left(tcLine, 10)) == 'PROTECTED ' + llBloqueEncontrado = .T. + toClase._ProtectedProps = Lower( Alltrim( Substr( tcLine, 11 ) ) ) + Endif + + Release toClase, tcLine + Return llBloqueEncontrado + Endproc + + + + + Procedure evaluateProcedureDefinition + Lparameters toClase, I, tc_Comentario, tcProcName, tcProcType, toObjeto +*-------------------------------------------------------------------------------------------------------------- + #If .F. + Local toClase As CL_CLASE Of 'FOXBIN2PRG.PRG' ; + , toObjeto As CL_OBJETO Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lcNombreObjeto, lnObjProc ; + , loProcedure As CL_PROCEDURE Of 'FOXBIN2PRG.PRG' + + If Empty(toClase._Fin_Cab) + toClase._Fin_Cab = m.I-1 + toClase._Ini_Cuerpo = m.I + Endif + + loProcedure = Null + loProcedure = Createobject("CL_PROCEDURE") + loProcedure._Nombre = tcProcName + loProcedure._ProcType = tcProcType + loProcedure._Comentario = tc_Comentario + loProcedure._Inicio = m.I + +*-- Anoto en HiddenMethods y ProtectedMethods según corresponda + Do Case + Case loProcedure._ProcType == 'hidden' + toClase._HiddenMethods = toClase._HiddenMethods + ',' + tcProcName + + Case loProcedure._ProcType == 'protected' + toClase._ProtectedMethods = toClase._ProtectedMethods + ',' + tcProcName + + Endcase + +*-- Agrego el objeto Procedimiento a la clase, o a un objeto de la clase. + If '.' $ tcProcName +*-- Procedimiento de objeto + lcNombreObjeto = Lower( Juststem( tcProcName ) ) + +*-- Busco el objeto al que corresponde el método + lnObjProc = This.findMethodsObjectByName( lcNombreObjeto, toClase ) + + If lnObjProc = 0 +*-- Procedimiento de clase + toClase.add_Procedure( loProcedure ) + toObjeto = Null + Else +*-- Procedimiento de objeto + toObjeto = toClase._AddObjects( lnObjProc ) + toObjeto.add_Procedure( loProcedure ) + +*-- Paso el log de errores + If Not Empty(toObjeto.c_TextErr) Then + toClase.writeErrorLog(toObjeto.c_TextErr) + toObjeto.c_TextErr = '' + Endif + Endif + Else +*-- Procedimiento de clase + toClase.add_Procedure( loProcedure ) + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loProcedure + Release loProcedure, I, lcNombreObjeto, lnObjProc ; + , toClase, tc_Comentario, tcProcName, tcProcType, toObjeto + Endtry + + Return + Endproc + + + + + Procedure identifyCodeBlocks +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (@! IN ) El array con las líneas del código donde buscar +* tnCodeLines (@! IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@! IN ) Cantidad de bloques de exclusión +* toModulo (@? OUT) Objeto con toda la información del módulo analizado +* toFoxBin2Prg (@? IN ) Referencia al objeto principal +* +* NOTA: +* Como identificador se usa el nombre de clase o de procedimiento, según corresponda. +*-------------------------------------------------------------------------------------------------------------- + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toModulo, toFoxBin2Prg + + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, loEx As Exception ; + , llFoxBin2Prg_Completed, llOLE_DEF_Completed, llINCLUDE_SCX_Completed, llLIBCOMMENT_Completed, llEXTERNAL_CLASS_Completed ; + , lc_Comentario, lcProcedureAbierto, lcLine ; + , loClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + Store '' To lcProcedureAbierto + + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + +*-- Búsqueda del ID de inicio de bloque (DEFINE CLASS / PROCEDURE) + For I = 1 To tnCodeLines + Store '' To lc_Comentario + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .excludedLine( m.I, tnBloquesExclusion, @taLineasExclusion ) ; + OR .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Excluida, vacía o solo Comentarios + + Case .analyzeCodeBlock_DEFINE_CLASS( @toModulo, @loClase, @lcLine, @taCodeLines, @m.I, tnCodeLines ; + , @lcProcedureAbierto, @taLineasExclusion, @tnBloquesExclusion, @lc_Comentario, @toFoxBin2Prg ) +*-- Puede haber varias clases definidas +* llEXTERNAL_CLASS_Completed = .T. + +*-- Logueo los errores + If Not Empty(loClase.c_TextErr) Then + .writeErrorLog( loClase.c_TextErr ) + Endif + Endcase + + Endfor + + .verify_EXTERNAL_CLASSES( @toModulo, @toFoxBin2Prg ) + + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loClase + Release loClase, I ; + , llFoxBin2Prg_Completed, llOLE_DEF_Completed, llINCLUDE_SCX_Completed, llLIBCOMMENT_Completed ; + , lc_Comentario, lcProcedureAbierto, lcLine + Endtry + + Return + Endproc + + + + Procedure identifyHeaderBlocks +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (@! IN ) El array con las líneas del código donde buscar +* tnCodeLines (@! IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@! IN ) Cantidad de bloques de exclusión +* toModulo (@? OUT) Objeto con toda la información del módulo analizado +* toFoxBin2Prg (@? IN ) Referencia al objeto principal +* +* NOTA: +* Como identificador se usa el nombre de clase o de procedimiento, según corresponda. +*-------------------------------------------------------------------------------------------------------------- + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toModulo, toFoxBin2Prg + + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, loEx As Exception ; + , llFoxBin2Prg_Completed, llOLE_DEF_Completed, llINCLUDE_SCX_Completed, llLIBCOMMENT_Completed, llEXTERNAL_CLASS_Completed ; + , lc_Comentario, lcProcedureAbierto, lcLine ; + , loClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + Store '' To lcProcedureAbierto + + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + + If toFoxBin2Prg.n_UseClassPerFile > 0 And toFoxBin2Prg.l_RedirectClassPerFileToMain + Else + llEXTERNAL_CLASS_Completed = .T. + Endif + +*-- Búsqueda del ID de inicio de bloque (DEFINE CLASS / PROCEDURE) + For I = 1 To tnCodeLines + Store '' To lc_Comentario + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Excluida, vacía o solo Comentarios + + Case Not llFoxBin2Prg_Completed And .analyzeCodeBlock_FoxBin2Prg( @toModulo, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFoxBin2Prg_Completed = .T. + + Case Not llEXTERNAL_CLASS_Completed And .analyzeCodeBlock_EXTERNAL_CLASS( @toModulo, @lcLine, @taCodeLines, @m.I, tnCodeLines ) +*-- Puede haber varias clases externas + + Case Not llLIBCOMMENT_Completed And .analyzeCodeBlock_LIBCOMMENT( @toModulo, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llLIBCOMMENT_Completed = .T. + llEXTERNAL_CLASS_Completed = .T. + + Case Not llOLE_DEF_Completed And .analyzeCodeBlock_OLE_DEF( @toModulo, @lcLine, @taCodeLines ; + , @m.I, tnCodeLines, @lcProcedureAbierto ) +*-- Puede haber varios objetos OLE + + Case Not llINCLUDE_SCX_Completed And .c_Type = 'SCX' And .analyzeCodeBlock_INCLUDE( @toModulo, @loClase, @lcLine ; + , @taCodeLines, @m.I, tnCodeLines, @lcProcedureAbierto ) +* Específico para SCX que lo tiene al inicio + llINCLUDE_SCX_Completed = .T. + llEXTERNAL_CLASS_Completed = .T. + + Endcase + + Endfor + + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loClase + Release taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toModulo, loClase, I ; + , llFoxBin2Prg_Completed, llOLE_DEF_Completed, llINCLUDE_SCX_Completed, llLIBCOMMENT_Completed ; + , lc_Comentario, lcProcedureAbierto, lcLine + Endtry + + Return + Endproc + + + + + Procedure verify_EXTERNAL_CLASSES +*-------------------------------------------------------------------------------- +*-- Compara las clases definidas en la cabecera con las clases encontradas luego +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (@? OUT) Objeto con toda la información del módulo analizado +* toFoxBin2Prg (@? IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- + Lparameters toModulo, toFoxBin2Prg + + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Local lnItem, I, X, lcClaseExterna + Local loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + +*-- Verificación de las Clases, si son Externas y se indicó chequearlas + Do Case + Case toFoxBin2Prg.n_UseClassPerFile = 1 And toFoxBin2Prg.l_ClassPerFileCheck And Empty(toFoxBin2Prg.c_ClassOperationType) +*-- El ClassPerFile original, con nomenclatura 'Libreria.NombreClase.vc2' + For I = 1 To toModulo._ExternalClasses_Count + lnItem = 0 + + For X = 1 To toModulo._Clases_Count + If Lower( toModulo._Clases(m.X)._ObjName ) == Lower( toModulo._ExternalClasses(m.I,1) ) + lnItem = m.X + Exit + Endif + Endfor + + If lnItem = 0 Then + lcClaseExterna = Forcepath( Juststem(toFoxBin2Prg.c_InputFile) + '.' + toModulo._ExternalClasses(m.I,1) + '.' + Justext(toFoxBin2Prg.c_InputFile), Justpath(toFoxBin2Prg.c_InputFile) ) +*ERROR 'No se ha encontrado la clase externa [' + toModulo._ExternalClasses(m.I,1) + '] en el archivo [' + toFoxBin2Prg.c_InputFile + ']' + Error ( loLang.C_EXTERNAL_CLASS_NAME_WAS_NOT_FOUND_LOC + ' [' + lcClaseExterna + ']' ) + Endif + + toModulo._Clases(lnItem)._Checked = .T. + Endfor + + Case toFoxBin2Prg.n_UseClassPerFile = 2 And toFoxBin2Prg.l_ClassPerFileCheck And Empty(toFoxBin2Prg.c_ClassOperationType) +*-- El nuevo ClassPerFile, con nomenclatura 'Libreria.ClaseBase.NombreClase.vc2' + For I = 1 To toModulo._ExternalClasses_Count + lnItem = 0 + + For X = 1 To toModulo._Clases_Count + If Lower( toModulo._Clases(m.X)._BaseClass + '.' + toModulo._Clases(m.X)._ObjName ) == Lower( toModulo._ExternalClasses(m.I,2) ) + lnItem = m.X + Exit + Endif + Endfor + + If lnItem = 0 Then + lcClaseExterna = Forcepath( Juststem(toFoxBin2Prg.c_InputFile) + '.' + toModulo._ExternalClasses(m.I,1) + '.' + Justext(toFoxBin2Prg.c_InputFile), Justpath(toFoxBin2Prg.c_InputFile) ) +*ERROR 'No se ha encontrado la clase externa [' + toModulo._ExternalClasses(m.I,1) + '] en el archivo [' + toFoxBin2Prg.c_InputFile + ']' + Error ( loLang.C_EXTERNAL_CLASS_NAME_WAS_NOT_FOUND_LOC + ' [' + lcClaseExterna + ']' ) + Endif + + toModulo._Clases(lnItem)._Checked = .T. + Endfor + + Endcase + Endproc + + + +Enddefine + + + + +Define Class c_conversor_prg_a_vcx As c_conversor_prg_a_bin + #If .F. + Local This As c_conversor_prg_a_vcx Of 'FOXBIN2PRG.PRG' + #Endif +*_MEMBERDATA = [] ; ++ [] ; ++ [] + c_Type = 'VC2' + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (@! OUT) Objeto generado de clase CL_CLASSLIB con la información leida del texto +* toEx (@! OUT) Objeto con información del error +* toFoxBin2Prg (@? IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toModulo, toEx As Exception, toFoxBin2Prg + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + DoDefault( @toModulo, @toEx, @toFoxBin2Prg ) + + Try + Local lnCodError, laCodeLines(1), lnCodeLines, lcInputFile, lcInputFile_Class, lnFileCount, laFiles(1,5) ; + , laLineasExclusion(1), lnBloquesExclusion, I, lcClassName, lnIDInputFile, llReplaceClass, lnRow ; + , loClase As CL_CLASE Of 'FOXBIN2PRG.PRG' ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + Local; + lnDots As Number + + With This As c_conversor_prg_a_vcx Of 'FOXBIN2PRG.PRG' + Store 0 To lnCodError, lnCodeLines + Store '' To C_FB2PRG_CODE, lcClassName + Store Null To toModulo + + loLang = _Screen.o_FoxBin2Prg_Lang + toModulo = Createobject('CL_CLASSLIB') + lnIDInputFile = toFoxBin2Prg.n_ProcessedFiles + + If toFoxBin2Prg.n_UseClassPerFile > 0 And toFoxBin2Prg.l_RedirectClassPerFileToMain ; + AND Empty(toFoxBin2Prg.c_ClassToConvert) + + If toFoxBin2Prg.n_RedirectClassType = 0 && Redireccionar todas las clases + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + .updateProgressbar( 'Identifying Header Blocks...', 1, lnCodeLines, 1 ) + .identifyHeaderBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toModulo, @toFoxBin2Prg ) + + .updateProgressbar( 'Loading Code...', 2, lnCodeLines, 1 ) + Endif + +*-- MÁSCARA DE BÚSQUEDA + If toFoxBin2Prg.n_UseClassPerFile = 1 Then +*-- Esto crea la máscara de búsqueda "filename.*.ext" para encontrar las partes +*-- con la sintaxis "Classlib.Classname.ext" o "Database.MemberName.ext" + lcBaseFilename = Juststem( Juststem(.c_InputFile) ) + lcInputFile = Addbs( Justpath(.c_InputFile) ) + lcBaseFilename + '.*.' + Justext(.c_InputFile) + Else && toFoxBin2Prg.n_UseClassPerFile = 2 +*-- Esto crea la máscara de búsqueda "filename.*.*.ext" para encontrar las partes +*-- con la sintaxis "Classlib.ClassType.Classname.ext" o "Database.MemberType.MemberName.ext" + lcBaseFilename = Juststem( Juststem( Juststem(.c_InputFile) ) ) + lcInputFile = Addbs( Justpath(.c_InputFile) ) + lcBaseFilename + '.*.*.' + Justext(.c_InputFile) + Endif + + If toFoxBin2Prg.n_RedirectClassType = 1 && Redireccionar solo esta clase + lcInputFile = .c_InputFile + Endif + +*!* Changed by: LScheffler 15.2.2021 +*!* change date="{^2021-02-15,16:09:00}" +* problem with classes declared in multiple files, looks like merge problem of git +* creates multiple classes in VCX +* the problem is ADIR(laFiles,Name+".*.ext") will return files with AT LEAST 2 dots +* so we simply remove files with to many dots + lnDots = Occurs('.',m.lcInputFile) + + lnFileCount = Adir( laFiles, lcInputFile, "", 1 ) + + If lnFileCount > 1 + For I = m.lnFileCount To 1 Step -1 + If Occurs('.',laFiles(I,1))>m.lnDots Then + Adel(laFiles,I) + lnFileCount = m.lnFileCount-1 + Endif &&OCCURS('.',laFiles(i,1))>m.lnDots + Next + Dimension; + laFiles(Evl(lnFileCount,1),Alen(laFiles,2)) +*!* /Changed by: LScheffler 15.2.2021 + + Asort( laFiles, 1, 0, 0, 1) + Endif + + For I = 1 To lnFileCount + If toFoxBin2Prg.n_UseClassPerFile = 1 Then + lcInputFile_Class = Forcepath( Juststem( laFiles(m.I,1) ), Justpath( .c_InputFile ) ) + '.' + Justext( .c_InputFile ) + lcClassName = Lower( Getwordnum( Justfname( lcInputFile_Class ), 2, '.' ) ) + +*-- Verificación de las Clases, si son Externas y se indicó chequearlas + If toFoxBin2Prg.l_ClassPerFileCheck And Empty(toFoxBin2Prg.c_ClassOperationType) ; + AND Ascan( toModulo._ExternalClasses , lcClassName, 1, 0, 1, 1+2+4 ) = 0 + .writeLog( C_TAB + '- ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + .writeErrorLog( C_TAB + '- ' + loLang.C_WARNING_LOC + ' ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + Loop && Salteo esta clase porque se indicó chequear y no concuerda con las anotadas + Endif + Else && toFoxBin2Prg.n_UseClassPerFile = 2 + lcInputFile_Class = Forcepath( Juststem( laFiles(m.I,1) ), Justpath( .c_InputFile ) ) + '.' + Justext( .c_InputFile ) + lcClassName = Lower( Getwordnum( Justfname( lcInputFile_Class ), 2, '.' ) + '.' + Getwordnum( Justfname( lcInputFile_Class ), 3, '.' ) ) + +*-- Verificación de las Clases, si son Externas y se indicó chequearlas + If toFoxBin2Prg.l_ClassPerFileCheck And Empty(toFoxBin2Prg.c_ClassOperationType) ; + AND Ascan( toModulo._ExternalClasses , lcClassName, 1, 0, 2, 1+2+4 ) = 0 + .writeLog( C_TAB + '- ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + .writeErrorLog( C_TAB + '- ' + loLang.C_WARNING_LOC + ' ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + Loop && Salteo esta clase porque se indicó chequear y no concuerda con las anotadas + Endif + Endif + + .writeLog( C_TAB + C_TAB + '+ ' + loLang.C_INCLUDING_CLASS_LOC + ' ' + Justfname( lcInputFile_Class ) ) + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( lcInputFile_Class, 'I', 'P1', 'E0', 'S1', 'X1' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + If toFoxBin2Prg.l_ProcessFiles Then + toFoxBin2Prg.normalizeFileCapitalization( .T., lcInputFile_Class ) + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + Filetostr( lcInputFile_Class ) + Endif + Endfor + + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + Else +*-- No es clase por archivo, o no se quiere redireccionar a Main, o se usó +*-- la sintaxis "classlib.vcx::classname::import" + If toFoxBin2Prg.l_ProcessFiles Then + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + .updateProgressbar( 'Identifying Header Blocks...', 1, lnCodeLines, 1 ) + .identifyHeaderBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toModulo, @toFoxBin2Prg ) + Endif + + Endif + + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + +*-- Identifico los TEXT/ENDTEXT, #IF .F./#ENDIF + .updateProgressbar( 'Identifying Excluded Blocks...', 3, lnCodeLines, 1 ) + .identifyExclusionBlocks( @laCodeLines, lnCodeLines, .F., @laLineasExclusion, @lnBloquesExclusion ) + +*-- Identifico el inicio/fin de bloque, definición, cabecera y cuerpo de cada clase + .identifyCodeBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toModulo, @toFoxBin2Prg ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I1' + Error 'InputFile Error Simulation' + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I0' + .writeErrorLog( '*** SIMULATED ERROR' ) + Endcase + + If .l_Error + .writeLog( '*** ERRORS found - Generation Cancelled' ) + Exit + Endif + + toFoxBin2Prg.updateProcessedFile( lnIDInputFile ) + .updateProgressbar( loLang.C_GENERATING_BINARY_LOC + '...', 0, lnCodeLines, 1 ) + + If toFoxBin2Prg.n_RedirectClassType = 1 Or Not Empty(toFoxBin2Prg.c_ClassToConvert) && Redireccionar solo esta clase a main + llReplaceClass = .T. + +* - new operations of DBF + If Empty(toFoxBin2Prg.c_ClassToConvert) +*!* Changed by: LScheffler 04.03.2021 +*!* change date="{^2021-03-04,10:03:00}" +* If inputfile in the form classlib.class.vc2 AND toFoxBin2Prg.n_RedirectClassType = 1 and Execute parameter tcRecompile = 1 +* the change of outputfile might generate an error +* toFoxBin2Prg.c_OutputFile is renamed to classlib.vcx, while this.c_OutputFile is classlib.class.vcx +* this will generate classlib.class.vcx, tries to recompile and toFoxBin2Prg recompiles classlib.vcx +* if classlib.vcx is not existing, it errors out, els it compiles the wrong file. +* So we do not rename if toFoxBin2Prg.n_RedirectClassType = 1 + If toFoxBin2Prg.n_RedirectClassType = 0 + toFoxBin2Prg.c_OutputFile = Fullpath( Forceext( lcBaseFilename, 'VCX' ), .c_InputFile) + Endif +*!* /Changed by: LScheffler 04.03.2021 + Else + loClase = toModulo._Clases(1) +* Ajusto el nombre interno de la clase al indicado en el nombre del archivo + loClase._Nombre = toFoxBin2Prg.c_ClassToConvert + loClase._ObjName = toFoxBin2Prg.c_ClassToConvert +* Reemplazo la propiedad Name + lnRow = Ascan(loClase._Props, 'Name', 1, -1, 1, 2+4+8) + If lnRow > 0 + loClase._Props(lnRow,2) = ["] + toFoxBin2Prg.c_ClassToConvert + ["] + Endif +* Y finalmente actualizo el memo + loClase._PROPERTIES = .classProps2Memo( @loClase, @toFoxBin2Prg ) + Endif + + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) + + If Adir( laFiles, toFoxBin2Prg.c_OutputFile, "", 1 ) = 1 + Use (toFoxBin2Prg.c_OutputFile) Alias TABLABIN Again Shared + Else + .createClasslib() + Endif + Else + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) + .createClasslib() + Endif + + .writeBinaryFile( @toModulo, @toFoxBin2Prg, llReplaceClass ) + Endwith && THIS + + + Catch To toEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Store Null To loClase + Release lnCodError, laCodeLines, lnCodeLines, lcInputFile, lcInputFile_Class, lnFileCount, laFiles ; + , laLineasExclusion, lnBloquesExclusion, I + Endtry + + Return + Endproc + + + + + Procedure writeBinaryFile + Lparameters toModulo, toFoxBin2Prg, tlReplaceClass +*-- Estructura del objeto toModulo generado: +*-- ----------------------------------------------------------------------------------------------------------- +*-- Version Versión usada para generar la versión PRG analizada +*-- SourceFile Nombre original del archivo fuente de la conversión +*-- Ole_Obj_Count Cantidad de objetos definidos en el array ole_objs[] +*-- Ole_Objs[1] Array de objetos OLE definidos como clases +*-- ObjName Nombre del objeto OLE (OLE2) +*-- Parent Nombre del objeto Padre +*-- CheckSum Suma de verificación +*-- Value Valor del campo OLE +*-- Clases_Count Array con las posiciones de los addobjects, definicion y propiedades +*-- Clases[1] Array con los datos de las clases, definicion, propiedades y métodos +*-- Nombre El nombre de la clase (ej: "miClase") +*-- ObjName Nombre del objeto +*-- Parent Nombre del objeto Padre +*-- Class Clase de la que hereda la definición +*-- Classloc Librería donde está la definición de la clase +*-- Ole Información campo ole +*-- Ole2 Información campo ole2 +*-- OlePublic Indica si la clase es OLEPublic o no (.T. / .F.) +*-- Uniqueid ID único +*-- Comentario El comentario de la clase (ej: "&& Mis comentarios") +*-- MetaData Información de metadata de la clase (baseclass, timestamp, scale) +*-- BaseClass Clase de base de la clase +*-- TimeStamp Timestamp de la clase +*-- Scale Scale de la clase (pixels, foxels) +*-- Definicion La definición de la clase (ej: "AS Custom OF LIBRERIA.VCX") +*-- Inicio/Fin Línea de inicio/fin de la clase (DEFINE CLASS/ENDDEFINE) +*-- Ini_Cab/Fin_Cab Línea de inicio/fin de la cabecera (def.propiedades, Hidden, Protected, #Include, CLASSDATA, DEFINED_PAM) +*-- Ini_Cuerpo/Fin_Cuerpo Línea de inicio/fin del cuerpo (ADD OBJECTs y PROCEDURES) +*-- HiddenProps Propiedades definidas como HIDDEN (ocultas) +*-- ProtectedProps Propiedades definidas como PROTECTED (protegidas) +*-- Defined_PAM Propiedades, eventos o métodos definidos por el usuario +*-- IncludeFile Nombre del archivo de inclusión +*-- Props_Count Cantidad de propiedades de la clase definicas en el array props[] +*-- Props[1,2] Array con todas las propiedades de la clase y sus valores. (col.1=Nombre, col.2=Comentario) +*-- AddObject_Count Cantidad de objetos definidos en el array addobjects[] +*-- AddObjects[1] Array con las posiciones de los addobjects, definicion y propiedades +*-- Nombre Nombre del objeto +*-- ObjName Nombre del objeto +*-- Parent Nombre del objeto Padre +*-- Clase Clase del objeto +*-- ClassLib Librería de clases de la que deriva la clase +*-- Baseclass Clase de base del objeto +*-- Uniqueid ID único +*-- Ole Información campo ole +*-- Ole2 Información campo ole2 +*-- ZOrder Orden Z del objeto +*-- Props_Count Cantidad de propiedades del objeto +*-- Props[1] Array con todas las propiedades del objeto y sus valores +*-- Procedure_count Cantidad de procedimientos definidos en el array procedures[] +*-- Procedures[1] Array con las posiciones de los procedures, definicion y comentarios +*-- Nombre Nombre del procedure +*-- ProcType Tipo de procedimiento (normal, hidden, protected) +*-- Comentario Comentario el procedure +*-- ProcLine_Count Cantidad de líneas del procedimiento +*-- ProcLines[1] Líneas del procedimiento +*-- Procedure_count Cantidad de procedimientos definidos en el array procedures[] +*-- Procedures[1] Array con las posiciones de los procedures, definicion y comentarios +*-- Nombre Nombre del procedure +*-- ProcType Tipo de procedimiento (normal, hidden, protected) +*-- Comentario Comentario el procedure +*-- ProcLine_Count Cantidad de líneas del procedimiento +*-- ProcLines[1] Líneas del procedimiento +*-- ----------------------------------------------------------------------------------------------------------- + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lcObjName, lnCodError, I, X, llReplace, laUniqueID(1,1), loEx As Exception ; + , loClase As CL_CLASE Of 'FOXBIN2PRG.PRG' ; + , loFSO As Scripting.FileSystemObject ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + With This As c_conversor_prg_a_vcx Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + + Store Null To loFSO, loClase + loFSO = .oFSO + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) + + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_O1' + Error 'OutputFile Error Simulation' + Endcase + + If tlReplaceClass + I = 1 + loClase = toModulo._Clases(m.I) + Locate For PLATFORM == Padr('WINDOWS', Fsize('PLATFORM')) And Lower(OBJNAME) == loClase._ObjName + llReplace = Found() + Endif + + If llReplace +*-- Reemplazar los campos del registro actual + If Empty(loClase._TimeStamp) + loClase._TimeStamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(loClase._UniqueID) + loClase._UniqueID = toFoxBin2Prg.unique_ID() + Endif + + Replace ; + PLATFORM With 'WINDOWS' ; + , Timestamp With loClase._TimeStamp ; + , Class With loClase._Class ; + , CLASSLOC With loClase._ClassLoc ; + , BaseClass With loClase._BaseClass ; + , OBJNAME With loClase._ObjName ; + , Parent With loClase._Parent ; + , PROPERTIES With loClase._PROPERTIES ; + , Protected With loClase._PROTECTED ; + , METHODS With loClase._METHODS ; + , OLE With loClase._Ole ; + , OLE2 With loClase._Ole2 ; + , RESERVED1 With loClase._RESERVED1 ; + , RESERVED2 With loClase._RESERVED2 ; + , RESERVED3 With loClase._RESERVED3 ; + , RESERVED4 With loClase._RESERVED4 ; + , RESERVED5 With loClase._RESERVED5 ; + , RESERVED6 With loClase._RESERVED6 ; + , RESERVED7 With loClase._RESERVED7 ; + , RESERVED8 With loClase._RESERVED8 ; + , User With loClase._User + +* Si tiene objetos asociados, antes debo eliminar los existentes para no duplicarlos + Delete All For PLATFORM == Padr('WINDOWS', Fsize('PLATFORM')) And Lower(Parent) == loClase._ObjName + + .insert_AllObjects( @loClase, @toFoxBin2Prg ) + + Else +*-- Creo el registro de cabecera + If tlReplaceClass And Reccount() > 0 + Select Max(Val(Substr(UNIQUEID,2))) From TABLABIN Into Array laUniqueID + toFoxBin2Prg.n_ID = laUniqueID(1) + Else + .createClasslib_RecordHeader( toModulo ) + Endif + +*-- Recorro las CLASES + For X = 1 To 2 + For I = 1 To toModulo._Clases_Count + loClase = Null + loClase = toModulo._Clases(m.I) + +*-- El dataenvironment debe estar primero, luego lo demás. + If m.X = 1 And Not loClase._BaseClass == 'dataenvironment' ; + OR m.X = 2 And loClase._BaseClass == 'dataenvironment' + Loop + Endif + + If Empty(loClase._TimeStamp) + loClase._TimeStamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(loClase._UniqueID) + loClase._UniqueID = toFoxBin2Prg.unique_ID() + Endif + +*!* Changed by: LScheffler 07.12.2021 +*!* +*!* Changed by: LScheffler
+*!* https://github.com/fdbozzo/foxbin2prg/issues/72 / double classes in VCX +*!* The old code will write a class whether or not the class is already in the classlib +*!* Problem comes if a class is defined double by inconsistent UseClassPerFile, +*!* with same class defined in file.vc2 and in file[.baseclass].class.vc2 +*!*
+*!*
+ + Select TABLABIN +*!* Changed by: LScheffler 23.02.2022 +*!* +*!* Changed by: LScheffler
+*!* https://github.com/fdbozzo/foxbin2prg/issues/77 / If a classname is used as objectname too, an error is reported +*!* A class is Objname with empty parent field, while an object has parent filled. +*!*
+*!*
+ +* LOCATE; +* FOR OBJNAME==loClase._ObjName + Locate; + FOR OBJNAME==loClase._ObjName; + AND Empty(Parent) + +*!* /Changed by LScheffler 07.12.2021 + If Found() Then + Error loLang.C_ClassTwice_Header_LOC + ; + loLang.C_ClassTwice_Lib_LOC + Justfname( Dbf() ) + ; + loLang.C_ClassTwice_Class_LOC + loClase._ObjName+0h0D0A + Endif &&FOUND() + +*!* /Changed by LScheffler 07.12.2021 + +*-- Inserto la clase + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , Timestamp ; + , Class ; + , CLASSLOC ; + , BaseClass ; + , OBJNAME ; + , Parent ; + , PROPERTIES ; + , Protected ; + , METHODS ; + , OLE ; + , OLE2 ; + , RESERVED1 ; + , RESERVED2 ; + , RESERVED3 ; + , RESERVED4 ; + , RESERVED5 ; + , RESERVED6 ; + , RESERVED7 ; + , RESERVED8 ; + , User) ; + VALUES ; + ( 'WINDOWS' ; + , loClase._UniqueID ; + , loClase._TimeStamp ; + , loClase._Class ; + , loClase._ClassLoc ; + , loClase._BaseClass ; + , loClase._ObjName ; + , loClase._Parent ; + , loClase._PROPERTIES ; + , loClase._PROTECTED ; + , loClase._METHODS ; + , loClase._Ole ; + , loClase._Ole2 ; + , loClase._RESERVED1 ; + , loClase._RESERVED2 ; + , loClase._RESERVED3 ; + , loClase._ClassIcon ; + , loClase._ProjectClassIcon ; + , loClase._Scale ; + , loClase._Comentario ; + , loClase._includeFile ; + , loClase._User ) + + + .insert_AllObjects( @loClase, @toFoxBin2Prg ) + + +*-- Inserto el COMMENT + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , Timestamp ; + , Class ; + , CLASSLOC ; + , BaseClass ; + , OBJNAME ; + , Parent ; + , PROPERTIES ; + , Protected ; + , METHODS ; + , OLE ; + , OLE2 ; + , RESERVED1 ; + , RESERVED2 ; + , RESERVED3 ; + , RESERVED4 ; + , RESERVED5 ; + , RESERVED6 ; + , RESERVED7 ; + , RESERVED8 ; + , User) ; + VALUES ; + ( 'COMMENT' ; + , 'RESERVED' ; + , 0 ; + , '' ; + , '' ; + , '' ; + , loClase._ObjName ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , Iif(loClase._OlePublic, 'OLEPublic', '') ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ) + + Endfor && I = 1 TO toModulo._Clases_Count + If !Empty( lnCodError ) Then + Exit + Endif &&!EMPTY( lnCodError ) + Endfor && X = 1 TO 2 + Endif + + Use In (Select("TABLABIN")) + + If toFoxBin2Prg.l_Recompile And Empty( lnCodError ) + toFoxBin2Prg.compileFoxProBinary() + Endif + + toFoxBin2Prg.updateProcessedFile() + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Store Null To loFSO, loClase + Release lcObjName, I, X, loClase, loFSO + + Endtry + + Return lnCodError + + Endproc +Enddefine + + + + +Define Class c_conversor_prg_a_scx As c_conversor_prg_a_bin + #If .F. + Local This As c_conversor_prg_a_scx Of 'FOXBIN2PRG.PRG' + #Endif +*_MEMBERDATA = [] ; ++ [] ; ++ [] + c_Type = 'SC2' + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (@! OUT) Objeto generado de clase CL_CLASSLIB con la información leida del texto +* toEx (@! OUT) Objeto con información del error +* toFoxBin2Prg (@! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toModulo, toEx As Exception, toFoxBin2Prg + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + DoDefault( @toModulo, @toEx, @toFoxBin2Prg ) + + Try + Local lnCodError, laCodeLines(1), lnCodeLines, lcInputFile, lcInputFile_Class, lnFileCount, laFiles(1,5) ; + , laLineasExclusion(1), lnBloquesExclusion, I, lnIDInputFile ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + With This As c_conversor_prg_a_vcx Of 'FOXBIN2PRG.PRG' + Store 0 To lnCodError, lnCodeLines + Store '' To C_FB2PRG_CODE + Store Null To toModulo + + loLang = _Screen.o_FoxBin2Prg_Lang + toModulo = Createobject('CL_CLASSLIB') + lnIDInputFile = toFoxBin2Prg.n_ProcessedFiles + + If toFoxBin2Prg.n_UseClassPerFile > 0 And toFoxBin2Prg.l_RedirectClassPerFileToMain + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + .updateProgressbar( 'Identifying Header Blocks...', 1, lnCodeLines, 1 ) + .identifyHeaderBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toModulo, @toFoxBin2Prg ) + + .updateProgressbar( 'Loading Code...', 2, lnCodeLines, 1 ) + +*-- MÁSCARA DE BÚSQUEDA + If toFoxBin2Prg.n_UseClassPerFile = 1 Then +*-- Esto crea la máscara de búsqueda "filename.*.ext" para encontrar las partes + lcBaseFilename = Juststem( Juststem(.c_InputFile) ) + lcInputFile = Addbs( Justpath(.c_InputFile) ) + lcBaseFilename + '.*.' + Justext(.c_InputFile) + Else && toFoxBin2Prg.n_UseClassPerFile = 2 +*-- Esto crea la máscara de búsqueda "Database.*.*.ext" para encontrar las partes +*-- con la sintaxis "Database.MemberType.MemberName.ext" + lcBaseFilename = Juststem( Juststem( Juststem(.c_InputFile) ) ) + lcInputFile = Addbs( Justpath(.c_InputFile) ) + lcBaseFilename + '.*.*.' + Justext(.c_InputFile) + Endif + + lnFileCount = Adir( laFiles, lcInputFile, "", 1 ) + Asort( laFiles, 1, 0, 0, 1) + + For I = 1 To lnFileCount + If toFoxBin2Prg.n_UseClassPerFile = 1 Then + lcInputFile_Class = Forcepath( Juststem( laFiles(m.I,1) ), Justpath( .c_InputFile ) ) + '.' + Justext( .c_InputFile ) + lcClassName = Lower( Getwordnum( Justfname( lcInputFile_Class ), 2, '.' ) ) + +*-- Verificación de las Clases, si son Externas y se indicó chequearlas + If toFoxBin2Prg.l_ClassPerFileCheck And Empty(toFoxBin2Prg.c_ClassOperationType) ; + AND Ascan( toModulo._ExternalClasses , lcClassName, 1, 0, 1, 1+2+4 ) = 0 + .writeLog( C_TAB + '- ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + .writeErrorLog( C_TAB + '- ' + loLang.C_WARNING_LOC + ' ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + Loop && Salteo esta clase + Endif + Else && toFoxBin2Prg.n_UseClassPerFile = 2 + lcInputFile_Class = Forcepath( Juststem( laFiles(m.I,1) ), Justpath( .c_InputFile ) ) + '.' + Justext( .c_InputFile ) + lcClassName = Lower( Getwordnum( Justfname( lcInputFile_Class ), 2, '.' ) + '.' + Getwordnum( Justfname( lcInputFile_Class ), 3, '.' ) ) + +*-- Verificación de las Clases, si son Externas y se indicó chequearlas + If toFoxBin2Prg.l_ClassPerFileCheck And Empty(toFoxBin2Prg.c_ClassOperationType) ; + AND Ascan( toModulo._ExternalClasses , lcClassName, 1, 0, 2, 1+2+4 ) = 0 + .writeLog( C_TAB + '- ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + .writeErrorLog( C_TAB + '- ' + loLang.C_WARNING_LOC + ' ' + loLang.C_OUTER_CLASS_DOES_NOT_MATCH_INNER_CLASSES_LOC + ' [' + lcInputFile_Class + ']' ) + Loop && Salteo esta clase + Endif + Endif + + .writeLog( C_TAB + C_TAB + '+ ' + loLang.C_INCLUDING_CLASS_LOC + ' ' + Justfname( lcInputFile_Class ) ) + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( lcInputFile_Class, 'I', 'P1', 'E0', 'S1', 'X1' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + toFoxBin2Prg.normalizeFileCapitalization( .T., lcInputFile_Class ) + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + Filetostr( lcInputFile_Class ) + Endfor + + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + Else +*-- No es clase por archivo, o no se quiere redireccionar a Main. + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + .updateProgressbar( 'Identifying Header Blocks...', 1, lnCodeLines, 1 ) + .identifyHeaderBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toModulo, @toFoxBin2Prg ) + + Endif + + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + +*-- Identifico los TEXT/ENDTEXT, #IF .F./#ENDIF + .updateProgressbar( 'Identifying Excluded Blocks...', 3, lnCodeLines, 1 ) + .identifyExclusionBlocks( @laCodeLines, lnCodeLines, .F., @laLineasExclusion, @lnBloquesExclusion ) + +*-- Identifico el inicio/fin de bloque, definición, cabecera y cuerpo de cada clase + .identifyCodeBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toModulo, @toFoxBin2Prg ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I1' + Error 'InputFile Error Simulation' + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I0' + .writeErrorLog( '*** SIMULATED ERROR' ) + Endcase + + If .l_Error + .writeLog( '*** ERRORS found - Generation Cancelled' ) + Exit + Endif + + toFoxBin2Prg.updateProcessedFile( lnIDInputFile ) + .updateProgressbar( 'Generating Binary...', 0, lnCodeLines, 1 ) + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) + .createForm() + .writeBinaryFile( @toModulo, @toFoxBin2Prg ) + Endwith && THIS + + + Catch To toEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Release lnCodError, laCodeLines, lnCodeLines, lcInputFile, lcInputFile_Class, lnFileCount, laFiles ; + , laLineasExclusion, lnBloquesExclusion, I + Endtry + + Return + Endproc + + + + + Procedure writeBinaryFile + Lparameters toModulo, toFoxBin2Prg +*-- Estructura del objeto toModulo generado: +*-- ----------------------------------------------------------------------------------------------------------- +*-- Version Versión usada para generar la versión PRG analizada +*-- SourceFile Nombre original del archivo fuente de la conversión +*-- Ole_Obj_Count Cantidad de objetos definidos en el array ole_objs[] +*-- Ole_Objs[1] Array de objetos OLE definidos como clases +*-- ObjName Nombre del objeto OLE (OLE2) +*-- Parent Nombre del objeto Padre +*-- CheckSum Suma de verificación +*-- Value Valor del campo OLE +*-- Clases_Count Array con las posiciones de los addobjects, definicion y propiedades +*-- Clases[1] Array con los datos de las clases, definicion, propiedades y métodos +*-- Nombre El nombre de la clase (ej: "miClase") +*-- ObjName Nombre del objeto +*-- Parent Nombre del objeto Padre +*-- Class Clase de la que hereda la definición +*-- Classloc Librería donde está la definición de la clase +*-- Ole Información campo ole +*-- Ole2 Información campo ole2 +*-- OlePublic Indica si la clase es OLEPublic o no (.T. / .F.) +*-- Uniqueid ID único +*-- Comentario El comentario de la clase (ej: "&& Mis comentarios") +*-- MetaData Información de metadata de la clase (baseclass, timestamp, scale) +*-- BaseClass Clase de base de la clase +*-- TimeStamp Timestamp de la clase +*-- Scale Scale de la clase (pixels, foxels) +*-- Definicion La definición de la clase (ej: "AS Custom OF LIBRERIA.VCX") +*-- Inicio/Fin Línea de inicio/fin de la clase (DEFINE CLASS/ENDDEFINE) +*-- Ini_Cab/Fin_Cab Línea de inicio/fin de la cabecera (def.propiedades, Hidden, Protected, #Include, CLASSDATA, DEFINED_PAM) +*-- Ini_Cuerpo/Fin_Cuerpo Línea de inicio/fin del cuerpo (ADD OBJECTs y PROCEDURES) +*-- HiddenProps Propiedades definidas como HIDDEN (ocultas) +*-- ProtectedProps Propiedades definidas como PROTECTED (protegidas) +*-- Defined_PAM Propiedades, eventos o métodos definidos por el usuario +*-- IncludeFile Nombre del archivo de inclusión +*-- Props_Count Cantidad de propiedades de la clase definicas en el array props[] +*-- Props[1,2] Array con todas las propiedades de la clase y sus valores. (col.1=Nombre, col.2=Comentario) +*-- AddObject_Count Cantidad de objetos definidos en el array addobjects[] +*-- AddObjects[1] Array con las posiciones de los addobjects, definicion y propiedades +*-- Nombre Nombre del objeto +*-- ObjName Nombre del objeto +*-- Parent Nombre del objeto Padre +*-- Clase Clase del objeto +*-- ClassLib Librería de clases de la que deriva la clase +*-- Baseclass Clase de base del objeto +*-- Uniqueid ID único +*-- Ole Información campo ole +*-- Ole2 Información campo ole2 +*-- ZOrder Orden Z del objeto +*-- Props_Count Cantidad de propiedades del objeto +*-- Props[1] Array con todas las propiedades del objeto y sus valores +*-- Procedure_count Cantidad de procedimientos definidos en el array procedures[] +*-- Procedures[1] Array con las posiciones de los procedures, definicion y comentarios +*-- Nombre Nombre del procedure +*-- ProcType Tipo de procedimiento (normal, hidden, protected) +*-- Comentario Comentario el procedure +*-- ProcLine_Count Cantidad de líneas del procedimiento +*-- ProcLines[1] Líneas del procedimiento +*-- Procedure_count Cantidad de procedimientos definidos en el array procedures[] +*-- Procedures[1] Array con las posiciones de los procedures, definicion y comentarios +*-- Nombre Nombre del procedure +*-- ProcType Tipo de procedimiento (normal, hidden, protected) +*-- Comentario Comentario el procedure +*-- ProcLine_Count Cantidad de líneas del procedimiento +*-- ProcLines[1] Líneas del procedimiento +*-- ----------------------------------------------------------------------------------------------------------- + #If .F. + Local toModulo As CL_CLASSLIB Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lcObjName, lnCodError, I, X, loEx As Exception ; + , loClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + + With This As c_conversor_prg_a_scx Of 'FOXBIN2PRG.PRG' +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_O1' + Error 'OutputFile Error Simulation' + Endcase + +*-- Creo el registro de cabecera + .createForm_RecordHeader( toModulo ) + +*-- El SCX tiene el INCLUDE en el primer registro + If Not Empty(toModulo._includeFile) + Replace RESERVED8 With toModulo._includeFile + Endif + + +*-- Recorro las CLASES + For X = 1 To 2 + For I = 1 To toModulo._Clases_Count + loClase = Null + loClase = toModulo._Clases(m.I) + +*-- El dataenvironment debe estar primero, luego lo demás. + If m.X = 1 And Not loClase._BaseClass == 'dataenvironment' ; + OR m.X = 2 And loClase._BaseClass == 'dataenvironment' + Loop + Endif + + If Empty(loClase._TimeStamp) + loClase._TimeStamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(loClase._UniqueID) + loClase._UniqueID = toFoxBin2Prg.unique_ID() + Endif + +*-- Inserto la clase + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , Timestamp ; + , Class ; + , CLASSLOC ; + , BaseClass ; + , OBJNAME ; + , Parent ; + , PROPERTIES ; + , Protected ; + , METHODS ; + , OLE ; + , OLE2 ; + , RESERVED1 ; + , RESERVED2 ; + , RESERVED3 ; + , RESERVED4 ; + , RESERVED5 ; + , RESERVED6 ; + , RESERVED7 ; + , RESERVED8 ; + , User) ; + VALUES ; + ( 'WINDOWS' ; + , loClase._UniqueID ; + , loClase._TimeStamp ; + , loClase._Class ; + , loClase._ClassLoc ; + , loClase._BaseClass ; + , loClase._ObjName ; + , loClase._Parent ; + , loClase._PROPERTIES ; + , loClase._PROTECTED ; + , loClase._METHODS ; + , loClase._Ole ; + , loClase._Ole2 ; + , loClase._RESERVED1 ; + , loClase._RESERVED2 ; + , loClase._RESERVED3 ; + , loClase._ClassIcon ; + , loClase._ProjectClassIcon ; + , loClase._Scale ; + , loClase._Comentario ; + , loClase._includeFile ; + , loClase._User ) + + + .insert_AllObjects( @loClase, @toFoxBin2Prg ) + + Endfor && I = 1 TO toModulo._Clases_Count + Endfor && m.X = 1 TO 2 + +*-- Inserto el COMMENT final + Insert Into TABLABIN ; + ( PLATFORM ; + , UNIQUEID ; + , Timestamp ; + , Class ; + , CLASSLOC ; + , BaseClass ; + , OBJNAME ; + , Parent ; + , PROPERTIES ; + , Protected ; + , METHODS ; + , OLE ; + , OLE2 ; + , RESERVED1 ; + , RESERVED2 ; + , RESERVED3 ; + , RESERVED4 ; + , RESERVED5 ; + , RESERVED6 ; + , RESERVED7 ; + , RESERVED8 ; + , User) ; + VALUES ; + ( 'COMMENT' ; + , 'RESERVED' ; + , 0 ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ; + , '' ) + + Use In (Select("TABLABIN")) + + If toFoxBin2Prg.l_Recompile + toFoxBin2Prg.compileFoxProBinary() + Endif + + toFoxBin2Prg.updateProcessedFile() + Endwith && THIS + + + Catch To loEx + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Store Null To loClase, loEx + Release lcObjName, lnCodError, I, X, loClase + Endtry + + Return + + Endproc +Enddefine + + + + +Define Class c_conversor_prg_a_pjx As c_conversor_prg_a_bin + #If .F. + Local This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + #Endif + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + c_Type = 'PJ2' + + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toProject (!@ OUT) Objeto generado de clase CL_PROJECT con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toProject, toEx As Exception, toFoxBin2Prg + DoDefault( @toProject, @toEx, @toFoxBin2Prg ) + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local laCodeLines(1), lnCodeLines, laLineasExclusion(1), lnBloquesExclusion, I, lnIDInputFile + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + Store 0 To lnCodeLines + Store Null To toModulo + lnIDInputFile = toFoxBin2Prg.n_ProcessedFiles + + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + +*-- Identifico los TEXT/ENDTEXT, #IF .F./#ENDIF +*.identifyExclusionBlocks( @laCodeLines, .F., @laLineasExclusion, @lnBloquesExclusion ) + +*-- Identifico el inicio/fin de bloque, definición, cabecera y cuerpo de cada clase + .updateProgressbar( 'Identifying Code Blocks...', 1, 2, 1 ) + .identifyCodeBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toProject, @toFoxBin2Prg ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I1' + Error 'InputFile Error Simulation' + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I0' + .writeErrorLog( '*** SIMULATED ERROR' ) + Endcase + + If .l_Error + .writeLog( '*** ERRORS found - Generation Cancelled' ) + Exit + Endif + + toFoxBin2Prg.updateProcessedFile( lnIDInputFile ) + .updateProgressbar( 'Generating Binary...', 2, 2, 1 ) + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) + .createProject() + .writeBinaryFile( @toProject, @toFoxBin2Prg ) + Endwith && THIS + + + Catch To toEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Release laCodeLines, lnCodeLines, laLineasExclusion, lnBloquesExclusion, I + Endtry + + Return + Endproc + + + + Procedure writeBinaryFile + Lparameters toProject, toFoxBin2Prg +*-- ----------------------------------------------------------------------------------------------------------- + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnCodError, lcMainProg, loEx As Exception ; + , loServerHead As CL_PROJ_SRV_HEAD Of 'FOXBIN2PRG.PRG' ; + , loFile As CL_PROJ_FILE Of 'FOXBIN2PRG.PRG' + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + Store Null To loFile, loServerHead + toProject._HomeDir = Chrtran( toProject._HomeDir, ['], [] ) + toProject._SccData = Chr(3) + Chr(0) + Chr(1) + Replicate( Chr(0), 651 ) + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_O1' + Error 'OutputFile Error Simulation' + Endcase + +*-- Creo solo el registro de cabecera del proyecto + .createProject_RecordHeader( toProject ) + + lcMainProg = '' + + If Not Empty(toProject._MainProg) + lcMainProg = Lower( Sys(2014, toProject._MainProg, Addbs(toProject._HomeDir) ) ) + Endif + + If Empty(toProject._TimeStamp) + toProject._TimeStamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(toProject._ID) + toProject._ID = toFoxBin2Prg.unique_ID('N') + Endif + +*-- Si hay ProjectHook de proyecto, lo inserto + If Not Empty(toProject._ProjectHookLibrary) + Insert Into TABLABIN ; + ( Name ; + , Type ; + , EXCLUDE ; + , Key ; + , RESERVED1 ) ; + VALUES ; + ( toProject._ProjectHookLibrary + Chr(0) ; + , 'W' ; + , .T. ; + , Upper(Juststem(toProject._ProjectHookLibrary)) ; + , toProject._ProjectHookClass + Chr(0) ) + Endif + +*-- Si hay ICONO de proyecto, lo inserto + If Not Empty(toProject._Icon) + Insert Into TABLABIN ; + ( Name ; + , Type ; + , Local ; + , Key ) ; + VALUES ; + ( Sys(2014, toProject._Icon, Addbs(Justpath(Addbs(toProject._HomeDir)))) + Chr(0) ; + , 'i' ; + , .T. ; + , Upper(Juststem(toProject._Icon)) ) + Endif + +*-- Agrego los ARCHIVOS + For Each loFile In toProject FoxObject + + If Empty(loFile._TimeStamp) + loFile._TimeStamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(loFile._ID) + loFile._ID = toFoxBin2Prg.unique_ID('N') + Endif + + Insert Into TABLABIN ; + ( Name ; + , Type ; + , EXCLUDE ; + , MAINPROG ; + , COMMENTS ; + , Local ; + , CPID ; + , Id ; + , Timestamp ; + , OBJREV ; + , User ; + , DEVINFO ; + , Key ) ; + VALUES ; + ( loFile._Name + Chr(0) ; + , .fileTypeCode(Justext(loFile._Name), loFile._Type) ; + , loFile._Exclude ; + , (loFile._Name == lcMainProg) ; + , loFile._Comments ; + , .T. ; + , loFile._CPID ; + , loFile._ID ; + , loFile._TimeStamp ; + , loFile._ObjRev ; + , Strconv(loFile._User,14) ; + , Strconv(loFile._DevInfo,14) ; + , Upper(Juststem(loFile._Name)) ) + Endfor + + Use In (Select("TABLABIN")) + toFoxBin2Prg.updateProcessedFile() + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Store Null To loFile, loServerHead + Release loFile, loServerHead + + Endtry + + Return lnCodError + Endproc + + + + Procedure identifyCodeBlocks + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toProject, toFoxBin2Prg +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (@! IN ) El array con las líneas del código donde buscar +* tnCodeLines (@! IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@! IN ) Cantidad de bloques de exclusión +* toProject (@? OUT) Objeto con toda la información del proyecto analizado +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +* +* NOTA: +* Como identificador se usa el nombre de clase o de procedimiento, según corresponda. +*-------------------------------------------------------------------------------------------------------------- + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, lc_Comentario, lcLine, llBuildProj_Completed, llDevInfo_Completed ; + , llServerHead_Completed, llFileComments_Completed, llFoxBin2Prg_Completed ; + , llExcludedFiles_Completed, llTextFiles_Completed, llProjectProperties_Completed + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + Store 0 To I + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + toProject = Createobject('CL_PROJECT') +*toProject._HomeDir = ADDBS(JUSTPATH(.c_OutputFile)) + + For I = 1 To tnCodeLines + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Vacía o solo Comentarios + Loop + + Case Not llFoxBin2Prg_Completed And .analyzeCodeBlock_FoxBin2Prg( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFoxBin2Prg_Completed = .T. + + Case Not llDevInfo_Completed And .analyzeCodeBlock_DevInfo( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llDevInfo_Completed = .T. + + Case Not llServerHead_Completed And .analyzeCodeBlock_ServerHead( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llServerHead_Completed = .T. + + Case .analyzeCodeBlock_ServerData( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) +*-- Puede haber varios servidores, por eso se siguen valuando + + Case Not llBuildProj_Completed And .analyzeCodeBlock_BuildProj( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines, @toFoxBin2Prg ) + llBuildProj_Completed = .T. + + Case Not llFileComments_Completed And .analyzeCodeBlock_FileComments( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFileComments_Completed = .T. + + Case Not llExcludedFiles_Completed And .analyzeCodeBlock_ExcludedFiles( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llExcludedFiles_Completed = .T. + + Case Not llTextFiles_Completed And .analyzeCodeBlock_TextFiles( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llTextFiles_Completed = .T. + + Case Not llProjectProperties_Completed And .analyzeCodeBlock_ProjectProperties( toProject, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llProjectProperties_Completed = .T. + + Endcase + + Endfor + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toProject ; + , I, lc_Comentario, lcLine, llBuildProj_Completed, llDevInfo_Completed ; + , llServerHead_Completed, llFileComments_Completed, llFoxBin2Prg_Completed ; + , llExcludedFiles_Completed, llTextFiles_Completed, llProjectProperties_Completed + Endtry + + Return + Endproc + + + + Procedure analyzeCodeBlock_BuildProj +*-------------------------------------------------------------------------------------------------------------- +* Analiza el bloque +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toProject (@? OUT) Objeto con toda la información del proyecto analizado +* tcLine (@! IN ) Línea de datos en evaluación +* taCodeLines (@! IN ) El array con las líneas del código donde buscar +* tnCodeLines (@! IN ) Cantidad de líneas de código +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines, toFoxBin2Prg + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcComment, lcMetadatos, luValor ; + , laPropsAndValues(1,2), lnPropsAndValues_Count ; + , loFile As CL_PROJ_FILE Of 'FOXBIN2PRG.PRG' + + If Left( tcLine, Len(C_BUILDPROJ_I) ) == C_BUILDPROJ_I + llBloqueEncontrado = .T. + + With This + For I = m.I + 1 To tnCodeLines + lcComment = '' + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case Left( tcLine, Len(C_BUILDPROJ_F) ) == C_BUILDPROJ_F + I = m.I + 1 + Exit + + Case .lineIsOnlyCommentAndNoMetadata( @tcLine, @lcComment ) + Loop && Saltear comentarios + + Case Upper( Left( tcLine, 14 ) ) == 'BUILD PROJECT ' + Loop + + Case Upper( Left( tcLine, 5 ) ) == '.ADD(' +* loFile: NAME,TYPE,EXCLUDE,COMMENTS + tcLine = Chrtran( tcLine, ["] + '[]', "'''" ) && Convierto "[] en ' + Store Null To loFile + loFile = Createobject('CL_PROJ_FILE') + loFile._Name = Alltrim( Strextract( tcLine, ['], ['] ) ) + +*-- Obtengo metadatos de los comentarios de FileMetadata: +*< FileMetadata: Type="V" Cpid="1252" Timestamp="1131901580" ID="1129207528" ObjRev="544" /> + .get_ListNamesWithValuesFrom_InLine_MetadataTag( @lcComment, @laPropsAndValues ; + , @lnPropsAndValues_Count, C_FILE_META_I, C_FILE_META_F ) + + loFile._Type = .get_ValueByName_FromListNamesWithValues( 'Type', 'C', @laPropsAndValues ) + loFile._CPID = .get_ValueByName_FromListNamesWithValues( 'CPID', 'I', @laPropsAndValues ) + loFile._TimeStamp = .get_ValueByName_FromListNamesWithValues( 'Timestamp', 'I', @laPropsAndValues ) + loFile._ID = .get_ValueByName_FromListNamesWithValues( 'ID', 'I', @laPropsAndValues ) + loFile._ObjRev = .get_ValueByName_FromListNamesWithValues( 'ObjRev', 'I', @laPropsAndValues ) + loFile._User = .get_ValueByName_FromListNamesWithValues( 'User', 'C', @laPropsAndValues ) + + If toFoxBin2Prg.n_BodyDevInfo = 1 + loFile._DevInfo = .get_ValueByName_FromListNamesWithValues( 'DevInfo', 'C', @laPropsAndValues ) + Endif + + toProject.Add( loFile, loFile._Name ) + + Case Upper( Left( tcLine, 10 ) ) == Upper( '*<.HomeDir' ) + toProject._HomeDir = Strextract( tcLine, "'", "'" ) + + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loFile + Release toProject, tcLine, taCodeLines, I, tnCodeLines ; + , lcComment, lcMetadatos, luValor, laPropsAndValues, lnPropsAndValues_Count, loFile + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_DevInfo +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado + + If Left( tcLine, Len(C_DEVINFO_I) ) == C_DEVINFO_I + llBloqueEncontrado = .T. + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case Left( tcLine, Len(C_DEVINFO_F) ) == C_DEVINFO_F + I = m.I + 1 + Exit + + Case .lineIsOnlyCommentAndNoMetadata( @tcLine ) + Loop && Saltear comentarios + + Otherwise + toProject.setParsedProjInfoLine( @tcLine ) + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_ServerHead +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado ; + , loServerHead As CL_PROJ_SRV_HEAD Of 'FOXBIN2PRG.PRG' + + If Left( tcLine, Len(C_SRV_HEAD_I) ) == C_SRV_HEAD_I + llBloqueEncontrado = .T. + + Store Null To loServerHead + loServerHead = toProject._ServerHead + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @tcLine ) + Loop && Saltear comentarios + + Case Left( tcLine, Len(C_SRV_HEAD_F) ) == C_SRV_HEAD_F + I = m.I + 1 + Exit + + Otherwise + loServerHead.setParsedHeadInfoLine( @tcLine ) + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loServerHead + Release loServerHead + + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_ServerData +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado ; + , loServerHead As CL_PROJ_SRV_HEAD Of 'FOXBIN2PRG.PRG' ; + , loServerData As CL_PROJ_SRV_DATA Of 'FOXBIN2PRG.PRG' + + If Left( tcLine, Len(C_SRV_DATA_I) ) == C_SRV_DATA_I + llBloqueEncontrado = .T. + + Store Null To loServerData, loServerHead + loServerHead = toProject._ServerHead + loServerData = loServerHead.getServerDataObject() + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @tcLine ) + Loop && Saltear comentarios + + Case Left( tcLine, Len(C_SRV_DATA_F) ) == C_SRV_DATA_F + I = m.I + 1 + Exit + + Otherwise + loServerHead.setParsedInfoLine( loServerData, @tcLine ) + Endcase + Endfor + Endwith && THIS + + loServerHead.add_Server( loServerData ) + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loServerData, loServerHead + Release loServerHead, loServerData + + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_FileComments +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines + + External Array toProject + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcFile, lcComment ; + , loFile As CL_PROJ_FILE Of 'FOXBIN2PRG.PRG' + + If Left( tcLine, Len(C_FILE_CMTS_I) ) == C_FILE_CMTS_I + llBloqueEncontrado = .T. + loFile = Null + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @tcLine ) + Loop && Saltear comentarios + + Case Left( tcLine, Len(C_FILE_CMTS_F) ) == C_FILE_CMTS_F + I = m.I + 1 + Exit + + Otherwise + lcFile = Lower( Alltrim( Strtran( Chrtran( Normalize( Strextract( tcLine, ".ITEM(", ").Description", 1, 1 ) ), ["], [] ), 'lcCurDir+', '', 1, 1, 1) ) ) + lcComment = Alltrim( Chrtran( Strextract( tcLine, "=", "", 1, 2 ), ['], [] ) ) + loFile = toProject( lcFile ) + loFile._Comments = lcComment + loFile = Null + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + loFile = Null + Release lcFile, lcComment, loFile + + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_ExcludedFiles +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines + + External Array toProject + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcFile, llExclude ; + , loFile As CL_PROJ_FILE Of 'FOXBIN2PRG.PRG' + + If Left( tcLine, Len(C_FILE_EXCL_I) ) == C_FILE_EXCL_I + llBloqueEncontrado = .T. + loFile = Null + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @tcLine ) + Loop && Saltear comentarios + + Case Left( tcLine, Len(C_FILE_EXCL_F) ) == C_FILE_EXCL_F + I = m.I + 1 + Exit + + Otherwise + lcFile = Lower( Alltrim( Strtran( Chrtran( Normalize( Strextract( tcLine, ".ITEM(", ").Exclude", 1, 1 ) ), ["], [] ), 'lcCurDir+', '', 1, 1, 1) ) ) + llExclude = Evaluate( Alltrim( Chrtran( Strextract( tcLine, "=", "", 1, 2 ), ['], [] ) ) ) + loFile = toProject( lcFile ) + loFile._Exclude = llExclude + loFile = Null + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + loFile = Null + Release lcFile, llExclude, loFile + + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_TextFiles +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines + + External Array toProject + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcFile, lcType ; + , loFile As CL_PROJ_FILE Of 'FOXBIN2PRG.PRG' + + If Left( tcLine, Len(C_FILE_TXT_I) ) == C_FILE_TXT_I + llBloqueEncontrado = .T. + loFile = Null + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @tcLine ) + Loop && Saltear comentarios + + Case Left( tcLine, Len(C_FILE_TXT_F) ) == C_FILE_TXT_F + I = m.I + 1 + Exit + + Otherwise + lcFile = Lower( Alltrim( Strtran( Chrtran( Normalize( Strextract( tcLine, ".ITEM(", ").Type", 1, 1 ) ), ["], [] ), 'lcCurDir+', '', 1, 1, 1) ) ) + lcType = Alltrim( Chrtran( Strextract( tcLine, "=", "", 1, 2 ), ['], [] ) ) + loFile = toProject( lcFile ) + loFile._Type = lcType + loFile = Null + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + loFile = Null + Release lcFile, lcType, loFile + + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_ProjectProperties +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toProject, tcLine, taCodeLines, I, tnCodeLines + + #If .F. + Local toProject As CL_PROJECT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcLine + + If Left( tcLine, Len(C_PROJPROPS_I) ) == C_PROJPROPS_I + llBloqueEncontrado = .T. + + With This As c_conversor_prg_a_pjx Of 'FOXBIN2PRG.PRG' + For I = m.I + 1 To tnCodeLines + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @tcLine ) + Loop && Saltear comentarios + + Case Left( tcLine, Len(C_PROJPROPS_F) ) == C_PROJPROPS_F + I = m.I + 1 + Exit + + Case Left( tcLine ,2 ) == '*<' +*--- Se asigna con EVALUATE() tal cual está en el PJ2, pero quitando el marcador *< /> + lcLine = Stuff( Alltrim( Strextract( tcLine, '*<', '/>' ) ), 2, 0, '_' ) + toProject.setParsedProjInfoLine( lcLine ) + + Case Upper( Left( tcLine, 9 ) ) == '.SETMAIN(' +*-- Cambio "SetMain()" por "_MainProg =" + lcLine = '._MainProg = ' + Lower( Strextract( Alltrim( tcLine), '.SetMain(', ')', 1, 1 ) ) + toProject.setParsedProjInfoLine( lcLine ) + + Otherwise +*--- Se asigna con EVALUATE() tal cual está en el PJ2 + lcLine = Stuff( Alltrim( tcLine), 2, 0, '_' ) + toProject.setParsedProjInfoLine( lcLine ) + Endcase + Endfor + Endwith && THIS + + I = m.I - 1 + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Endtry + + Return llBloqueEncontrado + Endproc + + +Enddefine + + + +Define Class c_conversor_prg_a_frx As c_conversor_prg_a_bin + #If .F. + Local This As c_conversor_prg_a_frx Of 'FOXBIN2PRG.PRG' + #Endif + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] + c_Type = 'FR2' + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toReport (!@ OUT) Objeto generado de clase CL_REPORT con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toReport, toEx As Exception, toFoxBin2Prg + DoDefault( @toReport, @toEx, @toFoxBin2Prg ) + + #If .F. + Local toReport As CL_REPORT Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnCodError, loEx As Exception, laCodeLines(1), lnCodeLines ; + , laLineasExclusion(1), lnBloquesExclusion, I, lnIDInputFile + + With This As c_conversor_prg_a_frx Of 'FOXBIN2PRG.PRG' + Store 0 To lnCodError, lnCodeLines + Store Null To toReport + lnIDInputFile = toFoxBin2Prg.n_ProcessedFiles + + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + .createReport('CURSOR') + +*-- Identifico el inicio/fin de bloque, definición, cabecera y cuerpo del reporte + .updateProgressbar( 'Identifying Code Blocks...', 1, 2, 1 ) + .identifyCodeBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toReport ) + Use In (Select('TABLABIN')) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I1' + Error 'InputFile Error Simulation' + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I0' + .writeErrorLog( '*** SIMULATED ERROR' ) + Endcase + + If .l_Error + .writeLog( '*** ERRORS found - Generation Cancelled' ) + Exit + Endif + + toFoxBin2Prg.updateProcessedFile( lnIDInputFile ) + .updateProgressbar( 'Generating Binary...', 2, 2, 1 ) + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) + .createReport() + .writeBinaryFile( @toReport, @toFoxBin2Prg ) + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Endtry + + Return lnCodError + Endproc + + + + Procedure writeBinaryFile + Lparameters toReport, toFoxBin2Prg +*-- ----------------------------------------------------------------------------------------------------------- + #If .F. + Local toReport As CL_REPORT Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local loReg, I, lcFieldType, lnFieldLen, lnFieldDec, lnNumCampo, laFieldTypes(1,18) ; + , luValor, lnCodError, loEx As Exception ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + loLang = _Screen.o_FoxBin2Prg_Lang + Select TABLABIN + Afields( laFieldTypes ) + loReg = Null + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + toFoxBin2Prg.addProcessedFile( This.c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_O1' + Error 'OutputFile Error Simulation' + Endcase + +*-- Agrego los registros + For Each loReg In toReport FoxObject + +*IF toFoxBin2Prg.l_NoTimestamps +* loReg.TIMESTAMP = 0 +*ENDIF +*IF toFoxBin2Prg.l_ClearUniqueID +* loReg.UNIQUEID = '' +*ENDIF + If Empty(loReg.Timestamp) + loReg.Timestamp = .rowTimeStamp( {^2013/11/04 20:00:00} ) + Endif + If Empty(loReg.UNIQUEID) Or Alltrim(loReg.UNIQUEID) = '0' + loReg.UNIQUEID = toFoxBin2Prg.unique_ID() + Endif + +*-- Ajuste de los tipos de dato + For I = 1 To Amembers(laProps, loReg, 0) + lnNumCampo = Ascan( laFieldTypes, laProps(m.I), 1, -1, 1, 1+2+4+8 ) + + If lnNumCampo = 0 +*ERROR 'No se encontró el campo [' + laProps(m.I) + '] en la estructura del archivo ' + DBF("TABLABIN") + Error (Textmerge(loLang.C_FIELD_NOT_FOUND_ON_FILE_STRUCTURE_LOC)) + Endif + + lcFieldType = laFieldTypes(lnNumCampo,2) + lnFieldLen = laFieldTypes(lnNumCampo,3) + lnFieldDec = laFieldTypes(lnNumCampo,4) + luValor = Evaluate('loReg.' + laProps(m.I)) + + Do Case + Case Inlist(lcFieldType, 'B') && Double + AddProperty( loReg, laProps(m.I), Cast( luValor As &lcFieldType. (lnFieldPrec) ) ) + + Case Inlist(lcFieldType, 'F', 'N', 'Y') && Float, Numeric, Currency + AddProperty( loReg, laProps(m.I), Cast( luValor As &lcFieldType. (lnFieldLen, lnFieldDec) ) ) + + Case Inlist(lcFieldType, 'W', 'G', 'M', 'Q', 'V', 'C') && Blob, General, Memo, Varbinary, Varchar, Character + AddProperty( loReg, laProps(m.I), luValor ) + + Otherwise && Demás tipos + AddProperty( loReg, laProps(m.I), Cast( luValor As &lcFieldType. (lnFieldLen) ) ) + + Endcase + + Endfor + + Insert Into TABLABIN From Name loReg + loReg = Null + Endfor + + Use In (Select("TABLABIN")) + + If toFoxBin2Prg.l_Recompile + toFoxBin2Prg.compileFoxProBinary() + Endif + + toFoxBin2Prg.updateProcessedFile() + + + Catch To loEx + lnCodError = loEx.ErrorNo + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + loReg = Null + Release loReg, I, lcFieldType, lnFieldLen, lnFieldDec, lnNumCampo, laFieldTypes, luValor + + Endtry + + Return lnCodError + Endproc + + + + Procedure identifyCodeBlocks + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toReport +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (!@ IN ) El array con las líneas del código donde buscar +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@? IN ) Cantidad de bloques de exclusion +* toReport (@? OUT) Objeto con toda la información del reporte analizado +* +* NOTA: +* Como identificador se usa el nombre de clase o de procedimiento, según corresponda. +*-------------------------------------------------------------------------------------------------------------- + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toReport As CL_REPORT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, lc_Comentario, lcLine, llFoxBin2Prg_Completed + Store 0 To I + + With This As c_conversor_prg_a_frx Of 'FOXBIN2PRG.PRG' + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + toReport = Null + toReport = Createobject('CL_REPORT') + + For I = 1 To tnCodeLines + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Vacía o solo Comentarios + Loop + + Case Not llFoxBin2Prg_Completed And .analyzeCodeBlock_FoxBin2Prg( toReport, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFoxBin2Prg_Completed = .T. + + Case .analyzeCodeBlock_Reportes( toReport, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + + Endcase + Endfor + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Endtry + + Return + Endproc + + + + Procedure analyzeCodeBlock_CDATA_inline +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toReport, tcLine, taCodeLines, I, tnCodeLines, toReg, tcPropName + + #If .F. + Local toReport As CL_REPORT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcValue, loEx As Exception + + If Left(tcLine, 1 + Len(tcPropName) + 1 + 9) == '<' + tcPropName + '>' + C_DATA_I + llBloqueEncontrado = .T. + + If C_DATA_F $ tcLine + lcValue = Strextract( tcLine, C_DATA_I, C_DATA_F ) + AddProperty( toReg, tcPropName, lcValue ) + Exit + Endif + +*-- Tomo la primera parte del valor + lcValue = Strextract( tcLine, C_DATA_I ) + +*-- Recorro las fracciones del valor + For I = m.I + 1 To tnCodeLines + tcLine = taCodeLines(m.I) + + If C_DATA_F $ tcLine && Fin del valor + lcValue = lcValue + CR_LF + Strextract( tcLine, '', C_DATA_F ) + +*-- Ajustes: En los labels, no se usa CR+LF, sino que se usa solo CR + If toReg.ObjType = "5" Then + lcValue = Strtran(lcValue, CR_LF, C_CR) + Endif + + AddProperty( toReg, tcPropName, lcValue ) + Exit + + Else && Otra fracción del valor + lcValue = lcValue + CR_LF + tcLine + Endif + Endfor + + Endif + + Catch To loEx + If loEx.ErrorNo = 1470 && Incorrect property name. + loEx.UserValue = 'PropName=[' + Transform(tcPropName) + '], Value=[' + Transform(lcValue) + ']' + Endif + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toReport, tcLine, taCodeLines, I, tnCodeLines, toReg, tcPropName ; + , lcValue, loEx + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_platform +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toReport, tcLine, taCodeLines, I, tnCodeLines, toReg + + #If .F. + Local toReport As CL_REPORT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, X, lnPos, lnPos2, lcValue, lnLenPropName, laProps(1) + + If Lower( Left(tcLine, 10) ) == 'platform="' + llBloqueEncontrado = .T. + lnLastPos = 1 + tcLine = ' ' + tcLine + + For X = 1 To Amembers( laProps, toReg, 0 ) + laProps(m.X) = ' ' + laProps(m.X) + lnPos = At( Lower(laProps(m.X)) + '="', tcLine ) + + If lnPos > 0 + lnLenPropName = Len(laProps(m.X)) + lnPos2 = At( '"', Substr( tcLine, lnPos + lnLenPropName + 2 ) ) + lcValue = Substr( tcLine, lnPos + lnLenPropName + 2, lnPos2 - 1 ) + + If laProps(m.X) == ' NAME' And Not Empty(lcValue) + lcValue = This.denormalizeXMLValue(lcValue) + Endif + + AddProperty( toReg, laProps(m.X), lcValue ) + Endif + Endfor + + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toReport, tcLine, taCodeLines, I, tnCodeLines, toReg ; + , X, lnPos, lnPos2, lcValue, lnLenPropName, laProps + Endtry + + Return llBloqueEncontrado + Endproc + + + + Procedure analyzeCodeBlock_Reportes +*------------------------------------------------------ +*-- Analiza el bloque +*------------------------------------------------------ + Lparameters toReport, tcLine, taCodeLines, I, tnCodeLines + + #If .F. + Local toReport As CL_REPORT Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local llBloqueEncontrado, lcComment, lcMetadatos, luValor ; + , laPropsAndValues(1,2), lnPropsAndValues_Count ; + , loReg + + If Left( tcLine, Len(C_TAG_REPORTE) + 1 ) == '<' + C_TAG_REPORTE + '' + llBloqueEncontrado = .T. + loReg = Null + + With This As c_conversor_prg_a_frx Of 'FOXBIN2PRG.PRG' + Scatter Memo Blank Name loReg + + For I = m.I + 1 To tnCodeLines + lcComment = '' + .set_Line( @tcLine, @taCodeLines, m.I ) + + Do Case + Case Left( tcLine, Len(C_TAG_REPORTE_F) ) == C_TAG_REPORTE_F + I = m.I + 1 + Exit + + Case .analyzeCodeBlock_platform( toReport, @tcLine, @taCodeLines, @m.I, @tnCodeLines, @loReg ) + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'picture' ) + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'tag' ) +*-- ARREGLO ALGUNOS VALORES CAMBIADOS AL TEXTUALIZAR + Do Case + Case loReg.ObjType == "1" + loReg.Tag = .decode_SpecialCodes_1_31( loReg.Tag ) + Case Inlist(loReg.ObjType, "25", "26") && Dataenvironment, cursors and relations + loReg.Tag = Iif( Empty( Chrtran( loReg.Tag, CR_LF+C_TAB, '') ), '', Substr(loReg.Tag,3) ) && Quito el ENTER agregado antes + Otherwise + loReg.Tag = .decode_SpecialCodes_1_31( loReg.Tag ) + Endcase + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'tag2' ) +*-- ARREGLO ALGUNOS VALORES CAMBIADOS AL TEXTUALIZAR + If Not Inlist(loReg.ObjType,"5","6","8") + loReg.TAG2 = Strconv( loReg.TAG2,14 ) + Endif + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'penred' ) + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'style' ) + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'expr' ) + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'supexpr' ) + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'comment' ) + + Case .analyzeCodeBlock_CDATA_inline( toReport, @tcLine, @taCodeLines, @m.I, tnCodeLines, @loReg, 'user' ) + + Endcase + + Endfor + Endwith && THIS + + I = m.I - 1 + toReport.Add( loReg ) + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + loReg = Null + Release lcComment, lcMetadatos, luValor, laPropsAndValues, lnPropsAndValues_Count, loReg + + Endtry + + Return llBloqueEncontrado + Endproc + + +Enddefine && CLASS c_conversor_prg_a_frx AS c_conversor_prg_a_bin + + + +Define Class c_conversor_prg_a_dbf As c_conversor_prg_a_bin + #If .F. + Local This As c_conversor_prg_a_dbf Of 'FOXBIN2PRG.PRG' + #Endif + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + c_Type = 'DB2' + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toTable (!@ OUT) Objeto generado de clase CL_TABLE con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toTable, toEx As Exception, toFoxBin2Prg + DoDefault( @toTable, @toEx, @toFoxBin2Prg ) + + #If .F. + Local toTable As CL_DBF_TABLE Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnCodError, loEx As Exception, laCodeLines(1), lnCodeLines, laLineasExclusion(1), lnBloquesExclusion, I ; + , lnIDInputFile, lnFileCount, laConfig(1), lcConfigItem, lc_DBF_Conversion_Support, lcAlterTable ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , lcTempDBC, llImportData ; + , loDBF_CFG As CL_DBF_CFG Of 'FOXBIN2PRG.PRG' + Store 0 To lnCodError, lnCodeLines + + With This As c_conversor_prg_a_dbf Of 'FOXBIN2PRG.PRG' + lnIDInputFile = toFoxBin2Prg.n_ProcessedFiles + loLang = _Screen.o_FoxBin2Prg_Lang + +*-- If table CFG exists, use it for DBF-specific configuration. FDBOZZO. 2014/06/15 + lnFileCount = toFoxBin2Prg.get_DBF_Configuration( Forceext(.c_InputFile, 'DBF'), @loDBF_CFG, .T. ) + lcTempDBC = Forcepath( '_FB2P', Justpath(.c_OutputFile) ) + + Do Case + Case lnFileCount = 1 And loDBF_CFG.n_DBF_Conversion_Support > 0 And Not Inlist(loDBF_CFG.n_DBF_Conversion_Support, 2, 8) + With toFoxBin2Prg + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endwith + + Case lnFileCount = 1 And loDBF_CFG.n_DBF_Conversion_Support > 0 && Implica 2 u 8 + llImportData = (loDBF_CFG.n_DBF_Conversion_Support = 8) + + Case toFoxBin2Prg.n_DBF_Conversion_Support = 8 && TXT2BIN (DATA IMPORT) + llImportData = .T. + + Case toFoxBin2Prg.n_DBF_Conversion_Support <> 2 + With toFoxBin2Prg + Error (Textmerge(loLang.C_FILE_NAME_IS_NOT_SUPPORTED_LOC)) + Endwith + + Otherwise +* Asume llImportData = .F. + + Endcase + + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) + +*-- Identifico el inicio/fin de bloque, campos e índices de la tabla + .identifyCodeBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toTable ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I1' + Error 'InputFile Error Simulation' + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I0' + .writeErrorLog( '*** SIMULATED ERROR' ) + Endcase + + If .l_Error + .writeLog( '*** ERRORS found - Generation Cancelled' ) + Exit + Endif + + toFoxBin2Prg.updateProcessedFile( lnIDInputFile ) + .writeBinaryFile_STRUCTURE( @toTable, @toFoxBin2Prg, @lcAlterTable ) + + If llImportData And lnCodeLines > 1 And toTable._I > 1 Then +*-- Identifico los registros de la tabla y los agrego + I = toTable._I - 1 + +*!* Changed by: LScheffler 21.02.2021 +*!* change date="{^2021-02-21,10:57:00}" +* additional options controlling +* - new operations of DBF + toTable.analyzeCodeBlock( C_TABLE_I, @laCodeLines, @m.I, lnCodeLines, @toFoxBin2Prg,; + IIF( m.lnFileCount = 1, Nvl( m.loDBF_CFG.l_DBF_BinChar_Base64, m.toFoxBin2Prg.l_DBF_BinChar_Base64 ), m.toFoxBin2Prg.l_DBF_BinChar_Base64 ),; + IIF( m.lnFileCount = 1, Nvl( m.loDBF_CFG.l_DBF_IncludeDeleted, m.toFoxBin2Prg.l_DBF_IncludeDeleted ), m.toFoxBin2Prg.l_DBF_IncludeDeleted ) ) +*!* /Changed by: LScheffler 21.02.2021 + + Endif + + If Not Empty(lcAlterTable) + Execscript(lcAlterTable) + Endif + + .writeBinaryFile_INDEXES( @toTable, @toFoxBin2Prg ) + + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Use In (Select(Juststem(This.c_OutputFile))) + + If Not Empty(lcTempDBC) + Close Databases + Erase (Forceext(lcTempDBC,'DBC')) + Erase (Forceext(lcTempDBC,'DCT')) + Erase (Forceext(lcTempDBC,'DCX')) + Endif + + Store Null To loDBF_CFG + Release loDBF_CFG + + Endtry + + Return lnCodError + Endproc + + + + Procedure writeBinaryFile_STRUCTURE + Lparameters toTable, toFoxBin2Prg, tcAlterTable +*-- ----------------------------------------------------------------------------------------------------------- + #If .F. + Local toTable As CL_DBF_TABLE Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, lnCodError, loEx As Exception ; + , loField As CL_DBF_FIELD Of 'FOXBIN2PRG.PRG' ; + , loDBFUtils As CL_DBF_UTILS Of 'FOXBIN2PRG.PRG' ; + , lcCreateTable, lcLongDec, lcFieldDef, lcIndex, lcTempDBC, lnDataSessionID, lnSelect + + With This As c_conversor_prg_a_dbf Of 'FOXBIN2PRG.PRG' + Store Null To loField, loIndex, loDBFUtils + loDBFUtils = Createobject('CL_DBF_UTILS') + + Store 0 To lnCodError + Store '' To lcIndex, lcFieldDef, tcAlterTable + lnDataSessionID = toFoxBin2Prg.DataSessionId + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_O1' + Error 'OutputFile Error Simulation' + Endcase + + Erase (Forceext(.c_OutputFile, 'DBF')) + Erase (Forceext(.c_OutputFile, 'FPT')) + Erase (Forceext(.c_OutputFile, 'CDX')) + + If Empty(toTable._Database) + lcCreateTable = 'CREATE TABLE "' + .c_OutputFile + '" FREE CodePage=' + toTable._CodePage + ' ;' + CR_LF + ' (' + Else + lcTempDBC = Forcepath( '_FB2P', Justpath(.c_OutputFile) ) + Create Database ( lcTempDBC ) + lcCreateTable = 'CREATE TABLE "' + .c_OutputFile + '" CodePage=' + toTable._CodePage + ' ;' + CR_LF + ' (' + Endif + + toTable._TableName = .c_OutputFile + +*-- Conformo los campos + For Each loField In toTable._Fields FoxObject + lcLongDec = '' + + If Not Empty(lcFieldDef) + lcFieldDef = lcFieldDef + ';' + CR_LF + ', ' + Endif + +*-- Nombre, Tipo + lcFieldDef = lcFieldDef + '"' + loField._Name + '" ' + loField._Type + +*-- Longitud + If Inlist( loField._Type, 'C', 'N', 'F', 'Q', 'V' ) + lcLongDec = lcLongDec + '(' + loField._Width + Endif + +*-- Decimales + If Inlist( loField._Type, 'N', 'F' ) And loField._Decimals > '0' Or loField._Type = 'B' + If Empty(lcLongDec) + lcLongDec = lcLongDec + '(' + Else + lcLongDec = lcLongDec + ',' + Endif + lcLongDec = lcLongDec + loField._Decimals + Endif + + If Not Empty(lcLongDec) + lcLongDec = lcLongDec + ')' + Endif + + lcFieldDef = lcFieldDef + lcLongDec + +*-- Null + lcFieldDef = lcFieldDef + Iif( loField._Null = '.T.', ' NULL', ' NOT NULL' ) + +*-- NoCPTran + If loField._NoCPTran = '.T.' + lcFieldDef = lcFieldDef + ' NOCPTRANS' + Endif + +*-- AutoInc + If loField._AutoInc_NextVal <> '0' + If toFoxBin2Prg.n_ExcludeDBFAutoincNextval = 1 +*-- If AutoIncNextVal is excluded from text, then assign 1 for allowing regeneration +*-- of DBF with this field. + tcAlterTable = tcAlterTable + ' ;' + CR_LF + ' ALTER ' + loField._Name + ' ' + loField._Type + ' AUTOINC NEXTVAL 1 STEP ' + loField._AutoInc_Step + Else + tcAlterTable = tcAlterTable + ' ;' + CR_LF + ' ALTER ' + loField._Name + ' ' + loField._Type + ' AUTOINC NEXTVAL ' + loField._AutoInc_NextVal + ' STEP ' + loField._AutoInc_Step + Endif + Endif + + loField = Null + Endfor + + lcCreateTable = lcCreateTable + lcFieldDef + ')' + Execscript(lcCreateTable) + + If Not Empty(tcAlterTable) + tcAlterTable = 'ALTER TABLE "' + .c_OutputFile + '" ' + tcAlterTable + Endif + +*-- Hook para permitir ejecución externa (por ejemplo, para rellenar la tabla con datos) + If Not Empty(toFoxBin2Prg.run_AfterCreateTable) + lnSelect = Select() + Do (toFoxBin2Prg.run_AfterCreateTable) With (lnDataSessionID), (.c_OutputFile), (toTable) + Set DataSession To (lnDataSessionID) && Por las dudas externamente se cambie + Select (lnSelect) + Endif + + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + loEx.UserValue = 'lcFieldDef="' + Transform(lcFieldDef) + '"' + CR_LF ; + + 'lcCreateTable="' + Transform(lcCreateTable) + '"' + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loField, loDBFUtils + Release I, loField, loDBFUtils ; + , lcCreateTable, lcLongDec, lcFieldDef, lcTempDBC, lnDataSessionID, lnSelect + + Endtry + + Return lnCodError + Endproc + + +* LScheffler + Procedure writeBinaryFile_INDEXES + Lparameters toTable, toFoxBin2Prg +*-- ----------------------------------------------------------------------------------------------------------- + #If .F. + Local toTable As CL_DBF_TABLE Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, lnCodError, loEx As Exception ; + , loIndex As CL_DBF_INDEX Of 'FOXBIN2PRG.PRG' ; + , loDBFUtils As CL_DBF_UTILS Of 'FOXBIN2PRG.PRG' ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' ; + , ldLastUpdate ; + , lcIndexFile + + With This As c_conversor_prg_a_dbf Of 'FOXBIN2PRG.PRG' + Store Null To loIndex + Store 0 To lnCodError + Store '' To lcIndex + Store .Null. To lcIndexFile + + loDBFUtils = Createobject('CL_DBF_UTILS') + + If toTable._Indexes.Count # 0 Then + + loLang = _Screen.o_FoxBin2Prg_Lang + toFoxBin2Prg.writeLog( Replicate('+', 100) ) + toFoxBin2Prg.writeLog( loLang.C_INDEX2BIN_PROCESSING_LOC ) + toFoxBin2Prg.writeLog( ' ' + Replicate('-', 98) ) + +*-- Regenero los índices + For Each loIndex In toTable._Indexes FoxObject + Do Case + Case Isnull ( m.lcIndexFile ) And Empty (m.loIndex._IndexFile) + toFoxBin2Prg.writeLog( loLang.C_INDEX2BIN_STRUCTURAL_LOC ) + toFoxBin2Prg.writeLog( ' ' + Replicate('- ', 49) ) + + Case Isnull ( m.lcIndexFile ) And m.loIndex._StandAlone + toFoxBin2Prg.writeLog( loLang.C_INDEX2BIN_STANDALONE_LOC + m.loIndex._IndexFile ) + + Case Isnull ( m.lcIndexFile ) + toFoxBin2Prg.writeLog( loLang.C_INDEX2BIN_COMPOUND_LOC + m.loIndex._IndexFile ) + toFoxBin2Prg.writeLog( ' ' + Replicate('- ', 59) ) + + Case ! m.lcIndexFile == m.loIndex._IndexFile And m.loIndex._StandAlone + toFoxBin2Prg.writeLog( ' ' + Replicate('-', 98) ) + toFoxBin2Prg.writeLog( loLang.C_INDEX2BIN_STANDALONE_LOC + m.loIndex._IndexFile ) + + Case ! m.lcIndexFile == m.loIndex._IndexFile + toFoxBin2Prg.writeLog( ' ' + Replicate('-', 98) ) + toFoxBin2Prg.writeLog( loLang.C_INDEX2BIN_COMPOUND_LOC + m.loIndex._IndexFile ) + toFoxBin2Prg.writeLog( ' ' + Replicate('- ', 59) ) + Endcase + lcIndexFile = m.loIndex._IndexFile + + lcIndex = 'INDEX ON ' + loIndex._Key + + If loIndex._TagType = 'BINARY' + lcIndex = lcIndex + ' BINARY' + Else + lcIndex = lcIndex + ' COLLATE "' + loIndex._Collate + '"' + + If Not Empty(loIndex._Filter) + lcIndex = lcIndex + ' FOR ' + loIndex._Filter + Endif + + lcIndex = lcIndex + ' ' + loIndex._Order + + If Not Inlist(loIndex._TagType, 'NORMAL', 'REGULAR') +*-- Si es PRIMARY lo cambio a CANDIDATE y luego lo recodifico + lcIndex = lcIndex + ' ' + Strtran( loIndex._TagType, 'PRIMARY', 'CANDIDATE' ) + Endif + Endif + + If m.loIndex._StandAlone Then + lcIndex = m.lcIndex + ' TO ' + m.lcIndexFile + Else &&m.loIndex._StandAlone + lcIndex = m.lcIndex + ' TAG ' + loIndex._TagName + Iif( Empty( m.lcIndexFile ), '', ' OF ' + m.lcIndexFile ) + toFoxBin2Prg.writeLog( ' ' + m.loIndex._TagName ) + Endif &&m.loIndex._StandAlone + + &lcIndex. + Endfor + + toFoxBin2Prg.writeLog( Replicate('+', 100) + 0h0D0A ) + + Endif &&toTable._Indexes.COUNT # 0 + + Use In (Select(Juststem(.c_OutputFile))) + +*-- La actualización de la fecha sirve para evitar diferencias al regenerar el DBF + If toFoxBin2Prg.l_ClearDBFLastUpdate Then + ldLastUpdate = Evaluate( '{^2013/11/04}' ) + Else + ldLastUpdate = Evaluate( '{^' + toTable._LastUpdate + '}' ) + Endif + + loDBFUtils.write_DBC_BackLink( .c_OutputFile, toTable._Database, ldLastUpdate ) + + toFoxBin2Prg.updateProcessedFile() + + toFoxBin2Prg.writeLog( Replicate('+', 100) ) + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + loEx.UserValue = 'lcIndex="' + Transform(lcIndex) + '"' + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loIndex + Release I, loIndex, lcIndex, ldLastUpdate + + Endtry + + Return lnCodError + Endproc + + + + Procedure identifyCodeBlocks +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (!@ IN ) El array con las líneas del código donde buscar +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@? IN ) Sin uso +* toTable (@? OUT) Objeto con toda la información de la tabla analizada +*-------------------------------------------------------------------------------------------------------------- + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toTable + + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toTable As CL_DBF_TABLE Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, lc_Comentario, lcLine, llFoxBin2Prg_Completed, llBloqueTable_Completed + Store 0 To I + + With This As c_conversor_prg_a_dbf Of 'FOXBIN2PRG.PRG' + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + toTable = Null + toTable = Createobject('CL_DBF_TABLE') + + For I = 1 To tnCodeLines + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Vacía o solo Comentarios + Loop + + Case Not llFoxBin2Prg_Completed And .analyzeCodeBlock_FoxBin2Prg( toTable, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFoxBin2Prg_Completed = .T. + + Case Not llBloqueTable_Completed And toTable.analyzeCodeBlock( @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llBloqueTable_Completed = .T. + Exit + + Endcase + Endfor + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toTable ; + , I, lc_Comentario, lcLine, llFoxBin2Prg_Completed, llBloqueTable_Completed + Endtry + + Return + Endproc + + +Enddefine && CLASS c_conversor_prg_a_dbf AS c_conversor_prg_a_bin + + +* LScheffler, Analyse, just locate +Define Class c_conversor_prg_a_dbc As c_conversor_prg_a_bin + #If .F. + Local This As c_conversor_prg_a_dbc Of 'FOXBIN2PRG.PRG' + #Endif + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + c_Type = 'DC2' + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toDatabase (!@ OUT) Objeto generado de clase CL_DBC con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toDatabase, toEx As Exception, toFoxBin2Prg + DoDefault( @toDatabase, @toEx, @toFoxBin2Prg ) + + #If .F. + Local toDatabase As CL_DBC Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnCodError, loEx As Exception, loReg, lcLine, laCodeLines(1), lnCodeLines, lcBaseFilename, lcInputFile ; + , lcMemberType, lcMemberName, lcLastMemberType, lnIDInputFile ; + , laLineasExclusion(1), lnBloquesExclusion, I, X, Y, laFiles(1,5), lnFileCount, lcTempTxt, laLines(1) ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + Store 0 To lnCodError, lnCodeLines, lnFileCount + Store '' To lcLine, laLines, laCodeLines, lcBaseFilename, lcMemberType, lcLastMemberType, lcMemberName, lcInputFile + Store Null To loReg, toDatabase + + With This As c_conversor_prg_a_dbc Of 'FOXBIN2PRG.PRG' + loLang = _Screen.o_FoxBin2Prg_Lang + toDatabase = Createobject('CL_DBC') + lnIDInputFile = toFoxBin2Prg.n_ProcessedFiles + + If toFoxBin2Prg.n_UseFilesPerDBC > 0 And toFoxBin2Prg.l_RedirectFilePerDBCToMain + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + C_FB2PRG_CODE = '' + +*-- Quito la última parte del cierre de para anexar lo intermedio + For X = 1 To lnCodeLines + If C_DATABASE_F $ laCodeLines(m.X) Then + Exit + Endif + C_FB2PRG_CODE = C_FB2PRG_CODE + laCodeLines(m.X) + CR_LF + Endfor + + .updateProgressbar( 'Identifying Header Blocks...', 1, lnCodeLines, 1 ) + .identifyHeaderBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toDatabase, @toFoxBin2Prg ) + + .updateProgressbar( 'Loading Code...', 2, lnCodeLines, 1 ) + +*-- Esto crea la máscara de búsqueda "Database.*.*.ext" para encontrar las partes +*-- con la sintaxis "Database.MemberType.MemberName.ext" + lcBaseFilename = Juststem( Juststem( Juststem(.c_InputFile) ) ) + lcInputFile = Addbs( Justpath(.c_InputFile) ) + lcBaseFilename + '.*.*.' + Justext(.c_InputFile) + lnFileCount = Adir( laFiles, lcInputFile, "", 1 ) + +*-- Busco "storedprocedures" y le pongo "z" al inicio + For I = 1 To lnFileCount + If Lower( laFiles(m.I,1)) == lcBaseFilename + '.database.storedproceduressource.' + Justext(.c_InputFile) Then + laFiles(m.I,1) = lcBaseFilename + '.zdatabase.storedproceduressource.' + Justext(.c_InputFile) + Exit + Endif + Endfor + + Asort( laFiles, 1, -1, 0, 1) && "zstoredprocedures" quedará al final + +*-- Busco "zstoredprocedures" y le quito la "z" del inicio + For I = 1 To lnFileCount + If Lower( laFiles(m.I,1)) == lcBaseFilename + '.zdatabase.storedproceduressource.' + Justext(.c_InputFile) Then + laFiles(m.I,1) = lcBaseFilename + '.database.storedproceduressource.' + Justext(.c_InputFile) + Exit + Endif + Endfor + + For I = 1 To lnFileCount + lcInputFile_Class = Forcepath( Juststem( laFiles(m.I,1) ), Justpath( .c_InputFile ) ) + '.' + Justext( .c_InputFile ) + lcMemberType = Lower( Getwordnum( Justfname( lcInputFile_Class ), 2, '.' ) ) + lcMemberName = Lower( Getwordnum( Justfname( lcInputFile_Class ), 3, '.' ) ) + + If toFoxBin2Prg.l_ProcessFiles Then + If Not lcMemberType == lcLastMemberType Then + If Not Empty(lcLastMemberType) Then +*-- Cambio de tipo de miembro, fin del anterior (connection, table, view, storedprocedures) + Do Case + Case lcLastMemberType == 'connection' + C_FB2PRG_CODE = C_FB2PRG_CODE + C_TAB + C_CONNECTIONS_F + CR_LF + Case lcLastMemberType == 'table' + C_FB2PRG_CODE = C_FB2PRG_CODE + C_TAB + C_TABLES_F + CR_LF + Case lcLastMemberType == 'view' + C_FB2PRG_CODE = C_FB2PRG_CODE + C_TAB + C_VIEWS_F + CR_LF + Case lcLastMemberType == 'database' +*C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + CR_LF + Endcase + + lcLastMemberType = '' + Endif + +*-- Cambio de tipo de miembro, inicio del actual (connection, table, view, storedprocedures) + Do Case + Case lcMemberType == 'connection' + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + CR_LF + C_TAB + C_CONNECTIONS_I + CR_LF + Case lcMemberType == 'table' + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + CR_LF + C_TAB + C_TABLES_I + CR_LF + Case lcMemberType == 'view' + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + CR_LF + C_TAB + C_VIEWS_I + CR_LF + Case lcMemberType == 'database' + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + CR_LF + Endcase + Endif + Endif + +*-- Verificación de los Miembros, si son Externos y se indicó chequearlos + If toFoxBin2Prg.l_ClassPerFileCheck And Empty(toFoxBin2Prg.c_ClassOperationType) ; + AND Ascan( toDatabase._ExternalClasses, lcMemberType + '.' + lcMemberName, 1, 0, 1, 1+2+4 ) = 0 + .writeLog( C_TAB + '- ' + loLang.C_OUTER_MEMBER_DOES_NOT_MATCH_INNER_MEMBERS_LOC + ' [' + lcInputFile_Class + ']' ) + .writeErrorLog( C_TAB + '- ' + loLang.C_WARNING_LOC + ' ' + loLang.C_OUTER_MEMBER_DOES_NOT_MATCH_INNER_MEMBERS_LOC + ' [' + lcInputFile_Class + ']' ) + Loop && Salteo este miembro porque no concuerda con los anotados + Endif + + .writeLog( C_TAB + C_TAB + '+ ' + loLang.C_INCLUDING_MEMBER_LOC + ' ' + Justfname( lcInputFile_Class ) ) + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( lcInputFile_Class, 'I', 'P1', 'E0', 'S1', 'X1' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + If toFoxBin2Prg.l_ProcessFiles Then + toFoxBin2Prg.normalizeFileCapitalization( .T., lcInputFile_Class ) + lcTempTxt = Filetostr( lcInputFile_Class ) + + For Y = 7 To Alines( laLines, lcTempTxt ) + C_FB2PRG_CODE = C_FB2PRG_CODE + laLines(m.Y) + CR_LF + Endfor + + lcLastMemberType = lcMemberType + Endif + Endfor + + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + + If Not Empty(lcLastMemberType) Then +*-- Cambio de tipo de miembro, fin del anterior (connection, table, view, storedprocedures) + Do Case + Case lcLastMemberType == 'connection' + C_FB2PRG_CODE = C_FB2PRG_CODE + C_TAB + C_CONNECTIONS_F + CR_LF + Case lcLastMemberType == 'table' + C_FB2PRG_CODE = C_FB2PRG_CODE + C_TAB + C_TABLES_F + CR_LF + Case lcLastMemberType == 'view' + C_FB2PRG_CODE = C_FB2PRG_CODE + C_TAB + C_VIEWS_F + CR_LF + Case lcLastMemberType == 'database' +*C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + CR_LF + Endcase + Endif + +*-- Agrego la última parte con el cierre de + For X = m.X To lnCodeLines + C_FB2PRG_CODE = C_FB2PRG_CODE + laCodeLines(m.X) + CR_LF + Endfor + + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + Else +*-- No es clase por archivo, o no se quiere redireccionar a Main. + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + .updateProgressbar( 'Identifying Header Blocks...', 1, lnCodeLines, 1 ) + .identifyHeaderBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toDatabase, @toFoxBin2Prg ) + + Endif + +*-- Identifico el inicio/fin de bloque, definición, cabecera y cuerpo del reporte + .updateProgressbar( 'Identifying Code Blocks...', 1, 2, 1 ) + .identifyCodeBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toDatabase, @toFoxBin2Prg ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I1' + Error 'InputFile Error Simulation' + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I0' + .writeErrorLog( '*** SIMULATED ERROR' ) + Endcase + + If .l_Error + .writeLog( '*** ERRORS found - Generation Cancelled' ) + Exit + Endif + + toFoxBin2Prg.updateProcessedFile( lnIDInputFile ) + .updateProgressbar( 'Generating Binary...', 2, 2, 1 ) + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) +*.createTable() + .writeBinaryFile( @toDatabase, @toFoxBin2Prg ) + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Endtry + + Return lnCodError + Endproc + + + + Procedure writeBinaryFile + Lparameters toDatabase, toFoxBin2Prg +*-- ----------------------------------------------------------------------------------------------------------- + #If .F. + Local toDatabase As CL_DBC Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnCodError, lcEventsFile + lnCodError = 0 + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + toFoxBin2Prg.addProcessedFile( This.c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_O1' + Error 'OutputFile Error Simulation' + Endcase + + If Not Empty(toDatabase._DBCEventFilename) + If Left(toDatabase._DBCEventFilename,1) = '.' Then + lcEventsFile = Addbs( Justpath(.c_InputFile) ) + toDatabase._DBCEventFilename + Else + lcEventsFile = toDatabase._DBCEventFilename + Endif + If File(lcEventsFile) Then + lcEventsFile = '' + Else + Strtofile( '', lcEventsFile ) + Endif + +*-- Si no recompilo el EventFilename.prg, el EXE dará un error (aunque el PRG no) + Compile ( Addbs( Justpath( This.c_OutputFile ) ) + toDatabase._DBCEventFilename ) + Endif + + toDatabase.updateDBC( This.c_OutputFile ) + + If toFoxBin2Prg.l_Recompile + toFoxBin2Prg.compileFoxProBinary() + Endif + + toFoxBin2Prg.updateProcessedFile() + + + Catch To loEx + lnCodError = loEx.ErrorNo + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + If Not Empty(lcEventsFile) Then + Erase (lcEventsFile) + Erase (Forceext(lcEventsFile,'FXP')) + Endif + + Endtry + + Return lnCodError + Endproc + + + + Procedure identifyHeaderBlocks +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (@! IN ) El array con las líneas del código donde buscar +* tnCodeLines (@! IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@! IN ) Cantidad de bloques de exclusión +* toDatabase (@? OUT) Objeto con toda la información del módulo analizado +* toFoxBin2Prg (@? IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- +* NOTA: +* Como identificador se usa el nombre de clase o de procedimiento, según corresponda. +*-------------------------------------------------------------------------------------------------------------- + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toDatabase, toFoxBin2Prg + + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toDatabase As CL_DBC Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, loEx As Exception ; + , llFoxBin2Prg_Completed, llOLE_DEF_Completed, llINCLUDE_SCX_Completed, llLIBCOMMENT_Completed, llEXTERNAL_MEMBER_Completed ; + , lc_Comentario, lcProcedureAbierto, lcLine ; + , loClase As CL_CLASE Of 'FOXBIN2PRG.PRG' + + With This As c_conversor_prg_a_bin Of 'FOXBIN2PRG.PRG' + Store '' To lcProcedureAbierto + + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + + If toFoxBin2Prg.n_UseFilesPerDBC > 0 And toFoxBin2Prg.l_RedirectFilePerDBCToMain + Else + llEXTERNAL_MEMBER_Completed = .T. + Endif + +*-- Búsqueda del ID de inicio de bloque (DEFINE CLASS / PROCEDURE) + For I = 1 To tnCodeLines + Store '' To lc_Comentario + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Excluida, vacía o solo Comentarios + Loop + + Case Not llFoxBin2Prg_Completed And .analyzeCodeBlock_FoxBin2Prg( @toDatabase, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFoxBin2Prg_Completed = .T. + + Case Not llEXTERNAL_MEMBER_Completed And .analyzeCodeBlock_EXTERNAL_MEMBER( @toDatabase, @lcLine, @taCodeLines, @m.I, tnCodeLines ) +*-- Puede haber varias clases externas + + Endcase + + Endfor + + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Store Null To loClase + Release taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toDatabase, loClase, I ; + , llFoxBin2Prg_Completed, llOLE_DEF_Completed, llINCLUDE_SCX_Completed, llLIBCOMMENT_Completed ; + , lc_Comentario, lcProcedureAbierto, lcLine + Endtry + + Return + Endproc + + + + Procedure identifyCodeBlocks +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (!@ IN ) El array con las líneas del código donde buscar +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@? IN ) Sin uso +* toDatabase (@! IN ) Objeto con toda la información de la base de datos analizada +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- +* NOTA: +* Como identificador se usa el nombre de clase o de procedimiento, según corresponda. +*-------------------------------------------------------------------------------------------------------------- + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toDatabase, toFoxBin2Prg + + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toDatabase As CL_DBC Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, lc_Comentario, lcLine, llFoxBin2Prg_Completed, llBloqueDatabase_Completed + Store 0 To I + + With This As c_conversor_prg_a_dbc Of 'FOXBIN2PRG.PRG' + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + + For I = 1 To tnCodeLines + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Vacía o solo Comentarios + Loop + + Case Not llFoxBin2Prg_Completed And .analyzeCodeBlock_FoxBin2Prg( toDatabase, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFoxBin2Prg_Completed = .T. + + Case Not llBloqueDatabase_Completed And toDatabase.analyzeCodeBlock( @lcLine, @taCodeLines, @m.I, tnCodeLines, @toFoxBin2Prg ) + llBloqueDatabase_Completed = .T. + + Endcase + Endfor + + .verify_EXTERNAL_MEMBERS( @toDatabase, @toFoxBin2Prg ) + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toDatabase ; + , I, lc_Comentario, lcLine, llFoxBin2Prg_Completed, llBloqueDatabase_Completed + Endtry + + Return + Endproc + + + Procedure verify_EXTERNAL_MEMBERS +*-------------------------------------------------------------------------------- +* Compara los miembros definidos en la cabecera con los miembros encontrados luego +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toDatabase (@! IN ) Objeto con toda la información del módulo analizado +* toFoxBin2Prg (@! IN ) Referencia al objeto principal +*-------------------------------------------------------------------------------------------------------------- + Lparameters toDatabase, toFoxBin2Prg + + #If .F. + Local toDatabase As CL_DBC Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Local lnItem, I, X, lcClaseExterna ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + loLang = _Screen.o_FoxBin2Prg_Lang + +*-- Verificación de los Miembros, si son Externos y se indicó chequearlos + If toFoxBin2Prg.n_UseFilesPerDBC > 0 And toFoxBin2Prg.l_ItemPerDBCCheck And Empty(toFoxBin2Prg.c_ClassOperationType) + For I = 1 To toDatabase._ExternalClasses_Count + lnItem = 0 + + For X = 1 To toDatabase._Members_Count + If Lower( toDatabase._Members(m.X,1) ) == Lower( toDatabase._ExternalClasses(m.I,1) ) + lnItem = m.X + Exit + Endif + Endfor + + If lnItem = 0 Then + lcClaseExterna = Forcepath( Juststem(toFoxBin2Prg.c_InputFile) + '.' + toDatabase._ExternalClasses(m.I,1) + '.' + Justext(toFoxBin2Prg.c_InputFile), Justpath(toFoxBin2Prg.c_InputFile) ) +*ERROR 'No se ha encontrado la clase externa [' + toDatabase._ExternalClasses(m.I,1) + '] en el archivo [' + toFoxBin2Prg.c_InputFile + ']' + Error ( loLang.C_EXTERNAL_MEMBER_NAME_WAS_NOT_FOUND_LOC + ' [' + lcClaseExterna + ']' ) + Endif + + toDatabase._Members(lnItem,2) = .T. && Checked + Endfor + Endif + Endproc + + +Enddefine && CLASS c_conversor_prg_a_dbc AS c_conversor_prg_a_bin + + + +Define Class c_conversor_prg_a_mnx As c_conversor_prg_a_bin + #If .F. + Local This As c_conversor_prg_a_mnx Of 'FOXBIN2PRG.PRG' + #Endif + _MemberData = [] ; + + [] ; + + [] ; + + [] + + c_Type = 'MN2' + n_MenuType = 0 + c_MenuLocation = '' + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toMenu (!@ OUT) Objeto generado de clase CL_DBC con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toMenu, toEx As Exception, toFoxBin2Prg + DoDefault( @toMenu, @toEx, @toFoxBin2Prg ) + + #If .F. + Local toMenu As CL_MENU Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnCodError, loEx As Exception, loReg, lcLine, laCodeLines(1), lnCodeLines ; + , laLineasExclusion(1), lnBloquesExclusion, lnIDInputFile + Store 0 To lnCodError, lnCodeLines + Store '' To lcLine + + With This As c_conversor_prg_a_mnx Of 'FOXBIN2PRG.PRG' + lnIDInputFile = toFoxBin2Prg.n_ProcessedFiles + + If Not toFoxBin2Prg.l_ProcessFiles Then +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + If toFoxBin2Prg.addProcessedFile( .c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) Then + toFoxBin2Prg.updateProcessedFile() + Endif + + Exit && Si se indicó no procesar, se sale aquí. (Modo de simulación) + Endif + + C_FB2PRG_CODE = Filetostr( .c_InputFile ) + lnCodeLines = Alines( laCodeLines, C_FB2PRG_CODE ) + + .createMenu('CURSOR') + +*-- Identifico el inicio/fin de bloque, definición, cabecera y cuerpo del reporte + .updateProgressbar( 'Identifying Code Blocks...', 1, 2, 1 ) + .identifyCodeBlocks( @laCodeLines, lnCodeLines, @laLineasExclusion, lnBloquesExclusion, @toMenu ) + Use In (Select('TABLABIN')) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I1' + Error 'InputFile Error Simulation' + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_I0' + .writeErrorLog( '*** SIMULATED ERROR' ) + Endcase + + If .l_Error + .writeLog( '*** ERRORS found - Generation Cancelled' ) + Exit + Endif + + toFoxBin2Prg.updateProcessedFile( lnIDInputFile ) + .updateProgressbar( 'Generating Binary...', 1, 2, 1 ) + toFoxBin2Prg.doBackup( .F., .T., '', '', '' ) + .createMenu() + .writeBinaryFile( @toMenu, @toFoxBin2Prg ) + Endwith && THIS + + + Catch To loEx + lnCodError = loEx.ErrorNo + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select("TABLABIN")) + Endtry + + Return lnCodError + Endproc + + + Procedure identifyCodeBlocks +*-------------------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* taCodeLines (!@ IN ) El array con las líneas del código donde buscar +* tnCodeLines (!@ IN ) Cantidad de líneas de código +* taLineasExclusion (@! IN ) Array unidimensional con un .T. o .F. según la línea sea de exclusión o no +* tnBloquesExclusion (@? IN ) Sin uso +* toMenu (@? OUT) Objeto con toda la información del menú analizado +* +* NOTA: +* Como identificador se usa el nombre de clase o de procedimiento, según corresponda. +*-------------------------------------------------------------------------------------------------------------- + Lparameters taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toMenu + + External Array taCodeLines, taLineasExclusion + + #If .F. + Local toMenu As CL_MENU Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, lc_Comentario, lcLine, llFoxBin2Prg_Completed, llBloqueMenu_Completed + Store 0 To I + + With This As c_conversor_prg_a_mnx Of 'FOXBIN2PRG.PRG' + .c_Type = Upper(Justext(.c_OutputFile)) + + If tnCodeLines > 1 + toMenu = Null + toMenu = Createobject('CL_MENU') + + For I = 1 To tnCodeLines + .set_Line( @lcLine, @taCodeLines, m.I ) + + Do Case + Case .lineIsOnlyCommentAndNoMetadata( @lcLine, @lc_Comentario ) && Vacía o solo Comentarios + Loop + + Case Not llFoxBin2Prg_Completed And .analyzeCodeBlock_FoxBin2Prg( toMenu, @lcLine, @taCodeLines, @m.I, tnCodeLines ) + llFoxBin2Prg_Completed = .T. + + Case Not llBloqueMenu_Completed And toMenu.analyzeCodeBlock( @lcLine, @taCodeLines, @m.I, tnCodeLines, This ) + llBloqueMenu_Completed = .T. + + Endcase + Endfor + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release taCodeLines, tnCodeLines, taLineasExclusion, tnBloquesExclusion, toMenu ; + , I, lc_Comentario, lcLine, llFoxBin2Prg_Completed, llBloqueMenu_Completed + Endtry + + Return + Endproc + + + Procedure writeBinaryFile +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toMenu (!@ OUT) Objeto generado de clase CL_DBC con la información leida del texto +*--------------------------------------------------------------------------------------------------- + Lparameters toMenu, toFoxBin2Prg + + #If .F. + Local toMenu As CL_MENU Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lnCodError + lnCodError = 0 + +*-- addProcessedFile( tcFile, tcInOutType, tcProcessed, tcHasErrors, tcSupported, tcExpanded ) + toFoxBin2Prg.addProcessedFile( This.c_OutputFile, 'O', 'P1', 'E0', 'S1', 'X0' ) + + Do Case + Case toFoxBin2Prg.c_SimulateError = 'SIMERR_O1' + Error 'OutputFile Error Simulation' + Endcase + + toMenu.updateMENU( This ) + + toFoxBin2Prg.updateProcessedFile() + + + Catch To loEx + lnCodError = loEx.ErrorNo + toFoxBin2Prg.updateProcessedFile( 0, '', '', 'E1' ) + + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Use In (Select(Juststem(This.c_OutputFile))) + + Endtry + + Return lnCodError + Endproc + + +Enddefine && CLASS c_conversor_prg_a_mnx AS c_conversor_prg_a_bin + + + +Define Class c_conversor_bin_a_prg As c_conversor_base + #If .F. + Local This As c_conversor_bin_a_prg Of 'FOXBIN2PRG.PRG' + #Endif + + _MemberData = [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] ; + + [] + + + Procedure convert +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toModulo (!@ OUT) Objeto generado de clase correspondiente con la información leida del texto +* toEx (!@ OUT) Objeto con información del error +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toModulo, toEx As Exception, toFoxBin2Prg + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + DoDefault( @toModulo, @toEx, @toFoxBin2Prg ) + Endproc + + + Procedure classify_PAM_Hidden_Protected +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tnPropsAndValues_Count (@! IN ) +* taPropsAndValues (@! IN ) +* tnProtected_Count (@! IN ) +* taProtected (@! IN ) +* tnPropsAndComments_Count (@! IN ) +* taPropsAndComments (@! IN ) +* tcHiddenProp (@! OUT) Lista de propiedades Hidden +* tcProtectedProp (@! OUT) Lista de propiedades Protected +*--------------------------------------------------------------------------------------------------- + Lparameters tnPropsAndValues_Count, taPropsAndValues, tnProtected_Count, taProtected ; + , tnPropsAndComments_Count, taPropsAndComments, tcHiddenProp, tcProtectedProp + + If tnPropsAndValues_Count > 0 Then +*-- Recorro las propiedades (campo Properties) para ir conformando +*-- las definiciones HIDDEN y PROTECTED + Local lcProp, I + + Store '' To tcHiddenProp, tcProtectedProp + + For I = 1 To tnProtected_Count + Do Case + Case Empty( taProtected(m.I) ) + Loop + + Case Right( taProtected(m.I), 1 ) == '^' +*-- Hidden Property or method + lcProp = Chrtran( taProtected(m.I), '^', '' ) + If Ascan(taPropsAndComments, '*' + lcProp, 1, 0, 1, 1+2+4) > 0 + Loop && method + Endif + tcHiddenProp = tcHiddenProp + ',' + lcProp + + Otherwise +*-- Protected Property or method + If Ascan(taPropsAndComments, '*' + taProtected(m.I), 1, 0, 1, 1+2+4) > 0 + Loop && method + Endif + tcProtectedProp = tcProtectedProp + ',' + taProtected(m.I) + Endcase + Endfor + + Endif + Endproc + + + + Procedure get_ADD_OBJECT_METHODS + Lparameters toRegObj, toRegClass, tcMethods, taMethods, taCode, tnMethodCount ; + , taPropsAndComments, tnPropsAndComments_Count, taProtected, tnProtected_Count ; + , toFoxBin2Prg + + External Array taPropsAndComments, taProtected + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lcMethodName, lnMethodCount + + With This As c_conversor_bin_a_prg Of 'FOXBIN2PRG.PRG' + lnMethodCount = tnMethodCount + .method2Array( toRegObj.METHODS, @taMethods, @taCode, '', @tnMethodCount ; + , @taPropsAndComments, tnPropsAndComments_Count, @taProtected, tnProtected_Count, @toFoxBin2Prg, @toRegObj ) + +*-- Ubico los métodos protegidos y les cambio la definición. +*-- Los métodos se deben generar con la ruta completa, porque si no es imposible saber a que objeto corresponden, +*-- o si son de la clase. + If tnMethodCount - lnMethodCount > 0 Then + For I = lnMethodCount + 1 To tnMethodCount + If taMethods(m.I,2) = 0 + Loop + Endif + + If Empty(toRegObj.Parent) + lcMethodName = toRegObj.OBJNAME + '.' + taMethods(m.I,1) + Else + Do Case + Case '.' $ toRegObj.Parent + lcMethodName = Substr(toRegObj.Parent, At('.', toRegObj.Parent) + 1) + '.' + toRegObj.OBJNAME + '.' + taMethods(m.I,1) + + Case Lower( Left(toRegObj.Parent + '.', Len( toRegClass.OBJNAME + '.' ) ) ) == Lower( toRegClass.OBJNAME + '.' ) + lcMethodName = toRegObj.OBJNAME + '.' + taMethods(m.I,1) + + Otherwise + lcMethodName = toRegObj.Parent + '.' + toRegObj.OBJNAME + '.' + taMethods(m.I,1) + + Endcase + Endif + +*-- Genero el método SIN indentar, ya que se hace luego + taCode(taMethods(m.I,2)) = 'PROCEDURE ' + lcMethodName + CR_LF + .indentMemo( taCode(taMethods(m.I,2)) ) + CR_LF + 'ENDPROC' + taMethods(m.I,1) = lcMethodName + Endfor + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toRegObj, toRegClass, tcMethods, taMethods, taCode, tnMethodCount ; + , taPropsAndComments, tnPropsAndComments_Count, taProtected, tnProtected_Count ; + , toFoxBin2Prg, lcMethodName, lnMethodCount + Endtry + + Return + Endproc + + + + Procedure get_CLASS_METHODS + Lparameters tnMethodCount, taMethods, taCode, taProtected, taPropsAndComments, toFoxBin2Prg +*-- DEFINIR MÉTODOS DE LA CLASE +*-- Ubico los métodos protegidos y les cambio la definición + External Array taMethods, taCode, taProtected, taPropsAndComments + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lcMethod, lcMethodName, lnProtectedItem, lnCommentRow, lcProcDef, lcMethods, lnLen + Store '' To lcMethod, lcMethodName, lcProcDef, lcMethods + + If tnMethodCount > 0 Then + With This As c_conversor_bin_a_prg Of 'FOXBIN2PRG.PRG' + For I = 1 To tnMethodCount + lcMethodName = Chrtran( taMethods(m.I,1), '^', '' ) + lnProtectedItem = Ascan( taProtected, taMethods(m.I,1), 1, 0, 0, 1+2+4) + + If lnProtectedItem = 0 + lnProtectedItem = Ascan( taProtected, taMethods(m.I,1) + '^', 1, 0, 0, 1+2+4) + + If lnProtectedItem = 0 +*-- Método común + lcProcDef = 'PROCEDURE' + Else +*-- Método oculto + lcProcDef = 'HIDDEN PROCEDURE' + Endif + Else +*-- Método protegido + lcProcDef = 'PROTECTED PROCEDURE' + Endif + + lnCommentRow = Ascan( taPropsAndComments, '*' + lcMethodName, 1, 0, 1, 1+2+4+8) + +*-- Nombre del método + lcMethod = lcProcDef + ' ' + taMethods(m.I,1) + +*-- Comentarios del método (si tiene) + If lnCommentRow > 0 And Not Empty(taPropsAndComments(lnCommentRow,2)) +* PRG_Compat_Level >= 1 + If Bitand(toFoxBin2Prg.n_PRG_Compat_Level, 1) > 0 + lcMethod = lcMethod + C_TAB + C_TAB + 'HELPSTRING "' + taPropsAndComments(lnCommentRow,2) + '"' + Else +* PRG_Compat_Level = 0 (Default old setting) + lcMethod = lcMethod + C_TAB + C_TAB + '&' + '& ' + taPropsAndComments(lnCommentRow,2) + Endif + Endif + +*-- Código del método + If taMethods(m.I,2) > 0 Then + taCode(taMethods(m.I,2)) = lcMethod + CR_LF + .indentMemo( taCode(taMethods(m.I,2)) ) + CR_LF + 'ENDPROC' + Else + lnLen = Alen(taCode,1) + 1 + Dimension taCode( lnLen ) + taCode( lnLen ) = lcMethod + CR_LF + 'ENDPROC' + taMethods(m.I,2) = lnLen + Endif + Endfor + Endwith && THIS + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tnMethodCount, taMethods, taCode, taProtected, taPropsAndComments ; + , lcMethod, lcMethodName, lnProtectedItem, lnCommentRow, lcProcDef, lcMethods, lnLen + Endtry + + Return + Endproc + + + + Procedure get_OLEPublicObjectName + Lparameters ta_NombresObjsOle +*-- Obtengo los objetos "OLEPublic" + Local I + + Select Padr(OBJNAME,100) OBJNAME ; + FROM TABLABIN ; + WHERE TABLABIN.PLATFORM = "COMMENT" And TABLABIN.RESERVED2 == "OLEPublic" ; + ORDER By 1 ; + INTO Array ta_NombresObjsOle + + For I = 1 To _Tally + ta_NombresObjsOle(m.I) = Alltrim( ta_NombresObjsOle(m.I) ) + Endfor + + Return + Endproc + + + + Procedure get_PropsAndCommentsFrom_RESERVED3 +*-- Sirve para el memo RESERVED3 +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcMemo (v! IN ) Contenido de un campo MEMO +* tlSort (v? IN ) Indica si se deben ordenar alfabéticamente los nombres +* taPropsAndComments (!@ OUT) Array con las propiedades y comentarios +* tnPropsAndComments_Count (!@ OUT) Cantidad de propiedades +* tcSortedMemo (@? OUT) Contenido del campo memo ordenado +*--------------------------------------------------------------------------------------------------- + Lparameters tcMemo, tlSort, taPropsAndComments, tnPropsAndComments_Count, tcSortedMemo + + External Array taPropsAndComments + + Try + Local laLines(1), I, lnPos, loEx As Exception + tcSortedMemo = '' + tnPropsAndComments_Count = Alines(laLines, tcMemo, 1+4) + + If tnPropsAndComments_Count <= 1 And Empty(laLines) + tnPropsAndComments_Count = 0 + Exit + Endif + + Dimension taPropsAndComments(tnPropsAndComments_Count,2) + + For I = 1 To tnPropsAndComments_Count + lnPos = At(' ', laLines(m.I)) && Un espacio separa la propiedad de su comentario (si tiene) + + If lnPos = 0 + taPropsAndComments(m.I,1) = Lower( laLines(m.I) ) + taPropsAndComments(m.I,2) = '' + Else + taPropsAndComments(m.I,1) = Lower( Left( laLines(m.I), lnPos - 1 ) ) + taPropsAndComments(m.I,2) = Substr( laLines(m.I), lnPos + 1 ) + Endif + Endfor + + If tlSort And This.l_PropSort_Enabled + Asort( taPropsAndComments, 1, -1, 0, 1 ) + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcMemo, tlSort, taPropsAndComments, tnPropsAndComments_Count, tcSortedMemo ; + , laLines, I, lnPos, loEx + Endtry + + Return + Endproc + + + + Procedure get_PropsAndValuesFrom_PROPERTIES +*-- Sirve para el memo PROPERTIES +*--------------------------------------------------------------------------------------------------- +* KNOWLEDGE BASE: +* 29/11/2013 FDBOZZO En un pageframe, si las props.nativas del mismo no están antes que las de +* los objetos contenidos, causa un error. Se deben ordenar primero las +* props.nativas (sin punto) y luego las de los objetos (con punto) +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcMemo (v! IN ) Contenido de un campo MEMO +* tnSort (v? IN ) Indica si se deben ordenar alfabéticamente los objetos y props (1), o no (0) +* taPropsAndValues (!@ OUT) Array con las propiedades y comentarios +* tnPropsAndValues_Count (!@ OUT) Cantidad de propiedades +* tcSortedMemo (?@ OUT) Contenido del campo memo ordenado +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters tcMemo, tnSort, taPropsAndValues, tnPropsAndValues_Count, tcSortedMemo, toFoxBin2Prg + + External Array taPropsAndValues + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local laItems(1), I, X, lnLenAcum, lnPosEQ, lcPropName, lnLenVal, lcValue, lcMethods, lcLastIncompletePropName + Store '' To tcSortedMemo, lcLastIncompletePropName + tnPropsAndValues_Count = 0 + + If Not Empty(m.tcMemo) + With This As c_conversor_bin_a_prg Of 'FOXBIN2PRG.PRG' + lnItemCount = Alines(laItems, m.tcMemo, 0, CR_LF) && Específicamente CR+LF para que no reconozca los CR o LF por separado + X = 0 + + If lnItemCount <= 1 And Empty(laItems) + lnItemCount = 0 + Exit + Endif + + +*-- 1) OBTENCIÓN Y SEPARACIÓN DE PROPIEDADES Y VALORES +*-- Crear un array con los valores especiales que pueden estar repartidos entre varias lineas + For I = 1 To m.lnItemCount + If Empty( laItems(m.I) ) + Loop + Endif + + If C_MPROPHEADER $ laItems(m.I) +*-- Solo entrará por aquí cuando se evalúe una propiedad de PROPERTIES con un valor especial (largo) + lnLenAcum = 0 + lnPosEQ = At( '=', laItems(m.I) ) + lcPropName = lcLastIncompletePropName + Left( laItems(m.I), lnPosEQ - 2 ) + lnLenVal = Int( Val( Substr( laItems(m.I), lnPosEQ + 2 + 517, 8) ) ) + lcValue = Substr( laItems(m.I), lnPosEQ + 2 + 517 + 8 ) + + If Len( lcValue ) < lnLenVal +*-- Como el valor es multi-línea, debo agregarle los CR_LF que le quitó el ALINES() + For I = m.I + 1 To m.lnItemCount + lcValue = lcValue + CR_LF + laItems(m.I) + + If Len( lcValue ) >= lnLenVal + Exit + Endif + Endfor + + lcValue = C_FB2P_VALUE_I + CR_LF + lcValue + CR_LF + C_FB2P_VALUE_F + Else + lcValue = C_FB2P_VALUE_I + lcValue + C_FB2P_VALUE_F + Endif + +*-- Es un valor especial, por lo que se encapsula en un marcador especial + X = m.X + 1 + Dimension taPropsAndValues(m.X,2) + taPropsAndValues(m.X,1) = lcPropName + taPropsAndValues(m.X,2) = .normalizePropertyValue( lcPropName, lcValue, '' ) + + Else +*-- Propiedad normal + lnPosEQ = At( '=', laItems(m.I) ) + + If lnPosEQ = 0 Then +*-- AUTOFIX DE PROPIEDAD PARTIDA: +*-- Esto solo puede ocurrir cuando en el memo de Propiedades hay alguna propiedad +*-- partida debido a una edición manual con un Enter erróneo, algo como esto: +* comm +* AND2.Caption = "Command2" +* +*-- En el caso anterior, las 2 líneas son realmente una: +* command2.Caption = "Command2" +* +*-- Solución: Guardar esta parte del nombre y agregarlo a la próxima propiedad. + lcLastIncompletePropName = laItems(m.I) + Loop + Endif + +* Skip ZOrderSet property if configured to + If toFoxBin2Prg.l_RemoveZOrderSetFromProps And Atc( '.ZOrderSet.', '.' + lcLastIncompletePropName + Left( laItems(m.I), lnPosEQ - 2 ) + '.' ) > 0 Then + lcLastIncompletePropName = '' + Loop + Endif + + X = m.X + 1 + Dimension taPropsAndValues(m.X,2) + taPropsAndValues(m.X,1) = lcLastIncompletePropName + Left( laItems(m.I), lnPosEQ - 2 ) +*!* Changed by: LScheffler 16.3.2023 +*!* +*!* Changed by: LScheffler
+*!* Problems with property values with leading and trailing spaces +*!* and with double ampersand in value +*!* we just do not LTRIM so we keep the leading space here
+*!* see issues #90, #91 +*!*
+*!*
+ +* taPropsAndValues(m.X,2) = .normalizePropertyValue( taPropsAndValues(m.X,1), Ltrim( Substr( laItems(m.I), lnPosEQ + 2 ) ), '' ) + taPropsAndValues(m.X,2) = .normalizePropertyValue( taPropsAndValues(m.X,1), Substr( laItems(m.I), lnPosEQ + 2 ), '' ) + +*!* /Changed by: LScheffler 16.3.2023 + Endif + + lcLastIncompletePropName = '' + Endfor + + + tnPropsAndValues_Count = m.X + lcMethods = '' + + +*-- 2) SORT + .sortPropsAndValues( @taPropsAndValues, tnPropsAndValues_Count, tnSort ) + + +*-- Agregar propiedades primero + For I = 1 To m.tnPropsAndValues_Count + tcSortedMemo = m.tcSortedMemo + m.taPropsAndValues(m.I,1) + ' = ' + m.taPropsAndValues(m.I,2) + CR_LF + Endfor + +*-- Agregar métodos al final + tcSortedMemo = m.tcSortedMemo + m.lcMethods + + Endwith && THIS + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcMemo, tnSort, taPropsAndValues, tnPropsAndValues_Count, tcSortedMemo ; + , laItems, I, X, lnLenAcum, lnPosEQ, lcPropName, lnLenVal, lcValue, lcMethods + Endtry + + Return + Endproc + + + + Procedure get_PropsFrom_PROTECTED +*--------------------------------------------------------------------------------------------------- +*-- Sirve para el memo PROTECTED +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* tcMemo (v! IN ) Contenido de un campo MEMO +* tlSort (v? IN ) Indica si se deben ordenar alfabéticamente los nombres +* taProtected (!@ OUT) Array con las propiedades y comentarios +* tnProtected_Count (!@ OUT) Cantidad de propiedades +* tcSortedMemo (@? OUT) Contenido del campo memo ordenado +*--------------------------------------------------------------------------------------------------- + Lparameters tcMemo, tlSort, taProtected, tnProtected_Count, tcSortedMemo + + External Array taProtected + + Local I + tcSortedMemo = '' + tnProtected_Count = Alines(taProtected, tcMemo, 1+4) + + If tnProtected_Count <= 1 And Empty(taProtected) + tnProtected_Count = 0 + Else + If tlSort And This.l_PropSort_Enabled + Asort( taProtected, 1, -1, 0, 1 ) + Endif + + For I = tnProtected_Count To 1 Step -1 +*-- El ASCAN es para evitar valores repetidos, que se eliminarán. v1.19.29 + taProtected(m.I) = taProtected(m.I) + If Ascan( taProtected, taProtected(m.I), 1, -1, 0, 1+2+4 ) = m.I + tcSortedMemo = tcSortedMemo + taProtected(m.I) + CR_LF + Else + Adel( taProtected, m.I ) + tnProtected_Count = tnProtected_Count - 1 + Endif + Endfor + + Dimension taProtected(tnProtected_Count) + Endif + + Release tcMemo, tlSort, taProtected, tnProtected_Count, tcSortedMemo, I + Return + Endproc + + + + Procedure ignoreCorruptedObjects(lcCursor) +* Issue#17 - Error, The specified key already exists +* Para evitar este error se deben ignorar los objetos corruptos (duplicados) +* Se identifican porque la clase principal el campo Reserved1 tiene vacio en vez de "Class" + Local lcParentObjName, lcSetDeleted + Select (lcCursor) + lcSetDeleted = Set("Deleted") + Set Deleted Off + +*!* Changed by: LScheffler 25.2.2022 +*!* +*!* Changed by: LScheffler
+*!* https://github.com/fdbozzo/foxbin2prg/issues/78 / After vc2 convert back to vcx class is corrupted no errors reported +*!* Better named: Missing class when building text file from corrupted VCX +*!* If the VCX is corrupted and holds empty records, the original coed will delete the next class. +*!* This because the while clause for an empty OBJNAME deletes the record with the class itself, since this never has a PARENT +*!* Solution is from bjornhoeksel, see issue +*!*
+*!*
+ +* Scan For PLATFORM = "WINDOWS" And Empty(Parent) And Empty(RESERVED1) +* lcParentObjName = Lower(OBJNAME) +* Delete +* Skip +* Delete Rest While Getwordnum(Lower(Parent) + '.', 1, '.') == lcParentObjName +* Skip -1 +* Endscan + + Scan For PLATFORM = "WINDOWS" And Empty(Parent) And Empty(RESERVED1) + lcParentObjName = Lower(OBJNAME) + Delete + If (Not Empty(lcParentObjName)) Then + Skip + Delete Rest While Getwordnum(Lower(Parent) + '.', 1, '.') == lcParentObjName + Skip -1 + Endif + Endscan +*!* /Changed by: LScheffler 25.2.2022 + + Set Deleted &lcSetDeleted. + Return + Endproc + + + + Procedure ignoreIncorrectDefinedObjects(lcCursor) +* Issue#15 - VFP Designer ignored objects should be ignored by FoxBin2Prg + Local lcObjName, lcParent, lcParentObjName, loObjs As Collection + loObjs = Createobject("Collection") + Select (lcCursor) + + Scan For PLATFORM = "WINDOWS" + lcObjName = Lower(OBJNAME) + lcParent = Lower(Parent) + + If Empty(lcParent) + lcParentObjName = lcObjName + Else + lcParentObjName = lcParent + '.' + lcObjName + Endif + + If Not Empty(lcParent) +* Tiene Parent, y debe existir, si no es ignorado +* NOTA: Del parent solo se puede comprobar el objeto primario. + If loObjs.GetKey(Getwordnum(lcParent + '.', 1, '.')) > 0 +* Existe: se agrega al array el nuevo objeto +* NOTA: Podría estar duplicado, pero no se trata ese caso aquí + If Not Empty(lcParentObjName) And loObjs.GetKey(lcParentObjName) = 0 + loObjs.Add( '', lcParentObjName ) + Endif + Else +* No existe: se ignora + Delete + Endif + Else +* No Existe: se agrega al array + If Not Empty(lcParentObjName) And loObjs.GetKey(lcParentObjName) = 0 + loObjs.Add( '', lcParentObjName ) + Endif + + Endif + Endscan + + Return + Endproc + + + + Procedure indentMemo + Lparameters tcMethod, tcIndentation, tlKeepProcHeader +*-- INDENTA EL CÓDIGO DE UN MÉTODO DADO Y QUITA LA CABECERA DE MÉTODO (PROCEDURE/ENDPROC) SI LA ENCUENTRA + Try + Local I, X, lcMethod, llProcedure, lnInicio, lnFin, laLineas(1), lnOffset ; + , loLang As CL_LANG Of 'FOXBIN2PRG.PRG' + + loLang = _Screen.o_FoxBin2Prg_Lang + lcMethod = '' + lnInicio = 1 + lnOffset = 0 + lnFin = Alines(laLineas, tcMethod) + llProcedure = ( Left(laLineas(1),10) == 'PROCEDURE ' ; + OR Left(laLineas(1),17) == 'HIDDEN PROCEDURE ' ; + OR Left(laLineas(1),20) == 'PROTECTED PROCEDURE ' ) + + If Vartype(tcIndentation) # 'C' + tcIndentation = '' + Endif + +*-- Quito las líneas en blanco luego del final del ENDPROC + X = 0 + For I = lnFin To 1 Step -1 + If Not Empty(laLineas(m.I)) && Última línea de código + If llProcedure And Left( Chrtran(laLineas(m.I), C_TAB, ' ') + ' ', 8 ) <> C_ENDPROC + ' ' Then +*ERROR 'Procedimiento sin cerrar. La última línea de código debe ser ENDPROC. [' + laLineas(1) + ']' + Error (Textmerge(loLang.C_PROCEDURE_NOT_CLOSED_ON_LINE_LOC)) + Endif + Exit + Endif + X = m.X + 1 + Endfor + + If m.X > 0 + lnFin = lnFin - m.X + Dimension laLineas(lnFin) + Endif + +*-- Si encuentra la cabecera de un PROCEDURE, la saltea + If llProcedure + lnOffset = 1 + Endif + + For I = lnInicio + lnOffset To lnFin - lnOffset +*-- TEXT/ENDTEXT aquí da error 2044 de recursividad. No usar. + lcMethod = lcMethod + CR_LF + tcIndentation + laLineas(m.I) + Endfor + + If llProcedure And tlKeepProcHeader + lcMethod = CR_LF + C_TAB + laLineas(lnInicio) + lcMethod + CR_LF + C_TAB + laLineas(lnFin) + Endif + + lcMethod = Substr(lcMethod,3) && Quito el primer ENTER (CR+LF) + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcMethod, tcIndentation, tlKeepProcHeader ; + , I, X, llProcedure, lnInicio, lnFin, laLineas, lnOffset + Endtry + + Return lcMethod + Endproc + + + + Procedure memoInOneLine + Lparameters tcMethod + + Try + Local lcLine, I + lcLine = '' + + If Not Empty(tcMethod) + For I = 1 To Alines(laLines, m.tcMethod, 0) + lcLine = lcLine + ', ' + laLines(m.I) + Endfor + + lcLine = Substr(lcLine, 3) + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcMethod, I + Endtry + + Return lcLine + Endproc + + + + Procedure set_MultilineMemoWithAddObjectProperties + Lparameters taPropsAndValues, tnPropCount, tcLeftIndentation, tlNormalizeLine + + External Array taPropsAndValues + + Try + Local lcLine, I, lcComentarios, laLines(1), lcFinDeLinea + lcLine = '' + lcFinDeLinea = ', ;' + CR_LF + + If tnPropCount > 0 + If Vartype(tcLeftIndentation) # 'C' + tcLeftIndentation = '' + Endif + + For I = 1 To tnPropCount + lcLine = lcLine + tcLeftIndentation + taPropsAndValues(m.I,1) + ' = ' + taPropsAndValues(m.I,2) + lcFinDeLinea + Endfor + +*-- Quito el ", ;" final + lcLine = tcLeftIndentation + Substr(lcLine, 1 + Len(tcLeftIndentation), Len(lcLine) - Len(tcLeftIndentation) - Len(lcFinDeLinea)) + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release taPropsAndValues, tnPropCount, tcLeftIndentation, tlNormalizeLine ; + , I, lcComentarios, laLines, lcFinDeLinea + Endtry + + Return lcLine + Endproc + + + Procedure set_UserValue +*--------------------------------------------------------------------------------------------------- +* Intenta obtener información más precisa sobre el error a reportar dentro de methods +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toEx (v! IN ) Objeto Exception +*--------------------------------------------------------------------------------------------------- + Lparameters toEx As Exception + + Local lcMethods, I, lcLine, laCodeLines(1), lcMethod, lcLocation, lnErrorLine + Store '' To lcMethods, lcLine, laCodeLines, lcMethod, lcLocation + Store 0 To lnErrorLine, I + + With This As c_conversor_bin_a_prg Of 'FOXBIN2PRG.PRG' + toEx.UserValue = toEx.UserValue + CR_LF + + If Not Empty(Alias()) And Inlist(.c_Type, 'SCX', 'VCX') Then + If Type("METHODS")#"U" Then + lcMethods = METHODS + Endif + toEx.UserValue = toEx.UserValue + 'Error location ' + '..............................' + CR_LF + + If Type("PARENT")#"U" And Not Empty(Parent) Then + lcLocation = lcLocation + Parent + '.' + Endif + + If Type("OBJNAME")#"U" Then + lcLocation = lcLocation + OBJNAME + Endif + +*-- Busco el Procedure si hay un n_Methods_LineNo + Alines(laCodeLines, lcMethods) + + For I = .n_Methods_LineNo To 1 Step -1 + lcLine = Ltrim( laCodeLines(m.I), 0, ' ', Chr(9) ) + + Do Case + Case Left(lcLine, 10) == 'PROCEDURE ' + lcMethod = Alltrim( Substr( lcLine, 11) ) + lnErrorLine = .n_Methods_LineNo - m.I + Exit + + Case Left(lcLine, 9) == 'FUNCTION ' + lcMethod = Alltrim( Substr( lcLine, 10) ) + lnErrorLine = .n_Methods_LineNo - m.I + Exit + + Endcase + + Endfor + + If Empty(lcMethod) Then + lcLocation = 'Class: ' + lcLocation + Else + lcLocation = 'Method: ' + lcLocation + '.' + lcMethod + Endif + + If lnErrorLine > 0 Then + lcLocation = lcLocation + ', Line ' + Transform(lnErrorLine) + Endif + + toEx.UserValue = toEx.UserValue + lcLocation + CR_LF + + If .n_Methods_LineNo = 0 Then + toEx.UserValue = toEx.UserValue + '> (no evaluated code yet)' + CR_LF + Else + toEx.UserValue = toEx.UserValue + '> ' + laCodeLines(.n_Methods_LineNo) + CR_LF + Endif + Endif + + toEx.UserValue = toEx.UserValue + 'Recno: ' + Transform(Recno()) + CR_LF + toEx.UserValue = toEx.UserValue + '.............................................' + CR_LF + Endwith + Endproc + + + Procedure sortMethod + Lparameters tcMethod, taMethods, taCode, tcSorted, tnMethodCount, taPropsAndComments, tnPropsAndComments_Count ; + , taProtected, tnProtected_Count, toFoxBin2Prg + + External Array taMethods, taCode, taPropsAndComments, taProtected + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local I, I2, laMethods(1,3), lnDeleted, lcMethodName, lnMethodPos, lcMethodType, loEx As Exception + + If tnMethodCount > 0 Then + +*-- taMethods[1,3] +*-- 1.Nombre Método +*-- 2.Posición Original +*-- 3.Tipo (HIDDEN/PROTECTED/NORMAL) + +*-- Alphabetical ordering of methods + If This.l_MethodSort_Enabled + Asort(taMethods,1,-1,0,1) + Endif + + Dimension laMethods(tnMethodCount,3) + lnDeleted = 0 + + For I = tnMethodCount To 1 Step -1 + If taMethods(m.I,2) > 0 Then + If '.' $ taMethods(m.I,1) +*-- Los métodos con '.' los mando a otro array + lnDeleted = lnDeleted + 1 + laMethods(lnDeleted,1) = taMethods(m.I,1) + laMethods(lnDeleted,2) = taMethods(m.I,2) + laMethods(lnDeleted,3) = taMethods(m.I,3) + Adel( taMethods, m.I ) + Endif + Endif + Endfor + + For I = lnDeleted To 1 Step -1 +*-- Los métodos con '.' los paso al final + I2 = tnMethodCount - lnDeleted + (lnDeleted - m.I) + 1 + taMethods(I2,1) = laMethods(m.I,1) + taMethods(I2,2) = laMethods(m.I,2) + taMethods(I2,3) = laMethods(m.I,3) + Endfor + + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcMethod, taMethods, taCode, tcSorted, tnMethodCount, taPropsAndComments, tnPropsAndComments_Count ; + , taProtected, tnProtected_Count, toFoxBin2Prg ; + , I, I2, laMethods, lnDeleted, lcMethodName, lnMethodPos, lcMethodType, loEx + Endtry + + Return + Endproc && SordMethod + + + + Procedure method2Array + Lparameters tcMethod, taMethods, taCode, tcSorted, tnMethodCount, taPropsAndComments, tnPropsAndComments_Count ; + , taProtected, tnProtected_Count, toFoxBin2Prg, toRegObj +*-- 29/10/2013 Fernando D. Bozzo +*-- Se tiene en cuenta la posibilidad de que haya un PROC/ENDPROC dentro de un TEXT/ENDTEXT +*-- cuando es usado en un generador de código o similar. + External Array taMethods, taCode, taPropsAndComments, taProtected + + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + +*-- ESTRUCTURA DE LOS ARRAYS CREADOS: +*-- taMethods[1,3] +*-- 1.Nombre Método +*-- 2.Posición Original +*-- 3.Tipo (HIDDEN/PROTECTED/NORMAL) +*-- taCode[1] +*-- 1.Bloque de código del método en su posición original + Try + Local lnLineCount, laLine(1), I, lnTextNodes, tcSorted, lnProtectedLine, lcMethod, lnLine_Len, lcLine, llProcOpen ; + , laLineasExclusion(1), lnBloquesExclusion, lcLastLine ; + , loEx As Exception + + If Not Empty(m.tcMethod) And Left(m.tcMethod,9) == "ENDPROC"+Chr(13)+Chr(10) + tcMethod = Substr(m.tcMethod,10) + Endif + + If Not Empty(m.tcMethod) + With This As c_conversor_bin_a_prg Of 'FOXBIN2PRG.PRG' + Dimension laLine(1) + Store '' To laLine, lcLine, lcLastLine + Store 0 To lnTextNodes + + lnLineCount = Alines(laLine, m.tcMethod) && NO aplicar nungún formato ni limpieza, que es el CÓDIGO FUENTE + +*-- Delete beginning empty lines before first "PROCEDURE", that is the first not empty line. + For I = 1 To lnLineCount + If Empty(laLine(m.I)) Or Left( Ltrim(laLine(m.I)),1 ) = '*' +*-- Skip empty and commented lines + Else + If m.I > 1 + For X = m.I-1 To 1 Step -1 + Adel(laLine, m.X) + Endfor + lnLineCount = lnLineCount - m.I + 1 + Dimension laLine(lnLineCount) + Endif + Exit + Endif + Endfor + +*-- Delete ending empty lines after last "ENDPROC", that is the last not empty line. + For I = lnLineCount To 1 Step -1 + If Empty(laLine(m.I)) Or Left( Ltrim(laLine(m.I)),1 ) = '*' + Adel(laLine, m.I) + Else + If m.I < lnLineCount + lnLineCount = m.I + Dimension laLine(lnLineCount) + Endif + Exit + Endif + Endfor + +*-- Identifico los TEXT/ENDTEXT, #IF .F./#ENDIF + .identifyExclusionBlocks( @laLine, lnLineCount, .F., @laLineasExclusion, @lnBloquesExclusion ) + +*-- Analyze and count line methods, get method names and consolidate block code + For I = 1 To lnLineCount + If toFoxBin2Prg.l_RemoveNullCharsFromCode + laLine(m.I) = Chrtran( laLine(m.I), C_NULL_CHAR, '' ) + Endif + + lnLine_Len = Len( laLine(m.I) ) + lcLastLine = lcLine + toFoxBin2Prg.set_Line( @lcLine, @laLine, m.I ) + .get_SeparatedLineAndComment( @lcLine ) + + Do Case + Case laLineasExclusion(m.I) + If tnMethodCount > 0 And llProcOpen + taCode(tnMethodCount) = taCode(tnMethodCount) + laLine(m.I) + CR_LF + Else +*-- Invalid method code, as outer code added for tools like ReFox or others, is cleaned up + Endif + + Case Right(lcLastLine,1) == ';' +*-- Saltear el análisis de esta línea, que es continuación de la anterior (lcLastLine). + taCode(tnMethodCount) = taCode(tnMethodCount) + laLine(m.I) + CR_LF + Loop + + Case lnTextNodes = 0 And Upper( Left(lcLine, 10) ) == 'PROCEDURE ' + tnMethodCount = tnMethodCount + 1 + Dimension taMethods(tnMethodCount, 3), taCode(tnMethodCount) + taMethods(tnMethodCount, 1) = Rtrim( Substr(lcLine, 11), 0, Chr(9), Chr(0), ' ' ) + taMethods(tnMethodCount, 2) = tnMethodCount + taMethods(tnMethodCount, 3) = '' + taCode(tnMethodCount) = 'PROCEDURE ' + taMethods(tnMethodCount, 1) + CR_LF && laLine(m.I) + CR_LF + llProcOpen = .T. + + Case lnTextNodes = 0 And Upper( Left(lcLine, 9) ) == 'FUNCTION ' && NOT VALID WITH VFP IDE, BUT 3rd. PARTY SOFTWARE CAN USE IT + tnMethodCount = tnMethodCount + 1 + Dimension taMethods(tnMethodCount, 3), taCode(tnMethodCount) + taMethods(tnMethodCount, 1) = Rtrim( Substr(lcLine, 10), 0, Chr(9), Chr(0), ' ' ) + taMethods(tnMethodCount, 2) = tnMethodCount + taMethods(tnMethodCount, 3) = '' + taCode(tnMethodCount) = 'PROCEDURE ' + taMethods(tnMethodCount, 1) + CR_LF && laLine(m.I) + CR_LF + llProcOpen = .T. + + Case lnTextNodes = 0 And Upper( Left(lcLine, 17) ) == 'HIDDEN PROCEDURE ' + tnMethodCount = tnMethodCount + 1 + Dimension taMethods(tnMethodCount, 3), taCode(tnMethodCount) + taMethods(tnMethodCount, 1) = Rtrim( Substr(lcLine, 18), 0, Chr(9), Chr(0), ' ' ) + taMethods(tnMethodCount, 2) = tnMethodCount + taMethods(tnMethodCount, 3) = 'HIDDEN ' + taCode(tnMethodCount) = 'HIDDEN PROCEDURE ' + taMethods(tnMethodCount, 1) + CR_LF && laLine(m.I) + CR_LF + llProcOpen = .T. + + Case lnTextNodes = 0 And Upper( Left(lcLine, 16) ) == 'HIDDEN FUNCTION ' && NOT VALID WITH VFP IDE, BUT 3rd. PARTY SOFTWARE CAN USE IT + tnMethodCount = tnMethodCount + 1 + Dimension taMethods(tnMethodCount, 3), taCode(tnMethodCount) + taMethods(tnMethodCount, 1) = Rtrim( Substr(lcLine, 17), 0, Chr(9), Chr(0), ' ' ) + taMethods(tnMethodCount, 2) = tnMethodCount + taMethods(tnMethodCount, 3) = 'HIDDEN ' + taCode(tnMethodCount) = 'HIDDEN PROCEDURE ' + taMethods(tnMethodCount, 1) + CR_LF && laLine(m.I) + CR_LF + llProcOpen = .T. + + Case lnTextNodes = 0 And Upper( Left(lcLine, 20) ) == 'PROTECTED PROCEDURE ' + tnMethodCount = tnMethodCount + 1 + Dimension taMethods(tnMethodCount, 3), taCode(tnMethodCount) + taMethods(tnMethodCount, 1) = Rtrim( Substr(lcLine, 21), 0, Chr(9), Chr(0), ' ' ) + taMethods(tnMethodCount, 2) = tnMethodCount + taMethods(tnMethodCount, 3) = 'PROTECTED ' + taCode(tnMethodCount) = 'PROTECTED PROCEDURE ' + taMethods(tnMethodCount, 1) + CR_LF && laLine(m.I) + CR_LF + llProcOpen = .T. + + Case lnTextNodes = 0 And Upper( Left(lcLine, 19) ) == 'PROTECTED FUNCTION ' && NOT VALID WITH VFP IDE, BUT 3rd. PARTY SOFTWARE CAN USE IT + tnMethodCount = tnMethodCount + 1 + Dimension taMethods(tnMethodCount, 3), taCode(tnMethodCount) + taMethods(tnMethodCount, 1) = Rtrim( Substr(lcLine, 20), 0, Chr(9), Chr(0), ' ' ) + taMethods(tnMethodCount, 2) = tnMethodCount + taMethods(tnMethodCount, 3) = 'PROTECTED ' + taCode(tnMethodCount) = 'PROTECTED PROCEDURE ' + taMethods(tnMethodCount, 1) + CR_LF && laLine(m.I) + CR_LF + llProcOpen = .T. + + Case lnTextNodes = 0 And Left(lcLine, 7) == 'ENDPROC' + If lnLine_Len >= 7 And Left( Upper( Chrtran( lcLine , '&'+Chr(9)+Chr(0), ' ') ) + ' ' ,8) == 'ENDPROC ' +*-- Es el final de estructura ENDPROC + If Not llProcOpen +*-- Esto no es normal, porque hay más de un ENDPROC, por lo que se ignora. + Loop + Endif + Else +*-- Es otra cosa (variable, etc) + taCode(tnMethodCount) = taCode(tnMethodCount) + lcLine + CR_LF + Loop + Endif + + taCode(tnMethodCount) = taCode(tnMethodCount) + lcLine &&+ CR_LF + llProcOpen = .F. + + Case lnTextNodes = 0 And Left(laLine(m.I), 7) == 'ENDFUNC' && NOT VALID WITH VFP IDE, BUT 3rd. PARTY SOFTWARE CAN USE IT + If lnLine_Len >= 7 And Left( Upper( Chrtran( laLine(m.I) , '&'+Chr(9)+Chr(0), ' ') ) + ' ' ,8) == 'ENDFUNC ' +*-- Es el final de estructura ENDPROC + If Not llProcOpen +*-- Esto no es normal, porque hay más de un ENDFUNC, por lo que se ignora. + Loop + Endif + lcLine = Strtran( lcLine, 'ENDFUNC', 'ENDPROC' ) + Else +*-- Es otra cosa (variable, etc) + taCode(tnMethodCount) = taCode(tnMethodCount) + lcLine + CR_LF + Loop + Endif + + taCode(tnMethodCount) = taCode(tnMethodCount) + lcLine &&+ CR_LF + llProcOpen = .F. + +*CASE tnMethodCount = 0 OR NOT llProcOpen AND LEFT( LTRIM(laLine(m.I)),1 ) = '*' + Case tnMethodCount = 0 Or Not llProcOpen +*-- Skip empty and commented lines before methods begin +*-- Aquí como condición podría poner: NOT llProcOpen AND LEFT(laLine(m.I), 7) # 'ENDPROC', pero abarcaría demasiado. + + Otherwise && Method Code + taCode(tnMethodCount) = taCode(tnMethodCount) + laLine(m.I) + CR_LF + + Endcase + Endfor + +*-- Agrego los métodos definidos, pero sin código (Protected/Reserved3) + For I = 1 To tnPropsAndComments_Count + lcMethod = Chrtran( taPropsAndComments(m.I,1), '*', '' ) + If Left( taPropsAndComments(m.I,1), 1 ) == '*' And Ascan( taMethods, lcMethod, 1, 0, 1, 1+2+4+8 ) = 0 + tnMethodCount = tnMethodCount + 1 + Dimension taMethods(tnMethodCount, 3) &&, taCode(tnMethodCount) + taMethods(tnMethodCount, 1) = lcMethod + taMethods(tnMethodCount, 2) = 0 + + lnProtectedLine = Ascan( taProtected, lcMethod, 1, 0, 1, 1+2+4+8 ) + + If lnProtectedLine = 0 Then + If tnProtected_Count = 0 + lnProtectedLine = 0 + Else + lnProtectedLine = Ascan( taProtected, lcMethod + '^', 1, 0, 1, 1+2+4+8 ) + Endif + + If lnProtectedLine = 0 Then + taMethods(tnMethodCount, 3) = '' + Else + taMethods(tnMethodCount, 3) = 'HIDDEN ' + Endif + Else + taMethods(tnMethodCount, 3) = 'PROTECTED ' + Endif + Endif + Endfor + Endwith && THIS AS c_conversor_bin_a_prg OF 'FOXBIN2PRG.PRG' + Endif + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release tcMethod, taMethods, taCode, tcSorted, tnMethodCount, taPropsAndComments, tnPropsAndComments_Count ; + , taProtected, tnProtected_Count, toFoxBin2Prg ; + , lnLineCount, laLine, I, lnTextNodes, tcSorted, lnProtectedLine, lcMethod, lnLine_Len, lcLine, llProcOpen ; + , laLineasExclusion, lnBloquesExclusion ; + , loEx + Endtry + + Return + Endproc && method2Array + + + + Procedure write_ADD_OBJECTS_WithProperties +*--------------------------------------------------------------------------------------------------- +* PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) +* toRegObj (v! IN ) Objeto de registro +* tcCodigo (@? OUT) Codigo generado +* toFoxBin2Prg (v! IN ) Referencia al objeto principal +*--------------------------------------------------------------------------------------------------- + Lparameters toRegObj, tcCodigo, toFoxBin2Prg + + #If .F. + Local toRegObj As CL_OBJETO Of 'FOXBIN2PRG.PRG' + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + Try + Local lcMemo, laPropsAndValues(1,2), lnPropsAndValues_Count + + With This As c_conversor_bin_a_prg Of 'FOXBIN2PRG.PRG' +*-- Defino los objetos a cargar + .get_PropsAndValuesFrom_PROPERTIES( toRegObj.PROPERTIES, 1, @laPropsAndValues, @lnPropsAndValues_Count, @lcMemo, @toFoxBin2Prg ) + lcMemo = .set_MultilineMemoWithAddObjectProperties( @laPropsAndValues, @lnPropsAndValues_Count, C_TAB + C_TAB, .T. ) + + If '.' $ toRegObj.Parent +*-- Este caso: clase.objeto.objeto ==> se quita clase + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> ADD OBJECT '<>.<>' AS <> <<>> + ENDTEXT + Else +*-- Este caso: objeto + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> ADD OBJECT '<>' AS <> <<>> + ENDTEXT + Endif + + If Not Empty(lcMemo) + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + <> ; + <> + ENDTEXT + Endif + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <><> <<>> + ENDTEXT + + If Not Empty(toRegObj.CLASSLOC) + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + ClassLib="<>" <<>> + ENDTEXT + Endif + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2+4+8 + BaseClass="<>" <<>> + ENDTEXT + +*-- Agrego metainformación para objetos OLE + If toRegObj.BaseClass == 'olecontrol' + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2+4+8 + OLEObject="< 0 Then + .classify_PAM_Hidden_Protected( @tnPropsAndValues_Count, @taPropsAndValues, @tnProtected_Count, @taProtected ; + , @tnPropsAndComments_Count, @taPropsAndComments, @lcHiddenProp, @lcProtectedProp ) + .write_DEFINED_PAM( @taPropsAndComments, tnPropsAndComments_Count, @tcCodigo ) + .write_HIDDEN_Properties( @lcHiddenProp, @tcCodigo ) + .write_PROTECTED_Properties( @lcProtectedProp, @tcCodigo ) + +*-- Escribo las propiedades de la clase y sus comentarios (los comentarios aquí son redundantes) + +*!* Changed by: LScheffler 16.3.2023 +*!* +*!* Changed by: LScheffler
+*!* Problems with property values with leading and trailing spaces +*!* and with double ampersand in value +*!* we just do not add the property comment, the comment will be recreated by the property definiton +*!* section DefinedPropArrayMethod
+*!* see issues #90, #91 +*!*
+*!*
+ If tnPropsAndValues_Count>0 +*LScheffler 16.3.2023 set delimiters around properties value, so we know it's without comment and we can keep "&&" in value + tcCodigo = tcCodigo + Chr(13) + Chr(10) + Chr(9) + C_DEFINED_PROPVAL_I + + For I = 1 To tnPropsAndValues_Count + tcCodigo = tcCodigo + Chr(13) + Chr(10) + Chr(9) + Chr(9) + taPropsAndValues(m.I,1) + ' = ' + taPropsAndValues(m.I,2) + +*LScheffler 16.3.2023 without comment +* If tnPropsAndComments_Count > 0 Then +* lnComment = Ascan( taPropsAndComments, taPropsAndValues(m.I,1), 1, 0, 1, 1+2+4+8) +* +* If lnComment > 0 And Not Empty(taPropsAndComments(lnComment,2)) +* tcCodigo = tcCodigo + Chr(9) + Chr(9) + '&' + '& ' + taPropsAndComments(lnComment,2) +* Endif +* Endif + + Endfor + +*LScheffler 16.3.2023 set delimiters around properties value, so we know it's without comment and we can keep "&&" in value + tcCodigo = tcCodigo + Chr(13) + Chr(10) + Chr(9) + C_DEFINED_PROPVAL_F + Endif &&tnPropsAndValues_Count>0 +*!* /Changed by: LScheffler 16.3.2023 + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> + ENDTEXT + Endif + Endwith && THIS + + Catch To loEx + If This.n_Debug > 0 And _vfp.StartMode = 0 + Set Step On + Endif + + Throw + + Finally + Release toRegClass, taPropsAndValues, taPropsAndComments, taProtected ; + , tnPropsAndValues_Count, tnPropsAndComments_Count, tnProtected_Count ; + , lcHiddenProp, lcProtectedProp, lcPropsMethodsDefd, I ; + , lcPropName, lnProtectedItem, lcComentarios, loEx + Endtry + + Return + Endproc + + + + Procedure write_DEFINED_PAM +*-- Escribo propiedades DEFINED (Reserved3) en este formato: + Lparameters taPropsAndComments, tnPropsAndComments_Count, tcCodigo + +* +*m: *metodovacio_con_comentarios && Este método no tiene código, pero tiene comentarios. A ver que pasa! +*m: *mimetodo && Mi metodo +*p: prop1 && Mi prop 1 +*p: prop_especial_cr && +*a: ^array_1_d[1,0] && Array 1 dimensión (1) +*a: ^array_2_d[1,2] && Array una dimension (1,2) +*p: _memberdata && XML Metadata for customizable properties +* + + If tnPropsAndComments_Count > 0 + Local I, lcPropsMethodsDefd, lcType + lcPropsMethodsDefd = '' + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> <> + ENDTEXT + + For I = 1 To tnPropsAndComments_Count + If Empty(taPropsAndComments(m.I,1)) + Loop + Endif + + lcType = Left( taPropsAndComments(m.I,1), 1 ) + lcType = Icase( lcType == '*', 'm' ; + , lcType == '^', 'a' ; + , 'p' ) + + If lcType == 'p' Then + tcCodigo = tcCodigo + Chr(13) + Chr(10) + Chr(9) + Chr(9) + '*' + lcType + ': ' + taPropsAndComments(m.I,1) + Else + tcCodigo = tcCodigo + Chr(13) + Chr(10) + Chr(9) + Chr(9) + '*' + lcType + ': ' + Substr( taPropsAndComments(m.I,1), 2) + Endif + + If Not Empty(taPropsAndComments(m.I,2)) + tcCodigo = tcCodigo + Chr(9) + Chr(9) + '&' + '& ' + taPropsAndComments(m.I,2) + Endif + Endfor + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> <> + ENDTEXT + + tcCodigo = tcCodigo + CR_LF + + Release I, lcPropsMethodsDefd, lcType + Endif + + Release taPropsAndComments, tnPropsAndComments_Count + Return + Endproc + + + + Procedure write_DEFINE_CLASS + Lparameters ta_NombresObjsOle, toRegClass, tcCodigo + + Local lcOF_Classlib, llOleObject + lcOF_Classlib = '' + llOleObject = ( Ascan( ta_NombresObjsOle, toRegClass.OBJNAME, 1, 0, 1, 1+2+4+8) > 0 ) + + If Not Empty(toRegClass.CLASSLOC) + lcOF_Classlib = 'OF "' + Lower(Alltrim(toRegClass.CLASSLOC)) + '" ' + Endif + +*-- DEFINICIÓN DE LA CLASE ( DEFINE CLASS 'className' AS 'classType' [OF 'classLib'] [OLEPUBLIC] ) + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<'DEFINE CLASS'>> <> AS <> <> + ENDTEXT + + Return + Endproc + + + + Procedure write_DEFINE_CLASS_COMMENTS + Lparameters toRegClass, tcCodigo +*-- Comentario de la clase + If Not Empty(toRegClass.RESERVED7) Then +*-- Si es multilínea, debe ir en un tag aparte + If Occurs( Chr(13), toRegClass.RESERVED7 ) > 0 Then + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> <> + <> + <<>> <> + ENDTEXT + Else && Comentario in-line + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + <<>> <<'&'+'&'>> <> + ENDTEXT + Endif + Endif + + Return + Endproc + + + + Procedure write_ENDDEFINE_IfApplicable + Lparameters tnLastClass, tcCodigo + If tnLastClass = 1 + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<'ENDDEFINE'>> + <<>> + ENDTEXT + Endif + + Return + Endproc + + + + Procedure write_EXTERNAL_CLASS_HEADER + Lparameters toRegClass, toFoxBin2Prg, tcCodigo +*-- < EXTERNAL_CLASS Name = "class-name" Baseclass="base-class" /> + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + If Empty(tcCodigo) Then + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + *-- EXTERNAL_CLASS identify external member Class names / EXTERNAL_CLASS identifica los nombres de las Clases externas + ENDTEXT + Endif + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <> Name="<>" Baseclass="<>" <> + ENDTEXT + + Return + Endproc + + + + Procedure write_EXTERNAL_MEMBER_HEADER + Lparameters toFoxBin2Prg, tcMemberName, tcMemberType, tcCodigo +*-- < EXTERNAL_MEMBER Name = "member-name" Type="member-type" /> + #If .F. + Local toFoxBin2Prg As c_foxbin2prg Of 'FOXBIN2PRG.PRG' + #Endif + + If Empty(tcCodigo) Then + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + *-- EXTERNAL_MEMBER identify external member names / EXTERNAL_MEMBER identifica los nombres de los miembros externos + ENDTEXT + Endif + + If Not Empty(tcMemberName) And Not Empty(tcMemberType) Then + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <> Name="<>" Type="<>" <> + ENDTEXT + Endif + + Return + Endproc + + + + Procedure write_INCLUDE + Lparameters toReg, tcCodigo +*-- #INCLUDE + If Not Empty(toReg.RESERVED8) Then + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> #INCLUDE "<>" + ENDTEXT + Endif + + Return + Endproc + + + + Procedure write_CLASSMETADATA + Lparameters toRegClass, tcCodigo + +*-- Agrego Metadatos de la clase (Baseclass, Timestamp, Scale, Uniqueid) + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> + ENDTEXT + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2+4+8 + <<>> <> + Baseclass="<>" + Timestamp="<>" + Scale="<>" + Uniqueid="<>" + ENDTEXT + + If Not Empty(toRegClass.OLE2) + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2+4+8 + <<>> Nombre="<>" + Parent="<>" + ObjName="<>" + OLEObject="< se quita clase + lcNombre = Substr(toRegObj.Parent, At('.', toRegObj.Parent)+1) + '.' + toRegObj.OBJNAME + Else +*-- Este caso: objeto + lcNombre = toRegObj.OBJNAME + Endif + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2+4+8 + <<>> <> + ObjPath="<>" + UniqueID="<>" + Timestamp="<>" + ENDTEXT + + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2+4+8 + <> + ENDTEXT + + Return + Endproc + + + + Procedure write_HIDDEN_Properties +*-- Escribo la definición HIDDEN de propiedades + Lparameters tcHiddenProp, tcCodigo + + If Not Empty(tcHiddenProp) + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> HIDDEN <> + ENDTEXT + Endif + + Return + Endproc + + + + Procedure write_PROTECTED_Properties +*-- Escribo la definición PROTECTED de propiedades + Lparameters tcProtectedProp, tcCodigo + + If Not Empty(tcProtectedProp) + TEXT TO tcCodigo ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> PROTECTED <> + ENDTEXT + Endif + + Return + Endproc + + + + Procedure write_TXT_REPORTE + Lparameters toReg + + Try + Local lc_TAG_REPORTE_I, lc_TAG_REPORTE_F, loEx As Exception + lc_TAG_REPORTE_I = '<' + C_TAG_REPORTE + ' ' + lc_TAG_REPORTE_F = '' + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1+2 PRETEXT 1+2 + <<>> platform="WINDOWS " uniqueid="<>" timestamp="<>" objtype="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + objcode="<>" name="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + vpos="<>" hpos="<>" height="<>" width="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + order="<>" unique="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + environ="<>" boxchar="<>" fillchar="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + pengreen="<>" penblue="<>" fillred="<>" fillgreen="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + fillblue="<>" pensize="<>" penpat="<>" fillpat="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + fontface="<>" fontstyle="<>" fontsize="<>" mode="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + ruler="<>" rulerlines="<>" grid="<>" gridv="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + gridh="<>" float="<>" stretch="<>" stretchtop="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + top="<>" bottom="<>" suptype="<>" suprest="<>" norepeat="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + resetrpt="<>" pagebreak="<>" colbreak="<>" resetpage="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + general="<>" spacing="<>" double="<>" swapheader="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + swapfooter="<>" ejectbefor="<>" ejectafter="<>" plain="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + summary="<>" addalias="<>" offset="<>" topmargin="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + botmargin="<>" totaltype="<>" resettotal="<>" resoid="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + curpos="<>" supalways="<>" supovflow="<>" suprpcol="<>" <<>> + ENDTEXT + + TEXT TO C_FB2PRG_CODE ADDITIVE TEXTMERGE NOSHOW FLAGS 1 PRETEXT 1+2 + supgroup="<>" supvalchng="<>" <<>> + ENDTEXT + + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + " " + + If Inlist(toReg.ObjType, 25, 26) && Dataenvironment, cursors and relations + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + " " + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + " " + Else + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + " " + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + " " + Endif + + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + " " + C_FB2PRG_CODE = C_FB2PRG_CODE + CR_LF + "