Re: [fpc-pascal] fpcunit documentation?

2007-06-13 Thread Graeme Geldenhuys

On 13/06/07, Tom Verhoeff <[EMAIL PROTECTED]> wrote:

I know FreePascal includes the fpcunit unit testing framework
(the compiler knows where to find it), but I can't seem to find any
documentation via the regular www.freepascal.org, or the fpc wiki,
or on the lazarus site?

Michael's fpcunit.pdf seems hidden.  Google tells me it is here




This link works here...  For more documentation, you can also look at
the JUnit testing framework.  FPCUnit is based on (and is very close
to)  JUnit and the documentation for JUnit should help you a lot with
writing test cases.

Michael did mention that he was going to document the fcl-fpcunit
directory, but a few other packages are scheduled first.

If you have any problems using FPCUnit, please post question here...

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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 07:32, Daniël Mantione wrote:


Op Wed, 13 Jun 2007, schreef Felipe Monteiro de Carvalho:


How would I then be sure that my string is never converted (or always
converted from utf-8 to utf-8 if prefered), but just passed like I
wrote it to the library that I am using?


Add the cwstring unit, and run it in an utf-8 terminal.


Sorry, but this view is too "terminal-centric" as far as I am  
concerned. That's not something you want to tell users of a GUI app.  
Or even programmers, for that matter. I really don't see a reason why  
this should not be configurable by the programmer himself.



Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] put data to stdout (fpc vs. gcc)

2007-06-13 Thread fpc
Hi

I wrote two programs one in C and one in Freepascal.

The program read a variable of a library  and write it to stdout. I will put it 
into a file: ("#: ./dataprog > file.dat").
I use "printf" in the C and "writeln" in  Freepascal.

The problem: The fpc-based program is explicit slower than the c-based program.
My questions:  Why is it so? Is it possible to avoid the problem?


--
C source:

for (i=0;ihttp://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] put data to stdout (fpc vs. gcc)

2007-06-13 Thread Catalin Zamfir Alexandru
Guess because you're using inc(count) which may tell the compiler to use a 
specific procedure, specific procedure that may have its own hidden 
variables.

Use count := count + 1; and see what happens. This way you're not using the 
inc() procedure that may be specific to the system unit.

On Wednesday 13 June 2007 11:56, [EMAIL PROTECTED] wrote:
> Hi
>
> I wrote two programs one in C and one in Freepascal.
>
> The program read a variable of a library  and write it to stdout. I will
> put it into a file: ("#: ./dataprog > file.dat"). I use "printf" in the C
> and "writeln" in  Freepascal.
>
> The problem: The fpc-based program is explicit slower than the c-based
> program. My questions:  Why is it so? Is it possible to avoid the problem?
>
>
> --
> C source:
>
> for (i=0;i   out1=(single) libout1[i];
>   out2=(single) libout2[i];
>   count+=1;
>   printf("%20.0f%15.5f%15.5f\n",count,out1,out2);}
>
> --
> fpc source:
>
> for i:=0 to n do
> begin
>   out1:=single(libout1[i]);
>   out2:=single(libout2[i]);
>   inc(count);
>   writeln(stdout, count:20, out1:15:5, out2:15:5);
> end;
>
> --
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


pgpZbel942ytY.pgp
Description: PGP signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] put data to stdout (fpc vs. gcc)

2007-06-13 Thread Catalin Zamfir Alexandru
Plus, you may have GCC with optimization flags on, due to your Linux system 
[for example Gentoo] - whily FPC may be compiling its programs in the normal, 
unoptimized way. This also may be a problem. Check it.

On Wednesday 13 June 2007 11:56, [EMAIL PROTECTED] wrote:
> Hi
>
> I wrote two programs one in C and one in Freepascal.
>
> The program read a variable of a library  and write it to stdout. I will
> put it into a file: ("#: ./dataprog > file.dat"). I use "printf" in the C
> and "writeln" in  Freepascal.
>
> The problem: The fpc-based program is explicit slower than the c-based
> program. My questions:  Why is it so? Is it possible to avoid the problem?
>
>
> --
> C source:
>
> for (i=0;i   out1=(single) libout1[i];
>   out2=(single) libout2[i];
>   count+=1;
>   printf("%20.0f%15.5f%15.5f\n",count,out1,out2);}
>
> --
> fpc source:
>
> for i:=0 to n do
> begin
>   out1:=single(libout1[i]);
>   out2:=single(libout2[i]);
>   inc(count);
>   writeln(stdout, count:20, out1:15:5, out2:15:5);
> end;
>
> --
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


