1 | #include <stdio.h> |
---|
2 | #define NMBNAME "/usr/local/datageisa/crs97/nmb.dat" |
---|
3 | #define NMBLINES 108 |
---|
4 | void molcodes_(void) |
---|
5 | { |
---|
6 | static char tpchar[NMBLINES][17]; /* room for max=15 + LF + 0 */ |
---|
7 | register FILE *fp; |
---|
8 | register int i; |
---|
9 | /* type Molecules */ |
---|
10 | struct molecules |
---|
11 | { |
---|
12 | char name[10]; |
---|
13 | int mcode; /* code of molecule */ |
---|
14 | int ntp; /* n of datasets */ |
---|
15 | int n1[4]; /* from */ |
---|
16 | int n2[4]; /* to */ |
---|
17 | }; |
---|
18 | /* type (Molecules) ListofMol(30) */ |
---|
19 | /* common /Reg4/ Wvmin,Wvmax */ |
---|
20 | /* common /Reg7/ Lepremier,NumSel,NbofMol */ |
---|
21 | /* common /Reg9/ ListofMol */ |
---|
22 | extern struct reg4 {float wvmin,wvmax;}; |
---|
23 | extern struct reg4 reg4_; |
---|
24 | extern struct reg7 {float lepremier;int numsel,nbofmol;}; |
---|
25 | extern struct reg7 reg7_; |
---|
26 | extern struct reg9 {struct molecules listofmol[30];}; |
---|
27 | extern struct reg9 reg9_; |
---|
28 | |
---|
29 | fp=fopen(NMBNAME,"r"); |
---|
30 | i=0; while(fseek(fp,5,SEEK_CUR),fgets(tpchar[i],17,fp)) |
---|
31 | { |
---|
32 | /* tpchar[i][strlen(tpchar[i])-2]=0; erase last & LF */ |
---|
33 | tpchar[i][strlen(tpchar[i])-1]=0; /* erase LF */ |
---|
34 | tpchar[i][14]=0; /* erase 15th */ |
---|
35 | i++; |
---|
36 | } |
---|
37 | |
---|
38 | printf("%9.3f %9.3f\n",reg4_.wvmin,reg4_.wvmax); |
---|
39 | for(i=0;i<reg7_.nbofmol-1;i++) |
---|
40 | { |
---|
41 | register int j,k; |
---|
42 | if(!strncmp(reg9_.listofmol[i].name,"all",3)) continue; |
---|
43 | printf(" %s %d",reg9_.listofmol[i].name,reg9_.listofmol[i].mcode); |
---|
44 | for(j=0;j<reg9_.listofmol[i].ntp;j++) |
---|
45 | for(k=reg9_.listofmol[i].n1[j]-1;k<reg9_.listofmol[i].n2[j];k++) |
---|
46 | printf(" %-15s",tpchar[k]); printf("\n"); |
---|
47 | } |
---|
48 | } |
---|