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

Weblog Page

Showing 261 - 270 of 1561 Postings (summary)

Re: [Xotcl] Device chaining from Objects/Classes defined in C

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

From: Scott Gargash <scottg_at_atc.creative.com>
Date: Sat, 23 Sep 2006 13:01:57 -0700

xotcl-bounces_at_alice.wu-wien.ac.at wrote on 09/15/2006 12:28:50 PM:

> I have some classes that are defined in C using the xotcl (cersion
> 1.4) C API. Things seem to work (I can create objects and invoke
> methods), but I can't get chaining to function. I can invoke the
> "next" command (using Tcl_Eval( interp, "xotcl::next")), but that
> fails with "next: can't find self"

Just a followup for anybody searching the mailing list archives.

XOTcl requires the Tcl stack to contain information about the executing
object in order to resolve the net method. By default, and prior to
1.5.1, C methods do not annotate the Tcl stack with the approriate
information to allow method chaining to work.

As of 1.5.1, C methods can be registered with an additional flag,
XOTCL_NONLEAF_METHOD. When a method with this flag is invoked the Tcl
stack will include the information needed to allow "next" to function
properly.

In addition to the new flag, 1.5.1 exports a couple of additional C
functions to improve the performance of the XOTcl at the C-interface.

XOTclNextObjCmd() - invoke "xotcl::next" at the C-level without an
additional interpreter evaluation
XOTclCallMethodWithArgs() - invoke a method without an additional
interpreter evaluation

[Xotcl] Asserts off/on

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

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Sat, 15 Jul 2006 15:06:25 +0300

Responded to Uwe instead of the list. Here:

Begin forwarded message:

> From: Kristoffer Lawson <setok_at_fishpool.com>
> Date: 11 July 2006 19:30:51 GMT+03:00
> To: Uwe Zdun <zdun_at_infosys.tuwien.ac.at>
> Subject: Re: [Xotcl] Asserts off/on
>
>
> On 11 Jul 2006, at 19:24, Uwe Zdun wrote:
>
>> The method "check" can be used to turn off assertions. The example
>> from the tutorial:
>
> That is per-object. I am wondering if there is anything that would
> be for everything.
>
> / http://www.fishpool.com/~setok/
>

            / http://www.fishpool.com/~setok/

[Xotcl] [forwarded] Re: XOTcl, threading and AOLserver ?

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

From: Gustaf Neumann <Gustaf.Neumann_at_wu-wien.ac.at>
Date: Thu, 16 Nov 2000 18:53:53 +0100 (CET)


Hi Zoran,

>>>>> "ZV" == Zoran Vasiljevic <zoran_at_munich.com> writes:
ZV> Question 1: do you plan to make (XOTcl) MT-safe ?

ZV> Since Tcl8.2, Tcl core is MT-safe, and so should be
ZV> the extensions. I can help you out with this, if needed.
ZV> I've noticed couple of globals/statics which may have to be
ZV> either moved to thread-specific-data or mutex-protected.

a brief answer is: yes, but not directly, ... we still have some other
issues on our todo-list, but I guess we should get that working
ASAP. So if you like to volunteer to help out, you're invited :)

ZV> Question 2: <read on>

ZV> Having nice introspection capabilities built into the
ZV> XOTcl, I wonder if one can write a Tcl script which
ZV> runs against the initialized interpreter and builds up
ZV> a script needed to re-construct all classes and/or object
ZV> which it finds there (in the interpreter)?

ZV> Why should one need this ?

if I understand it correctly, that is merely the same we internally
use in order to copy an object (or class). Hopefully, you can merely
re-use the code from predefined.xotcl in the src dir used to copy/move
objects (Object instproc copy). You just would have to build a script
instead of copying, right?

In general any XOTcl feature should be accesible via introspection. If
you run into problems, this might be a missing language feature...

btw, we also require the obj/class code introspection in order to
build a script that is shipped around in the mobile code system


--Uwe

-- 
Uwe Zdun
Specification of Software Systems, University of Essen
Phone: +49 201 81 00 332, Fax: +49 201 81 00 398
zdun_at_xotcl.org, uwe.zdun_at_uni-essen.de

[Xotcl] Namespaces and Xotcl

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

From: Shishir Ramam <sramam_at_gmail.com>
Date: Sat, 28 Oct 2006 18:54:04 -0700

Hi,
Was wondering why it's not possible to import namespaces when XOTcl objects
are involved.
The shortest example that I could rustle up is included below.
Help in understanding what prevents this from working is much appreciated.
-shishir


% package require XOTcl
1.4.0

% namespace eval ::my::test {
  namespace import ::xotcl::*

  Class Foo

  Foo instproc bar {} {
    puts " foo bar is a very tasty!"
  }
}

% ::my::test::Foo foo
::foo
% foo bar
 foo bar is a very tasty!

% ::my::test::Foo info instances
::foo

% # Why doesn't the following work?
% namespace import ::my::test::*

% Foo foo2
invalid command name "Foo"

% ::my::test::Foo info instances
::foo

% Foo info instances
invalid command name "Foo"

[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: Ken Jones <ken_at_redsummit.net>
Date: Fri, 14 Nov 2003 15:04:34 -0800

Hi. I've just starting tinkering around with XOTcl the past few days, trying to add it to my repertoire of Tcl OO extensions. It's definitely quite an interesting contrast to others like [incr Tcl] or Snit. While I won't be abandoning either of those, XOTcl is currently my leading candidate for a project I'm likely to be working on through the rest of the year, in large part because of its mixin support.

But one issue I couldn't figure out from my reading of the documentation or examples is whether it's possible to use an object's instance variable as a widget's -textvariable or -listvariable. For example, [incr Tcl] supports the [itcl::scope] command, so I can do something like this:

package require Itcl

::itcl::class Toggle {
    private variable _state "normal"
    
    constructor {} {
        checkbutton .cb -text Enable \
            -variable [::itcl::scope _state] \
            -onvalue "normal" -offvalue "disabled" \
            -command [::itcl::code $this toggle]
        .cb select ;# The checkbutton is initially on
        
        # ...
    }
    
    private method toggle {} {
        # ...
    }
}

Is there a similar feature for XOTcl?

Thanks,

- Ken Jones

Re: [Xotcl] full trace support for XOTcl methods/procs

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

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Wed, 2 Jan 2008 21:42:56 +0200

On 2 Jan 2008, at 21:26, Eckhard Lehmann wrote:

> Kristoffer Lawson schrieb:
>>>
>>> I see that there is no need for another interception technique,
>>> but it would be really helpful to have the current filter
>>> techiques also applied to ordinary Tcl code inside methods.
>>
>> Why not just use the Tcl [trace] command for the normal Tcl commands?
> How would you do that, together with filters? enterstep/leavestep
> work only in Tcl proc's, while filters work only on objects. How
> could this be mixed - as methods are composed of calls to objects
> (e.g. [my], [self]) as well as ordinary Tcl code?
> As long as it is separated, fine. But for Tcl statements in object
> methods it seems more difficult to me.

You could just wrap it in a package that sets a Tcl [trace] for
normal commands combined with filters for the XOTcl stuff, just
checking to see if the command names match, if necessary. Or maybe
I've missed something here and I'm thinking to simple :-)

            / http://www.scred.com/
            / http://www.fishpool.com/~setok/

Re: [Xotcl] info method behaviour

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

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Mon, 13 Aug 2001 14:54:26 +0300 (EEST)

On Sun, 12 Aug 2001, Artur Trzewik wrote:

>
> I know this problem. The possible solution is to use procsearch function if
> you know the name of method

Yes, you're solution should work (actually I thought you might have
something because of XOTclIDE's need for that), but it's still a bit
of tweaking. XOTcl should still probably provide a uniform way
to ask information like that.

         - ---------- = = ---------//--+
         | / Kristoffer Lawson | www.fishpool.fi|.com
         +-> | setok_at_fishpool.com | - - --+------
             |-- Fishpool Creations Ltd - / |
             +-------- = - - - = --------- /~setok/

[Xotcl] XOTcl 1.6.7 available for Debian (unstable)

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

From: Stefan Sobernig <stefan.sobernig_at_wu.ac.at>
Date: Mon, 02 Jan 2012 17:31:37 +0100

XOTcl 1.6.7 is now available for Debian:

http://packages.qa.debian.org/x/xotcl.html

//stefan

[Xotcl] Catching errors in calls to "next"

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

From: <MichaelL_at_frogware.com>
Date: Mon, 15 Nov 2004 12:41:25 -0500

I'm using XOTcl 1.3.1. (I haven't upgraded to the 1.3.3 beta yet.)

I have a filter that does work before and after calls to "next". I'd like
to make sure that the "after" code always gets called, so I'm using
"catch" around my call to "next," a bit like this:

        # do something before

        set err [catch {next} result]

        # do something after

The problem is that in specific circumstances (when objects are
constructed) the fact that "next" is called within "catch" is screwing
things up. (The error I'm getting is "5", which is defined in XOTcl as
"XOTCL_UNKNOWN".)

I can see why "catch" would get in the way, but so far I haven't found a
way around the problem. Does anyone have any ideas?

Here's some sample code. TestA works (as expected), but TestB doesn't.

    Object instproc someFilterA {args} {
        puts "self class = [self class]"
        puts "self = [self]"
        puts "self calledclass = [self calledclass]"
        puts "self calledproc = [self calledproc]"
        puts "args = $args"
        puts ""

        set err 0
        set result [next]

        if {$err==0 || $err==2 || $err==3 || $err==4} {
            # 0 = OK
            # 2 = Return
            # 3 = Break
            # 4 = Continue
            return $result
        } else {
            # 1 = Error
            # * = Error (user-defined)
            return -code error $result
        }

    }

    Object instproc someFilterB {args} {
        puts "self class = [self class]"
        puts "self = [self]"
        puts "self calledclass = [self calledclass]"
        puts "self calledproc = [self calledproc]"
        puts "args = $args"
        puts ""

        set err [catch {next} result]

        if {$err==0 || $err==2 || $err==3 || $err==4} {
            # 0 = OK
            # 2 = Return
            # 3 = Break
            # 4 = Continue
            return $result
        } else {
            # 1 = Error
            # * = Error (user-defined)
            return -code error $result
        }

    }

    puts "*** Initializing..."
    puts ""

    Class TestA -parameter {{x 0}} -filter someFilterA

    TestA instproc err {} {
        expr {5/0}
    }

    Class TestB -parameter {{x 0}} -filter someFilterB

    TestB instproc err {} {
        expr {5/0}
    }

    puts "*** Starting..."
    puts ""

    TestA ::a -x 5
    a x
    a x 10
    #a err

    puts ""
    puts "----------"
    puts ""

    TestB ::b -x 5
    b x
    b x 10
    #b err

    puts "*** Finished."

The relevant part of the output is:

*** Starting...

self class = ::xotcl::Object
self = ::TestA
self calledclass =
self calledproc = ::a
args = -x 5

self class = ::xotcl::Object
self = ::TestA
self calledclass = ::xotcl::Class
self calledproc = unknown
args = ::a -x 5

self class = ::xotcl::Object
self = ::TestA
self calledclass = ::xotcl::Class
self calledproc = create
args = ::a -x 5

self class = ::xotcl::Object
self = ::TestA
self calledclass = ::xotcl::Class
self calledproc = alloc
args = ::a -x 5

----------

self class = ::xotcl::Object
self = ::TestB
self calledclass =
self calledproc = ::b
args = -x 5


    ::TestB ::xotcl::Object->someFilterB
    invoked from within
"TestB ::b -x 5"
    invoked from within
"if 1 {
    Object instproc someFilterA {args} {
        puts "self class = [self class]"
        puts "self = [self]"
        puts "..."
    (file "XOTcl-test.tcl" line 7)
self class = ::xotcl::Object
self = ::TestA
self calledclass = ::xotcl::Class
self calledproc = instdestroy
args = ::a

self class = ::xotcl::Object
self = ::TestA
self calledclass = ::xotcl::Object
self calledproc = destroy
args =

self class = ::xotcl::Object
self = ::TestB
self calledclass = ::xotcl::Object
self calledproc = destroy
args =

[Xotcl] renaming a instproc

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

From: Kevin Van Workum <vanw_at_sabalcore.com>
Date: Mon, 16 Aug 2010 09:36:03 -0400

How do I rename a Class instproc? For example:

Class T -parameter { {msg "Hello world!"} }
T instproc hi {} {
    puts [my msg]
}
T instparametercmd msg

T t
t hi

t msg "Good Bye!"
t rename hi bye
t bye


Also, what's the difference between using "instparametercmd" and
"parametercmd" in the example above?

Thanks,

Kevin

-- 
Kevin Van Workum, PhD
Sabalcore Computing Inc.
Run your code on 500 processors.
Sign up for a free trial account.
www.sabalcore.com
877-492-8027 ext. 11

Next Page