NCEPLIBS-bufr  12.0.1
arallocc.c
Go to the documentation of this file.
1 
6 #include "bufrlib.h"
7 
10 #define IN_ARALLOCC
11 #include "cread.h"
12 #include "mstabs.h"
13 
28 void
29 arallocc(void)
30 {
31 
32  char brtstr[50] = "BUFRLIB: ARALLOCC FAILED ALLOCATING";
33 
34  int nfiles;
35 
36  int mxmtbb;
37  int mxmtbd;
38  int maxcd;
39 
40 /*
41 ** cread arrays
42 */
43 
44  nfiles = igetprm_f("NFILES");
45 
46  if (!(pb = malloc((nfiles+1) * sizeof(FILE *)))) bort_f(brtstr);
47 
48  if (!(lstpos = malloc((nfiles+1) * sizeof(fpos_t)))) bort_f(brtstr);
49 
50 /*
51 ** mstabs arrays
52 */
53 
54  mxmtbb = igetprm_f("MXMTBB");
55  mxmtbd = igetprm_f("MXMTBD");
56  maxcd = igetprm_f("MAXCD");
57 
58  if (!(ibfxyn_c = malloc(mxmtbb * sizeof(int)))) bort_f(brtstr);
59 
60  if (!(cbscl_c = malloc(mxmtbb * 4 * sizeof(char)))) bort_f(brtstr);
61 
62  if (!(cbsref_c = malloc(mxmtbb * 12 * sizeof(char)))) bort_f(brtstr);
63 
64  if (!(cbbw_c = malloc(mxmtbb * 4 * sizeof(char)))) bort_f(brtstr);
65 
66  if (!(cbunit_c = malloc(mxmtbb * 24 * sizeof(char)))) bort_f(brtstr);
67 
68  if (!(cbmnem_c = malloc(mxmtbb * 8 * sizeof(char)))) bort_f(brtstr);
69 
70  if (!(cbelem_c = malloc(mxmtbb * 120 * sizeof(char)))) bort_f(brtstr);
71 
72  if (!(idfxyn_c = malloc(mxmtbd * sizeof(int)))) bort_f(brtstr);
73 
74  if (!(cdseq_c = malloc(mxmtbd * 120 * sizeof(char)))) bort_f(brtstr);
75 
76  if (!(cdmnem_c = malloc(mxmtbd * 8 * sizeof(char)))) bort_f(brtstr);
77 
78  if (!(ndelem_c = malloc(mxmtbd * sizeof(int)))) bort_f(brtstr);
79 
80  if (!(idefxy_c = malloc(mxmtbd * maxcd * sizeof(int)))) bort_f(brtstr);
81 }
void arallocc(void)
Dynamically allocate C language arrays.
Definition: arallocc.c:29
int igetprm_f(char *cprmnm)
Get the current value of a parameter.
Enable a number of NCEPLIBS-bufr subprograms to be called from within the C part of the library.
void bort_f(char *errstr)
Log one error message and abort application program.
Declare variables for reading or writing BUFR messages via a C language interface.
FILE ** pb
File pointers.
fpos_t * lstpos
Byte positions of last successful reads from files corresponding to pb, for files that were opened fo...
Declare variables for internal storage of master Table B and Table D entries.
char(* cbunit_c)[24]
Master Table B units; copied from Fortran cbunit array.
int * idfxyn_c
Bit-wise representations of master Table D FXY numbers; copied from Fortran idfxyn array.
char(* cdmnem_c)[8]
Master Table D mnemonics; copied from Fortran cdmnem array.
char(* cbelem_c)[120]
Master Table B element names; copied from Fortran cbelem array.
int * ndelem_c
Number of child descriptors for master Table D sequence; copied from Fortran ndelem array.
int * idefxy_c
Bit-wise representations of child descriptors for master Table D sequence; copied from Fortran idefxy...
char(* cbbw_c)[4]
Master Table B bit widths; copied from Fortran cbbw array.
char(* cbsref_c)[12]
Master Table B reference value; copied from Fortran cbsref array.
char(* cdseq_c)[120]
Master Table D sequence names; copied from Fortran cdseq array.
int * ibfxyn_c
Bit-wise representations of master Table B FXY numbers; copied from Fortran ibfxyn array.
char(* cbscl_c)[4]
Master Table B scale factors; copied from Fortran cbscl array.
char(* cbmnem_c)[8]
Master Table B mnemonics; copied from Fortran cbmnem array.
integer, public maxcd
Maximum number of child descriptors that can be included within the sequence definition of a Table D ...
integer mxmtbb
Maximum number of entries in a master BUFR Table B.
integer mxmtbd
Maximum number of entries in a master BUFR Table D.
integer, public nfiles
Maximum number of BUFR files that can be connected to the BUFRLIB software (for reading or writing) a...