[Lazarus] Improving UTF8CharacterLength?

2015-08-09 Thread Jürgen Hestermann

I just had a closer look at the function UTF8CharacterLength in unit LazUTF8.
To me it looks as if it can be improved (made faster) because it checks too 
many things.

According to https://de.wikipedia.org/wiki/UTF-8 the number of bytes of an
UTF-8-character should be computable by the first byte only.
So it seems not to be neccessary to check for any following bytes (which also 
bears
the danger of accessing bytes out of the range of the string).
Isn't it enough to just do it like this:

--
if p=nil then
   exit(0);
if (ord(p^) and %1000)=% then // First bit is not set == 1 byte
   exit(1);
if (ord(p^) and %1110)=%1100 then // First 2 (of first 3) bits are set 
== 2 byte
   exit(2);
if (ord(p^) and %)=%1110 then // First 3 (of first 4) bits are set 
== 3 byte
   exit(3);
if (ord(p^) and %1000)=% then // First 4 (of first 5) bits are set 
== 4 byte
   exit(4);
exit(0); // invalid UTF-8 character
---

Currently, further bytes are checked even when
the first byte already determines the number of bytes.
But if the following bytes would not be as expected
it would not be a valid UTF-8-character.
But should this be checked by the UTF8CharacterLength function?
There is no error condition in the result of the function anyway.
I think errors should be checked when accessing the character as a whole.
Or is there any reason for handling invalid UTF-8-bytes more fault-tolerant?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] An online package manager

2015-08-09 Thread Aradeonas
Me too.

Regards,
Ara


-- 
http://www.fastmail.com - Accessible with your email software
  or over the web


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Stats

2015-08-09 Thread micsch
Am Sunday 09 August 2015 17:17:11 schrieb Graeme Geldenhuys:

 No, there is only the SourceForge download count, but even that is on
 enough because it doesn't take into account any SubVersion or Git repo
 users, OS package installs (from Linux distros and FreeBSD) etc. 

the sourceforge stats are pretty impressive


http://sourceforge.net/projects/freepascal/files/stats/timeline?dates=2015-01-01+to+2015-08-09




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Stats

2015-08-09 Thread Aradeonas
Yes!

Regards,
Ara


-- 
http://www.fastmail.com - Accessible with your email software
  or over the web


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Fwd: Re: Stats

2015-08-09 Thread Aradeonas
Yes!

Regards,
Ara

-- 
http://www.fastmail.com - Access your email from home and the web


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Stats

2015-08-09 Thread Aradeonas
Is there any stats of Lazarus or FPC ?How much user they have or
what ever?

Regards, Ara

-- 
http://www.fastmail.com - Email service worth paying for. Try it for free

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Stats

2015-08-09 Thread Graeme Geldenhuys
On 2015-08-09 16:50, mic...@gmail.com wrote:
 the sourceforge stats are pretty impressive

I would be interested to know what the unknown list of Top OSes
contain. Which OSes would register such a large group?

The Android download count, also in Top OSes, is also surprising. What,
do people download FPC from their mobile phones?

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] An online package manager

2015-08-09 Thread luiz americo pereira camara
Em 08/08/2015 21:49, Kostas Michalopoulos badsectorac...@gmail.com
escreveu:

 I would make this more complicated than absolutely necessary.

 lpk files have version and dependency information. AFAIK that is all you
need to get a minimum working package manager using a central repository
although i'd like to see multiple repositories that provide packages (f.e.
personally i'd prefer to host my own packages on my server).

 IMO what needs to be done is quite simple:

  1. Have the downloadable packages be a zip file (tons of tools can make
them, Lazarus can read them, etc) with the package directory as it should
be after installation, with the lpk and all.

I would make even simpler by not requiring to zip and upload to a server
the package and corresponding files. I would download from the SCM (
git/svn) directly, like bower does. The data necessary to register the
package would be name, description, dependencies, the SCM type, and the
repository URL.

Luiz

  2. Once a package is uploaded to a repository, it should extract the lpk
file so that it can show information about the package in a web view and...
  3.  Lazarus can download a list of available packages from a repository
and when requested, it will download the lpk file to show the details. Once
the user decides to download a package, the full zip is downloaded with the
dependencies (if they are not already installed) and have them extracted in
some place (user designated or just C:\lazarus\downloaded or something like
that) and the lpk files installed.
  4. Done. Restart Lazarus for the new stuff to take effect.

 I know that there might be some minor issues or things people would like
(like multiple lpk files or even separate metadata file, a format with
better compression, a better gui, etc) but really those can be done later
and IMO the majority of packages will work just fine with this setup. The
other things like comments, rating, etc can also be done later.

 I think that if something is going to be done, it needs to be the minimal
work that needs to get things going because otherwise, it will get stalled
(and it has been a while I hear about an online package installer :-P).


 On Sun, Aug 9, 2015 at 2:11 AM, Juha Manninen juha.mannine...@gmail.com
wrote:

 On Sat, Aug 8, 2015 at 4:27 PM, Aradeonas aradeo...@operamail.com
wrote:
  Is there any work on this subject until now or any one like to work on
this
  subject? If yes I want to help.

 The fppkg is for FPC packages. It does not work with Lazarus packages.
 There is a GUI for fppkg in Lazarus named LazarusPackageManager but it
 is broken. It should be fixed or removed.

 We need a similar system for Lazarus packages and maybe other Lazarus
resources.
 The idea is not new and there is even some skeleton code for it in
 package Aarre. Nothing functional yet unfortunately.

 Studying this issue has been on my ToDo list for long. Some open
questions :

 1. How much synergy with fppkg should it have? Can it share code?

 2. Meta-package file format? I guess it should be a GZip package
 containing Lazarus package sources + other metadata. What other
 resources should be supported? More metadata is needed.

 3. Support for user comments and votes for the packages. The GUI in
 Lazarus must support adding and viewing them.

 4. List of servers. Initially it should be CCR but can be extended.
 The ideal situation is that all package authors provide such
 meta-packages somewhere.

 5. A website. Is it needed to find the packages and advertise them?
 This may have synergy with fppkg again.

 If you are serious about this project, you should study the issue and
 make a plan with some diagrams even.
 I believe a SVN branch in Lazarus repo can be organized if needed.
 If fppkg code must be refactored and then reused, it may be easier to
 first fork it and then later offer to FPC project as a patch.

 Regards,
 Juha

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] An online package manager

2015-08-09 Thread Juha Manninen
It may be rather easy using HTTP or FTP download like fppkg is doing.
Some of its code can be used.
The package list must be one file (just like fppkg uses) to minimize
server load.
The package format cannot be shared with fppkg though.

I don't think the server load will be a problem. The packages contain
only textual source files and are compressed. They will be small
enough.

Allowing users to comment and rate the packages may be the most
difficult part but it is not needed initially. It will require
authentication and dealing with malicious attacks and whatever.
Read-only is easy.

Aradeonas, if you start to implement this, you should reuse the fppkg
code as much as possible. The design looks good.
The fpmake related stuff and the package format cannot be reused.
Also the client must be a Lazarus IDE package with a nice GUI instead
of a cmd line program.
Looking good so far ...

Regards,
Juha

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Stats

2015-08-09 Thread Graeme Geldenhuys
On 2015-08-09 15:06, Aradeonas wrote:
 Is there any stats of Lazarus or FPC ?How much user they have or
 what ever?

No, there is only the SourceForge download count, but even that is on
enough because it doesn't take into account any SubVersion or Git repo
users, OS package installs (from Linux distros and FreeBSD) etc. There
simply isn't a way to accurately determine the number of active FPC or
Lazarus users. This is the general case for all open source software.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] An online package manager

2015-08-09 Thread Aradeonas
Im agree with Luiz,Its better to have them in a server as a pack,because
as you (Juha) said we dont want do any force dependency on anything like
Git or Github so we can cache the packages in a server as a zip but for
a job like this I want to read previous and others work completely and
make a stable structure for future but we should use previous works.

Regards, Ara


-- 
http://www.fastmail.com - A fast, anti-spam email service.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus