[fpc-pascal]Defining Records on the fly:
If I have this type: Type tMyRec = Record X, Y: Integer; End; and can do this: Const ARec : tMyRec = (X:12; Y:25); why can't I do this? var AnotherRec: tMyRec; begin AnotherRec := (X:12; Y:25); end. ** Feel free to smack me around. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Defining Records on the fly:
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 16 February 2004 00:40, Jon D. Sawyer wrote: > Const ARec : tMyRec = (X:12; Y:25); > > why can't I do this? > > var > AnotherRec: tMyRec; > begin > AnotherRec := (X:12; Y:25); It's just the way the language is... you could do this... AnotherRec.X := 12; AnotherRec.Y := 25; or this, if i'm not mistaken... with AnotherRec do begin X := 12; Y := 25; end; with metta, Shawn Tan. -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAMJGK9KUEj/m6O5oRAgFLAJ9P8GoTc62l310Zq99F1g6RujOuwgCgsdc7 liXNcgoLQIPREr7BbN0lG6c= =u2G5 -END PGP SIGNATURE- ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]dbExpress with fpc
Michael Van Canneyt wrote: FPC supports both COM and CORBA interfaces - right ? I wouldn't have thought so. Delphi does it via compiler magic. I think fpk told me so on #fpc . An interface is a construct independent of COM or CORBA. It's just a set of methods. Delphi does allow you to use COM methods transparantly via interfaces. In principle, the same should be true for FPC. It is true ;). Added a short note to the wiki about it (Section New in 1.9.x (not yet in the docs)): http://www.freepascal.org/wiki/wiki.phtml?title=Language_related_articles (Michael, this is for the docs as well and can be removed then from the wiki :) ) ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]dbExpress with fpc
> Michael Van Canneyt wrote: > > > > > > An interface is a construct independent of COM or CORBA. It's just a set > > of methods. Delphi does allow you to use COM methods transparantly via > > interfaces. In principle, the same should be true for FPC. > > It is true ;). > > Added a short note to the wiki about it (Section New in 1.9.x (not yet > in the docs)): > http://www.freepascal.org/wiki/wiki.phtml?title=Language_related_articles > > (Michael, this is for the docs as well and can be removed then from the > wiki :) ) Is it global or local? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]dbExpress with fpc
Marco van de Voort wrote: Michael Van Canneyt wrote: An interface is a construct independent of COM or CORBA. It's just a set of methods. Delphi does allow you to use COM methods transparantly via interfaces. In principle, the same should be true for FPC. It is true ;). Added a short note to the wiki about it (Section New in 1.9.x (not yet in the docs)): http://www.freepascal.org/wiki/wiki.phtml?title=Language_related_articles (Michael, this is for the docs as well and can be removed then from the wiki :) ) Is it global or local? What do you mean with global/local? It can be changed at every place in a program/unit. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]dbExpress with fpc
> Marco van de Voort wrote: > > >>http://www.freepascal.org/wiki/wiki.phtml?title=Language_related_articles > >> > >>(Michael, this is for the docs as well and can be removed then from the > >>wiki :) ) > > > > > > Is it global or local? This: > What do you mean with global/local? It can be changed at every place in > a program/unit. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Weird DosError values
Hello all. 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 function (which is in my unit), but a DosError value of 0 from the procedure inside the main file. The code is below. Does anybody know what DosError 183 means, and if so, can I avoid this in any way? Thanks. -Lukas M. PS Does anybody have a more elegant solution to determine when there are no more files in a directory? I had to use the workaround of duplicate filenames because DosError was always 0. This is the setup: var dir_in:string; dir_out:string; Procedure Main; begin // Normally set from the command line, but dir_in and dir_out are always these values. dir_in := 'C:\2dapad\in'; // This directory has 64 files in it (all 2DAs) dir_out := 'C:\2dapad\pad'; num_files := NumberOfFiles(dir_in,'*.2da'); if num_files = 0 then EndProgram('There were no files.') // Just halts the program and writes a message on screen. else if num_files = -1 then EndProgram('Unable to open ' + dir_in) else if num_files = -2 then EndProgram('DosError in ' + dir_in); // Num_files always equals 1. GetBatchFile; end; Function NumberOfFiles(path,ext:string):longint; // Searches through the passed directory (if one is given) for files of a particular extension. // '' for ext = '*.*' // Note: This is the function that does't work (the one in my unit) var i:longint; q:longint; curr,old:string; temp:TSearchRec; ex:string; begin i := 0; curr := GetCurrentDir; if (ext = '') OR (ReplaceChrStr(ext,'.','') = ext) then ex := '*.*' else ex := ext; if path <> '' then begin GetShortName(path); if SetCurrentDir(path) = FALSE then NumberOfFiles := -1; // If there's an error, exit soon. end; FindFirst(ex,anyfile,temp); q := DosError; // Right here, this function ends, because DosError = 183. if q <> 0 then begin writeln('DosError = ' + IntToStr(q)); repeat until readkey <> ''; NumberOfFiles := -2; end; inc(i); old := temp.name; FindNext(temp); q := DosError; if (q = 0) AND (temp.name <> old) then begin inc(i); old := ''; while ((old = '') OR (DosError = 0)) AND (temp.name <> old) do begin old := temp.Name; FindNext(temp); inc(i); end; end; FindClose(temp); GetShortName(curr); if (path <> '') then SetCurrentDir(curr); NumberOfFiles := i; end; // This the function in the main file, that does work. // pads_skipped and pads_created are just global counters for number of files already dealth with. // dir_out is also set by the user. Procedure GetBatchFile; var f:tSearchRec; curr:string; i:integer; label batch_search; begin batch_search: // I know I'm bad... if name_in <> '' then last_file := ExtractFileName(name_in) else last_file := ''; curr := GetCurrentDir; GetShortName(dir_in); if SetCurrentDir(dir_in) = FALSE then EndProgram('Error: Unable to change directory from ' + GetCurrentDir + ' to ' + dir_in); i := 0; FindFirst('*.2da',anyfile,f); i := DosError; // Right here, and later, DosError is always 0. if i <> 0 then begin Log('DosError = ' + IntToStr(i)); name_in := '??_BATCH_END'; FindClose(f); GetShortName(curr); SetCurrentDir(curr); exit; end; i := 0; while (i < (pads_created + pads_skipped)) AND (DosError = 0) do // Keep going until a new file is found (the nth file in the list.) begin FindNext(f); inc(i); end; if (DosError <> 0) OR (last_file = f.Name) then begin name_in := '??_BATCH_END'; FindClose(f); GetShortName(curr); SetCurrentDir(curr); exit; end else begin GetShortName(curr); SetCurrentDir(curr); name_in := dir_in + f.Name; FindClose(f); if
[fpc-pascal]fpc and familiar linux (ipaq)
Hi, Read on the web site that fpc 1.9.3 builds itself and runs on the Zaurus. That's nice, I want to experiment wihth it on an iPAQ (which also uses an ARM CPU) and familiar Linux. Have anyone tried? Anything I should know before trying to build fpc myself for the ipaq? The ideal setup for pda development is a cross compiler, as the pda has limited ram and flash (disk) space. Does fpc supports building a cross compiler? []s, Fernando Lozano ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal