Compare commits

..
14 Commits
Author SHA1 Message Date
hidnplayr f6d0f4f2d3 Added NET_TX_BLOCKED flag in network devices to indicate output is blocked.
Implemented the NET_TX_BLOCKED and pending transmit queue for PCNET driver.
Fixed blocking functionality of socket_send_tcp when output buffer is full.
2026-07-31 14:11:26 +02:00
hidnplayr 0f5f56536b Very minimalistic iperf clone for KolibriOS (100% written by Claude Sonnet 5) 2026-07-27 15:07:47 +02:00
b00bl1k 0ca124d6cb Update CONTRIBUTING guidelines (#598)
Build system / Build (en_US) (push) Successful in 2m12s
Build system / Build (ru_RU) (push) Successful in 2m20s
Build system / Build (es_ES) (push) Successful in 2m23s
Build system / Publish Images (push) Successful in 1m58s
It would be helpful for reviewers if contributors included an `Assisted-by` tag in commits prepared with the help of AI tools.

Reviewed-on: #598
Reviewed-by: Burer <burer@kolibrios.org>
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Gleb Zaharov <risdeveau@lair.moe>
Reviewed-by: Ivan B <1+dunkaist@noreply.localhost>
Co-authored-by: Alexey Ryabov <alex@b00bl1k.ru>
2026-07-25 07:35:46 +00:00
Burer 7365a98326 apps/cmm: take the c-- programs and the compiler config from their repositories (#585)
Build system / Build (es_ES) (push) Successful in 2m32s
Build system / Build (ru_RU) (push) Successful in 2m40s
Build system / Build (en_US) (push) Successful in 2m46s
Build system / Publish Images (push) Successful in 2m27s
Reviewed-on: #585
Reviewed-by: Kiril Lipatov <lipatov.kiril@gmail.com>
Reviewed-by: bad_Dr3dd0x <1702+bad_dr3dd0x@noreply.localhost>
2026-07-25 07:27:02 +00:00
Matou1306 9941a5dfc9 fs/ext: fix bug in ext_setFileEnd (#595)
Build system / Build (es_ES) (push) Successful in 2m15s
Build system / Build (en_US) (push) Successful in 2m19s
Build system / Build (ru_RU) (push) Successful in 2m22s
Build system / Publish Images (push) Successful in 2m28s
Discovered this bug when working on truncating a file with EXTENTS flag.
Basically ebx was getting cloberred which resulted in loading an incorrect address into eax.

Reviewed-on: #595
Reviewed-by: Burer <burer@kolibrios.org>
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Ivan B <1+dunkaist@noreply.localhost>
Co-authored-by: Matou <mathieubotros@gmail.com>
2026-07-25 06:31:49 +00:00
Leency 041029b406 kernel/AHCI: use IRQ instead of delay (#597)
Build system / Build (ru_RU) (push) Successful in 2m16s
Build system / Build (en_US) (push) Successful in 2m21s
Build system / Build (es_ES) (push) Successful in 2m24s
Build system / Publish Images (push) Successful in 1m53s
This change was proceeded by request of Rhimad, author of original AHCI driver.
Tested on real hardware.Reviewed-on: #597
Reviewed-by: Ivan B <1+dunkaist@noreply.localhost>
Reviewed-by: rgimad <3+rgimad@noreply.localhost>
2026-07-23 19:28:52 +00:00
LeencyandBurer 7c4d3f57e6 apps/bbench - CPU, graphics, memory and disk benchmark for KolibriOS (#561)
Build system / Build (en_US) (push) Successful in 2m19s
Build system / Build (es_ES) (push) Successful in 2m22s
Build system / Build (ru_RU) (push) Successful in 2m30s
Build system / Publish Images (push) Successful in 2m32s
- Add `bbench` to IMG and System Panel
  - Universal benchmark with 17 tests for CPU, graphics, memory and disk
  - Tests can be toggled and configured
  - Generates derailed reports in HTML
- Remove `MGB` and `FSPEED` from System Panel, move them from IMG to ISO

---------

Co-authored-by: Burer <burer@kolibrios.org>
Reviewed-on: #561
Reviewed-by: bad_Dr3dd0x <1702+bad_dr3dd0x@noreply.localhost>
Reviewed-by: Burer <burer@kolibrios.org>
Co-authored-by: leency <lipatov.kiril@gmail.com>
2026-07-23 13:51:18 +00:00
LeencyandBurer 00fb7afe33 libs/libimg: fix progressive jpeg 4:2:0 shear when width mod 16 = 8 (#590)
Build system / Build (en_US) (push) Successful in 3m5s
Build system / Build (es_ES) (push) Successful in 3m5s
Build system / Build (ru_RU) (push) Successful in 3m8s
Build system / Publish Images (push) Successful in 2m3s
Co-authored-by: Burer <burer@kolibrios.org>
Reviewed-on: #590
Reviewed-by: Burer <burer@kolibrios.org>
Reviewed-by: IgorA <22+igora@noreply.localhost>
Reviewed-by: Ivan B <1+dunkaist@noreply.localhost>
Co-authored-by: leency <lipatov.kiril@gmail.com>
2026-07-22 08:09:55 +00:00
Leency db846b5eee AddDevice: class EF subclass 04 protocol 01
Test PR / Build (en_US) (pull_request) Successful in 1m54s
Test PR / Build (es_ES) (pull_request) Successful in 1m59s
Test PR / Build (ru_RU) (pull_request) Successful in 2m7s
Build system / Build (es_ES) (push) Successful in 2m6s
Build system / Build (ru_RU) (push) Successful in 2m15s
Build system / Build (en_US) (push) Successful in 2m20s
Build system / Publish Images (push) Successful in 2m32s
2026-07-21 17:51:53 +00:00
Leency 686f18772a final update 2026-07-21 17:51:53 +00:00
Leency 9b7292f3e7 update 2 2026-07-21 17:51:53 +00:00
Leency e41362fb04 full support Huawei E3372h-153 modem 2026-07-21 17:51:53 +00:00
Leency bbc0f1262c usbnet: upload drivers usbcdc and usbrndis 2026-07-21 17:51:53 +00:00
Leency 5fb16b1d81 data/common: stl=/sys/3d/view3ds (#591)
Build system / Build (en_US) (push) Successful in 2m15s
Build system / Build (ru_RU) (push) Successful in 2m18s
Build system / Build (es_ES) (push) Successful in 2m22s
Build system / Publish Images (push) Successful in 2m22s
Reviewed-on: #591
Reviewed-by: hidnplayr <hidnplayr@gmail.com>
Reviewed-by: Burer <burer@kolibrios.org>
Co-authored-by: leency <lipatov.kiril@gmail.com>
2026-07-21 16:34:17 +00:00
337 changed files with 6336 additions and 269971 deletions

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ jobs:
make -f Makefile.lin32
chmod +x c--
mv c-- /home/autobuild/tools/win32/bin/c--
cp ${{ gitea.workspace }}/programs/cmm/c--/c--.ini /home/autobuild/tools/win32/bin/c--.ini
cp ${{ gitea.workspace }}/programs/develop/cmm/c--.ini /home/autobuild/tools/win32/bin/c--.ini
make -f Makefile.lin32 clean
- name: Install TCC
+1 -1
View File
@@ -64,7 +64,7 @@ jobs:
make -f Makefile.lin32
chmod +x c--
mv c-- /home/autobuild/tools/win32/bin/c--
cp ${{ gitea.workspace }}/programs/cmm/c--/c--.ini /home/autobuild/tools/win32/bin/c--.ini
cp ${{ gitea.workspace }}/programs/develop/cmm/c--.ini /home/autobuild/tools/win32/bin/c--.ini
make -f Makefile.lin32 clean
- name: Install TCC
+4 -2
View File
@@ -24,6 +24,8 @@ jobs:
path: programs/develop/cmm
- name: oberon07
path: programs/develop/oberon07
- name: cmm_apps
path: programs/cmm
- name: kterm
path: programs/other/kterm
@@ -68,7 +70,7 @@ jobs:
git config user.name "kolibri-bot"
git config user.email "bot@kolibrios.org"
git checkout -B "$BRANCH"
git commit -m "$NAME: bump submodule to $WANT" -- "$PATH_"
git commit -m "chore/submodules: bump $NAME to $WANT" -- "$PATH_"
git push -f origin "$BRANCH"
# Open a PR via the Gitea API.
@@ -77,7 +79,7 @@ jobs:
http=$(curl -sS -o /tmp/pr.json -w '%{http_code}' -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"head\":\"${BRANCH}\",\"base\":\"main\",\"title\":\"${NAME}: bump submodule to upstream\"}" \
-d "{\"head\":\"${BRANCH}\",\"base\":\"main\",\"title\":\"chore/submodules: bump ${NAME} to upstream\"}" \
"${API}/repos/${REPO}/pulls")
echo "PR API HTTP status: $http"
cat /tmp/pr.json; echo
+4
View File
@@ -6,6 +6,10 @@
path = programs/develop/oberon07
url = https://github.com/AntKrotov/oberon-07-compiler.git
branch = master
[submodule "programs/cmm"]
path = programs/cmm
url = https://git.kolibrios.org/KolibriOS/cmm_apps.git
branch = main
[submodule "programs/other/kterm"]
path = programs/other/kterm
url = https://git.kolibrios.org/b00bl1k/kterm.git
+6
View File
@@ -59,6 +59,12 @@ Co-authored-by: ANOTHER-NAME <ANOTHER-NAME@EXAMPLE.COM>
to the end commit message body on a new line.
If you used AI tools while preparing the commit, you are encouraged to include an Assisted-by tag:
```
Assisted-by: AGENT_NAME:MODEL_VERSION
```
### Merge commits
> [!WARNING]
+7 -4
View File
@@ -170,8 +170,6 @@ extra_files = {
{"kolibrios/demos/life2", "common/demos/life2"},
{"kolibrios/demos/relay.lif", "common/demos/relay.lif"},
{"kolibrios/demos/rpento.lif", "common/demos/rpento.lif"},
{"kolibrios/develop/c--/c--.ini", SRC_PROGS .. "/cmm/c--/c--.ini"},
{"kolibrios/develop/c--/manual_c--.htm", SRC_PROGS .. "/cmm/c--/manual_c--.htm"},
{"kolibrios/develop/fpc/", "common/develop/fpc/*"},
{"kolibrios/develop/fpc/examples/", "../programs/develop/fp/examples/src/*"},
{"kolibrios/develop/oberon07/compiler.kex", SRC_PROGS .. "/develop/oberon07/Compiler.kex"},
@@ -428,7 +426,6 @@ tup.append_table(img_files, {
{"DISPTEST", VAR_PROGS .. "/testing/disptest/disptest"},
{"END", VAR_PROGS .. "/system/end/light/end"},
{"ESKIN", VAR_PROGS .. "/system/eskin/eskin"},
{"FSPEED", VAR_PROGS .. "/testing/fspeed/fspeed"},
{"GMON", VAR_PROGS .. "/system/gmon/gmon"},
{"HDD_INFO", VAR_PROGS .. "/system/hdd_info/hdd_info"},
{"KBD", VAR_PROGS .. "/testing/kbd/kbd"},
@@ -437,7 +434,6 @@ tup.append_table(img_files, {
{"LOADDRV", VAR_PROGS .. "/system/loaddrv/loaddrv"},
{"MAGNIFY", VAR_PROGS .. "/system/magnify/magnify"},
{"MADMOUSE", VAR_PROGS .. "/other/madmouse/madmouse"},
{"MGB", VAR_PROGS .. "/testing/mgb/mgb"},
{"MOUSEMUL", VAR_PROGS .. "/system/mousemul/mousemul"},
{"MOUSEPOS", VAR_PROGS .. "/other/mousepos/mousepos"},
{"MYKEY", VAR_PROGS .. "/system/MyKey/MyKey"},
@@ -576,6 +572,8 @@ tup.append_table(img_files, {
{"DRIVERS/EHCI.SYS", VAR_DRVS .. "/usb/ehci.sys"},
{"DRIVERS/USBHID.SYS", VAR_DRVS .. "/usb/usbhid/usbhid.sys"},
{"DRIVERS/USBOTHER.SYS",VAR_DRVS .. "/usb/usbother/usbother.sys"},
{"DRIVERS/USBCDC.SYS", VAR_DRVS .. "/usb/usbnet/usbcdc.sys"},
{"DRIVERS/USBRNDIS.SYS", VAR_DRVS .. "/usb/usbnet/usbrndis.sys"},
{"DRIVERS/USBSTOR.SYS", VAR_DRVS .. "/usb/usbstor.sys"},
{"DRIVERS/RDC.SYS", VAR_DRVS .. "/video/rdc.sys"},
{"DRIVERS/COMMOUSE.SYS", VAR_DRVS .. "/mouse/commouse.sys"},
@@ -640,6 +638,8 @@ tup.append_table(extra_files, {
{"kolibrios/media/zsea/plugins/rotate.obj", VAR_PROGS .. "/media/zsea/plugins/rotate/rotate.obj"},
{"kolibrios/media/zsea/plugins/scaling.obj", VAR_PROGS .. "/media/zsea/plugins/scaling/scaling.obj"},
{"kolibrios/utils/AMDtemp", VAR_PROGS .. "/system/amd_temp_view/AMDtemp"},
{"kolibrios/utils/fspeed", VAR_PROGS .. "/testing/fspeed/fspeed"},
{"kolibrios/utils/mgb", VAR_PROGS .. "/testing/mgb/mgb"},
{"kolibrios/utils/kfm/kfm", VAR_PROGS .. "/fs/kfm/kfm"},
{"kolibrios/utils/tedit/t_edit", VAR_PROGS .. "/other/t_edit/t_edit"},
{"kolibrios/3D/blocks/block.bin", VAR_PROGS .. "/bcc32/games/blocks/block.bin"},
@@ -681,6 +681,7 @@ tup.append_table(img_files, {
{"EASYSHOT", VAR_PROGS .. "/cmm/misc/easyshot.com"},
{"MOUSECFG", VAR_PROGS .. "/cmm/mousecfg/mousecfg.com"},
{"BARSCFG", VAR_PROGS .. "/cmm/barscfg/barscfg.com"},
{"BBENCH", VAR_PROGS .. "/cmm/bbench/bbench.com"},
{"SEARCH", VAR_PROGS .. "/cmm/misc/search.com"},
{"SYSPANEL", VAR_PROGS .. "/cmm/misc/software_widget.com"},
{"SYSMON", VAR_PROGS .. "/cmm/sysmon/sysmon.com"},
@@ -809,6 +810,8 @@ tup.append_table(extra_files, {
{"kolibrios/utils/minizip/minizip", VAR_PROGS .. "/fs/minizip/minizip"},
{"kolibrios/utils/minizip/miniunz", VAR_PROGS .. "/fs/minizip/miniunz"},
{"kolibrios/develop/c--/c--", VAR_PROGS .. "/develop/cmm/cmm"},
{"kolibrios/develop/c--/c--.ini", SRC_PROGS .. "/develop/cmm/c--.ini"},
{"kolibrios/develop/c--/manual_c--.htm", SRC_PROGS .. "/develop/cmm/manual_c--.htm"},
{"kolibrios/develop/tcc/tcc", VAR_PROGS .. "/develop/ktcc/source/tcc"},
{"kolibrios/develop/sqlite3/sqlite3", VAR_CONTRIB .. "/sdk/sources/sqlite3/shell/sqlite3"},
{"kolibrios/develop/utils/objconv", VAR_PROGS .. "/develop/objconv/objconv"},
+1
View File
@@ -29,6 +29,7 @@ xcf=/sys/media/kiv
rtf=/sys/RtfRead
3ds=/sys/3d/view3ds
asc=/sys/3d/view3ds
stl=/sys/3d/view3ds
lif=/kolibrios/demos/life2
skn=/sys/skincfg
dtp=/sys/skincfg
+1
View File
@@ -174,6 +174,7 @@ sh=/sys/shell
3ds=/sys/3d/view3ds
asc=/sys/3d/view3ds
stl=/sys/3d/view3ds
skn=/sys/skincfg
dtp=/sys/skincfg
+1 -2
View File
@@ -35,7 +35,6 @@ Console Board=develop/dbgboard,19
PCI Devices=pcidev,38
CPU Info=cpuid,37
Display Test=disptest,113
Graphic Bench=mgb,121
Benchmark=bbench,121
HDD Info=hdd_info,50
File Speed=fspeed,45
Network Speed=network/dl|-test,51
+1 -2
View File
@@ -35,7 +35,6 @@ Consola de depuracion=develop/dbgboard,19
Dispositivos PCI=pcidev,38
CPU Info=cpuid,37
Prueba de pantalla=disptest,113
Rendimiento grafico=mgb,121
Benchmark=bbench,121
Info de disco=hdd_info,50
Velocidad FS=fspeed,45
Velocidad de red=network/dl|-test,51
+1 -2
View File
@@ -35,7 +35,6 @@ AMDtemp=/k/utils/AMDtemp,128
Устройства PCI=pcidev,38
CPU Info=cpuid,37
Тест экрана=disptest,113
Скорость графики=mgb,121
Benchmark=bbench,121
Информация о дисках=hdd_info,50
Скорость ФС=fspeed,45
Скорость сети=network/dl|-test,51
+143 -13
View File
@@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2026. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; AMD PCnet driver for KolibriOS ;;
@@ -31,6 +31,11 @@ entry START
TX_RING_SIZE = 32 ; Number of packets in send ring buffer
RX_RING_SIZE = 32 ; Number of packets in receive ring buffer
; pending transmit queue, used when frames arrive while hardware is busy
PENDING_TX_MAX = 8 ; Maximum number of frames in the queue
PENDING_TX_LOWAT = 0 ; Low-water mark for the number of frames in the queue, before resetting the NET_TX_BLOCKED flag
; end configureable area
section '.flat' readable writable executable
@@ -316,6 +321,11 @@ struct device ETH_DEVICE
cur_tx dd ?
last_tx dd ?
; pending transmit queue: linked list of frames that arrived while the hardware was busy
pend_tx_head dd ? ; pointer to oldest queued NET_BUFF, 0 if empty
pend_tx_tail dd ? ; pointer to newest queued NET_BUFF, 0 if empty
pend_tx_count dd ? ; 0..PENDING_TX_MAX
options dd ?
full_duplex db ?
chip_version dw ?
@@ -1000,6 +1010,21 @@ init_ring:
mov [ebx + device.last_tx], 0
mov [ebx + device.cur_rx], 0
mov esi, [ebx + device.pend_tx_head]
.drain_pending:
test esi, esi
jz .pending_drained
mov eax, [esi + NET_BUFF.NextPtr]
push eax
invoke NetFree, esi
pop eax
mov esi, eax
jmp .drain_pending
.pending_drained:
mov dword [ebx + device.pend_tx_head], 0
mov dword [ebx + device.pend_tx_tail], 0
mov dword [ebx + device.pend_tx_count], 0
xor eax, eax
ret
@@ -1045,6 +1070,9 @@ proc transmit stdcall bufferptr
test [edi + descriptor.status], TXCTL_OWN
jnz .overrun
cmp [edi + descriptor.virtual], 0 ; Make sure int handler has performed cleanup already
jne .desc_busy
.desc_free:
; descriptor is free, use it
mov [edi + descriptor.virtual], esi
mov eax, esi
@@ -1058,6 +1086,12 @@ proc transmit stdcall bufferptr
; put to transfer queue
mov [edi + descriptor.status], TXCTL_OWN + TXCTL_STP + TXCTL_ENP
; Update stats
inc [ebx + device.packets_tx]
mov eax, [esi + NET_BUFF.length]
add dword[ebx + device.bytes_tx], eax
adc dword[ebx + device.bytes_tx + 4], 0
; trigger an immediate send
mov edx, [ebx + device.io_addr]
xor ecx, ecx ; CSR0
@@ -1069,16 +1103,16 @@ proc transmit stdcall bufferptr
inc [ebx + device.cur_tx]
and [ebx + device.cur_tx], TX_RING_SIZE - 1
; Update stats
inc [ebx + device.packets_tx]
mov eax, [esi + NET_BUFF.length]
add dword[ebx + device.bytes_tx], eax
adc dword[ebx + device.bytes_tx + 4], 0
spin_unlock_irqrestore
xor eax, eax
ret
.desc_busy:
pusha ; TODO CHECKME
invoke NetFree, [edi + descriptor.virtual]
popa
jmp .desc_free
.error:
DEBUGF 2, "TX packet error\n"
inc [ebx + device.packets_tx_err]
@@ -1089,12 +1123,40 @@ proc transmit stdcall bufferptr
ret
.overrun:
; Hardware ring is full.
DEBUGF 1, "High water\n"
or [ebx + device.state], NET_TX_BLOCKED
; Try the pending tx queue as a last resort
cmp [ebx + device.pend_tx_count], PENDING_TX_MAX
jae .queue_full
mov dword [esi + NET_BUFF.NextPtr], 0
mov dword [esi + NET_BUFF.PrevPtr], 0
mov eax, [ebx + device.pend_tx_tail]
mov [ebx + device.pend_tx_tail], esi
test eax, eax
jz @f
mov [eax + NET_BUFF.NextPtr], esi
jmp .list_linked
@@:
mov [ebx + device.pend_tx_head], esi
.list_linked:
inc [ebx + device.pend_tx_count]
DEBUGF 1, "Pending TX: %u\n", [ebx + device.pend_tx_count]
spin_unlock_irqrestore
xor eax, eax
ret
.queue_full:
DEBUGF 2, "TX overrun\n"
inc [ebx + device.packets_tx_ovr]
invoke NetFree, [bufferptr]
spin_unlock_irqrestore
or eax, -1
dec eax
ret
endp
@@ -1225,20 +1287,20 @@ int_handler:
jz .not_transmit
.tx_loop:
lea edi, [ebx + device.tx_ring]
mov eax, [ebx + device.last_tx]
lea edi, [ebx + device.tx_ring]
shl eax, 4
add edi, eax
test [edi + descriptor.status], TXCTL_OWN
jnz .not_transmit
jnz .tx_done ; still busy
mov eax, [edi + descriptor.virtual]
test eax, eax
jz .not_transmit
jz .tx_done ; never filled, or already reclaimed
mov [edi + descriptor.virtual], 0
DEBUGF 1,"Removing packet %x from memory\n", eax
invoke NetFree, eax
@@ -1247,6 +1309,10 @@ int_handler:
and [ebx + device.last_tx], TX_RING_SIZE - 1
jmp .tx_loop
.tx_done:
cmp [ebx + device.pend_tx_count], 0
jne .refill_loop
.not_transmit:
pop edi esi ebx
xor eax, eax
@@ -1254,6 +1320,70 @@ int_handler:
ret
.refill_loop:
mov ecx, [ebx + device.cur_tx]
shl ecx, 4
lea edi, [ebx + device.tx_ring]
add edi, ecx
test [edi + descriptor.status], TXCTL_OWN
jnz .refill_done ; not actually free after all - stop
cmp [edi + descriptor.virtual], 0
je @f
pusha
invoke NetFree, [edi + descriptor.virtual]
popa
@@:
mov esi, [ebx + device.pend_tx_head]
mov eax, [esi + NET_BUFF.NextPtr]
mov [ebx + device.pend_tx_head], eax
mov [edi + descriptor.virtual], esi
mov eax, esi
add eax, [eax + NET_BUFF.offset]
invoke GetPhysAddr
mov [edi + descriptor.base], eax
mov eax, [esi + NET_BUFF.length]
neg eax
mov [edi + descriptor.length], ax
mov [edi + descriptor.status], TXCTL_OWN + TXCTL_STP + TXCTL_ENP
inc [ebx + device.packets_tx]
mov eax, [esi + NET_BUFF.length]
add dword[ebx + device.bytes_tx], eax
adc dword[ebx + device.bytes_tx + 4], 0
inc [ebx + device.cur_tx]
and [ebx + device.cur_tx], TX_RING_SIZE - 1
dec [ebx + device.pend_tx_count]
jnz .refill_loop
mov dword [ebx + device.pend_tx_tail], 0
.refill_done:
DEBUGF 1, "Pending TX: %u\n", [ebx + device.pend_tx_count]
mov edx, [ebx + device.io_addr]
xor ecx, ecx ; CSR0
call [ebx + device.read_csr]
or eax, CSR_TX
call [ebx + device.write_csr]
cmp [ebx + device.pend_tx_count], PENDING_TX_LOWAT
ja @f
and [ebx + device.state], not NET_TX_BLOCKED
DEBUGF 1, "Low water\n"
@@:
pop edi esi ebx
xor eax, eax
inc eax
ret
@@ -1595,7 +1725,7 @@ proc check_media_mii stdcall dev:dword
mov ecx, eax
and eax, BMSR_LSTATUS
shr eax, 2
cmp eax, [ebx + device.state]
cmp ax, word[ebx + device.state] ; lazy masking of NET_TX_BLOCKED
jne .changed
spin_unlock_irqrestore
@@ -1643,7 +1773,7 @@ proc check_media_mii stdcall dev:dword
mov eax, ETH_LINK_UNKNOWN
.update:
mov [ebx + device.state], eax
mov word[ebx + device.state], ax ; lazy masking of NET_TX_BLOCKED
invoke NetLinkChanged
+158 -154
View File
@@ -1,154 +1,158 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; GNU GENERAL PUBLIC LICENSE ;;
;; Version 2, June 1991 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This macro will prepend driver name to all debug output through DEBUGF macro
; The driver name is taken from my_service label
if defined my_service
macro DEBUGF _level,_format, [args] {
common DEBUGF _level, "%s: " # _format, my_service, args
}
end if
include 'pci.inc'
include 'mii.inc'
; Kernel variables
PAGESIZE = 4096
; Network driver types
NET_TYPE_ETH = 1
NET_TYPE_SLIP = 2
; Link state
ETH_LINK_DOWN = 0 ; Link is down
ETH_LINK_UNKNOWN = 1b ; There could be an active link
ETH_LINK_FULL_DUPLEX = 10b ; full duplex flag
ETH_LINK_SPEED_10M = 100b ; 10 Mbit
ETH_LINK_SPEED_100M = 1000b ; 100 Mbit
ETH_LINK_SPEED_1G = 1100b ; Gigabit
ETH_LINK_SPEED_MASK = 1100b
; Macro to easily set i/o addresses to access device.
; In the beginning of a procedure (or ofter edx may have been destroyed),
; always use set_io with offset 0 to reset the variables.
LAST_IO = 0
macro set_io baseaddr, offset {
if offset = 0
mov edx, baseaddr
else if offset = LAST_IO
else
add edx, offset - LAST_IO
end if
LAST_IO = offset
}
; Macro to allocate a contiguous buffer in memory
; And initialise it to all zeros
; This macro will destroy eax, ecx and edi !
macro allocate_and_clear dest, size, err {
; We need to allocate at least 8 pages, if we want a contiguous area in ram
push edx
if (size < 8*4096) & (size > 4096)
invoke KernelAlloc, 8*4096
else
invoke KernelAlloc, size
end if
pop edx
test eax, eax
jz err
mov dest, eax
mov edi, eax ; look at last part of code!
; Release the unused pages (if any)
if (size < 8*4096) & (size > 4096)
add eax, (size/4096+1)*4096
mov ecx, 8-(size/4096+1)
push edx
invoke ReleasePages
pop edx
end if
; Clear the allocated buffer
mov ecx, size/4 ; divide by 4 because of DWORD
xor eax, eax
rep stosd
if (size - size/4*4)
mov ecx, size - size/4*4
rep stosb
end if
}
struct NET_DEVICE
type dd ? ; Type field
mtu dd ? ; Maximal Transmission Unit
name dd ? ; Ptr to 0 terminated string
unload dd ? ; Ptrs to driver functions
reset dd ? ;
transmit dd ? ;
state dd ? ; link state (0 = no link)
hwacc dd ? ; bitmask stating enabled HW accelerations (offload engines)
bytes_tx dq ? ; Statistics, updated by the driver
bytes_rx dq ? ;
packets_tx dd ? ;
packets_tx_err dd ? ; CRC errors, too long or too short frames
packets_tx_drop dd ? ;
packets_tx_ovr dd ? ; FIFO overrun
packets_rx dd ? ;
packets_rx_err dd ? ; CRC errors, too long or too short frames
packets_rx_drop dd ? ;
packets_rx_ovr dd ? ; FIFO overrun
ends
struct NET_BUFF
NextPtr dd ? ; pointer to next frame in list
PrevPtr dd ? ; pointer to previous frame in list
device dd ? ; ptr to NET_DEVICE structure
type dd ? ; data type (e.g. Ethernet)
length dd ? ; data length
offset dd ? ; offset to actual data (24 bytes for default frame)
data rb 0
ends
struct ETH_DEVICE NET_DEVICE
mac dp ?
dw ? ; qword alignment
ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; GNU GENERAL PUBLIC LICENSE ;;
;; Version 2, June 1991 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This macro will prepend driver name to all debug output through DEBUGF macro
; The driver name is taken from my_service label
if defined my_service
macro DEBUGF _level,_format, [args] {
common DEBUGF _level, "%s: " # _format, my_service, args
}
end if
include 'pci.inc'
include 'mii.inc'
; Kernel variables
PAGESIZE = 4096
; Network driver types
NET_TYPE_ETH = 1
NET_TYPE_SLIP = 2
; Link state
ETH_LINK_DOWN = 0 ; Link is down
ETH_LINK_UNKNOWN = 1b ; Link is up, but speed might be unknown
ETH_LINK_FULL_DUPLEX = 10b ; full duplex flag
ETH_LINK_SPEED_10M = 100b ; 10 Mbit
ETH_LINK_SPEED_100M = 1000b ; 100 Mbit
ETH_LINK_SPEED_1G = 1100b ; Gigabit
ETH_LINK_SPEED_MASK = 1100b
; Hardware state
NET_TX_BLOCKED = 1 shl 31 ; Transmit queue is full, if you call transmit again, driver might drop your frame
; Macro to easily set i/o addresses to access device.
; In the beginning of a procedure (or ofter edx may have been destroyed),
; always use set_io with offset 0 to reset the variables.
LAST_IO = 0
macro set_io baseaddr, offset {
if offset = 0
mov edx, baseaddr
else if offset = LAST_IO
else
add edx, offset - LAST_IO
end if
LAST_IO = offset
}
; Macro to allocate a contiguous buffer in memory
; And initialise it to all zeros
; This macro will destroy eax, ecx and edi !
macro allocate_and_clear dest, size, err {
; We need to allocate at least 8 pages, if we want a contiguous area in ram
push edx
if (size < 8*4096) & (size > 4096)
invoke KernelAlloc, 8*4096
else
invoke KernelAlloc, size
end if
pop edx
test eax, eax
jz err
mov dest, eax
mov edi, eax ; look at last part of code!
; Release the unused pages (if any)
if (size < 8*4096) & (size > 4096)
add eax, (size/4096+1)*4096
mov ecx, 8-(size/4096+1)
push edx
invoke ReleasePages
pop edx
end if
; Clear the allocated buffer
mov ecx, size/4 ; divide by 4 because of DWORD
xor eax, eax
rep stosd
if (size - size/4*4)
mov ecx, size - size/4*4
rep stosb
end if
}
struct NET_DEVICE
type dd ? ; Type field
mtu dd ? ; Maximal Transmission Unit
name dd ? ; Ptr to 0 terminated string
unload dd ? ; Ptrs to driver functions
reset dd ? ;
transmit dd ? ;
state dd ? ; link state (0 = no link)
hwacc dd ? ; bitmask stating enabled HW accelerations (offload engines)
bytes_tx dq ? ; Statistics, updated by the driver
bytes_rx dq ? ;
packets_tx dd ? ;
packets_tx_err dd ? ; CRC errors, too long or too short frames
packets_tx_drop dd ? ;
packets_tx_ovr dd ? ; FIFO overrun
packets_rx dd ? ;
packets_rx_err dd ? ; CRC errors, too long or too short frames
packets_rx_drop dd ? ;
packets_rx_ovr dd ? ; FIFO overrun
ends
struct NET_BUFF
NextPtr dd ? ; pointer to next frame in list
PrevPtr dd ? ; pointer to previous frame in list
device dd ? ; ptr to NET_DEVICE structure
type dd ? ; data type (e.g. Ethernet)
length dd ? ; data length
offset dd ? ; offset to actual data (24 bytes for default frame)
data rb 0
ends
struct ETH_DEVICE NET_DEVICE
mac dp ?
dw ? ; qword alignment
ends
+3
View File
@@ -0,0 +1,3 @@
if tup.getconfig("NO_FASM") ~= "" then return end
ROOT = "../../.."
tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys")
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+12 -2
View File
@@ -79,7 +79,7 @@ macro ADD_CLASS drv_name, class, subclass, protocol {
..class_code = ..length or (class shl 8)
if ..length = 3
..class_code = ..class_code or (protocol shl 24)
..class_code = ..class_code or (subclass shl 16) or (protocol shl 24)
end if
if ..length = 2
..class_code = ..class_code or (subclass shl 16)
@@ -172,7 +172,17 @@ macro ADD_IDL drv_name, [vendor_id, device_id] {
INIT_USBDRV_FILE
;ADD_CLASS 'usbcdc-ctrl' , 0x02, X , X
; CDC (Communications Device Class): NCM network + ACM serial
ADD_CLASS 'usbcdc' , 0x02, X , X
; RNDIS network (Remote NDIS): LTE modems in HiLink mode, USB tethering.
; Three encodings exist: Wireless-Controller/RF/RNDIS, Miscellaneous/
; RNDIS-over-Ethernet (phone tethering) and an ACM masquerade (the
; latter is declined by usbcdc, so the scan falls through to us).
ADD_CLASS 'usbrndis' , 0xE0, 0x01, 0x03
ADD_CLASS 'usbrndis' , 0xEF, 0x04, 0x01
ADD_CLASS 'usbrndis' , 0x02, 0x02, 0xFF
;ADD_CLASS 'usbimage' , 0x06, 1 , 1
;ADD_CLASS 'usbcdc-data' , 0x0A, X , X
;ADD_CLASS 'ccid' , 0x0B, X , X
+468
View File
@@ -722,6 +722,225 @@ endp
; callback inquiry_callback;
; * inquiry_callback checks that a logical device is a block device
; and the unit was ready; if so, it notifies the kernel about new disk device.
; Open the bulk pipes of the Zero-CD device and send the switch message
; chosen for it (optionally preceded by an INQUIRY exchange). Used as
; the fallback when the device has no MS OS 2.0 alternate enumeration.
proc modeswitch_send_cbw
push ebx
mov ebx, [modeswitch_pipe0]
cmp dword [modeswitch_in_ep], 0
jz @f
invoke USBOpenPipe, ebx, [modeswitch_in_ep], [modeswitch_in_mps], \
BULK_PIPE, 0
mov [modeswitch_in_pipe], eax
@@:
invoke USBOpenPipe, ebx, [modeswitch_out_ep], [modeswitch_out_mps], \
BULK_PIPE, 0
test eax, eax
jz .fail
mov [modeswitch_out_pipe], eax
; warm up the firmware with an INQUIRY exchange first, if the method
; asks for it (and the CSW pipe is available)
cmp dword [modeswitch_inq], 0
jz .magic
cmp dword [modeswitch_in_pipe], 0
jz .magic
invoke USBNormalTransferAsync, eax, modeswitch_cbw_inq, 31, \
modeswitch_inq_cbw_callback, 0, 0
DEBUGF 1,'K : modeswitch INQUIRY CBW submitted, handle %x\n', eax
test eax, eax
jz .fail
pop ebx
ret
.magic:
invoke USBNormalTransferAsync, [modeswitch_out_pipe], [modeswitch_msg], 31, \
modeswitch_callback, 0, 0
DEBUGF 1,'K : modeswitch CBW submitted, handle %x\n', eax
test eax, eax
jz .fail
pop ebx
ret
.fail:
mov dword [modeswitch_pipe0], 0 ; transaction over
pop ebx
ret
endp
; The INQUIRY CBW went out: read the 36 data bytes.
proc modeswitch_inq_cbw_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch INQUIRY CBW done, status %d\n', [.status]
cmp [.status], 0
jne .fail
invoke USBNormalTransferAsync, [modeswitch_in_pipe], modeswitch_bos_buf, \
36, modeswitch_inq_data_callback, 0, 1
test eax, eax
jz .fail
ret
.fail:
mov dword [modeswitch_pipe0], 0 ; transaction over
ret
endp
; The INQUIRY data arrived: read the CSW.
proc modeswitch_inq_data_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch INQUIRY data done, status %d len %d\n', [.status], [.length]
invoke USBNormalTransferAsync, [modeswitch_in_pipe], modeswitch_csw, \
13, modeswitch_inq_csw_callback, 0, 1
test eax, eax
jz .fail
ret
.fail:
mov dword [modeswitch_pipe0], 0 ; transaction over
ret
endp
; The INQUIRY transaction is complete: now the switch message itself.
proc modeswitch_inq_csw_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch INQUIRY CSW done, status %d\n', [.status]
invoke USBNormalTransferAsync, [modeswitch_out_pipe], [modeswitch_msg], 31, \
modeswitch_callback, 0, 0
DEBUGF 1,'K : modeswitch CBW submitted, handle %x\n', eax
test eax, eax
jz .fail
ret
.fail:
mov dword [modeswitch_pipe0], 0 ; transaction over
ret
endp
; The BOS descriptor has been read. If the device carries an
; MS OS 2.0 platform capability with a nonzero bAltEnumCode, switch it
; the way Windows does: a vendor control request "set alternate
; enumeration". Otherwise fall back to the bulk switch message.
proc modeswitch_bos_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch BOS done, status %d len %d\n', [.status], [.length]
cmp [.status], 0
jne .fallback
mov ecx, [.length]
sub ecx, 8 ; minus the setup packet
cmp ecx, 5
jb .fallback
mov esi, modeswitch_bos_buf
cmp byte [esi+1], 0x0F ; BOS descriptor type
jne .fallback
movzx edx, word [esi+2] ; wTotalLength
cmp edx, ecx
jbe @f
mov edx, ecx ; clamp to what was received
@@:
add edx, esi ; edx = end of BOS data
add esi, 5 ; first device capability
.cap_loop:
lea eax, [esi+3]
cmp eax, edx
ja .fallback ; no more capabilities
movzx ecx, byte [esi] ; bLength
test ecx, ecx
jz .fallback
cmp byte [esi+1], 0x10 ; DEVICE_CAPABILITY
jne .next_cap
cmp byte [esi+2], 0x05 ; PLATFORM capability
jne .next_cap
cmp ecx, 20+8 ; header + GUID + one set info
jb .next_cap
lea eax, [esi+ecx]
cmp eax, edx
ja .fallback ; capability sticks out of BOS
; is it the MS OS 2.0 platform GUID?
push esi edi ecx
add esi, 4
mov edi, msos20_guid
mov ecx, 16
repe cmpsb
pop ecx edi esi
jne .next_cap
; walk the descriptor set info structures, take one with bAltEnumCode
push ecx
sub ecx, 20
shr ecx, 3 ; number of 8-byte set infos
lea eax, [esi+20]
.set_loop:
test ecx, ecx
jz .no_alt_enum
cmp byte [eax+7], 0 ; bAltEnumCode
jne .set_found
add eax, 8
dec ecx
jmp .set_loop
.set_found:
pop ecx
mov cl, [eax+6] ; bMS_VendorCode
mov [modeswitch_alt_setup+1], cl
mov cl, [eax+7] ; bAltEnumCode -> wValue high byte
mov [modeswitch_alt_setup+3], cl
DEBUGF 1,'K : modeswitch: MS OS 2.0 alt enum supported\n'
mov ebx, [.calldata] ; pipe 0
invoke USBControlTransferAsync, ebx, modeswitch_alt_setup, 0, 0, \
modeswitch_alt_callback, ebx, 0
DEBUGF 1,'K : modeswitch SET_ALT_ENUMERATION submit %x\n', eax
test eax, eax
jz .fallback
ret
.no_alt_enum:
pop ecx
jmp .fallback
.next_cap:
add esi, ecx
jmp .cap_loop
.fallback:
DEBUGF 1,'K : modeswitch: no MS OS 2.0, using bulk message\n'
call modeswitch_send_cbw
ret
endp
; SET_ALT_ENUMERATION completed: on success the device re-enumerates
; by itself; if it stalled the request, try the bulk message instead.
proc modeswitch_alt_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch SET_ALT_ENUMERATION done, status %d\n', [.status]
cmp [.status], 0
je .ret
call modeswitch_send_cbw
.ret:
ret
endp
; The mode-switch CBW has completed. Read the CSW status like
; usb_modeswitch does: some firmwares only switch after the host has
; completed the whole Bulk-Only transaction.
proc modeswitch_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch CBW done, status %d\n', [.status]
cmp [.status], 0
jne .done
mov eax, [modeswitch_in_pipe]
test eax, eax
jz .done
invoke USBNormalTransferAsync, eax, modeswitch_csw, 13, \
modeswitch_csw_callback, 0, 1
test eax, eax
jnz .ret
.done:
mov dword [modeswitch_pipe0], 0 ; transaction over
.ret:
ret
endp
; The CSW arrived (or errored); nothing more to do, the device should
; drop off the bus and re-enumerate in its real configuration.
proc modeswitch_csw_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch CSW done, status %d len %d\n', [.status], [.length]
mov dword [modeswitch_pipe0], 0 ; transaction over
ret
endp
; SET_FEATURE(1) completed; the device either resets into its real
; configuration or (newer firmwares) just resets back into Zero-CD,
; which re-triggers the quirk with the next method of the list.
proc modeswitch_sf_callback stdcall uses ebx esi edi, .pipe:dword, .status:dword, .buffer:dword, .length:dword, .calldata:dword
DEBUGF 1,'K : modeswitch SET_FEATURE done, status %d\n', [.status]
mov dword [modeswitch_pipe0], 0 ; transaction over
ret
endp
proc AddDevice
push ebx esi
virtual at esp
@@ -737,6 +956,134 @@ end virtual
; bInterfaceProtocol are subsequent in interface_descr, just one
; memory reference is used for both.
mov esi, [.interface]
; Some 3G/LTE modems enumerate as a mass-storage-only "Zero-CD" (a
; virtual CD-ROM with Windows drivers) and must be switched to their
; real configuration by a magic vendor SCSI command sent to the bulk
; OUT endpoint (usb_modeswitch's "HuaweiNewMode"; a SET_FEATURE(1)
; only resets these devices back into Zero-CD). Match by VID:PID,
; fire the command and do not bind: the device drops off the bus and
; re-enumerates with a new PID.
mov ebx, [.pipe0]
invoke USBGetParam, ebx, 0 ; 0 = get device descriptor
test eax, eax
jz .no_modeswitch
mov ecx, [eax+8] ; idVendor | idProduct shl 16
mov edx, modeswitch_ids
.modeswitch_scan:
cmp dword [edx], 0
jz .no_modeswitch
cmp ecx, [edx]
jz .do_modeswitch
add edx, 8
jmp .modeswitch_scan
.do_modeswitch:
; one switch transaction at a time: some Zero-CDs (12d1:14ad) carry TWO
; storage interfaces and AddDevice fires for each; a second concurrent
; CBW confuses the firmware
cmp [modeswitch_pipe0], ebx
je .nothing
; pick the method: repeated appearances of the same id walk its method
; list (wrapping around), a different id starts from the first method
cmp ecx, [modeswitch_last_id]
je @f
mov [modeswitch_last_id], ecx
mov dword [modeswitch_attempt], 0
jmp .method_select
@@:
inc [modeswitch_attempt]
.method_select:
mov eax, [edx+4] ; start of the method list
mov ecx, [modeswitch_attempt]
.method_walk:
cmp dword [eax], -1 ; end of list: wrap around
jne @f
mov eax, [edx+4]
@@:
test ecx, ecx
jz .method_found
add eax, 8
dec ecx
jmp .method_walk
.method_found:
mov [modeswitch_pipe0], ebx
push esi
mov esi, switchdevice
invoke SysMsgBoardStr
pop esi
DEBUGF 1,'K : modeswitch attempt %d, method %d\n', [modeswitch_attempt], [eax]
cmp dword [eax], MSW_SET_FEATURE
je .method_set_feature
xor ecx, ecx
cmp dword [eax], MSW_CBW_INQ
jne @f
inc ecx
@@:
mov [modeswitch_inq], ecx
mov eax, [eax+4] ; the CBW for this attempt
mov [modeswitch_msg], eax
jmp .method_cbw
; SET_FEATURE(1) needs no endpoints: fire the control request and let
; the device drop off the bus by itself
.method_set_feature:
invoke USBControlTransferAsync, ebx, modeswitch_sf_setup, 0, 0, \
modeswitch_sf_callback, 0, 0
DEBUGF 1,'K : modeswitch SET_FEATURE submit %x\n', eax
test eax, eax
jnz .nothing
mov dword [modeswitch_pipe0], 0
jmp .nothing
.method_cbw:
; collect the bulk IN and bulk OUT endpoints of this interface
mov dword [modeswitch_in_pipe], 0
mov dword [modeswitch_in_ep], 0
mov dword [modeswitch_out_ep], 0
mov edx, [.config]
movzx ecx, [edx+config_descr.wTotalLength]
add edx, ecx ; edx = end of configuration data
.modeswitch_ep_scan:
movzx ecx, byte [esi] ; bLength
test ecx, ecx
jz .modeswitch_send ; malformed, use what we have
add esi, ecx
lea ecx, [esi+sizeof.endpoint_descr]
cmp ecx, edx
ja .modeswitch_send ; ran out of descriptors
cmp byte [esi+1], ENDPOINT_DESCR_TYPE
jne .modeswitch_ep_scan
mov cl, [esi+endpoint_descr.bmAttributes]
and cl, 3
cmp cl, BULK_PIPE
jne .modeswitch_ep_scan
movzx ecx, [esi+endpoint_descr.bEndpointAddress]
push edx
movzx edx, [esi+endpoint_descr.wMaxPacketSize]
and edx, 0xFFF
test cl, 80h
jz .modeswitch_ep_out
mov [modeswitch_in_ep], ecx
mov [modeswitch_in_mps], edx
pop edx
jmp .modeswitch_ep_scan
.modeswitch_ep_out:
mov [modeswitch_out_ep], ecx
mov [modeswitch_out_mps], edx
pop edx
jmp .modeswitch_ep_scan
.modeswitch_send:
cmp dword [modeswitch_out_ep], 0
jz .nothing ; no bulk OUT: cannot switch
mov [modeswitch_pipe0], ebx
; try the Windows mechanism first (MS OS 2.0 alternate enumeration,
; this is how E3372h switches); its callback falls back to the classic
; bulk switch message if the device has no such capability
invoke USBControlTransferAsync, ebx, modeswitch_bos_setup, \
modeswitch_bos_buf, 256, modeswitch_bos_callback, ebx, 1
DEBUGF 1,'K : modeswitch BOS read submit %x\n', eax
test eax, eax
jnz .nothing
call modeswitch_send_cbw ; could not even ask: fall back
jmp .nothing
.no_modeswitch:
xor ebx, ebx
mov cx, word [esi+interface_descr.bInterfaceSubClass]
; 1b. For Mass-storage SCSI-command-set Bulk-only devices subclass must be 6
@@ -991,6 +1338,16 @@ proc inquiry_callback
test al, al
jnz .nothing
DEBUGF 1,'K : direct-access mass storage device detected\n'
; Units that report 'medium not present' (the empty card slot of an LTE
; modem or card reader) are not registered: the kernel has no media
; change detection, so such a disk would only sit dead in the file
; managers. Replugging the device after inserting a card registers it.
mov edx, [esp+8]
cmp [edx+usb_unit_data.MediaPresent], 0
jnz @f
DEBUGF 1,'K : no media, not registering the disk\n'
ret 8
@@:
; 3. We have found a new disk device. Increment number of references.
lock inc [ecx+usb_device_data.NumReferences]
; Unfortunately, we are now in the context of the USB thread,
@@ -1568,6 +1925,117 @@ inquiry_fail db 'K : INQUIRY command failed',13,10,0
;read_capacity_fail db 'K : READ CAPACITY command failed',13,10,0
;read_fail db 'K : READ command failed',13,10,0
noindex db 'K : failed to generate disk name',13,10,0
switchdevice db 'K : Zero-CD modem detected, switching mode',13,10,0
; Zero-CD devices to switch: pairs of (idVendor + idProduct shl 16,
; pointer to a method list). Different firmware generations accept
; different switch methods and silently ignore (or merely ACK) the
; others, and some do not react to the method the usb_modeswitch
; database prescribes. So every id gets a LIST of methods and each
; (re)appearance of the same id tries the next one, wrapping around.
; No timers needed: an unswitched stick resets itself about half a
; minute after a swallowed command (observed on K3806), and the user
; can always just replug.
MSW_CBW = 0 ; method: bulk message, param = CBW ptr
MSW_SET_FEATURE = 1 ; method: SET_FEATURE(1) control request
MSW_CBW_INQ = 2 ; method: INQUIRY exchange, then the CBW;
; some firmwares accept the switch only
; after normal SCSI traffic (on Linux and
; Windows the storage driver reads the
; virtual CD before any switch tool runs)
align 4
modeswitch_ids dd 0x1F0112D1, modeswitch_list_1f01 ; Huawei E3372 etc
dd 0x14AD12D1, modeswitch_list_14ad ; Vodafone K3806
dd 0
; E3372h-153: the 10-byte command is the only one this firmware
; reacts to (verified on hardware; SET_FEATURE only resets it)
modeswitch_list_1f01:
dd MSW_CBW, modeswitch_cbw_new
dd -1
; K3806: the plain usb_modeswitch message (classic Huawei), the eject
; and the E3372 message are all ACKed but ignored, SET_FEATURE stalls
; (verified on hardware) - so lead with INQUIRY+message
modeswitch_list_14ad:
dd MSW_CBW_INQ, modeswitch_cbw_old
dd MSW_SET_FEATURE, 0
dd MSW_CBW, modeswitch_cbw_eject
dd MSW_CBW, modeswitch_cbw_new
dd MSW_CBW, modeswitch_cbw_old
dd -1
; usb_modeswitch's message for the 1F01 Zero-CD family: a CBW with the
; 10-byte vendor command 11 06 20 00 00 00 00 00 01 00 (note the 01 in
; byte 8; the older 6-byte 11 06 20 00 00 01 variant is ignored by
; E3372h firmwares) and no data stage
modeswitch_cbw_new:
db 'USBC' ; dCBWSignature
dd 0x12345678 ; dCBWTag
dd 0 ; dCBWDataTransferLength
db 0 ; bmCBWFlags
db 0 ; bCBWLUN
db 10 ; bCBWCBLength
db 0x11, 0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
db 0, 0, 0, 0, 0, 0
; the classic Huawei message for older sticks (usb_modeswitch 12d1:14ad
; etc): the 6-byte vendor command 11 06 20 00 00 01, byte-for-byte as
; usb_modeswitch sends it (bCBWCBLength is 0 in the original message)
modeswitch_cbw_old:
db 'USBC' ; dCBWSignature
dd 0x12345678 ; dCBWTag
dd 0 ; dCBWDataTransferLength
db 0 ; bmCBWFlags
db 0 ; bCBWLUN
db 0 ; bCBWCBLength
db 0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00
db 0, 0, 0, 0, 0, 0
; the standard eject (START STOP UNIT with LoEj|Stop): the generic
; Zero-CD switch used by many non-Huawei sticks
modeswitch_cbw_eject:
db 'USBC' ; dCBWSignature
dd 0x12345678 ; dCBWTag
dd 0 ; dCBWDataTransferLength
db 0 ; bmCBWFlags
db 0 ; bCBWLUN
db 6 ; bCBWCBLength
db 0x1B, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00
db 0, 0, 0, 0, 0, 0
; SET_FEATURE(1) to the device: the switch of the oldest Huawei sticks
modeswitch_sf_setup db 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
; standard INQUIRY (36 bytes of data IN), the warm-up for MSW_CBW_INQ
modeswitch_cbw_inq:
db 'USBC' ; dCBWSignature
dd 0x12345678 ; dCBWTag
dd 36 ; dCBWDataTransferLength
db 0x80 ; bmCBWFlags: data IN
db 0 ; bCBWLUN
db 6 ; bCBWCBLength
db 0x12, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00
db 0, 0, 0, 0, 0, 0
; scratch state of the mode-switch transaction
modeswitch_pipe0 dd 0 ; config pipe of the device
; (nonzero = transaction running)
modeswitch_msg dd 0 ; the CBW chosen for this device
modeswitch_inq dd 0 ; run an INQUIRY before the CBW
modeswitch_out_pipe dd 0 ; bulk OUT pipe handle
modeswitch_last_id dd 0 ; VID:PID of the last attempt
modeswitch_attempt dd 0 ; method index for that id
modeswitch_in_pipe dd 0 ; bulk IN pipe handle (for the CSW)
modeswitch_in_ep dd 0
modeswitch_in_mps dd 0
modeswitch_out_ep dd 0
modeswitch_out_mps dd 0
; GET_DESCRIPTOR(BOS), up to 256 bytes
modeswitch_bos_setup db 0x80, 0x06, 0x00, 0x0F, 0x00, 0x00
dw 256
; MS OS 2.0 "set alternate enumeration": vendor request to the device,
; bRequest (+1) and wValue high byte (+3) are patched in at runtime
modeswitch_alt_setup db 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00
; platform capability GUID of MS OS 2.0: D8DD60DF-4589-4CC7-9CD2-659D9E648A9F
msos20_guid db 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C
db 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F
modeswitch_csw rb 16 ; CSW receive buffer
modeswitch_bos_buf rb 256 ; BOS descriptor buffer
align 4
; Structure with callback functions.
File diff suppressed because it is too large. Load diff
+1
View File
@@ -3545,6 +3545,7 @@ ext_SetFileEnd:
call extfsTruncateFile
pop eax
.done:
lea ebx, [ebp+EXTFS.inodeBuffer]
lea eax, [ebx+INODE.mTime]
mov edx, -1
cmp [ebx+INODE.extraISize], 12
+28 -1
View File
@@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2026. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Part of the TCP/IP network stack for KolibriOS ;;
@@ -1034,6 +1034,9 @@ socket_send:
test eax, eax
jz .invalid
test esi, esi
jz .zero_length
stdcall is_region_userspace, edx, esi
jnz .invalid
@@ -1047,6 +1050,10 @@ socket_send:
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.zero_length:
DEBUGF DEBUG_NETWORK_ERROR, "SOCKET_send: data length = 0\n"
mov dword[esp + SYSCALL_STACK.eax], 0
ret
align 4
socket_send_udp:
@@ -1070,11 +1077,15 @@ socket_send_tcp:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: TCP\n"
.loop:
push eax
add eax, STREAM_SOCKET.snd
call socket_ring_write
pop eax
test ecx, ecx
jz .block
mov [esp + SYSCALL_STACK.eax], ecx
mov [eax + SOCKET.errorcode], 0
push eax
@@ -1084,6 +1095,22 @@ socket_send_tcp:
mov [esp + SYSCALL_STACK.ebx], eax
ret
.block:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: TCP is blocked\n"
test [eax + SOCKET.options], SO_NONBLOCK
jnz .wouldblock
call socket_block
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: TCP is unblocked\n"
mov ecx, dword[esp + SYSCALL_STACK.esi]
jmp .loop
.wouldblock:
mov dword[esp + SYSCALL_STACK.ebx], EWOULDBLOCK
mov dword[esp + SYSCALL_STACK.eax], -1
pop esi edx
ret
align 4
socket_send_ip:
+4 -1
View File
@@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2026. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; STACK.INC ;;
@@ -168,6 +168,9 @@ NET_HWACC_TCP_IPv4_OUT = 1 shl 1
NET_BUFF_LOOPBACK = 0
NET_BUFF_ETH = 1
; Hardware state (inside link_state)
NET_TX_BLOCKED = 1 shl 31 ; Transmit queue is full, if you call transmit again, driver might drop your frame
struct NET_DEVICE
device_type dd ? ; Type field
+28 -3
View File
@@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2026. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Part of the TCP/IP network stack for KolibriOS ;;
@@ -554,6 +554,14 @@ endl
mov ecx, esi
mov ebx, [eax + IP_SOCKET.device]
test ebx, ebx
jz @f
; Check if the output path is blocked, dont generate output frames if so.
test [ebx + NET_DEVICE.link_state], NET_TX_BLOCKED
jnz .output_blocked
@@:
mov edx, [eax + IP_SOCKET.LocalIP] ; source ip
mov edi, [eax + IP_SOCKET.RemoteIP] ; dest ip
mov al, [eax + IP_SOCKET.ttl]
@@ -736,6 +744,23 @@ endl
or eax, -1
ret
.output_blocked:
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_send: output path blocked, aborting\n"
pop ecx
add esp, ecx
add esp, 4
pop eax
mov [eax + TCP_SOCKET.timer_retransmission], TCP_time_re_min
or [eax + TCP_SOCKET.timer_flags], timer_flag_retransmission
lea ecx, [eax + SOCKET.mutex]
call mutex_unlock
or eax, -1
ret
.send_error:
add esp, 4
@@ -746,8 +771,8 @@ endl
DEBUGF DEBUG_NETWORK_ERROR, "TCP_send: sending failed\n"
or eax, -2
or eax, -1
dec eax
ret
endp
+3 -3
View File
@@ -320,12 +320,12 @@ tcp_respond:
stosb
mov eax, SOCKET_BUFFER_SIZE
sub eax, [esi + STREAM_SOCKET.rcv.size]
cmp eax, TCP_max_win
mov cl, [esi + TCP_SOCKET.RCV_SCALE]
shr eax, cl ; scale first, then clamp to the
cmp eax, TCP_max_win ; 16-bit field maximum
jbe .lessthanmax
mov eax, TCP_max_win
.lessthanmax:
mov cl, [esi + TCP_SOCKET.RCV_SCALE]
shr eax, cl
xchg al, ah
stosw ; window
Submodule
+1
Submodule programs/cmm added at 4678e1605d.
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("app_plus.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "app_plus.com")
-18
View File
@@ -1,18 +0,0 @@
struct sysdir
{
char name[64];
char path[64];
} sysdir;
:int SetAdditionalSystemDirectory(dword tName, tPath)
{
int i;
strcpy(#sysdir.name, tName);
strcpy(#sysdir.path, tPath);
$mov eax, 30
$mov ebx, 3
ECX = #sysdir;
$int 0x40
}
-162
View File
@@ -1,162 +0,0 @@
#define MEMSIZE 1024*60
#include "..\lib\gui.h"
#include "..\lib\obj\proc_lib.h"
#include "..\lib\patterns\simple_open_dialog.h"
#include "..\lib\patterns\restart_process.h"
#include "added_sysdir.c"
//===================================================//
// //
// DATA //
// //
//===================================================//
#define WINW 570
#define WINH 300
#define CONX 28 //content X pos
#define CONY 25 //content Y pos
char default_dir[] = "/sys";
od_filter filter2;
#define BTN_MANUAL_SEARCH 10
#define BTN_OPEN_ANYWAY 11
#define APP_PLUS_INI_PATH "/sys/settings/app_plus.ini"
//===================================================//
// //
// TRANSLATIONS //
// //
//===================================================//
#ifdef LANG_RUS
?define WINDOW_TITLE_TEXT "Внимание!"
?define CONTENT_HEADER_TEXT "KolibriOS работает в режиме дискеты"
?define DESCRIPTION_TEXT "Многие приложения сейчас недоступны.
Причина в том, что не смонтирован дополнительный системный
каталог. Но вы можете найти и задать его вручную. Его название
'kolibrios'. Вы также можете загрузить latest-dirstr.7z через
WebView и найти его внутри."
?define MANUALLY_BUTTON_TEXT "Указать папку /kolibrios/..."
?define OPEN_ANYWAY_BUTTON_TEXT "Запустить APP+ (некоторые программы будут недоступны)"
#else
?define WINDOW_TITLE_TEXT "Warning!"
?define CONTENT_HEADER_TEXT "KolibriOS is running in floppy mode"
?define DESCRIPTION_TEXT "A lot of apps aren't available.
The reason is that additional system directory is not mounted.
But you can find and set it manually. Its name is 'kolibrios'.
You can also download latest-dirstr.7z via WebView and find
it inside."
?define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
?define OPEN_ANYWAY_BUTTON_TEXT "Open APP+ anyway (some programs won't be available)"
#endif
//===================================================//
// //
// CODE //
// //
//===================================================//
void main()
{
if (param) {
SetAdditionalSystemDirectory("kolibrios", #param+1);
ExitProcess();
}
WaitAutosearch();
CheckKosMounted();
o_dialog.type = 2;
#define NO_DLL_INIT
load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog);
active_button_id = BTN_MANUAL_SEARCH;
loop() switch(@WaitEvent())
{
case evButton:
EventButton(GetButtonID());
break;
case evKey:
@GetKeyScancode();
if (AL == SCAN_CODE_ENTER) {
EventButton(active_button_id);
} else if (AL == SCAN_CODE_TAB) {
active_button_id = active_button_id-10^1 + 10;
DrawButtons();
}
break;
case evReDraw:
draw_window();
}
}
void draw_window()
{
sc.get();
DefineAndDrawWindow(screen.w-WINW/2, 100, WINW, WINH+skin_h, 0x34, sc.work, WINDOW_TITLE_TEXT,0);
draw_icon_16w(CONX+2, CONY-3, 5);
WriteTextB(CONX+27+2,CONY+2,0x81,MixColors(sc.work, 0xB92234,220),CONTENT_HEADER_TEXT);
WriteTextB(CONX+27,CONY,0x81,0xB92234,CONTENT_HEADER_TEXT);
WriteTextLines(CONX,CONY+42,0x90,sc.work_text,DESCRIPTION_TEXT,20);
DrawButtons();
}
void DrawButtons()
{
DrawStandartCaptButton(CONX, WINH-CONY-58, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT);
DrawStandartCaptButton(CONX, WINH-CONY-22, BTN_OPEN_ANYWAY, OPEN_ANYWAY_BUTTON_TEXT);
}
void CheckKosMounted()
{
if (dir_exists("/kolibrios"))
{
if (file_exists(APP_PLUS_INI_PATH)) EventOpenApp();
ExitProcess();
}
}
void WaitAutosearch()
{
while (CheckProcessExists("SEARCHAP")) pause(2);
}
//===================================================//
// //
// EVENTS //
// //
//===================================================//
void EventManualSearch()
{
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path+1);
pause(3);
CheckKosMounted();
}
void EventOpenApp()
{
if (RunProgram("/sys/syspanel", APP_PLUS_INI_PATH) < 0) {
notify("'App+ cannot start because\n/sys/syspanel does not exist' -E");
}
}
void EventButton(dword id)
{
if (id==CLOSE_BTN) ExitProcess();
else if (id==BTN_MANUAL_SEARCH) EventManualSearch();
else if (id==BTN_OPEN_ANYWAY) {
EventOpenApp();
ExitProcess();
}
}
stop:
-6
View File
@@ -1,6 +0,0 @@
@c-- /D=LANG_ENG app_plus.c
@del *.
@rename *.com *.
@del warning.txt
@pause
-5
View File
@@ -1,5 +0,0 @@
@c-- /D=LANG_RUS app_plus.c
@del *.
@rename *.com *.
@del warning.txt
@pause
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("appearance.c", "c-- /D=AUTOBUILD /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "appearance.com")
-472
View File
@@ -1,472 +0,0 @@
//11.03.12 - start!
#define MEMSIZE 1024*70
#include "../lib/mem.h"
#include "../lib/strings.h"
#include "../lib/io.h"
#include "../lib/list_box.h"
#include "../lib/gui.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/obj/libini.h"
#include "../lib/patterns/select_list.h"
#include "../lib/patterns/simple_open_dialog.h"
#include "../lib/patterns/restart_process.h"
dword fmas;
#include "ui_elements_preview.h"
#include "const.h"
//===================================================//
// //
// DATA //
// //
//===================================================//
int active_skin=-1, active_wallpaper=-1, active_screensaver=-1;
checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, false };
checkbox optionbox_tiled = { T_CHECKBOX_TILED, false };
checkbox optionbox_auto = { T_CHECKBOX_AUTO, true };
char ss_available[200];
collection list;
//===================================================//
// //
// CODE //
// //
//===================================================//
void main()
{
int id, i;
load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1);
load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog);
GetIniSettings();
tabs.add(#t_skins, #EventTabSkinsClick);
tabs.add(#t_wallpapers, #EventTabWallpappersClick);
tabs.add(#t_screensaver, #EventTabScreensaverClick);
tabs.draw_active_tab();
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
loop() switch(WaitEvent())
{
case evMouse:
SelectList_ProcessMouse();
if (tabs.active_tab == TAB_SCREENSAVERS) {
scrollbar_h_mouse stdcall (#ss_timeout);
if (ss_timeout.redraw) {
draw_timeout();
ss_timeout.redraw = false; //reset flag
}
}
break;
case evButton:
id=GetButtonID();
if (id==1) EventExit();
tabs.click(id);
if (tabs.active_tab == TAB_SKINS) {
checkbox1.click(id);
spinbox1.click(id);
}
if (tabs.active_tab == TAB_WALLPAPERS) {
if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder();
if (optionbox_stretch.click(id)) EventSetWallpMode(1,0,0);
if (optionbox_tiled.click(id)) EventSetWallpMode(0,1,0);
if (optionbox_auto.click(id)) EventSetWallpMode(0,0,1);
}
if (tabs.active_tab == TAB_SCREENSAVERS) {
if (id==BTN_TEST_SCREENSAVER) EventOpenFile();
if (id==BTN_SET_SCREENSAVER) EventSetSs();
}
break;
case evKey:
GetKeys();
if (select_list.ProcessKey(key_scancode)) { EventApply(); break; }
if (key_scancode==SCAN_CODE_ENTER) { EventOpenFile(); break; }
if (key_scancode==SCAN_CODE_DEL) { EventDeleteFile(); break; }
if (key_scancode==SCAN_CODE_TAB) {
id = tabs.active_tab+1;
if(id==3)id=0;
tabs.click(id + tabs.base_id);
break;
}
for (i=select_list.cur_y+1; i<select_list.count; i++)
{
id = list.get(i) + strrchr(list.get(i), '/');
if (ESBYTE[id]==key_ascii) || (ESBYTE[id]==key_ascii-32)
{
select_list.cur_y = i - 1;
select_list.KeyDown();
EventApply();
break;
}
}
break;
case evReDraw:
draw_window();
}
}
void draw_window()
{
sc.get();
DefineAndDrawWindow(screen.w-WIN_W-9/2,80,WIN_W+9,WIN_H+4+skin_h,0x74,sc.work,WINDOW_HEADER,0);
DrawBar(0, 0, WIN_W, PANEL_H-2, sc.work); //top
DrawBar(0, PANEL_H-2, LP-2, WIN_H-PANEL_H-LP+4, EDX); //left
DrawBar(LIST_W+LP+20, PANEL_H-2, WIN_W-LIST_W-26, WIN_H-PANEL_H-LP+4, EDX); //right
DrawBar(0, WIN_H-LP+2, WIN_W, LP-2, EDX); //bottom
tabs.draw();
draw_icon_16w(tabs.x + TAB_P, LP+5, 17);
draw_icon_16w(sizeof(t_skins)-1*8 + TAB_P + TAB_P + tabs.x, LP+5, 6);
draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_P + TAB_P + TAB_P + tabs.x, LP+5, 61);
if (tabs.active_tab == TAB_SKINS)
{
DrawFrame(RIGHTx, PANEL_H+5, RIGHTw, RIGHTh, T_UI_PREVIEW);
DrawUiElementsPreview(RIGHTx+20, PANEL_H+5, RIGHTh);
}
if (tabs.active_tab == TAB_WALLPAPERS)
{
DrawFrame(RIGHTx, PANEL_H+5, 180, 105, T_PICTURE_MODE);
optionbox_stretch.draw(RIGHTx+14, PANEL_H+25);
optionbox_tiled.draw(RIGHTx+14, PANEL_H+52);
optionbox_auto.draw(RIGHTx+14, PANEL_H+79);
DrawStandartCaptButton(RIGHTx, PANEL_H+130, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER);
}
if (tabs.active_tab == TAB_SCREENSAVERS)
{
draw_timeout();
ss_timeout.line_col = sc.line;
ss_timeout.frnt_col = sc.work;
scrollbar_h_draw stdcall (#ss_timeout);
DrawRectangle(RIGHTx, RIGHTy+25, RIGHTw-20, 15, sc.line);
ESI = DrawStandartCaptButton(RIGHTx, PANEL_H + 65, BTN_TEST_SCREENSAVER, T_SS_PREVIEW);
DrawStandartCaptButton(RIGHTx+ESI, PANEL_H + 65, BTN_SET_SCREENSAVER, T_SS_SET);
}
$push select_list.cur_y
SelectList_Init(
LP,
PANEL_H,
LIST_W,
WIN_H - LP - PANEL_H
);
$pop select_list.cur_y
SelectList_Draw();
SelectList_DrawBorder();
}
void draw_timeout()
{
miniprintf(#param, T_SS_TIMEOUT, ss_timeout.position+1);
WriteTextWithBg(RIGHTx, PANEL_H, 0xD0, sc.work_text, #param, sc.work);
}
void add_filesnames_into_the_list()
{
int j;
for (j=0; j<select_list.count; j++) {
miniprintf(#param,"%s/",#folder_path);
strcat(#param, io.dir.position(ESDWORD[j*4+fmas]));
list.add(#param);
}
}
void Open_Dir()
{
int j;
dword ext;
select_list.ClearList();
if (io.dir.buffer) free(io.dir.buffer);
io.dir.load(#folder_path,DIR_ONLYREAL);
if (fmas) free(fmas);
fmas = malloc(io.dir.count * 4);
for (j=0; j<io.dir.count; j++)
{
strncpy(#param, io.dir.position(j), PATHLEN);
strlwr(#param);
ext = #param + strrchr(#param,'.');
if (tabs.active_tab==TAB_SKINS) {
if (!streq(ext,"skn")) continue;
}
if (tabs.active_tab==TAB_WALLPAPERS) {
if (!streq(ext,"png")) && (!streq(ext,"jpg"))
&& (!streq(ext,"jpeg")) && (!streq(ext,"bmp"))
&& (!streq(ext,"gif")) continue;
}
ESDWORD[select_list.count*4 + fmas] = j;
select_list.count++;
}
sort_by_name(0, select_list.count-1);
list.drop();
//save current item for tab change
//add default item
if(tabs.active_tab == TAB_SKINS)
{
select_list.count++;
list.add(#default_skin);
add_filesnames_into_the_list();
if (active_skin==-1) && (ESBYTE[#previous_skin])
{
for (j=0; j<select_list.count; j++) {
if (streq(list.get(j), #previous_skin)) {
active_skin = j;
break;
}
}
}
select_list.cur_y = active_skin;
} else {
select_list.count++;
list.add(#default_wallp);
add_filesnames_into_the_list();
if (active_wallpaper==-1) && (ESBYTE[#previous_wallp]=='\\')
{
for (j=0; j<select_list.count; j++) {
if (streq(list.get(j), #previous_wallp+4)) {
active_wallpaper = j;
break;
}
}
}
select_list.cur_y = active_wallpaper;
}
if (!select_list.count) notify(T_NO_FILES);
if (select_list.cur_y>SL_VISIBLE) {
select_list.first = -SL_VISIBLE/2 + select_list.cur_y;
}
select_list.CheckDoesValuesOkey();
if (LIST_W) draw_window();
}
void SelectList_DrawLine(dword i)
{
int draw_y = i*SELECT_LIST_ITEMH+PANEL_H;
int i_abs = select_list.first + i;
dword text_color = 0xFFFfff;
dword bg_color = 0x000000;
char filename_buf[PATHLEN];
char* filename = #filename_buf;
strcpy(filename, list.get(i_abs));
if (EAX = strrchr(filename,'/')) filename += EAX;
if (ESBYTE[filename]=='T') && (ESBYTE[filename+1]=='_') filename+=2;
EAX = math.min(strrchr(filename,'.')-1, LIST_W - 24 / 8);
if(EAX) ESBYTE[filename+EAX] = '\0';
//save current item for tab change
switch(tabs.active_tab) {
CASE TAB_SKINS:
active_skin = select_list.cur_y;
if (!i_abs) filename = T_DEFAULT;
BREAK;
CASE TAB_WALLPAPERS:
active_wallpaper = select_list.cur_y;
if (!i_abs) filename = T_DEFAULT;
BREAK;
CASE TAB_SCREENSAVERS:
active_screensaver = select_list.cur_y;
if (!i_abs) filename = T_NO_SS;
}
if (select_list.cur_y == i_abs) {
text_color = sc.button;
bg_color = sc.button_text;
}
DrawBar(select_list.x, draw_y, LIST_W, SELECT_LIST_ITEMH, text_color);
WriteText(select_list.x+12,draw_y+select_list.text_y,select_list.font_type,bg_color, filename);
}
void GetIniSettings()
{
ini.section = "style";
ini.GetString("default_skin", #default_skin, PATHLEN, 0);
ini.GetString("default_wallp", #default_wallp, PATHLEN, 0);
ini.GetString("skin", #previous_skin, PATHLEN, 0);
ini.GetString("bg_param", #previous_wallp, PATHLEN, 0);
ini.section = "screensaver";
ss_timeout.position = ini.GetInt("timeout", 10) - 1;
ini.GetString("available", #ss_available, sizeof(ss_available), 0);
ini.GetString("program", #previous_ss, PATHLEN, 0);
}
//===================================================//
// //
// EVENTS //
// //
//===================================================//
void EventTabSkinsClick()
{
miniprintf(#folder_path, "%s/res/skins", get_real_kolibrios_path());
Open_Dir();
}
void EventTabWallpappersClick()
{
if (opendir_path) {
strcpy(#folder_path, #opendir_path);
} else {
miniprintf(#folder_path, "%s/res/wallpapers", get_real_kolibrios_path());
}
Open_Dir();
}
void EventTabScreensaverClick()
{
dword j;
char ssmas[sizeof(ss_available)];
list.drop();
select_list.ClearList();
select_list.count++;
list.add("");
strcpy(#ssmas, #ss_available);
do {
j = strrchr(#ssmas, '|');
if (ssmas[j]=='/') {
strcpy(#param, #ssmas + j);
} else {
miniprintf(#param, "/sys/%s", #ssmas + j);
}
list.add(#param);
ESBYTE[#ssmas + j - 1] = '\0';
select_list.count++;
} while (j);
if (active_screensaver == -1) && (ESBYTE[#previous_ss]) {
for (j=0; j<select_list.count; j++) {
if (strstr(list.get(j), #previous_ss)) active_screensaver = j;
}
}
select_list.cur_y = active_screensaver;
if (LIST_W) draw_window();
}
void EventDeleteFile()
{
if (select_list.cur_y) DeleteFile(list.get(select_list.cur_y)); //no not delete default
Open_Dir();
EventApply();
}
void EventSelectWallpFolder()
{
o_dialog.type = 2; //select folder
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) EventTabWallpappersClick();
}
void EventSetWallpMode(dword _stretch, _titled, _auto)
{
optionbox_stretch.checked = _stretch;
optionbox_tiled.checked = _titled;
optionbox_auto.checked = _auto;
optionbox_tiled.redraw();
optionbox_stretch.redraw();
optionbox_auto.redraw();
EventApply();
}
void EventApply()
{
char kivparam[4096+10];
dword file_name = list.get(select_list.cur_y);
if (tabs.active_tab==TAB_SKINS)
{
strcpy(#cur_skin_path, list.get(select_list.cur_y));
SetSystemSkin(#cur_skin_path);
MoveSize(OLD, OLD, OLD, WIN_H+4+GetSkinHeight());
}
if (tabs.active_tab==TAB_WALLPAPERS)
{
SelectList_Draw();
miniprintf(#kivparam, "\\S__%s", list.get(select_list.cur_y));
if (optionbox_tiled.checked) || (!select_list.cur_y) kivparam[1]='T';
if (optionbox_auto.checked) {
file_name += strrchr(file_name, '/');
if (ESBYTE[file_name] == 'T') && (ESBYTE[file_name+1] == '_') {
kivparam[1]='T';
}
}
RunProgram("/sys/media/kiv", #kivparam);
}
if (tabs.active_tab==TAB_SCREENSAVERS)
{
SelectList_Draw();
}
}
void EventOpenFile()
{
switch (tabs.active_tab) {
case TAB_SKINS:
RunProgram("/sys/skincfg", list.get(select_list.cur_y));
break;
case TAB_WALLPAPERS:
RunProgram("/sys/media/kiv", list.get(select_list.cur_y));
break;
case TAB_SCREENSAVERS:
if(select_list.cur_y) {
KillProcessByName("@ss", MULTIPLE);
RunProgram(list.get(select_list.cur_y), "@ss");
}
}
}
void EventExit()
{
if (get_real_kolibrios_path()) && (ESBYTE[#cur_skin_path]) {
ini.section = "style";
ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path));
}
ExitProcess();
}
void EventSetSs()
{
dword cur_ss = list.get(select_list.cur_y);
ini.section = "screensaver";
ini.SetString("program", cur_ss, strlen(cur_ss));
ini.SetInt("timeout", ss_timeout.position+1);
RestartProcessByName("/sys/@ss", MULTIPLE);
}
stop:
char folder_path[PATHLEN];
char cur_skin_path[PATHLEN];
char default_skin[PATHLEN];
char default_wallp[PATHLEN];
char previous_skin[PATHLEN];
char previous_wallp[PATHLEN];
char previous_ss[PATHLEN];
-5
View File
@@ -1,5 +0,0 @@
@c-- /D=LANG_ENG appearance.c
@del *.
@rename *.com *.
@del warning.txt
if not exist appearance ( @pause )
-5
View File
@@ -1,5 +0,0 @@
@c-- /D=LANG_RUS appearance.c
@del *.
@rename *.com *.
@del warning.txt
if not exist appearance ( @pause )
-106
View File
@@ -1,106 +0,0 @@
#ifdef LANG_RUS
char t_skins[] = " Стиль окон";
char t_wallpapers[] = " Обои";
char t_screensaver[] = " Скринсейвер";
?define WINDOW_HEADER "Настройки оформления"
?define T_SELECT_FOLDER "Выбрать папку"
?define T_PICTURE_MODE " Положение картинки "
?define T_CHECKBOX_STRETCH "Растянуть"
?define T_CHECKBOX_TILED "Замостить"
?define T_CHECKBOX_AUTO "Автоматически"
?define T_UPDATE_DOCK "Обновлять Dock-панель"
?define T_NO_FILES "'Поддерживаемые файлы не найдены' -E"
?define T_UI_PREVIEW " Пример компонентов "
?define T_SS_TIMEOUT "Интервал в минутах: %i "
?define T_SS_PREVIEW "Просмотр"
?define T_SS_SET "Установить"
?define T_NO_SS "[Выключен]"
?define T_DEFAULT "[По умолчанию]"
#else
char t_skins[] = " Skins";
char t_wallpapers[] = " Wallpapers";
char t_screensaver[] = " Screensaver";
?define WINDOW_HEADER "Appearance"
?define T_SELECT_FOLDER "Select folder"
?define T_PICTURE_MODE " Picture Mode "
?define T_CHECKBOX_STRETCH "Stretch"
?define T_CHECKBOX_TILED "Tiled"
?define T_CHECKBOX_AUTO "Auto"
?define T_UPDATE_DOCK "Update Dock"
?define T_NO_FILES "'No supported files were found' -E"
?define T_UI_PREVIEW " Components Preview "
?define T_SS_TIMEOUT "Wait in minutes: %i "
?define T_SS_PREVIEW "View"
?define T_SS_SET "Set"
?define T_NO_SS "[Disable]"
?define T_DEFAULT "[Default]"
#endif
#define WIN_W 560
#define WIN_H 445
#define LIST_W 260
#define PANEL_H 50
#define LP 6 //LIST_PADDING
#define SL_VISIBLE WIN_H - PANEL_H - LP / SELECT_LIST_ITEMH
#define RIGHTx LP + LIST_W + TAB_P + 30
#define RIGHTy PANEL_H
#define RIGHTw WIN_W - RIGHTx - LP - TAB_P
#define RIGHTh 215
enum {
TAB_SKINS,
TAB_WALLPAPERS,
TAB_SCREENSAVERS
};
enum {
BASE_TAB_BUTTON_ID=3,
BTN_SELECT_WALLP_FOLDER=10,
BTN_TEST_SCREENSAVER,
BTN_SET_SCREENSAVER
};
_ini ini = { "/sys/settings/system.ini" };
char default_dir[] = "/sys";
od_filter filter2 = { 8, "TXT\0\0" };
_tabs tabs = { -sizeof(t_skins)-sizeof(t_wallpapers)-sizeof(t_screensaver)
-3*8+WIN_W - TAB_P / 2, LP, NULL, BASE_TAB_BUTTON_ID };
scroll_bar ss_timeout = { RIGHTw-19,RIGHTx,15,RIGHTy+25,0,3,89,10,0,0xFFFfff,
0xBBBbbb,0xeeeeee};
void sort_by_name(int a, b) // for the first call: a = 0, b = sizeof(mas) - 1
{
int j;
int isn = a;
if (a >= b) return;
for (j = a; j <= b; j++) {
if (strcmpi(io.dir.position(ESDWORD[j*4+fmas]), io.dir.position(ESDWORD[b*4+fmas]))<=0) {
ESDWORD[isn*4+fmas] >< ESDWORD[j*4+fmas];
isn++;
}
}
sort_by_name(a, isn-2);
sort_by_name(isn, b);
}
dword get_real_kolibrios_path()
{
char real_kolibrios_path[256];
if (!dir_exists("/kolibrios")) return 0;
SetCurDir("/kolibrios");
GetCurDir(#real_kolibrios_path, sizeof(real_kolibrios_path));
return #real_kolibrios_path;
}
void SelectList_LineChanged()
{
EventApply();
}
@@ -1,33 +0,0 @@
checkbox checkbox1 = { "Checkbox", true };
more_less_box spinbox1 = { 23, 0, 999, "SpinBox" };
edit_box edit_cmm = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(param)-2,#param,0, 0b};
char st_str[16];
edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(st_str)-2,#st_str,0, 0b};
void DrawUiElementsPreview(dword x,y,h)
{
incn y2;
spinbox1.draw(x, y2.set(y+30));
WriteText(x, y2.inc(30), 0x90, sc.work_text, "C-- Edit");
DrawEditBoxPos(x, y2.inc(20), #edit_cmm);
WriteText(x, y2.inc(35), 0x90, sc.work_text, "Standard Edit");
DrawStEditBoxPos(x, y2.inc(20), #edit_st);
DrawStandartCaptButton(x, y+h-40, GetFreeButtonId(), "Button1");
DrawStandartCaptButton(x+100, y+h-40, GetFreeButtonId(), "Button2");
}
:void DrawStEditBoxPos(dword x,y, edit_box_pointer)
{
dword c_inactive = MixColors(sc.line, sc.work, 128);
dword c_active = MixColors(sc.line, 0, 128);
ESI = edit_box_pointer;
ESI.edit_box.left = x;
ESI.edit_box.top = y;
ESI.edit_box.border_color = c_inactive;
ESI.edit_box.focus_border_color = c_active;
edit_box_draw stdcall (edit_box_pointer);
}
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("barscfg.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "barscfg.com")
Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.
Binary file not shown.
-317
View File
@@ -1,317 +0,0 @@
#define MEMSIZE 1024*40
#include "..\lib\kolibri.h"
#include "..\lib\strings.h"
#include "..\lib\mem.h"
#include "..\lib\fs.h"
#include "..\lib\dll.h"
#include "..\lib\gui.h"
#include "..\lib\obj\libini.h"
#include "..\lib\obj\box_lib.h"
#include "..\lib\patterns\restart_process.h"
#ifdef LANG_RUS
?define WINDOW_TITLE "Настройки панели задач и Дока"
?define TASK_FRAME_T " Панель задач "
?define DOCK_FRAME_T " Док "
?define MIN_LEFT_BUTTON "Кнопка скрытия слева"
?define MIN_RIGHT_BUTTON "Кнопка скрытия справа"
?define SOFTEN_UP "Сглаживание сверху"
?define SOFTEN_DOWN "Сглаживание снизу"
?define CLOCK "Часы"
?define CPU_USAGE "Загрузка ЦП"
?define CHANGE_LANG "Язык ввода"
?define MENU_BUTTON "Кнопка меню"
?define PANEL_HEIGHT "Высота панели"
?define SOFTEN_HEIGHT "Высота сглаживания"
?define BUTTON_OFFSET "Поле вокруг кнопок"
?define FSIZE "Режим панели"
?define ASHOW "Не скрывать"
?define CHANGE_POS "Нажмите на изображение для смены позиции"
#else
?define WINDOW_TITLE "Taskbar and Docky configuration"
?define TASK_FRAME_T " Taskbar "
?define DOCK_FRAME_T " Docky "
?define MIN_LEFT_BUTTON "Min Left Button"
?define MIN_RIGHT_BUTTON "Min Right Button"
?define SOFTEN_UP "Soften Up"
?define SOFTEN_DOWN "Soften Down"
?define CLOCK "Clock"
?define CPU_USAGE "Cpu Usage"
?define CHANGE_LANG "Change Language"
?define MENU_BUTTON "Menu Button"
?define PANEL_HEIGHT "Panel Height"
?define SOFTEN_HEIGHT "Soften Height"
?define BUTTON_OFFSET "Button Offset"
?define FSIZE "Full width"
?define ASHOW "Always show"
?define CHANGE_POS "Click on image to change position"
#endif
char taskbar_ini_path[] = "/sys/settings/taskbar.ini";
_ini taskbar_flags_ini = { #taskbar_ini_path, "Flags" };
_ini taskbar_vars_ini = { #taskbar_ini_path, "Variables" };
_ini docky_ini = { "/sys/settings/docky.ini", "@" };
#define PIMG_W 37
#define PIMG_H 27 //27*5
unsigned char panels_img_data[] = FROM "bars_8b.raw";
dword panels_img_pal[] = {
0x00405D74,0x0084FC84,0x00FAFAFA,0x0000B400,
0x00E4E4E4,0x008C9B9C,0x000212FD,0x00D8DEDF,
0x00585C5D,0x0085B7E0,0x009EC6E7,0x0094C0E5,
0x00CB8800,0x00CE3D9E,0x00D20404,0x00485966
};
proc_info Form;
enum { BTN_TB_ATTACHEMENT=100, BTN_DOCKY_ATTACHEMENT=200 };
enum { TASKBAR, DOCKY };
more_less_box tbPanelHeight = { NULL, 6, 99, PANEL_HEIGHT };
more_less_box tbSoftenHeight = { NULL, 0, 99, SOFTEN_HEIGHT };
more_less_box tbButtonOffset = { NULL, 0, 99, BUTTON_OFFSET };
checkbox taskbar_on = 0;
checkbox docky_on = 0;
int tbAttachment;
checkbox tbSoftenUp = { SOFTEN_UP };
checkbox tbClock = { CLOCK };
checkbox tbSoftenDown = { SOFTEN_DOWN };
checkbox tbCpuUsage = { CPU_USAGE };
checkbox tbMinLeftButton = { MIN_LEFT_BUTTON };
checkbox tbChangeLang = { CHANGE_LANG };
checkbox tbMinRightButton = { MIN_RIGHT_BUTTON };
checkbox tbMenuButton = { MENU_BUTTON };
checkbox dkFsize = { FSIZE };
checkbox dkAshow = { ASHOW };
int dkLocation=0;
checkbox tbRunApplButton;
checkbox tbClnDeskButton;
void main()
{
dword id;
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
LoadCfg();
loop() switch(@WaitEvent())
{
case evButton:
id = @GetButtonID();
if (1==id) @ExitProcess();
if (taskbar_on.checked) EventTaskbarProcessButton(id);
if (docky_on.checked) EventDockyProcessButton(id);
if (taskbar_on.click(id)) {
IF (taskbar_on.checked == true) RunProgram("/sys/@taskbar", 0);
ELSE KillProcessByName("@TASKBAR", SINGLE);
DrawWindowContent();
}
if (docky_on.click(id)) {
IF (docky_on.checked == true) {
dkLocation = 2;
SaveSettingsAndRestartProcess(DOCKY);
} ELSE {
KillProcessByName("@DOCKY", SINGLE);
}
DrawWindowContent();
}
break;
case evKey:
if (@GetKeyScancode() == SCAN_CODE_ESC) ExitProcess();
break;
case evReDraw:
sc.get();
DefineAndDrawWindow(130, 150, 465, 398 + skin_h, 0x34, sc.work, WINDOW_TITLE, 0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) break;
DrawWindowContent();
}
}
void DrawPanelsImage(dword y, n)
{
PutPaletteImage(n * PIMG_W * PIMG_H + #panels_img_data, PIMG_W, PIMG_H, 22, y, 8, #panels_img_pal);
}
void SetDisabledMode()
{
EAX = taskbar_on.checked ^ 1;
tbSoftenUp.disabled =
tbSoftenDown.disabled =
tbMinLeftButton.disabled =
tbMinRightButton.disabled =
tbRunApplButton.disabled =
tbClnDeskButton.disabled =
tbClock.disabled =
tbCpuUsage.disabled =
tbChangeLang.disabled =
tbMenuButton.disabled =
tbPanelHeight.disabled =
tbSoftenHeight.disabled =
tbButtonOffset.disabled =
tbButtonOffset.disabled = EAX;
//
dkFsize.disabled =
dkAshow.disabled = docky_on.checked ^ 1;
}
void DrawWindowContent()
{
#define PD 10
dword frame_y;
word win_center_x = Form.cwidth / 2 + 20;
incn y;
int i;
SetDisabledMode();
frame_y = 15;
y.n = frame_y;
DefineButton(22, y.inc(18), PIMG_W-1, PIMG_H-1, 100 + BT_HIDE, 0);
DrawPanelsImage(y.n, tbAttachment);
WriteTextWithBg(68, y.inc(7), 0xD0, sc.work_text, CHANGE_POS, sc.work);
tbSoftenUp.draw(22, y.inc(35));
tbClock.draw(win_center_x, y.n);
tbSoftenDown.draw(22, y.inc(24));
tbCpuUsage.draw(win_center_x, y.n);
tbMinLeftButton.draw(22, y.inc(24));
tbChangeLang.draw(win_center_x, y.n);
tbMinRightButton.draw(22, y.inc(24));
tbMenuButton.draw(win_center_x, y.n);
tbPanelHeight.draw(22, y.inc(28));
tbSoftenHeight.draw(22, y.inc(32));
tbButtonOffset.draw(22, y.inc(32));
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T);
taskbar_on.draw(22, frame_y-7);
//DOCKY
frame_y = calc(y.inc(20));
DefineButton(22, y.inc(18), PIMG_W-1, PIMG_H-1, 200 + BT_HIDE, 0);
if (!dkLocation) i=2; else i=dkLocation;
DrawPanelsImage(y.n, i+1);
WriteTextWithBg(68, y.inc(7), 0xD0, sc.work_text, CHANGE_POS, sc.work);
dkFsize.draw(22, y.inc(35));
dkAshow.draw(win_center_x, y.n);
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T);
docky_on.draw(22, frame_y-7);
}
void LoadCfg()
{
tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1);
tbSoftenUp.checked = taskbar_flags_ini.GetInt("SoftenUp", 1);
tbSoftenDown.checked = taskbar_flags_ini.GetInt("SoftenDown", 1);
tbMinLeftButton.checked = taskbar_flags_ini.GetInt("MinLeftButton", 1);
tbMinRightButton.checked = taskbar_flags_ini.GetInt("MinRightButton", 1);
tbClock.checked = taskbar_flags_ini.GetInt("Clock", 1);
tbCpuUsage.checked = taskbar_flags_ini.GetInt("CpuUsage", 1);
tbChangeLang.checked = taskbar_flags_ini.GetInt("ChangeLang", 1);
tbMenuButton.checked = taskbar_flags_ini.GetInt("MenuButton", 1);
tbPanelHeight.value = taskbar_vars_ini.GetInt("PanelHeight", 28);
tbSoftenHeight.value = taskbar_vars_ini.GetInt("SoftenHeight", 4);
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
dkLocation = docky_ini.GetInt("location", 0);
dkFsize.checked = docky_ini.GetInt("fsize", 0);
dkAshow.checked = docky_ini.GetInt("ashow", 0);
taskbar_on.checked = CheckProcessExists("@TASKBAR");
docky_on.checked = CheckProcessExists("@DOCKY");
}
void SaveSettingsAndRestartProcess(byte panel_type)
{
if (panel_type==TASKBAR) {
taskbar_flags_ini.SetInt("Attachment", tbAttachment);
taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp.checked);
taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown.checked);
taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton.checked);
taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton.checked);
taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton.checked);
taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton.checked);
taskbar_flags_ini.SetInt("Clock", tbClock.checked);
taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage.checked);
taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang.checked);
taskbar_flags_ini.SetInt("MenuButton", tbMenuButton.checked);
taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight.value);
taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight.value);
taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset.value);
taskbar_vars_ini.SetInt("ButtonBottOffset", tbButtonOffset.value);
}
if (panel_type==DOCKY) {
if (!docky_on.checked) {
docky_ini.SetInt("location", 0);
} else {
docky_ini.SetInt("location", dkLocation);
}
docky_ini.SetInt("fsize", dkFsize.checked);
docky_ini.SetInt("ashow", dkAshow.checked);
}
RestartProcess(panel_type);
}
void RestartProcess(byte panel_type)
{
dword proc_name1;
if (panel_type == TASKBAR)
{
RestartProcessByName("/sys/@taskbar", SINGLE);
pause(50);
}
else
{
RestartProcessByName("/sys/@docky", SINGLE);
pause(120);
}
GetProcessInfo(#Form, SelfInfo);
ActivateWindow(GetProcessSlot(Form.ID));
}
void EventTaskbarProcessButton(dword id)
{
if (BTN_TB_ATTACHEMENT == id) {
tbAttachment ^= 1;
DrawWindowContent();
SaveSettingsAndRestartProcess(TASKBAR);
}
if (tbSoftenUp.click(id)) || (tbSoftenDown.click(id))
|| (tbMinLeftButton.click(id)) || (tbMinRightButton.click(id))
|| (tbRunApplButton.click(id)) || (tbClnDeskButton.click(id)) {
SaveSettingsAndRestartProcess(TASKBAR);
}
if (tbClock.click(id)) || (tbCpuUsage.click(id))
|| (tbChangeLang.click(id)) || (tbMenuButton.click(id))
|| (tbPanelHeight.click(id)) || (tbSoftenHeight.click(id))
|| (tbButtonOffset.click(id)) {
SaveSettingsAndRestartProcess(TASKBAR);
}
}
void EventDockyProcessButton(dword id)
{
if (BTN_DOCKY_ATTACHEMENT == id) {
dkLocation++;
if (dkLocation>4) dkLocation=1;
DrawWindowContent();
SaveSettingsAndRestartProcess(DOCKY);
}
if (dkFsize.click(id)) || (dkAshow.click(id)) {
SaveSettingsAndRestartProcess(DOCKY);
}
}
stop:
-6
View File
@@ -1,6 +0,0 @@
@c-- /D=LANG_ENG barscfg.c
@pause
@del barscfg
@rename *.com *.
@del warning.txt
-6
View File
@@ -1,6 +0,0 @@
@c-- /D=LANG_RUS barscfg.c
@pause
@del barscfg
@rename *.com *.
@del warning.txt
-285
View File
@@ -1,285 +0,0 @@
#include "TWB\colors.h"
#include "TWB\anchors.h"
#include "TWB\parse_tag.h"
#include "TWB\special.h"
#include "TWB\tag_list.h"
#define DEFAULT_BG_COL 0xffFBE5E4; //- peach; 0xffEBE8E9 - more grey
dword link_color_default;
dword link_color_active;
#include "TWB\links.h"
#define BODY_MARGIN 6
#define BASIC_CHAR_W 8
#define BASIC_LINE_H 18
struct STYLE {
bool
b, u, s, h,
font,
pre,
blq,
button,
image,
nav, header;
LIST tag_list;
dword title;
dword cur_line_h;
void reset();
};
void STYLE::reset()
{
b = u = s = h = font = pre = blq =
title = button = image = nav = header = false;
cur_line_h = NULL;
tag_list.reset();
}
struct TWebBrowser {
llist list;
STYLE style;
dword draw_y, draw_x, draw_w, left_gap;
dword o_bufpointer;
int cur_encoding, custom_encoding;
bool link, t_html, t_body;
dword bufpointer;
dword bufsize;
dword is_html;
collection img_url;
char header[150];
char linebuf[500];
char redirect[URL_SIZE];
bool secondrun;
void SetStyle();
void RenderTextbuf();
void RenderLine();
bool RenderImage();
void SetPageDefaults();
void ParseHtml();
void Reparse();
void NewLine();
void ChangeEncoding();
void AddCharToTheLine();
void DrawPage();
void tag_a();
void tag_p();
void tag_img();
void tag_kosicon();
void tag_div();
void tag_h1234_caption();
void tag_ol_ul_dt();
void tag_li();
void tag_q();
void tag_hr();
void tag_code();
void tag_meta_xml();
void tag_body();
void tag_iframe();
void tag_title();
void tag_font();
void tag_table_reset();
void tag_table();
void tag_td();
void tag_tr();
void reset_font_style();
};
#include "TWB\render.h"
#include "TWB\set_style.h"
//============================================================================================
void TWebBrowser::SetPageDefaults()
{
t_html = t_body = link = false;
style.reset();
reset_font_style();
link_color_default = 0x0000FF;
link_color_active = 0xFF0000;
links.clear();
anchors.clear();
img_url.drop();
text_colors.drop();
text_colors.add(0);
if (secondrun) {
canvas.Init(list.x, list.y, list.w, math.max(list.visible, list.count)+200);
canvas.Fill(0, bg_colors.get(0));
}
bg_colors.drop();
bg_colors.add(DEFAULT_BG_COL);
header = NULL;
draw_y = BODY_MARGIN;
draw_x = left_gap = BODY_MARGIN;
draw_w = list.w - BODY_MARGIN - BODY_MARGIN;
linebuf = 0;
redirect = '\0';
tag_table_reset();
is_html = true;
if (!strstri(bufpointer, "<body")) {
t_body = true;
if (!strstri(bufpointer, "<html")) && (!strstri(bufpointer, "<head")) && (!strstri(bufpointer, "<title"))
&& (!strstr(bufpointer, "<?xml")) && (!strstr(bufpointer, "<xml")) {
style.pre = true; //show linebreaks for a plaint text
is_html = false;
}
}
}
//============================================================================================
void TWebBrowser::Reparse()
{
ParseHtml(bufpointer, bufsize);
}
//============================================================================================
void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
int tab_len;
dword bufpos;
bufsize = _bufsize;
if (bufpointer == _bufpointer) {
custom_encoding = cur_encoding;
} else {
bufpointer = malloc(bufsize);
memmov(bufpointer, _bufpointer, bufsize);
//hold original buffer
o_bufpointer = malloc(bufsize);
memmov(o_bufpointer, bufpointer, bufsize);
cur_encoding = CH_CP866;
if (custom_encoding != -1) {
cur_encoding = custom_encoding;
bufpointer = ChangeCharset(cur_encoding, CH_CP866, bufpointer);
bufsize = strlen(bufpointer);
}
}
table.cols.drop();
secondrun = false;
_PARSE_START_:
SetPageDefaults();
for (bufpos=bufpointer; bufpos < bufpointer+bufsize; bufpos++;)
{
if (style.pre) {
if (ESBYTE[bufpos] == 0x0a) {
RenderTextbuf();
NewLine();
continue;
}
if (ESBYTE[bufpos] == 0x09) {
tab_len = draw_x - left_gap / list.font_w + strlen(#linebuf) % 4;
if (!tab_len) tab_len = 4; else tab_len = 4 - tab_len;
while (tab_len) {chrcat(#linebuf,' '); tab_len--;}
continue;
}
}
if (ESBYTE[bufpos] == '&') {
bufpos = GetUnicodeSymbol(#linebuf, sizeof(TWebBrowser.linebuf)-1, bufpos+1, bufpointer+bufsize);
continue;
}
if (ESBYTE[bufpos] == '<') && (is_html) {
if (strchr("!/?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", ESBYTE[bufpos+1])) {
bufpos++;
if (tag.parse(#bufpos, bufpointer + bufsize)) {
/*
if (secondrun)
{
if (streq(#tag.name, "tr")) debugln(" ");
if (!tag.opened) {
debugch('/');
} else {
debugch(' ');
}
debugln(sprintf(#param, "%s x%i y%i %s",
#tag.name, draw_x, draw_y, #linebuf));
}
//*/
RenderTextbuf();
if (debug_mode) { debugch('<'); if(!tag.opened)debugch('/'); debug(#tag.name); debugln(">"); }
$push cur_encoding
SetStyle();
$pop eax
// The thing is that UTF if longer than other encodings.
// So if encoding was changed from UTF to DOS than $bufpos position got wrong,
// and we have to start parse from the very beginning
if (EAX != cur_encoding) && (cur_encoding == CH_UTF8) {
ParseHtml(bufpointer, strlen(bufpointer));
return;
}
}
continue;
}
}
AddCharToTheLine(ESBYTE[bufpos]);
}
RenderTextbuf();
list.count = draw_y + style.cur_line_h;
list.CheckDoesValuesOkey();
anchors.current = NULL;
if (!secondrun) {
secondrun = true;
goto _PARSE_START_;
}
if (!header) {
strncpy(#header, #version, sizeof(TWebBrowser.header)-1);
DrawTitle(#header);
}
}
//============================================================================================
void TWebBrowser::AddCharToTheLine(unsigned char _char)
{
dword line_len = strlen(#linebuf);
if (_char<=15) _char=' ';
if (!style.pre) && (_char == ' ')
{
if (linebuf[line_len-1]==' ') return; //no double spaces
if (draw_x==left_gap) && (!linebuf) return; //no paces at the beginning of the line
if (link) && (line_len==0) return;
}
if (line_len < sizeof(TWebBrowser.linebuf)) {
chrcat(#linebuf+line_len, _char);
} else {
RenderTextbuf();
}
}
//============================================================================================
void TWebBrowser::ChangeEncoding(int _new_encoding)
{
if (cur_encoding == _new_encoding) return;
cur_encoding = _new_encoding;
bufpointer = ChangeCharset(cur_encoding, CH_CP866, bufpointer);
if (header) {
ChangeCharset(cur_encoding, CH_CP866, #header);
DrawTitle(#header);
}
}
//============================================================================================
scroll_bar scroll_wv = { 15,NULL,NULL,NULL,
0,2,NULL,0,0,0xeeeeee,0xBBBbbb,0xeeeeee};
void TWebBrowser::DrawPage()
{
if (list.w!=canvas.bufw) Reparse();
canvas.Show(list.first, list.h);
scroll_wv.max_area = list.count;
scroll_wv.cur_area = list.visible;
scroll_wv.position = list.first;
scroll_wv.all_redraw = 0;
scroll_wv.start_x = list.x + list.w;
scroll_wv.start_y = list.y;
scroll_wv.size_y = list.h;
if (list.count <= list.visible) {
DrawBar(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x,
scroll_wv.size_y, bg_colors.get(0) & 0x00FFFFFF);
} else {
scrollbar_v_draw(#scroll_wv);
}
}
-43
View File
@@ -1,43 +0,0 @@
struct _anchors {
char current[256];
collection anchor_name;
collection anchor_position;
void add();
int get_pos_by_name();
void clear();
void take_anchor_from();
} anchors=0;
void _anchors::add(dword _name, _pos)
{
anchor_name.add(_name);
anchor_position.add(itoa(_pos));
}
int _anchors::get_pos_by_name(dword _get_name)
{
dword pos_name = anchor_name.get_pos_by_name(_get_name);
if (ESBYTE[_get_name]==NULL) return 0;
if (pos_name==-1) {
return -1;
} else {
return atoi(anchor_position.get(pos_name));
}
}
void _anchors::clear()
{
anchor_name.drop();
anchor_position.drop();
}
void _anchors::take_anchor_from(dword _URL)
{
int anchor_pos;
if (!current) && (_URL) && (anchor_pos = strrchr(_URL, '#')) {
strncpy(#current, _URL+anchor_pos-1, sizeof(_anchors.current)-1);
ESBYTE[_URL+anchor_pos-1] = '\0';
}
}
-75
View File
@@ -1,75 +0,0 @@
collection_int text_colors;
collection_int bg_colors;
struct WEB_COLORS {
char *name;
dword rgb;
} web_colors[] = {
"aliceblue", 0xF0F8FF, "antiquewhite", 0xFAEBD7, "aqua", 0x00FFFF, "aquamarine", 0x7FFFD4,
"azure", 0xF0FFFF, "beige", 0xF5F5DC, "bisque", 0xFFE4C4, "black", 0x000000,
"blanchedalmond", 0xFFEBCD, "blue", 0x0000FF, "blueviolet", 0x8A2BE2, "brown", 0xA52A2A,
"burlywood", 0xDEB887, "cadetblue", 0x5F9EA0, "chartreuse", 0x7FFF00, "chocolate", 0xD2691E,
"coral", 0xFF7F50, "cornflowerblue", 0x6495ED, "cornsilk", 0xFFF8DC, "crimson", 0xDC143C,
"cyan", 0x00FFFF, "darkblue", 0x00008B, "darkcyan", 0x008B8B, "darkgoldenrod", 0xB8860B,
"darkgray", 0xA9A9A9, "darkgreen", 0x006400, "darkkhaki", 0xBDB76B, "darkmagenta", 0x8B008B,
"darkolivegreen", 0x556B2F, "darkorange", 0xFF8C00, "darkorchid", 0x9932CC, "darkred", 0x8B0000,
"darksalmon", 0xE9967A, "darkseagreen", 0x8FBC8F, "darkslateblue", 0x483D8B, "darkslategray", 0x2F4F4F,
"darkturquoise", 0x00CED1, "darkviolet", 0x9400D3, "deeppink", 0xFF1493, "deepskyblue", 0x00BFFF,
"dimgray", 0x696969, "dodgerblue", 0x1E90FF, "firebrick", 0xB22222, "floralwhite", 0xFFFAF0,
"forestgreen", 0x228B22, "fuchsia", 0xFF00FF, "gainsboro", 0xDCDCDC, "ghostwhite", 0xF8F8FF,
"gold", 0xFFD700, "goldenrod", 0xDAA520, "gray", 0x808080, "green", 0x008000,
"greenyellow", 0xADFF2F, "honeydew", 0xF0FFF0, "hotpink", 0xFF69B4, "indianred", 0xCD5C5C,
"indigo", 0x4B0082, "ivory", 0xFFFFF0, "khaki", 0xF0E68C, "lavender", 0xE6E6FA,
"lavenderblush", 0xFFF0F5, "lawngreen", 0x7CFC00, "lemonchiffon", 0xFFFACD, "lightblue", 0xADD8E6,
"lightcoral", 0xF08080, "lightcyan", 0xE0FFFF, "lightgreen", 0x90EE90, "lightgrey", 0xD3D3D3,
"lightpink", 0xFFB6C1, "lightsalmon", 0xFFA07A, "lightseagreen", 0x20B2AA, "lightskyblue", 0x87CEFA,
"lightslategray", 0x778899, "lightsteelblue", 0xB0C4DE, "lightyellow", 0xFFFFE0, "lime", 0x00FF00,
"limegreen", 0x32CD32, "linen", 0xFAF0E6, "magenta", 0xFF00FF, "maroon", 0x800000,
"mediumaquamarine", 0x66CDAA, "mediumblue", 0x0000CD, "mediumorchid", 0xBA55D3, "mediumpurple", 0x9370DB,
"mediumseagreen", 0x3CB371, "mediumslateblue", 0x7B68EE, "mediumspringgreen",0x00FA9A, "mediumturquoise", 0x48D1CC,
"mediumvioletred", 0xC71585, "midnightblue", 0x191970, "mintcream", 0xF5FFFA, "mistyrose", 0xFFE4E1,
"moccasin", 0xFFE4B5, "navajowhite", 0xFFDEAD, "navy", 0x000080, "oldlace", 0xFDF5E6,
"olive", 0x808000, "olivedrab", 0x6B8E23, "orange", 0xFFA500, "orangered", 0xFF4500,
"orchid", 0xDA70D6, "palegoldenrod", 0xEEE8AA, "palegreen", 0x98FB98, "paleturquoise", 0xAFEEEE,
"palevioletred", 0xDB7093, "papayawhip", 0xFFEFD5, "peachpuff", 0xFFDAB9, "peru", 0xCD853F,
"pink", 0xFFC0CB, "plum", 0xDDA0DD, "powderblue", 0xB0E0E6, "purple", 0x800080,
"red", 0xFF0000, "rosybrown", 0xBC8F8F, "royalblue", 0x4169E1, "saddlebrown", 0x8B4513,
"salmon", 0xFA8072, "sandybrown", 0xF4A460, "seagreen", 0x2E8B57, "seashell", 0xFFF5EE,
"sienna", 0xA0522D, "silver", 0xC0C0C0, "skyblue", 0x87CEEB, "slateblue", 0x6A5ACD,
"slategray", 0x708090, "snow", 0xFFFAFA, "springgreen", 0x00FF7F, "steelblue", 0x4682B4,
"tan", 0xD2B48C, "teal", 0x008080, "thistle", 0xD8BFD8, "tomato", 0xFF6347,
"turquoise", 0x40E0D0, "violet", 0xEE82EE, "wheat", 0xF5DEB3, "white", 0xFFFFFF,
"whitesmoke", 0xF5F5F5, "yellow", 0xFFFF00, "yellowgreen", 0x9ACD32, 0};
dword GetColor(char* color_str)
{
int ii;
dword textlen=0;
dword color=0;
strlwr(color_str);
if (ESBYTE[color_str] == '#') {
color_str++;
} else {
for (ii=0; web_colors[ii].name!=0; ii++)
{
if (streq(color_str, web_colors[ii].name)) return web_colors[ii].rgb;
}
}
textlen = strlen(color_str);
if (textlen==6) || (textlen==3)
{
FOR (ii=0; ii<textlen; ii++)
{
BL = ESBYTE[color_str+ii];
IF ((BL>='0') && (BL<='9')) BL -= '0';
//IF ((BL>='A') && (BL<='F')) BL -= 'A'-10;
IF ((BL>='a') && (BL<='f')) BL -= 'a'-10;
color = color*0x10 + BL;
if (textlen==3) color = color*0x10 + BL; //#abc ->> #aabbcc
}
return color;
}
return text_colors.get(0);
}
-113
View File
@@ -1,113 +0,0 @@
CustomCursor CursorPointer;
dword CursorFile = FROM "TWB/pointer.cur";
#include "..\lib\collection.h"
struct PAGE_LINKS {
collection unic_links;
collection element_links;
collection_int x;
collection_int y;
collection_int w;
collection_int h;
collection_int id;
collection_int underline_h;
signed int active;
dword active_url;
bool hover();
void add_link();
void add_text();
void clear();
void draw_underline();
} links;
void PAGE_LINKS::add_link(dword lpath)
{
unic_links.add(lpath);
}
void PAGE_LINKS::add_text(dword _x, _y, _w, _h, _underline_h)
{
x.add(_x);
y.add(_y);
w.add(_w);
h.add(_h);
underline_h.add(_underline_h);
element_links.add(unic_links.get_last());
id.add(unic_links.count);
}
void PAGE_LINKS::clear()
{
x.drop();
y.drop();
w.drop();
h.drop();
underline_h.drop();
id.drop();
element_links.drop();
unic_links.drop();
active = -1;
active_url = 0;
CursorPointer.Restore();
}
void PAGE_LINKS::draw_underline(signed _id, dword list_first, list_y, color)
{
int i;
if (_id == -1) return;
for (i=0; i<id.count; i++)
{
if (id.get(i) - id.get(_id) == 0)
&& (y.get(i) + h.get(i) - list_first > list_y) {
DrawBar(x.get(i), y.get(i) + h.get(i) - list_first,
w.get(i), underline_h.get(i), color);
}
}
}
bool PAGE_LINKS::hover(dword list_y, list_first)
{
int i;
int mx = mouse.x;
int my = mouse.y + list_first;
if (!id.count) return false;
//Here we check is any link hovered
for (i=0; i<id.count; i++)
{
if (mx>x.get(i)) && (my>y.get(i))
&& (mx<x.get(i)+w.get(i)) && (my<y.get(i)+h.get(i))
&& (my>list_y+list_first)
{
if (active!=i) {
CursorPointer.Load(#CursorFile);
CursorPointer.Set();
draw_underline(active, list_first, list_y, link_color_default);
draw_underline(i, list_first, list_y, DEFAULT_BG_COL);
active_url = element_links.get(i);
active = i;
DrawStatusBar(active_url);
}
if (mouse.lkm) && (mouse.down) {
DrawRectangle(x.get(active), -list_first + y.get(active),
w.get(active), h.get(active), 0);
}
return true;
}
}
if (active_url) {
CursorPointer.Restore();
draw_underline(active, list_first, list_y, link_color_default);
active_url = 0;
active = -1;
DrawStatusBar(NULL);
}
return false;
}
-202
View File
@@ -1,202 +0,0 @@
/*
struct _DOM {
collection tag;
collection tagparam;
collection_int parent;
} dom;
*/
struct _tag
{
char name[32];
char prior[32];
bool opened;
collection attributes;
collection values;
dword value;
dword number;
bool is();
bool parse();
dword get_next_param();
dword get_value_of();
signed get_number_of();
} tag=0;
bool _tag::is(dword _text)
{
return streq(#name, _text);
}
bool _tag::parse(dword _bufpos, bufend)
{
bool retok = true;
dword bufpos = ESDWORD[_bufpos];
dword params, paramsend;
dword closepos;
dword whitepos;
dword openpos;
if (name) strcpy(#prior, #name); else prior = '\0';
name = '\0';
attributes.drop();
values.drop();
if (!strncmp(bufpos,"!--",3))
{
bufpos+=3;
//STRSTR
while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufend)
{
bufpos++;
}
bufpos+=2;
retok = false;
goto _RET;
}
if (ESBYTE[bufpos] == '/') {
opened = false;
bufpos++;
} else {
opened = true;
}
closepos = strchr(bufpos, '>');
whitepos = strchrw(bufpos, bufend-bufpos);
if (!whitepos) || (whitepos > closepos) {
//no param
strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name)-1));
bufpos = closepos;
} else {
//we have param
while (chrlnum(whitepos, '\"', closepos - whitepos)%2) { //alt="Next>>"
if (!openpos = strchr(closepos+1, '<')) break;
if (openpos < strchr(closepos+1, '>')) break;
if (!closepos = EAX) {closepos = bufend;break;}
}
strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name)-1));
bufpos = closepos;
params = malloc(closepos - whitepos + 1);
strncpy(params, whitepos, closepos - whitepos);
paramsend = params + closepos - whitepos;
while (paramsend = get_next_param(params, paramsend-1));
free(params);
}
if (name) {
strlwr(#name);
// ignore text inside the next tags
if (is("script")) || (is("style")) || (is("binary")) || (is("select")) {
strcpy(#prior, #name);
sprintf(#name, "</%s>", #prior);
if (strstri(bufpos, #name)) bufpos = EAX-1;
retok = false;
} else {
if (name[strlen(#name)-1]=='/') name[strlen(#name)-1]=NULL; //for <br/>
}
} else {
retok = false;
}
_RET:
ESDWORD[_bufpos] = bufpos;
return retok;
}
dword _tag::get_next_param(dword ps, pe)
{
// "ps" - param start
// "pe" - param end
// "q" - quote char
char q = NULL;
dword initial_pe = pe;
dword fixeq;
dword val;
dword attr;
if (ESBYTE[pe] == '/') pe--;
while (pe>ps) && (__isWhite(ESBYTE[pe])) pe--;
if (ESBYTE[pe] == '"') || (ESBYTE[pe] == '\'')
{
//remove quote
q = ESBYTE[pe];
ESBYTE[pe] = '\0';
pe--;
//find VAL start and copy
pe = strrchr(ps, q) + ps;
val = pe;
if (pe>ps) pe--;
ESBYTE[pe] = '\0';
//find ATTR end
while (pe > ps) && (ESBYTE[pe] != '=') pe--;
ESBYTE[pe] = '\0';
}
else
{
//find VAL start and copy
while (pe > ps) && (ESBYTE[pe] != '=') pe--;
val = pe+1;
ESBYTE[pe] = '\0';
//already have ATTR end
}
if (pe > ps) pe--;
//Fix case: "src ="
while (pe>ps) && (__isWhite(ESBYTE[pe])) {
ESBYTE[pe] = '\0';
pe--;
}
//find ATTR start and copy
while (pe>ps) && (!__isWhite(ESBYTE[pe])) pe--;
attr = pe + 1;
ESBYTE[pe] = '\0';
// Fix case: src=./images/logo?sid=e8ece8b38b
// Exchange '=' and '\0' position.
// attr: src=./images/logo?sid => src
// val: e8ece8b38b => ./images/logo?sid=e8ece8b38b
fixeq = strchr(attr,'=');
if (!q) && (fixeq) {
ESBYTE[val-1] >< ESBYTE[fixeq];
val = fixeq+1;
}
strlwr(attr);
strrtrim(val);
//Fix case: " img.png"
while(__isWhite(ESBYTE[val])) && (val<initial_pe) val++;
attributes.add(attr);
values.add(val);
if (pe==ps) return NULL;
return pe;
}
dword _tag::get_value_of(dword _attr_name)
{
int pos = attributes.get_pos_by_name(_attr_name);
if (pos == -1) {
value = 0;
} else {
value = values.get(pos);
}
return value;
}
signed _tag::get_number_of(dword _attr_name)
{
if (get_value_of(_attr_name)) {
number = atoi(value);
} else {
number = 0;
}
return number;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

-184
View File
@@ -1,184 +0,0 @@
CANVAS canvas;
void TWebBrowser::RenderLine(dword _line)
{
unsigned px; //paint x coordinate
unsigned pw; //paint y coordinate
dword pc; //paint color
int zoom;
if (style.title)
{
strncpy(#header, _line, sizeof(TWebBrowser.header)-1);
strncat(#header, " - ", sizeof(TWebBrowser.header)-1);
strncat(#header, #version, sizeof(TWebBrowser.header)-1);
}
else if (t_html) && (!t_body) {
//
}
else if (ESBYTE[_line])
{
pw = strlen(_line) * list.font_w;
zoom = list.font_w / BASIC_CHAR_W;
//there is some shit happens!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (debug_mode) && (pw > draw_w + BODY_MARGIN) {
debugln("anomaly");
debugln(_line);
}
if (debug_mode) {
canvas.DrawBar(draw_x, draw_y, pw, list.item_h, 0xCCCccc);
debugln(_line);
}
style.cur_line_h = math.max(style.cur_line_h, list.item_h);
if (!secondrun) goto _SKIP_DRAW;
if (bg_colors.get_last() - bg_colors.get(0)) {
canvas.DrawBar(draw_x, draw_y, pw, list.item_h, bg_colors.get_last());
}
if (style.image) {
canvas.DrawBar(draw_x, draw_y, pw, list.item_h-1, 0xF9DBCB);
}
if (style.button) {
canvas.DrawBar(draw_x, draw_y, pw, list.item_h - calc(zoom*2), 0xCCCccc);
canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2), pw, zoom, 0x999999);
}
pc = text_colors.get_last();
if (link) && (pc == text_colors.get(0)) pc = link_color_default;
canvas.WriteText(draw_x, draw_y+1, list.font_type, pc, _line, NULL);
if (style.b) canvas.WriteText(draw_x+1, draw_y+1, list.font_type, pc, _line, NULL);
if (style.s) canvas.DrawBar(draw_x, list.item_h / 2 - zoom + draw_y, pw, zoom, pc);
if (style.u) canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, pc);
if (link) {
if (ESBYTE[_line]==' ') && (ESBYTE[_line+1]==NULL) {} else {
canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, link_color_default);
links.add_text(draw_x, draw_y + list.y, pw, list.font_h, zoom);
}
}
_SKIP_DRAW:
draw_x += pw;
}
ESBYTE[_line] = NULL;
}
void TWebBrowser::RenderTextbuf()
{
dword lbp = #linebuf;
int br; //break position
char nul = '\0';
unsigned int len;
//Do we need a line break?
if (!linebuf[0]) return;
while (len = strlen(lbp)) && (len * list.font_w + draw_x - left_gap >= draw_w) {
//Yes, we do. Lets calculate where...
br = len;
//Is a new line fits in the maximum line width?
if (br * list.font_w + draw_x - left_gap >= draw_w) {
br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
if (br < 0) br = 0;
while(br) {
if (ESBYTE[lbp + br]==' ') || (ESBYTE[lbp + br]=='-') {
if (br < len) br++;
break;
}
br--;
}
}
//Maybe a new line is too big for the whole new line? Then we have to split it
if (!br) && (len * list.font_w >= draw_w) {
br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
if (br < 0) {
NewLine();
br = draw_w - draw_x + left_gap - BODY_MARGIN / list.font_w;
}
}
if (br) {
ESBYTE[lbp + br] >< nul;
RenderLine(lbp);
ESBYTE[lbp + br] >< nul;
lbp += br;
while (ESBYTE[lbp]==' ') && (ESBYTE[lbp]) lbp++;
if (ESBYTE[lbp]) NewLine();
} else {
NewLine();
}
}
RenderLine(lbp);
}
void TWebBrowser::NewLine()
{
static bool empty_line = true;
if (draw_x==left_gap) && (draw_y==BODY_MARGIN) return;
if (t_html) && (!t_body) return;
if (draw_x == style.tag_list.level * 5 * list.font_w + left_gap) {
if (!empty_line) {
empty_line=true;
} else {
return;
}
} else {
empty_line = false;
}
draw_y += style.cur_line_h;
style.cur_line_h = list.item_h;
if (style.blq) draw_x = 6 * list.font_w; else draw_x = 0; //left_gap += style.tag_list.level * 5 * list.font_w ???
draw_x += style.tag_list.level * 5 * list.font_w + left_gap;
}
bool TWebBrowser::RenderImage(dword cur_img)
{
int img_x, img_y, img_w, img_h;
dword imgbuf[44];
if (!cur_img) || (!buf_data) return false;
img_h = ESDWORD[cur_img+8];
img_w = ESDWORD[cur_img+4];
if (img_w + draw_x - left_gap >= draw_w) NewLine();
img_y = draw_y;
if (img_h < list.item_h) img_y += list.item_h - img_h / 2 - 1; else img_y -= 2;
style.cur_line_h = math.max(style.cur_line_h, img_h);
img_w = math.min(img_w, canvas.bufw - draw_x);
if (link) links.add_text(draw_x + list.x, img_y + list.y, img_w, img_h, 0);
if (img_y + img_h >= canvas.bufh) canvas.IncreaseBufSize();
if (secondrun)
{
if (ESDWORD[cur_img+20] != IMAGE_BPP32) {
img_convert stdcall(cur_img, 0, IMAGE_BPP32, 0, 0);
$push eax
img_destroy stdcall(cur_img);
$pop eax
cur_img = EAX;
if (!EAX) return false;
}
imgbuf[04] = canvas.bufw;
imgbuf[08] = canvas.bufh;
imgbuf[20] = IMAGE_BPP32;
imgbuf[24] = buf_data+8;
img_blend stdcall(#imgbuf, cur_img, draw_x, img_y, 0, 0, img_w, img_h);
img_destroy stdcall(cur_img);
}
draw_x += img_w;
if (draw_x - left_gap >= draw_w) NewLine();
return true;
}
-513
View File
@@ -1,513 +0,0 @@
void TWebBrowser::SetStyle()
{
if (tag.get_value_of("name")) || (tag.get_value_of("id")) {
anchors.add(tag.value, draw_y);
if (anchors.current) && (streq(tag.value, #anchors.current+1)) {
list.first = draw_y;
anchors.current = NULL;
}
}
if (tag.is("a")) { tag_a(); return; }
if (tag.is("p")) { tag_p(); return; }
if (tag.is("img")) { tag_img(); return; }
if (tag.is("kosicon")) { tag_kosicon(); return; }
if (tag.is("div")) { tag_div(); return; }
if (tag.is("br")) { /*draw_x++;*/NewLine(); return; }
if (tag.is("nav")) { style.nav = tag.opened; return; }
if (tag.is("header")) { NewLine(); return; }
if (tag.is("article")) { NewLine(); return; }
if (tag.is("footer")) { NewLine(); return; }
if (tag.is("figure")) { NewLine(); return; }
if (tag.is("w:p")) { NewLine(); return; }
if (tag.is("b")) { style.b = tag.opened; return; }
if (tag.is("strong")) { style.b = tag.opened; return; }
if (tag.is("big")) { style.b = tag.opened; return; }
if (tag.is("w:b")) { style.b = tag.opened; return; }
if (tag.is("u")) { style.u = tag.opened; return; }
if (tag.is("ins")) { style.u = tag.opened; return; }
if (tag.is("s")) { style.s = tag.opened; return; }
if (tag.is("strike")) { style.s = tag.opened; return; }
if (tag.is("del")) { style.s = tag.opened; return; }
if (tag.is("pre")) { style.pre = tag.opened; return; }
if (tag.is("blockquote")) { style.blq = tag.opened; return; }
if (tag.is("button")) { style.button = tag.opened; return; }
if (tag.is("dl")) { if (tag.opened) NewLine(); return; }
if (tag.is("w:r")) { if (!tag.opened) style.b = false; return; }
if (tag.is("h1")) { tag_h1234_caption(); return; }
if (tag.is("h2")) { tag_h1234_caption(); return; }
if (tag.is("h3")) { tag_h1234_caption(); return; }
if (tag.is("h4")) { tag_h1234_caption(); return; }
if (tag.is("font")) { tag_font(); return; }
if (tag.is("dt")) { tag_ol_ul_dt(); return; }
if (tag.is("dd")) { tag_ol_ul_dt(); return; }
if (tag.is("ul")) { tag_ol_ul_dt(); return; }
if (tag.is("ol")) { tag_ol_ul_dt(); return; }
if (tag.is("li")) { tag_li(); return; }
if (tag.is("q")) { tag_q(); return; }
if (tag.is("hr")) { tag_hr(); return; }
if (tag.is("meta")) { tag_meta_xml(); return; }
if (tag.is("?xml")) { tag_meta_xml(); return; }
if (tag.is("code")) { tag_code(); return; }
if (tag.is("iframe")) { tag_iframe(); return; }
if (tag.is("caption")) { tag_h1234_caption(); return; }
if (tag.is("title")) { tag_title(); return; }
if (tag.is("body")) { tag_body(); return; }
if (tag.is("html")) { t_html = tag.opened; return; }
if (tag.is("table")) { tag_table(); return; }
if (tag.is("tr")) { tag_table(); return; }
if (tag.is("th")) { tag_table(); return; }
if (tag.is("td")) { tag_table(); return; }
}
void TWebBrowser::tag_p()
{
IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) return;
IF (!tag.opened) && (streq(#tag.prior,"p")) return;
NewLine();
}
void TWebBrowser::tag_title()
{
style.title = tag.opened;
if (!tag.opened) DrawTitle(#header);
}
void TWebBrowser::tag_font()
{
style.font = tag.opened;
if (tag.opened)
{
if (tag.get_value_of("bg")) {
bg_colors.add(GetColor(tag.value));
} else {
bg_colors.add(bg_colors.get_last());
}
if (tag.get_value_of("color")) {
text_colors.add(GetColor(tag.value));
} else {
text_colors.add(text_colors.get_last());
}
}
else {
if (text_colors.count>1) text_colors.pop();
if (bg_colors.count>1) bg_colors.pop(); //never pop the last color
}
}
void TWebBrowser::tag_div()
{
//if (streq(#tag.prior,"div")) && (tag.opened) return;
if (streq(#tag.prior,"td")) return;
if (streq(#tag.prior,"div")) return;
if (!tag.opened) && (style.font) text_colors.pop();
NewLine();
}
void TWebBrowser::tag_iframe()
{
if (tag.get_value_of("src")) {
NewLine();
strcpy(#linebuf, "IFRAME: ");
RenderTextbuf();
link=true;
links.add_link(tag.value);
strncpy(#linebuf, tag.value, sizeof(TWebBrowser.linebuf)-1);
RenderTextbuf();
link=false;
NewLine();
}
}
void TWebBrowser::tag_a()
{
if (!secondrun) return;
if (tag.opened)
{
if (tag.get_value_of("href")) && (!strstr(tag.value,"javascript:"))
{
link = true;
links.add_link(tag.value);
}
} else {
link = false;
}
}
void TWebBrowser::tag_meta_xml()
{
if (secondrun) return;
if (custom_encoding == -1) if (tag.get_value_of("charset"))
|| (tag.get_value_of("content")) || (tag.get_value_of("encoding"))
{
EDX = strrchr(tag.value, '=') + tag.value; //search in content=
if (ESBYTE[EDX] == '"') EDX++;
strlwr(EDX);
EAX = get_encoding_type_by_name(EDX);
if (EAX!=-1) ChangeEncoding(EAX);
}
if (streq(tag.get_value_of("http-equiv"), "refresh")) && (tag.get_value_of("content")) {
if (tag.value = strstri(tag.value, "url")) strcpy(#redirect, tag.value);
}
}
signed int get_encoding_type_by_name(dword name)
{
EDX = name;
if (streqrp(EDX,"utf-8")) || (streqrp(EDX,"utf8")) return CH_UTF8;
else if (streqrp(EDX,"windows-1251")) || (streqrp(EDX,"windows1251")) return CH_CP1251;
else if (streqrp(EDX,"dos")) || (streqrp(EDX,"cp-866")) return CH_CP866;
else if (streqrp(EDX,"iso-8859-5")) || (streqrp(EDX,"iso8859-5")) return CH_ISO8859_5;
else if (streqrp(EDX,"koi8-r")) || (streqrp(EDX,"koi8-u")) return CH_KOI8;
return -1;
}
void TWebBrowser::tag_code()
{
if (style.pre = tag.opened) {
bg_colors.add(0xe4ffcb);
} else {
if (bg_colors.count>1) bg_colors.pop(); //never pop the last color
}
}
void TWebBrowser::tag_ol_ul_dt()
{
char type = ESBYTE[#tag.name];
switch(type)
{
case 'd':
if (ESBYTE[#tag.name+1]=='d') style.tag_list.upd_level(tag.opened, type);
if (ESBYTE[#tag.name+1]=='t') style.tag_list.upd_level(false, 'd');
if (tag.opened) NewLine();
break;
case 'u':
case 'o':
if (style.nav) && (style.tag_list.level) NewLine();
style.tag_list.upd_level(tag.opened, type);
if (!tag.opened) && (!style.pre) NewLine();
}
}
void TWebBrowser::tag_li()
{
if (style.nav) {
chrncat(#linebuf, ' ', sizeof(TWebBrowser.linebuf));
} else if (tag.opened) {
if (!style.tag_list.level) style.tag_list.upd_level(1, 'u');
if (!style.pre) NewLine();
if (style.tag_list.order_type() == 'u') {
strcpy(#linebuf, "\31 ");
draw_x = style.tag_list.level * 5 - 2 * list.font_w + left_gap;
}
if (style.tag_list.order_type() == 'o') {
sprintf(#linebuf, "%i. ", style.tag_list.inc_counter());
draw_x = style.tag_list.level * 5 - 1 - strlen(#linebuf) * list.font_w + left_gap;
}
}
}
void TWebBrowser::tag_hr()
{
dword hrcol = 0x00777777;
dword hr_width = draw_w-BODY_MARGIN-BODY_MARGIN;
dword hr_size = 1;
if (tag.get_value_of("color")) {
hrcol = GetColor(tag.value);
}
if (tag.get_value_of("width")) && (!strchr(tag.value, '%')) {
hr_width = math.min(hr_width, tag.get_number_of("width"));
}
if (tag.get_number_of("size")) {
hr_size = math.min(500, tag.number);
}
if (draw_x != left_gap) NewLine();
if (secondrun) canvas.DrawBar(left_gap, style.cur_line_h / 2 + draw_y - 1, hr_width, hr_size, hrcol);
draw_y += hr_size - 3;
draw_x++;
NewLine();
return;
}
void TWebBrowser::tag_body()
{
t_body = tag.opened;
if (tag.get_value_of("link")) link_color_default = GetColor(tag.value);
if (tag.get_value_of("alink")) link_color_active = GetColor(tag.value);
if (tag.get_value_of("text")) text_colors.set(0, GetColor(tag.value));
if (tag.get_value_of("bgcolor")) bg_colors.set(0, GetColor(tag.value));
// Autodetecting encoding if no encoding was set
if (tag.opened) && (custom_encoding==-1) && (cur_encoding == CH_CP866) {
if (strstr(bufpointer, "\208\190")) ChangeEncoding(CH_UTF8);
else if (chrnum(bufpointer, '\246')>5) ChangeEncoding(CH_CP1251);
}
}
void TWebBrowser::tag_q()
{
chrncat(#linebuf, '\"', sizeof(TWebBrowser.linebuf));
}
void TWebBrowser::reset_font_style()
{
list.SetFont(BASIC_CHAR_W, 14, 10011000b);
style.cur_line_h = list.item_h = list.font_h + 5;
}
void TWebBrowser::tag_h1234_caption()
{
if (ESBYTE[#tag.name+1]=='4') {
NewLine();
NewLine();
style.h = tag.opened;
style.b = tag.opened;
} else {
style.h = tag.opened;
if (tag.opened) {
if (!style.pre) {
NewLine();
NewLine();
}
if (tag.is("h1")) {
list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
style.b = true;
} else if (tag.is("h2")) {
list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
} else {
list.SetFont(6*2, 9+8, 10001001b);
}
style.cur_line_h = list.item_h = list.font_h + 3;
} else {
if (tag.is("h1")) style.b = false;
NewLine();
reset_font_style();
}
}
}
void TWebBrowser::tag_kosicon()
{
dword imgbuf[44];
dword maxicon;
dword shared_i18 = memopen("ICONS18", NULL, SHM_READ);
maxicon = EDX / 18 / 18 / 4;
if (shared_i18) && (tag.get_number_of("n")) {
if (tag.number < maxicon) {
if (draw_x + 18 > canvas.bufw) NewLine();
canvas.DrawImage(draw_x, draw_y-1, 18, 18, 18*18*4*tag.number+shared_i18);
draw_x += 22;
}
}
}
void TWebBrowser::tag_img()
{
char img_path[4096]=0;
dword base64img;
if (!tag.get_value_of("data-large-image"))
if (!tag.get_value_of("data-src"))
if (!tag.get_value_of("src")) return;
if (streqrp(tag.value, "data:")) {
if (!strstr(tag.value, "base64,")) goto NOIMG;
EDX = EAX+7;
if (ESBYTE[EDX]==' ') EDX++;
base64img = malloc(strlen(EDX));
base64_decode stdcall (EDX, base64img, strlen(EDX));
img_decode stdcall (base64img, EAX, 0);
$push eax
free(base64img);
$pop eax
if (EAX) goto IMGOK; else goto NOIMG;
}
if (!strcmp(tag.value + strrchr(tag.value, '.'), "svg")) goto NOIMG;
if (!strcmp(tag.value + strrchr(tag.value, '.'), "webp")) goto NOIMG;
strlcpy(#img_path, tag.value, sizeof(img_path)-1);
replace_char(#img_path, ' ', '\0', sizeof(img_path)-1);
get_absolute_url(#img_path, history.current());
if (check_is_the_adress_local(#img_path)) {
img_from_file stdcall(#img_path);
if (EAX) goto IMGOK; else goto NOIMG;
}
if (cache.has(#img_path)) {
img_decode stdcall (cache.current_buf, cache.current_size, 0);
if (EAX) goto IMGOK; else goto NOIMG;
} else {
if (img_url.get_pos_by_name(#img_path)==-1) img_url.add(#img_path);
goto NOIMG;
}
IMGOK:
if (RenderImage(EAX)) return;
NOIMG:
if (tag.get_value_of("title")) || (tag.get_value_of("alt")) {
strncpy(#img_path, tag.value, sizeof(TWebBrowser.linebuf)-3);
sprintf(#linebuf, "[%s]", #img_path);
} else {
if (streqrp(#img_path, "data:")) img_path=0;
replace_char(#img_path, '?', NULL, strlen(#img_path));
img_path[sizeof(TWebBrowser.linebuf)-3] = '\0'; //prevent overflow in sprintf
sprintf(#linebuf, "[%s]", #img_path+strrchr(#img_path, '/'));
linebuf[50]= NULL;
}
text_colors.add(0x9A6F29);
style.image = true;
RenderTextbuf();
style.image = false;
text_colors.pop();
}
struct TABLE {
int depth;
int margin;
collection_int cols;
} table;
unsigned table_id;
unsigned colcount;
unsigned tr_pos;
unsigned td_pos;
unsigned row_start_y;
unsigned tallest_cell_in_row;
unsigned cur_cell_w;
void TWebBrowser::tag_table_reset()
{
table_id = 0;
colcount = 0;
tr_pos = 0;
td_pos = 0;
table.depth = 0;
cur_cell_w = 0;
}
void TWebBrowser::tag_table()
{
if (!tag.opened) {
if (style.font) tag_font();
if (link) tag_a();
style.b = false;
}
if (tag.is("table")) {
if(tag.opened) {
table.depth++;
if (table.depth==1) {
table_id++;
colcount = 0;
td_pos = 0;
row_start_y = draw_y;
if (tag.get_number_of("width")) {
if (strchr(tag.value, '%')) tag.number = list.w * tag.number / 100;
cur_cell_w = math.min(tag.number,list.w);
} else {
cur_cell_w = list.w;
}
}
} else {
if (table.depth>0) {
table.depth--;
}
if (table.depth==0) {
draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
draw_w = list.w;
if (td_pos) draw_y = math.max(draw_y, tallest_cell_in_row);
draw_y = math.max(draw_y+style.cur_line_h, tallest_cell_in_row);
row_start_y = tallest_cell_in_row = draw_y;
style.cur_line_h = list.item_h;
}
}
}
if (table.depth>1) {
if (tag.is("tr")) && (tag.opened) NewLine();
return;
}
if (!secondrun) {
if (tag.is("tr")) {
if (tag.opened) {
table.cols.add(1);
}
colcount = 0;
}
if (tag.opened) if (tag.is("td")) || (tag.is("th")) {
if (!table.cols.count) { table.cols.add(1); colcount = 0;}
colcount++;
if (colcount) table.cols.set(table.cols.count-1, colcount);
//if (tag.get_number_of("colspan")) colcount += tag.number-1;
}
} else {
if (tag.is("tr")) {
if (tag.opened) {
if (td_pos) draw_y = math.max(draw_y, tallest_cell_in_row);
_TR_FIX:
if (draw_x==left_gap) && (draw_y==BODY_MARGIN) {
row_start_y = tallest_cell_in_row = draw_y;
} else {
row_start_y = tallest_cell_in_row = draw_y = draw_y + style.cur_line_h;
}
style.cur_line_h = list.item_h;
tr_pos++;
td_pos = 0;
} else {
draw_y = math.max(draw_y, tallest_cell_in_row);
td_pos = 0;
}
draw_x = left_gap = style.tag_list.level * 5 * list.font_w + BODY_MARGIN;
draw_w = list.w;
}
if (tag.is("td")) || (tag.is("th")) {
if (!tr_pos) goto _TR_FIX;
tallest_cell_in_row = math.max(draw_y+style.cur_line_h-list.item_h+1, tallest_cell_in_row);
style.cur_line_h = list.item_h;
if (tag.opened)
{
if (!td_pos) {
table.margin = list.w - cur_cell_w / 2 + BODY_MARGIN;
draw_x = left_gap = table.margin;
draw_w = cur_cell_w - BODY_MARGIN;
} else {
draw_x = left_gap = left_gap + draw_w;
draw_w = cur_cell_w - left_gap + table.margin - BODY_MARGIN;
}
if (EAX = table.cols.get(tr_pos-1)-td_pos) {
draw_w /= EAX;
} else {
draw_y = row_start_y;
draw_x = left_gap = table.margin;
}
if (table.cols.get(tr_pos-1)-td_pos>1) && (tag.get_number_of("width")) {
if (strchr(tag.value, '%')) {
tag.number = cur_cell_w * tag.number / 100; //
}
if (tag.number < list.w - table.margin - left_gap) draw_w = tag.number;
}
draw_y = row_start_y;
td_pos++;
}
}
}
if (draw_x > cur_cell_w) {
draw_x = left_gap = table.margin;
draw_w = cur_cell_w - table.margin - 23 - left_gap;
table.depth = 0;
NewLine();
if (debug_mode) {
debugln("anomaly draw_x");
canvas.DrawBar(0, draw_y, 20, 20, 0xFF0000);
}
}
//if (left_gap + draw_w > list.w) {
// draw_w = list.w - left_gap;
// if (debug_mode) debugln("anomaly draw_W");
//}
}
-117
View File
@@ -1,117 +0,0 @@
char *unicode_symbols[]={
"quot","\"",
"amp", "&",
"lt", "<",
"gt", ">",
"#183","\31", "middot", "\31",
"#149","-",
"#151","-",
"#160"," ", "nbsp", "\t", "emsp", " ",
"#169","(c)", "copy", "(c)",
"#171","<<", "laquo","<<",
"#174","(r)", "reg", "(r)",
"#187",">>", "raquo",">>",
"hellip", "...",
"trade", "[TM]",
"bdquo", ",,",
"minus", "-",
"ndash", "-",
"mdash", "-", //--
"rsquo", "'", "apos", "'",
"sect", "#",
"ensp", " ",
"emsp13", " ",
"emsp14", " ",
"numsp", " ",
"puncsp", " ",
"thinsp", " ",
"#1028", "\242",
"#1030", "I",
"#1031", "\244",
"#8211", "-",
"#8212", "-",
"#8217", "'",
"#8220", "\"",
"#8222", "\"", "ldquo", "\"",
"#8221", "\"", "rdquo", "\"",
"#8470", "N",
"#8722", "-",
"#9642", "-", //square in the middle of the line
"#9658", ">",
"#9660", "v",
"#10094", "<",
"#10095", ">",
"#65122", "+",
"#8594", "->",
"#8627", "->",
"uarr", "^",
"darr", "v",
"rarr", "->",
"larr", "<-",
"bull", "\31",
"percnt","%",
"#xfeff", "",
"times", "x",
"lowast","*",
"#128154","<3",
"#128545",":(",
0};
unsigned char unicode_chars[] = "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяЁёhг\243i\105\244\0";
bool GetUnicodeSymbol(dword _line, line_size, bufpos, buf_end)
{
int i;
int code;
char special_code[10];
bool white_end = false;
dword bufstart = bufpos;
for (i=0; i<9; i++, bufpos++)
{
if (__isWhite(ESBYTE[bufpos])) {bufpos--; break;}
if (ESBYTE[bufpos] == ';') || (bufpos >= buf_end) break;
if (!strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#", ESBYTE[bufpos])) {bufpos--; break;}
special_code[i] = ESBYTE[bufpos];
}
special_code[i] = '\0';
for (i=0; unicode_symbols[i]!=0; i+=2;)
{
if (!strcmp(#special_code, unicode_symbols[i]))
{
strncat(_line, unicode_symbols[i+1], line_size);
return bufpos;
}
}
if (special_code[0]=='#')
{
code = atoi(#special_code + 1);
if (code>=0) && (code<=255) {
chrncat(_line, code, line_size); //NOT ALL ASCII CODES IN KOLIBRI ARE COMPATABLE WITH STANDARDS
return bufpos;
}
if (code>=1040) && (code<=1040+72) {
chrncat(_line, unicode_chars[code-1040], line_size);
return bufpos;
}
}
chrncat(_line, '&', line_size);
return bufstart;
}
-38
View File
@@ -1,38 +0,0 @@
struct LIST
{
int level;
char ordered[5];
int counter[5];
void reset();
void upd_level();
int inc_counter();
char order_type();
};
void LIST::reset()
{
level = 0;
}
void LIST::upd_level(int direction, char type)
{
if (direction == 1) && (level<5) {
level++;
counter[level] = 0;
ordered[level] = type;
}
if (direction == 0) && (level>0) {
level--;
}
}
int LIST::inc_counter()
{
counter[level]++;
return counter[level];
}
char LIST::order_type()
{
return ordered[level];
}
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("WebView.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "WebView.com")
File diff suppressed because it is too large. Load diff
-17
View File
@@ -1,17 +0,0 @@
@ECHO OFF
@c-- /D=LANG_RUS WebView.c
@del WebView
@rename WebView.com WebView
@del warning.txt
if not exist WebView ( @pause )
if exist WebView (
"C:\Program Files (x86)\WinImage\winimage.exe" "C:\Users\leency\Desktop\kolibri.img" /H /Q /I WebView
d:
cd "D:\Kolibri\Infrastructure\QEMU"
call "C:\Users\leency\Desktop\qemu.bat"
) else (
pause
)
-1
View File
@@ -1 +0,0 @@
c-- -D=LANG_ENG WebView.c
-64
View File
@@ -1,64 +0,0 @@
enum {
PAGE=1, IMG, FILE
};
struct _cache
{
dword current_buf;
dword current_size;
dword current_type;
dword current_charset;
collection url;
collection_int data;
collection_int size;
collection_int type;
collection_int charset;
void add();
bool has();
void clear();
} cache;
void _cache::add(dword _url, _data, _size, _type, _charset)
{
dword data_pointer;
data_pointer = malloc(_size);
memmov(data_pointer, _data, _size);
data.add(data_pointer);
url.add(_url);
size.add(_size);
type.add(_type);
charset.add(_charset);
current_buf = data_pointer;
current_size = _size;
}
bool _cache::has(dword _link)
{
int pos;
if (!url.count) return false;
pos = url.get_pos_by_name(_link);
if (pos != -1) {
current_buf = data.get(pos);
current_size = size.get(pos);
current_type = type.get(pos);
current_charset = charset.get(pos);
return true;
}
return false;
}
void _cache::clear()
{
int i;
for (i=0; i<data.count; i++) free(data.get(i));
url.drop();
data.drop();
size.drop();
type.drop();
current_buf = NULL;
current_size = NULL;
current_type = NULL;
current_charset = NULL;
}
-118
View File
@@ -1,118 +0,0 @@
#ifdef LANG_RUS
//===================================================//
// //
// CYRILLIC //
// //
//===================================================//
char buildin_page_error[] = FROM "res/page_not_found_ru.htm";
char buildin_page_home[] = FROM "res/homepage_ru.htm";
char buildin_page_help[] = FROM "res/help_ru.htm";
char accept_language[]= "Accept-Language: ru\n";
char rmb_menu[] =
"Back|Ctrl+<
Forward|Ctrl+>
-
Посмотреть исходник|Ctrl+U
Редактировать исходник|F2";
char main_menu[] =
"Открыть файл...|Ctrl+O
Новое окно|Ctrl+N
-
История|Ctrl+H
Менеджер загрузок|Ctrl+J
Настройки|Ctrl+E
Очистить кэш|Ctrl+F5
Обновить браузер";
char link_menu[] =
"Открыть в новой вкладке
Открыть в новом окне
-
Копировать ссылку
Скачать содержимое ссылки";
char loading_text[] = "Загрузка...";
char update_param[] = "-e http://builds.kolibrios.org/ru_RU/data/programs/cmm/browser/WebView.com";
char update_download_error[] = "'WebView\nОшибка при получении обновлений!' -tE";
char update_ok[] = "'WebView\nБраузер был успешно обновлен!' -tO";
char update_is_current[] = "'WebView\nВы уже используете последнюю версию.' -tI";
char update_can_not_copy[] = "'WebView\nНе могу переместить новую версию из папки Downloads на Ramdisk. Возможно, не достаточно места.' -tE";
char clear_cache_ok[] = "'WebView\nКэш очищен.' -tI";
#define T_RENDERING "Рендеринг страницы..."
#define T_DONE_IN_SEC "Готово: %i сек (%i милисек)"
#else
//===================================================//
// //
// ENGLISH //
// //
//===================================================//
char buildin_page_error[] = FROM "res/page_not_found_en.htm";
char buildin_page_home[] = FROM "res/homepage_en.htm";
char buildin_page_help[] = FROM "res/help_en.htm";
char accept_language[]= "Accept-Language: en\n";
char rmb_menu[] =
"Back|Ctrl+<
Forward|Ctrl+>
-
View source|Ctrl+U
Edit source|F2";
char main_menu[] =
"Open local file...|Ctrl+O
New window|Ctrl+N
-
History|Ctrl+H
Download Manager|Ctrl+J
Settings|Ctrl+E
Clear cache|Ctrl+F5
Update browser";
char link_menu[] =
"Open in new tab
Open in new window
-
Copy link
Download link contents";
char loading_text[] = "Loading...";
char update_param[] = "-e http://builds.kolibrios.org/en_US/data/programs/cmm/browser/WebView.com";
char update_download_error[] = "'WebView\nError receiving update information!' -tE";
char update_ok[] = "'WebView\nThe browser has been updated!' -tO";
char update_is_current[] = "'WebView\nThe browser is up to date.' -tI";
char update_can_not_copy[] = "'WebView\nError copying a new version from Downloads folder!\nProbably too litle space on Ramdisk.' -tE";
char clear_cache_ok[] = "'WebView\nThe cache has been cleared.' -tI";
#define T_RENDERING "Rendering..."
#define T_DONE_IN_SEC "Done in %i sec (%i milisec)"
#endif
//===================================================//
// //
// GLOBAL //
// //
//===================================================//
char buildin_page_test[] = FROM "res/test.htm";
#define URL_SERVICE_HISTORY "WebView:history"
#define URL_SERVICE_HOMEPAGE "WebView:home"
#define URL_SERVICE_TEST "WebView:test"
char webview_shared[] = "WEBVIEW";
enum {
NEW_TAB=600,
ENCODINGS=700,
BACK_BUTTON=800,
FORWARD_BUTTON, VIEW_SOURCE, EDIT_SOURCE,
REFRESH_BUTTON, GOTOURL_BUTTON, CHANGE_ENCODING,
GO_BUTTON, SEARCH_BUTTON, SANDWICH_BUTTON,
OPEN_FILE, NEW_WINDOW, VIEW_HISTORY, DOWNLOAD_MANAGER,
OPEN_SETTINGS, CLEAR_CACHE, UPDATE_BROWSER, IN_NEW_TAB, IN_NEW_WINDOW,
COPY_LINK_URL, DOWNLOAD_LINK_CT, TAB_ID,
TAB_CLOSE_ID = 900
};
char editbox_icons[] = FROM "res/editbox_icons.raw";
#define WIN_W 850
#define WIN_H 920
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
char version[]="WebView 3.98";
-36
View File
@@ -1,36 +0,0 @@
#ifdef LANG_RUS
#define HISTORY_HEADER "<html><title>История</title><body bgcolor=#fff><h3>Посещенные страницы</h3><br>"
#else
#define HISTORY_HEADER "<html><title>History</title><body bgcolor=#fff><h3>Visited pages</h3><br>"
#endif
ShowHistory()
{
int i;
dword history_pointer = malloc(history.items.data_size+256);
strcat(history_pointer, HISTORY_HEADER);
for (i=0; i<history.items.count-1; i++) //if (cache.type.get(i) == PAGE)
{
strcat(history_pointer, "<kosicon n=3><a href='");
strcat(history_pointer, history.items.get(i));
strcat(history_pointer, "'>");
strcat(history_pointer, history.items.get(i));
strcat(history_pointer, "</a><br>");
}
/*
strcat(history_pointer, "<br><b>Cached images</b><br>");
for (i=1; i<cache.url.count; i++) if (cache.type.get(i) == IMG)
{
strcat(history_pointer, cache.url.get(i));
strcat(history_pointer, " <img src='");
strcat(history_pointer, cache.url.get(i));
strcat(history_pointer, "'><br>");
}
*/
LoadInternalPage(history_pointer, strlen(history_pointer));
free(history_pointer);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@@ -1 +0,0 @@
                                                                                                                                                                                                                                                                                                                                                                                 ▐▐▌бЯЮВБ~xwtВБ~бЯЮ▐▐▌      ╜╗╗                                 ¤¤¤млк{xuЙЕГСОМЦУССОМЙЕГ{xuмлл╗╗╣rpm                                 нмй~{ПНКЙЕГ~{x{xu|yЙЕГПНККЖДЙЕГxvs                              ▐▐▌{xuПНКБ|ввЯччх√√√ччхеввКИДЩХТЩХТyxu                              вЯЯЙЕГЙЕГввЯ            ╛╜╗КЖДЩХТЩХТyxu                              ГБСОМ~{xччх         ╜╗╗rpmxvsyxuyxutqo                              xwtЦУС{xu···                                                         ДБСОМ~{xшчч                                                         бЮЭЙЕГЙЕГдба               пон}yx┤│▓                                 ▌▌▌{xuПНКБ|двбччч√√√чччдвб~{ЙЕГ|yv                                    нкк~{ПНКЙЕГ~{x{xu~{xЙЕГПНК~{нлй                                    √√√нкк{xuЙЕГСОМЦУССОМЙЕГ{xuнкк№№№                                          ▐▌▌вЯЯВБxwtВБвЯЯ▐▌▌                                                                                                                                                                                                                                                                                                                                                                              ▄▄▄                                                                                                                                                                                                                                                                                                            ,╨                  ,╨                                          ,╨ФОъ,╨            ,╨ФОъ,╨                                    ,╨ФОъJA┘JA┘JA┘      JA┘ФОъJA┘JA┘,╨                              ,╨JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨                            жJA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ ж                               жJA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ ж                                    ,╨JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨ ж                                          ,╨JA┘JA┘JA┘JA┘JA┘JA┘,╨                                          ,╨JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘ ж                                    ,╨ФОъJA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘JA┘,╨                              ,╨ФОъJA┘JA┘JA┘JA┘,╨,╨JA┘JA┘JA┘JA┘JA┘,╨                           ,╨JA┘JA┘JA┘JA┘,╨      ,╨JA┘JA┘JA┘,╨ ж                              ,╨JA┘,╨ ж            ,╨JA┘,╨ ж                                     ж ж                  ,╨ ж                                                                                                                                                                                                                                                                                                                                                                        ▄▄▄
-19
View File
@@ -1,19 +0,0 @@
<html><title>WebView Help</title><body>
<h1>WebView Text-Based Browser</h1>
It is free and open-source. If you have any suggestions or want to help improving it please visit its topic at <a href="//board.kolibrios.org/viewtopic.php?f=40&amp;t=1075">board.kolibrios.org</a><pre>
<b>Shortcut keys</b>
<font bg=C7CEE4>[CTRL + N or CTRL + T]</font> New window
<font bg=C7CEE4>[CTRL + R or F5]</font> Refresh the current page
<font bg=C7CEE4>[CTRL + O]</font> Start OpenDialog to open local file
<font bg=C7CEE4>[CTRL + U]</font> View a web page's source code
<font bg=C7CEE4>[CTRL + H]</font> Open browser history
<font bg=C7CEE4>[CTRL + J]</font> Display the file downloader
<font bg=C7CEE4>[CTRL + W]</font> Exit browser
<font bg=C7CEE4>[CTRL + ENTER]</font> Submit a web search
<font bg=C7CEE4>[CTRL + LEFT]</font> Back a page.
<font bg=C7CEE4>[CTRL + RIGHT]</font> Forward a page.
<font bg=C7CEE4>[F6]</font> Moves a text cursor to the omnibox
-17
View File
@@ -1,17 +0,0 @@
<html>
<meta charset="cp-866">
<title>Справка WebView</title>
<body><pre><h1>Справка WebView</h1>
<b>Клавиши быстрого вызова</b>
<font bg=C7CEE4>[CTRL + N или CTRL + T]</font> Новое окно
<font bg=C7CEE4>[CTRL + R или F5]</font> Перезагрузить страницу
<font bg=C7CEE4>[CTRL + O]</font> Вызвать диалог выбора файла
<font bg=C7CEE4>[CTRL + U]</font> Смотреть исходный код страницы
<font bg=C7CEE4>[CTRL + H]</font> Смотреть историю посещенных страниц
<font bg=C7CEE4>[CTRL + J]</font> Открыть загрузчик файлов
<font bg=C7CEE4>[CTRL + W]</font> Закрыть браузер
<font bg=C7CEE4>[CTRL + ENTER]</font> Поиск в интернете с помощью Google
<font bg=C7CEE4>[CTRL + ВЛЕВО]</font> Аналогично кнопке "Назад" в браузере
<font bg=C7CEE4>[CTRL + ВПРАВО]</font> Аналогично кнопке "Вперед"
<font bg=C7CEE4>[F6]</font> Перемещает текстовый курсор в омнибокс
-121
View File
@@ -1,121 +0,0 @@
enum { TAG, OPTION_VALUE, TEXT, COMMENT, INLINE_COMMENT, CODE };
char* C_HL_keywords[] = {
"switch", "if", "while", "for", "break", "continue", "return", "else",
"union", "typedef", "static", "class", "case", "#include",
"volatile", "register", "sizeof", "typedef", "union", "goto", "const", "auto",
"#define", "#endif", "#error", "#ifdef", "#ifndef", "#undef", "#if", "#else",
"inline",
"int ", "dword ", "long ", "double ", "float ", "char ", "unsigned ", "signed ",
"void ", "bool ", "enum ", "byte ", "word ", "struct ", "NULL", "loop", "stdcall ",
":void ", ":int ", ":bool ", ":dword ", NULL
};
dword ShowCodeSource(dword _bufpointer, _bufsize)
{
dword new_buf, new_buf_start, i;
int mode = CODE;
char spstr[64];
dword keylen;
dword keyn;
dword keycolor;
new_buf = malloc(_bufsize*10);
new_buf_start = new_buf;
sprintf(new_buf,"<html><head><title>%s</title><body><pre>",#current_path);
new_buf += strlen(new_buf);
for (i=_bufpointer; i<_bufpointer+_bufsize; i++)
{
if ('<' == ESBYTE[i]) {
strcpy(new_buf, "&lt;");
new_buf+=4;
continue;
}
if ('>' == ESBYTE[i]) {
strcpy(new_buf, "&gt;");
new_buf+=4;
continue;
}
if (ESBYTE[i] >= '0') && (ESBYTE[i] <= '9') && (CODE == mode) {
strcpy(new_buf, "<font color=#CF00FF>?</font>");
ESBYTE[new_buf+20] = ESBYTE[i];
new_buf+=28;
if (ESBYTE[i+1] == 'x') {
strcpy(new_buf, "<font color=#CF00FF>x</font>");
new_buf+=28;
i++;
}
continue;
}
if (CODE == mode) && ('\"' == ESBYTE[i]) {
mode = TEXT;
strcpy(new_buf, "<font color=#080>\"");
new_buf+=18;
continue;
}
if (TEXT == mode) && ('\"' == ESBYTE[i]) {
mode = CODE;
strcpy(new_buf, "\"</font>");
new_buf+=8;
continue;
}
if (! strncmp(i, "//", 2) ) && (mode == CODE) {
mode = INLINE_COMMENT;
strcpy(new_buf, "<font color=#999>//");
new_buf+=19;
i++;
continue;
}
if (INLINE_COMMENT == mode) {
if (13 == ESBYTE[i]) {
mode = CODE;
strcpy(new_buf, "\13</font>");
new_buf+=8;
continue;
}
}
if (! strncmp(i, "/*", 2) ) {
mode = COMMENT;
strcpy(new_buf, "<font color=#999>/*");
new_buf+=19;
i++;
continue;
}
if (! strncmp(i, "*/", 2) ) {
mode = CODE;
strcpy(new_buf, "*/</font>");
new_buf+=9;
i++;
continue;
}
if (CODE == mode) for (keyn=0; C_HL_keywords[keyn]!=NULL; keyn++)
{
keylen = strlen(C_HL_keywords[keyn]);
if (! strncmp(i, C_HL_keywords[keyn], keylen) ) {
if (keyn<31) keycolor="#f00"; else keycolor="#00f";
sprintf(#spstr, "<font color=%s>%s</font>", keycolor, C_HL_keywords[keyn]);
strcpy(new_buf, #spstr);
new_buf += keylen + 24;
i += keylen-1;
goto _CONTINUE;
}
}
ESBYTE[new_buf] = ESBYTE[i];
new_buf++;
_CONTINUE:
}
ESBYTE[new_buf] = 0;
LoadInternalPage(new_buf_start, new_buf - new_buf_start);
free(new_buf_start);
}
-49
View File
@@ -1,49 +0,0 @@
<html><head><title>New tab</title></head>
<body bgcolor=#fff>
<table><tr><td width=20><td width=220><pre>
_____________________
|# : : #|
| : WebView : |
| : for : |
| : KolibriOS : |
| : : |
| :_______________: |
| ____________ |
| | __ | |
| || | | |
\_____||__|________|__|<font color=#DDD>lc</font>
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatible
<font bg=#3CE7FF> </font></font></font></font>
<td>
</pre>
<kosicon n=58><a href=//kolibrios.org>Homepage</a> &nbsp;
<kosicon n=50><a href="//builds.kolibrios.org">Night-builds</a> &nbsp;
<kosicon n=50><a href="//ftp.kolibrios.org">FTP Server</a>
<pre>
By the way,
<font color="#555555">&bull; You can check for browser updates from the main menu.
&bull; To run a web search, type text in the address box and press Ctrl+Enter.
&bull; Pressing F6 moves the text cursor to the omnibox.
&bull; You can manually change the encoding of a page by clicking on the label in the bottom right corner.
~+
* +
' |
() .-.,="``"=. - o -
'=/_ \ |
* | '=.<a href=WebView:test>&nbsp;</a> |
\ `=./`, '
. '=.__.=' `=' *
+ +
O * ' .<font color=#DDD>jgs</font>
-49
View File
@@ -1,49 +0,0 @@
<html><head><title>Новая вкладка</title></head>
<body bgcolor=#fff>
<table><tr><td width=20><td width=220><pre>
_____________________
|# : : #|
| : WebView : |
| : for : |
| : KolibriOS : |
| : : |
| :_______________: |
| ____________ |
| | __ | |
| || | | |
\_____||__|________|__|<font color=#DDD>lc</font>
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable
<font bg=#3CE7FF> </font></font></font></font>
<td>
</pre>
<kosicon n=58><a href=//kolibrios.org>Официальный сайт</a> &nbsp;
<kosicon n=50><a href="//builds.kolibrios.org">Ночные сборки</a> &nbsp;
<kosicon n=50><a href="//ftp.kolibrios.org">FTP сервер</a>
<pre>
Кстати,
<font color="#555555">&bull; Из главного меню можно проверить наличие обновлений
&bull; Для поиска в Google наберите тест в адресной строке и нажмите Ctrl+Enter
&bull; Клавиша F6 перемещает текстовый курсор в омнибокс.
&bull; Можно изменить кодировку страницы, для этого нажмите на надпись в правом нижнем углу окна.
~+
* +
' |
() .-.,="``"=. - o -
'=/_ \ |
* | '=.<a href=WebView:test>&nbsp;</a> |
\ `=./`, '
. '=.__.=' `=' *
+ +
O * ' .<font color=#DDD>jgs</font>
@@ -1,14 +0,0 @@
<html>
<head><title>Page not found</title></head>
<body>
<h1>&nbsp;Webpage Not Available</h1>
<h2>&nbsp;What could be done:</h2>
<ul>
<li>Make sure that you have a working Internet connection.<br>
Open <a href="/sys/network/netcfg">Netcfg</a> network diagnostic tool.<br>
<li>Check the page address for any typos.<br>
<li>Server is temporarily unavailable.<br>
Refresh the page.<br>
<li>Browser didn't properly handle the server's response.<br>
Please, report an error.<br>
</ul>
@@ -1,17 +0,0 @@
<html>
<head>
<meta charset="cp-866">
<title>Страница не найдена</title>
</head>
<body>
<h1>&nbsp;Веб-страница недоступна <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAdCAMAAAD8QJ61AAAAIVBMVEUBAAAAAAAAgAAAgIAAAIAAAP+AgICZmZnAwMD/mZn///8vq9FJAAAAAXRSTlMAQObYZgAAAORJREFUeNpiGHQAUCcZoEgMwzAQyXbj9f8ffMJp7xz2Om2dgAaUQLF5j8vKBPAS5xWk6eM/iuKqcD7gK6+rjMEXAwqvkX61ICuSwo2uR5jjKBBkCA1ZJDiFrEqahzMIaAgnMG9AjwyBtdAVdO1uwVSQln0GCQvdsU4hkg2WgFhDSBl5DaEZgmVF1ZlPA2kxG0pjL4/QxnWZbQE9ekHHWJHRUMLns260ldA27RCw+m1BGwg+wu5odsM9LYZx3gF7hocwCYFfjr9Vhh5juBb3EQp0rYKgN91/Cu34iGdBHwT729V/8Q+bbAkSfuA/hwAAAABJRU5ErkJggg=="></h1>
<ul>
<li>Проверьте адресс страницы, возможно, была сделана опечатка.<br>
<li>Сервер временно недоступен. Штош поделать...<br>
<li>Убедитесь, что есть подключение к сети Интернет.<br>
В Колибри поддерживается только подключение по кабелю (WiFi не работает). Если кабель подключен, проверьте установлен ли драйвер сетевой карты. Для этого откройте <a href="/sys/network/netcfg">Netcfg</a> и убедитесь, что в колонке DRIVER указано имя двайвера.<br>
Список поддерживаемых сетевых карт <a target="_blank" href="/kolibrios/res/guide/hardware_support.htm#net">тут</a>.<br>
<li>Текстовый браузер не правильно обработал ответ сервера.<br>
Сообщите об ошибке.<br>
</ul>
-39
View File
@@ -1,39 +0,0 @@
<html>
<title>TEST</title>
<body bgcolor=#fff>
<pre><h3><kosicon n=21>Tables</h3>
<a href=//th99.infania.net>Total Hardware 1999</a>
<a href=//xcal1.vodafone.co.uk>Vodafone Test Files</a>
<a href=//vetusware.com>vetusware.com</a>
<a href=//toastytech.com/guis/index.html>GUI Gallery</a>
<a href=//www.weitek.com/textual/support/driver.html>weitek</a>
<a href=http://www.retro-computing.com/Home/retro-computing.php>retro-computing</a>
<a href=https://www.alanwood.net/unicode/cyrillic.html>cyrillic</a>
<pre><h3><kosicon n=22>Demoscene</h3>
<a href="https://amp.dascene.net/home.php">Amiga Music Preservation</a>
<a href="https://files.scene.org">Scene.org</a>
<a href=https://www.pouet.net/>Pouet.net</a>
<a href="https://aminet.net/tree?path=mods">Aminet</a>
<a href=https://barefeats.com/indarch.html>barefeats</a>
<h3><kosicon n=13>Forms</h3>
<a href=//wiby.org>wiby.org</a>
<h3><kosicon n=3>Other</h3>
<a href=//menuetos.net>menuetos.net</a>
<a href=//osnews.com>osnews.com</a>
<h3><kosicon n=54>Cyrillic only</h3>
<a href=//dgmag.in>dgmag.in</a> <a href=//old-dos.ru>old-dos.ru</a> <a href=//lionovsky.us>lionovsky.us</a> <a href=//mirrors.pdp-11.ru>mirrors.pdp-11.ru</a>
<a href=//artcon.ru>artcon.ru</a> <a href=//nubo.ru>nubo.ru</a> <a href=//nostalgy.net.ru/>nostalgy.net.ru</a> <a href=//acmp.ru/index.asp?main=tasks>acmp.ru</a>
<a href=//opennet.ru>opennet</a> <a href=//linux.org.ru>LOR</a>
<a href=//samlib.ru/b>samlib.ru/b</a>
<a href=//os-menuet.narod.ru>os-menuet.narod.ru</a> <a href=//coolthemes.narod.ru/indexold.html>coolthemes.narod.ru</a>
-1
View File
@@ -1 +0,0 @@
qemu-system-i386 -m 512 -fda kolibri.img -boot a -vga vmware -net nic,model=rtl8139 -net user -soundhw ac97 -usb -usbdevice tablet -enable-kvm -drive file=fat:rw:.
-10
View File
@@ -1,10 +0,0 @@
_ini ini;
void LoadIniConfig()
{
ini.path = GetIni(#settings_file, "app.ini");
ini.section = "WebView";
ini.GetString("proxy_address", #proxy_address, sizeof(proxy_address), NULL);
ini.GetString("search_engine", #search_engine, sizeof(search_engine), "http://bing.com/search?q=");
}
-91
View File
@@ -1,91 +0,0 @@
enum { TAG=1, VALUE, TEXT, COMMENT, SCRIPT};
int opened_font_counter=0;
int mode;
dword source_buf_end;
void SourceBufAdd(dword _mode, src)
{
dword font_found_pointer, src_orig = src;
if (_mode) mode = _mode;
strcpy(source_buf_end, src);
source_buf_end += strlen(source_buf_end);
if (font_found_pointer = strstr(src, "</font>")) {
opened_font_counter--;
}
if (font_found_pointer = strstr(src_orig, "<font ")) {
opened_font_counter++;
}
}
void CloseAllOpenedFonts(dword _mode)
{
while (opened_font_counter) SourceBufAdd(_mode, "</font>");
}
dword ShowSource(dword _bufdata, _in_bufsize)
{
dword i, j;
bool activate_script_mode = false;
dword source_buf_start;
opened_font_counter=0;
source_buf_start = malloc(_in_bufsize*5);
source_buf_end = source_buf_start;
SourceBufAdd(TEXT, "<html><head><title>View Source</title><body><pre>");
for (i=_bufdata; i<_bufdata+_in_bufsize; i++) switch (ESBYTE[i])
{
case '<':
if (!strncmp(i+1,"!--", 3)) SourceBufAdd(COMMENT, "<font color=#bbb>&lt;");
else if (SCRIPT == mode) {
if (!strncmp(i+1,"/script>", 8)) {
CloseAllOpenedFonts(NULL);
SourceBufAdd(TAG, "<font color=#00f>&lt;");
}
else SourceBufAdd(NULL, "&lt;");
}
else if (COMMENT == mode) {
SourceBufAdd(NULL, "&lt;");
}
else if (TEXT == mode) {
if (!strncmp(i+1,"script", 6)) activate_script_mode = true;
SourceBufAdd(TAG, "<font color=#00f>&lt;");
}
break;
case '>':
if (TAG == mode) && (activate_script_mode) {
activate_script_mode = false;
SourceBufAdd(SCRIPT, "&gt;</font><font color=#994500>");
}
else if (VALUE == mode) CloseAllOpenedFonts(TEXT);
else if (COMMENT == mode) && (!strncmp(i-2,"--", 2)) {
SourceBufAdd(TEXT, "&gt;");
CloseAllOpenedFonts(TEXT);
}
else if (COMMENT == mode) || (SCRIPT == mode) SourceBufAdd(NULL, "&gt;");
else if (TAG == mode) SourceBufAdd(TEXT, "&gt;</font>");
break;
case '&':
SourceBufAdd(NULL, "&amp;");
break;
case '\"':
case '\'':
if (TAG == mode) SourceBufAdd(VALUE, "<font color=#F301F2>&quot;");
else if (VALUE == mode) SourceBufAdd(TAG, "&quot;</font>");
else SourceBufAdd(NULL, "&quot;");
break;
default:
ESBYTE[source_buf_end] = ESBYTE[i];
source_buf_end++;
}
ESBYTE[source_buf_end] = 0;
LoadInternalPage(source_buf_start, source_buf_end-source_buf_start);
free(source_buf_start);
}
-195
View File
@@ -1,195 +0,0 @@
//===================================================//
// //
// MODULE //
// //
//===================================================//
#define TABS_MAX 5
TWebBrowser tabdata[TABS_MAX+1];
_history tabstory[TABS_MAX+1];
struct TAB
{
int count;
signed int active;
bool add();
bool close();
void save_state();
void restore();
} tab = {1,0};
bool TAB::add()
{
if (count==TABS_MAX) return false;
save_state();
count++;
active = count-1;
history = tabstory[active];
return true;
}
bool TAB::close(int _tab_number)
{
int i;
if (count==1) return false;
for (i=_tab_number; i<TABS_MAX; i++) {
tabdata[i] = tabdata[i+1];
tabstory[i] = tabstory[i+1];
}
if (_tab_number<active) && (active>0) active--;
if (active==count-1) && (active>0) active--;
count--;
return true;
}
void TAB::save_state()
{
tabstory[active] = history;
tabdata[active] = WB1;
}
void TAB::restore(int _id)
{
tab.active = _id;
WB1 = tabdata[_id];
history = tabstory[_id];
}
//===================================================//
// //
// WebView Actions //
// //
//===================================================//
#define DEFAULT_TABW 220
int tab_w = DEFAULT_TABW;
int GetTabWidth()
{
if (tab.count == TABS_MAX) return Form.cwidth / tab.count;
if (tab.count * DEFAULT_TABW + TAB_H < Form.cwidth) return DEFAULT_TABW; else
return Form.cwidth - TAB_H - 2 / tab.count;
}
void DrawTab(int _id)
{
#define CLOSE_S 13
dword bgcol, border_bottom_color;
char header_no_version[sizeof(TWebBrowser.header)];
char name[DEFAULT_TABW/6];
int xxx = _id * tab_w;
if (_id==tab.active) {
tab.save_state();
bgcol = sc.light;
border_bottom_color = sc.light;
} else {
bgcol=sc.work;
border_bottom_color = sc.line;
}
if (tabdata[_id].header) {
strncpy(#header_no_version, #tabdata[_id].header, strlen(#tabdata[_id].header)-sizeof(version)-2);
strncpy(#name, #header_no_version, tab_w-CLOSE_S/6-2);
}
DrawBar(xxx, TOOLBAR_H, 1, TAB_H, sc.dark);
DrawBar(xxx+1, TOOLBAR_H, tab_w-1, TAB_H-1, bgcol);
DrawBar(xxx+1, TOOLBAR_H+TAB_H-1, tab_w-1, 1, border_bottom_color);
DefineHiddenButton(xxx, TOOLBAR_H-1, tab_w, TAB_H, TAB_ID+_id);
WriteTextCenter(xxx, TOOLBAR_H+6, tab_w-CLOSE_S, sc.work_text, #name);
DefineHiddenButton(xxx+tab_w-CLOSE_S-3, TOOLBAR_H+3, CLOSE_S-1, CLOSE_S-1, TAB_CLOSE_ID+_id);
DrawBar(xxx+tab_w-CLOSE_S-3, TOOLBAR_H+3, CLOSE_S, CLOSE_S, sc.dark);
WriteText(xxx+tab_w-CLOSE_S+1, TOOLBAR_H+5, 0x80, sc.light, "x");
}
void DrawActiveTab()
{
if (tab_w == GetTabWidth()) DrawTab(tab.active);
else DrawTabsBar();
}
int DrawNewTabButton()
{
dword btn_light = MixColors(sc.button, 0xFFFfff, 220);
dword btn_dark = MixColors(sc.button, 0, 180);
int xxx = tab.count * tab_w;
if (tab.count < TABS_MAX) {
DrawBar(xxx, TOOLBAR_H, 1, TAB_H, sc.line);
DrawBar(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, sc.button);
DrawRectangle3D(xxx+1, TOOLBAR_H, TAB_H, TAB_H-1, btn_light, btn_dark);
PutPixel(xxx+1+TAB_H, TOOLBAR_H, btn_dark);
DefineHiddenButton(xxx+1, TOOLBAR_H, TAB_H-1, TAB_H-1, NEW_TAB);
WriteText(xxx+7, TOOLBAR_H+2, 0x90, sc.button_text, "+");
return xxx + TAB_H + 2;
} else {
return xxx;
}
}
void DrawTabsBar()
{
dword i;
tab_w = GetTabWidth();
for (i=0; i<tab.count; i++) DrawTab(i);
i = DrawNewTabButton();
DrawBar(i, TOOLBAR_H, Form.cwidth-i, TAB_H-1, MixColors(sc.dark, sc.work, 128));
DrawBar(i, TOOLBAR_H+TAB_H-1, Form.cwidth-i, 1, sc.line);
}
void EventTabClose(int _id)
{
DeleteButton(TAB_ID + tab.count-1);
if (_id == tab.active) {
tab.close(_id);
tab.restore(tab.active);
SetElementSizes();
WB1.Reparse();
WB1.DrawPage();
SetOmniboxText(history.current());
} else {
tab.close(_id);
}
DrawTabsBar();
DrawStatusBar(NULL);
}
void EventCloseActiveTab()
{
EventTabClose(tab.active);
}
void EventTabClick(int _id)
{
if (_id>=tab.count) _id = 0;
if (_id==-1) _id = tab.count-1;
tab.save_state();
tab.restore(_id);
DrawTabsBar();
SetElementSizes();
WB1.Reparse();
WB1.DrawPage();
SetOmniboxText(history.current());
DrawStatusBar(NULL);
}
void EventOpenNewTab(dword _url)
{
tab.add();
OpenPage(_url);
DrawTabsBar();
}
void EventActivateNextTab()
{
EventTabClick(tab.active+1);
}
void EventActivatePreviousTab()
{
EventTabClick(tab.active-1);
}
-119
View File
@@ -1,119 +0,0 @@
<!--doctype html public "-//w3c//dtd html 4.0 transitional//ru"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Тест Acid 0.1</title>
</head>
<body bgcolor="#000000" link="#0066FF" text="#FFFFFF">
<h1 align=center>Тест Acid 0.1</h1>
<br>
<b>Это тестовая страница для проверки текстового браузера <s>HTML Viewer</s> WebView</b>
<p>Из кодировок поддерживаются: CP866(DOS), CP1251(Windows), CP1252(Latin legacy), KOI8, и конечно UTF8. CSS и Javascript пока не реализованы (ахахаха). Поддержка тега &lt;table&gt; крайне базовая, поддержки вложенных таблиц нет.
</p>
<h3>История</h3>
Ранее программа называлась <b >HTMLv (HTML Viewer)</b> и изначально задумывалась как <q>Центр справки и поддержки</q>. Чтобы не изобретать велосипед и одновременно исполнить мечту многих, форматом просматриваемых страниц был выбран html.
Первоначальный автор Veliant, затем разработка была подхвачена дизайнером Leency. Это была моя вторая программа после файлового менеджера Eolite.<br>
<span> <br />
<b>
<font color="#FF0000">K</font>
<font color="#FFC005">o</font>
<font color="#F6F574">l</font>
<font color="#9EFC36">i</font>
<font color="#29FDFD">b</font>
<font color="#36A8FC">r</font>
<font color="blueviolet">i</font>
<font color="#C911FF">O</font>
<font color="#C911FF">S</font>
&nbsp; &nbsp;
<font color="#C911FF">F</font>
<font color="#36A8FC">o</font>
<font color="#29FDFD">r</font>
<font color="#9EFC36">e</font>
<font color="#FFC005">v</font>
<font color="#FF0000">e</font>
<font color="#FFC005">r</font>
</b>
<br>
<table>
<td>
<bg bgcolor=#333>
Небольшой список:<ol>
<li><q>Этот текст в кавычках</q></li>
<li><u>Это подчеркнутый текст</u></li>
<li><s>Это перечеркнутый текст</s></li>
<li><i>Это наклонный текст</i></li>
<li><strong>Это текст с усиленным выделением</strong></li>
<li><b><u><s><font color="#777444">Много тегов</font></s></u></b></ol>
</bg>
</p>
<br>
<!-- комментарий: этого текста здесь <нет> -->
<br>
<img alt="нет картинки, просто alt">
<img src = http://wiby.org/about/wibyplex.gif>
<a href="http://kolibrios.org/i/logo.png"><img id="2.1.4" src="http://kolibrios.org/i/logo.png" alt="logo"><br>Открыть</a><br>
<br>
<br>
<a href='./index.htm'>./index.htm</a><br>
<a href='/sys/index.htm'>Незакрытый тег а - index.htm<br>
<a href="/sys/calc">/sys/calc</a><br>
<a href="#2.1.4">#2.1.4</a><br>
<a href="http://kolibrios.org">http://kolibrios.org</a><br>
<a href="mailto:leency@mail.ru">Mail to Leency</a><br>
<br>
<h1><a href=#>Link H1</a> <u>Underline H1</u></h1>
<h2><a href=#>Link H2</a> <u>Underline H2</u></h2>
<h3><a href=#>Link H3</a> <u>Underline H2</u></h3>
<a href=#>Link</a> <u>Underline</u>
<td>
<pre>
"Осень уже пришла!"-
Шепнул мне на ухо ветер,
Подкравшись к подушке моей.
Басе
</pre><br>
В этом тексте есть переход на следующую строку, но браузер
его должен проигнорировать. Еще много пробелов. А тут есть
табы. Кое-какие символы: &quot; &amp; &lt; &gt; &#149;
&nbsp; &copy; &reg; &bdquo; &ldquo; &#151; Їжачок іншого боку р. Євфрат з'їв ґрунт та єврейський ґербалайф.
<p>61055,&nbsp; &#1075;.
&#1061;&#1072;&#1088;&#1100;&#1082;&#1086;&#1074;, &#1091;&#1083;.&nbsp; &#1050;&#1088;&#1072;&#1089;&#1085;&#1086;&#1079;&#1085;&#1072;&#1084;&#1077;&#1085;&#1085;&#1072;&#1103;, 16</SPAN>,&nbsp; &#1088;&#1072;&#1076;&#1080;&#1086;&#1092;&#1080;&#1079;&#1080;&#1095;&#1077;&#1089;&#1082;&#1080;&#1081;
&#1082;&#1086;&#1088;&#1087;&#1091;&#1089; &#1085;&#1072; &#1090;&#1077;&#1088;&#1088;&#1080;&#1090;&#1086;&#1088;&#1080;&#1080; &#1053;&#1058;&#1059; «&#1061;&#1055;&#1048;»
</p>
<pre><font color="#000">
<font bg=#FFED00 style="background-color:#FFED00"> Заметки </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> Речка на Жукова </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> Heroes 3 </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> Рисостерон, куринабол </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> </font>
</font></pre>
</table>
<hr color="#758999">
<center>Zhytomyr 2008-2025</center>
</body>
</html>
-36
View File
@@ -1,36 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<form action="https://www.w3schools.com/action_page.php">
First name: <input type="text" name="fname" value="Mickey"><br>
Last name: <input type="text" name="lname" value="Mouse"><br>
<input type="submit" value="Submit">
</form>
<form action="https://www.w3schools.com/action_page.php" method="post">
First name: <input type="text" name="fname" value="Aboba"><br>
Last name: <input type="text" name="lname" value="Aboba"><br>
<input type="submit" value="Submit">
</form>
<p>Click the "Submit" button and the form-data will be sent to a script on the server.</p>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
<h1>aboba</h1><br>
</body>
</html>
-12
View File
@@ -1,12 +0,0 @@
; ┬ ¤Єюь Їрщых ьюцэю шчьхэшЄ№ эрёЄЁющъш ъюьяшы ЄюЁр яю єьюыўрэш■.
J0 ; эх фхырЄ№ эрўры№э√щ jump эр main()
r- ; чряЁхЄшЄ№ шчьхэхэшх фюёЄєяэющ ярь Єш т *.com Їрщырї
X ; чряЁхЄшЄ№ тъы■ўхэшх т т√їюфэющ Їрщы эрфяшёш SPHINXC--
4 ; ъюьяшышЁютрЄ№ ъюф фы  80386 яЁюЎхёёюЁр
oc ; юяЁшьшчрЎш  яю ЁрчьхЁє ъюфр
w ; т√фртрЄ№ яЁхфєяЁхцфхэш 
de ; шёяюы№чютрЄ№ тЁхьхээюх Ёрё°шЁхэшх Єшяр яЁш фхыхэшш
ON ; тъы■ўшЄ№ юяЄшьшчрЎш■ ўшёхы
ost ; юяЄшьшчшЁютрЄ№ ЄхъёЄют√х ъюэёЄрэЄ√
;dos4gw
;env
File diff suppressed because it is too large. Load diff
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("clipview.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "clipview.com")
-5
View File
@@ -1,5 +0,0 @@
@del clipview
@c-- /D=LANG_ENG clipview.c
@rename clipview.com clipview
@del warning.txt
@pause
@@ -1,30 +0,0 @@
Содержимое контейнера буфера обмена
1. Первый dword содержит общую длину данных в контейнере
2. Второй dword указывает тип данныx:
0 = Текст
1 = Изображение
2 = RAW
4 и выше зарезервировано
2.1 Текст
Данные в третьем dword содержат тип кодировки:
0 = UTF
1 = 0866
2 = 1251
3 и выше зарезервировано
2.2 Изображение
Третий dword - размер по X
Четвертый dword - размер по Y
Пятый dword - глубина цвета в битах (8, 16, 24, 32, 48, 64)
Шестой dword - Указатель на палитру (смещение от начала файла).
Если палитры нет то значение 0
Седьмой dword - Размер области палитры, максимальное значение 256*4=1024байт.
Если палитры нет то значение 0
Восьмой dword - Указатель на данные пикселей для R, G, B.
Девятый dword - Размер области данных для пикселей.
2.3 RAW
Может содержать любые данные, т.к. содержимое на усмотрение программиста
-268
View File
@@ -1,268 +0,0 @@
#define ENTRY_POINT #main
#define MEMSIZE 4096*20
#include "..\lib\strings.h"
#include "..\lib\clipboard.h"
#include "..\lib\gui.h"
#include "..\lib\fs.h"
//===================================================//
// //
// DATA //
// //
//===================================================//
?define T_COLUMNS_TITLE "# Size Type Contents"
?define DEFAULT_SAVE_PATH "/tmp0/1/clipview.tmp"
char *data_type[] = { "Text", "Image", "RAW", "Unknown" };
enum {
BT_DELETE_LAST = 10,
BT_DELETE_ALL,
BT_UNLOCK,
BT_LIST_LEFT,
BT_LIST_RIGHT
};
#define PANEL_BOTTOM_H 35
#define GAP 5
#define LIST_Y 32
#define PANEL_TOP_H LIST_Y-2
#define LINE_H 20
#define TEXT_Y LINE_H - 14 / 2
proc_info Form;
struct LIST {
int w,h;
int count;
int first;
int visible;
} list = 0;
//===================================================//
// //
// CODE //
// //
//===================================================//
void main()
{
@mem_init();
@SetEventMask(EVM_REDRAW + EVM_BUTTON);
loop() switch(@WaitEventTimeout(10))
{
case evButton:
@GetButtonID();
switch(EAX) {
case 1:
ExitProcess();
case BT_DELETE_LAST:
EventDeleteLastSlot();
break;
case BT_DELETE_ALL:
EventDeleteAllSlots();
break;
case BT_UNLOCK:
EventResetBufferLock();
break;
case BT_LIST_LEFT:
list.first -= list.visible;
if (list.first <= 0) list.first = 0;
ClipViewSelectListDraw();
break;
case BT_LIST_RIGHT:
if (list.first + list.visible < list.count) list.first += list.visible;
ClipViewSelectListDraw();
break;
default:
if (EAX>=300) EventOpenAsHex(EAX-300);
else EventOpenAsText(EAX-100);
}
break;
case evReDraw:
sc.get();
DefineAndDrawWindow(GetScreenWidth()-600/2,80,600,400,0x73,NULL,"Clipboard Viewer",NULL);
GetProcessInfo(#Form, SelfInfo);
IF (Form.status_window&ROLLED_UP) break;
IF (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
IF (Form.width < 570) { MoveSize(OLD,OLD,570,OLD); break; }
DrawWindowContent();
break;
default:
if (Clipboard__GetSlotCount() > list.count) ClipViewSelectListDraw();
}
}
void DrawWindowContent()
{
list.w = Form.cwidth-GAP-GAP;
list.h = Form.cheight-PANEL_BOTTOM_H-LIST_Y-GAP;
list.visible = list.h / LINE_H;
DrawBar(0,0, Form.cwidth, PANEL_TOP_H, sc.work);
DrawBar(0,Form.cheight-PANEL_BOTTOM_H, Form.cwidth, PANEL_BOTTOM_H, sc.work);
DrawWideRectangle(GAP-GAP, LIST_Y-GAP, GAP*2+list.w, GAP*2+list.h, GAP-2, sc.work);
DefineButton(GAP, list.h + LIST_Y + 8, 110, 25, BT_DELETE_LAST, sc.button);
$inc edx
$add ebx, 130 << 16 //BT_DELETE_ALL
$int 64
$inc edx
$add ebx, 130 << 16 //BT_UNLOCK
$int 64
WriteText(GAP+11, LIST_Y + list.h + 14, 0x90, sc.button_text, "Delete last Delete all Reset lock");
WriteText(GAP+18, LIST_Y - 23, 0x90, sc.work_text, T_COLUMNS_TITLE);
ClipViewSelectListDraw();
SelectList_DrawBorder();
}
dword slot_data;
struct clipboard_data
{
dword size;
dword type;
dword encoding;
dword content;
dword content_offset;
} cdata;
void SelectList_DrawLine(dword i)
{
int yyy, slot_data_type_number;
yyy = i*LINE_H+LIST_Y;
DrawBar(GAP, yyy, list.w, LINE_H, -i%2 * 0x0E0E0E + 0xF1F1f1);
if (list.first + i >= list.count) {
return;
}
slot_data = Clipboard__GetSlotData(list.first + i);
cdata.size = ESDWORD[slot_data];
cdata.type = ESDWORD[slot_data+4];
if (cdata.type==SLOT_DATA_TYPE_TEXT) || (cdata.type==SLOT_DATA_TYPE_TEXT_BLOCK)
cdata.content_offset = 12;
else
cdata.content_offset = 8;
cdata.content = slot_data + cdata.content_offset;
WriteText(list.first+i/10^1*8+GAP+12, yyy+TEXT_Y, 0x90, 0x000000, itoa(list.first + i));
EDX = ConvertSizeToKb(cdata.size);
WriteText(GAP+44+16, yyy+TEXT_Y, 0x90, 0x000000, EDX);
slot_data_type_number = cdata.type;
if (slot_data_type_number >= 4) slot_data_type_number = 3;
WriteText(GAP+140, yyy+TEXT_Y, 0x90, 0x000000, data_type[slot_data_type_number]);
WriteTextB(GAP+list.w - 88, yyy+TEXT_Y, 0x90, 0x006597, "TEXT HEX");
DefineButton(GAP+list.w - 98, yyy, 50, LINE_H, 100+i+BT_HIDE, NULL);
$add edx, 200
$add ebx, 52 << 16 - 10 //BT_HEX
$int 64
ESI = list.w - 345 / 8;
if (cdata.size - cdata.content_offset < ESI) ESI = cdata.size - cdata.content_offset;
WriteText(GAP+236, yyy+TEXT_Y, 0x30, 0x000000, cdata.content);
}
int SaveSlotContents() {
if (! CreateFile(cdata.size, cdata.content, DEFAULT_SAVE_PATH)) {
return true;
} else {
notify("'Can not create /tmp0/1/clipview.tmp' -E");
return false;
}
}
void ClipViewSelectListDraw()
{
int i, list_last;
list.count = Clipboard__GetSlotCount();
if (list.first >= list.count) list.first = list.count - list.visible;
if (list.first < 0) list.first = 0;
if (list.count > list.visible) list_last = list.visible; else list_last = list.count;
for (i=0; i<list_last; i++;) SelectList_DrawLine(i);
DrawBar(GAP,i*LINE_H+LIST_Y, list.w, -i*LINE_H+ list.h, 0xFFFfff);
if (!list.count) WriteText(list.w / 2 + GAP - 60,
list.h / 2 - 8 + LIST_Y, 0x90, 0x999999, "No data to show");
//Show "<" and ">" buttons and a page number
//in case when there are items more than visible at once
if (list.count > list.visible) {
param[0] = list.first / list.visible + '0';
param[1] = '\0';
DefineButton(Form.cwidth-84-GAP, list.h + LIST_Y + 8, 25, 25, BT_LIST_LEFT, sc.button); //BT_LEFT
$inc edx
$add ebx, 57 << 16 //BT_RIGHT
$int 64
WriteText(Form.cwidth-84-GAP+10, list.h + LIST_Y + 14, 0x90, sc.button_text, "< >");
$add ebx, 28 << 16
$mov edx, #param;
$mov edi, sc.work
$mov ecx, 11010000b << 24
$add ecx, sc.work_text //page number
$int 64
}
}
void SelectList_DrawBorder() {
DrawRectangle3D(GAP-2, LIST_Y-2,
list.w+3, list.h+3,
sc.dark, sc.light);
DrawRectangle3D(GAP-1, LIST_Y-1,
list.w+1, list.h+1,
sc.line, sc.line);
}
//===================================================//
// //
// EVENTS //
// //
//===================================================//
void EventDeleteLastSlot()
{
int i;
for (i=0; i<list.visible; i++;) {
DeleteButton(list.first + i + 100);
$add edx, 200
$int 64
}
Clipboard__DeleteLastSlot();
DrawWindowContent();
}
void EventDeleteAllSlots()
{
while (Clipboard__GetSlotCount()) Clipboard__DeleteLastSlot();
DrawWindowContent();
}
void EventResetBufferLock() {
Clipboard__ResetBlockingBuffer();
DrawWindowContent();
}
void EventOpenAsText(int slot_id) {
slot_data = Clipboard__GetSlotData(slot_id);
cdata.size = ESDWORD[slot_data]-12;
cdata.content = slot_data+12;
if (SaveSlotContents()) RunProgram("/sys/develop/cedit", DEFAULT_SAVE_PATH);
}
void EventOpenAsHex(int slot_id) {
slot_data = Clipboard__GetSlotData(slot_id);
cdata.size = ESDWORD[slot_data];
cdata.content = slot_data;
if (SaveSlotContents()) RunProgram("/sys/develop/heed", DEFAULT_SAVE_PATH);
}
stop:
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("dicty.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "dicty.com")
-5
View File
@@ -1,5 +0,0 @@
@c-- /D=LANG_ENG dicty.c
@del dicty
@rename dicty.com dicty
@del warning.txt
@pause
-5
View File
@@ -1,5 +0,0 @@
@c-- /D=LANG_RUS dicty.c
@del dicty
@rename dicty.com dicty
@del warning.txt
@pause
-205
View File
@@ -1,205 +0,0 @@
#define MEMSIZE 4096 * 1024 * 2
#define NO_DLL_INIT
#include "../lib/strings.h"
#include "../lib/gui.h"
#include "../lib/obj/box_lib.h"
#ifdef LANG_RUS
#define WINDOW_TITLE "Словарик 2.4"
#define DICTIONARY_LOADED "Словарь загружен"
#define WORD_NOT_FOUND "Слово не найдено в словаре"
#define ERROR "Ошибка #%d"
#else
#define WINDOW_TITLE "Dictionary v2.4"
#define DICTIONARY_LOADED "Dictionary loaded"
#define WORD_NOT_FOUND "Word isn't found in the dictionary"
#define ERROR "Error #%d"
#endif
#define TEXT_ENG_RUS "ENG\26RUS"
#define TEXT_RUS_ENG "RUS\26ENG"
#define TEXT_RU2EN "ENG RUS"
#define TEXT_EN2RU "RUS ENG"
unsigned char speaker[23*40*3]= FROM "speaker.raw";
proc_info Form;
char search_word[256], translate_result[4096];
#define TOPH 45
#define PRONOUNCED_FILE "/tmp0/1/pronounced.txt"
#define SPEECH_PATH "/kolibrios/speech/speech"
dword speaker_id;
unsigned char eng_rus[] = FROM "eng_rus.dict""\0";
unsigned char rus_eng[] = FROM "rus_eng.dict""\0";
dword io_buffer_data;
#define ENG_RUS 0
#define RUS_ENG 1
int active_dict=2;
#define BTN_CHANGE_LANGUAGE 10
#define BTN_SPEAKER 11
char edit_text[256];
edit_box edit1 = {0,13,13,0xffffff,0x94AECE,0xffffff,0xffffff,
0x10000000,248,#edit_text,0,ed_focus+ed_always_focus};
void main()
{
int btnid;
load_dll(boxlib, #box_lib_init,0);
OpenDictionary(ENG_RUS);
if (param) {
strcpy(#edit_text, #param);
edit_box_set_text stdcall (#edit1, #param);
Translate();
}
@SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop() switch(@WaitEvent())
{
case evMouse:
edit_box_mouse stdcall (#edit1);
break;
case evButton:
btnid = @GetButtonID();
if (btnid==01) ExitProcess();
if (btnid==BTN_CHANGE_LANGUAGE) {
if (active_dict == ENG_RUS) {
OpenDictionary(RUS_ENG);
} else {
OpenDictionary(ENG_RUS);
}
DrawLangButtons();
}
if (btnid==BTN_SPEAKER) {
if (GetProcessSlot(speaker_id)!=0) {
KillProcess(speaker_id);
pause(50);
} else {
if (CreateFile(strlen(#translate_result)+1, #translate_result, PRONOUNCED_FILE)!=0) break;
pause(50);
speaker_id = RunProgram(SPEECH_PATH, PRONOUNCED_FILE);
}
SpeakerDraw();
}
break;
case evKey:
@GetKey();
edit_box_key stdcall(#edit1);
Translate();
break;
case evReDraw:
sc.get();
DefineAndDrawWindow(215,120,500,350,0x73,sc.work,WINDOW_TITLE,0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window&ROLLED_UP) break;
if (Form.height<140) { MoveSize(OLD,OLD,OLD,140); break; }
if (Form.width<400) { MoveSize(OLD,OLD,400,OLD); break; }
DrawBar(0, 0, Form.cwidth, TOPH, sc.work); //top bg
DrawBar(0, TOPH, Form.cwidth, 1, sc.line);
edit1.width = Form.cwidth-edit1.left-edit1.left - 116;
edit_box_draw stdcall(#edit1);
DrawWideRectangle(edit1.left-2, edit1.top-2, edit1.width+3, 25, 2, 0xffffff);
DrawRectangle(edit1.left-3, edit1.top-3, edit1.width+4, 26, sc.line);
DrawTranslation();
DrawLangButtons();
}
}
void DrawLangButtons()
{
dword direction;
int y = edit1.top+3;
DrawBar(Form.cwidth-111, y, 100, 25, sc.work);
DefineButton(Form.cwidth-79, y-4, 20, 20, BTN_CHANGE_LANGUAGE, sc.button);
WriteText(Form.cwidth-73, y-1, 10000001b, sc.button_text, "\26");
if (active_dict == ENG_RUS) {
direction = TEXT_RU2EN;
} else {
direction = TEXT_EN2RU;
}
WriteText(Form.cwidth-111, y, 0x90, sc.work_text, direction);
}
void Translate()
{
dword tr_start, tr_end;
sprintf(#search_word, "\10%s\13", #edit_text);
strupr(#search_word);
if (!edit_text) goto _TR_END;
tr_start = strstr(io_buffer_data, #search_word);
if (!tr_start) {
strcpy(#translate_result, WORD_NOT_FOUND);
} else {
tr_start = strchr(tr_start, '"') + 1;
tr_end = strchr(tr_start, '"');
strlcpy(#translate_result, tr_start, tr_end - tr_start);
}
_TR_END:
strcpy(#search_word, #search_word+1);
DrawTranslation();
}
void OpenDictionary(dword dict_id)
{
if (dict_id==active_dict) return;
active_dict = dict_id;
if (active_dict==ENG_RUS)
{
io_buffer_data=#eng_rus;
strcpy(#search_word, TEXT_ENG_RUS);
}
if (active_dict==RUS_ENG)
{
io_buffer_data=#rus_eng;
strcpy(#search_word, TEXT_RUS_ENG);
}
strcpy(#translate_result, DICTIONARY_LOADED);
DrawTranslation();
}
void DrawTranslation()
{
int y_pos=TOPH+1;
char draw_buf[4096];
strlcpy(#draw_buf, #translate_result, sizeof(draw_buf)-1);
DrawBar(0, y_pos, Form.cwidth, Form.cheight - y_pos, 0xFFFFFF);
strttl(#draw_buf);
WriteTextB(10+1, y_pos+8, 10000001b, 0x800080, #search_word);
DrawTextViewArea(10, y_pos+31, Form.cwidth-20, Form.cheight-30,
#draw_buf, -1, 0x000000);
SpeakerDraw();
}
void SpeakerDraw()
{
dword x = Form.cwidth-38;
dword y = Form.cheight-32;
if (active_dict == RUS_ENG)
{
DeleteButton(15);
DrawBar(x,y,23,20,0xFFFFFF);
} else {
DefineHiddenButton(x-5, y-5, 23+10, 20+9, BTN_SPEAKER);
if (!GetProcessSlot(speaker_id)) {
PutImage(x, y, 23,20, #speaker);
} else {
PutImage(x, y, 23,20, 23*20*3+#speaker);
}
}
}
stop:
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

-1
View File
@@ -1 +0,0 @@
                                                   ■■■щшшЄЄЄ                                       ўўў                  ЄЄЄ╟─┼╟┼╟···                              √√√ЦУХD;A╒╥╘               √∙√╚╟╟╟─╟▀▐▀                           щщщmgkC;AC;A┼├─   ъъъ═╩═ыыы      ▐█▐╟┼╟╔╟╔√∙√                     ╚╞╚SJPE<BE<BE<B┼├┼   р▐▀╚┼╟╠╔╠¤¤¤   ∙ў∙╚╞╚╚┼╟срс               ¤¤¤ЭЧЬG?EF>DF>DF>DF>D┼├┼   ЇЇЇ╚┼╟╚┼╟хух      ▄▄▄╚┼╟╠╦╠   урс░мн╠╩╩   НИЛH?EH?EH?EH?EH?EH?E╞┼╞      ┘╓┘╚╟╚═╦╦■■■   эээ╚╟╚╚╟╚√√√ЬШЪIAG{ty   gafIAGIAGIAGIAGIAGIAG╞─┼      ЁЁЁ╩╟╚╩╟╚ўўў   ЇЇЇ╩╟╚╩╟╚єЄєШСХKBHВ{А   c\aKBHKBHKBHKBHKBHKBH╚┼╞      ∙∙∙╩╟╚╩╟╚ююю   ¤¤¤╩╟╚╩╟╚ьыьСОСLDJЗГЗ   _X^LDJLDJLDJLDJLDJLDJ╚┼╞         ╠╩╠╩╟╩цхц      ╧╬╧╩╟╩фтфХРУNEKЗБЕ   bZ_NEKNEKNEKNEKNEKNEK╚┼╚         ╬╠╠╩╚╩цхц      ╤╬╧╩╚╩фффЫЦЪOFLГ|А   hafOFLOFLOFLOFLOFLOFL╔┼╚      ∙∙∙╠╚╩╠╚╩ююю   ¤¤¤╠╚╩╠╚╩эььеагQHNБ{~   pinQHNQHNQHNQHNQHNQHN╩╞╚      ёёё╠╚╩╠╚╩ўўў   їЇЇ╠╚╩╠╚╩єєє∙∙∙хтфёёё   ╣╡╖TKQRIORIORIORIORIO╩╞╔      ▄┘█╠╩╠╨═╬ ■    эээ╠╩╠╠╩╠№√№               ╙╨╥d\aSKQSKQSKQSKQ╩╚╔   їЇї═╩╠═╩╠чцч      ▀▌▀═╩╠╤╧╧                     яэяАy}ULRULRULR╩╚╩   с▀▀═╩╠╤╧╤¤¤¤   ∙∙∙═╦══╩╠фуф                        ¤¤¤йгжWOUVNT╦╚╦   шцч═╦═ыыы      срс═╩═╬╠╬√√√                              ╥╬╨ЖАГЁяя               √√√╨╠╬═╠═усу                                                         ЄЁЁ╧╠═╬══∙∙∙                                                         ■■■шццёЁё                                                            ¤¤¤░мо╘╤╙                                       ўўў                  ╒╙╒@8>D=Cыъы                              √√√ЦУХD;A╒╥╘      ■■■      яэяG>DB9?УПТ                           щщщmgkC;AC;A┼├─   ╕╡╕TLR╜╗╝      ПЙНC;AJBHяэя                     ╚╞╚RJPD<BD<BD<B┼├┼   ХСХD<BSLQўўў   шчшG@ED<BЪХЪ               ¤¤¤ЭЧЬG?EF>DF>DF>DF>D┼├┼   ┘╓╫F>DF>Dжве      ЙДЙF>DVNT   срспмн╠╩╩   НИЛG?EG?EG?EG?EG?EG?E╞┼╞      Аy~G?ESLQ√√√   └╛└G?EG?EєЄєЬЧЩI@F{sx   g_dI@FI@FI@FI@FI@FI@F╞─┼      ╠╩╠I@FI@Fурс   ▌┌▄I@FI@F╪╓╓ЦСХJBHА{А   c\aJBHJBHJBHJBHJBHJBH╞┼╞      ъъъJBHJBH╞┬┼   °°°KCIJBH╝╣╝СМСLCIЗБЕ   _W]LCILCILCILCILCILCI╚┼╞         ULRLCIкди      `X]LCIвЯбХРУMEKЗБЕ   bZ_MEKMEKMEKMEKMEKMEK╚┼╚         VNTMEKкей      bZ_MEKгавЫЦЪOFLГ|А   hafOFLOFLOFLOFLOFLOFL╔┼╚      ыъыOFLOFL╟┼╞   °°°PGMOFL┐╝╛дагPHNА{~   oinPHNPHNPHNPHNPHNPHN╩╞╚      ╬╠╬PHNPHNфуф   ▌▌▌PHNPHN┌╪╪∙∙∙хтфёёё   ╣╡╖TKQRIORIORIORIORIO╩╞╔      ЗБЕRIO]U[№√№   ├└┬RIORIOєєє               ╙╧╥d[`SJPSJPSJPSJP╩╞╔   ▌█▄SJPSJPмжк      ТНРSJPbY_                     яэяАy}ULRULRULR╩╚╩   ХПФULRbZ_ЎЎЎ   ыъъXOUULRвЭв                        ¤¤¤йгжWNTVMS╦╚╦   нймZQW╛║╝      ЭЧЪVMS\SYяюя                              ╨╬╨ДАГЁяя      √√√      ёЁё\TZWOUЭЩЬ                                                         ╦╔╩YPV]TZыыы                                                         №№№нзл═╩╠         
-154
View File
@@ -1,154 +0,0 @@
:static int __wsprintfproc;
:static int cdecl __wsprintf(int buff,mask,...){
char buffer[MAX_PATH];
char bufnum[32];
int bufferlen;
int param;
int length;
int pad;
struct _wsprintf_mf{
int precision;
int width;
int minus ;
int plus ;
int diez ;
int zero ;
byte upcase ;
byte _signed;//
}mf;
$push EBX,ESI,EDI;
param=#mask[sizeof(mask)];
length=0;
EDX=mask;
EBX=buff;
for(;;){
mf=0;
mf.precision=0x7FFF;
REPEATSMALL:
if(!DSCHAR[EDX]){
AL=0;
$call __wsprintfproc;
$pop EDI,ESI,EBX;
return length;
}
if(DSCHAR[EDX]!='%'){
WRITECHAR: AL=DSCHAR[EDX];$call __wsprintfproc; EDX++;GOTO REPEATSMALL;
}
GETMASK:
EDX++;
SWITCH(DSCHAR[EDX]){
CASE '-': mf.minus++;goto GETMASK;
CASE '+': mf.plus ++;goto GETMASK;
CASE '#': mf.diez ++;goto GETMASK;
CASE '0': mf.zero ++;EDX++;
}
WHILE(DSCHAR[EDX]>='0')&&(DSCHAR[EDX]<='9'){
$push EDX;mf.width=mf.width*10+DSCHAR[EDX]-'0';$pop EDX;EDX++;
}
if(DSCHAR[EDX]=='.'){
mf.precision=0;
GETPRECISION:
EDX++;
if(DSCHAR[EDX]>='0')
&&(DSCHAR[EDX]<='9'){
$push EDX;mf.precision=mf.precision*10+DSCHAR[EDX]-'0';$pop EDX;
GOTO GETPRECISION;
}
}
if(DSCHAR[EDX]=='l'){
EDX++;
}
if(DSCHAR[EDX]=='h'){
EDX++;
}
if(DSCHAR[EDX]<'a'){mf.upcase=1;}
SWITCH(DSCHAR[EDX]|0x20){
CASE 'c': buffer=DSCHAR[param];bufferlen=1;goto FORMAT;
CASE 's': if(!DSDWORD[param])DSDWORD[param]="(null)";//??????
FOR(bufferlen=0;bufferlen<mf.precision;bufferlen++){
AL=DSCHAR[DSDWORD[param]+bufferlen];
if(!AL)BREAK;
buffer[bufferlen]=AL;
}
goto FORMAT;
}
//с символьными покончили. теперь числовые
if(mf.precision==0x7FFF){mf.precision=mf.width;}
if(!mf.precision)mf.precision=1;
if(DSCHAR[EDX]|0x20=='x'){
$push EDX;
EDI=0;//cnt
EDX=DSDWORD[param];
WHILE(EDX){
AL=DL&0xF+0x30;if(AL>'9'){AL+='A'-'9'-1;if(!mf.upcase)AL|=0x20;}
bufnum[EDI]=AL;EDI++;EDX>>=4;
}
$pop EDX;
WHILE(EDI<mf.precision){bufnum[EDI]='0';EDI++;}
if(mf.diez){bufnum[EDI]=DSCHAR[EDX];EDI++;bufnum[EDI]='0';EDI++;}
FOR(bufferlen=0;EDI;bufferlen++){
EDI--;buffer[bufferlen]=bufnum[EDI];
}
goto FORMAT;
}
switch(DSCHAR[EDX]){
CASE 'i':
CASE 'd': $push EDX;EDX=DSDWORD[param];
if(int EDX<0){-EDX;mf._signed++;}
GOTO WRITEINT;
CASE 'u': $push EDX;mf.plus=0;EDX=DSDWORD[param];
WRITEINT:
EDI=0;//cnt
WHILE(EDX){
EAX=0;EDX><EAX;EAX/=10;EDX><EAX;bufnum[EDI]=AL+'0';EDI++;
}
WHILE(EDI<mf.precision){bufnum[EDI]='0';EDI++;}
if(mf._signed){bufnum[EDI]='-';EDI++;}
ELSE
if(mf.plus){bufnum[EDI]='+';EDI++;}
FOR(bufferlen=0;EDI;bufferlen++){
EDI--;buffer[bufferlen]=bufnum[EDI];
}
$pop EDX;
FORMAT:
EDX++;
param+=sizeof(int);
pad=mf.width-bufferlen;if(pad<0)pad=0;
if(!mf.minus)$call FRM;
FOR(EDI=0;EDI<bufferlen;EDI++){AL=buffer[EDI];$call __wsprintfproc;}
if(mf.minus)$call FRM;
BREAK;
default:
goto WRITECHAR;
}
}//for(;;)
FRM: WHILE(pad){AL=' ';$call __wsprintfproc;pad--;}$ret;
}
:int cdecl wsprintf(...)inline{
__wsprintfproc=#WSP;
goto __wsprintf;
WSP: DSCHAR[EBX]=AL;EBX++;$ret;
}
:void FillMemory(int dest,len,byt){
EDI = dest;
ECX = len;
AL = byt;
$cld $rep $stosb
}
//#define CopyMemory memmov
:void CopyMemory(int dest,src,len){
EDI = dest;
ESI = src;
ECX = len;
$cld $rep $movsb
}
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("diff.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "diff.com")
-5
View File
@@ -1,5 +0,0 @@
@del diff
@c-- diff.c
@move diff.com diff
@del warning.txt
@pause
-208
View File
@@ -1,208 +0,0 @@
//visual text comparer
//by den po - jdp@bk.ru
#define MEMSIZE 1024 * 60
#define ENTRY_POINT #main
#include "../lib/fs.h"
#include "../lib/strings.h"
#include "../lib/obj/console.h"
#define MAX_PATH 260
#include "32user32.h"
#include "objects.h"
#include "diff_gui.h"
#define mincmpstrings 2
#define maxcmpstrings 10
#define maxcmpoffset 100
char window_title[] = "Kolibri Diff tool (Visual Text Comparer)";
char* srcfilename;
char* dstfilename;
dword srcfile;
dword dstfile;
dword srcfilesize;
dword dstfilesize;
TCollection srcfilelines; //file lines
TCollection dstfilelines;
TCollection srcfilenums; //lines numbers
TCollection dstfilenums;
struct TSimpleCollection:TSortedCollection
{
TSimpleCollection();
int Compare( int Key1, Key2 );
};
int TSimpleCollection::Compare( int Key1, Key2 ){
return Key1-Key2;
}
TSimpleCollection::TSimpleCollection():TSortedCollection(1000,1000);
{
comparemethod=#Compare;
}
TSimpleCollection diffs; //list of differing strings
dword srcfilelinks; //pointer to the previos line with the same first symbol
dword dstfilelinks; //
getstrings(dword srcfile,srcfilesize,srcfilelines){
ECX=srcfilesize;
ESI=srcfile;
WHILE(ECX){
$push ECX,ESI
EAX=srcfilelines;
EAX.TCollection.Insert(ESI);
$pop ESI,ECX
WHILE(ECX){
$cld $lodsb ECX--;
if(AL==0x0D)||(AL==0x0A)DSBYTE[ESI-1]=0;
if(AL==0x0D)&&(DSBYTE[ESI]==0x0A){$lodsb;ECX--;}
if(AL==0x0D)||(AL==0x0A)BREAK;
}
}
}
#include "if.h"
bool getparam()
{
int i, param_len = strlen(#param);
if (param[0]=='"') {
for (i=1; i<param_len; i++) if (param[i]=='"') param[i]=NULL;
srcfilename = #param + 1;
dstfilename = #param + strlen(#param) + 3;
return true;
}
notify("'Wrong params! Use format:\nAPPPATH \"PARAM1\" \"PARAM2\"' -E");
return false;
}
main(){
mem_init();
if (param[0]) getparam();
if (!srcfilename) || (!dstfilename) gui(); else console();
}
console() {
int i;
int p;
int bs,bd,bsc,bdc,bsp,bdp;
int cache[256];
char s1;
int s2;
read_file(srcfilename, #srcfile, #srcfilesize);
read_file(dstfilename, #dstfile, #dstfilesize);
if (!srcfile) die("'First file not found' -E");
if (!dstfile) die("'Second file not found' -E");
srcfilelines.TCollection(srcfilesize/40,8192);
dstfilelines.TCollection(dstfilesize/40,8192);
//fill line pointers
getstrings(srcfile,srcfilesize,#srcfilelines);
getstrings(dstfile,dstfilesize,#dstfilelines);
srcfilenums.TCollection(srcfilelines.Count,1000);
dstfilenums.TCollection(dstfilelines.Count,1000);
srcfilelinks=malloc(srcfilelines.Count*4);
dstfilelinks=malloc(dstfilelines.Count*4);
//fill links on the next strings with the same first symbols
FillMemory(#cache,sizeof(cache),-1); i=srcfilelines.Count;
WHILE(i){
i--;
EBX=srcfilelines.At(i); EBX=DSBYTE[EBX];
DSDWORD[i<<2+srcfilelinks]=cache[EBX*4];
cache[EBX*4]=i;
}
FillMemory(#cache,sizeof(cache),-1); i=dstfilelines.Count;
WHILE(i){
i--;
EBX=dstfilelines.At(i); EBX=DSBYTE[EBX];
DSDWORD[i<<2+dstfilelinks]=cache[EBX*4];
cache[EBX*4]=i;
}
diffs.TSimpleCollection();
while( bsp < srcfilelines.Count ) || ( bdp < dstfilelines.Count )
{
////////////////////////////////////////////////////////
bsc=0;
p=dstfilelines.At(bdp);//current dst position
s1=DSBYTE[p];
bs=bsp+1;//found src line, bsc - number of matched
while( bs != -1 )//no next line starting with the same symbols
&&(bs-bsp<=maxcmpoffset)//check for 100 lines depth
&&(bs<srcfilelines.Count)
{
s2=srcfilelines.At(bs);
if(!strcmp(p,s2))
{//line found
bsc=1;
WHILE(bsc<maxcmpstrings)//counting number of matching lines
&&(bdp+bsc<dstfilelines.Count)
&&(bs+bsc<srcfilelines.Count)
&&(!strcmp(dstfilelines.At(bdp+bsc),srcfilelines.At(bs+bsc)))bsc++;
BREAK;
}
if(DSBYTE[s2]==s1)bs=DSDWORD[bs<<2+srcfilelinks];else bs++;
}
bdc=0;
p=srcfilelines.At(bsp);//current src position
s1=DSBYTE[p];
bd=bdp+1;//found dst line, bsc - number of matched
while( bd != -1 )//no next line starting with the same symbols
&&(bd-bdp<=maxcmpoffset)//check for 100 lines depth
&&(bd<dstfilelines.Count)
{
s2=dstfilelines.At(bd);
if(!strcmp(p,s2))
{
bdc=1;
WHILE(bdc<maxcmpstrings)//counting number of matching lines
&&(bsp+bdc<srcfilelines.Count)
&&(bd+bdc<dstfilelines.Count)
&&(!strcmp(srcfilelines.At(bsp+bdc),dstfilelines.At(bd+bdc)))bdc++;
BREAK;
}
if(DSBYTE[s2]==s1)bd=DSDWORD[bd<<2+dstfilelinks];else bd++;
}
if(bsc<bdc)
if(bd-bdp<bdc)
||(bdc>=mincmpstrings)
{
WHILE(bdp<bd){
diffs.Insert(srcfilenums.Count);
srcfilenums.Insert(-1); dstfilenums.Insert(bdp); bdp++;
}
continue;
}
if(strcmp(srcfilelines.At(bsp),dstfilelines.At(bdp)))diffs.Insert(srcfilenums.Count);
//lines are equal
srcfilenums.Insert(bsp); bsp++;
dstfilenums.Insert(bdp); bdp++;
CONTINUE;
}
free(srcfilelinks);
free(dstfilelinks);
if(!diffs.Count)
notify("'Nothing to compare' -E");
else ifinit();
con_exit stdcall (0);
diffs.DeleteAll(); delete diffs;
dstfilenums.DeleteAll(); delete dstfilenums;
srcfilenums.DeleteAll(); delete srcfilenums;
dstfilelines.DeleteAll(); delete dstfilelines;
srcfilelines.DeleteAll(); delete srcfilelines;
free(dstfile);
free(srcfile);
}
-159
View File
@@ -1,159 +0,0 @@
//===================================================//
// //
// LIB //
// //
//===================================================//
#include "../lib/gui.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/patterns/simple_open_dialog.h"
//===================================================//
// //
// DATA //
// //
//===================================================//
//proc_info Form;
#define WIN_W 450
char default_dir[] = "/sys";
od_filter filter2 = {0,0};
char src_path[4096];
char dst_path[4096];
edit_box src_box = {WIN_W-36-DOT_W,18,30,0xffffff,0x94AECE,0xFFFfff,
0xffffff,0x10000000,sizeof(src_path)-2,#src_path,0, ed_focus};
edit_box dst_box = {WIN_W-36-DOT_W,18,85,0xffffff,0x94AECE,0xFFFfff,
0xffffff,0x10000000,sizeof(dst_path)-2,#dst_path,0, 0b};
enum {
BID_EXIT_PRC=1,
BID_SRC_OPEN,
BID_DST_OPEN,
BID_GO
};
#define T_FIRST "First file:"
#define T_SECOND "Second file:"
#define T_GO " Compare "
#define READY 0
int state=READY;
//===================================================//
// //
// CODE //
// //
//===================================================//
void gui()
{
#define NO_DLL_INIT
load_dll(boxlib, #box_lib_init,0);
load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog);
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
loop() switch(@WaitEvent())
{
case evMouse:
if (READY == state) {
edit_box_mouse stdcall (#src_box);
edit_box_mouse stdcall (#dst_box);
}
break;
case evButton:
@GetButtonID();
if (EAX == BID_EXIT_PRC) ExitProcess();
if (EAX == BID_SRC_OPEN) EventOpenDialogFirst();
if (EAX == BID_DST_OPEN) EventOpenDialogSecond();
if (EAX == BID_GO) EventGo();
break;
case evKey:
@GetKey();
edit_box_key stdcall (#src_box);
edit_box_key stdcall (#dst_box);
EAX >>= 16;
if (AL == SCAN_CODE_ESC) ExitProcess();
if (AL == SCAN_CODE_TAB) EventTabClick();
if (AL == SCAN_CODE_ENTER) EventGo();
if (AL == SCAN_CODE_INS) EventInsert();
break;
case evReDraw:
draw_window();
break;
}
}
void draw_window()
{
sc.get();
DefineAndDrawWindow(215, 100, WIN_W+9, 170 + GetSkinHeight(), 0x34, sc.work, #window_title,0);
//GetProcessInfo(#Form, SelfInfo);
if (READY==state) {
DrawFileBox(#src_box, T_FIRST, BID_SRC_OPEN);
DrawFileBox(#dst_box, T_SECOND, BID_DST_OPEN);
DrawCaptButton(dst_box.left - 2, dst_box.top + 40, 120, 25, BID_GO, sc.button, sc.button_text, T_GO);
}
}
void UpdateEditBoxes(dword flag1, flag2)
{
EditBox_UpdateText(#src_box, flag1);
EditBox_UpdateText(#dst_box, flag2);
edit_box_draw stdcall (#src_box);
edit_box_draw stdcall (#dst_box);
}
//===================================================//
// //
// EVENTS //
// //
//===================================================//
void EventGo()
{
char run_param[4096];
wsprintf(#run_param, "\"%s\" \"%s\"", #src_path, #dst_path);
RunProgram(I_Path, #run_param);
}
void EventTabClick()
{
if ( src_box.flags & ed_focus ) {
UpdateEditBoxes(0, ed_focus);
} else {
UpdateEditBoxes(ed_focus, 0);
}
}
void EventOpenDialogFirst()
{
o_dialog.type = 0; //0-file, 1-save, 2-select folder
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#src_path, #openfile_path);
UpdateEditBoxes(ed_focus, 0);
}
}
void EventOpenDialogSecond()
{
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#dst_path, #openfile_path);
UpdateEditBoxes(0, ed_focus);
}
}
void EventInsert()
{
if ( src_box.flags & ed_focus ) EventOpenDialogFirst();
if ( dst_box.flags & ed_focus ) EventOpenDialogSecond();
}
-181
View File
@@ -1,181 +0,0 @@
int verthoriz=0;
int shownums=1;
char str[MAX_PATH];
word attr[MAX_PATH];
printstrat(int x,y,size,_text,_attr)
{
int i;
for (i=0; i<size; i++)
{
con_set_flags stdcall (ESBYTE[i*2+_attr]);
con_set_cursor_pos stdcall (x+i,y);
con_write_string stdcall (_text+i, 1);
}
}
drawline(int x,y,width,linex,s1,s2,ln)
{
int i;
int s1l;
int s2l;
int c1,c2;
char temp[10];
int x2,width2;
s1l=-1;
s2l=-1;
if(s1!=-1)s1l=strlen(s1);
if(s2!=-1)s2l=strlen(s2);
FillMemory(#attr,width*2,0x1F);
str[0]='║'; str[x+width-1]='║';
if(s1==-1)
{
FillMemory(#str[1],width-2,'·');
FillMemory(#attr[2],width-2*2,7);
}else{//строка присутствует
x2=1;
width2=width;
if(shownums)
{
wsprintf(#temp,"%6d",ln+1);
for(i=0;i<6;i++)
{
str[i+1]=temp[i];
attr[i+1]=0x19;
}
str[7]='│';
x2+=7;
width2-=7;
}
if(s1>0)&&(s2>0)&&(!strcmp(s1,s2))
{//строки совпадают
for(i=0;i<width2-2;i++)
if(i+linex<s1l)str[x2+i]=DSBYTE[s1+i+linex];else str[x2+i]=' ';
}else
{
for(i=0;i<width2-2;i++)
{
if(i+linex<s1l)c1=DSBYTE[s1+i+linex]; else c1=' ';
if(i+linex<s2l)c2=DSBYTE[s2+i+linex]; else c2=' ';
str[x2+i]=c1;
if(c1==c2)attr[x2+i]=0x4F;else attr[x2+i]=0x4E;
}
}
}
printstrat(x,y,width,#str,#attr);
}
drawborder(dword x1,y1,xs1,ys1,fname,line)
char temp[MAX_PATH];
int titlelen;
{
int i,j;
FillMemory(#str,xs1,'═');
FillMemory(#attr,xs1*2,0x1F);
str[0]='╚'; str[xs1-1]='╝';
printstrat(x1,y1+ys1-1,xs1,#str,#attr); //нижняя строчка
str[0]='╔'; str[xs1-1]='╗';
titlelen=xs1-4;
if(!shownums)titlelen-=8;
if(strlen(fname)>titlelen)wsprintf(#temp," ...%s ",strlen(fname)+fname-titlelen+3);
else wsprintf(#temp," %s ",fname);
for(i=0;temp[i];i++){ str[i+1]=temp[i]; attr[i+1]=0x1E; }
if(!shownums)
{
wsprintf(#temp,"[%6d]",line);
CopyMemory(xs1-9+#str,#temp,8);
FillMemory(xs1-8*2+#attr,12,0x19);
}
printstrat(x1,y1,xs1,#str,#attr);
}
printpanel(dword line,linex ,x1,y1,xs1,ys1 ,x2,y2,xs2,ys2)
{
int i,j;
int s,d,sl,dl;
int line1,line2;
for(j=line;j<srcfilenums.Count;j++){ s=srcfilenums.At(j); if(s!=-1)BREAK; }
if(s==-1)s=srcfilelines.Count-1;
drawborder(x1,y1,xs1,ys1,srcfilename,s+1);
for(j=line;j<dstfilenums.Count;j++){ d=dstfilenums.At(j); if(d!=-1)BREAK; }
if(d==-1)d=dstfilelines.Count-1;
drawborder(x2,y2,xs2,ys2,dstfilename,d+1);
for(j=0;j<ys1-2;j++)
{
if(j+line<srcfilenums.Count)s=srcfilenums.At(j+line); else s=-1;
line1=s;
if(s!=-1)s=srcfilelines.At(s);
if(j+line<dstfilenums.Count)d=dstfilenums.At(j+line); else d=-1;
line2=d;
if(d!=-1)d=dstfilelines.At(d);
drawline(x1,y1+j+1,xs1,linex,s,d,line1);
drawline(x2,y2+j+1,xs2,linex,d,s,line2);
}
}
ifinit()
int linenum=0;
int linex=0;
int ys;
int sbi_x, sbi_y;
{
load_dll(libConsole, #con_init, 0);
con_init stdcall (122, 40, 122, 800, #window_title);
linenum=diffs.At(0);
sbi_x = 122;
sbi_y = 800;
sbi_y--;
ys=sbi_y-2;
if(linenum+ys>srcfilenums.Count)linenum=srcfilenums.Count-ys;
if(linenum<0) linenum=0;
@redraw:
if(!verthoriz)
{
printpanel(linenum,linex
,0,0
,sbi_x/2 ,sbi_y
,sbi_x/2 ,0
,sbi_x/2 ,sbi_y
);
ys=sbi_y-2;
}
else
{
printpanel(linenum,linex
,0,0
,sbi_x ,sbi_y/2
,0 ,sbi_y/2
,sbi_x ,sbi_y/2
);
if(sbi_y&1)
{
FillMemory(#str,sbi_x,'░');
FillMemory(#attr,sbi_x*2,0);
printstrat(0,sbi_y-1,sbi_x,#str,#attr);
}
ys=sbi_y/2-2;
}
if (!ys) goto redraw;
else {
con_set_cursor_pos stdcall (2,0);
ExitProcess();
}
}
-182
View File
@@ -1,182 +0,0 @@
struct TCollection{
int Count;//itemcunt
int Delta;//increase buffer Delta
int Items;//pointer to array of item pointers
int Limit;//currently allocated size (in elements) of Items list
TCollection( int ALimit,ADelta );
~TCollection( void );
int At( int Index );
void AtDelete( int Index );
void AtFree( int Index );
void AtInsert( int Index, Item );
void DeleteAll( void );
void Free( int Item );
void FreeAll( void );
void FreeItem( int Item );
void Insert( int Item );
void SetLimit( int ALimit );
};
:int TCollection::At( int Index )
{
return DSDWORD[ Index*sizeof(int)+Items ];
}
:void TCollection::AtDelete( int Index )
{
// if(Index<0)||(Index>=Count){/*Error(coIndexError);*/return;}
ECX = Count-Index-1;
EDI = Index*sizeof(int)+Items; ESI = EDI+4; $cld; $rep;$movsd;
Count --;
}
:void TCollection::AtFree( int Index )
{
int Item = At( Index);
AtDelete( Index );
FreeItem( Item );
}
:void TCollection::AtInsert( int Index, Item )
{
$pushfd
IF( Count == Limit )
{
SetLimit( Count+Delta );
}
ECX = Count-Index;
EDI = Count*sizeof(int)+Items;
ESI = EDI-4; $std $rep $movsd $cld
DSDWORD[ EDI ] = Item;
Count ++;
$popfd
}
:void TCollection::DeleteAll()
{
Count=0;
}
:void TCollection::Free( int Item )
{
Delete( Item );
FreeItem( Item );
}
:void TCollection::FreeAll( void )
{
int I;
FOR( I = 0; I < Count; I ++ )FreeItem( At(I) );
Count = 0;
}
:void TCollection::FreeItem( int Item )
{
IF( Item )free( Item );//+++Dispose(PObject(Item), Done);
}
:void TCollection::Insert( int Item )
{
AtInsert( Count, Item );
}
:void TCollection::SetLimit( int ALimit )
{
int AItems;
IF( ALimit < Count )ALimit = Count;
IF( ALimit != Limit )
{
IF( !ALimit ) AItems = 0;
ELSE
{
AItems = malloc(ALimit*sizeof(int) );
IF( Count )&&( Items )
{
CopyMemory( AItems, Items, Limit*sizeof(int) );
}
}
IF( Limit )free( Items );
Items = AItems;
Limit = ALimit;
}
}
:TCollection::TCollection( int ALimit, ADelta )
{
Items = 0;
Count = 0;
Limit = 0;
Delta = ADelta;
SetLimit( ALimit );
return this;
}
:TCollection::~TCollection( void )
{
FreeAll();
SetLimit(0);
}
struct TSortedCollection:TCollection
{
int comparemethod;
int Duplicates;
TSortedCollection( int ALimit, ADelta );
int Compare( int Key1, Key2 );
void Insert( int Item );
int Search( int Key, Index );
};
:int TSortedCollection::Compare( int Key1, Key2 )
{
strcmp( Key1, Key2 );
}
:TSortedCollection::TSortedCollection( int ALimit, ADelta )
:TCollection( ALimit, ADelta );
{
comparemethod=#Compare;
return this;
}
:void TSortedCollection::Insert( int Item )
{
int i;
IF( !Search(/*KeyOf(*/Item/*)*/,#i) ) || ( Duplicates )AtInsert( i, Item );
}
:int TSortedCollection::Search( int Key, Index )
{
int L, H, I, C;
int S;
S = 0;
L = 0;
H = Count-1;
WHILE( L <= H )
{
I = L+H >> 1;
ECX = I*sizeof(int)+Items;
comparemethod( this, /*KeyOf(*/DSDWORD[ECX]/*)*/, Key );
C = EAX;
IF( C < 0 ){ L = I+1; }
ELSE
{
H = I-1;
IF( !C ){
S = 1;
IF( !Duplicates )L = I;
}
}
}
DSDWORD[ Index ]=L;
return S;
}
-6
View File
@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("dl.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "dl.com")
-6
View File
@@ -1,6 +0,0 @@
@c-- /D=LANG_ENG dl.c
@del dl
@rename dl.com dl
@del warning.txt
if not exist dl ( @pause )
-6
View File
@@ -1,6 +0,0 @@
@c-- /D=LANG_RUS dl.c
@del dl
@rename dl.com dl
@del warning.txt
if not exist dl ( @pause )
Loaded 100 of 337 files, more files were not shown because too many files have changed in this diff. Show more