Re: [fpc-pascal] Ical/.ics library?

2013-03-07 Thread Michael Van Canneyt



On Thu, 7 Mar 2013, Reinier Olislagers wrote:


Hi list,

(Had posted this earlier on the forum)

I'm looking at some day replacing some of my own utilities written using
.net code with FPC code.

One tool extracts birthdays from a database, slaps a reminder time on it
and exports it as ical/.ics

Some searching turned up
http://sourceforge.net/projects/delphiical/
which I haven't looked at yet.

Does anybody have experience with this?



From the page:

"Posted by Henrik — 2012-07-02

It's a pretty flawed and poorly written unit. Although it's very simple there's 
memory leaks, inconsistent naming conventions and clearly written by someone 
relatively new to Delphi. If used, remember to fix the errors.
"

I used to have a unit somewhere, but can't seem to locate it :(

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

Re: [fpc-pascal] Re: Get error information

2013-03-07 Thread Rainer Stratmann
Am Tuesday 05 March 2013 17:19:15 schrieb leledumbo:
> If the 2nd program is FPC program and is compiled with -gl, then upon crash
> StdErr will contain the runtime erorr information. 1st program can read
> that when the 2nd program dies.

How to read the information?
Ist stderr equal with /dev/stderr ?

I got the information on the development computer.

But the software runs also on embedded computers (http://linux.voyage.hk/) 
where I did not get the information. That's why I ask if there are may 
ceveral ways to get the error information.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Sigsegv with refcounting interface

2013-03-07 Thread Joao Morais
Hello list, what's the problem with "RoundThree" procedure (below)?
Here it raises a sigsegv trying to read an internal field. The
difference from "RoundTwo" is that I create an implementation of the
interface within the first param of tinterfacedlist.add method.

Same problem with fpc 2.6.2 and 2.7.1 (from two days ago), i386-win32.

Joao Morais

==

program project1;

{$mode objfpc}{$H+}

uses
  heaptrc,
  sysutils,
  Classes;

type
  iintf = interface
  ['{9E08FFD2-5AC4-4AE7-B2C6-703D62A10F16}']
function RefCount: Integer;
  end;

  { tintf }

  tintf = class(TInterfacedObject, iintf)
  public
constructor Create;
destructor Destroy; override;
function RefCount: Integer;
  end;

{ tintf }

constructor tintf.Create;
begin
  inherited Create;
  writeln('tintf "', PtrUInt(Self) ,'" created');
end;

destructor tintf.Destroy;
begin
  writeln('tintf "', PtrUInt(Self) ,'" destroyed');
  inherited Destroy;
end;

function tintf.RefCount: Integer;
begin
  Result := inherited RefCount;
end;

procedure RoundOne;
var
  vintf: TInterfaceList;
  v1: iintf;
begin
  writeln;
  writeln('Round one');
  writeln('-');
  vintf := TInterfaceList.Create;
  try
writeln('creating and adding...');
vintf.Add(tintf.create);
writeln('retrieving to v1...');
if vintf[0].QueryInterface(iintf, v1) = S_OK then
begin
  writeln('trying to write v1.RefCount...');
  writeln('counting: ', v1.RefCount);
end else
  writeln('problem');
v1 := nil;
  finally
FreeAndNil(vintf);
  end;
end;

procedure RoundTwo;
var
  vintf: TInterfaceList;
  v1, v2: iintf;
begin
  writeln;
  writeln('Round two');
  writeln('-');
  vintf := TInterfaceList.Create;
  try
writeln('creating...');
v2 := tintf.Create;
writeln('adding...');
vintf.Add(v2);
writeln('typecasting to v1...');
v1 := iintf(vintf[0]);
writeln('trying to write v1.RefCount...');
writeln('counting: ', v1.RefCount);
v1 := nil;
v2 := nil;
  finally
FreeAndNil(vintf);
  end;
end;

procedure RoundThree;
var
  vintf: TInterfaceList;
  v1: iintf;
begin
  writeln;
  writeln('Round three');
  writeln('---');
  vintf := TInterfaceList.Create;
  try
writeln('creating and adding...');
vintf.Add(tintf.Create);
writeln('typecasting to v1...');
v1 := iintf(vintf[0]);
writeln('trying to write v1.RefCount...');
writeln('counting: ', v1.RefCount);
v1 := nil;
  finally
FreeAndNil(vintf);
  end;
end;

begin
  RoundOne;
  RoundTwo;
  RoundThree;
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-07 Thread José Mejuto

El 07/03/2013 12:29, Joao Morais escribió:

Hello list, what's the problem with "RoundThree" procedure (below)?
Here it raises a sigsegv trying to read an internal field. The
difference from "RoundTwo" is that I create an implementation of the
interface within the first param of tinterfacedlist.add method.



 writeln('typecasting to v1...');
 v1 := iintf(vintf[0]);


Hello,

AFAIK you are casting a IUnknown to iintf instead requesting the iintf 
interface. I think the right procedure should be:


v1 := vintf[0] as iintf;

--

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


RE: [fpc-pascal] Re: Text IDE, the displayed cursor position

2013-03-07 Thread Pierre Free Pascal
The bug is indeed 64-bit specific...


Hopefully fixed in rev 23704,
http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=23704


Pierre Muller

> -Message d'origine-
> De : fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-
> boun...@lists.freepascal.org] De la part de Ebeling
> Envoyé : mardi 5 mars 2013 18:59
> À : FPC-Pascal users discussions
> Objet : Re: [fpc-pascal] Re: Text IDE, the displayed cursor position
> 
> Am Dienstag, den 05.03.2013, 14:20 +0100 schrieb Reinier Olislagers:
> > On 1-3-2013 15:03, Ebeling wrote:
> > > I am a low-level-user, who uses fpc only occasionally for small programs
> > > and only with 10 % of its functionality.  For my purposes, the text IDE
> > > seems to be adequate. But I stumble upon a basic functionality:  the
> > > displayed cursor-position.
> > >
> > > When I start a new program by clicking the button "new",  the cursor
> > > stands in the upper left corner, but its position is displayed as
> > > "1:976".
> > >
> > > This magic column number may be the difference between 2000 and 1024.
> > 
> > > I would be happy,  if someone could confirm my observations or give me a
> > > hint, what I am doing wrong.
> >
> > I remember an item on the bugtracker about cursor position. You might
> > want to search that. As far as I remember, a patch was attached which
> > you could try.
> > ___
> > fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> 
> Thank you for your response!
> 
> Now I see:
> 
> It is not only my problem (since fpc 2.4.0).
> 
> The bug is registrated for fpc version 2.6.2 concerning Linux as
> 
> 023956:  incorrect display of the cursor in the window edit code  and
> 023957:  incorrect procedure TIndicator.Draw for x86_64
> 
> As I allways install the binary form of fpc,  I hope the problem will be
> fixed with the next major release.
> 
> thank you again,  Hans Ebeling
> 
> 
> 
> 
> 
> 
> ___
> 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] Re: Get error information

2013-03-07 Thread leledumbo
> How to read the information?

You can take a look at the wiki article Executing External Programs,
substituting Output property with StdErr. Or if you use FPC 2.7.1, you can
see how RunCommand*** functions are implemented. Same as above article,
subsitute Output with StdErr.

> Ist stderr equal with /dev/stderr ?

No idea.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Get-error-information-tp5713366p5713407.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] arm-android, SQLite and the default libary

2013-03-07 Thread Sven Barth

Hello together!

I'm currently experimenting with porting our Windows Mobile client to 
Android. After some poor man's debugging I noticed that the wrong SQLite 
library is loaded. While we might want to change the default library for 
Android to 'libsqlite.so' I thought I'd experiment with the 
'SQLiteDefaultLibrary' variable in sqlite3.inc only learn that 
sqlite3conn uses its own default variable 'SQLiteLibraryName'. A view 
into the subversion's log shows that the one in sqlite3.inc was added 
after the one in sqlite3conn. Now I suggest to either let sqlite3conn 
additionally check the 'SQLiteDefaultLibrary' or remove the 
'SQLiteLibraryName' and use only 'SQLiteDefaultLibrary' to avoid 
potential further confusion...


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


Re: [fpc-pascal] arm-android, SQLite and the default libary

2013-03-07 Thread Michael Van Canneyt



On Thu, 7 Mar 2013, Sven Barth wrote:


Hello together!

I'm currently experimenting with porting our Windows Mobile client to 
Android. After some poor man's debugging I noticed that the wrong SQLite 
library is loaded. While we might want to change the default library for 
Android to 'libsqlite.so' I thought I'd experiment with the 
'SQLiteDefaultLibrary' variable in sqlite3.inc only learn that sqlite3conn 
uses its own default variable 'SQLiteLibraryName'. A view into the 
subversion's log shows that the one in sqlite3.inc was added after the one in 
sqlite3conn. Now I suggest to either let sqlite3conn additionally check the 
'SQLiteDefaultLibrary' or remove the 'SQLiteLibraryName' and use only 
'SQLiteDefaultLibrary' to avoid potential further confusion...


The latter solution is the best. For backwards compatibility, I suggest we do a

SQLiteLibraryName = sqlite3dyn.SQLiteDefaultLibrary

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


[fpc-pascal] Patch to enable Win64 SEH was: Re: LuaJIT 2 crashes under FPC+Win64. SEH issue?

2013-03-07 Thread Reinier Olislagers
On 2-3-2013 15:02, Marco van de Voort wrote:
> In our previous episode, denisgolovan said:
>> Building FPC with -dTEST_WIN64_SEH makes the trick!
> 
> Hmm, maybe it is slowly time to make this default in trunk?


Uploaded a patch at
http://bugs.freepascal.org/view.php?id=24012

Please have a look, compiler people ;)

Thanks,
Reinier

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


Re: [fpc-pascal] arm-android, SQLite and the default libary

2013-03-07 Thread Sven Barth

On 07.03.2013 17:52, Michael Van Canneyt wrote:



On Thu, 7 Mar 2013, Sven Barth wrote:


Hello together!

I'm currently experimenting with porting our Windows Mobile client to
Android. After some poor man's debugging I noticed that the wrong
SQLite library is loaded. While we might want to change the default
library for Android to 'libsqlite.so' I thought I'd experiment with
the 'SQLiteDefaultLibrary' variable in sqlite3.inc only learn that
sqlite3conn uses its own default variable 'SQLiteLibraryName'. A view
into the subversion's log shows that the one in sqlite3.inc was added
after the one in sqlite3conn. Now I suggest to either let sqlite3conn
additionally check the 'SQLiteDefaultLibrary' or remove the
'SQLiteLibraryName' and use only 'SQLiteDefaultLibrary' to avoid
potential further confusion...


The latter solution is the best. For backwards compatibility, I suggest
we do a

SQLiteLibraryName = sqlite3dyn.SQLiteDefaultLibrary


Done in 23708. Please note that your syntax didn't work, so I did it as 
follows:


=== code begin ===

var
  SQLiteLibraryName: String absolute sqlite3dyn.SQLiteDefaultLibrary 
deprecated 'use sqlite3dyn.SQLiteDefaultLibrary instead';


=== code end ===

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


Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-07 Thread Joao Morais
On Thu, Mar 7, 2013 at 9:27 AM, José Mejuto  wrote:
>
> Hello,
>
> AFAIK you are casting a IUnknown to iintf instead requesting the iintf
> interface. I think the right procedure should be:
>
> v1 := vintf[0] as iintf;

Hello, thanks for your reply.

You are right, changing to a safe typecast, don't know exactly why,
works flawlessly. Anyway the following code reproduce the exact
problem I have here. The 'sucess!' message isn't called.

Using 2.6.2 and 2.7.1 (2013/03/03)

Joao Morais

=

program project1;

{$mode objfpc}{$H+}

uses
  heaptrc,
  sysutils,
  Classes;

var
  vintfl: TInterfaceList;

procedure addintf(const aintf: IUnknown);
begin
  if vintfl.IndexOf(aintf) = -1 then
vintfl.Add(aintf);
end;

begin
  vintfl := TInterfaceList.Create;
  try
writeln('starting...');
addintf(TInterfacedObject.Create);
writeln('success!');
  finally
FreeAndNil(vintfl);
  end;
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Fwd: [Lazarus] Free-pascal question: Embedded programming

2013-03-07 Thread Chavoux Luyt
Sorry for cross-posting... I asked this question on Lazarus list and
was told that it fits better here...

-- Forwarded message --
From: Chavoux Luyt 
On 7 March 2013 12:11, Michael Schnell  wrote:
>
> On 03/07/2013 10:45 AM, Chavoux Luyt wrote:
>>
>> 1. How good is Lazarus/fpc for embedded programming (compared to C)? It will 
>> probably be on a (custom-made) device with ARM/Atmel-based chipset (with or 
>> without an OS - will this make a difference?).
>>
> What exactly do you mean by embedded ?

I am not going to build the hardware myself, but will probably (help
to) program the device. It will be a programmable GPS collar, so I am
not sure what the engineers are going to include. But to answer your
questions:
>
>
> Possible definitions include:
>
>  - (hard) real-time

Probably not necessary. It will need a real-time clock, though.
>
>  - direct hardware access

Yes, this will be needed.
>
>  - interrupt programming

Yes, probably. I want to include an accelerator meter and it should
send a hardware interrupt to tell the device to take a GPS reading.
>
>  - code in Flash memory (for "diskless" low-cost hardware)

Definitely diskless to fit in a GPS collar.
>
>  - no OS

Although an OS will probably make things easier, low power consumption
will be the most (?) important requirement. An OS that runs all the
time (or use too much power to boot up every time it receives a
hardware interrupt) will probably not work (even if an open-source OS
exists for a specific chipset).
>
>  - no GUI (for "headless" low-cost hardware)

Yes! (If there is an OS, it might be possible to have a web interface
and small embedded web server for settings etc., though).
>
>  - memory space efficiency (for low-cost hardware)

Yes! It needs to store at least  2160 GPS data points (in addition to
the main program itself and any configuration settings).
>
>  - speed efficiency (for low-cost hardware)

Yes!
>
>  - cross compiling

Yes, the development will be done on Linux (either fpc or c
cross-compiler) and written to the device using whatever
pins/connectors are available (probably USB and possibly wireless/UHF
- this will depend on hardware design)
>
>  - remote debugging

Will depend on the chipset and hardware design... can this be done using fpc?

2. I remember that the original Turbo Pascal (and Delphi) could use
in-line (i386) assembler. Is this still possible with
Lazarus/free-pascal and for other chipsets like Atmel/ARM?

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


[fpc-pascal] lazarus problem

2013-03-07 Thread GMAIL
I am using Lazarus for creating command line Free Pascal programs.
I did not realize what hapend but while compiling the free pascal program I get 
the following:

ld: symbol(s) not found for architecture i386
ld: warning: -macosx_version_min not specified, assuming 10.7
Undefined symbols for architecture i386:
  "_STRINGS_STRPAS$PCHAR$$SHORTSTRING", referenced from:
  _EXEINFO_READDEBUGLINK$TEXEFILE$SHORTSTRING$$BOOLEAN in exeinfo.o
  "_THREADVARLIST_STRINGS", referenced from:
  FPC_THREADVARTABLES in project1.o
  FPC_THREADVARTABLES in strings.o
ld: symbol(s) not found for architecture i386
An error occurred while linking 
project1.lpr(13,3) Error: Error while linking
project1.lpr(13,3) Fatal: There were 1 errors compiling module, stopping

I reinstalled Lazarus but nothing changed. Please help!

Sotiris Kousouris



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


Re: [fpc-pascal] lazarus problem

2013-03-07 Thread Mattias Gaertner

GMAIL  hat am 7. März 2013 um 18:01 geschrieben:
> I am using Lazarus for creating command line Free Pascal programs.
> I did not realize what hapend but while compiling the free pascal program I
> get
> the following:
>
> ld: symbol(s) not found for architecture i386
> ld: warning: -macosx_version_min not specified, assuming 10.7
> Undefined symbols for architecture i386:
> "_STRINGS_STRPAS$PCHAR$$SHORTSTRING", referenced from:
> _EXEINFO_READDEBUGLINK$TEXEFILE$SHORTSTRING$$BOOLEAN in exeinfo.o
> "_THREADVARLIST_STRINGS", referenced from:
> FPC_THREADVARTABLES in project1.o
> FPC_THREADVARTABLES in strings.o
> ld: symbol(s) not found for architecture i386
> An error occurred while linking
> project1.lpr(13,3) Error: Error while linking
> project1.lpr(13,3) Fatal: There were 1 errors compiling module, stopping
>
> I reinstalled Lazarus but nothing changed. Please help!

What fpc version?
Can you post the command line? You can find them in Lazarus in Project / Project
Options / Show Options.

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