[6182] in Athena Bugs
rt 7.1H: hc 2.1y
daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Tue Oct 9 10:08:27 1990
Date: Tue, 9 Oct 90 10:04:10 -0400
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
System name: pit-manager
Type and version: RTPC-ROMPC 7.1H
Display type: apa16
megapel
What were you trying to do?
Compile a file with hc.
What's wrong:
Hc notices an unused variable, and prints a warning about it,
but the warning refers to the wrong variable name (it says
"curRadarTarget" instead of "rounds").
What should have happened:
It should mention the correct variable name when reporting the
unused variable.
Please describe any relevant documentation references:
The file below has already been preprocessed. Compile it with
"hc -Hnocpp -c", and it should say, "w "m61a1.c",L136:
Variable "curRadarTarget" is never referenced." That's wrong.
It should say "w "m61a1.c",L136: Variable "rounds" is never
referenced.
jik
---CUT HERE---
# 1 "m61a1.c"
# 1 "./pm.h"
# 1 "./manifest.h"
# 2 "./pm.h"
# 1 "./eng.xbm"
static char eng_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x01, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x03, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x36, 0xc0,
0x01, 0x36, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xc0, 0x01, 0x58, 0x00, 0x00,
0x00, 0xc0, 0x03, 0x80, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x80,
0x00, 0x80, 0x03, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
0x00, 0x14, 0x00, 0xc0, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0a, 0x00, 0x20,
0x01, 0x00, 0x28, 0x00, 0x00, 0x05, 0x00, 0x20, 0x01, 0x00, 0x52, 0x00,
0x00, 0x03, 0x00, 0x20, 0x01, 0x00, 0x64, 0x00, 0x80, 0x01, 0x00, 0x20,
0x01, 0x00, 0xce, 0x00, 0xc0, 0x00, 0x00, 0x20, 0x01, 0x00, 0x83, 0x01,
0xc0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x01, 0x60, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x28, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x06, 0x62, 0x0c, 0x00,
0x00, 0x80, 0x31, 0x30, 0x06, 0x93, 0x12, 0x00, 0x00, 0x40, 0x48, 0x30,
0x76, 0x92, 0x12, 0x00, 0x00, 0x40, 0x48, 0x37, 0x56, 0x92, 0x12, 0x80,
0x00, 0x80, 0x49, 0x35, 0x76, 0x92, 0x12, 0x00, 0x00, 0x40, 0x4a, 0x37,
0x06, 0x92, 0x12, 0x00, 0x00, 0x40, 0x4a, 0x30, 0x06, 0x67, 0x0c, 0x00,
0x00, 0x80, 0x31, 0x30, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0xe7,
0x44, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x29, 0x45, 0x00, 0x00, 0x18,
0x0c, 0x00, 0x00, 0x29, 0x6d, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0xe7,
0x54, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x23, 0x54, 0x00, 0x00, 0x0c,
0x18, 0x00, 0x00, 0x2d, 0x44, 0x00, 0x00, 0x0c, 0x28, 0x00, 0x00, 0x29,
0x44, 0x00, 0x00, 0x0a, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x60, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x80, 0x01,
0xc0, 0x40, 0x00, 0x30, 0x06, 0x00, 0x81, 0x01, 0x80, 0x69, 0x00, 0x48,
0x09, 0x00, 0xcb, 0x00, 0x00, 0x33, 0x00, 0x48, 0x09, 0x00, 0x66, 0x00,
0x00, 0x25, 0x00, 0x30, 0x09, 0x00, 0x52, 0x00, 0x00, 0x0a, 0x00, 0x48,
0x09, 0x00, 0x28, 0x00, 0x00, 0x14, 0x00, 0x48, 0x09, 0x00, 0x14, 0x00,
0x00, 0x38, 0x00, 0x30, 0x06, 0x00, 0x0e, 0x00, 0x00, 0xe0, 0x00, 0x80,
0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x80, 0x00, 0xe0, 0x01, 0x00,
0x00, 0x00, 0x0d, 0x40, 0x01, 0x58, 0x00, 0x00, 0x00, 0x00, 0x36, 0xc0,
0x01, 0x36, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0xe0, 0x0f, 0x00, 0x00,
0x00, 0x00, 0xc0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
# 3 "./pm.h"
# 1 "./flaps0.xbm"
static char flaps0_bits[] = {
0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0xdf, 0xdd, 0xfd,
0x1f, 0x00, 0x00, 0x00, 0x60, 0xef, 0xee, 0xee, 0xee, 0x1f, 0x00, 0x00,
0x70, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x03, 0x00, 0x50, 0xbb, 0xbb, 0xbb,
0xbb, 0x7b, 0x7f, 0x00, 0x50, 0xdf, 0xdd, 0xdd, 0xdd, 0xbd, 0xff, 0x07,
0xe0, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
# 4 "./pm.h"
# 1 "./flaps1.xbm"
static char flaps1_bits[] = {
0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0xde, 0xdd, 0xfd,
0x1f, 0x00, 0x00, 0x00, 0x60, 0xef, 0xee, 0xee, 0xee, 0xff, 0x03, 0x00,
0x70, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x3f, 0x00, 0x58, 0xbb, 0xbb, 0xbb,
0xbb, 0x7b, 0x01, 0x00, 0x48, 0xdf, 0xdd, 0xdd, 0xdd, 0x3d, 0x0f, 0x00,
0xe8, 0xfe, 0xff, 0xff, 0xff, 0x9f, 0x3f, 0x00, 0x38, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
# 5 "./pm.h"
# 1 "./flaps2.xbm"
static char flaps2_bits[] = {
0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xdd, 0xfd,
0x1f, 0x00, 0x00, 0x00, 0x20, 0xef, 0xee, 0xee, 0xee, 0xff, 0x03, 0x00,
0x30, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x3f, 0x00, 0x38, 0xbb, 0xbb, 0xbb,
0xbb, 0x7b, 0x00, 0x00, 0x28, 0xdf, 0xdd, 0xdd, 0xdd, 0x3d, 0x0e, 0x00,
0x6c, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1e, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
# 6 "./pm.h"
# 1 "./flaps3.xbm"
static char flaps3_bits[] = {
0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xdd, 0xfd,
0x1f, 0x00, 0x00, 0x00, 0x20, 0xef, 0xee, 0xee, 0xee, 0xff, 0x03, 0x00,
0x30, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x3f, 0x00, 0x38, 0xbb, 0xbb, 0xbb,
0xbb, 0x7b, 0x00, 0x00, 0x28, 0xdf, 0xdd, 0xdd, 0xdd, 0x3d, 0x0c, 0x00,
0x6c, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
# 7 "./pm.h"
# 1 "./scale.h"
typedef struct {
int xorg;
int yorg;
int length;
int orientation;
double scale;
int minorInterval;
int minorSize;
int majorInterval;
int majorSize;
int indexSize;
double divisor;
char *format;
} scaleControl;
# 8 "./pm.h"
# 1 "../V/lib/Vlib.h"
# 10 "../V/lib/Vlib.h"
# 16 "../V/lib/Vlib.h"
# 1 "/usr/include/X11/Xlib.h"
# 33 "/usr/include/X11/Xlib.h"
# 1 "/usr/include/sys/types.h"
# 14 "/usr/include/sys/types.h"
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
# 48 "/usr/include/sys/types.h"
typedef struct _physadr { int r[1]; } *physadr;
typedef struct label_t {
int val[11];
} label_t;
typedef struct _quad { long val[2]; } quad;
typedef long daddr_t;
typedef char * caddr_t;
typedef u_long ino_t;
typedef long swblk_t;
typedef long size_t;
typedef long time_t;
typedef short dev_t;
typedef long off_t;
typedef u_short uid_t;
typedef u_short gid_t;
typedef signed char prio_t;
# 71 "/usr/include/sys/types.h"
typedef long fd_mask;
typedef struct fd_set {
fd_mask fds_bits[ (((256)+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) ))];
} fd_set;
typedef struct qhdr {
struct qhdr *link, *rlink;
} *queue_t;
# 109 "/usr/include/sys/types.h"
# 35 "/usr/include/X11/Xlib.h"
# 1 "/usr/include/X11/X.h"
typedef unsigned long XID;
typedef XID Window;
typedef XID Drawable;
typedef XID Font;
typedef XID Pixmap;
typedef XID Cursor;
typedef XID Colormap;
typedef XID GContext;
typedef XID KeySym;
typedef unsigned long Mask;
typedef unsigned long Atom;
typedef unsigned long VisualID;
typedef unsigned long Time;
typedef unsigned char KeyCode;
# 38 "/usr/include/X11/Xlib.h"
# 44 "/usr/include/X11/Xlib.h"
# 50 "/usr/include/X11/Xlib.h"
# 57 "/usr/include/X11/Xlib.h"
typedef struct _XExtData {
int number;
struct _XExtData *next;
int (*free_private)();
char *private_data;
} XExtData;
typedef struct {
int extension;
int major_opcode;
int first_event;
int first_error;
} XExtCodes;
typedef struct _XExten {
struct _XExten *next;
XExtCodes codes;
int (*create_GC)();
int (*copy_GC)();
int (*flush_GC)();
int (*free_GC)();
int (*create_Font)();
int (*free_Font)();
int (*close_display)();
int (*error)();
char *(*error_string)();
char *name;
} _XExtension;
typedef struct {
int depth;
int bits_per_pixel;
int scanline_pad;
} XPixmapFormatValues;
typedef struct {
int function;
unsigned long plane_mask;
unsigned long foreground;
unsigned long background;
int line_width;
int line_style;
int cap_style;
int join_style;
int fill_style;
int fill_rule;
int arc_mode;
Pixmap tile;
Pixmap stipple;
int ts_x_origin;
int ts_y_origin;
Font font;
int subwindow_mode;
int graphics_exposures;
int clip_x_origin;
int clip_y_origin;
Pixmap clip_mask;
int dash_offset;
char dashes;
} XGCValues;
typedef struct _XGC {
XExtData *ext_data;
GContext gid;
int rects;
int dashes;
unsigned long dirty;
XGCValues values;
} *GC;
typedef struct {
XExtData *ext_data;
VisualID visualid;
# 227 "/usr/include/X11/Xlib.h"
int class;
unsigned long red_mask, green_mask, blue_mask;
int bits_per_rgb;
int map_entries;
} Visual;
typedef struct {
int depth;
int nvisuals;
Visual *visuals;
} Depth;
typedef struct {
XExtData *ext_data;
struct _XDisplay *display;
Window root;
int width, height;
int mwidth, mheight;
int ndepths;
Depth *depths;
int root_depth;
Visual *root_visual;
GC default_gc;
Colormap cmap;
unsigned long white_pixel;
unsigned long black_pixel;
int max_maps, min_maps;
int backing_store;
int save_unders;
long root_input_mask;
} Screen;
typedef struct {
XExtData *ext_data;
int depth;
int bits_per_pixel;
int scanline_pad;
} ScreenFormat;
typedef struct {
Pixmap background_pixmap;
unsigned long background_pixel;
Pixmap border_pixmap;
unsigned long border_pixel;
int bit_gravity;
int win_gravity;
int backing_store;
unsigned long backing_planes;
unsigned long backing_pixel;
int save_under;
long event_mask;
long do_not_propagate_mask;
int override_redirect;
Colormap colormap;
Cursor cursor;
} XSetWindowAttributes;
typedef struct {
int x, y;
int width, height;
int border_width;
int depth;
Visual *visual;
Window root;
# 311 "/usr/include/X11/Xlib.h"
int class;
int bit_gravity;
int win_gravity;
int backing_store;
unsigned long backing_planes;
unsigned long backing_pixel;
int save_under;
Colormap colormap;
int map_installed;
int map_state;
long all_event_masks;
long your_event_mask;
long do_not_propagate_mask;
int override_redirect;
Screen *screen;
} XWindowAttributes;
typedef struct {
int family;
int length;
char *address;
} XHostAddress;
typedef struct _XImage {
int width, height;
int xoffset;
int format;
char *data;
int byte_order;
int bitmap_unit;
int bitmap_bit_order;
int bitmap_pad;
int depth;
int bytes_per_line;
int bits_per_pixel;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
char *obdata;
struct funcs {
struct _XImage *(*create_image)();
int (*destroy_image) (struct _XImage *);
unsigned long (*get_pixel) (struct _XImage *, int, int);
int (*put_pixel) (struct _XImage *, int, int, unsigned long);
struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
int (*add_pixel) (struct _XImage *, long);
# 374 "/usr/include/X11/Xlib.h"
} f;
} XImage;
typedef struct {
int x, y;
int width, height;
int border_width;
Window sibling;
int stack_mode;
} XWindowChanges;
typedef struct {
unsigned long pixel;
unsigned short red, green, blue;
char flags;
char pad;
} XColor;
typedef struct {
short x1, y1, x2, y2;
} XSegment;
typedef struct {
short x, y;
} XPoint;
typedef struct {
short x, y;
unsigned short width, height;
} XRectangle;
typedef struct {
short x, y;
unsigned short width, height;
short angle1, angle2;
} XArc;
typedef struct {
int key_click_percent;
int bell_percent;
int bell_pitch;
int bell_duration;
int led;
int led_mode;
int key;
int auto_repeat_mode;
} XKeyboardControl;
typedef struct {
int key_click_percent;
int bell_percent;
unsigned int bell_pitch, bell_duration;
unsigned long led_mask;
int global_auto_repeat;
char auto_repeats[32];
} XKeyboardState;
typedef struct {
Time time;
short x, y;
} XTimeCoord;
typedef struct {
int max_keypermod;
KeyCode *modifiermap;
} XModifierKeymap;
struct _DisplayAtoms {
Atom text;
Atom wm_state;
Atom wm_protocols;
Atom wm_save_yourself;
Atom wm_change_state;
Atom wm_colormap_windows;
};
typedef struct _XDisplay {
XExtData *ext_data;
struct _XDisplay *next;
int fd;
int lock;
int proto_major_version;
int proto_minor_version;
char *vendor;
long resource_base;
long resource_mask;
long resource_id;
int resource_shift;
XID (*resource_alloc)();
int byte_order;
int bitmap_unit;
int bitmap_pad;
int bitmap_bit_order;
int nformats;
ScreenFormat *pixmap_format;
int vnumber;
int release;
struct _XSQEvent *head, *tail;
int qlen;
unsigned long last_request_read;
unsigned long request;
char *last_req;
char *buffer;
char *bufptr;
char *bufmax;
unsigned max_request_size;
struct _XrmHashBucketRec *db;
int (*synchandler)();
char *display_name;
int default_screen;
int nscreens;
Screen *screens;
unsigned long motion_buffer;
Window current;
int min_keycode;
int max_keycode;
KeySym *keysyms;
XModifierKeymap *modifiermap;
int keysyms_per_keycode;
char *xdefaults;
char *scratch_buffer;
unsigned long scratch_length;
int ext_number;
_XExtension *ext_procs;
int (*event_vec[128])();
int (*wire_vec[128])();
KeySym lock_meaning;
struct XKeytrans *key_bindings;
Font cursor_font;
struct _DisplayAtoms *atoms;
struct {
long sequence_number;
int (*old_handler)();
int succeeded;
} reconfigure_wm_window;
unsigned long flags;
unsigned int mode_switch;
} Display;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Window root;
Window subwindow;
Time time;
int x, y;
int x_root, y_root;
unsigned int state;
unsigned int keycode;
int same_screen;
} XKeyEvent;
typedef XKeyEvent XKeyPressedEvent;
typedef XKeyEvent XKeyReleasedEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Window root;
Window subwindow;
Time time;
int x, y;
int x_root, y_root;
unsigned int state;
unsigned int button;
int same_screen;
} XButtonEvent;
typedef XButtonEvent XButtonPressedEvent;
typedef XButtonEvent XButtonReleasedEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Window root;
Window subwindow;
Time time;
int x, y;
int x_root, y_root;
unsigned int state;
char is_hint;
int same_screen;
} XMotionEvent;
typedef XMotionEvent XPointerMovedEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Window root;
Window subwindow;
Time time;
int x, y;
int x_root, y_root;
int mode;
int detail;
int same_screen;
int focus;
unsigned int state;
} XCrossingEvent;
typedef XCrossingEvent XEnterWindowEvent;
typedef XCrossingEvent XLeaveWindowEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
int mode;
int detail;
} XFocusChangeEvent;
typedef XFocusChangeEvent XFocusInEvent;
typedef XFocusChangeEvent XFocusOutEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
char key_vector[32];
} XKeymapEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
int x, y;
int width, height;
int count;
} XExposeEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Drawable drawable;
int x, y;
int width, height;
int count;
int major_code;
int minor_code;
} XGraphicsExposeEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Drawable drawable;
int major_code;
int minor_code;
} XNoExposeEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
int state;
} XVisibilityEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window parent;
Window window;
int x, y;
int width, height;
int border_width;
int override_redirect;
} XCreateWindowEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window event;
Window window;
} XDestroyWindowEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window event;
Window window;
int from_configure;
} XUnmapEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window event;
Window window;
int override_redirect;
} XMapEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window parent;
Window window;
} XMapRequestEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window event;
Window window;
Window parent;
int x, y;
int override_redirect;
} XReparentEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window event;
Window window;
int x, y;
int width, height;
int border_width;
Window above;
int override_redirect;
} XConfigureEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window event;
Window window;
int x, y;
} XGravityEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
int width, height;
} XResizeRequestEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window parent;
Window window;
int x, y;
int width, height;
int border_width;
Window above;
int detail;
unsigned long value_mask;
} XConfigureRequestEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window event;
Window window;
int place;
} XCirculateEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window parent;
Window window;
int place;
} XCirculateRequestEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Atom atom;
Time time;
int state;
} XPropertyEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Atom selection;
Time time;
} XSelectionClearEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window owner;
Window requestor;
Atom selection;
Atom target;
Atom property;
Time time;
} XSelectionRequestEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window requestor;
Atom selection;
Atom target;
Atom property;
Time time;
} XSelectionEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Colormap colormap;
# 913 "/usr/include/X11/Xlib.h"
int new;
int state;
} XColormapEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
Atom message_type;
int format;
union {
char b[20];
short s[10];
long l[5];
} data;
} XClientMessageEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
int request;
int first_keycode;
int count;
} XMappingEvent;
typedef struct {
int type;
Display *display;
XID resourceid;
unsigned long serial;
unsigned char error_code;
unsigned char request_code;
unsigned char minor_code;
} XErrorEvent;
typedef struct {
int type;
unsigned long serial;
int send_event;
Display *display;
Window window;
} XAnyEvent;
typedef union _XEvent {
int type;
XAnyEvent xany;
XKeyEvent xkey;
XButtonEvent xbutton;
XMotionEvent xmotion;
XCrossingEvent xcrossing;
XFocusChangeEvent xfocus;
XExposeEvent xexpose;
XGraphicsExposeEvent xgraphicsexpose;
XNoExposeEvent xnoexpose;
XVisibilityEvent xvisibility;
XCreateWindowEvent xcreatewindow;
XDestroyWindowEvent xdestroywindow;
XUnmapEvent xunmap;
XMapEvent xmap;
XMapRequestEvent xmaprequest;
XReparentEvent xreparent;
XConfigureEvent xconfigure;
XGravityEvent xgravity;
XResizeRequestEvent xresizerequest;
XConfigureRequestEvent xconfigurerequest;
XCirculateEvent xcirculate;
XCirculateRequestEvent xcirculaterequest;
XPropertyEvent xproperty;
XSelectionClearEvent xselectionclear;
XSelectionRequestEvent xselectionrequest;
XSelectionEvent xselection;
XColormapEvent xcolormap;
XClientMessageEvent xclient;
XMappingEvent xmapping;
XErrorEvent xerror;
XKeymapEvent xkeymap;
long pad[24];
} XEvent;
typedef struct _XSQEvent {
struct _XSQEvent *next;
XEvent event;
} _XQEvent;
typedef struct {
short lbearing;
short rbearing;
short width;
short ascent;
short descent;
unsigned short attributes;
} XCharStruct;
typedef struct {
Atom name;
unsigned long card32;
} XFontProp;
typedef struct {
XExtData *ext_data;
Font fid;
unsigned direction;
unsigned min_char_or_byte2;
unsigned max_char_or_byte2;
unsigned min_byte1;
unsigned max_byte1;
int all_chars_exist;
unsigned default_char;
int n_properties;
XFontProp *properties;
XCharStruct min_bounds;
XCharStruct max_bounds;
XCharStruct *per_char;
int ascent;
int descent;
} XFontStruct;
typedef struct {
char *chars;
int nchars;
int delta;
Font font;
} XTextItem;
typedef struct {
unsigned char byte1;
unsigned char byte2;
} XChar2b;
typedef struct {
XChar2b *chars;
int nchars;
int delta;
Font font;
} XTextItem16;
typedef union { Display *display;
GC gc;
Visual *visual;
Screen *screen;
ScreenFormat *pixmap_format;
XFontStruct *font; } XEDataObject;
extern XFontStruct *XLoadQueryFont(
Display* ,
const char*
);
extern XFontStruct *XQueryFont(
Display* ,
XID
);
extern XTimeCoord *XGetMotionEvents(
Display* ,
Window ,
Time ,
Time ,
int*
);
extern XModifierKeymap *XDeleteModifiermapEntry(
XModifierKeymap* ,
unsigned int ,
# 1116 "/usr/include/X11/Xlib.h"
int
);
extern XModifierKeymap *XGetModifierMapping(
Display*
);
extern XModifierKeymap *XInsertModifiermapEntry(
XModifierKeymap* ,
unsigned int ,
# 1134 "/usr/include/X11/Xlib.h"
int
);
extern XModifierKeymap *XNewModifiermap(
int
);
extern XImage *XCreateImage(
Display* ,
Visual* ,
unsigned int ,
int ,
int ,
char* ,
unsigned int ,
unsigned int ,
int ,
int
);
extern XImage *XGetImage(
Display* ,
Drawable ,
int ,
int ,
unsigned int ,
unsigned int ,
unsigned long ,
int
);
extern XImage *XGetSubImage(
Display* ,
Drawable ,
int ,
int ,
unsigned int ,
unsigned int ,
unsigned long ,
int ,
XImage* ,
int ,
int
);
extern Display *XOpenDisplay(
const char*
);
extern void XrmInitialize(
void
);
extern char *XFetchBytes(
Display* ,
int*
);
extern char *XFetchBuffer(
Display* ,
int* ,
int
);
extern char *XGetAtomName(
Display* ,
Atom
);
extern char *XGetDefault(
Display* ,
const char* ,
const char*
);
extern char *XDisplayName(
const char*
);
extern char *XKeysymToString(
KeySym
);
extern int (*XSynchronize(
Display* ,
int
))();
extern int (*XSetAfterFunction(
Display* ,
int (*) ( Display*
)
))();
extern Atom XInternAtom(
Display* ,
const char* ,
int
);
extern Colormap XCopyColormapAndFree(
Display* ,
Colormap
);
extern Colormap XCreateColormap(
Display* ,
Window ,
Visual* ,
int
);
extern Cursor XCreatePixmapCursor(
Display* ,
Pixmap ,
Pixmap ,
XColor* ,
XColor* ,
unsigned int ,
unsigned int
);
extern Cursor XCreateGlyphCursor(
Display* ,
Font ,
Font ,
unsigned int ,
unsigned int ,
XColor* ,
XColor*
);
extern Cursor XCreateFontCursor(
Display* ,
unsigned int
);
extern Font XLoadFont(
Display* ,
const char*
);
extern GC XCreateGC(
Display* ,
Drawable ,
unsigned long ,
XGCValues*
);
extern GContext XGContextFromGC(
GC
);
extern Pixmap XCreatePixmap(
Display* ,
Drawable ,
unsigned int ,
unsigned int ,
unsigned int
);
extern Pixmap XCreateBitmapFromData(
Display* ,
Drawable ,
const char* ,
unsigned int ,
unsigned int
);
extern Pixmap XCreatePixmapFromBitmapData(
Display* ,
Drawable ,
char* ,
unsigned int ,
unsigned int ,
unsigned long ,
unsigned long ,
unsigned int
);
extern Window XCreateSimpleWindow(
Display* ,
Window ,
int ,
int ,
unsigned int ,
unsigned int ,
unsigned int ,
unsigned long ,
unsigned long
);
extern Window XGetSelectionOwner(
Display* ,
Atom
);
extern Window XCreateWindow(
Display* ,
Window ,
int ,
int ,
unsigned int ,
unsigned int ,
unsigned int ,
int ,
unsigned int ,
Visual* ,
unsigned long ,
XSetWindowAttributes*
);
extern Colormap *XListInstalledColormaps(
Display* ,
Window ,
int*
);
extern char **XListFonts(
Display* ,
const char* ,
int ,
int*
);
extern char **XListFontsWithInfo(
Display* ,
const char* ,
int ,
int* ,
XFontStruct**
);
extern char **XGetFontPath(
Display* ,
int*
);
extern char **XListExtensions(
Display* ,
int*
);
extern Atom *XListProperties(
Display* ,
Window ,
int*
);
extern XHostAddress *XListHosts(
Display* ,
int* ,
int*
);
extern KeySym XKeycodeToKeysym(
Display* ,
unsigned int ,
# 1443 "/usr/include/X11/Xlib.h"
int
);
extern KeySym XLookupKeysym(
XKeyEvent* ,
int
);
extern KeySym *XGetKeyboardMapping(
Display* ,
unsigned int ,
# 1460 "/usr/include/X11/Xlib.h"
int ,
int*
);
extern KeySym XStringToKeysym(
const char*
);
extern long XMaxRequestSize(
Display*
);
extern char *XResourceManagerString(
Display*
);
extern unsigned long XDisplayMotionBufferSize(
Display*
);
extern VisualID XVisualIDFromVisual(
Visual*
);
extern XExtCodes *XInitExtension(
Display* ,
const char*
);
extern XExtCodes *XAddExtension(
Display*
);
extern XExtData *XFindOnExtensionList(
XExtData** ,
int
);
extern XExtData **XEHeadOfExtensionList(
XEDataObject
);
extern Window XRootWindow(
Display* ,
int
);
extern Window XDefaultRootWindow(
Display*
);
extern Window XRootWindowOfScreen(
Screen*
);
extern Visual *XDefaultVisual(
Display* ,
int
);
extern Visual *XDefaultVisualOfScreen(
Screen*
);
extern GC XDefaultGC(
Display* ,
int
);
extern GC XDefaultGCOfScreen(
Screen*
);
extern unsigned long XBlackPixel(
Display* ,
int
);
extern unsigned long XWhitePixel(
Display* ,
int
);
extern unsigned long XAllPlanes(
void
);
extern unsigned long XBlackPixelOfScreen(
Screen*
);
extern unsigned long XWhitePixelOfScreen(
Screen*
);
extern unsigned long XNextRequest(
Display*
);
extern unsigned long XLastKnownRequestProcessed(
Display*
);
extern char *XServerVendor(
Display*
);
extern char *XDisplayString(
Display*
);
extern Colormap XDefaultColormap(
Display* ,
int
);
extern Colormap XDefaultColormapOfScreen(
Screen*
);
extern Display *XDisplayOfScreen(
Screen*
);
extern Screen *XScreenOfDisplay(
Display* ,
int
);
extern Screen *XDefaultScreenOfDisplay(
Display*
);
extern long XEventMaskOfScreen(
Screen*
);
extern int XScreenNumberOfScreen(
Screen*
);
typedef int (*XErrorHandler) (
Display* ,
XErrorEvent*
);
extern XErrorHandler XSetErrorHandler (
XErrorHandler
);
typedef int (*XIOErrorHandler) (
Display*
);
extern XIOErrorHandler XSetIOErrorHandler (
XIOErrorHandler
);
extern XPixmapFormatValues *XListPixmapFormats(
Display* ,
int*
);
extern int *XListDepths(
Display* ,
int ,
int*
);
extern int XReconfigureWMWindow(
Display* ,
Window ,
int ,
unsigned int ,
XWindowChanges*
);
extern int XGetWMProtocols(
Display* ,
Window ,
Atom** ,
int*
);
extern int XSetWMProtocols(
Display* ,
Window ,
Atom* ,
int
);
extern int XIconifyWindow(
Display* ,
Window ,
int
);
extern int XWithdrawWindow(
Display* ,
Window ,
int
);
extern int XGetCommand(
Display* ,
Window ,
char*** ,
int*
);
extern int XGetWMColormapWindows(
Display* ,
Window ,
Window** ,
int*
);
extern int XSetWMColormapWindows(
Display* ,
Window ,
Window* ,
int
);
extern void XFreeStringList(
char**
);
extern XSetTransientForHint(
Display* ,
Window ,
Window
);
extern XActivateScreenSaver(
Display*
);
extern XAddHost(
Display* ,
XHostAddress*
);
extern XAddHosts(
Display* ,
XHostAddress* ,
int
);
extern XAddToExtensionList(
struct _XExtData** ,
XExtData*
);
extern XAddToSaveSet(
Display* ,
Window
);
extern int XAllocColor(
Display* ,
Colormap ,
XColor*
);
extern int XAllocColorCells(
Display* ,
Colormap ,
int ,
unsigned long* ,
unsigned int ,
unsigned long* ,
unsigned int
);
extern int XAllocColorPlanes(
Display* ,
Colormap ,
int ,
unsigned long* ,
int ,
int ,
int ,
int ,
unsigned long* ,
unsigned long* ,
unsigned long*
);
extern int XAllocNamedColor(
Display* ,
Colormap ,
const char* ,
XColor* ,
XColor*
);
extern XAllowEvents(
Display* ,
int ,
Time
);
extern XAutoRepeatOff(
Display*
);
extern XAutoRepeatOn(
Display*
);
extern XBell(
Display* ,
int
);
extern int XBitmapBitOrder(
Display*
);
extern int XBitmapPad(
Display*
);
extern int XBitmapUnit(
Display*
);
extern int XCellsOfScreen(
Screen*
);
extern XChangeActivePointerGrab(
Display* ,
unsigned int ,
Cursor ,
Time
);
extern XChangeGC(
Display* ,
GC ,
unsigned long ,
XGCValues*
);
extern XChangeKeyboardControl(
Display* ,
unsigned long ,
XKeyboardControl*
);
extern XChangeKeyboardMapping(
Display* ,
int ,
int ,
KeySym* ,
int
);
extern XChangePointerControl(
Display* ,
int ,
int ,
int ,
int ,
int
);
extern XChangeProperty(
Display* ,
Window ,
Atom ,
Atom ,
int ,
int ,
const unsigned char* ,
int
);
extern XChangeSaveSet(
Display* ,
Window ,
int
);
extern XChangeWindowAttributes(
Display* ,
Window ,
unsigned long ,
XSetWindowAttributes*
);
extern int XCheckIfEvent(
Display* ,
XEvent* ,
int (*) ( Display* ,
XEvent* ,
char*
) ,
char*
);
extern int XCheckMaskEvent(
Display* ,
long ,
XEvent*
);
extern int XCheckTypedEvent(
Display* ,
int ,
XEvent*
);
extern int XCheckTypedWindowEvent(
Display* ,
Window ,
int ,
XEvent*
);
extern int XCheckWindowEvent(
Display* ,
Window ,
long ,
XEvent*
);
extern XCirculateSubwindows(
Display* ,
Window ,
int
);
extern XCirculateSubwindowsDown(
Display* ,
Window
);
extern XCirculateSubwindowsUp(
Display* ,
Window
);
extern XClearArea(
Display* ,
Window ,
int ,
int ,
unsigned int ,
unsigned int ,
int
);
extern XClearWindow(
Display* ,
Window
);
extern XCloseDisplay(
Display*
);
extern XConfigureWindow(
Display* ,
Window ,
unsigned int ,
XWindowChanges*
);
extern int XConnectionNumber(
Display*
);
extern XConvertSelection(
Display* ,
Atom ,
Atom ,
Atom ,
Window ,
Time
);
extern XCopyArea(
Display* ,
Drawable ,
Drawable ,
GC ,
int ,
int ,
unsigned int ,
unsigned int ,
int ,
int
);
extern XCopyGC(
Display* ,
GC ,
unsigned long ,
GC
);
extern XCopyPlane(
Display* ,
Drawable ,
Drawable ,
GC ,
int ,
int ,
unsigned int ,
unsigned int ,
int ,
int ,
unsigned long
);
extern int XDefaultDepth(
Display* ,
int
);
extern int XDefaultDepthOfScreen(
Screen*
);
extern int XDefaultScreen(
Display*
);
extern XDefineCursor(
Display* ,
Window ,
Cursor
);
extern XDeleteProperty(
Display* ,
Window ,
Atom
);
extern XDestroyWindow(
Display* ,
Window
);
extern XDestroySubwindows(
Display* ,
Window
);
extern int XDoesBackingStore(
Screen*
);
extern int XDoesSaveUnders(
Screen*
);
extern XDisableAccessControl(
Display*
);
extern int XDisplayCells(
Display* ,
int
);
extern int XDisplayHeight(
Display* ,
int
);
extern int XDisplayHeightMM(
Display* ,
int
);
extern XDisplayKeycodes(
Display* ,
int* ,
int*
);
extern int XDisplayPlanes(
Display* ,
int
);
extern int XDisplayWidth(
Display* ,
int
);
extern int XDisplayWidthMM(
Display* ,
int
);
extern XDrawArc(
Display* ,
Drawable ,
GC ,
int ,
int ,
unsigned int ,
unsigned int ,
int ,
int
);
extern XDrawArcs(
Display* ,
Drawable ,
GC ,
XArc* ,
int
);
extern XDrawImageString(
Display* ,
Drawable ,
GC ,
int ,
int ,
const char* ,
int
);
extern XDrawImageString16(
Display* ,
Drawable ,
GC ,
int ,
int ,
const XChar2b* ,
int
);
extern XDrawLine(
Display* ,
Drawable ,
GC ,
int ,
int ,
int ,
int
);
extern XDrawLines(
Display* ,
Drawable ,
GC ,
XPoint* ,
int ,
int
);
extern XDrawPoint(
Display* ,
Drawable ,
GC ,
int ,
int
);
extern XDrawPoints(
Display* ,
Drawable ,
GC ,
XPoint* ,
int ,
int
);
extern XDrawRectangle(
Display* ,
Drawable ,
GC ,
int ,
int ,
unsigned int ,
unsigned int
);
extern XDrawRectangles(
Display* ,
Drawable ,
GC ,
XRectangle* ,
int
);
extern XDrawSegments(
Display* ,
Drawable ,
GC ,
XSegment* ,
int
);
extern XDrawString(
Display* ,
Drawable ,
GC ,
int ,
int ,
const char* ,
int
);
extern XDrawString16(
Display* ,
Drawable ,
GC ,
int ,
int ,
const XChar2b* ,
int
);
extern XDrawText(
Display* ,
Drawable ,
GC ,
int ,
int ,
XTextItem* ,
int
);
extern XDrawText16(
Display* ,
Drawable ,
GC ,
int ,
int ,
XTextItem16* ,
int
);
extern XEnableAccessControl(
Display*
);
extern int XEventsQueued(
Display* ,
int
);
extern int XFetchName(
Display* ,
Window ,
char**
);
extern XFillArc(
Display* ,
Drawable ,
GC ,
int ,
int ,
unsigned int ,
unsigned int ,
int ,
int
);
extern XFillArcs(
Display* ,
Drawable ,
GC ,
XArc* ,
int
);
extern XFillPolygon(
Display* ,
Drawable ,
GC ,
XPoint* ,
int ,
int ,
int
);
extern XFillRectangle(
Display* ,
Drawable ,
GC ,
int ,
int ,
unsigned int ,
unsigned int
);
extern XFillRectangles(
Display* ,
Drawable ,
GC ,
XRectangle* ,
int
);
extern XFlush(
Display*
);
extern XForceScreenSaver(
Display* ,
int
);
extern XFree(
char*
);
extern XFreeColormap(
Display* ,
Colormap
);
extern XFreeColors(
Display* ,
Colormap ,
unsigned long* ,
int ,
unsigned long
);
extern XFreeCursor(
Display* ,
Cursor
);
extern XFreeExtensionList(
char**
);
extern XFreeFont(
Display* ,
XFontStruct*
);
extern XFreeFontInfo(
char** ,
XFontStruct* ,
int
);
extern XFreeFontNames(
char**
);
extern XFreeFontPath(
char**
);
extern XFreeGC(
Display* ,
GC
);
extern XFreeModifiermap(
XModifierKeymap*
);
extern XFreePixmap(
Display* ,
Pixmap
);
extern int XGeometry(
Display* ,
int ,
const char* ,
const char* ,
unsigned int ,
unsigned int ,
unsigned int ,
int ,
int ,
int* ,
int* ,
int* ,
int*
);
extern XGetErrorDatabaseText(
Display* ,
const char* ,
const char* ,
const char* ,
char* ,
int
);
extern XGetErrorText(
Display* ,
int ,
char* ,
int
);
extern int XGetFontProperty(
XFontStruct* ,
Atom ,
unsigned long*
);
extern int XGetGCValues(
Display* ,
GC ,
unsigned long ,
XGCValues*
);
extern int XGetGeometry(
Display* ,
Drawable ,
Window* ,
int* ,
int* ,
unsigned int* ,
unsigned int* ,
unsigned int* ,
unsigned int*
);
extern int XGetIconName(
Display* ,
Window ,
char**
);
extern XGetInputFocus(
Display* ,
Window* ,
int*
);
extern XGetKeyboardControl(
Display* ,
XKeyboardState*
);
extern XGetPointerControl(
Display* ,
int* ,
int* ,
int*
);
extern int XGetPointerMapping(
Display* ,
unsigned char* ,
int
);
extern XGetScreenSaver(
Display* ,
int* ,
int* ,
int* ,
int*
);
extern int XGetTransientForHint(
Display* ,
Window ,
Window*
);
extern int XGetWindowProperty(
Display* ,
Window ,
Atom ,
long ,
long ,
int ,
Atom ,
Atom* ,
int* ,
unsigned long* ,
unsigned long* ,
unsigned char**
);
extern int XGetWindowAttributes(
Display* ,
Window ,
XWindowAttributes*
);
extern XGrabButton(
Display* ,
unsigned int ,
unsigned int ,
Window ,
int ,
unsigned int ,
int ,
int ,
Window ,
Cursor
);
extern XGrabKey(
Display* ,
int ,
unsigned int ,
Window ,
int ,
int ,
int
);
extern int XGrabKeyboard(
Display* ,
Window ,
int ,
int ,
int ,
Time
);
extern int XGrabPointer(
Display* ,
Window ,
int ,
unsigned int ,
int ,
int ,
Window ,
Cursor ,
Time
);
extern XGrabServer(
Display*
);
extern int XHeightMMOfScreen(
Screen*
);
extern int XHeightOfScreen(
Screen*
);
extern XIfEvent(
Display* ,
XEvent* ,
int (*) ( Display* ,
XEvent* ,
char*
) ,
char*
);
extern int XImageByteOrder(
Display*
);
extern XInstallColormap(
Display* ,
Colormap
);
extern KeyCode XKeysymToKeycode(
Display* ,
KeySym
);
extern XKillClient(
Display* ,
XID
);
extern unsigned long XLastKnownRequestProcessed(
Display*
);
extern int XLookupColor(
Display* ,
Colormap ,
const char* ,
XColor* ,
XColor*
);
extern XLowerWindow(
Display* ,
Window
);
extern XMapRaised(
Display* ,
Window
);
extern XMapSubwindows(
Display* ,
Window
);
extern XMapWindow(
Display* ,
Window
);
extern XMaskEvent(
Display* ,
long ,
XEvent*
);
extern int XMaxCmapsOfScreen(
Screen*
);
extern int XMinCmapsOfScreen(
Screen*
);
extern XMoveResizeWindow(
Display* ,
Window ,
int ,
int ,
unsigned int ,
unsigned int
);
extern XMoveWindow(
Display* ,
Window ,
int ,
int
);
extern XNextEvent(
Display* ,
XEvent*
);
extern XNoOp(
Display*
);
extern int XParseColor(
Display* ,
Colormap ,
const char* ,
XColor*
);
extern int XParseGeometry(
const char* ,
int* ,
int* ,
unsigned int* ,
unsigned int*
);
extern XPeekEvent(
Display* ,
XEvent*
);
extern XPeekIfEvent(
Display* ,
XEvent* ,
int (*) ( Display* ,
XEvent* ,
char*
) ,
char*
);
extern int XPending(
Display*
);
extern int XPlanesOfScreen(
Screen*
);
extern int XProtocolRevision(
Display*
);
extern int XProtocolVersion(
Display*
);
extern XPutBackEvent(
Display* ,
XEvent*
);
extern XPutImage(
Display* ,
Drawable ,
GC ,
XImage* ,
int ,
int ,
int ,
int ,
unsigned int ,
unsigned int
);
extern int XQLength(
Display*
);
extern int XQueryBestCursor(
Display* ,
Drawable ,
unsigned int ,
unsigned int ,
unsigned int* ,
unsigned int*
);
extern int XQueryBestSize(
Display* ,
int ,
Drawable ,
unsigned int ,
unsigned int ,
unsigned int* ,
unsigned int*
);
extern int XQueryBestStipple(
Display* ,
Drawable ,
unsigned int ,
unsigned int ,
unsigned int* ,
unsigned int*
);
extern int XQueryBestTile(
Display* ,
Drawable ,
unsigned int ,
unsigned int ,
unsigned int* ,
unsigned int*
);
extern XQueryColor(
Display* ,
Colormap ,
XColor*
);
extern XQueryColors(
Display* ,
Colormap ,
XColor* ,
int
);
extern int XQueryExtension(
Display* ,
const char* ,
int* ,
int* ,
int*
);
extern XQueryKeymap(
Display* ,
char [32]
);
extern int XQueryPointer(
Display* ,
Window ,
Window* ,
Window* ,
int* ,
int* ,
int* ,
int* ,
unsigned int*
);
extern XQueryTextExtents(
Display* ,
XID ,
const char* ,
int ,
int* ,
int* ,
int* ,
XCharStruct*
);
extern XQueryTextExtents16(
Display* ,
XID ,
const XChar2b* ,
int ,
int* ,
int* ,
int* ,
XCharStruct*
);
extern int XQueryTree(
Display* ,
Window ,
Window* ,
Window* ,
Window** ,
unsigned int*
);
extern XRaiseWindow(
Display* ,
Window
);
extern int XReadBitmapFile(
Display* ,
Drawable ,
const char* ,
unsigned int* ,
unsigned int* ,
Pixmap* ,
int* ,
int*
);
extern XRebindKeysym(
Display* ,
KeySym ,
KeySym* ,
int ,
const unsigned char* ,
int
);
extern XRecolorCursor(
Display* ,
Cursor ,
XColor* ,
XColor*
);
extern XRefreshKeyboardMapping(
XMappingEvent*
);
extern XRemoveFromSaveSet(
Display* ,
Window
);
extern XRemoveHost(
Display* ,
XHostAddress*
);
extern XRemoveHosts(
Display* ,
XHostAddress* ,
int
);
extern XReparentWindow(
Display* ,
Window ,
Window ,
int ,
int
);
extern XResetScreenSaver(
Display*
);
extern XResizeWindow(
Display* ,
Window ,
unsigned int ,
unsigned int
);
extern XRestackWindows(
Display* ,
Window* ,
int
);
extern XRotateBuffers(
Display* ,
int
);
extern XRotateWindowProperties(
Display* ,
Window ,
Atom* ,
int ,
int
);
extern int XScreenCount(
Display*
);
extern XSelectInput(
Display* ,
Window ,
long
);
extern int XSendEvent(
Display* ,
Window ,
int ,
long ,
XEvent*
);
extern XSetAccessControl(
Display* ,
int
);
extern XSetArcMode(
Display* ,
GC ,
int
);
extern XSetBackground(
Display* ,
GC ,
unsigned long
);
extern XSetClipMask(
Display* ,
GC ,
Pixmap
);
extern XSetClipOrigin(
Display* ,
GC ,
int ,
int
);
extern XSetClipRectangles(
Display* ,
GC ,
int ,
int ,
XRectangle* ,
int ,
int
);
extern XSetCloseDownMode(
Display* ,
int
);
extern XSetCommand(
Display* ,
Window ,
char** ,
int
);
extern XSetDashes(
Display* ,
GC ,
int ,
const char* ,
int
);
extern XSetFillRule(
Display* ,
GC ,
int
);
extern XSetFillStyle(
Display* ,
GC ,
int
);
extern XSetFont(
Display* ,
GC ,
Font
);
extern XSetFontPath(
Display* ,
char** ,
int
);
extern XSetForeground(
Display* ,
GC ,
unsigned long
);
extern XSetFunction(
Display* ,
GC ,
int
);
extern XSetGraphicsExposures(
Display* ,
GC ,
int
);
extern XSetIconName(
Display* ,
Window ,
const char*
);
extern XSetInputFocus(
Display* ,
Window ,
int ,
Time
);
extern XSetLineAttributes(
Display* ,
GC ,
unsigned int ,
int ,
int ,
int
);
extern int XSetModifierMapping(
Display* ,
XModifierKeymap*
);
extern XSetPlaneMask(
Display* ,
GC ,
unsigned long
);
extern int XSetPointerMapping(
Display* ,
const unsigned char* ,
int
);
extern XSetScreenSaver(
Display* ,
int ,
int ,
int ,
int
);
extern XSetSelectionOwner(
Display* ,
Atom ,
Window ,
Time
);
extern XSetState(
Display* ,
GC ,
unsigned long ,
unsigned long ,
int ,
unsigned long
);
extern XSetStipple(
Display* ,
GC ,
Pixmap
);
extern XSetSubwindowMode(
Display* ,
GC ,
int
);
extern XSetTSOrigin(
Display* ,
GC ,
int ,
int
);
extern XSetTile(
Display* ,
GC ,
Pixmap
);
extern XSetWindowBackground(
Display* ,
Window ,
unsigned long
);
extern XSetWindowBackgroundPixmap(
Display* ,
Window ,
Pixmap
);
extern XSetWindowBorder(
Display* ,
Window ,
unsigned long
);
extern XSetWindowBorderPixmap(
Display* ,
Window ,
Pixmap
);
extern XSetWindowBorderWidth(
Display* ,
Window ,
unsigned int
);
extern XSetWindowColormap(
Display* ,
Window ,
Colormap
);
extern XStoreBuffer(
Display* ,
const char* ,
int ,
int
);
extern XStoreBytes(
Display* ,
const char* ,
int
);
extern XStoreColor(
Display* ,
Colormap ,
XColor*
);
extern XStoreColors(
Display* ,
Colormap ,
XColor* ,
int
);
extern XStoreName(
Display* ,
Window ,
const char*
);
extern XStoreNamedColor(
Display* ,
Colormap ,
const char* ,
unsigned long ,
int
);
extern XSync(
Display* ,
int
);
extern XTextExtents(
XFontStruct* ,
const char* ,
int ,
int* ,
int* ,
int* ,
XCharStruct*
);
extern XTextExtents16(
XFontStruct* ,
const XChar2b* ,
int ,
int* ,
int* ,
int* ,
XCharStruct*
);
extern int XTextWidth(
XFontStruct* ,
const char* ,
int
);
extern int XTextWidth16(
XFontStruct* ,
const XChar2b* ,
int
);
extern int XTranslateCoordinates(
Display* ,
Window ,
Window ,
int ,
int ,
int* ,
int* ,
Window*
);
extern XUndefineCursor(
Display* ,
Window
);
extern XUngrabButton(
Display* ,
unsigned int ,
unsigned int ,
Window
);
extern XUngrabKey(
Display* ,
int ,
unsigned int ,
Window
);
extern XUngrabKeyboard(
Display* ,
Time
);
extern XUngrabPointer(
Display* ,
Time
);
extern XUngrabServer(
Display*
);
extern XUninstallColormap(
Display* ,
Colormap
);
extern XUnloadFont(
Display* ,
Font
);
extern XUnmapSubwindows(
Display* ,
Window
);
extern XUnmapWindow(
Display* ,
Window
);
extern int XVendorRelease(
Display*
);
extern XWarpPointer(
Display* ,
Window ,
Window ,
int ,
int ,
unsigned int ,
unsigned int ,
int ,
int
);
extern int XWidthMMOfScreen(
Screen*
);
extern int XWidthOfScreen(
Screen*
);
extern XWindowEvent(
Display* ,
Window ,
long ,
XEvent*
);
extern int XWriteBitmapFile(
Display* ,
const char* ,
Pixmap ,
unsigned int ,
unsigned int ,
int ,
int
);
# 3855 "/usr/include/X11/Xlib.h"
# 19 "../V/lib/Vlib.h"
# 1 "/usr/include/stdio.h"
extern struct _iobuf {
int _cnt;
char *_ptr;
char *_base;
int _bufsiz;
short _flag;
char _file;
} _iob[];
struct _iobuf *fopen();
struct _iobuf *fdopen();
struct _iobuf *freopen();
struct _iobuf *popen();
long ftell();
char *fgets();
char *gets();
int sprintf();
# 20 "../V/lib/Vlib.h"
# 1 "/usr/include/memory.h"
extern char *memccpy();
extern char *memchr();
extern int memcmp();
extern char *memcpy();
extern char *memset();
# 21 "../V/lib/Vlib.h"
typedef struct _vcolor {
char *color_name;
short index;
XColor xcolor;
struct _vcolor *next;
} VColor;
typedef struct {
double x, y, z;
} VPoint;
typedef struct {
short numVtces;
VPoint *vertex;
VColor *color;
} VPolygon;
typedef struct {
char *name;
int numPolys;
VPolygon **polygon;
} VObject;
typedef struct {
double m[4][4];
} VMatrix;
typedef struct {
unsigned long flags;
VMatrix eyeSpace;
VPolygon *clipPoly;
double units;
double dist;
double xres;
double yres;
int width;
int height;
VPoint Middl;
VPoint Scale;
Display *dpy;
int screen;
Window *win;
Pixmap monoPixmap;
int colors;
int set;
unsigned long mask;
unsigned long aMask, bMask;
unsigned long *pixel;
unsigned long aPixel[8 ];
unsigned long bPixel[8 ];
XColor aColor[8 *8 ];
XColor bColor[8 *8 ];
Colormap cmap;
} Viewport;
VColor *VColorList;
Viewport *VOpenViewport();
void VResizeViewport();
void VCloseViewport();
VPolygon *VCreatePolygon();
VPolygon *VCopyPolygon();
VPolygon *VClipPolygon();
VPoint *VCreatePoints();
VColor *VAllocColor();
int VBindColors();
void VExposeBuffer();
VObject *VReadObject();
int VWriteObject();
VMatrix *VRotate();
VMatrix *VTranslate();
VMatrix *VTranslatePoint();
double VMatrixDeterminant();
VMatrix *VMatrixInvert();
void VTransform();
double VDotProd();
char *Vmalloc();
# 134 "../V/lib/Vlib.h"
# 9 "./pm.h"
typedef struct _viewer {
struct _viewer *next;
Display *dpy;
Window win;
Window twin, rwin;
GC gc;
XFontStruct *font;
XFontStruct *rfont;
Viewport *v;
Pixmap eng;
Pixmap flap[5];
int cn;
int width, height;
int xCenter, yCenter;
int ftw, fth;
int rftw, rfth;
int radarWidth;
int radarHeight;
scaleControl altScale;
scaleControl velScale;
scaleControl hdgScale;
int TEWSx, TEWSy;
int TEWSSize;
} viewer;
typedef struct {
char *name;
double aspectRatio;
double CLOrigin, CLSlope;
double CLNegStall, CLPosStall;
double betaStall;
double CDOrigin, CDFactor;
double CDPhase;
double CDBOrigin, CDBFactor;
double CDBPhase;
double CLbeta;
double CMOrigin, CMFactor;
double CNOrigin, CNFactor;
double effAileron;
double effElevator;
double effRudder;
VMatrix I;
double LDamp;
double MDamp;
double NDamp;
double cmSlope;
double cmFactor;
double cnSlope;
double cnFactor;
double maxFlap;
double cFlap;
double flapRate;
double maxSpeedBrake;
double cSpeedBrake;
double speedBrakeRate;
double speedBrakeIncr;
double wingS;
double emptyWeight;
double maxFuel;
double maxThrust;
double maxABThrust;
double spFuelConsump;
double spABFuelConsump;
VPoint groundingPoint;
VPoint viewPoint;
double crashC;
double muStatic;
double muKinetic;
double muBStatic;
double muBKinetic;
double maxNWDef;
double NWIncr;
double maxNWS;
double gearD1;
double gearD2;
double armDelay;
double radarOutput;
double radarTRange;
double radarDRange;
double TEWSThreshold;
int sCount;
VPoint wStation[9];
int (*placeProc)();
VObject *object;
} craftType;
typedef struct _wdsc {
int mask;
int (*select)();
int (*update)();
int (*display)();
int (*firePress)();
int (*fireRelease)();
craftType *w;
} weaponDesc;
typedef struct _wctl {
int type;
int info;
int info2;
int info3;
} weaponStation;
typedef struct _craft {
int index;
int type;
int team;
double createTime;
viewer *vl;
VMatrix trihedral;
VMatrix Itrihedral;
VPoint C;
VPoint Cg;
VPoint Sg;
double rho;
VPoint G;
VPoint prevSg;
double p, q, r;
double Se, Sa, Sr;
double curHeading, curPitch, curRoll;
double curThrust;
double curFlap;
double flapSetting;
double curSpeedBrake;
double speedBrakeSetting;
int throttle;
double alpha, beta;
double fuel;
int groundContact;
int flags;
int radarMode;
double curNWDef;
int armFuse;
craftType *cinfo;
double order;
struct _craft *next;
VPoint viewDirection;
VPoint viewUp;
char name[32];
char display[32];
short curRadarTarget;
double targetDistance;
double targetClosure;
short relValid[16];
VPoint relPos[16];
double rval[16];
char *leftHUD[3];
char *rightHUD[3];
int curWeapon;
weaponStation station[9];
} craft;
int recordCount;
double curTime;
craft stbl[8];
craft ptbl[16];
craft mtbl[16*8];
weaponDesc wtbl[4];
double deltaT;
double halfDeltaTSquared;
int HUDPixel;
VColor *HUDColor;
int whitePixel;
VColor *whiteColor;
int blackPixel;
VColor *blackColor;
VColor *groundColor;
# 13 "m61a1.c"
# 1 "/usr/include/stdio.h"
# 63 "/usr/include/stdio.h"
# 14 "m61a1.c"
# 1 "/usr/include/string.h"
# 1 "/usr/include/strings.h"
char *strcat();
char *strncat();
int strcmp();
int strncmp();
char *strcpy();
char *strncpy();
int strlen();
char *index();
char *rindex();
# 10 "/usr/include/string.h"
extern char *strcpyn();
extern char *strcatn();
extern int strcmpn();
extern char *strchr();
extern char *strrchr();
extern char *strpbrk();
extern int strspn();
extern int strcspn();
extern char *strtok();
# 15 "m61a1.c"
# 1 "/usr/include/math.h"
extern double asinh(), acosh(), atanh();
extern double erf(), erfc();
extern double exp(), expm1(), log(), log10(), log1p(), pow();
extern double fabs(), floor(), ceil(), rint();
extern double lgamma();
extern double hypot(), cabs();
extern double copysign(), drem(), logb(), scalb();
extern int finite();
# 13 "/usr/include/math.h"
extern double j0(), j1(), jn(), y0(), y1(), yn();
extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();
extern double sinh(), cosh(), tanh();
extern double cbrt(), sqrt();
extern double modf(), ldexp(), frexp(), atof();
# 16 "m61a1.c"
int select_m61a1();
int display_m61a1();
int update_m61a1();
int press_m61a1();
int release_m61a1();
extern craftType * lookupCraft();
weaponDesc m61a1Desc = {
0x01 ,
select_m61a1,
update_m61a1,
display_m61a1,
press_m61a1,
release_m61a1,
};
int select_m61a1 (c)
craft *c; {
if (c->station[0].type == 0x01 && c->station[0].info > 0)
return 1;
else
return 0;
}
int display_m61a1 (c, w, u)
craft *c;
craftType *w;
viewer *u; {
char s[16];
register int tx, ty, m;
# 73 "m61a1.c"
XSegment seg[2];
strcpy (c->leftHUD[0], "LCOS");
sprintf (s, "%.3d M-61A1", c->station[0].info);
strcpy (c->leftHUD[1], s);
if (c->station[0].info3)
strcpy (c->leftHUD[2], "FIRING");
else
strcpy (c->leftHUD[2], "");
m = (double) 7 * (double) u->width /
(double) 1200 + 0.5;
tx = u->xCenter;
ty = u->yCenter - 3 * 9;
seg[0].x1 = tx - m;
seg[0].x2 = tx + m;
seg[0].y1 = seg[0].y2 = ty;
seg[1].x1 = seg[1].x2 = tx;
seg[1].y1 = ty - m;
seg[1].y2 = ty + m;
XDrawSegments (u->dpy, u->win, u->gc, seg, 2);
# 111 "m61a1.c"
return(0);
}
int press_m61a1 (c)
craft *c; {
c->station[0].info3 |= 1;
return 0;
}
int release_m61a1 (c)
craft *c; {
c->station[0].info3 &= ~1;
return 0;
}
extern long random ();
int update_m61a1 (c)
craft *c; {
craft *m;
int i;
VPoint tmp, mvel;
int curRadarTarget;
double fuzz, fuzzAngle, phiY, phiZ, tm, mv = (3.2808 * 1036.0);
if (c->station[0].info3 == 0)
return 0;
if (c->station[0].info <= 0)
return -1;
for ((i=0, m= &mtbl[0]); i<16*8; (++i, ++m))
if (m->type == 0 ) {
m->type = 3 ;
break;
}
if (i == 16*8)
return -1;
fuzz = ((double)(random() & 32767) +
(double)(random() & 32767)) / 32768.0 - 1.0;
fuzz = fuzz * ( (1.0 * 3.1415927 / 180.0)) ;
fuzzAngle = 2.0 * 3.1415927 * (double)(random() & 511) / 512.0;
phiZ = fuzz * sin (fuzzAngle);
phiY = fuzz * cos (fuzzAngle);
tm = mv * cos (( (3.0 * 3.1415927 / 180.0)) + phiZ);
tmp.x = tm * cos (phiY);
tmp.y = tm * sin (phiY);
tmp.z = mv * sin (-( (3.0 * 3.1415927 / 180.0)) + phiZ);
VTransform (&tmp, &(c->trihedral), &mvel);
m->createTime = curTime;
m->Cg = c->Cg;
m->curRoll = c->curRoll;
m->curPitch = c->curPitch;
m->curHeading = c->curHeading;
m->Cg.x += mvel.x;
m->Cg.y += mvel.y;
m->Cg.z += mvel.z;
VTransform (&(c->cinfo->wStation[0]), &(c->trihedral), &tmp);
m->Sg.x = c->Sg.x + tmp.x;
m->Sg.y = c->Sg.y + tmp.y;
m->Sg.z = c->Sg.z + tmp.z;
m->curRadarTarget = (3000.0 / 60.0) * deltaT;
m->curRadarTarget = (m->curRadarTarget > c->station[0].info) ? c->station[0].info : m->curRadarTarget;
m->groundContact = 10 ;
m->radarMode = c->station[0].info2 % m->groundContact;
c->station[0].info -= m->curRadarTarget;
c->station[0].info2 += m->curRadarTarget;
m->cinfo = lookupCraft ("m61a1 cannon");
return 0;
}
extern craftType * newCraft ();
extern char * strdup();
int placeCannon(c, m, poly, cnt)
craft *c;
VMatrix *m;
VPolygon **poly;
int *cnt; {
double t, intervalT;
VPoint v, s;
int i, j, k, n;
VPoint *q, tmp;
VPolygon **p;
v.x = c->Sg.x - c->prevSg.x;
v.y = c->Sg.y - c->prevSg.y;
v.z = c->Sg.z - c->prevSg.z;
intervalT = 1.0 / c->curRadarTarget;
for (t=intervalT*c->radarMode; t <= 1.0; t += intervalT * 10 ) {
s.x = -v.x * t;
s.y = -v.y * t;
s.z = -v.z * t;
if (c->Sg.z + s.z > 0.0)
continue;
n = c->cinfo->object->numPolys;
p = c->cinfo->object->polygon;
j = *cnt;
for (i=0; i<n; ++i) {
poly[j] = VCopyPolygon(p[i]);
for ((k=0, q=poly[j]->vertex); k<poly[j]->numVtces; (++k, ++q)) {
VTransform(q, m, &tmp);
tmp.x += s.x;
tmp.y += s.y;
tmp.z += s.z;
*q = tmp;
}
++j;
}
*cnt = j;
}
return(0);
}
void initm61a1()
{
craftType *c;
struct _iobuf *f;
wtbl[1] = m61a1Desc;
c = newCraft();
c->name = strdup("m61a1 cannon");
c->placeProc = placeCannon;
f = fopen ("bullet", "r");
c->object = VReadObject(f);
fclose (f);
}
int cannonCalculations (c)
craft *c; {
if (curTime - c->createTime > 10.0)
return 1;
if (c->Sg.z > 0.0)
return 1;
c->prevSg = c->Sg;
c->Sg.x += c->Cg.x * deltaT;
c->Sg.y += c->Cg.y * deltaT;
c->Sg.z += c->Cg.z * deltaT + 32.15 * halfDeltaTSquared;
c->Cg.z += 32.15 * deltaT;
return 0;
}