Re: lp5250 and "bypass code"
Scott Klement <[email protected]> Wed, 03 Nov 2010 10:44:31 -0500
| Newsgroups | gmane.comp.emulators.tn5250 |
|---|---|
| Message-ID | <[email protected]> |
Hi John,
Please look at the changes I made to lp5250d-win.c in Feb 2009
you can see them online, here:
http://tn5250.cvs.sourceforge.net/viewvc/tn5250/tn5250/win32/lp5250d-win.c?r1=1.9&r2=1.10
You need to be running the code from CVS to use this.
The changes allow for an exec: prefix. You code your configuration like
this:
foo {
host=example.com
env.DEVNAME=PRT01
outputcommand=exec:C:\tmp\tempfile.dat?C:\bin\printit.exe
}
I'm going from memory, so I might not have got the specifics right...
hopefully you can figure it out from the code.
Anyway -- what will happen is lp5250d will write a spooled file to
C:\tmp\tempfile.dat and then it'll run C:\bin\printit.exe when that file
is complete. (Thus, you don't have to use pipes.)
My program (my version of C:\bin\printit.exe in the example) then reads
the file and replaces the bypass codes, amongst other things, and
finally sends the result to the printer. (This is the part that I,
unfortunately, can't share.)
On 11/3/2010 10:08 AM, John Chambers wrote:
> Ok, I've implemented this in perl, as a one liner:
>
> perl -n -e "while
> (s/&%([0-9a-fA-F]{2})(([0-9a-fA-F]{2})*)&%/@{[chr(hex($1))]}&%$2&%/g) {
> };s/&%&%//g;print;"
>
> But, as noted in the source comments, pipes don't perform very well in
> windows. I don't even know how to install a pipe for a windows printer.
>
> I guess I can implement it with a state machine in the c source, but I
> don't think c has functions like chr and hex.
>
> By the way, thank you all, very much, for all the work that has gone
> into writing this software.
>
> John Chambers
>
> -----Original Message-----
> From: linux5250-bounces-Zwy7GipZuJhWk0Htik3J/[email protected]
> [mailto:linux5250-bounces-Zwy7GipZuJhWk0Htik3J/[email protected]] On Behalf Of Scott Klement
> Sent: Monday, November 01, 2010 1:25 PM
> To: Linux 5250 Development Project
> Subject: Re: [LINUX5250] lp5250 and "bypass code"
>
> On 10/29/2010 12:01 PM, John Chambers wrote:
>> Does anyone here know what a "bypass code" is? Or how to implement it
>
>> on lp5250d for windows?
>>
>
> A "bypass code" is a way to send printer escape codes to a printer
> without worrying about them being fouled up by the printer emulation
> software (which converts from IBM printer language to the actual printer
> language) or the ASCII/EBCDIC translation process.
>
> They used a sequence of&% as a toggle to switch into and out of
> 'bypass' mode. from there, anything received is in hex. It will be used
> to fashion actual bytes to be sent as-is to the printer. So for
> example, you might have this:
>
> &%090a0b&%
>
> The leading&% goes into bypass mode. The 09 (two characters) is used
> to create a byte containing 0x09, and that's sent to the printer as-is.
> Likewise the 0a is converted to 0x0a, and the 0b is converted to 0x0b,
> and they are sent to the printer as-is. The&% ends bypass mode, and
> things go back to normal until the next&% appears.
>
> Frankly, the whole thing was a kludge. A more proper (and IBM blessed)
> solution would be to use Host Print Transform. Or at least use SCS
> transparency codes if you _must_ send raw escape sequences to the
> printer.
>
> I-O Corporation used these bypass codes extensively in their devices....
>
> I have written software that works with lp5250d to emulate the way I-O
> handled them.
>
> Unfortunately, my software is for FreeBSD, not Windows. And I developed
> it under contract, and cannot give it away. But it wasn't terribly
> difficult to write -- you should be able to write your own.
> --
> This is the Linux 5250 Development Project (LINUX5250) mailing list To
> post a message email: LINUX5250-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe,
> or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/linux5250
> or email: LINUX5250-request-Zwy7GipZuJhWk0Htik3J/[email protected] Before posting, please take a
> moment to review the archives at http://archive.midrange.com/linux5250.
>
--
This is the Linux 5250 Development Project (LINUX5250) mailing list
To post a message email: LINUX5250-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/linux5250
or email: LINUX5250-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/linux5250.