[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] set-file-position! only works with fixnums

From: Kon Lovett
Subject: Re: [Chicken-users] set-file-position! only works with fixnums
Date: Thu, 1 Oct 2009 18:57:14 -0700

On Oct 1, 2009, at 12:27 AM, John Cowan wrote:

Thomas Bushnell BSG scripsit:

I think this is a mistake, but "fixing" it is harder than it seems.

Really, this is totally non-schemey.

The criterion should be an exact integer, just as it is for arrays.
Instead of allowing inexact integers to be file positions, how about
extending the hierarchy to handle these cases directly?

Well, in order for that to work you have to persuade Felix to incorporate
bignums in the core, and they can't be GMP bignums either because of
the licensing -- that would make Chicken as a whole GPL, and that's not
gonna happen.  Making all that happen is what is harder than it seems.

Possible is adding a int64_t heap type. But involves hitting every piece of code that any extension of the core number system would.

Indexing arrays with fixnums is no problem, because Chicken won't let
them be bigger than 2^24 elements anyhow, and fixnums go up to 2^32 - 1.
The sizes of files isn't under Chicken's control, but 2^53 is plenty
big enough for a long time to come.

Changed posixunix to use fseeko, ftello and treat lseek as taking & returning an off_t. It will use the 'long' forms when _POSIX_V6_ILP32_OFF32 is defined. (Only tested with MacOS 10.5)

Changed posixwin to use _fseeki64, _ftelli64 and _lseeki64.

Note: 'file-position' now ONLY returns integer flonums!

There is a test for flonum offsets.

It was impossible to inveigle           John Cowan <address@hidden>
Georg Wilhelm Friedrich Hegel 
Into offering the slightest apology
For his Phenomenology. --W. H. Auden, from "People" (1953)

Best Wishes,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]