[fpc-devel] SetString difference between Ansistring and UnicodeString

2009-10-06 Thread Vincent Snijders

While running valgrind on fpcdoc, I got a warning in
Procedure SetString (Out S : UnicodeString; Buf : PUnicodeChar; Len : SizeInt);

It assumes that the Buf is null terminated, and tries to use that information to 
truncate the length. The ansistring version:
Procedure SetString (Out S : AnsiString; Buf : PChar; Len : SizeInt); simply sets 
the length and moves the chars from Buf. Why is does the UnicodeString version only 
move the chars until the first #?


The reason ValGrind complains is probably that SetStrings assumes that Buf is null 
terminated:

  BufLen := IndexWord(Buf^, Len+1, 0);
IndexWord reads Len+1 words, I would change that code to
  BufLen := IndexWord(Buf^, Len, 0);
At least, if this scanning is actually useful for UnicodeStrings, unlike for 
Ansistrings. Otherwiser it may as well be removed.


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


Re: [fpc-devel] SetString difference between Ansistring and UnicodeString

2009-10-06 Thread Sergei Gorelkin

Vincent Snijders wrote:

Vincent Snijders schreef:

While running valgrind on fpcdoc, I got a warning in


Maybe you are interested in the valgind output. See attachment.

That check should be removed altogether, in both WideString and 
UnicodeString routines.
I just checked with Delphi, it allows setstring(widestring) with data 
containing #0 in the middle. So having a check is Delphi-uncompatible, 
and also causes a performance penalty.


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


Re: [fpc-devel] fp IDE with libgdb

2009-10-06 Thread Jonas Maebe


On 05 Oct 2009, at 15:27, Mark Morgan Lloyd wrote:

The fp IDE can drive libgdb to do straightforward debugging on x86  
and ARM, there might be failures with complex stuff that I've not  
been able to test. Those two platforms are no problem, the problems  
are on PowerPC and SPARC.


You're really picking your fights, aren't you? :) The textmode IDE is  
probably the least maintained part of FPC currently, and Linux/SPARC  
is not exactly the most used release either :)



-8-
$ gdb testC1A1
GNU gdb 6.8-debian
..
(gdb) dir ..
Source directories searched: /home/markMLl/sparc-2.2.4-6.3/..:$cdir: 
$cwd

(gdb) run
Starting program: /home/markMLl/sparc-2.2.4-6.3/testC1A1
Hello, World!

Program received signal SIGSEGV, Segmentation fault.
0x00010138 in WRITELN2 (STR=Cannot access memory at address 0xd48656c
) at test.pas:11
11  IF ptr^ = 0 THEN
(gdb) bt
#0  0x00010138 in WRITELN2 (STR=Cannot access memory at address  
0xd48656c

) at test.pas:11
#1  0x000101bc in main () at test.pas:18
(gdb)
-8-

Note that the code is correct: it's output the Hello World message  
even though subsequently the debugger is confused.


d48656c = #13'Hel'. gdb on SPARC is trying to dereference the string  
itself. I've fixed this in r13813 in trunk.



Jonas

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


Re: [fpc-devel] fp IDE with libgdb

2009-10-06 Thread Mark Morgan Lloyd

Jonas Maebe wrote:

On 05 Oct 2009, at 15:27, Mark Morgan Lloyd wrote:

The fp IDE can drive libgdb to do straightforward debugging on x86 and 
ARM, there might be failures with complex stuff that I've not been 
able to test. Those two platforms are no problem, the problems are on 
PowerPC and SPARC.


You're really picking your fights, aren't you? :) The textmode IDE is 
probably the least maintained part of FPC currently, and Linux/SPARC is 
not exactly the most used release either :)


[GRIN] Yes, and I'm the one trying to get to grips with the IDE for the 
common good starting with finding out exactly what files are being 
built into it on the different platforms- hence the Perl filter.


If SPARC is of any continuing relevance it's because it's possible to 
get fairly large systems dirt-cheap right now, I've been very quiet on 
this over the last few months specifically because I was trying to get 
to grips with the IDE issue... I didn't want to say anything until I was 
confident of my facts.


Note that the code is correct: it's output the Hello World message 
even though subsequently the debugger is confused.


d48656c = #13'Hel'. gdb on SPARC is trying to dereference the string 
itself. I've fixed this in r13813 in trunk.


0d48. Well spotted :-) OK, I'll get back onto that as soon as I've got a 
couple more live jobs off my desk.


