Single file for config files Dependencies of parameters and settings better shown Some API pem added. Static paths removed Settings better and more often linked TOCs reworked
7.9 KiB
FoxBin2Prg - Usage in object style
Documentation of FoxBin2Prg - A Binary to Text converter for MS Visual Foxpro 9
Purpose of this document
FoxBin2Prg might be used as an EXE either from Windows or VFP, or as as prg from inside VFP in a command line way.
This document deals with the integration as an VFP Object using VFP based objects.
For settings see Configuration, for API and other related stuff see Internals.
The original document was created by Fernando D. Bozzo 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
Usage
Instantiating
Basically, the instantiating of FoxBinPrg is straight forward:
*-- Instancing directly from the EXE (fastest way, only EXE needed)
LOCAL loCnv AS c_foxbin2prg OF "FOXBIN2PRG.PRG"
SET PROCEDURE TO "<Path>\FOXBIN2PRG.EXE"
loCnv = CREATEOBJECT("c_foxbin2prg")
loCnv.execute( <params> )
-or this way also-
*-- Instancing from the PRG (you also need various files, like the 27 props*.txt)
LOCAL loCnv AS c_foxbin2prg OF "FOXBIN2PRG.PRG"
loCnv = NEWOBJECT("c_foxbin2prg", "<Path>\FOXBIN2PRG.PRG")
loCnv.execute( <params> )
Execute
Transforming file(s) works like
obj.execute(cInputFile [,cType [,cTextName [,lGenText [,cDontShowErrors [,cDebug [,cDontShowProgress [,oModule [,oEx [,lRelanzarError [,cOriginalFileName [,cRecompile [,cNoTimestamps [,cBackupLevels [,cClearUniqueID [,cOptimizeByFilestamp [,cCFG_File] ] ] ] ] ] ] ] ] ] ] ] ] ] ])
A lot of the parameters are the same as calling the command line,
some additional are added and some are not string type.
Some settings will overwrite configuration.
Using an file as cCFG_File with InhibitInheritance=3 set will overwrite all configuration. See Configuration file(s) for more information. This file will be read as first setting, see Multi config.
Using an object as oCFG (instead of cCFG_File) will overwrite all configuration and only this settings will be used.
| Parameter | Value (Default) | Description |
|---|---|---|
| cInputFile | fullpath | Full name of the file to convert or directory name to process without any other parameter given, the extension (and the config) defines the operation |
| FileName::ClassName | If option UseClassPerFile is 1 or 2, a class-file will be extracted from the lib | |
| cType | empty | Fileextension of cInputFile defines operation |
| BIN2PRG | cInputFile is processed for generating a Text representation. | |
| PRG2BIN | cInputFile is processed for generating the Binary file(s). | |
| INTERACTIVE | A confirmation dialog will be shown when processing a directory asking what to convert. This option overrides the BIN2PRG and PRG2BIN parameters. Can be used with or without PRG2BIN or BIN2PRG |
|
| SHOWMSG | A status message will be shown on termination. | |
| * | If cInputFile is a project (pj[x2]) all files of the project, including the pjx, will be processed. The extension defines direction of operation. | |
| *- | If cInputFile is a project (pj[x2]) all files of the project, excluding the pjx, will be processed. The extension defines direction of operation. | |
| d, D, K, B, M, R, V | SCCAPI (SCCTEXT.PRG) compatibility mode, query the conversion support for the file type specified Types: d=DBC, D=DBF, K=Form, B=Label, M=Menu, R=Report, V=Class |
|
| -C | Create configuration file <cInputFile> or, if first parameter is empty, FoxBin2Prg._cfg in default folder. With recent values. | |
| -c | Create configuration file template <cInputFile> or, if first parameter is empty, FoxBin2Prg._cfg in default folder. With inactive default values. | |
| -t | Create per-table configuration file template or, if first parameter is empty and a table open, <tablename>._cfg in table folder. With inactive default values. | |
| cTextName | Text filename. | Only for SCCAPI (SCCTEXT.PRG) compatibility mode. File to use. |
| lGenText | .T., .F. | Only for SCCAPI (SCCTEXT.PRG) compatibility mode. .T.=Generates Text, .F.=Generates Binary. Note: cType have predominance over lGenText |
| cDontShowErrors | 0, 1 | '1' for NOT showing errors in MESSAGEBOX. This has precedence over the DontShowErrors setting. |
| cDebug | 0, 1, 2 | '0 'no debug, '1' for generating process LOGs, stop on errors, '2' like '1' and special log. This has precedence over the Debug value in the config files. |
| cDontShowProgress | 0, 1, 2 | '0' show progress, '1' for not showing the process window, '2' Show only for multi-file processing. This has precedence over the ShowProgressbar setting. Value "0","1" is inverted to the setting. |
| oModule | Internal use for Unit Testing | |
| oEx | Exception object, return for errorhandling | |
| lRelanzarError | .T.. .F. | Throw error to caller of .Execute() |
| cOriginalFileName | text | used in those cases in which inputFile is a temporary filename and you want to generate the correct filename on the header of the text version |
| cRecompile | 0, 1 | Indicates recompile ('1') the binary once generated. True if called from SCCAPI (SCCTEXT.PRG) compatibility mode. |
| path | The binary is compiled from this path | |
| cNoTimestamps | 0, 1 | Indicates if timestamp must be cleared ('1' or empty) or not ('0'), This has precedence over the NoTimestamps setting. |
| cBackupLevels | 0, 1, .. | "0" no Bakup, "1", one level filename.bak, "n" n levels of Backup filename.n.bak |
| cClearUniqueID | 0, 1 | 0=Keep UniqueID in text files, 1=Clear Unique ID. Useful for Diff and Merge. This has precedence over the ClearUniqueID setting. |
| cOptimizeByFilestamp | 0, 1 | 1=Optimize file regeneration depending on file timestamp. This has precedence over the OptimizeByFilestamp setting. Dangerous while working with branches! |
| cCFG_File or oCFG |
filename | Indicates a CFG filename for not using the default on foxbin2prg directory or path. See Configuration file(s) and Multi config for more information. |
| object | An object containing configuration options to use. See Internals for object creation. If this is set, no additional configuration file will be read. |
cOutputFolder
The procedural call of FoxBin2Prg like
FoxBin2Prg.EXE cInputFile ... exposes a parameter cOutputFolder.
This parameter is not available in this call. To set cOutputFolder:
obj.cOutputFolder = cOutputFolder
obj.execute(...)
Note
The BIN2PRG, PRG2BIN, INTERACTIVE, SHOWMSG cTypes might be mixed freely like:
PRG2BIN-INTERACTIVE
BIN2PRG-INTERACTIVE-SHOWMSG
Note
- The swap of cInputFile and cType is not possible here.
- If cType is -cCt, then only the first both parameters are allowed.
- Setting cInputFile and cType appropriate, info screen and generation of configuration templates is possible too. See command line
- While possibe, the SCCAPI (SCCTEXT.PRG) compatibility mode is more an idea of the command line.
Return values
Return value is 0=OK, 1=Error.

This project is part of VFPX.
