Re: [Lazarus] Is the TODO list working?

2016-11-23 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Nov 23, 2016 at 1:06 AM, silvioprog via Lazarus
 wrote:
> I can see three valid TODOs (please see attached picture), but only when I
> add the unit to the lpi. The problem happen when I have the unit declared
> only in the lpr uses clause.
>
> So, for Delphi compatibility it should look TODOs in the opened units at the
> source editor tabs too.
>
> (Lazarus is flexible, so it would be nice to have an extra option: search
> TODOs at project's folder too :-) )

+1

Perhaps search in all path that project uses.
I have many projects with no unit included. I just point paths.

—
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Is the TODO list working?

2016-11-24 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Nov 23, 2016 at 10:46 PM, Mattias Gaertner via Lazarus
 wrote:
>
> It now searches in all used project units, excluding used packages.
> Formerly it only searched in the units listed in the project inspector

Hmm, I didn't know... Thanks for that.

--
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Changes to fpWeb...

2017-01-14 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Jan 13, 2017 at 8:36 PM, Michael Van Canneyt via Lazarus
 wrote:
>
> Hello,
>
> I have committed a serious change to the way fpweb handles requests.
>
> Especially routing of requests was changed.
>
> [...]

For me, this is great news.
I'm feeling we've started to go ahead writing complex Web systems
using Object Pascal.
Thanks Michael and all those who have been contributing for these new features.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] I can't save any file using IDE (Windows)

2017-01-27 Thread Marcos Douglas B. Santos via Lazarus
Hi,

I updated my IDE, revision 54011, and now I can't save any file.
To reproduce this bug just:
1. open IDE
2. save project1
3. save unit1

If you try to compile, you'll see that unit1 is missing (not saved).

Lazarus 1.7 r54011M FPC 3.0.1 i386-win32-win32/win64


Someone could help?


Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] I can't save any file using IDE (Windows)

2017-01-27 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Jan 27, 2017 at 1:56 PM, Mattias Gaertner via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:
>>
>> Someone could help?
>
> Sorry. My fault Fixed.

Was fast, thank you!

But now I have a strange error. Please, see the image below.
I didn't change my compiler or paths and I can garantee that my fpc.cfg
exists in the same directory that fpc.exe.

[image: Inline image 1]


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] I can't save any file using IDE (Windows)

2017-01-27 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Jan 27, 2017 at 2:47 PM, Marcos Douglas B. Santos
 wrote:
>
>
> But now I have a strange error. Please, see the image below.
> I didn't change my compiler or paths and I can garantee that my fpc.cfg 
> exists in the same directory that fpc.exe.

I reseted my environmentoptions.xml and now it works.


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Saving namespace files on WinXP

2017-01-27 Thread Marcos Douglas B. Santos via Lazarus
I don't know if Lazarus won't support WinXP in the near future, but I
would like to notify a bug:
If you try to save a file that has a "namespace" like
"foo.bar.unit1.pas" the IDE won't put the file extension.

Is this a known bug?


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Saving namespace files on WinXP

2017-01-28 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Jan 27, 2017 at 6:44 PM, Mattias Gaertner via Lazarus
 wrote:
>> I don't know if Lazarus won't support WinXP in the near future, but I
>> would like to notify a bug:
>> If you try to save a file that has a "namespace" like
>> "foo.bar.unit1.pas" the IDE won't put the file extension.
>
> What do you mean with "put the file extension"?

Sorry. I meant the file is saved without the ".pas" extension.


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Managing Packages with many versions

2017-03-31 Thread Marcos Douglas B. Santos via Lazarus
Hi,

I would like to know how I can manager my 3rd packages with different
version.

For example, imagine that:
You have got a package called SmartFoo.lpk version 1.0.
You are using the master/trunk version.
Whe you compile it you got this: smartfoo\lib\x86_64-win64\*ppu, *.o, etc

Now you can use this package in your projects.

Then, the author update this package to 2.0 version.
Imagine that you have many projects using version 1.0 but you would like to
update to 2.0 to work in just one project.

The problem is: I don't want to work in other projects right now but you
need to mantain them compilable with the version 1.0 of SmartFoo if you
need it any time.

What is the best approach to deal with it?

I've already read the Wiki http://wiki.freepascal.org/Lazarus_Packages but
I can not realize how IDE will know about the right *.ppu files to use.


Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Managing Packages with many versions

2017-03-31 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Mar 31, 2017 at 11:54 AM, Michael Van Canneyt via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Put the various versions  in different directories. The IDE will use the
> correct one based on the dependencies and the location. Every version
> needs to have been opened once in the IDE.
>
> I use it all the time. Works fine, except some rather exotic error messages
> if the IDE doesn't find a matching version.
>

That is a way, thanks.
But I am thinking something like bellow:

smartfoo
  \lib
\i386-win32\
  \1.0
  \1.1
  \1.2.3
  *.ppu (trunk)
\x86_64-win64
  \1.0
  *.ppu (trunk)


My point is each project just use PPU files, not the real sources because I
would like
to have just one source.
The correct way is the author freeze the version using a label, but I can
do this myself locally. Then, I can compile and copy the PPU files for the
right lib\\.

But using this way I will need to set up which path to use when I add a
package into the project, right?
What do you think about it?


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Managing Packages with many versions

2017-03-31 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Mar 31, 2017 at 12:22 PM, Michael Van Canneyt via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Below. Bellow is something a cow does ;-)
>

 Yeah, sorry.  :)



> AFAIK The IDE will not work with that.
>
> It needs the actual sources of each version. So you need multiple
> directories with the sources of each version.
>
> FPC itself can work with this, if properly configured.
>

Well, Ok. I will use as you explained. Thanks.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Managing Packages with many versions

2017-03-31 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Mar 31, 2017 at 1:18 PM, Mattias Gaertner via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> The IDE searches a lpk (correct name and version) and the
> corresponding .ppu files are stored relative to the lpk. See here
> http://wiki.freepascal.org/Lazarus_Packages#Different_
> versions_of_a_package
>

Mattias,

Yes, but as Michael said, I need to have many copies of the sources.
I thought that I could use just one source and many /libs directories with
the .ppu's

What do you think?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Managing Packages with many versions

2017-04-01 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Mar 31, 2017 at 6:38 PM, Mattias Gaertner via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> >[...]
> > Yes, but as Michael said, I need to have many copies of the sources.
> > I thought that I could use just one source and many /libs directories
> with
> > the .ppu's
> >
> > What do you think?
>
> I guess different versions have different sources, don't they?


Yes, but we don't need the sources if we won't work on that sources.
If we just need to use the lib, the ppu files should be enough. Well, maybe
I could be wrong.

Thanks, anyway.


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Managing Packages with many versions

2017-04-01 Thread Marcos Douglas B. Santos via Lazarus
Mattias,

On Fri, Mar 31, 2017 at 1:18 PM, Mattias Gaertner via Lazarus
 wrote:
>> Then, the author update this package to 2.0 version.
>> Imagine that you have many projects using version 1.0 but you would like to
>> update to 2.0 to work in just one project.
>
> A project can set a preferred version of a package:
> http://wiki.freepascal.org/Lazarus_Packages#Using_preferred_file_name

But how can I choose the correct package if the different sources do
not have Min or Max version numbers?
I mean, the `New Requirement dialog` should have an option to choose
the package by path (default/preferred) and not only by Min Max.
I saw that I can change this information editing the .lpi file, but
would be great do this using IDE, don't you think?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Managing Packages with many versions

2017-04-02 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Apr 2, 2017 at 3:48 AM, Mattias Gaertner via Lazarus
 wrote:
>> > A project can set a preferred version of a package:
>> > http://wiki.freepascal.org/Lazarus_Packages#Using_preferred_file_name
>>
>> But how can I choose the correct package if the different sources do
>> not have Min or Max version numbers?
>
> Maybe my wording 'preferred version' was misleading, but the link
> explained the thing you were searching for.

I already understood this, thanks.

>> I mean, the `New Requirement dialog` should have an option to choose
>> the package by path (default/preferred) and not only by Min Max.
>> I saw that I can change this information editing the .lpi file, but
>> would be great do this using IDE, don't you think?
>
> Just right click on the dependency:
> http://wiki.freepascal.org/IDE_Window:_Project_Inspector#Store_file_name_as_preferred_for_this_dependency

I am talking about this dialog in attachment.

Using just "preferred", if I have two options, I can't change the path
in "Required Packages" using the IDE. To do that I need a workaround:
open the correct package in correct path and then, right click on the
dependency to set the "preferred" path using the package opened.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] How to know the Package version at runtime?

2017-04-26 Thread Marcos Douglas B. Santos via Lazarus
I have some packages that contains business rules. They are used any many
applications but sometimes I don't need to update all aplications if I
change some in these packages.
But if the application has catched an exeption, I would like to know which
packages, and their versions, the executable was using.

Is there any chance to know the version of packages that an executable is
using?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-04-30 Thread Marcos Douglas B. Santos via Lazarus
It months ago I realized that Lazarus was saving the sources like that:

1- If there is only ANSI chars, save it as ANSI encode;
2. If there is more than ANSI chars, save it as UTF8 encode;

(correct me if I'm wrong about that)

I think this was changed when I updated my FPC to 3.* and Lazarus (trunk).
Everything continues works. This new behavior was completly transparent to
me... but I have a doubt:

If Delphi sources don't use UTF8, how is the best way to mantain sources
that need to work in both compilers?

I mean, I would like to work with FPC and Lazarus as I am used to doing,
without take concerns about "remember to change the encode of these files",
"remember to not put accented chars on code", or something like that.

Is there some wiki page that explains this?
Are you working on projects that have these problems? Could you tell me
which is the best approach to deal with it?
Thank you.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Quick Video: A Web Application

2017-04-30 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Apr 20, 2017 at 6:03 AM, Michael Van Canneyt via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> On Thu, 20 Apr 2017, Santiago A. via Lazarus wrote:
>
> El 19/04/2017 a las 17:09, Anthony Walter via Lazarus escribió:
>>
>>> Thank you all for the feedback and discussion. From me, the
>>> implementer and designer, I can say the most difficult part of
>>> creating this project, and in most projects, is not the actual
>>> programming. It's the creation of the user interface design. Choosing
>>> and creating a layout, and deciding on css values. That by far took
>>> more time than the actual code, and I'm sure that part could be vastly
>>> improved.
>>>
>> Of course, GUIs are massive time consuming. Have you ever create a form
>> by hand in runtime?
>>
>> That is what RAD and GUI designers were created for ;-)
>>
>> I'm afraid that the world is still waiting for a good GUI designer for
>> web.
>>
>
> We will deliver it :)


Can you share with us when?  :)


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-04-30 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Apr 30, 2017 at 4:30 PM, Ondrej Pokorny via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> On 30.04.2017 18:37, Marcos Douglas B. Santos via Lazarus wrote:
>
>> Are you working on projects that have these problems? Could you tell me
>> which is the best approach to deal with it?
>>
>
> Speaking from my experience, the only approach (not only the best one but
> the only one) is not to use characters above #255.


I see...
Well, this is not the best approach for me, as you've said...
I'm brazilian and is common to use accents here. I can forget this 'rule'
easily. :(

But is this the only problem that you got?

Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Quick Video: A Web Applicationx

2017-04-30 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Apr 30, 2017 at 4:42 PM, Michael Van Canneyt via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

>
>
> On Sun, 30 Apr 2017, Marcos Douglas B. Santos via Lazarus wrote:
>
> On Thu, Apr 20, 2017 at 6:03 AM, Michael Van Canneyt via Lazarus <
>> lazarus@lists.lazarus-ide.org> wrote:
>>
>> On Thu, 20 Apr 2017, Santiago A. via Lazarus wrote:
>>>
>>> El 19/04/2017 a las 17:09, Anthony Walter via Lazarus escribió:
>>>
>>>>
>>>> Thank you all for the feedback and discussion. From me, the
>>>>> implementer and designer, I can say the most difficult part of
>>>>> creating this project, and in most projects, is not the actual
>>>>> programming. It's the creation of the user interface design. Choosing
>>>>> and creating a layout, and deciding on css values. That by far took
>>>>> more time than the actual code, and I'm sure that part could be vastly
>>>>> improved.
>>>>>
>>>>> Of course, GUIs are massive time consuming. Have you ever create a form
>>>> by hand in runtime?
>>>>
>>>> That is what RAD and GUI designers were created for ;-)
>>>>
>>>> I'm afraid that the world is still waiting for a good GUI designer for
>>>> web.
>>>>
>>>>
>>> We will deliver it :)
>>>
>>
>>
>> Can you share with us when?  :)
>>
>
> Current tentative schedule is september. But no guarantees. It doesn't
> depend only on me :)
>
> But today an important milestone (for me) was reached, so there is hope :)


