1 | //----------------------------------------------------------- |
---|
2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
3 | // arnault@lal.in2p3.fr |
---|
4 | // Modified by garonne@lal.in2p3.fr |
---|
5 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
6 | //----------------------------------------------------------- |
---|
7 | |
---|
8 | #include <stdio.h> |
---|
9 | #include <stdlib.h> |
---|
10 | #include <string.h> |
---|
11 | #include <ctype.h> |
---|
12 | |
---|
13 | #include "cmt_constituent.h" |
---|
14 | #include "cmt_generator.h" |
---|
15 | #include "cmt_system.h" |
---|
16 | #include "cmt_database.h" |
---|
17 | #include "cmt_log.h" |
---|
18 | |
---|
19 | /*----------------------------------------------------------*/ |
---|
20 | /* */ |
---|
21 | /* Operations on Constituent */ |
---|
22 | /* */ |
---|
23 | /*----------------------------------------------------------*/ |
---|
24 | |
---|
25 | //---------------------------------------------------------- |
---|
26 | void Constituent::show (const cmt_string& name) |
---|
27 | { |
---|
28 | Constituent* cptr = find (name); |
---|
29 | if (cptr == 0) return; |
---|
30 | |
---|
31 | const Constituent& constituent = *cptr; |
---|
32 | |
---|
33 | constituent.show (); |
---|
34 | } |
---|
35 | |
---|
36 | //---------------------------------------------------------- |
---|
37 | void Constituent::parse_all () |
---|
38 | { |
---|
39 | static ConstituentVector& Constituents = constituents (); |
---|
40 | |
---|
41 | int number; |
---|
42 | |
---|
43 | for (number = 0; number < Symbol::symbol_number (); number++) |
---|
44 | { |
---|
45 | Symbol& symbol = Symbol::symbol (number); |
---|
46 | |
---|
47 | if (symbol.type != Symbol::SymbolAction) continue; |
---|
48 | |
---|
49 | /* |
---|
50 | if (symbol.value_lists.size () < 1) continue; |
---|
51 | |
---|
52 | cmt_string value = symbol.build_macro_value (); |
---|
53 | |
---|
54 | if (value != "") |
---|
55 | { |
---|
56 | add_for_action (symbol.name); |
---|
57 | } |
---|
58 | */ |
---|
59 | add_for_action (symbol); |
---|
60 | } |
---|
61 | |
---|
62 | for (number = 0; number < Constituents.size (); number++) |
---|
63 | { |
---|
64 | Constituent& constituent = Constituents[number]; |
---|
65 | |
---|
66 | constituent.parse (); |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | //---------------------------------------------------------- |
---|
71 | void Constituent::show_all () |
---|
72 | { |
---|
73 | static ConstituentVector& Constituents = constituents (); |
---|
74 | |
---|
75 | int number; |
---|
76 | |
---|
77 | for (number = 0; number < Constituents.size (); number++) |
---|
78 | { |
---|
79 | const Constituent& constituent = Constituents[number]; |
---|
80 | |
---|
81 | constituent.show (); |
---|
82 | } |
---|
83 | } |
---|
84 | |
---|
85 | //---------------------------------------------------------- |
---|
86 | void Constituent::show_names () |
---|
87 | { |
---|
88 | static ConstituentVector& Constituents = constituents (); |
---|
89 | |
---|
90 | int number; |
---|
91 | |
---|
92 | for (number = 0; number < Constituents.size (); number++) |
---|
93 | { |
---|
94 | Constituent& constituent = Constituents[number]; |
---|
95 | cout << constituent.name << endl; |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|
99 | //---------------------------------------------------------- |
---|
100 | Constituent* Constituent::find (const cmt_string& name) |
---|
101 | { |
---|
102 | static ConstituentVector& Constituents = constituents (); |
---|
103 | |
---|
104 | int constituent_index; |
---|
105 | |
---|
106 | if (Constituents.size () == 0) return (0); |
---|
107 | |
---|
108 | for (constituent_index = 0; |
---|
109 | constituent_index < Constituents.size (); |
---|
110 | constituent_index++) |
---|
111 | { |
---|
112 | Constituent& constituent = Constituents[constituent_index]; |
---|
113 | |
---|
114 | if (constituent.name == name) |
---|
115 | { |
---|
116 | return (&constituent); |
---|
117 | } |
---|
118 | } |
---|
119 | |
---|
120 | return (0); |
---|
121 | } |
---|
122 | |
---|
123 | class constituents_action_iterator |
---|
124 | { |
---|
125 | public: |
---|
126 | typedef enum |
---|
127 | { |
---|
128 | ready, |
---|
129 | need_include |
---|
130 | } states; |
---|
131 | |
---|
132 | constituents_action_iterator (Constituent& c) : m_constituent (c) |
---|
133 | { |
---|
134 | m_state = ready; |
---|
135 | } |
---|
136 | |
---|
137 | void set (const cmt_string& w) |
---|
138 | { |
---|
139 | int equal; |
---|
140 | |
---|
141 | if (w == "") return; |
---|
142 | |
---|
143 | if (m_state == need_include) |
---|
144 | { |
---|
145 | m_state = ready; |
---|
146 | |
---|
147 | cmt_string& include = m_constituent.includes.add (); |
---|
148 | include = w; |
---|
149 | } |
---|
150 | |
---|
151 | if (w == "-OS9") |
---|
152 | { |
---|
153 | m_constituent.need_OS9 = true; |
---|
154 | } |
---|
155 | else if ((w == "-Windows") || |
---|
156 | (w == "-windows")) |
---|
157 | { |
---|
158 | m_constituent.windows = true; |
---|
159 | } |
---|
160 | else if (w == "-no_share") |
---|
161 | { |
---|
162 | m_constituent.no_share = true; |
---|
163 | } |
---|
164 | else if (w == "-no_static") |
---|
165 | { |
---|
166 | m_constituent.no_static = true; |
---|
167 | } |
---|
168 | else if (w == "-prototypes") |
---|
169 | { |
---|
170 | m_constituent.need_prototypes = true; |
---|
171 | } |
---|
172 | else if (w == "-no_prototypes") |
---|
173 | { |
---|
174 | m_constituent.need_prototypes = false; |
---|
175 | } |
---|
176 | else if (w == "-check") |
---|
177 | { |
---|
178 | m_constituent.need_check = true; |
---|
179 | } |
---|
180 | else if (w == "-triggers") |
---|
181 | { |
---|
182 | if (m_constituent.type == Library) |
---|
183 | { |
---|
184 | //m_constituent.build_triggers = true; |
---|
185 | } |
---|
186 | } |
---|
187 | else if (w == "-no_triggers") |
---|
188 | { |
---|
189 | if (m_constituent.type == Library) |
---|
190 | { |
---|
191 | m_constituent.build_triggers = false; |
---|
192 | } |
---|
193 | } |
---|
194 | else if (w == "-I") |
---|
195 | { |
---|
196 | m_state = need_include; |
---|
197 | } |
---|
198 | else if (w.substr (0, 3) == "-s=") |
---|
199 | { |
---|
200 | w.substr (3, m_subdir); |
---|
201 | } |
---|
202 | else if (w.substr (0, 3) == "-x=") |
---|
203 | { |
---|
204 | cmt_string& exclude = m_constituent.excludes.add (); |
---|
205 | w.substr (3, exclude); |
---|
206 | cmt_regexp& exp = m_constituent.exclude_exprs.add (); |
---|
207 | exp.set (exclude); |
---|
208 | } |
---|
209 | else if (w.substr (0, 3) == "-k=") |
---|
210 | { |
---|
211 | cmt_string& select = m_constituent.selects.add (); |
---|
212 | w.substr (3, select); |
---|
213 | cmt_regexp& exp = m_constituent.select_exprs.add (); |
---|
214 | exp.set (select); |
---|
215 | } |
---|
216 | else if (w.substr (0, 8) == "-import=") |
---|
217 | { |
---|
218 | cmt_string text_imports; |
---|
219 | w.substr (8, text_imports); |
---|
220 | |
---|
221 | CmtSystem::cmt_string_vector imports; |
---|
222 | |
---|
223 | CmtSystem::split (text_imports, ',', imports); |
---|
224 | |
---|
225 | for (int i = 0; i < imports.size (); i++) |
---|
226 | { |
---|
227 | cmt_string& import = m_constituent.imports.add (); |
---|
228 | import = imports[i] ; |
---|
229 | } |
---|
230 | } |
---|
231 | else if (w.substr (0, 7) == "-group=") |
---|
232 | { |
---|
233 | cmt_string group_name = ""; |
---|
234 | |
---|
235 | w.substr (7, group_name); |
---|
236 | |
---|
237 | if (group_name != "") |
---|
238 | { |
---|
239 | m_constituent.group = Group::add (group_name); |
---|
240 | } |
---|
241 | } |
---|
242 | else if (w.substr (0, 8) == "-suffix=") |
---|
243 | { |
---|
244 | w.substr (8, m_constituent.suffix); |
---|
245 | } |
---|
246 | else if (w == "-target_tag") |
---|
247 | { |
---|
248 | m_constituent.has_target_tag = true; |
---|
249 | } |
---|
250 | else if (w.substr (0, 1) == "-") |
---|
251 | { |
---|
252 | //if (!Cmt::get_quiet ()) |
---|
253 | //{ |
---|
254 | CmtMessage::warning ("bad option " + w + " in constituent " + |
---|
255 | m_constituent.name); |
---|
256 | // cerr << "#CMT> Warning: bad option " |
---|
257 | // << w << " in constituent " << m_constituent.name << endl; |
---|
258 | //CmtError::set (CmtError::execution_error, cmd); |
---|
259 | //} |
---|
260 | } |
---|
261 | else if ((equal = w.find ("=")) != cmt_string::npos) |
---|
262 | { |
---|
263 | cmt_string variable_name; |
---|
264 | cmt_string variable_value; |
---|
265 | |
---|
266 | w.substr (0, equal, variable_name); |
---|
267 | w.substr (equal + 1, variable_value); |
---|
268 | |
---|
269 | Variable* v = Variable::find (m_constituent.variables, variable_name); |
---|
270 | if (v == 0) |
---|
271 | { |
---|
272 | v = &(m_constituent.variables.add ()); |
---|
273 | v->set (variable_name); |
---|
274 | } |
---|
275 | |
---|
276 | (*v) = variable_value; |
---|
277 | } |
---|
278 | else |
---|
279 | { |
---|
280 | // We have a normal source module |
---|
281 | |
---|
282 | cmt_string& module = m_constituent.modules.add (); |
---|
283 | |
---|
284 | module.erase (0); |
---|
285 | |
---|
286 | // |
---|
287 | // The prefix explicitly provided in (w) has priority |
---|
288 | // over the currently specified (m_subdir) when it is an |
---|
289 | // absolute path |
---|
290 | // |
---|
291 | if (CmtSystem::absolute_path (w)) |
---|
292 | { |
---|
293 | module += w; |
---|
294 | } |
---|
295 | else |
---|
296 | { |
---|
297 | cmt_string prefix; |
---|
298 | cmt_string name = w; |
---|
299 | |
---|
300 | CmtSystem::dirname (name, prefix); |
---|
301 | if (prefix == "../src") CmtSystem::basename (name, name); |
---|
302 | |
---|
303 | module += m_subdir; |
---|
304 | |
---|
305 | if (module != "") |
---|
306 | { |
---|
307 | module += CmtSystem::file_separator (); |
---|
308 | } |
---|
309 | |
---|
310 | module += name; |
---|
311 | } |
---|
312 | } |
---|
313 | } |
---|
314 | |
---|
315 | Constituent& m_constituent; |
---|
316 | cmt_string m_subdir; |
---|
317 | states m_state; |
---|
318 | }; |
---|
319 | |
---|
320 | //---------------------------------------------------------- |
---|
321 | void Constituent::action (ConstituentType type, |
---|
322 | const CmtSystem::cmt_string_vector& words) |
---|
323 | { |
---|
324 | cmt_string generator; |
---|
325 | cmt_string name; |
---|
326 | Constituent* constituent; |
---|
327 | |
---|
328 | int i = 1; |
---|
329 | |
---|
330 | if (type == Document) |
---|
331 | { |
---|
332 | generator = words[i]; |
---|
333 | if (generator == "") return; |
---|
334 | i++; |
---|
335 | } |
---|
336 | |
---|
337 | name = words[i]; |
---|
338 | if (name == "") return; |
---|
339 | i++; |
---|
340 | |
---|
341 | constituent = add (type, name, generator); |
---|
342 | |
---|
343 | for (;i < words.size (); i++) |
---|
344 | { |
---|
345 | const cmt_string& w = words[i]; |
---|
346 | cmt_string& parameter = constituent->parameters.add (); |
---|
347 | parameter = w; |
---|
348 | } |
---|
349 | } |
---|
350 | |
---|
351 | //---------------------------------------------------------- |
---|
352 | void Constituent::parse () |
---|
353 | { |
---|
354 | if (parameters.size () == 0) return; |
---|
355 | |
---|
356 | Constituent& me = *this; |
---|
357 | |
---|
358 | modules.clear (); |
---|
359 | |
---|
360 | constituents_action_iterator it (me); |
---|
361 | |
---|
362 | for (int i = 0; i < parameters.size (); i++) |
---|
363 | { |
---|
364 | const cmt_string& w = parameters[i]; |
---|
365 | cmt_string ew = w; |
---|
366 | |
---|
367 | Symbol::expand (ew); |
---|
368 | |
---|
369 | CmtSystem::cmt_string_vector ws; |
---|
370 | |
---|
371 | //cerr << "Constituent " << name << " Analyzing module " << ew << endl; |
---|
372 | |
---|
373 | // if (ew.substr (0, 13) == "action_value=") |
---|
374 | // { |
---|
375 | // it.set (ew); |
---|
376 | // } |
---|
377 | // else |
---|
378 | // { |
---|
379 | CmtSystem::split (ew, " \t", ws); |
---|
380 | |
---|
381 | for (int j = 0; j < ws.size (); ++j) |
---|
382 | { |
---|
383 | const cmt_string& w = ws[j]; |
---|
384 | |
---|
385 | //cerr << "Constituent " << name << " Setting module " << w << endl; |
---|
386 | it.set (w); |
---|
387 | } |
---|
388 | // } |
---|
389 | } |
---|
390 | |
---|
391 | parameters.clear (); |
---|
392 | |
---|
393 | if (has_target_tag && (Document != type || "cmt_actions" != group->name ())) |
---|
394 | { |
---|
395 | const Tag* tag = Tag::find ("target_" + name); |
---|
396 | if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) |
---|
397 | { |
---|
398 | // Keep associated tag target_<name> |
---|
399 | // only if this tag is used somewhere |
---|
400 | // in tag or symbol expression |
---|
401 | has_target_tag = false; |
---|
402 | CmtMessage::verbose ("discarded tag target_" + name + " for " |
---|
403 | + (type == Application ? "application " : |
---|
404 | (type == Library ? "library " : "document ")) |
---|
405 | + name); |
---|
406 | } |
---|
407 | } |
---|
408 | } |
---|
409 | |
---|
410 | //---------------------------------------------------------- |
---|
411 | Constituent* Constituent::add (ConstituentType type, |
---|
412 | const cmt_string& name, |
---|
413 | const cmt_string& generator) |
---|
414 | { |
---|
415 | static ConstituentVector& Constituents = constituents (); |
---|
416 | |
---|
417 | { |
---|
418 | Constituent* constituent; |
---|
419 | |
---|
420 | if (name == "") return (0); |
---|
421 | |
---|
422 | constituent = find (name); |
---|
423 | if (constituent != 0) return (constituent); |
---|
424 | } |
---|
425 | |
---|
426 | Constituent& constituent = Constituents.add (); |
---|
427 | constituent.clear (); |
---|
428 | |
---|
429 | constituent.name = name; |
---|
430 | constituent.generator = generator; |
---|
431 | constituent.type = type; |
---|
432 | constituent.need_prototypes = Cmt::need_prototypes (); |
---|
433 | |
---|
434 | return (&constituent); |
---|
435 | } |
---|
436 | |
---|
437 | //---------------------------------------------------------- |
---|
438 | Constituent* Constituent::add_for_action (const Symbol& symbol) |
---|
439 | //Constituent* Constituent::add_for_action (const cmt_string& name) |
---|
440 | { |
---|
441 | Constituent* constituent (0); |
---|
442 | if (symbol.value_lists.size () < 1) return constituent; |
---|
443 | |
---|
444 | const Tag* tag = Tag::find ("target_" + symbol.name); |
---|
445 | const bool target_tag_used |
---|
446 | (Tag::check_tag_used (tag) || Symbol::check_tag_used (tag)); |
---|
447 | |
---|
448 | cmt_string value = symbol.build_macro_value (); |
---|
449 | if ( "" == value && !target_tag_used) return constituent; |
---|
450 | |
---|
451 | constituent = add (Document, symbol.name, "cmt_action_runner"); |
---|
452 | |
---|
453 | constituent->group = Group::add ("cmt_actions"); |
---|
454 | |
---|
455 | // Do NOT associate target_<name> by default |
---|
456 | // but only if this tag is used somewhere |
---|
457 | // in tag or symbol expression |
---|
458 | if (target_tag_used) |
---|
459 | constituent->has_target_tag = true; |
---|
460 | |
---|
461 | cmt_string& p1 = constituent->parameters.add (); |
---|
462 | p1 = "action_value="; |
---|
463 | Symbol::expand (value); |
---|
464 | // quote since split will later be applied |
---|
465 | // - in parse |
---|
466 | p1 += CmtSystem::quote (value, " \t"); |
---|
467 | // p1 += "$("; |
---|
468 | // p1 += symbol.name; |
---|
469 | // p1 += ")"; |
---|
470 | |
---|
471 | return (constituent); |
---|
472 | } |
---|
473 | |
---|
474 | //---------------------------------------------------------- |
---|
475 | void Constituent::clear_all () |
---|
476 | { |
---|
477 | static ConstituentVector& Constituents = constituents (); |
---|
478 | |
---|
479 | for (int i = 0; i < Constituents.size (); i++) |
---|
480 | { |
---|
481 | Constituent& c = Constituents[i]; |
---|
482 | c.clear (); |
---|
483 | } |
---|
484 | Constituents.clear (); |
---|
485 | } |
---|
486 | |
---|
487 | //---------------------------------------------------------- |
---|
488 | Constituent::ConstituentVector& Constituent::constituents () |
---|
489 | { |
---|
490 | static Database& db = Database::instance (); |
---|
491 | static ConstituentVector& Constituents = db.constituents (); |
---|
492 | |
---|
493 | return (Constituents); |
---|
494 | } |
---|
495 | |
---|
496 | //---------------------------------------------------------- |
---|
497 | Constituent::Constituent () |
---|
498 | { |
---|
499 | clear (); |
---|
500 | } |
---|
501 | |
---|
502 | //---------------------------------------------------------- |
---|
503 | Constituent::~Constituent () |
---|
504 | { |
---|
505 | } |
---|
506 | |
---|
507 | //---------------------------------------------------------- |
---|
508 | void Constituent::clear () |
---|
509 | { |
---|
510 | name = ""; |
---|
511 | generator = ""; |
---|
512 | type = Document; |
---|
513 | group = 0; |
---|
514 | modules.clear (); |
---|
515 | parameters.clear (); |
---|
516 | need_OS9 = false; |
---|
517 | windows = false; |
---|
518 | no_static = false; |
---|
519 | no_share = false; |
---|
520 | need_prototypes = false; |
---|
521 | need_check = false; |
---|
522 | build_triggers = false; |
---|
523 | has_target_tag = false; |
---|
524 | excludes.clear (); |
---|
525 | exclude_exprs.clear (); |
---|
526 | selects.clear (); |
---|
527 | select_exprs.clear (); |
---|
528 | includes.clear (); |
---|
529 | imports.clear (); |
---|
530 | variables.clear (); |
---|
531 | } |
---|
532 | |
---|
533 | //---------------------------------------------------------- |
---|
534 | void Constituent::build_all_makefiles (bool simulation) |
---|
535 | { |
---|
536 | static ConstituentVector& Constituents = constituents (); |
---|
537 | |
---|
538 | int i; |
---|
539 | |
---|
540 | for (i = 0; i < Constituents.size (); i++) |
---|
541 | { |
---|
542 | Constituent& constituent = Constituents[i]; |
---|
543 | |
---|
544 | constituent.build_makefile (simulation); |
---|
545 | } |
---|
546 | } |
---|
547 | |
---|
548 | //---------------------------------------------------------- |
---|
549 | void Constituent::build_all_msdev_files (bool simulation) |
---|
550 | { |
---|
551 | static ConstituentVector& Constituents = constituents (); |
---|
552 | |
---|
553 | int i; |
---|
554 | |
---|
555 | Generator::build_msdev_workspace (Constituents); |
---|
556 | |
---|
557 | for (i = 0; i < Constituents.size (); i++) |
---|
558 | { |
---|
559 | Constituent& constituent = Constituents[i]; |
---|
560 | |
---|
561 | constituent.build_msdev_file (simulation); |
---|
562 | } |
---|
563 | } |
---|
564 | |
---|
565 | // Visual Studio.Net Support |
---|
566 | //---------------------------------------------------------- |
---|
567 | void Constituent::build_all_vsnet_files (bool simulation) |
---|
568 | { |
---|
569 | static ConstituentVector& Constituents = constituents (); |
---|
570 | |
---|
571 | int i; |
---|
572 | |
---|
573 | Generator::build_vsnet_workspace (Constituents); |
---|
574 | |
---|
575 | for (i = 0; i < Constituents.size (); i++) |
---|
576 | { |
---|
577 | Constituent& constituent = Constituents[i]; |
---|
578 | |
---|
579 | constituent.build_vsnet_file (simulation); |
---|
580 | } |
---|
581 | } |
---|
582 | |
---|
583 | //---------------------------------------------------------- |
---|
584 | void Constituent::build_makefile (bool simulation) const |
---|
585 | { |
---|
586 | if (!simulation) |
---|
587 | { |
---|
588 | bool dependencies (false); |
---|
589 | Generator::build_constituent_makefile (*this, dependencies); |
---|
590 | } |
---|
591 | } |
---|
592 | |
---|
593 | //---------------------------------------------------------- |
---|
594 | void Constituent::build_msdev_file (bool simulation) const |
---|
595 | { |
---|
596 | if (!simulation) |
---|
597 | { |
---|
598 | Generator::build_msdev (*this); |
---|
599 | } |
---|
600 | } |
---|
601 | |
---|
602 | // Visual Studio.net Support |
---|
603 | //---------------------------------------------------------- |
---|
604 | void Constituent::build_vsnet_file (bool simulation) const |
---|
605 | { |
---|
606 | if (!simulation) |
---|
607 | { |
---|
608 | Generator::build_vsnet (*this); |
---|
609 | } |
---|
610 | } |
---|
611 | |
---|
612 | //---------------------------------------------------------- |
---|
613 | void Constituent::show (ostream& out) const |
---|
614 | //void Constituent::show () const |
---|
615 | { |
---|
616 | int i; |
---|
617 | |
---|
618 | switch (type) |
---|
619 | { |
---|
620 | case Library: |
---|
621 | out << "library"; |
---|
622 | break; |
---|
623 | case Application: |
---|
624 | out << "application"; |
---|
625 | break; |
---|
626 | case Document: |
---|
627 | out << "document " << generator; |
---|
628 | break; |
---|
629 | } |
---|
630 | |
---|
631 | out << " " << name; |
---|
632 | |
---|
633 | if (group != 0) |
---|
634 | { |
---|
635 | out << " -group=" << group->name (); |
---|
636 | } |
---|
637 | |
---|
638 | if (suffix != 0) |
---|
639 | { |
---|
640 | out << " -suffix=" << suffix; |
---|
641 | } |
---|
642 | |
---|
643 | if ((type == Application) && need_check) |
---|
644 | { |
---|
645 | out << " -check"; |
---|
646 | } |
---|
647 | |
---|
648 | if ((type == Library) && no_share) |
---|
649 | { |
---|
650 | out << " -no_share"; |
---|
651 | } |
---|
652 | |
---|
653 | if ((type == Library) && no_static) |
---|
654 | { |
---|
655 | out << " -no_static"; |
---|
656 | } |
---|
657 | |
---|
658 | if ((type == Library) && build_triggers) |
---|
659 | { |
---|
660 | out << " -triggers"; |
---|
661 | } |
---|
662 | |
---|
663 | if (has_target_tag) |
---|
664 | { |
---|
665 | out << " -target_tag"; |
---|
666 | } |
---|
667 | |
---|
668 | for (i = 0; i < (imports.size ()); i++) |
---|
669 | { |
---|
670 | const cmt_string& import_name = imports[i]; |
---|
671 | |
---|
672 | out << " -import=" << import_name; |
---|
673 | } |
---|
674 | |
---|
675 | for (i = 0; i < (excludes.size ()); i++) |
---|
676 | { |
---|
677 | const cmt_string& exclude = excludes[i]; |
---|
678 | |
---|
679 | out << " -x=" << exclude; |
---|
680 | } |
---|
681 | |
---|
682 | for (i = 0; i < (selects.size ()); i++) |
---|
683 | { |
---|
684 | const cmt_string& select = selects[i]; |
---|
685 | |
---|
686 | out << " -k=" << select; |
---|
687 | } |
---|
688 | |
---|
689 | for (i = 0; i < (modules.size ()); i++) |
---|
690 | { |
---|
691 | const cmt_string& module_name = modules[i]; |
---|
692 | |
---|
693 | out << " " << module_name; |
---|
694 | } |
---|
695 | |
---|
696 | for (i = 0; i < (variables.size ()); i++) |
---|
697 | { |
---|
698 | const Variable& v = variables[i]; |
---|
699 | |
---|
700 | // out << " " << v.name << "=" << v.value; |
---|
701 | // quote (up to) 2 times as split is applied 2 times |
---|
702 | // - before action |
---|
703 | // - in parse |
---|
704 | cmt_string qvalue (CmtSystem::quote (v.value, " \t")); |
---|
705 | out << " " << v.name << "=" |
---|
706 | << (qvalue == v.value ? v.value : CmtSystem::quote (qvalue, " \t")); |
---|
707 | // << CmtSystem::quote (CmtSystem::quote (v.value, " \t"), " \t"); |
---|
708 | } |
---|
709 | |
---|
710 | out << endl; |
---|
711 | } |
---|