%%HP: T(3)A(D)F(.);
@ HIDER, by Marc E Blair
DIR
  NORMAL
    \<<
      IF PATH { HOME } \=/
      THEN NULL PURGE
      END
    \>>
  HIDE
    \<<
      IF DUP TYPE 6 ==
      THEN 1 \->LIST
      END \-> L
      \<< VARS L SIZE 1 SWAP
        FOR A L A GET DELIT
        NEXT
        IF PATH { HOME } \=/
        THEN PATH NULL STO NULL 1 \->LIST + ORDER
        ELSE DROP "NOT ALLOWED AT HOME" DOERR
        END
      \>>
    \>>
  ALL
    \<< VARS DUP SIZE NULL RCL \-> S A
      \<< NULL
        IFERR PURGE
        THEN DROP
        ELSE A NULL RCL
          IF SAME NOT
          THEN VARS A NULL STO SWAP 
            IFERR ORDER
            THEN DROP
            END DUP 1 S SUB SWAP DUP SIZE S 1 + SWAP SUB NULL SWAP + +
          END
        END
      \>>
    \>>
  HIDEN
    \<< ALL DUP DUP NULL POS
      IF DUP 0 \=/
      THEN 1 + SWAP SIZE SUB
        IFERR NULL RCL DROP
        THEN DROP { }
        ELSE
          IF PATH { HOME } \=/
          THEN NULL SWAP +
          ELSE DROP { }
          END
        END
      ELSE 3 DROPN { }
      END
    \>>
  NULL
    \<< # 15777h SYSEVAL
    \>>
  SPACE
    \<< " " # 5B15h SYSEVAL
    \>>
  DELIT
    \<< OVER SIZE \-> S
      \<< DUP2 POS \-> A
        \<<
          IF A 0 \=/
          THEN
            IF S 1 ==
            THEN DROP2 { }
            ELSE
              IF A 1 ==
              THEN SWAP 2 S SUB SWAP DROP
              ELSE
                IF A S ==
                THEN SWAP 1 S 1 - SUB SWAP DROP
                ELSE SWAP DUP 1 A 1 - SUB SWAP A 1 + S SUB + SWAP DROP
                END
              END
            END
          ELSE DROP
          END
        \>>
      \>>
    \>>
  KEYSTO
    \<< { S
      \<<
        IFERR { } SWAP DUP
          IF TYPE 5 ==
          THEN DUP SIZE
          ELSE 1 \->LIST 1
          END 1 SWAP
          FOR A DUP A GET RCL
            IF TYPE 15 ==
            THEN
              IF DUP A GET RCL BYTES SWAP DROP 6.5 ==
              THEN 1
              ELSE 0
              END
            ELSE 1
            END
            IF
            THEN DUP A GET PURGE
            ELSE DUP A GET ROT SWAP + SWAP
            END
          NEXT DROP
          IF DUP { } \=/
          THEN \->STR "\010Non-empty directory" + DOERR
          ELSE DROP
          END
        THEN
          IF { } ==
          THEN "Too Few Arguments"
          ELSE DROP2 "Not Purgeable"
          END DOERR
        END
      \>> 54.2
      \<<
        IF PATH { HOME } \=/
        THEN # 15777h SYSEVAL PURGE
        END VARS "HIT PURGE" 1 DISP 1 FREEZE
      \>> 54.3 } STOKEYS
    \>>
END
