diff options
Diffstat (limited to 'sys/gio/sgikern')
38 files changed, 4270 insertions, 0 deletions
diff --git a/sys/gio/sgikern/README b/sys/gio/sgikern/README new file mode 100644 index 00000000..e944a4be --- /dev/null +++ b/sys/gio/sgikern/README @@ -0,0 +1,12 @@ +SGIKERN - + +This directory contains the source for the simple GIO kernel, used to write +a metacode file using only the simplest possible drawing instructions. This +makes it relatively easy to implement functional (but probably suboptimal) +translators for new devices. + +Special graphcap entries used by this kernel: + + MF maximum frame count per metafile + FS frame advance req'd at start of metafile + FE frame advance req'd at end of metafile diff --git a/sys/gio/sgikern/font.com b/sys/gio/sgikern/font.com new file mode 100644 index 00000000..c26af8d6 --- /dev/null +++ b/sys/gio/sgikern/font.com @@ -0,0 +1,746 @@ +# CHRTAB -- Table of strokes for the printable ASCII characters. Each +# character is encoded as a series of strokes. Each stroke is ex- +# pressed by a single integer containing the following bitfields: +# +# 2 1 +# 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 +# | | | | | | | +# | | | +---------+ +---------+ +# | | | | | +# | | | X Y +# | | | +# | | +-- pen up/down +# | +---- begin paint (not used at present) +# +------ end paint (not used at present) +# +#---------------------------------------------------------------------------- + +# Define the database. + +short chridx[97] # character index in chrtab +short chrwid[97] # character width table +short chrtab[3363] # stroke data to draw the characters + +# Index into CHRTAB of each printable character (starting with SP) + +data (chridx(i), i=001,005) / 1, 3, 32, 49, 58/ +data (chridx(i), i=006,010) / 110, 140, 207, 228, 253/ +data (chridx(i), i=011,015) / 278, 309, 322, 343, 350/ +data (chridx(i), i=016,020) / 365, 372, 418, 438, 494/ +data (chridx(i), i=021,025) / 563, 583, 632, 696, 733/ +data (chridx(i), i=026,030) / 803, 867, 896, 931, 935/ +data (chridx(i), i=031,035) / 948, 952, 999, 1052, 1077/ +data (chridx(i), i=036,040) / 1139, 1174, 1223, 1281, 1330/ +data (chridx(i), i=041,045) / 1381, 1436, 1463, 1500, 1547/ +data (chridx(i), i=046,050) / 1583, 1626, 1653, 1703, 1748/ +data (chridx(i), i=051,055) / 1818, 1881, 1923, 1962, 1997/ +data (chridx(i), i=056,060) / 2021, 2060, 2097, 2131, 2160/ +data (chridx(i), i=061,065) / 2169, 2172, 2181, 2190, 2193/ +data (chridx(i), i=066,070) / 2214, 2263, 2303, 2335, 2378/ +data (chridx(i), i=071,075) / 2415, 2447, 2527, 2575, 2606/ +data (chridx(i), i=076,080) / 2640, 2682, 2704, 2778, 2826/ +data (chridx(i), i=081,085) / 2868, 2916, 2961, 2994, 3033/ +data (chridx(i), i=086,090) / 3052, 3086, 3108, 3140, 3173/ +data (chridx(i), i=091,095) / 3204, 3233, 3271, 3274, 3312/ +data (chridx(i), i=096,096) / 3335/ + + +# Width data. + +data (chrwid(i), i=001,005) / 21, 16, 23, 26, 25/ +data (chrwid(i), i=006,010) / 29, 31, 16, 19, 19/ +data (chrwid(i), i=011,015) / 21, 30, 16, 30, 16/ +data (chrwid(i), i=016,020) / 28, 25, 25, 25, 25/ +data (chrwid(i), i=021,025) / 25, 25, 25, 25, 25/ +data (chrwid(i), i=026,030) / 25, 16, 16, 29, 30/ +data (chrwid(i), i=031,035) / 29, 24, 32, 25, 27/ +data (chrwid(i), i=036,040) / 26, 27, 26, 25, 28/ +data (chrwid(i), i=041,045) / 29, 17, 21, 27, 23/ +data (chrwid(i), i=046,050) / 31, 29, 27, 27, 27/ +data (chrwid(i), i=051,055) / 27, 25, 25, 29, 25/ +data (chrwid(i), i=056,060) / 29, 25, 27, 25, 19/ +data (chrwid(i), i=061,065) / 19, 19, 21, 21, 16/ +data (chrwid(i), i=066,070) / 25, 26, 24, 26, 24/ +data (chrwid(i), i=071,075) / 19, 24, 28, 17, 18/ +data (chrwid(i), i=076,080) / 27, 17, 32, 28, 25/ +data (chrwid(i), i=081,085) / 26, 25, 22, 22, 20/ +data (chrwid(i), i=086,090) / 28, 23, 29, 25, 24/ +data (chrwid(i), i=091,095) / 23, 19, 13, 19, 29/ +data (chrwid(i), i=096,096) / 19/ + + +# Stroke data. + +data (chrtab(i), i=0001,0005) / 35, 0, 220, 4251, 4249/ +data (chrtab(i), i=0006,0010) / 4305, 220, 4302, 4366, 220/ +data (chrtab(i), i=0011,0015) / 4380, 4366, 284, 4443, 4441/ +data (chrtab(i), i=0016,0020) / 4369, 202, 4233, 4232, 4295/ +data (chrtab(i), i=0021,0025) / 4359, 4424, 4425, 4362, 4298/ +data (chrtab(i), i=0026,0030) / 201, 4296, 4360, 4361, 4297/ +data (chrtab(i), i=0031,0035) / 0, 220, 4251, 4245, 219/ +data (chrtab(i), i=0036,0040) / 4245, 220, 4379, 4245, 796/ +data (chrtab(i), i=0041,0045) / 4827, 4821, 795, 4821, 796/ +data (chrtab(i), i=0046,0050) / 4955, 4821, 0, 604, 4224/ +data (chrtab(i), i=0051,0055) / 988, 4608, 145, 5137, 75/ +data (chrtab(i), i=0056,0060) / 5067, 0, 416, 4483, 672/ +data (chrtab(i), i=0061,0065) / 4739, 919, 5016, 4952, 4950/ +data (chrtab(i), i=0066,0070) / 5078, 5080, 5018, 4955, 4764/ +data (chrtab(i), i=0071,0075) / 4508, 4315, 4185, 4182, 4244/ +data (chrtab(i), i=0076,0080) / 4434, 4816, 4943, 5005, 5002/ +data (chrtab(i), i=0081,0085) / 4936, 150, 4308, 4435, 4817/ +data (chrtab(i), i=0086,0090) / 4944, 5006, 219, 4249, 4247/ +data (chrtab(i), i=0091,0095) / 4309, 4436, 4818, 5008, 5070/ +data (chrtab(i), i=0096,0100) / 5067, 5001, 4936, 4743, 4487/ +data (chrtab(i), i=0101,0105) / 4296, 4233, 4171, 4173, 4301/ +data (chrtab(i), i=0106,0110) / 4299, 4235, 4236, 0, 1244/ +data (chrtab(i), i=0111,0115) / 4167, 412, 4634, 4632, 4566/ +data (chrtab(i), i=0116,0120) / 4437, 4309, 4183, 4185, 4251/ +data (chrtab(i), i=0121,0125) / 4380, 4508, 4635, 4826, 5018/ +data (chrtab(i), i=0126,0130) / 5211, 5340, 974, 4941, 4875/ +data (chrtab(i), i=0131,0135) / 4873, 4999, 5127, 5256, 5322/ +data (chrtab(i), i=0136,0140) / 5324, 5198, 5070, 0, 1299/ +data (chrtab(i), i=0141,0145) / 5396, 5332, 5330, 5458, 5460/ +data (chrtab(i), i=0146,0150) / 5397, 5333, 5268, 5202, 5069/ +data (chrtab(i), i=0151,0155) / 4938, 4808, 4679, 4423, 4296/ +data (chrtab(i), i=0156,0160) / 4234, 4237, 4303, 4691, 4821/ +data (chrtab(i), i=0161,0165) / 4887, 4889, 4827, 4700, 4571/ +data (chrtab(i), i=0166,0170) / 4505, 4502, 4563, 4688, 4939/ +data (chrtab(i), i=0171,0175) / 5128, 5255, 5383, 5449, 5450/ +data (chrtab(i), i=0176,0180) / 264, 4298, 4301, 4367, 4432/ +data (chrtab(i), i=0181,0185) / 725, 4889, 791, 4827, 475/ +data (chrtab(i), i=0186,0190) / 4503, 468, 4689, 4940, 5129/ +data (chrtab(i), i=0191,0195) / 5256, 455, 4424, 4362, 4365/ +data (chrtab(i), i=0196,0200) / 4431, 4691, 409, 4565, 4753/ +data (chrtab(i), i=0201,0205) / 5004, 5193, 5320, 5384, 5449/ +data (chrtab(i), i=0206,0210) / 0, 346, 4377, 4313, 4250/ +data (chrtab(i), i=0211,0215) / 4251, 4316, 4380, 4443, 4440/ +data (chrtab(i), i=0216,0220) / 4374, 4245, 219, 4314, 4378/ +data (chrtab(i), i=0221,0225) / 4379, 4315, 281, 4440, 346/ +data (chrtab(i), i=0226,0230) / 4374, 0, 544, 4510, 4379/ +data (chrtab(i), i=0231,0235) / 4247, 4178, 4174, 4233, 4357/ +data (chrtab(i), i=0236,0240) / 4482, 4608, 282, 4311, 4243/ +data (chrtab(i), i=0241,0245) / 4237, 4297, 4358, 414, 4444/ +data (chrtab(i), i=0246,0250) / 4377, 4307, 4301, 4359, 4420/ +data (chrtab(i), i=0251,0255) / 4482, 0, 160, 4382, 4507/ +data (chrtab(i), i=0256,0260) / 4631, 4690, 4686, 4617, 4485/ +data (chrtab(i), i=0261,0265) / 4354, 4224, 410, 4567, 4627/ +data (chrtab(i), i=0266,0270) / 4621, 4553, 4486, 286, 4444/ +data (chrtab(i), i=0271,0275) / 4505, 4563, 4557, 4487, 4420/ +data (chrtab(i), i=0276,0280) / 4354, 0, 412, 4443, 4561/ +data (chrtab(i), i=0281,0285) / 4496, 412, 4496, 412, 4571/ +data (chrtab(i), i=0286,0290) / 4433, 4496, 89, 4249, 4755/ +data (chrtab(i), i=0291,0295) / 4819, 89, 4819, 89, 4184/ +data (chrtab(i), i=0296,0300) / 4820, 4819, 729, 4761, 4243/ +data (chrtab(i), i=0301,0305) / 4179, 729, 4179, 729, 4824/ +data (chrtab(i), i=0306,0310) / 4180, 4179, 0, 665, 4744/ +data (chrtab(i), i=0311,0315) / 4808, 665, 4825, 4808, 145/ +data (chrtab(i), i=0316,0320) / 5329, 5328, 145, 4240, 5328/ +data (chrtab(i), i=0321,0325) / 0, 328, 4359, 4295, 4232/ +data (chrtab(i), i=0326,0330) / 4233, 4298, 4362, 4425, 4422/ +data (chrtab(i), i=0331,0335) / 4356, 4227, 201, 4296, 4360/ +data (chrtab(i), i=0336,0340) / 4361, 4297, 263, 4422, 328/ +data (chrtab(i), i=0341,0345) / 4356, 0, 145, 5329, 5328/ +data (chrtab(i), i=0346,0350) / 145, 4240, 5328, 0, 202/ +data (chrtab(i), i=0351,0355) / 4233, 4232, 4295, 4359, 4424/ +data (chrtab(i), i=0356,0360) / 4425, 4362, 4298, 201, 4296/ +data (chrtab(i), i=0361,0365) / 4360, 4361, 4297, 0, 1184/ +data (chrtab(i), i=0366,0370) / 4096, 4160, 1184, 5344, 4160/ +data (chrtab(i), i=0371,0375) / 0, 476, 4379, 4248, 4179/ +data (chrtab(i), i=0376,0380) / 4176, 4235, 4360, 4551, 4679/ +data (chrtab(i), i=0381,0385) / 4872, 5003, 5072, 5075, 5016/ +data (chrtab(i), i=0386,0390) / 4891, 4700, 4572, 282, 4312/ +data (chrtab(i), i=0391,0395) / 4244, 4239, 4299, 4361, 777/ +data (chrtab(i), i=0396,0400) / 4939, 5007, 5012, 4952, 4890/ +data (chrtab(i), i=0401,0405) / 476, 4443, 4377, 4308, 4303/ +data (chrtab(i), i=0406,0410) / 4362, 4424, 4551, 583, 4808/ +data (chrtab(i), i=0411,0415) / 4874, 4943, 4948, 4889, 4827/ +data (chrtab(i), i=0416,0420) / 4700, 0, 474, 4551, 538/ +data (chrtab(i), i=0421,0425) / 4616, 604, 4679, 604, 4505/ +data (chrtab(i), i=0426,0430) / 4376, 199, 4935, 456, 4423/ +data (chrtab(i), i=0431,0435) / 457, 4487, 585, 4743, 584/ +data (chrtab(i), i=0436,0440) / 4807, 0, 152, 4247, 4311/ +data (chrtab(i), i=0441,0445) / 4312, 4248, 153, 4313, 4376/ +data (chrtab(i), i=0446,0450) / 4375, 4310, 4246, 4183, 4184/ +data (chrtab(i), i=0451,0455) / 4250, 4315, 4508, 4764, 4955/ +data (chrtab(i), i=0456,0460) / 5018, 5080, 5078, 5012, 4818/ +data (chrtab(i), i=0461,0465) / 4496, 4367, 4237, 4170, 4167/ +data (chrtab(i), i=0466,0470) / 858, 5016, 5014, 4948, 668/ +data (chrtab(i), i=0471,0475) / 4891, 4952, 4950, 4884, 4754/ +data (chrtab(i), i=0476,0480) / 4496, 73, 4234, 4362, 4681/ +data (chrtab(i), i=0481,0485) / 4937, 5066, 266, 4680, 4936/ +data (chrtab(i), i=0486,0490) / 5001, 266, 4679, 4935, 5000/ +data (chrtab(i), i=0491,0495) / 5066, 5068, 0, 152, 4247/ +data (chrtab(i), i=0496,0500) / 4311, 4312, 4248, 153, 4313/ +data (chrtab(i), i=0501,0505) / 4376, 4375, 4310, 4246, 4183/ +data (chrtab(i), i=0506,0510) / 4184, 4250, 4315, 4508, 4764/ +data (chrtab(i), i=0511,0515) / 4955, 5017, 5014, 4948, 4755/ +data (chrtab(i), i=0516,0520) / 795, 4953, 4950, 4884, 604/ +data (chrtab(i), i=0521,0525) / 4827, 4889, 4886, 4820, 4691/ +data (chrtab(i), i=0526,0530) / 467, 4755, 4882, 5008, 5070/ +data (chrtab(i), i=0531,0535) / 5067, 5001, 4936, 4743, 4487/ +data (chrtab(i), i=0536,0540) / 4296, 4233, 4171, 4172, 4237/ +data (chrtab(i), i=0541,0545) / 4301, 4364, 4363, 4298, 4234/ +data (chrtab(i), i=0546,0550) / 848, 5006, 5003, 4937, 595/ +data (chrtab(i), i=0551,0555) / 4818, 4881, 4942, 4939, 4872/ +data (chrtab(i), i=0556,0560) / 4743, 140, 4235, 4299, 4300/ +data (chrtab(i), i=0561,0565) / 4236, 0, 601, 4679, 666/ +data (chrtab(i), i=0566,0570) / 4744, 732, 4807, 732, 4109/ +data (chrtab(i), i=0571,0575) / 5133, 391, 4999, 584, 4551/ +data (chrtab(i), i=0576,0580) / 585, 4615, 713, 4871, 712/ +data (chrtab(i), i=0581,0585) / 4935, 0, 220, 4178, 4308/ +data (chrtab(i), i=0586,0590) / 4501, 4693, 4884, 5010, 5071/ +data (chrtab(i), i=0591,0595) / 5069, 5002, 4872, 4679, 4487/ +data (chrtab(i), i=0596,0600) / 4296, 4233, 4171, 4172, 4237/ +data (chrtab(i), i=0601,0605) / 4301, 4364, 4363, 4298, 4234/ +data (chrtab(i), i=0606,0610) / 850, 5008, 5004, 4938, 597/ +data (chrtab(i), i=0611,0615) / 4820, 4883, 4944, 4940, 4873/ +data (chrtab(i), i=0616,0620) / 4808, 4679, 140, 4235, 4299/ +data (chrtab(i), i=0621,0625) / 4300, 4236, 220, 4956, 219/ +data (chrtab(i), i=0626,0630) / 4827, 218, 4570, 4827, 4956/ +data (chrtab(i), i=0631,0635) / 0, 793, 4888, 4952, 4953/ +data (chrtab(i), i=0636,0640) / 4889, 858, 4890, 4825, 4824/ +data (chrtab(i), i=0641,0645) / 4887, 4951, 5016, 5017, 4955/ +data (chrtab(i), i=0646,0650) / 4828, 4636, 4443, 4313, 4247/ +data (chrtab(i), i=0651,0655) / 4179, 4173, 4234, 4360, 4551/ +data (chrtab(i), i=0656,0660) / 4679, 4872, 5002, 5069, 5070/ +data (chrtab(i), i=0661,0665) / 5009, 4883, 4692, 4564, 4435/ +data (chrtab(i), i=0666,0670) / 4370, 4304, 281, 4311, 4243/ +data (chrtab(i), i=0671,0675) / 4237, 4298, 4361, 842, 5004/ +data (chrtab(i), i=0676,0680) / 5007, 4945, 540, 4507, 4442/ +data (chrtab(i), i=0681,0685) / 4376, 4308, 4301, 4362, 4424/ +data (chrtab(i), i=0686,0690) / 4551, 583, 4808, 4873, 4940/ +data (chrtab(i), i=0691,0695) / 4943, 4882, 4819, 4692, 0/ +data (chrtab(i), i=0696,0700) / 92, 4182, 988, 5081, 5014/ +data (chrtab(i), i=0701,0705) / 4753, 4687, 4619, 4615, 592/ +data (chrtab(i), i=0706,0710) / 4622, 4555, 4551, 918, 4689/ +data (chrtab(i), i=0711,0715) / 4558, 4491, 4487, 4615, 88/ +data (chrtab(i), i=0716,0720) / 4250, 4380, 4508, 4825, 4953/ +data (chrtab(i), i=0721,0725) / 5018, 5084, 218, 4379, 4507/ +data (chrtab(i), i=0726,0730) / 4634, 88, 4249, 4378, 4506/ +data (chrtab(i), i=0731,0735) / 4825, 0, 412, 4315, 4249/ +data (chrtab(i), i=0736,0740) / 4246, 4308, 4499, 4755, 4948/ +data (chrtab(i), i=0741,0745) / 5014, 5017, 4955, 4764, 4508/ +data (chrtab(i), i=0746,0750) / 283, 4313, 4310, 4372, 788/ +data (chrtab(i), i=0751,0755) / 4950, 4953, 4891, 412, 4443/ +data (chrtab(i), i=0756,0760) / 4377, 4374, 4436, 4499, 659/ +data (chrtab(i), i=0761,0765) / 4820, 4886, 4889, 4827, 4764/ +data (chrtab(i), i=0766,0770) / 403, 4306, 4241, 4175, 4171/ +data (chrtab(i), i=0771,0775) / 4233, 4296, 4487, 4743, 4936/ +data (chrtab(i), i=0776,0780) / 5001, 5067, 5071, 5009, 4946/ +data (chrtab(i), i=0781,0785) / 4755, 209, 4239, 4235, 4297/ +data (chrtab(i), i=0786,0790) / 841, 5003, 5007, 4945, 403/ +data (chrtab(i), i=0791,0795) / 4370, 4303, 4299, 4360, 4487/ +data (chrtab(i), i=0796,0800) / 647, 4872, 4939, 4943, 4882/ +data (chrtab(i), i=0801,0805) / 4755, 0, 203, 4298, 4362/ +data (chrtab(i), i=0806,0810) / 4363, 4299, 851, 4881, 4816/ +data (chrtab(i), i=0811,0815) / 4687, 4559, 4368, 4242, 4181/ +data (chrtab(i), i=0816,0820) / 4182, 4249, 4379, 4572, 4700/ +data (chrtab(i), i=0821,0825) / 4891, 5017, 5078, 5072, 5004/ +data (chrtab(i), i=0826,0830) / 4938, 4808, 4615, 4423, 4296/ +data (chrtab(i), i=0831,0835) / 4234, 4235, 4300, 4364, 4427/ +data (chrtab(i), i=0836,0840) / 4426, 4361, 4297, 210, 4244/ +data (chrtab(i), i=0841,0845) / 4247, 4313, 794, 4953, 5014/ +data (chrtab(i), i=0846,0850) / 5008, 4940, 4874, 463, 4432/ +data (chrtab(i), i=0851,0855) / 4369, 4308, 4311, 4378, 4443/ +data (chrtab(i), i=0856,0860) / 4572, 604, 4827, 4889, 4950/ +data (chrtab(i), i=0861,0865) / 4943, 4875, 4809, 4744, 4615/ +data (chrtab(i), i=0866,0870) / 0, 213, 4244, 4243, 4306/ +data (chrtab(i), i=0871,0875) / 4370, 4435, 4436, 4373, 4309/ +data (chrtab(i), i=0876,0880) / 212, 4307, 4371, 4372, 4308/ +data (chrtab(i), i=0881,0885) / 202, 4233, 4232, 4295, 4359/ +data (chrtab(i), i=0886,0890) / 4424, 4425, 4362, 4298, 201/ +data (chrtab(i), i=0891,0895) / 4296, 4360, 4361, 4297, 0/ +data (chrtab(i), i=0896,0900) / 213, 4244, 4243, 4306, 4370/ +data (chrtab(i), i=0901,0905) / 4435, 4436, 4373, 4309, 212/ +data (chrtab(i), i=0906,0910) / 4307, 4371, 4372, 4308, 328/ +data (chrtab(i), i=0911,0915) / 4359, 4295, 4232, 4233, 4298/ +data (chrtab(i), i=0916,0920) / 4362, 4425, 4422, 4356, 4227/ +data (chrtab(i), i=0921,0925) / 201, 4296, 4360, 4361, 4297/ +data (chrtab(i), i=0926,0930) / 263, 4422, 328, 4356, 0/ +data (chrtab(i), i=0931,0935) / 1177, 4240, 5255, 0, 149/ +data (chrtab(i), i=0936,0940) / 5333, 5332, 149, 4244, 5332/ +data (chrtab(i), i=0941,0945) / 141, 5325, 5324, 141, 4236/ +data (chrtab(i), i=0946,0950) / 5324, 0, 153, 5264, 4231/ +data (chrtab(i), i=0951,0955) / 0, 151, 4248, 4312, 4310/ +data (chrtab(i), i=0956,0960) / 4182, 4184, 4250, 4315, 4444/ +data (chrtab(i), i=0961,0965) / 4700, 4891, 4954, 5016, 5014/ +data (chrtab(i), i=0966,0970) / 4948, 4883, 4625, 794, 4953/ +data (chrtab(i), i=0971,0975) / 4949, 4884, 604, 4827, 4889/ +data (chrtab(i), i=0976,0980) / 4885, 4819, 4754, 465, 4558/ +data (chrtab(i), i=0981,0985) / 4622, 4625, 4561, 458, 4489/ +data (chrtab(i), i=0986,0990) / 4488, 4551, 4615, 4680, 4681/ +data (chrtab(i), i=0991,0995) / 4618, 4554, 457, 4552, 4616/ +data (chrtab(i), i=0996,1000) / 4617, 4553, 0, 1044, 5078/ +data (chrtab(i), i=1001,1005) / 4951, 4759, 4630, 4565, 4498/ +data (chrtab(i), i=1006,1010) / 4495, 4557, 4684, 4876, 5005/ +data (chrtab(i), i=1011,1015) / 5071, 663, 4629, 4562, 4559/ +data (chrtab(i), i=1016,1020) / 4621, 4684, 1047, 5071, 5069/ +data (chrtab(i), i=1021,1025) / 5196, 5324, 5454, 5521, 5523/ +data (chrtab(i), i=1026,1030) / 5462, 5400, 5274, 5147, 4956/ +data (chrtab(i), i=1031,1035) / 4764, 4571, 4442, 4312, 4246/ +data (chrtab(i), i=1036,1040) / 4179, 4176, 4237, 4299, 4425/ +data (chrtab(i), i=1041,1045) / 4552, 4743, 4935, 5128, 5257/ +data (chrtab(i), i=1046,1050) / 5322, 1111, 5135, 5133, 5196/ +data (chrtab(i), i=1051,1055) / 0, 540, 4168, 473, 4935/ +data (chrtab(i), i=1056,1060) / 537, 4999, 540, 5063, 205/ +data (chrtab(i), i=1061,1065) / 4877, 7, 4423, 647, 5191/ +data (chrtab(i), i=1066,1070) / 72, 4103, 72, 4295, 840/ +data (chrtab(i), i=1071,1075) / 4807, 841, 4871, 905, 5127/ +data (chrtab(i), i=1076,1080) / 0, 220, 4295, 283, 4360/ +data (chrtab(i), i=1081,1085) / 348, 4423, 28, 4892, 5083/ +data (chrtab(i), i=1086,1090) / 5146, 5208, 5206, 5140, 5075/ +data (chrtab(i), i=1091,1095) / 4882, 986, 5144, 5142, 5076/ +data (chrtab(i), i=1096,1100) / 796, 5019, 5081, 5077, 5011/ +data (chrtab(i), i=1101,1105) / 4882, 338, 4882, 5073, 5136/ +data (chrtab(i), i=1106,1110) / 5198, 5195, 5129, 5064, 4871/ +data (chrtab(i), i=1111,1115) / 4103, 976, 5134, 5131, 5065/ +data (chrtab(i), i=1116,1120) / 786, 5009, 5071, 5066, 5000/ +data (chrtab(i), i=1121,1125) / 4871, 92, 4315, 156, 4314/ +data (chrtab(i), i=1126,1130) / 412, 4442, 476, 4443, 200/ +data (chrtab(i), i=1131,1135) / 4167, 201, 4231, 329, 4487/ +data (chrtab(i), i=1136,1140) / 328, 4551, 0, 985, 5148/ +data (chrtab(i), i=1141,1145) / 5142, 5081, 4955, 4828, 4636/ +data (chrtab(i), i=1146,1150) / 4443, 4313, 4247, 4180, 4175/ +data (chrtab(i), i=1151,1155) / 4236, 4298, 4424, 4615, 4807/ +data (chrtab(i), i=1156,1160) / 4936, 5066, 5132, 281, 4311/ +data (chrtab(i), i=1161,1165) / 4244, 4239, 4300, 4362, 540/ +data (chrtab(i), i=1166,1170) / 4507, 4376, 4308, 4303, 4363/ +data (chrtab(i), i=1171,1175) / 4488, 4615, 0, 220, 4295/ +data (chrtab(i), i=1176,1180) / 283, 4360, 348, 4423, 28/ +data (chrtab(i), i=1181,1185) / 4764, 4955, 5081, 5143, 5204/ +data (chrtab(i), i=1186,1190) / 5199, 5132, 5066, 4936, 4743/ +data (chrtab(i), i=1191,1195) / 4103, 921, 5079, 5140, 5135/ +data (chrtab(i), i=1196,1200) / 5068, 5002, 668, 4891, 5016/ +data (chrtab(i), i=1201,1205) / 5076, 5071, 5003, 4872, 4743/ +data (chrtab(i), i=1206,1210) / 92, 4315, 156, 4314, 412/ +data (chrtab(i), i=1211,1215) / 4442, 476, 4443, 200, 4167/ +data (chrtab(i), i=1216,1220) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=1221,1225) / 4551, 0, 220, 4295, 283/ +data (chrtab(i), i=1226,1230) / 4360, 348, 4423, 28, 5148/ +data (chrtab(i), i=1231,1235) / 5142, 338, 4818, 726, 4814/ +data (chrtab(i), i=1236,1240) / 7, 5127, 5133, 92, 4315/ +data (chrtab(i), i=1241,1245) / 156, 4314, 412, 4442, 476/ +data (chrtab(i), i=1246,1250) / 4443, 732, 5147, 860, 5146/ +data (chrtab(i), i=1251,1255) / 924, 5145, 988, 5142, 726/ +data (chrtab(i), i=1256,1260) / 4754, 4814, 724, 4690, 4816/ +data (chrtab(i), i=1261,1265) / 723, 4562, 4817, 200, 4167/ +data (chrtab(i), i=1266,1270) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=1271,1275) / 4551, 711, 5128, 839, 5129/ +data (chrtab(i), i=1276,1280) / 903, 5130, 967, 5133, 0/ +data (chrtab(i), i=1281,1285) / 220, 4295, 283, 4360, 348/ +data (chrtab(i), i=1286,1290) / 4423, 28, 5148, 5142, 338/ +data (chrtab(i), i=1291,1295) / 4818, 726, 4814, 7, 4615/ +data (chrtab(i), i=1296,1300) / 92, 4315, 156, 4314, 412/ +data (chrtab(i), i=1301,1305) / 4442, 476, 4443, 732, 5147/ +data (chrtab(i), i=1306,1310) / 860, 5146, 924, 5145, 988/ +data (chrtab(i), i=1311,1315) / 5142, 726, 4754, 4814, 724/ +data (chrtab(i), i=1316,1320) / 4690, 4816, 723, 4562, 4817/ +data (chrtab(i), i=1321,1325) / 200, 4167, 201, 4231, 329/ +data (chrtab(i), i=1326,1330) / 4487, 328, 4551, 0, 985/ +data (chrtab(i), i=1331,1335) / 5148, 5142, 5081, 4955, 4828/ +data (chrtab(i), i=1336,1340) / 4636, 4443, 4313, 4247, 4180/ +data (chrtab(i), i=1341,1345) / 4175, 4236, 4298, 4424, 4615/ +data (chrtab(i), i=1346,1350) / 4807, 4936, 5064, 5127, 5135/ +data (chrtab(i), i=1351,1355) / 281, 4311, 4244, 4239, 4300/ +data (chrtab(i), i=1356,1360) / 4362, 540, 4507, 4376, 4308/ +data (chrtab(i), i=1361,1365) / 4303, 4363, 4488, 4615, 974/ +data (chrtab(i), i=1366,1370) / 5065, 911, 5001, 4936, 719/ +data (chrtab(i), i=1371,1375) / 5327, 783, 5006, 847, 5005/ +data (chrtab(i), i=1376,1380) / 1103, 5133, 1167, 5134, 0/ +data (chrtab(i), i=1381,1385) / 220, 4295, 283, 4360, 348/ +data (chrtab(i), i=1386,1390) / 4423, 988, 5063, 1051, 5128/ +data (chrtab(i), i=1391,1395) / 1116, 5191, 28, 4636, 796/ +data (chrtab(i), i=1396,1400) / 5404, 338, 5074, 7, 4615/ +data (chrtab(i), i=1401,1405) / 775, 5383, 92, 4315, 156/ +data (chrtab(i), i=1406,1410) / 4314, 412, 4442, 476, 4443/ +data (chrtab(i), i=1411,1415) / 860, 5083, 924, 5082, 1180/ +data (chrtab(i), i=1416,1420) / 5210, 1244, 5211, 200, 4167/ +data (chrtab(i), i=1421,1425) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=1426,1430) / 4551, 968, 4935, 969, 4999/ +data (chrtab(i), i=1431,1435) / 1097, 5255, 1096, 5319, 0/ +data (chrtab(i), i=1436,1440) / 220, 4295, 283, 4360, 348/ +data (chrtab(i), i=1441,1445) / 4423, 28, 4636, 7, 4615/ +data (chrtab(i), i=1446,1450) / 92, 4315, 156, 4314, 412/ +data (chrtab(i), i=1451,1455) / 4442, 476, 4443, 200, 4167/ +data (chrtab(i), i=1456,1460) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=1461,1465) / 4551, 0, 476, 4555, 4488/ +data (chrtab(i), i=1466,1470) / 4423, 539, 4619, 4552, 604/ +data (chrtab(i), i=1471,1475) / 4683, 4616, 4423, 4295, 4168/ +data (chrtab(i), i=1476,1480) / 4106, 4108, 4173, 4237, 4300/ +data (chrtab(i), i=1481,1485) / 4299, 4234, 4170, 76, 4171/ +data (chrtab(i), i=1486,1490) / 4235, 4236, 4172, 284, 4892/ +data (chrtab(i), i=1491,1495) / 348, 4571, 412, 4570, 668/ +data (chrtab(i), i=1496,1500) / 4698, 732, 4699, 0, 220/ +data (chrtab(i), i=1501,1505) / 4295, 283, 4360, 348, 4423/ +data (chrtab(i), i=1506,1510) / 1051, 4432, 530, 5063, 594/ +data (chrtab(i), i=1511,1515) / 5127, 596, 5191, 28, 4636/ +data (chrtab(i), i=1516,1520) / 860, 5340, 7, 4615, 775/ +data (chrtab(i), i=1521,1525) / 5319, 92, 4315, 156, 4314/ +data (chrtab(i), i=1526,1530) / 412, 4442, 476, 4443, 988/ +data (chrtab(i), i=1531,1535) / 5147, 1180, 5147, 200, 4167/ +data (chrtab(i), i=1536,1540) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=1541,1545) / 4551, 969, 4935, 969, 5255/ +data (chrtab(i), i=1546,1550) / 0, 220, 4295, 283, 4360/ +data (chrtab(i), i=1551,1555) / 348, 4423, 28, 4636, 7/ +data (chrtab(i), i=1556,1560) / 5063, 5069, 92, 4315, 156/ +data (chrtab(i), i=1561,1565) / 4314, 412, 4442, 476, 4443/ +data (chrtab(i), i=1566,1570) / 200, 4167, 201, 4231, 329/ +data (chrtab(i), i=1571,1575) / 4487, 328, 4551, 647, 5064/ +data (chrtab(i), i=1576,1580) / 775, 5065, 839, 5066, 903/ +data (chrtab(i), i=1581,1585) / 5069, 0, 220, 4296, 220/ +data (chrtab(i), i=1586,1590) / 4743, 284, 4746, 348, 4810/ +data (chrtab(i), i=1591,1595) / 1116, 4743, 1116, 5191, 1179/ +data (chrtab(i), i=1596,1600) / 5256, 1244, 5319, 28, 4444/ +data (chrtab(i), i=1601,1605) / 1116, 5532, 7, 4487, 903/ +data (chrtab(i), i=1606,1610) / 5511, 92, 4315, 1308, 5338/ +data (chrtab(i), i=1611,1615) / 1372, 5339, 200, 4167, 200/ +data (chrtab(i), i=1616,1620) / 4423, 1096, 5063, 1097, 5127/ +data (chrtab(i), i=1621,1625) / 1225, 5383, 1224, 5447, 0/ +data (chrtab(i), i=1626,1630) / 220, 4296, 220, 5191, 284/ +data (chrtab(i), i=1631,1635) / 5130, 348, 5194, 1115, 5191/ +data (chrtab(i), i=1636,1640) / 28, 4444, 924, 5404, 7/ +data (chrtab(i), i=1641,1645) / 4487, 92, 4315, 988, 5211/ +data (chrtab(i), i=1646,1650) / 1244, 5211, 200, 4167, 200/ +data (chrtab(i), i=1651,1655) / 4423, 0, 540, 4443, 4313/ +data (chrtab(i), i=1656,1660) / 4247, 4179, 4176, 4236, 4298/ +data (chrtab(i), i=1661,1665) / 4424, 4615, 4743, 4936, 5066/ +data (chrtab(i), i=1666,1670) / 5132, 5200, 5203, 5143, 5081/ +data (chrtab(i), i=1671,1675) / 4955, 4764, 4636, 281, 4311/ +data (chrtab(i), i=1676,1680) / 4244, 4239, 4300, 4362, 906/ +data (chrtab(i), i=1681,1685) / 5068, 5135, 5140, 5079, 5017/ +data (chrtab(i), i=1686,1690) / 540, 4507, 4376, 4308, 4303/ +data (chrtab(i), i=1691,1695) / 4363, 4488, 4615, 647, 4872/ +data (chrtab(i), i=1696,1700) / 5003, 5071, 5076, 5016, 4891/ +data (chrtab(i), i=1701,1705) / 4764, 0, 220, 4295, 283/ +data (chrtab(i), i=1706,1710) / 4360, 348, 4423, 28, 4892/ +data (chrtab(i), i=1711,1715) / 5083, 5146, 5208, 5205, 5139/ +data (chrtab(i), i=1716,1720) / 5074, 4881, 4433, 986, 5144/ +data (chrtab(i), i=1721,1725) / 5141, 5075, 796, 5019, 5081/ +data (chrtab(i), i=1726,1730) / 5076, 5010, 4881, 7, 4615/ +data (chrtab(i), i=1731,1735) / 92, 4315, 156, 4314, 412/ +data (chrtab(i), i=1736,1740) / 4442, 476, 4443, 200, 4167/ +data (chrtab(i), i=1741,1745) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=1746,1750) / 4551, 0, 540, 4443, 4313/ +data (chrtab(i), i=1751,1755) / 4247, 4179, 4176, 4236, 4298/ +data (chrtab(i), i=1756,1760) / 4424, 4615, 4743, 4936, 5066/ +data (chrtab(i), i=1761,1765) / 5132, 5200, 5203, 5143, 5081/ +data (chrtab(i), i=1766,1770) / 4955, 4764, 4636, 281, 4311/ +data (chrtab(i), i=1771,1775) / 4244, 4239, 4300, 4362, 906/ +data (chrtab(i), i=1776,1780) / 5068, 5135, 5140, 5079, 5017/ +data (chrtab(i), i=1781,1785) / 540, 4507, 4376, 4308, 4303/ +data (chrtab(i), i=1786,1790) / 4363, 4488, 4615, 647, 4872/ +data (chrtab(i), i=1791,1795) / 5003, 5071, 5076, 5016, 4891/ +data (chrtab(i), i=1796,1800) / 4764, 330, 4492, 4621, 4685/ +data (chrtab(i), i=1801,1805) / 4812, 4874, 4932, 4994, 5122/ +data (chrtab(i), i=1806,1810) / 5188, 5190, 838, 4996, 5059/ +data (chrtab(i), i=1811,1815) / 5123, 778, 4997, 5060, 5124/ +data (chrtab(i), i=1816,1820) / 5189, 0, 220, 4295, 283/ +data (chrtab(i), i=1821,1825) / 4360, 348, 4423, 28, 4892/ +data (chrtab(i), i=1826,1830) / 5083, 5146, 5208, 5206, 5140/ +data (chrtab(i), i=1831,1835) / 5075, 4882, 4434, 986, 5144/ +data (chrtab(i), i=1836,1840) / 5142, 5076, 796, 5019, 5081/ +data (chrtab(i), i=1841,1845) / 5077, 5011, 4882, 594, 4817/ +data (chrtab(i), i=1846,1850) / 4879, 5001, 5063, 5191, 5257/ +data (chrtab(i), i=1851,1855) / 5259, 907, 5065, 5128, 5192/ +data (chrtab(i), i=1856,1860) / 721, 4880, 5066, 5129, 5193/ +data (chrtab(i), i=1861,1865) / 5258, 7, 4615, 92, 4315/ +data (chrtab(i), i=1866,1870) / 156, 4314, 412, 4442, 476/ +data (chrtab(i), i=1871,1875) / 4443, 200, 4167, 201, 4231/ +data (chrtab(i), i=1876,1880) / 329, 4487, 328, 4551, 0/ +data (chrtab(i), i=1881,1885) / 921, 5084, 5078, 5017, 4891/ +data (chrtab(i), i=1886,1890) / 4700, 4508, 4315, 4185, 4182/ +data (chrtab(i), i=1891,1895) / 4244, 4434, 4816, 4943, 5005/ +data (chrtab(i), i=1896,1900) / 5002, 4936, 150, 4308, 4435/ +data (chrtab(i), i=1901,1905) / 4817, 4944, 5006, 219, 4249/ +data (chrtab(i), i=1906,1910) / 4247, 4309, 4436, 4818, 5008/ +data (chrtab(i), i=1911,1915) / 5070, 5067, 5001, 4936, 4743/ +data (chrtab(i), i=1916,1920) / 4551, 4360, 4234, 4173, 4167/ +data (chrtab(i), i=1921,1925) / 4234, 0, 28, 4118, 476/ +data (chrtab(i), i=1926,1930) / 4551, 539, 4616, 604, 4679/ +data (chrtab(i), i=1931,1935) / 1052, 5142, 28, 5148, 263/ +data (chrtab(i), i=1936,1940) / 4871, 92, 4118, 156, 4121/ +data (chrtab(i), i=1941,1945) / 220, 4122, 348, 4123, 732/ +data (chrtab(i), i=1946,1950) / 5147, 860, 5146, 924, 5145/ +data (chrtab(i), i=1951,1955) / 988, 5142, 456, 4423, 457/ +data (chrtab(i), i=1956,1960) / 4487, 585, 4743, 584, 4807/ +data (chrtab(i), i=1961,1965) / 0, 220, 4301, 4362, 4488/ +data (chrtab(i), i=1966,1970) / 4679, 4807, 5000, 5130, 5197/ +data (chrtab(i), i=1971,1975) / 5211, 283, 4364, 4426, 348/ +data (chrtab(i), i=1976,1980) / 4428, 4489, 4552, 4679, 28/ +data (chrtab(i), i=1981,1985) / 4636, 924, 5404, 92, 4315/ +data (chrtab(i), i=1986,1990) / 156, 4314, 412, 4442, 476/ +data (chrtab(i), i=1991,1995) / 4443, 988, 5211, 1244, 5211/ +data (chrtab(i), i=1996,2000) / 0, 92, 4615, 156, 4618/ +data (chrtab(i), i=2001,2005) / 4615, 220, 4682, 987, 4615/ +data (chrtab(i), i=2006,2010) / 28, 4508, 732, 5212, 28/ +data (chrtab(i), i=2011,2015) / 4250, 284, 4314, 348, 4315/ +data (chrtab(i), i=2016,2020) / 860, 5083, 1052, 5083, 0/ +data (chrtab(i), i=2021,2025) / 156, 4487, 220, 4492, 4487/ +data (chrtab(i), i=2026,2030) / 284, 4556, 668, 4556, 4487/ +data (chrtab(i), i=2031,2035) / 668, 4999, 732, 5004, 4999/ +data (chrtab(i), i=2036,2040) / 796, 5068, 1179, 5068, 4999/ +data (chrtab(i), i=2041,2045) / 28, 4572, 668, 4892, 988/ +data (chrtab(i), i=2046,2050) / 5468, 28, 4315, 92, 4314/ +data (chrtab(i), i=2051,2055) / 348, 4378, 412, 4379, 1052/ +data (chrtab(i), i=2056,2060) / 5275, 1308, 5275, 0, 92/ +data (chrtab(i), i=2061,2065) / 4935, 156, 4999, 220, 5063/ +data (chrtab(i), i=2066,2070) / 923, 4232, 28, 4508, 732/ +data (chrtab(i), i=2071,2075) / 5212, 7, 4423, 647, 5191/ +data (chrtab(i), i=2076,2080) / 28, 4314, 284, 4314, 348/ +data (chrtab(i), i=2081,2085) / 4315, 796, 5019, 1052, 5019/ +data (chrtab(i), i=2086,2090) / 136, 4103, 136, 4359, 840/ +data (chrtab(i), i=2091,2095) / 4807, 841, 4871, 841, 5127/ +data (chrtab(i), i=2096,2100) / 0, 92, 4625, 4615, 156/ +data (chrtab(i), i=2101,2105) / 4689, 4680, 220, 4753, 4743/ +data (chrtab(i), i=2106,2110) / 1051, 4753, 28, 4508, 860/ +data (chrtab(i), i=2111,2115) / 5340, 327, 4935, 28, 4251/ +data (chrtab(i), i=2116,2120) / 348, 4315, 924, 5147, 1180/ +data (chrtab(i), i=2121,2125) / 5147, 520, 4487, 521, 4551/ +data (chrtab(i), i=2126,2130) / 649, 4807, 648, 4871, 0/ +data (chrtab(i), i=2131,2135) / 988, 4188, 4182, 860, 4167/ +data (chrtab(i), i=2136,2140) / 924, 4231, 988, 4295, 71/ +data (chrtab(i), i=2141,2145) / 5063, 5069, 156, 4182, 220/ +data (chrtab(i), i=2146,2150) / 4185, 284, 4186, 412, 4187/ +data (chrtab(i), i=2151,2155) / 647, 5064, 775, 5065, 839/ +data (chrtab(i), i=2156,2160) / 5066, 903, 5069, 0, 160/ +data (chrtab(i), i=2161,2165) / 4224, 224, 4288, 160, 4704/ +data (chrtab(i), i=2166,2170) / 128, 4672, 0, 28, 4868/ +data (chrtab(i), i=2171,2175) / 0, 480, 4544, 544, 4608/ +data (chrtab(i), i=2176,2180) / 96, 4640, 64, 4608, 0/ +data (chrtab(i), i=2181,2185) / 278, 4505, 4630, 83, 4504/ +data (chrtab(i), i=2186,2190) / 4819, 408, 4487, 0, 5/ +data (chrtab(i), i=2191,2195) / 4997, 0, 348, 4315, 4249/ +data (chrtab(i), i=2196,2200) / 4246, 4309, 4373, 4438, 4439/ +data (chrtab(i), i=2201,2205) / 4376, 4312, 4247, 215, 4310/ +data (chrtab(i), i=2206,2210) / 4374, 4375, 4311, 219, 4247/ +data (chrtab(i), i=2211,2215) / 153, 4312, 0, 210, 4307/ +data (chrtab(i), i=2216,2220) / 4371, 4369, 4241, 4243, 4308/ +data (chrtab(i), i=2221,2225) / 4437, 4693, 4820, 4883, 4945/ +data (chrtab(i), i=2226,2230) / 4938, 5000, 5063, 723, 4881/ +data (chrtab(i), i=2231,2235) / 4874, 4936, 597, 4756, 4818/ +data (chrtab(i), i=2236,2240) / 4810, 4872, 5063, 5127, 720/ +data (chrtab(i), i=2241,2245) / 4751, 4430, 4237, 4171, 4170/ +data (chrtab(i), i=2246,2250) / 4232, 4423, 4615, 4744, 4810/ +data (chrtab(i), i=2251,2255) / 205, 4235, 4234, 4296, 655/ +data (chrtab(i), i=2256,2260) / 4494, 4365, 4299, 4298, 4360/ +data (chrtab(i), i=2261,2265) / 4423, 0, 220, 4295, 4360/ +data (chrtab(i), i=2266,2270) / 4488, 283, 4361, 28, 4444/ +data (chrtab(i), i=2271,2275) / 4424, 338, 4500, 4629, 4757/ +data (chrtab(i), i=2276,2280) / 4948, 5074, 5135, 5133, 5066/ +data (chrtab(i), i=2281,2285) / 4936, 4743, 4615, 4488, 4426/ +data (chrtab(i), i=2286,2290) / 914, 5072, 5068, 5002, 661/ +data (chrtab(i), i=2291,2295) / 4884, 4947, 5008, 5004, 4937/ +data (chrtab(i), i=2296,2300) / 4872, 4743, 92, 4315, 156/ +data (chrtab(i), i=2301,2305) / 4314, 0, 849, 4946, 4882/ +data (chrtab(i), i=2306,2310) / 4880, 5008, 5010, 4884, 4757/ +data (chrtab(i), i=2311,2315) / 4565, 4372, 4242, 4175, 4173/ +data (chrtab(i), i=2316,2320) / 4234, 4360, 4551, 4679, 4872/ +data (chrtab(i), i=2321,2325) / 5002, 210, 4240, 4236, 4298/ +data (chrtab(i), i=2326,2330) / 469, 4436, 4371, 4304, 4300/ +data (chrtab(i), i=2331,2335) / 4361, 4424, 4551, 0, 796/ +data (chrtab(i), i=2336,2340) / 4871, 5191, 859, 4936, 604/ +data (chrtab(i), i=2341,2345) / 5020, 4999, 786, 4820, 4693/ +data (chrtab(i), i=2346,2350) / 4565, 4372, 4242, 4175, 4173/ +data (chrtab(i), i=2351,2355) / 4234, 4360, 4551, 4679, 4808/ +data (chrtab(i), i=2356,2360) / 4874, 210, 4240, 4236, 4298/ +data (chrtab(i), i=2361,2365) / 469, 4436, 4371, 4304, 4300/ +data (chrtab(i), i=2366,2370) / 4361, 4424, 4551, 668, 4891/ +data (chrtab(i), i=2371,2375) / 732, 4890, 905, 5063, 904/ +data (chrtab(i), i=2376,2380) / 5127, 0, 207, 5007, 5009/ +data (chrtab(i), i=2381,2385) / 4947, 4884, 4693, 4565, 4372/ +data (chrtab(i), i=2386,2390) / 4242, 4175, 4173, 4234, 4360/ +data (chrtab(i), i=2391,2395) / 4551, 4679, 4872, 5002, 848/ +data (chrtab(i), i=2396,2400) / 4945, 4883, 210, 4240, 4236/ +data (chrtab(i), i=2401,2405) / 4298, 783, 4882, 4820, 4693/ +data (chrtab(i), i=2406,2410) / 469, 4436, 4371, 4304, 4300/ +data (chrtab(i), i=2411,2415) / 4361, 4424, 4551, 0, 666/ +data (chrtab(i), i=2416,2420) / 4763, 4699, 4697, 4825, 4827/ +data (chrtab(i), i=2421,2425) / 4764, 4572, 4443, 4378, 4311/ +data (chrtab(i), i=2426,2430) / 4295, 346, 4375, 4360, 476/ +data (chrtab(i), i=2431,2435) / 4507, 4441, 4423, 21, 4693/ +data (chrtab(i), i=2436,2440) / 7, 4615, 200, 4167, 201/ +data (chrtab(i), i=2441,2445) / 4231, 329, 4487, 328, 4551/ +data (chrtab(i), i=2446,2450) / 0, 852, 5011, 5076, 5013/ +data (chrtab(i), i=2451,2455) / 4949, 4820, 4755, 405, 4372/ +data (chrtab(i), i=2456,2460) / 4307, 4241, 4239, 4301, 4364/ +data (chrtab(i), i=2461,2465) / 4491, 4619, 4748, 4813, 4879/ +data (chrtab(i), i=2466,2470) / 4881, 4819, 4756, 4629, 4501/ +data (chrtab(i), i=2471,2475) / 275, 4305, 4303, 4365, 653/ +data (chrtab(i), i=2476,2480) / 4815, 4817, 4755, 405, 4436/ +data (chrtab(i), i=2481,2485) / 4370, 4366, 4428, 4491, 523/ +data (chrtab(i), i=2486,2490) / 4684, 4750, 4754, 4692, 4629/ +data (chrtab(i), i=2491,2495) / 205, 4236, 4170, 4169, 4231/ +data (chrtab(i), i=2496,2500) / 4294, 4485, 4741, 4932, 4995/ +data (chrtab(i), i=2501,2505) / 199, 4486, 4742, 4933, 73/ +data (chrtab(i), i=2506,2510) / 4232, 4423, 4743, 4934, 4996/ +data (chrtab(i), i=2511,2515) / 4995, 4929, 4736, 4352, 4161/ +data (chrtab(i), i=2516,2520) / 4099, 4100, 4166, 4359, 256/ +data (chrtab(i), i=2521,2525) / 4225, 4163, 4164, 4230, 4359/ +data (chrtab(i), i=2526,2530) / 0, 220, 4295, 283, 4360/ +data (chrtab(i), i=2531,2535) / 28, 4444, 4423, 337, 4499/ +data (chrtab(i), i=2536,2540) / 4564, 4693, 4885, 5012, 5075/ +data (chrtab(i), i=2541,2545) / 5136, 5127, 915, 5072, 5064/ +data (chrtab(i), i=2546,2550) / 789, 4948, 5009, 4999, 7/ +data (chrtab(i), i=2551,2555) / 4615, 711, 5319, 92, 4315/ +data (chrtab(i), i=2556,2560) / 156, 4314, 200, 4167, 201/ +data (chrtab(i), i=2561,2565) / 4231, 329, 4487, 328, 4551/ +data (chrtab(i), i=2566,2570) / 904, 4871, 905, 4935, 1033/ +data (chrtab(i), i=2571,2575) / 5191, 1032, 5255, 0, 220/ +data (chrtab(i), i=2576,2580) / 4314, 4442, 4444, 4316, 284/ +data (chrtab(i), i=2581,2585) / 4378, 219, 4443, 213, 4295/ +data (chrtab(i), i=2586,2590) / 276, 4360, 21, 4437, 4423/ +data (chrtab(i), i=2591,2595) / 7, 4615, 85, 4308, 149/ +data (chrtab(i), i=2596,2600) / 4307, 200, 4167, 201, 4231/ +data (chrtab(i), i=2601,2605) / 329, 4487, 328, 4551, 0/ +data (chrtab(i), i=2606,2610) / 348, 4442, 4570, 4572, 4444/ +data (chrtab(i), i=2611,2615) / 412, 4506, 347, 4571, 341/ +data (chrtab(i), i=2616,2620) / 4420, 4353, 4288, 404, 4485/ +data (chrtab(i), i=2621,2625) / 4418, 149, 4565, 4549, 4482/ +data (chrtab(i), i=2626,2630) / 4417, 4288, 4096, 4097, 4099/ +data (chrtab(i), i=2631,2635) / 4163, 4161, 4097, 4098, 213/ +data (chrtab(i), i=2636,2640) / 4436, 277, 4435, 0, 220/ +data (chrtab(i), i=2641,2645) / 4295, 283, 4360, 28, 4444/ +data (chrtab(i), i=2646,2650) / 4423, 916, 4427, 591, 5127/ +data (chrtab(i), i=2651,2655) / 590, 5063, 526, 4999, 725/ +data (chrtab(i), i=2656,2660) / 5269, 7, 4615, 711, 5255/ +data (chrtab(i), i=2661,2665) / 92, 4315, 156, 4314, 789/ +data (chrtab(i), i=2666,2670) / 5012, 1109, 5012, 200, 4167/ +data (chrtab(i), i=2671,2675) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=2676,2680) / 4551, 905, 4871, 841, 5191/ +data (chrtab(i), i=2681,2685) / 0, 220, 4295, 283, 4360/ +data (chrtab(i), i=2686,2690) / 28, 4444, 4423, 7, 4615/ +data (chrtab(i), i=2691,2695) / 92, 4315, 156, 4314, 200/ +data (chrtab(i), i=2696,2700) / 4167, 201, 4231, 329, 4487/ +data (chrtab(i), i=2701,2705) / 328, 4551, 0, 213, 4295/ +data (chrtab(i), i=2706,2710) / 276, 4360, 21, 4437, 4423/ +data (chrtab(i), i=2711,2715) / 337, 4499, 4564, 4693, 4885/ +data (chrtab(i), i=2716,2720) / 5012, 5075, 5136, 5127, 915/ +data (chrtab(i), i=2721,2725) / 5072, 5064, 789, 4948, 5009/ +data (chrtab(i), i=2726,2730) / 4999, 1041, 5203, 5268, 5397/ +data (chrtab(i), i=2731,2735) / 5589, 5716, 5779, 5840, 5831/ +data (chrtab(i), i=2736,2740) / 1619, 5776, 5768, 1493, 5652/ +data (chrtab(i), i=2741,2745) / 5713, 5703, 7, 4615, 711/ +data (chrtab(i), i=2746,2750) / 5319, 1415, 6023, 85, 4308/ +data (chrtab(i), i=2751,2755) / 149, 4307, 200, 4167, 201/ +data (chrtab(i), i=2756,2760) / 4231, 329, 4487, 328, 4551/ +data (chrtab(i), i=2761,2765) / 904, 4871, 905, 4935, 1033/ +data (chrtab(i), i=2766,2770) / 5191, 1032, 5255, 1608, 5575/ +data (chrtab(i), i=2771,2775) / 1609, 5639, 1737, 5895, 1736/ +data (chrtab(i), i=2776,2780) / 5959, 0, 213, 4295, 276/ +data (chrtab(i), i=2781,2785) / 4360, 21, 4437, 4423, 337/ +data (chrtab(i), i=2786,2790) / 4499, 4564, 4693, 4885, 5012/ +data (chrtab(i), i=2791,2795) / 5075, 5136, 5127, 915, 5072/ +data (chrtab(i), i=2796,2800) / 5064, 789, 4948, 5009, 4999/ +data (chrtab(i), i=2801,2805) / 7, 4615, 711, 5319, 85/ +data (chrtab(i), i=2806,2810) / 4308, 149, 4307, 200, 4167/ +data (chrtab(i), i=2811,2815) / 201, 4231, 329, 4487, 328/ +data (chrtab(i), i=2816,2820) / 4551, 904, 4871, 905, 4935/ +data (chrtab(i), i=2821,2825) / 1033, 5191, 1032, 5255, 0/ +data (chrtab(i), i=2826,2830) / 469, 4372, 4242, 4175, 4173/ +data (chrtab(i), i=2831,2835) / 4234, 4360, 4551, 4679, 4872/ +data (chrtab(i), i=2836,2840) / 5002, 5069, 5071, 5010, 4884/ +data (chrtab(i), i=2841,2845) / 4693, 4565, 210, 4240, 4236/ +data (chrtab(i), i=2846,2850) / 4298, 842, 5004, 5008, 4946/ +data (chrtab(i), i=2851,2855) / 469, 4436, 4371, 4304, 4300/ +data (chrtab(i), i=2856,2860) / 4361, 4424, 4551, 583, 4808/ +data (chrtab(i), i=2861,2865) / 4873, 4940, 4944, 4883, 4820/ +data (chrtab(i), i=2866,2870) / 4693, 0, 213, 4288, 276/ +data (chrtab(i), i=2871,2875) / 4353, 21, 4437, 4416, 338/ +data (chrtab(i), i=2876,2880) / 4500, 4629, 4757, 4948, 5074/ +data (chrtab(i), i=2881,2885) / 5135, 5133, 5066, 4936, 4743/ +data (chrtab(i), i=2886,2890) / 4615, 4488, 4426, 914, 5072/ +data (chrtab(i), i=2891,2895) / 5068, 5002, 661, 4884, 4947/ +data (chrtab(i), i=2896,2900) / 5008, 5004, 4937, 4872, 4743/ +data (chrtab(i), i=2901,2905) / 0, 4608, 85, 4308, 149/ +data (chrtab(i), i=2906,2910) / 4307, 193, 4160, 194, 4224/ +data (chrtab(i), i=2911,2915) / 322, 4480, 321, 4544, 0/ +data (chrtab(i), i=2916,2920) / 788, 4864, 851, 4929, 724/ +data (chrtab(i), i=2921,2925) / 4948, 5013, 4992, 786, 4820/ +data (chrtab(i), i=2926,2930) / 4693, 4565, 4372, 4242, 4175/ +data (chrtab(i), i=2931,2935) / 4173, 4234, 4360, 4551, 4679/ +data (chrtab(i), i=2936,2940) / 4808, 4874, 210, 4240, 4236/ +data (chrtab(i), i=2941,2945) / 4298, 469, 4436, 4371, 4304/ +data (chrtab(i), i=2946,2950) / 4300, 4361, 4424, 4551, 576/ +data (chrtab(i), i=2951,2955) / 5184, 769, 4736, 770, 4800/ +data (chrtab(i), i=2956,2960) / 898, 5056, 897, 5120, 0/ +data (chrtab(i), i=2961,2965) / 213, 4295, 276, 4360, 21/ +data (chrtab(i), i=2966,2970) / 4437, 4423, 787, 4884, 4820/ +data (chrtab(i), i=2971,2975) / 4818, 4946, 4948, 4885, 4757/ +data (chrtab(i), i=2976,2980) / 4628, 4498, 4431, 7, 4615/ +data (chrtab(i), i=2981,2985) / 85, 4308, 149, 4307, 200/ +data (chrtab(i), i=2986,2990) / 4167, 201, 4231, 329, 4487/ +data (chrtab(i), i=2991,2995) / 328, 4551, 0, 723, 4885/ +data (chrtab(i), i=2996,3000) / 4881, 4819, 4756, 4629, 4373/ +data (chrtab(i), i=3001,3005) / 4244, 4179, 4177, 4239, 4366/ +data (chrtab(i), i=3006,3010) / 4685, 4812, 4873, 148, 4177/ +data (chrtab(i), i=3011,3015) / 144, 4367, 4686, 4813, 780/ +data (chrtab(i), i=3016,3020) / 4808, 83, 4241, 4368, 4687/ +data (chrtab(i), i=3021,3025) / 4814, 4876, 4873, 4808, 4679/ +data (chrtab(i), i=3026,3030) / 4423, 4296, 4233, 4171, 4167/ +data (chrtab(i), i=3031,3035) / 4233, 0, 218, 4300, 4361/ +data (chrtab(i), i=3036,3040) / 4424, 4551, 4679, 4808, 4874/ +data (chrtab(i), i=3041,3045) / 282, 4363, 4425, 218, 4444/ +data (chrtab(i), i=3046,3050) / 4427, 4488, 4551, 21, 4693/ +data (chrtab(i), i=3051,3055) / 0, 213, 4300, 4361, 4424/ +data (chrtab(i), i=3056,3060) / 4551, 4743, 4872, 4937, 5003/ +data (chrtab(i), i=3061,3065) / 276, 4363, 4425, 21, 4437/ +data (chrtab(i), i=3066,3070) / 4427, 4488, 4551, 917, 4999/ +data (chrtab(i), i=3071,3075) / 5319, 980, 5064, 725, 5141/ +data (chrtab(i), i=3076,3080) / 5127, 85, 4308, 149, 4307/ +data (chrtab(i), i=3081,3085) / 1033, 5191, 1032, 5255, 0/ +data (chrtab(i), i=3086,3090) / 85, 4551, 149, 4553, 213/ +data (chrtab(i), i=3091,3095) / 4617, 852, 4617, 4551, 21/ +data (chrtab(i), i=3096,3100) / 4501, 597, 5077, 21, 4307/ +data (chrtab(i), i=3101,3105) / 341, 4308, 725, 4948, 917/ +data (chrtab(i), i=3106,3110) / 4948, 0, 149, 4487, 213/ +data (chrtab(i), i=3111,3115) / 4490, 277, 4554, 661, 4554/ +data (chrtab(i), i=3116,3120) / 4487, 661, 4999, 725, 5002/ +data (chrtab(i), i=3121,3125) / 661, 4885, 5066, 1172, 5066/ +data (chrtab(i), i=3126,3130) / 4999, 21, 4565, 981, 5461/ +data (chrtab(i), i=3131,3135) / 21, 4308, 405, 4372, 1045/ +data (chrtab(i), i=3136,3140) / 5268, 1301, 5268, 0, 149/ +data (chrtab(i), i=3141,3145) / 4871, 213, 4935, 277, 4999/ +data (chrtab(i), i=3146,3150) / 852, 4296, 21, 4565, 661/ +data (chrtab(i), i=3151,3155) / 5141, 7, 4487, 583, 5127/ +data (chrtab(i), i=3156,3160) / 85, 4308, 405, 4372, 725/ +data (chrtab(i), i=3161,3165) / 4948, 981, 4948, 200, 4167/ +data (chrtab(i), i=3166,3170) / 200, 4423, 776, 4743, 840/ +data (chrtab(i), i=3171,3175) / 5063, 0, 149, 4615, 213/ +data (chrtab(i), i=3176,3180) / 4617, 277, 4681, 916, 4681/ +data (chrtab(i), i=3181,3185) / 4483, 4353, 4224, 4096, 4097/ +data (chrtab(i), i=3186,3190) / 4099, 4163, 4161, 4097, 4098/ +data (chrtab(i), i=3191,3195) / 21, 4565, 661, 5141, 85/ +data (chrtab(i), i=3196,3200) / 4371, 405, 4372, 789, 5012/ +data (chrtab(i), i=3201,3205) / 981, 5012, 0, 725, 4167/ +data (chrtab(i), i=3206,3210) / 789, 4231, 853, 4295, 853/ +data (chrtab(i), i=3211,3215) / 4181, 4177, 71, 4935, 4939/ +data (chrtab(i), i=3216,3220) / 149, 4177, 213, 4178, 277/ +data (chrtab(i), i=3221,3225) / 4179, 405, 4180, 519, 4936/ +data (chrtab(i), i=3226,3230) / 647, 4937, 711, 4938, 775/ +data (chrtab(i), i=3231,3235) / 4939, 0, 480, 4447, 4382/ +data (chrtab(i), i=3236,3240) / 4316, 4314, 4376, 4439, 4501/ +data (chrtab(i), i=3241,3245) / 4499, 4369, 351, 4381, 4379/ +data (chrtab(i), i=3246,3250) / 4441, 4504, 4566, 4564, 4498/ +data (chrtab(i), i=3251,3255) / 4240, 4494, 4556, 4554, 4488/ +data (chrtab(i), i=3256,3260) / 4423, 4357, 4355, 4417, 271/ +data (chrtab(i), i=3261,3265) / 4493, 4491, 4425, 4360, 4294/ +data (chrtab(i), i=3266,3270) / 4292, 4354, 4417, 4544, 0/ +data (chrtab(i), i=3271,3275) / 160, 4224, 0, 224, 4447/ +data (chrtab(i), i=3276,3280) / 4510, 4572, 4570, 4504, 4439/ +data (chrtab(i), i=3281,3285) / 4373, 4371, 4497, 351, 4509/ +data (chrtab(i), i=3286,3290) / 4507, 4441, 4376, 4310, 4308/ +data (chrtab(i), i=3291,3295) / 4370, 4624, 4366, 4300, 4298/ +data (chrtab(i), i=3296,3300) / 4360, 4423, 4485, 4483, 4417/ +data (chrtab(i), i=3301,3305) / 399, 4365, 4363, 4425, 4488/ +data (chrtab(i), i=3306,3310) / 4550, 4548, 4482, 4417, 4288/ +data (chrtab(i), i=3311,3315) / 0, 77, 4175, 4242, 4371/ +data (chrtab(i), i=3316,3320) / 4499, 4626, 4879, 5006, 5134/ +data (chrtab(i), i=3321,3325) / 5263, 5329, 79, 4241, 4370/ +data (chrtab(i), i=3326,3330) / 4498, 4625, 4878, 5005, 5133/ +data (chrtab(i), i=3331,3335) / 5262, 5329, 5331, 0, 284/ +data (chrtab(i), i=3336,3340) / 4251, 4185, 4183, 4245, 4372/ +data (chrtab(i), i=3341,3345) / 4500, 4629, 4695, 4697, 4635/ +data (chrtab(i), i=3346,3350) / 4508, 4380, 284, 4185, 4245/ +data (chrtab(i), i=3351,3355) / 4500, 4695, 4635, 4380, 412/ +data (chrtab(i), i=3356,3360) / 4251, 4183, 4372, 4629, 4697/ +data (chrtab(i), i=3361,3362) / 4508, 0/ diff --git a/sys/gio/sgikern/font.h b/sys/gio/sgikern/font.h new file mode 100644 index 00000000..eb2e72f4 --- /dev/null +++ b/sys/gio/sgikern/font.h @@ -0,0 +1,29 @@ +# FONT.H -- Font definitions. + +define CHARACTER_START 32 +define CHARACTER_END 126 +define CHARACTER_HEIGHT 26 +define CHARACTER_WIDTH 17 + +define FONT_LEFT 0 +define FONT_CENTER 9 +define FONT_RIGHT 27 +define FONT_TOP 36 +define FONT_CAP 34 +define FONT_HALF 23 +define FONT_BASE 9 +define FONT_BOTTOM 0 +define FONT_WIDTH 27 +define FONT_HEIGHT 36 + +define COORD_X_START 7 +define COORD_Y_START 1 +define COORD_PEN_START 13 +define COORD_X_LEN 6 +define COORD_Y_LEN 6 +define COORD_PEN_LEN 1 + +define PAINT_BEGIN_START 14 +define PAINT_END_START 15 +define PAINT_BEGIN_LEN 1 +define PAINT_END_LEN 1 diff --git a/sys/gio/sgikern/greek.com b/sys/gio/sgikern/greek.com new file mode 100644 index 00000000..cb9fffdc --- /dev/null +++ b/sys/gio/sgikern/greek.com @@ -0,0 +1,501 @@ +# GCHTAB -- Table of strokes for the printable GREEK characters. Each +# character is encoded as a series of strokes. Each stroke is ex- +# pressed by a single integer containing the following bitfields: +# +# 2 1 +# 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 +# | | | | | | | +# | | | +---------+ +---------+ +# | | | | | +# | | | X Y +# | | | +# | | +-- pen up/down +# | +---- begin paint (not used at present) +# +------ end paint (not used at present) +# +#---------------------------------------------------------------------------- + +# Define the database. + +short gchidx[97] # character index in gchtab +short gchwid[97] # character width table +short gchtab[2140] # stroke data to draw the characters + +# Index into CHRTAB of each printable character (starting with SP) + +data (gchidx(i), i=001,005) / 1, 3, 16, 29, 38/ +data (gchidx(i), i=006,010) / 77, 107, 154, 162, 181/ +data (gchidx(i), i=011,015) / 200, 205, 212, 233, 240/ +data (gchidx(i), i=016,020) / 246, 259, 297, 306, 348/ +data (gchidx(i), i=021,025) / 392, 402, 437, 483, 510/ +data (gchidx(i), i=026,030) / 568, 614, 645, 658, 666/ +data (gchidx(i), i=031,035) / 673, 681, 688, 741, 767/ +data (gchidx(i), i=036,040) / 793, 795, 806, 821, 863/ +data (gchidx(i), i=041,045) / 874, 883, 888, 899, 901/ +data (gchidx(i), i=046,050) / 912, 921, 930, 972, 987/ +data (gchidx(i), i=051,055) / 1037, 1067, 1083, 1088, 1117/ +data (gchidx(i), i=056,060) / 1143, 1182, 1207, 1242, 1244/ +data (gchidx(i), i=061,065) / 1253, 1256, 1265, 1267, 1276/ +data (gchidx(i), i=066,070) / 1284, 1321, 1373, 1394, 1436/ +data (gchidx(i), i=071,075) / 1465, 1500, 1525, 1554, 1568/ +data (gchidx(i), i=076,080) / 1610, 1635, 1655, 1679, 1699/ +data (gchidx(i), i=081,085) / 1729, 1746, 1788, 1817, 1849/ +data (gchidx(i), i=086,090) / 1862, 1891, 1893, 1934, 1975/ +data (gchidx(i), i=091,095) / 2006, 2036, 2074, 2079, 2117/ +data (gchidx(i), i=096,096) / 2126/ + + +# Width data. + +data (gchwid(i), i=001,005) / 21, 15, 15, 26, 25/ +data (gchwid(i), i=006,010) / 29, 30, 15, 19, 19/ +data (gchwid(i), i=011,015) / 27, 29, 30, 29, 15/ +data (gchwid(i), i=016,020) / 31, 25, 25, 25, 25/ +data (gchwid(i), i=021,025) / 25, 25, 25, 25, 25/ +data (gchwid(i), i=026,030) / 25, 29, 15, 29, 31/ +data (gchwid(i), i=031,035) / 29, 31, 32, 25, 30/ +data (gchwid(i), i=036,040) / 21, 25, 29, 26, 23/ +data (gchwid(i), i=041,045) / 26, 19, 25, 21, 25/ +data (gchwid(i), i=046,050) / 21, 21, 27, 29, 27/ +data (gchwid(i), i=051,055) / 29, 26, 19, 24, 25/ +data (gchwid(i), i=056,060) / 27, 27, 28, 21, 19/ +data (gchwid(i), i=061,065) / 19, 19, 21, 31, 27/ +data (gchwid(i), i=066,070) / 28, 26, 23, 24, 23/ +data (gchwid(i), i=071,075) / 27, 25, 27, 17, 24/ +data (gchwid(i), i=076,080) / 25, 25, 28, 25, 23/ +data (gchwid(i), i=081,085) / 27, 28, 24, 26, 25/ +data (gchwid(i), i=086,090) / 25, 21, 28, 22, 28/ +data (gchwid(i), i=091,095) / 23, 19, 19, 19, 31/ +data (gchwid(i), i=096,096) / 19/ + + +# Stroke data. + +data (gchtab(i), i=0001,0005) / 35, 0, 220, 4250, 4302/ +data (gchtab(i), i=0006,0010) / 4378, 4316, 218, 4308, 201/ +data (gchtab(i), i=0011,0015) / 4232, 4295, 4360, 4297, 0/ +data (gchtab(i), i=0016,0020) / 213, 4244, 4307, 4372, 4309/ +data (gchtab(i), i=0021,0025) / 199, 4232, 4297, 4360, 4358/ +data (gchtab(i), i=0026,0030) / 4292, 4227, 0, 604, 4224/ +data (gchtab(i), i=0031,0035) / 988, 4608, 145, 5137, 75/ +data (gchtab(i), i=0036,0040) / 5067, 0, 416, 4483, 672/ +data (gchtab(i), i=0041,0045) / 4739, 921, 4952, 5015, 5080/ +data (gchtab(i), i=0046,0050) / 5081, 4955, 4764, 4508, 4315/ +data (gchtab(i), i=0051,0055) / 4185, 4183, 4245, 4308, 4435/ +data (gchtab(i), i=0056,0060) / 4817, 4944, 5070, 87, 4309/ +data (gchtab(i), i=0061,0065) / 4436, 4818, 4945, 5008, 5070/ +data (gchtab(i), i=0066,0070) / 5066, 4936, 4743, 4487, 4296/ +data (gchtab(i), i=0071,0075) / 4170, 4171, 4236, 4299, 4234/ +data (gchtab(i), i=0076,0080) / 0, 1244, 4167, 412, 4634/ +data (gchtab(i), i=0081,0085) / 4632, 4566, 4437, 4309, 4183/ +data (gchtab(i), i=0086,0090) / 4185, 4251, 4380, 4508, 4635/ +data (gchtab(i), i=0091,0095) / 4826, 5018, 5211, 5340, 974/ +data (gchtab(i), i=0096,0100) / 4941, 4875, 4873, 4999, 5127/ +data (gchtab(i), i=0101,0105) / 5256, 5322, 5324, 5198, 5070/ +data (gchtab(i), i=0106,0110) / 0, 1236, 5267, 5330, 5395/ +data (gchtab(i), i=0111,0115) / 5396, 5333, 5269, 5204, 5138/ +data (gchtab(i), i=0116,0120) / 5005, 4874, 4744, 4615, 4423/ +data (gchtab(i), i=0121,0125) / 4232, 4170, 4173, 4239, 4627/ +data (gchtab(i), i=0126,0130) / 4757, 4823, 4825, 4763, 4636/ +data (gchtab(i), i=0131,0135) / 4507, 4441, 4439, 4500, 4625/ +data (gchtab(i), i=0136,0140) / 4938, 5064, 5255, 5319, 5384/ +data (gchtab(i), i=0141,0145) / 5385, 327, 4296, 4234, 4237/ +data (gchtab(i), i=0146,0150) / 4303, 4433, 343, 4501, 5002/ +data (gchtab(i), i=0151,0155) / 5128, 5255, 0, 218, 4251/ +data (gchtab(i), i=0156,0160) / 4316, 4379, 4377, 4311, 4246/ +data (gchtab(i), i=0161,0165) / 0, 608, 4574, 4443, 4311/ +data (gchtab(i), i=0166,0170) / 4242, 4238, 4297, 4421, 4546/ +data (gchtab(i), i=0171,0175) / 4672, 478, 4442, 4375, 4306/ +data (gchtab(i), i=0176,0180) / 4302, 4361, 4422, 4546, 0/ +data (gchtab(i), i=0181,0185) / 96, 4318, 4443, 4567, 4626/ +data (gchtab(i), i=0186,0190) / 4622, 4553, 4421, 4290, 4160/ +data (gchtab(i), i=0191,0195) / 222, 4442, 4503, 4562, 4558/ +data (gchtab(i), i=0196,0200) / 4489, 4422, 4290, 0, 151/ +data (gchtab(i), i=0201,0205) / 5129, 1047, 4233, 0, 664/ +data (gchtab(i), i=0206,0210) / 4743, 144, 5264, 135, 5255/ +data (gchtab(i), i=0211,0215) / 0, 1227, 5195, 5068, 4942/ +data (gchtab(i), i=0216,0220) / 4754, 4691, 4564, 4436, 4307/ +data (gchtab(i), i=0221,0225) / 4241, 4239, 4301, 4428, 4556/ +data (gchtab(i), i=0226,0230) / 4685, 4750, 4946, 5076, 5205/ +data (gchtab(i), i=0231,0235) / 5333, 0, 664, 4743, 152/ +data (gchtab(i), i=0236,0240) / 5272, 144, 5264, 0, 201/ +data (gchtab(i), i=0241,0245) / 4232, 4295, 4360, 4297, 0/ +data (gchtab(i), i=0246,0250) / 729, 4760, 4823, 4888, 4825/ +data (gchtab(i), i=0251,0255) / 144, 5392, 713, 4744, 4807/ +data (gchtab(i), i=0256,0260) / 4872, 4809, 0, 476, 4379/ +data (gchtab(i), i=0261,0265) / 4248, 4179, 4176, 4235, 4360/ +data (gchtab(i), i=0266,0270) / 4551, 4679, 4872, 5003, 5072/ +data (gchtab(i), i=0271,0275) / 5075, 5016, 4891, 4700, 4572/ +data (gchtab(i), i=0276,0280) / 476, 4443, 4378, 4312, 4243/ +data (gchtab(i), i=0281,0285) / 4240, 4299, 4361, 4424, 4551/ +data (gchtab(i), i=0286,0290) / 583, 4808, 4873, 4939, 5008/ +data (gchtab(i), i=0291,0295) / 5011, 4952, 4890, 4827, 4700/ +data (gchtab(i), i=0296,0300) / 0, 280, 4505, 4700, 4679/ +data (gchtab(i), i=0301,0305) / 539, 4615, 263, 4935, 0/ +data (gchtab(i), i=0306,0310) / 152, 4311, 4246, 4183, 4184/ +data (gchtab(i), i=0311,0315) / 4250, 4315, 4508, 4764, 4955/ +data (gchtab(i), i=0316,0320) / 5018, 5080, 5078, 5012, 4818/ +data (gchtab(i), i=0321,0325) / 4496, 4367, 4237, 4170, 4167/ +data (gchtab(i), i=0326,0330) / 668, 4891, 4954, 5016, 5014/ +data (gchtab(i), i=0331,0335) / 4948, 4754, 4496, 73, 4234/ +data (gchtab(i), i=0336,0340) / 4362, 4680, 4872, 5001, 5066/ +data (gchtab(i), i=0341,0345) / 266, 4679, 4935, 5000, 5066/ +data (gchtab(i), i=0346,0350) / 5068, 0, 152, 4311, 4246/ +data (gchtab(i), i=0351,0355) / 4183, 4184, 4250, 4315, 4508/ +data (gchtab(i), i=0356,0360) / 4764, 4955, 5017, 5014, 4948/ +data (gchtab(i), i=0361,0365) / 4755, 4563, 668, 4891, 4953/ +data (gchtab(i), i=0366,0370) / 4950, 4884, 4755, 659, 4882/ +data (gchtab(i), i=0371,0375) / 5008, 5070, 5067, 5001, 4936/ +data (gchtab(i), i=0376,0380) / 4743, 4487, 4296, 4233, 4171/ +data (gchtab(i), i=0381,0385) / 4172, 4237, 4300, 4235, 849/ +data (gchtab(i), i=0386,0390) / 5006, 5003, 4937, 4872, 4743/ +data (gchtab(i), i=0391,0395) / 0, 666, 4743, 732, 4807/ +data (gchtab(i), i=0396,0400) / 732, 4109, 5133, 455, 4999/ +data (gchtab(i), i=0401,0405) / 0, 220, 4178, 82, 4308/ +data (gchtab(i), i=0406,0410) / 4501, 4693, 4884, 5010, 5071/ +data (gchtab(i), i=0411,0415) / 5069, 5002, 4872, 4679, 4487/ +data (gchtab(i), i=0416,0420) / 4296, 4233, 4171, 4172, 4237/ +data (gchtab(i), i=0421,0425) / 4300, 4235, 597, 4820, 4946/ +data (gchtab(i), i=0426,0430) / 5007, 5005, 4938, 4808, 4679/ +data (gchtab(i), i=0431,0435) / 220, 4956, 219, 4635, 4956/ +data (gchtab(i), i=0436,0440) / 0, 857, 4888, 4951, 5016/ +data (gchtab(i), i=0441,0445) / 5017, 4955, 4828, 4636, 4443/ +data (gchtab(i), i=0446,0450) / 4313, 4247, 4179, 4173, 4234/ +data (gchtab(i), i=0451,0455) / 4360, 4551, 4679, 4872, 5002/ +data (gchtab(i), i=0456,0460) / 5069, 5070, 5009, 4883, 4692/ +data (gchtab(i), i=0461,0465) / 4628, 4435, 4305, 4238, 540/ +data (gchtab(i), i=0466,0470) / 4507, 4377, 4311, 4243, 4237/ +data (gchtab(i), i=0471,0475) / 4298, 4424, 4551, 583, 4808/ +data (gchtab(i), i=0476,0480) / 4938, 5005, 5006, 4945, 4819/ +data (gchtab(i), i=0481,0485) / 4692, 0, 92, 4182, 88/ +data (gchtab(i), i=0486,0490) / 4250, 4380, 4508, 4825, 4953/ +data (gchtab(i), i=0491,0495) / 5018, 5084, 154, 4379, 4507/ +data (gchtab(i), i=0496,0500) / 4825, 988, 5081, 5014, 4753/ +data (gchtab(i), i=0501,0505) / 4687, 4620, 4615, 918, 4689/ +data (gchtab(i), i=0506,0510) / 4623, 4556, 4551, 0, 412/ +data (gchtab(i), i=0511,0515) / 4315, 4249, 4246, 4308, 4499/ +data (gchtab(i), i=0516,0520) / 4755, 4948, 5014, 5017, 4955/ +data (gchtab(i), i=0521,0525) / 4764, 4508, 412, 4379, 4313/ +data (gchtab(i), i=0526,0530) / 4310, 4372, 4499, 659, 4884/ +data (gchtab(i), i=0531,0535) / 4950, 4953, 4891, 4764, 403/ +data (gchtab(i), i=0536,0540) / 4306, 4241, 4175, 4171, 4233/ +data (gchtab(i), i=0541,0545) / 4296, 4487, 4743, 4936, 5001/ +data (gchtab(i), i=0546,0550) / 5067, 5071, 5009, 4946, 4755/ +data (gchtab(i), i=0551,0555) / 403, 4370, 4305, 4239, 4235/ +data (gchtab(i), i=0556,0560) / 4297, 4360, 4487, 647, 4872/ +data (gchtab(i), i=0561,0565) / 4937, 5003, 5007, 4945, 4882/ +data (gchtab(i), i=0566,0570) / 4755, 0, 917, 4946, 4816/ +data (gchtab(i), i=0571,0575) / 4623, 4559, 4368, 4242, 4181/ +data (gchtab(i), i=0576,0580) / 4182, 4249, 4379, 4572, 4700/ +data (gchtab(i), i=0581,0585) / 4891, 5017, 5078, 5072, 5004/ +data (gchtab(i), i=0586,0590) / 4938, 4808, 4615, 4423, 4296/ +data (gchtab(i), i=0591,0595) / 4234, 4235, 4300, 4363, 4298/ +data (gchtab(i), i=0596,0600) / 463, 4432, 4306, 4245, 4246/ +data (gchtab(i), i=0601,0605) / 4313, 4443, 4572, 604, 4827/ +data (gchtab(i), i=0606,0610) / 4953, 5014, 5008, 4940, 4874/ +data (gchtab(i), i=0611,0615) / 4744, 4615, 0, 1247, 5278/ +data (gchtab(i), i=0616,0620) / 5341, 5406, 5407, 5344, 5216/ +data (gchtab(i), i=0621,0625) / 5087, 4957, 4891, 4824, 4756/ +data (gchtab(i), i=0626,0630) / 4616, 4548, 4482, 926, 4956/ +data (gchtab(i), i=0631,0635) / 4888, 4748, 4680, 4613, 4547/ +data (gchtab(i), i=0636,0640) / 4417, 4288, 4160, 4097, 4098/ +data (gchtab(i), i=0641,0645) / 4163, 4226, 4161, 0, 213/ +data (gchtab(i), i=0646,0650) / 4244, 4307, 4372, 4309, 199/ +data (gchtab(i), i=0651,0655) / 4232, 4297, 4360, 4358, 4292/ +data (gchtab(i), i=0656,0660) / 4227, 0, 1180, 4245, 5262/ +data (gchtab(i), i=0661,0665) / 140, 5260, 135, 5255, 0/ +data (gchtab(i), i=0666,0670) / 149, 5397, 144, 5392, 139/ +data (gchtab(i), i=0671,0675) / 5387, 0, 156, 5269, 4238/ +data (gchtab(i), i=0676,0680) / 140, 5260, 135, 5255, 0/ +data (gchtab(i), i=0681,0685) / 1177, 4359, 147, 5395, 141/ +data (gchtab(i), i=0686,0690) / 5389, 0, 1044, 5078, 4951/ +data (gchtab(i), i=0691,0695) / 4759, 4630, 4565, 4498, 4495/ +data (gchtab(i), i=0696,0700) / 4557, 4684, 4876, 5005, 5071/ +data (gchtab(i), i=0701,0705) / 663, 4629, 4562, 4559, 4621/ +data (gchtab(i), i=0706,0710) / 4684, 1047, 5071, 5069, 5196/ +data (gchtab(i), i=0711,0715) / 5324, 5454, 5521, 5523, 5462/ +data (gchtab(i), i=0716,0720) / 5400, 5274, 5147, 4956, 4764/ +data (gchtab(i), i=0721,0725) / 4571, 4442, 4312, 4246, 4179/ +data (gchtab(i), i=0726,0730) / 4176, 4237, 4299, 4425, 4552/ +data (gchtab(i), i=0731,0735) / 4743, 4935, 5128, 5257, 5322/ +data (gchtab(i), i=0736,0740) / 1111, 5135, 5133, 5196, 0/ +data (gchtab(i), i=0741,0745) / 473, 4167, 601, 5063, 537/ +data (gchtab(i), i=0746,0750) / 4999, 205, 4877, 7, 4423/ +data (gchtab(i), i=0751,0755) / 711, 5191, 480, 4447, 4381/ +data (gchtab(i), i=0756,0760) / 4379, 4441, 4568, 4696, 4825/ +data (gchtab(i), i=0761,0765) / 4891, 4893, 4831, 4704, 4576/ +data (gchtab(i), i=0766,0770) / 0, 1295, 5325, 5196, 5068/ +data (gchtab(i), i=0771,0775) / 4941, 4878, 4690, 4627, 4500/ +data (gchtab(i), i=0776,0780) / 4372, 4243, 4177, 4175, 4237/ +data (gchtab(i), i=0781,0785) / 4364, 4492, 4621, 4686, 4882/ +data (gchtab(i), i=0786,0790) / 4947, 5076, 5204, 5331, 5393/ +data (gchtab(i), i=0791,0795) / 5391, 0, 35, 0, 540/ +data (gchtab(i), i=0796,0800) / 4103, 540, 5127, 537, 5063/ +data (gchtab(i), i=0801,0805) / 72, 5064, 7, 5127, 0/ +data (gchtab(i), i=0806,0810) / 1176, 4824, 4567, 4438, 4308/ +data (gchtab(i), i=0811,0815) / 4241, 4239, 4300, 4426, 4553/ +data (gchtab(i), i=0816,0820) / 4808, 5256, 144, 5008, 0/ +data (gchtab(i), i=0821,0825) / 540, 4615, 604, 4679, 407/ +data (gchtab(i), i=0826,0830) / 4310, 4245, 4179, 4176, 4238/ +data (gchtab(i), i=0831,0835) / 4301, 4492, 4812, 5005, 5070/ +data (gchtab(i), i=0836,0840) / 5136, 5139, 5077, 5014, 4823/ +data (gchtab(i), i=0841,0845) / 4503, 407, 4374, 4309, 4243/ +data (gchtab(i), i=0846,0850) / 4240, 4302, 4365, 4492, 716/ +data (gchtab(i), i=0851,0855) / 4941, 5006, 5072, 5075, 5013/ +data (gchtab(i), i=0856,0860) / 4950, 4823, 348, 4892, 327/ +data (gchtab(i), i=0861,0865) / 4871, 0, 220, 4295, 284/ +data (gchtab(i), i=0866,0870) / 4359, 28, 5084, 5078, 5020/ +data (gchtab(i), i=0871,0875) / 7, 4551, 0, 608, 4224/ +data (gchtab(i), i=0876,0880) / 992, 4608, 147, 5139, 77/ +data (gchtab(i), i=0881,0885) / 5069, 0, 160, 4224, 544/ +data (gchtab(i), i=0886,0890) / 4608, 0, 28, 4615, 92/ +data (gchtab(i), i=0891,0895) / 4617, 1052, 4615, 28, 5148/ +data (gchtab(i), i=0896,0900) / 91, 5083, 0, 35, 0/ +data (gchtab(i), i=0901,0905) / 540, 4167, 540, 5063, 537/ +data (gchtab(i), i=0906,0910) / 4999, 7, 4423, 711, 5191/ +data (gchtab(i), i=0911,0915) / 0, 278, 4505, 4630, 83/ +data (gchtab(i), i=0916,0920) / 4504, 4819, 408, 4487, 0/ +data (gchtab(i), i=0921,0925) / 266, 4487, 4618, 77, 4488/ +data (gchtab(i), i=0926,0930) / 4813, 409, 4488, 0, 540/ +data (gchtab(i), i=0931,0935) / 4443, 4313, 4247, 4179, 4176/ +data (gchtab(i), i=0936,0940) / 4236, 4298, 4424, 4615, 4743/ +data (gchtab(i), i=0941,0945) / 4936, 5066, 5132, 5200, 5203/ +data (gchtab(i), i=0946,0950) / 5143, 5081, 4955, 4764, 4636/ +data (gchtab(i), i=0951,0955) / 540, 4507, 4377, 4311, 4243/ +data (gchtab(i), i=0956,0960) / 4240, 4300, 4362, 4488, 4615/ +data (gchtab(i), i=0961,0965) / 647, 4872, 5002, 5068, 5136/ +data (gchtab(i), i=0966,0970) / 5139, 5079, 5017, 4891, 4764/ +data (gchtab(i), i=0971,0975) / 0, 220, 4295, 284, 4359/ +data (gchtab(i), i=0976,0980) / 1052, 5127, 1116, 5191, 28/ +data (gchtab(i), i=0981,0985) / 5404, 7, 4551, 839, 5383/ +data (gchtab(i), i=0986,0990) / 0, 540, 4443, 4313, 4247/ +data (gchtab(i), i=0991,0995) / 4179, 4176, 4236, 4298, 4424/ +data (gchtab(i), i=0996,1000) / 4615, 4743, 4936, 5066, 5132/ +data (gchtab(i), i=1001,1005) / 5200, 5203, 5143, 5081, 4955/ +data (gchtab(i), i=1006,1010) / 4764, 4636, 540, 4507, 4377/ +data (gchtab(i), i=1011,1015) / 4311, 4243, 4240, 4300, 4362/ +data (gchtab(i), i=1016,1020) / 4488, 4615, 647, 4872, 5002/ +data (gchtab(i), i=1021,1025) / 5068, 5136, 5139, 5079, 5017/ +data (gchtab(i), i=1026,1030) / 4891, 4764, 405, 4494, 789/ +data (gchtab(i), i=1031,1035) / 4878, 402, 4882, 401, 4881/ +data (gchtab(i), i=1036,1040) / 0, 1244, 4167, 412, 4634/ +data (gchtab(i), i=1041,1045) / 4632, 4566, 4437, 4309, 4183/ +data (gchtab(i), i=1046,1050) / 4185, 4251, 4380, 4508, 4635/ +data (gchtab(i), i=1051,1055) / 4826, 5018, 5211, 5340, 974/ +data (gchtab(i), i=1056,1060) / 4941, 4875, 4873, 4999, 5127/ +data (gchtab(i), i=1061,1065) / 5256, 5322, 5324, 5198, 5070/ +data (gchtab(i), i=1066,1070) / 0, 92, 4626, 4103, 28/ +data (gchtab(i), i=1071,1075) / 4562, 28, 5084, 5142, 5020/ +data (gchtab(i), i=1076,1080) / 72, 5000, 7, 5063, 5133/ +data (gchtab(i), i=1081,1085) / 4999, 0, 160, 4224, 544/ +data (gchtab(i), i=1086,1090) / 4608, 0, 23, 4121, 4187/ +data (gchtab(i), i=1091,1095) / 4252, 4380, 4443, 4505, 4565/ +data (gchtab(i), i=1096,1100) / 4551, 25, 4251, 4379, 4505/ +data (gchtab(i), i=1101,1105) / 983, 5081, 5019, 4956, 4828/ +data (gchtab(i), i=1106,1110) / 4763, 4697, 4629, 4615, 985/ +data (gchtab(i), i=1111,1115) / 4955, 4827, 4697, 263, 4807/ +data (gchtab(i), i=1116,1120) / 0, 473, 4167, 601, 5063/ +data (gchtab(i), i=1121,1125) / 537, 4999, 205, 4877, 7/ +data (gchtab(i), i=1126,1130) / 4423, 711, 5191, 480, 4447/ +data (gchtab(i), i=1131,1135) / 4381, 4379, 4441, 4568, 4696/ +data (gchtab(i), i=1136,1140) / 4825, 4891, 4893, 4831, 4704/ +data (gchtab(i), i=1141,1145) / 4576, 0, 74, 4231, 4487/ +data (gchtab(i), i=1146,1150) / 4363, 4239, 4178, 4182, 4249/ +data (gchtab(i), i=1151,1155) / 4379, 4572, 4828, 5019, 5145/ +data (gchtab(i), i=1156,1160) / 5206, 5202, 5135, 5003, 4871/ +data (gchtab(i), i=1161,1165) / 5127, 5194, 267, 4302, 4242/ +data (gchtab(i), i=1166,1170) / 4246, 4313, 4443, 4572, 732/ +data (gchtab(i), i=1171,1175) / 4955, 5081, 5142, 5138, 5070/ +data (gchtab(i), i=1176,1180) / 5003, 136, 4424, 840, 5128/ +data (gchtab(i), i=1181,1185) / 0, 157, 4184, 1117, 5144/ +data (gchtab(i), i=1186,1190) / 404, 4431, 852, 4879, 139/ +data (gchtab(i), i=1191,1195) / 4166, 1099, 5126, 155, 5147/ +data (gchtab(i), i=1196,1200) / 154, 5146, 402, 4882, 401/ +data (gchtab(i), i=1201,1205) / 4881, 137, 5129, 136, 5128/ +data (gchtab(i), i=1206,1210) / 0, 604, 4679, 668, 4743/ +data (gchtab(i), i=1211,1215) / 21, 4182, 4309, 4369, 4431/ +data (gchtab(i), i=1216,1220) / 4494, 4621, 86, 4245, 4305/ +data (gchtab(i), i=1221,1225) / 4367, 4430, 4621, 4813, 5006/ +data (gchtab(i), i=1226,1230) / 5071, 5137, 5205, 5270, 717/ +data (gchtab(i), i=1231,1235) / 4942, 5007, 5073, 5141, 5270/ +data (gchtab(i), i=1236,1240) / 5333, 412, 4956, 391, 4935/ +data (gchtab(i), i=1241,1245) / 0, 35, 0, 160, 4224/ +data (gchtab(i), i=1246,1250) / 224, 4288, 160, 4704, 128/ +data (gchtab(i), i=1251,1255) / 4672, 0, 28, 4868, 0/ +data (gchtab(i), i=1256,1260) / 480, 4544, 544, 4608, 96/ +data (gchtab(i), i=1261,1265) / 4640, 64, 4608, 0, 35/ +data (gchtab(i), i=1266,1270) / 0, 1106, 5392, 5198, 917/ +data (gchtab(i), i=1271,1275) / 5328, 5003, 144, 5328, 0/ +data (gchtab(i), i=1276,1280) / 85, 4437, 4809, 277, 4807/ +data (gchtab(i), i=1281,1285) / 1312, 4807, 0, 533, 4436/ +data (gchtab(i), i=1286,1290) / 4306, 4240, 4173, 4170, 4232/ +data (gchtab(i), i=1291,1295) / 4423, 4551, 4680, 4875, 5006/ +data (gchtab(i), i=1296,1300) / 5138, 5205, 533, 4500, 4370/ +data (gchtab(i), i=1301,1305) / 4304, 4237, 4234, 4296, 4423/ +data (gchtab(i), i=1306,1310) / 533, 4757, 4884, 4946, 5066/ +data (gchtab(i), i=1311,1315) / 5128, 5191, 661, 4820, 4882/ +data (gchtab(i), i=1316,1320) / 5002, 5064, 5191, 5255, 0/ +data (gchtab(i), i=1321,1325) / 732, 4635, 4505, 4373, 4306/ +data (gchtab(i), i=1326,1330) / 4238, 4168, 4096, 732, 4699/ +data (gchtab(i), i=1331,1335) / 4569, 4437, 4370, 4302, 4232/ +data (gchtab(i), i=1336,1340) / 4160, 732, 4956, 5083, 5146/ +data (gchtab(i), i=1341,1345) / 5143, 5077, 5012, 4819, 4563/ +data (gchtab(i), i=1346,1350) / 860, 5082, 5079, 5013, 4948/ +data (gchtab(i), i=1351,1355) / 4819, 467, 4818, 4944, 5006/ +data (gchtab(i), i=1356,1360) / 5003, 4937, 4872, 4679, 4551/ +data (gchtab(i), i=1361,1365) / 4424, 4361, 4300, 467, 4754/ +data (gchtab(i), i=1366,1370) / 4880, 4942, 4939, 4873, 4808/ +data (gchtab(i), i=1371,1375) / 4679, 0, 21, 4245, 4372/ +data (gchtab(i), i=1376,1380) / 4434, 4739, 4801, 4864, 149/ +data (gchtab(i), i=1381,1385) / 4308, 4370, 4675, 4737, 4864/ +data (gchtab(i), i=1386,1390) / 4992, 981, 5011, 4880, 4229/ +data (gchtab(i), i=1391,1395) / 4098, 4096, 0, 724, 4693/ +data (gchtab(i), i=1396,1400) / 4565, 4372, 4241, 4174, 4171/ +data (gchtab(i), i=1401,1405) / 4233, 4296, 4423, 4551, 4744/ +data (gchtab(i), i=1406,1410) / 4875, 4942, 4945, 4883, 4632/ +data (gchtab(i), i=1411,1415) / 4570, 4572, 4637, 4765, 4892/ +data (gchtab(i), i=1416,1420) / 5018, 469, 4436, 4305, 4238/ +data (gchtab(i), i=1421,1425) / 4234, 4296, 455, 4680, 4811/ +data (gchtab(i), i=1426,1430) / 4878, 4882, 4820, 4695, 4633/ +data (gchtab(i), i=1431,1435) / 4635, 4700, 4828, 5018, 0/ +data (gchtab(i), i=1436,1440) / 850, 4820, 4693, 4437, 4308/ +data (gchtab(i), i=1441,1445) / 4306, 4432, 4623, 341, 4372/ +data (gchtab(i), i=1446,1450) / 4370, 4496, 4623, 527, 4302/ +data (gchtab(i), i=1451,1455) / 4172, 4170, 4232, 4423, 4615/ +data (gchtab(i), i=1456,1460) / 4744, 4874, 527, 4366, 4236/ +data (gchtab(i), i=1461,1465) / 4234, 4296, 4423, 0, 404/ +data (gchtab(i), i=1466,1470) / 4371, 4241, 4174, 4171, 4233/ +data (gchtab(i), i=1471,1475) / 4296, 4423, 4615, 4808, 5002/ +data (gchtab(i), i=1476,1480) / 5133, 5200, 5203, 5077, 4949/ +data (gchtab(i), i=1481,1485) / 4819, 4687, 4554, 4352, 75/ +data (gchtab(i), i=1486,1490) / 4297, 4424, 4616, 4809, 5003/ +data (gchtab(i), i=1491,1495) / 5133, 1107, 5076, 4948, 4818/ +data (gchtab(i), i=1496,1500) / 4687, 4553, 4416, 0, 18/ +data (gchtab(i), i=1501,1505) / 4180, 4309, 4437, 4564, 4627/ +data (gchtab(i), i=1506,1510) / 4688, 4684, 4616, 4416, 19/ +data (gchtab(i), i=1511,1515) / 4244, 4500, 4627, 1045, 5074/ +data (gchtab(i), i=1516,1520) / 5008, 4681, 4484, 4352, 981/ +data (gchtab(i), i=1521,1525) / 5010, 4944, 4681, 0, 17/ +data (gchtab(i), i=1526,1530) / 4115, 4245, 4437, 4500, 4498/ +data (gchtab(i), i=1531,1535) / 4430, 4295, 277, 4436, 4434/ +data (gchtab(i), i=1536,1540) / 4366, 4231, 334, 4562, 4692/ +data (gchtab(i), i=1541,1545) / 4821, 4949, 5076, 5139, 5136/ +data (gchtab(i), i=1546,1550) / 5067, 4864, 853, 5075, 5072/ +data (gchtab(i), i=1551,1555) / 5003, 4800, 0, 277, 4238/ +data (gchtab(i), i=1556,1560) / 4170, 4168, 4231, 4423, 4553/ +data (gchtab(i), i=1561,1565) / 4619, 341, 4302, 4234, 4232/ +data (gchtab(i), i=1566,1570) / 4295, 0, 848, 4883, 4820/ +data (gchtab(i), i=1571,1575) / 4693, 4565, 4372, 4241, 4174/ +data (gchtab(i), i=1576,1580) / 4171, 4233, 4296, 4423, 4551/ +data (gchtab(i), i=1581,1585) / 4744, 4874, 4941, 5010, 5015/ +data (gchtab(i), i=1586,1590) / 4954, 4891, 4764, 4572, 4443/ +data (gchtab(i), i=1591,1595) / 4378, 4377, 4441, 4442, 469/ +data (gchtab(i), i=1596,1600) / 4436, 4305, 4238, 4234, 4296/ +data (gchtab(i), i=1601,1605) / 455, 4680, 4810, 4877, 4946/ +data (gchtab(i), i=1606,1610) / 4951, 4890, 4764, 0, 277/ +data (gchtab(i), i=1611,1615) / 4103, 341, 4167, 917, 5076/ +data (gchtab(i), i=1616,1620) / 5140, 5077, 4949, 4820, 4560/ +data (gchtab(i), i=1621,1625) / 4431, 4303, 335, 4558, 4680/ +data (gchtab(i), i=1626,1630) / 4743, 335, 4494, 4616, 4679/ +data (gchtab(i), i=1631,1635) / 4807, 4936, 5067, 0, 92/ +data (gchtab(i), i=1636,1640) / 4316, 4443, 4506, 4568, 4938/ +data (gchtab(i), i=1641,1645) / 5000, 5063, 220, 4442, 4504/ +data (gchtab(i), i=1646,1650) / 4874, 4936, 5063, 5127, 533/ +data (gchtab(i), i=1651,1655) / 4103, 533, 4167, 0, 341/ +data (gchtab(i), i=1656,1660) / 4096, 405, 4096, 338, 4364/ +data (gchtab(i), i=1661,1665) / 4361, 4487, 4615, 4744, 4874/ +data (gchtab(i), i=1666,1670) / 5005, 1045, 4938, 4936, 4999/ +data (gchtab(i), i=1671,1675) / 5191, 5321, 5387, 1109, 5002/ +data (gchtab(i), i=1676,1680) / 5000, 5063, 0, 277, 4231/ +data (gchtab(i), i=1681,1685) / 341, 4367, 4298, 4231, 981/ +data (gchtab(i), i=1686,1690) / 5009, 4877, 1045, 5074, 5008/ +data (gchtab(i), i=1691,1695) / 4877, 4747, 4553, 4424, 4231/ +data (gchtab(i), i=1696,1700) / 85, 4437, 0, 469, 4372/ +data (gchtab(i), i=1701,1705) / 4241, 4174, 4171, 4233, 4296/ +data (gchtab(i), i=1706,1710) / 4423, 4551, 4744, 4875, 4942/ +data (gchtab(i), i=1711,1715) / 4945, 4883, 4820, 4693, 4565/ +data (gchtab(i), i=1716,1720) / 469, 4436, 4305, 4238, 4234/ +data (gchtab(i), i=1721,1725) / 4296, 455, 4680, 4811, 4878/ +data (gchtab(i), i=1726,1730) / 4882, 4820, 0, 468, 4295/ +data (gchtab(i), i=1731,1735) / 468, 4359, 852, 4935, 852/ +data (gchtab(i), i=1736,1740) / 4999, 18, 4244, 4437, 5269/ +data (gchtab(i), i=1741,1745) / 18, 4243, 4436, 5268, 0/ +data (gchtab(i), i=1746,1750) / 17, 4115, 4245, 4437, 4500/ +data (gchtab(i), i=1751,1755) / 4498, 4429, 4426, 4488, 4551/ +data (gchtab(i), i=1756,1760) / 277, 4436, 4434, 4365, 4362/ +data (gchtab(i), i=1761,1765) / 4424, 4551, 4679, 4808, 4938/ +data (gchtab(i), i=1766,1770) / 5069, 5136, 5205, 5209, 5147/ +data (gchtab(i), i=1771,1775) / 5020, 4892, 4762, 4760, 4821/ +data (gchtab(i), i=1776,1780) / 4946, 5072, 5262, 712, 4939/ +data (gchtab(i), i=1781,1785) / 5005, 5072, 5141, 5145, 5083/ +data (gchtab(i), i=1786,1790) / 5020, 0, 140, 4297, 4360/ +data (gchtab(i), i=1791,1795) / 4487, 4615, 4808, 4939, 5006/ +data (gchtab(i), i=1796,1800) / 5009, 4947, 4884, 4757, 4629/ +data (gchtab(i), i=1801,1805) / 4436, 4305, 4238, 4096, 519/ +data (gchtab(i), i=1806,1810) / 4744, 4875, 4942, 4946, 4884/ +data (gchtab(i), i=1811,1815) / 533, 4500, 4369, 4302, 4096/ +data (gchtab(i), i=1816,1820) / 0, 1109, 4565, 4372, 4241/ +data (gchtab(i), i=1821,1825) / 4174, 4171, 4233, 4296, 4423/ +data (gchtab(i), i=1826,1830) / 4551, 4744, 4875, 4942, 4945/ +data (gchtab(i), i=1831,1835) / 4883, 4820, 4693, 469, 4436/ +data (gchtab(i), i=1836,1840) / 4305, 4238, 4234, 4296, 455/ +data (gchtab(i), i=1841,1845) / 4680, 4811, 4878, 4882, 4820/ +data (gchtab(i), i=1846,1850) / 724, 5204, 0, 596, 4487/ +data (gchtab(i), i=1851,1855) / 596, 4551, 18, 4244, 4437/ +data (gchtab(i), i=1856,1860) / 5141, 18, 4243, 4436, 5140/ +data (gchtab(i), i=1861,1865) / 0, 17, 4115, 4245, 4437/ +data (gchtab(i), i=1866,1870) / 4500, 4498, 4364, 4361, 4487/ +data (gchtab(i), i=1871,1875) / 277, 4436, 4434, 4300, 4297/ +data (gchtab(i), i=1876,1880) / 4360, 4487, 4551, 4744, 4874/ +data (gchtab(i), i=1881,1885) / 5005, 5072, 5075, 5013, 4948/ +data (gchtab(i), i=1886,1890) / 5011, 5072, 909, 5075, 0/ +data (gchtab(i), i=1891,1895) / 35, 0, 145, 4371, 4564/ +data (gchtab(i), i=1896,1900) / 4501, 4372, 4241, 4174, 4171/ +data (gchtab(i), i=1901,1905) / 4232, 4295, 4423, 4552, 4683/ +data (gchtab(i), i=1906,1910) / 4750, 75, 4233, 4296, 4424/ +data (gchtab(i), i=1911,1915) / 4553, 4683, 590, 4683, 4744/ +data (gchtab(i), i=1916,1920) / 4807, 4935, 5064, 5195, 5262/ +data (gchtab(i), i=1921,1925) / 5265, 5204, 5141, 5076, 5203/ +data (gchtab(i), i=1926,1930) / 5265, 587, 4745, 4808, 4936/ +data (gchtab(i), i=1931,1935) / 5065, 5195, 0, 604, 4571/ +data (gchtab(i), i=1936,1940) / 4506, 4505, 4568, 4759, 4951/ +data (gchtab(i), i=1941,1945) / 663, 4502, 4373, 4307, 4305/ +data (gchtab(i), i=1946,1950) / 4431, 4622, 4814, 663, 4566/ +data (gchtab(i), i=1951,1955) / 4437, 4371, 4369, 4495, 4622/ +data (gchtab(i), i=1956,1960) / 526, 4365, 4236, 4170, 4168/ +data (gchtab(i), i=1961,1965) / 4294, 4612, 4675, 4673, 4544/ +data (gchtab(i), i=1966,1970) / 4416, 526, 4429, 4300, 4234/ +data (gchtab(i), i=1971,1975) / 4232, 4358, 4612, 0, 860/ +data (gchtab(i), i=1976,1980) / 4544, 924, 4480, 17, 4115/ +data (gchtab(i), i=1981,1985) / 4245, 4437, 4500, 4498, 4429/ +data (gchtab(i), i=1986,1990) / 4426, 4552, 4744, 4873, 5068/ +data (gchtab(i), i=1991,1995) / 5199, 277, 4436, 4434, 4365/ +data (gchtab(i), i=1996,2000) / 4362, 4424, 4551, 4743, 4872/ +data (gchtab(i), i=2001,2005) / 5002, 5133, 5199, 5333, 0/ +data (gchtab(i), i=2006,2010) / 604, 4571, 4506, 4505, 4568/ +data (gchtab(i), i=2011,2015) / 4759, 5079, 5080, 4887, 4629/ +data (gchtab(i), i=2016,2020) / 4435, 4240, 4173, 4171, 4233/ +data (gchtab(i), i=2021,2025) / 4423, 4613, 4675, 4673, 4608/ +data (gchtab(i), i=2026,2030) / 4480, 4417, 662, 4499, 4304/ +data (gchtab(i), i=2031,2035) / 4237, 4235, 4297, 4423, 0/ +data (gchtab(i), i=2036,2040) / 480, 4447, 4382, 4316, 4314/ +data (gchtab(i), i=2041,2045) / 4376, 4439, 4501, 4499, 4369/ +data (gchtab(i), i=2046,2050) / 351, 4381, 4379, 4441, 4504/ +data (gchtab(i), i=2051,2055) / 4566, 4564, 4498, 4240, 4494/ +data (gchtab(i), i=2056,2060) / 4556, 4554, 4488, 4423, 4357/ +data (gchtab(i), i=2061,2065) / 4355, 4417, 271, 4493, 4491/ +data (gchtab(i), i=2066,2070) / 4425, 4360, 4294, 4292, 4354/ +data (gchtab(i), i=2071,2075) / 4417, 4544, 0, 160, 4224/ +data (gchtab(i), i=2076,2080) / 544, 4608, 0, 224, 4447/ +data (gchtab(i), i=2081,2085) / 4510, 4572, 4570, 4504, 4439/ +data (gchtab(i), i=2086,2090) / 4373, 4371, 4497, 351, 4509/ +data (gchtab(i), i=2091,2095) / 4507, 4441, 4376, 4310, 4308/ +data (gchtab(i), i=2096,2100) / 4370, 4624, 4366, 4300, 4298/ +data (gchtab(i), i=2101,2105) / 4360, 4423, 4485, 4483, 4417/ +data (gchtab(i), i=2106,2110) / 399, 4365, 4363, 4425, 4488/ +data (gchtab(i), i=2111,2115) / 4550, 4548, 4482, 4417, 4288/ +data (gchtab(i), i=2116,2120) / 0, 338, 4240, 4430, 533/ +data (gchtab(i), i=2121,2125) / 4304, 4619, 208, 5392, 0/ +data (gchtab(i), i=2126,2130) / 284, 4251, 4185, 4183, 4245/ +data (gchtab(i), i=2131,2135) / 4372, 4500, 4629, 4695, 4697/ +data (gchtab(i), i=2136,2139) / 4635, 4508, 4380, 0/ diff --git a/sys/gio/sgikern/ltype.dat b/sys/gio/sgikern/ltype.dat new file mode 100644 index 00000000..a5509e21 --- /dev/null +++ b/sys/gio/sgikern/ltype.dat @@ -0,0 +1,28 @@ +# LTYPE.DAT -- Initialize the builtin line types for the SGI kernel. Data +# is given in GKI units (1.0 = 32768 units). A segment of 32 GKI units is +# resolved on a device with 1024 resolved pixels. + +data p_seg /1, 1, 1/ +data p_segleft /320, 32, 512/ + +data p_nseg[1] /2/ # PL_DASHED +data p_penup[1,1] /false/ +data p_penup[1,2] /true/ +data p_seglen[1,1] /320/ +data p_seglen[1,2] /128/ + +data p_nseg[2] /2/ # PL_DOTTED +data p_penup[2,1] /false/ +data p_penup[2,2] /true/ +data p_seglen[2,1] /32/ +data p_seglen[2,2] /128/ + +data p_nseg[3] /4/ # PL_DOTDASH +data p_penup[3,1] /false/ +data p_penup[3,2] /true/ +data p_penup[3,3] /false/ +data p_penup[3,4] /true/ +data p_seglen[3,1] /512/ +data p_seglen[3,2] /128/ +data p_seglen[3,3] /32/ +data p_seglen[3,4] /128/ diff --git a/sys/gio/sgikern/mkpkg b/sys/gio/sgikern/mkpkg new file mode 100644 index 00000000..3dd9e943 --- /dev/null +++ b/sys/gio/sgikern/mkpkg @@ -0,0 +1,53 @@ +# Make the GIO/SGIKERN simple graphics kernel. + +$checkout libsgi.a lib$ +$update libsgi.a +$checkin libsgi.a lib$ +$call relink +$exit + +update: + $call relink + $call install + ; + +relink: + $omake x_sgikern.x + $link x_sgikern.o -lsgi + ; + +install: # install in system library + $move x_sgikern.e bin$ + ; + +libsgi.a: + sgicancel.x sgi.com sgi.h + sgiclear.x sgi.com sgi.h <mach.h> + sgiclose.x sgi.com sgi.h + sgiclws.x sgi.h sgi.com + sgicolor.x sgi.com sgi.h + sgidrawch.x font.com font.h greek.com sgi.com sgi.h \ + <gki.h> <gset.h> <math.h> + sgiescape.x + sgifa.x sgi.com sgi.h + sgifaset.x sgi.com sgi.h <gki.h> + sgiflush.x sgi.com sgi.h + sgifont.x sgi.com sgi.h <gki.h> <gset.h> + sgigcell.x + sgiinit.x sgi.com sgi.h <ctype.h> <gki.h> <mach.h> + sgiline.x sgi.com sgi.h <gset.h> + sgiopen.x sgi.com sgi.h <gki.h> + sgiopenws.x sgi.com sgi.h <error.h> <gki.h> <mach.h> + sgipcell.x sgi.com sgi.h <gki.h> + sgipl.x ltype.dat sgi.com sgi.h <gki.h> <gset.h> + sgiplset.x sgi.com sgi.h <gki.h> + sgipm.x sgi.com sgi.h <gki.h> + sgipmset.x sgi.com sgi.h <gki.h> + sgireset.x sgi.com sgi.h <gset.h> <gki.h> + sgitx.x font.com font.h greek.com sgi.com sgi.h \ + <gki.h> <gset.h> <math.h> + sgitxset.x sgi.com sgi.h <gki.h> <gset.h> + sgk.x sgk.com sgk.h <chars.h> <gki.h> <mach.h> + t_sgideco.x sgk.h <error.h> <gki.h> + t_sgikern.x <error.h> <gki.h> + ; diff --git a/sys/gio/sgikern/sgi.com b/sys/gio/sgikern/sgi.com new file mode 100644 index 00000000..e050183b --- /dev/null +++ b/sys/gio/sgikern/sgi.com @@ -0,0 +1,17 @@ +# SGI common. A common is necessary since there is no graphics descriptor +# in the argument list of the kernel procedures. The stdgraph data structures +# are designed along the lines of FIO: a small common is used to hold the time +# critical data elements, and an auxiliary dynamically allocated descriptor is +# used for everything else. + +pointer g_kt # kernel transform graphics descriptor +pointer g_tty # graphcap descriptor +int g_nframes # number of frames written +int g_maxframes # max frames per device metafile +int g_ndraw # no draw instr. in current frame +int g_in, g_out # input, output files +int g_xres, g_yres # desired device resolution +char g_device[SZ_GDEVICE] # force output to named device + +common /sgicom/ g_kt, g_tty, g_nframes, g_maxframes, g_ndraw, + g_in, g_out, g_xres, g_yres, g_device diff --git a/sys/gio/sgikern/sgi.h b/sys/gio/sgikern/sgi.h new file mode 100644 index 00000000..a9f1da20 --- /dev/null +++ b/sys/gio/sgikern/sgi.h @@ -0,0 +1,76 @@ +# SGI global definitions. + +define MAX_CHARSIZES 10 # max discreet device char sizes +define SZ_SBUF 1024 # initial string buffer size +define SZ_GDEVICE 31 # maxsize forced device name +define DEF_MAXFRAMES 16 # maximum frames/metafile + +# The SGI state/device descriptor. + +define LEN_SGI 81 + +define SGI_SBUF Memi[$1] # string buffer +define SGI_SZSBUF Memi[$1+1] # size of string buffer +define SGI_NEXTCH Memi[$1+2] # next char pos in string buf +define SGI_NCHARSIZES Memi[$1+3] # number of character sizes +define SGI_POLYLINE Memi[$1+4] # device supports polyline +define SGI_POLYMARKER Memi[$1+5] # device supports polymarker +define SGI_FILLAREA Memi[$1+6] # device supports fillarea +define SGI_CELLARRAY Memi[$1+7] # device supports cell array +define SGI_XRES Memi[$1+8] # device resolution in X +define SGI_YRES Memi[$1+9] # device resolution in Y +define SGI_ZRES Memi[$1+10] # device resolution in Z +define SGI_FILLSTYLE Memi[$1+11] # number of fill styles +define SGI_ROAM Memi[$1+12] # device supports roam +define SGI_ZOOM Memi[$1+13] # device supports zoom +define SGI_SELERASE Memi[$1+14] # device has selective erase +define SGI_PIXREP Memi[$1+15] # device supports pixel replic. +define SGI_STARTFRAME Memi[$1+16] # frame advance at metafile BOF +define SGI_ENDFRAME Memi[$1+17] # frame advance at metafile EOF + # extra space +define SGI_CURSOR Memi[$1+20] # last cursor accessed +define SGI_COLOR Memi[$1+21] # last color set +define SGI_TXSIZE Memi[$1+22] # last text size set +define SGI_TXFONT Memi[$1+23] # last text font set +define SGI_TYPE Memi[$1+24] # last line type set +define SGI_WIDTH Memi[$1+25] # last line width set +define SGI_DEVNAME Memi[$1+26] # name of open device + # extra space +define SGI_CHARHEIGHT Memi[$1+30+$2-1] # character height +define SGI_CHARWIDTH Memi[$1+40+$2-1] # character width +define SGI_CHARSIZE Memr[P2R($1+50+$2-1)] # text sizes permitted +define SGI_PLAP ($1+60) # polyline attributes +define SGI_PMAP ($1+64) # polymarker attributes +define SGI_FAAP ($1+68) # fill area attributes +define SGI_TXAP ($1+71) # default text attributes + +# Substructure definitions. + +define LEN_PL 4 +define PL_STATE Memi[$1] # polyline attributes +define PL_LTYPE Memi[$1+1] +define PL_WIDTH Memi[$1+2] +define PL_COLOR Memi[$1+3] + +define LEN_PM 4 +define PM_STATE Memi[$1] # polymarker attributes +define PM_LTYPE Memi[$1+1] +define PM_WIDTH Memi[$1+2] +define PM_COLOR Memi[$1+3] + +define LEN_FA 3 # fill area attributes +define FA_STATE Memi[$1] +define FA_STYLE Memi[$1+1] +define FA_COLOR Memi[$1+2] + +define LEN_TX 10 # text attributes +define TX_STATE Memi[$1] +define TX_UP Memi[$1+1] +define TX_SIZE Memi[$1+2] +define TX_PATH Memi[$1+3] +define TX_SPACING Memr[P2R($1+4)] +define TX_HJUSTIFY Memi[$1+5] +define TX_VJUSTIFY Memi[$1+6] +define TX_FONT Memi[$1+7] +define TX_QUALITY Memi[$1+8] +define TX_COLOR Memi[$1+9] diff --git a/sys/gio/sgikern/sgicancel.x b/sys/gio/sgikern/sgicancel.x new file mode 100644 index 00000000..d9249d4b --- /dev/null +++ b/sys/gio/sgikern/sgicancel.x @@ -0,0 +1,16 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "sgi.h" + +# SGI_CANCEL -- Cancel any buffered output. + +procedure sgi_cancel (dummy) + +int dummy # not used at present +include "sgi.com" + +begin + if (g_kt == NULL) + return + call sgi_reset() +end diff --git a/sys/gio/sgikern/sgiclear.x b/sys/gio/sgikern/sgiclear.x new file mode 100644 index 00000000..f2a63d29 --- /dev/null +++ b/sys/gio/sgikern/sgiclear.x @@ -0,0 +1,54 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> +include "sgi.h" + +# SGI_CLEAR -- Advance a frame on the plotter. All attribute packets are +# initialized to their default values. Redundant calls or calls immediately +# after a workstation open (before anything has been drawn) are ignored. + +procedure sgi_clear (dummy) + +int dummy # not used at present + +int sgk_open() +errchk sgk_open +include "sgi.com" + +begin + # This is a no-op if nothing has been drawn. + if (g_kt == NULL || g_ndraw == 0) + return + + # Start a new frame. This is done either by issuing the frame advance + # instruction or by starting a new metafile. Close the output file and + # start a new metafile if the maximum frame count has been reached. + # This disposes of the metafile to the system, causing the actual + # plots to be drawn. Open a new metafile ready to receive next frame. + + g_nframes = g_nframes + 1 + if (g_nframes >= g_maxframes) { + + # Does this device require a frame advance at end of metafile? + if (SGI_ENDFRAME(g_kt) == YES) + call sgk_frame (g_out) + + g_nframes = 0 + call sgk_close (g_out) + g_out = sgk_open (Memc[SGI_DEVNAME(g_kt)], g_tty) + + # Does this device require a frame advance at beginning of metafile? + if (SGI_STARTFRAME(g_kt) == YES) + call sgk_frame (g_out) + + } else { + # Merely output frame instruction to start a new frame in the same + # metafile. + + call sgk_frame (g_out) + } + + # Init kernel data structures. + call sgi_reset() + g_ndraw = 0 +end diff --git a/sys/gio/sgikern/sgiclose.x b/sys/gio/sgikern/sgiclose.x new file mode 100644 index 00000000..380cd01f --- /dev/null +++ b/sys/gio/sgikern/sgiclose.x @@ -0,0 +1,30 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "sgi.h" + +# SGI_CLOSE -- Close the SGI translation kernel. Close the spool file so +# the output is finally plotted. Free up storage. + +procedure sgi_close() + +include "sgi.com" + +begin + # If there is anything in the metafile, flush it and add a frame + # advance if required for the device. + + if (g_ndraw > 0 || g_nframes > 0) { + # Does this device require a frame advance at end of metafile? + if (SGI_ENDFRAME(g_kt) == YES) + call sgk_frame (g_out) + } + + # Close output metafile, disposing of it to the host system. + call sgk_close (g_out) + + # Free kernel data structures. + call mfree (SGI_SBUF(g_kt), TY_CHAR) + call mfree (g_kt, TY_STRUCT) + + g_kt = NULL +end diff --git a/sys/gio/sgikern/sgiclws.x b/sys/gio/sgikern/sgiclws.x new file mode 100644 index 00000000..e7d29dd7 --- /dev/null +++ b/sys/gio/sgikern/sgiclws.x @@ -0,0 +1,17 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "sgi.h" + +# SGI_CLOSEWS -- Close the named workstation. Flush the output. +# The spool file is closed only on the next plot or at gktclose time. +# If the spool file is closed here, APPEND mode would not work. + +procedure sgi_closews (devname, n) + +short devname[ARB] # device name (not used) +int n # length of device name +include "sgi.com" + +begin + call sgk_flush (g_out) +end diff --git a/sys/gio/sgikern/sgicolor.x b/sys/gio/sgikern/sgicolor.x new file mode 100644 index 00000000..cdd13708 --- /dev/null +++ b/sys/gio/sgikern/sgicolor.x @@ -0,0 +1,20 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "sgi.h" + +# SGI_COLOR -- Set line drawing color. + +procedure sgi_color (index) + +int index # index for color switch statement +include "sgi.com" + +begin + # switch (index) { + # case WHITE: + # case RED: + # case GREEN: + # case BLUE: + # default: + # } +end diff --git a/sys/gio/sgikern/sgidrawch.x b/sys/gio/sgikern/sgidrawch.x new file mode 100644 index 00000000..ab7500ea --- /dev/null +++ b/sys/gio/sgikern/sgidrawch.x @@ -0,0 +1,84 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <math.h> +include <gki.h> +include <gset.h> +include "sgi.h" +include "font.h" + +define ITALIC_TILT 0.30 # fraction of xsize to tilt italics at top + + +# SGI_DRAWCHAR -- Draw a character of the given size and orientation at the +# given position. + +int procedure sgi_drawchar (ch, x, y, xsize, ysize, orien, font) + +char ch # character to be drawn +int x, y # lower left GKI coords of character +int xsize, ysize # width, height of char in GKI units +int orien # orientation of character (0 degrees normal) +int font # desired character font + +int mx, my +real px, py, coso, sino, theta +int stroke, tab1, tab2, i, pen, width +int bitupk() +include "font.com" +include "greek.com" +include "sgi.com" + +begin + if (ch < CHARACTER_START || ch > CHARACTER_END) + i = '?' - CHARACTER_START + 1 + else + i = ch - CHARACTER_START + 1 + + # Set the font. + call sgi_font (font) + + if (font == GT_GREEK) { + width = gchwid[i] + tab1 = gchidx[i] + tab2 = gchidx[i+1] - 1 + } else { + width = chrwid[i] + tab1 = chridx[i] + tab2 = chridx[i+1] - 1 + } + + theta = -DEGTORAD(orien) + coso = cos(theta) + sino = sin(theta) + + do i = tab1, tab2 { + if (font == GT_GREEK) + stroke = gchtab[i] + else + stroke = chrtab[i] + + px = bitupk (stroke, COORD_X_START, COORD_X_LEN) + py = bitupk (stroke, COORD_Y_START, COORD_Y_LEN) + pen = bitupk (stroke, COORD_PEN_START, COORD_PEN_LEN) + + # Scale size of character. + px = px / width * xsize + py = py / FONT_HEIGHT * ysize + + # The italic font is implemented applying a tilt. + if (font == GT_ITALIC) + px = px + ((py / ysize) * xsize * ITALIC_TILT) + + # Rotate and shift. + mx = x + px * coso + py * sino + my = y - px * sino + py * coso + + # Draw the line segment or move pen. + if (pen == 0) + call sgk_move (g_out, mx, my) + else + call sgk_draw (g_out, mx, my) + } + + return (int(real(width) / real(FONT_WIDTH) * xsize)) +end diff --git a/sys/gio/sgikern/sgiescape.x b/sys/gio/sgikern/sgiescape.x new file mode 100644 index 00000000..ff2480cd --- /dev/null +++ b/sys/gio/sgikern/sgiescape.x @@ -0,0 +1,13 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# SGI_ESCAPE -- Pass a device dependent instruction on to the kernel. +# The SGK kernel does not have any escape functions at present. + +procedure sgi_escape (fn, instruction, nwords) + +int fn # function code +short instruction[ARB] # instruction data words +int nwords # length of instruction + +begin +end diff --git a/sys/gio/sgikern/sgifa.x b/sys/gio/sgikern/sgifa.x new file mode 100644 index 00000000..37793f22 --- /dev/null +++ b/sys/gio/sgikern/sgifa.x @@ -0,0 +1,20 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "sgi.h" + +# SGI_FILLAREA -- Fill a closed area. + +procedure sgi_fillarea (p, npts) + +short p[ARB] # points defining line +int npts # number of points, i.e., (x,y) pairs +include "sgi.com" + +begin + # This kernel doesn't have any real fill area capability yet; if + # fill area is enabled in the graphcap entry, just draw the outline + # of the area. + + if (SGI_FILLAREA(g_kt) == YES) + call sgi_polyline (p, npts) +end diff --git a/sys/gio/sgikern/sgifaset.x b/sys/gio/sgikern/sgifaset.x new file mode 100644 index 00000000..c3810252 --- /dev/null +++ b/sys/gio/sgikern/sgifaset.x @@ -0,0 +1,18 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include "sgi.h" + +# SGI_FASET -- Set the fillarea attributes. + +procedure sgi_faset (gki) + +short gki[ARB] # attribute structure +pointer fa +include "sgi.com" + +begin + fa = SGI_FAAP(g_kt) + FA_STYLE(fa) = gki[GKI_FASET_FS] + FA_COLOR(fa) = gki[GKI_FASET_CI] +end diff --git a/sys/gio/sgikern/sgiflush.x b/sys/gio/sgikern/sgiflush.x new file mode 100644 index 00000000..e3e1b805 --- /dev/null +++ b/sys/gio/sgikern/sgiflush.x @@ -0,0 +1,14 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "sgi.h" + +# SGI_FLUSH -- Flush output. + +procedure sgi_flush (dummy) + +int dummy # not used at present +include "sgi.com" + +begin + call sgk_flush (g_out) +end diff --git a/sys/gio/sgikern/sgifont.x b/sys/gio/sgikern/sgifont.x new file mode 100644 index 00000000..808c7f56 --- /dev/null +++ b/sys/gio/sgikern/sgifont.x @@ -0,0 +1,42 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include <gset.h> +include "sgi.h" + +# SGI_FONT -- Set the character font. The roman font is normal. Bold is +# implemented by increasing the vector line width; care must be taken to +# set SGI_WIDTH so that the other vector drawing procedures remember to +# change the width back. The italic font is implemented in the character +# generator by a geometric transformation. + +procedure sgi_font (font) + +int font # code for font to be set + +int normal, bold +int pk1, pk2, width +include "sgi.com" + +begin + width = SGI_WIDTH(g_kt) + normal = 0 + bold = 1 + + pk1 = GKI_PACKREAL(real(normal)) + pk2 = GKI_PACKREAL(real(bold)) + + if (font == GT_BOLD) { + if (width != pk2) { + call sgk_linewidth (g_out, bold) + width = pk2 + } + } else { + if (width != pk1) { + call sgk_linewidth (g_out, normal) + width = pk1 + } + } + + SGI_WIDTH(g_kt) = width +end diff --git a/sys/gio/sgikern/sgigcell.x b/sys/gio/sgikern/sgigcell.x new file mode 100644 index 00000000..4c2bfe06 --- /dev/null +++ b/sys/gio/sgikern/sgigcell.x @@ -0,0 +1,14 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# SGI_GETCELLARRAY -- Input a cell array, i.e., two dimensional array of pixels +# (greylevels or colors). + +procedure sgi_getcellarray (nx, ny, x1,y1, x2,y2) + +int nx, ny # number of pixels in X and Y +int x1, y1 # lower left corner of input window +int x2, y2 # lower left corner of input window + +begin + # Not implemented yet. +end diff --git a/sys/gio/sgikern/sgiinit.x b/sys/gio/sgikern/sgiinit.x new file mode 100644 index 00000000..54caf25d --- /dev/null +++ b/sys/gio/sgikern/sgiinit.x @@ -0,0 +1,162 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> +include <ctype.h> +include <gki.h> +include "sgi.h" + +# SGI_INIT -- Initialize the gkt data structures from the graphcap entry +# for the device. Called once, at OPENWS time, with the TTY pointer already +# set in the common. The companion routine SGI_RESET initializes the attribute +# packets when the frame is flushed. + +procedure sgi_init (tty, devname) + +pointer tty # graphcap descriptor +char devname[ARB] # device name + +pointer nextch +int maxch, i +real char_height, char_width, char_size + +bool ttygetb() +real ttygetr() +int ttygeti(), btoi(), gstrcpy() +include "sgi.com" + +begin + # Allocate the gkt descriptor and the string buffer. + if (g_kt == NULL) { + call calloc (g_kt, LEN_SGI, TY_STRUCT) + call malloc (SGI_SBUF(g_kt), SZ_SBUF, TY_CHAR) + } + + # Get the maximum frame count and the flags controlling frame advance + # at start and end of metafile. + + g_maxframes = ttygeti (tty, "MF") + if (g_maxframes == 0) + g_maxframes = DEF_MAXFRAMES + SGI_STARTFRAME(g_kt) = btoi (ttygetb (tty, "FS")) + SGI_ENDFRAME(g_kt) = btoi (ttygetb (tty, "FE")) + + # Init string buffer parameters. The first char of the string buffer + # is reserved as a null string, used for graphcap control strings + # omitted from the graphcap entry for the device. + + SGI_SZSBUF(g_kt) = SZ_SBUF + SGI_NEXTCH(g_kt) = SGI_SBUF(g_kt) + 1 + Memc[SGI_SBUF(g_kt)] = EOS + + # Get the device resolution from the graphcap entry. + + g_xres = ttygeti (tty, "xr") + if (g_xres <= 0) + g_xres = 1024 + g_yres = ttygeti (tty, "yr") + if (g_yres <= 0) + g_yres = 1024 + + # Initialize the character scaling parameters, required for text + # generation. The heights are given in NDC units in the graphcap + # file, which we convert to GKI units. Estimated values are + # supplied if the parameters are missing in the graphcap entry. + + char_height = ttygetr (tty, "ch") + if (char_height < EPSILON) + char_height = 1.0 / 35.0 + char_height = char_height * GKI_MAXNDC + + char_width = ttygetr (tty, "cw") + if (char_width < EPSILON) + char_width = 1.0 / 80.0 + char_width = char_width * GKI_MAXNDC + + # If the device has a set of discreet character sizes, get the + # size of each by fetching the parameter "tN", where the N is + # a digit specifying the text size index. Compute the height and + # width of each size character from the "ch" and "cw" parameters + # and the relative scale of character size I. + + SGI_NCHARSIZES(g_kt) = min (MAX_CHARSIZES, ttygeti (tty, "th")) + nextch = SGI_NEXTCH(g_kt) + + if (SGI_NCHARSIZES(g_kt) <= 0) { + SGI_NCHARSIZES(g_kt) = 1 + SGI_CHARSIZE(g_kt,1) = 1.0 + SGI_CHARHEIGHT(g_kt,1) = char_height + SGI_CHARWIDTH(g_kt,1) = char_width + } else { + Memc[nextch+2] = EOS + for (i=1; i <= SGI_NCHARSIZES(g_kt); i=i+1) { + Memc[nextch] = 't' + Memc[nextch+1] = TO_DIGIT(i) + char_size = ttygetr (tty, Memc[nextch]) + SGI_CHARSIZE(g_kt,i) = char_size + SGI_CHARHEIGHT(g_kt,i) = char_height * char_size + SGI_CHARWIDTH(g_kt,i) = char_width * char_size + } + } + + # Initialize the output parameters. All boolean parameters are stored + # as integer flags. All string valued parameters are stored in the + # string buffer, saving a pointer to the string in the gkt + # descriptor. If the capability does not exist the pointer is set to + # point to the null string at the beginning of the string buffer. + + SGI_POLYLINE(g_kt) = btoi (ttygetb (tty, "pl")) + SGI_POLYMARKER(g_kt) = btoi (ttygetb (tty, "pm")) + SGI_FILLAREA(g_kt) = btoi (ttygetb (tty, "fa")) + SGI_FILLSTYLE(g_kt) = ttygeti (tty, "fs") + SGI_ROAM(g_kt) = btoi (ttygetb (tty, "ro")) + SGI_ZOOM(g_kt) = btoi (ttygetb (tty, "zo")) + SGI_XRES(g_kt) = ttygeti (tty, "xr") + SGI_YRES(g_kt) = ttygeti (tty, "yr") + SGI_ZRES(g_kt) = ttygeti (tty, "zr") + SGI_CELLARRAY(g_kt) = btoi (ttygetb (tty, "ca")) + SGI_SELERASE(g_kt) = btoi (ttygetb (tty, "se")) + SGI_PIXREP(g_kt) = btoi (ttygetb (tty, "pr")) + + # Initialize the input parameters. + + SGI_CURSOR(g_kt) = 1 + + # Save the device string in the descriptor. + nextch = SGI_NEXTCH(g_kt) + SGI_DEVNAME(g_kt) = nextch + maxch = SGI_SBUF(g_kt) + SZ_SBUF - nextch + 1 + nextch = nextch + gstrcpy (devname, Memc[nextch], maxch) + 1 + SGI_NEXTCH(g_kt) = nextch +end + + +# SGI_GSTRING -- Get a string value parameter from the graphcap table, +# placing the string at the end of the string buffer. If the device does +# not have the named capability return a pointer to the null string, +# otherwise return a pointer to the string. Since pointers are used, +# rather than indices, the string buffer is fixed in size. The additional +# degree of indirection required with an index was not considered worthwhile +# in this application since the graphcap entries are never very large. + +pointer procedure sgi_gstring (cap) + +char cap[ARB] # device capability to be fetched +pointer strp, nextch +int maxch, nchars +int ttygets() +include "sgi.com" + +begin + nextch = SGI_NEXTCH(g_kt) + maxch = SGI_SBUF(g_kt) + SZ_SBUF - nextch + 1 + + nchars = ttygets (g_tty, cap, Memc[nextch], maxch) + if (nchars > 0) { + strp = nextch + nextch = nextch + nchars + 1 + } else + strp = SGI_SBUF(g_kt) + + SGI_NEXTCH(g_kt) = nextch + return (strp) +end diff --git a/sys/gio/sgikern/sgiline.x b/sys/gio/sgikern/sgiline.x new file mode 100644 index 00000000..086ac158 --- /dev/null +++ b/sys/gio/sgikern/sgiline.x @@ -0,0 +1,31 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gset.h> +include "sgi.h" + +# SGI_LINETYPE -- Set the line type option. + +procedure sgi_linetype (index) + +int index # index for line type switch statement + +int linetype +include "sgi.com" + +begin + switch (index) { + case GL_CLEAR: + linetype = 0 + case GL_DASHED: + linetype = 2 + case GL_DOTTED: + linetype = 3 + case GL_DOTDASH: + linetype = 4 + default: + linetype = 1 # solid + } + + # This will be done in software in a future version of the SGI kernel. + # call sgk_linetype (g_out, linetype) +end diff --git a/sys/gio/sgikern/sgiopen.x b/sys/gio/sgikern/sgiopen.x new file mode 100644 index 00000000..5164ecd7 --- /dev/null +++ b/sys/gio/sgikern/sgiopen.x @@ -0,0 +1,77 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include "sgi.h" + +# SGI_OPEN -- Install the SGI kernel as a graphics kernel device driver. +# The device table DD consists of an array of the entry point addresses for +# the driver procedures. If a driver does not implement a particular +# instruction the table entry for that procedure may be set to zero, causing +# the interpreter to ignore the instruction. + +procedure sgi_open (devname, dd) + +char devname[ARB] # nonnull for forced output to a device +int dd[ARB] # device table to be initialized + +pointer sp, devns +int len_devname +int locpr(), strlen() +extern sgi_openws(), sgi_closews(), sgi_clear(), sgi_cancel() +extern sgi_flush(), sgi_polyline(), sgi_polymarker(), sgi_text() +extern sgi_fillarea(), sgi_putcellarray(), sgi_plset() +extern sgi_pmset(), sgi_txset(), sgi_faset() +extern sgi_escape() +include "sgi.com" + +begin + call smark (sp) + call salloc (devns, SZ_FNAME, TY_SHORT) + + # Flag first pass. Save forced device name in common for OPENWS. + # Zero the frame and instruction counters. + + g_kt = NULL + g_nframes = 0 + g_ndraw = 0 + call strcpy (devname, g_device, SZ_GDEVICE) + + # Install the device driver. + + dd[GKI_OPENWS] = locpr (sgi_openws) + dd[GKI_CLOSEWS] = locpr (sgi_closews) + dd[GKI_DEACTIVATEWS] = 0 + dd[GKI_REACTIVATEWS] = 0 + dd[GKI_MFTITLE] = 0 + dd[GKI_CLEAR] = locpr (sgi_clear) + dd[GKI_CANCEL] = locpr (sgi_cancel) + dd[GKI_FLUSH] = locpr (sgi_flush) + dd[GKI_POLYLINE] = locpr (sgi_polyline) + dd[GKI_POLYMARKER] = locpr (sgi_polymarker) + dd[GKI_TEXT] = locpr (sgi_text) + dd[GKI_FILLAREA] = locpr (sgi_fillarea) + dd[GKI_PUTCELLARRAY] = locpr (sgi_putcellarray) + dd[GKI_SETCURSOR] = 0 + dd[GKI_PLSET] = locpr (sgi_plset) + dd[GKI_PMSET] = locpr (sgi_pmset) + dd[GKI_TXSET] = locpr (sgi_txset) + dd[GKI_FASET] = locpr (sgi_faset) + dd[GKI_GETCURSOR] = 0 + dd[GKI_GETCELLARRAY] = 0 + dd[GKI_ESCAPE] = locpr (sgi_escape) + dd[GKI_SETWCS] = 0 + dd[GKI_GETWCS] = 0 + dd[GKI_UNKNOWN] = 0 + + # If a device was named open the workstation as well. This is + # necessary to permit processing of metacode files which do not + # contain the open workstation instruction. + + len_devname = strlen (devname) + if (len_devname > 0) { + call achtcs (devname, Mems[devns], len_devname) + call sgi_openws (Mems[devns], len_devname, NEW_FILE) + } + + call sfree (sp) +end diff --git a/sys/gio/sgikern/sgiopenws.x b/sys/gio/sgikern/sgiopenws.x new file mode 100644 index 00000000..a2a5a7eb --- /dev/null +++ b/sys/gio/sgikern/sgiopenws.x @@ -0,0 +1,98 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> +include <gki.h> +include <error.h> +include "sgi.h" + +# SGI_OPENWS -- Open the named workstation. Once a workstation has been +# opened we leave it open until some other workstation is opened or the +# kernel is closed. Opening a workstation involves initialization of the +# kernel data structures, following by initialization of the device itself. + +procedure sgi_openws (devname, n, mode) + +short devname[ARB] # device name +int n # length of device name +int mode # access mode + +pointer sp, buf +pointer ttygdes() +bool streq() +int sgk_open() +bool need_open, same_dev +include "sgi.com" + +begin + call smark (sp) + call salloc (buf, max (SZ_FNAME, n), TY_CHAR) + + # If a device was named when the kernel was opened then output will + # always go to that device (g_device) regardless of the device named + # in the OPENWS instruction. If no device was named (null string) + # then unpack the device name, passed as a short integer array. + + if (g_device[1] == EOS) { + call achtsc (devname, Memc[buf], n) + Memc[buf+n] = EOS + } else + call strcpy (g_device, Memc[buf], SZ_FNAME) + + # Find out if first time, and if not, if same device as before + # note that if (g_kt == NULL), then same_dev is false. + + same_dev = false + need_open = true + + if (g_kt != NULL) { + same_dev = (streq (Memc[SGI_DEVNAME(g_kt)], Memc[buf])) + if (!same_dev) { + # Does this device require a frame advance at end of metafile? + if (SGI_ENDFRAME(g_kt) == YES) + call sgk_frame (g_out) + call sgk_close (g_out) + } else + need_open = false + } + + # Initialize the kernel data structures. Open graphcap descriptor + # for the named device, allocate and initialize descriptor and common. + # graphcap entry for device must exist. + + if (need_open) { + if (!same_dev) { + if (g_kt != NULL) + call ttycdes (g_tty) + iferr (g_tty = ttygdes (Memc[buf])) + call erract (EA_ERROR) + + # Initialize data structures if we had to open a new device. + call sgi_init (g_tty, Memc[buf]) + call sgi_reset() + } + + # Open the output file. Metacode output to the device will be + # spooled and then disposed of to the device at CLOSEWS time. + + iferr (g_out = sgk_open (Memc[SGI_DEVNAME(g_kt)], g_tty)) { + call ttycdes (g_tty) + call erract (EA_ERROR) + } else { + # Does this device require a frame advance at start of metafile? + if (SGI_STARTFRAME(g_kt) == YES) + call sgk_frame (g_out) + g_nframes = 0 + g_ndraw = 0 + } + } + + # Clear the screen if device is being opened in new_file mode. + # This is a nop if we really opened a new device, but it will clear + # the screen if this is just a reopen of the same device in new file + # mode. + + if (mode == NEW_FILE) + call sgi_clear (0) + + call sfree (sp) +end diff --git a/sys/gio/sgikern/sgipcell.x b/sys/gio/sgikern/sgipcell.x new file mode 100644 index 00000000..b39e6377 --- /dev/null +++ b/sys/gio/sgikern/sgipcell.x @@ -0,0 +1,195 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include "sgi.h" + +define DEF_YRES 2048 # default height of device pixel in GKI units +define ZSTEP 4 # bit to be tested (step function width) + + +# SGI_PUTCELLARRAY -- Draw a cell array, i.e., two dimensional array of pixels +# (greylevels or colors). The algorithm used here maps 8 bits in into 1 bit +# out, using a step function lookup table. The result is a band-contoured +# image, where the spacing and width of the contour bands decreases as the +# rate of change of intensity in the input cell array increases. + +procedure sgi_putcellarray (m, nx, ny, ax1,ay1, ax2,ay2) + +short m[nx,ny] # cell array +int nx, ny # number of pixels in X and Y +int ax1, ay1 # lower left corner of output window +int ax2, ay2 # upper right corner of output window + +bool ttygetb() +include "sgi.com" + +begin + if (ttygetb (g_tty, "BI")) + call sgi_bcell (m, nx, ny, ax1,ay1, ax2,ay2) + else + call sgi_mcell (m, nx, ny, ax1,ay1, ax2,ay2) +end + + +# SGI_BCELL -- Put cell array, optimized for a bitmap device. In this case, +# to get the maximum resolution at maximum efficiency it is desirable for the +# main loop to be over device pixels, mapping the device pixel into the +# nearest line of the input cell array. + +procedure sgi_bcell (m, nx, ny, ax1,ay1, ax2,ay2) + +short m[nx,ny] # cell array +int nx, ny # number of pixels in X and Y +int ax1, ay1 # lower left corner of output window +int ax2, ay2 # upper right corner of output window + +real dx, dy +int my, i1, i2, v, i, j, k +include "sgi.com" +int and() + +begin + # Count drawing instruction, set polyline width to 1 for max y-res. + g_ndraw = g_ndraw + 1 + call sgk_linewidth (g_out, 1) + SGI_WIDTH(g_kt) = 0 + + # Determine the width of a cell array pixel in GKI units. + dx = real (ax2 - ax1) / nx + + # Determine the height of a device pixel in GKI units. + if (SGI_YRES(g_kt) <= 0) + dy = GKI_MAXNDC / DEF_YRES + else + dy = max (1.0, real(GKI_MAXNDC) / real(SGI_YRES(g_kt))) + + # Process the cell array. The outer loop runs over device pixels in Y; + # each iteration writes one line of the output raster. The inner loop + # runs down a line of the cell array. + + k = 0 + for (my = ay1 + dy/2; my < ay2; my = k * dy + ay1) { + j = max(1, min(ny, int (real(my-ay1) / real(ay2-ay1) * (ny-1)) + 1)) + my = min (my, int (ay2 - dy/2)) + + for (i=1; i <= nx; ) { + do i = i, nx { + v = m[i,j] + if (and (v, ZSTEP) != 0) + break + } + + if (i <= nx) { + i1 = i + i2 = nx + do i = i1 + 1, nx { + v = m[i,j] + if (and (v, ZSTEP) == 0) { + i2 = i + break + } + } + + # The following decreases the length of dark line segments + # to make features more visible. + + if (i2 - i1 >= 2) + if (i1 > 1 && i2 < nx) { + i1 = i1 + 1 + i2 = i2 - 1 + } + + # Draw the line segment. + call sgk_move (g_out, int ((i1-1) * dx + ax1), my) + call sgk_draw (g_out, int (i2 * dx + ax1), my) + + if (i2 >= nx) + i = nx + 1 + } + } + + k = k + 1 + } +end + + +# SGI_MCELL -- Put cell array, optimized for a metafile device. In this case, +# it is prohibitively expensive to draw into each resolvable line of the +# output device. It is better to set the linewidth to the width of a cell +# array pixel, output the minimum number of drawing instructions, and let the +# metafile device widen the lines. + +procedure sgi_mcell (m, nx, ny, ax1,ay1, ax2,ay2) + +short m[nx,ny] # cell array +int nx, ny # number of pixels in X and Y +int ax1, ay1 # lower left corner of output window +int ax2, ay2 # upper right corner of output window + +real dx, dy +int yres, my, i1, i2, v, i, j +include "sgi.com" +int and() + +begin + # Count drawing instruction, clobber saved polyline width. + g_ndraw = g_ndraw + 1 + SGI_WIDTH(g_kt) = 0 + + # Determine the width and height of a cell array pixel in GKI units. + dx = real (ax2 - ax1) / nx + dy = real (ay2 - ay1) / ny + + # Set the SGK line width to the height of a pixel in the cell array. + yres = SGI_YRES(g_kt) + if (yres <= 0) + yres = DEF_YRES + call sgk_linewidth (g_out, + max (1, nint (dy / (real(GKI_MAXNDC) / real(yres))))) + + # Process the cell array. The outer loop runs over lines of the input + # cell array; each iteration writes only one line of the output raster, + # but the width of the line is adjusted to the height of a pixel in + # the cell array (the resolution of the cell array should not exceed + # that of the device). + + for (j=1; j <= ny; j=j+1) { + my = int ((j - 0.5) * dy) + ay1 + + for (i=1; i <= nx; ) { + do i = i, nx { + v = m[i,j] + if (and (v, ZSTEP) != 0) + break + } + + if (i <= nx) { + i1 = i + i2 = nx + do i = i + 1, nx { + v = m[i,j] + if (and (v, ZSTEP) == 0) { + i2 = i + break + } + } + + # The following decreases the length of dark line segments + # to make features more visible. + + if (i2 - i1 >= 2) + if (i1 > 1 && i2 < nx) { + i1 = i1 + 1 + i2 = i2 - 1 + } + + # Draw the line segment. + call sgk_move (g_out, int ((i1-1) * dx + ax1), my) + call sgk_draw (g_out, int (i2 * dx + ax1), my) + + if (i2 >= nx) + i = nx + 1 + } + } + } +end diff --git a/sys/gio/sgikern/sgipl.x b/sys/gio/sgikern/sgipl.x new file mode 100644 index 00000000..e3eea44f --- /dev/null +++ b/sys/gio/sgikern/sgipl.x @@ -0,0 +1,183 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include <gset.h> +include "sgi.h" + +define MAX_LTYPES 3 # max software line type patterns (excl. solid) +define MAX_LSEGMENTS 4 # max line segments per pattern +define LT_OFFSET 1 # offset to be subtracted from ltype code + + +# SGI_POLYLINE -- Draw a polyline. The polyline is defined by the array of +# points P, consisting of successive (x,y) coordinate pairs. The first point +# is not plotted but rather defines the start of the polyline. The remaining +# points define line segments to be drawn. + +procedure sgi_polyline (p, npts) + +short p[ARB] # points defining line +int npts # number of points, i.e., (x,y) pairs + +pointer pl +int x, y +int len_p, i +include "sgi.com" + +begin + if (npts < 2) + return + + len_p = npts * 2 + + # Keep track of the number of drawing instructions since the last frame + # clear. + g_ndraw = g_ndraw + 1 + + # Update polyline attributes if necessary. + pl = SGI_PLAP(g_kt) + + if (SGI_WIDTH(g_kt) != PL_WIDTH(pl)) { + call sgk_linewidth (g_out, nint (GKI_UNPACKREAL(PL_WIDTH(pl)))) + SGI_WIDTH(g_kt) = PL_WIDTH(pl) + } + if (SGI_COLOR(g_kt) != PL_COLOR(pl)) { + call sgi_color (PL_COLOR(pl)) + SGI_COLOR(g_kt) = PL_COLOR(pl) + } + + if (PL_LTYPE(pl) == GL_CLEAR) { + # Ignore clear (erase) polylines. + ; + + } else if (PL_LTYPE(pl) != GL_SOLID) { + # Draw a dashed or dotted polyline of the indicated type. + call sgi_dashline (g_out, p, npts, PL_LTYPE(pl)) + + } else { + # Draw a solid polyline (usual case, optimized). + + # Move to the first point. + x = p[1] + y = p[2] + call sgk_move (g_out, x, y) + + # Draw the polyline. + for (i=3; i <= len_p; i=i+2) { + x = p[i] + y = p[i+1] + call sgk_draw (g_out, x, y) + } + } +end + + +# SGI_DASHLINE -- Draw a dashed or dotted polyline using the indicated line +# style. + +procedure sgi_dashline (g_out, p, npts, ltype) + +int g_out # output file +short p[ARB] # the polyline points +int npts # number of points, i.e., (x,y) pairs +int ltype # desired line type + +bool penup +int len_p, i +real vlen, vpos, seglen, dx, dy +int oldx, oldy, newx, newy, penx, peny +int sgi_getseg() + +begin + len_p = npts * 2 + + oldx = p[1]; oldy = p[2] + call sgk_move (g_out, oldx, oldy) + + # Process each line segment in the polyline. + do i = 3, len_p, 2 { + newx = p[i] + newy = p[i+1] + + # Compute VLEN, the length of the polyline line segment to be + # drawn, VPOS, the relative position along the line segment, + # and DX and DY, the scale factors to be applied to VPOS to get + # the x and y coordinates of a point along the line segment. + + dx = newx - oldx + dy = newy - oldy + vlen = sqrt (dx*dx + dy*dy) + if (vlen < 1.0) # GKI units + next + + dx = dx / vlen + dy = dy / vlen + vpos = 0.0 + + # For each line segment, get segments of the line type pattern + # until all of the current line segment has been drawn. The pattern + # wraps around indefinitely, following the polyline around the + # vertices with concern only for the total length traversed. + + while (vlen - vpos >= 1.0) { + seglen = sgi_getseg (int (vlen - vpos), penup, ltype) + if (seglen < 1.0) + break + + vpos = vpos + seglen + penx = oldx + vpos * dx + peny = oldy + vpos * dy + + if (penup) + call sgk_move (g_out, penx, peny) + else + call sgk_draw (g_out, penx, peny) + } + + oldx = newx + oldy = newy + } +end + + +# SGI_GETSEG -- Get a segment of a line style pattern. The segment extends +# from the current position in the pattern to either the next penup/pendown +# breakpoint in the pattern, or to the point MAXLEN units further along in +# the pattern. When the end of the pattern is reached wrap around and +# duplicate the pattern indefinitely. + +int procedure sgi_getseg (maxlen, penup, ltype) + +int maxlen # max length segment to be returned +bool penup # [out] pen up or pen down type segment? +int ltype # line type code + +int seglen, seg, lt +int p_seg[MAX_LTYPES] +int p_nseg[MAX_LTYPES] +int p_segleft[MAX_LTYPES] +bool p_penup[MAX_LTYPES,MAX_LSEGMENTS] +int p_seglen[MAX_LTYPES,MAX_LSEGMENTS] +include "ltype.dat" + +begin + lt = max (1, min (MAX_LTYPES, ltype - LT_OFFSET)) + seg = p_seg[lt] + penup = p_penup[lt,seg] + + repeat { + if (maxlen < p_segleft[lt]) { + seglen = maxlen + p_segleft[lt] = p_segleft[lt] - seglen + } else { + seglen = p_segleft[lt] + seg = seg + 1 + if (seg > p_nseg[lt]) + seg = 1 + p_seg[lt] = seg + p_segleft[lt] = p_seglen[lt,seg] + } + } until (seglen > 0) + + return (seglen) +end diff --git a/sys/gio/sgikern/sgiplset.x b/sys/gio/sgikern/sgiplset.x new file mode 100644 index 00000000..30038437 --- /dev/null +++ b/sys/gio/sgikern/sgiplset.x @@ -0,0 +1,20 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include "sgi.h" + +# SGI_PLSET -- Set the polyline attributes. The polyline width parameter is +# passed to the encoder as a packed floating point number, i.e., int(LWx100). + +procedure sgi_plset (gki) + +short gki[ARB] # attribute structure +pointer pl +include "sgi.com" + +begin + pl = SGI_PLAP(g_kt) + PL_LTYPE(pl) = gki[GKI_PLSET_LT] + PL_WIDTH(pl) = gki[GKI_PLSET_LW] + PL_COLOR(pl) = gki[GKI_PLSET_CI] +end diff --git a/sys/gio/sgikern/sgipm.x b/sys/gio/sgikern/sgipm.x new file mode 100644 index 00000000..e53f3f03 --- /dev/null +++ b/sys/gio/sgikern/sgipm.x @@ -0,0 +1,56 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include "sgi.h" + +# SGI_POLYMARKER -- Draw a polymarker. The polymarker is defined by the array +# of points P, consisting of successive (x,y) coordinate pairs. + +procedure sgi_polymarker (p, npts) + +short p[ARB] # points defining line +int npts # number of points, i.e., (x,y) pairs + +pointer pm +int i, len_p +int x, y, oldx, oldy +include "sgi.com" + +begin + if (npts <= 0) + return + + len_p = npts * 2 + + # Keep track of the number of drawing instructions since the last frame + # clear. + g_ndraw = g_ndraw + 1 + + # Update polymarker attributes if necessary. + + pm = SGI_PMAP(g_kt) + + if (SGI_TYPE(g_kt) != PM_LTYPE(pm)) { + call sgi_linetype (PM_LTYPE(pm)) + SGI_TYPE(g_kt) = PM_LTYPE(pm) + } + if (SGI_WIDTH(g_kt) != PM_WIDTH(pm)) { + call sgk_linewidth (g_out, nint (GKI_UNPACKREAL(PM_WIDTH(pm)))) + SGI_WIDTH(g_kt) = PM_WIDTH(pm) + } + if (SGI_COLOR(g_kt) != PM_COLOR(pm)) { + call sgi_color (PM_COLOR(pm)) + SGI_COLOR(g_kt) = PM_COLOR(pm) + } + + # Draw the polymarker. + oldx = 0; oldy = 0 + for (i=1; i <= len_p; i=i+2) { + x = p[i]; y = p[i+1] + if (x != oldx || y != oldy) { + call sgk_move (g_out, x, y) + call sgk_draw (g_out, x, y) + } + oldx = x; oldy = y + } +end diff --git a/sys/gio/sgikern/sgipmset.x b/sys/gio/sgikern/sgipmset.x new file mode 100644 index 00000000..0d72392f --- /dev/null +++ b/sys/gio/sgikern/sgipmset.x @@ -0,0 +1,19 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include "sgi.h" + +# SGI_PMSET -- Set the polymarker attributes. + +procedure sgi_pmset (gki) + +short gki[ARB] # attribute structure +pointer pm +include "sgi.com" + +begin + pm = SGI_PMAP(g_kt) + PM_LTYPE(pm) = gki[GKI_PMSET_MT] + PM_WIDTH(pm) = gki[GKI_PMSET_MW] + PM_COLOR(pm) = gki[GKI_PMSET_CI] +end diff --git a/sys/gio/sgikern/sgireset.x b/sys/gio/sgikern/sgireset.x new file mode 100644 index 00000000..a97034eb --- /dev/null +++ b/sys/gio/sgikern/sgireset.x @@ -0,0 +1,50 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gki.h> +include <gset.h> +include "sgi.h" + +# SGI_RESET -- Reset the state of the transform common, i.e., in response to +# a clear or a cancel. Initialize all attribute packets to their default +# values and set the current state of the device to undefined, forcing the +# device state to be reset when the next output instruction is executed. + +procedure sgi_reset() + +pointer pl, pm, fa, tx +include "sgi.com" + +begin + # Set pointers to attribute substructures. + pl = SGI_PLAP(g_kt) + pm = SGI_PMAP(g_kt) + fa = SGI_FAAP(g_kt) + tx = SGI_TXAP(g_kt) + + # Initialize the attribute packets. + PL_LTYPE(pl) = 1 + PL_WIDTH(pl) = GKI_PACKREAL(1.) + PL_COLOR(pl) = 1 + PM_LTYPE(pm) = 1 + PM_WIDTH(pm) = GKI_PACKREAL(1.) + PM_COLOR(pm) = 1 + FA_STYLE(fa) = 1 + FA_COLOR(fa) = 1 + TX_UP(tx) = 90 + TX_SIZE(tx) = GKI_PACKREAL(1.) + TX_PATH(tx) = GT_RIGHT + TX_HJUSTIFY(tx) = GT_LEFT + TX_VJUSTIFY(tx) = GT_BOTTOM + TX_FONT(tx) = GT_ROMAN + TX_COLOR(tx) = 1 + TX_SPACING(tx) = 0.0 + + # Set the device attributes to undefined, forcing them to be reset + # when the next output instruction is executed. + + SGI_TYPE(g_kt) = -1 + SGI_WIDTH(g_kt) = -1 + SGI_COLOR(g_kt) = -1 + SGI_TXSIZE(g_kt) = -1 + SGI_TXFONT(g_kt) = -1 +end diff --git a/sys/gio/sgikern/sgitx.x b/sys/gio/sgikern/sgitx.x new file mode 100644 index 00000000..d0db5c58 --- /dev/null +++ b/sys/gio/sgikern/sgitx.x @@ -0,0 +1,459 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <math.h> +include <gset.h> +include <gki.h> +include "sgi.h" +include "font.h" + +define BASECS_X 12 # Base (size 1.0) char width in GKI coords. +define BASECS_Y 12 # Base (size 1.0) char height in GKI coords. + + +# SGI_TEXT -- Draw a text string. The string is drawn at the position (X,Y) +# using the text attributes set by the last GKI_TXSET instruction. The text +# string to be drawn may contain embedded set font escape sequences of the +# form \fR (roman), \fG (greek), etc. We break the input text sequence up +# into segments at font boundaries and draw these on the output device, +# setting the text size, color, font, and position at the beginning of each +# segment. + +procedure sgi_text (xc, yc, text, n) + +int xc, yc # where to draw text string +short text[ARB] # text string +int n # number of characters + +real x, y, dx, dy, tsz, offset, cosv, sinv +int x1, x2, y1, y2, orien +int x0, y0, gki_dx, gki_dy, ch, cw +int xstart, ystart, newx, newy +int totlen, polytext, font, seglen, totwidth +pointer sp, seg, ip, op, tx, first +int stx_segment(), sgi_drawchar() +include "sgi.com" + +real g_dx, g_dy # scale GKI to window coords +int g_x1, g_y1 # origin of device window +int g_x2, g_y2 # upper right corner of device window +data g_dx /1.0/, g_dy /1.0/ +data g_x1 /0/, g_y1 /0/, g_x2 /GKI_MAXNDC/, g_y2 / GKI_MAXNDC/ + +begin + call smark (sp) + call salloc (seg, n + 2, TY_CHAR) + + # Keep track of the number of drawing instructions since the last frame + # clear. + g_ndraw = g_ndraw + 1 + + # Set pointer to the text attribute structure. + tx = SGI_TXAP(g_kt) + + # Set the text size and color if not already set. Both should be + # invalidated when the screen is cleared. Text color should be + # invalidated whenever another color is set. The text size was + # set by sgi_txset, and is just a scaling factor. + + SGI_TXSIZE(g_kt) = TX_SIZE(tx) + if (TX_COLOR(tx) != SGI_COLOR(g_kt)) { + call sgi_color (TX_COLOR(tx)) + SGI_COLOR(g_kt) = TX_COLOR(tx) + } + + # Set the linetype to a solid line. + if (SGI_TYPE(g_kt) != GL_SOLID) { + call sgi_linetype (GL_SOLID) + SGI_TYPE(g_kt) = GL_SOLID + } + + # No discreet character sizes, so just scale the base sizes. + tsz = GKI_UNPACKREAL(TX_SIZE(tx)) # scale factor + ch = SGI_CHARHEIGHT(g_kt,1) * tsz + cw = SGI_CHARWIDTH(g_kt,1) * tsz + + # Break the text string into segments at font boundaries and count + # the total number of printable characters. + + totlen = stx_segment (text, n, Memc[seg], TX_FONT(tx), cw, totwidth) + + # Compute the text drawing parameters, i.e., the coordinates of the + # first character to be drawn, the step between successive characters, + # and the polytext flag (GKI coords). + + call stx_parameters (xc,yc, totlen, totwidth, x0,y0, gki_dx,gki_dy, + polytext, orien) + + # Draw the segments, setting the font at the beginning of each segment. + # The first segment is drawn at (X0,Y0). The separation between + # characters is DX,DY. A segment is drawn as a block if the polytext + # flag is set, otherwise each character is drawn individually. + + x = x0 * g_dx + g_x1 + y = y0 * g_dy + g_y1 + dx = gki_dx * g_dx + dy = gki_dy * g_dy + cosv = cos (-DEGTORAD(orien)) + sinv = sin (-DEGTORAD(orien)) + + for (ip=seg; Memc[ip] != EOS; ip=ip+1) { + # Process the font control character heading the next segment. + font = Memc[ip] + ip = ip + 1 + + # Draw the segment. + while (Memc[ip] != EOS) { + # Clip leading out of bounds characters. + for (; Memc[ip] != EOS; ip=ip+1) { + x1 = x; x2 = x1 + cw + y1 = y; y2 = y1 + ch + + if (x1 >= g_x1 && x2 <= g_x2 && y1 >= g_y1 && y2 <= g_y2) + break + else { + x = x + dx + y = y + dy + } + + if (polytext == NO) { + ip = ip + 1 + break + } + } + + # Coords of first char to be drawn. + xstart = x + ystart = y + + # Move OP to first out of bounds char. + for (op=ip; Memc[op] != EOS; op=op+1) { + x1 = x; x2 = x1 + cw + y1 = y; y2 = y1 + ch + + if (x1 <= g_x1 || x2 >= g_x2 || y1 <= g_y1 || y2 >= g_y2) + break + else { + x = x + dx + y = y + dy + } + + if (polytext == NO) { + op = op + 1 + break + } + } + + # Count number of inbounds chars. + seglen = op - ip + + # Leave OP pointing to the end of this segment. + if (polytext == NO) + op = ip + 1 + else { + while (Memc[op] != EOS) + op = op + 1 + } + + # Compute X,Y of next segment. + newx = xstart + (dx * (op - ip)) + newy = ystart + dy + + # Quit if no inbounds chars. + if (seglen == 0) { + x = newx + y = newy + ip = op + next + } + + # Output the inbounds chars. + + first = ip + x = xstart + y = ystart + + while (seglen > 0 && (polytext == YES || ip == first)) { + offset = sgi_drawchar (Memc[ip], nint(x), nint(y), cw, ch, + orien, font) + ip = ip + 1 + seglen = seglen - 1 + x = x + (offset * cosv) + y = y - (offset * sinv) + } + + x = newx + y = newy + ip = op + } + } + + call sfree (sp) +end + + +# STX_SEGMENT -- Process the text string into segments, in the process +# converting from type short to char. The only text attribute that can +# change within a string is the font, so segments are broken by \fI, \fG, +# etc. font select sequences embedded in the text. The segments are encoded +# sequentially in the output string. The first character of each segment is +# the font number. A segment is delimited by EOS. A font number of EOS +# marks the end of the segment list. The output string is assumed to be +# large enough to hold the segmented text string. + +int procedure stx_segment (text, n, out, start_font, cw, totwidth) + +short text[ARB] # input text +int n # number of characters in text +char out[ARB] # output string +int start_font # initial font code +int cw # default character width +int totwidth # seg width in GKI units + +int i +int ip, op +int totlen, font + +include "font.com" +include "greek.com" + +begin + out[1] = start_font + font = start_font + totlen = 0 + totwidth = 0 + op = 2 + + for (ip=1; ip <= n; ip=ip+1) { + if (text[ip] == '\\' && text[ip+1] == 'f') { + # Select font. + out[op] = EOS + op = op + 1 + ip = ip + 2 + + switch (text[ip]) { + case 'B': + font = GT_BOLD + case 'I': + font = GT_ITALIC + case 'G': + font = GT_GREEK + default: + font = GT_ROMAN + } + + out[op] = font + op = op + 1 + + } else { + # Deposit character in segment. + if (text[ip] < CHARACTER_START || text[ip] > CHARACTER_END) + i = '?' - CHARACTER_START + 1 + else + i = text[ip] - CHARACTER_START + 1 + + if (font == GT_GREEK) { + totwidth = totwidth + + int(real(gchwid[i]) / real(FONT_WIDTH) * cw) + } else { + totwidth = totwidth + + int(real(chrwid[i]) / real(FONT_WIDTH) * cw) + } + + out[op] = text[ip] + op = op + 1 + totlen = totlen + 1 + } + } + + # Terminate last segment and add null segment. + out[op] = EOS + out[op+1] = EOS + + return (totlen) +end + + +# STX_PARAMETERS -- Set the text drawing parameters, i.e., the coordinates +# of the lower left corner of the first character to be drawn, the spacing +# between characters, and the polytext flag. Input consists of the coords +# of the text string, the length of the string, and the text attributes +# defining the character size, justification in X and Y of the coordinates, +# and orientation of the string. All coordinates are in GKI units. + +procedure stx_parameters (xc, yc, totlen, totwidth, x0, y0, dx, dy, polytext, + orien) + +int xc, yc # coordinates at which string is to be drawn +int totlen # number of characters to be drawn +int totwidth # width of characters to be drawn +int x0, y0 # lower left corner of first char to be drawn +int dx, dy # step in X and Y between characters +int polytext # OK to output text segment all at once +int orien # rotation angle of characters + +pointer tx +int up, path +real dir, sz, ch, cw, cosv, sinv, space +real xsize, ysize, xvlen, yvlen, xu, yu, xv, yv, p, q +include "sgi.com" + +begin + tx = SGI_TXAP(g_kt) + + # Get character sizes in GKI coords. + sz = GKI_UNPACKREAL (TX_SIZE(tx)) + ch = SGI_CHARHEIGHT(g_kt,1) * sz + cw = SGI_CHARWIDTH(g_kt,1) * sz + + # Compute the character rotation angle. This is independent of the + # direction in which characters are drawn. A character up vector of + # 90 degrees (normal) corresponds to a rotation angle of zero. + + up = TX_UP(tx) + orien = up - 90 + + # Determine the direction in which characters are to be plotted. + # This depends on both the character up vector and the path, which + # is defined relative to the up vector. + + path = TX_PATH(tx) + switch (path) { + case GT_UP: + dir = up + case GT_DOWN: + dir = up - 180 + case GT_LEFT: + dir = up + 90 + default: # GT_NORMAL, GT_RIGHT + dir = up - 90 + } + + # ------- DX, DY --------- + # Convert the direction vector into the step size between characters. + # Note CW and CH are in GKI coordinates, hence DX and DY are too. + # Additional spacing of some fraction of the character size is used + # if TX_SPACING is nonzero. + + dir = -DEGTORAD(dir) + cosv = cos (dir) + sinv = sin (dir) + + # Correct for spacing (unrotated). + space = (1.0 + TX_SPACING(tx)) + if (path == GT_UP || path == GT_DOWN) + p = ch * space + else + p = cw * space + q = 0 + + # Correct for rotation. + dx = p * cosv + q * sinv + dy = -p * sinv + q * cosv + + # ------- XU, YU --------- + # Determine the coordinates of the center of the first character req'd + # to justify the string, assuming dimensionless characters spaced on + # centers DX,DY apart. + + #xvlen = dx * (totlen - 1) + if (dx > 0) + xvlen = totwidth - dx + else + xvlen = 0 + yvlen = dy * (totlen - 1) + + switch (TX_HJUSTIFY(tx)) { + case GT_CENTER: + xu = - (xvlen / 2.0) + case GT_RIGHT: + # If right justify and drawing to the left, no offset req'd. + if (xvlen < 0) + xu = 0 + else + xu = -xvlen + default: # GT_LEFT, GT_NORMAL + # If left justify and drawing to the left, full offset right req'd. + if (xvlen < 0) + xu = -xvlen + else + xu = 0 + } + + switch (TX_VJUSTIFY(tx)) { + case GT_CENTER: + yu = - (yvlen / 2.0) + case GT_TOP: + # If top justify and drawing downward, no offset req'd. + if (yvlen < 0) + yu = 0 + else + yu = -yvlen + default: # GT_BOTTOM, GT_NORMAL + # If bottom justify and drawing downward, full offset up req'd. + if (yvlen < 0) + yu = -yvlen + else + yu = 0 + } + + # ------- XV, YV --------- + # Compute the offset from the center of a single character required + # to justify that character, given a particular character up vector. + # (This could be combined with the above case but is clearer if + # treated separately.) + + p = -DEGTORAD(orien) + cosv = cos(p) + sinv = sin(p) + + # Compute the rotated character in size X and Y. + xsize = abs ( cw * cosv + ch * sinv) + ysize = abs (-cw * sinv + ch * cosv) + + switch (TX_HJUSTIFY(tx)) { + case GT_CENTER: + xv = 0 + case GT_RIGHT: + xv = - (xsize / 2.0) + default: # GT_LEFT, GT_NORMAL + xv = xsize / 2 + } + + switch (TX_VJUSTIFY(tx)) { + case GT_CENTER: + yv = 0 + case GT_TOP: + yv = - (ysize / 2.0) + default: # GT_BOTTOM, GT_NORMAL + yv = ysize / 2 + } + + # ------- X0, Y0 --------- + # The center coordinates of the first character to be drawn are given + # by the reference position plus the string justification vector plus + # the character justification vector. + + x0 = xc + xu + xv + y0 = yc + yu + yv + + # The character drawing primitive requires the coordinates of the + # lower left corner of the character (irrespective of orientation). + # Compute the vector from the center of a character to the lower left + # corner of a character, rotate to the given orientation, and correct + # the starting coordinates by addition of this vector. + + p = - (cw / 2.0) + q = - (ch / 2.0) + + x0 = x0 + ( p * cosv + q * sinv) + y0 = y0 + (-p * sinv + q * cosv) + + # ------- POLYTEXT --------- + # Set the polytext flag. Polytext output is possible only if chars + # are to be drawn to the right with no extra spacing between chars. + + if (abs(dy) == 0 && dx == cw) + polytext = YES + else + polytext = NO +end diff --git a/sys/gio/sgikern/sgitxset.x b/sys/gio/sgikern/sgitxset.x new file mode 100644 index 00000000..c064d556 --- /dev/null +++ b/sys/gio/sgikern/sgitxset.x @@ -0,0 +1,29 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <gset.h> +include <gki.h> +include "sgi.h" + +# SGI_TXSET -- Set the text drawing attributes. + +procedure sgi_txset (gki) + +short gki[ARB] # attribute structure + +pointer tx +include "sgi.com" + +begin + tx = SGI_TXAP(g_kt) + + TX_UP(tx) = gki[GKI_TXSET_UP] + TX_PATH(tx) = gki[GKI_TXSET_P ] + TX_HJUSTIFY(tx) = gki[GKI_TXSET_HJ] + TX_VJUSTIFY(tx) = gki[GKI_TXSET_VJ] + TX_FONT(tx) = gki[GKI_TXSET_F ] + TX_QUALITY(tx) = gki[GKI_TXSET_Q ] + TX_COLOR(tx) = gki[GKI_TXSET_CI] + + TX_SPACING(tx) = GKI_UNPACKREAL (gki[GKI_TXSET_SP]) + TX_SIZE(tx) = gki[GKI_TXSET_SZ] +end diff --git a/sys/gio/sgikern/sgk.com b/sys/gio/sgikern/sgk.com new file mode 100644 index 00000000..a919e147 --- /dev/null +++ b/sys/gio/sgikern/sgk.com @@ -0,0 +1,49 @@ +# SGK.COM -- The common for the SGK kernel. A common is used here for maximum +# efficiency (minimum indirection) when rasterizing vectors and encoding +# metacode. The maximum bitmap size is set at compile time in sgk.h. + +# Booleans put here to avoid possible alignment problems. + +bool mf_bitmap # metafile type, metacode or bitmap +bool mf_rotate # rotate (swap x and y) +bool mf_yflip # flip y axis end for end +bool mf_update # update bitmap +bool mf_delete # delete metacode file after dispose +bool mf_debug # print kernel debugging messages +bool mf_swap2 # swap every 2 bytes on output +bool mf_swap4 # swap every 4 bytes on output +bool mf_oneperfile # store each frame in a new file + +common /sgkboo/ mf_bitmap, mf_rotate, mf_yflip, mf_update, mf_delete, mf_debug, + mf_swap2, mf_swap4, mf_oneperfile + +# Everything else goes here. + +int mf_fd # file descriptor of output file +int mf_frame # frame counter +char mf_fname[SZ_PATHNAME] # metafile filename +char mf_dispose[SZ_OSCMD] # host dispose command + +int mf_op # [MCODE] index into obuf +short mf_obuf[LEN_OBUF] # metacode buffer + +int mf_cx, mf_cy # [BITMAPS] current pen position +int mf_nbpb # packing factor, bits per byte +int mf_pxsize, mf_pysize # physical x, y size of bitmap, bits +int mf_wxsize, mf_wysize # x, y size of bitmap window, bits +int mf_xorigin, mf_yorigin # origin of bitmap window +real mf_xscale, mf_yscale # to convert from NDC to device coords +int mf_xmin, mf_xmax # x clipping limits +int mf_ymin, mf_ymax # y clipping limits +int mf_lenframe # frame size, words +int mf_linewidth # relative line width +int mf_lworigin # device width of line size 1.0 +real mf_lwslope # device pixels per line size increment +int mf_fbuf[LEN_FBUF] # frame buffer (BIG) +int mf_bitmask[BPW] # bit mask table + +common /sgkcom/ mf_fd, mf_frame, mf_op, mf_cx, mf_cy, mf_nbpb, mf_pxsize, + mf_pysize, mf_wxsize, mf_wysize, mf_xorigin, mf_yorigin, mf_xscale, + mf_yscale, mf_xmin, mf_xmax, mf_ymin, mf_ymax, mf_lenframe, + mf_linewidth, mf_lworigin, mf_lwslope, mf_fbuf, mf_bitmask, mf_obuf, + mf_fname, mf_dispose diff --git a/sys/gio/sgikern/sgk.h b/sys/gio/sgikern/sgk.h new file mode 100644 index 00000000..09c62d95 --- /dev/null +++ b/sys/gio/sgikern/sgk.h @@ -0,0 +1,7 @@ +# SGK.H -- SGK metacode definitions. + +define SGK_LENMCI 3 # SGK instruction length +define SGK_FRAME 1 # new frame instruction +define SGK_MOVE 2 # move pen +define SGK_DRAW 3 # draw pen +define SGK_SETLW 4 # set line width diff --git a/sys/gio/sgikern/sgk.x b/sys/gio/sgikern/sgk.x new file mode 100644 index 00000000..3ed77f76 --- /dev/null +++ b/sys/gio/sgikern/sgk.x @@ -0,0 +1,853 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> +include <chars.h> +include <gki.h> +include "sgk.h" + +.help sgk +.nf --------------------------------------------------------------------------- +SGK -- Simple graphics device interface. The purpose of this interface is +to provide a simple means for interfacing new plotter devices to IRAF/GIO. +The interface works by writing a binary metacode file and then disposing of +it by issuing a command to the host system. + + g_out = sgk_open (device, tty) # device open + sgk_close (g_out) # device close + sgk_flush (g_out) # flush output + + sgk_frame (g_out) # start a new frame + sgk_move (g_out, x, y) # move to (x,y) + sgk_draw (g_out, x, y) # draw a vector to (x,y) + sgk_linewidth (g_out, width) # set line width (>=1) + +The procedures comprising the top end of the SGK interface are summarized +above and the code is included in this file. These procedures could be +rewritten by the user to talk directly to a graphics device if desired, +although the metacode file interface is likely to be simpler in most cases. + +The SGK kernel can produce either metacode or bitmap output. Metacode output +is normally preferred for intelligent plotters and for pen plotters. Bitmap +output is normally preferred for raster plotters. The type of output file +to be generated is selected by the graphcap entry for an SGI/SGK device. + +The METACODE FORMAT written by the SGK interface is a sequence of 16 bit integer +words containing binary opcodes and data. The metacode is extremely simple, +consisting of only two drawing instructions (pen up move and pen down draw), +a frame instruction, and an optional set line width instruction. All text is +rendered into vectors by the SGI kernel hence there are no text drawing +instructions. The SGK metacode instruction formats are summarized below. + + opcode / data words + + 1 0 0 # frame instruction + 2 X Y # move to (x,y) + 3 X Y # draw to (x,y) + 4 W 0 # set line width (>= 1, 1=normal, 2=bold) + +All opcodes and data words are 16 bit positive integers encoded in the machine +independent MII format, i.e., most significant byte first. Only 15 bits of +each 16 bit word are actually used. Coordinates are specified in the range 0 +to 32767. All instructions are zero padded to 3 words to simplify metacode +translation programs. + +The BITMAP FORMAT written by the SGK is even simpler than the metacode format. +Output consists of a binary raster file containing one or more bitmaps with no +embedded header information. All bitmaps in a raster file are of the same +size. The size is specified in the graphcap entry for the device and may be +passed to the host dispose task on the foreign task command line if desired. +Page offsets may also be passed on the command line, e.g., to position the +plot on the plotter page. + +The following graphcap fields apply to both metacode and bitmap devices. + + DD host command to dispose of metacode file ($F) + DB have the kernel print debug messages during execution + RM boolean; if present, SGK will delete metacode file + MF multiframe count (max frames per job) + NF store each frame in a new file (rather than all in one file) + RO rotate plot (swap x and y) + YF y-flip plot (flip y axis) (done after rotate) + +The following additional fields are defined for bitmap devices. + + BI boolean; presence indicates a bitmapped or raster device + LO width in device pixels of a line of size 1.0 + LS difference in device pixels between line sizes + PX physical x size (linelen) of bitmap as stored in memory, bits + PY physical y size of bitmap, i.e., number of lines in bitmap + XO,YO origin of plotting window in device pixels + XW,YW width of plotting window in device pixels + NB number of bits to be set in each 8 bit byte output + BF bit-flip each byte in bitmap (easier here than later) + BS byte swap the bitmap when output (swap every two bytes) + WS word swap the bitmap when output (swap every four bytes) + +The multiframe count (MF) limits the number of frames per job, where a job +refers to the dispose command submitted to the host to process the frames. +If the new file flag (NF) is absent, all frames will be stored in the same +physical file (this holds for both metacode and bitmap frames). If the new +file flag (NF) is set, each frame will be stored in a separate file, with +the N files having the names $F.1, $F.2, ... $F.N, where $F is the unique +(root) filename generated from the template given in the DD string. The $F +is replaced by the root filename, rather than by a list of all the filenames, +to keep the OS command to a reasonable length and to permit the use of host +file templates to perform operate upon the full set of files (and to avoid +having to choose between spaces and commas to delimit the filenames). +For example, if MF=8 and NF=yes, then "$F.[1-8]" will match the file set +on a UNIX host. The template "$F.*" is less precise but would also work. + +The output raster will consist of PY lines each of length PX bits. If PX is +chosen to be a multiple of 8, there will be PX/8 bytes per line of the output +raster. Note that the values of PX and PY are arbitrary and should be chosen +to simplify the code of the translator and maximize efficiency. In particular, +PX and PY do not in general define the maximum physical resolution of the +device, although if NB=8 the value of PX will typically approximate the +physical resolution in X. If there are multiple bitmap frames per file, +each frame will occupy an integral number of SPP char units of storage in the +output file, with the values of any extra bits at the end of the bitmap being +undefined (a char is 16 bits on most IRAF host machines). + +The plot will be rasterized in a logical window XW one-bit pixels wide and YW +pixels high. The first YO lines of the output raster will be zero, with the +plotting window beginning at line YO+1. The first XO bits of each output line +will be zeroed, with the plotting window beginning at bit XO+1. The bytes in +each output line may be bit-flipped if desired, and all of the bits in each +output byte need not be used for pixel data. If the bit packing factor NB is +set to 8 the plotting window will map into XW bits of storage of each output +line. If fewer than 8 bits are used in each output byte more than XW physical +bits of storage will be used, e.g., if NB=4, XW*2 bits of storage are required +for a line of the plotting window. The unused bits are set to zero. The +translator can later "or" a mask into the zeroed bits, flip the data bits, +or perform any other bytewise operation using simple lookup table mapping +techniques. +.endhelp ---------------------------------------------------------------------- + +# NOTE -- The mf_physbit lookup table, used to map logical screen bits into +# physical bits in the bitmap (for NB != 8) is equivalenced to the mf_obuf +# array which is not otherwise used for bitmap devices. The length of the +# mf_obuf array must therefore be >= PX. + +define mf_physbit mf_obuf # union these two arrays [[[NOTE]]] +define BPW NBITS_INT # nbits in an integer +define LEN_FBUF (2550*3300/BPW) # max size bitmap / frame buffer +define LEN_OBUF 3300 # nwords in output buffer +define SZ_DDSTR 256 # max size graphcap.DD +define SZ_OSCMD 256 # OS dispose command from graphcap.DD + + +# SGK_OPEN -- Open the metacode file. Parse the DD string from the graphcap +# entry for the device to get the file template and OS dispose command. +# Generate a unique file name and open the metacode file as a NEW_FILE. +# Save the dispose command for later. + +int procedure sgk_open (device, tty) + +char device[ARB] # device name [NOT USED] +pointer tty # pointer to graphcap descriptor + +char cap[2] +int len_nodeprefix, byte, off, op, i, j +pointer sp, raw_ddstr, ddstr, devname, spool, fname, tempfn, val, ip + +bool ttygetb() +real ttygetr() +int open(), ttygets(), ttygeti(), gstrcpy(), shifti() +errchk open, ttygets, ttygeti, ttygetb +include "sgk.com" + +begin + call smark (sp) + call salloc (raw_ddstr, SZ_DDSTR, TY_CHAR) + call salloc (ddstr, SZ_DDSTR, TY_CHAR) + call salloc (devname, SZ_FNAME, TY_CHAR) + call salloc (spool, SZ_FNAME, TY_CHAR) + call salloc (fname, SZ_PATHNAME, TY_CHAR) + call salloc (tempfn, SZ_PATHNAME, TY_CHAR) + call salloc (val, SZ_FNAME, TY_CHAR) + + # The DB flag may be set in the graphcap entry for an SGI device to + # print debug messages during execution. + + mf_debug = ttygetb (tty, "DB") + + # The DD string is used to pass device dependent information to the + # graphics device driver. + + if (ttygets (tty, "DD", Memc[raw_ddstr], SZ_DDSTR) <= 0) + call error (1, "sgikern: missing DD parameter in graphcap") + + # Expand any $(XX) graphcap parameter references in the DD string. + op = ddstr + for (ip=raw_ddstr; Memc[ip] != EOS; ip=ip+1) + if (Memc[ip] == '$' && Memc[ip+1] == '(' && Memc[ip-1] != '\\') { + # Graphcap parameter substitution. + call strcpy (Memc[ip+2], cap, 2) + if (ttygets (tty, cap, Memc[val], SZ_FNAME) <= 0) { + call eprintf ("Warning: graphcap field `%s' not found\n") + call pargstr (cap) + } else { + for (off=val; Memc[off] == '#'; off=off+1) + ; + for (; Memc[off] != EOS; off=off+1) { + Memc[op] = Memc[off] + op = op + 1 + } + } + ip = ip + 4 + + } else { + # Ordinary character. + Memc[op] = Memc[ip] + op = op + 1 + } + Memc[op] = EOS + + # Parse the DD string into the node/device name, temp file name, + # and host dispose command. + + # Get node and device name (e.g., "node!device,..."). + len_nodeprefix = 0 + ip = ddstr + for (op=devname; Memc[ip] != EOS; ip=ip+1) + if (Memc[ip] == ',') { + if (Memc[ip-1] == '\\') { + Memc[op-1] = ',' + ip = ip - 1 + } else { + ip = ip + 1 + break + } + } else { + if (Memc[ip] == FNNODE_CHAR) + len_nodeprefix = op - devname + 1 + Memc[op] = Memc[ip] + op = op + 1 + } + Memc[op] = EOS + + # Get spoolfile root name. + op = spool + gstrcpy (Memc[devname], Memc[spool], len_nodeprefix) + for (; Memc[ip] != EOS; ip=ip+1) + if (Memc[ip] == ',') { + if (Memc[ip-1] == '\\') { + Memc[op-1] = ',' + ip = ip - 1 + } else { + ip = ip + 1 + break + } + } else { + Memc[op] = Memc[ip] + op = op + 1 + } + Memc[op] = EOS + + # Get OS pathname of spoofile. + call mktemp (Memc[spool], Memc[tempfn], SZ_PATHNAME) + call fmapfn (Memc[tempfn], mf_fname, SZ_PATHNAME) + call strupk (mf_fname, mf_fname, SZ_PATHNAME) + + # Get pathname of spoolfile on the remote node. The call to + # ki_fmapfn() is currently necessary to translate the filename for + # the remote node, but may be replaced by the usual fmapfn() in a + # future version of the kernel interface. + + call ki_fmapfn (Memc[tempfn], Memc[fname], SZ_PATHNAME) + call strupk (Memc[fname], Memc[fname], SZ_PATHNAME) + + if (mf_debug) { + call eprintf ("sgk: open device %s, outfile = %s\n") + call pargstr (Memc[devname]) + call pargstr (mf_fname) + } + + # Copy OS command for disposing of metacode file into common, replacing + # all $F sequences in the command by the OS pathname of the spool file. + + op = gstrcpy (Memc[devname], mf_dispose, len_nodeprefix) + 1 + + for (; Memc[ip] != EOS; ip=ip+1) + if (Memc[ip] == '$' && Memc[ip-1] == '\\') { + # Escape a $. + mf_dispose[op-1] = '$' + + } else if (Memc[ip] == '$' && Memc[ip+1] == 'F') { + # Filename substitution. + for (i=fname; Memc[i] != EOS; i=i+1) { + mf_dispose[op] = Memc[i] + op = op + 1 + } + ip = ip + 1 + + } else { + # Ordinary character. + mf_dispose[op] = Memc[ip] + op = op + 1 + } + + mf_dispose[op] = EOS + + # Remove (delete) metacode file after issuing OS dispose command? + mf_delete = ttygetb (tty, "RM") + + # Store each frame in a new file? + mf_oneperfile = ttygetb (tty, "NF") + + mf_update = false + mf_frame = 1 + + # Open a new metacode file. + if (mf_oneperfile) + call sgk_mkfname (mf_fname, mf_frame, Memc[fname], SZ_FNAME) + else + call strcpy (mf_fname, Memc[fname], SZ_FNAME) + + if (mf_debug) { + call eprintf ("sgk: open frame %2d, outfile = %s\n") + call pargi (mf_frame) + call pargstr (Memc[fname]) + } + mf_fd = open (Memc[fname], NEW_FILE, BINARY_FILE) + + # Rotate plot (swap x,y)? Y-flip plot? + mf_rotate = ttygetb (tty, "RO") + mf_yflip = ttygetb (tty, "YF") + + # Raster (bitmap) or metacode device? + mf_bitmap = ttygetb (tty, "BI") + + if (mf_bitmap) { + # Bitmap output; initialize bitmap parameters. + + mf_pxsize = ttygeti (tty, "PX") + mf_pysize = ttygeti (tty, "PY") + mf_xorigin = ttygeti (tty, "XO") + mf_yorigin = ttygeti (tty, "YO") + mf_wxsize = ttygeti (tty, "XW") + mf_wysize = ttygeti (tty, "YW") + mf_nbpb = ttygeti (tty, "NB") + mf_swap2 = ttygetb (tty, "BS") + mf_swap4 = ttygetb (tty, "WS") + + mf_lworigin = max (1, ttygeti (tty, "LO")) + mf_lwslope = ttygetr (tty, "LS") + mf_lenframe = (mf_pxsize * mf_pysize + BPW-1) / BPW + + if (mf_wxsize == 0) + mf_wxsize = mf_pxsize - mf_xorigin + if (mf_wysize == 0) + mf_wysize = mf_pysize - mf_yorigin + if (mf_nbpb == 0) + mf_nbpb = NBITS_BYTE + + mf_linewidth = mf_lworigin + mf_cx = 0 + mf_cy = 0 + + mf_xmin = mf_xorigin + mf_ymin = mf_yorigin + mf_xmax = mf_xmin + mf_wxsize - 1 + mf_ymax = mf_ymin + mf_wysize - 1 + + mf_xscale = real(mf_wxsize) / real(GKI_MAXNDC) + mf_yscale = real(mf_wysize) / real(GKI_MAXNDC) + + if (mf_lenframe > LEN_FBUF) + call error (1, "sgikern: bitmap too large") + + # Initialize the bit mask table. If it is necessary to bit-flip + # bytes in the bitmap, we can do that here by flipping each byte + # of the word mask. Bit flipping can be done during rasterization + # at no additional cost, but is an expensive operation if done + # later with a filter. + + if (ttygetb (tty, "BF")) { + do j = 1, (BPW/NBITS_BYTE) + do i = 1, NBITS_BYTE { + off = (j - 1) * NBITS_BYTE + mf_bitmask[off+i] = shifti (1, off + NBITS_BYTE - i) + } + } else { + do i = 1, BPW + mf_bitmask[i] = shifti (1, i - 1) + } + + # Initialize the bit offset lookup table. This gives the physical + # x-offset into the lookup table of each addressable x-coordinate + # on the device. If NB is NBITS_BYTE the mapping is one-to-one. + # Note that the table contains zero-indexed bit offsets. + + do i = 1, mf_pxsize { + byte = (i - 1) / mf_nbpb + mf_physbit[i] = min (mf_pxsize, + byte * NBITS_BYTE + (i - (byte * mf_nbpb))) - 1 + } + + if (mf_debug) { + call eprintf ("bitmap [%d,%d] origin=[%d,%d] wsize=[%d,%d]\n") + call pargi (mf_pxsize); call pargi (mf_pysize) + call pargi (mf_xorigin); call pargi (mf_yorigin) + call pargi (mf_wxsize); call pargi (mf_wysize) + } + + } else { + # Metacode output; initialize the metacode output buffer. + mf_op = 1 + if (mf_debug) + call eprintf ("metafile device\n") + } + + call sfree (sp) + return (mf_fd) +end + + +# SGK_CLOSE -- Close the metacode spool file and dispose of it to a host system +# metacode translation task. Delete the spool file when the OS command +# completes, unless it has already been deleted by the task run. + +procedure sgk_close (fd) + +int fd # output stream [NOT USED] + +int i +pointer sp, fname +int oscmd() +errchk sgk_flush, close, oscmd +include "sgk.com" + +begin + call smark (sp) + call salloc (fname, SZ_FNAME, TY_CHAR) + + if (mf_debug) + call eprintf ("close device\n") + + if (mf_bitmap) + call sgk_frame (mf_fd) + else + call sgk_flush (mf_fd) + + if (mf_debug) { + call eprintf ("dispose: %s\n") + call pargstr (mf_dispose) + } + + if (mf_fd != NULL) { + call close (mf_fd) + mf_fd = NULL + } + + # Send the dispose command to the host system. + if (mf_dispose[1] != EOS) + if (oscmd (mf_dispose, "", "", "") != OK) + call eprintf ("Warning: SGK graphics output dispose error\n") + + # Delete the metacode or raster file if so indicated in the graphcap + # entry for the device. + + if (mf_delete) { + if (mf_debug) { + call eprintf ("delete metafile %s\n") + call pargstr (mf_fname) + } + if (mf_oneperfile) { + do i = 1, mf_frame { + call sgk_mkfname (mf_fname, i, Memc[fname], SZ_FNAME) + iferr (call delete (Memc[fname])) + ; + } + } else iferr (call delete (mf_fname)) + ; + } + + call sfree (sp) +end + + +# SGK_FLUSH -- Flush any buffered metacode output. + +procedure sgk_flush (fd) + +int fd # output stream [NOT USED] +include "sgk.com" + +begin + if (!mf_bitmap && mf_op > 1) { + if (mf_debug) + call eprintf ("flush graphics output\n") + call miiwrites (mf_fd, mf_obuf, mf_op-1) + mf_op = 1 + } + + if (mf_fd != NULL) + call flush (mf_fd) +end + + +# SGK_FRAME -- Output a frame advance instruction. + +procedure sgk_frame (fd) + +int fd # output stream [NOT USED] +include "sgk.com" + +begin + # Ignore frame commands if frame is empty. + if (!mf_update) + return + + if (mf_debug) + call eprintf ("start a new frame\n") + + if (mf_bitmap) { + # Write the bitmap to the output raster-file. + + if (mf_swap2) + call bswap2 (mf_fbuf, 1, mf_fbuf, 1, + mf_lenframe * SZ_INT * SZB_CHAR) + if (mf_swap4) + call bswap4 (mf_fbuf, 1, mf_fbuf, 1, + mf_lenframe * SZ_INT * SZB_CHAR) + + call write (mf_fd, mf_fbuf, mf_lenframe * SZ_INT) + + } else { + # Write the SGI frame instruction to the output mcode-file. + + if (mf_op + SGK_LENMCI > LEN_OBUF) { + call miiwrites (mf_fd, mf_obuf, mf_op-1) + mf_op = 1 + } + + mf_obuf[mf_op] = SGK_FRAME + mf_obuf[mf_op+1] = 0 + mf_obuf[mf_op+2] = 0 + mf_op = mf_op + SGK_LENMCI + } + + mf_frame = mf_frame + 1 + mf_update = false +end + + +# SGK_MOVE -- Output a pen move instruction. + +procedure sgk_move (fd, x, y) + +int fd # output stream [NOT USED] +int x, y # point to move to + +include "sgk.com" + +begin + if (mf_bitmap) { + if (mf_rotate) { + mf_cx = y + mf_cy = x + } else { + mf_cx = x + mf_cy = y + } + + if (mf_yflip) + mf_cy = GKI_MAXNDC - mf_cy + + # Convert to zero indexed coordinates and clip at boundary. + # Allow room for line width shift near boundary. + + mf_cx = max (mf_xmin, min (mf_xmax, + int (mf_cx * mf_xscale) + mf_xorigin)) + mf_cy = max (mf_ymin, min (mf_ymax, + int (mf_cy * mf_yscale) + mf_yorigin)) + + } else { + if (mf_op + SGK_LENMCI > LEN_OBUF) { + call miiwrites (mf_fd, mf_obuf, mf_op-1) + mf_op = 1 + } + + mf_obuf[mf_op] = SGK_MOVE + if (mf_rotate) { + mf_obuf[mf_op+1] = y + mf_obuf[mf_op+2] = x + } else { + mf_obuf[mf_op+1] = x + mf_obuf[mf_op+2] = y + } + if (mf_yflip) + mf_obuf[mf_op+2] = GKI_MAXNDC - mf_obuf[mf_op+2] + mf_op = mf_op + SGK_LENMCI + } +end + + +# SGK_DRAW -- Output a pen draw instruction. + +procedure sgk_draw (fd, a_x, a_y) + +int fd # output stream [NOT USED] +int a_x, a_y # point to draw to + +char fname[SZ_FNAME] +int xshift, yshift, dx, dy +int new_x, new_y, x1, y1, x2, y2, n, i +int open() +errchk open, close +include "sgk.com" + +begin + if (mf_rotate) { + new_x = a_y + new_y = a_x + } else { + new_x = a_x + new_y = a_y + } + + if (mf_yflip) + new_y = GKI_MAXNDC - new_y + + if (!mf_update) { + # We are called when the first drawing instruction is output for a + # new frame. We clear the bitmap or close and open a new frame + # file here, rather than at sgk_frame() time, as we do not want + # to initialize the frame buffer or open a new frame file unless + # we are actually going to write into the frame. + + # Zero out all the bits in a bitmap. + if (mf_bitmap) + call aclri (mf_fbuf, mf_lenframe) + + # Open a new frame file if the one frame per file flag is set. + if (mf_oneperfile && mf_frame > 1) { + if (mf_fd != NULL) + call close (mf_fd) + call sgk_mkfname (mf_fname, mf_frame, fname, SZ_FNAME) + if (mf_debug) { + call eprintf ("sgk: open frame %2d, outfile = %s\n") + call pargi (mf_frame) + call pargstr (fname) + } + mf_fd = open (fname, NEW_FILE, BINARY_FILE) + } + + mf_update = true + } + + if (mf_bitmap) { + # Convert to zero indexed coordinates and clip at boundary. + # Allow room for line width shift near boundary. + + new_x = max (mf_xmin, min (mf_xmax, + int (new_x * mf_xscale) + mf_xorigin)) + new_y = max (mf_ymin, min (mf_ymax, + int (new_y * mf_yscale) + mf_yorigin)) + + if (mf_linewidth <= 1) + call sgk_vector (mf_cx, mf_cy, new_x, new_y) + else { + # Redraw the vector several times with small normal shifts to + # produce a wider line. + + xshift = 0 + yshift = 0 + + if (abs (new_x - mf_cx) > abs (new_y - mf_cy)) { + dx = 0 + dy = 1 + } else { + dx = 1 + dy = 0 + } + + do i = 1, mf_linewidth { + x1 = mf_cx + xshift + y1 = mf_cy + yshift + x2 = new_x + xshift + y2 = new_y + yshift + + call sgk_vector (x1, y1, x2, y2) + + n = (i + 1) / 2 + if (and (i, 1) == 0) { + xshift = dx * n + yshift = dy * n + } else { + xshift = -dx * n + yshift = -dy * n + } + } + } + + # Update the current pen position, and set the update flag so that + # the bitmap will be written to the output file. + + mf_cx = new_x + mf_cy = new_y + + } else { + # Output a metacode draw instruction. + if (mf_op + SGK_LENMCI > LEN_OBUF) { + call miiwrites (mf_fd, mf_obuf, mf_op-1) + mf_op = 1 + } + + mf_obuf[mf_op] = SGK_DRAW + mf_obuf[mf_op+1] = new_x + mf_obuf[mf_op+2] = new_y + mf_op = mf_op + SGK_LENMCI + } +end + + +# SGK_VECTOR -- Write a vector (line) of unit width into the bitmap. The line +# endpoints are expressed in physical device coordinates. + +procedure sgk_vector (a_x1, a_y1, a_x2, a_y2) + +int a_x1, a_y1 # start point of line +int a_x2, a_y2 # end point of line + +real dydx, dxdy +long fbit, wbit, word +int wpln, mask, dx, dy, x, y, x1, y1, x2, y2, or() +include "sgk.com" + +begin + x1 = a_x1; y1 = a_y1 + x2 = a_x2; y2 = a_y2 + + dx = x2 - x1 + dy = y2 - y1 + + if (abs(dx) > abs(dy)) { + if (x1 > x2) { + x1 = a_x2; x2 = a_x1; dx = -dx + y1 = a_y2; y2 = a_y1; dy = -dy + } + + if (dy == 0 && mf_nbpb == NBITS_BYTE) { + # Somewhat optimized code for the case of a horiz. vector. + + fbit = y1 * mf_pxsize + x1 + word = fbit / BPW + wbit = and (fbit, BPW-1) + + do x = x1, x2 { + mf_fbuf[word+1] = or (mf_fbuf[word+1], mf_bitmask[wbit+1]) + wbit = wbit + 1 + if (wbit >= BPW) { + wbit = 0 + word = word + 1 + } + } + + } else { + # The general case for a mostly-X vector. + + dydx = real(dy) / real(dx) + do x = x1, x2 { + y = int ((x - x1) * dydx) + y1 + fbit = y * mf_pxsize + mf_physbit[x+1] + word = fbit / BPW + wbit = and (fbit, BPW-1) + mf_fbuf[word+1] = or (mf_fbuf[word+1], mf_bitmask[wbit+1]) + } + } + + } else if (dy != 0) { + if (y1 > y2) { + x1 = a_x2; x2 = a_x1; dx = -dx + y1 = a_y2; y2 = a_y1; dy = -dy + } + + if (dx == 0) { + # Optimized code for the case of a vertical vector. + + fbit = y1 * mf_pxsize + mf_physbit[x1+1] + word = fbit / BPW + 1 + wbit = and (fbit, BPW-1) + wpln = (mf_pxsize + BPW-1) / BPW + mask = mf_bitmask[wbit+1] + + do y = y1, y2 { + mf_fbuf[word] = or (mf_fbuf[word], mask) + word = word + wpln + } + + } else { + # The general case of a mostly-Y vector. + + dxdy = real(dx) / real(dy) + do y = y1, y2 { + x = int ((y - y1) * dxdy) + x1 + fbit = y * mf_pxsize + mf_physbit[x+1] + word = fbit / BPW + wbit = and (fbit, BPW-1) + mf_fbuf[word+1] = or (mf_fbuf[word+1], mf_bitmask[wbit+1]) + } + } + + } else { + # Plot a single point (dx=dy=0). + + fbit = y1 * mf_pxsize + mf_physbit[x1+1] + word = fbit / BPW + wbit = and (fbit, BPW-1) + mf_fbuf[word+1] = or (mf_fbuf[word+1], mf_bitmask[wbit+1]) + } +end + + +# SGK_LINEWIDTH -- Output a line width set instruction. + +procedure sgk_linewidth (fd, width) + +int fd # output stream [NOT USED] +int width # new line width + +int gap +include "sgk.com" + +begin + if (mf_bitmap) { + # Set the line width in device pixels. + mf_linewidth = max (1, mf_lworigin + int ((width-1) * mf_lwslope)) + + # Set the clipping limits. Allow for shifting to widen lines. + gap = mf_linewidth - 1 + mf_xmin = mf_xorigin + gap + mf_ymin = mf_yorigin + gap + mf_xmax = mf_xorigin + (mf_wxsize - 1) - gap + mf_ymax = mf_yorigin + (mf_wysize - 1) - gap + + } else { + if (mf_op + SGK_LENMCI > LEN_OBUF) { + call miiwrites (mf_fd, mf_obuf, mf_op-1) + mf_op = 1 + } + + mf_obuf[mf_op] = SGK_SETLW + mf_obuf[mf_op+1] = width + mf_obuf[mf_op+2] = 0 + mf_op = mf_op + SGK_LENMCI + } +end + + +# SGK_MKFNAME -- Make the name of file N of a multiframe set. + +procedure sgk_mkfname (root, num, outstr, maxch) + +char root[ARB] # root filename +int num # file number +char outstr[maxch] # receives new filename +int maxch + +begin + call sprintf (outstr, maxch, "%s.%d") + call pargstr (root) + call pargi (num) +end diff --git a/sys/gio/sgikern/t_sgideco.x b/sys/gio/sgikern/t_sgideco.x new file mode 100644 index 00000000..57dae876 --- /dev/null +++ b/sys/gio/sgikern/t_sgideco.x @@ -0,0 +1,106 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> +include <gki.h> +include "sgk.h" + +define LEN_MCBUF 3000 + + +# SGIDECODE -- Decode an SGI metacode file, printing the decoded metacode +# instructions on the standard output. + +procedure t_sgidecode() + +pointer sp, fname, mcbuf, ip, itop +int fd, list, verbose, gkiunits, nwords + +bool clgetb() +int clpopni(), clgfil(), clplen(), open(), btoi(), miireads() + +begin + call smark (sp) + call salloc (fname, SZ_FNAME, TY_CHAR) + call salloc (mcbuf, LEN_MCBUF, TY_SHORT) + + # Open list of metafiles to be decoded. + list = clpopni ("input") + + if (clgetb ("generic")) { + verbose = NO + gkiunits = NO + } else { + verbose = btoi (clgetb ("verbose")) + gkiunits = btoi (clgetb ("gkiunits")) + } + + # Process a list of metacode files, writing the decoded metacode + # instructions on the standard output. + + while (clgfil (list, Memc[fname], SZ_FNAME) != EOF) { + # Print header if new file. + if (clplen (list) > 1) { + call printf ("\n# METAFILE `%s':\n") + call pargstr (Memc[fname]) + } + + # Open input file. + iferr (fd = open (Memc[fname], READ_ONLY, BINARY_FILE)) { + call erract (EA_WARN) + next + } + + # Process the metacode. + + itop = mcbuf + ip = mcbuf + + repeat { + if (ip >= itop) { + # Refill buffer. + nwords = miireads (fd, Mems[mcbuf], LEN_MCBUF) + if (nwords == EOF) + break + itop = mcbuf + nwords + ip = mcbuf + } + + switch (Mems[ip]) { + case SGK_FRAME: + call printf ("new_frame\n") + case SGK_MOVE: + if (gkiunits == YES) { + call printf ("move (%d, %d)\n") + call pargs (Mems[ip+1]) + call pargs (Mems[ip+2]) + } else { + call printf ("move (%0.5f, %0.5f)\n") + call pargr (real(Mems[ip+1]) / real(GKI_MAXNDC)) + call pargr (real(Mems[ip+2]) / real(GKI_MAXNDC)) + } + case SGK_DRAW: + if (gkiunits == YES) { + call printf ("draw (%d, %d)\n") + call pargs (Mems[ip+1]) + call pargs (Mems[ip+2]) + } else { + call printf ("draw (%0.5f, %0.5f)\n") + call pargr (real(Mems[ip+1]) / real(GKI_MAXNDC)) + call pargr (real(Mems[ip+2]) / real(GKI_MAXNDC)) + } + case SGK_SETLW: + call printf ("set_linewidth (%d)\n") + call pargs (Mems[ip+1]) + default: + call printf ("unknown instruction\n") + } + + ip = ip + SGK_LENMCI + } + + call close (fd) + } + + call clpcls (list) + call sfree (sp) +end diff --git a/sys/gio/sgikern/t_sgikern.x b/sys/gio/sgikern/t_sgikern.x new file mode 100644 index 00000000..359a87ad --- /dev/null +++ b/sys/gio/sgikern/t_sgikern.x @@ -0,0 +1,67 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> +include <gki.h> + +# SGIKERN -- Generic graphics kernel for the standard plotter output. The whole +# package is copied as much as possible from the stdgraph package. + +procedure t_sgikern() + +int fd, list +pointer gki, sp, fname, devname +int dev[LEN_GKIDD], deb[LEN_GKIDD] +int debug, verbose, gkiunits +bool clgetb() +int clpopni(), clgfil(), open(), btoi() +int gki_fetch_next_instruction() + +begin + call smark (sp) + call salloc (fname, SZ_FNAME, TY_CHAR) + call salloc (devname, SZ_FNAME, TY_CHAR) + + # Open list of metafiles to be decoded. + list = clpopni ("input") + + # Get parameters. + call clgstr ("device", Memc[devname], SZ_FNAME) + if (clgetb ("generic")) { + debug = NO + verbose = NO + gkiunits = NO + } else { + debug = btoi (clgetb ("debug")) + verbose = btoi (clgetb ("verbose")) + gkiunits = btoi (clgetb ("gkiunits")) + } + + # Open the graphics kernel. + call sgi_open (Memc[devname], dev) + call gkp_install (deb, STDERR, verbose, gkiunits) + + # Process a list of metacode files, writing the decoded metacode + # instructions on the standard output. + + while (clgfil (list, Memc[fname], SZ_FNAME) != EOF) { + # Open input file. + iferr (fd = open (Memc[fname], READ_ONLY, BINARY_FILE)) { + call erract (EA_WARN) + next + } + + # Process the metacode instruction stream. + while (gki_fetch_next_instruction (fd, gki) != EOF) { + if (debug == YES) + call gki_execute (Mems[gki], deb) + call gki_execute (Mems[gki], dev) + } + + call close (fd) + } + + call gkp_close() + call sgi_close() + call clpcls (list) + call sfree (sp) +end diff --git a/sys/gio/sgikern/x_sgikern.x b/sys/gio/sgikern/x_sgikern.x new file mode 100644 index 00000000..797820c2 --- /dev/null +++ b/sys/gio/sgikern/x_sgikern.x @@ -0,0 +1,5 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +task stdplot = t_sgikern, + sgikern = t_sgikern, + sgidecode = t_sgidecode |