XCALL HP

is a flexible method of controlling the HP LaserJet Series II and Series III in DBL programs.

See also

XCALL HP gives you the ability to:

And what's best of all?- It does all this in a simple to use, intuitive manner consistent with good programming practice. It uses the DBL Synergy style approach of functions and qualifiers.

Although DISPLAY statements and Synergy Xcall's typically output to the screen while XCALL HP typically outputs to the Laser, note the similarities in the following:

        DISPLAY      (ch, $scr_pos(5,1), 'This is normal',
         &                $scr_att(bold),
         &                $scr_pos(20,1),'This is bold')

        XCALL W_DISP (id, wd_pos,5,1,    'This is normal',
         &                wd_attr,attr_set+attr_bold,
         &                wd_pos,20,1,   'This is bold')

        XCALL HP     (ch, hpPOS,5,1,   0,'This is normal',
         &                hpFONT,hpBOLD,
         &                hpPOS,20,1,  0,'This is bold')
The parameters you specify in xcall hp consist of functions, most of which are followed by one or more qualifiers.

The hpPOS function, for example, positions the cursor. (Did you know the LaserJet had a cursor?) It takes two qualifiers which are row and column.

Need a TIFF converter? We've got one here!

Are you interested? The distribution for this product is all in source code. I've taken the liberty of including some documentation excerpts in hopes of whetting your appetite.

Should you wish to order XCALL HP, its cost is $400.00 US funds. Here's our licensing blurb.

Sincerely,
Alan Cohen
416-783-9826
Computer Advocacy Inc

-------------------------------------------------
P.S. I get a lot of spam, so if you send email to
alan at domain name computeradvocacy.com,
expect to get a challenge request so I know you really mean it.
-Alan

Table of Contents

Distribution contents lists and describes diskette files (All files are source)
Addressing the cursor discusses the LaserJet's cursor, how it is addressed, units of measurement
Output Destination XCALL HP can output to a channel or append to a string
How XCALL HP works briefly discusses its basic design. (See also Tips & Techniques for more detail)
Compile & Link Considerations
Common Area briefly discusses the COMMON area used by XCALL HP
Error Handling
Reference describes all XCALL HP functions (the bulk of this document)
Fish & Chips an analogy to help understand fonts
Tips & Techniques a variety of discussions and suggestions about the workings and use of XCALL HP
This is the Table of Contents for xcall hp. The document xcall hp - documentation excerpt (the one you're reading now) includes only the the sections "Output Destination", "How XCALL HP works" and several pages from "Reference". The complete documentation for XCALL HP is about 50 pages.

OUTPUT destination

In general, HP and HPSTRING differ only by their output destination.

XCALL HP sends its output to a channel. (It does not open a channel.) The channel number is the first parameter in the xcall.

XCALL HPSTRING appends its output onto the end of a string. The string is the first parameter in the xcall. Thus, you can use it to build strings.
All examples of the form:XCALL HP (ch, ...)
could be written as: XCALL HPSTRING (variable, ...)
The exception is the situation where XCALL HPSTRING is instructed to output an entire file (a raster graphics for example). In such a case, it only appends the file name not the file's contents to the string.

How XCALL HP works

XCALL HP accepts, as parameters, a channel and up to 98 more parameters.

If a parameter is zero, the next parameter is expected to be an alpha string and is output as is.

If a parameter is greater than zero and less than 32, the corresponding ASCII value is output. For example, specifying 13,10 as two parameters would cause a carriage return and linefeed to be output.

If a parameter is greater than or equal to 32, the parameter is assumed to be a function as defined in HPSUB.DEF

Some of these functions require qualifiers. For example, hpPOS expects that the next two parameters will be a row and column.

XCALL APPEND

When XCALL HPSTRING is appending its output to a string rather than outputting to a channel (see Output destination above), it uses XCALL APPEND to do the appending.


REFERENCE

The bulk of this document, the Reference section, describes each of the available functions. The structure of each section is:

               Function
               Description
               Notes
               See also
               Example
The functions are listed in alphabetical order. Generally, each function description begins on a new page.

There is a section entitled "MACROS" which is not a function but is a discussion of the nature of LaserJet macros and the various hpMACRO functions which follow.


List of functions

0 displays alpha variable or literal
hpAREA defines row & col (vertical & horizontal) area
hpBOX draws a rectangle using hpAREA's dimensions
hpDEBUG tells laser to display codes (not execute them)
hpDOTS defines unit of measurement (row/col vs dots)
hpFILL shades an area defined by hpAREA
hpFLUSH sends E to flush page and do a soft reset
hpFONT sets font characteristics
hpFONT_DELETE deletes soft fonts from Laser memory
hpGRAPHIC prints a raster graphics file
hpHLINE draws a horizontal line
hpHTAB positions cursor horizontally
hpLM sets the left margin
hpLOAD downloads a soft font
hpLPI sets number of lines per inch
(MACROS) a discussion of the 8 macro functions which follow
hpMACROautoenable a macro for automatic overlay
hpMACROcallcall a macro
hpMACROdel delete a macro
hpMACROdisabledisable a macro from automatic overlay
hpMACROexecuteexecute a macro
hpMACROpermend a macro definition and make it permanent
hpMACROstartstart a macro definition
hpMACROtempend a macro definition and make it temporary
hpMANUAL sets paper location to be manual feed
hpMOVE positions cursor (relative)
hpPOS positions cursor (absolute)
hpPOP pops cursor position off the stack
hpPUSH pushes cursor position on the stack
hpSTATIONERYdefines paper size
hpTHICK set horizontal and/or vertical line draw thickness
hpVLINE draws a vertical line
hpVTAB positions cursor vertically
hpUNDER turns on underlining
hpUNDER_OFFturns off underlining

hpBOX


Description:
Draws a box starting at the current cursor position using height and width provided by last hpAREA. The thickness of the horizontal and vertical portions of the box are one dot by default. This thickness can be changed. (see hpTHICK)

Notes:
Drawing a box does not change the cursor position.

See also: hpAREA, hpFILL, hpTHICK

Example:

               xcall hp (ch,  hpPOS,12,50,           ;position cursor.
&                             hpAREA,9,10,           ;define area.
&                             hpBOX,                 ;draw a box around it.
&                             hpPOS,13,51,           ;position just inside box
&                             0,'Hello')             ;and display 'hello' there
Assuming 10CPI and 6LPI, the cursor is positioned 2 inches down (because 2" is 12lines divided by 6LPI) and 5 inches across (because 5" is 50columns divided by 10CPI) on the page. There, a box is drawn which is 1.5 inches high (9/6) and 1 inch wide (10/10).

hpLM,col

Description:
Sets the left margin to column col.

Notes: When the laser is reset, (by hpFLUSH for example,) the margin is reset to 0.

Example:
The following code prints a phone book with 3 columns, of 50 lines each.

The traditional print technique is to count your lines as you print them. When that counter hits some number (say 50), you clear the counter, eject the page and start again. Here, it's similar except we increment the margin by 30 and reposition the cursor back to the top of the same page. (We've also drawn some vertical lines to separate the columns.)

        clear line, margin
        do forever
               begin
               reads (1,rec,eof)
               if (line.gt.50)
                       begin
                       line =
                       margin = margin+30
                       if (margin.gt.60)
                              begin
                              margin =
                              xcall hp (ch,  hpPOS,0,29,hpVLINE,50,
               &                             hpPOS,0,59,hpVLINE,50,
               &                             hpFLUSH)
                              end
                       xcall hp (ch,  hpLM,margin,
               &                      hpPOS,0,margin)
                       end
               writes (ch,rec)
               incr line
               end

hpPOS,row,col

Description:
Positions the cursor to row,col. The actual physical position resulting from this will depend on the current unit of measurement as defined by hpDOTS.

See also: hpMOVE, hpHTAB, hpVTAB, hpDOTS

Notes:
The top of page is hpPOS,0,0 not hpPOS,1,1

Example:

               xcall hp (ch,  hpDOTS,$false,
                       &      hpPOS,4,10,    0,'Name',
                       &      hpPOS,5,10,    0,'Rank',
                       &      hpPOS,6,10,    0,'Serial#',
                       &      hpFONT,hpBOLD,
                       &      hpPOS,4,20,    0,'Alan',
                       &      hpPOS,5,20,    0,'slave',
                       &      hpPOS,6,20,    0,'1234',
                       &      hpFONT,hpMEDIUM)