object.h

Go to the documentation of this file.
00001 /* $Header: /opt/proj/minix/cvsroot/src/commands/aal/object.h,v 1.1.1.1 2005/04/21 14:53:57 beng Exp $ */
00002 /*
00003  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
00004  * See the copyright notice in the ACK home directory, in the file "Copyright".
00005  */
00006 #include "byte_order.h"
00007 #include <local.h>
00008 #include <stdio.h>
00009 
00010 #if CHAR_UNSIGNED
00011 #define Xchar(ch)       (ch)
00012 #else
00013 #define Xchar(ch)       ((ch) & 0377)
00014 #endif
00015 
00016 #if ! defined(BYTES_REVERSED)
00017 #define BYTES_REVERSED 1
00018 #endif
00019 
00020 #if ! defined(WORDS_REVERSED)
00021 #define WORDS_REVERSED 1
00022 #endif
00023 
00024 #if BYTES_REVERSED
00025 #define uget2(c)        (Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
00026 #define Xput2(i, c)     (((c)[0] = (i)), ((c)[1] = (i) >> 8))
00027 #define put2(i, c)      { register int j = (i); Xput2(j, c); }
00028 #else
00029 #define uget2(c)        (* ((unsigned short *) (c)))
00030 #define Xput2(i, c)     (* ((short *) (c)) = (i))
00031 #define put2(i, c)      Xput2(i, c)
00032 #endif
00033 
00034 #define get2(c)         ((short) uget2(c))
00035 
00036 #if WORDS_REVERSED || BYTES_REVERSED
00037 #define get4(c)         (uget2(c) | ((long) uget2((c)+2) << 16))
00038 #define put4(l, c)      { register long x=(l); \
00039                           Xput2((int)x,c); \
00040                           Xput2((int)(x>>16),(c)+2); \
00041                         }
00042 #else
00043 #define get4(c)         (* ((long *) (c)))
00044 #define put4(l, c)      (* ((long *) (c)) = (l))
00045 #endif
00046 
00047 #define SECTCNT 3       /* number of sections with own output buffer */
00048 #if BIGMACHINE
00049 #define WBUFSIZ (8*BUFSIZ)
00050 #else
00051 #define WBUFSIZ BUFSIZ
00052 #endif
00053 
00054 struct fil {
00055         int     cnt;
00056         char    *pnow;
00057         char    *pbegin;
00058         long    currpos;
00059         int     fd;
00060         char    pbuf[WBUFSIZ];
00061 };
00062 
00063 extern struct fil __parts[];
00064 
00065 #define PARTEMIT        0
00066 #define PARTRELO        (PARTEMIT+SECTCNT)
00067 #define PARTNAME        (PARTRELO+1)
00068 #define PARTCHAR        (PARTNAME+1)
00069 #ifdef SYMDBUG
00070 #define PARTDBUG        (PARTCHAR+1)
00071 #else
00072 #define PARTDBUG        (PARTCHAR+0)
00073 #endif
00074 #define NPARTS          (PARTDBUG + 1)
00075 
00076 #define getsect(s)      (PARTEMIT+((s)>=(SECTCNT-1)?(SECTCNT-1):(s)))

Generated on Fri Apr 14 22:56:37 2006 for minix by  doxygen 1.4.6