Re: [fpc-pascal] Re:The Interface to MySQL has changed on version by version Andi Purwito

2007-10-10 Thread Michael Van Canneyt


On Tue, 9 Oct 2007, L wrote:

  mysqlku.pas(16,18) Error: Identifier not found TMYSQL
  mysqlku.pas(16,18) Error: Error in type definition
  mysqlku.pas(18,22) Error: Identifier not found TMYSQL_ROW
  mysqlku.pas(18,22) Error: Error in type definition
  mysqlku.pas(74,17) Error: Operator is not  overloaded
  mysqlku.pas(76,32) Error: Illegal qualifier
  mysqlku.pas(76,35) Error: Illegal expression
  mysqlku.pas(77,35) Error: Illegal qualifier
  mysqlku.pas(77,38) Error: Illegal expression
  mysqlku.pas(78,37) Error: Illegal qualifier
  mysqlku.pas(78,44) Error: Illegal expression
 
  It's look that the interface has changed. But where can we get and follow 
  its
  change?
 
 Instead of using 'TMYSQL_ROW' try 'MYSQL_ROW' (omit the T).
 That way, you can compile the code with both versions of Mysql since the old
 units have the type definitions without the 'T' also.
 
 To Michael or whoever knows:
 Did the C header files use 'T' back then but not now?

That's one of the changes, yes. The first versions of the mysql headers
were done manually, if I remember correctly. Only later, a switch was
made to h2pas.

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


Re: [fpc-pascal] Calling a function by name (as string) read from a text file

2007-10-10 Thread Daniël Mantione
y

Op Wed, 10 Oct 2007, schreef Jilani Khaldi:

  type  Tsetupfunc_mapping=record
  name:string;
  func:setupfunc;
  end;
   const setupfunc_mapping:array[0..2] of Tsetupfunc_mapping=(
  (name:'setup_function_1';func:@setup_function_1),
  (name:'setup_function_2';func:@setup_function_2),
  (name:'setup_function_3';func:@setup_function_3));
  
  Then search the name of the function you want to call in the table, then
  call the function in the func field.
 Thanks, but the consts should be:
 const setupfunc_mapping: array[0..2] of Tsetupfunc_mapping=(
 (name: 'setup_function_1'; func: setup_function_1),
 (name: 'setup_function_2'; func: setup_function_2),
 (name: 'setup_function_3'; func: setup_function_3));
 
 However compiling with {$mode objfpc} I get the error:
 ** Error: Some fields coming before name weren't initialized
 and it dosen't compile.

Did you implement the record exactly as shown? This error normally occurs 
if you have fields in your record that you don't mention in your typed 
const declaration.

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

Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Leonardo M. Ram
 
 What's wrong with
 http://www.freepascal.org/docs-html/ref/refch8.html#x79-860008 ?

See http://www.freepascal.org/docs-html/ref/refse39.html

I was reading the document and noted this hughe image with blanks 
http://www.freepascal.org/docs-html/ref/ref100x.png that really looks bad.

Anyway, nothing related to the subject.


Leonardo M. Ramé
http://leonardorame.blogspot.com


   

Be a better Globetrotter. Get better travel answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=listsid=396545469
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Matt Emson

Jilani Khaldi wrote:

Hi All,
just curious about the D language 
(http://www.digitalmars.com/d/index.html), I read some articles on the 
site, downloaded the compiler... and wrote some little examples. Well, 
many of the things that the author presented as new and hot features 
are already present in Turbo Pascal or in Delphi for a decade (objects 
by reference, strings...). 
I only with that Walter would take on-board Sets ala Object Pascal. They 
get all these crazy, crazy set implementations popping up in the D 
forums, but if you demonstrate how OP does it, we get a that's nice 
and it's totally ignored... well last time I looked, so maybe he did 
implement sets now.


M

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


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Florian Klaempfl
Jilani Khaldi schrieb:
 Hi All,
 just curious about the D language
 (http://www.digitalmars.com/d/index.html), I read some articles on the
 site, downloaded the compiler... and wrote some little examples. Well,
 many of the things that the author presented as new and hot features are
 already present in Turbo Pascal or in Delphi for a decade (objects by
 reference, strings...).
 The only thing I see it has more than Object Pascal is Generics
 (templates) and they seems to be well implemented there.
 I think, with templates, Object Pascal will be the only human high
 level complete and mature language.
 

What's wrong with
http://www.freepascal.org/docs-html/ref/refch8.html#x79-860008 ?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling a function by name (as string) read from a text file

2007-10-10 Thread Jilani Khaldi
Did you implement the record exactly as shown? This error normally occurs 
if you have fields in your record that you don't mention in your typed 
const declaration.


{$mode objfpc} - Error!
{$mode delphi} - Ok!
...
type
  TSetupFuncMapping = record
x: array of double;
name:string;
func: SetupFunc;
  end;

const
  SFM: array[0..2] of TSetupFuncMapping = (
  (x: nil; name: 'SetupFunction_1'; func: SetupFunction_1),
  (x: nil; name: 'SetupFunction_2'; func: SetupFunction_2),
  (x: nil; name: 'SetupFunction_3'; func: SetupFunction_3));

Jilani

--
Jilani KHALDI

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


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Jilani Khaldi

What's wrong with
http://www.freepascal.org/docs-html/ref/refch8.html#x79-860008 ?

Nothing, once completed.

--
Jilani KHALDI

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


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Florian Klaempfl
Jilani Khaldi schrieb:
 What's wrong with
 http://www.freepascal.org/docs-html/ref/refch8.html#x79-860008 ?
 Nothing, once completed.

Well, it's completed or do you miss things? but still under testing ;)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Mattias Gaertner
On Wed, 10 Oct 2007 16:12:03 +0200
Florian Klaempfl [EMAIL PROTECTED] wrote:

 Jilani Khaldi schrieb:
  What's wrong with
  http://www.freepascal.org/docs-html/ref/refch8.html#x79-860008 ?
  Nothing, once completed.
 
 Well, it's completed or do you miss things? but still under testing ;)

Is there already a generic tree example?

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


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Florian Klaempfl
Mattias Gaertner schrieb:
 On Wed, 10 Oct 2007 16:12:03 +0200
 Florian Klaempfl [EMAIL PROTECTED] wrote:
 
 Jilani Khaldi schrieb:
 What's wrong with
 http://www.freepascal.org/docs-html/ref/refch8.html#x79-860008 ?
 Nothing, once completed.
 Well, it's completed or do you miss things? but still under testing ;)
 
 Is there already a generic tree example?

Not a tree, but a list and a map:
http://svn.freepascal.org/svn/fpc/trunk/rtl/objpas/fgl.pp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Adrian Veith


Jilani Khaldi schrieb:

Hi All,
just curious about the D language 
(http://www.digitalmars.com/d/index.html), I read some articles on the 
site, downloaded the compiler... and wrote some little examples. Well, 
many of the things that the author presented as new and hot features 
are already present in Turbo Pascal or in Delphi for a decade (objects 
by reference, strings...).

oh D has more interesting things for a compiled language:
 - dynamic closures or delegates to nested functions
 - lazy evaluation
 - template mixins
 - garbage collection

I am not sure if all these things are really useful - but it looks 
interesting. especially the delegates stuff.


What I don't understand is, that they haven't changed the idiotic switch 
statement.


cheers,

Adrian.

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


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Jilani Khaldi

Well, it's completed or do you miss things? but still under testing ;)
At this moment I, really, can't answer seen I have just begun to look at 
templates. I need it to translante a piece of code from D to FP.


--
Jilani KHALDI

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


Re: [fpc-pascal] Calling a function by name (as string) read froma text file

2007-10-10 Thread Tomas Hajny
Jilani Khaldi wrote:
 Did you implement the record exactly as shown? This error normally
 occurs
 if you have fields in your record that you don't mention in your typed
 const declaration.

 {$mode objfpc} - Error!
 {$mode delphi} - Ok!
 ...
 type
TSetupFuncMapping = record
  x: array of double;
  name:string;
  func: SetupFunc;
end;

 const
SFM: array[0..2] of TSetupFuncMapping = (
(x: nil; name: 'SetupFunction_1'; func: SetupFunction_1),
(x: nil; name: 'SetupFunction_2'; func: SetupFunction_2),
(x: nil; name: 'SetupFunction_3'; func: SetupFunction_3));


I only get a RTE when compiling and running the following with 2.0.4, not
a compile time error.

Tomas


{$MODE OBJFPC}
uses
   SysUtils;

type
   SetupFun = function(const vect: array of double): double;

MyRec = record
   x: array of double;
   myFunName: ShortString; // function name to evoke
end;

type
   TSetupFuncMapping = record
 x: array of double;
 name:string;
 func: SetupFun;
   end;

function SetupFunction_1 (const vect: array of double): double;
begin
 SetupFunction_1 := 1;
end;

function SetupFunction_2 (const vect: array of double): double;
begin
 SetupFunction_2 := 2;
end;

function SetupFunction_3 (const vect: array of double): double;
begin
 SetupFunction_3 := 3;
end;

function SetMeUp(const x1: array of double): double;
var
   i: integer;
   sum: double;
begin
   sum := 0.0;
   for i := 0 to High(x1) do
 sum := sum + x1[i];
   result := sum;
end;


const
   SFM: array[0..3] of TSetupFuncMapping = (
   (x: nil; name: 'SetupFunction_1'; func: @SetupFunction_1),
   (x: nil; name: 'SetupFunction_2'; func: @SetupFunction_2),
   (x: nil; name: 'SetMeUp'; func: @SetMeUp),
   (x: nil; name: 'SetupFunction_3'; func: @SetupFunction_3));

// main
var
   MR: MyRec;
   y: double;
   st: string;
   f: text;
   i, j, count: integer;
begin
   // read MR from a text file...
   assign(f, 'data.txt');
   {$I-}
   reset(f);
   {$I+}
   readln(f, MR.myFunName);
   readln(f, count);
   setlength(MR.x,count+1);
   for i := 0 to count do
 readln(f, MR.x[i]);
   closefile(f);
   writeln(MR.myFunName);
   writeln(High(MR.x));
   for i := 0 to High(MR.x) do
 begin
  writeln(MR.x[i]);
  for J := 0 to 3 do
   if SFM [J].Name = MR.MyFunName [J] then
y := SFM [J].Func (MR.X);
  st := Format('Value: %6.5f', [y]);
  writeln(st);
  setlength(MR.x,0);
 end;
   readln;
end.

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


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Mattias Gaertner
On Wed, 10 Oct 2007 17:07:45 +0200
Florian Klaempfl [EMAIL PROTECTED] wrote:

 Mattias Gaertner schrieb:
  On Wed, 10 Oct 2007 16:12:03 +0200
  Florian Klaempfl [EMAIL PROTECTED] wrote:
  
  Jilani Khaldi schrieb:
  What's wrong with
  http://www.freepascal.org/docs-html/ref/refch8.html#x79-860008 ?
  Nothing, once completed.
  Well, it's completed or do you miss things? but still under
  testing ;)
  
  Is there already a generic tree example?
 
 Not a tree, but a list and a map:
 http://svn.freepascal.org/svn/fpc/trunk/rtl/objpas/fgl.pp

It seems the map works with a list instead of a hash or a tree. 
Does the STL map work the same?


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


Re: [fpc-pascal] D language and Object Pascal

2007-10-10 Thread Jilani Khaldi

oh D has more interesting things for a compiled language:
 - dynamic closures or delegates to nested functions
 - lazy evaluation
 - template mixins
 - garbage collection

I am not sure if all these things are really useful - but it looks 
interesting. especially the delegates stuff.
I think the main problem of Java, D, C++... (and even Object Pascal) is 
the syndrome of giantism. They are getting bigger and bigger all the 
time. C, instead, doesn't suffer of this and it is always a main 
language. I think we have to restart from Turbo Pascal 3.0.


--
Jilani KHALDI

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


[fpc-pascal] PThreads

2007-10-10 Thread Andreas Berger




I just found this link to
Win32 PThreads and wanted to know if FPC uses pthreads in the
Windows implementation. It would probably ease use. The main
inconvenience to this library is that it wants to use a dll and the
nice thing about FPC is "no dependencies". So maybe an interface to the
C library would have to be written.


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

Re: [fpc-pascal] PThreads

2007-10-10 Thread Marco van de Voort
 I just found this a
  href=http://sources.redhat.com/pthreads-win32/index.html;link to
 Win32 PThreads/a and wanted to know if FPC uses pthreads in the
 Windows implementation. 

No. FPC is in general totally independant of any Unix lib on Windows. The
parts that _can_ be used are typically mingw implementations of libs with
little other dependancies.

 It would probably ease use.

Actually it wouldn't be pretty pointless. FPC threading is modelled after
Delphi, which is closer to Windows than to pthreads.

 The main inconvenience to this library is that
 it wants to use a dll and the nice thing about FPC is no dependencies.
 So maybe an interface to the C library would have to be written

What would be the need for this? Deep integration with cygwin? 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal