Re: [fpc-pascal] opendelphi.org

2006-03-17 Thread Florian Klaempfl
Vinzent Hoefler wrote:
> On Thursday 16 March 2006 16:35, memsom wrote:
> 
>> Pascal on Linux etc is niche.
> 
> Yeah, that has always been my problem. Programming for environments and 
> in languages that are usually both considered niche.

Not to forget (translated german idiom): only if you swim against the stream you
reach the source :)

> 
> Nonetheless I do it. And I even get fucking paid for it. 
> And most 
> important: It really works.

Mostly even better because "niche" solutions fit usually the needs better.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Lazarus

2006-03-17 Thread Mattias Gaertner
On Fri, 17 Mar 2006 01:34:11 -0300
"Felipe Monteiro de Carvalho" <[EMAIL PROTECTED]> wrote:

> On 3/17/06, Gökhan Ersumer <[EMAIL PROTECTED]> wrote:
> > Yep, I said so (on last paragraph) but IMO this is
> > bad for maintanence and/or component writers.
> 
> I wrote TTrayIcon component to implement multiplatform system tray and
> also did a lot of things on the Qt interface for Lazarus, and also
> started the Windows CE interface, and I had no idea about that vtm
> thing until I read your e-mail.
> 
> So I can conclude that one can write components and even new
> interfaces (and maintain them) without ever knowing about this.

That's exactly the idea of creating a vmt, instead of working with a fake:
No extra code or headaches for the components, property editors, component
editors, object inspector, ... .

The vmt is created only for the lookuproot (TForms/TDataModules). For
example a TForm1. This is a class of its own, so it needs a vmt of its own.
This way the class can be renamed and the classtype pointer can be used
normally. A TTrayIcon put onto the form/datamodule does not get an extra
vmt. When the IDE supports designing components, and you want to design a
TTrayIcon descendent, then the IDE will create a TTrayIcon1 vmt.

See designer/jitforms.pp function CreateNewJITClass.


Mattias


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


Re: [fpc-pascal] os dependency with ifdef

2006-03-17 Thread Tomas Hajny
Marc Santhoff wrote:


Hi,

> I' like to know how I should write code for different system. SInce I'm
> no Linux user nor have any experience on MacOS I need to know how to
> wrap platform dependant code.
>
> Since I'm still fiddling with reading the serial port I have the idea
> that linux and even MacOS may be very similar to my main os FreeBSD.
>
> I do know Win32 is different, but how similar are the other os'ses?
>
> Is there any code in the FCL or the like I can study for getting my
> ifdefs right?

If you really want to create it prepared for current and future platforms,
don't do it via IFDEFs first of all. The procedural solution would be to
design a logical layer for functionality you need (get permissions for
accessing port, open port, set characteristics, read data, write data,
close port) in common interface part of a unit created as an include file,
possibly create (an)other include file(s) with shared parts of the
implementation too and create standalone units for the different platforms
you need to support.

Alternative solution (slightly more OOP-like and, somewhat easier to
implement and providing more flexibility) is to use create a "manager"
record for your particular functionality - see e.g. the heap management
and thread management routines, plus keyboard, mouse and video management
provided in units of the same name.

Tomas

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


Re: [fpc-pascal] Re: fpc-pascal Digest, Vol 19, Issue 24

2006-03-17 Thread Geoff Bagley



Well, just to mention a counter-example: My favourite Ada compiler is 
written in Ada.



Vinzent.
 

I used to use an Algol 60 compiler which had been written in a 
(gradually  growing)

sub-set of Algol 60.  A new meaning to "boot-strapping" ?

Geoff

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


Re: [fpc-pascal] WinSock

2006-03-17 Thread Hans Mårtensson

Tony Pelton wrote:


also, and i'm not sure about this, as i've been meaning to ask, but i
think the stuff in the "Sockets" unit is meant to be a cross platform
sockets API ?

anyone know about this ?

i'm going to be doing some (hopefully) cross platform socket stuff soon.
 



I did some socket programming on win32 recently and also first looked at 
the Sockets unit.
I think that you are right that this unit is meant to be a cross 
platform unit. But I found that it didn't work on win32, may be be 
hasn't been finished yet. So I used the Winsock unit, which makes it 
possible to call the win32 API's as documented by microsoft.


Hans Mårtensson

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


Re: [fpc-pascal] os dependency with ifdef

2006-03-17 Thread Marc Santhoff
Am Freitag, den 17.03.2006, 11:11 +0100 schrieb Tomas Hajny:
> Marc Santhoff wrote:
> 
> 
> Hi,
> 
> > I' like to know how I should write code for different system. SInce I'm
> > no Linux user nor have any experience on MacOS I need to know how to
> > wrap platform dependant code.
> >
> > Since I'm still fiddling with reading the serial port I have the idea
> > that linux and even MacOS may be very similar to my main os FreeBSD.
> >
> > I do know Win32 is different, but how similar are the other os'ses?
> >
> > Is there any code in the FCL or the like I can study for getting my
> > ifdefs right?
> 
> If you really want to create it prepared for current and future platforms,
> don't do it via IFDEFs first of all. The procedural solution would be to
> design a logical layer for functionality you need (get permissions for
> accessing port, open port, set characteristics, read data, write data,
> close port) in common interface part of a unit created as an include file,
> possibly create (an)other include file(s) with shared parts of the
> implementation too and create standalone units for the different platforms
> you need to support.

This is what I'm beginning to do at the moment, after some information
retrieval about how serial ports on Win32 work I've come to the
conclusion that porting the unit rtl/unix/serial.pp would be the best
thing for my special task.

I'm only bothered by the design of that stuff, no result codes
(procedure not function) in some important areas. But I will not make
changes breaking old code, I hope some exception throwing will do ... 

> Alternative solution (slightly more OOP-like and, somewhat easier to
> implement and providing more flexibility) is to use create a "manager"
> record for your particular functionality - see e.g. the heap management
> and thread management routines, plus keyboard, mouse and video management
> provided in units of the same name.

Yes, if I had to design it from the start I would think about making it
a really universally usable and technically perfect solution. But for
now my goal is to get some very simple communication running on windows
(slow, no handshake).

Thanks,
Marc


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


Re: [fpc-pascal] os dependency with ifdef

2006-03-17 Thread Felipe Monteiro de Carvalho
Hello,

On 3/16/06, Marc Santhoff <[EMAIL PROTECTED]> wrote:
> Since I'm still fiddling with reading the serial port I have the idea
> that linux and even MacOS may be very similar to my main os FreeBSD.
>
> I do know Win32 is different, but how similar are the other os'ses?

You can mostly assume that if it works for Linux, then it will work
for FreeBSD and all other BSDs and even Solaris (and vice-versa).

This isn´t true for Mac OS X. Althought it is based on FreeBSD, it is
very, very different from standard unix boxes.

> Is there any code in the FCL or the like I can study for getting my
> ifdefs right?

I used ifdefs to write two cross-platform projects: TTrayIcon
component and the Virtual Magnifying Glass. You can see their codes on
the internet.

For the magnifier, look for the LoadBitmap procedure to see a example
of how to use a ifdef to implement a function that is very different
on both platforms

http://cvs.sourceforge.net/viewcvs.py/magnifier/magnifierv3/glass.pas?rev=1.14&view=auto

TTrayIcon code is here:

http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/components/trayicon/?root=lazarus

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