From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Catonano Newsgroups: gmane.lisp.guile.user Subject: Re: unsigned-int Date: Thu, 22 Jun 2017 21:13:39 +0200 Message-ID: References: <87efuchu4b.fsf@netris.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1498158861 11649 195.159.176.226 (22 Jun 2017 19:14:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 22 Jun 2017 19:14:21 +0000 (UTC) Cc: guile-user@gnu.org To: Mark H Weaver Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jun 22 21:14:15 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dO7YT-0002aX-D5 for guile-user@m.gmane.org; Thu, 22 Jun 2017 21:14:13 +0200 Original-Received: from localhost ([::1]:60585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dO7YY-0006JA-KM for guile-user@m.gmane.org; Thu, 22 Jun 2017 15:14:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dO7Xz-0006HX-08 for guile-user@gnu.org; Thu, 22 Jun 2017 15:13:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dO7Xx-0004FL-MM for guile-user@gnu.org; Thu, 22 Jun 2017 15:13:42 -0400 Original-Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:34722) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dO7Xx-0004Ej-Am for guile-user@gnu.org; Thu, 22 Jun 2017 15:13:41 -0400 Original-Received: by mail-wr0-x235.google.com with SMTP id 77so36187221wrb.1 for ; Thu, 22 Jun 2017 12:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/PmbK8lxjwY7MZL/jsZZLLC7dkS1QReBPSxqbYDtZYk=; b=LIYd87f82JGDweihWetgFWmf5QrkOkszjfF2E/dYZBORz5fpyGTOyReY9f8zL9ckFm 1Sq226hijtTqAoXErLxw3gwGFxIZFnvT7+owecREFrz8s4A7Q1c3q1+XSPJBLfpxc31C U2M2SmKSdJekXywFxF25Nyz4/gInPc1Wga8f55mONS3N1JHRYIOWn125uaf6mBbZoVAB OBjaSX03X+urXz53barzuuSSv39sybuDLJ/GNgDA1gvwzvs9jbKjW5IXVPFYP72/ALcg ssUvpMcIMn9ejyaPdhwB59YRGnp32narI8mmOMxGxBfCTUhAlN0gS8eWPTPiHIRlgXMF /73g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/PmbK8lxjwY7MZL/jsZZLLC7dkS1QReBPSxqbYDtZYk=; b=PJLH5uNhlgMCzFD66HlVTtoOXYm9xVLDbkN0PFnmG0I14f57vdr2WR6VozVwzpdkGt TFR0x9gApydzvfrDlOevN69kyu4HvTDLbXTnPawI8G7QLbzXh5aUtYx8SKV3HBMLK4r3 Z+EbA+U9sRnItUTVmifVCXaPYhxDi0rHiWUk1cepiYjBI5KLo7HFmsMdFfFP6UdlkRma h0xdWp9kGNW0GGVtSam/hX8LU7Tg5VNUrgX1gZEu//WNn6TqX94ylF2Lhn05PGyPqM9o vtMZMHKzNKisU4AlkPNbKfIXV4ahQ32tf6hrSbQPOw+nRIyjg1edzPb5UkMOkPRC+Sku Kf7Q== X-Gm-Message-State: AKS2vOwWVvKjw7Cc7+YzEqSCXspB6KVuMODC27tbORPYKsp43RBy3vNC 2J+AERh5KJAb4vgKb9F0eOmfr+u8dA== X-Received: by 10.80.137.36 with SMTP id e33mr3747949ede.67.1498158820293; Thu, 22 Jun 2017 12:13:40 -0700 (PDT) Original-Received: by 10.80.131.4 with HTTP; Thu, 22 Jun 2017 12:13:39 -0700 (PDT) In-Reply-To: <87efuchu4b.fsf@netris.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::235 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13867 Archived-At: 2017-06-22 18:20 GMT+02:00 Mark H Weaver : > Catonano writes: > > > I can't extract correct values from unsigned-int's > > > > I can extract correct values from int, unsigned-short > > > > but NOT form an unsigned-int > > > > In that case the number that comes out is plainly wrong > > > > This is how I extract a number from an int (and it works) > > > > (bytevector-uint-ref (pointer->bytevector > > outcome-ptr (sizeof int)) 0 > > (endianness big) 1) ) > > You need to use 'bytevector-int-ref', not 'bytevector-uint-ref', to > extract a signed integer. > I am extracting an unsigned-int here. (sizeof int) and (sizeof unsigned-int) happen to be te same > > > This is an unsigned-short (and it works) > > > > (bytevector-uint-ref (pointer->bytevector > > columns-ptr (sizeof unsigned-short)) 0 > > (endianness big) 1) > > > > This is an unsigned-int and it DOESN'T work > > > > (bytevector-uint-ref (pointer->bytevector > > rows-ptr (sizeof unsigned-int)) 0 > > (endianness big) 1) > > There's also a problem with all three of your examples above. You're > passing '1' as the final argument to 'bytevector-uint-ref'. That's the > width in bytes of the numeric field to access. In all cases, those 1s > should be replaced with (sizeof ). > Ah. I had misunderstood the signature of bytevector-*-ref Fixed. > Also, I'm not sure why you're specifying (endianness big) here. I just attempted with (endianness big). It worked, so I assumed it had to be right > I would > think (native-endianness) would be appropriate here. Ah ! I hadn't noticed (native-endianness) existed ! Fixed > Given this, and > the fact that you're passing the wrong width, makes me surprised that > this is working for you at all. Mark, thank you so much for your review. I appreciate that I apologize if my questions are naive. I wrote my last scrap of C code in about 2004 and it never was my thing Also the manual is a great reference but not a great tutorial and I'm not a great reader, probably. Still I'd like to use guile-freexl to extract data from a bunch of xls files and store such data in a Postgresql db. I believe that this could be useful to other guilers too Last time I used a Clojure wrap around an Apache Foundation Java library. But guile-freexl would be free software ! So, yeah, I'm sorry for the fuss All that said, I applied the fixes that you suggested and I still get completely wrong number of rows of the spreadsheets and correct number of columns Exactly as before your correctons So maybe this thingie of mine could use some further attention. Thanks again