Sample Language Monitor

This section describes the sample PJL language monitor source code shipped with the Windows 95 DDK. The source code builds an executable named PJLMON.DLL, so the sample language monitor will be called PJLMON in this section.

After the Windows 95 DDK is installed, the sample language monitor source code is in the \%DDKROOT%\PRINTER\SAMPLES\SPOOLER\PJLMON directory.

The C source code modules and their header files that make up the sample language monitor PJLMON are identified and briefly described in the following table. If you are developing a different language monitor, suggestions on how you might use each of the modules are also in the following table. Note that an object module, PARSEPJL.OBJ, is also part of the sample language monitor. This object module parses the data read from the printer, using PJL language rules. PARSEPJL.OBJ is included in the sample language monitor directory to enable you to build the language monitor. When you develop the object module that parses the printer status language your printer uses, you will have to substitute it for PARSEPJL.OBJ when you build your language monitor.

Source Module Name/Description

Comment

PJLMON.C

Contains the InitializeMonitorEx and LibMain functions and all of the functions that InitializeMonitorEx puts pointers to in the MONITOR structure.

Contains two functions, CreateUstatusThread and UstatusThread, that manage the thread that handles unsolicited responses from the printer. The IsPJL and Find1284Key that determine if the printer connected to the port is bi-directional and if it is PJL-capable. Another interesting set of functions is ProcessPJLString, InterpretTokens, and ProcessParserError, which are the callers of the working parser functions in PARSEPJL.C.

UTILLM.C

Utility functions that provide memory allocation, string handling, semaphore management, and debugging services.

Contains a function that finds a particular PINIPORT structure in an array of such structures.

SPLTYPES.H

Header file for PJLMON.C

Defines the PINIPORT structure, which the sample language monitor uses to keep track of the status of the port being monitored. You may want to change the contents of this structure. This header file also defines PP_* constants which define the bit positions in the status member of the PINIPORT structure (port is open, sending data to the printer, PJL command was sent to printer, etc.).

LOCAL.H

Header file for UTILLM.C