home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!convex!convex!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!news.funet.fi!funic!nntp.hut.fi!cs.hut.fi!aleskine
- From: aleskine@cs.hut.fi (Arto Leskinen)
- Subject: reading multibyte chars
- Message-ID: <ALESKINE.93Jan23204652@cardhu.cs.hut.fi>
- Lines: 43
- Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
- Nntp-Posting-Host: cardhu.cs.hut.fi
- Organization: Helsinki University of Technology, Finland
- Distribution: comp.sys.mac.programmer
- Date: Sat, 23 Jan 1993 18:47:03 GMT
- Lines: 43
-
- I have following code for eventloop (important parts)
- do {
- SystemTask ();
- mTIdle( NULL );
- if (GetNextEvent (everyEvent, &event))
- {
- switch (event.what) {
- case keyDown:
- doKeyDown(&event);
- break;
- ...
- }
- }
- } while (..);
- and following in the part where i read characters. But this does not work
- with 2 byte chars. I only get one keydown event for 2 byte chars.
- ...
- switch (CharByte(&c,0)) {
- case smFirstByte: /*First byte of multi byte char*/
- doubleByte[0] = c;
- break;
- case smLastByte: /*Last byte of multi byte char*/
- doubleByte[1] = c;
- addChars(mTRecH, doubleByte,2); /*Changes currChar, charsTotal */
- line = (*mTRecH)->currLine;
- calcLines(mTRecH, line);
- drawLines(mTRecH, line); /* Changes lineStarts, currLine */
- mTCalcCaretVPos(mTRecH); /* Puts the selRect into new place */
- break;
- case smSingleByte: /*Single byte char*/
- addChar(mTRecH, c);
- line = (*mTRecH)->currLine;
- calcLines(mTRecH, line);
- drawLines(mTRecH, line); /* Changes lineStarts, currLine */
- mTCalcCaretVPos(mTRecH); /* Puts the selRect into new place */
- }
- What is wrong here? addChar does like it sounds, calcLines updates linestart
- array, drawlines draws current and following lines and mtCalcCaretVPos keeps
- track of carets place.
- I would love to hear any ideas. Thank you.
- Arto Leskinen.
- aleskine@cs.hut.fi
-
-