| 123 | */ |
| 124 | |
| 125 | int /* O - 0 on success, -1 on failure */ |
| 126 | _cupsRasterInterpretPPD( |
| 127 | cups_page_header2_t *h, /* O - Page header to create */ |
| 128 | ppd_file_t *ppd, /* I - PPD file */ |
| 129 | int num_options, /* I - Number of options */ |
| 130 | cups_option_t *options, /* I - Options */ |
| 131 | cups_interpret_cb_t func) /* I - Optional page header callback (@code NULL@ for none) */ |
| 132 | { |
| 133 | int status; /* Cumulative status */ |
| 134 | char *code; /* Code to run */ |
| 135 | const char *val; /* Option value */ |
| 136 | ppd_size_t *size; /* Current size */ |
| 137 | float left, /* Left position */ |
| 138 | bottom, /* Bottom position */ |
| 139 | right, /* Right position */ |
| 140 | top, /* Top position */ |
| 141 | temp1, temp2; /* Temporary variables for swapping */ |
| 142 | int preferred_bits; /* Preferred bits per color */ |
| 143 | |
| 144 | |
| 145 | /* |
| 146 | * Range check input... |
| 147 | */ |
| 148 | |
| 149 | _cupsRasterClearError(); |
| 150 | |
| 151 | if (!h) |
| 152 | { |
| 153 | _cupsRasterAddError("Page header cannot be NULL!\n"); |
| 154 | return (-1); |
| 155 | } |
| 156 | |
| 157 | /* |
| 158 | * Reset the page header to the defaults... |
| 159 | */ |
| 160 | |
| 161 | memset(h, 0, sizeof(cups_page_header2_t)); |
| 162 | |
| 163 | h->NumCopies = 1; |
| 164 | h->PageSize[0] = 612; |
| 165 | h->PageSize[1] = 792; |
| 166 | h->HWResolution[0] = 100; |
| 167 | h->HWResolution[1] = 100; |
| 168 | h->cupsBitsPerColor = 1; |
| 169 | h->cupsColorOrder = CUPS_ORDER_CHUNKED; |
| 170 | h->cupsColorSpace = CUPS_CSPACE_K; |
| 171 | h->cupsBorderlessScalingFactor = 1.0f; |
| 172 | h->cupsPageSize[0] = 612.0f; |
| 173 | h->cupsPageSize[1] = 792.0f; |
| 174 | h->cupsImagingBBox[0] = 0.0f; |
| 175 | h->cupsImagingBBox[1] = 0.0f; |
| 176 | h->cupsImagingBBox[2] = 612.0f; |
| 177 | h->cupsImagingBBox[3] = 792.0f; |
| 178 | |
| 179 | strlcpy(h->cupsPageSizeName, "Letter", sizeof(h->cupsPageSizeName)); |
| 180 | |
| 181 | #ifdef __APPLE__ |
| 182 | /* |
no test coverage detected