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
599f0d1c
Commit
599f0d1c
authored
Dec 14, 1994
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added ability to get at strings embedded in the struct
- For the mac, added ability to get at pascal-style strings
parent
e00637bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
Include/structmember.h
Include/structmember.h
+7
-0
Python/structmember.c
Python/structmember.c
+23
-1
No files found.
Include/structmember.h
View file @
599f0d1c
...
...
@@ -74,6 +74,13 @@ struct memberlist {
#define T_UINT 11
#define T_ULONG 12
/* Added by Jack: strings contained in the structure */
#define T_STRING_INPLACE 13
#ifdef macintosh
#define T_PSTRING 14
/* macintosh pascal-style counted string */
#define T_PSTRING_INPLACE 15
#endif
/* macintosh */
/* Readonly flag */
#define READONLY 1
#define RO READONLY
/* Shorthand */
...
...
Python/structmember.c
View file @
599f0d1c
...
...
@@ -108,6 +108,24 @@ getmember(addr, mlist, name)
else
v
=
newstringobject
(
*
(
char
**
)
addr
);
break
;
case
T_STRING_INPLACE
:
v
=
newstringobject
((
char
*
)
addr
);
break
;
#ifdef macintosh
case
T_PSTRING
:
if
(
*
(
char
**
)
addr
==
NULL
)
{
INCREF
(
None
);
v
=
None
;
}
else
v
=
newsizedstringobject
((
*
(
char
**
)
addr
)
+
1
,
**
(
unsigned
char
**
)
addr
);
break
;
case
T_PSTRING_INPLACE
:
v
=
newsizedstringobject
(((
char
*
)
addr
)
+
1
,
*
(
unsigned
char
*
)
addr
);
break
;
#endif
/* macintosh */
case
T_CHAR
:
v
=
newsizedstringobject
((
char
*
)
addr
,
1
);
break
;
...
...
@@ -140,7 +158,11 @@ setmember(addr, mlist, name, v)
for
(
l
=
mlist
;
l
->
name
!=
NULL
;
l
++
)
{
if
(
strcmp
(
l
->
name
,
name
)
==
0
)
{
if
(
l
->
readonly
||
l
->
type
==
T_STRING
)
{
#ifdef macintosh
if
(
l
->
readonly
||
l
->
type
==
T_STRING
||
l
->
type
==
T_PSTRING
)
{
#else
if
(
l
->
readonly
||
l
->
type
==
T_STRING
)
{
#endif
/* macintosh */
err_setstr
(
TypeError
,
"readonly attribute"
);
return
-
1
;
}
...
...
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