source: trunk/minix/commands/autil/obj.h@ 11

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

Minix 3.1.2a

File size: 1.8 KB
Line 
1/* $Id: obj.h,v 1.1 2005/06/23 09:50:54 philip 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 <local.h>
7#include <stdio.h>
8#include <out.h>
9#include <ranlib.h>
10#include <arch.h>
11#include "object.h"
12
13#if ! defined(CHAR_UNSIGNED)
14#define CHAR_UNSIGNED 0
15#endif
16
17#if CHAR_UNSIGNED
18#define Xchar(ch) (ch)
19#else
20#define Xchar(ch) ((ch) & 0377)
21#endif
22
23#if ! defined(BYTE_ORDER)
24#define BYTE_ORDER 0x3210
25#endif
26
27#if (BYTE_ORDER == 0x3210 || BYTE_ORDER == 0x1032)
28#define uget2(c) (Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
29#define Xput2(i, c) (((c)[0] = (i)), ((c)[1] = (i) >> 8))
30#define put2(i, c) { register int j = (i); Xput2(j, c); }
31#else
32#define uget2(c) (* ((unsigned short *) (c)))
33#define Xput2(i, c) (* ((short *) (c)) = (i))
34#define put2(i, c) Xput2(i, c)
35#endif
36
37#define get2(c) ((short) uget2(c))
38
39#if BYTE_ORDER != 0x0123
40#define get4(c) (uget2(c) | ((long) uget2((c)+2) << 16))
41#define put4(l, c) { register long x=(l); \
42 Xput2((int)x,c); \
43 Xput2((int)(x>>16),(c)+2); \
44 }
45#else
46#define get4(c) (* ((long *) (c)))
47#define put4(l, c) (* ((long *) (c)) = (l))
48#endif
49
50#define SECTCNT 3 /* number of sections with own output buffer */
51#if BIGMACHINE
52#define WBUFSIZ (8*BUFSIZ)
53#else
54#define WBUFSIZ BUFSIZ
55#endif
56
57struct fil {
58 int cnt;
59 char *pnow;
60 char *pbegin;
61 long currpos;
62 int fd;
63 char pbuf[WBUFSIZ];
64};
65
66extern struct fil __parts[];
67
68#define PARTEMIT 0
69#define PARTRELO (PARTEMIT+SECTCNT)
70#define PARTNAME (PARTRELO+1)
71#define PARTCHAR (PARTNAME+1)
72#ifdef SYMDBUG
73#define PARTDBUG (PARTCHAR+1)
74#else
75#define PARTDBUG (PARTCHAR+0)
76#endif
77#define NPARTS (PARTDBUG + 1)
78
79#define getsect(s) (PARTEMIT+((s)>=(SECTCNT-1)?(SECTCNT-1):(s)))
Note: See TracBrowser for help on using the repository browser.