void DoQueryReplay(NetBuffer obptr, byte code) { int i; string comma = ""; int obptr0 = obptr.Index; int num, denom; if (this.QrInProgress) { this.telnet.Trace.trace_ds("> StructuredField\n"); this.QrInProgress = false; } obptr.Add16(0); obptr.Add(See.SFID_QREPLY); obptr.Add(code); switch (code) { case See.QR_CHARSETS: { this.telnet.Trace.trace_ds("> QueryReply(CharacterSets)\n"); obptr.Add(0x82); /* flags: GE, CGCSGID present */ obptr.Add(0x00); /* more flags */ obptr.Add(7); /* SDW */ obptr.Add(7); /* SDH */ obptr.Add(0x00); /* Load PS format types */ obptr.Add(0x00); obptr.Add(0x00); obptr.Add(0x00); obptr.Add(0x07); /* DL */ obptr.Add(0x00); /* SET 0: */ obptr.Add(0x10); /* FLAGS: non-loadable, single-plane, single-byte, no compare */ obptr.Add(0x00); /* LCID */ obptr.Add32(cgcsgid); /* CGCSGID */ // TODO: Missing font stuff for extended font information break; } case See.QR_IMP_PART: { this.telnet.Trace.trace_ds("> QueryReply(ImplicitPartition)\n"); obptr.Add(0x0); /* reserved */ obptr.Add(0x0); obptr.Add(0x0b); /* length of display size */ obptr.Add(0x01); /* "implicit partition size" */ obptr.Add(0x00); /* reserved */ obptr.Add16(80); /* implicit partition width */ obptr.Add16(24); /* implicit partition height */ obptr.Add16(this.telnet.Controller.MaxColumns); /* alternate height */ obptr.Add16(this.telnet.Controller.MaxRows); /* alternate width */ break; } case See.QR_NULL: { this.telnet.Trace.trace_ds("> QueryReply(Null)\n"); break; } case See.QR_SUMMARY: { this.telnet.Trace.trace_ds("> QueryReply(Summary("); for (i = 0; i < NSR; i++) { this.telnet.Trace.trace_ds("%s%s", comma, See.GetQCodeode(this.SupportedReplies[i])); comma = ","; obptr.Add(this.SupportedReplies[i]); } this.telnet.Trace.trace_ds("))\n"); break; } case See.QR_USABLE_AREA: { this.telnet.Trace.trace_ds("> QueryReply(UsableArea)\n"); obptr.Add(0x01); /* 12/14-bit addressing */ obptr.Add(0x00); /* no special character features */ obptr.Add16(this.telnet.Controller.MaxColumns); /* usable width */ obptr.Add16(this.telnet.Controller.MaxRows); /* usable height */ obptr.Add(0x01); /* units (mm) */ num = 100; denom = 1; while (0 == (num % 2) && 0 == (denom % 2)) { num /= 2; denom /= 2; } obptr.Add16((int)num); /* Xr numerator */ obptr.Add16((int)denom); /* Xr denominator */ num = 100; denom = 1; while (0 == (num % 2) && 0 == (denom % 2)) { num /= 2; denom /= 2; } obptr.Add16((int)num); /* Yr numerator */ obptr.Add16((int)denom); /* Yr denominator */ obptr.Add(7); /* AW */ obptr.Add(7); /* AH */ obptr.Add16(this.telnet.Controller.MaxColumns * this.telnet.Controller.MaxRows); /* buffer, questionable */ break; } case See.QR_COLOR: { this.telnet.Trace.trace_ds("> QueryReply(Color)\n"); obptr.Add(0x00); /* no options */ obptr.Add(this.telnet.Appres.color8 ? 8 : 16); /* report on 8 or 16 colors */ obptr.Add(0x00); /* default color: */ obptr.Add(0xf0 + See.COLOR_GREEN); /* green */ for (i = 0xf1; i <= (this.telnet.Appres.color8 ? 0xf8 : 0xff); i++) { obptr.Add(i); if (this.telnet.Appres.m3279) { obptr.Add(i); } else { obptr.Add(0x00); } } break; } case See.QR_HIGHLIGHTING: { this.telnet.Trace.trace_ds("> QueryReply(Highlighting)\n"); obptr.Add(5); /* report on 5 pairs */ obptr.Add(See.XAH_DEFAULT); /* default: */ obptr.Add(See.XAH_NORMAL); /* normal */ obptr.Add(See.XAH_BLINK); /* blink: */ obptr.Add(See.XAH_BLINK); /* blink */ obptr.Add(See.XAH_REVERSE); /* reverse: */ obptr.Add(See.XAH_REVERSE); /* reverse */ obptr.Add(See.XAH_UNDERSCORE); /* underscore: */ obptr.Add(See.XAH_UNDERSCORE); /* underscore */ obptr.Add(See.XAH_INTENSIFY); /* intensify: */ obptr.Add(See.XAH_INTENSIFY); /* intensify */ break; } case See.QR_REPLY_MODES: { this.telnet.Trace.trace_ds("> QueryReply(ReplyModes)\n"); obptr.Add(Codes.Field); obptr.Add(Codes.ExtendedField); obptr.Add(Codes.Character); break; } case See.QR_ALPHA_PART: { this.telnet.Trace.trace_ds("> QueryReply(AlphanumericPartitions)\n"); obptr.Add(0); /* 1 partition */ obptr.Add16(this.telnet.Controller.MaxRows * this.telnet.Controller.MaxColumns); /* buffer space */ obptr.Add(0); /* no special features */ break; } default: { // Internal error return; } } obptr.Add16At(obptr0, obptr.Index - obptr0); }
void do_query_reply(NetBuffer obptr, byte code) { //int len; int i; string comma = ""; int obptr0 = obptr.Index; //obptr - obuf; //byte *obptr_len; int num, denom; if (qr_in_progress) { telnet.trace.trace_ds("> StructuredField\n"); qr_in_progress = false; } //space3270out(4); obptr.Add16(0); // Length - set later obptr.Add(see.SFID_QREPLY); obptr.Add(code); switch (code) { case see.QR_CHARSETS: telnet.trace.trace_ds("> QueryReply(CharacterSets)\n"); //space3270out(23); obptr.Add(0x82); /* flags: GE, CGCSGID present */ obptr.Add(0x00); /* more flags */ obptr.Add(7); //*char_width); /* SDW */ obptr.Add(7); //*char_height);/* SDH */ obptr.Add(0x00); /* Load PS format types */ obptr.Add(0x00); obptr.Add(0x00); obptr.Add(0x00); obptr.Add(0x07); /* DL */ obptr.Add(0x00); /* SET 0: */ obptr.Add(0x10); /* FLAGS: non-loadable, single-plane, * single-byte, no compare */ obptr.Add(0x00); /* LCID */ obptr.Add32(cgcsgid); /* CGCSGID */ // TODO: Missing font stuff for extended font information break; case see.QR_IMP_PART: telnet.trace.trace_ds("> QueryReply(ImplicitPartition)\n"); // space3270out(13); obptr.Add(0x0); /* reserved */ obptr.Add(0x0); obptr.Add(0x0b); /* length of display size */ obptr.Add(0x01); /* "implicit partition size" */ obptr.Add(0x00); /* reserved */ obptr.Add16(80); /* implicit partition width */ obptr.Add16(24); /* implicit partition height */ obptr.Add16(telnet.tnctlr.maxCOLS); /* alternate height */ obptr.Add16(telnet.tnctlr.maxROWS); /* alternate width */ break; case see.QR_NULL: telnet.trace.trace_ds("> QueryReply(Null)\n"); break; case see.QR_SUMMARY: telnet.trace.trace_ds("> QueryReply(Summary("); // space3270out(NSR); for (i = 0; i < NSR; i++) { telnet.trace.trace_ds("%s%s", comma, see.see_qcode(supported_replies[i])); comma = ","; obptr.Add(supported_replies[i]); } telnet.trace.trace_ds("))\n"); break; case see.QR_USABLE_AREA: telnet.trace.trace_ds("> QueryReply(UsableArea)\n"); // space3270out(19); obptr.Add(0x01); /* 12/14-bit addressing */ obptr.Add(0x00); /* no special character features */ obptr.Add16(telnet.tnctlr.maxCOLS); /* usable width */ obptr.Add16(telnet.tnctlr.maxROWS); /* usable height */ obptr.Add(0x01); /* units (mm) */ num = 100; denom = 1; while (0 == (num % 2) && 0 == (denom % 2)) { num /= 2; denom /= 2; } obptr.Add16((int)num); /* Xr numerator */ obptr.Add16((int)denom); /* Xr denominator */ num = 100; denom = 1; while (0 == (num % 2) && 0 == (denom % 2)) { num /= 2; denom /= 2; } obptr.Add16((int)num); /* Yr numerator */ obptr.Add16((int)denom); /* Yr denominator */ obptr.Add(7); //*char_width); /* AW */ obptr.Add(7); //*char_height);/* AH */ obptr.Add16(telnet.tnctlr.maxCOLS * telnet.tnctlr.maxROWS); /* buffer, questionable */ break; case see.QR_COLOR: telnet.trace.trace_ds("> QueryReply(Color)\n"); // space3270out(4 + 2*15); obptr.Add(0x00); /* no options */ obptr.Add(telnet.appres.color8? 8: 16); /* report on 8 or 16 colors */ obptr.Add(0x00); /* default color: */ obptr.Add(0xf0 + see.COLOR_GREEN); /* green */ for (i = 0xf1; i <= (telnet.appres.color8? 0xf8: 0xff); i++) { obptr.Add(i); if (telnet.appres.m3279) { obptr.Add(i); } else { obptr.Add(0x00); } } break; case see.QR_HIGHLIGHTING: telnet.trace.trace_ds("> QueryReply(Highlighting)\n"); // space3270out(11); obptr.Add(5); /* report on 5 pairs */ obptr.Add(see.XAH_DEFAULT); /* default: */ obptr.Add(see.XAH_NORMAL); /* normal */ obptr.Add(see.XAH_BLINK); /* blink: */ obptr.Add(see.XAH_BLINK); /* blink */ obptr.Add(see.XAH_REVERSE); /* reverse: */ obptr.Add(see.XAH_REVERSE); /* reverse */ obptr.Add(see.XAH_UNDERSCORE); /* underscore: */ obptr.Add(see.XAH_UNDERSCORE); /* underscore */ obptr.Add(see.XAH_INTENSIFY); /* intensify: */ obptr.Add(see.XAH_INTENSIFY); /* intensify */ break; case see.QR_REPLY_MODES: telnet.trace.trace_ds("> QueryReply(ReplyModes)\n"); // space3270out(3); obptr.Add(SF_SRM_FIELD); obptr.Add(SF_SRM_XFIELD); obptr.Add(SF_SRM_CHAR); break; case see.QR_ALPHA_PART: telnet.trace.trace_ds("> QueryReply(AlphanumericPartitions)\n"); // space3270out(4); obptr.Add(0); /* 1 partition */ obptr.Add16(telnet.tnctlr.maxROWS * telnet.tnctlr.maxCOLS); /* buffer space */ obptr.Add(0); /* no special features */ break; default: return; /* internal error */ } obptr.Add16At(obptr0, obptr.Index - obptr0); //obptr_len = obuf + obptr0; //len = (obptr - obuf) - obptr0; //SET16(obptr_len, len); }