Mercurial > cpython-lru_cache-weakref
annotate Mac/Python/macguesstabsize.c @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | 9588c238e660 |
| children | d6b292a33cfe |
| rev | line source |
|---|---|
|
1693
cf29c09f07b6
Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents:
1495
diff
changeset
|
1 #include <Types.h> |
|
cf29c09f07b6
Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents:
1495
diff
changeset
|
2 #include <Files.h> |
|
cf29c09f07b6
Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents:
1495
diff
changeset
|
3 #include <OSUtils.h> |
|
cf29c09f07b6
Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents:
1495
diff
changeset
|
4 #include <Resources.h> |
|
cf29c09f07b6
Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents:
1495
diff
changeset
|
5 |
| 1495 | 6 #include <string.h> |
| 7 | |
| 2228 | 8 /* Interface used by parsetok.c */ |
| 1495 | 9 |
| 10 guesstabsize(path) | |
| 11 char *path; | |
| 12 { | |
|
1795
fa8bbd09f2e6
Updates for THINK C 6.0. Moved the necessary UNIX emulation routines here.
Guido van Rossum <guido@python.org>
parents:
1693
diff
changeset
|
13 Str255 s; |
| 1495 | 14 int refnum; |
| 15 Handle h; | |
| 16 int tabsize = 0; | |
| 17 s[0] = strlen(path); | |
|
1795
fa8bbd09f2e6
Updates for THINK C 6.0. Moved the necessary UNIX emulation routines here.
Guido van Rossum <guido@python.org>
parents:
1693
diff
changeset
|
18 memcpy(s+1, path, s[0]); |
| 1495 | 19 refnum = OpenResFile(s); |
| 20 if (refnum == -1) | |
| 21 return 0; | |
| 22 UseResFile(refnum); | |
| 23 h = GetIndResource('ETAB', 1); | |
| 24 if (h != 0) { | |
| 25 tabsize = (*(short**)h)[1]; | |
| 26 } | |
| 27 CloseResFile(refnum); | |
| 28 return tabsize; | |
| 29 } |
