Brent, I think the growTo: addition is good.
In using replaceFrom: position+1 to: position + n with: aCollection startingAt: 1, I think you're fixing the wrong thing - you're working around the real culprit, which is that Text>>replaceFrom:to:with: does copying, which is quite contrary to other implementations of the same selector.
Also, I don't understand the reasoning in removing the test Tim left there - (aCollection isMemberOf: String) not ifTrue: [^ super nextPutAll: aCollection].
Daniel
< Brought to you by the BugFixArchiveViewer and CommentNotePad >
Over the last week or so I've been working on an enhanced serial port class that allows one to alter serial port attributes on the fly, access rs232c pin information, plus invoke all sorts of extended commands, abuse the unix termios and ioctl interface, and the macintosh device control call.
This all seems to work on os-x, untested on (linux/freebsd/openbsd), mostly working on os-9, unsupported on windows (until a primitive or few is written and some smalltalk glue code created).
Right now I'm looking for a few folks who really want serial support on os-x or enhanced support on *nix* boxes.
If you match those expectations please email me for the changeset, and the os9/osx plugins
I'll note the *nix* version requires one to compile a external plugin for your *nix* environment so you should be comfortable with building VMs.
The windows flavour requires a windows programmer to dig in and build the glue code and the minimal plugin, so that one can set for example the baudRate on an open port, or determine if the CTS pin is high.
A bit more testing and I'll send to the havesters for general release.
-- ======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===
Oops forgot to mention the 25 SUnit based tests to confirm (somewhat) that things are working. Yes very useful in debugging across platforms.
On Wednesday, June 4, 2003, at 05:03 PM, John M McIntosh wrote:
Over the last week or so I've been working on an enhanced serial port class
--
======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===
On 04/06/03 21:03, "John M McIntosh" johnmci@smalltalkconsulting.com wrote:
Over the last week or so I've been working on an enhanced serial port class that allows one to alter serial port attributes on the fly, access rs232c pin information, plus invoke all sorts of extended commands, abuse the unix termios and ioctl interface, and the macintosh device control call.
John, I just curious if your code work for USB ports. Actual Macs not longer have RS422 / 232 ports.
Cheers. Edgar
On Thursday 05 June 2003 02:23 am, Lic. Edgar J. De Cleene wrote:
On 04/06/03 21:03, "John M McIntosh" johnmci@smalltalkconsulting.com
wrote:
Over the last week or so I've been working on an enhanced serial port class that allows one to alter serial port attributes on the fly, access rs232c pin information, plus invoke all sorts of extended commands, abuse the unix termios and ioctl interface, and the macintosh device control call.
John, I just curious if your code work for USB ports. Actual Macs not longer have RS422 / 232 ports.
This actually was the main reason for John's new work. Dan and I both needed to support USB serial dongles under OS/X and Linux.
He's doing great work, but unfortunately I haven't had time to look at it.
On 05/06/03 11:10, "Ned Konz" ned@bike-nomad.com wrote:
On Thursday 05 June 2003 02:23 am, Lic. Edgar J. De Cleene wrote:
On 04/06/03 21:03, "John M McIntosh" johnmci@smalltalkconsulting.com
wrote:
Over the last week or so I've been working on an enhanced serial port class that allows one to alter serial port attributes on the fly, access rs232c pin information, plus invoke all sorts of extended commands, abuse the unix termios and ioctl interface, and the macintosh device control call.
John, I just curious if your code work for USB ports. Actual Macs not longer have RS422 / 232 ports.
This actually was the main reason for John's new work. Dan and I both needed to support USB serial dongles under OS/X and Linux.
He's doing great work, but unfortunately I haven't had time to look at it.
-- Ned Konz
Very thanks to all !!!
Attached is the changeset for the extended serial port support and SUnit.
Unix users should be able to build a plugin and run with it. Note that I've not coded up a method on the unix side that builds the list of serial path names. Right now it has /dev/modem as the only hard coded device. That needs a bit of work from some unix aware folks.
Mac users can email me for the plugins for os-x and os-9 support.
Window users need someone to build a plugin.
Over the last week or so I've been working on an enhanced serial port class that allows one to alter serial port attributes on the fly, access rs232c pin information, plus invoke all sorts of extended commands, abuse the unix termios and ioctl interface, and the macintosh device control call
======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===
EnhancedSerialPorts-JMM.11.cs.gz attached
Change to serialportextended plugin to return 32bit positive integers for read/write number of bytes, versus a SmallInteger to avoid issues with reading/writting billions of bytes.
Adds Weak support to SerialPortExtended class so instances that are GCed now will close the port. Before this you could loose them on a GC event if you didn't have anymore strong references, which could mean you could loose the ability to access the port since it could be hung open, which would require you to restart Squeak to recover.
{As usual it was painful to add this registry logic, because it's a bit tricky}
======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===
Well I've not confirmation of that. However I ask the IOKit for the serial device drivers and their paths. With that I get back
/dev/tty.IrDA-IrCOMMch-b /dev/tty.modem
Then we issue open(), read(), write(), ioctl(), tcsetattr() etc on the file descriptor.
Therefore if your USB emulates a serial device then it should be supported. I've not looked but I think the modem in the powerbook is really a USB device? No?
Right now my testing has been limited to the powerbook internal modem (osx), an 8600 (osx & os9) which has real rs422 ports that I used to talk to an rs232 port on a intel box via a null modem, also to a standalone 28.8kb modem.
On Thursday, June 5, 2003, at 02:23 AM, Lic. Edgar J. De Cleene wrote:
On 04/06/03 21:03, "John M McIntosh" johnmci@smalltalkconsulting.com wrote:
Over the last week or so I've been working on an enhanced serial port class that allows one to alter serial port attributes on the fly, access rs232c pin information, plus invoke all sorts of extended commands, abuse the unix termios and ioctl interface, and the macintosh device control call.
John, I just curious if your code work for USB ports. Actual Macs not longer have RS422 / 232 ports.
Cheers. Edgar
-- ======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===
danielv@netvision.net.il wrote_
Brent, I think the growTo: addition is good.
Well, I took part in that work and now I have really really to write you an answer. I apologize that I need two .
In using replaceFrom: position+1 to: position + n with: aCollection startingAt: 1, I think you're fixing the wrong thing - you're working around the real culprit, which is that Text>>replaceFrom:to:with: does copying, which is quite contrary to other implementations of the same selector.
SequenceableCollection>>replaceFrom:to:with: delegates to the modifying method replaceFrom:to:with:startingAt:, and Text does not do that. There are no other implementors of replaceFrom:to:with: in the standard 3.4 image.
Text has also an in-place replacement method. It is replaceFrom: start to: stop with: replacement startingAt: repStart
This method was added a year ago by tk, in change set #4879, which in turn was an addition to change set #4872 that improved WriteStream>>pastEndPut. (better growing )
Also, I don't understand the reasoning in removing the test Tim left there - (aCollection isMemberOf: String) not ifTrue: [^ super nextPutAll: aCollection].
And I do not understand why it is present at all. aCollection is typically an instance of Text, and this statement sends adding to one of the superclasses - to either WriteStream or Stream. WriteStream>>nextPutAll: does the work when there is enough room left in the stream collection; otherwise, the work is further delegated to Stream, which does element-wise adding.
When a Collection is really a String, it would be converted into a Text in Text>>replaceFrom:to:with:
The original method
nextPutAll: aCollection "Optimized access to get around Text at:Put: overhead" | n | n _ aCollection size. ((aCollection isMemberOf: String) not or: [position + n > writeLimit]) ifTrue: [^ super nextPutAll: aCollection]. collection string replaceFrom: position+1 to: position + n with: aCollection startingAt: 1. position _ position + n
handles strings in a very strange way: When there is enough free space in the string, it adds to the string of the text, but not also to the runs. This works because instances of Text are always created with a run that contains a default text attribute. ----------------------------------------------------
While I write this, I remember that I found a third place, where the method growTo: allows the use of string replacement: It is in WriteStream:
next: anInteger putAll: aCollection startingAt: startIndex "Store the next anInteger elements from the given collection."
| newEnd | collection class == aCollection class ifFalse: [^ super next: anInteger putAll: aCollection startingAt: startIndex].
newEnd _ position + anInteger. newEnd > writeLimit ifTrue: [self growTo: newEnd + 10].
collection replaceFrom: position+1 to: newEnd with: aCollection startingAt: startIndex. position _ newEnd.
^aCollection
Currently WriteStream does not implement this method, it inherits a method with this name from PositionableStream.
Daniel
Greetings, Boris
this has been super-somthingsd ( anyone know how to spell "superseeded" correctly? I'd guess that it isn't related to "to seed" but more something latin -- "super cedere" lets see, hmm, dictionary?, yes: cedo, cessi, cessum "to walk". thus superceded, hmm... guess it was morphed to be written superseded anyways... lets ask the democratic dictionary (http://www.teco.edu/~cdecker/cgi-bin/demodict/demodict.html):
superceded: 108,000 superseded: 473,000 superseeded: 21,000
;-) ).
([closed]).
< I'm a bug-fixing machine! >
This post brought to you by the BugFixArchiveViewer, a handy tool that makes it easy to comment on proposed fixes and enhancements for Squeak. For more information, check out the Web page for the BugFixArchiveViewer project: http://minnow.cc.gatech.edu/squeak/3214
< I'm a bug-fixing machine! >
squeak-dev@lists.squeakfoundation.org