1
2 // ------------------------------------------------------------------
3 // GoldED+
4 // Copyright (C) 1990-1999 Odinn Sorensen
5 // Copyright (C) 1999-2000 Alexander S. Aganichev
6 // ------------------------------------------------------------------
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 // MA 02111-1307 USA
21 // ------------------------------------------------------------------
22 // $Id: gccfgg4.cpp,v 1.6 2007/01/08 09:48:18 ssianky Exp $
23 // ------------------------------------------------------------------
24 // Configuration functions, part 4.
25 // ------------------------------------------------------------------
26
27 #include <golded.h>
28 #include <gcprot.h>
29
30
31 // ------------------------------------------------------------------
32
33 extern char* val;
34
35
36 // ------------------------------------------------------------------
37
CfgExcludenodes()38 void CfgExcludenodes() {
39
40 // Only used by GoldNODE
41 }
42
43 // ------------------------------------------------------------------
44
CfgExternoptions()45 void CfgExternoptions() {
46
47 const word CRC_CLS = 0x34F4;
48 const word CRC_CURSOR = 0x0D67;
49 const word CRC_RELOAD = 0xDEC0;
50 const word CRC_PAUSE = 0x3926;
51 const word CRC_PAUSEONERROR = 0xD99A;
52 const word CRC_WIPE = 0x1E80;
53 const word CRC_KEEPCTRL = 0x0738;
54 const word CRC_NOCLS = 0x2FAA;
55 const word CRC_NOCURSOR = 0x9345;
56 const word CRC_NORELOAD = 0x40E2;
57 const word CRC_NOPAUSE = 0x5D94;
58 const word CRC_NOPAUSEONERROR = 0xDBAA;
59 const word CRC_NOWIPE = 0xE3DA;
60 const word CRC_NOKEEPCTRL = 0x38FC;
61
62 // Handle options
63 while(*val) {
64
65 if(*val == '-')
66 val++;
67
68 char* _key;
69 word _crc = getkeyvalcrc(&_key, &val);
70
71 switch(_crc) {
72
73 case CRC_CLS:
74 CFG->externoptions |= EXTUTIL_CLS;
75 break;
76 case CRC_CURSOR:
77 CFG->externoptions |= EXTUTIL_CURSOR;
78 break;
79 case CRC_RELOAD:
80 CFG->externoptions |= EXTUTIL_RELOAD;
81 break;
82 case CRC_PAUSE:
83 CFG->externoptions |= EXTUTIL_PAUSE;
84 break;
85 case CRC_PAUSEONERROR:
86 CFG->externoptions |= EXTUTIL_PAUSEONERROR;
87 break;
88 case CRC_WIPE:
89 CFG->externoptions |= EXTUTIL_WIPE;
90 break;
91 case CRC_KEEPCTRL:
92 CFG->externoptions |= EXTUTIL_KEEPCTRL;
93 break;
94 case CRC_NOCLS:
95 CFG->externoptions &= ~EXTUTIL_CLS;
96 break;
97 case CRC_NOCURSOR:
98 CFG->externoptions &= ~EXTUTIL_CURSOR;
99 break;
100 case CRC_NORELOAD:
101 CFG->externoptions &= ~EXTUTIL_RELOAD;
102 break;
103 case CRC_NOPAUSE:
104 CFG->externoptions &= ~EXTUTIL_PAUSE;
105 break;
106 case CRC_NOPAUSEONERROR:
107 CFG->externoptions &= ~EXTUTIL_PAUSEONERROR;
108 break;
109 case CRC_NOWIPE:
110 CFG->externoptions &= ~EXTUTIL_WIPE;
111 break;
112 case CRC_NOKEEPCTRL:
113 CFG->externoptions &= ~EXTUTIL_KEEPCTRL;
114 break;
115 }
116 }
117 }
118
119
120 // ------------------------------------------------------------------
121
CfgExternutil()122 void CfgExternutil()
123 {
124 ExtUtil extutil;
125
126 // Get util number
127 char* _key;
128 char* _val = val;
129 getkeyval(&_key, &_val);
130 extutil.utilno = atoi(_key);
131
132 // Get options
133 int _optbak = CFG->externoptions;
134
135 while(strchr("-", *_val))
136 {
137 getkeyval(&_key, &_val);
138 val = _key;
139 CfgExternoptions();
140 }
141
142 extutil.options = CFG->externoptions;
143 CFG->externoptions = _optbak;
144
145 extutil.cmdline = _val; // Get commandline
146
147 // Count it
148 CFG->externutil.push_back(extutil);
149 }
150
151 // ------------------------------------------------------------------
152
CfgEzycommsgbase(const char * path,bool force)153 void CfgEzycommsgbase(const char *path, bool force) {
154
155 if(force or strblank(CFG->ezycom.msgbasepath))
156 MapPath(PathCopy(CFG->ezycom.msgbasepath, path));
157 }
158
CfgEzycommsgbase()159 void CfgEzycommsgbase() {
160
161 CfgEzycommsgbase(val, true);
162 }
163
164 // ------------------------------------------------------------------
165
CfgEzycomuserbase(const char * path,bool force)166 void CfgEzycomuserbase(const char *path, bool force) {
167
168 if(force or strblank(CFG->ezycom.userbasepath))
169 MapPath(PathCopy(CFG->ezycom.userbasepath, path));
170 }
171
CfgEzycomuserbase()172 void CfgEzycomuserbase() {
173
174 CfgEzycomuserbase(val, true);
175 }
176
177 // ------------------------------------------------------------------
178
CfgEzycomuserno()179 void CfgEzycomuserno() {
180
181 CFG->ezycomuserno = atoi(val);
182 }
183
184 // ------------------------------------------------------------------
185
CfgFidolastread(const char * path)186 void CfgFidolastread(const char *path) {
187
188 MapPath(strxcpy(CFG->fidolastread, val, sizeof(Path)));
189 }
190
CfgFidolastread()191 void CfgFidolastread() {
192
193 CfgFidolastread(val);
194 }
195
196 // ------------------------------------------------------------------
197
CfgFidomsgtype()198 void CfgFidomsgtype() {
199
200 if(striinc("FTS", val))
201 CFG->fidomsgtype = "FTS1";
202 else
203 CFG->fidomsgtype = "OPUS";
204 }
205
206 // ------------------------------------------------------------------
207
CfgFidouserlist()208 void CfgFidouserlist() {
209
210 strcpy(CFG->fidouserlist, val);
211 }
212
213 // ------------------------------------------------------------------
214
CfgFidouserno()215 void CfgFidouserno() {
216
217 CFG->fidouserno = atoi(val);
218 }
219
220 // ------------------------------------------------------------------
221
CfgFilealias()222 void CfgFilealias() {
223
224 char* ptr = strskip_txt(val);
225 if(*ptr) {
226 *ptr++ = NUL;
227 ptr = strskip_wht(ptr);
228 FileAlias tmp;
229 strxcpy(tmp.alias, val, sizeof(tmp.alias));
230 strxcpy(tmp.file, ptr, sizeof(Path));
231 CFG->filealias.push_back(tmp);
232 }
233 }
234
235 // ------------------------------------------------------------------
236
CfgForcetemplate()237 void CfgForcetemplate() {
238
239 bool flag = make_bool(GetYesno(val));
240 if(cfgingroup)
241 CFG->grp.AddItm(GRP_FORCETEMPLATE, flag);
242 else
243 CFG->forcetemplate = flag;
244 }
245
246 // ------------------------------------------------------------------
247
CfgFrqext(const char * v)248 void CfgFrqext(const char* v) {
249
250 char* ptr = val = throw_strdup(v);
251 CfgFrqext();
252 throw_free(ptr);
253 }
254
CfgFrqext()255 void CfgFrqext() {
256
257 tokenize(CFG->frqext, val);
258 }
259
260 // ------------------------------------------------------------------
261
CfgFrqnodemap()262 void CfgFrqnodemap() {
263
264 char* key;
265 FrqNodeMap fnm;
266 getkeyval(&key, &val);
267 fnm.to.reset(key);
268 getkeyval(&key, &val);
269 fnm.from.reset(key);
270
271 CFG->frqnodemap.push_back(fnm);
272 }
273
274 // ------------------------------------------------------------------
275
CfgFrqoptions()276 void CfgFrqoptions() {
277
278 if(striinc("SORT", val))
279 CFG->frqoptions |= FREQ_SORT;
280 if(striinc("FROMTOP", val))
281 CFG->frqoptions |= FREQ_FROMTOP;
282 if(striinc("NOFILES", val))
283 CFG->frqoptions |= FREQ_NOFILES;
284 if(striinc("FAST", val))
285 CFG->frqoptions |= FREQ_FAST;
286 if(striinc("NOWAZOOMSG", val))
287 CFG->frqoptions |= FREQ_NOWAZOOMSG;
288 if(striinc("NOTFROMTOP", val))
289 CFG->frqoptions &= ~FREQ_FROMTOP;
290 }
291
292 // ------------------------------------------------------------------
293
CfgGedhandshake()294 void CfgGedhandshake() {
295
296 CFG->gedhandshake = make_bool(GetYesno(val));
297 }
298
299 // ------------------------------------------------------------------
300
CfgGermankeyboard()301 void CfgGermankeyboard() {
302
303 right_alt_same_as_left = not GetYesno(val);
304 }
305
306 // ------------------------------------------------------------------
307
CfgGoldbasepath(const char * path,bool force)308 void CfgGoldbasepath(const char *path, bool force) {
309
310 if(force or strblank(CFG->goldbasepath))
311 MapPath(PathCopy(CFG->goldbasepath, path));
312 }
313
CfgGoldbasepath()314 void CfgGoldbasepath() {
315
316 CfgGoldbasepath(val, true);
317 }
318
319 // ------------------------------------------------------------------
320
CfgGoldbasesyspath()321 void CfgGoldbasesyspath() {
322
323 PathCopy(CFG->goldbasesyspath, val);
324 }
325
326 // ------------------------------------------------------------------
327
CfgGoldbaseuserno()328 void CfgGoldbaseuserno() {
329
330 CFG->goldbaseuserno = atoi(val);
331 }
332
333 // ------------------------------------------------------------------
334
CfgGoldhelp()335 void CfgGoldhelp() {
336
337 MapPath(strxcpy(CFG->helpcfg.fn, val, sizeof(Path)));
338 replaceextension(CFG->helpged, CFG->helpcfg.fn, __gver_cfgext__);
339 }
340
341 // ------------------------------------------------------------------
342
CfgGoldlang()343 void CfgGoldlang() {
344
345 MapPath(strxcpy(CFG->langcfg, val, sizeof(Path)));
346 }
347
348 // ------------------------------------------------------------------
349
CfgGoldpath()350 void CfgGoldpath() {
351
352 MapPath(PathCopy(CFG->goldpath, val));
353 }
354
355 // ------------------------------------------------------------------
356
CfgGoldxlat()357 void CfgGoldxlat() {
358
359 MapPath(val);
360 replaceextension(CFG->xlatged, val, __gver_cfgext__);
361 }
362
363 // ------------------------------------------------------------------
364
CfgGroup()365 void CfgGroup() {
366
367 char* _key;
368 getkeyval(&_key, &val);
369 CFG->grp.AddGrp(_key);
370 cfgingroup = true;
371 }
372
373 // ------------------------------------------------------------------
374