perl

Data structure underling perl SV


perl.h has the line "typedef struct STRUCT_SV SV;". perl.c uses the SV typedef all over the place. I can't find the definition of "STRUCT_SV" and the struct definition that underlies it. I'ld just like to look at the underling data structure for SV. After that I'll try to figure out HVs and AVs.

Can anyone help me?

By the way brian, the book is Learning Perl.

Thanks, John


Solution

  • STRUCT_SV is defined on the previous line.

    /* SGI's <sys/sema.h> has struct sv */
    #if defined(__sgi)
    #   define STRUCT_SV perl_sv
    #else
    #   define STRUCT_SV sv
    #endif
    

    And struct STRUCT_SV's definition is in sv.h.

    struct STRUCT_SV {              /* struct sv { */
        _SV_HEAD(void*);
        _SV_HEAD_UNION;
    };