From cf88f5e8a4d0c7103e2c059981f45178cda216a2 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 15 Feb 2009 21:08:55 +0000 Subject: [PATCH] remove is{dir,reg,lnk,sock,fifo,blk,chr}. The vector returned by io.stat() does now contain the type in element 11. --- Nasal/io.nas | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Nasal/io.nas b/Nasal/io.nas index 1dec0a599..cea2f75f9 100644 --- a/Nasal/io.nas +++ b/Nasal/io.nas @@ -9,27 +9,6 @@ var readfile = func(file) { } -# Generates a stat() test routine that is passed the "mode" field -# (stat(...)[2]) from a stat() call (index 2), extracts the IFMT -# subfield and compares it with the given type, assumes S_IFMT == -# 0xf000. -var _gen_ifmt_test = func(fmt, ifmt) { - func(stat_mode) { - debug.warn("use of deprecated function is" ~ fmt ~ "()"); - var i = int(stat_mode / 0x1000); - return ifmt == i - int(i / 0x10) * 0x10; - } -} - - -# Generate file type test predicates isdir(), isreg(), islnk(), etc. -# Usage: var s = io.stat(filename); # nil -> doesn't exist, broken link -# if (s != nil and io.isdir(s[2])) { ... } -var ifmts = { dir:4, reg:8, lnk:10, sock:12, fifo:1, blk:6, chr:2 }; -foreach (var fmt; keys(ifmts)) - caller(0)[0]["is" ~ fmt] = _gen_ifmt_test(fmt, ifmts[fmt]); - - # Loads Nasal file into namespace and executes it. The namespace # (module name) is taken from the optional second argument, or # derived from the Nasal file's name.