Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c889b760
Commit
c889b760
authored
Feb 13, 1995
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added RawFSSpec and RawAlias methods which turn their string arguments
into fsspec and alias objects.
parent
bd06e962
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
Mac/Modules/macfsmodule.c
Mac/Modules/macfsmodule.c
+53
-0
No files found.
Mac/Modules/macfsmodule.c
View file @
c889b760
...
...
@@ -151,6 +151,16 @@ mfsa_getattr(self, name)
mfsaobject
*
self
;
char
*
name
;
{
if
(
strcmp
(
name
,
"data"
)
==
0
)
{
int
size
;
PyObject
*
rv
;
size
=
GetHandleSize
((
Handle
)
self
->
alias
);
HLock
((
Handle
)
self
->
alias
);
rv
=
PyString_FromStringAndSize
(
*
(
Handle
)
self
->
alias
,
size
);
HUnlock
((
Handle
)
self
->
alias
);
return
rv
;
}
return
findmethod
(
mfsa_methods
,
(
object
*
)
self
,
name
);
}
...
...
@@ -353,6 +363,8 @@ mfss_getattr(self, name)
mfssobject
*
self
;
char
*
name
;
{
if
(
strcmp
(
name
,
"data"
)
==
0
)
return
PyString_FromStringAndSize
((
char
*
)
&
self
->
fsspec
,
sizeof
(
FSSpec
));
return
findmethod
(
mfss_methods
,
(
object
*
)
self
,
name
);
}
...
...
@@ -498,6 +510,45 @@ mfs_FSSpec(self, args)
return
(
object
*
)
newmfssobject
(
&
fss
);
}
static
object
*
mfs_RawFSSpec
(
self
,
args
)
object
*
self
;
/* Not used */
object
*
args
;
{
FSSpec
*
fssp
;
int
size
;
if
(
!
newgetargs
(
args
,
"s#"
,
&
fssp
,
&
size
))
return
NULL
;
if
(
size
!=
sizeof
(
FSSpec
)
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Incorrect size for FSSpec record"
);
return
NULL
;
}
return
(
object
*
)
newmfssobject
(
fssp
);
}
static
object
*
mfs_RawAlias
(
self
,
args
)
object
*
self
;
/* Not used */
object
*
args
;
{
char
*
dataptr
;
Handle
h
;
int
size
;
if
(
!
newgetargs
(
args
,
"s#"
,
&
dataptr
,
&
size
))
return
NULL
;
h
=
NewHandle
(
size
);
if
(
h
==
NULL
)
{
PyErr_NoMemory
();
return
NULL
;
}
HLock
(
h
);
memcpy
((
char
*
)
*
h
,
dataptr
,
size
);
HUnlock
(
h
);
return
(
object
*
)
newmfsaobject
((
AliasHandle
)
h
);
}
/* List of methods defined in the module */
static
struct
methodlist
mfs_methods
[]
=
{
...
...
@@ -505,6 +556,8 @@ static struct methodlist mfs_methods[] = {
{
"StandardGetFile"
,
mfs_StandardGetFile
,
1
},
{
"StandardPutFile"
,
mfs_StandardPutFile
,
1
},
{
"FSSpec"
,
mfs_FSSpec
,
1
},
{
"RawFSSpec"
,
mfs_RawFSSpec
,
1
},
{
"RawAlias"
,
mfs_RawAlias
,
1
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment