Annotation of gcc/va-spur.h, revision 1.1.1.2

1.1       root        1: /*  varargs.h for SPUR */
                      2: 
                      3: /* NB.  This is NOT the definition needed for the new ANSI proposed
                      4:    standard */
                      5:  
                      6: 
                      7: struct va_struct { char regs[20]; };
                      8: 
                      9: #define va_alist va_regs, va_stack
                     10: 
                     11: #define va_dcl struct va_struct va_regs; int va_stack;
                     12: 
1.1.1.2 ! root       13: typedef struct {
        !            14:     int pnt;
        !            15:     char *regs;
        !            16:     char *stack;
        !            17: } va_list;
1.1       root       18: 
1.1.1.2 ! root       19: #define va_start(pvar) \
        !            20:      ((pvar).pnt = 0, (pvar).regs = va_regs.regs, \
        !            21:       (pvar).stack = (char *) &va_stack)
        !            22: #define va_end(pvar)
1.1       root       23: 
                     24: #define va_arg(pvar,type)  \
                     25:     ({  type va_result; \
1.1.1.2 ! root       26:         if ((pvar).pnt >= 20) { \
        !            27:            va_result = *( (type *) ((pvar).stack + (pvar).pnt - 20)); \
        !            28:           (pvar).pnt += (sizeof(type) + 7) & ~7; \
1.1       root       29:        } \
1.1.1.2 ! root       30:        else if ((pvar).pnt + sizeof(type) > 20) { \
        !            31:           va_result = * (type *) (pvar).stack; \
        !            32:           (pvar).pnt = 20 + ( (sizeof(type) + 7) & ~7); \
1.1       root       33:        } \
                     34:        else if (sizeof(type) == 8) { \
                     35:           union {double d; int i[2];} u; \
1.1.1.2 ! root       36:           u.i[0] = *(int *) ((pvar).regs + (pvar).pnt); \
        !            37:           u.i[1] = *(int *) ((pvar).regs + (pvar).pnt + 4); \
1.1       root       38:           va_result = * (type *) &u; \
1.1.1.2 ! root       39:           (pvar).pnt += 8; \
1.1       root       40:        } \
                     41:        else { \
1.1.1.2 ! root       42:           va_result = * (type *) ((pvar).regs + (pvar).pnt); \
        !            43:           (pvar).pnt += (sizeof(type) + 3) & ~3; \
1.1       root       44:        } \
                     45:        va_result; })

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.