Ok Michael, stay focused, stay focused... :)


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-01 Thread Marcos Douglas B. Santos via Lazarus
On Mon, May 1, 2017 at 6:30 AM, Tony Whyman via Lazarus
 wrote:
> Marcos,
>
> When I originally created the Firebird Pascal API package, I wrote it with
> FPC as the only intended target. However, I then got feedback asking for
> Delphi compatibility and I couldn't resist the challenge of seeing how easy
> it would be to convert the source code. In the end, it was not that
> difficult and the following summarises the changes needed (apart from the
> minor syntax changes):
>
> [...snip...]
>

Tony, thank you for all these tips.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-01 Thread Marcos Douglas B. Santos via Lazarus
On Mon, May 1, 2017 at 8:47 AM, Mattias Gaertner via Lazarus
 wrote:
> Option a) You can use English in sources and load all non ASCII
> constants via resourcestrings or similar. Then the codepage is
> irrelevant.
> Option b) You can store all files as UTF-8 with BOM. Then FPC will
> store all non ASCII string constants as unicodestrings. Be careful when
> using PChar with them. This adds implicit conversions, so it might be
> slower.
>

Maybe option A could be the best.
I did not remember to use resourcestrings... it is a good tip, thanks.

Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-01 Thread Marcos Douglas B. Santos via Lazarus
On Mon, May 1, 2017 at 11:06 AM, Juha Manninen via Lazarus
 wrote:
> On Mon, May 1, 2017 at 12:30 PM, Tony Whyman via Lazarus
> ...
>
> No! The good idea is to use "String".

I agree.

>> 5. Take care when using string literals.
>> I added
>> {$IFDEF FPC}
>> {$codepage UTF8}
>> {$ENDIF}
>
> Yes, string literals are tricky but usually you should NOT use {$codepage 
> UTF8}.
> It is explained in the wiki page. I will not repeat it here.

So, as Mattias said, we should code using ANSI chars and everything will be Ok.

>> 7. Generics
>
> For Delphi compatible generics you can use FPC trunk and the Generics
> Collection lib made by Maciej.

Is it part of FPC? If not, could you can post the official URL?


>> I hope you find this a useful checklist.
>
> It contained so much false information that it only confuses people. :(
>
> I want to repeat that it is possible to write code dealing with
> Unicode that is fully compatible with Delphi at source level.
> It will be compatible with a future UTF-16 solution in Lazarus as well.
> Encoding agnostic (UTF-8 / UTF-16) code is possible even if you must
> iterate individual codepoints. See the wiki page for details.

That is I wanted to read. Thanks.

Some doubts:

> Remember these to keep your code compatible:
>  1. Normally use type "String".
>  1. Assign a constant always to a type String variable.

What do you mean? Instead of create a constant, is it better create a
String variable and assign the string to it?

>  2. Use type UnicodeString explicitly for API calls that need it.


Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-02 Thread Marcos Douglas B. Santos via Lazarus
On Tue, May 2, 2017 at 5:58 AM, Juha Manninen via Lazarus
 wrote:
> On Sun, Apr 30, 2017 at 7:37 PM, Marcos Douglas B. Santos via Lazarus
>  wrote:
>> If Delphi sources don't use UTF8, how is the best way to mantain sources
>> that need to work in both compilers?
>
> I wonder if I have misunderstood something about your questions.
> What means "Delphi sources don't use UTF8"?
> AFAIK they do use UTF8.

Sorry about that. I stopped using Delphi at version 7, that uses ANSI.
I thought that Delphi nowadays was using UTF16.
I will install Delphi Tokyo Starter and discover these things.

> One more clarification about assigning string data:
> The potential problem is only with string literals, constants.
> Assignment between variables always goes right thanks to their dynamic
> encoding in FPC 3+.

But if I put theses constants as resourcestrings, it's Ok as Mattias
told me, right?

Thank you for these tips.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-02 Thread Marcos Douglas B. Santos via Lazarus
On Tue, May 2, 2017 at 5:30 AM, Juha Manninen via Lazarus
 wrote:
>>>  1. Assign a constant always to a type String variable.
>>
>> What do you mean? Instead of create a constant, is it better create a
>> String variable and assign the string to it?
>
> From FPC's point of view our UTF-8 solution is a hack. In practice it
> means that success in assigning string literals depends on the string
> type.
> This:
>   S := 'Have 🍷 for FPC 💓 Lazarus';
> always works if "S" is a "String". It may not work with other string types.
> It is all explained in the wiki page.

I understood, thanks.

> When all your string data is Unicode then you can code in a Delphi
> compatible way.
> Only the Windows system codepages impose a problem, but I got an
> impression you don't need them now.

I am develop on Windows. What problems do you mean?


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Marcos Douglas B. Santos via Lazarus
On Wed, May 3, 2017 at 5:59 AM, Graeme Geldenhuys via Lazarus
 wrote:
> On 2017-05-03 01:21, Marcos Douglas B. Santos via Lazarus wrote:
>> Sorry about that. I stopped using Delphi at version 7, that uses ANSI.
>> I thought that Delphi nowadays was using UTF16.
>
> They (Delphi) loves to follow Microsoft. Files are stored in UTF-8 (this
> is the norm), but they use UTF-16 internally.
>
> Lazarus stores files in UTF-8 and uses UTF-8 internally.
>
> Some background info
> 
> UTF-16 was the first encoding implementation for Unicode - at a time
> when they thought 2-bytes will be big enough for everything. They were
> wrong. So then they invented UTF-8 to solve the problem. But by that
> time Microsoft already standardised on UTF-16, so Delphi followed suite.
> Linux, FreeBSD etc saw the light and used UTF-8 instead.

Ok, thank you for these informations.

best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Marcos Douglas B. Santos via Lazarus
On Wed, May 3, 2017 at 6:13 AM, Ondrej Pokorny via Lazarus
 wrote:
> Not if you need pre-unicode Delphi support :)
>
> (Well, Marcos didn't specify what Delphi version he wants to target but he
> stated "If Delphi sources don't use UTF8 [...]", which applies to
> pre-unicode Delphi versions.)

Yeah, sorry. I said that because I didn't know which encoding Delphi
is using nowadays.
But I would like to use only Delphi with Unicode support with
"dot.unit.support".

Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

2017-05-03 Thread Marcos Douglas B. Santos via Lazarus
On Wed, May 3, 2017 at 9:37 AM, Mattias Gaertner via Lazarus
 wrote:
>> Hmmm... why does FPC not understand the BOM?
>
> It does. And so does Delphi. But with and without BOM have different
> meanings.
>
>
>> > You are right, that using Unicode with Lazarus only needs a couple of
>> > rules to follow. Sharing code with Delphi adds a few more rules.
>>
>> One valid choice is to edit in Lazarus and copy to Delphi only to be
>> built. I understood Marcos Douglas planned something like that.
>> If code really must be edited in both, how to solve it?
>
> That's what I tried to explain to Marcos and what you described as
> "That must be very confusing."
>
>
>> This was another complication I did not think about. :(
>>
>> About the couple of rules to follow, I had these in mind:
>>  1. Normally use type "String".
>>  2. Assign a constant always to a type String variable.
>>  3. Use type UnicodeString explicitly for API calls that need it.
>
> 4. When sharing code with Delphi use BOM or use only ASCII constants.
> You can choose for each unit. Either way load texts using
> resourcestring or similar techniques.
>
> 5. What about Char and aString[]?
> 6. What about PChar?

I got it.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Android & iOS

2017-07-03 Thread Marcos Douglas B. Santos via Lazarus
Hi,

Direct to the subject:
Can I create Apps for Android and iOS using Lazarus nowadays?

I've seen frameworks like Castle-Engine that have a Tool which claims to be
more easy to building and packaging Apps:
https://github.com/castle-engine/castle-engine/wiki/Build-Tool

This framework looks like a piece of art, but I'm more interested to build
business applications with Forms, Grids, Lists and so on.

I believe that Ionic framework is a good choice to build mobile apps, but
if could have such apps using Free Pascal and Lazarus, would be nice.

Can I do that using Lazarus and its default widgets?

Thanks.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Android & iOS

2017-07-04 Thread Marcos Douglas B. Santos via Lazarus
On Tue, Jul 4, 2017 at 3:04 AM, Michael Van Canneyt via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> You can create some form of apps using the customdrawn
> widgetset, but I cannot honestly recommend this approach. I do not think it
> works on iOS (I could be mistaken) and it looks simply abysmal on android.
>
> I have created some android apps using the FPC JVM compiler, but then you
> need to start all over for iOS. I believe there is still some iOS desiger
> package by Joost van der Sluis.
>
> So at the moment the developer experience would not be very good, I think
> you're better off using a HTML5 based Ionic app.
>

Ok Michael, thanks for the advice.


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Android & iOS

2017-07-05 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Jul 5, 2017 at 7:05 AM, Michael Schnell via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> This of course is bad news, but we do hope for improvement when time
> comes
>
> See -> http://www.remobjects.com/ .
> They claim to allow for writing multi-target pascal applications:
> "NEW: Elements 9.1, Oxygene, C# & Swift, for iOS, Android, Mac, .NET &
> more."
>
> (Of course not free / Open Source)
>

I've read something about RemObjects but I prefer stay in FPC that is Open
Source.
But thanks, anyway.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Android & iOS

2017-07-05 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Jul 5, 2017 at 8:57 AM, Mark Morgan Lloyd via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Might also be worth bering https://blog.jetbrains.com/kot
> lin/2017/05/kotlin-on-android-now-official/ in mind. Not Pascal, but at
> least was designed with Pascal in mind.
>

I didn't know Kotlin compiles to iOS.
They are using LLVM — but FPC has a branch for that too, right? — but
"...Kotlin/Native is far from complete, so this Technology Preview has a
number of limitations that will be eliminated at later stages" see
https://blog.jetbrains.com/kotlin/2017/04/kotlinnative-tech-preview-kotlin-without-a-vm/


So, I believe Ionic and JavaScript is winning until now.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Android & iOS

2017-07-05 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Jul 5, 2017 at 9:30 AM, Alfred via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> I you limit yourself to Android: with LAMW you can make perfect Android
> apps !
>
> https://github.com/jmpessoa/lazandroidmodulewizard
>
> http://forum.lazarus.freepascal.org/index.php/topic,21919.0.html
>

I saw this project. Looks good... but my client needs Android and iOS so...
:(

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Running Unit tests for all projects

2017-07-18 Thread Marcos Douglas B. Santos via Lazarus
Hi,

I have several projects that have FPCUnit tests.
I would like to know if there is a tool or a simple way to compile, run and
catch the results for all projects.

Motivation: When I update FPC, 3rd libs/frameworks and Lazarus, some
changes may broke my code, but not in all projects.
I would like to know which projects will be broke before update my stable
versions for each compiler/lib/framework/ide.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Running Unit tests for all projects

2017-07-19 Thread Marcos Douglas B. Santos via Lazarus
On Tue, Jul 18, 2017 at 11:11 AM, Graeme Geldenhuys via Lazarus
 wrote:
> On 2017-07-18 14:42, Marcos Douglas B. Santos via Lazarus wrote:
>
> MSEide+MSEgui has such a tool in its MSEUniverse repository. It's a bit
> cryptic to use (and no help as always), but once you get the gist of things
> (Martin will surely lend a hand explaining things) it works pretty well.

Thanks, I'll take a look.

> For my own projects I simply have batch scripts that execute automatically
> via cron jobs every  amount of minutes or hours. The produce XML output
> which gets processed by XSLT to generate a HTML page which is automatically
> published. I also get a unit test summary email sent to me. The process is
> very similar to what I do with the tiOPF project. Take a look at the
> /InstallScripts/freebsd/ directory for an example. Oh yeah, I also
> use FPTest (a DUnit2 clone but FPC specific) - instead of FPCUnit, but the
> latter should be able to do the above (I think).

I saw. It's simple and works to tiOPF. I thought in a program to run
all tests in all my programs... that is it, I should to create a
program, register all project paths and run.

How do you get the compiler arguments for each project? Mabe using the
XML that Lazarus creates for each program?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Running Unit tests for all projects

2017-07-19 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Jul 19, 2017 at 9:53 AM, Martin Schreiber via Lazarus
 wrote:
>
> Screenshot:
> http://mseide-msegui.sourceforge.net/pics/mserun.png
> Binaries:
> https://sourceforge.net/projects/mseuniverse/files/mserun/
> Source:
> https://gitlab.com/mseide-msegui/mseuniverse/tree/master/tools/mserun

Hi Martin,
It looks like it's about Git, not about testing... right?

Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Running Unit tests for all projects

2017-07-19 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Jul 19, 2017 at 9:59 AM, Mattias Gaertner via Lazarus
 wrote:
> On Wed, 19 Jul 2017 09:43:02 -0300
> "Marcos Douglas B. Santos via Lazarus" 
> wrote:
>
>>[...]
>> How do you get the compiler arguments for each project? Mabe using the
>> XML that Lazarus creates for each program?
>
> You can either compile each project using lazbuild, or you can fetch
> the options from the produced .compiled file (xml format).

OMG, that is it. I didn't think in that possibility.
Using lazbuild is better because it's smart enough to automatically
compiles required packages.

But I only use lazbuild to build the IDE. I've took a look in this
page http://wiki.lazarus.freepascal.org/lazbuild and I haven't found
an argument related to the project file (lpi or lpr).

Can I just do that?
(sorry, I'm not with my Lazarus environment now to test)
lazbuild [options] /path/myproject.lpi

Regards,
Marcos Douglas

PS.
This is really cool too "--build-mode" and will make my life easier. Thanks
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Running Unit tests for all projects

2017-07-19 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Jul 19, 2017 at 10:32 AM, Martin Schreiber via Lazarus
 wrote:
> On Wednesday 19 July 2017 15:08:55 Marcos Douglas B. Santos via Lazarus wrote:
>> On Wed, Jul 19, 2017 at 9:53 AM, Martin Schreiber via Lazarus
>>
>> Hi Martin,
>> It looks like it's about Git, not about testing... right?
>>
> Why do you think so? The screenshot shows the unittests of MSElang.
> Another screenshot which shows the run to create MSE* releases.
> http://mseide-msegui.sourceforge.net/pics/mserun1.png

Hmm... sorry, my fault.

Martin (and Paul Breneman), I will get the sources and take a look more closer.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Please consider adding Application Explorer to lazarus components folder

2017-07-24 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Jul 23, 2017 at 7:08 PM, Anthony Walter via Lazarus
 wrote:
> I think this tool should be added to the lazarus components folder. I've
> been trying to fix issues with the sparta docked form designer and fell back
> to debugging/testing using a tool I wrote some time ago. It has helped me
> understand the structure of the sparta designer a lot. It's helpful in many
> other areas as well.
>
> Here is a brief video with a property grid newly added:
>
> https://video.getlazarus.org/appexploregrid.mp4
>
> And here is the original page for this tool with a better overview:
>
> https://www.getlazarus.org/apps/appexplore/

Very interesting!
Thanks for share.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] FCL DOM [vs] laz2_DOM, and more

2017-07-29 Thread Marcos Douglas B. Santos via Lazarus
Hi,

Nowadays, we have full Unicode support in FPC.
So, my question is: The units bellow is still necessary to use XML
with Lazarus or we can use just the original provided by FCL?

laz2_DOM
laz2_XMLRead
laz2_XMLWrite
laz2_XMLCfg
laz2_XMLUtils
laz_XMLStreaming

See here http://wiki.lazarus.freepascal.org/XML_Tutorial

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] FCL DOM [vs] laz2_DOM, and more

2017-07-29 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Jul 29, 2017 at 8:39 PM, Marcos Douglas B. Santos
 wrote:
> Hi,
>
> Nowadays, we have full Unicode support in FPC.
> So, my question is: The units bellow...

below*


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] FCL DOM [vs] laz2_DOM, and more

2017-07-30 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Jul 30, 2017 at 5:00 AM, Michael Van Canneyt via Lazarus
 wrote:
>
> The FPC units use UnicodeString (UTF16), the lazarus units use UTF8.
> If the end result is used excluively in UTF8 strings, the lazarus version
> may be
> faster as there will be less conversions.

Thank you.

Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] FCL DOM [vs] laz2_DOM, and more

2017-07-30 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Jul 30, 2017 at 5:29 AM, Michalis Kamburelis via Lazarus
 wrote:
>
> I wonder if we can move the UTF8-based XML units to FPC, to be
> available in the main FPC distribution too? (Possibly renamed like
> Utf8_XMLXxx or such, instead of LazX_XMLXxx.)

+1
However, a better name for the unit could be domutf8, using FPC naming pattern.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Status of namespace

2017-08-02 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 2, 2017 at 11:08 AM, Fabio Luis Girardi via Lazarus
 wrote:
> Hi all!!
>
> Whats the current state of Lazarus when dealing with packages with dotted
> units (namespaces)?
>
> Should I avoid this idea?

It's working.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Status of namespace

2017-08-02 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 2, 2017 at 11:50 AM, Juha Manninen via Lazarus
 wrote:
> On Wed, Aug 2, 2017 at 5:46 PM, Juha Manninen  
> wrote:
>> - The original bug is fixed long time ago, but I understood there are
>> 2 others that should be reported separately.
>>   - F12 in designer.
>>   - Codetools issues.
>
> ... and those may be fixed already, too.

I believe they were already fixed. I'm using it without these problems.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] String vs WideString

2017-08-12 Thread Marcos Douglas B. Santos via Lazarus
Hi,

I have a "old" system that was coded in FPC 2.6.5.
Today I had to change something in the code and now I need to update
to FPC 3.0 and Lazarus 1.9.

This system uses a COM object. I made a class to wrap the configuration.

So, all string arguments in this class is WideString based.
The SetLicence method will receive a WideString but the source is a "string".

Look:

Lib.SetLicense(
  IniFile.ReadString('TheLib', 'license', '')
);

As you know, IniFile.ReadString returns a "string" and some internal
conversion is happening and the licence is not valid anymore.

If I put the licence as a string directly, it works:

Lib.SetLicense(
  'my_licence_here'
);

How can I change my code to work properly using Ini files, strings and
WideString?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-12 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Aug 12, 2017 at 5:32 PM, Mattias Gaertner via Lazarus
 wrote:
> On Sat, 12 Aug 2017 16:46:09 -0300
> "Marcos Douglas B. Santos via Lazarus" 
> wrote:
>
>>[...]
>> Lib.SetLicense(
>>   IniFile.ReadString('TheLib', 'license', '')
>> );
>
> What encoding has the ini file?

ANSI. A simple text file on Windows with only ANSI chars.

But I'm so sorry Mattias, it was my fault.
The program was reading the wrong file version (problem in paths...).

It works now, but I have one question:
What is the right way to code to do not see this warning?

Warning: Implicit string type conversion from "AnsiString" to "WideString"

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-12 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Aug 12, 2017 at 5:49 PM, Mattias Gaertner via Lazarus
 wrote:
> On Sat, 12 Aug 2017 17:43:29 -0300
> "Marcos Douglas B. Santos via Lazarus" 
> wrote:
>
>>[...]
>> > What encoding has the ini file?
>>
>> ANSI. A simple text file on Windows with only ANSI chars.
>
> Which one? Do you mean Windows CP-1252?

Yes...
But would it make any difference?

>>[...]
>> Warning: Implicit string type conversion from "AnsiString" to "WideString"
>
> Explicit type cast:
>
> Lib.SetLicense(
>WideString(IniFile.ReadString('TheLib', 'license', ''))
> );

