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

Weblog Page

Filtered by date 2017-01-02, 801 - 810 of 1541 Postings (all, summary)

Re: [Xotcl] Segmentation fault

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

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Fri, 24 Sep 2004 17:03:58 +0300 (EEST)

On Fri, 24 Sep 2004, Kristoffer Lawson wrote:

>
> Now I'm also getting it even without the debug output, after having some data
> pass back and forth:
>
> called Tcl_FindHashEntry on deleted table
> Aborted
>
> Perhaps it's related to some other issue that was brought up here? Turning
> into a bit of a showstopper so at the very least I need some kind of
> workaround.

OK, this particular problem was thankfully solved by getting the 1.3.2
that Uwe posted to me earlier in relation to the namespace issue
(http://wi.wu-wien.ac.at/~uzdun/resources/xotcl-1.3.2.tar.gz), but the
segmentation fault still occurs when I have debugging output turned on.

I could send the application itself, if absolutely necessary, with the
assumption it is used for debugging only and then destroyed. Still, would
be better if this could be avoided.

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

[Xotcl] little spreadsheet in NX

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

From: Gustaf Neumann <neumann_at_wu.ac.at>
Date: Thu, 19 May 2011 20:36:09 +0200

Dear Community,

Here is a little spreadsheet program in NX. Maybe, someone has a usage
for it.
best regards -gustaf




===============================================================================
# A small Spreadsheet implementation, originally developed by Richard
# Suchenwirth in plain Tcl (see http://wiki.tcl.tk/1287). The
# spreadsheet was rewritten in an object oriented manner as a design
# study in NX by Gustaf Neumann in May 2011.
#
package require nx
package require Tk

##############################################################################
# Class TkUtils
#
# A small support class to ease syntactically the reference to
# instance variables and the registration of callbacks.
##############################################################################
nx::Class create TkUtils {

   :protected method bindvar {name} {
     :require namespace
     return [nx::self]::$name
   }
   :protected method callback {name args} {
     return [list [nx::self] $name {*}$args]
   }
}

##############################################################################
# Class SpreadSheet
#
# The SpreadSheet computes simply totals for rows and columns.
##############################################################################
nx::Class create SpreadSheet {
   #
   # The following attributes can be used for configuring the
   # spreadsheet.
   #
   :attribute {rows:integer 3}
   :attribute {cols:integer 2}
   :attribute {width:integer 8}

   #
   # If no widget is provided, use the name of the object as widget
   # name.
   #
   :attribute {widget ".[namespace tail [self]]"}

   #
   # Use the methods of TkUtils in this class.
   #
   :mixin TkUtils

   #
   # The method "cell" hides the internal respresentation and sets a
   # cell to a value.
   #
   :method cell {pair value} {
     set :data($pair) $value
   }

   #
   # The constructor builds the SpreadSheet matrix via multiple text
   # entry fields.
   #
   :method init {} {
     set :last ${:rows},${:cols} ;# keep grand total field
     trace var [:bindvar data] w [:callback redo]
     frame ${:widget}
     for {set y 0} {$y<= ${:rows}} {incr y} {
       set row [list]
       for {set x 0} {$x<= ${:cols}} {incr x} {
        set e [entry ${:widget}.$y,$x -width ${:width} \
                   -textvar [:bindvar data($y,$x)] -just right]
        if {$x==${:cols} || $y==${:rows}} {
          $e config -state disabled -background grey -relief flat
        }
        lappend row $e
       }
       grid {*}$row -sticky news
     }
     $e config -relief solid
   }

   #
   # The method "redo" is triggered via the updates in the cells
   #
   :public method redo {varname el op} {
     if {$el ne ${:last}} {
       lassign [split $el ,] y x
       if {$x ne ""} {
        :sum $y,* $y,${:cols}
        :sum *,$x ${:rows},$x
       } ;# otherwise 'el' was not a cell index
     } ;# prevent endless recalculation of grand total
   }

   #
   # The method "sum" adds the values matched by pattern (typically a
   # row or column) and sets finally the target column with the total
   #
   :method sum {pat target} {
     set sum 0
     set total "" ;# default if no addition succeeds
     foreach {i value} [array get :data $pat] {
       if {$i != $target} {
        if {[string is double -strict $value]} {
          set total [set sum [expr {$sum + $value}]]
        }
       }
     }
     :cell $target $total
   }
}

# Build spreadsheet x
SpreadSheet create x {
   # populate with some values
   :cell 0,0 Spread1
   :cell 1,0 47
   :cell 2,1 11
}

# Build spreadsheet y
SpreadSheet create y -rows 4 -cols 4 {
   :cell 0,0 Spread2
   :cell 1,0 12
   :cell 2,2 22
}

# pack the widgets
pack [x widget] [y widget] -fill both

===================================================================

RE: [Xotcl] Weird behaviour

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

From: Murr, Florian <florian.murr_at_siemens.com>
Date: Thu, 5 Jan 2006 16:30:40 +0100

Thanks a lot!
While trying to understand your suggestions, I further simplified my own
code and found the problem.

It was all my fault!

 In the slave interpreter 'Celsius2Kelvin' is an unknown proc and
therefor a room-object with this name gets created and I got confused. -
I definitly have to get some rest soon :-)

