Hi folks,
when writing a plugin in Slang I encountered two problems wrt platform specifics: 1) convert a squeak pathname to a platform pathname: * my plugin links to a library that expects a platform file path * must convert from Squeak path (char encoding etc.) * sqFilenameFromString() should do this * PROBLEM: this does not work in an external plugin * because it is just a macro pointing to some platform-code function that would have to be linked to the external plugin * PROPOSAL: provide an ioFilenameFromString() function exported from the VM * looked up by plugin via interpreterProxy->ioLoadFunctionFrom ("ioFilenameFromString", "") * could trivially be implemented by using sqFilenameFromString macro? 2) endianness: * I need to know the current platform's endianness * because the linked library provides 8 bit bitmap data in platform order * and I want to adjust the Squeak form from the plugin (set depth to -8 on little-endian machine) * PROBLEM: which function/macro to use? * there seem to be several: - LSB_FIRST used in B3DAcceleratorPlugin.c - MSB_FIRST used in sqWin32Window.c - WORDS_BIGENDIAN defined on Mac OS and Unix - is this the one? thanks, - Bert - |
On 25-Nov-05, at 3:47 AM, Bert Freudenberg wrote: > Hi folks, > > when writing a plugin in Slang I encountered two problems wrt > platform specifics: > > 1) convert a squeak pathname to a platform pathname: > > * my plugin links to a library that expects a platform file path > * must convert from Squeak path (char encoding etc.) > * sqFilenameFromString() should do this > > * PROBLEM: this does not work in an external plugin > * because it is just a macro pointing to some platform-code > function that would have to be linked to the external plugin > > * PROPOSAL: provide an ioFilenameFromString() function exported > from the VM > * looked up by plugin via interpreterProxy->ioLoadFunctionFrom > ("ioFilenameFromString", "") > * could trivially be implemented by using sqFilenameFromString macro? This would be good, since the sqFilenameFromString is responsible (if in fact it does on all platforms) to translate from squeak file name encoding to platform character set dependent encoding. -- ======================================================================== === John M. McIntosh <[hidden email]> 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== === |
On 25-Nov-05, at 10:43 AM, John M McIntosh wrote: > > On 25-Nov-05, at 3:47 AM, Bert Freudenberg wrote: > >> Hi folks, >> >> when writing a plugin in Slang I encountered two problems wrt >> platform specifics: >> >> 1) convert a squeak pathname to a platform pathname: >> >> * my plugin links to a library that expects a platform file path >> * must convert from Squeak path (char encoding etc.) >> * sqFilenameFromString() should do this >> >> * PROBLEM: this does not work in an external plugin >> * because it is just a macro pointing to some platform-code >> function that would have to be linked to the external plugin It took me enough effort just to get the macro incorporated many years ago. On RISC OS the macro points to a nice function that has to do a full canonicalisation proces to get the OS to work out the proper filename. From recent discussions with John it sounds like Apple desperately need to provide a similar OS call to save application writers from losing all their hair. >> >> * PROPOSAL: provide an ioFilenameFromString() function exported >> from the VM >> * looked up by plugin via interpreterProxy->ioLoadFunctionFrom >> ("ioFilenameFromString", "") >> * could trivially be implemented by using sqFilenameFromString >> macro? > > This would be good, since the sqFilenameFromString is responsible > (if in fact it does on all platforms) to translate from squeak file > name encoding > to platform character set dependent encoding. don't hold you breath. Blue is such an ugly colour for a human face. Of course if this is a Sophie critical thing it can be done much sooner. Likewise the endian stuff. tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim |
Free forum by Nabble | Edit this page |