Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: tcl commands supported by jacl

25 views
Skip to first unread message
Message has been deleted

suchenwi

unread,
Sep 1, 2008, 4:04:47 AM9/1/08
to
On 1 Sep., 07:56, Praveen <praveengupta....@gmail.com> wrote:
> As we know jacl is a 100% implementation of tcl . i want to know about
> tcltest package which is a part of tcl basically . Is tcltest package
> supported by jacl also to write the tests in the same manner as we
> write in TCL?

Tcltest consists mostly of pure Tcl scripts (some parts are C code to
be compiled, which I'd skip for Jacl). I'd just try the test suite,
see what does not work, and exclude those tests that have a justified
reason for not working under Jacl.

davidn...@gmail.com

unread,
Sep 1, 2008, 4:57:43 AM9/1/08
to
On Sep 1, 7:56 am, Praveen <praveengupta....@gmail.com> wrote:
> As we know jacl is a 100% implementation of tcl . i want to know about
> tcltest package which is a part of tcl basically . Is tcltest package
> supported by jacl also to write the tests in the same manner as we
> write in TCL?

If you download the code from CVS, you'll find the following file:

tcltest.tcl, which is, indeed, what you are looking for.

I'm not sure that Jacl is a 100% implementation of Tcl though.

Praveen

unread,
Sep 1, 2008, 8:02:04 AM9/1/08
to
On Sep 1, 1:57 pm, "davidnwel...@gmail.com" <davidnwel...@gmail.com>
wrote:

> On Sep 1, 7:56 am, Praveen <praveengupta....@gmail.com> wrote:
>
> > As we know jacl is a 100% implementation of tcl . i want to know about
> > tcltest package which is a part of tcl basically . Is tcltest package
> > supported by jacl also to write the tests in the same manner as we
> > write in TCL?
>
i would like to correct the first sentence:
Jacl is an implementation of Tcl written in 100 percent pure Java.
thanks for replying.
can you give more details ,i am new to jacl.
from where can i download the code ?
will the tcltest.tcl file supported by the jacl?

suchenwi

unread,
Sep 1, 2008, 8:21:16 AM9/1/08
to
On 1 Sep., 14:02, Praveen <praveengupta....@gmail.com> wrote:
> will the tcltest.tcl file supported by the jacl?

Googling for "tcltest jacl" brings, among others,
http://aspn.activestate.com/ASPN/Mail/Message/tcljava-user/824916
where it says:

"Thanks to a lot of hard work by Christian Krone, Jacl 1.3 is now able
to run the tcltest package from Tcl 8.3."

Neil Madden

unread,
Sep 1, 2008, 9:07:20 AM9/1/08
to

See http://tcljava.sourceforge.net/docs/website/index.html

> will the tcltest.tcl file supported by the jacl?

Yes - Jacl supports tcltest.

-- Neil

Message has been deleted

Praveen

unread,
Sep 2, 2008, 4:59:23 AM9/2/08
to
On Sep 1, 6:07 pm, Neil Madden <n...@cs.nott.ac.uk> wrote:
> Praveen wrote:
> > On Sep 1, 1:57 pm, "davidnwel...@gmail.com" <davidnwel...@gmail.com>
> > wrote:
> >> On Sep 1, 7:56 am, Praveen <praveengupta....@gmail.com> wrote:
>
> >>> As we know jacl is a 100% implementation of tcl . i want to know about
> >>> tcltest package which is a part of tcl basically . Is tcltest package
> >>> supported by jacl also to write the tests in the same manner as we
> >>> write in TCL?
> > i would like to correct the first sentence:
> > Jacl is an implementation of Tcl written in 100 percent pure Java.
> > thanks for replying.
> > can you give more details ,i am new to jacl.
> > from where can i download the code ?
>
> Seehttp://tcljava.sourceforge.net/docs/website/index.html

>
> > will the tcltest.tcl file supported by the jacl?
>
> Yes - Jacl supports tcltest.
>
> -- Neil

thanks
i have a same doubt for SWT.
does jacl support java SWT ?

Neil Madden

unread,
Sep 2, 2008, 12:46:32 PM9/2/08
to

It supports it in the same way that it supports any Java library -- just
"package require java" and then you can call methods, instantiate
objects etc from any available Java package on your classpath. For
instance, the following appears to work for me:

# simple Jacl/SWT example
package require java

java::import -package org.eclipse.swt SWT
java::import -package org.eclipse.swt.widgets Display Shell Label

set display [java::new Display]
set shell [java::new Shell $display]
set label [java::new Label $shell [java::field SWT NONE]]

$label setText "Hello, World!"
$label pack
$shell pack
$shell open
while {![$shell isDisposed]} {
if {![$display readAndDispatch]} { $display sleep }
}
$display dispose

For Swing-based GUIs there is Swank which has a Tk-like API.

-- Neil

Tom Poindexter

unread,
Sep 2, 2008, 1:13:40 PM9/2/08
to
In article <hcqdnbhHlK908CDV...@bt.com>,

Neil Madden <n...@cs.nott.ac.uk> wrote:
>Praveen wrote:

>> does jacl support java SWT ?
>

>For Swing-based GUIs there is Swank which has a Tk-like API.

FYI Swank is at:
http://onemoonscientific.com/swank/

I haven't tried this myself, but there is a library that
emulates Swing on top of SWT, perhaps give that a try with
Swank:
http://swingwt.sourceforge.net/
--
Tom Poindexter
tpoi...@nyx.net

Praveen

unread,
Sep 4, 2008, 1:23:13 AM9/4/08
to
how can we define user constraints to use it with "test" command in
jacl?
if possible give an example.

Donal K. Fellows

unread,
Sep 4, 2008, 6:37:18 AM9/4/08
to
Praveen wrote:
> how can we define user constraints to use it with "test" command in
> jacl? if possible give an example.

Simple example:
tcltest::testConstraint dingbatVar [info exists ::dingbat]

It *really* is that simple.

Donal.

Praveen

unread,
Sep 11, 2008, 3:56:16 AM9/11/08
to
hi,
i installed the jacl 1.4.1 binary version some command are workin
fine
but i am facing problem at several places .

1) "test" command is not recognized , when i use "package require
tcltest" command
to check the tcltest package version . it gives me "1.0". when i try
to update with tcltest 2.2.8. it shows the message "using tcl 8.0,
need tcl 8.3".
please provide the solution.

