From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 8B293BB83 for ; Fri, 18 Aug 2006 23:00:17 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7IL0Hud003282 for ; Fri, 18 Aug 2006 23:00:17 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA11595 for ; Fri, 18 Aug 2006 23:00:16 +0200 (MET DST) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7IL0G5h003280 for ; Fri, 18 Aug 2006 23:00:16 +0200 Received: by nf-out-0910.google.com with SMTP id y38so1700567nfb for ; Fri, 18 Aug 2006 14:00:16 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=rMbuQ5Kn2U3nDhdX+W0uoat16R7MxhbM6j/RSYDNDaPkNwlIwJjDdWlZbMc/fnnxxNCL73f6M1WMxITvZWHa7srcWEq8S4P/GvGCLceM3F8bUTadl+/LX7IxspxuUssX5N2nfjwa4+Hh5x0tQEkk1Jbz+MEoYkqLWAlna4pifJk= Received: by 10.49.29.2 with SMTP id g2mr4542658nfj; Fri, 18 Aug 2006 14:00:16 -0700 (PDT) Received: by 10.78.158.8 with HTTP; Fri, 18 Aug 2006 14:00:16 -0700 (PDT) Message-ID: Date: Fri, 18 Aug 2006 14:00:16 -0700 From: "Nathaniel Gray" To: malc Subject: Re: [Caml-list] Help interfacing with C Cc: "Caml List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Spam: no; 0.00; interfacing:01 malc:01 malc:01 pulsesoft:01 fdlist:01 pairs:01 fdset:01 fdlist:01 fdset:01 newres:01 val:01 newres:01 val:01 pairs:01 cheers:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 On 8/16/06, malc wrote: > On Wed, 16 Aug 2006, Nathaniel Gray wrote: > > > Hi folks, > > > > I'm having a heck of a time figuring out why this code *doesn't* work: > > > > /* fdlist is a list of (file_descr * 'a) pairs. Filter by FD_ISSET */ > > static value fdset_to_fdlist2(value fdlist, fd_set *fdset) > > { > > value l, p, newres; > > value res = Val_int(0); > > > > Begin_roots4(l, p, res, newres); /* I know, this is aggressive */ > > for (l = fdlist; l != Val_int(0); l = Field(l, 1)) { > > p = Field(l, 0); > > int fd = Int_val(Field(p, 0)); > > This here (expanded) does Int_val (Field (Field (l, 0), 0)) > > > > > int fd = Int_val(Field(l, 0)); > > > > I think the difference is self-evident. Indeed, it's the entire point of the exercise. In the first version l is a list of (fd, 'a) pairs, in the second it's a list of fds. Cheers, -n8 -- >>>-- Nathaniel Gray -- Caltech Computer Science ------> >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->