Mercurial > cpython-lru_cache-weakref
annotate Mac/Python/macsetfiletype.c @ 12835:bc35647fe472 legacy-trunk
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Fri, 02 Jun 2000 21:29:59 +0000 |
| parents | d6b292a33cfe |
| children | db963a615bc9 |
| rev | line source |
|---|---|
|
5079
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
1 /*********************************************************** |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
3 The Netherlands. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
4 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
5 All Rights Reserved |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
6 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
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:
2311
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:
2311
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:
2311
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:
2311
diff
changeset
|
11 supporting documentation, and that the names of Stichting Mathematisch |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
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:
2311
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:
2311
diff
changeset
|
14 distribution of the software without specific, written prior |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
15 permission. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
16 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
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:
2311
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:
2311
diff
changeset
|
19 (CNRI) at the Internet address ftp://ftp.python.org. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
20 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
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:
2311
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:
2311
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:
2311
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:
2311
diff
changeset
|
28 PERFORMANCE OF THIS SOFTWARE. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
29 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
2311
diff
changeset
|
30 ******************************************************************/ |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 /* |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 * macsetfiletype - Set the mac's idea of file type |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 * |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 */ |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 |
|
1921
275951b08608
Make it work under MPW too.
Guido van Rossum <guido@python.org>
parents:
1892
diff
changeset
|
37 #include "macdefs.h" |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 int |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 setfiletype(name, creator, type) |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 char *name; |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 long creator, type; |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 { |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 FInfo info; |
|
12835
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
45 FSSpec fss; |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 unsigned char *pname; |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 |
|
2179
8da03decef59
More Pstring() stuff and some cosmetics
Jack Jansen <jack.jansen@cwi.nl>
parents:
1921
diff
changeset
|
48 pname = (StringPtr) Pstring(name); |
|
12835
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
49 if (FSMakeFSSpec(0, 0, pname, &fss) < 0 ) |
|
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
50 return -1; |
|
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
51 if ( FSpGetFInfo(&fss, &info) < 0 ) |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 return -1; |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 info.fdType = type; |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 info.fdCreator = creator; |
|
12835
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
55 return FSpSetFInfo(&fss, &info); |
|
1892
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 } |
|
eec0dc5aba60
gestaltmodule.c: interface to Gestalt Manager.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 |
|
2311
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
58 long |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
59 getfiletype(name) |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
60 char *name; |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
61 { |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
62 FInfo info; |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
63 unsigned char *pname; |
|
12835
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
64 FSSpec fss; |
|
2311
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
65 |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
66 pname = (StringPtr) Pstring(name); |
|
12835
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
67 if (FSMakeFSSpec(0, 0, pname, &fss) < 0 ) |
|
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
68 return -1; |
|
bc35647fe472
Replaced GetFInfo and SetFInfo calls with FspGetFInfo and FspSetFInfo calls, which are carbon-compatible.
Jack Jansen <jack.jansen@cwi.nl>
parents:
5079
diff
changeset
|
69 if ( FSpGetFInfo(&fss, &info) < 0 ) |
|
2311
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
70 return -1; |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
71 return info.fdType; |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
72 } |
|
fc6e96221088
Added getfiletype routine
Jack Jansen <jack.jansen@cwi.nl>
parents:
2179
diff
changeset
|
73 |
