OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / src / Tools / filter / mrc2hdf / src / init.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <math.h>
5 #include "../inc/config.h"
6 #include "genUtil.h"
7 #include "eosString.h"
8 #include "File.h"
9 #include "Memory.h"
10
11
12 void
13 init0(mrc2hdfInfo* info)
14 {
15     info->fptIn = NULL;    info->flagIn = 0;
16     info->fptInList     = NULL;    info->fptInListList = NULL;    info->flagInList = 0;
17     info->fptInList2     = NULL;    info->fptInList2List = NULL;    info->flagInList2 = 0;
18     info->IR = 1.0;    info->flagIR = 0;
19     info->IG = 0.0;    info->flagIG = 0;
20     info->IB = 0.0;    info->flagIB = 0;
21     info->IA = 1.0;    info->flagIA = 0;
22     info->I2R = 0.0;    info->flagI2R = 0;
23     info->I2G = 1.0;    info->flagI2G = 0;
24     info->I2B = 0.0;    info->flagI2B = 0;
25     info->I2A = 1.0;    info->flagI2A = 0;
26     info->fptOut = NULL;    info->flagOut = 0;
27     info->fptconfigFile = NULL;    info->flagconfigFile = 0;
28     info->nResolution = 1;    info->flagnResolution = 0;
29     info->hdf5mode = 1;    info->flaghdf5mode = 0;
30     info->mode = 0;    info->flagmode = 0;
31 }
32
33 void
34 init1(mrc2hdfInfo* info)
35 {
36     char s[1024];
37     int i;
38     if(info->flagIn) {
39         info->fptIn = fileOpen(info->In, "r");
40     }
41     
42     if(info->flagInList) {
43         info->fptInListList = fileOpen(info->InListList, "r");
44         fseek(info->fptInListList, 0L, SEEK_SET);
45         i=0;
46         while(NULL!=stringGetFromFile(s, "", info->fptInListList, stdout, 1)) {
47             i++;
48         }
49         info->fptInList = (FILE**)memoryAllocate(i*sizeof(FILE*), "in init1");
50         info->InList    = (char**)memoryAllocate(i*sizeof(char*), "in init1");
51         info->flagInList = i;
52         fseek(info->fptInListList, 0L, SEEK_SET);
53         i=0;
54         while(NULL!=stringGetFromFile(s, "", info->fptInListList, stdout, 1)) {
55             info->InList[i] = stringGetNthWord(s, 1, " ,\t");
56             info->fptInList[i] = fileOpen(info->InList[i],"r");
57             i++;
58         }
59     }
60     
61     if(info->flagInList2) {
62         info->fptInList2List = fileOpen(info->InList2List, "r");
63         fseek(info->fptInList2List, 0L, SEEK_SET);
64         i=0;
65         while(NULL!=stringGetFromFile(s, "", info->fptInList2List, stdout, 1)) {
66             i++;
67         }
68         info->fptInList2 = (FILE**)memoryAllocate(i*sizeof(FILE*), "in init1");
69         info->InList2    = (char**)memoryAllocate(i*sizeof(char*), "in init1");
70         info->flagInList2 = i;
71         fseek(info->fptInList2List, 0L, SEEK_SET);
72         i=0;
73         while(NULL!=stringGetFromFile(s, "", info->fptInList2List, stdout, 1)) {
74             info->InList2[i] = stringGetNthWord(s, 1, " ,\t");
75             info->fptInList2[i] = fileOpen(info->InList2[i],"r");
76             i++;
77         }
78     }
79     
80     if(info->flagIR) {
81     }
82     
83     if(info->flagIG) {
84     }
85     
86     if(info->flagIB) {
87     }
88     
89     if(info->flagIA) {
90     }
91     
92     if(info->flagI2R) {
93     }
94     
95     if(info->flagI2G) {
96     }
97     
98     if(info->flagI2B) {
99     }
100     
101     if(info->flagI2A) {
102     }
103     
104     if(!info->flagOut) {
105         stringGetFromFile(s, "Out", stdin, stdout, 0);
106         info->Out = stringGetNthWord(s, 1, " ,\t");
107         info->flagOut++;
108     }
109     if(info->flagOut) {
110         info->fptOut = fileOpen(info->Out, "w");
111     }
112     
113     if(info->flagconfigFile) {
114         info->fptconfigFile = fileOpen(info->configFile, "r");
115     }
116     
117     if(info->flagnResolution) {
118     }
119     
120     if(info->flaghdf5mode) {
121     }
122     
123     if(info->flagmode) {
124     }
125     
126 }
127 #ifdef KHOROS
128 #include <stdio.h>
129 #include "bootstrap.h"
130 #include "dataserv.h"
131 #include "datamanip.h"
132 extern void func_usage_additions(void);
133 extern void func_free_args(kexit_status status, kaddr client_data);
134 extern void func_get_args(kform* pane);
135
136 void
137 func_usage_additions(void)
138 {
139 }
140 void
141 func_free_args(kexit_status status, kaddr client_data)
142 {
143 }
144 void
145 func_get_args(kform* pane)
146 {
147 }
148 void
149 khorosInit(int argc, char* argv[])
150 {
151     char* eospath;
152     char  panepath[1024];
153     FILE* fpt;
154     
155     eospath = getenv("EOS_HOME");
156     sprintf(panepath, "%s/src/Tools/filter/mrc2hdf/src/mrc2hdf.pane", eospath);
157     khoros_initialize(argc, argv, "EOS");
158     fpt = fopen(panepath, "r");    if(NULL!=fpt) {
159         fclose(fpt);
160         kclui_initialize(panepath, KGEN_NONE, "EOS", "mrc2hdf",
161                      func_usage_additions,
162                      func_get_args,
163                      func_free_args);
164     }
165 }
166 #endif /* KHOROS */