foxbin2prg icon indicating copy to clipboard operation
foxbin2prg copied to clipboard

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

Open t-zuidema opened this issue 2 years ago • 5 comments

ℹ Computer information

  • VFP version: 9.0, version not relevant
  • FoxBin2PRG version: 1.19.76
  • Last FoxBin2PRG version w/o bug (if available): n/a

📝 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


  • Note, configuration files will follow an inheritance.

    1. Default values
  • 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: <Tabellenname>.dbf.cfg in tables folder)

  • 6., Parameter calling FOXBIN2PRG.EXE.

  • Some Parameter calling FOXBIN2PRG.EXE overturn this settings (except Defaults)


*-- 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

  •                           && 0 don't save HomeDir in PJ2
    
  •                           && 1 save HomeDir in PJ2
    

*----------------------------------------------------------------------------------------------------------------

*-- 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)

  •                           && 0 One library.tx2 file
    
  •                           && 1 Multiple file.class.tx2 files
    
  •                           && 2 Multiple file.baseclass.class.tx2 files
    

RedirectClassPerFileToMain: 1 && When regenerating binary files, determine target file

  •                           && 0 Don't redirect to file.tx2
    
  •                           && 1 Redirect to file.tx2 when selecting file[.baseclass].class.tx2
    
  •                           &&   RedirectClassType: 1 has precedence
    

RedirectClassType: 0 && For classes created with UseClassPerFile>0 in the form file[.baseclass].class.tx2

  •                           && Those files could be imported like file.tx2::Class::import or like file[.baseclass].class.tx2
    
  •                           && For the second form:
    
  •                           && 0 Redirect file[.baseclass].class.tx2 to file.VCX and add / replace all other classes of this library
    
  •                           && 1 Redirect file[.baseclass].class.tx2 to file[.baseclass].class.VCX and do not touch file.VCX
    
  •                           && 2 Redirect file[.baseclass].class.tx2 to file.VCX and do not touch other classes of file.VCX
    

ClassPerFileCheck: 0 && Check, if files listed in the main file of a library or form will be included

  •                           && 0 Don't check file inclusion
    
  •                           && 1 Check file[.baseclass].class.tx2 inclusion
    
  •                           &&   Only used if import file is in file[.baseclass].class.tx2 syntax
    
  •                           &&   Ignored for RedirectClassType: 2
    

*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

*-- 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.

  •                           &&   Options below will only read if OldFilesPerDBC is set 1 before!
    
  •                           &&   If OldFilesPerDBC is set 0 later, alle setting will be lost
    

UseFilesPerDBC: 0 && 0=One database dc2 file, 1=Multiple file...dc2 files

  •                           && 0 creates only a file.dc2 with all DBC (file) data
    
  •                           && 1 creates a file.dc2 with DBC properties
    
  •                           &&   and additional DBC files per DBC item (stored-proc, table, ..)
    
  •                           &&   Note: recration only if RedirectFilePerDBCToMain is 1
    

RedirectFilePerDBCToMain: 0 && 0=Don't redirect to file.dc2, 1=Redirect to file.tx2 when selecting file.item..dc2 ItemPerDBCCheck: 0 && 0=Don't check file.item..dc2 inclusion, 1=Check file.item.*.dc2 inclusion *----------------------------------------------------------------------------------------------------------------

*-- 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

t-zuidema avatar Nov 25 '22 09:11 t-zuidema

@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. :(

lscheffler avatar Nov 25 '22 15:11 lscheffler

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

DougHennig avatar Nov 26 '22 20:11 DougHennig

@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.
  1. 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.
  2. 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.
  1. 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:

  • Declare why not using VFP's normal way to alter the casing
  • All stuff possibly touched should be altered in a stringent way
  • Follow this guide and pull request again

Update

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

lscheffler avatar Dec 01 '22 06:12 lscheffler

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.

t-zuidema avatar Dec 01 '22 14:12 t-zuidema

So, what you mean is

  • You set a built in PEM to Protected (or Hidden, ends up the same)
  • VFP writes this in with upper cases to the Protected field
  • FoxBin2Prg does as shown above 2Text, then 2Bin, now the PEM is lower case
  • FoxBin2Prg on next run generates text with lower case
  • git sees change

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?

lscheffler avatar Dec 01 '22 16:12 lscheffler