Files
tms-c-compiler/scripts/tests/m3/diff/ti-xhello.c
T

38 lines
903 B
C

/* K&R source for the M3 differential golden: the same four-call Xlib client
as scripts/m3/xhello.c, compiled by the 1987 TI compiler.
The ROM's Display/Screen fields are at bit displacements 0x480/0x40, i.e.
byte offsets 0x90/0x8; the 1987 compiler's &-of-member arithmetic is in
bits, so it emits 1152 and 64 for these pads. */
struct display {
char pad[0x90];
void *screens;
};
struct screen {
char pad[0x8];
unsigned int root;
};
extern struct display *XOpenDisplay();
extern int XCreateSimpleWindow();
extern int XMapWindow();
extern int XSync();
int xhello()
{
struct display *d;
unsigned int root;
int w;
int s;
d = XOpenDisplay("0::0");
if (!d)
return -1;
root = ((struct screen *)d->screens)->root;
w = XCreateSimpleWindow(d, root, 100, 100, 400, 200, 2, 0, 1);
XMapWindow(d, w);
s = XSync(d, 0);
return w;
}