--File PressNetDefs.mesa --Last edited November 23, 1981 10:59 AM By Glen Williams --added imageCode DIRECTORY; PressNetDefs: DEFINITIONS = BEGIN --Types and Variables Printer: TYPE = {Stinger}; ScanDirection: TYPE = {portrait, landscape}; --the direction the scanner writes bits: landscape=bits go up the length of the page attributesCode: CARDINAL = 134267B; --semi-random code to make sure attributes block is recognized imageCode: CARDINAL = 134367B; --another semi-random code. Means this buffer holds image data e6(0,3634)(1,6880)\i84I2i15I13b12B24bi22BI1b9B18b13B31b1i2B83bI15B22i62bI10B23i PrinterAttributes: TYPE = MACHINE DEPENDENT RECORD --these are the values a user needs. [printer(0: 0..9): Printer, nPrinterColors(0: 10..12): [0..7B], scanDirection(0: 13..15): ScanDirection, resolutionB(1: 0..15): CARDINAL, --scanlines/inch resolutionS(2: 0..15): CARDINAL, --bits/inch in scan line scanLengthInches(3: 0..15): CARDINAL --length of scan in inches (paper size) * 10 ];e6\b17B34i36I146i16I37i24I40i44I PageAttributes: TYPE = MACHINE DEPENDENT RECORD [firstScan: CARDINAL, --the first scan line of information on the page. I.e., the count of scan lines to skip before your -- first line of data. On a landscape machine, first scan determines the left margin. On a portrait -- machine, the top margin. Begin enumeration at zero. lastScan: CARDINAL, --the last scan line of data on the page. I.e., the image is composed of scanlines starting @ firstScan -- and ending @lastScan, interpreted as addresses on the printed page. margin: CARDINAL, --# of bits into page to position the beginning of the scan. On a landscape machine, -- this determines the bottom margin. bitWc: CARDINAL --# of bits in scan line/word size. (Usually bits/16). ]; (635)\1b15B58i268I23i182I24i129I21i53I4b StingerAttributes: PrinterAttributes =\b17B [printer: Stinger, nPrinterColors: 1, scanDirection: landscape, resolutionB: 384, resolutionS: 384, scanLengthInches: 110];l4268d3633 PressSendError: ERROR [err: PressNetErr, s: STRING]; --if s # NIL then it contains info passed from the specific error-generator\b15B38i76I PressNetErr: TYPE = {noError, --for initialization --These are renamed from Eftp-generated errors errorNoRoute, errorNoResponse, errorFromServer, errorEftpOK, --looks like an error but isn't errorEftpExternalReceiverAbort, errorEftpReceiverBusyAbort, errorEftpOutOfSyncAbort, errorEftpRejected, errorNotSending, errorTimedOut --this occurs when data is being transmitted to rhe listener: when SetRetries's count is exhausted }; --Procedures --for sender --Currently the sender is allowed to send one page only. --The steps in sending a page to the printer are the following. -- Call GetPrinterAttributes to determine scan-line direction of desired printer. -- Call PrinterReady to see if the printer is available. -- Call SendPageAttributes to let the printer set up its parameters. -- Call SendLine lastScan-firstScan+1 times to transmit the scan lines. -- Call CloseConnection. GetPrinterAttributes: PROCEDURE[printer: Printer] RETURNS [pa: PrinterAttributes]; --for now returns a compiled-in set of attributes PrinterReady: PROCEDURE [printer: Printer, retries: CARDINAL _ 1] RETURNS [goAhead: BOOLEAN _ FALSE]; --If returns successfully, you have a connection. --Later may return reason for no connection (i.e., printer down, not listening etc) SetRetries: PROC[n: CARDINAL]; --sets the retry count for all the transfers after the connection is established. SendPageAttributes: PROCEDURE[attrPt: POINTER TO PageAttributes]; --this routine sends the page attributes to the printer. --If goAhead returns FALSE, there was trouble with the parameters and the connection is closed. SendLine: PROCEDURE[p: POINTER]; --Sends a scan-line of bits to the printer. The # of words sent is taken from PageAttributes.bitWc. CloseConnection: PROCEDURE[]; --A connection will be kept open until this routine is called. Don't forget to call it! --for Printer GetAJob: PROCEDURE[];--listens for a job request and gets attributes. If attributes are -- ok, it stores them as first page of Press.bits and returns GetBits: PROCEDURE[] RETURNS[okToProceed: BOOLEAN _ FALSE]; --This differs from Send Bits in that this routine gets all the bits of the page before --exiting. It also responds to CloseConnection from the user. When this exits, we're ready to print. SendPrinterAttributes: PROCEDURE[printer: Printer]; --This routine answers the GetPrinterAttributes query from remote users. Not -- implemented in first round of implementations. END. --of PressNetDefs Last edited September 21, 1981 4:21 PM By Glen Williams --created\b11B24i20I3i47I65i31I142i1I1i98I6b13i70I1i2B61bI4B302b23B61i50I1b14B88i134bI11B23i81bI19B47i56I1i95I2b8B25i100bI17B14i87I3b2i13I9B12bi2B126I2b8B52i189b1I22B30i127b1BI6i --Last edited November 17, 1981 11:45 AM By Glen Williams --changed PrinterAttributes and SendBits to Sendline \i59I2i8I17i25I