]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/cdl-guide/language.tcl.html
Initial revision
[karo-tx-redboot.git] / doc / html / cdl-guide / language.tcl.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >An Introduction to Tcl</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="The eCos Component Writer's Guide"
20 HREF="cdl-guide.html"><LINK
21 REL="UP"
22 TITLE="The CDL Language"
23 HREF="language.html"><LINK
24 REL="PREVIOUS"
25 TITLE="Option Naming Convention"
26 HREF="language.naming.html"><LINK
27 REL="NEXT"
28 TITLE="Values and Expressions"
29 HREF="language.values.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >The <SPAN
50 CLASS="APPLICATION"
51 >eCos</SPAN
52 > Component Writer's Guide</TH
53 ></TR
54 ><TR
55 ><TD
56 WIDTH="10%"
57 ALIGN="left"
58 VALIGN="bottom"
59 ><A
60 HREF="language.naming.html"
61 ACCESSKEY="P"
62 >Prev</A
63 ></TD
64 ><TD
65 WIDTH="80%"
66 ALIGN="center"
67 VALIGN="bottom"
68 >Chapter 3. The CDL Language</TD
69 ><TD
70 WIDTH="10%"
71 ALIGN="right"
72 VALIGN="bottom"
73 ><A
74 HREF="language.values.html"
75 ACCESSKEY="N"
76 >Next</A
77 ></TD
78 ></TR
79 ></TABLE
80 ><HR
81 ALIGN="LEFT"
82 WIDTH="100%"></DIV
83 ><DIV
84 CLASS="SECT1"
85 ><H1
86 CLASS="SECT1"
87 ><A
88 NAME="LANGUAGE.TCL">An Introduction to Tcl</H1
89 ><P
90 >All <SPAN
91 CLASS="APPLICATION"
92 >CDL</SPAN
93 > scripts are implemented as <SPAN
94 CLASS="APPLICATION"
95 >Tcl</SPAN
96 > scripts, and are read in by
97 running the data through a standard <SPAN
98 CLASS="APPLICATION"
99 >Tcl</SPAN
100 > interpreter, extended with a
101 small number of additional commands such as
102 <TT
103 CLASS="LITERAL"
104 >cdl_option</TT
105 > and <TT
106 CLASS="LITERAL"
107 >cdl_component</TT
108 >.
109 Often it is not necessary to know the full details of <SPAN
110 CLASS="APPLICATION"
111 >Tcl</SPAN
112 > syntax.
113 Instead it is possible to copy an existing script, perform some copy
114 and paste operations, and make appropriate changes to names and to
115 various properties. However there are also cases where an
116 understanding of <SPAN
117 CLASS="APPLICATION"
118 >Tcl</SPAN
119 > syntax is very desirable, for example:</P
120 ><TABLE
121 BORDER="5"
122 BGCOLOR="#E0E0F0"
123 WIDTH="70%"
124 ><TR
125 ><TD
126 ><PRE
127 CLASS="PROGRAMLISTING"
128 >cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS {
129     display       "Externs for initialization"
130     flavor        data
131     default_value {"static char fpool1[ 2000 ], \\\n\
132                                 fpool2[ 2000 ], \\\n\
133                                 fpool3[ 2000 ];"}
134     &#8230;
135 }</PRE
136 ></TD
137 ></TR
138 ></TABLE
139 ><P
140 >This causes the <TT
141 CLASS="LITERAL"
142 >cdl_option</TT
143 > command to be executed, which in turn
144 evaluates its body in a recursive invocation of the <SPAN
145 CLASS="APPLICATION"
146 >Tcl</SPAN
147 > interpreter.
148 When the <SPAN
149 CLASS="PROPERTY"
150 >default_value</SPAN
151 > property is encountered the braces around the
152 value part are processed by the interpreter, stopping it from doing
153 further processing of the braced contents (except for backslash
154 processing at the end of a line, that is special). In particular it
155 prevents command substitution for
156 <TT
157 CLASS="LITERAL"
158 >[&nbsp;2000&nbsp;]</TT
159 >. A single argument will be
160 passed to the <SPAN
161 CLASS="PROPERTY"
162 >default_value</SPAN
163 > command which expects a <SPAN
164 CLASS="APPLICATION"
165 >CDL</SPAN
166 >
167 expression, so the expression parsing code is passed the following:</P
168 ><TABLE
169 BORDER="5"
170 BGCOLOR="#E0E0F0"
171 WIDTH="70%"
172 ><TR
173 ><TD
174 ><PRE
175 CLASS="SCREEN"
176 >"static char fpool1[ 2000 ], \\\n fpool2[ 2000 ], \\\n fpool3[ 2000 ];"</PRE
177 ></TD
178 ></TR
179 ></TABLE
180 ><P
181 >The <SPAN
182 CLASS="APPLICATION"
183 >CDL</SPAN
184 > expression parsing code will treat this as a simple string
185 constant, as opposed to a more complicated expression involving other
186 options and various operators. The string parsing code will perform
187 the usual backslash substitutions so the actual default value will be:</P
188 ><TABLE
189 BORDER="5"
190 BGCOLOR="#E0E0F0"
191 WIDTH="70%"
192 ><TR
193 ><TD
194 ><PRE
195 CLASS="SCREEN"
196 >static char fpool1[ 2000 ], \
197  fpool2[ 2000 ], \
198  fpool3[ 2000 ];</PRE
199 ></TD
200 ></TR
201 ></TABLE
202 ><P
203 >If the user does not modify the option's value then the following
204 will be generated in the appropriate configuration header file:</P
205 ><TABLE
206 BORDER="5"
207 BGCOLOR="#E0E0F0"
208 WIDTH="70%"
209 ><TR
210 ><TD
211 ><PRE
212 CLASS="PROGRAMLISTING"
213 >#define CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS static char fpool1[ 2000 ], \
214  fpool2[ 2000 ], \
215  fpool3[ 2000 ];</PRE
216 ></TD
217 ></TR
218 ></TABLE
219 ><P
220 >Getting this desired result usually requires an understanding of both
221 <SPAN
222 CLASS="APPLICATION"
223 >Tcl</SPAN
224 > syntax and <SPAN
225 CLASS="APPLICATION"
226 >CDL</SPAN
227 > expression syntax. Sometimes it is possible to
228 substitute a certain amount of trial and error instead, but this may
229 prove frustrating. It is also worth pointing out that many <SPAN
230 CLASS="APPLICATION"
231 >CDL</SPAN
232 >
233 scripts do not involve this level of complexity. On the other hand,
234 some of the more advanced features of the <SPAN
235 CLASS="APPLICATION"
236 >CDL</SPAN
237 > language involve
238 fragments of <SPAN
239 CLASS="APPLICATION"
240 >Tcl</SPAN
241 > code, for example the <SPAN
242 CLASS="PROPERTY"
243 >define_proc</SPAN
244 > property. To
245 use these component writers will need to know about the full <SPAN
246 CLASS="APPLICATION"
247 >Tcl</SPAN
248 >
249 language as well as the syntax.</P
250 ><P
251 >Although the current example may seem to suggest that <SPAN
252 CLASS="APPLICATION"
253 >Tcl</SPAN
254 > is rather
255 complicated, it is actually a very simple yet powerful scripting
256 language: the syntax is defined by just eleven rules. On occasion this
257 simplicity means that Tcl's behavior is subtly different from other
258 languages, which can confuse newcomers.</P
259 ><P
260 >When the Tcl interpreter is passed some data such as
261 <TT
262 CLASS="LITERAL"
263 >puts&nbsp;Hello</TT
264 >, it splits this data into a command
265 and its arguments. The command will be terminated by a newline or by a
266 semicolon, unless one of the quoting mechanisms is used. The command
267 and each of its arguments are separated by white space. So in the
268 following example:</P
269 ><TABLE
270 BORDER="5"
271 BGCOLOR="#E0E0F0"
272 WIDTH="70%"
273 ><TR
274 ><TD
275 ><PRE
276 CLASS="SCREEN"
277 >puts Hello
278 set x 42</PRE
279 ></TD
280 ></TR
281 ></TABLE
282 ><P
283 >This will result in two separate commands being executed. The first
284 command is <TT
285 CLASS="LITERAL"
286 >puts</TT
287 > and is passed a single argument,
288 <TT
289 CLASS="LITERAL"
290 >Hello</TT
291 >. The second command is <TT
292 CLASS="LITERAL"
293 >set</TT
294 >
295 and is passed two arguments, <TT
296 CLASS="LITERAL"
297 >x</TT
298 > and
299 <TT
300 CLASS="LITERAL"
301 >42</TT
302 >. The intervening newline character serves to
303 terminate the first command, and a semi-colon separator could be used
304 instead: </P
305 ><TABLE
306 BORDER="5"
307 BGCOLOR="#E0E0F0"
308 WIDTH="70%"
309 ><TR
310 ><TD
311 ><PRE
312 CLASS="SCREEN"
313 >puts Hello;set x 42</PRE
314 ></TD
315 ></TR
316 ></TABLE
317 ><P
318 >Any white space surrounding the semicolon is just ignored because it
319 does not serve to separate arguments.</P
320 ><P
321 >Now consider the following:</P
322 ><TABLE
323 BORDER="5"
324 BGCOLOR="#E0E0F0"
325 WIDTH="70%"
326 ><TR
327 ><TD
328 ><PRE
329 CLASS="SCREEN"
330 >set x Hello world</PRE
331 ></TD
332 ></TR
333 ></TABLE
334 ><P
335 >This is not valid <SPAN
336 CLASS="APPLICATION"
337 >Tcl</SPAN
338 >. It is an attempt to invoke the
339 <TT
340 CLASS="LITERAL"
341 >set</TT
342 > command with three arguments:
343 <TT
344 CLASS="LITERAL"
345 >x</TT
346 >, <TT
347 CLASS="LITERAL"
348 >Hello</TT
349 >, and
350 <TT
351 CLASS="LITERAL"
352 >world</TT
353 >. The <TT
354 CLASS="LITERAL"
355 >set</TT
356 > only takes two
357 arguments, a variable name and a value, so it is necessary to combine
358 the data into a single argument by quoting:</P
359 ><TABLE
360 BORDER="5"
361 BGCOLOR="#E0E0F0"
362 WIDTH="70%"
363 ><TR
364 ><TD
365 ><PRE
366 CLASS="SCREEN"
367 >set x "Hello world"</PRE
368 ></TD
369 ></TR
370 ></TABLE
371 ><P
372 >When the <SPAN
373 CLASS="APPLICATION"
374 >Tcl</SPAN
375 > interpreter encounters the first quote character it
376 treats all subsequent data up to but not including the closing quote
377 as part of the current argument. The quote marks are removed by the
378 interpreter, so the second argument passed to the
379 <TT
380 CLASS="LITERAL"
381 >set</TT
382 > command is just <TT
383 CLASS="LITERAL"
384 >Hello world</TT
385 >
386 without the quote characters. This can be significant in the context
387 of <SPAN
388 CLASS="APPLICATION"
389 >CDL</SPAN
390 > scripts. For example:</P
391 ><TABLE
392 BORDER="5"
393 BGCOLOR="#E0E0F0"
394 WIDTH="70%"
395 ><TR
396 ><TD
397 ><PRE
398 CLASS="PROGRAMLISTING"
399 >cdl_option CYG_HAL_STARTUP {
400     &#8230;
401     default_value "RAM"
402 }</PRE
403 ></TD
404 ></TR
405 ></TABLE
406 ><P
407 >The <SPAN
408 CLASS="APPLICATION"
409 >Tcl</SPAN
410 > interpreter strips off the quote marks so the <SPAN
411 CLASS="APPLICATION"
412 >CDL</SPAN
413 >
414 expression parsing code sees <TT
415 CLASS="LITERAL"
416 >RAM</TT
417 > instead of
418 <TT
419 CLASS="LITERAL"
420 >"RAM"</TT
421 >. It will treat this as a reference to
422 some unknown option <TT
423 CLASS="VARNAME"
424 >RAM</TT
425 > rather than as a string
426 constant, and the expression evaluation code will use a value of
427 <TT
428 CLASS="LITERAL"
429 >0</TT
430 > when it encounters an option that is not
431 currently loaded. Therefore the option
432 <TT
433 CLASS="VARNAME"
434 >CYG_HAL_STARTUP</TT
435 > ends up with a default value of
436 <TT
437 CLASS="LITERAL"
438 >0</TT
439 >. Either braces or backslashes should be used to
440 avoid this, for example
441 <TT
442 CLASS="LITERAL"
443 >default_value&nbsp;{&nbsp;"RAM"&nbsp;}</TT
444 >. </P
445 ><DIV
446 CLASS="NOTE"
447 ><BLOCKQUOTE
448 CLASS="NOTE"
449 ><P
450 ><B
451 >Note: </B
452 >There are long-term plans to implement some sort of <SPAN
453 CLASS="APPLICATION"
454 >CDL</SPAN
455 > validation
456 utility <SPAN
457 CLASS="APPLICATION"
458 >cdllint</SPAN
459 > which
460 could catch common errors like this one.</P
461 ></BLOCKQUOTE
462 ></DIV
463 ><P
464 >A quoted argument continues until the closing quote character is
465 encountered, which means that it can span multiple lines. Newline or
466 semicolon characters do not terminate the current command in such
467 cases. <SPAN
468 CLASS="PROPERTY"
469 >description</SPAN
470 > properties usually make use of this:</P
471 ><TABLE
472 BORDER="5"
473 BGCOLOR="#E0E0F0"
474 WIDTH="70%"
475 ><TR
476 ><TD
477 ><PRE
478 CLASS="PROGRAMLISTING"
479 >cdl_package CYGPKG_ERROR {
480     description   "
481         This package contains the common list of error and
482         status codes. It is held centrally to allow
483         packages to interchange error codes and status
484         codes in a common way, rather than each package
485         having its own conventions for error/status
486         reporting. The error codes are modelled on the
487         POSIX style naming e.g. EINVAL etc. This package
488         also provides the standard strerror() function to
489         convert error codes to textual representation."
490     &#8230;
491 }</PRE
492 ></TD
493 ></TR
494 ></TABLE
495 ><P
496 >The <SPAN
497 CLASS="APPLICATION"
498 >Tcl</SPAN
499 > interpreter supports much the same forms of backslash
500 substitution as other common programming languages. Some backslash
501 sequences such as <TT
502 CLASS="LITERAL"
503 >\n</TT
504 > will be replaced by the
505 appropriate character. The sequence <TT
506 CLASS="LITERAL"
507 >\\</TT
508 > will be
509 replaced by a single backslash. A backslash at the very end of a line
510 will cause that backslash, the newline character, and any white space
511 at the start of the next line to be replaced by a single space. Hence
512 the following two Tcl commands are equivalent:</P
513 ><TABLE
514 BORDER="5"
515 BGCOLOR="#E0E0F0"
516 WIDTH="70%"
517 ><TR
518 ><TD
519 ><PRE
520 CLASS="PROGRAMLISTING"
521 >puts  "Hello\nworld\n"
522 puts \
523 "Hello
524 world
525 "</PRE
526 ></TD
527 ></TR
528 ></TABLE
529 ><P
530 >If a <SPAN
531 CLASS="PROPERTY"
532 >description</SPAN
533 > string needs to contain quote marks or other
534 special characters then backslash escapes can be used. In addition to
535 quote and backslash characters, the Tcl interpreter treats square
536 brackets, the <TT
537 CLASS="LITERAL"
538 >$</TT
539 > character, and braces specially.
540 Square brackets are used for command substitution, for example:</P
541 ><TABLE
542 BORDER="5"
543 BGCOLOR="#E0E0F0"
544 WIDTH="70%"
545 ><TR
546 ><TD
547 ><PRE
548 CLASS="SCREEN"
549 >puts "The answer is [expr 6 * 9]"</PRE
550 ></TD
551 ></TR
552 ></TABLE
553 ><P
554 >When the Tcl interpreter encounters the square brackets it will treat
555 the contents as another command that should be executed first, and the
556 result of executing that is used when continuing to process the
557 script. In this case the Tcl interpreter will execute the command
558 <TT
559 CLASS="LITERAL"
560 >expr 6 * 9</TT
561 >, yielding a result of 42
562 <A
563 NAME="AEN1270"
564 HREF="#FTN.AEN1270"
565 >[1]</A
566 >
567 and then the
568 Tcl interpreter will execute <TT
569 CLASS="LITERAL"
570 >puts "The answer is 42"</TT
571 >.
572 It should be noted that the interpreter performs only one level
573 of substitution: if the result of performing command substitution
574 performs further special characters such as square brackets then these
575 will not be treated specially.</P
576 ><P
577 >Command substitution will not prove useful for many <SPAN
578 CLASS="APPLICATION"
579 >CDL</SPAN
580 > scripts,
581 except for e.g. a <SPAN
582 CLASS="PROPERTY"
583 >define_proc</SPAN
584 > property which involves a fragment of
585 <SPAN
586 CLASS="APPLICATION"
587 >Tcl</SPAN
588 > code. Potentially there are some interesting uses, for example
589 to internationalize <SPAN
590 CLASS="PROPERTY"
591 >display</SPAN
592 > strings. However care does have to be
593 taken to avoid unexpected command substitution, for example if an
594 option description involves square brackets then typically these would
595 require backslash-escapes.</P
596 ><P
597 >The <TT
598 CLASS="LITERAL"
599 >$</TT
600 > character is used in Tcl scripts to perform
601 variable substitution:</P
602 ><TABLE
603 BORDER="5"
604 BGCOLOR="#E0E0F0"
605 WIDTH="70%"
606 ><TR
607 ><TD
608 ><PRE
609 CLASS="PROGRAMLISTING"
610 >set x [expr 6 * 9]
611 puts "The answer is $x"</PRE
612 ></TD
613 ></TR
614 ></TABLE
615 ><P
616 >Variable substitution, like command substitution, is unlikely to
617 prove useful for many <SPAN
618 CLASS="APPLICATION"
619 >CDL</SPAN
620 > scripts except in the context of
621 <SPAN
622 CLASS="APPLICATION"
623 >Tcl</SPAN
624 > fragments. If it is necessary to have a <TT
625 CLASS="LITERAL"
626 >$</TT
627 >
628 character then a backslash escape may have to be used.</P
629 ><P
630 >Braces are used to collect a sequence of characters into a single
631 argument, just like quotes. The difference is that variable, command
632 and backslash substitution do not occur inside braces (with the
633 sole exception of backslash substitution at the end of a line).
634 Therefore given a line in a <SPAN
635 CLASS="APPLICATION"
636 >CDL</SPAN
637 > script such as:</P
638 ><TABLE
639 BORDER="5"
640 BGCOLOR="#E0E0F0"
641 WIDTH="70%"
642 ><TR
643 ><TD
644 ><PRE
645 CLASS="PROGRAMLISTING"
646 >default_value {"RAM"}</PRE
647 ></TD
648 ></TR
649 ></TABLE
650 ><P
651 >The braces are stripped off by the <SPAN
652 CLASS="APPLICATION"
653 >Tcl</SPAN
654 > interpreter, leaving
655 <TT
656 CLASS="LITERAL"
657 >"RAM"</TT
658 > which will be handled as a string constant by
659 the expression parsing code. The same effect could be achieved using
660 one of the following:</P
661 ><TABLE
662 BORDER="5"
663 BGCOLOR="#E0E0F0"
664 WIDTH="70%"
665 ><TR
666 ><TD
667 ><PRE
668 CLASS="PROGRAMLISTING"
669 >default_value \"RAM\"
670 default_value "\"RAM\""</PRE
671 ></TD
672 ></TR
673 ></TABLE
674 ><P
675 >Generally the use of braces is less confusing. At this stage it is
676 worth noting that the basic format of <SPAN
677 CLASS="APPLICATION"
678 >CDL</SPAN
679 > data makes use of
680 braces:</P
681 ><TABLE
682 BORDER="5"
683 BGCOLOR="#E0E0F0"
684 WIDTH="70%"
685 ><TR
686 ><TD
687 ><PRE
688 CLASS="PROGRAMLISTING"
689 >cdl_option &lt;name&gt; {
690      &#8230;
691 };</PRE
692 ></TD
693 ></TR
694 ></TABLE
695 ><P
696 >The <TT
697 CLASS="LITERAL"
698 >cdl_option</TT
699 > command is passed two arguments, a name and a body,
700 where the body consists of everything inside the braces but not the
701 braces themselves. This body can then be executed in a recursive
702 invocation of the <SPAN
703 CLASS="APPLICATION"
704 >Tcl</SPAN
705 > interpreter. If a <SPAN
706 CLASS="APPLICATION"
707 >CDL</SPAN
708 > script contains
709 mismatched braces then the interpreter is likely to get rather
710 confused and the resulting diagnostics may be difficult to understand. </P
711 ><P
712 >Comments in Tcl scripts are introduced by a hash character
713 <TT
714 CLASS="LITERAL"
715 >#</TT
716 >. However, a hash character only introduces a
717 comment if it occurs where a command is expected. Consider the
718 following:</P
719 ><TABLE
720 BORDER="5"
721 BGCOLOR="#E0E0F0"
722 WIDTH="70%"
723 ><TR
724 ><TD
725 ><PRE
726 CLASS="PROGRAMLISTING"
727 ># This is a comment
728 puts "Hello" # world</PRE
729 ></TD
730 ></TR
731 ></TABLE
732 ><P
733 >The first line is a valid comment, since the hash character occurs
734 right at the start where a command name is expected. The second line
735 does not contain a comment. Instead it is an attempt to invoke the
736 <TT
737 CLASS="LITERAL"
738 >puts</TT
739 > command with three arguments:
740 <TT
741 CLASS="LITERAL"
742 >Hello</TT
743 >, <TT
744 CLASS="LITERAL"
745 >#</TT
746 > and
747 <TT
748 CLASS="LITERAL"
749 >world</TT
750 >. These are not valid arguments for the
751 <TT
752 CLASS="LITERAL"
753 >puts</TT
754 > command so an error will be raised.
755 If the second line was rewritten as:</P
756 ><TABLE
757 BORDER="5"
758 BGCOLOR="#E0E0F0"
759 WIDTH="70%"
760 ><TR
761 ><TD
762 ><PRE
763 CLASS="PROGRAMLISTING"
764 >puts "Hello"; # world</PRE
765 ></TD
766 ></TR
767 ></TABLE
768 ><P
769 >then this is a valid Tcl script. The semicolon identifies the end of
770 the current command, so the hash character occurs at a point where the
771 next command would start and hence it is interpreted as the start of a
772 comment.</P
773 ><P
774 >This handling of comments can lead to subtle behavior. Consider the
775 following:</P
776 ><TABLE
777 BORDER="5"
778 BGCOLOR="#E0E0F0"
779 WIDTH="70%"
780 ><TR
781 ><TD
782 ><PRE
783 CLASS="PROGRAMLISTING"
784 >cdl_option WHATEVER {
785 # This is a comment }
786     default_value 0
787     &#8230;
788 }</PRE
789 ></TD
790 ></TR
791 ></TABLE
792 ><P
793 >Consider the way the Tcl interpreter processes this. The command name
794 and the first argument do not pose any special difficulties. The
795 opening brace is interpreted as the start of the next argument, which
796 continues until a closing brace is encountered. In this case the
797 closing brace occurs on the second line, so the second argument passed
798 to <TT
799 CLASS="LITERAL"
800 >cdl_option</TT
801 > is
802 <TT
803 CLASS="LITERAL"
804 >\n&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;This&nbsp;is&nbsp;a&nbsp;comment</TT
805 >. This second argument is processed in a recursive
806 invocation of the Tcl interpreter and does not contain any commands,
807 just a comment. Top-level script processing then resumes, and the next
808 command that is encountered is <TT
809 CLASS="LITERAL"
810 >default_value</TT
811 >. Since
812 the parser is not currently processing a configuration option this is
813 an error. Later on the Tcl interpreter would encounter a closing brace
814 by itself, which is also an error.</P
815 ><P
816 >For component writers who need more information about <SPAN
817 CLASS="APPLICATION"
818 >Tcl</SPAN
819 >,
820 especially about the language rather than the syntax, various
821 resources are available. A reasonable starting point is the
822 <A
823 HREF="http://www.tcl.tk/scripting/"
824 TARGET="_top"
825 >Scriptics developer
826 web site</A
827 >.</P
828 ></DIV
829 ><H3
830 CLASS="FOOTNOTES"
831 >Notes</H3
832 ><TABLE
833 BORDER="0"
834 CLASS="FOOTNOTES"
835 WIDTH="100%"
836 ><TR
837 ><TD
838 ALIGN="LEFT"
839 VALIGN="TOP"
840 WIDTH="5%"
841 ><A
842 NAME="FTN.AEN1270"
843 HREF="language.tcl.html#AEN1270"
844 >[1]</A
845 ></TD
846 ><TD
847 ALIGN="LEFT"
848 VALIGN="TOP"
849 WIDTH="95%"
850 ><P
851 >It is possible that some versions of the Tcl interpreter will instead
852 produce a result of 54 when asked to multiply six by nine. Appropriate
853 <A
854 HREF="http://www.douglasadams.com/creations/hhgg.html"
855 TARGET="_top"
856 >reference
857 documentation</A
858 > should be consulted for more information on why
859 42 is in fact the correct answer.</P
860 ></TD
861 ></TR
862 ></TABLE
863 ><DIV
864 CLASS="NAVFOOTER"
865 ><HR
866 ALIGN="LEFT"
867 WIDTH="100%"><TABLE
868 SUMMARY="Footer navigation table"
869 WIDTH="100%"
870 BORDER="0"
871 CELLPADDING="0"
872 CELLSPACING="0"
873 ><TR
874 ><TD
875 WIDTH="33%"
876 ALIGN="left"
877 VALIGN="top"
878 ><A
879 HREF="language.naming.html"
880 ACCESSKEY="P"
881 >Prev</A
882 ></TD
883 ><TD
884 WIDTH="34%"
885 ALIGN="center"
886 VALIGN="top"
887 ><A
888 HREF="cdl-guide.html"
889 ACCESSKEY="H"
890 >Home</A
891 ></TD
892 ><TD
893 WIDTH="33%"
894 ALIGN="right"
895 VALIGN="top"
896 ><A
897 HREF="language.values.html"
898 ACCESSKEY="N"
899 >Next</A
900 ></TD
901 ></TR
902 ><TR
903 ><TD
904 WIDTH="33%"
905 ALIGN="left"
906 VALIGN="top"
907 >Option Naming Convention</TD
908 ><TD
909 WIDTH="34%"
910 ALIGN="center"
911 VALIGN="top"
912 ><A
913 HREF="language.html"
914 ACCESSKEY="U"
915 >Up</A
916 ></TD
917 ><TD
918 WIDTH="33%"
919 ALIGN="right"
920 VALIGN="top"
921 >Values and Expressions</TD
922 ></TR
923 ></TABLE
924 ></DIV
925 ></BODY
926 ></HTML
927 >