This file is indexed.

/usr/include/ncarg/ncarg_ras.h is in libncarg-dev 6.1.2-7.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
/*
 *	$Id: ncarg_ras.h,v 1.21 2008-07-27 03:22:41 haley Exp $
 */
/************************************************************************
*                                                                       *
*                Copyright (C)  2000                                    *
*        University Corporation for Atmospheric Research                *
*                All Rights Reserved                                    *
*                                                                       *
*    The use of this Software is governed by a License Agreement.       *
*                                                                       *
************************************************************************/

#ifndef _RASTER_
#define _RASTER_

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>	 /* included for 'struct stat' */
#include <ncarg/c.h>

/*************************** TYPE DEFINITIONS *************************/

typedef enum {
	RAS_OK		= 1,
	RAS_EOF		= 0,
	RAS_ERROR	= -1
} RasterErrorType;

#define RAS_DEFAULT_NCOLORS	256

typedef enum {
	RAS_UNKNOWN,
	RAS_INDEXED,
	RAS_DIRECT
} RasterEncoding;

struct RasterStruct {
	/* File Related */
	char			*name;
	char			*format;
	char			*dep;		/* Format dependent */
	int			fd;		/* File descriptor */
	FILE			*fp;		/* FILE pointer */
	int			written;	/* File has been written */
	int			read;		/* File has been read */
	/*
	The next three items are associated with the file
	and tracked to insure that they do not change from
	frame to frame i.e. this interface assumes that
	all images within a single file have the same
	dimensions and encoding type.
	*/
	int			file_nx;
	int			file_ny;
	RasterEncoding		file_type;

	/* Image Related */
	int			nx;
	int			ny;		/* Vertical dimension */
	int			depth;		/* Bits deep */
	int			length;		/* Image length in bytes */
	RasterEncoding		type;		/* Encoding type */
	int			ncolor;		/* Number of colors */
	char			*text;		/* Comments and such */
	int			map_forced;	/* Color map force loaded */
	unsigned char		*red;		/* Red color table */
	unsigned char		*green;		/* Green color table */
	unsigned char		*blue;		/* Blue color table */
	unsigned char		*data;		/* Image pixels */
	struct RasterStruct	*(*Open)();
	struct RasterStruct	*(*OpenWrite)();
	int			(*Read)();
	int			(*Write)();
	int			(*Close)();
	int			(*PrintInfo)();
	int			(*ImageCount)();
};

typedef struct RasterStruct Raster;

struct	RasStatStruct {
	struct stat	stat;	/* UNIX stat struct	*/
	RasterEncoding	type;	/* Encoding type	*/
	int		nx, 	/* horizontal dimension	*/
			ny;	/* vertical dimension	*/
};

typedef	struct	RasStatStruct	RasStat;

typedef struct _RasterfileStruct {
	char			*name;
	char			*format;
	int			mode;
	int			fd;
	FILE			*fp;
	int			written;
	Raster			*ras;
	char			*dep;
} RasterfileStruct;

/********************* IMAGE PROCESSING MACROS ***********************/

#define INDEXED_PIXEL(ras, x, y) \
	ras->data[((y) * ras->nx) + (x)]

#define INDEXED_PIXEL_PTR(ras, x, y) \
	&ras->data[((y) * ras->nx) + (x)]

#define INDEXED_RED(ras, pixel) \
	ras->red[(pixel)]

#define INDEXED_GREEN(ras, pixel) \
	ras->green[(pixel)]

#define INDEXED_BLUE(ras, pixel) \
	ras->blue[(pixel)]

#define COPY_COLORMAP(from, to) \
	{ \
	int	i; \
		for(i=0; i<256; i++) { \
			(to)->red[i] = (from)->red[i]; \
			(to)->green[i] = (from)->green[i]; \
			(to)->blue[i] = (from)->blue[i]; \
		} \
	}

#define DIRECT_RED(ras, x, y) \
	(ras)->data[(y) * 3 * (ras)->nx + (x) * 3 + 0]

#define DIRECT_GREEN(ras, x, y) \
	(ras)->data[(y) * 3 * (ras)->nx + (x) * 3 + 1]

#define DIRECT_BLUE(ras, x, y) \
	(ras)->data[(y) * 3 * (ras)->nx + (x) * 3 + 2]

#define DIRECT_RED_PTR(ras, x, y) \
	&(ras)->data[(y) * 3 * (ras)->nx + (x) * 3 + 0]

#define DIRECT_GREEN_PTR(ras, x, y) \
	&(ras)->data[(y) * 3 * (ras)->nx + (x) * 3 + 1]

#define DIRECT_BLUE_PTR(ras, x, y) \
	&(ras)->data[(y) * 3 * (ras)->nx + (x) * 3 + 2]

#define DIRECT_Y(ras, x, y) \
	(ras)->data[(y) * 2 * (ras)->nx + (x) * 2 + 0]

#define DIRECT_UV(ras, x, y) \
	(ras)->data[(y) * 3 * (ras)->nx + (x) * 3 + 1]


#define NrtNformatName		"NrtNformatName"
#define NrtNformatDesc		"NrtNformatDesc"

/* Definitions related to machine portability */

#define CARD32	unsigned long
#define CARD16	unsigned int
#define CARD8	unsigned char

#ifdef CRAY
#define B32	:32
#define B16	:16
#else
#define B32
#define B16
#endif /* CRAY */

/**************************** ERROR CODES ********************************/

/*
These macros relate to the HDF library. For new versions,
these must be checked for consistency!.
*/

#define HDF_ERROR_START		2001
#define HDF_ERRNO		(HDF_ERROR_START - 1 + abs(DFerror))

/* Raster library error codes */

#define RAS_ERROR_START		1001

typedef enum {
	 RAS_E_SYSTEM = RAS_ERROR_START,
	 RAS_E_INTERNAL,
	 RAS_E_8BIT_PIXELS_ONLY,
	 RAS_E_8BIT_INTENSITIES_ONLY,
	 RAS_E_8BIT_RUNLENGTHS_ONLY,
	 RAS_E_NOT_IN_CORRECT_FORMAT,
	 RAS_E_UNSUPPORTED_ENCODING,
	 RAS_E_IMPROPER_COLORMAP_LOAD,
	 RAS_E_COLORMAP_TOO_BIG,
	 RAS_E_IMAGE_SIZE_CHANGED,
	 RAS_E_IMAGE_TYPE_CHANGED,
	 RAS_E_NO_FORMAT_SPECIFIED,
	 RAS_E_NULL_NAME,
	 RAS_E_UNKNOWN_FORMAT,
	 RAS_E_INVALID_COLORMAP,
	 RAS_E_NO_OPTION_PARM,
	 RAS_E_UNSUPPORTED_RESOLUTION,
	 RAS_E_BOGUS_RASTER_STRUCTURE,
	 RAS_E_UNSUPPORTED_FUNCTION,
	 RAS_E_SUN_RLE_UNSUPPORTED,
	 RAS_E_PARALLAX,
	 RAS_E_PREMATURE_EOF,
	 RAS_E_PROGRAMMING,
	 RAS_E_TOO_MANY_DITHERBITS,
	 RAS_E_UNKNOWN_RESOURCE,
	 RAS_E_BOGUS_COOKIE
} RasterErrorIndex;

/* Definitions common to all machines */

#ifndef True
#define True		1
#endif

#ifndef False
#define False		0
#endif

/************************* Function Prototypes **************************/

/* This macro protects C function names from C++ name-mangling. */
NCARG_PROTO_BEGIN

extern	int	RasterInit(
#ifdef	NeedFuncProto
	int	*argc,
	char	*argv[]
#endif
	);

extern	int	RasterPrintOptions();

extern	Raster *RasterOpen(
#ifdef	NeedFuncProto
        char    *name,
        char    *format
#endif
	);

extern	Raster *RasterOpenWrite(
#ifdef	NeedFuncProto
        char    	*name,
        int     	nx,
        int     	ny,
        char   		*comment,
        RasterEncoding	encoding,
        char    	*format
#endif
	);

extern	int RasterWrite(
#ifdef	NeedFuncProto
        Raster  *ras
#endif
	);

extern	int RasterRead(
#ifdef	NeedFuncProto
        Raster  *ras
#endif
	);

extern	int RasterClose(
#ifdef	NeedFuncProto
        Raster  *ras
#endif
	);

extern	int RasterPrintInfo(
#ifdef	NeedFuncProto
        Raster  *ras
#endif
	);

extern	int RasterLoadPalette(
#ifdef	NeedFuncProto
        Raster  *ras,
        unsigned char	*colors
#endif
	);

extern	int RasterPrintColors(
#ifdef	NeedFuncProto
        Raster  *ras
#endif
	);

extern	int RasterCopyColormap(
#ifdef	NeedFuncProto
        Raster  *src,
        Raster  *dst
#endif
	);

extern	Raster *RasterCreate(
#ifdef	NeedFuncProto
	int		nx,
	int		ny,
	RasterEncoding	encoding
#endif
	);

extern	char   *RasterTypeString(
#ifdef	NeedFuncProto
	RasterEncoding	type
#endif
	);

extern	int RasterDestroy(
#ifdef	NeedFuncProto
        Raster  *ras
#endif
	);

extern	Voidptr	ras_malloc(
#ifdef	NeedFuncProto
	unsigned	len
#endif
	);

extern	Voidptr	ras_calloc(
#ifdef NeedFuncProto
	unsigned	nelem,
	unsigned	elsize
#endif
	);

extern	void	ras_free(
#ifdef NeedFuncProto
	Voidptr		p
#endif
	);

extern	int	RasterStat(
#ifdef	NeedFuncProto
	char	*path,
	char	*format,
	RasStat	*ras_stat,
	int	*icount
#endif
	);

extern const char *RasterGetFormatFromName(
#ifdef NeedFuncProto
	const char	*name
#endif
	);

extern	int RasterResampleBilinear(
#ifdef	NeedFuncProto
        Raster  *src,
        Raster  *dst,
	int	verbose
#endif
	);

extern	int RasterResampleNearestNeighbor(
#ifdef	NeedFuncProto
        Raster  *src,
        Raster  *dst,
	int	verbose
#endif
	);

extern	Raster	*RasterScale(
#ifdef	NeedFuncProto
        Raster  *src,
	int	scale
#endif
	);


extern	void	RasterCopy(
#ifdef	NeedFuncProto
	Raster	*src,
	Raster	*dst,
	int	src_x, 
	int	src_y, 
	int	src_nx, 
	int	src_ny
#endif
);

extern	void	RasterOp(
#ifdef	NeedFuncProto
	Raster	*src,
	Raster	*dst,
	int	src_x,
	int	src_y,
	int	src_nx,
	int	src_ny,
	int	dst_x,
	int	dst_y,
	int	op
#endif
);

extern	int RasterCenterCrop(
#ifdef	NeedFuncProto
	Raster		*src,
	Raster		*dst
#endif
);

extern	int RasterInvert(
#ifdef	NeedFuncProto
	Raster		*src,
	Raster		*dst
#endif
);


extern int	RasterInitError();

extern int	RasterSetError(
#ifdef	NeedFuncProto
	int	error_number
#endif
);

extern const char *RasterGetError();

extern int	RasterEsprintfError();

extern int	RasterPrintError();



/********* Function definitions for Generic driver ********************/

extern int GenericClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for SGI semi-public interface ***********/

extern Raster *SGIOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int SGIRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *SGIOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int SGIWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int SGIPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int SGIClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int SGISetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for NRIF semi-public interface ***********/

extern Raster *NrifOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int NrifRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *NrifOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int NrifWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int NrifPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int NrifClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int NrifSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for Sun semi-public interface ***********/

extern Raster *SunOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int SunRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *SunOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int SunWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int SunPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int SunClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int SunSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for XWD semi-public interface ***********/

extern Raster *XWDOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int XWDRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *XWDOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int XWDWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int XWDPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int XWDClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int XWDSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for HDF semi-public interface ***********/

extern Raster *HDFOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int HDFRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *HDFOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int HDFWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int HDFPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int HDFClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int HDFSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for AVS semi-public interface ***********/

extern Raster *AVSOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int AVSRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *AVSOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int AVSWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int AVSPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int AVSClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int AVSSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for Parallax semi-public interface ***********/

extern Raster *ParallaxOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int ParallaxRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *ParallaxOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int ParallaxWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int ParallaxPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int ParallaxClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int ParallaxSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for HPPCL semi-public interface ***********/

extern Raster *HPPCLOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int HPPCLRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *HPPCLOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int HPPCLWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int HPPCLPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int HPPCLClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int HPPCLSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

/********* Function definitions for Abekas semi-public interface ***********/

extern Raster *AbekasOpen(
#ifdef NeedFuncProto
	char	*name
#endif
	);

extern int AbekasRead(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern Raster *AbekasOpenWrite(
#ifdef NeedFuncProto
	char		*name,
	int		nx,
	int		ny,
	char		*comment,
	RasterEncoding	encoding
#endif
	);

extern int AbekasWrite(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int AbekasPrintInfo(
#ifdef NeedFuncProto
	Raster		*ras
#endif
	);

extern int AbekasClose(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

extern int AbekasSetFunctions(
#ifdef NeedFuncProto
	Raster	*ras
#endif
	);

NCARG_PROTO_END

#endif /* _RASTER_ */