[openfirmware] r1521 - ofw/fs

svn at openfirmware.info svn at openfirmware.info
Sun Nov 29 01:10:18 CET 2009


Author: wmb
Date: 2009-11-29 01:10:18 +0100 (Sun, 29 Nov 2009)
New Revision: 1521

Modified:
   ofw/fs/zipfs.fth
Log:
Minor cleanup of zipfs.fth, removing unused words and adding a few comments.


Modified: ofw/fs/zipfs.fth
===================================================================
--- ofw/fs/zipfs.fth	2009-11-29 00:00:54 UTC (rev 1520)
+++ ofw/fs/zipfs.fth	2009-11-29 00:10:18 UTC (rev 1521)
@@ -103,12 +103,14 @@
 \ ID of the header that's currently in the buffer
 -1 instance value header-id
 
+external
 : load  ( adr -- len )
    0. seek drop
    dup image-size read    ( adr len )
    tuck  ?crc             ( len )
 ;
 
+headers
 : read-magic  ( id -- adr )
    -1 to header-id                     ( id )
    u>d seek drop                       ( id )
@@ -177,14 +179,6 @@
    4 +  /end-header +               ( id' )
    eh-comlen le-w@ +                ( id' )  \ Skip comment
 ;
-: dirent?  ( id -- id flag )
-   dup  header-id =  if  false exit  then  ( id )
-   dup read-magic                       ( id )
-   zip-buffer  " PK"(01 02)" comp   if  ( id )
-      false exit
-   then
-   zip-buffer /central read drop        ( id )
-;
 
 : first-dir-header  ( -- false | id true )
    first-file-header  0=  if  false exit  then
@@ -232,12 +226,6 @@
        h# fe00 and  9 >> d# 1980 + ( day month year )
 ;  
 
-: next-header-ok?  ( id -- flag )
-   +file u>d seek drop  zip-magic  2 read        ( len )
-   zip-magic swap  " PK" $=
-;
-
-
 : set-prefix  ( adr len -- )
    to prefix-len
    path-prefix prefix-len move
@@ -312,6 +300,9 @@
    find-file  0=  if  true exit  then
    link-target
 ;
+
+\ Find the link target for the current directory entry and
+\ if it is relative, prefix it with the current entry's path
 : chase-link  ( -- true | name$ false )
    zip-name$  [char] / right-split-string  set-prefix
    link-target  if  true exit  then   ( link$ )
@@ -336,8 +327,6 @@
    repeat                                 ( )
    false                                  ( false )
 ;
-
-
 : final-component  ( -- flag )
    dir?  if                                ( )
       zip-name$ set-prefix  true           ( true )
@@ -352,6 +341,17 @@
       false                                ( false )
    then                                    ( flag )
 ;
+\ Determine if the current path name matches the path prefix
+: in-directory?  ( -- flag )
+   prefix-len 0=  if  true exit  then  \ No prefix - return true
+
+   \ If the path name is shorter than the prefix, it doesn't match
+   \ The = in <= filters out the name of the directory itself
+   name-len prefix-len <=  if  false exit  then
+
+   zip-name prefix$ comp 0=
+;
+
 external
 : open  ( -- flag )
    -1 to image-size  0 to offset
@@ -367,17 +367,6 @@
 ;
 : close  ( -- )  ;
 
-\ Determine if the current path name matches the path prefix
-: in-directory?  ( -- flag )
-   prefix-len 0=  if  true exit  then  \ No prefix - return true
-
-   \ If the path name is shorter than the prefix, it doesn't match
-   \ The = in <= filters out the name of the directory itself
-   name-len prefix-len <=  if  false exit  then
-
-   zip-name prefix$ comp 0=
-;
-
 : next-file-info  ( id -- false | id' s m h d m y len attributes name$ true )
    begin  another-file?  while             ( id' )
       in-directory?  if                    ( id )




More information about the openfirmware mailing list