diff anagram/support/file.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/support/file.h	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,50 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 2006 David A. Holland. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * file.h - canonicalized interface to files.
+ *
+ * This module provides a common subset of Unix file handles and their
+ * DOS/Windows imitations, as well as some related functions.
+ */
+
+#ifndef FILE_H
+#define FILE_H
+
+#include <time.h>
+#include "port.h"
+
+class AgString; // #include "agstring.h"
+
+
+#ifdef AG_ON_UNIX
+
+#include <unistd.h>
+#define O_TEXT   0
+#define O_BINARY 0
+#define PATH_DELIMITER '/'
+
+inline off_t tell(int fd) { return lseek(fd, 0, SEEK_CUR); }
+
+#endif /* AG_ON_UNIX */
+
+
+
+#ifdef AG_ON_WINDOWS
+
+#include <io.h>
+#define PATH_DELIMITER '\\'
+
+#endif /* AG_ON_WINDOWS */
+
+
+int open_shared_denywrite(const char *path, int openflags);
+int open_shared_any(const char *name, int openflags);
+
+extern AgString work_dir_name;
+void set_work_dir(void);
+
+time_t getFileTimestamp(const char *name);
+
+#endif /* FILE_H */