Re: [fpc-pascal]class variable

2003-04-04 Thread milimeter
Great!
But does -St also contain the parameters of -S2/-Sd? Or can we use them at 
them at the same time? "fpc -St -Sd aaa.pp"?


>
> Sorry that is wrong, static class members are supported, you need to
> enable the static keyword using -St
>
> I don't know what you mean with class properties.
>

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]class variable

2003-04-04 Thread Thomas Schatzl
Hi,


> Great!
> But does -St also contain the parameters of -S2/-Sd?
> Or can we use them at 
> them at the same time? "fpc -St -Sd aaa.pp"?

Yes you can.

Regards,
  Thomas
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]class variable

2003-04-04 Thread Anton Tichawa
On Friday 04 April 2003 07:48, you wrote:
> > Hello!
> >
> >>   Can any tell me if there's "Class Variable" in free pascal like in
> >> java?
> >>   I mean, in java, you can declare a class memeber to be "static", all
> >> instance of this class share the same variable memory. Such a member can
> >> be
> >> accessed through class name without any instantiation.
> >>   Does free pascal will add such a feature in the future?
> >
> > AFAIK, class variables are not supported yet, nor are class properties.
> > But
> > it's possible to use class methods, which in turn access a global
> > variable.
>
> Sorry that is wrong, static class members are supported, you need to
> enable the static keyword using -St
>
> I don't know what you mean with class properties.

Sorry for my misinfo, but I didn't find anything about class variables in the 
docs (1.06), and I tried, in vain, to compile programs with class variables. 
I'm happy to learn that -St allows using class variables. It's a pity, 
though, that different keywords have to be used for class variables and class 
methods.

By class properties, I mean properties that only access class members (class 
variables and class methods), and are accessible with the syntax:

..

When trying class methods, I found that the executable behaves strange: 
Invoking a class method with

.

works fine. But, invoking the class method with

.

is accepted by the compiler, but results in an exception when  is 
nil. Is that OK?

thanks,

anton tichawa.

--

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

--

Ing. Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
phone: +43 1 218 97 59
mobil: +43 664 52 07 907; currently n/a
email: [EMAIL PROTECTED]

--
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]class variable

2003-04-04 Thread Peter Vreman
> When trying class methods, I found that the executable behaves strange:
> Invoking a class method with
>
> .
>
> works fine. But, invoking the class method with
>
> .
>
> is accepted by the compiler, but results in an exception when 
> is
> nil. Is that OK?

Please try it with 1.0.7 or 1.1. There are some changes regarding class
methods since 1.0.6


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]class variable

2003-04-04 Thread Michael Van Canneyt


On Fri, 4 Apr 2003, Anton Tichawa wrote:

> On Friday 04 April 2003 07:48, you wrote:
> > > Hello!
> > >
> > >>   Can any tell me if there's "Class Variable" in free pascal like in
> > >> java?
> > >>   I mean, in java, you can declare a class memeber to be "static", all
> > >> instance of this class share the same variable memory. Such a member can
> > >> be
> > >> accessed through class name without any instantiation.
> > >>   Does free pascal will add such a feature in the future?
> > >
> > > AFAIK, class variables are not supported yet, nor are class properties.
> > > But
> > > it's possible to use class methods, which in turn access a global
> > > variable.
> >
> > Sorry that is wrong, static class members are supported, you need to
> > enable the static keyword using -St
> >
> > I don't know what you mean with class properties.
>
> Sorry for my misinfo, but I didn't find anything about class variables in the
> docs (1.06), and I tried, in vain, to compile programs with class variables.

I think peter was wrong. He meant class functions or methods.

> I'm happy to learn that -St allows using class variables. It's a pity,
> though, that different keywords have to be used for class variables and class
> methods.
>
> By class properties, I mean properties that only access class members (class
> variables and class methods), and are accessible with the syntax:
>
> ..
>
> When trying class methods, I found that the executable behaves strange:
> Invoking a class method with
>
> .
>
> works fine. But, invoking the class method with
>
> .
>
> is accepted by the compiler, but results in an exception when  is
> nil. Is that OK?

It depends on what you do in this method. It definitely works, because
e.g. 'Classname' is a class method.

The idea of a class variable is strange to me.
Why not simply use a global variable ?

Michael.

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]class variable

2003-04-04 Thread Anton Tichawa
Hello!

