Updated: 11/5/2005; 6:02:20 PM.
Chris Double's Radio Weblog
        

Saturday, August 03, 2002

One reason I'm using Ficl as my Forth on the 9210 is it's great support for wrapping C structures. In this case I'm wrapping Symbian C++ classes but it works the same. This allows me to create and manipulate C++ classes from Forth, on the phone itself. Any Lisp I get going on the phone is definitely going to have the same facility, it's so useful.
11:36:30 PM      

[I've found a better way of getting the data from the clipboard. Use the following code instead of that described below:

CPlainText* ptext = CPlainText::NewL(); 
ptext->PasteFromStoreL(cb->Store(), cb->StreamDictionary(), 0); 
TUint16 *buffer = new TUint16[ptext->DocumentLength()]; 
TPtr16 *text = new TPtr16(buffer, ptext->DocumentLength()); 
ptext->Extract(*text);
]

I spent hours on Friday night working out how to get plain text out of the Nokia 9210 clipboard (Symbian OS) using C++. I couldn't find documentation anywhere on how to do it. There were examples of how to read data from the clipboard, but nothing on what 'id' was used for the plain text clipboard data other applications used, and what format the data is held in on the clipboard. Very painful.

For future reference, the TStreamId is KClipboardUidTypePlainText:

TStreamId id = (cb->StreamDictionary()).At(KClipboardUidTypePlainText);

The data is stored in the stream with the length as a TInt32, followed by the string data as array of TUint8. Example code:

RStoreReadStream stream; 
stream.OpenL(cb->Store(), id); 
TUint32 len = stream.ReadUint32L(); 
TUint8 *buffer = new TUint8[len]; 
Ptr8 text(buffer, len, len); 
stream.ReadL(text, len);

I'm using this from Forth (Ficl) on the 9210 to enable to write forth code in the Nokia 9210 Word application, copy it and immediately execute it from the Forth application. Eventually I won't have to deal with C++ on the Nokia at all and just use Forth or Goo or Common Lisp on-board.


11:32:23 PM      

Chris Armstrong has a Goo Tutorial in progress.
11:23:22 PM      

Read only access to the Goo CVS is available.
11:22:29 PM      

© Copyright 2005 Chris Double.
 
August 2002
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Jul   Sep



Click here to visit the Radio UserLand website.

Listed on BlogShares

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.