Jump to content

wright

Members
  • Content Count

    38
  • Joined

  • Last visited

Community Reputation

2 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. wright

    ICS for Linux?

    Hi, i think you are referring to me, except if i'm wrong! i will try to send it to you as soon as possible.
  2. Why would embarcadero use their competitor's servers? AWS => AMAZON Azure => Microsoft (MS Visual Studio)
  3. ICS V9.1 Done! Some improvement needed. Now i'm targeting V10.
  4. How to fix => F2047 Circular unit reference to 'Ics.Fmx.OverbyteIcsWSocketS' ? when compiling the "D110InstallVclFmx" project it raised that error in "IcsLinuxD110". I thought that was due to the changes i did for porting it (ICS v9...) on Android platform, but that wasn't the case. it occured even for win32/64 bit platform too. I'm talking about the ICS V9.1
  5. Yep! right it works. For the moment i figured it out as you suggested. Also i think that block of code should be wrapped under {$IF DEFINED(MSWINDOWS)} statement for future builds... as it is planned to introduced Android platform in ICS V10.
  6. I fixed it. I have gone through all the implementations up to above the indexed function. All errors related to what i provided, were due to the compile directives that have encompassed "Compound statements" (begin...end) in function IcsGetLocalTimeZoneBias. I just added some android compile directives: //... {$IFDEF ANDROID} var TimeZone: TTimeZone; begin TimeZone := TTimeZone.Local; Result := -Round(TimeZone.GetUtcOffset(Now).TotalMinutes); end; {$ENDIF} Yes! i noticed that. I'll list all changes after succeeded tests.
  7. As per the recent updates, the iconv related functions and types have been removed and replaced with cross-platform RTL functions. That's how i managed to migrate the code... but needed to be tested. function IcsIsValidAnsiCodePage(const CP: LongWord): Boolean; {$IFDEF MSWINDOWS} begin Result := IsValidCodePage(CP); end; {$ENDIF} {$IFDEF POSIX} var Encoding: TEncoding; CodePageStr: AnsiString; I: Integer; begin Result := (CP <> 1200) and (CP <> 1201) and (CP <> 12000) and (CP <> 12001); if Result then begin // Find the corresponding character encoding for the code page for I := Low(IconvCodepageMapping) to High(IconvCodepageMapping) do begin if IconvCodepageMapping[I].C = CP then begin CodePageStr := IconvCodepageMapping[I].A; Break; end; end; // Try to get the encoding for the code page try Encoding := TEncoding.GetEncoding(AnsiString(CodePageStr)); Result := Assigned(Encoding); except on E: EEncodingError do Result := False; end; end; end; {$ENDIF} However, codes for posix should work with android platform, but we can use the TEncoding.GetEncoding method to attempt to get an encoding for the given code page. {$IFDEF ANDROID} var Encoding: TEncoding; begin Result := (CP <> 1200) and (CP <> 1201) and (CP <> 12000) and (CP <> 12001); if Result then begin try // Attempt to get the encoding for the code page Encoding := TEncoding.GetEncoding(CP); Result := Assigned(Encoding); except // Handle encoding error on E: EEncodingError do Result := False; end; end; end; {$ENDIF}
  8. For the moment: Android (32-64 bit) FList is declared, as i posted it in the first post.⬇️ The fact is that, i thought tha was simple, why the IDE kept showing error and compiler failed where everything was declared. i also tried to reorder the constructor and functions to see if it causes compile errors but nothing solved. I also checked Doc wiki for Constructor overriding, if there is something to do with mobile platform.
  9. - E2023 Function needs result type and E2003 Undeclared identifier: 'FList' function TIcsIntegerList.Add(Item: Integer): Integer; begin Result := FList.Add(Pointer(Item)); end; - E2004 Identifier redeclared: 'TIcsIntegerList', E2003 Undeclared identifier: 'FList' procedure TIcsIntegerList.Clear; begin FList.Clear; end; - E2037 Declaration of 'TIcsIntegerList' differs from previous declaration. constructor TIcsIntegerList.Create; begin FList := TList.Create; end; - E2004 Identifier redeclared: 'TIcsIntegerList', E2003 Undeclared identifier: 'FList', E2003 Undeclared identifier: 'Index' procedure TIcsIntegerList.Delete(Index: Integer); begin FList.Delete(Index); end; - E2003 Undeclared identifier: 'iconv_t', E2003 Undeclared identifier: 'iconv_open'E2003 Undeclared identifier: 'iconv_close' and E2029 Declaration expected but 'IF' found {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} function IcsIsValidAnsiCodePage(const CP: LongWord): Boolean; {$IFDEF MSWINDOWS} begin Result := IsValidCodePage(CP); end; {$ENDIF} {$IFDEF POSIX} {$IFDEF MACOS} begin Result := CFLocaleGetIdentifier(CP); end; {$ENDIF} var Ctx: iconv_t; begin Result := (CP <> 1200) and (CP <> 1201) and (CP <> 12000) and (CP <> 12001); if Result then begin Ctx := iconv_open(PAnsiChar(IcsIconvNameFromCodePage(CP)), ICONV_UNICODE); if Ctx = iconv_t(-1) then Result := False else begin iconv_close(Ctx); Result := True; end; end; end; {$ENDIF} - E2003 Undeclared identifier: '_statvfs', E2003 Undeclared identifier: 'statvfs', W1023 Comparing signed and unsigned types - widened both operands, E2029 ')' expected but identifier 'f_bfree' found function IcsGetFreeDiskSpace(const APath: String): Int64; {$IFDEF MSWINDOWS} var TotalSpace, FreeSpace : Int64; begin if GetDiskFreeSpaceEx (PChar(APath), FreeSpace, TotalSpace, nil) then Result := FreeSpace else Result := -1; {$ENDIF} {$IFDEF POSIX} var FN : RawByteString; // Path or file name Buf : _statvfs; begin FN := UnicodeToAnsi(APath, CP_UTF8); if statvfs(PAnsiChar(FN), Buf) = 0 then Result := Int64(Buf.f_bfree) * Int64(Buf.f_frsize) { V8.65 } else Result := -1; {$ENDIF} end; - E2034 Too many actual parameters, with variable "LBOMSize" when compiling on Android platform. function IcsGetBufferCodepage(Buf: PAnsiChar; ByteCount: Integer): LongWord; { V8.07 } var LBOMSize: Integer; begin Result := IcsGetBufferCodepage(Buf, ByteCount, LBOMSize); end; - - The TIcsFileStreamW class is a Unicode version of the TFileStream class throws errors. It is a custom file stream class defined. On Android, file handling is done differently, i am still looking for a work around. E2003 Undeclared identifier: 'TIcsFileStreamW' E2029 '=' expected but ';' found E2029 '=' expected but ')' found E2075 This form of method call only allowed in methods of derived types E2003 Undeclared identifier: 'FFileName' E2037 Declaration of 'TIcsFileStreamW' differs from previous declaration { TIcsFileStreamW } {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} constructor TIcsFileStreamW.Create(const FileName: UnicodeString; Mode: Word); begin {$IFDEF COMPILER12_UP} inherited Create(FileName, Mode); FFileName := FileName; {$ELSE} Create(Filename, Mode, 0); {$ENDIF} end; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} constructor TIcsFileStreamW.Create(const FileName: UnicodeString; Mode: Word; Rights: Cardinal); begin {$IFDEF COMPILER12_UP} inherited Create(FileName, Mode, Rights); FFileName := FileName; {$ELSE} if Mode = fmCreate then begin inherited Create(IcsFileCreateW(FileName)); if Cardinal(FHandle) = INVALID_HANDLE_VALUE then {$IFDEF COMPILER12_UP} raise Exception.CreateResFmt(@SFCreateErrorEx, [ExpandFileName(FileName), SysErrorMessage(GetLastError)]); {$ELSE} raise Exception.CreateResFmt(@SFCreateErrorEx, [IcsExpandFileNameW(FileName), SysErrorMessage(GetLastError)]); {$ENDIF} end else begin inherited Create(IcsFileOpenW(FileName, Mode)); if Cardinal(FHandle) = INVALID_HANDLE_VALUE then {$IFDEF COMPILER12_UP} raise Exception.CreateResFmt(@SFCreateErrorEx, [ExpandFileName(FileName), SysErrorMessage(GetLastError)]); {$ELSE} raise Exception.CreateResFmt(@SFCreateErrorEx, [IcsExpandFileNameW(FileName), SysErrorMessage(GetLastError)]); {$ENDIF} end; FFileName := FileName; {$ENDIF} end; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} constructor TIcsFileStreamW.Create(const Utf8FileName: UTF8String; Mode: Word); begin {$IFDEF COMPILER12_UP} FFileName := Utf8FileName; inherited Create(FFileName, Mode); {$ELSE} Create(AnsiToUnicode(Utf8FileName, CP_UTF8), Mode, 0); {$ENDIF} end;
  10. Really interesting! My main purpose is to have the WebSocket/Ssl modules working on my projects which target Android platform. I know that porting ICS V9.0 to Android is likely to be a more complex and time-consuming task. And by initially focusing on ICS V10, i can make quicker progress and gain valuable experience with the newer codebase but I would like to use / port "TSslWebSocketCli" with Ssl.
  11. TList exist on all platforms, yes! I followed instructions from Migrating_Delphi_Code_to_Mobile_from_Desktop and embarcadero Delphi recommends the use of TList<...>, in our case: TList<Integer> to make it Cros-platform. as in ref: Generics_Collections_TList, stackoverflow: explication of - Remy Lebeau. from the original file, these errors are on these lines (5912 to 5940) : [DCC Error] OverbyteIcsUtils.pas(5912): E2023 Function needs result type [DCC Error] OverbyteIcsUtils.pas(5914): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5914): E2003 Undeclared identifier: 'Item' [DCC Error] OverbyteIcsUtils.pas(5919): E2004 Identifier redeclared: 'TIcsIntegerList' [DCC Error] OverbyteIcsUtils.pas(5921): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5926): E2037 Declaration of 'TIcsIntegerList' differs from previous declaration [DCC Error] OverbyteIcsUtils.pas(5928): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5933): E2004 Identifier redeclared: 'TIcsIntegerList' [DCC Error] OverbyteIcsUtils.pas(5935): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5935): E2003 Undeclared identifier: 'Index' [DCC Error] OverbyteIcsUtils.pas(5940): E2037 Declaration of 'TIcsIntegerList' differs from previous declaration Yes, you've done the bulk of the work, thank you for that! but there are many Types / classes which don't compile on Android/mobile platform such as: "TIcsFileStreamW" in "OverbyteIcsUtils.pas", "iconv"..."iconv_open"..., "_statvfs" (the way we get free space on disk for linux doesn't work for android, i planned to add it), "IcsGetBufferCodepage" (the way to get buffer of codepage for mobile platform need to be implemented, i 'll post mine later). As i sais i'll focus on "TIcsIntegerList" first.
  12. HI there i just made a try, i started there! To work on the Android platform using compile directives, i needed to make some modifications to the code in several files. Lets focus on 'svn.overbyte.be/svn/icsv9/Source/OverbyteIcsUtils.pas'.The classTIcsIntegerList is essentially a wrapper around the TList class, since this code was designed for use in a Windows platform target, on a different platform, i needed to make some adjustments. type TIcsIntegerList = class(TObject) private FList : TList<Integer>; // Use TList<Integer> instead of TList function GetCount: Integer; function GetFirst: Integer; function GetLast: Integer; function GetItem(Index: Integer): Integer; procedure SetItem(Index: Integer; const Value: Integer); public constructor Create; virtual; destructor Destroy; override; function IndexOf(Item: Integer): Integer; function Add(Item: Integer): Integer; virtual; procedure Assign(Source: TIcsIntegerList); virtual; procedure Clear; virtual; procedure Delete(Index: Integer); virtual; property Count: Integer read GetCount; property First: Integer read GetFirst; property Last : Integer read GetLast; property Items[Index: Integer] : Integer read GetItem write SetItem; default; end; // ... other codes { TIcsIntegerList } function TIcsIntegerList.Add(Item: Integer): Integer; begin Result := FList.Add(Item); // No need to typecast Item to Pointer end; procedure TIcsIntegerList.Clear; begin FList.Clear; end; constructor TIcsIntegerList.Create; begin FList := TList<Integer>.Create; // Use TList<Integer> instead of TList end; procedure TIcsIntegerList.Delete(Index: Integer); begin FList.Delete(Index); end; destructor TIcsIntegerList.Destroy; begin FList.Free; inherited; end; function TIcsIntegerList.GetCount: Integer; begin Result := FList.Count; end; function TIcsIntegerList.GetFirst: Integer; begin Result := FList.First; // No need to typecast FList.First to Integer end; function TIcsIntegerList.GetLast: Integer; begin Result := FList.Last; // No need to typecast FList.Last to Integer end; // ... other codes but i faced a lot of errors when i target android platform and compiled, it gives me errors like: [DCC Error] OverbyteIcsUtils.pas(5931): E2023 Function needs result type [DCC Error] OverbyteIcsUtils.pas(5933): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5933): E2003 Undeclared identifier: 'Item' [DCC Error] OverbyteIcsUtils.pas(5938): E2004 Identifier redeclared: 'TIcsIntegerList' [DCC Error] OverbyteIcsUtils.pas(5940): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5945): E2037 Declaration of 'TIcsIntegerList' differs from previous declaration ...: So how to fix it? Or can anyone point me to the right direction?
  13. wright

    ICS V8.67 announced

    Low-level experienced, I'm still learning.
  14. wright

    ICS V8.67 announced

    Sure, i'll try.
×