pgp5T4sahsUeg.pgp
Description: PGP signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] put data to stdout (fpc vs. gcc)

2007-06-13 Thread Henry Vermaak

On 13/06/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi

I wrote two programs one in C and one in Freepascal.

The program read a variable of a library  and write it to stdout. I will put it into a file: 
("#: ./dataprog > file.dat").
I use "printf" in the C and "writeln" in  Freepascal.

The problem: The fpc-based program is explicit slower than the c-based program.
My questions:  Why is it so? Is it possible to avoid the problem?


--
C source:

for (i=0;i

interesting...  which version of fpc are you using?  how big does n
go?  you can use the time util to give us some figures.

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


Re: [fpc-pascal] put data to stdout (fpc vs. gcc)

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 10:56, [EMAIL PROTECTED] wrote:

The problem: The fpc-based program is explicit slower than the c- 
based program.

My questions:  Why is it so? Is it possible to avoid the problem?


I guess it's the single to string conversion. This routine is very  
complex and not optimized at all. Getting it both right and portable  
is hard enough by itself, as far as I'm concerned.



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


Re: [fpc-pascal] fpcunit documentation?

2007-06-13 Thread Tom Verhoeff
On Wed, Jun 13, 2007 at 12:27:29AM +0200, Darius Blaszijk wrote:
> The link you gave below to the pdf seems to point to a valid file. 
> Please recheck it.

It is there alright, but you cannot navigate to that file on
.  You need to know the URL to find the file.
In fact, fpcunit is mentioned almost nowhere.  Even googling does
not turn up a lot of relevant leads.

I think fpcunit is listed in (some earlier) release notes, when it
got integrated first in the FCL (1.9.x).

The FCL implementation got restructured (cf. the subversion repository
structure) after I wrote about FCL in the wiki.

If someone tells me the overall structure of the FCL, then I could
update the wiki somewhat more.  How do I find out which units are there?
Looking at the svn repository, it is still not obvious to me.

Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL | Dept. of Math. & Comp. Science
PHONE:  +31 40 247 41 25| Technische Universiteit Eindhoven
FAX:+31 40 247 54 04| PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Daniël Mantione


Op Wed, 13 Jun 2007, schreef Jonas Maebe:

> 
> On 13 jun 2007, at 07:32, Daniël Mantione wrote:
> 
> > Op Wed, 13 Jun 2007, schreef Felipe Monteiro de Carvalho:
> > 
> > > How would I then be sure that my string is never converted (or always
> > > converted from utf-8 to utf-8 if prefered), but just passed like I
> > > wrote it to the library that I am using?
> > 
> > Add the cwstring unit, and run it in an utf-8 terminal.
> 
> Sorry, but this view is too "terminal-centric" as far as I am concerned.
> That's not something you want to tell users of a GUI app. Or even programmers,
> for that matter. I really don't see a reason why this should not be
> configurable by the programmer himself.

I fully agree one should be able to convert to any encoding one wishes; 
in the HTML build tool I use a hacked widestring manager for this purpose; 
we need to more structural solution.

I don't agree it is terminal centric; converting to the system encoding is 
usually what is wanted it ensures that regardless wether the system uses utf-8 
or 
any other encouding, the program displays correct output (for the 
characters that can be displayed).

Daniël___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Florian Klaempfl
Jonas Maebe schrieb:
> 
> On 13 jun 2007, at 07:32, Daniël Mantione wrote:
> 
>> Op Wed, 13 Jun 2007, schreef Felipe Monteiro de Carvalho:
>>
>>> How would I then be sure that my string is never converted (or always
>>> converted from utf-8 to utf-8 if prefered), but just passed like I
>>> wrote it to the library that I am using?
>>
>> Add the cwstring unit, and run it in an utf-8 terminal.
> 
> Sorry, but this view is too "terminal-centric" as far as I am concerned.
> That's not something you want to tell users of a GUI app. Or even
> programmers, for that matter. I really don't see a reason why this
> should not be configurable by the programmer himself.

Well, then something with the design is wrong. Ansistrings are per
definition strings which use the default 8 bit encoding of the
environment. Putting always utf-8 into them is abusing them and that's
why there is an utf8string type in the system unit.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] this line in pascal compile for i386 version but arm version

2007-06-13 Thread josepascual
Hi Everyone,

this pascal line
.
.
.
else Result :=Round(VarAsType(dataNum, varDouble))//varInteger)
.
.
.