Wow... everywhere? :(

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-12 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Aug 12, 2017 at 7:21 PM, Bo Berglund via Lazarus
 wrote:
> On Sat, 12 Aug 2017 17:56:58 -0300, "Marcos Douglas B. Santos via
> Lazarus"  wrote:
>
>>> Which one? Do you mean Windows CP-1252?
>>
>>Yes...
>>But would it make any difference?
>
> I recently had a problem with an application that was converted from
> old string type to AnsiString and seemingly worked in the new Unicode
> environment.
> However, we received reports that it had failed in some Asian
> countries (Korea, China, Thailand) and upon checking it turned out
> that the data inside a string used as buffer was changed because of
> locale differences
>
> After switching out the affected variable declarations from AnsiString
> to RawByteString the application seemingly started to work again also
> on these locations.
>
> So AnsiString is not safe either
>
> And after this I have spent some time to totally rework the use of
> strings as buffers to instead use TBytes. Lots of work but guaranteed
> to not sneak in unexpected conversions.

Is not simpler to use RawByteString instead TBytes?

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-14 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Aug 13, 2017 at 7:51 AM, Juha Manninen via Lazarus
 wrote:
> On Sun, Aug 13, 2017 at 1:21 AM, Bo Berglund via Lazarus
>  wrote:
>> So AnsiString is not safe either
>
> That is a little misleading.
> Actually using the Windows system codepage is not safe any more.
> The current Unicode system in Lazarus maps AnsiString to use UTF-8.
> Text with Windows codepage must be converted explicitly.
> This is a breaking change compared to the old Unicode suppport in
> Lazarus 1.4.x + FPC 2.6.x.
> The right solution is to use Unicode everywhere. Windows codepages can
> be seen as a historical remain, retained for backwards compatibility.
> Now is year 2017, Unicode has been used for decades. Everybody should
> use it by now.

"The right solution is to use Unicode everywhere."
I agree. But would be best if the compiler uses Unicode everywhere and
us, developers, using just one type called "string"... Even if this
break the old code. Maybe, instead using "string", the new code should
be use just UnicodeString...

Well, I know that many people here already had this "fight" about
Unicode so, let's forget about it what the compiler "should" or not to
do.

> Marcos Douglas, please change the encoding in your text file to UTF-8.
> Every decent text editor, including the editor in Lazarus, has a
> feature to do it.
> Once the data is Unicode, it is all smooth sailing.
> Data is converted between UTF-8 and UTF-16 losslessly.

You're right.

> One more thing:
> Data for WideString/UnicodeString parameters in WinAPI functions are
> converted automatically. You can ignore the warning or suppress it by
> a type cast as Mattias showed.
> However for PWideChar parameters you should create an explicit
> temporary variable, usually UnicodeString but WideString for OLE.
> Assigning to it from your "String" data converts encoding.
> Then cast the new variable as the required pointer type.

This is a ugly trick... but I understood what you mean.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-14 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Aug 14, 2017 at 6:53 AM, Tony Whyman via Lazarus
 wrote:
>
> On 13/08/17 12:18, Juha Manninen via Lazarus wrote:
>>
>> Unicode was designed to solve exactly the problems caused by locale
>> differences.
>> Why don't you use it?
>
> I believe you effectively answer your own question in your preceding post:
>
>> Actually using the Windows system codepage is not safe any more.
>> The current Unicode system in Lazarus maps AnsiString to use UTF-8.
>> Text with Windows codepage must be converted explicitly.
>> This is a breaking change compared to the old Unicode suppport in
>> Lazarus 1.4.x + FPC 2.6.x.
>
> If you are processing strings as "text" then you probably do not care how it
> is encoded and can live with "breaking changes". However, if, for some
> reason you are or need to be aware of how the text is encoded - or are using
> string types as a useful container for binary data then, types that sneak up
> on you with implicit type conversions or which have semantics that change
> between compilers or versions, are just another source of bugs.
>
> PChar used to be  a safe means to access binary data - but not anymore,
> especially if you move between FPC and Delphi. (One of my gripes is that the
> FCL still makes too much use of PChar instead of PByte with the resulting
> Delphi incompatibility). The "string" type also used to be a safe container
> for any sort of binary data, but when its definition can change between
> compilers and versions, it is now something to be avoided.
>
> As a general rule, I now always use PByte for any sort of string that is
> binary, untyped or encoding to be determined. It works across compilers (FPC
> and Delphi) with consistent semantics and is safe for such use.
>
> I also really like AnsiString from FCP 3.0 onwards. By making the encoding a
> dynamic attribute of the type, it means that I know what is in the container
> and can keep control.
>
> I am sorry, but I would only even consider using Unicodestrings as a type
> (or the default string type) when I am just processing text for which the
> encoding is a don't care, such as a window caption, or for intensive text
> analysis. If I am reading/writing text from a file or database where the
> encoding is often implicit and may vary from the Unicode standard then my
> preference is for AnsiString. I can then read the text (e.g. from the file)
> into a (RawByteString) buffer, set the encoding and then process it safely
> while often avoiding the overhead from any transliteration. PByte comes into
> its own when the file contains a mixture of binary data and text.
>
> Text files and databases tend to use UTF-8 or are encoded using legacy
> Windows Code pages. The Chinese also have GB18030. With a database, the
> encoding is usually known and AnsiString is a good way to read/write data
> and to convey the encoding, especially as databases usually use a variable
> length multi-byte encoding natively and not UTF-16/Unicode. With files, the
> text encoding is usually implicit and AnsiString is ideal for this as it
> lets you read in the text and then assign the (implicit) encoding to the
> string, or ensure the correct encoding when writing.

Unicode everywhere and you using AnsiString and doing everything...
Now I'm confused.

> And anyway, I do most of my work in Linux, so why would I even want to
> bother myself with arrays of widechars when the default environment is UTF8?

Maybe you do not have problems because you don't use Windows.

> We do need some stability and consistency in strings which, as someone else
> noted have been confused by Embarcadero. I would like to see that focused on
> AnsiString with UnicodeString being only for specialist use on Windows or
> when intensive text analysis makes a two byte encoding more efficient than a
> variable length multi-byte encoding.

FPC and Lazarus claim they are cross-platform — this is a fact — and
because that, IMHO, both should be use in only one way in every
system, don't you think?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-14 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Aug 14, 2017 at 10:21 AM, Tony Whyman via Lazarus
 wrote:
>
> On 14/08/17 14:11, Marcos Douglas B. Santos via Lazarus wrote:
>>
>> FPC and Lazarus claim they are cross-platform — this is a fact — and
>> because that, IMHO, both should be use in only one way in every
>> system, don't you think?
>>
>> Best regards,
>> Marcos Douglas
>
> Precisely. But why this fixation on UTF-16/Unicode and not UTF8?

I have no fixation in any Unicode flavors...
My "problem" is because I use Windows, not Linux where UTF8 is the default.

> Lazarus is already a UTF8 environment.
>
> Much of the LCL assumes UTF8.
>
> UTF8 is arguably a much more efficient way to store and transfer data
>
> UTF-16/Unicode can only store 65,536 characters while the Unicode standard
> (that covers UTF8 as well) defines 136,755 characters.
>
> UTF-16/Unicode's main advantage seems to be for rapid indexing of large
> strings.
>
> You made need UTF-16/Unicode support for accessing Microsoft APIs but apart
> from that, why is it being promoted as the universal standard?

I didn't propose that.
But take a look in other languages, see what they are using.


Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-16 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 16, 2017 at 6:12 AM, Juha Manninen via Lazarus
 wrote:
> On Mon, Aug 14, 2017 at 4:11 PM, Marcos Douglas B. Santos via Lazarus
>  wrote:
>> Unicode everywhere and you using AnsiString and doing everything...
>> Now I'm confused.
>
> Yes, please read:
>  http://wiki.freepascal.org/Unicode_Support_in_Lazarus
> I have advertised it so much that some people are already irritated,
> but maybe you missed it so far.

Thanks. I know about this page... unfortunately looks like it is not
enough, since many others still complain.

>> This is a ugly trick... but I understood what you mean.
>
> This was about the explicit temporary UnicodeString variable for
> WinAPI call parameters.
> No, it is not ugly, the code remains 100% compatible with Delphi.
> Please remember also that direct WinAPI call are not needed in
> cross-platform code.

This thread is not only about WinAPI. I have this problem because I
need to use a Windows 3rd Lib, which uses WideString.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-16 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 16, 2017 at 11:37 AM, Juha Manninen via Lazarus
 wrote:
> On Wed, Aug 16, 2017 at 5:13 PM, Marcos Douglas B. Santos via Lazarus
>  wrote:
>> Thanks. I know about this page... unfortunately looks like it is not
>> enough, since many others still complain.
>
> What is missing? I can try to improve it.

I cannot say from others, but I had this issue (about WideString) for now.

>> This thread is not only about WinAPI. I have this problem because I
>> need to use a Windows 3rd Lib, which uses WideString.
>
> Then just use WideString or UnicodeString where needed. It is not a problem.

Are you saying that I need to do this?
(following the firt example on this thread)

=== begin ===
var
  U: UnicodeString;
  W: WideString;
begin
  U := IniFile.ReadString('TheLib', 'license', '');
  W := U;
  Lib.SetLicense(W);
  // ...
end;
=== end ===

...and I will not get a "Warning", right?


> Note,  WideString is for OLE programming. Most often you should use
> UnicodeString. Their memory management differs.

Ok... thanks... but in my case is a OLE object that I need to use.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] String vs WideString

2017-08-17 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Aug 16, 2017 at 12:38 PM, Juha Manninen via Lazarus
 wrote:
> On Wed, Aug 16, 2017 at 5:48 PM, Marcos Douglas B. Santos via Lazarus
>> Are you saying that I need to do this?
>> (following the firt example on this thread)
>
> No, if the parameter is WideString, not a pointer PWideChar, you can
> just call it like you did. Suppress the warning as Mattias told if it
> bothers you. You can also make a helper function so the conversion
> happens in one place.
> Yes, for OLE you need WideString.

"Suppress the warning as Mattias told if it bothers you"

Of course bothers me.
Sorry, but every single warning is a... warning... that needs to be resolved.
If this is not a problem (or a possible future problem), the compiler
should not give us a warning, right?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Namespace

2017-08-20 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Jan 12, 2011 at 3:53 PM, Sven Barth  wrote:
> On 12.01.2011 18:24, Mattias Gaertner wrote:
>>
>> Marcos Douglas  hat am 12. Januar 2011 um 18:05
>> geschrieben:
>>
>>  > On Wed, Jan 12, 2011 at 1:57 PM, Andreas Schneider 
>> wrote:
>>  > >
>>  > > ... which you can already do. The unit order in the uses clause
>>  > > already determines which identifier is chosen when you do *not*
>>  > > specify a unit explicitly. So just make sure that LCL's TButton is
>>  > > always the default one and you can still use your own TButton by
>>  > > prefixing it with your own unitname. All you want is already there
>> and
>>  > > seems to cover 99% of the usecases.
>>  >
>>  > But I can register a component called TButton?
>>
>> No, that would conflict with the LCL TButton. See the FCL function
>> FindClass.
>
>
> If I see that right, then even if Lazarus would implement this it would need
> a new FPC release with an extended FindClass to enable this. As the current
> release is just two months old this might not happen in just some weeks.

Hi Sven.
Do you have any news about it?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Namespace

2017-08-20 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Aug 20, 2017 at 2:26 PM, Sven Barth via Lazarus
 wrote:
> Am 20.08.2017 18:55 schrieb "Marcos Douglas B. Santos via Lazarus"
> :
>>
>> On Wed, Jan 12, 2011 at 3:53 PM, Sven Barth 
>> wrote:
>> > On 12.01.2011 18:24, Mattias Gaertner wrote:
>> >>
>> >> Marcos Douglas  hat am 12. Januar 2011 um 18:05
>> >> geschrieben:
>> >>
>> >>  > On Wed, Jan 12, 2011 at 1:57 PM, Andreas Schneider 
>> >> wrote:
>> >>  > >
>> >>  > > ... which you can already do. The unit order in the uses clause
>> >>  > > already determines which identifier is chosen when you do *not*
>> >>  > > specify a unit explicitly. So just make sure that LCL's TButton is
>> >>  > > always the default one and you can still use your own TButton by
>> >>  > > prefixing it with your own unitname. All you want is already there
>> >> and
>> >>  > > seems to cover 99% of the usecases.
>> >>  >
>> >>  > But I can register a component called TButton?
>> >>
>> >> No, that would conflict with the LCL TButton. See the FCL function
>> >> FindClass.
>> >
>> >
>> > If I see that right, then even if Lazarus would implement this it would
>> > need
>> > a new FPC release with an extended FindClass to enable this. As the
>> > current
>> > release is just two months old this might not happen in just some weeks.
>>
>> Hi Sven.
>> Do you have any news about it?
>
> Why should I have any news? I merely stated what would need to happen if
> this is to be changed.

It was just a question... never mind. Thanks.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Why is there no announcement of Lazarus event

2017-09-08 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Sep 8, 2017 at 1:40 PM, Graeme Geldenhuys via Lazarus
 wrote:
>
> I didn't realise the idea of having a Conference came about so late. They
> [Blaise Pascal] really should plan ahead better. The same issue "too short
> notice" might now apply to somebody that wants to attend the conference too.
> :-/

I agree. I know that could be difficult, but plan ahead (months?)
would be better.
I'm living on Brazil but almost every year I travel to abroad. If I
know about these conferences at the future, I would participated.

> I do appreciate Blaise Pascal for wanting to promote FPC and Lazarus though.
> It's high time somebody does!

+1

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite?

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
Hi,

Nowadays we have Unicode and so on.

Is there any reason to these units (Laz2_DOM, laz2_XMLRead, and
laz2_XMLWrite) still exists?

I've always used them, but days ago I needed to use XPath and the
xpath unit works using objects from DOM unit, not laz2_DOM, and
because that my doubt.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite?

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus
 wrote:
>
> These units work using UTF8. The DOM units use UnicodeString (UTF16).
>
> Given that these units are quite stable in terms of functionality and
> maturity, it may be a good idea to move them to the FCL.

Yes, that is my point.
But instead of just moving them, shouldn't they merge as well into a
single unit, ie, only one DOM, XMLRead, and XMLWrite unit?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Error loading a package with different versions

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
I have a package with different versions like this:

/mypack
  /1.0/src...
  /2.0/src...

Then I have 2 project, each one using a different version.
The same environment like this:
http://wiki.freepascal.org/Lazarus_Packages#Example_library_with_multiple_lpk

My problem is:
Every time that I switch between these projects, I get an error from the IDE:
"The following packages failed to load:"

I'm using the menu: `Project->Open Recent Project`

BUT, if I try again, ie, I click at the same menu item, choosing the
same project that is already opened, the IDE refresh the package and
load the right version.

I believe something is wrong when the IDE try to close the loaded
package for the first time, before open the right version.

I'm using trunk, but an old revision:
Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64



Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite?

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Sep 20, 2017 at 3:02 PM, Michael Van Canneyt via Lazarus
 wrote:
>
>
> On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote:
>
>> On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus
>>  wrote:
>>>
>>>
>>> These units work using UTF8. The DOM units use UnicodeString (UTF16).
>>>
>>> Given that these units are quite stable in terms of functionality and
>>> maturity, it may be a good idea to move them to the FCL.
>>
>>
>> Yes, that is my point.
>> But instead of just moving them, shouldn't they merge as well into a
>> single unit, ie, only one DOM, XMLRead, and XMLWrite unit?
>
>
> I don't think so, because how will you make the difference between the 2 ?
> And it's not possible to have optimal code for both cases in 1 set of
> classes; The idea is that there are no conversions necessary.

And we will continue having two base code to do the same thing?
Don't you think this is confusing for the users?

