Problems with "unknown" procedure 
Author Message
 Problems with "unknown" procedure

I'm trying to write a program which redefines the "unknown" procdeure. But I'm
having a bit of a problem...

...When I try the following in a script:-

proc unknown {args} {
   puts "UNKNOWN($args)"

Quote:
}

...and source run the script from a windows console, I get the following
results:-

% rubbish
UNKNOWN(history add {rubbish

Quote:
})

UNKNOWN(rubbish)
% puts hello
UNKNOWN(history add {puts hello
Quote:
}):-

hello

...How do I get rid of the "history add" stuff?

Many Thanks,
   =Adrian=



Mon, 14 Nov 2005 19:37:45 GMT  
 Problems with "unknown" procedure

Quote:

> I'm trying to write a program which redefines the "unknown" procdeure. But I'm
> having a bit of a problem...

> ...When I try the following in a script:-

> proc unknown {args} {
>    puts "UNKNOWN($args)"
> }

> ...and source run the script from a windows console, I get the following
> results:-

> % rubbish
> UNKNOWN(history add {rubbish
> })
> UNKNOWN(rubbish)
> % puts hello
> UNKNOWN(history add {puts hello
> }):-
> hello

> ...How do I get rid of the "history add" stuff?

Thats part of the interactive console that uses unknown to load some
procs..., so to get rid of it either load history before by invoking it
sooner or don't use the interactive console...

Michael



Mon, 14 Nov 2005 19:44:43 GMT  
 Problems with "unknown" procedure
Hi Adrian,

Quote:

> I'm trying to write a program which redefines the "unknown"
> procdeure. But I'm having a bit of a problem...
> [...]
> I get the following results:-

> % rubbish
> UNKNOWN(history add {rubbish
> })
> UNKNOWN(rubbish)
> % puts hello
> UNKNOWN(history add {puts hello
> }):-
> hello

> ...How do I get rid of the "history add" stuff?

By delegating everything that you don't care about to the original
[unknown].  [unknown] is used for auto-loading and other stuff, so you
shouldn't just replace it, but subclass it.  Try something like

  if {"" != [info commands original_unknown]} {
      rename unknown original_unknown
  }
  proc unknown {cmd args} {
      puts "UNKNOWN $cmd $args"
      # do something depending on cmd
      uplevel 1 original_unknown [list $cmd] $args
  }

Hope this helps, benny



Tue, 15 Nov 2005 00:55:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. PTUI problem, "lifo::lifo": unknown namespace

2. Problem with "String trim" within procedure

3. Help with an "unknown" APL2 symbol

4. Unknown Variable "%AppTemplateFamily"

5. ERROR "Corrupt Block/Unknown Block Freed"

6. ANYONE ELSE GETTING "UNKNOWN" NEWS POSTINGS

7. CP shows "Unknown Image Format"

8. +define+unknown="'bx" chokes verilog

9. "Unknown Command: -quiet" in mingw

10. "unknown" command usage

11. "unknown" command usage

12. unknown option "-class" error

 

 
Powered by phpBB® Forum Software