include "print.m"; print := load Print Print->PATH; Print: module { PATH: con "/dis/lib/print/print.dis"; CONFIG_PATH: con "/lib/print/"; init: fn(): int; set_printfd: fn(fd: ref Sys->FD); print_image: fn(p: ref Printer, display: ref Draw->Display, im: ref Draw->Image, pcwidth: int): int; print_textfd: fn(p: ref Printer, fd: ref Sys->FD, ps: real, pr: int, wrap: int): int; get_defprinter: fn(): ref Printer; set_defprinter: fn(p: ref Printer); get_size: fn(p: ref Printer): (int, real, real); # dpi, xinches, yinches get_printers: fn(): list of ref Printer; get_papers: fn(): list of ref Paper; save_settings: fn(): int; # Printer types Ptype: adt { name: string; modes: list of ref Pmode; driver: string; hpmapfile: string; }; # Paper sizes Paper: adt { name: string; hpcode: string; width_inches: real; height_inches: real; }; # Print modes Pmode: adt { name: string; desc: string; resx: int; resy: int; blackdepth: int; coldepth: int; blackresmult: int; }; # Print options Popt: adt { name: string; mode: ref Pmode; paper: ref Paper; orientation: int; duplex: int; }; # Printer instance PORTRAIT: con 0; LANDSCAPE: con 1; DUPLEX_OFF: con 0; DUPLEX_LONG: con 1; DUPLEX_SHORT: con 2; Printer: adt { name: string; ptype: ref Ptype; device: string; popt: ref Popt; pdriver: Pdriver; }; }; Pdriver: module { PATHPREFIX: con "/dis/lib/print/"; DATAPREFIX: con "/lib/print/"; init: fn(debug: int); sendimage: fn(p: ref Print->Printer, tfd: ref Sys->FD, display: ref Draw->Display, im: ref Draw->Image, width: int, lmargin: int): int; sendtextfd: fn(p: ref Print->Printer, pfd, tfd: ref Sys->FD, ps: real, pr: int, wrap: int): int; printable_pixels: fn(p: ref Print->Printer): (int, int); };
A4= hpcode=26 width_inches=8.3 height_inches=11.7 A5= hpcode=25 width_inches=4.15 height_inches=5.85
Aliases can also be defined, such as
myA4=A4
The final configuration file, defprinter, just contains the name of the default printer.
PRINT(2 ) | Rev: Tue Mar 31 02:42:39 GMT 2015 |