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

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: 
1.1.1.3 ! root        7: struct __va_struct { char regs[20]; };
1.1       root        8: 
1.1.1.3 ! root        9: #define va_alist __va_regs, __va_stack
1.1       root       10: 
1.1.1.3 ! root       11: #define va_dcl struct __va_struct __va_regs; int __va_stack;
1.1       root       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) \
1.1.1.3 ! root       20:      ((pvar).pnt = 0, (pvar).regs = __va_regs.regs, \
        !            21:       (pvar).stack = (char *) &__va_stack)
1.1.1.2   root       22: #define va_end(pvar)
1.1       root       23: 
                     24: #define va_arg(pvar,type)  \
1.1.1.3 ! root       25:     ({  type __va_result; \
1.1.1.2   root       26:         if ((pvar).pnt >= 20) { \
1.1.1.3 ! root       27:            __va_result = *( (type *) ((pvar).stack + (pvar).pnt - 20)); \
1.1.1.2   root       28:           (pvar).pnt += (sizeof(type) + 7) & ~7; \
1.1       root       29:        } \
1.1.1.2   root       30:        else if ((pvar).pnt + sizeof(type) > 20) { \
1.1.1.3 ! root       31:           __va_result = * (type *) (pvar).stack; \
1.1.1.2   root       32:           (pvar).pnt = 20 + ( (sizeof(type) + 7) & ~7); \
1.1       root       33:        } \
                     34:        else if (sizeof(type) == 8) { \
1.1.1.3 ! root       35:           union {double d; int i[2];} __u; \
        !            36:           __u.i[0] = *(int *) ((pvar).regs + (pvar).pnt); \
        !            37:           __u.i[1] = *(int *) ((pvar).regs + (pvar).pnt + 4); \
        !            38:           __va_result = * (type *) &__u; \
1.1.1.2   root       39:           (pvar).pnt += 8; \
1.1       root       40:        } \
                     41:        else { \
1.1.1.3 ! root       42:           __va_result = * (type *) ((pvar).regs + (pvar).pnt); \
1.1.1.2   root       43:           (pvar).pnt += (sizeof(type) + 3) & ~3; \
1.1       root       44:        } \
1.1.1.3 ! root       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.