Mercurial > repos > dawe > srf2fastq
annotate srf2fastq/io_lib-1.12.2/io_lib/mach-io.c @ 0:d901c9f41a6a default tip
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author | dawe |
---|---|
date | Tue, 07 Jun 2011 17:48:05 -0400 |
parents | |
children |
rev | line source |
---|---|
0
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
1 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
2 * Copyright (c) Medical Research Council 1994. All rights reserved. |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
3 * |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
4 * Permission to use, copy, modify and distribute this software and its |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
5 * documentation for any purpose is hereby granted without fee, provided that |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
6 * this copyright and notice appears in all copies. |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
7 * |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
8 * This file was written by James Bonfield, Simon Dear, Rodger Staden, |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
9 * as part of the Staden Package at the MRC Laboratory of Molecular |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
10 * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom. |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
11 * |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
12 * MRC disclaims all warranties with regard to this software. |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
13 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
14 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
15 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
16 * Machine independant io: |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
17 * For reading and writing to big-endian and little-endian files |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
18 * |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
19 * Routines available: |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
20 * be_write_int_1() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
21 * be_write_int_2() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
22 * be_write_int_4() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
23 * be_write_int_8() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
24 * be_read_int_1() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
25 * be_read_int_2() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
26 * be_read_int_4() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
27 * be_read_int_8() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
28 * le_write_int_1() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
29 * le_write_int_2() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
30 * le_write_int_4() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
31 * le_write_int_8() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
32 * le_read_int_1() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
33 * le_read_int_2() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
34 * le_read_int_4() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
35 * le_read_int_8() |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
36 * |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
37 * All routine return: |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
38 * 0 - an error has occurred during io operation |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
39 * 1 - value suggessfully read or written |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
40 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
41 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
42 #include <stdio.h> |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
43 #include "io_lib/stdio_hack.h" |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
44 #include "io_lib/mach-io.h" |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
45 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
46 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
47 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
48 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
49 /**********************************************************************/ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
50 /* IO for big-endian files */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
51 /**********************************************************************/ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
52 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
53 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
54 * Write a big-endian int1 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
55 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
56 int be_write_int_1(FILE *fp, uint1 *i1) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
57 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
58 if (fwrite(i1, sizeof(uint1), 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
59 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
60 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
61 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
62 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
63 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
64 * Write a big-endian int2 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
65 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
66 int be_write_int_2(FILE *fp, uint2 *i2) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
67 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
68 uint2 i = be_int2(*i2); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
69 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
70 if (fwrite(&i, 2, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
71 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
72 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
73 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
74 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
75 * Write a big-endian int4 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
76 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
77 int be_write_int_4(FILE *fp, uint4 *i4) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
78 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
79 uint4 i = be_int4(*i4); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
80 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
81 if (fwrite(&i, 4, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
82 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
83 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
84 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
85 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
86 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
87 * Write a big-endian int8 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
88 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
89 int be_write_int_8(FILE *fp, uint8 *i8) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
90 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
91 uint8 i = be_int8(*i8); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
92 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
93 if (fwrite(&i, 8, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
94 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
95 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
96 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
97 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
98 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
99 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
100 * Read a big-endian int1 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
101 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
102 int be_read_int_1(FILE *fp, uint1 *i1) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
103 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
104 if (fread(i1, sizeof(uint1), 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
105 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
106 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
107 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
108 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
109 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
110 * Read a big-endian int2 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
111 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
112 int be_read_int_2(FILE *fp, uint2 *i2) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
113 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
114 uint2 i; |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
115 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
116 if (fread(&i, 2, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
117 *i2 = be_int2(i); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
118 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
119 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
120 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
121 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
122 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
123 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
124 * Read a big-endian int4 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
125 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
126 int be_read_int_4(FILE *fp, uint4 *i4) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
127 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
128 uint4 i; |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
129 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
130 if (fread(&i, 4, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
131 *i4 = be_int4(i); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
132 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
133 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
134 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
135 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
136 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
137 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
138 * Read a big-endian int8 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
139 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
140 int be_read_int_8(FILE *fp, uint8 *i8) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
141 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
142 uint8 i; |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
143 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
144 if (fread(&i, 8, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
145 *i8 = be_int8(i); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
146 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
147 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
148 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
149 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
150 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
151 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
152 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
153 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
154 /**********************************************************************/ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
155 /* IO for little-endian files */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
156 /**********************************************************************/ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
157 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
158 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
159 * Write a little-endian int1 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
160 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
161 int le_write_int_1(FILE *fp, uint1 *i1) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
162 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
163 if (fwrite(i1, sizeof(uint1), 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
164 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
165 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
166 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
167 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
168 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
169 * Write a little-endian int2 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
170 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
171 int le_write_int_2(FILE *fp, uint2 *i2) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
172 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
173 uint2 i = le_int2(*i2); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
174 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
175 if (fwrite(&i, 2, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
176 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
177 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
178 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
179 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
180 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
181 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
182 * Write a little-endian int4 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
183 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
184 int le_write_int_4(FILE *fp, uint4 *i4) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
185 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
186 uint4 i = le_int4(*i4); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
187 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
188 if (fwrite(&i, 4, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
189 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
190 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
191 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
192 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
193 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
194 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
195 * Write a little-endian int8 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
196 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
197 int le_write_int_8(FILE *fp, uint8 *i8) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
198 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
199 uint8 i = le_int8(*i8); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
200 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
201 if (fwrite(&i, 8, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
202 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
203 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
204 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
205 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
206 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
207 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
208 * Read a little-endian int1 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
209 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
210 int le_read_int_1(FILE *fp, uint1 *i1) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
211 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
212 if (fread(i1, sizeof(uint1), 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
213 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
214 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
215 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
216 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
217 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
218 * Read a little-endian int2 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
219 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
220 int le_read_int_2(FILE *fp, uint2 *i2) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
221 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
222 uint2 i; |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
223 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
224 if (fread(&i, 2, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
225 *i2 = le_int2(i); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
226 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
227 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
228 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
229 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
230 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
231 * Read a little-endian int4 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
232 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
233 int le_read_int_4(FILE *fp, uint4 *i4) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
234 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
235 uint4 i; |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
236 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
237 if (fread(&i, 4, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
238 *i4 = le_int4(i); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
239 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
240 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
241 } |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
242 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
243 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
244 /* |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
245 * Read a little-endian int8 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
246 */ |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
247 int le_read_int_8(FILE *fp, uint8 *i8) |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
248 { |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
249 uint8 i; |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
250 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
251 if (fread(&i, 8, 1, fp) != 1) return (0); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
252 *i8 = le_int8(i); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
253 |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
254 return (1); |
d901c9f41a6a
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff
changeset
|
255 } |