What about having just one code but setting the type of string
(XMLString) to use? (even having Unicode... God)

How can I use XPath with laz2_* units then?


Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
Hi,

I'm working in my new "pet project" called Xavier.
Xavier is an object-oriented library for work with XML.

The motives and announcement is on the forum:
http://forum.lazarus.freepascal.org/index.php/topic,38343.0.html

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Sep 20, 2017 at 4:31 PM, Michael Van Canneyt via Lazarus
 wrote:
>
>
> On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote:
>
>> Hi,
>>
>> I'm working in my new "pet project" called Xavier.
>> Xavier is an object-oriented library for work with XML.
>
>
> I don't understand the 'why' ? Should I understand that you consider the DOM
> units not object-oriented ?

Yes and no.

Michael, with all my respect, that depends of your view about Object thinking.
Yes, DOM uses classes and objects, but IMO Objects is more than that.
Objects are more close to Functional programming than most people think.
If can code classes but if you are implementing (all) in an imperative
way, I mean line by line telling the computer how to do something
instead of code what you just want, you may not are thinking in terms
of Objects. Your class, in these cases, is just a "bucket of data and
procedures".

In a perfect design, we may only connect all objects to work in a
"task", call "run", and "they" will know what to do.
They (Objects) will decide how to do. Not the programmer (the
"controller"). Just objects sending messages for each other.

Yeah, looks so philosophical... :)

I've been writing a blog about this for two years
http://objectpascalprogramming.com/

...and I use these same concepts in production code, of course.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Error loading a package with different versions

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Sep 20, 2017 at 4:53 PM, Mattias Gaertner via Lazarus
 wrote:
> On Wed, 20 Sep 2017 15:09:43 -0300
> "Marcos Douglas B. Santos via Lazarus" 
> wrote:
>
>>[...]
>> I'm using trunk, but an old revision:
>> Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64
>
> Please create a bug report.

Done
https://bugs.freepascal.org/view.php?id=32450


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-20 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Sep 20, 2017 at 7:33 PM, Michael Van Canneyt via Lazarus
 wrote:
>
> [...]
>
> You should be programming Java:
> https://steve-yegge.blogspot.be/2006/03/execution-in-kingdom-of-nouns.html

Nah... most of them know nothing about true OOP.
They believe that an object is a "record" with getters and setters... anyway.

> I prefer imperative programming. (verbs, if you want). It comes more
> natural.
>
> Well, each his own style. But, if you allow me: the post on the lazarus
> forum and the Xavier page should really explain what you mean by OOP. I
> guess most people will be confused, as I am.

As you said, each his own style. What is more important is keeping
this excellent community united, around that great language called
Object Pascal.
And indeed is a good tip. I'll improve the README. Thank you.

>
> Thanks for explaining.

You're welcome.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-21 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Sep 21, 2017 at 2:57 AM, leledumbo via Lazarus
 wrote:
> Free Pascal - Lazarus mailing list wrote
>> Hi,
>>
>> I'm working in my new "pet project" called Xavier.
>> Xavier is an object-oriented library for work with XML.
>>
>> The motives and announcement is on the forum:
>> http://forum.lazarus.freepascal.org/index.php/topic,38343.0.html
>
> Apart from not needing to free memory and simpler nodes retrieval, I can't
> really see any difference with DOM. I was expecting some kind of DSL to work
> with XML in a declarative way, but unfortunately it still looks imperative.

I've just started this project and we don't have the 1.0 version yet.
Any ideas could be considered at this point.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-21 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Sep 21, 2017 at 5:00 AM, Michael Schnell via Lazarus
 wrote:
> On 20.09.2017 22:09, Marcos Douglas B. Santos via Lazarus wrote:
>>
>> In a perfect design, we may only connect all objects to work in a "task",
>> call "run", and "they" will know what to do. They (Objects) will decide how
>> to do. Not the programmer (the "controller"). Just objects sending messages
>> for each other.
>
> Is that what the (language construct) "Interface" is supposed to provide ?

No. But Interfaces are very important. There is not true OOP without
"contracts" — that is what Interfaces are.
You can use inheritance to provide polimorphism, but inheritance could
be evil and should be avoided[1] as much you can. Instead, use
composion.
Others languages are using "duck typing", but I believe Interfaces are better.

Regards,
Marcos Douglas

[1] My posts about inheritance https://goo.gl/nzM4Ss
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-21 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Sep 21, 2017 at 7:32 AM, Anthony Walter via Lazarus
 wrote:
> Marcos,
>
> What and where are James.Data, James.Data.Clss?

Hi Anthony,

Jame is another project of mine: https://github.com/mdbs99/james
I've changed Xavier README a little bit including James as a
dependency and some principles.
Sorry about this misudestandy.

> Have you seen my XML interface at this url?
>
> https://github.com/sysrpl/Cross.Codebot/blob/master/source/codebot.text.xml.pas
>
> It might be helpful to study and/or consider. Example:
>
> [...snip...]

I know Codebot and Bare.Game for a long time.
Maybe I already told you, but you're a great developer. You code
things from the scratch and, even that, the design of your classes is
clean and beautiful. I mean, you do not code like a "hacker", but as
an architect. Your work have inspired me many times. Thank you.

Unfortunately, I didn't remember about this part when I thought to
code Xavier — but it was only a few hours coding with 2 beers.
However, I have some principles or own style that prevents me to use
Codebot. For example: I don't use functions anymore, only objects
(tip: think about put your functions inside classes, see New() methods
in Xavier); classes should be short as possible with 5 or less
methods, most; no nil/NULL as a valid return; other things.
But of course I will study (again) Codebot! For example, I will see
how did you code XPath, because I need to know how to do this on
Windows too. I can get many ideas from Codebot. Thanks again.

What license did you use in Codebot? You might put a LICENSE file there...

Another thing: You might divide Codebot in some specific libraries.
I thought coding everything that I want in James, but I realized that
is simpler to new users give just a piece that they want now, not a
big library — even with dependencies.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-22 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Sep 22, 2017 at 10:51 AM, el es via Lazarus
 wrote:
> On 21/09/17 17:49, Marcos Douglas B. Santos via Lazarus wrote:
>
>>
>> [1] My posts about inheritance https://goo.gl/nzM4Ss
>>
>
> If it only was in English ;) Unfortunately knowing Esperanto (once upon a 
> time)
> only gets you so far as 5% ;)

The blog is written in Portuguese.
Maybe I can be far from readers here, on this list. But remember that
Brazil — Portuguese speakers — is a huge country and I have a consider
audience. There are others countries that speak Portuguese too, as
Portugal of course.

However, the second largest audience in my blog, comes from English
speakers. Third comes from Portugal. Believe or not.

So, you can do like them: just use Google Translator.   :)

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi

2017-09-24 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Sep 23, 2017 at 5:25 AM, Graeme Geldenhuys via Lazarus
 wrote:
> On 2017-09-21 04:06, Marcos Douglas B. Santos via Lazarus wrote:
>>
>>
>> Nah... most of them know nothing about true OOP.
>> They believe that an object is a "record" with getters and setters...
>> anyway.
>
>
> If I understand you correctly... referring to Java developers, then that is
> a totally wrong generalisation.

Ok, I will rephrase: most that I know, met, or that I read an article
or comment on the internet.

>> As you said, each his own style. What is more important is keeping
>> this excellent community united, around that great language called
>> Object Pascal.
>
>
> I love Object Pascal too, and have a real soft spot for it (and always
> will). But G*D damn, Java is brilliant too. Not just Java the language, but
> the millions of frameworks and tools built around it too (JPA, Spring Boot,
> Jenkins, Maven etc). Also the understated Java Annotations are unbelievably
> powerful and can (and does) reduce the amount of boilerplate code
> tremendously(*).
>
> FPC doesn't even cover the most basic of things - no decent debugger that
> can handle all the Object Pascal language features. :-/