Do you agree that the PowerPC problem is probably a broken Debian 
library somewhere? It's not as though we actually need XML for anything...


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] fp IDE with libgdb

2009-10-06 Thread Jonas Maebe


On 06 Oct 2009, at 16:38, Mark Morgan Lloyd wrote:

Do you agree that the PowerPC problem is probably a broken Debian  
library somewhere? It's not as though we actually need XML for  
anything...


Sorry, I really don't know. I'm not involved in the IDE at all, let  
alone in its GDB integration.



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


[fpc-devel] russian compiler messages

2009-10-06 Thread dmitry boyarintsev
Hello FPC-Developers

Is there anyone maintaining compiler messages translations? I have
some fixes for them and utf-8 format.
I know i should post them to bug tracker, but is there anyone to
review and accept (or reject) fixes?

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


Re: [fpc-devel] russian compiler messages

2009-10-06 Thread Jonas Maebe


On 06 Oct 2009, at 16:48, dmitry boyarintsev wrote:


Is there anyone maintaining compiler messages translations?


I don't think so.


I have
some fixes for them and utf-8 format.
I know i should post them to bug tracker, but is there anyone to
review and accept (or reject) fixes?


Michael speaks/reads Russian.


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


Re: [fpc-devel] russian compiler messages

2009-10-06 Thread Florian Klaempfl
dmitry boyarintsev schrieb:
 Hello FPC-Developers
 
 Is there anyone maintaining compiler messages translations? I have
 some fixes for them and utf-8 format.
 I know i should post them to bug tracker, but is there anyone to
 review and accept (or reject) fixes?

One of the main compiler developers will take care of it if nobody knows
  the language :)
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] russian compiler messages

2009-10-06 Thread Sergei Gorelkin

dmitry boyarintsev пишет:

Hello FPC-Developers

Is there anyone maintaining compiler messages translations? I have
some fixes for them and utf-8 format.
I know i should post them to bug tracker, but is there anyone to
review and accept (or reject) fixes?


I was just intending to write almost the same :-)

In view of upcoming release 2.4 I brought the russian message file up to 
date. Current status is: all messages and about 70% documentation 
comments, will hopefully complete this week.


So, who will be the first to creat a Mantis entry? :-)

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


Re: [fpc-devel] fp IDE with libgdb

2009-10-06 Thread Mark Morgan Lloyd

Jonas Maebe wrote:

On 06 Oct 2009, at 16:38, Mark Morgan Lloyd wrote:

Do you agree that the PowerPC problem is probably a broken Debian 
library somewhere? It's not as though we actually need XML for 
anything...


Sorry, I really don't know. I'm not involved in the IDE at all, let 
alone in its GDB integration.


In that case I'll assume that it's a Debian problem and drop it, or 
maybe see if I can patch it out of libgdb for the moment.


I suppose that one thing I should look at is bumping the supported 
libgdb 6.7.1 - 6.8 (current). I might need to ask for help if that 
involves the fpc makefiles etc.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] russian compiler messages

2009-10-06 Thread Sergei Gorelkin

Florian Klaempfl wrote:



So, who will be the first to creat a Mantis entry? :-)

I gave you both access to trunk/compiler/msg, so please update things as
needed ;)


Actually write access and commit as need :)


Ok, that simplifies things: no need to pollute Mantis, and can do 
several iterations. Thank you.



The question is - Is the trunk version sufficient to get into 2.4 (I had 
synchronized with errore.msg rev. 13665), or I should sync with some 
other revision ?


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


Re: [fpc-devel] russian compiler messages

2009-10-06 Thread Sergei Gorelkin

dmitry boyarintsev wrote:

On Tue, Oct 6, 2009 at 7:13 PM, Sergei Gorelkin sergei_gorel...@mail.ru wrote:

So, who will be the first to creat a Mantis entry? :-)

Please do so. Unicode version should proof useful for Lazarus, as well.


It looks like UTF-8 version should be added, and cp1251 can be dropped.
cp866, however, is still needed for Windows console.


