summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-05 22:23:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-05 22:23:35 -0700
commit303103f9a2fa0837a4613a5ad57f7f1ca2f1d61b (patch)
treef8ec6aec551383a49e1f3497ca2f040c418daf8c /lisplib.c
parentad8319e7f8f09d328e37374fe0e71c64782fd9aa (diff)
downloadtxr-303103f9a2fa0837a4613a5ad57f7f1ca2f1d61b.tar.gz
txr-303103f9a2fa0837a4613a5ad57f7f1ca2f1d61b.tar.bz2
txr-303103f9a2fa0837a4613a5ad57f7f1ca2f1d61b.zip
New filesystem object testing functions.
* lisplib.c (path_test_set_entries, path_test_instantiate): New static functions. (dlt_register): Registered new functions to dl_table. * txr.1: Documented new functions. * share/txr/stdlib/path-test.tl: New file.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lisplib.c b/lisplib.c
index 8bb5816e..699d076e 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -140,6 +140,30 @@ static val with_resources_instantiate(val set_fun)
return nil;
}
+static val path_test_set_entries(val dlt, val fun)
+{
+ val name[] = {
+ lit("path-exists-p"), lit("path-file-p"), lit("path-dir-p"),
+ lit("path-symlink-p"), lit("path-blkdev-p"), lit("path-chrdev-p"),
+ lit("path-sock-p"), lit("path-pipe-p"), lit("path-pipe-p"),
+ lit("path-setgid-p"), lit("path-setuid-p"), lit("path-sticky-p"),
+ lit("path-mine-p"), lit("path-my-group-p"), lit("path-executable-to-me-p"),
+ lit("path-writable-to-me-p"), lit("path-newer"), lit("path-older"),
+ lit("path-same-object"),
+ nil
+ };
+
+ set_dlt_entries(dlt, name, fun);
+ return nil;
+}
+
+static val path_test_instantiate(val set_fun)
+{
+ funcall1(set_fun, nil);
+ load(format(nil, lit("~a/path-test.tl"), stdlib_path, nao));
+ return nil;
+}
+
val dlt_register(val dlt,
val (*instantiate)(val),
val (*set_entries)(val, val))
@@ -156,6 +180,7 @@ void lisplib_init(void)
dlt_register(dl_table, ifa_instantiate, ifa_set_entries);
dlt_register(dl_table, txr_case_instantiate, txr_case_set_entries);
dlt_register(dl_table, with_resources_instantiate, with_resources_set_entries);
+ dlt_register(dl_table, path_test_instantiate, path_test_set_entries);
}
val lisplib_try_load(val sym)