This file is indexed.

/usr/include/pi-macros.h is in libpisock-dev 0.12.5-dfsg-2build2.

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
/*
 * $Id: pi-macros.h,v 1.17 2006/10/17 13:24:07 desrod Exp $
 *
 * pi-macros.h: pilot-link specific macro defintions
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
 * General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
#ifndef _PILOT_MACROS_H_
#define _PILOT_MACROS_H_

#include <time.h>
#include "pi-args.h"

typedef unsigned long recordid_t;

#ifdef __cplusplus
extern "C" {
#endif

	extern double get_float PI_ARGS((void *));
	extern void set_float PI_ARGS((void *, double));
	extern int compareTm PI_ARGS((struct tm * a, struct tm * b));

#ifdef __cplusplus
}
#endif
#ifndef __cplusplus
#define get_long(ptr) \
        (unsigned long) ( \
        (((unsigned long)((unsigned char *)(ptr))[0]) << 24) | \
        (((unsigned long)((unsigned char *)(ptr))[1]) << 16) | \
        (((unsigned long)((unsigned char *)(ptr))[2]) << 8) | \
        (((unsigned long)((unsigned char *)(ptr))[3]) ) )


#define get_treble(ptr) ((unsigned long)\
                        ((((unsigned char*)(ptr))[0] << 16) | \
                         (((unsigned char*)(ptr))[1] << 8)  | \
                         (((unsigned char*)(ptr))[2])))
#define get_short(ptr) ((unsigned short)\
                       ((((unsigned char*)(ptr))[0] << 8)  | \
                        (((unsigned char*)(ptr))[1])))
#define get_byte(ptr) (((unsigned char*)(ptr))[0])
#define get_slong(ptr) (signed long)(\
				(get_long((ptr)) > 0x7FFFFFFF) ?\
                                (((signed long)(get_long((ptr)) & 0x7FFFFFFF)) - 0x80000000):\
                                ((signed long)(get_long((ptr))))\
                                )
#define get_streble(ptr) (signed long)(\
				(get_treble((ptr)) > 0x7FFFFF) ?\
                                (((signed long)(get_treble((ptr)) & 0x7FFFFF)) - 0x800000):\
                                ((signed long)(get_treble((ptr))))\
                                )
#define get_sshort(ptr) (signed short)(\
				(get_short((ptr)) > 0x7FFF) ?\
                                (((signed short)(get_short((ptr)) & 0x7FFF)) - 0x8000):\
                                ((signed short)(get_short((ptr))))\
                                )
#define get_sbyte(ptr) (signed char)(\
				(get_byte((ptr)) > 0x7F) ?\
                                (((signed char)(get_byte((ptr)) & 0x7F)) - 0x80):\
                                ((signed char)(get_byte((ptr))))\
                                )
#define set_long(ptr,val) ((((unsigned char*)(ptr))[0] = (unsigned char)(((unsigned long)(val)) >> 24) & 0xff), \
		          (((unsigned char*)(ptr))[1] = (((unsigned long)(val)) >> 16) & 0xff), \
		          (((unsigned char*)(ptr))[2] = (((unsigned long)(val)) >> 8) & 0xff), \
		          (((unsigned char*)(ptr))[3] = (((unsigned long)(val)) >> 0) & 0xff))
#define set_slong(ptr,val) set_long((ptr),((unsigned long)(\
                            (((signed long)(val)) < 0) ?\
                            ((unsigned long)(((signed long)(val)) + 0x80000000) | 0x80000000) :\
                            (val)\
                           )))
#define set_treble(ptr,val) ((((unsigned char*)(ptr))[0] = (unsigned char)(((unsigned long)(val)) >> 16) & 0xff), \
		             (((unsigned char*)(ptr))[1] = (((unsigned long)(val)) >> 8) & 0xff), \
		             (((unsigned char*)(ptr))[2] = (((unsigned long)(val)) >> 0) & 0xff))
#define set_streble(ptr,val) set_treble((ptr),((unsigned long)(\
                            (((signed long)(val)) < 0) ?\
                            ((unsigned long)(((signed long)(val)) + 0x800000) | 0x800000) :\
                            (val)\
                           )))
#define set_short(ptr,val) ((((unsigned char*)(ptr))[0] = (((unsigned short)(val)) >> 8) & 0xff), \
		            (((unsigned char*)(ptr))[1] = (((unsigned short)(val)) >> 0) & 0xff))
#define set_sshort(ptr,val) set_short((ptr),((unsigned short)(\
                            (((signed short)(val)) < 0) ?\
                            ((unsigned short)(((signed short)(val)) + 0x8000) | 0x8000) :\
                            (val)\
                           )))
#define set_byte(ptr,val) (((unsigned char*)(ptr))[0]=(val))
#define set_sbyte(ptr,val) set_byte((ptr),((unsigned char)(\
                            (((signed char)(val)) < 0) ?\
                            ((unsigned char)(((signed char)(val)) + 0x80) | 0x80) :\
                            (val)\
                           )))
#define char4(c1,c2,c3,c4) (((c1)<<24)|((c2)<<16)|((c3)<<8)|(c4))
#else				/*ifdef __cplusplus */
inline unsigned long get_long(const void *buf)
{
	unsigned char *ptr = (unsigned char *) buf;

	return (*ptr << 24) | (*(++ptr) << 16) | (*(++ptr) << 8) |
	    *(++ptr);
}

inline signed long get_slong(const void *buf)
{
	unsigned long val = get_long(buf);

	if (val > 0x7FFFFFFF)
		return ((signed long) (val & 0x7FFFFFFF)) - 0x80000000;
	else
		return val;
}

inline unsigned long get_treble(const void *buf)
{
	unsigned char *ptr = (unsigned char *) buf;

	return (*ptr << 16) | (*(++ptr) << 8) | *(++ptr);
}

inline signed long get_streble(const void *buf)
{
	unsigned long val = get_treble(buf);

	if (val > 0x7FFFFF)
		return ((signed long) (val & 0x7FFFFF)) - 0x800000;
	else
		return val;
}

inline int get_short(const void *buf)
{
	unsigned char *ptr = (unsigned char *) buf;

	return (*ptr << 8) | *(++ptr);
}

inline signed short get_sshort(const void *buf)
{
	unsigned short val = get_short(buf);

	if (val > 0x7FFF)
		return ((signed short) (val & 0x7FFF)) - 0x8000;
	else
		return val;
}

inline int get_byte(const void *buf)
{
	return *((unsigned char *) buf);
}

inline signed char get_sbyte(const void *buf)
{
	unsigned char val = get_byte(buf);

	if (val > 0x7F)
		return ((signed char) (val & 0x7F)) - 0x80;
	else
		return val;
}

inline void set_long(void *buf, const unsigned long val)
{
	unsigned char *ptr = (unsigned char *) buf;

	*ptr = (unsigned char) ((val >> 24) & 0xff);
	*(++ptr) = (unsigned char) ((val >> 16) & 0xff);
	*(++ptr) = (unsigned char) ((val >> 8) & 0xff);
	*(++ptr) = (unsigned char) (val & 0xff);
}

inline void set_slong(void *buf, const signed long val)
{
	unsigned long uval;

	if (val < 0) {
		uval = (val + 0x80000000);
		uval |= 0x80000000;
	} else
		uval = val;
	set_long(buf, uval);
}

inline void set_treble(void *buf, const unsigned long val)
{
	unsigned char *ptr = (unsigned char *) buf;

	*ptr = (unsigned char) ((val >> 16) & 0xff);
	*(++ptr) = (unsigned char) ((val >> 8) & 0xff);
	*(++ptr) = (unsigned char) (val & 0xff);
}

inline void set_streble(void *buf, const signed long val)
{
	unsigned long uval;

	if (val < 0) {
		uval = (val + 0x800000);
		uval |= 0x800000;
	} else
		uval = val;
	set_treble(buf, uval);
}

inline void set_short(void *buf, const int val)
{
	unsigned char *ptr = (unsigned char *) buf;

	*ptr = (val >> 8) & 0xff;
	*(++ptr) = val & 0xff;
}

inline void set_sshort(void *buf, const signed short val)
{
	unsigned short uval;

	if (val < 0) {
		uval = (val + 0x8000);
		uval |= 0x8000;
	} else
		uval = val;
	set_treble(buf, uval);
}

inline void set_byte(void *buf, const int val)
{
	*((unsigned char *) buf) = val;
}

inline void set_sbyte(void *buf, const signed char val)
{
	unsigned char uval;

	if (val < 0) {
		uval = (val + 0x80);
		uval |= 0x80;
	} else
		uval = val;
	set_byte(buf, uval);
}

inline struct tm *getBufTm(struct tm *t, const void *buf, int setTime)
{
	unsigned short int d = get_short(buf);

	t->tm_year = (d >> 9) + 4;
	t->tm_mon = ((d >> 5) & 15) - 1;
	t->tm_mday = d & 31;

	if (setTime) {
		t->tm_hour = 0;
		t->tm_min = 0;
		t->tm_sec = 0;
	}

	t->tm_isdst = -1;

	mktime(t);

	return t;
}

inline void setBufTm(void *buf, const struct tm *t)
{
	set_short(buf,
		  ((t->tm_year - 4) << 9) | ((t->tm_mon +
					      1) << 5) | t->tm_mday);
}

inline unsigned long char4(char c1, char c2, char c3, char c4)
{
	return (c1 << 24) | (c2 << 16) | (c3 << 8) | c4;
}

#endif				/*__cplusplus*/
#endif				/* _PILOT_MACROS_H_ */