Rev 5363 | Rev 6462 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5363 | Rev 6262 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line -... | ||
7 | - | ||
8 | ;------------------------------------------------------------------------- |
- | |
9 | ; |
- | |
10 | ; File path partial substitution (according to configuration) |
- | |
11 | ; |
- | |
12 | ; |
- | |
13 | ; SPraid |
- | |
14 | ; |
- | |
15 | ;------------------------------------------------------------------------- |
- | |
16 | 7 | ||
Line 17... | Line 8... | ||
17 | $Revision: 5363 $ |
8 | $Revision: 6262 $ |
18 | 9 | ||
19 | 10 | ||
Line 243... | Line 234... | ||
243 | ; name is too long |
234 | ; name is too long |
244 | add esp, 64 |
235 | add esp, 64 |
245 | stc |
236 | stc |
246 | ret |
237 | ret |
247 | endp=> |
238 | endp |
- | 239 | ||
- | 240 | ||
- | 241 | char_todown: |
|
- | 242 | ; convert character in al to downcase, using cp866 encoding |
|
- | 243 | cmp al, 'A' |
|
- | 244 | jb .ret |
|
- | 245 | cmp al, 'Z' |
|
- | 246 | jbe .az |
|
- | 247 | cmp al, 0x80 ; 'А' |
|
- | 248 | jb .ret |
|
- | 249 | cmp al, 0x90 ; 'Р' |
|
- | 250 | jb .rus |
|
- | 251 | cmp al, 0xF0 ; 'Ё' |
|
- | 252 | jz .yo |
|
- | 253 | cmp al, 0x9F ; 'Я' |
|
- | 254 | ja .ret |
|
- | 255 | ; 0x90-0x9F -> 0xE0-0xEF |
|
- | 256 | add al, 0xE0-0x90 |
|
- | 257 | .ret: |
|
- | 258 | ret |
|
- | 259 | ||
- | 260 | .az: |
|
- | 261 | .rus: ; 0x80-0x8F -> 0xA0-0xAF |
|
- | 262 | add al, 0x20 |
|
- | 263 | ret |
|
- | 264 | ||
- | 265 | .yo: |
|
- | 266 | inc al |
|
- | 267 | ret |
|
- | 268 | ||
- | 269 | ||
- | 270 | char_toupper: |
|
- | 271 | ; convert character in al to uppercase, using cp866 encoding |
|
- | 272 | cmp al, 'a' |
|
- | 273 | jb .ret |
|
- | 274 | cmp al, 'z' |
|
- | 275 | jbe .az |
|
- | 276 | cmp al, 0xA0 ; 'а' |
|
- | 277 | jb .ret |
|
- | 278 | cmp al, 0xE0 ; 'р' |
|
- | 279 | jb .rus |
|
- | 280 | cmp al, 0xF1 ; 'ё' |
|
- | 281 | jz .yo |
|
- | 282 | cmp al, 0xEF ; 'я' |
|
- | 283 | ja .ret |
|
- | 284 | ; 0xE0-0xEF -> 0x90-0x9F |
|
- | 285 | sub al, 0xE0-0x90 |
|
- | 286 | .ret: |
|
- | 287 | ret |
|
- | 288 | ||
- | 289 | .az: |
|
- | 290 | .rus: ; 0xA0-0xAF -> 0x80-0x8F |
|
- | 291 | and al, not 0x20 |
|
- | 292 | ret |
|
- | 293 | ||
- | 294 | .yo: |
|
- | 295 | dec al |
|
- | 296 | ret |
|
- | 297 | ||
- | 298 | ||
- | 299 | uni2ansi_str: |
|
- | 300 | ; convert UNICODE zero-terminated string to ASCII-string (codepage 866) |
|
- | 301 | ; in: esi->source, edi->buffer (may be esi=edi) |
|
- | 302 | ; destroys: eax,esi,edi |
|
- | 303 | lodsw |
|
- | 304 | call uni2ansi_char |
|
- | 305 | stosb |
|
- | 306 | test al, al |
|
- | 307 | jnz uni2ansi_str |
|
- | 308 | ret |
|
- | 309 | ||
- | 310 | ||
- | 311 | uni2ansi_char: |
|
- | 312 | ; convert UNICODE character in ax to ANSI character in al using cp866 encoding |
|
- | 313 | cmp ax, 0x80 |
|
- | 314 | jb .ret |
|
- | 315 | cmp ax, 0xB6 |
|
- | 316 | jz .B6 |
|
- | 317 | cmp ax, 0x400 |
|
- | 318 | jb .unk |
|
- | 319 | cmp ax, 0x410 |
|
- | 320 | jb @f |
|
- | 321 | cmp ax, 0x440 |
|
- | 322 | jb .rus1 |
|
- | 323 | cmp ax, 0x450 |
|
- | 324 | jb .rus2 |
|
- | 325 | cmp ax, 0x460 |
|
- | 326 | jb @f |
|
- | 327 | .unk: |
|
- | 328 | mov al, '_' |
|
- | 329 | .ret: |
|
- | 330 | ret |
|
- | 331 | ||
- | 332 | .B6: |
|
- | 333 | mov al, 20 |
|
- | 334 | ret |
|
- | 335 | ||
- | 336 | .rus1: ; 0x410-0x43F -> 0x80-0xAF |
|
- | 337 | add al, 0x70 |
|
- | 338 | ret |
|
- | 339 | ||
- | 340 | .rus2: ; 0x440-0x44F -> 0xE0-0xEF |
|
- | 341 | add al, 0xA0 |
|
- | 342 | ret |
|
- | 343 | ||
- | 344 | @@: |
|
- | 345 | push ecx edi |
|
- | 346 | mov ecx, 8 |
|
- | 347 | mov edi, .table |
|
- | 348 | repnz scasb |
|
- | 349 | mov ah, cl |
|
- | 350 | pop edi ecx |
|
- | 351 | jnz .unk |
|
- | 352 | mov al, 0xF7 |
|
- | 353 | sub al, ah |
|
- | 354 | ret |
|
- | 355 | ||
- | 356 | .table db 1, 51h, 4, 54h, 7, 57h, 0Eh, 5Eh |
|
- | 357 | ||
- | 358 | ||
- | 359 | ansi2uni_char: |
|
- | 360 | ; convert ANSI character in al to UNICODE character in ax, using cp866 encoding |
|
- | 361 | movzx eax, al |
|
- | 362 | cmp al, 0x80 |
|
- | 363 | jb @f ; 0x00-0x7F - trivial map |
|
- | 364 | cmp al, 0xB0 |
|
- | 365 | jb .rus ; 0x80-0xAF -> 0x410-0x43F |
|
- | 366 | cmp al, 0xE0 |
|
- | 367 | jb .unk |
|
- | 368 | cmp al, 0xF0 |
|
- | 369 | jb .rus2 ; 0xE0-0xEF -> 0x440-0x44F |
|
- | 370 | cmp al, 0xF8 |
|
- | 371 | jnc .unk |
|
- | 372 | mov al, [eax+uni2ansi_char.table-0xF0] |
|
- | 373 | add ax, 400h |
|
- | 374 | ret |
|
- | 375 | ||
- | 376 | @@: |
|
- | 377 | cmp al, 20 |
|
- | 378 | jnz .ret |
|
- | 379 | mov al, 0xB6 |
|
- | 380 | .ret: |
|
- | 381 | ret |
|
- | 382 | ||
- | 383 | .rus: |
|
- | 384 | add ax, 0x410-0x80 |
|
- | 385 | ret |
|
- | 386 | ||
- | 387 | .rus2: |
|
- | 388 | add ax, 0x440-0xE0 |
|
- | 389 | ret |
|
- | 390 | ||
- | 391 | .unk: |
|
- | 392 | mov al, '_' |
|
- | 393 | ret=> |