Sorry for having bothered you and thanks for your suggestions!
- Florian

-----Original Message-----
From: Gustaf Neumann [mailto:neumann_at_wu-wien.ac.at]
Sent: Thursday, January 05, 2006 3:13 PM
To: Murr, Florian
Cc: xotcl_at_alice.wu-wien.ac.at
Subject: Re: [Xotcl] Weird behaviour

i am somewhat confused be the code (why are you creating and deleting
interpreters?)
is the following code doing, what you are trying? (aggregates rooms on
floors with a simple syntax)

-gustaf
===================================================
package require XOTcl
namespace import -force ::xotcl::*

namespace eval tih {
  Class Floor \
      -instproc has cmds {eval $cmds}
 
  Class Room -superclass Class \
      -parameter {{count 0} currTemp} \
      -instproc new args {
    set name "[self callingobject]::[namespace tail [self]]-[my incr
count]"
    eval [self] create $name $args
      }

  Room room -parameter {{currTemp 300}}
  Room guestRoom -superclass room
  Room bathRoom -superclass room
  Room guestBathRoom -superclass bathRoom

  proc Celsius2Kelvin {a} { expr {$a+273.15} }

  Floor floor3 -has {
    guestRoom new
    guestBathRoom new -currTemp [Celsius2Kelvin 30]
  }

  puts "rooms on floor 3: [floor3 info children]"
  foreach c [floor3 info children] {
    puts "temperature in room $c is [$c currTemp]"
  }
 
}
exit
 

XOTcl/NX mailing list by object move?

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: Mon, 20 Mar 2006 13:46:58 +0100

Koen Danckaert schrieb:

> Gustaf Neumann wrote:
>
>>>
>>> proc myproc {args} {linsert $args 0 [uplevel 1 self]}
>>> proc myvar {var} {return [uplevel 1 self]::$var}
>>
>>
>> as kristoffer noted (and as in my earlier version shows)
>> it makes sense to add a requireNamespace to myvar.
>
>
> I usually put the requireNamespace in the "init" method (when it's
> needed).

Same with me ...

> But I agree that the overhead of putting it in myvar would be negligible.

the point is to make things more robust to beginners...

> I used myproc because the name "method" isn't used anywhere in XOTcl.

well we have at least "info methods";
i am trying to use the following terminology:
we have object specific methods
  - proc
  - forward
  - cmd
and class defined methods
  - instproc
  - instforward
  - instcmd (e.g "create" of Class, or "destroy" of Object).
when we call one of these, we have method invocations.
If we do not distinguish between these variants, "method" seems
the right term. "mymethod" is a little bit longer and not so crisp
as "myproc".

I have added "::xotcl::mymethod" and "::xotcl::myvar" to my
development version. i guess, you would you prefer to have
these exported. Opinions?

-gustaf neumann

[Xotcl] info parameters, parameters for all superclasses?

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, 2 Dec 2006 22:28:42 +0200

I noticed [info parameters] only returns the parameters for the
direct class object on which it is called. This actually makes sense
and is probably the expected behaviour. I just wonder if it might be
useful to have something in there to request all parameters belonging
to a certain object, from all its classes and superclasses?

Doable in script, of course, but might be handy for serialisation?

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

[Xotcl] build problem on solaris

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

From: Aamer Akhter <aakhter_at_gmail.com>
Date: Tue, 27 Jul 2004 12:42:06 -0400

Folks,

I'm having a a makefile problem on solaris (the linux build went fine)

gcc -pipe -shared -o libxotcl1.2.so so/xotcl.o so/xotclError.o
so/xotclMetaData.o so/xotclObjectData.o so/xotclProfile.o
so/xotclTrace.o so/xotclUtil.o so/xotclShadow.o so/xotclCompile.o
so/aolstub.o so/xotclStubInit.o
-L/auto/nsite-mmpls/users/aakhter/ats4.0/lib -ltclstub8.4
: libxotcl1.2.so
/bin/bash: -c: line 1: syntax error near unexpected token `;'
/bin/bash: -c: line 1: `if test ! "x" = "x" ; then for dir in ; do
if (cd $dir; make binaries) ; then true ; else exit 1 ; fi ; done;
fi;'

which is (with make -d):

   Finished prerequisites of target file `binaries'.
  Must remake target `binaries'.
Putting child 0x00068080 (binaries) PID 17840 on the chain.
Live child 0x00068080 (binaries) PID 17840
/bin/bash: -c: line 1: syntax error near unexpected token `;'
/bin/bash: -c: line 1: `if test ! "x" = "x" ; then for dir in ; do
if (cd $dir; make binaries) ; then true ; else exit 1 ; fi ; done;
fi;'

makefile:

binaries: $(BINARIES) $(XOTCLSH) $(XOWISH) pkgIndex.tcl
        _at_if test ! "x$(subdirs)" = "x" ; then \
        for dir in $(subdirs) ; do \
           if (cd $$dir; $(MAKE) $_at_) ; then true ; else exit 1 ; fi ; \
        done; fi;


has anybody run into this problem already?

-- 
Aamer Akhter / aakhter_at_gmail.com

[Xotcl] NX object copy bug?

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

From: Victor Mayevski <vitick_at_gmail.com>
Date: Wed, 15 Dec 2010 16:26:08 -0800

Hello Gustaf,

When an object contains a setter, and if you do a copy of that object,
the variable gets copied but the setter method is not copied.

Object create o;
o setter s;
o s value;
o s;# returns "value"
o copy o1;
o1 s; # error: unable to dispatch method 's'

When I use "attribute" instead of "setter", it works fine.

Re: [Xotcl] Issue with mixin delete

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: Mon, 8 May 2006 13:42:55 -0600

Gustaf Neumann <neumann_at_wu-wien.ac.at> wrote on 05/06/2006 05:10:24 PM:

> Scott Gargash schrieb:
> >
> > Hello,
> >
> > I've run into an issue when trying to remove a mixin from an object.
> > It appears that removing a mixin from an object interacts with the
> > method chaining, such that the "next" isn't invoked.
> >
> scott,
>
> in your example, you are trying to delete the currently active mixin
> from the mixin list (xotcl needs it
> currently to continue from that point in the mixin chain), and then you
> are deleting the object anyhow.
> Most probably, we should rise an error in such cases.
>
> what is your intention, what lead you to this construction?

In my particular case, I'm manipulating a graph. Some nodes have mixins that are used to notify
other connected nodes. When a node (with this particular mixin) is destroyed, it notifies connected
nodes that it's being disconnected. Another mixin class later in the chain intercepts the destroy
call and moves the node back to a pool (the nodes manipulate a fixed pool of hardware resources, so
they need to be tracked and reused). Since "move" reinvokes the destructor, if I don't remove the
notification mixin from the object, connected nodes are doubly notified (bad), but when I remove the
mixin, I don't get the correct chaining behavior and resource reclamation.

BTW, this will happen with any method, not just "destroy". Is it not considered acceptable to ever
remove a mixin class? When is it valid to remove a mixin if removing it corrupts the method
chaining?

      Scott

[Xotcl] Checking to see if a class is defined

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

From: Adam Turoff <adam.turoff_at_gmail.com>
Date: Fri, 25 Jun 2004 09:50:44 -0400

I'm creating a test suite for an XOTcl class I'm writing, and I want to
test this sequence:

(1) MyClass is undefined (initial state)
--- package require MyClass succeeds
(2) MyClass is defined (expected state after loading the package)
(3) MyClass isa ::xotcl::Class
(4) MyClass has methods x, y, z

However, I am not having any luck in testing #1 and #2. Is there any
kind of introspection that can help me determine if a class is defined?
Using [info exists MyClass] doesn't seem to work.

Thanks,

-- Adam

[Xotcl] Tcl and XOTcl für Windows

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

From: Margit de Toma <m.detoma_at_fgg.at>
Date: Thu, 22 Mar 2001 20:08:43 +0100

Hallo Liste!

Kann mir jemand erklären, wie ich mir die Entwicklungsumgebung auf einem
Windows-Rechner einrichte, welche Versionen und Files ich brauche usw.
Ich habe mir tcl832.zip und xotcl-0-84-bin-win32.zip geholt, da entpackt er
dann zwar wie wild, aber es gibt keine install- oder setup-Files und ich
weiß eigentlich nicht, was ich damit anfangen soll. Da ich aber kaum Zeit
habe, mich ins Labor zu setzen, wäre eine Entwicklungsumgebung am Rechner zu
Hause bzw. im Büro sehr wichtig!

LG

Margit de Toma

Next Page