Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
2984dad8
Commit
2984dad8
authored
Jun 18, 2014
by
wtschueller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tcl: support switch command
--HG-- extra : rebase_source : f516669986006db5aca6af6417f323e57fa848d1
parent
9d24b488
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
778 additions
and
1 deletion
+778
-1
tclscanner.l
src/tclscanner.l
+182
-1
060__command__switch_8tcl.xml
testing/060/060__command__switch_8tcl.xml
+358
-0
060_command_switch.tcl
testing/060_command_switch.tcl
+238
-0
No files found.
src/tclscanner.l
View file @
2984dad8
...
@@ -1836,6 +1836,181 @@ D
...
@@ -1836,6 +1836,181 @@ D
myScan->ns, myScan->entry_cl, myScan->entry_fn);
myScan->ns, myScan->entry_cl, myScan->entry_fn);
}
}
//! Handle internal tcl commands.
// switch ?options? string pattern body ?pattern body ...?
// switch ?options? string {pattern body ?pattern body ...?}
static void tcl_command_SWITCH()
{
D
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_scan *myScan=NULL;
unsigned int i;
QCString token;
// first: find the last option token
unsigned int lastOptionIndex = 0;
for (i = 2; i<tcl.list_commandwords.count(); i += 2)
{
token = (*tcl.list_commandwords.at(i)).utf8();
if (token == "--")
{
lastOptionIndex = i;
break;
}
if (token[0] == '-' && i - lastOptionIndex == 2)
{
// options start with dash and should form a continuous chain
lastOptionIndex = i;
}
}
// second: eat up options
for (i = 2; i <= lastOptionIndex; i++)
{
myScan = tcl_command_ARG(myScan, i, false);
}
// third: how many tokens are left?
if (tcl.list_commandwords.count() - lastOptionIndex == 5)
{
//printf("syntax: switch ?options? string {pattern body ?pattern body ...?}\n");
myScan = tcl_command_ARG(myScan, lastOptionIndex + 1, false);
myScan = tcl_command_ARG(myScan, lastOptionIndex + 2, false);
myScan = tcl_command_ARG(myScan, lastOptionIndex + 3, false);
// walk trough the list step by step
// this way we can preserve whitespace
bool inBraces = false;
bool nextIsPattern = true;
int size;
const char *elem;
const char *next;
token = (*tcl.list_commandwords.at(lastOptionIndex + 4)).utf8();
if (token[0] == '{')
{
inBraces = true;
token = token.mid(1, token.length() - 2);
if (myScan!=NULL)
{
myScan->after << "NULL" << QCString("{");
}
else
{
tcl_codify(NULL,QCString("{"));
}
}
// ToDo: check if multibyte chars are handled correctly
while (token.length() > 0)
{
TclFindElement((const char*)token, token.length(), &elem, &next, &size, NULL);
//printf("%s\nstart=%d, elem=%d, next=%d, size=%d, brace=%d\n",
// (const char*) token, (const char*) token, elem, next, size, brace);
//
// handle leading whitespace/opening brace/double quotes
if (elem - token > 0)
{
if (myScan != NULL)
{
myScan->after << "NULL" << token.left(elem - token);
}
else
{
tcl_codify(NULL, token.left(elem - token));
}
}
// handle actual element without braces/double quotes
if (nextIsPattern)
{
if (myScan != NULL)
{
myScan->after << "NULL" << token.mid(elem - token,size);
}
else
{
tcl_codify(NULL,token.mid(elem - token, size));
}
//printf("pattern=%s\n",(const char*) token.mid(elem - token, size));
}
else {
if (myScan != NULL)
{
myScan->after << "script" << token.mid(elem - token, size);
}
else
{
myScan = tcl.scan.at(0);
myScan = tcl_scan_start('?', token.mid(elem - token, size),
myScan->ns, myScan->entry_cl, myScan->entry_fn);
}
//printf("script =%s\n", (const char*) token.mid(elem - token, size));
}
// handle trailing whitespace/closing brace/double quotes
if (next - elem - size > 0)
{
if (myScan != NULL)
{
myScan->after << "NULL" << token.mid(elem - token + size, next - elem - size);
}
else
{
tcl_codify(NULL, token.mid(elem - token + size, next - elem - size));
}
}
nextIsPattern = !nextIsPattern;
token = token.mid(next - token);
}
if (inBraces)
{
if (myScan != NULL)
{
myScan->after << "NULL" << QCString("}");
}
else
{
tcl_codify(NULL, QCString("}"));
}
}
if (!nextIsPattern)
{
tcl_war("Invalid switch syntax: last token is not a list of even elements.\n");
//tcl_war("%s\n", tcl.list_commandwords.join(" ").ascii());
}
}
else if ((tcl.list_commandwords.count() - lastOptionIndex > 6) &&
((tcl.list_commandwords.count() - lastOptionIndex-3) % 4 == 0))
{
//printf("detected: switch ?options? string pattern body ?pattern body ...?\n");
myScan = tcl_command_ARG(myScan, lastOptionIndex + 1, false);
myScan = tcl_command_ARG(myScan, lastOptionIndex + 2, false);
//printf("value=%s\n",(const char*) (*tcl.list_commandwords.at(lastOptionIndex + 2)).utf8());
for (i = lastOptionIndex + 3; i < tcl.list_commandwords.count(); i += 4)
{
myScan = tcl_command_ARG(myScan, i + 0, false); // whitespace
myScan = tcl_command_ARG(myScan, i + 1, false); // pattern
myScan = tcl_command_ARG(myScan, i + 2, false); // whitespace
if (myScan != NULL) // script
{
myScan->after << "script" << tcl.list_commandwords[i+3];
}
else
{
myScan = tcl.scan.at(0);
myScan = tcl_scan_start('?', *tcl.list_commandwords.at(i+3),
myScan->ns, myScan->entry_cl, myScan->entry_fn);
}
//printf("pattern=%s\n",(const char*) (*tcl.list_commandwords.at(i+1)).utf8());
//printf("script=%s\n",(const char*) (*tcl.list_commandwords.at(i+3)).utf8());
}
}
else
{
// not properly detected syntax
tcl_war("Invalid switch syntax: %d options followed by %d tokens.\n",
lastOptionIndex / 2, (tcl.list_commandwords.count() - 1) / 2 - lastOptionIndex / 2);
for (i = lastOptionIndex + 1; i <= tcl.list_commandwords.count(); i++)
{
myScan = tcl_command_ARG(myScan, i, false);
}
}
}
//! Handle internal tcl commands.
//! Handle internal tcl commands.
// "catch script ?resultVarName? ?optionsVarName?"
// "catch script ?resultVarName? ?optionsVarName?"
static void tcl_command_CATCH()
static void tcl_command_CATCH()
...
@@ -2494,8 +2669,14 @@ tcl_inf("->\n");
...
@@ -2494,8 +2669,14 @@ tcl_inf("->\n");
}
}
/*
/*
* Start of internal tcl keywords
* Start of internal tcl keywords
* Ready: eval, catch, if, for, foreach, while
* Ready:
switch,
eval, catch, if, for, foreach, while
*/
*/
if (myStr=="switch")
{
if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;}
tcl_command_SWITCH();
goto command_end;
}
if (myStr=="eval")
if (myStr=="eval")
{
{
if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
...
...
testing/060/060__command__switch_8tcl.xml
0 → 100644
View file @
2984dad8
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<doxygen
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"compound.xsd"
version=
""
>
<compounddef
id=
"060__command__switch_8tcl"
kind=
"file"
>
<compoundname>
060_command_switch.tcl
</compoundname>
<sectiondef
kind=
"func"
>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
Invoked
</definition>
<argsstring>
args
</argsstring>
<name>
Invoked
</name>
<briefdescription>
<para>
should be reference by every proc below
</para>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"10"
bodyend=
"13"
/>
<referencedby
refid=
"060__command__switch_8tcl_1ab08ae027fc5777bc4f0629f1b60b35db"
compoundref=
"060__command__switch_8tcl"
startline=
"22"
endline=
"25"
>
a
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a68bdb74c144118d936931c46f75d4b3e"
compoundref=
"060__command__switch_8tcl"
startline=
"29"
endline=
"36"
>
b
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1ab14f56bc3bd7680490ece4ad7815465f"
compoundref=
"060__command__switch_8tcl"
startline=
"37"
endline=
"43"
>
c
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1af43f4b1f0064a33b2d662af9f06d3a00"
compoundref=
"060__command__switch_8tcl"
startline=
"44"
endline=
"50"
>
d
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1aff65a51a703804e0ad1adbcfd76c86f8"
compoundref=
"060__command__switch_8tcl"
startline=
"51"
endline=
"57"
>
e
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1af6830d2c644b45088ea8f1f74a46b778"
compoundref=
"060__command__switch_8tcl"
startline=
"58"
endline=
"65"
>
f
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1af08b4b5bfa9edf0b0a7dee1c2b2c29e0"
compoundref=
"060__command__switch_8tcl"
startline=
"66"
endline=
"73"
>
g
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1af96fd0966e32a310a0778d2e5c357700"
compoundref=
"060__command__switch_8tcl"
startline=
"74"
endline=
"81"
>
h
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a8c90afd4641b25be86bd09983c3cbee0"
compoundref=
"060__command__switch_8tcl"
startline=
"83"
endline=
"94"
>
i
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a2aaa92757686acea102cba3475f0c13b"
compoundref=
"060__command__switch_8tcl"
startline=
"95"
endline=
"106"
>
j
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a20363f854eb4098a446733d63d34dbc1"
compoundref=
"060__command__switch_8tcl"
startline=
"107"
endline=
"118"
>
k
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1aff56f84b49947b84b2a304f51cf8e678"
compoundref=
"060__command__switch_8tcl"
startline=
"119"
endline=
"129"
>
l
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a78d127e8bda64d4471ac811ad512fbd9"
compoundref=
"060__command__switch_8tcl"
startline=
"130"
endline=
"141"
>
m
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1acdde3cd86eb2421ce8dbb2e85227d368"
compoundref=
"060__command__switch_8tcl"
startline=
"142"
endline=
"153"
>
n
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a495e7a4ede0831107e9d435080a7c268"
compoundref=
"060__command__switch_8tcl"
startline=
"154"
endline=
"165"
>
o
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a15229b450f26d8fa1c10bea4f3279f4d"
compoundref=
"060__command__switch_8tcl"
startline=
"166"
endline=
"175"
>
p
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1ab678a0a9a7e94bce5b17141f40220d88"
compoundref=
"060__command__switch_8tcl"
startline=
"176"
endline=
"185"
>
q
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a0a0bd3dc69dd06934c4e6362155e0ace"
compoundref=
"060__command__switch_8tcl"
startline=
"186"
endline=
"195"
>
r
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a011c73f2dbb87635a3b4206c72355f6e"
compoundref=
"060__command__switch_8tcl"
startline=
"196"
endline=
"205"
>
s
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a429306927a4581ad93fac620e605eec5"
compoundref=
"060__command__switch_8tcl"
startline=
"207"
endline=
"210"
>
x
</referencedby>
<referencedby
refid=
"060__command__switch_8tcl_1a32b6e5206a2cc75dbb8ed2eff74f5ce4"
compoundref=
"060__command__switch_8tcl"
startline=
"215"
endline=
"229"
>
y
</referencedby>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a3f55465410c57ed00ab28827a741b1c3"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
NotInvoked
</definition>
<argsstring>
args
</argsstring>
<name>
NotInvoked
</name>
<briefdescription>
<para>
must not be reference by every proc below
</para>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"16"
bodyend=
"19"
/>
<referencedby
refid=
"060__command__switch_8tcl_1a32b6e5206a2cc75dbb8ed2eff74f5ce4"
compoundref=
"060__command__switch_8tcl"
startline=
"215"
endline=
"229"
>
y
</referencedby>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1ab08ae027fc5777bc4f0629f1b60b35db"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
a
</definition>
<argsstring>
args
</argsstring>
<name>
a
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"22"
bodyend=
"25"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a68bdb74c144118d936931c46f75d4b3e"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
b
</definition>
<argsstring>
args
</argsstring>
<name>
b
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"29"
bodyend=
"36"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1ab14f56bc3bd7680490ece4ad7815465f"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
c
</definition>
<argsstring>
args
</argsstring>
<name>
c
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"37"
bodyend=
"43"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1af43f4b1f0064a33b2d662af9f06d3a00"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
d
</definition>
<argsstring>
args
</argsstring>
<name>
d
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"44"
bodyend=
"50"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1aff65a51a703804e0ad1adbcfd76c86f8"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
e
</definition>
<argsstring>
args
</argsstring>
<name>
e
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"51"
bodyend=
"57"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1af6830d2c644b45088ea8f1f74a46b778"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
f
</definition>
<argsstring>
args
</argsstring>
<name>
f
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"58"
bodyend=
"65"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1af08b4b5bfa9edf0b0a7dee1c2b2c29e0"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
g
</definition>
<argsstring>
args
</argsstring>
<name>
g
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"66"
bodyend=
"73"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1af96fd0966e32a310a0778d2e5c357700"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
h
</definition>
<argsstring>
args
</argsstring>
<name>
h
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"74"
bodyend=
"81"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a8c90afd4641b25be86bd09983c3cbee0"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
i
</definition>
<argsstring>
args
</argsstring>
<name>
i
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"83"
bodyend=
"94"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a2aaa92757686acea102cba3475f0c13b"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
j
</definition>
<argsstring>
args
</argsstring>
<name>
j
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"95"
bodyend=
"106"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a20363f854eb4098a446733d63d34dbc1"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
k
</definition>
<argsstring>
args
</argsstring>
<name>
k
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"107"
bodyend=
"118"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1aff56f84b49947b84b2a304f51cf8e678"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
l
</definition>
<argsstring>
args
</argsstring>
<name>
l
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"119"
bodyend=
"129"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a78d127e8bda64d4471ac811ad512fbd9"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
m
</definition>
<argsstring>
args
</argsstring>
<name>
m
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"130"
bodyend=
"141"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1acdde3cd86eb2421ce8dbb2e85227d368"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
n
</definition>
<argsstring>
args
</argsstring>
<name>
n
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"142"
bodyend=
"153"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a495e7a4ede0831107e9d435080a7c268"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
o
</definition>
<argsstring>
args
</argsstring>
<name>
o
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"154"
bodyend=
"165"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a15229b450f26d8fa1c10bea4f3279f4d"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
p
</definition>
<argsstring>
args
</argsstring>
<name>
p
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"166"
bodyend=
"175"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1ab678a0a9a7e94bce5b17141f40220d88"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
q
</definition>
<argsstring>
args
</argsstring>
<name>
q
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"176"
bodyend=
"185"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a0a0bd3dc69dd06934c4e6362155e0ace"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
r
</definition>
<argsstring>
args
</argsstring>
<name>
r
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"186"
bodyend=
"195"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a011c73f2dbb87635a3b4206c72355f6e"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
s
</definition>
<argsstring>
args
</argsstring>
<name>
s
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"196"
bodyend=
"205"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a429306927a4581ad93fac620e605eec5"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
x
</definition>
<argsstring>
args
</argsstring>
<name>
x
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"207"
bodyend=
"210"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
</memberdef>
<memberdef
kind=
"function"
id=
"060__command__switch_8tcl_1a32b6e5206a2cc75dbb8ed2eff74f5ce4"
prot=
"public"
static=
"no"
const=
"no"
explicit=
"no"
inline=
"no"
virt=
"non-virtual"
>
<type/>
<definition>
y
</definition>
<argsstring>
args
</argsstring>
<name>
y
</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location
file=
"060_command_switch.tcl"
bodystart=
"215"
bodyend=
"229"
/>
<references
refid=
"060__command__switch_8tcl_1aa889853547f65a22ae133cd57ff89601"
compoundref=
"060__command__switch_8tcl"
startline=
"10"
endline=
"13"
>
Invoked
</references>
<references
refid=
"060__command__switch_8tcl_1a3f55465410c57ed00ab28827a741b1c3"
compoundref=
"060__command__switch_8tcl"
startline=
"16"
endline=
"19"
>
NotInvoked
</references>
</memberdef>
</sectiondef>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<location
file=
"060_command_switch.tcl"
/>
</compounddef>
</doxygen>
testing/060_command_switch.tcl
0 → 100644
View file @
2984dad8
#// objective: tests processing of switch, only references/referencedby relations are relevant
#// check: 060__command__switch_8tcl.xml
#// config: REFERENCED_BY_RELATION = yes
#// config: REFERENCES_RELATION = yes
#// config: EXTRACT_ALL = yes
#// config: INLINE_SOURCES = no
##
# \brief should be reference by every proc below
proc
Invoked args
{
puts
"Procedure
\"
Invoked
\"
is invoked indeed. Ok."
return
$args
}
##
# \brief must not be reference by every proc below
proc
NotInvoked args
{
puts
"Procedure
\"
NotInvoked
\"
is invoked. Not Ok!"
return
$args
}
#
# check if call references work at all
proc
a args
{
Invoked NotInvoked
return
}
#
# switch command
# switch ?options? string pattern body ?pattern body ...?
proc
b args
{
switch value NotInvoked
{
}
NotInvoked
{
}
default
{
Invoked
}
return
}
proc
c args
{
switch value NotInvoked
{
}
[
Invoked
]
{
}
default
{
}
return
}
proc
d args
{
switch NotInvoked pattern
{
}
[
Invoked
]
{
}
default
{
}
return
}
proc
e args
{
switch
[
Invoked
]
pattern
{
}
NotInvoked
{
}
default
{
}
return
}
proc
f args
{
switch -exact value pattern
{
}
NotInvoked
{
}
default
{
Invoked
}
return
}
proc
g args
{
switch -exact -- value pattern
{
}
NotInvoked
{
}
default
{
Invoked
}
return
}
proc
h args
{
switch -exact -- -value pattern
{
}
NotInvoked
{
}
default
{
Invoked
}
return
}
# switch ?options? string {pattern body ?pattern body ...?
}
proc i args
{
switch value
{
NotInvoked
{
}
NotInvoked
{
}
default
{
Invoked
}
}
return
}
proc
j args
{
switch vale
{
NotInvoked
{
}
[
NotInvoked
]
{
}
default
{
Invoked
}
}
return
}
proc
k args
{
switch NotInvoked
{
[
NotInvoked
]
{
}
NotInvoked
{
Invoked
}
default
{
}
}
return
}
proc
l args
{
switch
[
Invoked
]
{
pattern
{
}
NotInvoked
{
}
default
{
}
}
return
}
proc
m args
{
switch -exact value
{
pattern
{
}
NotInvoked
{
}
default
{
Invoked
}
}
return
}
proc
n args
{
switch -exact -- value
{
pattern
{
}
NotInvoked
{
}
default
{
Invoked
}
}
return
}
proc
o args
{
switch -exact -- -value
{
pattern
{
}
NotInvoked
{
}
default
{
Invoked
}
}
return
}
proc
p args
{
switch -exact -- inquotes
{
"inquotes"
{
Invoked
}
default
{
}
}
return
}
proc
q args
{
switch -exact --
"in quotes"
{
"in quotes"
{
Invoked
}
default
{
}
}
return
}
proc
r args
{
switch -exact -- inbraces
{
{
inbraces
}
{
Invoked
}
default
{
}
}
return
}
proc
s args
{
switch -exact --
{
in braces
}
{
{
in braces
}
{
Invoked
}
default
{
}
}
return
}
# wrong syntax
proc
x args
{
catch
{
switch
-exact --
[
Invoked
]
pattern1 NotInvoked pattern2
}
return
}
# The current version does not check the last argument beforehand.
# Therefore, all script elements are evaluated as scripts before
# the parser detects the dangling pattern. It throws a warning, at the very least.
# Anyway, for working code the documentation will be correct.
proc
y args
{
catch
{
switch
-exact --
[
Invoked
]
{
pattern
{
NotInvoked
}
NotInvoked
{
NotInvoked
}
default
{
NotInvoked
}
pattern
}}
return
}
#
# call all single letter procs
# let tcl check what is called and what is not called
foreach
p
[
info
procs ?
]
{
puts
"Check procedure
\"
$p
\"
"
$p
}
exit
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment