Пример #1
0
DRIVER_ERROR LJColor::addJobSettings()
{
    cur_pcl_buffer_ptr += sprintf((char *) cur_pcl_buffer_ptr,
        "@PJL SET PAGEPROTECT=AUTO\012@PJL SET RESOLUTION=%d\012@PJL SET DENSITY=5\012", m_pQA->horizontal_resolution);
    if (m_pQA->print_quality == -1)
    {
        cur_pcl_buffer_ptr += sprintf((char *) cur_pcl_buffer_ptr,
        "@PJL SET RET=OFF\012@PJL SET ECONOMODE=ON\012");
    }
    if (m_pJA->e_duplex_mode != DUPLEXMODE_NONE)
    {
        cur_pcl_buffer_ptr += sprintf((char *) cur_pcl_buffer_ptr,
            "@PJL SET DUPLEX=ON\012@PJL SET BINDING=%s\012",
            (m_pJA->e_duplex_mode == DUPLEXMODE_BOOK) ? "LONGEDGE" :
                                                        "SHORTEDGE");
    }
    else
    {
        addToHeader("@PJL SET DUPLEX=OFF\012", 19);
    }
    cur_pcl_buffer_ptr += sprintf((char *) cur_pcl_buffer_ptr, "@PJL ENTER LANGUAGE=PCL\012");
    sendJobHeader();
    DRIVER_ERROR err = Cleanup();
    return err;
}
Пример #2
0
	FPTRLIST_INLINE bool FPtrList::FPtrListPrivate::insert(int nIndex, LPVOID pVal)
	{
		if (nIndex == 0)
		{
			return addToHeader(pVal);
		}
		else if (nIndex == m_nSize)
		{
			return addToLast(pVal);
		}
		
		if (!moveTo(nIndex)) return false;
		FASSERT(NULL != m_pCursor);

		FPtrList::FPtrListPrivate::FPTRLIST_NODE *pNode = new FPtrList::FPtrListPrivate::FPTRLIST_NODE;
		pNode->pPrevious = m_pCursor->pPrevious;
		pNode->pNext = m_pCursor;
		pNode->pList = this;
		pNode->pVal = pVal;

		m_pCursor->pPrevious->pNext = pNode;
		m_pCursor->pPrevious = pNode;

		m_nSize++;

		moveToHeader();

		return true;
	}
Пример #3
0
	FPTRLIST_INLINE bool FPtrList::FPtrListPrivate::addToLast(LPVOID pVal)
	{
		if (isEmpty())
		{
			return addToHeader(pVal);
		}

		FPtrList::FPtrListPrivate::FPTRLIST_NODE *pNode = new FPtrList::FPtrListPrivate::FPTRLIST_NODE;
		pNode->pPrevious = m_pLast;
		pNode->pNext = NULL;
		pNode->pList = this;
		pNode->pVal = pVal;

		if (NULL != m_pLast) m_pLast->pNext = pNode;
		m_pLast = pNode;

		m_nSize++;

		moveToHeader();

		return true;
	}
Пример #4
0
/*********************************************************************
// Name:  PostHeader
// Input:       1) return path
//              2) Subject
//              3) destination address
//              4) headers
// Output:      Error code or Success
// Description:
// Author/Date:  jcar 20/9/96
// History:
//********************************************************************/
static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders)
{
	/* Print message header according to RFC 822 */
	/* Return-path, Received, Date, From, Subject, Sender, To, cc */

	int res;
	char *header_buffer;
	char *headers_lc = NULL;
	size_t i;

	if (xheaders) {
		size_t headers_lc_len;

		headers_lc = estrdup(xheaders);
		headers_lc_len = strlen(headers_lc);

		for (i = 0; i < headers_lc_len; i++) {
			headers_lc[i] = tolower(headers_lc[i]);
		}
	}

	header_buffer = ecalloc(1, MAIL_BUFFER_SIZE);

	if (!xheaders || !strstr(headers_lc, "date:")) {
		time_t tNow = time(NULL);
		zend_string *dt = php_format_date("r", 1, tNow, 1);

		snprintf(header_buffer, MAIL_BUFFER_SIZE, "Date: %s\r\n", ZSTR_VAL(dt));
		zend_string_free(dt);
	}

	if (!headers_lc || !strstr(headers_lc, "from:")) {
		if (!addToHeader(&header_buffer, "From: %s\r\n", RPath)) {
			goto PostHeader_outofmem;
		}
	}
	if (!addToHeader(&header_buffer, "Subject: %s\r\n", Subject)) {
		goto PostHeader_outofmem;
	}

	/* Only add the To: field from the $to parameter if isn't in the custom headers */
	if ((headers_lc && (!strstr(headers_lc, "\r\nto:") && (strncmp(headers_lc, "to:", 3) != 0))) || !headers_lc) {
		if (!addToHeader(&header_buffer, "To: %s\r\n", mailTo)) {
			goto PostHeader_outofmem;
		}
	}
	if (xheaders) {
		if (!addToHeader(&header_buffer, "%s\r\n", xheaders)) {
			goto PostHeader_outofmem;
		}
	}

	if (headers_lc) {
		efree(headers_lc);
	}
	if ((res = Post(header_buffer)) != SUCCESS) {
		efree(header_buffer);
		return (res);
	}
	efree(header_buffer);

	if ((res = Post("\r\n")) != SUCCESS) {
		return (res);
	}

	return (SUCCESS);

PostHeader_outofmem:
	if (headers_lc) {
		efree(headers_lc);
	}
	return OUT_OF_MEMORY;
}
Пример #5
0
void LJColor::configureRasterData()
{

/*
 *  Configure image data - ESC*v#W - # = 6 bytes
 *  02 - RGB colorspace (00 - Device RGB)
 *  03 - Direct pixel
 *  08 - bits per index - ignored for direct pixel
 *  08, 08, 08 - bits per primary each
 */

    addToHeader ((const BYTE *) "\033*v6W\00\03\010\010\010\010", 11);

//  Continues tone dither
//  Logical operation - 0

    addToHeader ((const BYTE *) "\033*t18J", 6);

/*
 *  Driver Configuration Command - ESC*#W - # = 3 bytes
 *  device id - 6 = color HP LaserJet Printer
 *  func index - 4 = Select Colormap
 *  argument - 2   = Vivid Graphics
 */

    addToHeader ((const BYTE *) "\033*o3W\06\04\06", 8);

/*
 *  Program color palette entries
 */
    addToHeader ((const BYTE *) "\033*v255A\033*v255B\033*v255C\033*v0I", 26);
    addToHeader ((const BYTE *) "\033*v255A\033*v0B\033*v0C\033*v6I", 22);
    addToHeader ((const BYTE *) "\033*v0A\033*v255B\033*v0C\033*v5I", 22);
    addToHeader ((const BYTE *) "\033*v0A\033*v0B\033*v255C\033*v3I", 22);
    addToHeader ((const BYTE *) "\033*v255A\033*v255B\033*v0C\033*v4I", 24);
    addToHeader ((const BYTE *) "\033*v255A\033*v0B\033*v255C\033*v2I", 24);
    addToHeader ((const BYTE *) "\033*v0A\033*v255B\033*v255C\033*v1I", 24);
    addToHeader ((const BYTE *) "\033*v0A\033*v0B\033*v0C\033*v7I", 20);

//  Foreground color

    addToHeader ((const BYTE *) "\033*v7S", 5);
}