Also, please. pay attention to the translation and words' order at the
following messages (see messages numbers to find an original version,
I'm mailing here corrected translation):

parser_w_proc_far_ignored=03001_W_Директива FAR игноpиpуется
parser_w_proc_near_ignored=03002_W_Директива NEAR игнорируется
parser_w_proc_interrupt_ignored=03003_W_Директива INTERRUPT
игнорируется, для всех процессоров, кроме i386


These three are no longer in English version, so I dropped them too.


parser_w_proc_directive_ignored=03005_W_Директива $1 процедуры игнорируется
parser_e_no_overload_for_all_procs=03006_E_Не все объявления $1
перегружены (определены как OVERLOAD)
parser_e_export_name_double=03008_E_Имя фyнкции $1 экспоpтиpyется дважды
parser_e_export_ordinal_double=03009_E_Индекс фyнкции $1 экспоpтиpyется дважды
parser_e_proc_inline_not_supported=03016_E_Директива INLINE не поддеpживается
parser_w_use_extended_syntax_for_objects=03042_W_Использование NEW и
DISPOSE для инициализации объектов
parser_e_header_dont_match_any_member=03048_E_Ни один из методов
объекта $1, не соответствует заголовоку фyнкции
parser_e_only_class_methods_via_class_ref=03053_E_У класса можно
вызывать только класс-методы
parser_e_only_class_methods=03054_E_В теле класс-метода, можно
обращаться только к класс-методам своего класса.
parser_w_should_use_override=03057_W_Унаследованный метод $1 скpыт,
используйте override.
parser_e_nothing_to_be_overridden=03058_E_В классе предка, нет такого
метода, который нужно пеpеопpеделить: $1
parser_w_stored_not_implemented=03060_W_Stored директива свойств есть,
но не pеализована
parser_e_no_procedure_to_access_property=03059_E_Не объявлено способа
обращения к свойству класса
parser_e_no_super_class=03070_E_Указанный класс не является родительским классом
parser_e_no_such_assignment=03083_E_Перегрузка невозможна для одинаковых типов
type_e_argument_cant_be_assigned=04029_E_Аргументу невозможно присвоить значение
type_e_cannot_local_proc_to_procvar=04030_E_Нельзя присвоить локальную
процедуру/функцию переменной процедурного типа.
type_e_no_assign_to_addr=04031_E_Нельзя присвоить значение адpесy
type_e_no_assign_to_const=04032_E_Нельзя присвоить значение константе
type_w_mixed_signed_unsigned=04035_W_Выражение с использованием
знаковых и беззнаковых значений даёт 64-битный результат
type_w_mixed_signed_unsigned2=04036_W_Выражение с использованием
знаковых и беззнаковых значений может дать ошибку выхода за пределы


Merged.


Imho, some translations are not really informative, i.e 06029: STACK
FRAME опyщены (sounds a bit rude in Russian).
How about: Для некоторых процедур/функций STACK FRAME-ы не созданы?


For this one I used Кадр стека не создан (не требуется).

Sergei


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


Re: [fpc-devel] russian compiler messages

2009-10-06 Thread Florian Klaempfl
Sergei Gorelkin schrieb:
 Florian Klaempfl wrote:
 

 So, who will be the first to creat a Mantis entry? :-)
 I gave you both access to trunk/compiler/msg, so please update things as
 needed ;)

 Actually write access and commit as need :)
 
 Ok, that simplifies things: no need to pollute Mantis, and can do
 several iterations. Thank you.
 
 
 The question is - Is the trunk version sufficient to get into 2.4 (I had
 synchronized with errore.msg rev. 13665), or I should sync with some
 other revision ?

Trunk is fine, we can merge it then to fixes.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Errors using generics - what is wrong?

2009-10-06 Thread Žilvinas Ledas

Hello all,

I am trying to use generics but compilation fails.
Whan I try to use unit with my generic class in my real project I get 
Fatal: Internal error 200204175 error.

When I try to use it in empty Lazarus application (Unit1.pas) and I put
-
procedure TForm1.Button1Click(Sender: TObject);
var
 lst:  specialize TTwoValuesListUnicodeString;
begin
end;
-
I get these errors:
-
Unit1.pas(29,17) Error: Forward declaration not solved constructor 
TTwoValuesList$UnicodeString.Create;
Unit1.pas(30,16) Error: Forward declaration not solved destructor 
TTwoValuesList$UnicodeString.Destroy;
Unit1.pas(32,15) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.AddString(UnicodeString,UnicodeString);
Unit1.pas(33,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.GetS1(LongInt):UnicodeString;
Unit1.pas(34,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.GetS2(LongInt):UnicodeString;
Unit1.pas(35,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.Count:LongInt;
Unit1.pas(36,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.GetS2(UnicodeString,Boolean=FALSE):UnicodeString;

Unit1.pas(47) Fatal: There were 7 errors compiling module, stopping
-

my generic class is in another (not Unit1.pas) unit looks like this:
-
type
 generic TTwoValuesListTVal = class
 type private
   PTwoVal = ^TTwoVal;
   TTwoval = record
 FS1: TVal;
 FS2: TVal;
   end;

 var private
   FLst: TFPList;

 public
   constructor Create;
   destructor Destroy;

   procedure AddString(S1: TVal; S2: TVal);
   function GetS1(i: Integer): TVal;
   function GetS2(i: Integer): TVal; overload;
   function Count: Integer;
   function GetS2(S1: TVal; isSorted: Boolean = false): TVal; overload;

 published
   property Items: TFPList read FLst;

 end;
-

What am I doing wrong?


Regards,
Zilvinas Ledas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Errors using generics - what is wrong?

2009-10-06 Thread Žilvinas Ledas

Sorry, I forgot to mention I am using
Free Pascal Compiler version 2.3.1 [2009/09/08] for i386
(don't know how to get more specific version info...)



Žilvinas Ledas wrote:

Hello all,

I am trying to use generics but compilation fails.
Whan I try to use unit with my generic class in my real project I get 
Fatal: Internal error 200204175 error.

When I try to use it in empty Lazarus application (Unit1.pas) and I put
-
procedure TForm1.Button1Click(Sender: TObject);
var
 lst:  specialize TTwoValuesListUnicodeString;
begin
end;
-
I get these errors:
-
Unit1.pas(29,17) Error: Forward declaration not solved constructor 
TTwoValuesList$UnicodeString.Create;
Unit1.pas(30,16) Error: Forward declaration not solved destructor 
TTwoValuesList$UnicodeString.Destroy;
Unit1.pas(32,15) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.AddString(UnicodeString,UnicodeString);
Unit1.pas(33,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.GetS1(LongInt):UnicodeString;
Unit1.pas(34,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.GetS2(LongInt):UnicodeString;
Unit1.pas(35,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.Count:LongInt;
Unit1.pas(36,14) Error: Forward declaration not solved 
TTwoValuesList$UnicodeString.GetS2(UnicodeString,Boolean=FALSE):UnicodeString; 


Unit1.pas(47) Fatal: There were 7 errors compiling module, stopping
-

my generic class is in another (not Unit1.pas) unit looks like this:
-
type
 generic TTwoValuesListTVal = class
 type private
   PTwoVal = ^TTwoVal;
   TTwoval = record
 FS1: TVal;
 FS2: TVal;
   end;

 var private
   FLst: TFPList;

 public
   constructor Create;
   destructor Destroy;

   procedure AddString(S1: TVal; S2: TVal);
   function GetS1(i: Integer): TVal;
   function GetS2(i: Integer): TVal; overload;
   function Count: Integer;
   function GetS2(S1: TVal; isSorted: Boolean = false): TVal; overload;

 published
   property Items: TFPList read FLst;

 end;
-

What am I doing wrong?


Regards,
Zilvinas Ledas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


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


Re: [fpc-devel] Errors using generics - what is wrong?

2009-10-06 Thread Vincent Snijders

Žilvinas Ledas schreef:

Hello all,

I am trying to use generics but compilation fails.
Whan I try to use unit with my generic class in my real project I get 
Fatal: Internal error 200204175 error.

When I try to use it in empty Lazarus application (Unit1.pas) and I put
-
procedure TForm1.Button1Click(Sender: TObject);
var
 lst:  specialize TTwoValuesListUnicodeString;
begin
end;
-
I get these errors:
-


I would try to use a named type:
type
  TTwoUnicodeValuesList = specialize TTwoValuesListUnicodeString;

procedure TForm1.Button1Click(Sender: TObject);
var
 lst:  TTwoUnicodeValuesList;
begin
end;

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


Re: [fpc-devel] Errors using generics - what is wrong?

2009-10-06 Thread Žilvinas Ledas

Vincent Snijders wrote:


I would try to use a named type:
type
  TTwoUnicodeValuesList = specialize TTwoValuesListUnicodeString;

procedure TForm1.Button1Click(Sender: TObject);
var
 lst:  TTwoUnicodeValuesList;
begin
end;

Vincent



Thanks, it works with named type.
Is using not named specializations is some kind of not implemented yet 
part? :)



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