comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 2006 David A. Holland. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * file.h - canonicalized interface to files.
7 *
8 * This module provides a common subset of Unix file handles and their
9 * DOS/Windows imitations, as well as some related functions.
10 */
11
12 #ifndef FILE_H
13 #define FILE_H
14
15 #include <time.h>
16 #include "port.h"
17
18 class AgString; // #include "agstring.h"
19
20
21 #ifdef AG_ON_UNIX
22
23 #include <unistd.h>
24 #define O_TEXT 0
25 #define O_BINARY 0
26 #define PATH_DELIMITER '/'
27
28 inline off_t tell(int fd) { return lseek(fd, 0, SEEK_CUR); }
29
30 #endif /* AG_ON_UNIX */
31
32
33
34 #ifdef AG_ON_WINDOWS
35
36 #include <io.h>
37 #define PATH_DELIMITER '\\'
38
39 #endif /* AG_ON_WINDOWS */
40
41
42 int open_shared_denywrite(const char *path, int openflags);
43 int open_shared_any(const char *name, int openflags);
44
45 extern AgString work_dir_name;
46 void set_work_dir(void);
47
48 time_t getFileTimestamp(const char *name);
49
50 #endif /* FILE_H */