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

Re: forked files?



In article <Pine.SUN.3.91.960201135216.21961B-100000@sunspot.tiac.net>,
Programer  <progrmer@tiac.net> wrote:
> On 27 Jan 1996, Adalbert Goertz wrote:
> 
> > 1) What are forked files?

In a forked file, there are two "forks": the "data fork" and the
"resource fork".  They are stored within a single file, but are
effectively two separate data streams.  For example, when a program
wishes to access both of the forks in a forked file, it has to open
and access them separately.

This is mostly hidden from the user - the only time most people come
across this is if they try to do something with a forked file in
ProDOS-8, which cannot handle them.

The data fork and resource fork serve different purposes.  The data
fork usually contains the main set of data associated with the file,
e.g. the text for a text or Teach file, the code for an application
(on the IIgs, at least), etc.

The resource fork is stored in a specific format that contains any
number of "resources".  Each resource has an identifying type, which
specifies what sort of data is stored in the resource, and an
identification number.

The specific resources that can appear in a file vary according to the
file type.  Some resources can be used in any file.  For example, any
file can have a "version" resource, which is displayed by Finder when
you use the Icon Info command.  Similarly, a couple of "comment"
resources are allowed in any file: one is a general comment that can
be used to describe the file (Finder also shows this in Icon Info), and
the other is for Finder to display if it cannot find an application for
the file.

In a Teach file, the resource fork holds information such as the
document ruler, style information for the text, and the window position.

In an application, the resource fork can contain any data that the
application author wants to put there.  It will usually include
information on the toolsets required by the application, the structure
of the application's menus, alerts, windows, etc., and most of the
text displayed by the application.

Some types of file don't use the data fork at all - they store all
their information in the resource fork.  A Control Panel (CDEV) is an
example of this.  Even the code for a CDEV is stored in a resource.

> Files on the IIgs that have a Resource fork like on the Macintosh.

Note that the internal structure of the data in the IIgs and Mac
resource forks are quite different.  The IIgs Resource Manager cannot
handle Macintosh resource forks, and the Macintosh Resource Manager
cannot handle IIgs resource forks.

The Mac and IIgs can copy files with a resource fork for the other
computer, because copying the fork doesn't require any interpretation
of the content of the fork.

> > 2) what versions of GS/OS can/cannot handle forked files?
> 
> definatly v5.0 and up, i believe 4.0 could copy them but did not yet have 
> a Resource Manager Toolkit yet (correct me if i'm wrong someone)...

System 4.0 is able to handle resource forks, but the version of Finder
that was included with System 4 and earlier doesn't know about them, so
it will only copy the data fork.

System 5.0 was the first version which fully supported resource forks,
including copy support in Finder, and the Resource Manager toolset for
accessing data within the resource fork.

> > 4) What are the hardware requirements for forked files?
> 
> Any Apple II ProDOS disk can have them however only the IIgs can support 
> them and copy files that are forked...(there was no room in ProDOS 8 v2.x 
> to add support for resource forks) and unless someone wrote a P8 program 
> that could handle them anything in ProDOS 8 they just give you errors...

HFS and MS-DOS disks can also support resource forks.  (On MS-DOS, it
is done by storing the resource fork in a separate file in a hidden
subdirectory at the level of the main file.)

I think they are also supported in some way on ISO-9660 and High Sierra
CD-ROMs.
-- 
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand