Re: [fpc-devel] the libc unit on 64-bit systems
Op Thu, 31 Jan 2008, schreef Graeme Geldenhuys: Wow you guys reply quickly. :) The above code doesn't look nice either, so I think I will rather implement a alternative. (Daniel's is better, I still have the habit to make 1.0.x compat defines, while not necessary anymore) All I really use 'libc' for is to retrieve the user name and group name from the user and group id's of files. As I said, it's not critical, I can always display the id's only. Or maybe parse the /etc/groups and /etc/passwd files to get the names, but I heard that's not very accurate for some reason. Thanks again Marco and Dani?l for the quick replies! Rather than use the libc unit, you might want to declare getpwent in your own code; a few naming service procedures are a whole lot easier to keep portable than the entire libc unit. If 2.3.1 for Linux one can probably use package users. I plan to update this coming weekend to BSD compability. (the group part is mostly done already). Afaik 2.2.0 has this package too, but it wasn't compiled till the recent package restructure (Which will be merged to 2.2 in the coming weeks somewhere) This doesn't guarantee you anything (getpwent could well be a macro on a random unix), Not uncommon even, since some only have the _r variant iirc. but it wouldn't be that much work to make it work on the known Unixes. Better focus that to an area where all benefit. This abstraction is simple to do, and often needed. However all people till now blindly grab libc or hack their own, and refuse to invest time in the general units. I hope that the reviving of the (Michael abandonware) users package will start this proces. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] the libc unit on 64-bit systems
On 31/01/2008, Daniël Mantione [EMAIL PROTECTED] wrote: If so, how can I IFDEF code that needs to run on Linux (32 64 bit) {$if defined(linux) and defined(i386)} Just to let you know Daniël, that doesn't work for Linux 32-bit systems, but the idea is correct. It should read. {$if defined(linux) and defined(cpu386)} Thanks again... Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] more descriptive parameter names for C translated headers
Zitat von Graeme Geldenhuys [EMAIL PROTECTED]: Hi, I use the xlib.pp unit a lot. As far as I understand it and many others like it was created with a automated tool. As I use the functions, I thought I could start changing the para1, para2... to more descriptive parameter names. This makes it much easier to code if you use something like Lazarus that gives function declaration hints etc.. It will not affect/break anybody's code if I start making those changes, but I would like to get the correct naming convention going... I'm only doing this once! :) Here's the original declaration: function XSetSelectionOwner(para1:PDisplay; para2:TAtom; para3:TWindow; para4:TTime):cint;cdecl;external libX11; what should the new parameters look like Delphi / standard Object Pascal style: 1) function XSetSelectionOwner(ADisplay:PDisplay; ASelection:TAtom; AOwner:TWindow; ATime:TTime):cint;cdecl;external libX11; or maybe 2) function XSetSelectionOwner(display:PDisplay; selection:TAtom; owner:TWindow; time:TTime):cint;cdecl;external libX11; My preference is 1). What's your thoughts? Parameter names are needed by many headers. Why not write a tool, that does it semi-automatically? Give it the c file with nice parameter names and the pascal unit and it replaces para* with the c names. This tool could be useful here: http://wiki.lazarus.freepascal.org/Creating_bindings_for_C_libraries#Future_work_.2F_Missing_stuff Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] more descriptive parameter names for C translated headers
Hi, I use the xlib.pp unit a lot. As far as I understand it and many others like it was created with a automated tool. As I use the functions, I thought I could start changing the para1, para2... to more descriptive parameter names. This makes it much easier to code if you use something like Lazarus that gives function declaration hints etc.. It will not affect/break anybody's code if I start making those changes, but I would like to get the correct naming convention going... I'm only doing this once! :) Here's the original declaration: function XSetSelectionOwner(para1:PDisplay; para2:TAtom; para3:TWindow; para4:TTime):cint;cdecl;external libX11; what should the new parameters look like Delphi / standard Object Pascal style: 1) function XSetSelectionOwner(ADisplay:PDisplay; ASelection:TAtom; AOwner:TWindow; ATime:TTime):cint;cdecl;external libX11; or maybe 2) function XSetSelectionOwner(display:PDisplay; selection:TAtom; owner:TWindow; time:TTime):cint;cdecl;external libX11; My preference is 1). What's your thoughts? Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] more descriptive parameter names for C translated headers
On 01/02/2008, Mattias Gärtner [EMAIL PROTECTED] wrote: My preference is 1). What's your thoughts? Parameter names are needed by many headers. Why not write a tool, that does it semi-automatically? Give it the c file with nice parameter names and the pascal unit and it replaces para* with the c names. This tool could be useful here: http://wiki.lazarus.freepascal.org/Creating_bindings_for_C_libraries#Future_work_.2F_Missing_stuff Interesting idea, I'll give it a go. I might have asked this before, but why doesn't the h2pas tool put in the correct parameter names in the first place? I'm sure there must be some technical reason? :) Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] more descriptive parameter names for C translated headers
On Feb 1, 2008 6:58 PM, Graeme Geldenhuys [EMAIL PROTECTED] wrote: I might have asked this before, but why doesn't the h2pas tool put in the correct parameter names in the first place? I'm sure there must be some technical reason? :) I think that h2pas just needs to be improved. I took a look at the code while thinking about creating something similar for objective-c for the Cocoa bindings, but h2pas has a very exotic code. I think it's created with the gnu tools for automatic compiler generation, yacc. I read the code, but understood absolutely nothing =) -- Felipe Monteiro de Carvalho ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] the libc unit on 64-bit systems
All I really use 'libc' for is to retrieve the user name and group name from the user and group id's of files. As I said, it's not critical, I can always display the id's only. Or maybe parse the /etc/groups and /etc/passwd files to get the names, but I heard that's not very accurate for some reason. Really the only reliable way to get that information is to link with libc. Reading the files in /etc will work on a basic system but will fail if an alternate authentication system is in use. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] more descriptive parameter names for C translated headers
On Fri, 1 Feb 2008 19:12:19 +0100 Felipe Monteiro de Carvalho [EMAIL PROTECTED] wrote: On Feb 1, 2008 6:58 PM, Graeme Geldenhuys [EMAIL PROTECTED] wrote: I might have asked this before, but why doesn't the h2pas tool put in the correct parameter names in the first place? I'm sure there must be some technical reason? :) It does. But some c libs only provide crappy c headers. I think that h2pas just needs to be improved. I took a look at the code while thinking about creating something similar for objective-c for the Cocoa bindings, but h2pas has a very exotic code. I think it's created with the gnu tools for automatic compiler generation, yacc. I read the code, but understood absolutely nothing =) Mattias ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] ppcrossarm build fails to compile rtl and packages
From: [EMAIL PROTECTED] I'm trying to build an arm/wince cross-compiler from a Windows XP host from 2.2.1 SVN (rev 10079). I can build a working ppcrossarm.exe from the fpc source folder by: make compiler_cycle CPU_TARGET=arm OS_TARGET=wince FPC=ppc386.exe However, when I try to build the RTL and packages with the following: make -C rtl clean FPC=ppcrossarm.exe make rtl packages FPC=ppcrossarm.exe OPT=-g The process terminates at the instruction to build the package FV: Fixed now. Yury. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] the libc unit on 64-bit systems
On 01/02/2008, peter green [EMAIL PROTECTED] wrote: Really the only reliable way to get that information is to link with libc. Reading the files in /etc will work on a basic system but will fail if an alternate authentication system is in use. Yup, that's what somebody else told me as well. I must look at the GTK 1.2 file dialog's code to see what they did to overcome that issue. Otherwise simply show directories and file names only in the fpGUI File Dialog. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel