prn_parameters()

This function is called after prn_select() for any COD which expects parameters (a COD for which the call to prn_select() returned 1). The global variable prn_device contains the number of the currently selected COD.

The argument passed to this function is a null-terminated string sent by the application. It is the parameter string defined by you for the POD in DFSETUP. Remember that the application views output in terms of PODs and a POD is defined with an owner COD and a unique parameter definition. an OSDI uses COD identifiers together with POD parameter values.

The parameter string is intended to be used to control the COD and not to be printed. The interpretation of this string is entirely a matter for your code.

The string passed to prn_parameters() will end with either line-feed or carriage-return/line-feed depending on the printer characteristics set up in DFSETUP.

For our DP4 Till example the printer COD takes a parameter specifying the destination of the print text (slip or journal) and the character size:

 
/**/
 
void prn_parameters(text)
 
 char *text;
 
{
 int character_size;
 
 switch(prn_device)
 {  
  case 'P':
   /* Parameter defines what kind of till printer - slip is default */
   till_printer = text[0] == 'J' ? JOURNAL : SLIP;
 
   /* Second part is character size */
    character_size = text[1];
 
   if (!init_printer(till_printer, character_size))
          prn_error = till_printer == JOURNAL ?
     ERR_JOURNAL_INIT : ERR_SLIP_INIT; 
   break;
 
  default :
   break;
 }
}

Function init_printer() is operating-system dependent and therefore not shown. Note that the value of prn_error is set according to the type of initialisation failure. ERR_xxxxx are error definitions also known to the application (they are contained in an user-defined application-specific header file shared by the OSDI and application source).