w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

picttoppm.c
Go to the documentation of this file.
1 /*
2  * picttoppm.c -- convert a MacIntosh PICT file to PPM format.
3  *
4  * This program is normally part of the PBM+ utilities, but you
5  * can compile a slightly crippled version without PBM+ by
6  * defining STANDALONE (e.g., cc -DSTANDALONE picttoppm.c).
7  * However, if you want this you probably want PBM+ sooner or
8  * later so grab it now.
9  *
10  * Copyright 1989,1992,1993 George Phillips
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation for any purpose and without fee is hereby granted, provided
14  * that the above copyright notice appear in all copies and that both that
15  * copyright notice and this permission notice appear in supporting
16  * documentation. This software is provided "as is" without express or
17  * implied warranty.
18  *
19  * George Phillips <phillips@cs.ubc.ca>
20  * Department of Computer Science
21  * University of British Columbia
22  *
23  * $Id: picttoppm.c,v 1.7 1993/10/26 22:40:31 phillips Exp phillips $
24  */
25 
26 #ifdef STANDALONE
27 
28 #include <stdio.h>
29 #ifdef __STDC__
30 #define ARGS(x) x
31 #else
32 #define ARGS(x) ()
33 #endif /* __STDC__ */
34 #define PPM_ASSIGN(p, R, G, B) (p).r = R; (p).g = G; (p).b = B
35 #define max(x, y) ((x) > (y) ? (x) : (y))
36 #define min(x, y) ((x) < (y) ? (x) : (y))
37 typedef unsigned char pixval;
38 typedef struct { pixval r, g, b; } pixel;
39 void ppm_init();
40 FILE* pm_openr();
41 void pm_usage();
42 void pm_message();
43 void pm_error();
44 int pm_keymatch();
45 void ppm_writeppminit();
46 void ppm_writeppmrow();
47 void pm_close();
49 
50 #else
51 
52 #include <string.h>
53 #include "ppm.h"
54 
55 #endif /* STANDALONE */
56 
57 #include "pbmfont.h"
58 
59 /*
60  * Typical byte, 2 byte and 4 byte integers.
61  */
62 typedef unsigned char byte;
63 typedef char signed_byte; /* XXX */
64 typedef unsigned short word;
65 typedef unsigned long longword;
66 
67 /*
68  * Data structures for QuickDraw (and hence PICT) stuff.
69  */
70 
71 struct Rect {
76 };
77 
78 struct pixMap {
79  struct Rect Bounds;
92 };
93 
94 struct RGBColour {
98 };
99 
100 struct Point {
103 };
104 
105 struct Pattern {
106  byte pix[64];
107 };
108 
109 typedef void (*transfer_func) ARGS(( struct RGBColour* src, struct RGBColour* dst ));
110 
111 static char* stage;
112 static struct Rect picFrame;
113 static word* red;
114 static word* green;
115 static word* blue;
116 static word rowlen;
117 static word collen;
119 static int verbose;
120 static int fullres;
121 static int recognize_comment;
122 
123 static struct RGBColour black = { 0, 0, 0 };
124 static struct RGBColour white = { 0xffff, 0xffff, 0xffff };
125 
126 /* various bits of drawing state */
127 static struct RGBColour foreground = { 0, 0, 0 };
128 static struct RGBColour background = { 0xffff, 0xffff, 0xffff };
129 static struct RGBColour op_colour;
130 static struct Pattern bkpat;
131 static struct Pattern fillpat;
132 static struct Rect clip_rect;
133 static struct Rect cur_rect;
134 static struct Point current;
135 static struct Pattern pen_pat;
138 static word pen_mode;
141 static byte text_face;
145 static struct font* tfont;
146 
147 /* state for magic printer comments */
148 static int ps_text;
149 static byte ps_just;
150 static byte ps_flip;
152 static byte ps_linespace;
153 static int ps_cent_x;
154 static int ps_cent_y;
155 static int ps_cent_set;
156 
157 struct opdef {
158  char* name;
159  int len;
160  void (*impl) ARGS((int));
161  char* description;
162 };
163 
164 struct blit_info {
165  struct Rect srcRect;
166  struct Rect srcBounds;
167  int srcwid;
168  byte* srcplane;
169  int pixSize;
170  struct Rect dstRect;
172  int mode;
173  struct blit_info* next;
174 };
175 
176 static struct blit_info* blit_list = 0;
177 static struct blit_info** last_bl = &blit_list;
178 
179 #define WORD_LEN (-1)
180 
181 static void interpret_pict ARGS(( void ));
182 static void alloc_planes ARGS(( void ));
183 static void compact_plane ARGS(( word* plane, int planelen ));
184 static void output_ppm ARGS(( int version ));
185 static void Opcode_9A ARGS(( int version ));
186 static void BitsRect ARGS(( int version ));
187 static void BitsRegion ARGS(( int version ));
188 static void do_bitmap ARGS(( int version, int rowBytes, int is_region ));
189 static void do_pixmap ARGS(( int version, word rowBytes, int is_region ));
190 static transfer_func transfer ARGS(( int ));
191 static void draw_pixel ARGS (( int, int, struct RGBColour*, transfer_func ));
192 static int blit ARGS((
193  struct Rect* srcRect, struct Rect* srcBounds, int srcwid, byte* srcplane,
194  int pixSize, struct Rect* dstRect, struct Rect* dstBounds, int dstwid,
195  struct RGBColour* colour_map, int mode ));
196 static struct blit_info* add_blit_list ARGS(( void ));
197 static void do_blits ARGS(( void ));
198 static byte* unpackbits ARGS(( struct Rect* bounds, word rowBytes, int pixelSize ));
199 static byte* expand_buf ARGS(( byte* buf, int* len, int bits_per_pixel ));
200 static void Clip ARGS(( int version ));
201 static void read_pixmap ARGS(( struct pixMap* p, word* rowBytes ));
202 static struct RGBColour* read_colour_table ARGS(( void ));
203 static void BkPixPat ARGS(( int version ));
204 static void PnPixPat ARGS(( int version ));
205 static void FillPixPat ARGS(( int version ));
206 static void read_pattern ARGS(( void ));
207 static void read_8x8_pattern ARGS(( struct Pattern* ));
208 static void BkPat ARGS(( int version ));
209 static void PnPat ARGS(( int version ));
210 static void FillPat ARGS(( int version ));
211 static void PnSize ARGS(( int version ));
212 static void PnMode ARGS(( int version ));
213 static void OpColor ARGS(( int version ));
214 static void RGBFgCol ARGS(( int version ));
215 static void RGBBkCol ARGS(( int version ));
216 
217 static void Line ARGS(( int version ));
218 static void LineFrom ARGS(( int version ));
219 static void ShortLine ARGS(( int version ));
220 static void ShortLineFrom ARGS(( int version ));
221 
222 static void PnLocHFrac ARGS(( int version ));
223 static void TxFont ARGS(( int version ));
224 static void TxFace ARGS(( int version ));
225 static void TxMode ARGS(( int version ));
226 static void TxSize ARGS(( int version ));
227 static void skip_text ARGS(( void ));
228 static void LongText ARGS(( int version ));
229 static void DHText ARGS(( int version ));
230 static void DVText ARGS(( int version ));
231 static void DHDVText ARGS(( int version ));
232 static void do_text ARGS(( word x, word y ));
233 static void do_ps_text ARGS(( word x, word y ));
234 static void rotate ARGS(( int* x, int* y));
235 static void skip_poly_or_region ARGS(( int version ));
236 static void LongComment ARGS(( int version ));
237 static void ShortComment ARGS(( int version ));
238 
239 static int rectwidth ARGS(( struct Rect* r ));
240 static int rectheight ARGS(( struct Rect* r ));
241 static int rectsamesize ARGS(( struct Rect* r1, struct Rect* r2 ));
242 static void rectinter ARGS(( struct Rect* r1, struct Rect* r2, struct Rect* r3 ));
243 static void rectscale ARGS(( struct Rect* r, double xscale, double yscale ));
244 
245 static void read_rect ARGS(( struct Rect* r ));
246 static void dump_rect ARGS(( char* s, struct Rect* r ));
247 
248 static void do_paintRect ARGS(( struct Rect* r ));
249 static void paintRect ARGS(( int version ));
250 static void paintSameRect ARGS(( int version ));
251 static void do_frameRect ARGS(( struct Rect* r ));
252 static void frameRect ARGS(( int version ));
253 static void frameSameRect ARGS(( int version ));
254 static void paintPoly ARGS(( int version ));
255 
256 static word get_op ARGS(( int version ));
257 
258 static longword read_long ARGS(( void ));
259 static word read_word ARGS(( void ));
260 static byte read_byte ARGS(( void ));
261 static signed_byte read_signed_byte ARGS(( void ));
262 
263 static void skip ARGS(( int n ));
264 static void read_n ARGS(( int n, char* buf ));
265 
266 static struct font* get_font ARGS(( int font, int size, int style ));
267 
268 static int load_fontdir ARGS((char *file));
269 static void read_rgb ARGS((struct RGBColour *rgb));
270 static void draw_pen_rect ARGS((struct Rect *r));
271 static void draw_pen ARGS((int x, int y));
272 static void read_point ARGS((struct Point *p));
273 static void read_short_point ARGS((struct Point *p));
274 static void scan_line ARGS((short x1, short y1, short x2, short y2));
275 static void scan_poly ARGS((int np, struct Point pts[]));
276 static void poly_sort ARGS((int sort_index, struct Point points[]));
277 static void picComment ARGS((word type, int length));
278 static int abs_value ARGS((int x));
279 /*
280  * a table of the first 194(?) opcodes. The table is too empty.
281  *
282  * Probably could use an entry specifying if the opcode is valid in version
283  * 1, etc.
284  */
285 
286 /* for reserved opcodes of known length */
287 #define res(length) \
288 { "reserved", (length), NULL, "reserved for Apple use" }
289 
290 /* for reserved opcodes of length determined by a function */
291 #define resf(skipfunction) \
292 { "reserved", NA, (skipfunction), "reserved for Apple use" }
293 
294 /* seems like RGB colours are 6 bytes, but Apple says they're variable */
295 /* I'll use 6 for now as I don't care that much. */
296 #define RGB_LEN (6)
297 
298 #define NA (0)
299 
300 static struct opdef optable[] = {
301 /* 0x00 */ { "NOP", 0, NULL, "nop" },
302 /* 0x01 */ { "Clip", NA, Clip, "clip" },
303 /* 0x02 */ { "BkPat", 8, BkPat, "background pattern" },
304 /* 0x03 */ { "TxFont", 2, TxFont, "text font (word)" },
305 /* 0x04 */ { "TxFace", 1, TxFace, "text face (byte)" },
306 /* 0x05 */ { "TxMode", 2, TxMode, "text mode (word)" },
307 /* 0x06 */ { "SpExtra", 4, NULL, "space extra (fixed point)" },
308 /* 0x07 */ { "PnSize", 4, PnSize, "pen size (point)" },
309 /* 0x08 */ { "PnMode", 2, PnMode, "pen mode (word)" },
310 /* 0x09 */ { "PnPat", 8, PnPat, "pen pattern" },
311 /* 0x0a */ { "FillPat", 8, FillPat, "fill pattern" },
312 /* 0x0b */ { "OvSize", 4, NULL, "oval size (point)" },
313 /* 0x0c */ { "Origin", 4, NULL, "dh, dv (word)" },
314 /* 0x0d */ { "TxSize", 2, TxSize, "text size (word)" },
315 /* 0x0e */ { "FgColor", 4, NULL, "foreground color (longword)" },
316 /* 0x0f */ { "BkColor", 4, NULL, "background color (longword)" },
317 /* 0x10 */ { "TxRatio", 8, NULL, "numerator (point), denominator (point)" },
318 /* 0x11 */ { "Version", 1, NULL, "version (byte)" },
319 /* 0x12 */ { "BkPixPat", NA, BkPixPat, "color background pattern" },
320 /* 0x13 */ { "PnPixPat", NA, PnPixPat, "color pen pattern" },
321 /* 0x14 */ { "FillPixPat", NA, FillPixPat, "color fill pattern" },
322 /* 0x15 */ { "PnLocHFrac", 2, PnLocHFrac, "fractional pen position" },
323 /* 0x16 */ { "ChExtra", 2, NULL, "extra for each character" },
324 /* 0x17 */ res(0),
325 /* 0x18 */ res(0),
326 /* 0x19 */ res(0),
327 /* 0x1a */ { "RGBFgCol", RGB_LEN, RGBFgCol, "RGB foreColor" },
328 /* 0x1b */ { "RGBBkCol", RGB_LEN, RGBBkCol, "RGB backColor" },
329 /* 0x1c */ { "HiliteMode", 0, NULL, "hilite mode flag" },
330 /* 0x1d */ { "HiliteColor", RGB_LEN, NULL, "RGB hilite color" },
331 /* 0x1e */ { "DefHilite", 0, NULL, "Use default hilite color" },
332 /* 0x1f */ { "OpColor", NA, OpColor, "RGB OpColor for arithmetic modes" },
333 /* 0x20 */ { "Line", 8, Line, "pnLoc (point), newPt (point)" },
334 /* 0x21 */ { "LineFrom", 4, LineFrom, "newPt (point)" },
335 /* 0x22 */ { "ShortLine", 6, ShortLine, "pnLoc (point, dh, dv (-128 .. 127))" },
336 /* 0x23 */ { "ShortLineFrom", 2, ShortLineFrom, "dh, dv (-128 .. 127)" },
337 /* 0x24 */ res(WORD_LEN),
338 /* 0x25 */ res(WORD_LEN),
339 /* 0x26 */ res(WORD_LEN),
340 /* 0x27 */ res(WORD_LEN),
341 /* 0x28 */ { "LongText", NA, LongText, "txLoc (point), count (0..255), text" },
342 /* 0x29 */ { "DHText", NA, DHText, "dh (0..255), count (0..255), text" },
343 /* 0x2a */ { "DVText", NA, DVText, "dv (0..255), count (0..255), text" },
344 /* 0x2b */ { "DHDVText", NA, DHDVText, "dh, dv (0..255), count (0..255), text" },
345 /* 0x2c */ res(WORD_LEN),
346 /* 0x2d */ res(WORD_LEN),
347 /* 0x2e */ res(WORD_LEN),
348 /* 0x2f */ res(WORD_LEN),
349 /* 0x30 */ { "frameRect", 8, frameRect, "rect" },
350 /* 0x31 */ { "paintRect", 8, paintRect, "rect" },
351 /* 0x32 */ { "eraseRect", 8, NULL, "rect" },
352 /* 0x33 */ { "invertRect", 8, NULL, "rect" },
353 /* 0x34 */ { "fillRect", 8, NULL, "rect" },
354 /* 0x35 */ res(8),
355 /* 0x36 */ res(8),
356 /* 0x37 */ res(8),
357 /* 0x38 */ { "frameSameRect", 0, frameSameRect, "rect" },
358 /* 0x39 */ { "paintSameRect", 0, paintSameRect, "rect" },
359 /* 0x3a */ { "eraseSameRect", 0, NULL, "rect" },
360 /* 0x3b */ { "invertSameRect", 0, NULL, "rect" },
361 /* 0x3c */ { "fillSameRect", 0, NULL, "rect" },
362 /* 0x3d */ res(0),
363 /* 0x3e */ res(0),
364 /* 0x3f */ res(0),
365 /* 0x40 */ { "frameRRect", 8, NULL, "rect" },
366 /* 0x41 */ { "paintRRect", 8, NULL, "rect" },
367 /* 0x42 */ { "eraseRRect", 8, NULL, "rect" },
368 /* 0x43 */ { "invertRRect", 8, NULL, "rect" },
369 /* 0x44 */ { "fillRRrect", 8, NULL, "rect" },
370 /* 0x45 */ res(8),
371 /* 0x46 */ res(8),
372 /* 0x47 */ res(8),
373 /* 0x48 */ { "frameSameRRect", 0, NULL, "rect" },
374 /* 0x49 */ { "paintSameRRect", 0, NULL, "rect" },
375 /* 0x4a */ { "eraseSameRRect", 0, NULL, "rect" },
376 /* 0x4b */ { "invertSameRRect", 0, NULL, "rect" },
377 /* 0x4c */ { "fillSameRRect", 0, NULL, "rect" },
378 /* 0x4d */ res(0),
379 /* 0x4e */ res(0),
380 /* 0x4f */ res(0),
381 /* 0x50 */ { "frameOval", 8, NULL, "rect" },
382 /* 0x51 */ { "paintOval", 8, NULL, "rect" },
383 /* 0x52 */ { "eraseOval", 8, NULL, "rect" },
384 /* 0x53 */ { "invertOval", 8, NULL, "rect" },
385 /* 0x54 */ { "fillOval", 8, NULL, "rect" },
386 /* 0x55 */ res(8),
387 /* 0x56 */ res(8),
388 /* 0x57 */ res(8),
389 /* 0x58 */ { "frameSameOval", 0, NULL, "rect" },
390 /* 0x59 */ { "paintSameOval", 0, NULL, "rect" },
391 /* 0x5a */ { "eraseSameOval", 0, NULL, "rect" },
392 /* 0x5b */ { "invertSameOval", 0, NULL, "rect" },
393 /* 0x5c */ { "fillSameOval", 0, NULL, "rect" },
394 /* 0x5d */ res(0),
395 /* 0x5e */ res(0),
396 /* 0x5f */ res(0),
397 /* 0x60 */ { "frameArc", 12, NULL, "rect, startAngle, arcAngle" },
398 /* 0x61 */ { "paintArc", 12, NULL, "rect, startAngle, arcAngle" },
399 /* 0x62 */ { "eraseArc", 12, NULL, "rect, startAngle, arcAngle" },
400 /* 0x63 */ { "invertArc", 12, NULL, "rect, startAngle, arcAngle" },
401 /* 0x64 */ { "fillArc", 12, NULL, "rect, startAngle, arcAngle" },
402 /* 0x65 */ res(12),
403 /* 0x66 */ res(12),
404 /* 0x67 */ res(12),
405 /* 0x68 */ { "frameSameArc", 4, NULL, "rect, startAngle, arcAngle" },
406 /* 0x69 */ { "paintSameArc", 4, NULL, "rect, startAngle, arcAngle" },
407 /* 0x6a */ { "eraseSameArc", 4, NULL, "rect, startAngle, arcAngle" },
408 /* 0x6b */ { "invertSameArc", 4, NULL, "rect, startAngle, arcAngle" },
409 /* 0x6c */ { "fillSameArc", 4, NULL, "rect, startAngle, arcAngle" },
410 /* 0x6d */ res(4),
411 /* 0x6e */ res(4),
412 /* 0x6f */ res(4),
413 /* 0x70 */ { "framePoly", NA, skip_poly_or_region, "poly" },
414 /* 0x71 */ { "paintPoly", NA, paintPoly, "poly" },
415 /* 0x72 */ { "erasePoly", NA, skip_poly_or_region, "poly" },
416 /* 0x73 */ { "invertPoly", NA, skip_poly_or_region, "poly" },
417 /* 0x74 */ { "fillPoly", NA, skip_poly_or_region, "poly" },
418 /* 0x75 */ resf(skip_poly_or_region),
419 /* 0x76 */ resf(skip_poly_or_region),
420 /* 0x77 */ resf(skip_poly_or_region),
421 /* 0x78 */ { "frameSamePoly", 0, NULL, "poly (NYI)" },
422 /* 0x79 */ { "paintSamePoly", 0, NULL, "poly (NYI)" },
423 /* 0x7a */ { "eraseSamePoly", 0, NULL, "poly (NYI)" },
424 /* 0x7b */ { "invertSamePoly", 0, NULL, "poly (NYI)" },
425 /* 0x7c */ { "fillSamePoly", 0, NULL, "poly (NYI)" },
426 /* 0x7d */ res(0),
427 /* 0x7e */ res(0),
428 /* 0x7f */ res(0),
429 /* 0x80 */ { "frameRgn", NA, skip_poly_or_region, "region" },
430 /* 0x81 */ { "paintRgn", NA, skip_poly_or_region, "region" },
431 /* 0x82 */ { "eraseRgn", NA, skip_poly_or_region, "region" },
432 /* 0x83 */ { "invertRgn", NA, skip_poly_or_region, "region" },
433 /* 0x84 */ { "fillRgn", NA, skip_poly_or_region, "region" },
434 /* 0x85 */ resf(skip_poly_or_region),
435 /* 0x86 */ resf(skip_poly_or_region),
436 /* 0x87 */ resf(skip_poly_or_region),
437 /* 0x88 */ { "frameSameRgn", 0, NULL, "region (NYI)" },
438 /* 0x89 */ { "paintSameRgn", 0, NULL, "region (NYI)" },
439 /* 0x8a */ { "eraseSameRgn", 0, NULL, "region (NYI)" },
440 /* 0x8b */ { "invertSameRgn", 0, NULL, "region (NYI)" },
441 /* 0x8c */ { "fillSameRgn", 0, NULL, "region (NYI)" },
442 /* 0x8d */ res(0),
443 /* 0x8e */ res(0),
444 /* 0x8f */ res(0),
445 /* 0x90 */ { "BitsRect", NA, BitsRect, "copybits, rect clipped" },
446 /* 0x91 */ { "BitsRgn", NA, BitsRegion, "copybits, rgn clipped" },
447 /* 0x92 */ res(WORD_LEN),
448 /* 0x93 */ res(WORD_LEN),
449 /* 0x94 */ res(WORD_LEN),
450 /* 0x95 */ res(WORD_LEN),
451 /* 0x96 */ res(WORD_LEN),
452 /* 0x97 */ res(WORD_LEN),
453 /* 0x98 */ { "PackBitsRect", NA, BitsRect, "packed copybits, rect clipped" },
454 /* 0x99 */ { "PackBitsRgn", NA, BitsRegion, "packed copybits, rgn clipped" },
455 /* 0x9a */ { "Opcode_9A", NA, Opcode_9A, "the mysterious opcode 9A" },
456 /* 0x9b */ res(WORD_LEN),
457 /* 0x9c */ res(WORD_LEN),
458 /* 0x9d */ res(WORD_LEN),
459 /* 0x9e */ res(WORD_LEN),
460 /* 0x9f */ res(WORD_LEN),
461 /* 0xa0 */ { "ShortComment", 2, ShortComment, "kind (word)" },
462 /* 0xa1 */ { "LongComment", NA, LongComment, "kind (word), size (word), data" }
463 };
464 
465 struct const_name {
466  int value;
467  char* name;
468 };
469 
470 static char* const_name ARGS(( struct const_name* table, int ct));
471 
472 struct const_name transfer_name[] = {
473  { 0, "srcCopy" },
474  { 1, "srcOr" },
475  { 2, "srcXor" },
476  { 3, "srcBic" },
477  { 4, "notSrcCopy" },
478  { 5, "notSrcOr" },
479  { 6, "notSrcXor" },
480  { 7, "notSrcBic" },
481  { 32, "blend" },
482  { 33, "addPin" },
483  { 34, "addOver" },
484  { 35, "subPin" },
485  { 36, "transparent" },
486  { 37, "adMax" },
487  { 38, "subOver" },
488  { 39, "adMin" },
489  { -1, 0 }
490 };
491 
492 struct const_name font_name[] = {
493  { 0, "systemFont" },
494  { 1, "applFont" },
495  { 2, "newYork" },
496  { 3, "geneva" },
497  { 4, "monaco" },
498  { 5, "venice" },
499  { 6, "london" },
500  { 7, "athens" },
501  { 8, "sanFran" },
502  { 9, "toronto" },
503  { 11, "cairo" },
504  { 12, "losAngeles" },
505  { 20, "times" },
506  { 21, "helvetica" },
507  { 22, "courier" },
508  { 23, "symbol" },
509  { 24, "taliesin" },
510  { -1, 0 }
511 };
512 
513 struct const_name ps_just_name[] = {
514  { 0, "no" },
515  { 1, "left" },
516  { 2, "center" },
517  { 3, "right" },
518  { 4, "full" },
519  { -1, 0 }
520 };
521 
522 struct const_name ps_flip_name[] = {
523  { 0, "no" },
524  { 1, "horizontal" },
525  { 2, "vertical" },
526  { -1, 0 }
527 };
528 
529 #define FNT_BOLD (1)
530 #define FNT_ITALIC (2)
531 #define FNT_ULINE (4)
532 #define FNT_OUTLINE (8)
533 #define FNT_SHADOW (16)
534 #define FNT_CONDENSE (32)
535 #define FNT_EXTEND (64)
536 
537 static int align = 0;
538 static FILE* ifp;
539 
540 int
542 int argc;
543 char* argv[];
544 {
545  int argn;
546  int header;
547  char* usage =
548 "[-verbose] [-fullres] [-noheader] [-quickdraw] [-fontdir file] [pictfile]";
549 
550  ppm_init( &argc, argv );
551 
552  argn = 1;
553  verbose = 0;
554  fullres = 0;
555  header = 1;
556  recognize_comment = 1;
557 
558  while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') {
559  if (pm_keymatch(argv[argn], "-verbose", 2))
560  verbose++;
561  else if (pm_keymatch(argv[argn], "-fullres", 3))
562  fullres = 1;
563  else if (pm_keymatch(argv[argn], "-noheader", 2))
564  header = 0;
565  else if (pm_keymatch(argv[argn], "-quickdraw", 2))
566  recognize_comment = 0;
567  else if (pm_keymatch(argv[argn], "-fontdir", 3)) {
568  argn++;
569  if (!argv[argn])
570  pm_usage(usage);
571  else
573  }
574  else
575  pm_usage(usage);
576  ++argn;
577  }
578 
579  if (load_fontdir("fontdir") < 0)
580  pm_message("warning: can't load font directory 'fontdir'\n", 0,0,0,0);
581 
582  if (argn < argc) {
583  ifp = pm_openr(argv[argn]);
584  ++argn;
585  } else
586  ifp = stdin;
587 
588  if (argn != argc)
589  pm_usage(usage);
590 
591  if (header) {
592  stage = "Reading 512 byte header";
593  skip(512);
594  }
595 
596  interpret_pict();
597  exit(0);
598 }
599 
600 static void
602 {
603  byte ch;
604  word picSize;
605  word opcode;
606  word len;
607  int version;
608  int i;
609 
610  for (i = 0; i < 64; i++)
611  pen_pat.pix[i] = bkpat.pix[i] = fillpat.pix[i] = 1;
612  pen_width = pen_height = 1;
613  pen_mode = 0; /* srcCopy */
615  text_mode = 0; /* srcCopy */
617 
618  stage = "Reading picture size";
619  picSize = read_word();
620 
621  if (verbose)
622  pm_message("picture size = %d (0x%x)", picSize, picSize, 0, 0, 0);
623 
624  stage = "reading picture frame";
626 
627  if (verbose) {
628  dump_rect("Picture frame:", &picFrame);
629  pm_message("Picture size is %d x %d",
631  picFrame.bottom - picFrame.top, 0, 0, 0);
632  }
633 
634  if (!fullres)
635  alloc_planes();
636 
637  while ((ch = read_byte()) == 0)
638  ;
639  if (ch != 0x11)
640  pm_error("No version number");
641 
642  switch (read_byte()) {
643  case 1:
644  version = 1;
645  break;
646  case 2:
647  if (read_byte() != 0xff)
648  pm_error("can only do version 2, subcode 0xff");
649  version = 2;
650  break;
651  default:
652  pm_error("Unknown version");
653  }
654 
655  if (verbose)
656  pm_message("PICT version %d", version, 0, 0, 0, 0);
657 
658  while((opcode = get_op(version)) != 0xff) {
659  if (opcode < 0xa2) {
660  if (verbose) {
662  if (!strcmp(stage, "reserved"))
663  pm_message("reserved opcode=0x%x", opcode, 0, 0, 0, 0);
664  else
665  pm_message("%s", stage = optable[opcode].name, 0, 0, 0, 0);
666  }
667 
668  if (optable[opcode].impl != NULL)
669  (*optable[opcode].impl)(version);
670  else if (optable[opcode].len >= 0)
672  else switch (optable[opcode].len) {
673  case WORD_LEN:
674  len = read_word();
675  skip(len);
676  break;
677  default:
678  pm_error("can't do length of %d",
679  optable[opcode].len);
680  }
681  }
682  else if (opcode == 0xc00) {
683  if (verbose)
684  pm_message("HeaderOp", 0, 0, 0, 0, 0);
685  stage = "HeaderOp";
686  skip(24);
687  }
688  else if (opcode >= 0xa2 && opcode <= 0xaf) {
689  stage = "skipping reserved";
690  if (verbose)
691  pm_message("%s 0x%x", stage, opcode, 0, 0, 0);
692  skip(read_word());
693  }
694  else if (opcode >= 0xb0 && opcode <= 0xcf) {
695  /* just a reserved opcode, no data */
696  if (verbose)
697  pm_message("reserved 0x%x", opcode, 0, 0, 0);
698  }
699  else if (opcode >= 0xd0 && opcode <= 0xfe) {
700  stage = "skipping reserved";
701  if (verbose)
702  pm_message("%s 0x%x", stage, opcode, 0, 0, 0);
703  skip(read_long());
704  }
705  else if (opcode >= 0x100 && opcode <= 0x7fff) {
706  stage = "skipping reserved";
707  if (verbose)
708  pm_message("%s 0x%x", stage, opcode, 0, 0, 0);
709  skip((opcode >> 7) & 255);
710  }
711  else if (opcode >= 0x8000 && opcode <= 0x80ff) {
712  /* just a reserved opcode */
713  if (verbose)
714  pm_message("reserved 0x%x", opcode, 0, 0, 0, 0);
715  }
716  else if (opcode >= 8100 && opcode <= 0xffff) {
717  stage = "skipping reserved";
718  if (verbose)
719  pm_message("%s 0x%x", stage, opcode, 0, 0, 0);
720  skip(read_long());
721  }
722  else
723  pm_error("can't handle opcode of %x", opcode);
724  }
726 }
727 
728 /* allocation is same for version 1 or version 2. We are super-duper
729  * wasteful of memory for version 1 picts. Someday, we'll separate
730  * things and only allocate a byte per pixel for version 1 (or heck,
731  * even only a bit, but that would require even more extra work).
732  */
733 
734 static void alloc_planes()
735 {
738 
743 
744  planelen = rowlen * collen;
745  if ((red = (word*)malloc(planelen * sizeof(word))) == NULL ||
746  (green = (word*)malloc(planelen * sizeof(word))) == NULL ||
747  (blue = (word*)malloc(planelen * sizeof(word))) == NULL)
748  {
749 
750  pm_error("not enough memory to hold picture");
751  }
752  /* initialize background to white */
753  memset(red, 255, planelen * sizeof(word));
754  memset(green, 255, planelen * sizeof(word));
755  memset(blue, 255, planelen * sizeof(word));
756 }
757 
758 static void
760 register word* plane;
761 register int planelen;
762 {
763  register byte* p;
764 
765  for (p = (byte*)plane; planelen-- > 0; )
766  *p++ = (*plane++ >> 8) & 255;
767 }
768 
769 static void
771 int version;
772 {
773  int width;
774  int height;
775  register char* r;
776  register char* g;
777  register char* b;
778  pixel* pixelrow;
779  register pixel* pP;
780  int row;
781  register int col;
782 
783  if (fullres)
784  do_blits();
785 
786  stage = "writing PPM";
787 
790  r = (char*) red;
792  g = (char*) green;
794  b = (char*) blue;
796 
797  ppm_writeppminit(stdout, width, height, (pixval) 255, 0 );
799  for (row = 0; row < height; ++row) {
800  for (col = 0, pP = pixelrow; col < width;
801  ++col, ++pP, ++r, ++g, ++b) {
802  PPM_ASSIGN(*pP, *r, *g, *b);
803  }
804 
806  }
807  pm_close(stdout);
808 }
809 
810 static void
812 {
813  struct blit_info* bi;
814  int srcwidth, dstwidth, srcheight, dstheight;
815  double scale, scalelow, scalehigh;
816  double xscale = 1.0;
817  double yscale = 1.0;
818  double lowxscale, highxscale, lowyscale, highyscale;
819  int xscalecalc = 0, yscalecalc = 0;
820 
821  if (!blit_list) return;
822 
823  fullres = 0;
824 
825  for (bi = blit_list; bi; bi = bi->next) {
826  srcwidth = rectwidth(&bi->srcRect);
827  dstwidth = rectwidth(&bi->dstRect);
828  srcheight = rectheight(&bi->srcRect);
829  dstheight = rectheight(&bi->dstRect);
830  if (srcwidth > dstwidth) {
831  scalelow = (double)(srcwidth ) / (double)dstwidth;
832  scalehigh = (double)(srcwidth + 1.0) / (double)dstwidth;
833  switch (xscalecalc) {
834  case 0:
835  lowxscale = scalelow;
836  highxscale = scalehigh;
837  xscalecalc = 1;
838  break;
839  case 1:
840  if (scalelow < highxscale && scalehigh > lowxscale) {
841  if (scalelow > lowxscale) lowxscale = scalelow;
842  if (scalehigh < highxscale) highxscale = scalehigh;
843  }
844  else {
845  scale = (lowxscale + highxscale) / 2.0;
846  xscale = (double)srcwidth / (double)dstwidth;
847  if (scale > xscale) xscale = scale;
848  xscalecalc = 2;
849  }
850  break;
851  case 2:
852  scale = (double)srcwidth / (double)dstwidth;
853  if (scale > xscale) xscale = scale;
854  break;
855  }
856  }
857 
858  if (srcheight > dstheight) {
859  scalelow = (double)(srcheight ) / (double)dstheight;
860  scalehigh = (double)(srcheight + 1.0) / (double)dstheight;
861  switch (yscalecalc) {
862  case 0:
863  lowyscale = scalelow;
864  highyscale = scalehigh;
865  yscalecalc = 1;
866  break;
867  case 1:
868  if (scalelow < highyscale && scalehigh > lowyscale) {
869  if (scalelow > lowyscale) lowyscale = scalelow;
870  if (scalehigh < highyscale) highyscale = scalehigh;
871  }
872  else {
873  scale = (lowyscale + highyscale) / 2.0;
874  yscale = (double)srcheight / (double)dstheight;
875  if (scale > yscale) yscale = scale;
876  yscalecalc = 2;
877  }
878  break;
879  case 2:
880  scale = (double)srcheight / (double)dstheight;
881  if (scale > yscale) yscale = scale;
882  break;
883  }
884  }
885  }
886 
887  if (xscalecalc == 1) {
888  if (1.0 >= lowxscale && 1.0 <= highxscale)
889  xscale = 1.0;
890  else
891  xscale = lowxscale;
892  }
893  if (yscalecalc == 1) {
894  if (1.0 >= lowyscale && 1.0 <= lowyscale)
895  yscale = 1.0;
896  else
897  yscale = lowyscale;
898  }
899 
900  if (xscale != 1.0 || yscale != 1.0) {
901  for (bi = blit_list; bi; bi = bi->next)
902  rectscale(&bi->dstRect, xscale, yscale);
903 
904  pm_message("Scaling output by %f in X and %f in Y",
905  xscale, yscale, 0, 0, 0);
907  }
908 
909  alloc_planes();
910 
911  for (bi = blit_list; bi; bi = bi->next) {
912  blit(&bi->srcRect, &bi->srcBounds, bi->srcwid, bi->srcplane,
913  bi->pixSize,
914  &bi->dstRect, &picFrame, rowlen,
915  bi->colour_map,
916  bi->mode);
917  }
918 }
919 
920 /*
921  * This could use read_pixmap, but I'm too lazy to hack read_pixmap.
922  */
923 
924 static void
926 int version;
927 {
928 #ifdef DUMP
929  FILE *fp = fopen("data", "wb");
930  int ch;
931  if (fp == NULL) exit(1);
932  while ((ch = fgetc(ifp)) != EOF) fputc(ch, fp);
933  exit(0);
934 #else
935  struct pixMap p;
936  struct Rect srcRect;
937  struct Rect dstRect;
938  byte* pm;
939  int pixwidth;
940  word mode;
941 
942  /* skip fake len, and fake EOF */
943  skip(4);
944  read_word(); /* version */
945  read_rect(&p.Bounds);
946  pixwidth = p.Bounds.right - p.Bounds.left;
947  p.packType = read_word();
948  p.packSize = read_long();
949  p.hRes = read_long();
950  p.vRes = read_long();
951  p.pixelType = read_word();
952  p.pixelSize = read_word();
953  p.pixelSize = read_word();
954  p.cmpCount = read_word();
955  p.cmpSize = read_word();
956  p.planeBytes = read_long();
957  p.pmTable = read_long();
958  p.pmReserved = read_long();
959 
960  if (p.pixelSize == 16)
961  pixwidth *= 2;
962  else if (p.pixelSize == 32)
963  pixwidth *= 3;
964 
965  read_rect(&srcRect);
966  if (verbose)
967  dump_rect("source rectangle:", &srcRect);
968 
969  read_rect(&dstRect);
970  if (verbose)
971  dump_rect("destination rectangle:", &dstRect);
972 
973  mode = read_word();
974  if (verbose)
975  pm_message("transfer mode = %s", const_name(transfer_name, mode),0,0,0,0);
976 
977  pm = unpackbits(&p.Bounds, 0, p.pixelSize);
978 
979  if (blit(&srcRect, &(p.Bounds), pixwidth, pm, p.pixelSize,
980  &dstRect, &picFrame, rowlen,
981  (struct RGBColour*)0,
982  mode))
983  {
984  free(pm);
985  }
986 #endif
987 }
988 
989 static void
991 int version;
992 {
993  word rowBytes;
994 
995  stage = "Reading rowBytes for bitsrect";
996  rowBytes = read_word();
997 
998  if (verbose)
999  pm_message("rowbytes = 0x%x (%d)", rowBytes, rowBytes & 0x7fff, 0, 0, 0);
1000 
1001  if (rowBytes & 0x8000)
1002  do_pixmap(version, rowBytes, 0);
1003  else
1004  do_bitmap(version, rowBytes, 0);
1005 }
1006 
1007 static void
1009 int version;
1010 {
1011  word rowBytes;
1012 
1013  stage = "Reading rowBytes for bitsregion";
1014  rowBytes = read_word();
1015 
1016  if (rowBytes & 0x8000)
1017  do_pixmap(version, rowBytes, 1);
1018  else
1019  do_bitmap(version, rowBytes, 1);
1020 }
1021 
1022 static void
1023 do_bitmap(version, rowBytes, is_region)
1024 int version;
1025 int rowBytes;
1026 int is_region;
1027 {
1028  struct Rect Bounds;
1029  struct Rect srcRect;
1030  struct Rect dstRect;
1031  word mode;
1032  byte* pm;
1033  static struct RGBColour colour_table[] = { {65535L, 65535L, 65535L}, {0, 0, 0} };
1034 
1035  read_rect(&Bounds);
1036  read_rect(&srcRect);
1037  read_rect(&dstRect);
1038  mode = read_word();
1039  if (verbose)
1040  pm_message("transfer mode = %s", const_name(transfer_name, mode),0,0,0,0);
1041 
1042  if (is_region)
1044 
1045  stage = "unpacking rectangle";
1046 
1047  pm = unpackbits(&Bounds, rowBytes, 1);
1048 
1049  if (blit(&srcRect, &Bounds, Bounds.right - Bounds.left, pm, 8,
1050  &dstRect, &picFrame, rowlen,
1051  colour_table,
1052  mode))
1053  {
1054  free(pm);
1055  }
1056 }
1057 
1058 #if __STDC__
1059 static void
1060 do_pixmap( int version, word rowBytes, int is_region )
1061 #else /*__STDC__*/
1062 static void
1063 do_pixmap(version, rowBytes, is_region)
1064 int version;
1065 word rowBytes;
1066 int is_region;
1067 #endif /*__STDC__*/
1068 {
1069  word mode;
1070  struct pixMap p;
1071  word pixwidth;
1072  byte* pm;
1073  struct RGBColour* colour_table;
1074  struct Rect srcRect;
1075  struct Rect dstRect;
1076 
1077  read_pixmap(&p, NULL);
1078 
1079  pixwidth = p.Bounds.right - p.Bounds.left;
1080 
1081  if (verbose)
1082  pm_message("%d x %d rectangle", pixwidth,
1083  p.Bounds.bottom - p.Bounds.top, 0, 0, 0);
1084 
1085  colour_table = read_colour_table();
1086 
1087  read_rect(&srcRect);
1088 
1089  if (verbose)
1090  dump_rect("source rectangle:", &srcRect);
1091 
1092  read_rect(&dstRect);
1093 
1094  if (verbose)
1095  dump_rect("destination rectangle:", &dstRect);
1096 
1097  mode = read_word();
1098 
1099  if (verbose)
1100  pm_message("transfer mode = %s", const_name(transfer_name, mode),0,0,0,0);
1101 
1102  if (is_region)
1104 
1105  stage = "unpacking rectangle";
1106 
1107  pm = unpackbits(&p.Bounds, rowBytes, p.pixelSize);
1108 
1109  if (blit(&srcRect, &(p.Bounds), pixwidth, pm, 8,
1110  &dstRect, &picFrame, rowlen,
1111  colour_table,
1112  mode))
1113  {
1114  free(colour_table);
1115  free(pm);
1116  }
1117 }
1118 
1119 static struct blit_info* add_blit_list()
1120 {
1121  struct blit_info* bi;
1122 
1123  if (!(bi = (struct blit_info*)malloc(sizeof(struct blit_info))))
1124  pm_error("out of memory for blit list");
1125 
1126  bi->next = 0;
1127  *last_bl = bi;
1128  last_bl = &(bi->next);
1129 
1130  return bi;
1131 }
1132 
1133 /* Various transfer functions for blits.
1134  *
1135  * Note src[Not]{Or,Xor,Copy} only work if the source pixmap was originally
1136  * a bitmap.
1137  * There's also a small bug that the foreground and background colours
1138  * are not used in a srcCopy; this wouldn't be hard to fix.
1139  * It IS a problem since the foreground and background colours CAN be changed.
1140  */
1141 
1142 #define rgb_all_same(x, y) \
1143  ((x)->red == (y) && (x)->green == (y) && (x)->blue == (y))
1144 #define rgb_is_white(x) rgb_all_same((x), 0xffff)
1145 #define rgb_is_black(x) rgb_all_same((x), 0)
1146 
1147 static void srcCopy(src, dst)
1148 struct RGBColour* src;
1149 struct RGBColour* dst;
1150 {
1151  if (rgb_is_black(src))
1152  *dst = foreground;
1153  else
1154  *dst = background;
1155 }
1156 
1157 static void srcOr(src, dst)
1158 struct RGBColour* src;
1159 struct RGBColour* dst;
1160 {
1161  if (rgb_is_black(src))
1162  *dst = foreground;
1163 }
1164 
1165 static void srcXor(src, dst)
1166 struct RGBColour* src;
1167 struct RGBColour* dst;
1168 {
1169  dst->red ^= ~~src->red;
1170  dst->green ^= ~~src->green;
1171  dst->blue ^= ~~src->blue;
1172 }
1173 
1174 static void srcBic(src, dst)
1175 struct RGBColour* src;
1176 struct RGBColour* dst;
1177 {
1178  if (rgb_is_black(src))
1179  *dst = background;
1180 }
1181 
1182 static void notSrcCopy(src, dst)
1183 struct RGBColour* src;
1184 struct RGBColour* dst;
1185 {
1186  if (rgb_is_white(src))
1187  *dst = foreground;
1188  else if (rgb_is_black(src))
1189  *dst = background;
1190 }
1191 
1192 static void notSrcOr(src, dst)
1193 struct RGBColour* src;
1194 struct RGBColour* dst;
1195 {
1196  if (rgb_is_white(src))
1197  *dst = foreground;
1198 }
1199 
1200 static void notSrcBic(src, dst)
1201 struct RGBColour* src;
1202 struct RGBColour* dst;
1203 {
1204  if (rgb_is_white(src))
1205  *dst = background;
1206 }
1207 
1208 static void notSrcXor(src, dst)
1209 struct RGBColour* src;
1210 struct RGBColour* dst;
1211 {
1212  dst->red ^= src->red;
1213  dst->green ^= src->green;
1214  dst->blue ^= src->blue;
1215 }
1216 
1217 static void addOver(src, dst)
1218 struct RGBColour* src;
1219 struct RGBColour* dst;
1220 {
1221  dst->red += src->red;
1222  dst->green += src->green;
1223  dst->blue += src->blue;
1224 }
1225 
1226 static void addPin(src, dst)
1227 struct RGBColour* src;
1228 struct RGBColour* dst;
1229 {
1230  if ((long)dst->red + (long)src->red > (long)op_colour.red)
1231  dst->red = op_colour.red;
1232  else
1233  dst->red = dst->red + src->red;
1234 
1235  if ((long)dst->green + (long)src->green > (long)op_colour.green)
1236  dst->green = op_colour.green;
1237  else
1238  dst->green = dst->green + src->green;
1239 
1240  if ((long)dst->blue + (long)src->blue > (long)op_colour.blue)
1241  dst->blue = op_colour.blue;
1242  else
1243  dst->blue = dst->blue + src->blue;
1244 }
1245 
1246 static void subOver(src, dst)
1247 struct RGBColour* src;
1248 struct RGBColour* dst;
1249 {
1250  dst->red -= src->red;
1251  dst->green -= src->green;
1252  dst->blue -= src->blue;
1253 }
1254 
1255 /* or maybe its src - dst; my copy of Inside Mac is unclear */
1256 static void subPin(src, dst)
1257 struct RGBColour* src;
1258 struct RGBColour* dst;
1259 {
1260  if ((long)dst->red - (long)src->red < (long)op_colour.red)
1261  dst->red = op_colour.red;
1262  else
1263  dst->red = dst->red - src->red;
1264 
1265  if ((long)dst->green - (long)src->green < (long)op_colour.green)
1266  dst->green = op_colour.green;
1267  else
1268  dst->green = dst->green - src->green;
1269 
1270  if ((long)dst->blue - (long)src->blue < (long)op_colour.blue)
1271  dst->blue = op_colour.blue;
1272  else
1273  dst->blue = dst->blue - src->blue;
1274 }
1275 
1276 static void adMax(src, dst)
1277 struct RGBColour* src;
1278 struct RGBColour* dst;
1279 {
1280  if (src->red > dst->red) dst->red = src->red;
1281  if (src->green > dst->green) dst->green = src->green;
1282  if (src->blue > dst->blue) dst->blue = src->blue;
1283 }
1284 
1285 static void adMin(src, dst)
1286 struct RGBColour* src;
1287 struct RGBColour* dst;
1288 {
1289  if (src->red < dst->red) dst->red = src->red;
1290  if (src->green < dst->green) dst->green = src->green;
1291  if (src->blue < dst->blue) dst->blue = src->blue;
1292 }
1293 
1294 static void blend(src, dst)
1295 struct RGBColour* src;
1296 struct RGBColour* dst;
1297 {
1298 #define blend_component(cmp) \
1299  ((long)src->cmp * (long)op_colour.cmp) / 65536 + \
1300  ((long)dst->cmp * (long)(65536 - op_colour.cmp) / 65536)
1301 
1302  dst->red = blend_component(red);
1303  dst->green = blend_component(green);
1304  dst->blue = blend_component(blue);
1305 }
1306 
1307 static void transparent(src, dst)
1308 struct RGBColour* src;
1309 struct RGBColour* dst;
1310 {
1311  if (src->red != background.red || src->green != background.green ||
1312  src->blue != background.blue)
1313  {
1314  *dst = *src;
1315  }
1316 }
1317 
1319 int mode;
1320 {
1321  switch (mode) {
1322  case 0: return srcCopy;
1323  case 1: return srcOr;
1324  case 2: return srcXor;
1325  case 3: return srcBic;
1326  case 4: return notSrcCopy;
1327  case 5: return notSrcOr;
1328  case 6: return notSrcXor;
1329  case 7: return notSrcBic;
1330  case 32: return blend;
1331  case 33: return addPin;
1332  case 34: return addOver;
1333  case 35: return subPin;
1334  case 36: return transparent;
1335  case 37: return adMax;
1336  case 38: return subOver;
1337  case 39: return adMin;
1338  default:
1339  if (mode != 0)
1340  pm_message("no transfer function for code %s, using srcCopy",
1341  const_name(transfer_name, mode), 0, 0, 0, 0);
1342  return srcCopy;
1343  }
1344 }
1345 
1346 #ifndef VMS
1347 #define AMI_OP !=
1348 #else
1349 #define AMI_OP ==
1350 #endif
1351 
1352 
1353 static int
1354 blit(srcRect, srcBounds, srcwid, srcplane, pixSize, dstRect, dstBounds, dstwid, colour_map, mode)
1355 struct Rect* srcRect;
1356 struct Rect* srcBounds;
1357 int srcwid;
1358 byte* srcplane;
1359 int pixSize;
1360 struct Rect* dstRect;
1361 struct Rect* dstBounds;
1362 int dstwid;
1363 struct RGBColour* colour_map;
1364 int mode;
1365 {
1366 /* I can't tell what the result value of this function is supposed to mean,
1367  but I found several return statements that did not set it to anything,
1368  and several calls that examine it. I'm guessing that "1" is the
1369  appropriate thing to return in those cases, so I made it so.
1370  -Bryan 00.03.02
1371 */
1372 
1373  struct Rect clipsrc;
1374  struct Rect clipdst;
1375  register byte* src;
1376  register word* reddst;
1377  register word* greendst;
1378  register word* bluedst;
1379  register int i;
1380  register int j;
1381  int dstoff;
1382  int xsize;
1383  int ysize;
1384  int srcadd;
1385  int dstadd;
1386  struct RGBColour* ct;
1387  int pkpixsize;
1388  struct blit_info* bi;
1389  struct RGBColour src_c, dst_c;
1390  transfer_func trf;
1391 
1392  if (ps_text)
1393  return(1);
1394 
1395  /* almost got it. clip source rect with source bounds.
1396  * clip dest rect with dest bounds. if source and
1397  * destination are not the same size, use pnmscale
1398  * to get a nicely sized rectangle.
1399  */
1400  rectinter(srcBounds, srcRect, &clipsrc);
1401  rectinter(dstBounds, dstRect, &clipdst);
1402 
1403  if (fullres) {
1404  bi = add_blit_list();
1405  bi->srcRect = clipsrc;
1406  bi->srcBounds = *srcBounds;
1407  bi->srcwid = srcwid;
1408  bi->srcplane = srcplane;
1409  bi->pixSize = pixSize;
1410  bi->dstRect = clipdst;
1411  bi->colour_map = colour_map;
1412  bi->mode = mode;
1413  return(0);
1414  }
1415 
1416  if (verbose) {
1417  dump_rect("copying from:", &clipsrc);
1418  dump_rect("to: ", &clipdst);
1419  pm_message("a %d x %d area to a %d x %d area",
1420  rectwidth(&clipsrc), rectheight(&clipsrc),
1421  rectwidth(&clipdst), rectheight(&clipdst), 0);
1422  }
1423 
1424  pkpixsize = 1;
1425  if (pixSize == 16)
1426  pkpixsize = 2;
1427 
1428  src = srcplane + (clipsrc.top - srcBounds->top) * srcwid +
1429  (clipsrc.left - srcBounds->left) * pkpixsize;
1430  xsize = clipsrc.right - clipsrc.left;
1431  ysize = clipsrc.bottom - clipsrc.top;
1432  srcadd = srcwid - xsize * pkpixsize;
1433 
1434  dstoff = (clipdst.top - dstBounds->top) * dstwid +
1435  (clipdst.left - dstBounds->left);
1436  reddst = red + dstoff;
1437  greendst = green + dstoff;
1438  bluedst = blue + dstoff;
1439  dstadd = dstwid - (clipdst.right - clipdst.left);
1440 
1441  /* get rid of Text mask mode bit, if (erroneously) set */
1442  if ((mode & ~64) == 0)
1443  trf = 0; /* optimized srcCopy */
1444  else
1445  trf = transfer(mode & ~64);
1446 
1447  if (!rectsamesize(&clipsrc, &clipdst)) {
1448 #ifdef STANDALONE
1449  fprintf(stderr,
1450  "picttoppm: standalone version can't scale rectangles yet, sorry.\n");
1451  fprintf(stderr, "picttoppm: skipping this rectangle.\n");
1452  return(1);
1453 #else
1454  FILE* pnmscale;
1455  char* tmpfile = tmpnam((char*)0);
1456  char command[1024];
1457  register byte* redsrc;
1458  register byte* greensrc;
1459  register byte* bluesrc;
1460  int greenpix;
1461  FILE* scaled;
1462  int cols, rows, format;
1463  pixval maxval;
1464  pixel* row;
1465  pixel* rowp;
1466 
1467 #if (defined(AMIGA) || defined(VMS))
1468  char ami_tmpfile[L_tmpnam];
1469  int ami_result;
1470  tmpnam(ami_tmpfile);
1471  if (!(pnmscale = fopen(ami_tmpfile, "wb")))
1472  pm_error("cannot create temporary file '%s'", ami_tmpfile);
1473 #else /* AMIGA or VMS */
1474  sprintf(command, "pnmscale -xsize %d -ysize %d > %s",
1475  rectwidth(&clipdst), rectheight(&clipdst), tmpfile);
1476 
1477  pm_message("running 'pnmscale -xsize %d -ysize %d' on a %d x %d image",
1478  rectwidth(&clipdst), rectheight(&clipdst),
1479  rectwidth(&clipsrc), rectheight(&clipsrc), 0);
1480 
1481  if (!(pnmscale = popen(command, "w"))) {
1482  pm_message("cannot execute command '%s'", command, 0, 0, 0, 0);
1483  pm_perror("popen");
1484  }
1485 #endif /* AMIGA or VMS */
1486 
1487  fprintf(pnmscale, "P6\n%d %d\n%d\n",
1488  rectwidth(&clipsrc), rectheight(&clipsrc), PPM_MAXMAXVAL);
1489 
1490 #define REDEPTH(c, oldmax) ((c) * ((PPM_MAXMAXVAL) + 1) / (oldmax + 1))
1491 
1492  switch (pixSize) {
1493  case 8:
1494  for (i = 0; i < ysize; ++i) {
1495  for (j = 0; j < xsize; ++j) {
1496  ct = colour_map + *src++;
1497  fputc(REDEPTH(ct->red, 65535L), pnmscale);
1498  fputc(REDEPTH(ct->green, 65535L), pnmscale);
1499  fputc(REDEPTH(ct->blue, 65535L), pnmscale);
1500  }
1501  src += srcadd;
1502  }
1503  break;
1504  case 16:
1505  for (i = 0; i < ysize; ++i) {
1506  for (j = 0; j < xsize; ++j) {
1507  fputc(REDEPTH((*src & 0x7c) >> 2, 32), pnmscale);
1508  greenpix = (*src++ & 3) << 3;
1509  greenpix |= (*src & 0xe0) >> 5;
1510  fputc(REDEPTH(greenpix, 32), pnmscale);
1511  fputc(REDEPTH((*src++ & 0x1f) << 11, 32), pnmscale);
1512  }
1513  src += srcadd;
1514  }
1515  break;
1516  case 32:
1517  srcadd = srcwid - xsize;
1518  redsrc = src;
1519  greensrc = src + (srcwid / 3);
1520  bluesrc = greensrc + (srcwid / 3);
1521 
1522  for (i = 0; i < ysize; ++i) {
1523  for (j = 0; j < xsize; ++j) {
1524  fputc(REDEPTH(*redsrc++, 256), pnmscale);
1525  fputc(REDEPTH(*greensrc++, 256), pnmscale);
1526  fputc(REDEPTH(*bluesrc++, 256), pnmscale);
1527  }
1528  redsrc += srcadd;
1529  greensrc += srcadd;
1530  bluesrc += srcadd;
1531  }
1532  }
1533 
1534 #if (defined(AMIGA) || defined(VMS))
1535  if( fclose(pnmscale) != 0 ) {
1536  unlink(ami_tmpfile);
1537  pm_perror("write error");
1538  }
1539  sprintf(command, "pnmscale -xsize %d -ysize %d %s > %s",
1540  rectwidth(&clipdst), rectheight(&clipdst), ami_tmpfile, tmpfile);
1541  pm_message("running 'pnmscale -xsize %d -ysize %d' on a %d x %d image",
1542  rectwidth(&clipdst), rectheight(&clipdst),
1543  rectwidth(&clipsrc), rectheight(&clipsrc), 0);
1544  ami_result = system(command);
1545  unlink(ami_tmpfile);
1546  if( ami_result AMI_OP 0 ) {
1547  unlink(tmpfile);
1548  pm_perror("pnmscale failed");
1549  }
1550 #else /* AMIGA or VMS */
1551  if (pclose(pnmscale)) {
1552  pm_message("pnmscale failed", 0, 0, 0, 0, 0);
1553  pm_perror("pclose");
1554  }
1555 #endif /* AMIGA or VMS */
1556  ppm_readppminit(scaled = pm_openr(tmpfile), &cols, &rows,
1557  &maxval, &format);
1558  row = ppm_allocrow(cols);
1559  /* couldn't hurt to assert cols, rows and maxval... */
1560 
1561  if (trf == 0) {
1562  while (rows-- > 0) {
1564  for (i = 0, rowp = row; i < cols; ++i, ++rowp) {
1565  *reddst++ = PPM_GETR(*rowp) * 65536L / (maxval + 1);
1566  *greendst++ = PPM_GETG(*rowp) * 65536L / (maxval + 1);
1567  *bluedst++ = PPM_GETB(*rowp) * 65536L / (maxval + 1);
1568  }
1569  reddst += dstadd;
1570  greendst += dstadd;
1571  bluedst += dstadd;
1572  }
1573  }
1574  else {
1575  while (rows-- > 0) {
1577  for (i = 0, rowp = row; i < cols; i++, rowp++) {
1578  dst_c.red = *reddst;
1579  dst_c.green = *greendst;
1580  dst_c.blue = *bluedst;
1581  src_c.red = PPM_GETR(*rowp) * 65536L / (maxval + 1);
1582  src_c.green = PPM_GETG(*rowp) * 65536L / (maxval + 1);
1583  src_c.blue = PPM_GETB(*rowp) * 65536L / (maxval + 1);
1584  (*trf)(&src_c, &dst_c);
1585  *reddst++ = dst_c.red;
1586  *greendst++ = dst_c.green;
1587  *bluedst++ = dst_c.blue;
1588  }
1589  reddst += dstadd;
1590  greendst += dstadd;
1591  bluedst += dstadd;
1592  }
1593  }
1594 
1595  pm_close(scaled);
1596  ppm_freerow(row);
1597  unlink(tmpfile);
1598  return(1);
1599 #endif /* STANDALONE */
1600  }
1601 
1602  if (trf == 0) {
1603  /* optimized srcCopy blit ('cause it was implemented first) */
1604  switch (pixSize) {
1605  case 8:
1606  for (i = 0; i < ysize; ++i) {
1607  for (j = 0; j < xsize; ++j) {
1608  ct = colour_map + *src++;
1609  *reddst++ = ct->red;
1610  *greendst++ = ct->green;
1611  *bluedst++ = ct->blue;
1612  }
1613  src += srcadd;
1614  reddst += dstadd;
1615  greendst += dstadd;
1616  bluedst += dstadd;
1617  }
1618  break;
1619  case 16:
1620  for (i = 0; i < ysize; ++i) {
1621  for (j = 0; j < xsize; ++j) {
1622  *reddst++ = (*src & 0x7c) << 9;
1623  *greendst = (*src++ & 3) << 14;
1624  *greendst++ |= (*src & 0xe0) << 6;
1625  *bluedst++ = (*src++ & 0x1f) << 11;
1626  }
1627  src += srcadd;
1628  reddst += dstadd;
1629  greendst += dstadd;
1630  bluedst += dstadd;
1631  }
1632  break;
1633  case 32:
1634  srcadd = (srcwid / 3) - xsize;
1635  for (i = 0; i < ysize; ++i) {
1636  for (j = 0; j < xsize; ++j)
1637  *reddst++ = *src++ << 8;
1638 
1639  reddst += dstadd;
1640  src += srcadd;
1641 
1642  for (j = 0; j < xsize; ++j)
1643  *greendst++ = *src++ << 8;
1644 
1645  greendst += dstadd;
1646  src += srcadd;
1647 
1648  for (j = 0; j < xsize; ++j)
1649  *bluedst++ = *src++ << 8;
1650 
1651  bluedst += dstadd;
1652  src += srcadd;
1653  }
1654  }
1655  }
1656  else {
1657 #define grab_destination() \
1658  dst_c.red = *reddst; \
1659  dst_c.green = *greendst; \
1660  dst_c.blue = *bluedst
1661 
1662 #define put_destination() \
1663  *reddst++ = dst_c.red; \
1664  *greendst++ = dst_c.green; \
1665  *bluedst++ = dst_c.blue
1666 
1667  /* generalized (but slow) blit */
1668  switch (pixSize) {
1669  case 8:
1670  for (i = 0; i < ysize; ++i) {
1671  for (j = 0; j < xsize; ++j) {
1672  grab_destination();
1673  (*trf)(colour_map + *src++, &dst_c);
1674  put_destination();
1675  }
1676  src += srcadd;
1677  reddst += dstadd;
1678  greendst += dstadd;
1679  bluedst += dstadd;
1680  }
1681  break;
1682  case 16:
1683  for (i = 0; i < ysize; ++i) {
1684  for (j = 0; j < xsize; ++j) {
1685  grab_destination();
1686  src_c.red = (*src & 0x7c) << 9;
1687  src_c.green = (*src++ & 3) << 14;
1688  src_c.green |= (*src & 0xe0) << 6;
1689  src_c.blue = (*src++ & 0x1f) << 11;
1690  (*trf)(&src_c, &dst_c);
1691  put_destination();
1692  }
1693  src += srcadd;
1694  reddst += dstadd;
1695  greendst += dstadd;
1696  bluedst += dstadd;
1697  }
1698  break;
1699  case 32:
1700  srcadd = srcwid / 3;
1701  for (i = 0; i < ysize; i++) {
1702  for (j = 0; j < xsize; j++) {
1703  grab_destination();
1704  src_c.red = *src << 8;
1705  src_c.green = src[srcadd] << 8;
1706  src_c.blue = src[srcadd * 2] << 8;
1707  (*trf)(&src_c, &dst_c);
1708  put_destination();
1709  src++;
1710  }
1711  src += srcwid - xsize;
1712  reddst += dstadd;
1713  greendst += dstadd;
1714  bluedst += dstadd;
1715  }
1716  }
1717  }
1718  return(1);
1719 }
1720 
1721 
1722 
1723 #if __STDC__
1724 static byte*
1725 unpackbits( struct Rect* bounds, word rowBytes, int pixelSize )
1726 #else /*__STDC__*/
1727 static byte*
1728 unpackbits(bounds, rowBytes, pixelSize)
1729 struct Rect* bounds;
1730 word rowBytes;
1731 int pixelSize;
1732 #endif /*__STDC__*/
1733 {
1734  byte* linebuf;
1735  byte* pm;
1736  byte* pm_ptr;
1737  register int i,j,k,l;
1738  word pixwidth;
1739  int linelen;
1740  int len;
1741  byte* bytepixels;
1742  int buflen;
1743  int pkpixsize;
1744  int rowsize;
1745 
1746  if (pixelSize <= 8)
1747  rowBytes &= 0x7fff;
1748 
1749  stage = "unpacking packbits";
1750 
1751  pixwidth = bounds->right - bounds->left;
1752 
1753  pkpixsize = 1;
1754  if (pixelSize == 16) {
1755  pkpixsize = 2;
1756  pixwidth *= 2;
1757  }
1758  else if (pixelSize == 32)
1759  pixwidth *= 3;
1760 
1761  if (rowBytes == 0)
1762  rowBytes = pixwidth;
1763 
1764  rowsize = pixwidth;
1765  if (rowBytes < 8)
1766  rowsize = 8 * rowBytes; /* worst case expansion factor */
1767 
1768  /* we're sloppy and allocate some extra space because we can overshoot
1769  * by as many as 8 bytes when we unpack the raster lines. Really, I
1770  * should be checking to see if we go over the scan line (it is
1771  * possible) and complain of a corrupt file. That fix is more complex
1772  * (and probably costly in CPU cycles) and will have to come later.
1773  */
1774  if ((pm = (byte*)malloc((rowsize * (bounds->bottom - bounds->top) + 8) * sizeof(byte))) == NULL)
1775  pm_error("no mem for packbits rectangle");
1776 
1777  /* Sometimes we get rows with length > rowBytes. I'll allocate some
1778  * extra for slop and only die if the size is _way_ out of wack.
1779  */
1780  if ((linebuf = (byte*)malloc(rowBytes + 100)) == NULL)
1781  pm_error("can't allocate memory for line buffer");
1782 
1783  if (rowBytes < 8) {
1784  /* ah-ha! The bits aren't actually packed. This will be easy */
1785  for (i = 0; i < bounds->bottom - bounds->top; i++) {
1786  pm_ptr = pm + i * pixwidth;
1787  read_n(buflen = rowBytes, (char*) linebuf);
1788  bytepixels = expand_buf(linebuf, &buflen, pixelSize);
1789  for (j = 0; j < buflen; j++)
1790  *pm_ptr++ = *bytepixels++;
1791  }
1792  }
1793  else {
1794  for (i = 0; i < bounds->bottom - bounds->top; i++) {
1795  pm_ptr = pm + i * pixwidth;
1796  if (rowBytes > 250 || pixelSize > 8)
1797  linelen = read_word();
1798  else
1799  linelen = read_byte();
1800 
1801  if (verbose > 1)
1802  pm_message("linelen: %d", linelen, 0, 0, 0, 0);
1803 
1804  if (linelen > rowBytes) {
1805  pm_message("linelen > rowbytes! (%d > %d) at line %d",
1806  linelen, rowBytes, i, 0, 0);
1807  }
1808 
1809  read_n(linelen, (char*) linebuf);
1810 
1811  for (j = 0; j < linelen; ) {
1812  if (linebuf[j] & 0x80) {
1813  len = ((linebuf[j] ^ 255) & 255) + 2;
1814  buflen = pkpixsize;
1815  bytepixels = expand_buf(linebuf + j+1, &buflen, pixelSize);
1816  for (k = 0; k < len; k++) {
1817  for (l = 0; l < buflen; l++)
1818  *pm_ptr++ = *bytepixels++;
1819  bytepixels -= buflen;
1820  }
1821  j += 1 + pkpixsize;
1822  }
1823  else {
1824  len = (linebuf[j] & 255) + 1;
1825  buflen = len * pkpixsize;
1826  bytepixels = expand_buf(linebuf + j+1, &buflen, pixelSize);
1827  for (k = 0; k < buflen; k++)
1828  *pm_ptr++ = *bytepixels++;
1829  j += len * pkpixsize + 1;
1830  }
1831  }
1832  }
1833  }
1834 
1835  free(linebuf);
1836 
1837  return pm;
1838 }
1839 
1840 static byte*
1842 byte* buf;
1843 int* len;
1844 int bits_per_pixel;
1845 {
1846  static byte pixbuf[256 * 8];
1847  register byte* src;
1848  register byte* dst;
1849  register int i;
1850 
1851  src = buf;
1852  dst = pixbuf;
1853 
1854  switch (bits_per_pixel) {
1855  case 8:
1856  case 16:
1857  case 32:
1858  return buf;
1859  case 4:
1860  for (i = 0; i < *len; i++) {
1861  *dst++ = (*src >> 4) & 15;
1862  *dst++ = *src++ & 15;
1863  }
1864  *len *= 2;
1865  break;
1866  case 2:
1867  for (i = 0; i < *len; i++) {
1868  *dst++ = (*src >> 6) & 3;
1869  *dst++ = (*src >> 4) & 3;
1870  *dst++ = (*src >> 2) & 3;
1871  *dst++ = *src++ & 3;
1872  }
1873  *len *= 4;
1874  break;
1875  case 1:
1876  for (i = 0; i < *len; i++) {
1877  *dst++ = (*src >> 7) & 1;
1878  *dst++ = (*src >> 6) & 1;
1879  *dst++ = (*src >> 5) & 1;
1880  *dst++ = (*src >> 4) & 1;
1881  *dst++ = (*src >> 3) & 1;
1882  *dst++ = (*src >> 2) & 1;
1883  *dst++ = (*src >> 1) & 1;
1884  *dst++ = *src++ & 1;
1885  }
1886  *len *= 8;
1887  break;
1888  default:
1889  pm_error("bad bits per pixel in expand_buf");
1890  }
1891  return pixbuf;
1892 }
1893 
1894 static void
1896 int version;
1897 {
1898  word len;
1899 
1900  len = read_word();
1901 
1902  if (len == 0x000a) { /* null rgn */
1903  read_rect(&clip_rect);
1904  /* XXX should clip this by picFrame */
1905  if (verbose)
1906  dump_rect("clipping to", &clip_rect);
1907  }
1908  else
1909  skip(len - 2);
1910 }
1911 
1912 static void
1913 read_pixmap(p, rowBytes)
1914 struct pixMap* p;
1915 word* rowBytes;
1916 {
1917  stage = "getting pixMap header";
1918 
1919  if (rowBytes != NULL)
1920  *rowBytes = read_word();
1921 
1922  read_rect(&p->Bounds);
1923  p->version = read_word();
1924  p->packType = read_word();
1925  p->packSize = read_long();
1926  p->hRes = read_long();
1927  p->vRes = read_long();
1928  p->pixelType = read_word();
1929  p->pixelSize = read_word();
1930  p->cmpCount = read_word();
1931  p->cmpSize = read_word();
1932  p->planeBytes = read_long();
1933  p->pmTable = read_long();
1934  p->pmReserved = read_long();
1935 
1936  if (verbose) {
1937  pm_message("pixelType: %d", p->pixelType, 0, 0, 0, 0);
1938  pm_message("pixelSize: %d", p->pixelSize, 0, 0, 0, 0);
1939  pm_message("cmpCount: %d", p->cmpCount, 0, 0, 0, 0);
1940  pm_message("cmpSize: %d", p->cmpSize, 0, 0, 0, 0);
1941  }
1942 
1943  if (p->pixelType != 0)
1944  pm_error("sorry, I only do chunky format");
1945  if (p->cmpCount != 1)
1946  pm_error("sorry, cmpCount != 1");
1947  if (p->pixelSize != p->cmpSize)
1948  pm_error("oops, pixelSize != cmpSize");
1949 }
1950 
1951 static struct RGBColour*
1953 {
1954  longword ctSeed;
1955  word ctFlags;
1956  word ctSize;
1957  word val;
1958  int i;
1959  struct RGBColour* colour_table;
1960 
1961  stage = "getting color table info";
1962 
1963  ctSeed = read_long();
1964  ctFlags = read_word();
1965  ctSize = read_word();
1966 
1967  if (verbose) {
1968  pm_message("ctSeed: %d", ctSeed, 0, 0, 0, 0);
1969  pm_message("ctFlags: %d", ctFlags, 0, 0, 0, 0);
1970  pm_message("ctSize: %d", ctSize, 0, 0, 0, 0);
1971  }
1972 
1973  stage = "reading colour table";
1974 
1975  if ((colour_table = (struct RGBColour*) malloc(sizeof(struct RGBColour) * (ctSize + 1))) == NULL)
1976  pm_error("no memory for colour table");
1977 
1978  for (i = 0; i <= ctSize; i++) {
1979  val = read_word();
1980  /* The indicies in a device colour table are bogus and usually == 0.
1981  * so I assume we allocate up the list of colours in order.
1982  */
1983  if (ctFlags & 0x8000)
1984  val = i;
1985  if (val > ctSize)
1986  pm_error("pixel value greater than colour table size");
1987  colour_table[val].red = read_word();
1988  colour_table[val].green = read_word();
1989  colour_table[val].blue = read_word();
1990 
1991  if (verbose > 1)
1992  pm_message("%d: [%d,%d,%d]", val,
1993  colour_table[val].red,
1994  colour_table[val].green,
1995  colour_table[val].blue, 0);
1996  }
1997 
1998  return colour_table;
1999 }
2000 
2001 static void
2003 int version;
2004 {
2005  op_colour.red = read_word();
2007  op_colour.blue = read_word();
2008 }
2009 
2010 /* these 3 do nothing but skip over their data! */
2011 static void
2013 int version;
2014 {
2015  read_pattern();
2016 }
2017 
2018 static void
2020 int version;
2021 {
2022  read_pattern();
2023 }
2024 
2025 static void
2027 int version;
2028 {
2029  read_pattern();
2030 }
2031 
2032 /* this just skips over a version 2 pattern. Probabaly will return
2033  * a pattern in the fabled complete version.
2034  */
2035 static void
2037 {
2038  word PatType;
2039  word rowBytes;
2040  struct pixMap p;
2041  byte* pm;
2042  struct RGBColour* ct;
2043 
2044  stage = "Reading a pattern";
2045 
2046  PatType = read_word();
2047 
2048  switch (PatType) {
2049  case 2:
2050  skip(8); /* old pattern data */
2051  skip(5); /* RGB for pattern */
2052  break;
2053  case 1:
2054  skip(8); /* old pattern data */
2055  read_pixmap(&p, &rowBytes);
2056  ct = read_colour_table();
2057  pm = unpackbits(&p.Bounds, rowBytes, p.pixelSize);
2058  free(pm);
2059  free(ct);
2060  break;
2061  default:
2062  pm_error("unknown pattern type in read_pattern");
2063  }
2064 }
2065 
2066 static void BkPat(version)
2067 int version;
2068 {
2070 }
2071 
2072 static void PnPat(version)
2073 int version;
2074 {
2076 }
2077 
2078 static void FillPat(version)
2079 int version;
2080 {
2082 }
2083 
2084 static void
2086 struct Pattern* pat;
2087 {
2088  byte buf[8], *exp;
2089  int len, i;
2090 
2091  read_n(len = 8, (char*)buf);
2092  if (verbose) {
2093  pm_message("pattern: %02x%02x%02x%02x",
2094  buf[0], buf[1], buf[2], buf[3], 0);
2095  pm_message("pattern: %02x%02x%02x%02x",
2096  buf[4], buf[5], buf[6], buf[7], 0);
2097  }
2098  exp = expand_buf(buf, &len, 1);
2099  for (i = 0; i < 64; i++)
2100  pat->pix[i] = *exp++;
2101 }
2102 
2103 static void PnSize(version)
2104 int version;
2105 {
2106  pen_height = read_word();
2107  pen_width = read_word();
2108  if (verbose)
2109  pm_message("pen size %d x %d", pen_width, pen_height, 0, 0, 0);
2110 }
2111 
2112 static void PnMode(version)
2113 int version;
2114 {
2115  pen_mode = read_word();
2116 
2117  if (pen_mode >= 8 && pen_mode < 15)
2118  pen_mode -= 8;
2119  if (verbose)
2120  pm_message("pen transfer mode = %s",
2121  const_name(transfer_name, pen_mode), 0, 0, 0, 0);
2122 
2124 }
2125 
2126 static void read_rgb(rgb)
2127 struct RGBColour* rgb;
2128 {
2129  rgb->red = read_word();
2130  rgb->green = read_word();
2131  rgb->blue = read_word();
2132 }
2133 
2134 static void RGBFgCol(v)
2135 int v;
2136 {
2137  read_rgb(&foreground);
2138  if (verbose)
2139  pm_message("foreground now [%d,%d,%d]",
2141 }
2142 
2143 static void RGBBkCol(v)
2144 int v;
2145 {
2146  read_rgb(&background);
2147  if (verbose)
2148  pm_message("background now [%d,%d,%d]",
2150 }
2151 
2152 static void read_point(p)
2153 struct Point* p;
2154 {
2155  p->y = read_word();
2156  p->x = read_word();
2157 }
2158 
2159 static void read_short_point(p)
2160 struct Point* p;
2161 {
2162  p->x = read_signed_byte();
2163  p->y = read_signed_byte();
2164 }
2165 
2166 #define PIXEL_INDEX(x,y) ((y) - picFrame.top) * rowlen + (x) - picFrame.left
2167 
2168 static void draw_pixel(x, y, clr, trf)
2169 int x, y;
2170 struct RGBColour* clr;
2171 transfer_func trf;
2172 {
2173  register int i;
2174  struct RGBColour dst;
2175 
2176  if (x < clip_rect.left || x >= clip_rect.right ||
2177  y < clip_rect.top || y >= clip_rect.bottom)
2178  {
2179  return;
2180  }
2181 
2182  i = PIXEL_INDEX(x, y);
2183  dst.red = red[i];
2184  dst.green = green[i];
2185  dst.blue = blue[i];
2186  (*trf)(clr, &dst);
2187  red[i] = dst.red;
2188  green[i] = dst.green;
2189  blue[i] = dst.blue;
2190 }
2191 
2192 static void draw_pen_rect(r)
2193 struct Rect* r;
2194 {
2195  register int i = PIXEL_INDEX(r->left, r->top);
2196  register int x, y;
2197  struct RGBColour dst;
2198  int rowadd = rowlen - (r->right - r->left);
2199 
2200  for (y = r->top; y < r->bottom; y++) {
2201  for (x = r->left; x < r->right; x++) {
2202  dst.red = red[i];
2203  dst.green = green[i];
2204  dst.blue = blue[i];
2205  if (pen_pat.pix[(x & 7) + (y & 7) * 8])
2206  (*pen_trf)(&black, &dst);
2207  else
2208  (*pen_trf)(&white, &dst);
2209  red[i] = dst.red;
2210  green[i] = dst.green;
2211  blue[i] = dst.blue;
2212 
2213  i++;
2214  }
2215  i += rowadd;
2216  }
2217 }
2218 
2219 static void draw_pen(x, y)
2220 int x, y;
2221 {
2222  struct Rect penrect;
2223 
2224  penrect.left = x;
2225  penrect.right = x + pen_width;
2226  penrect.top = y;
2227  penrect.bottom = y + pen_height;
2228 
2229  rectinter(&penrect, &clip_rect, &penrect);
2230 
2231  draw_pen_rect(&penrect);
2232 }
2233 
2234 /*
2235  * Digital Line Drawing
2236  * by Paul Heckbert
2237  * from "Graphics Gems", Academic Press, 1990
2238  */
2239 
2240 /* absolute value of a */
2241 #define ABS(a) (((a)<0) ? -(a) : (a))
2242 /* take binary sign of a, either -1, or 1 if >= 0 */
2243 #define SGN(a) (((a)<0) ? -1 : 1)
2244 
2245 /*
2246  * digline: draw digital line from (x1,y1) to (x2,y2),
2247  * calling a user-supplied procedure at each pixel.
2248  * Does no clipping. Uses Bresenham's algorithm.
2249  *
2250  * Paul Heckbert 3 Sep 85
2251  */
2252 static void scan_line(short x1, short y1, short x2, short y2) {
2253  int d, x, y, ax, ay, sx, sy, dx, dy;
2254 
2255  if (pen_width == 0 && pen_height == 0)
2256  return;
2257 
2258  dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx);
2259  dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy);
2260 
2261  x = x1;
2262  y = y1;
2263  if (ax>ay) { /* x dominant */
2264  d = ay-(ax>>1);
2265  for (;;) {
2266  draw_pen(x, y);
2267  if (x==x2) return;
2268  if ((x > rowlen) && (sx > 0)) return;
2269  if (d>=0) {
2270  y += sy;
2271  d -= ax;
2272  }
2273  x += sx;
2274  d += ay;
2275  }
2276  }
2277  else { /* y dominant */
2278  d = ax-(ay>>1);
2279  for (;;) {
2280  draw_pen(x, y);
2281  if (y==y2) return;
2282  if ((y > collen) && (sy > 0)) return;
2283  if (d>=0) {
2284  x += sx;
2285  d -= ay;
2286  }
2287  y += sy;
2288  d += ax;
2289  }
2290  }
2291 }
2292 
2293 static void Line(v)
2294  int v;
2295 {
2296  struct Point p1;
2297  read_point(&p1);
2298  read_point(&current);
2299  if (verbose)
2300  pm_message("(%d,%d) to (%d, %d)",
2301  p1.x,p1.y,current.x,current.y, 0);
2302  scan_line(p1.x,p1.y,current.x,current.y);
2303 }
2304 
2305 static void LineFrom(v)
2306  int v;
2307 {
2308  struct Point p1;
2309  read_point(&p1);
2310  if (verbose)
2311  pm_message("(%d,%d) to (%d, %d)",
2312  current.x,current.y,p1.x,p1.y, 0);
2313 
2314  if (!fullres)
2315  scan_line(current.x,current.y,p1.x,p1.y);
2316 
2317  current.x = p1.x;
2318  current.y = p1.y;
2319 }
2320 
2321 static void ShortLine(v)
2322  int v;
2323 {
2324  struct Point p1;
2325  read_point(&p1);
2327  if (verbose)
2328  pm_message("(%d,%d) delta (%d, %d)",
2329  p1.x,p1.y,current.x,current.y, 0);
2330  current.x += p1.x;
2331  current.y += p1.y;
2332 
2333  if (!fullres)
2334  scan_line(p1.x,p1.y,current.x,current.y);
2335 }
2336 
2337 static void ShortLineFrom(v)
2338  int v;
2339 {
2340  struct Point p1;
2341  read_short_point(&p1);
2342  if (verbose)
2343  pm_message("(%d,%d) delta (%d, %d)",
2344  current.x,current.y,p1.x,p1.y, 0);
2345  p1.x += current.x;
2346  p1.y += current.y;
2347  if (!fullres)
2348  scan_line(current.x,current.y,p1.x,p1.y);
2349  current.x = p1.x;
2350  current.y = p1.y;
2351 }
2352 
2353 static void paintRect(v)
2354 int v;
2355 {
2356  read_rect(&cur_rect);
2358 }
2359 
2360 static void paintSameRect(v)
2361 int v;
2362 {
2364 }
2365 
2366 static void do_paintRect(prect)
2367 struct Rect* prect;
2368 {
2369  struct Rect rect;
2370 
2371  if (fullres)
2372  return;
2373 
2374  if (verbose)
2375  dump_rect("painting", prect);
2376 
2377  rectinter(&clip_rect, prect, &rect);
2378 
2379  draw_pen_rect(&rect);
2380 }
2381 
2382 static void frameRect(v)
2383 int v;
2384 {
2385  read_rect(&cur_rect);
2387 }
2388 
2389 static void frameSameRect(v)
2390 int v;
2391 {
2393 }
2394 
2395 static void do_frameRect(rect)
2396 struct Rect* rect;
2397 {
2398  register int x, y;
2399 
2400  if (fullres)
2401  return;
2402 
2403  if (verbose)
2404  dump_rect("framing", rect);
2405 
2406  if (pen_width == 0 || pen_height == 0)
2407  return;
2408 
2409  for (x = rect->left; x <= rect->right - pen_width; x += pen_width) {
2410  draw_pen(x, rect->top);
2411  draw_pen(x, rect->bottom - pen_height);
2412  }
2413 
2414  for (y = rect->top; y <= rect->bottom - pen_height ; y += pen_height) {
2415  draw_pen(rect->left, y);
2416  draw_pen(rect->right - pen_width, y);
2417  }
2418 }
2419 
2420 /* a stupid shell sort - I'm so embarassed */
2421 
2422 static void poly_sort(sort_index, points)
2423  int sort_index;
2424  struct Point points[];
2425 {
2426  int d, i, j, temp;
2427 
2428  /* initialize and set up sort interval */
2429  d = 4;
2430  while (d<=sort_index) d <<= 1;
2431  d -= 1;
2432 
2433  while (d > 1) {
2434  d >>= 1;
2435  for (j = 0; j <= (sort_index-d); j++) {
2436  for(i = j; i >= 0; i -= d) {
2437  if ((points[i+d].y < points[i].y) ||
2438  ((points[i+d].y == points[i].y) &&
2439  (points[i+d].x <= points[i].x))) {
2440  /* swap x1,y1 with x2,y2 */
2441  temp = points[i].y;
2442  points[i].y = points[i+d].y;
2443  points[i+d].y = temp;
2444  temp = points[i].x;
2445  points[i].x = points[i+d].x;
2446  points[i+d].x = temp;
2447  }
2448  }
2449  }
2450  }
2451 }
2452 
2453 /* Watch out for the lack of error checking in the next two functions ... */
2454 
2455 static void scan_poly(np, pts)
2456  int np;
2457  struct Point pts[];
2458 {
2459  int dx,dy,dxabs,dyabs,i,scan_index,j,k,px,py;
2460  int sdx,sdy,x,y,toggle,old_sdy,sy0;
2461 
2462  /* This array needs to be at least as large as the largest dimension of
2463  the bounding box of the poly (but I don't check for overflows ...) */
2464  struct Point coord[5000];
2465 
2466  scan_index = 0;
2467 
2468  /* close polygon */
2469  px = pts[np].x = pts[0].x;
2470  py = pts[np].y = pts[0].y;
2471 
2472  /* This section draws the polygon and stores all the line points
2473  * in an array. This doesn't work for concave or non-simple polys.
2474  */
2475  /* are y levels same for first and second points? */
2476  if (pts[1].y == pts[0].y) {
2477  coord[scan_index].x = px;
2478  coord[scan_index].y = py;
2479  scan_index++;
2480  }
2481 
2482 #define sign(x) ((x) > 0 ? 1 : ((x)==0 ? 0:(-1)) )
2483 
2484  old_sdy = sy0 = sign(pts[1].y - pts[0].y);
2485  for (j=0; j<np; j++) {
2486  /* x,y difference between consecutive points and their signs */
2487  dx = pts[j+1].x - pts[j].x;
2488  dy = pts[j+1].y - pts[j].y;
2489  sdx = SGN(dx);
2490  sdy = SGN(dy);
2491  dxabs = abs(dx);
2492  dyabs = abs(dy);
2493  x = y = 0;
2494 
2495  if (dxabs >= dyabs)
2496  {
2497  for (k=0; k < dxabs; k++) {
2498  y += dyabs;
2499  if (y >= dxabs) {
2500  y -= dxabs;
2501  py += sdy;
2502  if (old_sdy != sdy) {
2503  old_sdy = sdy;
2504  scan_index--;
2505  }
2506  coord[scan_index].x = px+sdx;
2507  coord[scan_index].y = py;
2508  scan_index++;
2509  }
2510  px += sdx;
2511  draw_pen(px, py);
2512  }
2513  }
2514  else
2515  {
2516  for (k=0; k < dyabs; k++) {
2517  x += dxabs;
2518  if (x >= dyabs) {
2519  x -= dyabs;
2520  px += sdx;
2521  }
2522  py += sdy;
2523  if (old_sdy != sdy) {
2524  old_sdy = sdy;
2525  if (sdy != 0) scan_index--;
2526  }
2527  draw_pen(px,py);
2528  coord[scan_index].x = px;
2529  coord[scan_index].y = py;
2530  scan_index++;
2531  }
2532  }
2533  }
2534 
2535  /* after polygon has been drawn now fill it */
2536 
2537  scan_index--;
2538  if (sy0 + sdy == 0) scan_index--;
2539 
2540  poly_sort(scan_index, coord);
2541 
2542  toggle = 0;
2543  for (i = 0; i < scan_index; i++) {
2544  if ((coord[i].y == coord[i+1].y) && (toggle == 0))
2545  {
2546  for (j = coord[i].x; j <= coord[i+1].x; j++)
2547  draw_pen(j, coord[i].y);
2548  toggle = 1;
2549  }
2550  else
2551  toggle = 0;
2552  }
2553 }
2554 
2555 
2556 static void paintPoly(v)
2557  int v;
2558 {
2559  struct Rect bb;
2560  struct Point pts[100];
2561  int i, np = (read_word() - 10) >> 2;
2562 
2563  read_rect(&bb);
2564  for (i=0; i<np; ++i)
2565  read_point(&pts[i]);
2566 
2567  /* scan convert poly ... */
2568  if (!fullres)
2569  scan_poly(np, pts);
2570 }
2571 
2572 static void PnLocHFrac(version)
2573 int version;
2574 {
2575  word frac = read_word();
2576 
2577  if (verbose)
2578  pm_message("PnLocHFrac = %d", frac, 0, 0, 0, 0);
2579 }
2580 
2581 static void TxMode(version)
2582 int version;
2583 {
2584  text_mode = read_word();
2585 
2586  if (text_mode >= 8 && text_mode < 15)
2587  text_mode -= 8;
2588  if (verbose)
2589  pm_message("text transfer mode = %s",
2590  const_name(transfer_name, text_mode), 0, 0, 0, 0);
2591 
2592  /* ignore the text mask bit 'cause we don't handle it yet */
2593  text_trf = transfer(text_mode & ~64);
2594 }
2595 
2596 static void TxFont(version)
2597 int version;
2598 {
2599  text_font = read_word();
2600  if (verbose)
2601  pm_message("text font %s", const_name(font_name, text_font), 0, 0, 0, 0);
2602 }
2603 
2604 static void TxFace(version)
2605 int version;
2606 {
2607  text_face = read_byte();
2608  if (verbose)
2609  pm_message("text face %d", text_face, 0, 0, 0, 0);
2610 }
2611 
2612 static void TxSize(version)
2613 int version;
2614 {
2615  text_size = read_word();
2616  if (verbose)
2617  pm_message("text size %d", text_size, 0, 0, 0, 0);
2618 }
2619 
2620 static void
2622 {
2623  skip(read_byte());
2624 }
2625 
2626 static void
2628 int version;
2629 {
2630  struct Point p;
2631 
2632  read_point(&p);
2633  do_text(p.x, p.y);
2634 }
2635 
2636 static void
2638 int version;
2639 {
2640  current.x += read_byte();
2642 }
2643 
2644 static void
2646 int version;
2647 {
2648  current.y += read_byte();
2650 }
2651 
2652 static void
2654 int version;
2655 {
2656  byte dh, dv;
2657 
2658  dh = read_byte();
2659  dv = read_byte();
2660 
2661  if (verbose)
2662  pm_message("dh, dv = %d, %d", dh, dv, 0, 0, 0);
2663 
2664  current.x += dh;
2665  current.y += dv;
2667 }
2668 
2669 static void
2670 #ifdef __STDC__
2671 do_text(word x, word y)
2672 #else
2674 word x;
2675 word y;
2676 #endif
2677 {
2678  int len, dy, w, h;
2679  struct glyph* glyph;
2680 
2681  if (fullres) {
2682  skip_text();
2683  return;
2684  }
2685 
2687  tfont = pbm_defaultfont("bdf");
2688 
2689  if (ps_text) {
2690  do_ps_text(x, y);
2691  return;
2692  }
2693 
2694  for (len = read_byte(); len > 0; len--) {
2695  if (!(glyph = tfont->glyph[read_byte()]))
2696  continue;
2697 
2698  dy = y - glyph->height - glyph->y;
2699  for (h = 0; h < glyph->height; h++) {
2700  for (w = 0; w < glyph->width; w++) {
2701  if (glyph->bmap[h * glyph->width + w])
2702  draw_pixel(x + w + glyph->x, dy, &black, text_trf);
2703  else
2704  draw_pixel(x + w + glyph->x, dy, &white, text_trf);
2705  }
2706  dy++;
2707  }
2708  x += glyph->xadd;
2709  }
2710 
2711 
2712  current.x = x;
2713  current.y = y;
2714 }
2715 
2716 static void
2717 #ifdef __STDC__
2718 do_ps_text(word tx, word ty)
2719 #else
2720 do_ps_text(tx, ty)
2721 word tx;
2722 word ty;
2723 #endif
2724 {
2725  int len, width, i, w, h, x, y, rx, ry, o;
2726  byte str[256], ch;
2727  struct glyph* glyph;
2728 
2729  current.x = tx;
2730  current.y = ty;
2731 
2732  if (!ps_cent_set) {
2733  ps_cent_x += tx;
2734  ps_cent_y += ty;
2735  ps_cent_set = 1;
2736  }
2737 
2738  len = read_byte();
2739 
2740  /* XXX this width calculation is not completely correct */
2741  width = 0;
2742  for (i = 0; i < len; i++) {
2743  ch = str[i] = read_byte();
2744  if (tfont->glyph[ch])
2745  width += tfont->glyph[ch]->xadd;
2746  }
2747 
2748  if (verbose) {
2749  str[len] = '\0';
2750  pm_message("ps text: %s", str);
2751  }
2752 
2753  /* XXX The width is calculated in order to do different justifications.
2754  * However, I need the width of original text to finish the job.
2755  * In other words, font metrics for Quickdraw fonts
2756  */
2757 
2758  x = tx;
2759 
2760  for (i = 0; i < len; i++) {
2761  if (!(glyph = tfont->glyph[str[i]]))
2762  continue;
2763 
2764  y = ty - glyph->height - glyph->y;
2765  for (h = 0; h < glyph->height; h++) {
2766  for (w = 0; w < glyph->width; w++) {
2767  rx = x + glyph->x + w;
2768  ry = y;
2769  rotate(&rx, &ry);
2770  if ((rx >= picFrame.left) && (rx < picFrame.right) &&
2771  (ry >= picFrame.top) && (ry < picFrame.bottom))
2772  {
2773  o = PIXEL_INDEX(rx, ry);
2774  if (glyph->bmap[h * glyph->width + w]) {
2775  red[o] = foreground.red;
2776  green[o] = foreground.green;
2777  blue[o] = foreground.blue;
2778  }
2779  }
2780  }
2781  y++;
2782  }
2783  x += glyph->xadd;
2784  }
2785 }
2786 
2787 /* This only does 0, 90, 180 and 270 degree rotations */
2788 
2789 static void rotate(x, y)
2790 int *x;
2791 int *y;
2792 {
2793  int tmp;
2794 
2795  if (ps_rotation >= 315 || ps_rotation <= 45)
2796  return;
2797 
2798  *x -= ps_cent_x;
2799  *y -= ps_cent_y;
2800 
2801  if (ps_rotation > 45 && ps_rotation < 135) {
2802  tmp = *x;
2803  *x = *y;
2804  *y = tmp;
2805  }
2806  else if (ps_rotation >= 135 && ps_rotation < 225) {
2807  *x = -*x;
2808  }
2809  else if (ps_rotation >= 225 && ps_rotation < 315) {
2810  tmp = *x;
2811  *x = *y;
2812  *y = -tmp;
2813  }
2814  *x += ps_cent_x;
2815  *y += ps_cent_y;
2816 }
2817 
2818 static void
2820 int version;
2821 {
2822  stage = "skipping polygon or region";
2823  skip(read_word() - 2);
2824 }
2825 
2826 static
2828  switch (type) {
2829  case 150:
2830  if (verbose) pm_message("TextBegin");
2831  if (length < 6)
2832  break;
2833  ps_just = read_byte();
2834  ps_flip = read_byte();
2835  ps_rotation = read_word();
2836  ps_linespace = read_byte();
2837  length -= 5;
2838  if (recognize_comment)
2839  ps_text = 1;
2840  ps_cent_set = 0;
2841  if (verbose) {
2842  pm_message("%s justification, %s flip, %d degree rotation, %d/2 linespacing",
2846  }
2847  break;
2848  case 151:
2849  if (verbose) pm_message("TextEnd");
2850  ps_text = 0;
2851  break;
2852  case 152:
2853  if (verbose) pm_message("StringBegin");
2854  break;
2855  case 153:
2856  if (verbose) pm_message("StringEnd");
2857  break;
2858  case 154:
2859  if (verbose) pm_message("TextCenter");
2860  if (length < 8)
2861  break;
2862  ps_cent_y = read_word();
2863  if (ps_cent_y > 32767)
2864  ps_cent_y -= 65536;
2865  skip(2); /* ignore fractional part */
2866  ps_cent_x = read_word();
2867  if (ps_cent_x > 32767)
2868  ps_cent_x -= 65536;
2869  skip(2); /* ignore fractional part */
2870  length -= 8;
2871  if (verbose)
2872  pm_message("offset %d %d", ps_cent_x, ps_cent_y);
2873  break;
2874  case 155:
2875  if (verbose) pm_message("LineLayoutOff");
2876  break;
2877  case 156:
2878  if (verbose) pm_message("LineLayoutOn");
2879  break;
2880  case 160:
2881  if (verbose) pm_message("PolyBegin");
2882  break;
2883  case 161:
2884  if (verbose) pm_message("PolyEnd");
2885  break;
2886  case 163:
2887  if (verbose) pm_message("PolyIgnore");
2888  break;
2889  case 164:
2890  if (verbose) pm_message("PolySmooth");
2891  break;
2892  case 165:
2893  if (verbose) pm_message("picPlyClo");
2894  break;
2895  case 180:
2896  if (verbose) pm_message("DashedLine");
2897  break;
2898  case 181:
2899  if (verbose) pm_message("DashedStop");
2900  break;
2901  case 182:
2902  if (verbose) pm_message("SetLineWidth");
2903  break;
2904  case 190:
2905  if (verbose) pm_message("PostScriptBegin");
2906  break;
2907  case 191:
2908  if (verbose) pm_message("PostScriptEnd");
2909  break;
2910  case 192:
2911  if (verbose) pm_message("PostScriptHandle");
2912  break;
2913  case 193:
2914  if (verbose) pm_message("PostScriptFile");
2915  break;
2916  case 194:
2917  if (verbose) pm_message("TextIsPostScript");
2918  break;
2919  case 195:
2920  if (verbose) pm_message("ResourcePS");
2921  break;
2922  case 200:
2923  if (verbose) pm_message("RotateBegin");
2924  break;
2925  case 201:
2926  if (verbose) pm_message("RotateEnd");
2927  break;
2928  case 202:
2929  if (verbose) pm_message("RotateCenter");
2930  break;
2931  case 210:
2932  if (verbose) pm_message("FormsPrinting");
2933  break;
2934  case 211:
2935  if (verbose) pm_message("EndFormsPrinting");
2936  break;
2937  default:
2938  if (verbose) pm_message("%d", type);
2939  break;
2940  }
2941  if (length > 0)
2942  skip(length);
2943 }
2944 
2945 static void
2947 int version;
2948 {
2949  picComment(read_word(), 0);
2950 }
2951 
2952 static void
2954 int version;
2955 {
2956  word type;
2957 
2958  type = read_word();
2960 }
2961 
2962 static int
2964 struct Rect* r;
2965 {
2966  return r->right - r->left;
2967 }
2968 
2969 static int
2971 struct Rect* r;
2972 {
2973  return r->bottom - r->top;
2974 }
2975 
2976 static int
2978 struct Rect* r1;
2979 struct Rect* r2;
2980 {
2981  return r1->right - r1->left == r2->right - r2->left &&
2982  r1->bottom - r1->top == r2->bottom - r2->top ;
2983 }
2984 
2985 static void
2987 struct Rect* r1;
2988 struct Rect* r2;
2989 struct Rect* r3;
2990 {
2991  r3->left = max(r1->left, r2->left);
2992  r3->top = max(r1->top, r2->top);
2993  r3->right = min(r1->right, r2->right);
2994  r3->bottom = min(r1->bottom, r2->bottom);
2995 }
2996 
2997 static void
2999 struct Rect* r;
3000 double xscale;
3001 double yscale;
3002 {
3003  r->left *= xscale;
3004  r->right *= xscale;
3005  r->top *= yscale;
3006  r->bottom *= yscale;
3007 }
3008 
3009 static void
3011 struct Rect* r;
3012 {
3013  r->top = read_word();
3014  r->left = read_word();
3015  r->bottom = read_word();
3016  r->right = read_word();
3017 }
3018 
3019 static void
3021 char* s;
3022 struct Rect* r;
3023 {
3024  pm_message("%s (%d,%d) (%d,%d)",
3025  s, r->left, r->top, r->right, r->bottom);
3026 }
3027 
3028 static char*
3030 struct const_name* table;
3031 int ct;
3032 {
3033  static char numbuf[32];
3034  int i;
3035 
3036  for (i = 0; table[i].name; i++)
3037  if (table[i].value == ct)
3038  return table[i].name;
3039 
3040  sprintf(numbuf, "%d", ct);
3041  return numbuf;
3042 }
3043 
3044 /*
3045  * All data in version 2 is 2-byte word aligned. Odd size data
3046  * is padded with a null.
3047  */
3048 static word
3050 int version;
3051 {
3052  if ((align & 1) && version == 2) {
3053  stage = "aligning for opcode";
3054  read_byte();
3055  }
3056 
3057  stage = "reading opcode";
3058 
3059  if (version == 1)
3060  return read_byte();
3061  else
3062  return read_word();
3063 }
3064 
3065 static longword
3067 {
3068  word i;
3069 
3070  i = read_word();
3071  return (i << 16) | read_word();
3072 }
3073 
3074 static word
3076 {
3077  byte b;
3078 
3079  b = read_byte();
3080 
3081  return (b << 8) | read_byte();
3082 }
3083 
3084 static byte
3086 {
3087  int c;
3088 
3089  if ((c = fgetc(ifp)) == EOF)
3090  pm_error("EOF / read error while %s", stage);
3091 
3092  ++align;
3093  return c & 255;
3094 }
3095 
3096 static signed_byte
3098 {
3099  return (signed_byte)read_byte();
3100 }
3101 
3102 static void
3104 int n;
3105 {
3106  static byte buf[1024];
3107 
3108  align += n;
3109 
3110  for (; n > 0; n -= 1024)
3111  if (fread(buf, n > 1024 ? 1024 : n, 1, ifp) != 1)
3112  pm_error("EOF / read error while %s", stage);
3113 }
3114 
3115 static void
3117 int n;
3118 char* buf;
3119 {
3120  align += n;
3121 
3122  if (fread(buf, n, 1, ifp) != 1)
3123  pm_error("EOF / read error while %s", stage);
3124 }
3125 
3126 #ifdef STANDALONE
3127 
3128 /* glue routines if you don't have PBM+ handy; these are only good enough
3129  * for picttoppm's purposes!
3130  */
3131 
3132 static char* outfile;
3133 
3134 void pm_message(fmt, p1, p2, p3, p4, p5)
3135 char* fmt;
3136 int p1, p2, p3, p4, p5;
3137 {
3138  fprintf(stderr, "picttoppm: ");
3139  fprintf(stderr, fmt, p1, p2, p3, p4, p5);
3140  fprintf(stderr, "\n");
3141 }
3142 
3143 void pm_error(fmt, p1, p2, p3, p4, p5)
3144 char* fmt;
3145 int p1, p2, p3, p4, p5;
3146 {
3147  pm_message(fmt, p1, p2, p3, p4, p5);
3148  exit(1);
3149 }
3150 
3151 int pm_keymatch(arg, opt, minlen)
3152 char* arg, *opt;
3153 int minlen;
3154 {
3155  for (; *arg && *arg == *opt; arg++, opt++)
3156  minlen--;
3157  return !*arg && minlen <= 0;
3158 }
3159 
3160 void ppm_init(argc, argv)
3161 int* argc;
3162 char** argv;
3163 {
3164  outfile = "standard output";
3165 }
3166 
3167 FILE* pm_openr(file)
3168 char* file;
3169 {
3170  FILE* fp;
3171 
3172  if (!(fp = fopen(file, "rb"))) {
3173  fprintf(stderr, "picttoppm: can't read file %s\n", file);
3174  exit(1);
3175  }
3176  outfile = file;
3177  return fp;
3178 }
3179 
3180 void writerr()
3181 {
3182  fprintf(stderr, "picttoppm: write error on %s\n", outfile);
3183  exit(1);
3184 }
3185 
3186 void pm_usage(u)
3187 char* u;
3188 {
3189  fprintf(stderr, "usage: picttoppm %s\n", u);
3190  exit(1);
3191 }
3192 
3193 void ppm_writeppminit(fp, width, height, maxval, forceplain)
3194 FILE* fp;
3195 int width, height, maxval, forceplain;
3196 {
3197  if (fprintf(fp, "P6\n%d %d\n%d\n", width, height, maxval) == EOF)
3198  writerr();
3199 }
3200 
3202 int width;
3203 {
3204  pixel* r;
3205 
3206  if (!(r = (pixel*)malloc(width * sizeof(pixel)))) {
3207  fprintf(stderr, "picttoppm: out of memory\n");
3208  exit(1);
3209  }
3210  return r;
3211 }
3212 
3213 void ppm_writeppmrow(fp, row, width, maxval, forceplain)
3214 FILE* fp;
3215 pixel* row;
3216 int width, maxval, forceplain;
3217 {
3218  while (width--) {
3219  if (fputc(row->r, fp) == EOF) writerr();
3220  if (fputc(row->g, fp) == EOF) writerr();
3221  if (fputc(row->b, fp) == EOF) writerr();
3222  row++;
3223  }
3224 }
3225 
3226 void pm_close(fp)
3227 FILE* fp;
3228 {
3229  if (fclose(fp) == EOF)
3230  writerr();
3231 }
3232 
3233 #endif /* STANDALONE */
3234 
3235 /* Some font searching routines */
3236 
3237 struct fontinfo {
3238  int font;
3239  int size;
3240  int style;
3241  char* filename;
3242  struct font* loaded;
3243  struct fontinfo* next;
3244 };
3245 
3246 static struct fontinfo* fontlist = 0;
3247 static struct fontinfo** fontlist_ins = &fontlist;
3248 
3250 char* dirfile;
3251 {
3252  FILE* fp;
3253  int n, nfont;
3254  char* arg[5], line[1024];
3255  struct fontinfo* fontinfo;
3256 
3257  if (!(fp = fopen(dirfile, "rb")))
3258  return -1;
3259 
3260  nfont = 0;
3261  while (fgets(line, 1024, fp)) {
3262  if ((n = mk_argvn(line, arg, 5)) == 0 || arg[0][0] == '#')
3263  continue;
3264  if (n != 4)
3265  continue;
3266  if (!(fontinfo = (struct fontinfo*)malloc(sizeof(struct fontinfo))) ||
3267  !(fontinfo->filename = (char*)malloc(strlen(arg[3]) + 1)))
3268  {
3269  pm_error("out of memory for font information");
3270  }
3271 
3272  fontinfo->font = atoi(arg[0]);
3273  fontinfo->size = atoi(arg[1]);
3274  fontinfo->style = atoi(arg[2]);
3275  strcpy(fontinfo->filename, arg[3]);
3276  fontinfo->loaded = 0;
3277 
3278  fontinfo->next = 0;
3281  nfont++;
3282  }
3283 
3284  return nfont;
3285 }
3286 
3287 static int abs_value(x)
3288 int x;
3289 {
3290  if (x < 0)
3291  return -x;
3292  else
3293  return x;
3294 }
3295 
3296 static struct font* get_font(font, size, style)
3297 int font;
3298 int size;
3299 int style;
3300 {
3301  int closeness, bestcloseness;
3302  struct fontinfo* fi, *best;
3303 
3304  best = 0;
3305  for (fi = fontlist; fi; fi = fi->next) {
3306  closeness = abs_value(fi->font - font) * 10000 +
3307  abs_value(fi->size - size) * 100 +
3308  abs_value(fi->style - style);
3309  if (!best || closeness < bestcloseness) {
3310  best = fi;
3311  bestcloseness = closeness;
3312  }
3313  }
3314 
3315  if (best) {
3316  if (best->loaded)
3317  return best->loaded;
3318 
3319  if ((best->loaded = pbm_loadbdffont(best->filename)))
3320  return best->loaded;
3321  }
3322 
3323  /* It would be better to go looking for the nth best font, really */
3324  return 0;
3325 }
3326 
3327 #ifdef VMS
3328 unlink(p)
3329  char *p;
3330 {delete(p);}
3331 #endif
double __cdecl exp(double _X)
return _Result< 0 ? -1 :_Result;} #line 1069 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnwprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1091 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, va_list _ArgList) { return _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1108 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _ArgList) { return _vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1133 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1179 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1196 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __vswprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1212 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf(wchar_t *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1227 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1243 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1264 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1281 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1283 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1312 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1347 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_l(_Format,((void *) 0), _ArgList);} #line 1361 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1380 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1394 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __swprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1414 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1435 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf(wchar_t *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1454 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1474 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "__swprintf_l_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __swprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vswprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __vswprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "swprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swprintf(wchar_t *_Buffer, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vswprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vswprintf(wchar_t *_Buffer, wchar_t const *_Format, va_list _Args);__inline int __cdecl _swprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1511 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1532 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1534 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1562 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1582 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1603 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1623 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1646 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1668 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1711 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1737 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1755 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1774 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1792 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #pragma warning(push) #pragma warning(disable:4141 6054) #pragma warning(pop) #line 1856 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" int __cdecl __stdio_common_vswscanf(unsigned __int64 _Options, wchar_t const *_Buffer, size_t _BufferCount, wchar_t const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vswscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1897 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf(wchar_t const *_Buffer, wchar_t const *_Format, va_list _ArgList) { return _vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1947 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1949 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1976 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1995 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_swscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2015 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "swscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl swscanf(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2034 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2054 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 2077 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2100 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2122 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2143 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) typedef __int64 fpos_t;errno_t __cdecl _get_stream_buffer_pointers(FILE *_Stream, char ***_Base, char ***_Pointer, int **_Count);errno_t __cdecl clearerr_s(FILE *_Stream);errno_t __cdecl fopen_s(FILE **_Stream, char const *_FileName, char const *_Mode);size_t __cdecl fread_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);errno_t __cdecl freopen_s(FILE **_Stream, char const *_FileName, char const *_Mode, FILE *_OldStream);char *__cdecl gets_s(char *_Buffer, rsize_t _Size);errno_t __cdecl tmpfile_s(FILE **_Stream);errno_t __cdecl tmpnam_s(char *_Buffer, rsize_t _Size);#line 145 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl clearerr(FILE *_Stream);int __cdecl fclose(FILE *_Stream);int __cdecl _fcloseall(void);FILE *__cdecl _fdopen(int _FileHandle, char const *_Mode);int __cdecl feof(FILE *_Stream);int __cdecl ferror(FILE *_Stream);int __cdecl fflush(FILE *_Stream);int __cdecl fgetc(FILE *_Stream);int __cdecl _fgetchar(void);int __cdecl fgetpos(FILE *_Stream, fpos_t *_Position);char *__cdecl fgets(char *_Buffer, int _MaxCount, FILE *_Stream);int __cdecl _fileno(FILE *_Stream);int __cdecl _flushall(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "fopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl fopen(char const *_FileName, char const *_Mode);int __cdecl fputc(int _Character, FILE *_Stream);int __cdecl _fputchar(int _Character);int __cdecl fputs(char const *_Buffer, FILE *_Stream);size_t __cdecl fread(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);__declspec(deprecated("This function or variable may be unsafe. Consider using " "freopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl freopen(char const *_FileName, char const *_Mode, FILE *_Stream);FILE *__cdecl _fsopen(char const *_FileName, char const *_Mode, int _ShFlag);int __cdecl fsetpos(FILE *_Stream, fpos_t const *_Position);int __cdecl fseek(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl ftell(FILE *_Stream);__int64 __cdecl _ftelli64(FILE *_Stream);size_t __cdecl fwrite(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl getc(FILE *_Stream);int __cdecl getchar(void);int __cdecl _getmaxstdio(void);int __cdecl _getw(FILE *_Stream);void __cdecl perror(char const *_ErrorMessage);int __cdecl _pclose(FILE *_Stream);FILE *__cdecl _popen(char const *_Command, char const *_Mode);#line 344 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl putc(int _Character, FILE *_Stream);int __cdecl putchar(int _Character);int __cdecl puts(char const *_Buffer);int __cdecl _putw(int _Word, FILE *_Stream);int __cdecl remove(char const *_FileName);int __cdecl rename(char const *_OldFileName, char const *_NewFileName);int __cdecl _unlink(char const *_FileName);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_unlink" ". See online help for details.")) int __cdecl unlink(char const *_FileName);#line 391 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl rewind(FILE *_Stream);int __cdecl _rmtmp(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "setvbuf" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) void __cdecl setbuf(FILE *_Stream, char *_Buffer);int __cdecl _setmaxstdio(int _Maximum);int __cdecl setvbuf(FILE *_Stream, char *_Buffer, int _Mode, size_t _Size);__declspec(allocator) char *__cdecl _tempnam(char const *_DirectoryName, char const *_FilePrefix);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpfile_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl tmpfile(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpnam_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl tmpnam(char *_Buffer);int __cdecl ungetc(int _Character, FILE *_Stream);void __cdecl _lock_file(FILE *_Stream);void __cdecl _unlock_file(FILE *_Stream);int __cdecl _fclose_nolock(FILE *_Stream);int __cdecl _fflush_nolock(FILE *_Stream);int __cdecl _fgetc_nolock(FILE *_Stream);int __cdecl _fputc_nolock(int _Character, FILE *_Stream);size_t __cdecl _fread_nolock(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);size_t __cdecl _fread_nolock_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _fseek_nolock(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64_nolock(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl _ftell_nolock(FILE *_Stream);__int64 __cdecl _ftelli64_nolock(FILE *_Stream);size_t __cdecl _fwrite_nolock(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _getc_nolock(FILE *_Stream);int __cdecl _putc_nolock(int _Character, FILE *_Stream);int __cdecl _ungetc_nolock(int _Character, FILE *_Stream);int *__cdecl __p__commode(void);#line 596 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfprintf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_s(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_p(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vfprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 648 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 662 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_s((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 677 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 693 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 695 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_p((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 710 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);} #line 724 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 738 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf(char const *const _Format, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 751 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 765 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf_s(char const *const _Format, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 780 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 796 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p(char const *const _Format, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 809 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 828 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 846 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl _set_printf_count_output(int _Value);int __cdecl _get_printf_count_output(void);__inline int __cdecl _fprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 871 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 891 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 893 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 948 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 965 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 983 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1002 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1004 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1022 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1039 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfscanf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _Arglist);__inline int __cdecl _vfscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options()), _Stream, _Format, _Locale, _ArgList);} #line 1070 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1084 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Stream, _Format, _Locale, _ArgList);} #line 1101 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1118 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1120 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1134 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf(char const *const _Format, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1147 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1161 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf_s(char const *const _Format, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1176 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1178 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _fscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1197 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "fscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl fscanf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1215 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1234 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fscanf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1254 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_scanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _scanf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1274 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "scanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl scanf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1291 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scanf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1309 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl scanf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1330 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsprintf(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsnprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, size_t _MaxCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_p(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1399 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1415 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);return _Result< 0 ? -1 :_Result;} #line 1446 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1462 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl vsprintf(char *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1477 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1498 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1516 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1526 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1547 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1563 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1585 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1602 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1630 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1641 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1659 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf(char const *const _Format, va_list _ArgList) { return _vscprintf_l(_Format,((void *) 0), _ArgList);} #line 1672 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p(char const *const _Format, va_list _ArgList) { return _vscprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1703 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1723 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1739 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1761 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf(char *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl sprintf(char *_Buffer, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl vsprintf(char *_Buffer, char const *_Format, va_list _Args);__inline int __cdecl _sprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1810 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1832 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1834 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1862 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1882 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1905 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1936 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1956 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _snprintf(char *_Buffer, size_t _BufferCount, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _vsnprintf(char *_Buffer, size_t _BufferCount, char const *_Format, va_list _Args);__inline int __cdecl _snprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1986 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2006 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2028 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2049 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2092 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2110 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p(_Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2127 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsscanf(unsigned __int64 _Options, char const *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vsscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2158 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsscanf(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2172 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2189 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __inline int __cdecl vsscanf_s(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2208 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) #line 2219 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2238 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl sscanf(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2275 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sscanf_s(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsscanf_s(_Buffer, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2297 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 2299 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2326 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2349 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2374 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2397 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_tempnam" ". See online help for details.")) char *__cdecl tempnam(char const *_Directory, char const *_FilePrefix);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fcloseall" ". See online help for details.")) int __cdecl fcloseall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fdopen" ". See online help for details.")) FILE *__cdecl fdopen(int _FileHandle, char const *_Format);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fgetchar" ". See online help for details.")) int __cdecl fgetchar(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fileno" ". See online help for details.")) int __cdecl fileno(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_flushall" ". See online help for details.")) int __cdecl flushall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fputchar" ". See online help for details.")) int __cdecl fputchar(int _Ch);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_getw" ". See online help for details.")) int __cdecl getw(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_putw" ". See online help for details.")) int __cdecl putw(int _Ch, FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_rmtmp" ". See online help for details.")) int __cdecl rmtmp(void);#line 2441 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h"__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma once#pragma once#pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int *__cdecl _errno(void);errno_t __cdecl _set_errno(int _Value);errno_t __cdecl _get_errno(int *_Value);unsigned long *__cdecl __doserrno(void);errno_t __cdecl _set_doserrno(unsigned long _Value);errno_t __cdecl _get_doserrno(unsigned long *_Value);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) void *__cdecl memchr(void const *_Buf, int _Val, size_t _MaxCount);int __cdecl memcmp(void const *_Buf1, void const *_Buf2, size_t _Size);void *__cdecl memcpy(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memmove(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memset(void *_Dst, int _Val, size_t _Size);char *__cdecl strchr(char const *_Str, int _Val);char *__cdecl strrchr(char const *_Str, int _Ch);char *__cdecl strstr(char const *_Str, char const *_SubStr);wchar_t *__cdecl wcschr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsrchr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsstr(wchar_t const *_Str, wchar_t const *_SubStr);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) static __inline errno_t __cdecl memcpy_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;if(_Source==((void *) 0)||_DestinationSize< _SourceSize) { memset(_Destination, 0, _DestinationSize);{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;return 22 ;} memcpy(_Destination, _Source, _SourceSize);return 0;} static __inline errno_t __cdecl memmove_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;memmove(_Destination, _Source, _SourceSize);return 0;}#pragma warning(pop) __pragma(pack(pop))#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int __cdecl _memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);int __cdecl _memicmp_l(void const *_Buf1, void const *_Buf2, size_t _Size, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memccpy" ". See online help for details.")) void *__cdecl memccpy(void *_Dst, void const *_Src, int _Val, size_t _Size);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memicmp" ". See online help for details.")) int __cdecl memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl wcscat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcscpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcsncat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);errno_t __cdecl wcsncpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);wchar_t *__cdecl wcstok_s(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);__declspec(allocator) wchar_t *__cdecl _wcsdup(wchar_t const *_String);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscat(wchar_t *_Destination, wchar_t const *_Source);int __cdecl wcscmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscpy(wchar_t *_Destination, wchar_t const *_Source);size_t __cdecl wcscspn(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcslen(wchar_t const *_String);size_t __cdecl wcsnlen(wchar_t const *_Source, size_t _MaxCount);static __inline size_t __cdecl wcsnlen_s(wchar_t const *_Source, size_t _MaxCount) { return(_Source==0) ? 0 :wcsnlen(_Source, _MaxCount);}__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncat(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);int __cdecl wcsncmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncpy(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);wchar_t *__cdecl wcspbrk(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcsspn(wchar_t const *_String, wchar_t const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcstok(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);#line 237 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstring.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline wchar_t *__cdecl _wcstok(wchar_t *const _String, wchar_t const *const _Delimiter) { return wcstok(_String, _Delimiter, 0);} __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcserror(int _ErrorNumber);errno_t __cdecl _wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, int _ErrorNumber);__declspec(deprecated("This function or variable may be unsafe. Consider using " "__wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl __wcserror(wchar_t const *_String);errno_t __cdecl __wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, wchar_t const *_ErrorMessage);int __cdecl _wcsicmp(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicmp_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicmp_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);errno_t __cdecl _wcsnset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);wchar_t *__cdecl _wcsrev(wchar_t *_String);errno_t __cdecl _wcsset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsset(wchar_t *_String, wchar_t _Value);errno_t __cdecl _wcslwr_s(wchar_t *_String, size_t _SizeInWords);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr(wchar_t *_String);errno_t __cdecl _wcslwr_s_l(wchar_t *_String, size_t _SizeInWords, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr_l(wchar_t *_String, _locale_t _Locale);errno_t __cdecl _wcsupr_s(wchar_t *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr(wchar_t *_String);errno_t __cdecl _wcsupr_s_l(wchar_t *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr_l(wchar_t *_String, _locale_t _Locale);size_t __cdecl wcsxfrm(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount);size_t __cdecl _wcsxfrm_l(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount, _locale_t _Locale);int __cdecl wcscoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcscoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsicoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsncoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsncoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _wcsnicoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsdup" ". See online help for details.")) wchar_t *__cdecl wcsdup(wchar_t const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicmp" ". See online help for details.")) int __cdecl wcsicmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnicmp" ". See online help for details.")) int __cdecl wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnset" ". See online help for details.")) wchar_t *__cdecl wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsrev" ". See online help for details.")) wchar_t *__cdecl wcsrev(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsset" ". See online help for details.")) wchar_t *__cdecl wcsset(wchar_t *_String, wchar_t _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcslwr" ". See online help for details.")) wchar_t *__cdecl wcslwr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsupr" ". See online help for details.")) wchar_t *__cdecl wcsupr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicoll" ". See online help for details.")) int __cdecl wcsicoll(wchar_t const *_String1, wchar_t const *_String2);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl strcpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strcat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strerror_s(char *_Buffer, size_t _SizeInBytes, int _ErrorNumber);errno_t __cdecl strncat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);errno_t __cdecl strncpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);char *__cdecl strtok_s(char *_String, char const *_Delimiter, char **_Context);void *__cdecl _memccpy(void *_Dst, void const *_Src, int _Val, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcat(char *_Destination, char const *_Source);int __cdecl strcmp(char const *_Str1, char const *_Str2);int __cdecl _strcmpi(char const *_String1, char const *_String2);int __cdecl strcoll(char const *_String1, char const *_String2);int __cdecl _strcoll_l(char const *_String1, char const *_String2, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcpy(char *_Destination, char const *_Source);size_t __cdecl strcspn(char const *_Str, char const *_Control);__declspec(allocator) char *__cdecl _strdup(char const *_Source);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strerror(char const *_ErrorMessage);errno_t __cdecl _strerror_s(char *_Buffer, size_t _SizeInBytes, char const *_ErrorMessage);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strerror(int _ErrorMessage);int __cdecl _stricmp(char const *_String1, char const *_String2);int __cdecl _stricoll(char const *_String1, char const *_String2);int __cdecl _stricoll_l(char const *_String1, char const *_String2, _locale_t _Locale);int __cdecl _stricmp_l(char const *_String1, char const *_String2, _locale_t _Locale);size_t __cdecl strlen(char const *_Str);errno_t __cdecl _strlwr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr(char *_String);errno_t __cdecl _strlwr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr_l(char *_String, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncat(char *_Destination, char const *_Source, size_t _Count);int __cdecl strncmp(char const *_Str1, char const *_Str2, size_t _MaxCount);int __cdecl _strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicmp_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strnicoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strncoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strncoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);size_t __cdecl __strncnt(char const *_String, size_t _Count);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncpy(char *_Destination, char const *_Source, size_t _Count);size_t __cdecl strnlen(char const *_String, size_t _MaxCount);static __inline size_t __cdecl strnlen_s(char const *_String, size_t _MaxCount) { return _String==0 ? 0 :strnlen(_String, _MaxCount);} errno_t __cdecl _strnset_s(char *_String, size_t _SizeInBytes, int _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strnset(char *_Destination, int _Value, size_t _Count);char *__cdecl strpbrk(char const *_Str, char const *_Control);char *__cdecl _strrev(char *_Str);errno_t __cdecl _strset_s(char *_Destination, size_t _DestinationSize, int _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strset(char *_Destination, int _Value);size_t __cdecl strspn(char const *_Str, char const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strtok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strtok(char *_String, char const *_Delimiter);errno_t __cdecl _strupr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr(char *_String);errno_t __cdecl _strupr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr_l(char *_String, _locale_t _Locale);size_t __cdecl strxfrm(char *_Destination, char const *_Source, size_t _MaxCount);size_t __cdecl _strxfrm_l(char *_Destination, char const *_Source, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strdup" ". See online help for details.")) char *__cdecl strdup(char const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strcmpi" ". See online help for details.")) int __cdecl strcmpi(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_stricmp" ". See online help for details.")) int __cdecl stricmp(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strlwr" ". See online help for details.")) char *__cdecl strlwr(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnicmp" ". See online help for details.")) int __cdecl strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnset" ". See online help for details.")) char *__cdecl strnset(char *_String, int _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strrev" ". See online help for details.")) char *__cdecl strrev(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strset" ". See online help for details.")) char *__cdecl strset(char *_String, int _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strupr" ". See online help for details.")) char *__cdecl strupr(char *_String);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) __pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) typedef unsigned short _ino_t;typedef _ino_t ino_t;#line 24 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef unsigned int _dev_t;typedef _dev_t dev_t;#line 36 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef long _off_t;typedef _off_t off_t;#line 48 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h"#pragma warning(pop) typedef char *sds;#pragma pack(push, 1) struct sdshdr5 { unsigned char flags;char buf[];};struct sdshdr8 { uint8_t len;uint8_t alloc;unsigned char flags;char buf[];};struct sdshdr16 { uint16_t len;uint16_t alloc;unsigned char flags;char buf[];};struct sdshdr32 { uint32_t len;uint32_t alloc;unsigned char flags;char buf[];};struct sdshdr64 { uint64_t len;uint64_t alloc;unsigned char flags;char buf[];};#pragma pack(pop) static inline size_t sdslen(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :return((flags) >> 3) ;case 1 :return((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len;case 2 :return((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len;case 3 :return((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) ->len;case 4 :return((struct sdshdr64 *)((s) -(sizeof(struct sdshdr64)))) ->len;} return 0;}static inline size_t sdsavail(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ return 0;} case 1 :{ struct sdshdr8 *sh=(void *)((s) -(sizeof(struct sdshdr8)));;return sh->alloc - sh->len;} case 2 :{ struct sdshdr16 *sh=(void *)((s) -(sizeof(struct sdshdr16)));;return sh->alloc - sh->len;} case 3 :{ struct sdshdr32 *sh=(void *)((s) -(sizeof(struct sdshdr32)));;return sh->alloc - sh->len;} case 4 :{ struct sdshdr64 *sh=(void *)((s) -(sizeof(struct sdshdr64)));;return sh->alloc - sh->len;} } return 0;}static inline void sdssetlen(sds s, size_t newlen) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ unsigned char *fp=((unsigned char *) s) - 1;*fp=0|(newlen<< 3);} break;case 1 :((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len=(uint8_t) newlen;break;case 2 :((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len=(uint16_t) newlen;break;case 3 :((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) -> len
Definition: CPAL.d:15583
#define buflen
Definition: afm2pl.c:181
struct @88 table[500]
#define font
Definition: aptex-macros.h:175
#define width(a)
Definition: aptex-macros.h:198
#define type(a)
Definition: aptex-macros.h:171
#define name
#define height(a)
Definition: aptex-macros.h:200
#define mode
Definition: aptex-macros.h:510
static gray maxval
Definition: asciitopgm.c:38
char * p2
Definition: bmpfont.h:62
char * p1
Definition: bmpfont.h:62
static int bits_per_pixel(cairo_xlib_surface_t *surface)
#define n
Definition: t4ht.c:1290
#define b
Definition: jpegint.h:372
#define free(a)
Definition: decNumber.cpp:310
int w
Definition: dviconv.c:26
int v
Definition: dviconv.c:10
int h
Definition: dviconv.c:9
#define fopen
Definition: xxstdio.h:21
#define fread
Definition: xxstdio.h:25
#define fgets
Definition: xxstdio.h:29
#define fgetc
Definition: xxstdio.h:26
static int np
Definition: bifont.c:64
int strcmp()
Definition: coll.cpp:143
char * strcpy()
char * temp
Definition: dvidvi.c:137
struct rect rect
Definition: dvipdfm.c:59
static void
Definition: fpif.c:118
DataHeader dh
Definition: genbrk.cpp:103
#define s
Definition: afcover.h:80
#define r1
#define r3
#define r2
static char usage[]
Definition: giftopnm.c:59
#define c(n)
Definition: gpos-common.c:150
#define d(n)
Definition: gpos-common.c:151
int col
Definition: gsftopk.c:443
unsigned char pixelrow[1023]
Definition: hbf2gf.c:377
static FILE * outfile
Definition: wrjpgcom.c:80
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific f u
Definition: afcover.h:88
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
Arabic default style
Definition: afstyles.h:94
void exit()
#define EOF
Definition: afmparse.c:59
kerning y
Definition: ttdriver.c:212
@ right
Definition: annotate.c:15
int int double double double char double points
Definition: gdfx.h:18
int int double double double char double char char * bottom
Definition: gdfx.h:20
int atoi(const char *)
static unsigned char pat[8]
Definition: pkfont.c:194
#define unlink(file)
Definition: config.h:413
#define buf
#define fclose
Definition: debug.h:100
#define popen(cmd, mode)
Definition: mingw32.h:91
#define pclose(file)
Definition: win32lib.h:271
#define system(p)
Definition: win32lib.h:269
#define fprintf
Definition: mendex.h:64
static const unsigned char dv[]
Definition: nkf.c:577
#define length(c)
Definition: ctangleboot.c:65
union hdr header
Definition: pbmtomacp.c:291
#define malloc
Definition: alloca.c:91
#define sprintf
Definition: snprintf.c:44
float x
Definition: cordic.py:15
def fontinfo
Definition: mftrace.py:1364
#define version
Definition: nup.c:10
int k
Definition: otp-parser.c:70
void pm_usage(char *usage)
Definition: libpbm1.c:343
FILE * pm_openr(char *name)
Definition: libpbm1.c:600
void pm_perror(char *reason)
Definition: libpbm1.c:351
struct font * pbm_loadbdffont(char *name)
Definition: libpbm5.c:946
int mk_argvn(char *s, vec, int mk_max)
Definition: libpbm5.c:1079
struct font * pbm_defaultfont(char *name)
Definition: libpbm5.c:641
static int rows
Definition: pbmclean.c:15
static int format
Definition: pbmclean.c:15
static int cols
Definition: pbmmask.c:21
#define abs(a)
Definition: pbmplus.h:225
#define ARGS(alist)
Definition: pbmplus.h:235
#define min(a, b)
Definition: pbmplus.h:223
#define max(a, b)
Definition: pbmto4425.c:11
#define scaled
Definition: pdftypes.h:88
static void subPin(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1256
static word text_size
Definition: picttoppm.c:144
static void read_pixmap()
static struct opdef optable[]
Definition: picttoppm.c:300
static void read_short_point()
static word read_word()
Definition: picttoppm.c:3075
#define SGN(a)
Definition: picttoppm.c:2243
static void srcXor(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1165
#define grab_destination()
static void skip_text()
Definition: picttoppm.c:2621
static void subOver(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1246
static int verbose
Definition: picttoppm.c:119
static word * red
Definition: picttoppm.c:113
unsigned char byte
Definition: picttoppm.c:62
static void OpColor()
static void TxFont()
static int load_fontdir()
static longword planelen
Definition: picttoppm.c:118
static void RGBBkCol()
static byte text_face
Definition: picttoppm.c:141
static void dump_rect()
static void paintSameRect()
static void do_frameRect()
static byte read_byte()
Definition: picttoppm.c:3085
static struct RGBColour foreground
Definition: picttoppm.c:127
static int align
Definition: picttoppm.c:537
static void read_rgb()
static word pen_height
Definition: picttoppm.c:137
static int ps_cent_y
Definition: picttoppm.c:154
static struct Rect cur_rect
Definition: picttoppm.c:133
static int ps_text
Definition: picttoppm.c:148
static struct Pattern bkpat
Definition: picttoppm.c:130
static struct font * tfont
Definition: picttoppm.c:145
static void read_rect()
static void addPin(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1226
#define put_destination()
unsigned short word
Definition: picttoppm.c:64
#define RGB_LEN
Definition: picttoppm.c:296
static void blend(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1294
static void TxSize()
static struct RGBColour background
Definition: picttoppm.c:128
static void DHText()
#define AMI_OP
Definition: picttoppm.c:1347
static void transparent(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1307
struct const_name ps_flip_name[]
Definition: picttoppm.c:522
static void ShortComment()
static void do_blits()
Definition: picttoppm.c:811
void(* transfer_func)()
Definition: picttoppm.c:109
static int abs_value()
static void scan_poly()
static void do_ps_text()
static int ps_cent_x
Definition: picttoppm.c:153
static void Line()
static void rectscale()
#define res(length)
Definition: picttoppm.c:287
static void notSrcBic(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1200
static struct Rect picFrame
Definition: picttoppm.c:112
#define WORD_LEN
Definition: picttoppm.c:179
struct const_name ps_just_name[]
Definition: picttoppm.c:513
static struct fontinfo * fontlist
Definition: picttoppm.c:3246
static void picComment()
static void read_8x8_pattern()
static void LongText()
char signed_byte
Definition: picttoppm.c:63
static void rotate()
static int fullres
Definition: picttoppm.c:120
static void srcOr(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1157
static void paintRect()
static void poly_sort()
static void RGBFgCol()
static void LongComment()
static byte ps_flip
Definition: picttoppm.c:150
static void LineFrom()
static void adMin(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1285
static void adMax(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1276
static void read_n()
static byte ps_linespace
Definition: picttoppm.c:152
static FILE * ifp
Definition: picttoppm.c:538
static void read_pattern()
Definition: picttoppm.c:2036
static void skip_poly_or_region()
static struct Pattern fillpat
Definition: picttoppm.c:131
#define NA
Definition: picttoppm.c:298
static void do_paintRect()
static int blit()
static struct blit_info ** last_bl
Definition: picttoppm.c:177
static struct fontinfo ** fontlist_ins
Definition: picttoppm.c:3247
static void do_bitmap()
static struct Pattern pen_pat
Definition: picttoppm.c:135
static int rectwidth()
static void do_text()
static void PnPat()
static void Opcode_9A()
#define PIXEL_INDEX(x, y)
Definition: picttoppm.c:2166
static word pen_width
Definition: picttoppm.c:136
static void frameSameRect()
static word text_font
Definition: picttoppm.c:140
#define resf(skipfunction)
Definition: picttoppm.c:291
static char * const_name()
static int ps_cent_set
Definition: picttoppm.c:155
static int rectsamesize()
static void notSrcCopy(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1182
unsigned long longword
Definition: picttoppm.c:65
static void FillPixPat()
static void DVText()
static struct blit_info * blit_list
Definition: picttoppm.c:176
static void notSrcOr(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1192
#define blend_component(cmp)
static void addOver(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1217
static void PnPixPat()
static void DHDVText()
static word * green
Definition: picttoppm.c:114
struct const_name font_name[]
Definition: picttoppm.c:492
static struct RGBColour * read_colour_table()
Definition: picttoppm.c:1952
static void draw_pen()
static void do_pixmap()
static byte * expand_buf()
static void notSrcXor(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1208
static void PnLocHFrac()
static void BkPixPat()
static void read_point()
static void draw_pen_rect()
static word pen_mode
Definition: picttoppm.c:138
static void ShortLineFrom()
static struct blit_info * add_blit_list()
Definition: picttoppm.c:1119
#define rgb_is_white(x)
Definition: picttoppm.c:1144
static byte * unpackbits()
static int rectheight()
static struct RGBColour op_colour
Definition: picttoppm.c:129
static void BitsRegion()
static word collen
Definition: picttoppm.c:117
static void PnMode()
static void TxFace()
struct const_name transfer_name[]
Definition: picttoppm.c:472
static transfer_func pen_trf
Definition: picttoppm.c:139
static void PnSize()
#define sign(x)
static int recognize_comment
Definition: picttoppm.c:121
static void FillPat()
static word ps_rotation
Definition: picttoppm.c:151
static void paintPoly()
static struct font * get_font()
static void compact_plane()
static struct Point current
Definition: picttoppm.c:134
static word rowlen
Definition: picttoppm.c:116
static void scan_line()
static char * stage
Definition: picttoppm.c:111
#define REDEPTH(c, oldmax)
static void frameRect()
static byte ps_just
Definition: picttoppm.c:149
static struct RGBColour white
Definition: picttoppm.c:124
static void draw_pixel()
static void TxMode()
static void interpret_pict()
Definition: picttoppm.c:601
static transfer_func text_trf
Definition: picttoppm.c:143
static void skip()
Definition: gsftopk.c:516
#define ABS(a)
Definition: picttoppm.c:2241
static void srcBic(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1174
static struct RGBColour black
Definition: picttoppm.c:123
static void alloc_planes()
Definition: picttoppm.c:734
#define rgb_is_black(x)
Definition: picttoppm.c:1145
static void rectinter()
static void Clip()
static void srcCopy(struct RGBColour *src, struct RGBColour *dst)
Definition: picttoppm.c:1147
static longword read_long()
Definition: picttoppm.c:3066
static word text_mode
Definition: picttoppm.c:142
static signed_byte read_signed_byte()
Definition: picttoppm.c:3097
static word get_op()
static transfer_func transfer()
static void ShortLine()
int main(int argc, argv)
Definition: picttoppm.c:541
static void BitsRect()
static word * blue
Definition: picttoppm.c:115
static void output_ppm()
static struct Rect clip_rect
Definition: picttoppm.c:132
static void BkPat()
#define fp
#define pm_error
Definition: png22pnm.c:118
#define pm_keymatch(stra, strb, _x)
Definition: png22pnm.c:121
unsigned long pixel
Definition: png22pnm.c:123
#define pm_close(file)
Definition: png22pnm.c:120
#define pm_message
Definition: png22pnm.c:116
double scale
Definition: pnmhistmap.c:38
void ppm_readppmrow(FILE *file, pixel *pixelrow, int cols, pixval maxval, int format)
Definition: libppm1.c:87
void ppm_init(int *argcP, argv)
Definition: libppm1.c:21
void ppm_readppminit(FILE *file, int *colsP, int *rowsP, pixval *maxvalP, int *formatP)
Definition: libppm1.c:53
void ppm_writeppmrow(FILE *file, pixel *pixelrow, int cols, pixval maxval, int forceplain)
Definition: libppm2.c:129
void ppm_writeppminit(FILE *file, int cols, int rows, pixval maxval, int forceplain)
Definition: libppm2.c:23
#define PPM_GETR(p)
Definition: ppm.h:36
#define PPM_ASSIGN(p, red, grn, blu)
Definition: ppm.h:46
#define PPM_GETG(p)
Definition: ppm.h:37
#define PPM_MAXMAXVAL
Definition: ppm.h:31
#define ppm_freerow(pixelrow)
Definition: ppm.h:74
#define PPM_GETB(p)
Definition: ppm.h:38
gray pixval
Definition: ppm.h:9
#define ppm_allocrow(cols)
Definition: ppm.h:72
static int size
Definition: ppmlabel.c:24
int g
Definition: ppmqvga.c:68
int r
Definition: ppmqvga.c:68
static double yscale
Definition: ppmtopjxl.c:47
static int ysize
Definition: ppmtopjxl.c:42
static double xscale
Definition: ppmtopjxl.c:46
static int xsize
Definition: ppmtopjxl.c:41
bstring c int memset(void *s, int c, int length)
static int row
Definition: ps2pk.c:587
#define x1
#define y1
#define y2
#define x2
#define impl
Definition: pts_fax.c:34
#define str(s)
Definition: sh6.c:399
char linebuf[12000]
Definition: spottopgm.c:21
Definition: dt2dv.c:55
byte pix[64]
Definition: picttoppm.c:106
word x
Definition: picttoppm.c:101
word y
Definition: picttoppm.c:102
word blue
Definition: picttoppm.c:97
word green
Definition: picttoppm.c:96
word red
Definition: picttoppm.c:95
Definition: picttoppm.c:71
word top
Definition: picttoppm.c:72
word right
Definition: picttoppm.c:75
word left
Definition: picttoppm.c:73
word bottom
Definition: picttoppm.c:74
struct RGBColour * colour_map
Definition: picttoppm.c:171
int pixSize
Definition: picttoppm.c:169
struct Rect dstRect
Definition: picttoppm.c:170
byte * srcplane
Definition: picttoppm.c:168
struct Rect srcBounds
Definition: picttoppm.c:166
struct Rect srcRect
Definition: picttoppm.c:165
int mode
Definition: picttoppm.c:172
int srcwid
Definition: picttoppm.c:167
struct blit_info * next
Definition: picttoppm.c:173
char * name
Definition: picttoppm.c:467
Definition: libppm5.c:414
short x
Definition: libppm5.c:415
short y
Definition: libppm5.c:416
Definition: dir.c:406
Definition: filedef.h:30
Definition: pbmfont.h:11
struct glyph * glyph[256]
Definition: pbmfont.h:14
struct font * loaded
Definition: picttoppm.c:3242
char * filename
Definition: picttoppm.c:3241
int style
Definition: picttoppm.c:3240
int size
Definition: picttoppm.c:3239
int font
Definition: picttoppm.c:3238
struct fontinfo * next
Definition: picttoppm.c:3243
Definition: pbmfont.h:4
int width
Definition: pbmfont.h:5
int x
Definition: pbmfont.h:6
int height
Definition: pbmfont.h:5
int y
Definition: pbmfont.h:6
char * bmap
Definition: pbmfont.h:8
int xadd
Definition: pbmfont.h:7
Definition: bdf.c:133
int len
Definition: picttoppm.c:159
char * description
Definition: picttoppm.c:161
char * name
Definition: picttoppm.c:158
void(* impl)()
Definition: picttoppm.c:160
longword packSize
Definition: picttoppm.c:82
word cmpCount
Definition: picttoppm.c:87
longword vRes
Definition: picttoppm.c:84
longword pmTable
Definition: picttoppm.c:90
word pixelSize
Definition: picttoppm.c:86
longword pmReserved
Definition: picttoppm.c:91
word cmpSize
Definition: picttoppm.c:88
word pixelType
Definition: picttoppm.c:85
word version
Definition: picttoppm.c:80
struct Rect Bounds
Definition: picttoppm.c:79
word packType
Definition: picttoppm.c:81
longword planeBytes
Definition: picttoppm.c:89
longword hRes
Definition: picttoppm.c:83
Definition: ppm.h:33
Definition: dvipdfm.c:55
Definition: jpegtopnm.c:237
Definition: table.h:30
Definition: strexpr.c:21
#define FILE
Definition: t1stdio.h:34
ch
Definition: t4ht.c:1443
int j
Definition: t4ht.c:1589
*job_name strlen((char *) job_name) - 4)
char * file
Definition: t4ht.c:931
char fmt[256]
Definition: tex4ht.c:3925
val
Definition: tex4ht.c:3227
TT_Glyph glyph
Definition: ttf2pfb.c:162
Definition: obx.h:51
long long scaled
Definition: vf_ng.c:93
#define argv
Definition: xmain.c:270
#define argc
Definition: xmain.c:269
#define argn