From e0615bc76274e1709e3ca2aa06f3a0271bcebebb Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 4 Oct 2018 17:53:33 +0000 Subject: [PATCH] Rtfread: - remove outdated unused code - use built-in font instead of a file in /fonts/ folder git-svn-id: svn://kolibrios.org@7433 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 1 - programs/cmm/examples/Tupfile.lua | 2 + programs/cmm/examples/info.c | 52 ++ programs/cmm/examples/pig.c | 25 + programs/cmm/lib/patterns/restart_process.h | 2 +- programs/other/rtfread/trunk/ascl.inc | 819 -------------------- programs/other/rtfread/trunk/bgifont.inc | 120 +-- programs/other/rtfread/trunk/litt.chr | Bin 0 -> 3982 bytes programs/other/rtfread/trunk/rtfread.asm | 56 +- 9 files changed, 109 insertions(+), 968 deletions(-) create mode 100644 programs/cmm/examples/info.c create mode 100644 programs/cmm/examples/pig.c delete mode 100644 programs/other/rtfread/trunk/ascl.inc create mode 100644 programs/other/rtfread/trunk/litt.chr diff --git a/data/Tupfile.lua b/data/Tupfile.lua index d8ac7c73af..169b614e67 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -38,7 +38,6 @@ img_files = { {"File Managers/FNAV/FNAV_CUR.PNG", "common/File Managers/fNav/fnav_cur.png"}, {"File Managers/FNAV/FNAV_FNT.PNG", "common/File Managers/fNav/fnav_fnt.png"}, {"File Managers/FNAV/FNAV_ICN.PNG", "common/File Managers/fNav/fnav_icn.png"}, - {"FONTS/LITT.CHR", PROGS .. "/demos/bgitest/trunk/FONTS/LITT.CHR"}, {"FONTS/TAHOMA.KF", "common/fonts/tahoma.kf"}, {"LIB/ICONV.OBJ", "common/lib/iconv.obj"}, {"LIB/KMENU.OBJ", "common/lib/kmenu.obj"}, diff --git a/programs/cmm/examples/Tupfile.lua b/programs/cmm/examples/Tupfile.lua index 65b13ccf1c..877ec702f4 100644 --- a/programs/cmm/examples/Tupfile.lua +++ b/programs/cmm/examples/Tupfile.lua @@ -8,3 +8,5 @@ tup.rule("collections.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("K tup.rule("menu.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "menu.com") tup.rule("rgb.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "rgb.com") tup.rule("console.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "console.com") +tup.rule("info.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "info.com") +tup.rule("pig.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "pig.com") diff --git a/programs/cmm/examples/info.c b/programs/cmm/examples/info.c new file mode 100644 index 0000000000..2919f5e72e --- /dev/null +++ b/programs/cmm/examples/info.c @@ -0,0 +1,52 @@ +/* + * Template C-- program. +*/ + +#define MEMSIZE 4096*15 + +#include "../lib/io.h" +#include "../lib/gui.h" + +#define WIN_W 12*10+30 +#define WIN_H 80 + +void main() +{ + word btn; + loop() switch(WaitEvent()) + { + case evButton: + btn = GetButtonID(); + if (btn == 1) ExitProcess(); + break; + + case evKey: + GetKeys(); + if (key_scancode == SCAN_CODE_ESC) ExitProcess(); + break; + + case evReDraw: + draw_window(); + break; + } +} + + +inline GetRevisionNumber() +{ + char buf[32]; + EAX = 18; + EBX = 13; + ECX = #buf; + return ESDWORD[#buf+5]; +} + +void draw_window() +{ + system.color.get(); + DefineUnDragableWindow(screen.width-WIN_W-15, GetClientHeight()-WIN_H-15, WIN_W-1, WIN_H-1); + DrawBar(0,0,WIN_W,WIN_H,0x414155); + DrawWideRectangle(0,0,WIN_W,WIN_H, 3, 0x5555FF); + WriteText(15, 20, 0x81, 0xFFFF55, " REV 7321 "); + WriteText(15, 20+25, 0x81, 0xFFFF55, "17.09.2018"); +} diff --git a/programs/cmm/examples/pig.c b/programs/cmm/examples/pig.c new file mode 100644 index 0000000000..24c616d1c0 --- /dev/null +++ b/programs/cmm/examples/pig.c @@ -0,0 +1,25 @@ +/* + * Template C-- program. +*/ + +#define MEMSIZE 4096*5 + +#include "../lib/kolibri.h" +#include "../lib/fs.h" +#include "../lib/patterns/restart_process.h" + +proc_info Form; + +void main() +{ + int i; + CreateDir("/tmp0/1/pig"); + RunProgram("/sys/UNZ", "-o /tmp0/1/pig -h /kolibrios/games/pig.zip"); + for (i = 0; i < 200; i++) + { + if (CheckProcessExists("UNZ")==false) break; + pause(3); + } + RunProgram("/tmp0/1/pig/pig", NULL); +} + diff --git a/programs/cmm/lib/patterns/restart_process.h b/programs/cmm/lib/patterns/restart_process.h index ded1a94c94..76720886a2 100644 --- a/programs/cmm/lib/patterns/restart_process.h +++ b/programs/cmm/lib/patterns/restart_process.h @@ -12,7 +12,7 @@ enum { #define MAX_PROCESS_COUNT 256 -:int CheckProcessExists(dword proc_name) { +:bool CheckProcessExists(dword proc_name) { int i; proc_info Process; for (i=0; i _FI structure -; edi-> where to load - push edi -if BGI_LEVEL eq KERNEL - mov edi,0x40000 -end if - .nfont: - mov edx,[esi] -if BGI_LEVEL eq KERNEL - movzx ebx,word[esi+4] - mov [BGIfont_Prepare.okflag],'N' -end if - call _BGIfont_Prepare -if ~ BGI_LEVEL eq KERNEL - add esi,4 -else - push esi - test eax,eax - jz .fail - mov [BGIfont_Prepare.okflag],'*' - .fail: - mov esi,BGIfont_Prepare.font - call boot_log - pop esi - add esi,6 -end if - loop .nfont - dph2 _BGI_BOLD,300,550 -; movzx edi,byte[0x40000] - pop edi -} - BGIfont_get2head: shr ecx,28 ; font # sub ecx,4 @@ -146,30 +83,11 @@ BGIfont_get2head: .ex: ret -BGIfont_GetName: -; in: ecx-fontID; -; out: edx-font name. - call BGIfont_get2head - xor edx,edx - test edi,edi - jz .ex - mov edx,[edi] - .ex: - ret - macro dps2 _str { -if ~ BGI_LEVEL eq KERNEL - if LOAD_MSG eq 1 - dps _str - end if -else - pusha - mov esi,BGIfont_Prepare.okflag - mov byte[esi], _str - call boot_log - popa -end if + if LOAD_MSG eq 1 + dps _str + end if } macro dph2 num,x,y @@ -236,32 +154,21 @@ _BGIfont_Prepare: mov dword[.font],edx ; filename mov esi,edi ; esi->FontName mov [.dest],edi ; ptr to load font -if ~ BGI_LEVEL eq KERNEL mov eax, 70 mov ebx, .fontattr mcall test eax, eax - jnz .fail + ;jnz .fail dps2 '1' mov eax, [.fileattr+32] - mov [.fsize], eax + mov [.fsize], litt_end-litt_file mov ebx,.fontinfo mov eax,70 mcall ; ebx - file size -else - push edi esi edx - mov eax,.font - xor ebx,ebx - mov esi,12 - mov ecx,ebx - mov edx,edi - call fileread - pop edx esi edi - mov ebp,edi - add ebp,ebx - cmp ebp,0x50000 - ja .fail -end if + ;mov ebx, litt_end-litt_file + ;mov edi, litt_file + ;mov [.dest],litt_file ; ptr to load font + cmp dword[edi],0x08084b50 ; 'PK',8,8 jne .fail dps2 '2' @@ -334,7 +241,6 @@ end if popa ret -if ~ BGI_LEVEL eq KERNEL .fontinfo: dd 0 dd 0 @@ -343,7 +249,7 @@ if ~ BGI_LEVEL eq KERNEL .dest dd 0 .fontfullname: db BGIFONT_PATH -.font db 'FONT.CHR',0 +.font db 'LITT.CHR',0 .fontattr: dd 5 @@ -354,11 +260,7 @@ if ~ BGI_LEVEL eq KERNEL db 0 dd .fontfullname .fileattr rd 40/4 -else - .dest dd 0 - .font db 'FONT CHR' - .okflag db ' ',0 -end if + BGIfont_Coo: ; y->word[txt.y1], x->word[txt.x1] diff --git a/programs/other/rtfread/trunk/litt.chr b/programs/other/rtfread/trunk/litt.chr new file mode 100644 index 0000000000000000000000000000000000000000..347f65d2aef643c26d7984a4f615bafa4424cc1b GIT binary patch literal 3982 zcmdT`&x>4D7QXMj`|f*ntIdQgB!oc<5z&|#l19b|B9aM8MhQWKiy$ExjYbXK(lkM{ z=-glLwYq4646_gkgGd%xxCjzNf(wx>T!{2S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jKF;<_UkOFF+DU6D%5x8 zU1Y{y!4RBHm7t4gC*28q0p9kZa-J-qoRjFR^&Eq$=6sRIWb)IsZTxE9n^6ogu|#fD zioqS_H*$}z12f)VUP$xUKhpx(W!`L>PbfIdjccj^8*s|D1f zK8VhA<5fbBDw*;`b3~2tg1~3gW>$K!YF5YZB}ODXnf)0jqAys2FrDfQ#fU!9b=V>J zbSIKlIy?jLI?yoamcu&w+c6z6B+j!R^fgo%DSn2@2wEAZk@O>LP?%L~qHT^W(QiEK zAP!g@xwyF-ScMR7>O_!vve`PZ(kROJ&Z=buIuo44KLJm{1K;VYqj&Pkt9dfh)aLoN zwNFnnsCP!AaI=fEDG-I8YLa%bo%1s8-bI;kW>dWk_2U2e?{=M?bZZlpJ7{>ud`1o3 z3Mnl}k(mM3;Py)R$Xm1&P=_&|4s*|-nJ|S_>ZrjzBRB!8Y%#U6Ieq+8msm(o=bNYT z0}o-wcQVb8oPN$?JHdQpX4^8|d(mA}LZPur;x?Hdm*&UCS*QC;%ym{h@dUr>ljhyd LZQPAIpIG?^zH&@c literal 0 HcmV?d00001 diff --git a/programs/other/rtfread/trunk/rtfread.asm b/programs/other/rtfread/trunk/rtfread.asm index 66f16d6105..0c640b2631 100644 --- a/programs/other/rtfread/trunk/rtfread.asm +++ b/programs/other/rtfread/trunk/rtfread.asm @@ -15,8 +15,6 @@ WINW equ 600 WINH equ 450 WIN_COLOR equ 0x73f0f0f0 DEFCOLOR equ 0x303030 -;RENDER equ PIX -;RENDER equ BGI RENDER equ FREE BGIFONT_PATH equ '/sys/fonts/' @@ -56,34 +54,24 @@ AR_OFFSET equ 10 dd I_END0 ; размер программы dd esp_end ; количество памяти dd sys_mem ; адрес вершины стэка - dd fname_buf ; адрес буфера для параметров (не используется) - dd cur_dir_path ; зарезервировано + dd fname_buf ; адрес буфера для параметров + dd cur_dir_path ; путь к программе -include '../../../config.inc' ;for nightbuild +include '../../../config.inc' ;for nightbuild include '../../../macros.inc' ; макросы облегчают жизнь ассемблерщиков! include '../../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac' -;include 'MACROS.INC' -;include 'load_lib.mac' - @use_library -;include '../../../debug.inc' +; include '../../../debug.inc' -if ~ RENDER eq PIX - TOP=TOP+4 - include 'bgifont.inc' -end if +TOP=TOP+4 +include 'bgifont.inc' include 'rtf_lite.inc' -;include 'ascl.inc' ;--------------------------------------------------------------------- ;--- НАЧАЛО ПРОГРАММЫ ---------------------------------------------- ;--------------------------------------------------------------------- -help_file: - file 'reader.rtf' -help_end: - START: mcall 68, 11 mcall 40, 0x80000027 @@ -95,11 +83,9 @@ load_libraries l_libs_start,end_l_libs call [OpenDialog_Init] mov [pitch],2 - if ~ RENDER eq PIX mov edx,FONT_NAME mov edi,save_limit BGIfont_Prepare - end if start2: cmp byte[fname_buf],0 je load_file;top_red @@ -321,7 +307,6 @@ key: ; ; je still jmp red .noarup: - if RENDER eq FREE cmp ah,56 ;zoom+ jne .noplus .zplus: @@ -338,7 +323,6 @@ key: ; fdiv [Zoomscale] jmp .zoom .nominus: - end if cmp ah,0xB5 ; end jne .pre_file_open .end: @@ -672,14 +656,7 @@ end if mov ecx,16 .l1: push ecx - if RENDER eq BGI - mov edx,char - mov ecx,0x48000000 - mov esi,1 - BGIfont_Outtext - else mcall 4,,0x10000000,char,1 - end if pop ecx inc [char] add ebx,(CHARW+3) shl 16 @@ -1072,18 +1049,13 @@ scroll_bar_data_vertical: ;--------------------------------------------------------------------- ;blind db ? -if RENDER eq PIX -; rd 2 - Free rd 9 -else -if RENDER eq BGI - FreeFontscale dd 0.07 -else + Zoomscale dd 1.15 FreeFontscale dd 0.04 -end if + Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0 -end if + + I_END0: fname_buf: rb 1024+16 @@ -1141,6 +1113,14 @@ szKeyword rb 31 szParameter rb 21 block_end dd ? +help_file: + file 'reader.rtf' +help_end: + +litt_file: + file 'litt.chr' +litt_end: + ;--------------------------------------------------------------------- I_END: ; метка конца программы rb RTFSIZE