Re: [fpc-pascal] weird printout of char

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 5:38 PM, Jonas Maebe wrote: > > ik wrote on ma, 05 nov 2012: > > >> On Mon, Nov 5, 2012 at 4:39 PM, Jonas Maebe >> wrote: >>> >>> >>> On 05 Nov 2012, at 15:25, ik wrote: >>> >>> I have a program like this: >>> >>> - >>> program print; >>> begin >>> writeln(#$d790);

Re: [fpc-pascal] weird printout of char

2012-11-05 Thread Jonas Maebe
ik wrote on ma, 05 nov 2012: On Mon, Nov 5, 2012 at 4:39 PM, Jonas Maebe wrote: On 05 Nov 2012, at 15:25, ik wrote: I have a program like this: - program print; begin writeln(#$d790); // Should print א [snip] I'm trying to use UTF-8, not UTF-16 ($05d0 is UTF-16 values) #$

Re: [fpc-pascal] weird printout of char

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 3:41 PM, Ewald wrote: > Try this: (a char is only one byte, you're trying to print a multi-byte > character: print multiple one-byte characters) > WriteLn(#$d7, #$90); Breaking it into two bytes works. > > > On 11/05/2012 03:25 PM, ik wrote: >> Hello, >> >> I have a progra

Re: [fpc-pascal] weird printout of char

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 4:39 PM, Jonas Maebe wrote: > > On 05 Nov 2012, at 15:25, ik wrote: > > I have a program like this: > > - > program print; > begin > writeln(#$d790); // Should print א > end. > -- > > [snip] > > What am I missing or doing wrong ? > > > a) add "uses cwstring"

Re: [fpc-pascal] weird printout of char

2012-11-05 Thread Ewald
Try this: (a char is only one byte, you're trying to print a multi-byte character: print multiple one-byte characters) WriteLn(#$d7, #$90); On 11/05/2012 03:25 PM, ik wrote: > Hello, > > I have a program like this: > > - > program print; > begin > writeln(#$d790); // Should print א > en

Re: [fpc-pascal] weird printout of char

2012-11-05 Thread Jonas Maebe
On 05 Nov 2012, at 15:25, ik wrote: I have a program like this: - program print; begin writeln(#$d790); // Should print א end. -- [snip] What am I missing or doing wrong ? a) add "uses cwstring" to get a full unicodestring manager in your program b) the unicode code po

[fpc-pascal] weird printout of char

2012-11-05 Thread ik
Hello, I have a program like this: - program print; begin writeln(#$d790); // Should print א end. -- I print this to a file: ./program > file In hex editor the value 3F A0 It also the same on normal terminal. I'm using Free Pascal Compiler version 2.6.0 [2012/05/17] for x86

Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 3:15 PM, Graeme Geldenhuys wrote: > On 2012-11-05 13:07, Michael Van Canneyt wrote: >> >> This will not detect if no exception is raised, only if the right >> exception is raised in case one is raised. > > > You are correct. An extra test is needed just before the except blo

Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread Graeme Geldenhuys
On 2012-11-05 13:07, Michael Van Canneyt wrote: > > This will not detect if no exception is raised, only if the right > exception is raised in case one is raised. You are correct. An extra test is needed just before the except block. As your example shows, simply calling Fail(...) if no exceptio

Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread Michael Van Canneyt
On Mon, 5 Nov 2012, Graeme Geldenhuys wrote: On 2012-11-05 12:49, ik wrote: So how do I do it ? Create a method of the test class, and pass that to AssertException. Alternatively, do it manually as follows: try si.SetSlideName('001~z~1~a~4~d~1.1.2.swf'); si.SlideTypeDB; except

Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread Graeme Geldenhuys
On 2012-11-05 12:49, ik wrote: > > So how do I do it ? Create a method of the test class, and pass that to AssertException. Alternatively, do it manually as follows: try si.SetSlideName('001~z~1~a~4~d~1.1.2.swf'); si.SlideTypeDB; except on E: exception do begin CheckEq

Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread Michael Van Canneyt
On Mon, 5 Nov 2012, ik wrote: On Mon, Nov 5, 2012 at 2:45 PM, Michael Van Canneyt wrote: On Mon, 5 Nov 2012, ik wrote: Hello, I wish to test if a method has raised an exception for a value (something that should make the test pass) or not. For example: function TestNum(ch : Char) : By

Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 2:45 PM, Michael Van Canneyt wrote: > > > On Mon, 5 Nov 2012, ik wrote: > >> Hello, >> >> I wish to test if a method has raised an exception for a value >> (something that should make the test pass) or not. >> >> For example: >> >> function TestNum(ch : Char) : Byte; >> begi

Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread Michael Van Canneyt
On Mon, 5 Nov 2012, ik wrote: Hello, I wish to test if a method has raised an exception for a value (something that should make the test pass) or not. For example: function TestNum(ch : Char) : Byte; begin if UpCase(ch) in ['A'..'F', '0'..'9'] then ... else raise Exception.Create('I

[fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread ik
Hello, I wish to test if a method has raised an exception for a value (something that should make the test pass) or not. For example: function TestNum(ch : Char) : Byte; begin if UpCase(ch) in ['A'..'F', '0'..'9'] then ... else raise Exception.Create('Invalid char was given.'); end;

Re: [fpc-pascal] What is the size of AnsiChar

2012-11-05 Thread Jonas Maebe
On 05 Nov 2012, at 11:49, ik wrote: As I understand, AnsiString and AnsiChar contain the environment type of string (it can be ISO8859x, utf-8 etc...). If that so, how can I know the size (in bytes) of AnsiChar ? The size of the type "AnsiChar" is always one byte. It is impossible to give t

Re: [fpc-pascal] What is the size of AnsiChar

2012-11-05 Thread LacaK
ik wrote / napísal(a): On Mon, Nov 5, 2012 at 1:18 PM, Tomas Hajny wrote: On Mon, November 5, 2012 11:49, ik wrote: Hello Ido, As I understand, AnsiString and AnsiChar contain the environment type of string (it can be ISO8859x, utf-8 etc...). If that so, how can I know the size (in

Re: [fpc-pascal] What is the size of AnsiChar

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 1:18 PM, Tomas Hajny wrote: > On Mon, November 5, 2012 11:49, ik wrote: > > > Hello Ido, > >> As I understand, AnsiString and AnsiChar contain the environment type >> of string (it can be ISO8859x, utf-8 etc...). >> If that so, how can I know the size (in bytes) of AnsiChar

Re: [fpc-pascal] What is the size of AnsiChar

2012-11-05 Thread Tomas Hajny
On Mon, November 5, 2012 11:49, ik wrote: Hello Ido, > As I understand, AnsiString and AnsiChar contain the environment type > of string (it can be ISO8859x, utf-8 etc...). > If that so, how can I know the size (in bytes) of AnsiChar ? As far as I understand it, AnsiChar is always 1 byte, i.e.

[fpc-pascal] What is the size of AnsiChar

2012-11-05 Thread ik
Hello, As I understand, AnsiString and AnsiChar contain the environment type of string (it can be ISO8859x, utf-8 etc...). If that so, how can I know the size (in bytes) of AnsiChar ? Thanks, Ido ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.o