source: trunk/minix/commands/aal/object.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 1.7 KB
Line 
1/* $Header: /cvsup/minix/src/commands/aal/object.h,v 1.1.1.1 2005/04/21 14:53:57 beng Exp $ */
2/*
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 */
6#include "byte_order.h"
7#include <local.h>
8#include <stdio.h>
9
10#if CHAR_UNSIGNED
11#define Xchar(ch) (ch)
12#else
13#define Xchar(ch) ((ch) & 0377)
14#endif
15
16#if ! defined(BYTES_REVERSED)
17#define BYTES_REVERSED 1
18#endif
19
20#if ! defined(WORDS_REVERSED)
21#define WORDS_REVERSED 1
22#endif
23
24#if BYTES_REVERSED
25#define uget2(c) (Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
26#define Xput2(i, c) (((c)[0] = (i)), ((c)[1] = (i) >> 8))
27#define put2(i, c) { register int j = (i); Xput2(j, c); }
28#else
29#define uget2(c) (* ((unsigned short *) (c)))
30#define Xput2(i, c) (* ((short *) (c)) = (i))
31#define put2(i, c) Xput2(i, c)
32#endif
33
34#define get2(c) ((short) uget2(c))
35
36#if WORDS_REVERSED || BYTES_REVERSED
37#define get4(c) (uget2(c) | ((long) uget2((c)+2) << 16))
38#define put4(l, c) { register long x=(l); \
39 Xput2((int)x,c); \
40 Xput2((int)(x>>16),(c)+2); \
41 }
42#else
43#define get4(c) (* ((long *) (c)))
44#define put4(l, c) (* ((long *) (c)) = (l))
45#endif
46
47#define SECTCNT 3 /* number of sections with own output buffer */
48#if BIGMACHINE
49#define WBUFSIZ (8*BUFSIZ)
50#else
51#define WBUFSIZ BUFSIZ
52#endif
53
54struct fil {
55 int cnt;
56 char *pnow;
57 char *pbegin;
58 long currpos;
59 int fd;
60 char pbuf[WBUFSIZ];
61};
62
63extern struct fil __parts[];
64
65#define PARTEMIT 0
66#define PARTRELO (PARTEMIT+SECTCNT)
67#define PARTNAME (PARTRELO+1)
68#define PARTCHAR (PARTNAME+1)
69#ifdef SYMDBUG
70#define PARTDBUG (PARTCHAR+1)
71#else
72#define PARTDBUG (PARTCHAR+0)
73#endif
74#define NPARTS (PARTDBUG + 1)
75
76#define getsect(s) (PARTEMIT+((s)>=(SECTCNT-1)?(SECTCNT-1):(s)))
Note: See TracBrowser for help on using the repository browser.