compile okey in 2.1.1 and 2.1.4 fpc for i386 but 2.1.1 and 2.1.4 ppccrossarm


this is the error:

===
.
.
(431,58) Error: Can't determine which overloaded function to call
.
.
===
error is talking about Round.

thank you,

Jose Pascual

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


Re: [fpc-pascal] put data to stdout (fpc vs. gcc)

2007-06-13 Thread Daniël Mantione


Op Wed, 13 Jun 2007, schreef Catalin Zamfir Alexandru:

> Guess because you're using inc(count) which may tell the compiler to use a 
> specific procedure, specific procedure that may have its own hidden 
> variables.
> 
> Use count := count + 1; and see what happens. This way you're not using the 
> inc() procedure that may be specific to the system unit.

Nonsense, inc is compiler internal and fast.

The problem is probably our real to string conversion is slower.

Daniël___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 11:26, Florian Klaempfl wrote:

Sorry, but this view is too "terminal-centric" as far as I am  
concerned.

That's not something you want to tell users of a GUI app. Or even
programmers, for that matter. I really don't see a reason why this
should not be configurable by the programmer himself.


Well, then something with the design is wrong. Ansistrings are per
definition strings which use the default 8 bit encoding of the
environment.


The problem is the definition of "environment". What libiconv  
considers as environment (some terminal environment variables) does  
not necessarily match the api's you are using in your program.



Putting always utf-8 into them is abusing them and that's
why there is an utf8string type in the system unit.


I'm not saying that they should always contain utf-8, but that the  
programmer should be able to control this. It's also not just about  
explicitly using ansistrings, but also about constant strings. If you  
have


api_which_expects_utf8_string(p: pchar)

and do

api_which_expects_utf8_string('łóżka')

then you'd like a way for that constant string to be passed as utf-8  
in all cases without needing to put utf8encode() calls everywhere in  
your program (especially if all api routines I use expect utf-8,  
which is pretty much the case on Darwin/Mac OS X).



Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] this line in pascal compile for i386 version but arm version

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 11:34, josepascual wrote:


else Result :=Round(VarAsType(dataNum, varDouble))//varInteger)
.
.
.

compile okey in 2.1.1 and 2.1.4 fpc for i386 but 2.1.1 and 2.1.4  
ppccrossarm



this is the error:

===
.
.
(431,58) Error: Can't determine which overloaded function to call
.
.
===
error is talking about Round.


That is because the overload priority for routines which accept a 64  
bit integer (int64/qword, currency, and also comp on non-x86) and a  
64 bit float(double) is the same when passing a variable variant  
argument. Since we have round(comp), round(currency) and round 
(double), the compiler cannot choose which one you want if you pass a  
variant. The reason it compiles on i386, is that you also have a round 
(extended) there, which has a higher priority than the 64 bit variants.


So you need to fix your code by adding an extra VarAsType(...,double)  
call.



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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Florian Klaempfl
Jonas Maebe schrieb:
> 
> On 13 jun 2007, at 11:26, Florian Klaempfl wrote:
> 
>>> Sorry, but this view is too "terminal-centric" as far as I am concerned.
>>> That's not something you want to tell users of a GUI app. Or even
>>> programmers, for that matter. I really don't see a reason why this
>>> should not be configurable by the programmer himself.
>>
>> Well, then something with the design is wrong. Ansistrings are per
>> definition strings which use the default 8 bit encoding of the
>> environment.
> 
> The problem is the definition of "environment". What libiconv considers
> as environment (some terminal environment variables) does not
> necessarily match the api's you are using in your program.

This is a matter of the cwstrings unit now.

> 
>> Putting always utf-8 into them is abusing them and that's
>> why there is an utf8string type in the system unit.
> 
> I'm not saying that they should always contain utf-8, but that the
> programmer should be able to control this. It's also not just about
> explicitly using ansistrings, but also about constant strings. If you have
> 
> api_which_expects_utf8_string(p: pchar)
> 
> and do
> 
> api_which_expects_utf8_string('łóżka')

The problem is that the compiler needs conversion rules how to interpret
this and the compiler internally knows only widestrings and no utf8 or
whatever strings. Maintaining different encodings in the compiler is imo
also too much.

> 
> then you'd like a way for that constant string to be passed as utf-8 in
> all cases without needing to put utf8encode() calls everywhere in your
> program (especially if all api routines I use expect utf-8, which is
> pretty much the case on Darwin/Mac OS X).

Then you have to use the utf8string type. If it doesn't work good
enough, we've to fix it.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search order for libraries, how to influence; using GMP

2007-06-13 Thread Tom Verhoeff
On Tue, Jun 12, 2007 at 11:16:23PM +0200, Darius Blaszijk wrote:
> BTW: JediMath has a 100% pascal implementation for arbitrary length 
> arithmatic. Checkout JmLargeFloat.

Thanks.  But this does not seem to implement arbitrary-precision
integers and rationals (fractions).  The GMP does.

Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL | Dept. of Math. & Comp. Science
PHONE:  +31 40 247 41 25| Technische Universiteit Eindhoven
FAX:+31 40 247 54 04| PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] FPC's generics

2007-06-13 Thread Bisma Jayadi

Hi all,

FPC uses 2 keywords for generics: "generic" for generic definition block, and 
"specialize" for generic type implementation. I think the "generic" keyword is 
quite redundant, useless, and too verbose since generics already use pair of <> 
to define a generics type. Generics definition should be enough described using 
the pair of <> only without "generic" keyword.


The example below should be very obvious to the compiler:

(*** begin of example ***)

type
  TRegularIntegerArray: array[0..100] of integer;
  TGenericArray: array[0..100] of T;

var
  IntegerArrayFromGeneric = specialize TGenericArray;

(*** end of example ***)

Or, if we MUST use "generic" keyword to help compiler parse the code, also make 
the syntax less cryptic, I suggest using the example below:


(*** begin of example ***)

type
  TList = generic class(TObject)
type public
   TCompareFunc = function(const Item1, Item2: T): Integer;
var public
  data : T;
procedure Add(item: T);
procedure Sort(compare: TCompareFunc);
  end of T;

  TGenericArray: generic array[0..100] of T;

var
  PointerListFromGeneric = specialize TList for Pointer;
  IntegerArrayFromGeneric = specialize TGenericArray for Integer;

(*** end of example ***)

Though I agree that a generic MUST have a clear structure definition (in type 
section) before it's being used (in var section), since generic is all about 
type definition, also for ease of readability.


Any comments?

-Bee-

has Bee.ography at:
http://beeography.wordpress.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Felipe Monteiro de Carvalho

On 6/13/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote:

Then you have to use the utf8string type. If it doesn't work good
enough, we've to fix it.


changing on my program from strint to utf8string didn't make any
difference. The string is ok when I don't have BOM and is wrong with a
BOM

program utftestbom;

{$mode objfpc}{$H+}

uses SysUtils;

var
 MyStr: UTF8String;
 i: Integer;
begin
 MyStr := 'Texto ł ñ ø ß á';

 WriteLn('Printing string values');

 WriteLn('Length: ', Length(MyStr));

 for i := 1 to Length(MyStr) do
  Write(IntToHex(Integer(MyStr[i]), 2) + ' ');

 WriteLn('');
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC's generics

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 13:35, Bisma Jayadi wrote:

FPC uses 2 keywords for generics: "generic" for generic definition  
block, and "specialize" for generic type implementation. I think  
the "generic" keyword is quite redundant


I think it is useful, because it allows future language extensions to  
also use the <> syntax without conflicting with generics (e.g., the  
Objective Pascal draft syntax also makes use of angle brackets for a  
couple of things).



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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Daniël Mantione


Op Wed, 13 Jun 2007, schreef Felipe Monteiro de Carvalho:

> On 6/13/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote:
> > Then you have to use the utf8string type. If it doesn't work good
> > enough, we've to fix it.
> 
> changing on my program from strint to utf8string didn't make any
> difference. The string is ok when I don't have BOM and is wrong with a
> BOM.

How hard is it to add that widestringmanager? Correct version of this 
program:

program utftestbom;

{$mode objfpc}{$H+}

uses SysUtils,cwstring;

var
  MyStr:ansistring;
  i: Integer;
begin
 MyStr :='Texto ? ñ ø ß á';

 WriteLn('Printing string values');

 WriteLn('Length: ', Length(MyStr));

 for i := 1 to Length(MyStr) do
  Write(IntToHex(Integer(MyStr[i]), 2) + ' ');

 WriteLn('');
end.

Daniël___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC's generics

2007-06-13 Thread Bisma Jayadi

type
  TRegularIntegerArray: array[0..100] of integer;
  TGenericArray: array[0..100] of T;

var
  IntegerArrayFromGeneric = specialize TGenericArray;


Yes, I know, the ':' and '=' usage is wrong, it's a mistypo. :-D

Anyway, using my suggested generic syntax(es), it's allowed to specialize a 
generic type in type section. Like below example:


> type
>   TRegularIntegerArray = array[0..100] of integer;
>   TGenericArray = array[0..100] of T;
>   TIntegerArray = specialize TGenericArray;
>
> var
>   IntegerArray: TIntegerArray;

Or:

> type
>   TList = generic class(TObject)
> type public
>TCompareFunc = function(const Item1, Item2: T): Integer;
> var public
>   data : T;
> procedure Add(item: T);
> procedure Sort(compare: TCompareFunc);
>   end of T;
>   TPointerList = specialize TList for Pointer;
>
> var
>   PointerList: TPointerList;

-Bee-

has Bee.ography at:
http://beeography.wordpress.com

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


Re: [fpc-pascal] FPC's generics

2007-06-13 Thread Florian Klaempfl
Bisma Jayadi schrieb:
> Hi all,
> Any comments?

We tried to do it keeping the spirit of pascal in mind. The array in an
array declaration is also useless, you could do
type
  a : integer[0..100];

Using generic is verbose but imo one defines seldomly generic types so
it is ok because it improves readability of the construct.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC's generics

2007-06-13 Thread Bisma Jayadi
I think it is useful, because it allows future language extensions to 
also use the <> syntax without conflicting with generics (e.g., the 
Objective Pascal draft syntax also makes use of angle brackets for a 
couple of things).


Then my second syntax proposal might overcome possible conflict with future or 
other <> symbol implementation, since it uses no <> symbol at all, and IMO more 
pascalish (less cryptic). :-D


In short, my second syntax proposal is:

- generic definition syntax (type section):
  {type_name} = generic {type_definition} of {generic_holder} ;

- generic implementation syntax (var section):
  {var_name} : specialize {generic_type} for {implemented_type} ;
  or if it's defined in type section:
  {type_name} = specialize {generic_type} for {implemented_type} ;

-Bee-

has Bee.ography at:
http://beeography.wordpress.com

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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Felipe Monteiro de Carvalho

On 6/13/07, Daniël Mantione <[EMAIL PROTECTED]> wrote:

How hard is it to add that widestringmanager? Correct version of this
program:


This also doesn't change the output of the program. With either BOM or not.

--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 13:33, Felipe Monteiro de Carvalho wrote:


changing on my program from strint to utf8string didn't make any
difference. The string is ok when I don't have BOM and is wrong with a
BOM


I've in the mean time discovered that nl_langinfo always returns US- 
ASCII (or an empty string) under Darwin, regardless of what your LANG/ 
LC_* settings are. Forcing it to utf-8 fixes some problems, but there  
is another error in the generic code for writing a widestring. I'm  
fixing that currently.



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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Jeff Wormsley

What happens if you redefine your program as follows?

program utftestbom;

{$mode objfpc}{$H+}

uses SysUtils;

const MyStr: UTF8String = 'Texto ł ñ ø ß á';

var
 i: Integer;

begin
 WriteLn('Printing string values');

 WriteLn('Length: ', Length(MyStr));

 for i := 1 to Length(MyStr) do
  Write(IntToHex(Integer(MyStr[i]), 2) + ' ');

 WriteLn('');
end.


Felipe Monteiro de Carvalho wrote:

On 6/13/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote:

Then you have to use the utf8string type. If it doesn't work good
enough, we've to fix it.


changing on my program from strint to utf8string didn't make any
difference. The string is ok when I don't have BOM and is wrong with a
BOM

program utftestbom;

{$mode objfpc}{$H+}

uses SysUtils;

var
 MyStr: UTF8String;
 i: Integer;
begin
 MyStr := 'Texto ł ñ ø ß á';

 WriteLn('Printing string values');

 WriteLn('Length: ', Length(MyStr));

 for i := 1 to Length(MyStr) do
  Write(IntToHex(Integer(MyStr[i]), 2) + ' ');

 WriteLn('');
end.




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


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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Florian Klaempfl
Jonas Maebe schrieb:
> 
> On 13 jun 2007, at 13:33, Felipe Monteiro de Carvalho wrote:
> 
>> changing on my program from strint to utf8string didn't make any
>> difference. The string is ok when I don't have BOM and is wrong with a
>> BOM
> 
> I've in the mean time discovered that nl_langinfo always returns
> US-ASCII (or an empty string) under Darwin, regardless of what your
> LANG/LC_* settings are. Forcing it to utf-8 fixes some problems, but
> there is another error in the generic code for writing a widestring. I'm
> fixing that currently.

If MacOSX uses always utf-8 for 8 bit strings, you can hardcode it of
course in cwstrings and don't use iconv.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC's generics

2007-06-13 Thread Florian Klaempfl
Bisma Jayadi schrieb:
>> I think it is useful, because it allows future language extensions to
>> also use the <> syntax without conflicting with generics (e.g., the
>> Objective Pascal draft syntax also makes use of angle brackets for a
>> couple of things).
> 
> Then my second syntax proposal might overcome possible conflict with
> future or other <> symbol implementation, since it uses no <> symbol at
> all, and IMO more pascalish (less cryptic). :-D
> 
> In short, my second syntax proposal is:

Where is the name of the type parameters given? Well and we used < ... >
because a lot of programmers recognize it as generic/template definition.

> 
> - generic definition syntax (type section):
>   {type_name} = generic {type_definition} of {generic_holder} ;
> 
> - generic implementation syntax (var section):
>   {var_name} : specialize {generic_type} for {implemented_type} ;
>   or if it's defined in type section:
>   {type_name} = specialize {generic_type} for {implemented_type} ;
> 
> -Bee-
> 
> has Bee.ography at:
> http://beeography.wordpress.com
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

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


[fpc-pascal] a book about freepascal [off-topic]

2007-06-13 Thread Daniel Franzini

Hi

I'm not sure if you guys are aware of this but here it goes.

A brazilian publisher named Editora Erica (www.erica.com.br) published
a brand new book about introdutory computer programming with
FreePascal.

http://www.editoraerica.com.br/buscafinal.asp?cod=1369

A (possible) translation of the book's title is: Free Pascal -
Computer Programming - Basic Guide of Desgin and Programming on Linux,
MS-Windows and MS-DOS

One of the authors, Manzano, is a widely recognized book writter and
instructor of basic computer programming as well as operating systems
as Windows and office packages like ms-word and such. As far as i
remember, Manzano teaches at SENAI, a government-supported teaching
organization very popular in Brazil.

--
Daniel

"Let us change our traditional attitude to the construction of
programs. Instead of imagining that our main task is to instruct a
computer what to do, let us concentrate rather on explaining to human
beings what we want a computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other."
(http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And
while I'm not good at painting, drawing, or music, I can write
software." (Yukihiro Matsumoto, a.k.a. ``Matz'')
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 14:21, Florian Klaempfl wrote:


If MacOSX uses always utf-8 for 8 bit strings, you can hardcode it of
course in cwstrings and don't use iconv.


Well, it's a bit more complicated than that, see
http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/trunk/intl/config.charset? 
rev=4343


(search for "Darwin 7.5")

But I'm indeed going to force utf-8, though still using iconv (I  
don't feel like implementing the translation manually).



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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Florian Klaempfl
Jonas Maebe schrieb:
> 
> On 13 jun 2007, at 14:21, Florian Klaempfl wrote:
> 
>> If MacOSX uses always utf-8 for 8 bit strings, you can hardcode it of
>> course in cwstrings and don't use iconv.
> 
> Well, it's a bit more complicated than that, see
> http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/trunk/intl/config.charset?rev=4343
> 
> (search for "Darwin 7.5")
> 
> But I'm indeed going to force utf-8, though still using iconv (I don't
> feel like implementing the translation manually).

widestring to utf-8 can be done by the system unit?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] a book about freepascal [off-topic]

2007-06-13 Thread Michael Van Canneyt


On Wed, 13 Jun 2007, Daniel Franzini wrote:

> Hi
> 
> I'm not sure if you guys are aware of this but here it goes.
> 
> A brazilian publisher named Editora Erica (www.erica.com.br) published
> a brand new book about introdutory computer programming with
> FreePascal.
> 
> http://www.editoraerica.com.br/buscafinal.asp?cod=1369
> 
> A (possible) translation of the book's title is: Free Pascal -
> Computer Programming - Basic Guide of Desgin and Programming on Linux,
> MS-Windows and MS-DOS
> 
> One of the authors, Manzano, is a widely recognized book writter and
> instructor of basic computer programming as well as operating systems
> as Windows and office packages like ms-word and such. As far as i
> remember, Manzano teaches at SENAI, a government-supported teaching
> organization very popular in Brazil.

Cool. 
Recently a similar book appeared in Hungary. I bought it :)
I'll see if I can buy this one too :-)

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


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Daniël Mantione


Op Wed, 13 Jun 2007, schreef Florian Klaempfl:

> Jonas Maebe schrieb:
> > 
> > On 13 jun 2007, at 14:21, Florian Klaempfl wrote:
> > 
> >> If MacOSX uses always utf-8 for 8 bit strings, you can hardcode it of
> >> course in cwstrings and don't use iconv.
> > 
> > Well, it's a bit more complicated than that, see
> > http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/trunk/intl/config.charset?rev=4343
> > 
> > (search for "Darwin 7.5")
> > 
> > But I'm indeed going to force utf-8, though still using iconv (I don't
> > feel like implementing the translation manually).
> 
> widestring to utf-8 can be done by the system unit?

Yes, but widestring comparisons cannot, so a utf-8 only widestring manager 
would still be a huge job.

Daniël___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Felipe Monteiro de Carvalho

On 6/13/07, Jeff Wormsley <[EMAIL PROTECTED]> wrote:

What happens if you redefine your program as follows?


Doesn't change anything.

The core problem is (like jonas said some posts ago) that we need a
way to define the output of the widestring manager.

One possible way to do this would, when converting from widestring to
UTF8String always convert to UTF-8, despite what the operating system
or the terminal expect. Based on my tests, this is not the case today.

--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Funny things about utf-8 strings on mac

2007-06-13 Thread Jonas Maebe


On 13 jun 2007, at 14:08, Jonas Maebe wrote:

I've in the mean time discovered that nl_langinfo always returns US- 
ASCII (or an empty string) under Darwin, regardless of what your  
LANG/LC_* settings are. Forcing it to utf-8 fixes some problems,  
but there is another error in the generic code for writing a  
widestring. I'm fixing that currently.


Both issues are now fixed.


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


Re: [fpc-pascal] a book about freepascal [off-topic]

2007-06-13 Thread Daniel Franzini

well

i saw this on Saraiva Megastore, a HUGE book shop in a mall in Sao
Paulo...i'm not sure if they sell it on the internet AND if they can
deliver to outside Brazilalso, i'm not sure if the publisher can
do the same.but i can buy one and send to you, if you prefer

On 6/13/07, Michael Van Canneyt <[EMAIL PROTECTED]> wrote:



On Wed, 13 Jun 2007, Daniel Franzini wrote:

> Hi
>
> I'm not sure if you guys are aware of this but here it goes.
>
> A brazilian publisher named Editora Erica (www.erica.com.br) published
> a brand new book about introdutory computer programming with
> FreePascal.
>
> http://www.editoraerica.com.br/buscafinal.asp?cod=1369
>
> A (possible) translation of the book's title is: Free Pascal -
> Computer Programming - Basic Guide of Desgin and Programming on Linux,
> MS-Windows and MS-DOS
>
> One of the authors, Manzano, is a widely recognized book writter and
> instructor of basic computer programming as well as operating systems
> as Windows and office packages like ms-word and such. As far as i
> remember, Manzano teaches at SENAI, a government-supported teaching
> organization very popular in Brazil.

Cool.
Recently a similar book appeared in Hungary. I bought it :)
I'll see if I can buy this one too :-)

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




--
Daniel

"Let us change our traditional attitude to the construction of
programs. Instead of imagining that our main task is to instruct a
computer what to do, let us concentrate rather on explaining to human
beings what we want a computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other."
(http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And
while I'm not good at painting, drawing, or music, I can write
software." (Yukihiro Matsumoto, a.k.a. ``Matz'')
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] a book about freepascal [off-topic]

2007-06-13 Thread Felipe Monteiro de Carvalho

I took a quick look at the website and they do ship world wide.

The only challenge would be understanding the portuguese on their
website. There doesn't seam to be an english version of the site.

--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] a book about freepascal [off-topic]

2007-06-13 Thread Michael Van Canneyt


On Wed, 13 Jun 2007, Felipe Monteiro de Carvalho wrote:

> I took a quick look at the website and they do ship world wide.
> 
> The only challenge would be understanding the portuguese on their
> website. There doesn't seam to be an english version of the site.

I also discovered that :/

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


Re: [fpc-pascal] a book about freepascal [off-topic]

2007-06-13 Thread Felipe Monteiro de Carvalho

You could send them an e-mail:  [EMAIL PROTECTED]

I find almost impossible that noone there speaks english.

--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpcunit documentation?

2007-06-13 Thread Dean Zobec
Tom Verhoeff pravi:
> I know FreePascal includes the fpcunit unit testing framework
> (the compiler knows where to find it), but I can't seem to find any
> documentation via the regular www.freepascal.org, or the fpc wiki,
> or on the lazarus site?
> 
> Michael's fpcunit.pdf seems hidden.  Google tells me it is here
> 
>   
> 
> but that directory does not list it.
> 
> That is a pity.
> 
> Can someone educate me (or update the site)?
> 
> Is there any more up-to-date documentation.  I know some people
> enhanced fpcunit after Michael's article from 9 October 2005.
> 
>   Tom
I can send you an article I wrote about fpcunit two years ago but I
never had time to rewrite with some more interesting examples of test
driven development. The overall functionality has not changed at all
since that, and the article is a good tutorial about unit testing using
the fpcunit framework.
Anyway, just ask here if you have specific questions about fpcunit and
well'answer you as always.
Thank you,
Dean
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Problem with dynamic libraries

2007-06-13 Thread Adrian Veith

Hi,

i have written a dll (pasForNeko) in delphi / windows which can be 
called from the haxe/neko language, in order to use existing object 
pascal code from this language. now I try to port this to fpc and linux 
and run into some problems:


1. I can't compile even the simplest library from fpc (i use 2.1.4) in linux

library testdll; 


uses
 SysUtils,
 Classes;

procedure HalloWelt;
begin
end;

exports
 HalloWelt;

begin
end.

causes an: Error  while linking
in linux when compiled with

fpc testdll.pas

in windows it works with fpc

2. the delphi/windows version of the pasForNeko works fine. the same 
code compiled with fpc in windows fails to run with an exception.


Are there known pitfalls when compiling dlls in fpc which are called 
from applications written in C ?



Thanx,

Adrian.




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


RE: [fpc-pascal] this line in pascal compile for i386 version but arm version

2007-06-13 Thread josepascual
Hi Jonas,

> -Mensaje original-
> De: [EMAIL PROTECTED] [mailto:fpc-pascal-
> [EMAIL PROTECTED] En nombre de Jonas Maebe
> Enviado el: miércoles, 13 de junio de 2007 11:42
> Para: FPC-Pascal users discussions
> Asunto: Re: [fpc-pascal] this line in pascal compile for i386 version
> but arm version
> 
> 
> On 13 jun 2007, at 11:34, josepascual wrote:
> 
> > else Result :=Round(VarAsType(dataNum, varDouble))//varInteger)
> > .
> > .
> > .
> >
> > compile okey in 2.1.1 and 2.1.4 fpc for i386 but 2.1.1 and 2.1.4
> > ppccrossarm
> >
> >
> > this is the error:
> >
> > ===
> > .
> > .
> > (431,58) Error: Can't determine which overloaded function to call
> > .
> > .
> > ===
> > error is talking about Round.
> 
> That is because the overload priority for routines which accept a 64
> bit integer (int64/qword, currency, and also comp on non-x86) and a
> 64 bit float(double) is the same when passing a variable variant
> argument. Since we have round(comp), round(currency) and round
> (double), the compiler cannot choose which one you want if you pass a
> variant. The reason it compiles on i386, is that you also have a round
> (extended) there, which has a higher priority than the 64 bit variants.
> 
> So you need to fix your code by adding an extra VarAsType(...,double)
> call.

How can I do it? 

else Result :=Round(double(VarAsType(dataNum, varDouble)))//varInteger)

or other solution?

thank you in advanced

Jose Pascual
 
> 
> Jonas
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> __ Informacisn de NOD32, revisisn 2325 (20070612) __
> 
> Este mensaje ha sido analizado con NOD32 antivirus system
> http://www.nod32.com


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


Re: [fpc-pascal] this line in pascal compile for i386 version but arm version

2007-06-13 Thread Jonas Maebe


On 13 Jun 2007, at 20:25, josepascual wrote:


So you need to fix your code by adding an extra VarAsType(...,double)
call.


How can I do it?

else Result :=Round(double(VarAsType(dataNum, varDouble)))// 
varInteger)


or other solution?


I'd guess

else Result :=Round(double(VarAsType(dataNum, varDouble)/varInteger))


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


Re: [fpc-pascal] Problem with dynamic libraries

2007-06-13 Thread Leonardo M. Ram
Replace procedure HalloWelt; with

procedure HalloWelt; cdecl; 

> procedure HalloWelt;
> begin
> end;
> 


Leonardo M. Ramé
http://leonardorame.blogspot.com


   

Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal