Annotation of researchv10no/cmd/hdr/io.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     Sydney C Compiler.
                      3:  *
                      4:  *     Copyright 1984, Bruce Ellis.
                      5:  *
                      6:  *     Unauthorised possesion, sale or use prohibited.
                      7:  */
                      8: 
                      9: extern char    *err_ptr;
                     10: extern char    *put_ptr;
                     11: extern char    *get_end;
                     12: extern char    *get_ptr;
                     13: extern char    err_buff[];
                     14: extern char    put_buff[];
                     15: extern char    get_buff[];
                     16: extern void    err_flush();
                     17: extern void    put_flush();
                     18: 
                     19: #define        put(c)  if (*put_ptr++ = (c), put_ptr == &put_buff[BUFFZ]) \
                     20:                        put_flush(); \
                     21:                else
                     22: 
                     23: #ifdef PUT_CALLS
                     24: extern void    putz();
                     25: extern void    vput();
                     26: extern void    uput();
                     27: #else  PUT_CALLS
                     28: /*
                     29:  *     vput and uput pack longs into 1, 2 or 4 bytes.
                     30:  *     putz() is equivalent to [uv]put(0) but less optimisable.
                     31:  *
                     32:  *     If packing is not required we can replace them with
                     33:  *     four put()s.  The argument to the [uv]put macros should
                     34:  *     be a register (look at how often it is accessed).
                     35:  */
                     36: #define        putz()  put(0)
                     37: 
                     38: #define        vput(i) if ((unsigned long)(i) < 0x80) \
                     39:                        put(i); \
                     40:                else if ((unsigned long)(i) < 0x4000) \
                     41:                { \
                     42:                        put((((int)(i) >> 8) & 0x3F) | 0x80); \
                     43:                        put((int)(i) & 0xFF); \
                     44:                } \
                     45:                else \
                     46:                { \
                     47:                        put((((i) >> 24) & 0x3F) | 0xC0); \
                     48:                        put(((i) >> 16) & 0xFF); \
                     49:                        put(((int)(i) >> 8) & 0xFF); \
                     50:                        put((int)(i) & 0xFF); \
                     51:                }
                     52: 
                     53: #define        uput(i) if ((i) < 0x40) \
                     54:                { \
                     55:                        if ((i) < -0x40) \
                     56:                        { \
                     57:                                if ((i) < -0x2000) \
                     58:                                { \
                     59:                                        put((((i) >> 24) & 0x3F) | 0xC0); \
                     60:                                        put(((i) >> 16) & 0xFF); \
                     61:                                        put(((int)(i) >> 8) & 0xFF); \
                     62:                                        put((int)(i) & 0xFF); \
                     63:                                } \
                     64:                                else \
                     65:                                { \
                     66:                                        put((((int)(i) >> 8) & 0x3F) | 0x80); \
                     67:                                        put((int)(i) & 0xFF); \
                     68:                                } \
                     69:                        } \
                     70:                        else \
                     71:                                put(i); \
                     72:                } \
                     73:                else if ((i) < 0x2000) \
                     74:                { \
                     75:                        put((((int)(i) >> 8) & 0x3F) | 0x80); \
                     76:                        put((int)(i) & 0xFF); \
                     77:                } \
                     78:                else \
                     79:                { \
                     80:                        put((((i) >> 24) & 0x3F) | 0xC0); \
                     81:                        put(((i) >> 16) & 0xFF); \
                     82:                        put(((int)(i) >> 8) & 0xFF); \
                     83:                        put((int)(i) & 0xFF); \
                     84:                }
                     85: #endif PUT_CALLS

unix.superglobalmegacorp.com

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