diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1994-12-14 13:04:05 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1994-12-14 13:04:05 (GMT) |
commit | 599f0d1c2c72e1364c564226c69d40dcfff1f960 (patch) | |
tree | 3996cfcb096fc6f7fc36edeeeb837b7adccc00fb /Python | |
parent | e00637bdcf31ed5247de4e3fbea931b52defaf8e (diff) | |
download | cpython-599f0d1c2c72e1364c564226c69d40dcfff1f960.zip cpython-599f0d1c2c72e1364c564226c69d40dcfff1f960.tar.gz cpython-599f0d1c2c72e1364c564226c69d40dcfff1f960.tar.bz2 |
- Added ability to get at strings embedded in the struct
- For the mac, added ability to get at pascal-style strings
Diffstat (limited to 'Python')
-rw-r--r-- | Python/structmember.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Python/structmember.c b/Python/structmember.c index 784bbf5..7ec48b3 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -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; } |