Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sun-barr!newstop!texsun!letni!mic!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: Xlib in perl Message-ID: <110063@convex.convex.com> Date: 8 Dec 90 05:15:03 GMT References: <1990Dec8.003846.15309@uvaarpa.Virginia.EDU> Sender: news@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 36 In article <1990Dec8.003846.15309@uvaarpa.Virginia.EDU> eichin@athena.mit.edu writes about putting Xlib into perl. Unbelievable -- only at MIT! But here some have asked for it. : On a related note, is anyone working on the problem of having :makelib (or rather, h2ph) convert 'struct' declarations to "pack" :lines, perhaps even into (something like): : sub utmp { ($line,$name,$host,$time)=unpack("A8 A8 A16 :L",$_[0]); } Not exactly, but I do think about it a lot. So does Felix Lee. My experiences with pstruct (see archives at Ohio State) have led me to believe that using perl to parse the C to do this is the wrong way. I just had an idea, maybe even an inspiration: how about that we use the STABs that 'cc -g' puts out? They're funky, but if you could get them parsed, it just might work. : There's also the issue of the filehandle itself. I can pass :the name of a filehandle into a sub by reference, but I'd like to :store it in an aggregate with the other data (particularly, I'd like :to be able to "return" it with the other data from xopendisplay.) :Filehandles are occasionally tricky to manipulate; I've particularly :noticed that one can't "local(FD);". Well, sure you can -- see question 23 in the FAQ, new this month. Saying "local(*FD)" works just fine. Sadly, you must be very careful here. You can't get at any subroutines called &FD now, NOR CAN ANY OF YOUR CHILDREN, by which I mean functions you call. Dynamic scoping, you know. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me