GNU Smalltalk 2.3 released

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

GNU Smalltalk 2.3 released

Paolo Bonzini
GNU Smalltalk 2.3 is now available from the GNU FTP server:

ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-2.3.tar.gz

This version includes a lot of small improvements and bugfixes, thanks
to the numerous reports from the users.

This version includes an important license change.  GNU Smalltalk now
adds an explicit exception to the GNU GPL license, explicitly allowing
the programs running under the virtual machine to use a GPL-incompatible
license.  This exception is used both by the virtual machine and by the
library bindings included in GNU Smalltalk.  This clears gray areas when
a Smalltalk program is using functions in the external library bindings
via dynamic linking and the foreign function call interface (C call-outs).


Other changes include:

* C call-outs returning #void now return self rather than nil.
Performance of code heavily using C call-outs has improved.

* FileStreams can now use pwrite for more efficient operation on files
opened for read/write, and will do fewer gratuitous lseek operations.
pread will also be used by FileStream>>#copyFrom:to:.  The number of
system calls issued when generating the documentation, for example, is
reduced by a third.

* Fixed many bugs including:.

** Fixed miscompilation of methods containing both -0.0 and 0.0
(positive and negative floating-point zero).

** Fixed bug in File>>#touch, which did not work really.  Other methods
were added to modify a file's atime and mtime.

** Fixed bug in SortedCollection.  After #removeAtIndex:, adds would
leave the collection unordered.

** Fixed crash when a forked process performed an explicit return.

* Introduced a method to efficiently convert a WriteStream into a
ReadStream.  It is called #readStream and makes WriteStream more
polymorphic with String.

* Introduced two more class shapes, #character and #utf32, that can be
used for String and UnicodeString (see later).

* More reliable detection of at-end-of-file condition for pipes, TTYs,
and so on (especially on Mac OS X), and of sockets closed by the peer.
Due to incompatibilities between various OSes, you are advised to test
end-of-stream conditions *before* rather than after reading a character
from stdin.  In 2.2, either way would work, but serious bugs were
present on Mac OS X unless stdin was redirected from a file.

* (GTK bindings) Moved gdk_draw_ functions to GdkDrawable.

* New goodie to parse the command line.  Look at the documentation for
the Getopt class and for SystemDictionary>>#arguments:do:.

* New example, lazy collections.  When loaded, #select:, #reject: and
#collect: do not create a new collection unless necessary.  Idioms like

        (a select: [ :each | ... ]) do: [ : each | ... ]

or

        a := a select: [ :each | ... ].
        a := a reject: [ :each | ... ].
        a := a select: [ :each | ... ].
        ^a size

can be much faster when this example is loaded.

* New examples of how to subclass CompiledMethod to perform "true
delegation" or interpreting foreign bytecode sets.

* Regular expressions are now included in the default image.  The
interface is now definitive and is similar to 2.2.  The concrete classes
for RegexResults are in a private namespace (since the user need not
instantiate them anyway).  Right now, regular expressions are only
usable for String objects (see Unicode support below).  This may change
in the future.

* The backtraces now omit again the internal methods in the exception
handling system.

* The class above which super-send bytecodes start searching is now
embedded in the bytecode stream.  This provides the infrastructure to
implement 'here' as in Smalltalk/X or 'self.Foo b' to execute the
Foo>>#b method (these possible extensions have not been implemented).

* The header files compile cleanly with a C++ compiler.  For the
occasion, the preferred name of the old `mst_Object' has changed to
`gst_object'.

* Various speedups.


Unicode support:

* Characters above 127 are no longer used to represent extended ASCII
characters.  Instead, they are only used to represent a byte in the
encoding of the Unicode characters from 128 on.  To create them use the
Blue Book method Character class>>#value:.

To represent Unicode characters above 127, instead, use the (ANSI
Smalltalk) Character class>>#codePoint: method.  Note that these
characters *cannot* be shown on a stream or on the Transcript with
#nextPut: (use #display: instead) nor compared with #== (use #= instead).

Character literals like $+ or $A are guaranteed to create normal
"Character" objects, for which you can safely use #nextPut:.  Right now,
these are valid only for characters between 0 and 127.  To create
Character literals for unicode characters, use the new syntax to express
characters using their Unicode code point.  This may be extended in the
future to support Unicode character literals.

A ``safe'' way to obtain the character whose encoding is between 128 and
255 is this (which requires the Iconv module to be loaded):

         ##('<your character>' asUnicodeString first)

(This snippet has no shortcut by design because, in general, converting
a Character to a UnicodeCharacter is not a well-defined operation).

* New UnicodeCharacter and UnicodeString classes.  These new classes can
also be passed to and received from C functions.  See the manual for
more information.

* New syntax $<13> to express characters using their Unicode code point.
  As anticipated, this syntax will create instances of the new
UnicodeCharacter class when the number is > 127.

* Part of the I18N module was separated into the Iconv module, which
provides support for printing Unicode characters and strings correctly.


Other goodies:

* NCurses bindings, contributed by Brad Watson.


Happy smalltalking!

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Olivier Blanc-3
Hello,

here is a first version (0.0a) of an opengl module
I attach a tar file containing what's nedded to compile the module.
I guess I didn't follow the good practice for m4 and makefile.am files.
Let me know what should be changed.

I did't had time to test every things, so some code are still in
comments. All other code have been tested.

I put some tests files in a test subdir.

I cntinue to work on it, and I will send more in 15 days.

Regards,

Olivier

smtk-2.3.opengl.tgz (60K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Paul D. Fernhout
In reply to this post by Paolo Bonzini
Paolo-

Thanks for this release. Just checked it into a local svn repository for
some "experiments". :-) [Cue "Young Frankenstein"-ian laughter; see
previous posts for details related to using pinches of GST to add
something sweet to a certain bitter hot beverage. :-)]

Anyway, I tried to compile 2.3 as-is on a Debian system (mostly running
testing). I am getting the same problem Brad Watson posted to the list
about for 2.2, where he wrote:
 > I'm working on compiling and installing Smalltalk
 > 2.2a, however, I encountered a problem with the probe
 > for comint.el in the configure script: it halts
 > indefinately until I C-c out of it.

You asked him to run two commands (on 09/25/2006 11:25 AM), just for
reference I ran them and got:

   $ emacs -batch -q -no-site-file -l comint.el
   bash: emacs: command not found

   $ emacs -batch -q -no-site-file -l comint.elc
   bash: emacs: command not found

This is probably around the spot in the configure code that hangs:

============
{ echo "$as_me:$LINENO: checking for comint.el" >&5
echo $ECHO_N "checking for comint.el... $ECHO_C" >&6; }
if test "${ac_cv_emacs_comint+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
else

   ac_cv_emacs_comint=no
   if test $EMACS != no; then
     $EMACS -batch -q -no-site-file -l comint.el 2>&1 | \
       grep 'Cannot open load file' > /dev/null 2>&1 || ac_cv_emacs_comint=yes
     $EMACS -batch -q -no-site-file -l comint.elc 2>&1 | \
       grep 'Cannot open load file' > /dev/null 2>&1 || ac_cv_emacs_comint=yes
   fi

fi
{ echo "$as_me:$LINENO: result: $ac_cv_emacs_comint" >&5
echo "${ECHO_T}$ac_cv_emacs_comint" >&6; }
===========

I commented out that part out after the first two lines and it proceeds; I
don't know enough of that scripting to understand if my commenting out
broke anything important needed later for the build.

I typed "make" afterwards and it completed OK and then ran:
   $ ./gst
   GNU Smalltalk ready
   st> 2 + 3 !
   5
   st>

Anyway, this is not a major problem for me; just thought I'd report it as
an issue, especially if anyone else encounters it. Might just be what
happens when emacs is not available?

Otherwise, congratulations on the milestone!

--Paul Fernhout

Paolo Bonzini wrote:
> GNU Smalltalk 2.3 is now available from the GNU FTP server:
>
> ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-2.3.tar.gz


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Brad Watson
In reply to this post by Paolo Bonzini
It still happens for me as well: xemacs just hangs when called from the ./configure script in batch mode if it can't find the comint.el file.  On my system I do have the comint.elc file, and if I comment out the test for the former, the configure script runs fine.

----- Original Message ----
From: Paul D. Fernhout <[hidden email]>
To: [hidden email]
Sent: Tuesday, December 5, 2006 1:08:14 PM
Subject: Re: [Help-smalltalk] GNU Smalltalk 2.3 released

Paolo-

Thanks for this release. Just checked it into a local svn repository for
some "experiments". :-) [Cue "Young Frankenstein"-ian laughter; see
previous posts for details related to using pinches of GST to add
something sweet to a certain bitter hot beverage. :-)]

Anyway, I tried to compile 2.3 as-is on a Debian system (mostly running
testing). I am getting the same problem Brad Watson posted to the list
about for 2.2, where he wrote:
 > I'm working on compiling and installing Smalltalk
 > 2.2a, however, I encountered a problem with the probe
 > for comint.el in the configure script: it halts
 > indefinately until I C-c out of it.

You asked him to run two commands (on 09/25/2006 11:25 AM), just for
reference I ran them and got:

   $ emacs -batch -q -no-site-file -l comint.el
   bash: emacs: command not found

   $ emacs -batch -q -no-site-file -l comint.elc
   bash: emacs: command not found

This is probably around the spot in the configure code that hangs:

============
{ echo "$as_me:$LINENO: checking for comint.el" >&5
echo $ECHO_N "checking for comint.el... $ECHO_C" >&6; }
if test "${ac_cv_emacs_comint+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
else

   ac_cv_emacs_comint=no
   if test $EMACS != no; then
     $EMACS -batch -q -no-site-file -l comint.el 2>&1 | \
       grep 'Cannot open load file' > /dev/null 2>&1 || ac_cv_emacs_comint=yes
     $EMACS -batch -q -no-site-file -l comint.elc 2>&1 | \
       grep 'Cannot open load file' > /dev/null 2>&1 || ac_cv_emacs_comint=yes
   fi

fi
{ echo "$as_me:$LINENO: result: $ac_cv_emacs_comint" >&5
echo "${ECHO_T}$ac_cv_emacs_comint" >&6; }
===========

I commented out that part out after the first two lines and it proceeds; I
don't know enough of that scripting to understand if my commenting out
broke anything important needed later for the build.

I typed "make" afterwards and it completed OK and then ran:
   $ ./gst
   GNU Smalltalk ready
   st> 2 + 3 !
   5
   st>

Anyway, this is not a major problem for me; just thought I'd report it as
an issue, especially if anyone else encounters it. Might just be what
happens when emacs is not available?

Otherwise, congratulations on the milestone!

--Paul Fernhout

Paolo Bonzini wrote:
> GNU Smalltalk 2.3 is now available from the GNU FTP server:
>
> ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-2.3.tar.gz


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk





 
____________________________________________________________________________________
Have a burning question?  
Go to www.Answers.yahoo.com and get answers from real people who know.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Brad Watson
In reply to this post by Paolo Bonzini
Paolo,

Congratulations!  What do you have in mind for the for this feature:

"* New examples of how to subclass CompiledMethod to perform "true
delegation" or interpreting foreign bytecode sets."

Kind regards,

Brad Watson

----- Original Message ----
From: Paolo Bonzini <[hidden email]>
To: [hidden email]; GNU Smalltalk <[hidden email]>; ESUG <[hidden email]>
Sent: Tuesday, December 5, 2006 4:33:04 AM
Subject: [Help-smalltalk] GNU Smalltalk 2.3 released

GNU Smalltalk 2.3 is now available from the GNU FTP server:

ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-2.3.tar.gz

This version includes a lot of small improvements and bugfixes, thanks
to the numerous reports from the users.

This version includes an important license change.  GNU Smalltalk now
adds an explicit exception to the GNU GPL license, explicitly allowing
the programs running under the virtual machine to use a GPL-incompatible
license.  This exception is used both by the virtual machine and by the
library bindings included in GNU Smalltalk.  This clears gray areas when
a Smalltalk program is using functions in the external library bindings
via dynamic linking and the foreign function call interface (C call-outs).


Other changes include:

* C call-outs returning #void now return self rather than nil.
Performance of code heavily using C call-outs has improved.

* FileStreams can now use pwrite for more efficient operation on files
opened for read/write, and will do fewer gratuitous lseek operations.
pread will also be used by FileStream>>#copyFrom:to:.  The number of
system calls issued when generating the documentation, for example, is
reduced by a third.

* Fixed many bugs including:.

** Fixed miscompilation of methods containing both -0.0 and 0.0
(positive and negative floating-point zero).

** Fixed bug in File>>#touch, which did not work really.  Other methods
were added to modify a file's atime and mtime.

** Fixed bug in SortedCollection.  After #removeAtIndex:, adds would
leave the collection unordered.

** Fixed crash when a forked process performed an explicit return.

* Introduced a method to efficiently convert a WriteStream into a
ReadStream.  It is called #readStream and makes WriteStream more
polymorphic with String.

* Introduced two more class shapes, #character and #utf32, that can be
used for String and UnicodeString (see later).

* More reliable detection of at-end-of-file condition for pipes, TTYs,
and so on (especially on Mac OS X), and of sockets closed by the peer.
Due to incompatibilities between various OSes, you are advised to test
end-of-stream conditions *before* rather than after reading a character
from stdin.  In 2.2, either way would work, but serious bugs were
present on Mac OS X unless stdin was redirected from a file.

* (GTK bindings) Moved gdk_draw_ functions to GdkDrawable.

* New goodie to parse the command line.  Look at the documentation for
the Getopt class and for SystemDictionary>>#arguments:do:.

* New example, lazy collections.  When loaded, #select:, #reject: and
#collect: do not create a new collection unless necessary.  Idioms like

    (a select: [ :each | ... ]) do: [ : each | ... ]

or

    a := a select: [ :each | ... ].
    a := a reject: [ :each | ... ].
    a := a select: [ :each | ... ].
    ^a size

can be much faster when this example is loaded.

* New examples of how to subclass CompiledMethod to perform "true
delegation" or interpreting foreign bytecode sets.

* Regular expressions are now included in the default image.  The
interface is now definitive and is similar to 2.2.  The concrete classes
for RegexResults are in a private namespace (since the user need not
instantiate them anyway).  Right now, regular expressions are only
usable for String objects (see Unicode support below).  This may change
in the future.

* The backtraces now omit again the internal methods in the exception
handling system.

* The class above which super-send bytecodes start searching is now
embedded in the bytecode stream.  This provides the infrastructure to
implement 'here' as in Smalltalk/X or 'self.Foo b' to execute the
Foo>>#b method (these possible extensions have not been implemented).

* The header files compile cleanly with a C++ compiler.  For the
occasion, the preferred name of the old `mst_Object' has changed to
`gst_object'.

* Various speedups.


Unicode support:

* Characters above 127 are no longer used to represent extended ASCII
characters.  Instead, they are only used to represent a byte in the
encoding of the Unicode characters from 128 on.  To create them use the
Blue Book method Character class>>#value:.

To represent Unicode characters above 127, instead, use the (ANSI
Smalltalk) Character class>>#codePoint: method.  Note that these
characters *cannot* be shown on a stream or on the Transcript with
#nextPut: (use #display: instead) nor compared with #== (use #= instead).

Character literals like $+ or $A are guaranteed to create normal
"Character" objects, for which you can safely use #nextPut:.  Right now,
these are valid only for characters between 0 and 127.  To create
Character literals for unicode characters, use the new syntax to express
characters using their Unicode code point.  This may be extended in the
future to support Unicode character literals.

A ``safe'' way to obtain the character whose encoding is between 128 and
255 is this (which requires the Iconv module to be loaded):

         ##('<your character>' asUnicodeString first)

(This snippet has no shortcut by design because, in general, converting
a Character to a UnicodeCharacter is not a well-defined operation).

* New UnicodeCharacter and UnicodeString classes.  These new classes can
also be passed to and received from C functions.  See the manual for
more information.

* New syntax $<13> to express characters using their Unicode code point.
  As anticipated, this syntax will create instances of the new
UnicodeCharacter class when the number is > 127.

* Part of the I18N module was separated into the Iconv module, which
provides support for printing Unicode characters and strings correctly.


Other goodies:

* NCurses bindings, contributed by Brad Watson.


Happy smalltalking!

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk





 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Michael Fellinger-3
In reply to this post by Paolo Bonzini
On Tuesday 05 December 2006 21:33, Paolo Bonzini wrote:
> GNU Smalltalk 2.3 is now available from the GNU FTP server:
>
> ftp://ftp.gnu.org/gnu/smalltalk/smalltalk-2.3.tar.gz
>

Well, an old friend has showed up:

st> String sourceCodeAt: #asString!
Object: FileStream error: could not
open /home/manveru/pkgbuilds/smalltalk/pkg/usr/share/smalltalk/kernel/String.st
SystemExceptions.FileError(Exception)>>#signal
SystemExceptions.FileError class(Exception class)>>#signal:
[] in FileStream class(FileDescriptor class)>>#open:mode:
[] in FileStream class(FileDescriptor class)>>#fopen:mode:ifFail:
FileStream(FileDescriptor)>>#fileOp:with:with:ifFail:
FileStream class(FileDescriptor class)>>#fopen:mode:ifFail:
VFS.RealFileHandler>>#open:mode:ifFail:
FileStream class(FileDescriptor class)>>#open:mode:
FileSegment>>#withFileDo:
FileSegment>>#asString
String class(Behavior)>>#sourceCodeAt:
UndefinedObject>>#executeStatements

and:

FileSegment relocateFrom: 'usr/share/smalltalk/kernel'
  to: '/usr/share/smalltalk/kernel/'!

does not fix it this time.
i think it's a problem with --prefix on ./configure again.


another bug showed up again on my 64bit machine:

st> 100 factorial / 99 factorial!
Segmentation fault

this is no surprise though, since it wasn't fixed since 2.2e
i tried to find the reason for the segfault and ran it with strace again:

[manveru@sigma ~]$ cat crashgst.st
100 factorial / 99 factorial!

[manveru@sigma ~]$ strace gst crashgst.st
... lots of stuff until we finally open the file ...
open("crashgst.st", O_RDONLY)           = 3
fcntl(3, F_GETFD)                       = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff755911a0) = -1 ENOTTY
(Inappropriate ioctl for device)
poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, -1) = 1
read(3, "100 factorial / 99 factorial!\n", 1024) = 30
lseek(3, 0, SEEK_CUR)                   = 30
getcwd("/home/manveru", 4098)           = 14
lseek(3, 0, SEEK_CUR)                   = 30
gettimeofday({1165386427, 676969}, NULL) = 0
getrusage(RUSAGE_SELF, {ru_utime={0, 32002}, ru_stime={0, 12000}, ...}) = 0
rt_sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---

I cannot interpret what it means, and it may be of total unimportance... but
thought i'd give as much information as possible.
it runs fine on my 32bit-machines.

despite these problems i packaged it up as always, hope we can try some
patches for this soon ;)

> This version includes a lot of small improvements and bugfixes, thanks
> to the numerous reports from the users.
> [...]
> Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Paolo Bonzini
> FileSegment relocateFrom: 'usr/share/smalltalk/kernel'
>   to: '/usr/share/smalltalk/kernel/'!
>
> does not fix it this time.
> i think it's a problem with --prefix on ./configure again.

You should use

   FileSegment relocateFrom: '/home/manveru/pkgbuilds/smalltalk/pkg/'
      to: '/'!

to fix it, if anything.  But just to understand, you should be
configuring with

   ./configure --prefix=/usr

and installing with

   make install DESTDIR=$HOME/pkgbuilds/smalltalk/pkg

This bug might actually be the result of a fix. :-)

> this is no surprise though, since it wasn't fixed since 2.2e
> i tried to find the reason for the segfault and ran it with strace again:

You should try with gdb instead:

   gdb gst crashgst.st
   handle SIGSEGV noprint
   b abort
   run
   bt

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Michael Fellinger-3
On Wednesday 06 December 2006 17:17, Paolo Bonzini wrote:

> > FileSegment relocateFrom: 'usr/share/smalltalk/kernel'
> >   to: '/usr/share/smalltalk/kernel/'!
> >
> > does not fix it this time.
> > i think it's a problem with --prefix on ./configure again.
>
> You should use
>
>    FileSegment relocateFrom: '/home/manveru/pkgbuilds/smalltalk/pkg/'
>       to: '/'!
>
> to fix it, if anything.  But just to understand, you should be
> configuring with
>
>    ./configure --prefix=/usr
>
> and installing with
>
>    make install DESTDIR=$HOME/pkgbuilds/smalltalk/pkg
>
> This bug might actually be the result of a fix. :-)

OK, thank you very much, the order indeed mattered ;)
sorry, i'm still very new to this whole packaging-stuff and linux, so i might
need a slight push now and then...

now let's investigate the other issue, will mail about it soon.

>
> > this is no surprise though, since it wasn't fixed since 2.2e
> > i tried to find the reason for the segfault and ran it with strace again:
>
> You should try with gdb instead:
>
>    gdb gst crashgst.st
>    handle SIGSEGV noprint
>    b abort
>    run
>    bt
>
> Paolo

--
Weez International Limited

East Roppongi Bldg 5F, 509
3-16-35 Roppongi, Minato-ku Tokyo #106-0032
Tel: 81-(0)3-3505-3881 Fax: 81-(0)3-3505-3883
E-mail: [hidden email]
Website: http://weez-int.com


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: GNU Smalltalk 2.3 released

Michael Fellinger-3
In reply to this post by Paolo Bonzini
On Wednesday 06 December 2006 17:23, Paolo Bonzini wrote:
> > You should try with gdb instead:
> >
> >   gdb gst crashgst.st
>
> gdb --args gst crashgst.st, sorry.  Even better if you run "gdb --args
> ./gst crashgst.st" from the build directory.
>

ok, this works better, but i cannot set a breakpoint for abort, it doesn't
come across it...
also, using the gst in the build-directory doesn't work well, no idea why.
well, anyway - i tried following which seems quite promising...:

[manveru@sigma smalltalk-2.3]$ gdb --args gst crashgst.st
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".

(gdb) start
Breakpoint 1 at 0x405840
Starting program: /home/manveru/pkgbuilds/smalltalk/src/smalltalk-2.3/gst
crashgst.st
0x0000000000405840 in main ()
(gdb) step
Single stepping until exit from function main,
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x00002b120357ec10 in __gmpn_submul_1 () from /usr/lib/libgmp.so.3
(gdb) bt
#0  0x00002b120357ec10 in __gmpn_submul_1 () from /usr/lib/libgmp.so.3
#1  0x00002b1203589bb1 in __gmpn_bdivmod () from /usr/lib/libgmp.so.3
#2  0x00002b120358a31d in __gmpn_gcd () from /usr/lib/libgmp.so.3
#3  0x000000000046b87c in _gst_mpz_gcd ()
#4  0x00000000004488bc in VMpr_LargeInteger_gcd ()
#5  0x000000000044de2c in _gst_send_message_internal ()
#6  0x000000000045701d in _gst_interpret ()
#7  0x0000000000460f34 in _gst_nvmsg_send ()
#8  0x000000000040c05e in _gst_execute_statements ()
#9  0x0000000000464eaa in _gst_parse_chunks ()
#10 0x0000000000406587 in _gst_parse_stream ()
#11 0x00000000004058be in process_file ()
#12 0x000000000040597e in gst_top_level_loop ()
#13 0x0000000000405865 in main ()


^manveru


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [OpenGL module] version 0.0b

Paolo Bonzini
In reply to this post by Olivier Blanc-3
Olivier Blanc wrote:
> I found some huge bugs, specially on nurbs callback.
> Here is a new version with one more example.
>
> By the way, should I continue to post some new versions ? Are you
> interested by this module ?

Yes.  I suggest though that you post the versions to a web site, and
just post the link here.

Paolo



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [OpenGL module] version 0.0b

Paolo Bonzini
In reply to this post by Olivier Blanc-3
> By the way, should I continue to post some new versions ? Are you
> interested by this module ?

I have a suggestion.

You can declare the Color, Point, etc. classes as either this:

Object variable: #float subclass: #Color
         instanceVariableNames: ''
         classVariableNames: ''
         poolDictionaries: ''
         category: ''!

Then, override new to be "^self basicNew: N" where N is the number of
instance variables, and then add methods like

red
     ^self at: 1

red: aFloat
     self at: 1 put: aFloat

and so on.

(The same works for #double; you can also have an abstract class
defining all these methods, and concrete classes for each type).

Then, apply the attached patch.  With it, you have a new way to pass
arguments to C functions, #array, and if you have defined the classes as
above, this new way maps naturally to the sole argument of functions
like glColor3fv:

glColor3fv: color
     <cCall: 'glColor3fv' returning: #void args: #(#array)>!

This is also stored way way more efficiently.

Paolo

* local directory is at [hidden email]--2004b/smalltalk--devo--2.2--patch-202
* comparing to [hidden email]--2004b/smalltalk--devo--2.2--patch-202
M  ./doc/gst.texi
M  ./libgst/cint.c
M  ./libgst/sym.c
M  ./libgst/sym.h

* modified files

--- orig/doc/gst.texi
+++ mod/doc/gst.texi
@@ -2742,6 +2742,12 @@ C object value passed as @code{void *}
 Pointer to C object value passed as @code{void **}.  The @code{CObject}
 is modified on output to reflect the value stored into the passed object.
 
+@item array    
+The Smalltalk object must be of an indexable class; the pointer to the
+first indexed instance variable is passed.  The pointer might move
+upon garbage collection, so the object must either be fixed,
+or the called C routine should not call back to Smalltalk.
+
 @item smalltalk  
 Pass the object pointer to C.  The C routine should treat the value as a
 pointer to anonymous storage.  This pointer can be returned to Smalltalk
@@ -2767,6 +2773,7 @@ Table of parameter conversions:
 
 @multitable {Declared param type} {Boolean (True, False)} {@code{int} (C promotion rule)}
 @item Declared param type @tab Object type          @tab C parameter type used
+@item array               @tab any indexable class  @tab void *
 @item boolean             @tab Boolean (True, False)@tab int
 @item byteArray           @tab ByteArray            @tab char *
 @item cObject             @tab CObject              @tab void *


--- orig/libgst/cint.c
+++ mod/libgst/cint.c
@@ -93,7 +93,8 @@ typedef enum
   CDATA_WCHAR,
   CDATA_WSTRING,
   CDATA_WSTRING_OUT,
-  CDATA_SYMBOL_OUT
+  CDATA_SYMBOL_OUT,
+  CDATA_ARRAY /* pass pointer to base for indexable objects */
 }
 cdata_type;
 
@@ -205,6 +206,9 @@ static void init_dld (void);
 PTR dld_open (const char *filename);
 
 /* Callout to tests callins.  */
+static void test_array (int *oopData);
+
+/* Callout to tests callins.  */
 static void test_callin (OOP oop);
 
 /* Callout to test the CString class */
@@ -273,6 +277,7 @@ static const char *c_type_name[] = {
   "wchar_t", /* CDATA_WCHAR */
   "wchar_t *", /* CDATA_WSTRING */
   "wchar_t *", /* CDATA_WSTRING_OUT */
+  "void *", /* CDATA_ARRAY */
 };
 
 /* A map between symbols and the cdata_type enum.  */
@@ -304,6 +309,7 @@ static const symbol_type_map type_map[]
   {&_gst_wchar_symbol, CDATA_WCHAR},
   {&_gst_wstring_symbol, CDATA_WSTRING},
   {&_gst_wstring_out_symbol, CDATA_WSTRING_OUT},
+  {&_gst_array_symbol, CDATA_ARRAY},
   {NULL, CDATA_UNKNOWN}
 };
 
@@ -429,6 +435,13 @@ my_opendir (const char *dir)
 }
 
 void
+test_array (int *data)
+{
+  while (*data != -1)
+    printf ("%d ", *data++);
+}
+
+void
 test_callin (OOP oop)
 {
   OOP o, sel;
@@ -526,6 +539,7 @@ _gst_init_cfuncs (void)
   _gst_define_cfunc ("getArgv", get_argv);
 
   /* Test functions */
+  _gst_define_cfunc ("testArray", test_array);
   _gst_define_cfunc ("testCallin", test_callin);
   _gst_define_cfunc ("testCString", test_cstring);
   _gst_define_cfunc ("testCObjectPtr", test_cobject_ptr);
@@ -760,6 +774,7 @@ get_ffi_type (OOP returnTypeOOP)
   switch (TO_INT (returnTypeOOP))
     {
     case CDATA_OOP:
+    case CDATA_ARRAY:
     case CDATA_COBJECT:
     case CDATA_COBJECT_PTR:
     case CDATA_SYMBOL:
@@ -828,12 +843,12 @@ push_smalltalk_obj (OOP oop,
  oop == _gst_nil_oop ? CDATA_COBJECT :
  class == _gst_char_class ? CDATA_CHAR :
  class == _gst_unicode_character_class ? CDATA_WCHAR :
- class == _gst_byte_array_class ? CDATA_BYTEARRAY :
  is_a_kind_of (class, _gst_integer_class) ? CDATA_LONG :
- is_a_kind_of (class, _gst_string_class) ? CDATA_STRING :
- is_a_kind_of (class, _gst_unicode_string_class) ? CDATA_WSTRING :
  is_a_kind_of (class, _gst_c_object_class) ? CDATA_COBJECT :
  is_a_kind_of (class, _gst_float_class) ? CDATA_DOUBLE :
+ class == _gst_byte_array_class ? CDATA_BYTEARRAY :
+ is_a_kind_of (class, _gst_string_class) ? CDATA_STRING :
+ is_a_kind_of (class, _gst_unicode_string_class) ? CDATA_WSTRING :
  CDATA_OOP;
       break;
 
@@ -873,6 +888,18 @@ push_smalltalk_obj (OOP oop,
       return;
     }
 
+  else if (cType == CDATA_ARRAY)
+    {
+      if (CLASS_IS_INDEXABLE (class))
+ {
+  int first = CLASS_FIXED_FIELDS (class);
+          cp->u.ptrVal = (PTR) &OOP_TO_OBJ (oop)->data[first];
+          INC_ADD_OOP (oop); /* make sure it doesn't get gc'd */
+          SET_TYPE (&ffi_type_pointer);
+          return;
+ }
+    }
+
   else if (is_a_kind_of (class, _gst_integer_class))
     {
       switch (cType)
@@ -1027,7 +1054,6 @@ push_smalltalk_obj (OOP oop,
  }
     }
 
-
   bad_type (class, cType);
 }
 


--- orig/libgst/sym.c
+++ mod/libgst/sym.c
@@ -95,6 +95,7 @@ symbol_info;
 
 
 OOP _gst_and_symbol = NULL;
+OOP _gst_array_symbol = NULL;
 OOP _gst_as_scaled_decimal_scale_symbol = NULL;
 OOP _gst_at_put_symbol = NULL;
 OOP _gst_at_symbol = NULL;
@@ -278,6 +279,7 @@ static scope cur_scope = NULL;
    and is used to restore the global variables upon image load.  */
 static const symbol_info sym_info[] = {
   {&_gst_and_symbol, "and:"},
+  {&_gst_array_symbol, "array"},
   {&_gst_as_scaled_decimal_scale_symbol, "asScaledDecimal:scale:"},
   {&_gst_at_put_symbol, "at:put:"},
   {&_gst_at_symbol, "at:"},


--- orig/libgst/sym.h
+++ mod/libgst/sym.h
@@ -89,6 +89,7 @@ extern int _gst_use_undeclared
   ATTRIBUTE_HIDDEN;
 
 extern OOP _gst_and_symbol ATTRIBUTE_HIDDEN;
+extern OOP _gst_array_symbol ATTRIBUTE_HIDDEN;
 extern OOP _gst_as_scaled_decimal_scale_symbol ATTRIBUTE_HIDDEN;
 extern OOP _gst_at_put_symbol ATTRIBUTE_HIDDEN;
 extern OOP _gst_at_symbol ATTRIBUTE_HIDDEN;




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Re: [OpenGL module] version 0.0b

olivier blanc-2
In reply to this post by Paolo Bonzini
Le jeudi 07 décembre 2006 à 07:47 +0100, Paolo Bonzini a écrit :
>  I suggest though that you post the versions to a web site, and
> just post the link here.

Ok, I will work on the suggestions you gave and post a link to a web
site soon.

olivier
--
Olivier Blanc
Minefi - Bureau SI4/Dap3 - +33 240 128 909
olivier.blanc at dgi.finances.gouv.fr




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk