Re: [AOLSERVER] metakit with aolserver

2002-04-01 Thread Jean-Claude Wippler

Jeff Rogers [EMAIL PROTECTED] wrote:

After some experimentation I figured out part of the problem, only to find
a different one.
[...]
Once I changed my library path back to the default and picked up
namespace.tcl (which only deals with procedures, not commands, so there may
be yet another issue in there) I got a new error:

view index is out of range
while executing
set n [namespace current]
(in namespace eval ::mk script line 2)

To make things more interesting, this error is not specific to aolserver;
its reproducable with plain old tclsh:
Starting program: /usr/bin/tclsh
% load bin/Mk4tcl.so
% namespace eval ::mk {set n [namespace current]}
view index is out of range
% set ::mk::n
can't read ::mk::n: no such variable
% set ::mk::n 0
0
%
Program received signal SIGSEGV, Segmentation fault.
0x4027bbe6 in c4_Sequence::DecRef () from bin/Mk4tcl.so
(gdb) where
#0  0x4027bbe6 in c4_Sequence::DecRef () from bin/Mk4tcl.so
[...]

The segfault is bad of course, but there may be multiple issues here.

Note that MK defines a mk::set command.  So please change from:
namespace eval ::mk {set n [namespace current]}
to:
namespace eval ::mk {::set n [namespace current]}
As I assume that is what you intended?

I still have a bunch more experimentation to do (not least of which is
recompiling everything to make sure everything's in sync, as I'm using the
prebuilt Mk4tcl.so), but this is some food for thought.

FWIW, MetaKit 2.4.4 was released yesterday.

Thanks for the traceback - I'll look into what is going wrong there.

-jcw



Re: [AOLSERVER] metakit with aolserver

2002-04-01 Thread Dossy

On 2002.04.01, Jean-Claude Wippler [EMAIL PROTECTED] wrote:

 FWIW, MetaKit 2.4.4 was released yesterday.

Cool!

Jean-Claude, as a user of your most excellent TclKit for
the AOLserver wiki (which is, of course, WiKit-based), I
wanted to just jot out a little public thank you so much
for sharing all your great stuff with us.

If only I could find some way to give back ...

-- Dossy

--
Dossy Shiobara   mail: [EMAIL PROTECTED]
Panoptic Computer Network web: http://www.panoptic.com/
  He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on. (p. 70)



Re: [AOLSERVER] metakit with aolserver

2002-04-01 Thread Jeff Rogers

On Mon, 1 Apr 2002 22:35:41 +0200, Jean-Claude Wippler [EMAIL PROTECTED] wrote:

The segfault is bad of course, but there may be multiple issues here.

Note that MK defines a mk::set command.  So please change from:
namespace eval ::mk {set n [namespace current]}
to:
namespace eval ::mk {::set n [namespace current]}
As I assume that is what you intended?

Yep, that certainly makes the error make sense.  Qualifying the set command
fixes that problem.

But AOLServer still doesn't like namespaces.  In particular, commands (not
procedures) defined in a namespace.  They seem to get lost and I haven't yet
found a way to get to them through 'namespace import' or anything like that.

So I tried an alternate approach, again using renaming:  this time, I
changed the mk4tcl code to create commands named __mk__file and so forth,
then from a startup file create tcl procedures ::mk::file et al.  Since they
are procedures, they get recreated in the namespace.  However, attempting to
use them gets back an error Initialization error in dispatcher.  I think
whats going on here is that mk4tcl creates a bunch of c++ objects on
initialization and registers an exit procedure to clean those up when the
tcl interpreter is destroyed; however AOLserver creates an interpreter for
startup and then destroys it and creates more when necessary, so mk4tcl is
left with references to destroyed objects.  If this is correct, then either
mk4tcl (or the hypothetical aolserver version, ns_metakit) would need to
call the initialization procedure for each new interpreter (or otherwise
when necessary) or not register the exit procedure.

The namespace thing still bugs me tho.

-J



Re: [AOLSERVER] metakit with aolserver

2002-04-01 Thread Wojciech Kocjan

Maybe for now you should try the following code:

proc req_mk4tcl {} {
 if {[lsearch [info loaded] *mk4tcl.so*]0} {
 load /usr/local/aolserver/lib/mk4tcl.so
 }
}

And then you can load 'plain' Tcl extensions. Just put req_mk4tcl before
any of your code that uses metakit.

This is a little awful, but will get you started in 5 minutes.

You may then add this command to nsd version of mk4tcl, which you are
trying to build. You could just move the Tcl_Create*Command() to the
req_mk4tcl (written in C this time), so that it creates commands when
neccessary. You will have to use Tcl_SetAllocData() to store whether you
already created commands/initialized other data for this interpreter.

A little messy, but should work. I for now use libtbcload.so in the way
described above - that is I wrote tbcload::bceval which renames itself
and loads libtbcload.so and calls tbcload::bceval again :) Messy, but
works fine...

--
WK

Jeff Rogers wrote:
 On Mon, 1 Apr 2002 22:35:41 +0200, Jean-Claude Wippler [EMAIL PROTECTED] wrote:


The segfault is bad of course, but there may be multiple issues here.

Note that MK defines a mk::set command.  So please change from:
   namespace eval ::mk {set n [namespace current]}
to:
   namespace eval ::mk {::set n [namespace current]}
As I assume that is what you intended?


 Yep, that certainly makes the error make sense.  Qualifying the set command
 fixes that problem.

 But AOLServer still doesn't like namespaces.  In particular, commands (not
 procedures) defined in a namespace.  They seem to get lost and I haven't yet
 found a way to get to them through 'namespace import' or anything like that.

 So I tried an alternate approach, again using renaming:  this time, I
 changed the mk4tcl code to create commands named __mk__file and so forth,
 then from a startup file create tcl procedures ::mk::file et al.  Since they
 are procedures, they get recreated in the namespace.  However, attempting to
 use them gets back an error Initialization error in dispatcher.  I think
 whats going on here is that mk4tcl creates a bunch of c++ objects on
 initialization and registers an exit procedure to clean those up when the
 tcl interpreter is destroyed; however AOLserver creates an interpreter for
 startup and then destroys it and creates more when necessary, so mk4tcl is
 left with references to destroyed objects.  If this is correct, then either
 mk4tcl (or the hypothetical aolserver version, ns_metakit) would need to
 call the initialization procedure for each new interpreter (or otherwise
 when necessary) or not register the exit procedure.

 The namespace thing still bugs me tho.

 -J






--
WK

UTF-8 has a certain purity in that it equally annoys every nation,
and is nobody's default encoding. -- Andy Robinson