Re: [fpc-pascal] Weird DosError values
From:"Matthews" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sujbect: [fpc-pascal] Weird DosError values Date sent: Mon, 16 Feb 2004 18:06:13 -0500 Hello Lukas > I'm using a function and a procedure, both which deal > with finding files in > the same directory, and then either counting them, or > reading them, but I'm > getting some very weird values for DosError. I'm using > v1.0.10, and I > continue to get a value of 183 from DosError in the . . We'd probably need little bit more information from you. First of all, your code snippet isn't directly compilable as it is now - it isn't even completely clear which FindFirst function is being used (my guess is that one from SysUtils because of the TSearchRec type used, but on the other hand you're using DosError as well, which is relevant to FindFirst from unit Dos). Second, it would be definitely useful to know the target you're compiling for (GO32v2?, ???) and the operating system you're running on. Regarding your code - well, I'd definitely suggest to use something like while..do or repeat..until instead of your use of goto construct. Best regards Tomas -- VOLNY klub: Modemisti vseho druhu, spojte se! http://klub.volny.cz ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Error Making CVS version of compiler
From: "Matt Henley" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject:[fpc-pascal]Error Making CVS version of compiler Date sent: Tue, 17 Feb 2004 20:06:49 -0600 . . > /usr/local/bin/ppc386 -Ur -Xs -OG2p3 -n -Fi../inc > -Fi../i386 -Fi../unix > -Fii386 -FE. -di386 -dRELEASE ../unix/dos.pp > dos.pp(227,1) Fatal: Syntax error, "BEGIN" expected but > "identifier > THREADVAR" found > make[3]: *** [dos.ppu] Error 1 > make[3]: Leaving directory > `/home/matt/fpc/fpc/rtl/linux' > make[2]: *** [cycle] Error 2 . . First of all, there's been an error in CVS, but this has been fixed in between. However, you'll probably have to start cycling with a 1.0.10 compiler. This is a general rule - if cycling doesn't work with the snapshot, try to start with the latest official _release_ version (not beta!) - this rule should be added to the build FAQ probably. Tomas -- VOLNY klub: Modemisti vseho druhu, spojte se! http://klub.volny.cz ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Free Pascal for ARM
Hi, I'm interested in freepascal for ARM, I have downloaded the last snapshot (cvs) of freepascal and I've tried to compile with a fatal internal error, "typinfo.pp(443,6) Fatal: Internal error 200308241" My host is a linux and i386, the above error is making a cross compiler with target ARM. patched Makefile.FPC, because there was several error in sections for ARM Run FPCMake to generate Makefile make CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/usr/local/arm/2.95.3/arm-linux/bin cycle ---typinfo.pp--- -- Function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string; Akinds : TTypeKinds) : PPropInfo; begin Result:=GetPropInfo(TypeInfo,PropName); If (Akinds<>[]) then (* ERROR in this line, this's 443 line *) If (Result<>Nil) then If Not (Result^.PropType^.Kind in AKinds) then Result:=Nil; end; -- Kind regards ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]trouble compiling a demo
I am trying to compile this which is giving me hell unit MyError; { Custom error reporting routines. *** WINDOWS VERSION *** } interface procedure Say(msg : String); procedure SockError(msg : String); procedure SockSay(msg : String); procedure GenError(msg : String);implementation uses sockets; procedure Say(msg : String); begin Writeln(stderr, msg); end; procedure SockError(msg : String); begin Writeln(stderr, msg, SocketError); Halt(1); end; procedure SockSay(msg : String); begin Writeln(stderr, msg, SocketError); end; procedure GenError(msg : String); begin Say(msg); Halt(1); end; end. The error message is this. I am new to this so I am having trouble understanding what's wrong. the error message is myerror-win.pas(1,6) Error: Illegal unit name: MYERROR myerror-win.pas(9,1) Fatal: Syntax error, ; expected but INTERFACE found >Exit code: 1 --- ***National City made the following annotations --- This communication is a confidential and proprietary business communication. It is intended solely for the use of the designated recipient(s). If this communication is received in error, please contact the sender and delete this communication. === ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]RE: Defining Records on the fly:
Since Free Pascal supports function overloading, you could do something like this: Function CheckPoint(X, Y:real): Boolean; Begin {Does something here..} end; Function CheckPoint(aPoint: tMyRec): Boolean; Begin Result:=CheckPoint(aPoint.X, aPoint.Y); end; // So you can use it either way: var MyRec:tMyRec; begin if CheckPoint(MyRec) then {do stuff}; if CheckPoint(1.2, 2.2) then {do more stuff}; end; > Here is why I was wondering why you couldn't, say I have this type: > Type tMyRec = Record X, Y : Real; End; > > And I have this function: > > Function CheckPoint(aPoint: tMyRec): Boolean; > Begin > {Does something here..} > end; > > begin > CheckPoint((X:1.2;Y:2.2)); > end. __ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]trouble compiling a demo
On Wed, 18 Feb 2004, Crabtree, Chad wrote: > I am trying to compile this which is giving me hell > > unit MyError; > > { > Custom error reporting routines. > > *** WINDOWS VERSION *** > } > > interface > > procedure Say(msg : String); > procedure SockError(msg : String); > procedure SockSay(msg : String); > procedure GenError(msg : String);implementation > > uses sockets; > > procedure Say(msg : String); > begin >Writeln(stderr, msg); > end; > > procedure SockError(msg : String); > begin >Writeln(stderr, msg, SocketError); >Halt(1); > end; > > procedure SockSay(msg : String); > begin >Writeln(stderr, msg, SocketError); > end; > > procedure GenError(msg : String); > begin >Say(msg); >Halt(1); > end; > > end. > > The error message is this. I am new to this so I am having trouble > understanding what's wrong. the error message is > > myerror-win.pas(1,6) Error: Illegal unit name: MYERROR > myerror-win.pas(9,1) Fatal: Syntax error, ; expected but INTERFACE found I would say the error is quite clear. The name of the unit must be the same as the filename it is in: myerror-win in this case. Michael. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Weird DosError values
Dear Tomas, Thanks for your advice. My apologies for not providing enough information - I realized after I sent the message that I should have mentioned what OS, etc. I was running. I'm running Win 2000, and using sysutils, and dos - could that be the problem? The target os (as given to my by DevPascal 1.9.2) is Win32 for i386. However, I downloaded the 1.9.2 w32 version of FreePascal, and the program compiled fine, and hasn't given me any errors since (no odd DosError values). Thanks for your suggestion on resolving the use of goto. I'll implement that soon. One question: In the future, should I just host my code on geocities (or something) and then include a link to it instead? -Lukas At 05:11 AM 2/17/2004, you wrote: From:"Matthews" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sujbect: [fpc-pascal] Weird DosError values Date sent: Mon, 16 Feb 2004 18:06:13 -0500 Hello Lukas > I'm using a function and a procedure, both which deal > with finding files in > the same directory, and then either counting them, or > reading them, but I'm > getting some very weird values for DosError. I'm using > v1.0.10, and I > continue to get a value of 183 from DosError in the . . We'd probably need little bit more information from you. First of all, your code snippet isn't directly compilable as it is now - it isn't even completely clear which FindFirst function is being used (my guess is that one from SysUtils because of the TSearchRec type used, but on the other hand you're using DosError as well, which is relevant to FindFirst from unit Dos). Second, it would be definitely useful to know the target you're compiling for (GO32v2?, ???) and the operating system you're running on. Regarding your code - well, I'd definitely suggest to use something like while..do or repeat..until instead of your use of goto construct. Best regards Tomas -- VOLNY klub: Modemisti vseho druhu, spojte se! http://klub.volny.cz ___ 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
Re: [fpc-pascal] Weird DosError values
> Thanks for your advice. > > My apologies for not providing enough information - I realized after I sent > the message that I should have mentioned what OS, etc. I was running. > > I'm running Win 2000, and using sysutils, and dos - could that be the problem? > > The target os (as given to my by DevPascal 1.9.2) is Win32 for i386. > > However, I downloaded the 1.9.2 w32 version of FreePascal, and the program > compiled fine, and hasn't given me any errors since (no odd DosError > values). Thanks for your suggestion on resolving the use of goto. I'll > implement that soon. > > One question: In the future, should I just host my code on geocities (or > something) and then include a link to it instead? How large is your buffer? Do you try to read 2/4/8k blocks ? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]TDatabase, TDataset, Mysql
Greetings. I am new to Pascal, and FPC. I am curious how I can learn more about using TDatabase and TDataset in conjunction with MySQL, if that's even possible. I have only seen references to these classes and am not certian what they accomplish, or their interface, only that they are used for database programming. Thanks, Jeremy ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]My object function is overriding real function
Greetings. I have a object that connects to a speech server, festival. In my object, I define a function called close. This must close the socket connection, which is done by the function close. Therefore, I am having a problem, because simply calling close with the sin and sout parameters results in an error because it is calling my objects close function which takes no parameters. How can I call a function that is not part of my object, but has the same name as one of my object functions? Here is my simple code, for example: function TFestival.Open(host : string; port : integer) : integer; var h : THost; addr : TInetSockAddr; begin h.NameLookup(host); if h.LastError <> 0 then begin Open := 1; Exit; end; addr.family := AF_INET; addr.port := ShortHostToNet(port); addr.addr := HostTonet(longint(h.IPAddress)); sock := Socket(AF_INET, SOCK_STREAM, 0); if Not Connect(sock, addr, sin, sout) then begin Open := 2; Exit; end; rewrite(sout); reset(sin); Open := 1; end; procedure TFestival.Close(); begin close(sin); close(sout); Close := 0; end; I realize that I can simply rename my close procedure but I imagine that I will run into similar situations as I continue to use Free Pascal. Thank you for your help, Jeremy ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]RE: Defining Records on the fly:
You can also define a function that returns the record you need: function NewMyRec( X, Y : double ) : TMyRec; begin NewMyRec.x := X; NewMyRec.y := Y; end; I think it's really better than declare a new variable and initialize it by the code. if CheckPoint(NewMyRec(1.2, 2.2)) then ... Be well... Jeff Pohlmeyer wrote: Since Free Pascal supports function overloading, you could do something like this: Function CheckPoint(X, Y:real): Boolean; Begin {Does something here..} end; Function CheckPoint(aPoint: tMyRec): Boolean; Begin Result:=CheckPoint(aPoint.X, aPoint.Y); end; // So you can use it either way: var MyRec:tMyRec; begin if CheckPoint(MyRec) then {do stuff}; if CheckPoint(1.2, 2.2) then {do more stuff}; end; Here is why I was wondering why you couldn't, say I have this type: Type tMyRec = Record X, Y : Real; End; And I have this function: Function CheckPoint(aPoint: tMyRec): Boolean; Begin {Does something here..} end; begin CheckPoint((X:1.2;Y:2.2)); end. __ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Adam Victor Nazareth Brandizzi Estudante de Ciência da Computação - UnB e-mails: [EMAIL PROTECTED], [EMAIL PROTECTED] ICQ: 168537710 Jaber: bardo0 (users.jabber.org) ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]My object function is overriding real function
If the function you wish to call is apart of another unit you can call i.g.: UnitName.Close(sin); UnitName.Close(sout); ** That may work from within the same unit but I'm not certain. ** Free pascal is great about name spaces and allowing you to specify which function you wish to call. On Wed, 2004-02-18 at 20:50, Jeremy Cowgar wrote: > Greetings. > > I have a object that connects to a speech server, festival. In my > object, I define a function called close. This must close the socket > connection, which is done by the function close. Therefore, I am having > a problem, because simply calling close with the sin and sout parameters > results in an error because it is calling my objects close function > which takes no parameters. > > How can I call a function that is not part of my object, but has the > same name as one of my object functions? Here is my simple code, for > example: > > function TFestival.Open(host : string; port : integer) : integer; > var > h : THost; > addr : TInetSockAddr; > begin > h.NameLookup(host); > if h.LastError <> 0 then > begin > Open := 1; > Exit; > end; > > addr.family := AF_INET; > addr.port := ShortHostToNet(port); > addr.addr := HostTonet(longint(h.IPAddress)); > > sock := Socket(AF_INET, SOCK_STREAM, 0); > if Not Connect(sock, addr, sin, sout) then > begin > Open := 2; > Exit; > end; > > rewrite(sout); > reset(sin); > > Open := 1; > end; > > procedure TFestival.Close(); > begin > close(sin); > close(sout); > > Close := 0; > end; > > I realize that I can simply rename my close procedure but I imagine that > I will run into similar situations as I continue to use Free Pascal. > > Thank you for your help, > > Jeremy > > > > ___ > 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
Re: [fpc-pascal]RE: Defining Records on the fly:
^_^ Thats how its working at the moment and I've known that FPC doesn't do that kinda definition on the fly. My real question was why not? On Wed, 2004-02-18 at 21:34, Adam Victor Nazareth Brandizzi wrote: > You can also define a function that returns the record you need: > > function NewMyRec( X, Y : double ) : TMyRec; > begin >NewMyRec.x := X; >NewMyRec.y := Y; > end; > > I think it's really better than declare a new variable and initialize it > by the code. > > if CheckPoint(NewMyRec(1.2, 2.2)) then ... > > Be well... > > Jeff Pohlmeyer wrote: > > >Since Free Pascal supports function overloading, > >you could do something like this: > > > > > >Function CheckPoint(X, Y:real): Boolean; > >Begin > > {Does something here..} > >end; > > > > > >Function CheckPoint(aPoint: tMyRec): Boolean; > >Begin > > Result:=CheckPoint(aPoint.X, aPoint.Y); > >end; > > > > > >// So you can use it either way: > > > >var > > MyRec:tMyRec; > >begin > > if CheckPoint(MyRec) then {do stuff}; > > if CheckPoint(1.2, 2.2) then {do more stuff}; > >end; > > > > > > > > > >>Here is why I was wondering why you couldn't, say I have this type: > >>Type tMyRec = Record X, Y : Real; End; > >> > >>And I have this function: > >> > >>Function CheckPoint(aPoint: tMyRec): Boolean; > >>Begin > >> {Does something here..} > >>end; > >> > >>begin > >> CheckPoint((X:1.2;Y:2.2)); > >>end. > >> > >> > > > > > >__ > >Do you Yahoo!? > >Yahoo! Mail SpamGuard - Read only the mail you want. > >http://antispam.yahoo.com/tools > > > >___ > >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
Re: [fpc-pascal] Weird DosError values
Marco: I'm using 1k blocks. -Lukas At 04:29 PM 2/18/2004, you wrote: How large is your buffer? Do you try to read 2/4/8k blocks ? ___ 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
Re: [fpc-pascal]My object function is overriding real function
> procedure TFestival.Close(); > begin > close(sin); > close(sout); > > Close := 0; > end; > > I realize that I can simply rename my close procedure but I imagine that > I will run into similar situations as I continue to use Free Pascal. Use explicit namespacing: System.Close(sin) ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Convert C to Pascal
Hallo, i know this is not exactly question to this maillist but maybe somebody could help me how can i convert only the following definition of "reg_drq_block_call_back" into FPC Pascal notation: void ( * reg_drq_block_call_back ) ( struct REG_CMD_INFO * ); where definition is struct REG_CMD_INFO { unsigned char cmd; ... etc. } ; struct REG_CMD_INFO reg_cmd_info; ("struct" is simply converted to "record", that is not the problem) Lubomir Cabla http://www.freewebs.com/hdat2/ ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Convert C to Pascal
> Hallo, > > i know this is not exactly question to this maillist but > maybe somebody could help me how can i convert only the following > definition of "reg_drq_block_call_back" into FPC Pascal notation: > > void ( * reg_drq_block_call_back ) ( struct REG_CMD_INFO * ); > > where definition is > > struct REG_CMD_INFO > { >unsigned char cmd; >... etc. > } ; > > struct REG_CMD_INFO reg_cmd_info; > > ("struct" is simply converted to "record", that is not the problem) Pascal style: type REG_CMD_INFO = record cmd : byte; end; reg_drq_block_call_back = procedure(var r:REG_CMD_INFO); or more close to C style with pointers: type REG_CMD_INFO = record cmd : byte; end; REG_CMD_INFO = ^REG_CMD_INFO; reg_drq_block_call_back = procedure(pr:PREG_CMD_INFO); ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal