Re: [fpc-pascal] Unicode output on console works for me on Linux, not on Windows

2011-08-01 Thread Reinier Olislagers
On 1-8-2011 14:38, Ondrej wrote:
>> I think that you have to configure the console to use UTF-8 output (but I
>> don't know how this is done on Windows).
> 
> I think that should be:
> 
> SetConsoleOutputCP(CP_UTF8);
> 
Thanks all, I got it to work using SetConsoleOutput.
UTF8ToConsole did not work for me.

For posterity/the archives:
program uniconsole;

{$mode objfpc}{$H+}
{$APPTYPE CONSOLE}

uses
  {$IFDEF UNIX}
{$IFDEF UseCThreads}
cthreads,
{$ENDIF}
  {Widestring manager needed for widestring support}
  cwstring,
  {$ENDIF}
  {$IFDEF WINDOWS}
  Windows, {for setconsoleoutputcp}
  {$ENDIF}
  Classes
  ;

var
UTF8TestString: string;

begin
{$IFDEF WINDOWS}
SetConsoleOutputCP(CP_UTF8);
{$ENDIF}
UTF8TestString:= 'rosé, водка and ούζο';
writeln ('plain: ' + UTF8TestString);
{Apparently we don't need UTF8ToConsole for this
UTF8ToConsole did not do anything for me in fact.}
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Trouble setting/getting ftVarBytes field data in TBufDataset

2011-08-01 Thread Reinier Olislagers
I've got trouble finding out how to fill and retrieve data for a
ftVarBytes field in a TBufDataset.

.AsString doesn't seem to work well - if I fill it with the string
How do I fill this field?
I get back
How

I tried SetData, which takes a buffer as data, so I tried filling a
PChar with the string data. Retrieving it leads to a big dump of memory,
so I wonder how you define the end of the buffer in the SetData call.

Hope somebody can point me to some documentation or tell me the proper
way to do this. I've looked at Delphi docs, but that dealt mostly with
general BLOB fields, don't know if that includes varBytes.

Below some test code and output:
program varbytesproject;

{$mode objfpc}{$H+}
{$APPTYPE CONSOLE}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes, SysUtils,
  { you can add units after this }
  DB, BufDataSet;

var
  TestDataset: TBufDataset;
  FieldDef: TFieldDef;
  TestString: String;
  TempPChar: PChar;
begin
  TestDataset := TBufDataset.Create(nil);
  FieldDef := TestDataset.FieldDefs.AddFieldDef;
  FieldDef.Name := 'ftVarBytes';
  FieldDef.DataType := ftVarBytes;
  FieldDef.Size := 2;
  TestDataset.CreateDataSet;
  TestDataset.Open;
  TestDataset.Append;

  writeln('1. How do I fill an ftVarBytes field?');
  Teststring:='How do I fill this field?';
  writeln('2. Like this?');
  TestDataset.FieldByName('ftVarBytes').Asstring := Teststring;
  writeln('ftVarbytes.AsString: ' +
TestDataset.FieldByName('ftVarBytes').AsString);

  writeln('3. Or like this?');
  TempPChar:=PChar(TestString);
  TestDataSet.FieldByName('ftVarBytes').SetData(TempPChar);
  writeln('ftVarbytes.AsString: ' +
TestDataset.FieldByName('ftVarBytes').AsString);
  TestDataset.Post;

  writeln('4. Get data using this:');
  writeln('ftVarbytes.AsString: ' +
TestDataset.FieldByName('ftVarBytes').AsString);
  writeln('5. Or get data using this:');
  TempPchar:='';
  if TestDataset.FieldByName('ftVarBytes').GetData(TempPChar) then
  begin
writeln('We filled TempPChar with: ' + TempPChar);
  end
  else
  begin
writeln('The Getdata function didn''t work.');
  end;
  TestDataset.Close;
  TestDataset.Free;
end.

Output:
1. How do I fill an ftVarBytes field?
2. Like this?
ftVarbytes field contains: How
3. Or like this?
ftVarbytes field contains: How
4. Get data using this:
ftVarbytes field contains: How
5. Or get data using this:
We filled TempPChar with:

!The Getdata function didn't work.





TObject♦

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


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Andrew Brunner
The only thing I can think of would be packet inspection.  Firewalls
included with Linux and Windows do not perform "deep" packet
inspection.  They only allow/deny packets with specific ports over
either TCP or UDP.

Am I missing something?

On Mon, Aug 1, 2011 at 12:31 PM, Michael Van Canneyt
 wrote:
> Any reason why it should not detect it ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Michael Van Canneyt



On Mon, 1 Aug 2011, Andrew Brunner wrote:


On Mon, Aug 1, 2011 at 12:05 PM, Michael Van Canneyt
 wrote:

..But it is not always supported by the browser (as Marco indicated)
and many firewalls simply don't agree with websockets.



Can  firewalls detect websockets over port 80?


Any reason why it should not detect it ?

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


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Andrew Brunner
On Mon, Aug 1, 2011 at 12:05 PM, Michael Van Canneyt
 wrote:
> ..But it is not always supported by the browser (as Marco indicated)
> and many firewalls simply don't agree with websockets.
>

Can  firewalls detect websockets over port 80?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Michael Van Canneyt



On Mon, 1 Aug 2011, Andrew Brunner wrote:


On Mon, Aug 1, 2011 at 10:43 AM, Felipe Monteiro de Carvalho
 wrote:

On Mon, Aug 1, 2011 at 5:23 PM, Andrew Brunner
 wrote:

I agree with this one.  The only thing I could add would be AJAX &
WebSockets for really advanced applications.


Do WebSockets allow to use TCP sockets in JavaScript or is it something else?


WebSockets are persistent connections that never close unless
directed.  Plus the server can push data over the socket and the
client can process data on an event basis.

HTTPRequest is query response.   WebSockets is asynchronous and
perfect for event driven programming over the web.


..But it is not always supported by the browser (as Marco indicated)
and many firewalls simply don't agree with websockets.

So unless you have absolute control over these parameters, 
it's a bad idea to rely on websockets.


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

Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Andrew Brunner
On Mon, Aug 1, 2011 at 10:43 AM, Felipe Monteiro de Carvalho
 wrote:
> On Mon, Aug 1, 2011 at 5:23 PM, Andrew Brunner
>  wrote:
>> I agree with this one.  The only thing I could add would be AJAX &
>> WebSockets for really advanced applications.
>
> Do WebSockets allow to use TCP sockets in JavaScript or is it something else?

WebSockets are persistent connections that never close unless
directed.  Plus the server can push data over the socket and the
client can process data on an event basis.

HTTPRequest is query response.   WebSockets is asynchronous and
perfect for event driven programming over the web.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Marco van de Voort
In our previous episode, Andrew Brunner said:
> > username/sessionID, then send an empty sessionID cookie (this will
> > delete the sessionID cookie in client)
> 
> I agree with this one.  The only thing I could add would be AJAX &
> WebSockets for really advanced applications.

I thought websockets were disabled in most current browsers due to security
concerns?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Felipe Monteiro de Carvalho
On Mon, Aug 1, 2011 at 5:23 PM, Andrew Brunner
 wrote:
> I agree with this one.  The only thing I could add would be AJAX &
> WebSockets for really advanced applications.

Do WebSockets allow to use TCP sockets in JavaScript or is it something else?

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


RE : [fpc-pascal] web app and application persistency

2011-08-01 Thread Ludo Brands
> > So how should I proceed to obtain a application which will keep 
> > running for the entire session of a user? I don't want to 
> simply save 
> > session info because the application is rather large, there 
> are lots 
> > of things going on and it would be much easier for my coding if I 
> > could keep the program running on the web server ...
> >
> > Any ideas?
> 
> If you really want the application running 100% of the time, 
> there are only 2 options:
> - fastcgi with mod_fastcgi (NOT mod_fcgid) and 
> ExternalFastCGIServer option.
> - Embedded server (i;e. the application acts as a webserver).
> 
> Both ways are supported with fpWeb. I use fastcgi.
> 

Currently I'm working on project that uses a small (fast)cgi module that
sends and receives data over a socket to the application that is running in
the background.  A 3rd option. 

Ludo  

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


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Gustavo Enrique Jimenez
Hi:

  If you don't want to use cookies, you could write the sessionID in a
hidden field in every html form (cgi app must write this hidden field
in every form). Or, if you use ajax, you could attach the sessionID to
every link (cgi app must write the sessionID parameter in every link).

Gustavo


2011/8/1 Gustavo Enrique Jimenez :
> Hi:
>
>  I send cookies to the client. One of those cookies is a "sessionID",
> a random number generated at login.
>  My sequence is something like
>
> Login
> Client: username/password ->Login html button
> Server: run cgi app with username/password parameters -> ¿Valid user?
> ->  generate sessionID, store in DB. Send sessionID to the client as a
> cookie.
>
> Transaction
> Client: Product -> Search product html button (sessionID is also sent
> to the server)
> Server: run cgi app with product/username parameter. sessionID is
> implicit, as any cookie. if username/sessionID from the client is the
> same as in the DB, send data to the client.
>
> The sessionID cookie will remain until logout or expire time. This
> way, you don't have to store password in html. The sessionID cookie
> must be random+hash, unique to every session. sessionID is sort of
> temporal password.
>
> Cliente: username  -> Logout html button
> Server: run cgi app with username/sessionID. Verify
> username/sessionID, then send an empty sessionID cookie (this will
> delete the sessionID cookie in client)
>
> Gustavo
>
>
>
>>2011/8/1 Felipe Monteiro de Carvalho :
>> Hello,
>>
>> This is kind of a theorical question, but I though I'd ask before
>> starting to code =)
>>
>> Basically I have a desktop app which I need to retrofit into a
>> web-app. My idea is to cut it in a visual and a non-visual part and
>> implement the visual part in HTML+JavaScript and keep the non-visual
>> like it is now, in Pascal.
>>
>> So, the problem is that CGI apps are started for every request, correct?
>>
>> So how should I proceed to obtain a application which will keep
>> running for the entire session of a user? I don't want to simply save
>> session info because the application is rather large, there are lots
>> of things going on and it would be much easier for my coding if I
>> could keep the program running on the web server ...
>>
>> Any ideas?
>>
>> thanks,
>> --
>> Felipe Monteiro de Carvalho
>> ___
>> 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] web app and application persistency

2011-08-01 Thread Andrew Brunner
On Mon, Aug 1, 2011 at 10:07 AM, Gustavo Enrique Jimenez
 wrote:
> Hi:
>
>  I send cookies to the client. One of those cookies is a "sessionID",
> a random number generated at login.
>  My sequence is something like
>
> Login
> Client: username/password ->Login html button
> Server: run cgi app with username/password parameters -> ¿Valid user?
> ->  generate sessionID, store in DB. Send sessionID to the client as a
> cookie.
>
> Transaction
> Client: Product -> Search product html button (sessionID is also sent
> to the server)
> Server: run cgi app with product/username parameter. sessionID is
> implicit, as any cookie. if username/sessionID from the client is the
> same as in the DB, send data to the client.
>
> The sessionID cookie will remain until logout or expire time. This
> way, you don't have to store password in html. The sessionID cookie
> must be random+hash, unique to every session. sessionID is sort of
> temporal password.
>
> Cliente: username  -> Logout html button
> Server: run cgi app with username/sessionID. Verify
> username/sessionID, then send an empty sessionID cookie (this will
> delete the sessionID cookie in client)

I agree with this one.  The only thing I could add would be AJAX &
WebSockets for really advanced applications.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Gustavo Enrique Jimenez
Hi:

 I send cookies to the client. One of those cookies is a "sessionID",
a random number generated at login.
 My sequence is something like

Login
Client: username/password ->Login html button
Server: run cgi app with username/password parameters -> ¿Valid user?
->  generate sessionID, store in DB. Send sessionID to the client as a
cookie.

Transaction
Client: Product -> Search product html button (sessionID is also sent
to the server)
Server: run cgi app with product/username parameter. sessionID is
implicit, as any cookie. if username/sessionID from the client is the
same as in the DB, send data to the client.

The sessionID cookie will remain until logout or expire time. This
way, you don't have to store password in html. The sessionID cookie
must be random+hash, unique to every session. sessionID is sort of
temporal password.

Cliente: username  -> Logout html button
Server: run cgi app with username/sessionID. Verify
username/sessionID, then send an empty sessionID cookie (this will
delete the sessionID cookie in client)

Gustavo



>2011/8/1 Felipe Monteiro de Carvalho :
> Hello,
>
> This is kind of a theorical question, but I though I'd ask before
> starting to code =)
>
> Basically I have a desktop app which I need to retrofit into a
> web-app. My idea is to cut it in a visual and a non-visual part and
> implement the visual part in HTML+JavaScript and keep the non-visual
> like it is now, in Pascal.
>
> So, the problem is that CGI apps are started for every request, correct?
>
> So how should I proceed to obtain a application which will keep
> running for the entire session of a user? I don't want to simply save
> session info because the application is rather large, there are lots
> of things going on and it would be much easier for my coding if I
> could keep the program running on the web server ...
>
> Any ideas?
>
> thanks,
> --
> Felipe Monteiro de Carvalho
> ___
> 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] web app and application persistency

2011-08-01 Thread Marcos Douglas
On Mon, Aug 1, 2011 at 11:21 AM, Felipe Monteiro de Carvalho
 wrote:
>
> Hello,
>
> This is kind of a theorical question, but I though I'd ask before
> starting to code =)
>
> Basically I have a desktop app which I need to retrofit into a
> web-app. My idea is to cut it in a visual and a non-visual part and
> implement the visual part in HTML+JavaScript and keep the non-visual
> like it is now, in Pascal.
>
> So, the problem is that CGI apps are started for every request, correct?

Correct.

> So how should I proceed to obtain a application which will keep
> running for the entire session of a user? I don't want to simply save
> session info because the application is rather large, there are lots
> of things going on and it would be much easier for my coding if I
> could keep the program running on the web server ...
>
> Any ideas?

You MUST save the session. How the app knows about the user logged?
To keep the app running on the web server, read about FastCGI.

http://en.wikipedia.org/wiki/FastCGI
\packages\fcl-web\src\
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] web app and application persistency

2011-08-01 Thread Michael Van Canneyt



On Mon, 1 Aug 2011, Felipe Monteiro de Carvalho wrote:


Hello,

This is kind of a theorical question, but I though I'd ask before
starting to code =)

Basically I have a desktop app which I need to retrofit into a
web-app. My idea is to cut it in a visual and a non-visual part and
implement the visual part in HTML+JavaScript and keep the non-visual
like it is now, in Pascal.

So, the problem is that CGI apps are started for every request, correct?


Correct.

There are techniques to avoid this: fastcgi, apache module, embedded server.



So how should I proceed to obtain a application which will keep
running for the entire session of a user? I don't want to simply save
session info because the application is rather large, there are lots
of things going on and it would be much easier for my coding if I
could keep the program running on the web server ...

Any ideas?


If you really want the application running 100% of the time, there are only 2 
options:
- fastcgi with mod_fastcgi (NOT mod_fcgid) and ExternalFastCGIServer option.
- Embedded server (i;e. the application acts as a webserver).

Both ways are supported with fpWeb. I use fastcgi.

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


[fpc-pascal] web app and application persistency

2011-08-01 Thread Felipe Monteiro de Carvalho
Hello,

This is kind of a theorical question, but I though I'd ask before
starting to code =)

Basically I have a desktop app which I need to retrofit into a
web-app. My idea is to cut it in a visual and a non-visual part and
implement the visual part in HTML+JavaScript and keep the non-visual
like it is now, in Pascal.

So, the problem is that CGI apps are started for every request, correct?

So how should I proceed to obtain a application which will keep
running for the entire session of a user? I don't want to simply save
session info because the application is rather large, there are lots
of things going on and it would be much easier for my coding if I
could keep the program running on the web server ...

Any ideas?

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


[fpc-pascal] How to use tilog from tiopf2?

2011-08-01 Thread Felipe Monteiro de Carvalho
Does anyone know how to use this?

I tryed googling, but didn't have much luck ...

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


Re: [fpc-pascal] FPImage and WebP support

2011-08-01 Thread Michael Van Canneyt



On Mon, 1 Aug 2011, Graeme Geldenhuys wrote:


Hi,

Has anybody started work on supporting WebP image format for FPImage?

 http://code.google.com/speed/webp/


Not yet. But it looks very interesting.

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


[fpc-pascal] FPImage and WebP support

2011-08-01 Thread Graeme Geldenhuys
Hi,

Has anybody started work on supporting WebP image format for FPImage?

  http://code.google.com/speed/webp/


Regards,
  - Graeme -

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

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


Re: [fpc-pascal] Unicode output on console works for me on Linux, not on Windows

2011-08-01 Thread Ondrej
> I think that you have to configure the console to use UTF-8 output (but I
> don't know how this is done on Windows).

I think that should be:

SetConsoleOutputCP(CP_UTF8);
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] sdlutils on linux 64 bits

2011-08-01 Thread Jonas Maebe


On 31 Jul 2011, at 23:11, Daniel Gaspary wrote:


  The last activity on this unit seems to be from 2008. Any new
solution or workaround to make the code compatible ?


It's a third party unit that was imported from JEDI-SDL. It was even  
deleted in the past because it wasn't part of the interface to the SDL  
library and not really tested, only to be brought back because the  
newly started sdlgraph unit (which never got finished) depended on it.  
So if you want help with it, I think that contacting the JEDI-SDL  
people is your best shot.



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


[fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?

2011-08-01 Thread Bruce Tulloch
Thanks for the feedback everyone.

I have a Mac on which I can run a native FPC/Lazarus environment for
debugging purposes. My goal here is to add a cross compiling build for
OS X along side existing Linux and Win32/64 targets so all our OS and
CPU targets can be rebuilt at once.

So, from what I gather, I can copy the SDK across from my (Leopard) Mac
to the Linux build machine and I have found odcctools:

  http://svn.macosforge.org/repository/odcctools/trunk/

so I should be able to build the toolchain (as, ld).

I don't need -Xg/dsymutils (because I using this as build system only)
and I can add a clause to /etc/fpc.cfg to include the necessary search
paths.

I'll give it a go and report back.

-b

On 08/01/11 17:49, Bruce Tulloch wrote:
> Is anyone on the list doing this? If so, how did you set it up?
>
> The information on the FPC wiki and elsewhere in the lists is woefully
> out of date.
>
> Many thanks, Bruce.
>   
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Unicode output on console works for me on Linux, not on Windows

2011-08-01 Thread Jonas Maebe


On 01 Aug 2011, at 08:09, Reinier Olislagers wrote:


I tried to output Unicode text to console on English Windows Vista
(using Lucida Console font, which shows Greek and Cyrillic  
characters).

Doesn't seem to work.


I think that you have to configure the console to use UTF-8 output  
(but I don't know how this is done on Windows). A bit like how on *nix  
UTF-8 input/output also only works if the console is configured for it  
(using e.g. LANG=en_US.UTF-8).



(On Debian x64 it works perfectly - maybe because the default encoding
I've got is UTF8: LANG environment variable is en_US.utf8?)



Indeed.


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


Re: [fpc-pascal] Unicode output on console works for me on Linux, not on Windows

2011-08-01 Thread Marcos Douglas
On Mon, Aug 1, 2011 at 3:09 AM, Reinier Olislagers
 wrote:
> (Reposted from the forum)
>
> I tried to output Unicode text to console on English Windows Vista
> (using Lucida Console font, which shows Greek and Cyrillic characters).
> Doesn't seem to work.
> (On Debian x64 it works perfectly - maybe because the default encoding
> I've got is UTF8: LANG environment variable is en_US.utf8?)
> If I redirect the output to file, I can see the output properly for the
> output containing "plain" if I open the file as UTF8.
>
> Does anybody know how to do this?
>
> Thanks,
> Reinier
>
> {$mode objfpc}{$H+}
> program UnicodeTest;
>
> uses
>  {$IFDEF UNIX}
>    {$IFDEF UseCThreads}
>    cthreads,
>    {$ENDIF}
>  {Widestring manager needed for widestring support}
>  cwstring,
>  {$ENDIF}
>  Classes,
>  StrUtils
>  ;
>
> var
> UTF8TestString: string;
> OurWideString: widestring;
> begin
> UTF8TestString:= ' rosé, водка and ούζο';
> writeln ('plain: ' + UTF8TestString);
> writeln (UTF8ToANSI('utf8toansi: ' + UTF8TestString));
> writeln (UTF8Decode('utf8decode: ' + UTF8TestString));
> //Just for luck, shouldn't work:
> writeln (ANSIToUTF8('ansitoutf8: ' + UTF8TestString));
> writeln (UTF8Encode('utf8encode: ' + UTF8TestString));
> writeln ('');
> OurWideString:= 'rosé, водка and ούζο';
> writeln ('plain: ' + OurWideString);
> writeln (UTF8ToANSI('utf8toansi: ' + OurWideString));
> writeln (UTF8Decode('utf8decode: ' + OurWideString));
> //Just for luck, shouldn't work:
> writeln (UTF8Encode('utf8encode: ' + OurWideString));
> writeln (ANSIToUTF8('ansitoutf8: ' + OurWideString));
> end.

In console programs, try UTF8ToConsole() function (unit FileUtil).
A string "created" outside of your code, use SysToUTF8() to convert in
a UTF8 and after UTF8ToConsole() to print on the console.

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


Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?

2011-08-01 Thread Marco van de Voort
In our previous episode, Jonas Maebe said:
> > The information on the FPC wiki and elsewhere in the lists is woefully
> > out of date.
> 
> In general, this is not supported (and personally I've never done it). You 
> have to build an Apple tool chain (assembler, linker) on a Linux host, which 
> is not supported by Apple, and then copy a Mac OS X SDK to your Linux 
> machine. Additionally, for -Xg functionality (in combination with DWARF debug 
> information) the dsymutil program is required, but since it's not open source 
> it is definitely not possible to build it for Linux.
> 
> I think your best bet is to google general information about cross-compiling 
> from Linux to Mac OS X. I think there is nothing FPC-specific about it, 
> except for maybe pointing the compiler to the SDK (use the -XR command line 
> parameter for that).

I did it with 10.4. The trouble is getting the toolchain to run. IIRC
Adriaan assisted me with that back then.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] sdlutils on linux 64 bits

2011-08-01 Thread Daniel Gaspary
Hi,

I was trying to run the example from [1], but I have noticed
fpcmake from sdl package does not compile sdlutils for my environment,
Linux (ubuntu 11.04) 64 bits.

   sdlutils is the only unit with restrictions in fpmake.pp . Tyring
to compile myself I got errors like the following:

   "Typecast has different size (4 -> 8) in assignment"

   PUInt8( Addr )^ := R or G or B;

   The last activity on this unit seems to be from 2008. Any new
solution or workaround to make the code compatible ?


   Thanks.


[1] 
http://www.pascalgamedevelopment.com/content.php?15-Artillery-Game-Tutorial-Part-1-Introduction
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?

2011-08-01 Thread Felipe Monteiro de Carvalho
On Mon, Aug 1, 2011 at 9:49 AM, Bruce Tulloch  wrote:
> Is anyone on the list doing this? If so, how did you set it up?

If your objective is writing software for Mac OS X without actually
having a Mac computer, then I seriously doubt it would work, unless
your app is a simple command line program. Mac OS X has a number of
particularities.

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


Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?

2011-08-01 Thread Jonas Maebe

On 01 Aug 2011, at 09:49, Bruce Tulloch wrote:

> The information on the FPC wiki and elsewhere in the lists is woefully
> out of date.

In general, this is not supported (and personally I've never done it). You have 
to build an Apple tool chain (assembler, linker) on a Linux host, which is not 
supported by Apple, and then copy a Mac OS X SDK to your Linux machine. 
Additionally, for -Xg functionality (in combination with DWARF debug 
information) the dsymutil program is required, but since it's not open source 
it is definitely not possible to build it for Linux.

I think your best bet is to google general information about cross-compiling 
from Linux to Mac OS X. I think there is nothing FPC-specific about it, except 
for maybe pointing the compiler to the SDK (use the -XR command line parameter 
for that).


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


[fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?

2011-08-01 Thread Bruce Tulloch
Is anyone on the list doing this? If so, how did you set it up?

The information on the FPC wiki and elsewhere in the lists is woefully
out of date.

Many thanks, Bruce.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal