| 1 |
/* |
| 2 |
* $Id: e_mac.h 443 2006-05-30 04:37:13Z darren $ |
| 3 |
* |
| 4 |
* Copyright (c) 2001, Maarten L. Hekkelman |
| 5 |
* |
| 6 |
* Author: Maarten L. Hekkelman <[email protected]> |
| 7 |
* http://www.hekkelman.com |
| 8 |
* |
| 9 |
* This source code is released for free distribution under the terms of the |
| 10 |
* GNU General Public License. It is provided on an as-is basis and no |
| 11 |
* responsibility is accepted for its failure to perform as expected. |
| 12 |
* |
| 13 |
* Configures ctags for Macintosh environment. |
| 14 |
*/ |
| 15 |
#ifndef E_MAC_H |
| 16 |
#define E_MAC_H |
| 17 |
|
| 18 |
#define BUILD_MPW_TOOL 1 |
| 19 |
|
| 20 |
#define MACROS_USE_PATTERNS 1 |
| 21 |
#define DEFAULT_FILE_FORMAT 2 |
| 22 |
#define INTERNAL_SORT 1 |
| 23 |
#define TMPDIR "/tmp" |
| 24 |
#define NEED_PROTO_TRUNCATE 1 |
| 25 |
#define STDC_HEADERS 1 |
| 26 |
#define HAVE_CLOCK 1 |
| 27 |
#define HAVE_FGETPOS 1 |
| 28 |
#define HAVE_OPENDIR 1 |
| 29 |
#define HAVE_REMOVE 1 |
| 30 |
#define HAVE_SETENV 1 |
| 31 |
#define HAVE_STRERROR 1 |
| 32 |
#define HAVE_STRSTR 1 |
| 33 |
#define HAVE_FCNTL_H 1 |
| 34 |
#define HAVE_STDLIB_H 1 |
| 35 |
#define HAVE_STRING_H 1 |
| 36 |
#define HAVE_SYS_DIR_H 1 |
| 37 |
#define HAVE_SYS_TIMES_H 1 |
| 38 |
#define HAVE_TIME_H 1 |
| 39 |
#define HAVE_TYPES_H 1 |
| 40 |
#define HAVE_STDLIB_H 1 |
| 41 |
|
| 42 |
#include <time.h> |
| 43 |
#include <errno.h> |
| 44 |
#include <stdlib.h> |
| 45 |
#include <fcntl.h> |
| 46 |
#include <stdio.h> |
| 47 |
|
| 48 |
#include <Files.h> |
| 49 |
|
| 50 |
#if BUILD_MPW_TOOL |
| 51 |
|
| 52 |
/* |
| 53 |
The following defines are collected from various header files from some |
| 54 |
Linux distribution |
| 55 |
*/ |
| 56 |
|
| 57 |
typedef unsigned long mode_t; |
| 58 |
typedef unsigned long ino_t; |
| 59 |
typedef unsigned long dev_t; |
| 60 |
typedef short nlink_t; |
| 61 |
typedef unsigned long uid_t; |
| 62 |
typedef unsigned long gid_t; |
| 63 |
|
| 64 |
/* Encoding of the file mode. */ |
| 65 |
#define S_IFMT 0170000 /* These bits determine file type. */ |
| 66 |
|
| 67 |
/* File types. */ |
| 68 |
#define S_IFDIR 0040000 /* Directory. */ |
| 69 |
#define S_IFCHR 0020000 /* Character device. */ |
| 70 |
#define S_IFBLK 0060000 /* Block device. */ |
| 71 |
#define S_IFREG 0100000 /* Regular file. */ |
| 72 |
|
| 73 |
#define S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask)) |
| 74 |
|
| 75 |
#define S_ISDIR(mode) S_ISTYPE((mode), S_IFDIR) |
| 76 |
#define S_ISCHR(mode) S_ISTYPE((mode), S_IFCHR) |
| 77 |
#define S_ISBLK(mode) S_ISTYPE((mode), S_IFBLK) |
| 78 |
#define S_ISREG(mode) S_ISTYPE((mode), S_IFREG) |
| 79 |
|
| 80 |
struct stat { |
| 81 |
dev_t st_dev; /* Device. */ |
| 82 |
unsigned short int __pad1; |
| 83 |
ino_t st_ino; /* File serial number. */ |
| 84 |
mode_t st_mode; /* File mode. */ |
| 85 |
nlink_t st_nlink; /* Link count. */ |
| 86 |
uid_t st_uid; /* User ID of the file's owner. */ |
| 87 |
gid_t st_gid; /* Group ID of the file's group.*/ |
| 88 |
off_t st_size; /* Size of file, in bytes. */ |
| 89 |
unsigned long int st_blksize; /* Optimal block size for I/O. */ |
| 90 |
long st_blocks; /* Number 512-byte blocks allocated. */ |
| 91 |
time_t st_atime; /* Time of last access. */ |
| 92 |
time_t st_mtime; /* Time of last modification. */ |
| 93 |
time_t st_ctime; /* Time of last status change. */ |
| 94 |
}; |
| 95 |
|
| 96 |
int fstat(int fildes, struct stat *buf); |
| 97 |
|
| 98 |
#else |
| 99 |
#include <console.h> |
| 100 |
#include <stat.mac.h> |
| 101 |
#endif |
| 102 |
|
| 103 |
#ifndef PATH_MAX |
| 104 |
#define PATH_MAX 1024 |
| 105 |
#endif |
| 106 |
|
| 107 |
/* |
| 108 |
Our own stat, accepts unix like paths. |
| 109 |
*/ |
| 110 |
int mstat(const char *path, struct stat *buf); |
| 111 |
|
| 112 |
struct dirent { |
| 113 |
char d_name[64]; |
| 114 |
}; |
| 115 |
|
| 116 |
typedef struct { |
| 117 |
FSSpec file; |
| 118 |
int index; |
| 119 |
struct dirent ent; |
| 120 |
} DIR; |
| 121 |
|
| 122 |
extern DIR* opendir(const char *dirname); |
| 123 |
extern struct dirent* readdir(DIR* dirp); |
| 124 |
extern int closedir(DIR* dirp); |
| 125 |
extern void rewinddir(DIR* dirp); |
| 126 |
extern char* getcwd(char*, int); |
| 127 |
|
| 128 |
/* |
| 129 |
Our own fopen, accepts unix like paths. |
| 130 |
*/ |
| 131 |
extern FILE* mfopen(const char* file, const char* mode); |
| 132 |
|
| 133 |
/* |
| 134 |
Dirty, define the standard functions fopen, stat and lstat to map to our |
| 135 |
own routines. |
| 136 |
*/ |
| 137 |
#define fopen mfopen |
| 138 |
#define stat(a,b) mstat(a,b) |
| 139 |
#define lstat(a,b) mstat(a,b) |
| 140 |
|
| 141 |
#endif |
| 142 |
|
| 143 |
/* vi:set tabstop=4 shiftwidth=4: */ |