Re: [fpc-devel] Limitations of static ranged integer types andsucc/pred, and dynamic solution.

2011-12-23 Thread Skybuck Flying
The reason for the proposal to add a dynamic/runtime version of 
Low/High/Succ/Pred is pretty simply:


Currently there simply is no dynamic/runtime version of it.

Thus any code which is written using low/high/succ/pred is static in nature, 
when the code needs to be changed to dynamic it's likely that this will 
cause problems.


The problems are a bit vague, perhaps even hard to spot, correct and 
understand, I am not going to examine these problems in detail right now, 
but these problems probably exist.


All that is needed to fix these problems is a dynamic version of these 
methods. But then again this might require even more work to have dynamic 
integer types/ranges as well to complement/support it.


I'll shall try to give one example of a potential problem:

Situation 1:

type
 Tvalue = 0..5000;

var
 vIndex : TValue;
 vA : TValue;
 vB : TValue;

for Index := Low(TValue) to High(TValue) do
begin
  if vA = High(TValue) then
  begin
  vA := Low(TValue);
  end else
  begin
  vA := Succ(vA);
  end;
end;

^ This is a real world example and will probably compile just fine or 
perhaps with a few correction.


Now suppose the Tvalue can no longer be static and must be changed to 
dynamic, a choice could be made to turn this into a smallint like so:


TValue = smallint

Suddenly this changes the range of low, high, succ, pred.

At runtime the real range is set, for example to 32000.

This breaks all the code, the wrap backs will be wrong, the vA will go out 
of range and will go to 32768 and perhaps even wrap back to negative.


Typecasts might also add to the problem, not sure about that.

Thus by simply changing the ranged static Tvalue to a more open range 
static integer type a whole can of worms/problems is opened.


These problems could be more easily solved if Low/High/Succ/Pred was more 
dynamic in nature and could adept to the runtime change.


Bye,
 Skybuck. 


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Paramstr trailing spaces, bug or not?

2011-12-23 Thread Marco van de Voort
In our previous episode, Sergei Gorelkin said:
  the space)
 
  Can you reproduce that? I tried with a simple hello-world kind of
  application and in that case I can't reproduce it either.
 
  This is on Windows 7 in a virtual machine. (kvm)
 
 Just some notes:

 - syswin.inc code looks like any number of delimiters between parameters
   are skipped.

.. unless quoted.

 - this extra whitespace is added by the makefile, suggesting some 
 buggy/incorrect processing in 
 make.exe or makefile itself.

It could be that the makefile logic quotes every argument on windows, in
case of spaces. We would need a kind of strace tool for Windows to find out.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Limitations of static ranged integer types andsucc/pred, and dynamic solution.

2011-12-23 Thread Marco van de Voort
In our previous episode, Skybuck Flying said:
 
 Currently there simply is no dynamic/runtime version of it.

You are totally right. Please submit a patch for conforming arrays support
:-)
 
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Paramstr trailing spaces, bug or not?

2011-12-23 Thread Sergei Gorelkin

23.12.2011 16:18, Marco van de Voort пишет:

- syswin.inc code looks like any number of delimiters between parameters
   are skipped.


.. unless quoted.


- this extra whitespace is added by the makefile, suggesting some 
buggy/incorrect processing in
make.exe or makefile itself.


It could be that the makefile logic quotes every argument on windows, in
case of spaces. We would need a kind of strace tool for Windows to find out.


... it is the trailing backslash escaping the following character (C style).
I could reproduce the issue, by using the following command in 'packages' 
directory:

make install PP=f:\trunk\compiler\ppc386.exe PREFIX=f:\lazarus\fpc\2.7.1\

Note the quotes, and also note where they end up in output:

make -C fcl-base install
make[1]: Entering directory `F:/trunk/packages/fcl-base'
.\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o 
-Fu../../rtl/units/i386-win32 -o -Fu../../packages/hash/units/i386-win32 -o 
-Fu../../packages/paszlib/units/i386-win32 -o -Fu../../packages/fcl-process/units/i386-win32 -o 
-Fu../../packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 
--compiler=f:/trunk/compiler/ppc386.exe --prefix=f:\lazarus\fpc\2.7.1 
--unitinstalldir=f:\lazarus\fpc\2.7.1/units/i386-win32/fcl-base

The installer encountered the following error:
Failed to create directory f:\lazarus\fpc\2.7.1 
--unitinstalldir=f:\lazarus\fpc\2.7.1\units\i386-win32\fcl-base\units\i386-win32\fcl-base\

make[1]: *** [install] Error 1

Without quotes the result is basically the same:

.\fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o 
-Fu../../rtl/units/i386-win32 -o -Fu../../packages/hash/units/i386-win32 -o 
-Fu../../packages/paszlib/units/i386-win32 -o -Fu../../packages/fcl-process/units/i386-win32 -o 
-Fu../../packages/fpmkunit/units/i386-win32 -o -FE. -o -FUunits/i386-win32 -o -di386 
--compiler=f:/trunk/compiler/ppc386.exe --prefix=f:\lazarus\fpc\2.7.1\ 
--unitinstalldir=f:\lazarus\fpc\2.7.1\/units/i386-win32/fcl-base

The installer encountered the following error:
Failed to create directory f:\lazarus\fpc\2.7.1 
--unitinstalldir=f:\lazarus\fpc\2.7.1\\units\i386-win32\fcl-base\units\i386-win32\fcl-base\


Finally, when trailing backslash is duplicated, everything runs successfully.

Sergei
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Limitations of static ranged integer types andsucc/pred, and dynamic solution.

2011-12-23 Thread waldo kitty

On 12/23/2011 07:21, Marco van de Voort wrote:

In our previous episode, Skybuck Flying said:


Currently there simply is no dynamic/runtime version of it.


You are totally right. Please submit a patch for conforming arrays support
:-)


ROTFL! sneaky sneaky sneaky but i love it! hehehe...

good show ;)

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Limitations of static ranged integer types andsucc/pred, and dynamic solution.

2011-12-23 Thread waldo kitty

On 12/23/2011 14:04, waldo kitty wrote:
[stuff]

ouch... my profound apologies to everyone... that was supposed to go private and 
i have only myself and my [reply] (vs [reply list] or [reply all]) button to 
blame...

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] fpc translations

2011-12-23 Thread Mattias Gaertner
Hi devels,

How does the localization of fpc work?
Is there only the -Fr parameter or is there more?
Does the compiler convert the encoding?

I guess the files in fpc/compiler/msg are used. For example for
German it uses errord.msg.
What encoding has the file errord.msg?


Mattias
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] fpc translations

2011-12-23 Thread Michael Van Canneyt



On Fri, 23 Dec 2011, Mattias Gaertner wrote:


Hi devels,

How does the localization of fpc work?
Is there only the -Fr parameter or is there more?
Does the compiler convert the encoding?


No, the file must be in the encoding used on the platform. 
The compiler does not look at the encoding.




I guess the files in fpc/compiler/msg are used. For example for
German it uses errord.msg.
What encoding has the file errord.msg?


I would guess windows or DOS, since it's not readable on linux.
The file errordu.msg is readable, so most likely it is UTF-8.

These files were made long before the compiler had a notion of codepages.
These days one could perhaps look at recoding...

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel