[fpc-pascal] How to use XMLCfg?

2021-08-06 Thread Abuy via fpc-pascal
Tried Laz2_XMLCfg unit. Result is «Project createxml raised exception 
class 'External SIGSEGV'. In file 
'C:\lazarus\components\lazutils\laz2_xmlcfg.pas' at line 165: 
Create(nil);». I guess it is all because author of this unit for some 
reson calling unexisting constructor from constructor TXMLConfig.Create. 
Does this unit & older XMLCfg actually works?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to use XMLCfg?

2021-08-09 Thread Abuy via fpc-pascal

In Windows 7 same code & same version of Lazarus & program works fine.

On 08.08.2021 17:23, Vojtěch Čihák via fpc-pascal wrote:

Hi,

Laz2_ are UTF8 versions and they works well.

Create(nil); means that instance has no owner.

(I have Lazarus 2.3.0, it is not on line 165 here).

You can try demo at ../examples/xmlstreaming/.. It works here.

V.

__
 > Od: "Abuy via fpc-pascal" 
 > Komu: fpc-pascal@lists.freepascal.org
 > Datum: 07.08.2021 08:53
 > Předmět: [fpc-pascal] How to use XMLCfg?
 >

Tried Laz2_XMLCfg unit. Result is «Project createxml raised exception
class 'External SIGSEGV'. In file
'C:\lazarus\components\lazutils\laz2_xmlcfg.pas' at line 165:
Create(nil);». I guess it is all because author of this unit for some
reson calling unexisting constructor from constructor TXMLConfig.Create.
Does this unit & older XMLCfg actually works?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] How to create AnsiString with specific code page?

2021-09-15 Thread Abuy via fpc-pascal
I need string with Windows-1251. Tried var msg: AnsiString(1251) but 
this does not work. What I am doing now is


var msg: rawbytestring;
begin
  SetCodePage(msg, 1251, True);
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Code page for the Windows event viewer

2021-09-15 Thread Abuy via fpc-pascal
Instead of cyrillic characters there some garbage in Windows event 
viewer. Have tried AnsiString with Windows-1251 code page (type 
StringCP1251 = type AnsiString(1251)) but this does not work. What works 
is RawByteString variable with the following conversion to Windows-1251. 
Here is code:


{$MODE objfpc} {$ifdef mswindows}{$apptype console}{$endif}
{$R C:\lazarus\fpc\3.2.0\source\packages\fcl-base\src\win\fclel.res}
program Project1;

uses
  EventLog,
  sysutils;
type
  StringCP1251 = type AnsiString(1251);
var
  logger:teventlog;
  //msg:StringCP1251;
  msg:rawbytestring;
begin
msg:='Іівівйц й вфівфъ2цву йцуцйівів';
SetCodePage(msg, 1251, True);

Write('DefaultSystemCodePage is ');
Writeln(system.DefaultSystemCodePage);

logger:=teventlog.create(nil);
logger.Identification:='My gressdqwwe';
logger.RegisterMessageFile('');
logger.logtype:=ltsystem;
logger.active:=true;

Write('Code page is ');
WriteLn(StringCodePage(msg));

logger.Info(msg);
logger.Destroy;

WriteLn('End');
end.

OS: English Windows XP.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Code page for the Windows event viewer

2021-09-15 Thread Abuy via fpc-pascal
UnicodeString change only look of symbols (instead of quastion marks 
this — Іівівйц ГђВ№ 
вфівфъ2цву 
йцуцйівів). No BOM. File is UTF-8. No command 
line parameters.


On 15.09.2021 16:53, Tomas Hajny via fpc-pascal wrote:

On 2021-09-15 15:08, Abuy via fpc-pascal wrote:

Instead of cyrillic characters there some garbage in Windows event
viewer. Have tried AnsiString with Windows-1251 code page (type
StringCP1251 = type AnsiString(1251)) but this does not work. What
works is RawByteString variable with the following conversion to
Windows-1251. Here is code:

{$MODE objfpc} {$ifdef mswindows}{$apptype console}{$endif}
{$R C:\lazarus\fpc\3.2.0\source\packages\fcl-base\src\win\fclel.res}
program Project1;

uses
  EventLog,
  sysutils;
type
  StringCP1251 = type AnsiString(1251);
var
  logger:teventlog;
  //msg:StringCP1251;
  msg:rawbytestring;
begin
msg:='Іівівйц й вфівфъ2цву йцуцйівів';
SetCodePage(msg, 1251, True);

Write('DefaultSystemCodePage is ');
Writeln(system.DefaultSystemCodePage);

logger:=teventlog.create(nil);
logger.Identification:='My gressdqwwe';
logger.RegisterMessageFile('');
logger.logtype:=ltsystem;
logger.active:=true;

Write('Code page is ');
WriteLn(StringCodePage(msg));

logger.Info(msg);
logger.Destroy;

WriteLn('End');
end.


What happens if you declare Msg as UnicodeString? How is your source
file stored (which encoding, BOM if applicable or not)? Which command
line parameters do you use (e.g. -Fc???)?

Tomas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Code page for the Windows event viewer

2021-09-16 Thread Abuy via fpc-pascal

No change.

On 16.09.2021 13:28, Tomas Hajny via fpc-pascal wrote:

On 2021-09-15 16:09, Abuy via fpc-pascal wrote:

UnicodeString change only look of symbols (instead of quastion marks
this — Іівівйц ГђВ№
вфівфъ2цву
йцуцйівів). No BOM. File is UTF-8. No
command line parameters.


If your source file is in UTF-8, you need to let the compiler know about
this. You can do so by using the compiler option -Fcutf8 (or by using
the BOM, but the explicit option is the safest).

Tomas




On 15.09.2021 16:53, Tomas Hajny via fpc-pascal wrote:

On 2021-09-15 15:08, Abuy via fpc-pascal wrote:

Instead of cyrillic characters there some garbage in Windows event
viewer. Have tried AnsiString with Windows-1251 code page (type
StringCP1251 = type AnsiString(1251)) but this does not work. What
works is RawByteString variable with the following conversion to
Windows-1251. Here is code:

{$MODE objfpc} {$ifdef mswindows}{$apptype console}{$endif}
{$R C:\lazarus\fpc\3.2.0\source\packages\fcl-base\src\win\fclel.res}
program Project1;

uses
  EventLog,
  sysutils;
type
  StringCP1251 = type AnsiString(1251);
var
  logger:teventlog;
  //msg:StringCP1251;
  msg:rawbytestring;
begin
msg:='Іівівйц й вфівфъ2цву йцуцйівів';
SetCodePage(msg, 1251, True);

Write('DefaultSystemCodePage is ');
Writeln(system.DefaultSystemCodePage);

logger:=teventlog.create(nil);
logger.Identification:='My gressdqwwe';
logger.RegisterMessageFile('');
logger.logtype:=ltsystem;
logger.active:=true;

Write('Code page is ');
WriteLn(StringCodePage(msg));

logger.Info(msg);
logger.Destroy;

WriteLn('End');
end.


What happens if you declare Msg as UnicodeString? How is your source
file stored (which encoding, BOM if applicable or not)? Which command
line parameters do you use (e.g. -Fc???)?

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] A rather good blog post on Object Pascal that I thought you folks might enjoy

2023-01-18 Thread Abuy via fpc-pascal

Lazy post. Bad writing. Could be better.

On 18.01.2023 11:36, Liam Proven via fpc-pascal wrote:

Why Object Pascal is More Than Meets the Eye: Exploring the Power and
Versatility of Delphi and FreePascal

https://blog.rosseaux.net/post/a346cfec6211430a62c28e765710954d/Why_Object_Pascal_is_More_Than_Meets_the_Eye-_Exploring_the_Power_and_Versatility_of_Delphi_and_FreePascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal