Lines 197-204
NP_number_pens(int num_params, /* I
Link Here
|
197 |
|
197 |
|
198 |
if (num_params == 0) |
198 |
if (num_params == 0) |
199 |
PenCount = 8; |
199 |
PenCount = 8; |
200 |
else if (num_params == 1 && params[0].value.number <= 1024) |
200 |
else if (num_params == 1) |
201 |
PenCount = (int)params[0].value.number; |
201 |
{ |
|
|
202 |
if (params[0].value.number < 1 || params[0].value.number > MAX_PENS) |
203 |
{ |
204 |
fprintf(stderr, |
205 |
"DEBUG: HP-GL/2 \'NP\' command with invalid number of " |
206 |
"pens (%d)!\n", (int)params[0].value.number); |
207 |
PenCount = 8; |
208 |
} |
209 |
else |
210 |
PenCount = (int)params[0].value.number; |
211 |
} |
202 |
else |
212 |
else |
203 |
fprintf(stderr, |
213 |
fprintf(stderr, |
204 |
"DEBUG: HP-GL/2 \'NP\' command with invalid number of " |
214 |
"DEBUG: HP-GL/2 \'NP\' command with invalid number of " |
Lines 235-241
PC_pen_color(int num_params, /* I -
Link Here
|
235 |
|
245 |
|
236 |
if (num_params == 0) |
246 |
if (num_params == 0) |
237 |
{ |
247 |
{ |
238 |
for (i = 0; i <= PenCount; i ++) |
248 |
for (i = 0; i < PenCount; i ++) |
239 |
if (i < 8) |
249 |
if (i < 8) |
240 |
{ |
250 |
{ |
241 |
Pens[i].rgb[0] = standard_colors[i][0]; |
251 |
Pens[i].rgb[0] = standard_colors[i][0]; |
Lines 256-262
PC_pen_color(int num_params, /* I -
Link Here
|
256 |
} |
266 |
} |
257 |
else if (num_params == 1 || num_params == 4) |
267 |
else if (num_params == 1 || num_params == 4) |
258 |
{ |
268 |
{ |
259 |
i = (int)params[0].value.number; |
269 |
i = (int)params[0].value.number - 1; |
|
|
270 |
|
271 |
if (i < 0 || i >= PenCount) |
272 |
{ |
273 |
fprintf(stderr, |
274 |
"DEBUG: HP-GL/2 \'PC\' command with invalid pen (%d)!\n", i + 1); |
275 |
return; |
276 |
} |
260 |
|
277 |
|
261 |
if (num_params == 1) |
278 |
if (num_params == 1) |
262 |
{ |
279 |
{ |
Lines 330-336
PW_pen_width(int num_params, /* I -
Link Here
|
330 |
|
347 |
|
331 |
if (num_params == 2) |
348 |
if (num_params == 2) |
332 |
{ |
349 |
{ |
333 |
pen = (int)params[1].value.number; |
350 |
pen = (int)params[1].value.number - 1; |
|
|
351 |
|
352 |
if (pen < 0 || pen >= PenCount) |
353 |
{ |
354 |
fprintf(stderr, |
355 |
"DEBUG: HP-GL/2 \'PW\' command with invalid pen (%d)!\n", |
356 |
pen + 1); |
357 |
return; |
358 |
} |
334 |
|
359 |
|
335 |
Pens[pen].width = w; |
360 |
Pens[pen].width = w; |
336 |
|
361 |
|
Lines 345-351
PW_pen_width(int num_params, /* I -
Link Here
|
345 |
* Set width for all pens... |
370 |
* Set width for all pens... |
346 |
*/ |
371 |
*/ |
347 |
|
372 |
|
348 |
for (pen = 0; pen <= PenCount; pen ++) |
373 |
for (pen = 0; pen < PenCount; pen ++) |
349 |
Pens[pen].width = w; |
374 |
Pens[pen].width = w; |
350 |
|
375 |
|
351 |
if (PageDirty) |
376 |
if (PageDirty) |
Lines 399-412
SP_select_pen(int num_params, /* I -
Link Here
|
399 |
param_t *params) /* I - Parameters */ |
424 |
param_t *params) /* I - Parameters */ |
400 |
{ |
425 |
{ |
401 |
if (num_params == 0) |
426 |
if (num_params == 0) |
402 |
PenNumber = 1; |
427 |
PenNumber = 0; |
403 |
else if (params[0].value.number <= PenCount) |
428 |
else if (num_params > 1) |
404 |
PenNumber = (int)params[0].value.number; |
|
|
405 |
else |
406 |
fprintf(stderr, |
429 |
fprintf(stderr, |
407 |
"DEBUG: HP-GL/2 \'SP\' command with invalid number or value " |
430 |
"DEBUG: HP-GL/2 \'SP\' command with invalid number of parameters " |
408 |
"of parameters (%d, %d)!\n", num_params, |
431 |
"(%d)!\n", num_params); |
|
|
432 |
else if (params[0].value.number <= 0 || params[0].value.number >= PenCount) |
433 |
fprintf(stderr, "DEBUG: HP-GL/2 \'SP\' command with invalid pen (%d)!\n", |
409 |
(int)params[0].value.number); |
434 |
(int)params[0].value.number); |
|
|
435 |
else |
436 |
PenNumber = (int)params[0].value.number - 1; |
410 |
|
437 |
|
411 |
if (PageDirty) |
438 |
if (PageDirty) |
412 |
printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], |
439 |
printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], |