From olivers at mondrian-ide.com Fri Sep 2 19:50:51 2005 From: olivers at mondrian-ide.com (olivers@mondrian-ide.com) Date: Fri Sep 2 19:44:00 2005 Subject: [fxruby-users] Unicode support in FXRuby 1.6 In-Reply-To: References: Message-ID: <2936.67.94.56.66.1125705051.squirrel@webmail.mondrian-ide.com> Did you get any information on this? I decided to look around a bit since I had to learn a bit of Unicode for work the other day. I didn't find out much, but here it is in the interest of getting a discussion going: require 'jcode' # japanese character support module $KCODE = 'u' # tells ruby to use the UTF-8 character set utf_string = "\xc2\xa9" # UTF-8 code for the copyright sign utf_string.length # -> 2, just a byte count utf_string.jlength # -> 1, the number of UTF-8 characters That's all I could get to happen. So you can store Unicode strings with the '\x' escape code, but you have to type in the UTF or Japanese encoded bytes manually (no u'Unicode String' like in Python) and ruby doesn't really know the difference. There are some string utilities in the jcode module, and jcode also alludes to a PATTERN_UTF8 option which allows you to use Regexps with Unicode but it wasn't defined for me. There is also an 'iconv' module which allows you to convert between character sets, but it is just a wrapper around a unix utility and is not available for me on Windows XP. Oliver > All, > > As some of you know, Jeroen has added support for Unicode strings in > the unstable development version of FOX (version 1.5). I'm trying to > plan ahead to decide how best to support this for FXRuby 1.6, but I > don't really know anything about Ruby's support for Unicode or i18n in > general. If you're familiar with this topic (how/if Ruby deals with > Unicode strings) I'd appreciate some pointers. > > Thanks, > > Lyle > > _______________________________________________ > fxruby-users mailing list > fxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > From sander at knology.net Fri Sep 2 21:11:16 2005 From: sander at knology.net (Sander Jansen) Date: Fri Sep 2 22:52:28 2005 Subject: [fxruby-users] Unicode support in FXRuby 1.6 In-Reply-To: <2936.67.94.56.66.1125705051.squirrel@webmail.mondrian-ide.com> References: <2936.67.94.56.66.1125705051.squirrel@webmail.mondrian-ide.com> Message-ID: <200509022011.17248.sander@knology.net> > That's all I could get to happen. So you can store Unicode strings with > the '\x' escape code, but you have to type in the UTF or Japanese encoded > bytes manually (no u'Unicode String' like in Python) and ruby doesn't > really know the difference. Can't you store the ruby scripts as UTF8 encoded text files? Or will the ruby interperter struggle with that? > There are some string utilities in the jcode > module, and jcode also alludes to a PATTERN_UTF8 option which allows you > to use Regexps with Unicode but it wasn't defined for me. > There is also > an 'iconv' module which allows you to convert between character sets, but > it is just a wrapper around a unix utility and is not available for me on > Windows XP. FOX has several text codecs already buildin. Sander From olivers at mondrian-ide.com Sat Sep 3 02:05:31 2005 From: olivers at mondrian-ide.com (Oliver Smith) Date: Sat Sep 3 01:55:53 2005 Subject: [fxruby-users] Unicode support in FXRuby 1.6 In-Reply-To: <200509022011.17248.sander@knology.net> Message-ID: > > That's all I could get to happen. So you can store Unicode strings with > > the '\x' escape code, but you have to type in the UTF or > Japanese encoded > > bytes manually (no u'Unicode String' like in Python) and ruby doesn't > > really know the difference. > > Can't you store the ruby scripts as UTF8 encoded text files? Or > will the ruby > interperter struggle with that? I think there is a way to do that, since there's a -K option to the ruby interpreter which allows you to specify UTF-8, EUC or Shift-JIS, but when I tried it choked on the non-ascii character regardless (I just saved a simple ruby file in UTF-8 format with notepad and did 'ruby -Ku test.rb'). I guess the $KCODE system variable is supposed to do this also. I just noticed an argument to Regexp.new which allows you to specify from the same charset choices. I can use a UTF-8 two-byte character in a character class and it works as expected. Oliver From ggarra at advancedsl.com.ar Sat Sep 3 03:24:12 2005 From: ggarra at advancedsl.com.ar (Gonzalo Garramuno) Date: Sat Sep 3 03:17:33 2005 Subject: [fxruby-users] Unicode support in FXRuby 1.6 References: <2936.67.94.56.66.1125705051.squirrel@webmail.mondrian-ide.com> Message-ID: <002101c5b058$7fbadb10$0201a8c0@microsoft> That's pretty much correct. Ruby's Unicode support is somewhat weak compared to python or perl. Only UTF-8 is supported. No support for UTF-16 is available, afaik. Basically... here's everything you wanted to know about ruby's Unicode but were afraid to ask.... * $KCODE can be set to support an encoding directly, but this is *NOT* needed to have a script work with unicode. It is just a simple shortcut so that any regex like /./ will do the right thing. * Without $KCODE, regexp with unicode support is available. It is done using /u language option, like t =~ //u or Regexp.new(regex, options, 'u') (or, alternatively, //m which is for multi-byte -- meaning ANSI, UTF-8, EUC, or SJIS depending on what $KCODE is set to, albeit I believe this is now no longer needed as setting $KCODE will alredy adjust all regexes). * Supporting u"" like python can be added to some extent very easily. See: http://redhanded.hobix.com/inspect/closingInOnUnicodeWithJcode.html This allows you to then do: c = u'U+00a9' # same as \xc2\xa9 * You can also use: [].pack('U*') "".unpack('U*') to pack/unpack utf-8 strings. This allows you to easily count characters and iterate thru them, without the need of jcode (which really is only needed for getting succ to work). * jcode.rb is kind of a ruby hack and it is incomplete. Methods such as: reverse, capitalize, casecmp, swapcase, all the strip functions and probably others are not defined and will return incorrect results, depending on the language. * Ruby's $KCODE does not add a UTF-8 <->Latin1 encoding conversion, unlike python's unicode strings. So, albeit with the above, you can do: question = u'U+00bfHabla espaU+00f1ol?' # ?Habla espa?ol? puts question similar to python's: question = u'\u00bfHabla espa\u00f1ol?' # ?Habla espa?ol? print question You will not get the corresponding Latin1 string when you print it (unlike python's unicode strings). * To properly do the above, and convert Latin1<->UTF8 for printing, you should use iconv. ruby -rinconv -e 'puts Iconv.iconv("UTF-8", "ISO-8859-1", "\xf1")' Iconv, by default, does *NOT* get installed by the One-Click Windows installer, even thou it is supposed to be a standard part of ruby. Adding something then like: class UString require 'iconv' def to_s puts Iconv.iconv("UTF-8", "ISO-8859-1", self) end end will do the trick for Why's UString class. * The ruby interpreter should have no problem reading a utf-8 .rb script file, but you have to prefix it by calling > ruby -Ku file.rb (or set RUBYOPTS to -Ku, so ruby always runs with that) Note, however, that window's notepad, when saving UTF-8 files adds a valid albeit meaningless 3-byte BOM (byte-order sequence) at start which will not work fine with ruby1.8 (and will also corrupt unix shebang lines on most -all?- unixes). This sequence is not valid utf-8 unicode, albeit it is allowed by the standard. Ruby, just as Unix shebangs, does not deal with this appropiately. From ggarra at advancedsl.com.ar Sat Sep 3 04:05:57 2005 From: ggarra at advancedsl.com.ar (Gonzalo Garramuno) Date: Sat Sep 3 03:59:19 2005 Subject: [fxruby-users] Unicode support in FXRuby 1.6 References: Message-ID: <003e01c5b05e$51991b10$0201a8c0@microsoft> Oh yeah... the plan for ruby2.0 (or 1.9?) Unicode is to have: http://redhanded.hobix.com/inspect/futurismUnicodeInRuby.html so what does this mean for fxruby? Well, it means that Unicode support could probably be implemented in either one of two ways: a) By using FXRuby's own FXString, which would do all the encoding and which would support a constructor like: class FXUnicodeString < String def initialize( str, encoding = $KCODE ) # with encoding being ASCII (latin1, really), Unicode, EJIS or EUC end # ...etc... # ...with all of ruby's standard String methods implemented, using fox's unicode as the backend. end # And perhaps... for ease of use... class Kernel def u(str) FXUnicodeString.new(str, 'U') end end or... b) Simply by having a similar text function for the widgets with unicode, so that, besides: text() text=() # both returning the string unprocessed. there's also text(str, encoding) text_enc() # returns [text, encoding] # if fox remembers the encoding Obviously, a) is better as that it would be more similar to what ruby plans to eventually do with unicode support (and thus, eventually, FXUnicodeString could just be replaced with ruby's String itself), albeit it may end up being more work in having to implement all of ruby's methods. From ggarra at advancedsl.com.ar Sat Sep 3 05:09:24 2005 From: ggarra at advancedsl.com.ar (Gonzalo Garramuno) Date: Sat Sep 3 05:02:30 2005 Subject: [fxruby-users] Unicode support in FXRuby 1.6 References: <2936.67.94.56.66.1125705051.squirrel@webmail.mondrian-ide.com> <002101c5b058$7fbadb10$0201a8c0@microsoft> Message-ID: <006501c5b067$2de0bb70$0201a8c0@microsoft> > (or, alternatively, //m which is for multi-byte -- meaning ANSI, UTF-8, > EUC, or SJIS depending on > what $KCODE is set to, albeit I believe this is now no longer needed as > setting $KCODE will alredy > adjust all regexes). > Err... actually this is not correct. /m is for multi-line in regex. Not sure what the heck I was thinking there. From lyle at knology.net Sat Sep 3 11:15:17 2005 From: lyle at knology.net (Lyle Johnson) Date: Sat Sep 3 11:08:29 2005 Subject: [fxruby-users] Re: FXRuby issues In-Reply-To: <005901c5b065$9fdca470$0201a8c0@microsoft> References: <005901c5b065$9fdca470$0201a8c0@microsoft> Message-ID: <2c523111c79ef75b55756c16d59542c0@knology.net> On Sep 3, 2005, at 3:58 AM, Gonzalo Garramuno wrote: > Sorry to bother you personally, but after working with FXRuby for the > first time on a relatively medium-sized project, I collected a list of > things that seem to be broken in fxruby (or fox), and I thought it > would be good for you guys to be aware of. > Some of these things I consider them somewhat serious in term of > recommending fxruby for larger projects, which is unfortunate, cause I > overally really liked how the API is designed. > ? > Unless specified, problems seem to show in both 1.2 and 1.4, under > Windows, at least.? The main things I run into problems were: > ? > *?Segfaults. > FXRuby segfaults quite a lot.? This, for once, happens when things are > not created, which is understandable, but bad anyway, compared to > other toolkits like FLTK, TK, etc. where segfaults are simply not > possible (other than the library is buggy). When an FXRuby application segfaults, it's almost always the fault of the FXRuby bindings themselves and not the underlying FOX library. > But more so, I also found segfaults with: > ??? - crashes when creating large canvases/images.? These were pretty > weird.? I basically could not get FxRuby to have a 4K or > 8K?canvas+image buffer.? I am not sure how this could be as a 128Mb + > 2GB swap should be enough for handling this with no problem.? Worse, > fxruby would just segfault upon creation.? No "out of memory" message > or anything.? This is overall pretty bad. > ??? - segfaults sometimes when an actual ruby exception was raised > (runtime error, syntax error, etc).? What was bad about this is that > it would > ??????often not allow ruby to actually flush and print the actual > error that caused the crash, leaving you somewhat in the dark as to > what > ????? happened (Fox issue???issue in my code?)? Again, this was pretty > bad. > ??? - 1.4 seems to have some issues with the garbage collector.? > GC.start will often segfault it. It would be great if you could submit a bug report to the tracker at RubyForge (http://rubyforge.org/tracker/?atid=1223&group_id=300&func=browse) that describes in detail how to reproduce any of these problems. A short example program that does so is even better. > *?The whole versioning thing.? I mentioned this already.? Yes, we disagree about this. There are usually non-trivial API changes between major releases of FOX. This was true going from FOX 1.0 to 1.2, and again from 1.2 to 1.4. I'm glad that your application required few, if any, changes to "port" it from FXRuby 1.2 to 1.4, but that's the exception and not the rule, as I think long-time users will attest. > * Windows focus bugs This sounds like a bug (or feature) of the FOX library itself. You might try reporting it to the foxgui-users mailing list to see if anyone has any suggestions. > * Custom mouse icons will not allow hotspot to be changed.? Setting > hotspot to anything positive in the constructor, crashes fxruby.? > Using setHotX/Y on 1.4 does nothing.? At least on windows. If the FOX library doesn't allow you to change the hotspot for custom icons, I can't do anything about that in the FXRuby layer either, but I'll check into it. The code shouldn't crash when setting the hotspot, and that should be easy enough for me to test. > * The way the DC classes are designed are great but: > ??? - FXDCPrint is just way too buggy and incomplete.? It probably > should be removed from the release (or a word of warning in the docs > should be present) > ??? - FXDC is in serious need of supporting: > ??? ??? * bezier/bspline drawing > ??? ??? * hit testing > ??? ??? * FXDCWindow's with double buffering (sans opengl) > ????? Three things that are relatively common in other toolkits (Tk, > FLTK, etc). These are again shortcomings of FOX itself. You can report them to the foxgui-users list if you like. > ????* The new 1.4 tooltip callback is buggy.? On startup of the > program, it will often not get called until the user clicks on > something.? And other times, the tooltip will popup for no reason, > using the default popup text. OK, will check into this. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 5595 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20050903/7c82fc3a/attachment.bin From sander at knology.net Sat Sep 3 09:39:31 2005 From: sander at knology.net (Sander Jansen) Date: Sat Sep 3 11:20:29 2005 Subject: [fxruby-users] Re: FXRuby issues In-Reply-To: <2c523111c79ef75b55756c16d59542c0@knology.net> References: <005901c5b065$9fdca470$0201a8c0@microsoft> <2c523111c79ef75b55756c16d59542c0@knology.net> Message-ID: <200509030839.32225.sander@knology.net> On Saturday 03 September 2005 10:15 am, Lyle Johnson wrote: > On Sep 3, 2005, at 3:58 AM, Gonzalo Garramuno wrote: > > Sorry to bother you personally, but after working with FXRuby for the > > first time on a relatively medium-sized project, I collected a list of > > things that seem to be broken in fxruby (or fox), and I thought it > > would be good for you guys to be aware of. > > Some of these things I consider them somewhat serious in term of > > recommending fxruby for larger projects, which is unfortunate, cause I > > overally really liked how the API is designed. > > ? > > Unless specified, problems seem to show in both 1.2 and 1.4, under > > Windows, at least.? The main things I run into problems were: > > ? > > *?Segfaults. > > FXRuby segfaults quite a lot.? This, for once, happens when things are > > not created, which is understandable, but bad anyway, compared to > > other toolkits like FLTK, TK, etc. where segfaults are simply not > > possible (other than the library is buggy). > > When an FXRuby application segfaults, it's almost always the fault of > the FXRuby bindings themselves and not the underlying FOX library. > > > But more so, I also found segfaults with: > > ??? - crashes when creating large canvases/images.? These were pretty > > weird.? I basically could not get FxRuby to have a 4K or > > 8K?canvas+image buffer.? Well there are GDI limits ofcourse.... FOX will throw a exception if limits are reached.... Sander From lyle at knology.net Sat Sep 3 11:51:12 2005 From: lyle at knology.net (Lyle Johnson) Date: Sat Sep 3 11:44:22 2005 Subject: [fxruby-users] Re: FXRuby issues In-Reply-To: <200509030839.32225.sander@knology.net> References: <005901c5b065$9fdca470$0201a8c0@microsoft> <2c523111c79ef75b55756c16d59542c0@knology.net> <200509030839.32225.sander@knology.net> Message-ID: <6d715708897f90e16d018d9956fa9371@knology.net> On Sep 3, 2005, at 8:39 AM, Sander Jansen wrote: > Well there are GDI limits ofcourse.... FOX will throw a exception if > limits > are reached... True, but I doubt that's the case for Gonzalo's application, especially if the buffer size is only 4 or 8k in size. From olivers at mondrian-ide.com Sat Sep 3 12:53:57 2005 From: olivers at mondrian-ide.com (Oliver Smith) Date: Sat Sep 3 12:44:16 2005 Subject: [fxruby-users] Unicode support in FXRuby 1.6 In-Reply-To: <002101c5b058$7fbadb10$0201a8c0@microsoft> Message-ID: Gonzalo, Thanks a lot for your thorough notes! I think you covered everything I was curious about. Oliver > -----Original Message----- > From: fxruby-users-bounces@rubyforge.org > [mailto:fxruby-users-bounces@rubyforge.org]On Behalf Of Gonzalo > Garramuno > Sent: Saturday, September 03, 2005 12:24 AM > To: fxruby-users@rubyforge.org > Subject: Re: [fxruby-users] Unicode support in FXRuby 1.6 > > > That's pretty much correct. Ruby's Unicode support is somewhat weak > compared to python or perl. > Only UTF-8 is supported. No support for UTF-16 is available, afaik. > > Basically... here's everything you wanted to know about ruby's > Unicode but > were afraid to ask.... > > * $KCODE can be set to support an encoding directly, but this is *NOT* > needed to have a script work with unicode. > It is just a simple shortcut so that any regex like /./ will do the right > thing. > > * Without $KCODE, regexp with unicode support is available. It is done > using /u language option, like > t =~ //u > or > Regexp.new(regex, options, 'u') > (or, alternatively, //m which is for multi-byte -- meaning ANSI, UTF-8, > EUC, or SJIS depending on > what $KCODE is set to, albeit I believe this is now no longer needed as > setting $KCODE will alredy > adjust all regexes). > > * Supporting u"" like python can be added to some extent very > easily. See: > http://redhanded.hobix.com/inspect/closingInOnUnicodeWithJcode.html > This allows you to then do: > c = u'U+00a9' # same as \xc2\xa9 > > * You can also use: > [].pack('U*') > "".unpack('U*') > to pack/unpack utf-8 strings. This allows you to easily count > characters and iterate thru them, > without the need of jcode (which really is only needed for > getting succ > to work). > > * jcode.rb is kind of a ruby hack and it is incomplete. Methods such as: > reverse, capitalize, casecmp, swapcase, all the strip functions > and probably > others are not defined and will return incorrect results, depending on the > language. > > * Ruby's $KCODE does not add a UTF-8 <->Latin1 encoding conversion, unlike > python's unicode strings. So, albeit with the above, you can do: > > question = u'U+00bfHabla espaU+00f1ol?' # ?Habla espa?ol? > puts question > > similar to python's: > question = u'\u00bfHabla espa\u00f1ol?' # ?Habla espa?ol? > print question > > You will not get the corresponding Latin1 string when you print it (unlike > python's unicode strings). > > * To properly do the above, and convert Latin1<->UTF8 for printing, you > should use iconv. > ruby -rinconv -e 'puts Iconv.iconv("UTF-8", "ISO-8859-1", "\xf1")' > Iconv, by default, does *NOT* get installed by the One-Click Windows > installer, even thou it is supposed to be a > standard part of ruby. > Adding something then like: > class UString > require 'iconv' > def to_s > puts Iconv.iconv("UTF-8", "ISO-8859-1", self) > end > end > will do the trick for Why's UString class. > > * The ruby interpreter should have no problem reading a utf-8 .rb script > file, but you have to prefix it by calling > > ruby -Ku file.rb (or set RUBYOPTS to -Ku, so ruby always runs > with that) > Note, however, that window's notepad, when saving UTF-8 files adds a valid > albeit meaningless 3-byte BOM (byte-order sequence) at start > which will not > work fine with ruby1.8 (and will also corrupt unix shebang lines on > most -all?- unixes). This sequence is not valid utf-8 unicode, > albeit it is > allowed by the standard. Ruby, just as Unix shebangs, does not deal with > this appropiately. > > _______________________________________________ > fxruby-users mailing list > fxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > From ggarra at advancedsl.com.ar Tue Sep 6 14:20:11 2005 From: ggarra at advancedsl.com.ar (Gonzalo Garramuno) Date: Tue Sep 6 14:13:16 2005 Subject: [fxruby-users] Re: FXRuby issues References: <005901c5b065$9fdca470$0201a8c0@microsoft> <2c523111c79ef75b55756c16d59542c0@knology.net> <200509030839.32225.sander@knology.net> <6d715708897f90e16d018d9956fa9371@knology.net> Message-ID: <003401c5b30f$a533e490$0201a8c0@microsoft> Yes, it isn't that. What's more, I've been trying to debug a still present crashing bug that will crash the application after some time of use (an hour or so), and I now have a definitive clue as to what's causing it. In my code, I basically have code that does: @image.release @image.destroy GC.start @image = FXBMPImage.new(@window.getApp, nil, IMAGE_SHMI|IMAGE_SHMP, width, height) @image.create whenever the user zooms in/out on the canvas (or the canvas is resized as a result of the map growing). I have verified that width, height and @window are valid thru printing statements, yet I have noticed that sometimes the FXBMPImage.new() function does not return. Instead it seems to pop the ruby stack, returning from the current function, leaving @image unitialized and uncreated (ie. @image.create and subsequent code is never reached). My guess is that there's probably some sort of exception being raised in the FXBMPImage constructor of which ruby is never made aware of. This eventually leads to a crash later on in my code, whenever a DC context wants to be inited with that image, as it remains unitialized. On that subject, is there any way I can check if an element is created. Something like @image.created? From lyle at knology.net Tue Sep 6 15:08:42 2005 From: lyle at knology.net (lyle@knology.net) Date: Tue Sep 6 15:01:47 2005 Subject: [fxruby-users] Re: FXRuby issues In-Reply-To: <> References: <> Message-ID: <20050906190842.20665.qmail@webmail3.knology.net> On Tue, 06 Sep 2005 15:20:11 -0300, Gonzalo Garramuno wrote : > On that subject, is there any way I can check if an element is created. > Something like @image.created? Yes, it is exactly like @image.created? (see the API docs for FXId, which is an ancestor class of FXImage). From ujb1 at gmx.de Thu Sep 1 09:11:27 2005 From: ujb1 at gmx.de (ujb1@gmx.de) Date: Mon Sep 12 11:23:21 2005 Subject: [fxruby-users] FXRuby and multithreading Message-ID: <10689.1125580287@www38.gmx.net> Hello fxruby-users, does anybody have experience with FXRuby and multithreading? My Problem: - I populate a FXTreeList widget with items. This is done in an extra worker thread, as this task takes some minutes - In the meantime, the user can continue to work with the application. All works fine, until the user opens a modal window (e.g. a FXMessageBox). Sometimes FXRuby crashes with an acess violation in FXWindow::getShell: while((p=win->parent) && p->parent) win=p; p seems to be invalid in this situation The this-pointer seems to be ok and points to the MXMessageBox. The processed message is a WM_KILLFOCUS message FX::FXWindow::getShell() line 383 + 18 bytes FX::FXApp::dispatchEvent(void * 0x002b1b58, unsigned int 8, unsigned int 0, long 0) line 3943 + 8 bytes FX::FXApp::wndproc(void * 0x002b1b58, unsigned int 8, unsigned int 0, long 0) line 3446 USER32! InternalCallWinProc@20 + 27 bytes USER32! UserCallWinProcCheckWow@32 + 183 bytes USER32! DispatchClientMessage@20 + 77 bytes USER32! __fnDWORD@4 + 34 bytes NTDLL! KiUserCallbackDispatcher@12 + 19 bytes USER32! 77d49105() USER32! SoftModalMessageBox@4 + 1380 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutW@24 + 89 bytes USER32! SoftModalMessageBox@4 + 1380 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutW@24 + 89 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutA@24 + 111 bytes NTDLL! RtlImageDirectoryEntryToData@16 + 61 bytes 023f83dc() ruby 1.8.2 fxruby 1.2.6 regards Dirk -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse für Mail, Message, More +++ From ujb1 at gmx.de Thu Sep 1 10:21:04 2005 From: ujb1 at gmx.de (ujb1@gmx.de) Date: Mon Sep 12 11:23:21 2005 Subject: [fxruby-users] FXRuby and multithreading References: <10689.1125580287@www38.gmx.net> Message-ID: <28565.1125584464@www9.gmx.net> Hi, some more information: the error described in the last mail is a consecutive fault of another error: FXRuby crashed in FXRbWindow::markfunc: // Mark child windows register FXWindow* child=self->getFirst(); while(child!=NULL){ FXRbGcMark(child); child=child->getNext(); <------ child is 0x00000004!!!! } } The error is catched by the ruby error handler. The handler calls abort. Abort shows another message box and FXRuby crashes a second time with this box. Maybe this is a Qnil??? How does it get into the list of children? FXRbWindow::markfunc(FX::FXWindow * 0x037b8f28) line 170 + 3 bytes FXRbComposite::markfunc(FX::FXComposite * 0x037b8f28) line 117 + 9 bytes FXRbRootWindow::markfunc(FX::FXRootWindow * 0x037b8f28) line 839 + 9 bytes FXRbApp::markfunc(FX::FXApp * 0x032049a8) line 310 + 24 bytes MSVCRT-RUBY18! 1003d300() MSVCRT-RUBY18! 1003cf50() MSVCRT-RUBY18! 1003cf6e() FXRbGcMark(void * 0x032049a8) line 340 + 9 bytes FXRbId::markfunc(FX::FXId * 0x037c20b0) line 130 + 18 bytes FXRbDrawable::markfunc(FX::FXDrawable * 0x037c20b0) line 122 + 9 bytes FXRbWindow::markfunc(FX::FXWindow * 0x037c20b0) line 152 + 9 bytes FXRbComposite::markfunc(FX::FXComposite * 0x037c20b0) line 117 + 9 bytes FXRbTextField::markfunc(FX::FXTextField * 0x037c20b0) line 881 + 9 bytes Hello fxruby-users, does anybody have experience with FXRuby and multithreading? My Problem: - I populate a FXTreeList widget with items. This is done in an extra worker thread, as this task takes some minutes - In the meantime, the user can continue to work with the application. All works fine, until the user opens a modal window (e.g. a FXMessageBox). Sometimes FXRuby crashes with an acess violation in FXWindow::getShell: while((p=win->parent) && p->parent) win=p; p seems to be invalid in this situation The this-pointer seems to be ok and points to the MXMessageBox. The processed message is a WM_KILLFOCUS message FX::FXWindow::getShell() line 383 + 18 bytes FX::FXApp::dispatchEvent(void * 0x002b1b58, unsigned int 8, unsigned int 0, long 0) line 3943 + 8 bytes FX::FXApp::wndproc(void * 0x002b1b58, unsigned int 8, unsigned int 0, long 0) line 3446 USER32! InternalCallWinProc@20 + 27 bytes USER32! UserCallWinProcCheckWow@32 + 183 bytes USER32! DispatchClientMessage@20 + 77 bytes USER32! __fnDWORD@4 + 34 bytes NTDLL! KiUserCallbackDispatcher@12 + 19 bytes USER32! 77d49105() USER32! SoftModalMessageBox@4 + 1380 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutW@24 + 89 bytes USER32! SoftModalMessageBox@4 + 1380 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutW@24 + 89 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutA@24 + 111 bytes NTDLL! RtlImageDirectoryEntryToData@16 + 61 bytes 023f83dc() ruby 1.8.2 fxruby 1.2.6 regards Dirk -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse f?r Mail, Message, More +++ -- GMX DSL = Maximale Leistung zum minimalen Preis! 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl From ujb1 at gmx.de Fri Sep 2 04:27:39 2005 From: ujb1 at gmx.de (ujb1@gmx.de) Date: Mon Sep 12 11:23:21 2005 Subject: [fxruby-users] FXRuby and multithreading References: <28565.1125584464@www9.gmx.net> Message-ID: <18464.1125649659@www40.gmx.net> Hello, the problem can be reproduced with the groupbox.rbw example: - take the example file groupbox.rbw - add a GC.start in the clockThread - start the programm - Open the About dialog --> the About box shows: FOX is a really, really cool C++ library! --> Windows XP says: Access Violation at address 0x02cd05a3 I'm using Ruby 1.8.2 Best regards Dirk Hi, some more information: the error described in the last mail is a consecutive fault of another error: FXRuby crashed in FXRbWindow::markfunc: // Mark child windows register FXWindow* child=self->getFirst(); while(child!=NULL){ FXRbGcMark(child); child=child->getNext(); <------ child is 0x00000004!!!! } } The error is catched by the ruby error handler. The handler calls abort. Abort shows another message box and FXRuby crashes a second time with this box. Maybe this is a Qnil??? How does it get into the list of children? FXRbWindow::markfunc(FX::FXWindow * 0x037b8f28) line 170 + 3 bytes FXRbComposite::markfunc(FX::FXComposite * 0x037b8f28) line 117 + 9 bytes FXRbRootWindow::markfunc(FX::FXRootWindow * 0x037b8f28) line 839 + 9 bytes FXRbApp::markfunc(FX::FXApp * 0x032049a8) line 310 + 24 bytes MSVCRT-RUBY18! 1003d300() MSVCRT-RUBY18! 1003cf50() MSVCRT-RUBY18! 1003cf6e() FXRbGcMark(void * 0x032049a8) line 340 + 9 bytes FXRbId::markfunc(FX::FXId * 0x037c20b0) line 130 + 18 bytes FXRbDrawable::markfunc(FX::FXDrawable * 0x037c20b0) line 122 + 9 bytes FXRbWindow::markfunc(FX::FXWindow * 0x037c20b0) line 152 + 9 bytes FXRbComposite::markfunc(FX::FXComposite * 0x037c20b0) line 117 + 9 bytes FXRbTextField::markfunc(FX::FXTextField * 0x037c20b0) line 881 + 9 bytes Hello fxruby-users, does anybody have experience with FXRuby and multithreading? My Problem: - I populate a FXTreeList widget with items. This is done in an extra worker thread, as this task takes some minutes - In the meantime, the user can continue to work with the application. All works fine, until the user opens a modal window (e.g. a FXMessageBox). Sometimes FXRuby crashes with an acess violation in FXWindow::getShell: while((p=win->parent) && p->parent) win=p; p seems to be invalid in this situation The this-pointer seems to be ok and points to the MXMessageBox. The processed message is a WM_KILLFOCUS message FX::FXWindow::getShell() line 383 + 18 bytes FX::FXApp::dispatchEvent(void * 0x002b1b58, unsigned int 8, unsigned int 0, long 0) line 3943 + 8 bytes FX::FXApp::wndproc(void * 0x002b1b58, unsigned int 8, unsigned int 0, long 0) line 3446 USER32! InternalCallWinProc@20 + 27 bytes USER32! UserCallWinProcCheckWow@32 + 183 bytes USER32! DispatchClientMessage@20 + 77 bytes USER32! __fnDWORD@4 + 34 bytes NTDLL! KiUserCallbackDispatcher@12 + 19 bytes USER32! 77d49105() USER32! SoftModalMessageBox@4 + 1380 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutW@24 + 89 bytes USER32! SoftModalMessageBox@4 + 1380 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutW@24 + 89 bytes USER32! MessageBoxWorker@4 + 314 bytes USER32! MessageBoxTimeoutA@24 + 111 bytes NTDLL! RtlImageDirectoryEntryToData@16 + 61 bytes 023f83dc() ruby 1.8.2 fxruby 1.2.6 regards Dirk -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse f?r Mail, Message, More +++ -- GMX DSL = Maximale Leistung zum minimalen Preis! 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse f?r Mail, Message, More +++ From ggarra at advancedsl.com.ar Mon Sep 12 17:02:57 2005 From: ggarra at advancedsl.com.ar (Gonzalo Garramuno) Date: Mon Sep 12 16:55:49 2005 Subject: [fxruby-users] FXRuby and multithreading References: <28565.1125584464@www9.gmx.net> <18464.1125649659@www40.gmx.net> Message-ID: <004101c5b7dd$5cad8be0$0201a8c0@microsoft> I can confirm this bug, under FXRuby1.4.2. Under 1.2, it seems to work fine. Adding: @clockThread = Thread.new(@clockLabel) { |clockLabel| while true clockLabel.text = Time.now.strftime("%I:%M:%S %p") sleep(1) GC.start ### new addition end } will cause a segfault. This seems akin to the segfaults I've been seeing with IFMapper whenever I called the garbage collector, so the problem may be related. ----- Original Message ----- From: To: Sent: Friday, September 02, 2005 5:27 AM Subject: [fxruby-users] FXRuby and multithreading > Hello, > > the problem can be reproduced with the groupbox.rbw example: > - take the example file groupbox.rbw > - add a GC.start in the clockThread > - start the programm > - Open the About dialog > From maxim.kulkin at gmail.com Tue Sep 13 08:40:27 2005 From: maxim.kulkin at gmail.com (Maxim Kulkin) Date: Tue Sep 13 08:33:17 2005 Subject: [fxruby-users] FXScintilla.styleSetHotspot Message-ID: <5b339f6505091305404848df10@mail.gmail.com> On scintilla documentation page ( http://scintilla.sourceforge.net/ScintillaDoc.html#SCI_STYLESETHOTSPOT) there are hotspot styles mentioned (e.g. SCI_STYLESETHOTSPOT). But I couldn't find any in FXRuby 1.2.6 or in 1.4.2 versions. Am I missing something or those functions really doesn't implemented. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20050913/8dd102f5/attachment.htm From TheHaPK at yandex.ru Mon Sep 19 07:39:48 2005 From: TheHaPK at yandex.ru (HaPK) Date: Mon, 19 Sep 2005 15:39:48 +0400 (MSD) Subject: [fxruby-users] FXScintilla.getLine bug ? Message-ID: <432EA384.000002.24074@camay.yandex.ru> I'm trying to write some FXScintilla missing methods (btw, there are plenty of them) and came into this problem: some messages require output buffer to be specified as parameter. Should I reserve memory for it and how this could be accomplished. I've seen this trick in code buffer = "".ljust(size) sendMessage(XXXX, buffer, 0) But one method got me thinking : is there a bug in FXScintilla.getLine method ? # Retrieve the contents of a line. # Returns the length of the line. def getLine(line) buffer = "".ljust(line) sendMessage(2153, line, buffer) buffer end >From the code it's not obvious how it "Returns the length of the line". Moreover, "".ljust(line) seems like a bug to me: line - is the index of line in question, ljust needs size in bytes to be supplied. So, it seems to me, that this line should be as follows: buffer = "".ljust( sendMessage(2153, line, 0) ) Message 2153 (SCI_GETLINE) returns line length if buffer == 0. The question is: is this a bug or feature ? From fkchang2000 at yahoo.com Wed Sep 21 21:34:34 2005 From: fkchang2000 at yahoo.com (Forrest Chang) Date: Wed, 21 Sep 2005 18:34:34 -0700 (PDT) Subject: [fxruby-users] TkLabelFrame equivalent? Message-ID: <20050922013435.33282.qmail@web82009.mail.mud.yahoo.com> Hi All: Is there an equivalent to TkLabelFrame, i.e I want to have a frame with test at the top and a box around the contents? My scan of the API didn't reveal one to me. FOrrest From sander at knology.net Wed Sep 21 20:05:00 2005 From: sander at knology.net (Sander Jansen) Date: Wed, 21 Sep 2005 19:05:00 -0500 Subject: [fxruby-users] TkLabelFrame equivalent? In-Reply-To: <20050922013435.33282.qmail@web82009.mail.mud.yahoo.com> References: <20050922013435.33282.qmail@web82009.mail.mud.yahoo.com> Message-ID: <200509211905.00981.sander@knology.net> FXGroupBox? Sander On Wednesday 21 September 2005 08:34 pm, Forrest Chang wrote: > Hi All: > > Is there an equivalent to TkLabelFrame, i.e I want > to have a frame with test at the top and a box around > the contents? My scan of the API didn't reveal one > to me. > > FOrrest > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users From jeroen at fox-toolkit.org Wed Sep 21 23:25:42 2005 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Wed, 21 Sep 2005 22:25:42 -0500 Subject: [fxruby-users] TkLabelFrame equivalent? In-Reply-To: <20050922013435.33282.qmail@web82009.mail.mud.yahoo.com> References: <20050922013435.33282.qmail@web82009.mail.mud.yahoo.com> Message-ID: <200509212225.42598.jeroen@fox-toolkit.org> On Wednesday 21 September 2005 20:34, Forrest Chang wrote: > Hi All: > > Is there an equivalent to TkLabelFrame, i.e I want > to have a frame with test at the top and a box around > the contents? My scan of the API didn't reveal one > to me. Perhaps you mean FXGroupBox? - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 22:20 09/21/2005 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+