annotate Mac/Python/macguesstabsize.c @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents d6b292a33cfe
children c5edd86e2698
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5079
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
1 /***********************************************************
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
3 The Netherlands.
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
4
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
5 All Rights Reserved
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
6
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
7 Permission to use, copy, modify, and distribute this software and its
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
8 documentation for any purpose and without fee is hereby granted,
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
9 provided that the above copyright notice appear in all copies and that
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
10 both that copyright notice and this permission notice appear in
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
11 supporting documentation, and that the names of Stichting Mathematisch
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
12 Centrum or CWI or Corporation for National Research Initiatives or
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
13 CNRI not be used in advertising or publicity pertaining to
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
14 distribution of the software without specific, written prior
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
15 permission.
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
16
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
17 While CWI is the initial source for this software, a modified version
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
18 is made available by the Corporation for National Research Initiatives
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
19 (CNRI) at the Internet address ftp://ftp.python.org.
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
20
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
28 PERFORMANCE OF THIS SOFTWARE.
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
29
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
30 ******************************************************************/
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 2228
diff changeset
31
1693
cf29c09f07b6 Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents: 1495
diff changeset
32 #include <Types.h>
cf29c09f07b6 Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents: 1495
diff changeset
33 #include <Files.h>
cf29c09f07b6 Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents: 1495
diff changeset
34 #include <OSUtils.h>
cf29c09f07b6 Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents: 1495
diff changeset
35 #include <Resources.h>
cf29c09f07b6 Replace <MacHeaders> by specific required header files
Guido van Rossum <guido@python.org>
parents: 1495
diff changeset
36
1495
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 #include <string.h>
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
38
2228
9588c238e660 fixed comment
Guido van Rossum <guido@python.org>
parents: 2179
diff changeset
39 /* Interface used by parsetok.c */
1495
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
40
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 guesstabsize(path)
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 char *path;
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 {
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
44 Str255 s;
1495
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 int refnum;
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
46 Handle h;
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 int tabsize = 0;
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 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
49 memcpy(s+1, path, s[0]);
1495
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 refnum = OpenResFile(s);
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 if (refnum == -1)
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 return 0;
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 UseResFile(refnum);
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 h = GetIndResource('ETAB', 1);
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 if (h != 0) {
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
56 tabsize = (*(short**)h)[1];
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 }
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
58 CloseResFile(refnum);
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
59 return tabsize;
877073b9f8c3 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 }