Changeset 125:8b6d038b7f79
- Timestamp:
- 02/11/08 20:23:29
(1 year ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
uncommented getCodePage for compatibility and made the parse statemachine work only with ascii to ensure proper parsing.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r108 |
r125 |
|
| 179 | 179 | auto newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| 180 | 180 | auto oldFont = OS.SelectObject (hDC, newFont); |
|---|
| 181 | | TCHAR[] buffer = StrToTCHARs (/+getCodePage (),+/ parse (text)); |
|---|
| | 181 | TCHAR[] buffer = StrToTCHARs (getCodePage (), parse (text)); |
|---|
| 182 | 182 | RECT rect; |
|---|
| 183 | 183 | int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX; |
|---|
| … | … | |
| 411 | 411 | int index = 0, state = 0, linkIndex = 0; |
|---|
| 412 | 412 | int start = 0, tagStart = 0, linkStart = 0, endtagStart = 0, refStart = 0; |
|---|
| | 413 | |
|---|
| 413 | 414 | while (index < length_) { |
|---|
| 414 | | char c = CharacterToLower (buffer [index]); |
|---|
| | 415 | |
|---|
| | 416 | // instead Character.toLower |
|---|
| | 417 | // only needed for the control symbols, which are always ascii |
|---|
| | 418 | char c = buffer[index]; |
|---|
| | 419 | if( c >= 'A' && c <= 'Z' ){ |
|---|
| | 420 | c -= ( 'A' - 'a' ); |
|---|
| | 421 | } |
|---|
| | 422 | |
|---|
| | 423 | // only simple ascii whitespace needed |
|---|
| | 424 | bool isWhitespace(char w ){ |
|---|
| | 425 | switch(w){ |
|---|
| | 426 | case ' ': return true; |
|---|
| | 427 | default : return false; |
|---|
| | 428 | } |
|---|
| | 429 | } |
|---|
| | 430 | |
|---|
| 415 | 431 | switch (state) { |
|---|
| 416 | 432 | case 0: |
|---|
| … | … | |
| 433 | 449 | break; |
|---|
| 434 | 450 | default: |
|---|
| 435 | | if (CharacterIsWhitespace(c)) break; |
|---|
| | 451 | if (isWhitespace(c)) break; |
|---|
| 436 | 452 | else state = 13; |
|---|
| 437 | 453 | } |
|---|
| … | … | |
| 492 | 508 | break; |
|---|
| 493 | 509 | case 13: |
|---|
| 494 | | if (CharacterIsWhitespace (c)) { |
|---|
| | 510 | if (isWhitespace (c)) { |
|---|
| 495 | 511 | state = 0; |
|---|
| 496 | 512 | } else if (c is '='){ |
|---|
| … | … | |
| 625 | 641 | */ |
|---|
| 626 | 642 | if (string.length is 0) string = " "; //$NON-NLS-1$ |
|---|
| 627 | | TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); |
|---|
| | 643 | TCHAR* buffer = StrToTCHARz (getCodePage (), string); |
|---|
| 628 | 644 | OS.SetWindowText (handle, buffer); |
|---|
| 629 | 645 | parse (text); |
|---|