Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #24600

RESIZE-FILE - mistakes ANS made

From "Ed" <invalid@invalid.com>
Newsgroups comp.lang.forth
Subject RESIZE-FILE - mistakes ANS made
Date 2013-07-20 00:09 +1000
Organization Aioe.org NNTP Server
Message-ID <ksbh6p$8ug$1@speranza.aioe.org> (permalink)

Show all headers | View raw


RESIZE-FILE has two issues.

The first I've already mentioned:

    Ed wrote:
    > RESIZE-FILE should have gone into File-Access Extension since
    > a) not all OS support such a function and  b) it's not essential and the
    > effect can be achieved in other ways.

The other is:

        11.6.1.2147 RESIZE-FILE

        ( ud fileid -- ior )
        ...
        At the conclusion of the operation [..] FILE-POSITION returns an
        unspecified value.

I can't imagine why.

There are three possible actions following a RESIZE-FILE.

1. the position of the file-pointer doesn't matter because the file
    will be closed after truncation.

2. the position of the file-pointer doesn't matter because it will
    be changed later to some value determined by the application.

3. the position of the file-pointer should be  'ud'  because that's
    the point at which one will begin writing new data.

Typically it's scenario 3 that you'll be using.  Conveniently (and
perhaps not surprisingly) every OS I know that has a 'resize' function
leaves the file-pointer set to just the right position - at the new
end of file.

Currently an ANS Standard Program requires RESIZE-FILE be
followed by a REPOSITION-FILE

        ( ud )  2DUP  fid  DUP >R  RESIZE-FILE  THROW
                   R> REPOSITION-FILE THROW

not because you need it, but because ANS failed to specify what
was needed.

Until next time.


Back to comp.lang.forth | Previous | NextNext in thread | Find similar


Thread

RESIZE-FILE - mistakes ANS made "Ed" <invalid@invalid.com> - 2013-07-20 00:09 +1000
  Re: RESIZE-FILE - mistakes ANS made m.a.m.hendrix@tue.nl - 2013-07-19 07:55 -0700
    Re: RESIZE-FILE - mistakes ANS made Bernd Paysan <bernd.paysan@gmx.de> - 2013-07-19 22:34 +0200
    Re: RESIZE-FILE - mistakes ANS made "Ed" <invalid@invalid.com> - 2013-07-22 14:39 +1000
      Re: RESIZE-FILE - mistakes ANS made Alex McDonald <blog@rivadpm.com> - 2013-07-21 23:25 -0700
        Re: RESIZE-FILE - mistakes ANS made m.a.m.hendrix@tue.nl - 2013-07-22 01:21 -0700
          Re: RESIZE-FILE - mistakes ANS made Alex McDonald <blog@rivadpm.com> - 2013-07-22 15:00 -0700
          Re: RESIZE-FILE - mistakes ANS made "Ed" <invalid@invalid.com> - 2013-07-29 18:31 +1000
            Re: RESIZE-FILE - mistakes ANS made Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 03:36 -0500
              Re: RESIZE-FILE - mistakes ANS made "Ed" <invalid@invalid.com> - 2013-08-01 18:00 +1000
                Re: RESIZE-FILE - mistakes ANS made Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-01 03:33 -0500
      Re: RESIZE-FILE - mistakes ANS made m.a.m.hendrix@tue.nl - 2013-07-22 01:20 -0700
        Re: RESIZE-FILE - mistakes ANS made "Ed" <invalid@invalid.com> - 2013-07-24 17:56 +1000
      Re: RESIZE-FILE - mistakes ANS made Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-22 03:49 -0500
  Re: RESIZE-FILE - mistakes ANS made anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 11:40 +0000
    Re: RESIZE-FILE - mistakes ANS made "Ed" <invalid@invalid.com> - 2013-07-24 18:04 +1000

csiph-web