2)when i try to run the SWT example .

# simple Jacl/SWT example
package require java


java::import -package org.eclipse.swt SWT
java::import -package org.eclipse.swt.widgets Display Shell Label


set display [java::new Display]
set shell [java::new Shell $display]
set label [java::new Label $shell [java::field SWT NONE]]


$label setText "Hello, World!"
$label pack
$shell pack
$shell open
while {![$shell isDisposed]} {
if {![$display readAndDispatch]} { $display sleep }
}
$display dispose

it is not recognizing the class in the swt package. i already included
the "org.eclipse.swt_3.3.0.v3346 ;
org.eclipse.swt.win32.win32.x86_3.3.0.v3346;"jar files in classpath.
and using JDK1.5. if i am doing any mistake in configiring the things
please let me know.

thanks

Neil Madden

unread,
Sep 11, 2008, 5:37:45 AM9/11/08
to
Praveen wrote:
> hi,
> i installed the jacl 1.4.1 binary version some command are workin
> fine
> but i am facing problem at several places .
>
> 1) "test" command is not recognized , when i use "package require
> tcltest" command
> to check the tcltest package version . it gives me "1.0". when i try
> to update with tcltest 2.2.8. it shows the message "using tcl 8.0,
> need tcl 8.3".
> please provide the solution.

Jacl officially only supports Tcl 8.0, but it actually has a number of
more recent features. You could try editing the tcltest package
(tcltest.tcl) to remove the [package require Tcl 8.3] line, but I can't
guarantee that it will work.

>
> 2)when i try to run the SWT example .
>
> # simple Jacl/SWT example
> package require java
>
>
> java::import -package org.eclipse.swt SWT
> java::import -package org.eclipse.swt.widgets Display Shell Label
>
>
> set display [java::new Display]
> set shell [java::new Shell $display]
> set label [java::new Label $shell [java::field SWT NONE]]
>
>
> $label setText "Hello, World!"
> $label pack
> $shell pack
> $shell open
> while {![$shell isDisposed]} {
> if {![$display readAndDispatch]} { $display sleep }
> }
> $display dispose
>
>
>
> it is not recognizing the class in the swt package. i already included
> the "org.eclipse.swt_3.3.0.v3346 ;
> org.eclipse.swt.win32.win32.x86_3.3.0.v3346;"jar files in classpath.
> and using JDK1.5. if i am doing any mistake in configiring the things
> please let me know.

This is definitely a classpath issue. You need to include the full path
to the jar file, i.e.: C:\foo\bar\swt.jar for Java to pick up classes
properly.

-- Neil

Praveen

unread,
Sep 11, 2008, 9:57:31 AM9/11/08
to
i try your suggestion previous errors are not coming but some other
error in tcltest.tcl are coming , is the tcltest 1.0 has minimal
functionality to support
test command and run the given code.

jacl 1.4.1 shows it has tcltest 1.0 package.

i create this small test file :

package require java
package require tcltest
test sum-1.1 {addition test} {
set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]
} {30}
i am trying to execute by using following sequence of commands

java tcl.lang.Shell
source "file name "

it gives me following error message
invalid command name"test".

can you give some sugesstion.

suchenwi

unread,
Sep 11, 2008, 10:03:51 AM9/11/08
to
On 11 Sep., 15:57, Praveen <praveengupta....@gmail.com> wrote:
> i am trying to execute by using following sequence of commands
>
> java tcl.lang.Shell
> source "file name "
>
> it gives me following error message
> invalid command name"test".

If you look at the tcltest man page, it says:
package require tcltest ?2.3?
tcltest::test name description ?option value ...?
...
So the test command is in the tcltest namespace. Either specify that
when testing, or do
namespace import tcltest::*
after the package require tcltest.

Praveen

unread,
Sep 12, 2008, 8:37:33 AM9/12/08
to
On Sep 11, 7:03 pm, suchenwi <richard.suchenwirth-

Thanks ,
It is working , but when I include constraints block
like this in given code:

package require java
package require tcltest

namespace import tcltest::*
test sum-1.1 {addition test} -constraints{
unix
} -body{


set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]

} -result 40

It gives me the following error
wrong # args: must be "test name description ?constraints? script
expectedAnswer"

As I told you tcltest package 1.0 is used by jacl 1.4.1.
is there any procedure to use the tcl2.2.8 with jacl 1.4.1.
Thanks

Helmut Giese

unread,
Sep 12, 2008, 9:46:20 AM9/12/08
to
Hi,

>test sum-1.1 {addition test} -constraints{
this looks suspicious: I think, there should be a space before the '{'

> unix
> } -body{
as should be here as well.
Remember: In Tcl white space is significant.

HTH
Helmut Giese

Praveen

unread,
Sep 15, 2008, 1:09:04 AM9/15/08
to

I make it that way also , still it doesn't work:-

package require java
package require tcltest
namespace import tcltest::*

test sum-1.1 { addition test } -constraints {

unix
} -body {
set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]
} -result 40

Is any other modification required? Please suggest.

Neil Madden

unread,
Sep 18, 2008, 5:43:00 PM9/18/08
to

As the error message suggests, tcltest 1 only supports a simpler syntax:

test sum-1.1 {addition test} unix {


set sum [java::new Sum]
$sum add 10
$sum add 20
set total [$sum getSum]

} 40

-- Neil

0 new messages