Mercurial > repos > dawe > srf2fastq
comparison srf2fastq/io_lib-1.12.2/io_lib/array.h @ 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d901c9f41a6a |
---|---|
1 /* | |
2 * Copyright (c) Medical Research Council 1994. All rights reserved. | |
3 * | |
4 * Permission to use, copy, modify and distribute this software and its | |
5 * documentation for any purpose is hereby granted without fee, provided that | |
6 * this copyright and notice appears in all copies. | |
7 * | |
8 * This file was written by James Bonfield, Simon Dear, Rodger Staden, | |
9 * as part of the Staden Package at the MRC Laboratory of Molecular | |
10 * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom. | |
11 * | |
12 * MRC disclaims all warranties with regard to this software. | |
13 */ | |
14 | |
15 /* | |
16 * File: array.h | |
17 * Version: | |
18 * | |
19 * Description: | |
20 * | |
21 * Created: | |
22 * Updated: | |
23 * | |
24 */ | |
25 | |
26 #ifndef _ARRAY_H_ | |
27 #define _ARRAY_H_ | |
28 | |
29 /* 12/1/99 johnt - use stddef.h not sys/types.h for size_t */ | |
30 #include <stddef.h> /* IMPORT: size_t */ | |
31 | |
32 #ifdef __cplusplus | |
33 extern "C" { | |
34 #endif | |
35 | |
36 typedef struct { | |
37 size_t size; /* element size */ | |
38 size_t dim; /* allocated number of elements */ | |
39 size_t max; /* elements accessed */ | |
40 void *base; /* base address of array */ | |
41 } ArrayStruct, *Array; | |
42 | |
43 | |
44 | |
45 extern Array ArrayCreate(size_t size, size_t dim); | |
46 | |
47 extern int ArrayExtend(Array a, size_t dim); | |
48 | |
49 extern void *ArrayRef(Array a, size_t i); | |
50 | |
51 extern int ArrayDestroy(Array a); | |
52 | |
53 #define ArrayMax(a) ( (a)->max ) | |
54 | |
55 #define ArrayBase(t,a) ( (t *)((a)->base) ) | |
56 | |
57 /* | |
58 #define arr(t,a,n) \ | |
59 (*(t*)((a)->base + (a)->size*(n))) | |
60 | |
61 #define arrp(t,a,n) \ | |
62 ((t*)((a)->base + (a)->size*(n))) | |
63 */ | |
64 | |
65 | |
66 | |
67 | |
68 #define arr(t,a,n) \ | |
69 ((t*)((a)->base))[n] | |
70 | |
71 #define ARR(t,a,n) \ | |
72 (*((t*)ArrayRef((a),(n)))) | |
73 | |
74 #define arrp(t,a,n) \ | |
75 &((t*)((a)->base))[n] | |
76 #define ARRP(t,a,n) \ | |
77 ((t*)ArrayRef(a,n)) | |
78 | |
79 #define ARRAY_NO_ERROR 0 | |
80 #define ARRAY_FULL -1 | |
81 #define ARRAY_INVALID_ARGUMENTS -2 | |
82 #define ARRAY_OUT_OF_MEMORY -3 | |
83 | |
84 extern int ArrayError; | |
85 | |
86 extern char *ArrayErrorString(int error); | |
87 | |
88 | |
89 #ifdef __cplusplus | |
90 } | |
91 #endif | |
92 | |
93 #endif /*_ARRAY_H_*/ |