Results 1 to 10 of 133

Thread: So whatever happened to the whole PGDCE thing?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    I'm not dismissing it, I'm waiting for it to mature to the point of usability.
    Which, in my estimate, will eventually happen as fpc reaches 3.0.4 or 3.0.6
    For example, classes in 3.0.0 are not unicode so I *still* had to create this hackaround:

    Code:
      TFileStream = class(classes.THandleStream)
      Private
        FFileName : UnicodeString;
      public
        constructor Create(const AFileName: UnicodeString; Mode: Word);
        constructor Create(const AFileName: UnicodeString; Mode: Word; Rights: Cardinal);
        destructor Destroy; override;
        property FileName : UnicodeString Read FFilename;
      end;
    That wasn't hard. I already have one for 2.6.4:

    Code:
    {
      This is a permanent fix for the broken RTL of FPC 2.6.4
      See http://bugs.freepascal.org/view.php?id=27221
    
      This fix is required to get Platinum level of Wine compatibility
    }
    {$ifndef windows}
      {$fatal Windows ONLY}
    {$endif}
    type
      TFileStream = class(classes.TFileStream)
      public
        destructor Destroy; override;
      end;
    
      //The rest of the classes are dragged along by the need to base them on the fixed TFileStream
      TStringList = class(classes.TStringList)
      public
        procedure LoadFromFile(const FileName: AnsiString);
        procedure SaveToFile(const FileName: AnsiString);
      end;
    
      TIniFileKey = class
    
    //..... and so on
    // where 
    
    destructor TFileStream.Destroy;
    begin
      if Handle <= 4 then CloseHandle(Handle);
      inherited;
    end;
    P.S. Truly universal code compatible with both 2.6 and 3.0 branches goes like this:
    Code:
    {$if FPC_FULLVERSION>=20700}
      {$define che_unicode}
    {$endif}  
    
    ...
    
    {$ifdef che_unicode}
      {$if FPC_FULLVERSION<30000}
        {$fatal Impossible to use this compiler version: RTL is not unicode} //The sad truth
      {$endif}
    
      { modeswitch unicodestrings} //is in the main project file
    
      {$warn IMPLICIT_STRING_CAST_LOSS Error}
      {$warn EXPLICIT_STRING_CAST_LOSS Error}
      { if FPC_FULLVERSION<=40000} //***TODO Replace with version in which it is fixed
         {$define fix_fpc3_unicode} // Use custom mods of TFileStream, TStringList and TIniFile
      { endif}
    
      AnsiString1251 = type AnsiString(1251);
      TFileNameString = UnicodeString;
      PFileNameChar = PUnicodeChar;
    
    {$else}
      //Legacy Free Pascal below 3.0 (2.6.0 to 2.6.4)
      RawByteString = AnsiString;
      AnsiString1251 = AnsiString;
      {$ifdef windows}
        //no unicode support for file names
        TFileNameString = AnsiString;
        PFileNameChar = PAnsiChar;
      {$else}
        TFileNameString = Utf8String;
        PFileNameChar = PAnsiChar;
      {$endif}
    {$endif}
    P.P.S. This is getting far off-topic. Dear mods, please feel free to snip this discussion off.
    Last edited by Chebmaster; 13-08-2017 at 10:38 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •