View · Search · Index
No registered users in community xowiki
in last 10 minutes

Weblog Page

Showing 331 - 340 of 1561 Postings (summary)

Re: [Xotcl] Problem with automatic variable unsetting upon return from an instproc?

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Jim Russell <Jim.Russell_at_dynetics.com>
Date: Wed, 19 Nov 2003 09:53:35 -0600

Uwe:

   Thank you so much for the very lucid explanation. I was hoping that
I could use the trace mechanism to implement a garbage collection
scheme. I was storing the XOTcl object name in an ordinary Tcl variable
upon which I placed the unset trace. When the variable goes out of
scope, the unset callback is called, and I had hoped to dereference the
variable to call the XOTcl object's destroy method. However, this
doesn't appear to be a good approach. Do you have any suggestions?

Jim

Uwe Zdun wrote:
> Jim,
>
> at first glance, the behavior seems ok to me. You're setting 2 traces to the
> local scope variable "f" which get unset in reverse order -> so
> the two "f" outputs should be ok.
>
> The rhs traces "2" and "3" are for the two inner invocations. For the outer
> invocations, the callframe is deleted before the Trace is executed. The
> problem here is that Tcl does not print the error that occurs.
>
> Consider the following plain Tcl example:
>
> proc tracecb { name1 name2 op } {
> if {[catch {
> upvar $name1 var
> puts "tracecb \"$name1\" \"$name2\" \"$op\" \"$var\""
> } err]} {
> puts $err
> }
> }
> proc x {a} {
> ::trace add variable a [list unset] ::tracecb
> if {$a == 0} {return}
> incr a -1
> x $a
> }
>
> x 4
>
> This prints:
> tracecb "a" "" "unset" "0"
> tracecb "a" "" "unset" "1"
> tracecb "a" "" "unset" "2"
> tracecb "a" "" "unset" "3"
> can't read "var": no such variable
>
> so you cannot rely on the "upvar" in the trace to a local scope variable.
>
> You can try to refer to an XOTcl variable (an instance variable)
> with "[self] trace ..." instead.
>
> Uwe
>
>

Re: [Xotcl] Request for XOTcl proc and var type ahead in tkcon

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Wed, 06 Apr 2005 14:12:07 +0200

Hi John and Jeff,

Just now i made a quick attempt to handle all kind of methods in
tkcon.tcl (i started with
the newest version from the cvs repository http://tkcon.sourceforge.net/).
The code tgries to be least invasive, there are almost certainly more
elegant
ways to handle this, however, it seems to work pretty well with procs,
instprocs
(as well with instprocs from mixins). See the following script, where i
have added the
lines with the <TAB> keys.

=======
(scripts) 4 % package require XOTcl
1.3.6
(scripts) 5 % namespace import ::xotcl::*
(scripts) 6 % Class create M -instproc foo {} {puts hi}
::M
(scripts) 7 % Object o
::o
(scripts) 8 % o set<TAB>
self set
(scripts) 8 % o set x 1
1
(scripts) 9 % o mixin M
foo forward
(scripts) 10 % o fo<TAB>
=======

just replace ::tkcon::ExpandProcname with the proc below.

Jeff, I am not too happy about the way expandOrder is evaluated,
but this might be a misleading impression of a new user. frequently,
the expansion of pathnames overrules the proc expansion. how about
doing the pathname expansion (optionally) when the path starts with
one of "./~"?

all the best
-gustaf

=====================================================
proc ::tkcon::ExpandProcname str {
  # in a first step, get the cmd to check, if we should handle subcommands
  set cmd [::tkcon::CmdGet $::tkcon::PRIV(console)]
  # if there are two cmds, and xotcl is loaded, do the xotcl magic
  if {[llength $cmd]==2 &&
      [EvalAttached [list info exists ::xotcl::version]]} {
    set o [lindex $cmd 0]
    set sub [lindex $cmd 1]
    set match [EvalAttached [list $o info methods $sub*]]
  } else {
    # standard behavior
    set match [EvalAttached [list info commands $str*]]
    if {[llength $match] == 0} {
      set ns [EvalAttached \
          "namespace children \[namespace current\] [list $str*]"]
      if {[llength $ns]==1} {
    set match [EvalAttached [list info commands ${ns}::*]]
      } else {
    set match $ns
      }
    }
  }
  if {[llength $match] > 1} {
    regsub -all {([^\\]) } [ExpandBestMatch $match $str] {\1\\ } str
    set match [linsert $match 0 $str]
  } else {
    regsub -all {([^\\]) } $match {\1\\ } match
  }
  return $match
}
=====================================================

[Xotcl] XOTcl 1.3.9 available

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Fri, 09 Dec 2005 22:57:22 +0100

Dear XOTcl community,

I am pleased to annouce the availability of XOTcl 1.3.9.
Major changes relative to 1.3.8 are:

     * Improved Functionality
       + new subcommand for self: [self args] return the full argument list
          of the current call
       + "<obj> info vars" does not trigger read traces on each variable
anymore
       + Serializer: exportMethods accepts forwards/instforwards now
           as well
       + new switch -nocomplain for "mixin|instmixin|filter|instfilter
delete"
            to avoid error messages when deleting entries not there
(similar unset)
       + require automatically a namespace when a childobject is added
       + new command ::xotcl::__qualify: convert an relative name
           into an command name (exactly as create does it, ignoring
           namespaces from transparent interceptors)

     * Improved code quality:
       + fixing version numbers for package require
       + Upgraded TEA to 3.4
       + updated rpm build (many thanks to Ildiko Schmidt and Alexander
Bergolth)
       + fixed bug with error propagation when getter/setter methods are
           used for parameters (many thanks to Manfred Stelzhammer for
           pointing this out)

 For more details about the changes, please consult the ChangeLog and
 documentation.

MORE INFO
  General and more detailed information about XOTcl and its components
  can be found at http://www.xotcl.org


Best regards,

Gustaf Neumann
Uwe Zdun

Re: [Xotcl] Linking object instance variables to a widget -textvariable?

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Catherine Letondal <letondal_at_pasteur.fr>
Date: Sat, 15 Nov 2003 10:23:51 +0100

Uwe Zdun wrote:
> Hi Ken,
>
> perhaps others use other styles, but a simple way to bind variables,commands,
       
> or other callbacks from TK into XOTcl is replacement of "self" (or "my") from
       
> within a XOTcl method. Example:
>
> Class BrowserTree
> BrowserTree instproc init args {
> ...
> set tree [Tree $sw.tree \
> -relief flat -borderwidth 0 -width 15 -highlightthickness
> 0\
> -redraw 0 -dropenabled 1 -dragenabled 1 \
> -dragevent 3 \
> -droptypes {
> TREE_NODE {copy {} move {} link {}}
> LISTBOX_ITEM {copy {} move {} link {}}
> } \
> -opencmd "[self] modifyTree 1 $sw.tree" \
> -closecmd "[self] modifyTree 0 $sw.tree"]
> ...
> $tree bindText <ButtonPress-1> "[self] selectTreeElement $tree"
> $tree bindText <Double-ButtonPress-1> "[self] openTreeElement $tree"
> ...
> }
>
> note that you cannot use curly brackets {} here, because then self would
> not be replaced within the object's scope and would likely have a wrong value
> or raise an exception.
>
> this style of binding works nicely together with XOTcl's inheritance and
> mixins
>

This work perfectly for commands, and I use it all the time, but it does not
work for variables.
In fact, I believe Tk always expect a Tcl global variable and an XOtcl
object instance variable is not a global variable, right?

So the issue is maybe : how to bind an Xotcl object instance variable
to a Tcl global variable?

Catherine

Re: [Xotcl] proper way to access xotcl classes

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Matthew Smith <chedderslam_at_gmail.com>
Date: Thu, 8 May 2008 11:02:48 -0500

I copy and pasted what you posted, and still get the error:
invalid command name "s1"

On Thu, May 8, 2008 at 10:59 AM, Gustaf Neumann <neumann_at_wu-wien.ac.at>
wrote:

> Matthew Smith schrieb:
>
>>
>>
>> Putting in:
>> s1 push a
>> results in an error, however I can do:
>>
>> what is the error? this indicates that you have not defined the method
>> push correctly
>>
>> I get:
>> invalid command name "s1"
>>
> this indicates, that you have not created an object s1. Your program
> should look like the following.....
>
> hope this helps
> -gustaf neumann
>
> ===========================================
> package require XOTcl; namespace import ::xotcl::*
>
> Class Stack
> Stack instproc init {} {
> my instvar things
> set things ""
> }
> Stack instproc push {thing} {
> my instvar things
> set things [concat [list $thing] $things]
> return $thing
> }
> Stack instproc pop {} {
> my instvar things
> set top [lindex $things 0]
> set things [lrange $things 1 end]
> return $top
> }
>
> set s1 [Stack new]
>
> s1 push a
> s1 push b
>
> set x [s1 pop]
> puts "The popped value is $x"
> ===========================================
>
>

[Xotcl] xotcl 1.3.7 problem

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Koen Danckaert <koen_at_retarget.com>
Date: Thu, 29 Sep 2005 18:55:47 +0200

Hello,

There seems to be a problem with instvar alias names in xotcl 1.3.7

Consider the following code:

Class C -parameter {number name}
C instproc test {} {
    my instvar {number x} name
    puts "$name $x"
}
C c -name koen -number 25
c test

This fails with
can't read "name": no such variable

It works when the aliased variables are put last in the instvar command:
my instvar name {number x}


Regards,
Koen Danckaert

Re: [Xotcl] Re: Bug: configure step chooses wrong tclsh [REASONING]

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Sun, 11 Apr 2004 00:20:22 +0200

On Saturday 10 April 2004 22:54, Jeff Hobbs wrote:
> Actually the sampleextension-0.2 is years old, and I should remove
> the entire www.tcl.tk/doc/tea/ area, since I haven't had time to
> correct the old docs. Most major extension all use TEA2 now (some
> use TEA3 in fact, which is relatively recent). SC_PROG_TCLSH is NOT
> the way to go. Note that the core does not use TEA (Tcl Extension
> Architecture) because it is not an extension.

 ok.

 i looked into http://sourceforge.net/projects/incrtcl, which contains itcl3.2.1,
 which uses still the SC_* macros (i got there by clicking on project
 "incrtcl" on http://www.tcl.tk/software/tcltk/netcvs.html).

 i have checked out the version from there, it uses TEA_* macros.
 jeff, is this TEA2 or TEA3? i got as well tcl.m4 from cvs tcl/tclconfig,
 which appears to be more recent. in both files, i find not hint whether
 this is based on TEA2 or TEA3.

 Where is TEA3 documented? Is there a better documentation than
 the comments of the macros?

 -gustaf neumann

 
 
-- 
Univ.Prof. Dr.Gustaf Neumann
Abteilung für Wirtschaftsinformatik
WU-Wien, Augasse 2-6, 1090 Wien

[Xotcl] Suggestion needed

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Victor Mayevski <vitick_at_gmail.com>
Date: Mon, 19 Jan 2015 13:11:21 -0800

Using NX, over some period of time, I have find myself customizing
nx::Object (adding my own methods to it) in order to adapt NX to my
personal needs. It works and is a nice way to extend NX globally but I
would rather not pollute the nx:: namespace. Can there be a better way of
doing it, like, for example "nx copy nxcustom" and then using
nxcustom::Object and nxcustom::Class? I have tried making a copy of the
nx.tcl source file and renaming the "nx" namespace in it. That does work
nicely but might not be the best way of doing it. Any suggestions?

Thanks

Re: [Xotcl] compilation problem

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Bernd Eidenschink <eidenschink_at_web.de>
Date: Thu, 20 Jul 2006 11:36:16 +0200

Gustaf,

> to be sure, i just built xotcl 1.4.0 against 8.4.13, and it worked
> without a glitch.

thanks for making the effort!
I started now with the switches from the oacs wiki docs you pointed me to:

./configure --enable-threads --prefix=/usr/local/ns \
 --exec-prefix=/usr/local/ns --with-tcl=/tmp/tcl8.4.13/unix

and it shows that "--with-tcl=" arg did the trick on my machine. The TCL
config files are identical (diffed), nevertheless. If I can find some more
time, I'll try to track exactly whats going on, for now, it compiled as
expected in the first run.

Thanks!
Bernd.

Re: [Xotcl] NX: crash report

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Thu, 14 Apr 2011 10:25:01 +0200

This is fixed in the git repository... -gustaf

On 14.04.11 01:52, Victor Mayevski wrote:
> The following (incorrect) usage will cause a crash:
>
> *****
> % o attribute {a v}
> ::o::a
> % o::a #Incorrect usage
> Segmentation fault
> *****
>
> The next one, however, does not crash:
>
> *****
> % Object create o
> ::o
> % o attribute {a v}
> ::o::a
> % o a # Correct usage first
> v
> % o::a # Incorrect usage
> can't read "o::a": no such variable
> while executing
> "o::a"
> %
> *****

Next Page