ؾʹͳΔPerl1.0࠷৽ಈ(2)
• As a birthday present to Perl and Larry, through
the work of the perl1-porters, in particular Richard
Clamp, resurrected here is Perl 1.0 with minimal
patches for modern machines.
• ϕʔΦϧϑͷࢻͱڞʹ2002ͷ12݄19ʹ
gcc-3ʹରԠͨ͠ύονͷtag͕ଧͨΕΔ
• LarryͱPerlͷ͓ੜϓϨθϯτ
Perl2.0ͷStringܕ
• STAB͕෦ʹຒΊࠐ·ΕΔΑ͏ʹͳͬͨ
1 struct string {
2 char * str_ptr; /* pointer to malloced string */
3 double str_nval; /* numeric value, if any */
4 int str_len; /* allocated size */
5 int str_cur; /* length of str_ptr as a C string */
6 union {
7 STR *str_next; /* while free, link to next free str */
8 STAB *str_magic; /* while in use, ptr to magic stab, if an
*/
9 } str_link;
10 char str_pok; /* state of str_ptr */
11 char str_nok; /* state of str_nval */
12 char str_rare; /* used by search strings */
13 char str_prev; /* also used by search strings */
14 };
Perl3ͷεΧϥʔܕ
1 struct string {
2 char * str_ptr; /* pointer to malloced string */
3 union {
4 double str_nval; /* numeric value, if any */
5 STAB *str_stab; /* magic stab for magic "key" string */
6 long str_useful; /* is this search optimization effective? */
7 ARG *str_args; /* list of args for interpreted string */
8 HASH *str_hash; /* string represents an assoc array (stab?) */
9 ARRAY *str_array; /* string represents an array */
10 } str_u;
11 int str_len; /* allocated size */
12 int str_cur; /* length of str_ptr as a C string */
13 STR *str_magic; /* while free, link to next free str */
14 /* while in use, ptr to "key" for magic items */
15 char str_pok; /* state of str_ptr */
16 char str_nok; /* state of str_nval */
17 unsigned char str_rare; /* used by search strings */
18 unsigned char str_state; /* one of SS_* below */
19 /* also used by search strings for backoff */
20 #ifdef TAINT
21 bool str_tainted; /* 1 if possibly under control of $< */
22 #endif
23 };
Perl5.0ͷSVܕ
• ݱࡏͷPerl5ͱத͕ҟͳΔ͕͓͓Αͦݪܕ
͕࡞ΒΕ͍ͯΔ
1 /* Using C's structural equivalence to help emulate C++
inheritance here... */
2
3 struct sv {
4 void* sv_any; /* pointer to something */
5 U32 sv_refcnt; /* how many references to us */
6 U32 sv_flags; /* what we are */
7 };