fdbozzo / foxbin2prg

Visual FoxPro 9 Binary to Text and Text to Binary converter. Replacement for SCCText(X) and TwoFox that is bi-directional (Text is editable)
https://vfpx.codeplex.com/wikipage?title=FoxBin2Prg
MIT License
59 stars 35 forks source link

Casing of HIDDEN class properties is changed during conversion from Text to Bin #87

Open t-zuidema opened 1 year ago

t-zuidema commented 1 year ago

ℹ Computer information

📝 Provide detailed reproduction steps (if any)

  1. Have a VCX with a class with some PEM's that are hidden.
  2. Change the casing of one of those PEM's to be Pascal case: f.e. Load, or Init.
  3. Convert VCX to Text and back to VCX
  4. Notice that the casing of the PEM name in the Text is not changed (Mixed casing)
  5. Notice that the casing of the PEM in the VCX is all lower
  6. Culprit is line 10531 in Procedure analyzeCodeBlock_HIDDEN, where only during the conversion of Text to Bin, the property is LOWER()ed.

✔️ Expected result

Expected result is that nothing of the casing has changed, or that the casing in the conversion from Bin to Text is done.

❌ Actual result

The casing is converted to all lower on converting from Text to Bin

📷 Config

Do not include your normal config. Please add your current full configuration.
Create a config file via DO FOXBIN2PRG.PRG WITH '-C','path-to-source\FoxBin.cfg' , zip and add here.

################################################################################################################ FOXBIN2PRG.CFG configuration options: (If no values given, these are the DEFAULTS) Version: v1.19.76 Options read as of 2022/11/25 10:09:32


*-- Settings for internal work, not processing Language: (auto) && Language of shown messages and LOGs. EN=English, FR=French, ES=Español, DE=German, Not defined = AUTOMATIC [DEFAULT] ShowProgressbar: 2 && 0=Don't show, 1=Allways show, 2= Show only for multi-file processing DontShowErrors: 1 && Show message errors by default ExtraBackupLevels: 1 && By default 1 BAK is created. With this you can make more .N.BAK, or none Debug: 0 && Don't Activate individual .Log by default BackgroundImage: && Backgroundimage for process form. Empty for empty Background. File not found uses default. HomeDir: 1 && Home Directory in PJX

-- Conversion operation by type PJX_Conversion_Support: 2 && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) VCX_Conversion_Support: 2 && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) SCX_Conversion_Support: 2 && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) FRX_Conversion_Support: 2 && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) LBX_Conversion_Support: 2 && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) MNX_Conversion_Support: 2 && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) DBC_Conversion_Support: 2 && 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) DBF_Conversion_Support: 8 && 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) FKY_Conversion_Support: 1 && 0=No support, 1=Generate TXT only (Diff) MEM_Conversion_Support: 1 && 0=No support, 1=Generate TXT only (Diff) ----------------------------------------------------------------------------------------------------------------

Setting for container files (not pjx) -- CLASS and FORM options (tx2 is to read as vc2 or sc2, VCX might be SCX) *- Class per file options (UseClassPerFile: 1) UseClassPerFile: 2 && Determines how a library (or form) will handle included class (or, for forms, objects)

-- DBC options - File per DBC options (UseFilesPerDBC: 1) OldFilesPerDBC: 1 && 1=Turns the File per DBC options on, 0 uses the old UseClassPerFile etc settings.

-- General files NoTimestamps: 1 && Clear timestamps of several file types by default for minimize text-file differences ClearUniqueID: 1 && 0=Keep UniqueID in text files, 1=Clear Unique ID. Useful for Diff and Merge OptimizeByFilestamp: 0 && 1=Optimize file regeneration depending on file timestamp. Dangerous while working with branches! RemoveNullCharsFromCode: 1 && 1=Drop NULL chars from source code RemoveZOrderSetFromProps: 0 && 0=Do not remove ZOrderSet property from object, 1=Remove ZOrderSet property from object PRG_Compat_Level: 0 && 0=Legacy, 1=Use HELPSTRING as Class Procedure comment ----------------------------------------------------------------------------------------------------------------

-- PJX special BodyDevInfo: 0 && 0=Don't keep DevInfo for body pjx records, 1=Keep DevInfo ----------------------------------------------------------------------------------------------------------------

-- DBF special ClearDBFLastUpdate: 1 && 0=Keep DBF LastUpdate, 1=Clear DBF LastUpdate. Useful for Diff. ExcludeDBFAutoincNextval: 0 && 0=Do not exclude this value from db2, 1=Exclude this value from db2 DBF_Conversion_Included: && If DBF_Conversion_Support:4, you can specify multiple filemasks: www,fb2p_free.dbf DBF_Conversion_Excluded: && If DBF_Conversion_Support:4, you can specify multiple filemasks: www,fb2p_free.dbf DBF_BinChar_Base64: 1 && For character type fields, if NoCPTrans 0=do not transform, 1=use Base64 transform (default) DBF_IncludeDeleted: 0 && 0=Do not include deleted records (default), 1=Include deleted records *----------------------------------------------------------------------------------------------------------------

-- Text file extensions extension: tx2=newext && Specify extensions to use. Default FoxBin2Prg extensions ends in '2' (see at the bottom) -- Example configuration for SourceSafe compatibility: extension: pj2=PJ2 && Text file to PJX extension: vc2=VC2 && Text file to VCX extension: sc2=SC2 && Text file to SCX extension: fr2=FR2 && Text file to FRX extension: lb2=LB2 && Text file to LBX extension: mn2=MN2 && Text file to MNX extension: db2=DB2 && Text file to DBF extension: dc2=DC2 && Text file to DBC -- Additional extensions extension: fk2=FK2 && Text file to FKY extension: me2=ME2 && Text file to MEM *

📷 Screenshots

lscheffler commented 1 year ago

@t-zuidema
Thanks for pointing out and fixing the problem. Would you mind to follow this guide and pull request again? It's nice to see the changes and the contributors, and the change at work.
If you just alter the prg, it will not go to work for the community until somebody compiles etc. Thank you.
@DougHennig Possibly one should check if the requested changes are made in a request. :(

DougHennig commented 1 year ago

@lscheffler Good point: I saw the changes to the PRG didn't think about him building the exe.

lscheffler commented 1 year ago

@t-zuidema I found a bit off time today, so look this up. I must admit that I do not understand what this is about.

  1. What do you mean by Change the casing of one of those PEM's to be Pascal case: f.e. Load, or Init.
    • How do you do this.
    • And why.
    • User Properties and Methods are lower case by VFP standard, casing is done via Intellisense or _MEMBERDATA property.
  2. I have not the slightest idea what altering the case in Properties / Protected / Reseerved3 fields of the VCX should do. It ends up lower case in the class designer anyway with me in VFP9.
  3. FoxBin2PRG keeps VFP standard, that is lower case in the fields mentioned above for user defined PEMs.
    • BinToText just stores the fields to text, assuming they are of standard
    • It is lowered during TextToBin because of people fiddling with it in the text version.
  4. This is true for all other PEM, in FoxBin2Prg with a not to deep search.
    • _ProtectedProps
    • _HiddenProps
    • _ProtectedMethods
    • _HiddenMethods
      1. FoxBin2Prg should deal all of them in a stringent way

I think FoxBin2Prg should deal with VFP standard, this looks like keeping a hack for a special case right now.
As long as I do not see why this is useful I return FoxBin2Prg to the previous state. If there is a public need for this, please:

Update

If implemented, there is no reason to limit this to protected or hidden PEM's

t-zuidema commented 1 year ago

Thanks for looking in. I found the steps to reproduce the upper casing of the method. Steps: CREATE CLASSLIB test CREATE CLASS MyForm OF test as form Make the Load event/method Hidden via Class/Edit Property/Method. Save the class, close the class and inspect the generated VCX. The 'Protected' field from the second row contains: 'Load^', VFP uppercased the property name. Roundtripping this class through FoxBin2Prg will generate no problem in VFP (It doesn't care for case) but introduces changes in the text versions so introducing changes in Git/Source control.

lscheffler commented 1 year ago

So, what you mean is

Ok, I grok this. In this case we should keep the case Can you do the work for all four problems and create a new version as shown in the contribution guide?