> The idea of a class variable is strange to me.
> Why not simply use a global variable ?

In fact it would be a global variable, but one that is bound to a class, also 
in the sense of a namespace.

Consider, as an example, a class variable that holds the count of instances. 
Something like (this is pseudo code - it will not work that simple):

type t_myclass_a = class
  class var instance_count: integer;
  end;

type t_my_class_b = class
  class var instance_count: integer;
  end;

procedure list_instances(aclass: tclass);
begin
  writeln('the class ' + aclass.classname + ' has ' +
intstr(aclass.instance_count) + ' instances');
  // i. e. accessing the proper global variable for
  // the given class type
end;

Type checking and inheritance of class variables still would have to be 
considered.

Anton.

--

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

--

Ing. Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
phone: +43 1 218 97 59
mobil: +43 664 52 07 907; currently n/a
email: [EMAIL PROTECTED]

--
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]OpenGL/GLUT run time error when I whant compile this code

2003-04-04 Thread Karim Forsthofer
Hello 
I played around with the OpenGL unit, and I wrote some minimal OpenGL code to get a 
window: 
Here is the code:

program glbasic;

uses
  gl, glut;

const
  width = 640;
  height= 480;

procedure drawthings;

begin
  glClearColor(0.0, 0.0, 0.0, 0.0);
 (*will add some more code*);
end;

begin 
  glutInit(@argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE or GLUT_RGB);
  glutInitWindowSize( width, height);
  glutInitWindowPosition(0, 0);
  glutCreateWindow('glbasic');
  glutDisplayFunc(@drawthings);
  glutMainLoop();
end.

Now, when I whant to run to code, I get some Run time errors on the console: 

Runtime error 216 at 0x4052F5CA
   0x4051F5CA
Runtime error 216 at 0x0804C1CA
   0x0849C1CA
   0x0805127E
   
   etc. 
   etc. 
   etc. (about 20 lines)

1). I know not a lot of runtime errors, but after succesfully compiling, that isn`t a 
fpc bug, is it ? 
What is the source of this run time error ? (mesa, fpc or my code ?)
2). I think about there isn`t enough code in the drawthings procedure to run 
succesfull. 

What you think ? 

Greetings 
Karim F. 

-- 
__
http://www.linuxmail.org/
Now with e-mail forwarding for only US$5.95/yr

Powered by Outblaze
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]OpenGL/GLUT run time error when I whant compile this code

2003-04-04 Thread James Mills
On Sat, Apr 05, 2003 at 10:02:07AM +0800, Karim Forsthofer wrote:
> Hello 
> I played around with the OpenGL unit, and I wrote some minimal OpenGL code to get a 
> window: 
> Here is the code:
> 
> program glbasic;
> 
> uses
>   gl, glut;
> 
> const
>   width = 640;
>   height= 480;
> 
> procedure drawthings;
> 
> begin
>   glClearColor(0.0, 0.0, 0.0, 0.0);
>  (*will add some more code*);
> end;
> 
> begin 
>   glutInit(@argc, argv);
>   glutInitDisplayMode(GLUT_DOUBLE or GLUT_RGB);
>   glutInitWindowSize( width, height);
>   glutInitWindowPosition(0, 0);
>   glutCreateWindow('glbasic');
>   glutDisplayFunc(@drawthings);
>   glutMainLoop();
> end.
> 
> Now, when I whant to run to code, I get some Run time errors on the console: 
> 
> Runtime error 216 at 0x4052F5CA
>0x4051F5CA
> Runtime error 216 at 0x0804C1CA
>0x0849C1CA
>0x0805127E
>
>etc. 
>etc. 
>etc. (about 20 lines)
> 
> 1). I know not a lot of runtime errors, but after succesfully compiling, that isn`t 
> a fpc bug, is it ? 
> What is the source of this run time error ? (mesa, fpc or my code ?)
> 2). I think about there isn`t enough code in the drawthings procedure to run 
> succesfull. 
> 
> What you think ? 

That piece of code runs fine on my machine, except that my display
doesn't support OpenGL GLX Extension :( hehe, need to compile my nvidia
kernel drivers...

cheer
sJames

> 
> Greetings 
> Karim F. 
> 
> -- 
> __
> http://www.linuxmail.org/
> Now with e-mail forwarding for only US$5.95/yr
> 
> Powered by Outblaze
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal