This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Tip of the day - section

Help for those learning Tcl or writing their own scripts.
Post Reply
a
ap
Halfop
Posts: 44
Joined: Fri Jun 09, 2006 12:20 am

Tip of the day - section

Post by ap »

Hi,

I was reading Tip of the day - section in the forum and i have few questions.
what's the purpose to have proc eventloop, proc pp, proc pv, proc pn, proc indent -> http://forum.egghelp.org/viewtopic.php? ... c&start=45

and also proc wordwrap. I mean how to use them?

I'll appreciate of someone will explain with few small examples please?


thanks
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

The eventloop procedure allows you to execute tcl commands with immediate full error reporting. For example:
// This is an invalid command executed before eventloop
% set bla [string len]
wrong # args: should be "string length string"

// This is an invalid command executed after eventloop
%eventloop
Type "exit" to exit the event loop
% set bla [string len]
wrong # args: should be "string length string"
while executing
"string len"
As for proc pp, proc pv, proc pn and proc indent:
user wrote:pp - print proc
pv - print variable
pn - print namespace (with procs, variables and proper indentation)
indent - apply indentation based on open/close braces
You can test them, for example:
% proc bla {a b c} {
set a [expr {$b+$c}]
}
% pp bla
proc bla {a b c} {
set a [expr {$b+$c}]
}
a
ap
Halfop
Posts: 44
Joined: Fri Jun 09, 2006 12:20 am

Post by ap »

Sir_Fz, thank you so much, now i got it.
Post Reply