daisyforms.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lpsched.h"
static int max_requests_needing_form_mounted ( FSTATUS * );
static int max_requests_needing_pwheel_mounted ( char * );
/**
** queue_form() - ADD A REQUEST TO A FORM QUEUE
**/
void
{
}
return;
}
/**
** unqueue_form() - REMOVE A REQUEST FROM A FORM QUEUE
**/
void
{
if (pfs) {
}
return;
}
/**
** queue_pwheel() - ADD A REQUEST TO A PRINT WHEEL QUEUE
**/
void
{
if (name) {
/*
* Don't bother queueing the request for
* a print wheel if this request is destined for
* only this printer and the printer doesn't take
* print wheels.
*/
if (
) {
}
}
return;
}
/**
** unqueue_pwheel() - REMOVE A REQUEST FROM A PRINT WHEEL QUEUE
**/
void
{
if (ppws) {
}
return;
}
/**
** check_form_alert() - CHECK CHANGES TO MOUNT FORM ALERT
**/
void
{
register short trigger,
fire_off_alert = 0;
int requests_waiting;
/*
* Call this routine whenever a requests has been queued
* or dequeued for a form, and whenever the form changes.
* If a pointer to a new _FORM is passed, the FSTATUS
* structure is updated with the changes. Use a second
* argument of 0 if no change.
*
* WARNING: It is valid to call this routine when adding
* a NEW form (not just changing it). Thus the members of
* the structure "pfs->form" may not be set.
* In this case, though, "pf" MUST be set, and there can
* be NO alert active.
*/
if (pf) {
trigger = 1;
} else
if (Starting)
goto Return;
/*
* Cancel an active alert if the number of requests queued
* has dropped below the threshold (or the threshold has been
* raised), or if the alert command or period has changed.
* In the latter case we'll reactive the alert later.
*/
else if (
&& (
)
)
/*
* If we still have the condition for an alert, we'll fire
* one off. It is possible the alert is still running, but
* that's okay. First, we may want to change the alert message;
* second, the "alert()" routine doesn't execute an alert
* if it is already running.
*/
fire_off_alert = 1;
/*
* Watch it! We may be adding a new form, so there
* may be nothing to toss out.
*/
}
/*
* Have to do this after updating the changes.
*/
if (fire_off_alert)
return;
}
/**
** check_pwheel_alert() - CHECK CHANGES TO MOUNT PRINTWHEEL ALERT
**/
void
{
register short trigger,
fire_off_alert = 0;
int requests_waiting;
/*
* Call this routine whenever a request has been queued
* or dequeued for a print-wheel, and whenever the print-wheel
* changes. If a pointer to a new PWHEEL is passed, the
* PWSTATUS structure is updated with the changes. Use a
* second argument of 0 if no change.
*
* WARNING: It is valid to call this routine when adding
* a NEW print wheel (not just changing it). Thus the members
* of the structure "ppws->pwheel" may not be set.
* In this case, though, "ppw" MUST be set, and there can
* be NO alert active.
*/
if (ppw) {
trigger = 1;
} else
if (Starting)
goto Return;
/*
* Cancel an active alert if the number of requests queued
* has dropped below the threshold (or the threshold has been
* raised), or if the alert command or period has changed.
* In the latter case we'll reactive the alert later.
*/
else if (
&& (
)
)
/*
* If we still have the condition for an alert, we'll fire
* one off. It is possible the alert is still running, but
* that's okay. First, we may want to change the alert message;
* second, the "alert()" routine doesn't execute an alert
* if it is already running.
*/
fire_off_alert = 1;
/*
* Watch it! We may be adding a new print wheel, so there
* may be nothing to toss out.
*/
}
/*
* Have to do this after updating the changes.
*/
if (fire_off_alert)
return;
}
static int
{
int i;
if (startingTray < 0)
startingTray = 0;
if (ppfs) {
return(i);
}
else if (!pfs)
/* no form request matches no form mounted */
return(0);
return(-1);
}
char *
{
int tray = 0;
char *ptr, *p;
int n;
else
p = "";
n = sizeof (trayList);
tray++;
}
*(ptr-1) = 0;
return(NULL);
}
int
{
}
int
{
}
/**
** max_requests_needing_form_mounted()
** max_requests_needing_pwheel_mounted()
**/
static int
{
int max = 0;
/*
* For each printer that doesn't have this form mounted,
* count the number of requests needing this form and
* assigned to the printer. Find the maximum across all such
* printers. Sorry, the code actually has a different loop
* (it steps through the requests) but the description of what
* happens below is easier to understand as given. (Looping
* through the printers would result in #printers x #requests
* steps, whereas this entails #requests steps.)
*/
if (NewRequest)
return (max);
}
static int
{
int max = 0;
/*
* For each printer that doesn't have this print-wheel mounted,
* count the number of requests needing this print-wheel and
* assigned to the printer. Find the maximum across all such
* printers. Sorry, the code actually has a different loop
* (it steps through the requests) but the description of what
* happens below is easier to understand as given. (Looping
* through the printers would result in #printers x #requests
* steps, whereas this entails #requests steps.)
*/
if (
)
if (NewRequest)
if (
)
return (max);
}
/**
** one_printer_with_charsets()
**/
int
{
/*
* This little function answers the question: Is a request
* that needs a character set destined for a particular
* printer that has selectable character sets instead of
* mountable print wheels?
*/
return (
);
}