Unfortunately, I have to agree about the debugger.  :(

> * Take a gander at how much Java Annotations reduced boiler plate code
>   using JPA in EJB 3.0 and later vs EJB 2.1 which didn't use
>   annotations.
>
>
> http://web.archive.org/web/20100731223045/http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html

Thanks,

Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
Hi,

Yes, yes... another email about Unicode, because it has not been
completed yet. Sorry.
I would like to know how I can develop CLI and GUI (Lazarus) programs
using just UnicodeString, making them all compatible with Delphi
compiler.

My environment is:
Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64

I thought that I could use this:

{$mode delphi}
{$modeswitch unicodestrings}

Then, I made some tests:

1- Writing a CLI with basic chars:

===code-begin===
program Project1;
{$mode delphi}
{$modeswitch unicodestrings}
uses
  SysUtils, Classes;
const
  TXT = '1'#13#10'2'#13#10'3';
var
  Ss: TStrings;
begin
  Ss := TStringList.Create;
  try
Ss.Text := TXT;
Writeln('text ', ss.Text);
Writeln('count ', ss.Count);
  finally
Ss.Free;
  end;
  ReadLn;
end.
===code-end===

===output-begin===
text 1
2
3

count 3
===output-end===

Everything worked. No warnings. Good.


Then I changed the const like this:
===code-begin===
const
  TXT: string = '1'#13#10'2'#13#10'3';
===code-end===

Everything worked. But now I have a warning:
project1.lpr(13,19) Warning: Implicit string type conversion with
potential data loss from "UnicodeString" to "AnsiString"

Why?
Is not String supposed to be UnicodeString?
Is TStrings ANSI and because that I got this warning?


Then I changed the const like this:
===code-begin===
const
  TXT = '1'#13#10'2'#13#10'3'#13#10'áéíóú';
===code-end===


And:
===output-begin===
text 1
2
3
áéíóú

count 4
===output-end===

Is it not possible to write accented chars to display at the console?




2- Writing a GUI with basic chars:

I just copy the same code with some modifications:
===code-begin===
unit Unit1;

{$mode delphi}
{$modeswitch unicodestrings}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

const
  TXT = '1'#13#10'2'#13#10'3'#13#10;

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
  Ss: TStrings;
begin
  Ss := TStringList.Create;
  try
Ss.Text := TXT;
ShowMessage('text ' + ss.Text);
ShowMessage('count ' + ss.Count.ToString);
  finally
Ss.Free;
  end;
end;

end.
===code-end===


Everything worked. But now I have a few warnings:

Compile Project, Target: C:\temp\project1.exe: Success, Warnings: 4
unit1.pas(36,29) Warning: Implicit string type conversion from
"AnsiString" to "UnicodeString"
unit1.pas(36,34) Warning: Implicit string type conversion with
potential data loss from "UnicodeString" to "AnsiString"
unit1.pas(37,30) Warning: Implicit string type conversion from
"AnsiString" to "UnicodeString"
unit1.pas(37,45) Warning: Implicit string type conversion with
potential data loss from "UnicodeString" to "AnsiString"


Then, I changed the const like this (again):
===code-begin===
const
  TXT: string = '1'#13#10'2'#13#10'3';
===code-end===

Everything worked. But now I have same warnings before.



Then, I changed the const like this (yeah, again):
===code-begin===
const
  TXT = '1'#13#10'2'#13#10'3'#13#10'áéíóú';
===code-end===

Everything worked. But now I have same warnings before.


Finally ,I changed the const like this:
===code-begin===
const
  TXT: string = '1'#13#10'2'#13#10'3'#13#10'áéíóú';
===code-end===

And now, the first message is:
[Window Title]
project1

[Content]
text 1
2
3
áéíóú



Summary:

1. I did simple programs with simple constants and I got different
results or warnings.

2. I truly believe that smarter people as FPC team, Lazarus team, and
all smart collaborators can code CLI, GUI and all compatible with
Delphi... but for me is still very hard to understand.


What I need and my thoughts for help you to help me:

1. I would like to use just "string" everywhere.
2. I DON'T care about performance like gain 2ms... 10ms... 1s... I
really don't care, if I can code a simple and elegant code.
3. Don't think external files. If a have a UTF8 encoded file, I know
that and I can use string conversion... but it is EXTERNAL, not part
of the code. So, in my mind this is OK and normal.

Again, my env is:
Lazarus 1.9.0 r54784 FPC 3.0.1 i386-win32-win32/win64


May I code using just "string"?

Thank you.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Sep 25, 2017 at 3:19 PM, Ondrej Pokorny via Lazarus
 wrote:
> On 25.09.2017 20:02, Marcos Douglas B. Santos via Lazarus wrote:
>>
>> May I code using just "string"?
>
>
> Yes. LCL is ANSI/UTF8 only, so is TStrings.
>
> You can write Lazarus+Delphi compatible code without a lot of problems. Just
> use the string type. The only thing you have to be aware is that in Delphi
> you work with UTF-16 and in Lazarus with UTF-8 - but for most cases it
> doesn't really matter. You will have to write your own methods with IFDEF-ed
> code for things where it matters (read/write from/to buffer, char-by-char
> iterations etc.).

But my code had different outputs and/or warnings only using Lazarus!

You said compatible.
What about Warnings?
Why I need IFDEF-ed if the code "is" compatible?

For example, is this code compatible/work with/on Delphi?
https://github.com/mdbs99/james/blob/a9ad48fb8eaf4f11c6dd7b65d6ac2f63e6fc09fb/test/james.data.tests.pas#L57

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
I understand use IFDEF to compile in different platforms like Windows
vs... err... Haiku. Of Linux vs Nintendo Wii...
But why should I use IFDEF in a code that should be the same in both
compilers (FPC vs Delphi)?
Is it because the string type is not Unicode? OK, so I want to convert
all to use UTF16, ie, UnicodeString (wrong name) and make ALL code
compatible. But this is looks like not possible without:

* IFDEFs
* know a few {modes}
* know what type of string I'm working on


If there is an argument in the compiler to compile it with the
definition of "all string is an UnicodeString like Java, C#, Delphi
and all them", would be great.
Then we will compile the compiler and Lazarus with the same type of
string and everything will work.
It will be slower than now? Yes, maybe... but we already use objects!
If you want 500% performance, use pointers, records and procedures
with whatever encode you want. But if you use objects, the overhead
already exists... and who cares? 1ms... 2ms... even 2s that you may
lost using UTF16? (or UTF8, but make all equal!) So? The world is
using Ruby and they don't care... or Python, Java... and they store in
UTF16 too, which requires a double of space... but if it works and the
code is clean, should be more important, don't agree?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
Hi Sven,
First of all, thanks for your time to answer me.

On Mon, Sep 25, 2017 at 4:43 PM, Sven Barth via Lazarus
 wrote:
> On 25.09.2017 20:51, Marcos Douglas B. Santos via Lazarus wrote:
>> I understand use IFDEF to compile in different platforms like Windows
>> vs... err... Haiku. Of Linux vs Nintendo Wii...
>> But why should I use IFDEF in a code that should be the same in both
>> compilers (FPC vs Delphi)?
>
> Because they *aren't* the same. In Delphi String = UnicodeString while
> in the RTL, the FCL and the LCL String = AnsiString(CP_ACP) and using a
> different modeswitch *does not* change that, cause modes are unit specific.

Yes, but using {$modeswitch unicodestrings}, at least in a certain
unit, should work with the same code between compilers because
"string", for that unit, is UnicodeString as Delphi string is, no?

> Especially the RTL is not ready for String = UnicodeString. So your best
> bet is to use UTF8String or set the default code page to UTF8 (the LCL
> units do that by default if I remember correctly, but Ondrej can confirm
> or deny that).

Yes, Lazarus do that by default. But did you see in my examples, at
the first email, how many inconsistencies I got, using just Lazarus
and change chars in one simple constant?

>> It will be slower than now? Yes, maybe... but we already use objects!
>> If you want 500% performance, use pointers, records and procedures
>> with whatever encode you want. But if you use objects, the overhead
>> already exists... and who cares? 1ms... 2ms... even 2s that you may
>> lost using UTF16? (or UTF8, but make all equal!) So? The world is
>> using Ruby and they don't care... or Python, Java... and they store in
>> UTF16 too, which requires a double of space... but if it works and the
>> code is clean, should be more important, don't agree?
>
> For FPC also more restricted targets are to be kept in mind (AVR, DOS,
> etc.).

I know almost nothing about compilers. But IMHO, the compiler should
have which it already have: "string", which is an alias.
Then, for each OS, we should pass one argument like (simplifying):
-S=UnicodeString  or -S=AnsiString... something like that (I hope you
understood).
I mean, we should not have overload functions, but only one type of
string. Even if that type may be RawByteString.

After compiled, we will have a RTL that will work follow the "-S" argument.

> So the RTL will be adjusted in a way that it can be easily
> compiled with String = UnicodeString or as is now with String =
> AnsiString(CP_ACP). But we are not there yet.

Now we're talking.
Almost everyone that know how to work with "the group of strings",
making them compatible between FPC and Delphi, are saying that Unicode
is already done and everything is fine. You are the first one to say
that is not complete yet. Thank you. I'm glad to know that I'm not
crazy.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
Hi Mattias,

On Mon, Sep 25, 2017 at 5:45 PM, Mattias Gaertner via Lazarus
 wrote:
> On Mon, 25 Sep 2017 17:18:05 -0300
> "Marcos Douglas B. Santos via Lazarus" 
> wrote:
>
>>[...]
>
> Your first email does not contain a simple Lazarus+string example. I
> see an example for LCL+unicodestring.

Yes, because I tried to make the code compatible. If Delphi uses UTF16
there is some logic to use it the same encode... I thought.

>>[...]
>> I know almost nothing about compilers. But IMHO, the compiler should
>> have which it already have: "string", which is an alias.
>> Then, for each OS, we should pass one argument like (simplifying):
>> -S=UnicodeString  or -S=AnsiString... something like that (I hope you
>> understood).
>
> The flags are -MDelphiUnicode, -MDelphi or -MObjFPC.
> But they only compile the units with sources in the unit path, which
> excludes all FPC units. Also keep in mind that the system unit and the
> RTL require a lot of low level functions, which require separate
> versions.

Which make this flags useless for that. It should be all code (my,
RTL, Lazarus, etc) to make this work using one type of string.

>> I mean, we should not have overload functions, but only one type of
>> string. Even if that type may be RawByteString.
>
> From a user pov: Yes, that's what Lazarus is recommending: Simply use
> one string type, and that is String. The confusion starts when you start
> using different string types.

Yeah, but DOM uses DOMString, which is WideString.
Lazarus uses UTF8 and have a laz2_DOM that uses "string", which is
UTF8, but I cannot use this unit with XPath unit, which needs a
TXMLDocument that works with WideString... see my point?
RTL was only ANSI, now has overload to UnicodeString... but according
with Sven, the Unicode support is not finished yet.

And what about the huge Warnings between these units, do you think
that is normal to use cast on everything?

> Unicode <> UnicodeString
> Unicode is working with UTF-8.
> If you want a Delphi compatible UTF-16 RTL and packages you are welcome
> to help the FPC team.

I can help in a high level way (Classes, Components, etc) not in the
compiler level.
But how can I know about these tasks? May I just pick one in bug
tracker that I want? How to know who is working on each task, which is
more important?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Sep 25, 2017 at 6:10 PM, Sven Barth via Lazarus
 wrote:
> On 25.09.2017 22:18, Marcos Douglas B. Santos via Lazarus wrote:
>> [...]
>> Yes, but using {$modeswitch unicodestrings}, at least in a certain
>> unit, should work with the same code between compilers because
>> "string", for that unit, is UnicodeString as Delphi string is, no?
>
> Yes, but it does not change the types of functions, classes, etc. that
> are used. They have the types they were compiled with while you are
> using a different string type. So you can't simply override a virtual
> method for example that has a String argument that is in fact a
> AnsiString with a method that has a String that's a UnicodeString as
> argument. So of course there will be warnings in case you're passing
> UnicodeString variables to AnsiString variables.

I saw that many RTL functions have an overload like this:
Function FileExists (Const FileName : RawByteString) : Boolean;
Function FileExists (Const FileName : UnicodeString) : Boolean;

The first one calls the second:
Function FileExists (Const FileName : RawByteString) : Boolean;
begin
  Result:=FileExists(UnicodeString(FileName));
end;

My question is:
No matter the encode of FileName: RawByteString is, if I cast to
UnicodeString I will not have any loss of characters?

>> Yes, Lazarus do that by default. But did you see in my examples, at
>> the first email, how many inconsistencies I got, using just Lazarus
>> and change chars in one simple constant?
>
> Note: I'll ignore the GUI example, cause Ondrej might be better for that.

No problem.

> For the console you need to keep in mind that the console - at least on
> Windows - has a code page as well. On my Linux - which is set to UTF-8 -
> your example works without any problem, but if I use Wine I get the same
> output as you.

Ok, but the compiler knows if a program is a CLI, I believe... so, it
could change those variables DefaultSystemCodePage,
DefaultFileSystemCodePage...
For users (developers) is not clear, do you agree?

>>[...]
>> I know almost nothing about compilers. But IMHO, the compiler should
>> have which it already have: "string", which is an alias.
>> Then, for each OS, we should pass one argument like (simplifying):
>> -S=UnicodeString  or -S=AnsiString... something like that (I hope you
>> understood).
>
> The compiler is not the problem. It's that especially the low level part
> of the RTL needs to be aware of the String type and handle it correctly.
> Essentially all functions will need to be checked whether they can
> correctly handle String (as in the generic string type) or are specific
> for AnsiString and thus would need to be adjusted.

I see...

>> I mean, we should not have overload functions, but only one type of
>> string. Even if that type may be RawByteString.
>
> You are wrong. Think about functions reading or writing data from/to
> files. Especially when the data was written with the other String type
> in mind.

It is normal that external data (files) to have different encodes.
IMO, only in these cases, we should care about encoding, because an
external data is outside of our code, we cannot control it.

>> After compiled, we will have a RTL that will work follow the "-S" argument.
>>
>>> So the RTL will be adjusted in a way that it can be easily
>>> compiled with String = UnicodeString or as is now with String =
>>> AnsiString(CP_ACP). But we are not there yet.
>>
>> Now we're talking.
>> Almost everyone that know how to work with "the group of strings",
>> making them compatible between FPC and Delphi, are saying that Unicode
>> is already done and everything is fine. You are the first one to say
>> that is not complete yet. Thank you. I'm glad to know that I'm not
>> crazy.
>
> Unicode itself is working, but in the form of UTF-8, not UTF-16 and as
> such it is as compatible to Delphi as it can currently get with some
> caveats when the specific type is important.

Well, I only setted {mode delphi} and {modeswitch unicodestrings} and
I did not leave Lazarus and still got strange results... looks like
FPC flags is not compatible with itself or Lazarus.
Again, I know that you, Mattias and many others understand that
perfectly. But my examples were very simple, but they didn't work
perfectly using just FPC and Lazarus.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Sep 25, 2017 at 6:23 PM, Sven Barth via Lazarus
 wrote:
> On 25.09.2017 23:11, Marcos Douglas B. Santos via Lazarus wrote:
>>>> [...]
>>> The flags are -MDelphiUnicode, -MDelphi or -MObjFPC.
>>> But they only compile the units with sources in the unit path, which
>>> excludes all FPC units. Also keep in mind that the system unit and the
>>> RTL require a lot of low level functions, which require separate
>>> versions.
>>
>> Which make this flags useless for that. It should be all code (my,
>> RTL, Lazarus, etc) to make this work using one type of string.
>
> No, because especially the RTL and FCL is usually provided precompiled.
> Thus you can't change the string type anymore afterwards without
> recompiling all the code.

That's I am talking about.
I use FPC and Lazarus by sources. I compile both. Never used an installer...
Maybe you already answered in other way, but: In that case, can I
compile FPC and Lazarus with these flags (all strings=UnicodeString)
and everything will work like that?

>> I can help in a high level way (Classes, Components, etc) not in the
>> compiler level.
>> But how can I know about these tasks? May I just pick one in bug
>> tracker that I want? How to know who is working on each task, which is
>> more important?
>
> Currently noone is working on it.

:-O

> A first step would be to add modeswitch headers to all units that must
> not use a specific mode (e.g. the System, ObjPas and some more language
> support units) like this:
>
> === code begin ===
>
> {$ifdef FPC_UNICODE_RTL}
> {$modeswitch unicodestrings}
> {$endif}
>
> === code end ===
>
> Once this is done one can test to compile the RTL, FCL and packages with
> FPC_UNICODE_RTL defined and see what blows and fix that step by step...
>
> Alternatively a constant in the System unit might be better so that one
> can check like this:
>
> === code begin ===
>
> // System unit
> {$ifdef FPC_UNICODE_RTL}
> FpcRtlIsUnicode = true;
> {$else}
> FpcRtlIsUnicode = false;
> {$endif}
>
> // some other unit
> {$if FpcRtlIsUnicode}
> {$modeswitch unicodestrings}
> {$endif}
>
> === code end ===

I've put {$modeswitch unicodestrings} in two simple programs (CLI and
GUI) and... CRASH!
Imagine working with this on the compiler level...  :)


My first thought about is that:
Every argument of all classes and functions should be raw string —
RawByteString.
May have some other types (UTF8String, UTF16String, etc) only for
users to use in the high level. For example: If the user know that a
file was encoded in UFT8, he/she will use UTF8String only to receive
that buffer.
Then, every single RTL class/function that works with Strings, should
check which encode was used (and we already have this today). These
functions will received an "string", will check which encode is (ie,
UTF8String following the example), and will pass to another built-in
private function to do the job.

"UnicodeString", as we know today, shouldn't exists. This does not
make any sense.
Only RawByteString — which should be only "string" — and others types
that defines the encode, as I said above, but used only once to
receive the buffer.

> Or if one wants to compile with -Municodestrings than instead the core
> units need to be protected with
>
> === code begin ===
>
> {$modeswitch unicodestrings-}
>
> === code end ===
>
> I'm currently not sure what would be the better approach in the long
> term... :/

Just guessing:
The default is not Unicode so, shouldn't have logic to use
{$modeswitch unicodestrings-}.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Sep 25, 2017 at 7:52 PM, Juha Manninen via Lazarus
 wrote:
> Marcos Douglas, this wiki page answers all your questions about using
> Unicode with Lazarus:
>  http://wiki.freepascal.org/Unicode_Support_in_Lazarus

OK, let's talk:

1. "Using UTF-8 in non-LCL programs"
"In a non-LCL project add a dependency for LazUtils package. Then add
LazUTF8 unit in the uses section of main program file. It must be near
the beginning, just after the critical memory managers and threading
stuff (e.g. cmem, heaptrc, cthreads)."

Indeed, that was very good. Thanks.
That solved one of my questions. I tested and it worked perfectly.
I would say that should be part of compiler, not in a Lazarus package,
because this is a basic thing that should work without other "3rd
lib".


2. "Assign a constant always to a type String variable."

So, you mean that I cannot declare a constant without specify the
type. The language allow me but it won't work?


3. "Calling API functions that use WideString or UnicodeString"
"When a parameter type is WideString or UnicodeString, you can just
pass a String to it. The compiler converts data automatically. There
will be a warning about converting from AnsiString to UnicodeString
which can be either ignored or suppressed by typecasting the String to
UnicodeString."

Then the example:
=== code begin ===
procedure ApiCall(aParam: UnicodeString);  // Definition.
 ...
ApiCall(S);// Call with String S, ignore warning.
ApiCall(UnicodeString(S)); // Call with String S, suppress warning.

=== code end ===

All these warnings is so annoying. I understood the point here, but I
don't like to see any hint or warning. I need to solve all.
But, I am in doubt about what is more annoying: typecasting all
arguments or ignore all.


3.1. "When a parameter type is a pointer PWideChar, you need a
temporary UnicodeString variable. Assign your String to it. The
compiler then converts its data. Then typecast the temporary variable
to PWideChar."
=== code begin ===
procedure ApiCallP(aParamP: PWideChar);  // Definition.
 ...
var Tmp: UnicodeString;   // Temporary variable.
 ...
Tmp := S; // Assign String -> UnicodeString.
ApiCallP(PWideChar(Tmp)); // Call with temp variable, typecast to pointer.
=== code end ===

That is a ugly hack. This code doesn't make any sense, if you don't
know about these Unicode issues.
We need do remember that trick when we are coding... not good.


4. "Reading / writing text file with Windows codepage"
"This is not compatible with Delphi nor with former Lazarus code. In
practice you must encapsulate the code dealing with system codepage
and convert the data to UTF-8 as quickly as possible."

The text said: "This is not compatible with Delphi ".

Examples on that page are hacks.


5. "CodePoint functions for encoding agnostic code"

I liked to know that exists an unit to work with Code Point which is
agnostic if the encoding is UTF8 or UTF16. I will use it. Thanks
again.


On Mon, Sep 25, 2017 at 8:01 PM, Juha Manninen via Lazarus
 wrote:
> And more ...
>
> Marcos Douglas, the Unicode solution in Lazarus works amazingly well
> when your data is Unicode from the start.
> It only has trouble with Windows system codepages but they can be
> converted, too.

Nowadays, I'm only using Windows so...

> Question: what is the fundamental problem? Why can't you use the
> system as it is advertised and documented?

I've already wrote my issues from the first email. Please, see the
first email and then, one of my answer to Mattias about WideString,
DOM, etc.


Summary:
I know that was a huge work for who made that. Lazarus is more
Unicode, more compatible with Delphi, and the team could move on.
Great.
But you might agree with me that this is far from a good design, right?


Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-25 Thread Marcos Douglas B. Santos via Lazarus
On Mon, Sep 25, 2017 at 9:52 PM, Juha Manninen via Lazarus
 wrote:
> On Tue, Sep 26, 2017 at 3:14 AM, Marcos Douglas B. Santos via Lazarus
>  wrote:
>> So, you mean that I cannot declare a constant without specify the
>> type. The language allow me but it won't work?
>
> Yes you can declare a string constant without specifying the type.

But according with this table, I shouldn't do that because so many
problems could happen.
http://wiki.freepascal.org/Unicode_Support_in_Lazarus#Without_.7B.24codepage_utf8.7D_or_compilerswitch_-FcUTF8

>> 3.1. "When a parameter type is a pointer PWideChar,
>> you need a temporary UnicodeString variable.
>> ...
>> That is a ugly hack. This code doesn't make any sense, if you don't
>> know about these Unicode issues.
>> We need do remember that trick when we are coding... not good.
>
> It is not so ugly. It is actually an elegant solution. Just one
> assignment, using the FPC's automatic conversion in a clever way. No
> explicit conversion functions or anything.
> The "ugly" pointer typecast is needed always, also in Delphi.

The "ugly" is because we need to remember to do that instead of just
assign the variable.
IMHO, both design are wrong. But I understand that the problem is in
the compiler — or RTL.

>> 4. "Reading / writing text file with Windows codepage"
>> ...
>> The text said: "This is not compatible with Delphi ".
>> Examples on that page are hacks.
>
> The solution is to NOT use Windows codepages. They can be seen as a
> historical remain with severe inherent problems which are solved by
> Unicode already a long ago.
> Windows has supported full Unicode since year 2000, and supported
> UCS-2 before that.
> Why would anybody still use the historical Windows codepages?

So, no problems here and the page is outdated. OK.

>> Summary:
>> I know that was a huge work for who made that. Lazarus is more
>> Unicode, more compatible with Delphi, and the team could move on.
>> Great.
>> But you might agree with me that this is far from a good design, right?
>
> IMO it is not far from a good design. From FPC's point of view it is a
> hack but you can write 100% Delphi compatible code by following just
> few simple rules (and dumping the historical Windows codepages).

Like I said, it's a hack. But, again, it was|is a great job. No doubt.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-26 Thread Marcos Douglas B. Santos via Lazarus
On Tue, Sep 26, 2017 at 6:31 AM, Juha Manninen via Lazarus
 wrote:
> On Tue, Sep 26, 2017 at 4:37 AM, Marcos Douglas B. Santos via Lazarus
>  wrote:
>> But according with this table, I shouldn't do that because so many
>> problems could happen.
>> http://wiki.freepascal.org/Unicode_Support_in_Lazarus#Without_.7B.24codepage_utf8.7D_or_compilerswitch_-FcUTF8
>
> No. It works when assigning to String and that is what matters.

I understood that I can use like this:
const
  VALUE: string = 'áéíóú';

Not like this:
const
  VALUE = 'áéíóú';

Right?
But this is not compile:
const
  V1: string = 'a';
  V2: string = V1 + 'b';

>>> The solution is to NOT use Windows codepages.
>>> ...
>> So, no problems here and the page is outdated. OK.
>
> The page is correct but your code and/or data is outdated if it uses
> the Windows codepage encoding. :)
> Well, honestly, why do you still use it?
> Unicode has been around for decades. It solved all the horrible
> problems inherent to locale dependent codepages. Windows has supported
> full Unicode for ~18 years.
> Maybe there still is a valid reason to use codepages but I don't know
> what it is.

I don't use it.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-26 Thread Marcos Douglas B. Santos via Lazarus
On Tue, Sep 26, 2017 at 9:09 AM, Juha Manninen via Lazarus
 wrote:
> On Tue, Sep 26, 2017 at 12:11 AM, Marcos Douglas B. Santos via Lazarus
>  wrote:
>> Yeah, but DOM uses DOMString, which is WideString.
>> Lazarus uses UTF8 and have a laz2_DOM that uses "string", which is
>> UTF8, but I cannot use this unit with XPath unit, which needs a
>> TXMLDocument that works with WideString... see my point?
>
> That is a problem. I guess you can use the units with Lazarus but it
> results to many conversions between encodings.
> It should be solved somehow.

So we can say that Lazarus code do not use XPath to work with XML, right?


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-26 Thread Marcos Douglas B. Santos via Lazarus
On Tue, Sep 26, 2017 at 5:06 PM, Howard Page-Clark via Lazarus
 wrote:
> On 26/09/17 20:51, Marcos Douglas B. Santos via Lazarus wrote:
>>
>> I understood that I can use like this:
>> const
>>VALUE: string = 'áéíóú';
>>
>> Not like this:
>> const
>>VALUE = 'áéíóú';
>>
>> Right?
>> But this is not compile:
>> const
>>V1: string = 'a';
>>V2: string = V1 + 'b';
>
> You can't do that in a const declaration.
> But in an implementation, the following does compile:
>
> {$J+} {$H+}
> const
>   V1: string = 'a';
>   V2: string = 'b';
>   V3: String = '';
>
> begin
>   V3:=V1 + V2;
>   WriteLn(V3);
> end.

I know this trick that was deprecated a long time ago. A constant that
can change...
I think may be better not using constants in the code anymore.

But thanks, anyway.


Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-27 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Sep 27, 2017 at 5:16 AM, Graeme Geldenhuys via Lazarus
 wrote:
> On 2017-09-27 03:51, Marcos Douglas B. Santos via Lazarus wrote:
>>
>> A constant that
>> can change...
>
>
>
> Yeah, that concept still blows my mind. [figuratively speaking] They should
> shoot the developer that came up with that idea - and the team leader that
> approved it.

Everybody has crazy ideias... the problem is who sign them saying
"yeah, go ahead!" :)

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Converting all code to use UnicodeString

2017-09-27 Thread Marcos Douglas B. Santos via Lazarus
On Wed, Sep 27, 2017 at 7:05 AM, Juha Manninen via Lazarus
 wrote:
> On Tue, Sep 26, 2017 at 10:52 PM, Marcos Douglas B. Santos via Lazarus
> [...]
> About the string constant concatenation, just use variables when it is proper:
> const
>   V1: string = 'a';
> var
>   S1: String;
> ... later in code ...
>   S1 := V1 + 'b';
>
> String literals can be assigned without problems as long as your
> variables are "String".
> The big table in the wiki page is intimidating, in reality the issue
> is not so complex.

I'm already doing that.
This not perfect, but is better than have problems. Thanks.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Kitto2 for Rich Internet Applications

2017-09-28 Thread Marcos Douglas B. Santos via Lazarus
Hi,

I would like to know if anybody here has already used Kitto2
https://github.com/EtheaDev/kitto2
This project used or was based on the old ExtPascal.

My question is because this project compiles only in Delphi and maybe
somebody here has already ported to FPC or thought on it.

I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about this.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Kitto2 for Rich Internet Applications

2017-09-28 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Sep 28, 2017 at 10:43 AM, Michael Van Canneyt via Lazarus
 wrote:
>
>
> On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote:
>
>> Hi,
>>
>> I would like to know if anybody here has already used Kitto2
>> https://github.com/EtheaDev/kitto2
>> This project used or was based on the old ExtPascal.
>>
>> My question is because this project compiles only in Delphi and maybe
>> somebody here has already ported to FPC or thought on it.
>>
>> I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about
>> this.
>
>
> Kitto2 is a dead end, just as ExtPascal was.

They removed ExtPascal from it... but I've never tried Kitto2.

> Nevertheless, now that Embarcadero embraced it, I doubt they will consider
> porting to FPC.

The author have no objections...
But if you say that FPC already has something better (December,
right?), I'll choose fcl-web, of course.

(and I do not saying that I will use Kitto2... was just to know)

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Kitto2 for Rich Internet Applications

2017-09-28 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Sep 28, 2017 at 11:43 AM, Michael Van Canneyt via Lazarus
 wrote:
>
> On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote:
>
>>[...]
>> But if you say that FPC already has something better (December,
>> right?), I'll choose fcl-web, of course.
>
>
> I believe it is better, yes.
>
> We managed to convince a major component developer of this, so we're not
> alone in this belief :)

WOW! Good to know. Thanks Michael.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Packages and units with the same name

2017-10-13 Thread Marcos Douglas B. Santos via Lazarus
Hi,

Imagine that we have two packages and each one has a global.pas unit like this:

BasePack
   /pkg
  basepack.lpk
   /src
  global.pas

SmartPack
   /pkg
  smartpack.lpk
  /src
  global.pas


Both packages have the same configuration:
Other unit files (-Fu) = ../src

But if SmartPack uses BasePack the compiler says that we have two
versions of global.pas

My question is:
How can I put some units in a package but in a way that these units
would be invisible in others packages?

I thought that only units included in package would be visible outside
(other programs/packages) but I realized that doesn't matter if were
included or not, the visibility is defined only by path (-Fu).

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Packages and units with the same name

2017-10-13 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Oct 13, 2017 at 4:16 PM, Mattias Gaertner via Lazarus
 wrote:
> On Fri, 13 Oct 2017 15:42:27 -0300
> "Marcos Douglas B. Santos via Lazarus" 
> wrote:
>
>>[...]
>> I thought that only units included in package would be visible outside
>> (other programs/packages) but I realized that doesn't matter if were
>> included or not, the visibility is defined only by path (-Fu).
>
> Correct. Unit names must be unique in a program.

Right. But when we use 3rd packages, we don't control which names they
will use to name their units.
Moreover, I believe each package should work only in a bounded
context. Its developers should not named their files considering that
these names could be used in a bigger context. Don't you agree?

IMHO, would be better if packages may have just some "exported units".
What do you think?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Packages and units with the same name

2017-10-13 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Oct 13, 2017 at 6:40 PM, Sven Barth via Lazarus
 wrote:
> On 13.10.2017 21:32, Marcos Douglas B. Santos via Lazarus wrote:
>> [...]
>>
>> IMHO, would be better if packages may have just some "exported units".
>> What do you think?
>
> It doesn't matter. Any symbols in a unit are mangled only locally to the
> unit and there *can not* be two or more symbols with the same name in
> one program. What you ask for is simply not possible.

Is it not possible *today* or never?
I don't know how the compiler works, but try to understand me:
I would like to modularize a big program in small packages — because
it's better than to use dll/so.
Each one these packages will work in a bounded context. Each one may
have a "Facade" to the main program, exposing its "interface" (classes
and interfaces, most).
So, the main program shouldn't know nothing about "private units" that
belongs only for the package.
That is encapsulation too.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Packages and units with the same name

2017-10-14 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Oct 14, 2017 at 1:18 AM, leledumbo via Lazarus
 wrote:
>> Is it not possible *today* or never?
>
> Never, not without changing the way compiler manages units. FPC units are
> organized in folders for easier management at filesystem level, but
> filesystem is not the namespace, there can never be /first/path/to/a.pas and
> /second/path/to/a.pas used in a single program, because only that a
> identifies the unit, not the path to it. This is the same as you can't have
> two files with the same name under the same path. Indeed you can't control
> unit names written by 3rd party and collision might happen, so most package
> developers add prefix in their unit names (e.g. IdGlobals) or use the new
> dotted unit names (e.g. my.globals.types, your.globals.consts).
>
>> So, the main program shouldn't know nothing about "private units" that
>> belongs only for the package. That is encapsulation too.
>
> Pascal unit is THE namespace, while most other languages uses filesystem as
> namespace. Namespace don't have visibility, only its contents have.

I know how it works in a single program, but I thought that using
packages could be different... but not.
Thanks, anyway.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Packages and units with the same name

2017-10-14 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Oct 14, 2017 at 4:33 AM, Sven Barth via Lazarus
 wrote:
> Am 14.10.2017 00:03 schrieb "Marcos Douglas B. Santos via Lazarus"
> :
>>
>> On Fri, Oct 13, 2017 at 6:40 PM, Sven Barth via Lazarus
>>  wrote:
>> > On 13.10.2017 21:32, Marcos Douglas B. Santos via Lazarus wrote:
>> >> [...]
>> >>
>> >> IMHO, would be better if packages may have just some "exported units".
>> >> What do you think?
>> >
>> > It doesn't matter. Any symbols in a unit are mangled only locally to the
>> > unit and there *can not* be two or more symbols with the same name in
>> > one program. What you ask for is simply not possible.
>>
>> Is it not possible *today* or never?
>> I don't know how the compiler works, but try to understand me:
>> I would like to modularize a big program in small packages — because
>> it's better than to use dll/so.
>> Each one these packages will work in a bounded context. Each one may
>> have a "Facade" to the main program, exposing its "interface" (classes
>> and interfaces, most).
>> So, the main program shouldn't know nothing about "private units" that
>> belongs only for the package.
>> That is encapsulation too.
>
> I can very reasonably say that this will never be possible. It's simply how
> things work on the binary level. And as I said that's also true for dynamic
> packages (which are a different beast than Lazarus' packages): even if a
> unit becomes part of a package it won't be touched as it can be used as part
> of the package as well as directly in the application binary without any
> changes.
> Unit names *must* be unique inside a program (with or without packages). So
> better use prefixes or dotted unit names to reduce the chance for conflicts.

My next question would be about dynamic packages... but you've already
answered me.
Thanks for all information.

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] SimpleIPC

2017-10-14 Thread Marcos Douglas B. Santos via Lazarus
On Sat, Oct 14, 2017 at 3:38 PM, Terry A. Haimann via Lazarus
 wrote:
> I would like to see a example program forSimpleIPC Server and client.
> It would be most helpful if these were cli programs so that I could see
> what libraries were required.

There are some examples in \packages\fcl-process\examples directory.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Packages and units with the same name

2017-10-15 Thread Marcos Douglas B. Santos via Lazarus
On Sun, Oct 15, 2017 at 12:36 PM, leledumbo via Lazarus
 wrote:
>> I know how it works in a single program, but I thought that using
>> packages could be different... but not.
>
> Packages is Lazarus concept, the compiler has no idea about it at all. What
> Lazarus does with it is generate a unit with the same name as the .lpk
> containing all units belonging to the package in its uses clause (with
> additional Register procedure and initialization section containing
> RegisterPackage call, purely for linking with the IDE), then feed the
> compiler with it. The end result is no different than compiling the units
> manually. In the end, when used by a program, it's the same combinations of
> .o and .ppu pair that the compiler sees.

I see. Thanks.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] IPC: TSimpleIPC, ZeroMQ, nanomsg...

2017-10-18 Thread Marcos Douglas B. Santos via Lazarus
Hi,

I would like to know if someone has already worked with Messages
between different programs, made in different languages, with binds to
work in FPC and Delphi 7.

My main case is connect a old Delphi 7 program to have a
"conversation" with others Exes, coded in FPC, locally.

But in the future, I will need to send/receive messages through
network, "talking" with Java and C# services.

Some options that I have already seen:
- ZeroMQ -> http://zeromq.org/
- nanomsg -> http://nanomsg.org/

I would like to use a "famous" library, which has good documentation
with many binds, or to use the simpler one that allows me to use in
all these languages above.

What do you propose?

Best regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] IPC: TSimpleIPC, ZeroMQ, nanomsg...

2017-10-19 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Oct 19, 2017 at 2:42 PM, Sandro Cumerlato via Lazarus
 wrote:
> ZeroMQ (libzmq 4.2.2) header binding for FPC is available at:
>
> https://github.com/DJMaster/zeromq-fpc

Yeah, I saw this on ZeroMQ website.
Thanks anyway.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] IPC: TSimpleIPC, ZeroMQ, nanomsg...

2017-10-20 Thread Marcos Douglas B. Santos via Lazarus
On Thu, Oct 19, 2017 at 4:44 PM, Denis Kozlov  wrote:
> I would also suggest IPC through TCP/IP.
>
> I have deployed several tools with such IPC implementation which operate
> across multiple platforms and are rock solid. All you need is a good
> networking library that works in both FPC and Delphi, such as Synapse (make
> sure to use the latest trunk version). Both Java and C# have extensive
> TCP/IP components so you will have no problem there.
>
> Also FPC wiki has a list of some networking libraries:
> http://wiki.lazarus.freepascal.org/Networking_libraries

Well, we use that way today but some times the performance is not good.
So, I am thinking to use our own API but using a new tool for
communication between applications. If everything is local, we may
improve the performance.

But do you also recommend to use TCP even in local (same machine) applications?
How do you know which ports were used for each application?
I believe you need to use a local database (SQLite) to register all
URLs for each Exe when they started. You might not use hardcode ports
because others application could be using first.


On Fri, Oct 20, 2017 at 12:24 PM, Denis Kozlov  wrote:
>
>> But do you also recommend to use TCP even in local (same machine)
>> applications?
>
> Yes, but whether it would be the best method to use will depend heavily on
> your use case.
>
>> How do you know which ports were used for each application?
>
> That, again, depends on your use case.
>
> For example, if your application needs to create multiple child processes
> and control them, then the first instance creates a listening server on some
> predetermined port and each child process will connect to the same
> predetermined port to talk to the master/server.

But, as I told you, we shouldn't predetermined ports because others
processes, which do not belongs us, could use the same ports.
I believe, these ports should be dynamic and the main application
needs a way to know these informations.

> By the way, you have moved this conversation away from the mailing list. Was
> that intentional?

Not intentional, sorry. I just clicked on reply...
So, I am sending to Lazarus now all private emails.

Best regards
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Who is using Object Pascal in production?

2017-10-27 Thread Marcos Douglas B. Santos via Lazarus
I would like to propose a discussion about "What is the relevance of
Object Pascal nowadays".
I don't want waste your time. I just want to know if we are growing
and being more relevant or not.

I use Object Pascal (mostly FPC, some old Delphi) in production to
make real applications. But we are seeing more and more "new
frameworks", "new technologies" and new languages that are become more
relevant.

What do you think?

Thanks.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Who is using Object Pascal in production?

2017-10-27 Thread Marcos Douglas B. Santos via Lazarus
On Fri, Oct 27, 2017 at 10:53 AM, Alexey via Lazarus
 wrote:
>>What do you think?
>
> I think, new langs are for other tasks. Go- for web servers; Rust- maybe
> concurrent or not (used for browser). JS based langs- for web. Kotlin- for
> Java. 90% of new langs - for other tasks.

And Object Pascal is for... desktop?

We can do almost everything with Pascal but people don't see in that way.

Regards,
Marcos Douglas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


  1   2   >