forked from KolibriOS/kolibrios
wword.obj src added
git-svn-id: svn://kolibrios.org@2329 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6bd8780b1a
commit
bb704ae063
4
programs/develop/libraries/wword/compile.bat
Normal file
4
programs/develop/libraries/wword/compile.bat
Normal file
@ -0,0 +1,4 @@
|
||||
del wword.obj
|
||||
fasm wword.asm
|
||||
kpack wword.obj
|
||||
pause
|
12
programs/develop/libraries/wword/readme.txt
Normal file
12
programs/develop/libraries/wword/readme.txt
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
wword.obj
|
||||
==============
|
||||
|
||||
Извлечение текста из файлов MS Word 8.0 и 9.0.
|
||||
Библиотека написана на основе программы doc2txt.
|
||||
Автор doc2txt - Иван Рощин, http://www.ivr.da.ru
|
||||
|
||||
==============
|
||||
Александр Богомаз aka Albom
|
||||
albom85@yandex.ru
|
||||
http://albom85.narod.ru
|
241
programs/develop/libraries/wword/wword.asm
Normal file
241
programs/develop/libraries/wword/wword.asm
Normal file
@ -0,0 +1,241 @@
|
||||
|
||||
format MS COFF
|
||||
|
||||
public EXPORTS
|
||||
|
||||
section '.flat' code readable writable align 16
|
||||
|
||||
|
||||
version:
|
||||
mov eax, 10
|
||||
ret
|
||||
|
||||
; int __stdcall convert (const char filename[], char buffer[], int mode)
|
||||
convert:
|
||||
|
||||
mov eax, [esp+4]
|
||||
mov dword [filename], eax
|
||||
mov eax, [esp+8]
|
||||
mov dword [buffer], eax
|
||||
mov eax, [esp+12]
|
||||
mov dword [mode], eax
|
||||
|
||||
pushad
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 11
|
||||
int 0x40
|
||||
|
||||
mov dword [file_in], 5
|
||||
mov dword [file_in+4], 0
|
||||
mov dword [file_in+8], 0
|
||||
mov dword [file_in+12], 0
|
||||
mov dword [file_in+16], bdvk
|
||||
mov byte [file_in+20], 0
|
||||
mov eax, [filename]
|
||||
mov dword [file_in+21], eax
|
||||
|
||||
mov eax, 70
|
||||
mov ebx, file_in
|
||||
int 0x40
|
||||
|
||||
mov dword eax, [bdvk+32]
|
||||
mov dword [buf_len], eax
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 12
|
||||
mov ecx, [buf_len]
|
||||
int 0x40
|
||||
|
||||
mov [buf], eax
|
||||
|
||||
cmp eax, 0
|
||||
jne _mem_ok
|
||||
|
||||
popad
|
||||
mov eax, -1
|
||||
ret 12
|
||||
|
||||
_mem_ok:
|
||||
mov dword [file_in], 0
|
||||
mov dword [file_in+4], 0x600
|
||||
mov dword [file_in+8], 0
|
||||
mov eax, [buf_len]
|
||||
sub eax, 0x600
|
||||
mov [buf_len], eax
|
||||
mov dword [file_in+12], eax
|
||||
mov eax, [buf]
|
||||
mov dword [file_in+16], eax
|
||||
mov byte [file_in+20], 0
|
||||
mov eax, [filename]
|
||||
mov dword [file_in+21], eax
|
||||
|
||||
mov eax, 70
|
||||
mov ebx, file_in
|
||||
int 0x40
|
||||
|
||||
call translate
|
||||
|
||||
mov eax, 68
|
||||
mov ebx, 13
|
||||
mov ecx, [buf]
|
||||
int 0x40
|
||||
|
||||
popad
|
||||
|
||||
mov eax, [result]
|
||||
ret 12
|
||||
|
||||
translate:
|
||||
pushad
|
||||
|
||||
xor ebx, ebx
|
||||
mov [result], 0
|
||||
|
||||
mov ecx, [buf] ; ¢å®¤®© ¡ãä¥à
|
||||
mov edx, [buffer] ; ¢ë室®© ¡ãä¥à
|
||||
|
||||
_translate_loop:
|
||||
|
||||
|
||||
cmp ebx, [buf_len]
|
||||
je _translate_end
|
||||
|
||||
mov byte al, [ecx]
|
||||
inc ecx
|
||||
inc ebx
|
||||
mov byte ah, [ecx]
|
||||
|
||||
cmp ah, 0
|
||||
jne _translate_next1
|
||||
|
||||
cmp al, 0
|
||||
je _translate_end
|
||||
|
||||
cmp al, 13
|
||||
jne _translate_no13
|
||||
|
||||
mov byte [edx], 0x0d
|
||||
inc edx
|
||||
mov byte [edx], 0x0a
|
||||
inc edx
|
||||
mov byte [edx], 32
|
||||
inc edx
|
||||
mov byte [edx], 32
|
||||
inc edx
|
||||
mov byte [edx], 32
|
||||
inc edx
|
||||
mov al, 32
|
||||
jmp _translate_copy
|
||||
|
||||
_translate_no13:
|
||||
|
||||
cmp al, 0x1f
|
||||
jg _translate_eng_1
|
||||
|
||||
inc ecx
|
||||
inc ebx
|
||||
jmp _translate_loop
|
||||
|
||||
_translate_eng_1:
|
||||
|
||||
cmp al, 0x7f
|
||||
jle _translate_eng_2
|
||||
|
||||
inc ecx
|
||||
inc ebx
|
||||
jmp _translate_loop
|
||||
|
||||
_translate_eng_2:
|
||||
jmp _translate_copy
|
||||
|
||||
_translate_next1:
|
||||
|
||||
cmp ah, 4
|
||||
jne _translate_next2
|
||||
|
||||
cmp al, 0x2f
|
||||
jb _translate_rus_s
|
||||
|
||||
and eax, 0xff
|
||||
add eax, rus_big
|
||||
sub eax, 0x10
|
||||
|
||||
mov al, [eax]
|
||||
|
||||
jmp _translate_copy
|
||||
|
||||
_translate_rus_s:
|
||||
and eax, 0xff
|
||||
add eax, rus_small
|
||||
sub eax, 0x30
|
||||
|
||||
mov al, [eax]
|
||||
|
||||
jmp _translate_copy
|
||||
|
||||
|
||||
_translate_next2:
|
||||
cmp ah, 0x20
|
||||
jne _translate_next3
|
||||
|
||||
_translate_next3:
|
||||
|
||||
_translate_copy:
|
||||
mov byte [edx], al
|
||||
|
||||
inc ecx
|
||||
inc edx
|
||||
inc ebx
|
||||
inc [result]
|
||||
|
||||
jmp _translate_loop
|
||||
|
||||
_translate_end:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
|
||||
align 16
|
||||
EXPORTS:
|
||||
dd szVersion, version
|
||||
dd szConvert, convert
|
||||
dd 0, 0
|
||||
|
||||
szVersion db 'version',0
|
||||
szConvert db 'convert',0
|
||||
|
||||
buf dd 0
|
||||
buf_len dd 0
|
||||
result dd 0
|
||||
|
||||
mode dd 0
|
||||
buffer dd 0
|
||||
filename dd 0
|
||||
|
||||
rus_big db '€<>‚ƒ„…†‡ˆ‰Š‹Œ<E280B9>Ž<EFBFBD><C5BD>‘’“”•–—˜™š›œ<E280BA>žŸ'
|
||||
rus_small db ' ¡¢£¤¥¦§¨©ª«¬®¯àáâãäåæçèéêëìíîï'
|
||||
|
||||
section '.data' data readable writable align 16
|
||||
|
||||
file_in rd 1
|
||||
rd 1
|
||||
rd 1
|
||||
rd 1
|
||||
rd 1
|
||||
rb 1
|
||||
rd 1
|
||||
|
||||
bdvk rd 1
|
||||
rb 1
|
||||
rb 3
|
||||
rb 4
|
||||
rb 4
|
||||
rb 4
|
||||
rb 4
|
||||
rb 4
|
||||
rb 4
|
||||
rd 1
|
||||
rd 1
|
||||
|
9
programs/develop/libraries/wword/wword.h
Normal file
9
programs/develop/libraries/wword/wword.h
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
// Версия. 10 означает 0.1 (100 - 1.0, ...)
|
||||
int version();
|
||||
|
||||
// filename - полный путь к доку
|
||||
// buffer - буфер, должет быть не меньше размера дока
|
||||
// mode - режим, пока не реализовано, указывать 0
|
||||
// возвращаемое значение - число байт, записанных в буфер
|
||||
int __stdcall convert (const char filename[], char buffer[], int mode);
|
Loading…
Reference in New Issue
Block a user