* [RFA] Recognize unqualified itcl commands for auto_mkindex
@ 2002-01-10 20:17 Keith Seitz
2002-01-15 10:43 ` Ian Roxborough
0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2002-01-10 20:17 UTC (permalink / raw)
To: Insight Maling List; +Cc: Ian Roxborough
Hi,
This patch "fixes" itcl so that we can use it to generate tclIndexes. The
patch has two parts:
o For every itcl command dealing with autoloading, recognize the command
without the namespace qualifier, i.e., "class" in addition to "itcl_class"
and "itcl::class". We should probably change our sources to NOT import
itcl::*, since this really seems to be a headache for auto_mkindex.
o Fix the "public" auto_mkindex_parser command so that it properly evals
expressions like:
public {
method foo {}
proc bar {}
}
Previously, chunks of code like this were being eval'd to require a
command like:
auto_mkindex_parser::command public\{\n\ \ \ method\ foo\ \{\}\n and so
on.
Silly.
With these changes and one pending change in gdb/gdbtk/library/Makefile,
we should now be able to regenerate a proper tclIndex for ourselves.
Keith
ChangeLog
2002-01-10 Keith Seitz <keiths@redhat.com>
* itcl/library/itcl.tcl: Add recognition for "class", "body",
"ensemble", and "configbody" without the "itc::" namespace
qualifier.
(auto_mkindex_parser::command public): If given an argument
list of just one item, re-eval it again so that the whole
thing is not interpreted as one humongous command.
Patch
Index: itcl/itcl/library/itcl.tcl
===================================================================
RCS file: /cvs/src/src/itcl/itcl/library/itcl.tcl,v
retrieving revision 1.1.1.2
diff -p -r1.1.1.2 itcl.tcl
*** itcl/itcl/library/itcl.tcl 2001/09/09 19:49:04 1.1.1.2
--- itcl/itcl/library/itcl.tcl 2002/01/11 04:11:21
*************** proc ::itcl::local {class name args} {
*** 42,52 ****
# parser in Tcl...
#
#
# USAGE: itcl::class name body
# Adds an entry for the given class declaration.
#
! foreach cmd {itcl::class itcl_class} {
auto_mkindex_parser::command $cmd {name body} {
variable index
variable scriptFile
--- 42,53 ----
# parser in Tcl...
#
+ # RED HAT LOCAL: don't require namespace qualifier
#
# USAGE: itcl::class name body
# Adds an entry for the given class declaration.
#
! foreach cmd {itcl::class itcl_class class} {
auto_mkindex_parser::command $cmd {name body} {
variable index
variable scriptFile
*************** foreach cmd {itcl::class itcl_class} {
*** 61,99 ****
}
}
#
# USAGE: itcl::body name arglist body
# Adds an entry for the given method/proc body.
#
! auto_mkindex_parser::command itcl::body {name arglist body} {
! variable index
! variable scriptFile
! append index "set [list auto_index([fullname $name])]"
! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
}
#
# USAGE: itcl::configbody name arglist body
# Adds an entry for the given method/proc body.
#
! auto_mkindex_parser::command itcl::configbody {name body} {
! variable index
! variable scriptFile
! append index "set [list auto_index([fullname $name])]"
! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
}
#
# USAGE: ensemble name ?body?
# Adds an entry to the auto index list for the given ensemble name.
#
! auto_mkindex_parser::command itcl::ensemble {name {body ""}} {
! variable index
! variable scriptFile
! append index "set [list auto_index([fullname $name])]"
! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
}
#
# USAGE: public arg ?arg arg...?
# protected arg ?arg arg...?
--- 62,111 ----
}
}
+ # RED HAT LOCAL: don't require namespace qualifier
#
# USAGE: itcl::body name arglist body
# Adds an entry for the given method/proc body.
#
! foreach cmd {itcl::body body} {
! auto_mkindex_parser::command $cmd {name arglist body} {
! variable index
! variable scriptFile
! append index "set [list auto_index([fullname $name])]"
! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
! }
}
+ # RED HAT LOCAL: don't require namespace qualifier
#
# USAGE: itcl::configbody name arglist body
# Adds an entry for the given method/proc body.
#
! foreach cmd {itcl::configbody configbody} {
! auto_mkindex_parser::command $cmd {name body} {
! variable index
! variable scriptFile
! append index "set [list auto_index([fullname $name])]"
! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
! }
}
+ # RED HAT LOCAL: don't require namespace qualifier
#
# USAGE: ensemble name ?body?
# Adds an entry to the auto index list for the given ensemble name.
#
! foreach cmd {itcl::ensemble ensemble} {
! auto_mkindex_parser::command $cmd {name {body ""}} {
! variable index
! variable scriptFile
! append index "set [list auto_index([fullname $name])]"
! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
! }
}
+ # RED HAT LOCAL: treat public differently, since we do care about
+ # public procs
#
# USAGE: public arg ?arg arg...?
# protected arg ?arg arg...?
*************** auto_mkindex_parser::command itcl::ensem
*** 102,115 ****
# Evaluates the arguments as commands, so we can recognize proc
# declarations within classes.
#
! foreach cmd {public protected private} {
auto_mkindex_parser::command $cmd {args} {
variable parser
$parser eval $args
}
}
! # CYGNUS LOCAL
# This version of auto_import does not work, because it relies
# WHOLLY on the tclIndex files, but the tclIndex files have no
# notion of what the export list for a namespace is. So at the
--- 114,141 ----
# Evaluates the arguments as commands, so we can recognize proc
# declarations within classes.
#
! foreach cmd {protected private} {
auto_mkindex_parser::command $cmd {args} {
variable parser
$parser eval $args
}
}
+
+ # RED HAT LOCAL: When the user has used "public {...}" (llength $args == 1),
+ # we must eval $args again into its component statements so
+ # that we look at every line in the "body". Otherwise,
+ # we'll be looking for the contents of the "{...}" as a
+ # command, which is funny business.
+ auto_mkindex_parser::command public {args} {
+ variable parser
+ if {[llength $args] == 1} {
+ eval $parser eval $args
+ } else {
+ $parser eval $args
+ }
+ }
! # RED HAT LOCAL
# This version of auto_import does not work, because it relies
# WHOLLY on the tclIndex files, but the tclIndex files have no
# notion of what the export list for a namespace is. So at the
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Recognize unqualified itcl commands for auto_mkindex
2002-01-10 20:17 [RFA] Recognize unqualified itcl commands for auto_mkindex Keith Seitz
@ 2002-01-15 10:43 ` Ian Roxborough
2002-01-15 13:04 ` Keith Seitz
0 siblings, 1 reply; 3+ messages in thread
From: Ian Roxborough @ 2002-01-15 10:43 UTC (permalink / raw)
To: Keith Seitz; +Cc: insight
Approved.
(minor typo in the ChangeLog "itc::" -> "itcl::")
Ian.
On Thu, 10 Jan 2002 20:17:16 -0800 (PST) Keith Seitz <keiths@redhat.com> wrote:
>
> Hi,
>
> This patch "fixes" itcl so that we can use it to generate tclIndexes. The
> patch has two parts:
>
> o For every itcl command dealing with autoloading, recognize the command
> without the namespace qualifier, i.e., "class" in addition to "itcl_class"
> and "itcl::class". We should probably change our sources to NOT import
> itcl::*, since this really seems to be a headache for auto_mkindex.
>
> o Fix the "public" auto_mkindex_parser command so that it properly evals
> expressions like:
>
> public {
> method foo {}
> proc bar {}
> }
>
> Previously, chunks of code like this were being eval'd to require a
> command like:
>
> auto_mkindex_parser::command public\{\n\ \ \ method\ foo\ \{\}\n and so
> on.
>
> Silly.
>
> With these changes and one pending change in gdb/gdbtk/library/Makefile,
> we should now be able to regenerate a proper tclIndex for ourselves.
>
> Keith
>
> ChangeLog
> 2002-01-10 Keith Seitz <keiths@redhat.com>
>
> * itcl/library/itcl.tcl: Add recognition for "class", "body",
> "ensemble", and "configbody" without the "itc::" namespace
> qualifier.
> (auto_mkindex_parser::command public): If given an argument
> list of just one item, re-eval it again so that the whole
> thing is not interpreted as one humongous command.
>
> Patch
> Index: itcl/itcl/library/itcl.tcl
> ===================================================================
> RCS file: /cvs/src/src/itcl/itcl/library/itcl.tcl,v
> retrieving revision 1.1.1.2
> diff -p -r1.1.1.2 itcl.tcl
> *** itcl/itcl/library/itcl.tcl 2001/09/09 19:49:04 1.1.1.2
> --- itcl/itcl/library/itcl.tcl 2002/01/11 04:11:21
> *************** proc ::itcl::local {class name args} {
> *** 42,52 ****
> # parser in Tcl...
> #
>
> #
> # USAGE: itcl::class name body
> # Adds an entry for the given class declaration.
> #
> ! foreach cmd {itcl::class itcl_class} {
> auto_mkindex_parser::command $cmd {name body} {
> variable index
> variable scriptFile
> --- 42,53 ----
> # parser in Tcl...
> #
>
> + # RED HAT LOCAL: don't require namespace qualifier
> #
> # USAGE: itcl::class name body
> # Adds an entry for the given class declaration.
> #
> ! foreach cmd {itcl::class itcl_class class} {
> auto_mkindex_parser::command $cmd {name body} {
> variable index
> variable scriptFile
> *************** foreach cmd {itcl::class itcl_class} {
> *** 61,99 ****
> }
> }
>
> #
> # USAGE: itcl::body name arglist body
> # Adds an entry for the given method/proc body.
> #
> ! auto_mkindex_parser::command itcl::body {name arglist body} {
> ! variable index
> ! variable scriptFile
> ! append index "set [list auto_index([fullname $name])]"
> ! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
> }
>
> #
> # USAGE: itcl::configbody name arglist body
> # Adds an entry for the given method/proc body.
> #
> ! auto_mkindex_parser::command itcl::configbody {name body} {
> ! variable index
> ! variable scriptFile
> ! append index "set [list auto_index([fullname $name])]"
> ! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
> }
>
> #
> # USAGE: ensemble name ?body?
> # Adds an entry to the auto index list for the given ensemble name.
> #
> ! auto_mkindex_parser::command itcl::ensemble {name {body ""}} {
> ! variable index
> ! variable scriptFile
> ! append index "set [list auto_index([fullname $name])]"
> ! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
> }
>
> #
> # USAGE: public arg ?arg arg...?
> # protected arg ?arg arg...?
> --- 62,111 ----
> }
> }
>
> + # RED HAT LOCAL: don't require namespace qualifier
> #
> # USAGE: itcl::body name arglist body
> # Adds an entry for the given method/proc body.
> #
> ! foreach cmd {itcl::body body} {
> ! auto_mkindex_parser::command $cmd {name arglist body} {
> ! variable index
> ! variable scriptFile
> ! append index "set [list auto_index([fullname $name])]"
> ! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
> ! }
> }
>
> + # RED HAT LOCAL: don't require namespace qualifier
> #
> # USAGE: itcl::configbody name arglist body
> # Adds an entry for the given method/proc body.
> #
> ! foreach cmd {itcl::configbody configbody} {
> ! auto_mkindex_parser::command $cmd {name body} {
> ! variable index
> ! variable scriptFile
> ! append index "set [list auto_index([fullname $name])]"
> ! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
> ! }
> }
>
> + # RED HAT LOCAL: don't require namespace qualifier
> #
> # USAGE: ensemble name ?body?
> # Adds an entry to the auto index list for the given ensemble name.
> #
> ! foreach cmd {itcl::ensemble ensemble} {
> ! auto_mkindex_parser::command $cmd {name {body ""}} {
> ! variable index
> ! variable scriptFile
> ! append index "set [list auto_index([fullname $name])]"
> ! append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n"
> ! }
> }
>
> + # RED HAT LOCAL: treat public differently, since we do care about
> + # public procs
> #
> # USAGE: public arg ?arg arg...?
> # protected arg ?arg arg...?
> *************** auto_mkindex_parser::command itcl::ensem
> *** 102,115 ****
> # Evaluates the arguments as commands, so we can recognize proc
> # declarations within classes.
> #
> ! foreach cmd {public protected private} {
> auto_mkindex_parser::command $cmd {args} {
> variable parser
> $parser eval $args
> }
> }
>
> ! # CYGNUS LOCAL
> # This version of auto_import does not work, because it relies
> # WHOLLY on the tclIndex files, but the tclIndex files have no
> # notion of what the export list for a namespace is. So at the
> --- 114,141 ----
> # Evaluates the arguments as commands, so we can recognize proc
> # declarations within classes.
> #
> ! foreach cmd {protected private} {
> auto_mkindex_parser::command $cmd {args} {
> variable parser
> $parser eval $args
> }
> }
> +
> + # RED HAT LOCAL: When the user has used "public {...}" (llength $args == 1),
> + # we must eval $args again into its component statements so
> + # that we look at every line in the "body". Otherwise,
> + # we'll be looking for the contents of the "{...}" as a
> + # command, which is funny business.
> + auto_mkindex_parser::command public {args} {
> + variable parser
> + if {[llength $args] == 1} {
> + eval $parser eval $args
> + } else {
> + $parser eval $args
> + }
> + }
>
> ! # RED HAT LOCAL
> # This version of auto_import does not work, because it relies
> # WHOLLY on the tclIndex files, but the tclIndex files have no
> # notion of what the export list for a namespace is. So at the
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Recognize unqualified itcl commands for auto_mkindex
2002-01-15 10:43 ` Ian Roxborough
@ 2002-01-15 13:04 ` Keith Seitz
0 siblings, 0 replies; 3+ messages in thread
From: Keith Seitz @ 2002-01-15 13:04 UTC (permalink / raw)
To: Ian Roxborough; +Cc: insight
On Tue, 15 Jan 2002, Ian Roxborough wrote:
> Approved.
> (minor typo in the ChangeLog "itc::" -> "itcl::")
ChangeLog fixed and patch committed.
Keith
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-01-15 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-10 20:17 [RFA] Recognize unqualified itcl commands for auto_mkindex Keith Seitz
2002-01-15 10:43 ` Ian Roxborough
2002-01-15 13:04 ` Keith Seitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).