Fix EN typos

- Corrections for en_US language.
- Some whitespace sanitation.

git-svn-id: svn://kolibrios.org@10064 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Andrew 2024-05-29 21:37:05 +00:00
parent bb2607b7d8
commit a53bea545e
10 changed files with 1311 additions and 1313 deletions

View File

@ -34,8 +34,8 @@ INFTY equ 1000000000
moveorder dd 1,7,2,6,3,5,4
; table used for static evaluation.
; this table is taken from 4st attack: it is ways better
; than the table i used before =)
; this table is taken from 4st attack: it is much better
; than the table I used before =)
evaltable: dd 0, 0, 0, 0, 0, 0, 0, 0, 0
dd 0, 3, 4, 5, 7, 5, 4, 3, 0
dd 0, 4, 6, 8,10, 8, 6, 4, 0
@ -74,14 +74,14 @@ aiGetMove:
mov [cpulevel],eax
mov dword [bestval],-INFTY
mov dword [nbestmoves],0
; try every move
mov ecx,6
.evalmoves:
; get move to make from move order table
mov eax,[moveorder+ecx*4]
; if this is an invalid move, continue with next move
BOARDISVALIDMOVE eax
jz .nextmove
@ -89,7 +89,7 @@ aiGetMove:
; make move for current player
mov ebx,[currentplayer]
call boardMakeMove
; evaluate move
push eax ; save move #
push ecx ; save loop counter
@ -100,14 +100,14 @@ aiGetMove:
push dword -INFTY ; alpha
push dword INFTY ; beta
call alphabeta
neg eax ; damn, how could i forget this ???
neg eax ; How could I forget this ???
mov ebx,eax ; save result for later
pop ecx ; restore loop counter
pop eax ; restore move #
; undo move (eax = move #)
call boardUndoMove
; let's see wether we have a new best move
cmp ebx,[bestval] ; new best value found ?
jle .nonewbestval
@ -127,7 +127,7 @@ aiGetMove:
js .done
jmp .evalmoves
.done:
; randomly pick one of the best moves
call rand ; rand() % nbestmoves
xor edx,edx
@ -156,7 +156,7 @@ alphabeta:
%define beta (ebp+ 8)
enter 0,0
; win for other player -> end search
mov eax,[player]
BOARDGETOTHERPLAYER eax
@ -180,7 +180,7 @@ alphabeta:
; max search depth reached -> do static evaluation
cmp dword [ply],0
je .staticeval
; for each move
mov ecx,6
@ -193,15 +193,15 @@ alphabeta:
; pick move from move order table
mov eax,[moveorder+ecx*4]
; invalid move ? if so, continue with next move
BOARDISVALIDMOVE eax
jz .nextmove
; make move for current player
mov ebx,[player]
call boardMakeMove
; evaluate move
push eax
push ecx
@ -219,27 +219,27 @@ alphabeta:
push edx
call alphabeta
neg eax
; new alpha ?
cmp eax,[alpha]
jle .nonewalpha
mov [alpha],eax ; yes -> save it
.nonewalpha:
.nonewalpha:
pop ecx
pop eax
; undo move
call boardUndoMove
.nextmove: ; evaluate next move
dec ecx
jns .evalmoves
.done:
mov eax,[alpha]
leave
ret 4*4
; static evaluation
.staticeval:
xor eax,eax
@ -255,7 +255,7 @@ alphabeta:
je .empty ; nope -> go on
sub eax,[evaltable+esi*4] ; yes -> sub stone value from eax
.empty:
.next: ; next stone
dec esi
jns .l
@ -267,4 +267,4 @@ alphabeta:
%undef alpha
%undef beta
%endif
%endif

View File

@ -1,251 +1,251 @@
; level format
; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2]
; internal format
; [stepptr]= worms #
; area: [worm_len][start_cell #][end_cell #]..[dirs]..
; [cur_step]: dragged worm pointer
; [finish]: 0 - if head dragged, 1- if tail
WG_levelp:
mcall 40,100111b
inc [drag_flag]
call get_xy_sf
sub esi,2
call LP_levelp.bit2
cmp edx,4
jne .ok
dec esi
.ok:
movzx ecx,byte[esi]
mov [stepptr],ecx
inc esi
xor eax,eax
mov edi,area
.lp1:
push ecx
movzx ecx,byte[esi]
inc esi
mov [edi],cl
inc edi
lodsb
dec ecx
movzx ebx,al
stosb
push edi
inc edi
mov edx,8/2
lodsb
.lp:
rol al,2
push ecx
mov cl,al
and ecx,11b
add ebx,[dirs+ecx*4]
mov [edi],cl
pop ecx
inc edi
dec edx
test edx,edx
jnz .nxt
mov edx,8/2
lodsb
.nxt:
loop .lp
cmp edx,4
jne .ok2
dec esi
.ok2:
pop ecx
mov [ecx],bl
pop ecx
loop .lp1
mov esi,[stepptr]
ret
WG_key:
cmp eax,0
jl WG_mouse
ret
WG_drawm:
mov [win_flag],1
mov ecx,[cell_count]
; mov [sq_size],3
.lp:
push ecx
movzx ebx,byte[field+ecx-1]
and byte[field+ecx-1],11000000b
shr ebx,6
test ebx,ebx
jz .no
dec ebx
lea eax,[ecx-1]
call get_xy
add [lx],5-2 shl 16
add [ly],5-2 shl 16
mov edx,[f_colors+ebx*4]
mcall 13,[lx],[ly]
.no:
pop ecx
loop .lp
add [sq_size],3
mov ecx,[stepptr]
xor eax,eax
mov esi,area
push ebp
mov edi,w_colors
mov dword[player],1
.lp2:
push ecx
movzx ecx,byte[esi]
inc esi
xor eax,eax
lodsb
mov ebp,esi
.lp1:
inc esi
push ecx eax
call get_xy
mcall 13,[lx],[ly],[edi]
pop eax
mov ecx,[player]
mov bl,[field+eax]
shr bl,6
add [field+eax],cl
cmp bl,cl
je .match
and [win_flag],0
.match:
pop ecx
push esi edi
movzx ebx,byte[esi]
mov esi,eax
mov [ebp],al
add eax,[dirs+ebx*4]
cmp ecx,1
je .skip
mov edi,eax
call getline
call bold_line
.skip:
pop edi esi
loop .lp1
pop ecx
add edi,4
inc dword[player]
loop .lp2
pop ebp
sub [sq_size],3
ret
WG_mouse:
cmp [win_flag],1
je .ex
mov [jump],still
mov edx,eax
call get_last_mclick
cmp edx,-2
jne .no1st
test eax,eax
jz .ex
.noempty:
; First Click at ebx cell
; dpd ebx
mov [cur_step],0
mov dword[finish],0
mov esi,area
mov ecx,[stepptr]
.fndlp:
movzx edx,byte[esi]
cmp bl,[esi+1]
je .fnd
cmp bl,[esi+2]
jne .nxt
inc dword[finish]
.fnd:
mov [cur_step],esi
mov [jump],drw;red
jmp .ex
.nxt:
lea esi,[esi+edx+2]
loop .fndlp
jmp .ex
.no1st:
test eax,eax
jz .ex
; While dragging
mov esi,[cur_step]
test esi,esi
jz .ex
lea edi,[esi+1]
add edi,[finish]
movzx eax,byte[edi]
cmp eax,ebx
je .ex
push ebx
cmp dword[finish],0
jne .noswap
xchg eax,ebx
.noswap:
call get_offset
cmp ebx,1
pop ebx
jne .ex
cmp eax,-1
je .ex
test byte[field+ebx],11b
jnz .ex
movzx ecx,byte[esi]
cmp dword[finish],0
jne .tail
mov [esi+1],bl
mov [esi+2],al
add esi,ecx
std
lea edi,[esi+1]
rep movsb
jmp .redex
.tail:
mov [esi+2],bl
movzx ebx,byte[esi+3]
movzx edx,byte[esi+1]
add edx,[dirs+ebx*4]
mov [esi+1],dl
add esi,3
lea edi,[esi-1]
rep movsb
mov [edi-1],al
; ud2
.redex:
cld
mov [jump],drw;red
mov esi,area
.ex:
ret
WG_level:
file 'wriggle.bin'
if lang eq ru
WG_help mstr \
'‚ è  § ¤ ç  - âï­ãâì ç¥à¢ïª®¢ §  £®«®¢ã ¨«¨',\
'墮áâ, ¯®ª  ª ¦¤ë© ¨§ ­¨å ­¥ ¯®ªà®¥â ª«¥âª¨',\
'᢮¥£® 梥â , ®áâ ¢¨¢ ­¥§ ªàëâ묨 ¡¥«ë¥ ª¢ ¤à âë.',\
'—¥à¢ïª¨ ­¥ ¬®£ãâ ¯¥à¥ªà뢠âì ¨ ¯¥à¥á¥ª âì ¤àã£',\
'¤à㣠.','',\
'http://www.clickmazes.com'
else
WG_help mstr \
'Your aim is to drag the wriggley worms by head or',\
'tail until each worm covers the squares of its',\
'own colour leaving only white squares exposed.',\
'Worms cannot cross or overlap.','',\
'http://www.clickmazes.com'
end if
; level format
; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2]
; internal format
; [stepptr]= worms #
; area: [worm_len][start_cell #][end_cell #]..[dirs]..
; [cur_step]: dragged worm pointer
; [finish]: 0 - if head dragged, 1- if tail
WG_levelp:
mcall 40,100111b
inc [drag_flag]
call get_xy_sf
sub esi,2
call LP_levelp.bit2
cmp edx,4
jne .ok
dec esi
.ok:
movzx ecx,byte[esi]
mov [stepptr],ecx
inc esi
xor eax,eax
mov edi,area
.lp1:
push ecx
movzx ecx,byte[esi]
inc esi
mov [edi],cl
inc edi
lodsb
dec ecx
movzx ebx,al
stosb
push edi
inc edi
mov edx,8/2
lodsb
.lp:
rol al,2
push ecx
mov cl,al
and ecx,11b
add ebx,[dirs+ecx*4]
mov [edi],cl
pop ecx
inc edi
dec edx
test edx,edx
jnz .nxt
mov edx,8/2
lodsb
.nxt:
loop .lp
cmp edx,4
jne .ok2
dec esi
.ok2:
pop ecx
mov [ecx],bl
pop ecx
loop .lp1
mov esi,[stepptr]
ret
WG_key:
cmp eax,0
jl WG_mouse
ret
WG_drawm:
mov [win_flag],1
mov ecx,[cell_count]
; mov [sq_size],3
.lp:
push ecx
movzx ebx,byte[field+ecx-1]
and byte[field+ecx-1],11000000b
shr ebx,6
test ebx,ebx
jz .no
dec ebx
lea eax,[ecx-1]
call get_xy
add [lx],5-2 shl 16
add [ly],5-2 shl 16
mov edx,[f_colors+ebx*4]
mcall 13,[lx],[ly]
.no:
pop ecx
loop .lp
add [sq_size],3
mov ecx,[stepptr]
xor eax,eax
mov esi,area
push ebp
mov edi,w_colors
mov dword[player],1
.lp2:
push ecx
movzx ecx,byte[esi]
inc esi
xor eax,eax
lodsb
mov ebp,esi
.lp1:
inc esi
push ecx eax
call get_xy
mcall 13,[lx],[ly],[edi]
pop eax
mov ecx,[player]
mov bl,[field+eax]
shr bl,6
add [field+eax],cl
cmp bl,cl
je .match
and [win_flag],0
.match:
pop ecx
push esi edi
movzx ebx,byte[esi]
mov esi,eax
mov [ebp],al
add eax,[dirs+ebx*4]
cmp ecx,1
je .skip
mov edi,eax
call getline
call bold_line
.skip:
pop edi esi
loop .lp1
pop ecx
add edi,4
inc dword[player]
loop .lp2
pop ebp
sub [sq_size],3
ret
WG_mouse:
cmp [win_flag],1
je .ex
mov [jump],still
mov edx,eax
call get_last_mclick
cmp edx,-2
jne .no1st
test eax,eax
jz .ex
.noempty:
; First Click at ebx cell
; dpd ebx
mov [cur_step],0
mov dword[finish],0
mov esi,area
mov ecx,[stepptr]
.fndlp:
movzx edx,byte[esi]
cmp bl,[esi+1]
je .fnd
cmp bl,[esi+2]
jne .nxt
inc dword[finish]
.fnd:
mov [cur_step],esi
mov [jump],drw;red
jmp .ex
.nxt:
lea esi,[esi+edx+2]
loop .fndlp
jmp .ex
.no1st:
test eax,eax
jz .ex
; While dragging
mov esi,[cur_step]
test esi,esi
jz .ex
lea edi,[esi+1]
add edi,[finish]
movzx eax,byte[edi]
cmp eax,ebx
je .ex
push ebx
cmp dword[finish],0
jne .noswap
xchg eax,ebx
.noswap:
call get_offset
cmp ebx,1
pop ebx
jne .ex
cmp eax,-1
je .ex
test byte[field+ebx],11b
jnz .ex
movzx ecx,byte[esi]
cmp dword[finish],0
jne .tail
mov [esi+1],bl
mov [esi+2],al
add esi,ecx
std
lea edi,[esi+1]
rep movsb
jmp .redex
.tail:
mov [esi+2],bl
movzx ebx,byte[esi+3]
movzx edx,byte[esi+1]
add edx,[dirs+ebx*4]
mov [esi+1],dl
add esi,3
lea edi,[esi-1]
rep movsb
mov [edi-1],al
; ud2
.redex:
cld
mov [jump],drw;red
mov esi,area
.ex:
ret
WG_level:
file 'wriggle.bin'
if lang eq ru
WG_help mstr \
'‚ è  § ¤ ç  - âï­ãâì ç¥à¢ïª®¢ §  £®«®¢ã ¨«¨',\
'墮áâ, ¯®ª  ª ¦¤ë© ¨§ ­¨å ­¥ ¯®ªà®¥â ª«¥âª¨',\
'᢮¥£® 梥â , ®áâ ¢¨¢ ­¥§ ªàëâ묨 ¡¥«ë¥ ª¢ ¤à âë.',\
'—¥à¢ïª¨ ­¥ ¬®£ãâ ¯¥à¥ªà뢠âì ¨ ¯¥à¥á¥ª âì ¤àã£',\
'¤à㣠.','',\
'http://www.clickmazes.com'
else
WG_help mstr \
'Your aim is to drag the wriggley worms by head or',\
'tail until each worm covers the squares of its',\
'own color leaving only white squares exposed.',\
'Worms cannot cross or overlap.','',\
'http://www.clickmazes.com'
end if

View File

@ -23,7 +23,7 @@ struct List{
List_Node *foundation_head;//points first foundation list
List_Node *board_head;//points first board list
FILE *fptr;
void create();// Includes create toplist, boardlists and foundlists
void create_toplist();
void create_boardlists();
@ -97,7 +97,7 @@ int main()
if(!islem.top_head)// checking top list empty or not
islem.istopempty = true;
List_Node *traverse;
traverse = islem.board_head;
int counter = 0;
@ -121,7 +121,7 @@ int main()
break;
}
}
return 0;
}
@ -156,21 +156,21 @@ void List::create_toplist(){
fscanf(fptr, " %c %s %s ", &tempsuit, tempvalue, tempisup);
newnode->suit = tempsuit;
/*Changing type of value char array to integer*/
if(tempvalue[0] == 'A') newnode->value = 1;
else if(tempvalue[0] == 'J')newnode->value = 11;
else if(tempvalue[0] == 'Q')newnode->value = 12;
else if(tempvalue[0] == 'K')newnode->value = 13;
else
else
sscanf(tempvalue, "%d", &newnode->value);
/*Changing type of isup char array to boolean*/
if(strcmp(tempisup, "Up") == 0)
newnode->isup = true;
if(strcmp(tempisup, "Down") == 0)
newnode->isup = false;
if(top_head == NULL){//add first node to empty top list
top_head = newnode;
final = top_head;
@ -188,7 +188,7 @@ void List::create_boardlists(){
char tempcolor, tempsuit, tempvalue[4], tempisup[8], garbage[10];
int index = 1;// This index represents nth board list
newboardlist = new List_Node;// creating first boardlist node
board_head = newboardlist;
boardlist_final = newboardlist;
@ -219,7 +219,7 @@ void List::create_boardlists(){
else if(tempvalue[0] == 'J')newnode->value = 11;
else if(tempvalue[0] == 'Q')newnode->value = 12;
else if(tempvalue[0] == 'K')newnode->value = 13;
else
else
sscanf(tempvalue, "%d", &newnode->value);
if(strcmp(tempisup, "Up") == 0)
@ -281,7 +281,7 @@ void List::printkart(Card_Node *kart){//prints datas of kart node
void List::printlists(){
clear_screen();
Card_Node *ct[7];// Board List Card Node Traverser; ct[0] for 1.list, ct[1] for 2.list ....
Card_Node *foundct[4];//Found List Card Node Traverser, foundct[0] = Spades, foundct[1] = Hearts, foundct[2] = Diamonds, foundct[3] = Clubs
Card_Node *foundct[4];//Found List Card Node Traverser, foundct[0] = Spades, foundct[1] = Hearts, foundct[2] = Diamonds, foundct[3] = Clubs
Card_Node *topct;// TopList Card Traverser
List_Node *listtraverse;// List Node Traverser
@ -306,7 +306,7 @@ void List::printlists(){
}
/*Printing Board List's Cards*/
for(int i = 0; i < 19; i++){//this for loop traverses lists and goes 19 times down, a list can include cards up to 19 (6 down cards + 13 up cards)
for(int i = 0; i < 19; i++){//this for loop traverses lists and goes 19 times down, a list can include cards up to 19 (6 down cards + 13 up cards)
for(int j = 0; j < 7; j++)
{
if(ct[j]){// if ct[j] is not null, print it and go to next node
@ -317,7 +317,7 @@ void List::printlists(){
else// if ct[j] is null, print a tab
printf("\t");
}
if(ct[0] || ct[1] || ct[2] || ct[3] || ct[4] || ct[5] || ct[6])// After printing a line;
if(ct[0] || ct[1] || ct[2] || ct[3] || ct[4] || ct[5] || ct[6])// After printing a line;
printf("\n");//if at least one card is not null: go new line
else
break;// if all cards in line are null: break outer for loop
@ -343,7 +343,7 @@ void List::printlists(){
else// if foundct[j] is null, print a tab
printf("\t");
}
if(foundct[0] || foundct[1] || foundct[2] || foundct[3])// After printing a line;
if(foundct[0] || foundct[1] || foundct[2] || foundct[3])// After printing a line;
printf("\n");//if at least one card is not null: go new line
else
break;// if all cards in line are null: break outer for loop
@ -458,7 +458,7 @@ void List::goster_TopToFoundation(){// wants input from use
else if(tempvalue[0] == 'J')Symbol_of_numbers = 11;
else if(tempvalue[0] == 'Q')Symbol_of_numbers = 12;
else if(tempvalue[0] == 'K')Symbol_of_numbers = 13;
else
else
sscanf(tempvalue, "%d", &Symbol_of_numbers);
TopToFoundation(Symbol_of_colors, Symbol_of_suits, Symbol_of_numbers);
@ -472,7 +472,7 @@ void List::TopToFoundation(char s_color, char s_suit, int s_value){
cout << "Top list is empty, you cannot make this move." << endl;
return;
}
cardtraverse = top_head;
cardtail = top_head;
@ -527,7 +527,7 @@ void List::goster_TopToBoard(){// wants input from user for moving card top list
else if(tempvalue[0] == 'J')Symbol_of_numbers = 11;
else if(tempvalue[0] == 'Q')Symbol_of_numbers = 12;
else if(tempvalue[0] == 'K')Symbol_of_numbers = 13;
else
else
sscanf(tempvalue, "%d", &Symbol_of_numbers);
cout << "Select the number of the destination Board List:";
@ -544,7 +544,7 @@ void List::TopToBoard(int listindex, char s_color, char s_suit, int s_value){
cout << "Top list is empty, you cannot make this move." << endl;
return;
}
cardtraverse = top_head;
cardtail = top_head;
@ -600,7 +600,7 @@ void List::goster_BoardToBoard(){
else if(tempvalue[0] == 'J')Symbol_of_numbers = 11;
else if(tempvalue[0] == 'Q')Symbol_of_numbers = 12;
else if(tempvalue[0] == 'K')Symbol_of_numbers = 13;
else
else
sscanf(tempvalue, "%d", &Symbol_of_numbers);
BoardToBoard(source, destination, Symbol_of_colors, Symbol_of_suits, Symbol_of_numbers);
}
@ -614,10 +614,10 @@ void List::BoardToBoard(int fromwhere, int towhere, char s_color, char s_suit, i
temp_head = sourcelisttraverse->cards;
cardtraverse = temp_head;
cardtail = temp_head;
while(cardtraverse){
if(cardtraverse->isup)// Dont move cards if the entered card is down
if(cardtraverse->isup)// Don't move cards if the entered card is down
if(cardtraverse->color == s_color && cardtraverse->suit == s_suit && cardtraverse->value == s_value){
willbemoved = cardtraverse;
break;
@ -651,7 +651,7 @@ void List::BoardToBoard(int fromwhere, int towhere, char s_color, char s_suit, i
cardtail->next = willbemoved;
cout << "Wrong Movement!" << endl;
}
}
void List::goster_BoardToFoundation(){
@ -754,7 +754,6 @@ void List::close(){//Deletes all linked lists and linkedlists's all nodes
foundation_head = foundation_head->next;
delete listtraverse;
}
fclose(fptr);//Closing reading txt file
}

View File

@ -1,7 +1,7 @@
;; Calculator for MenuetOS (c) Ville Turjanmaa
;;
;;
;; Compile with FASM
;;
;;
;; Pavel Rymovski (Heavyiron) - version for KolibriOS
;;
;; What's new:
@ -12,7 +12,7 @@
;; Calc 1.2
;; 1) added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2
;; Calc 1.31
;; 1) optimised program
;; 1) optimized program
;; 2) new type of window (you need kernel 114 revision or higher)
;; Calc 1.32
;; 1) fixed arccos
@ -44,13 +44,13 @@ butid: db 12, 13, 14, 19, 20, 21, 26, 27, 28, 34, 15, 39, 39, 22, 36, 29, 35, 3
START:
red:
call draw_window
still:
still:
mcall 10
dec eax
jz red
dec eax
jz key
dec eax
jz key
button:
mcall 17 ; get button id
@ -76,7 +76,7 @@ testbut:
cmp eax, 1 ; button 1 -- exit
jne noexit
mcall -1
noexit:
cmp eax, 2
jne no_reset
@ -206,7 +206,7 @@ no_int:
fdiv [trans1]
jmp show_result
no_1x:
no_1x:
cmp eax, 24
jne no_cos
fld [trans1]
@ -226,14 +226,14 @@ no_cos:
fpatan
jmp show_result
no_acos:
no_acos:
cmp eax, 30
jne no_x2
fld [trans1]
fmul st, st0
jmp show_result
no_x2:
no_x2:
cmp eax, 31
jne no_tan
fld [trans1]
@ -279,7 +279,7 @@ no_add:
mov [calc], '-'
call print_display
jmp still
no_sub:
cmp eax, 29
jne no_div
@ -450,7 +450,7 @@ new_entry:
ret
ftoa: ; fpu st0 -> [integer],[decimal]
ftoa: ; fpu st0 -> [integer],[decimal]
pusha
fst [tmp2]
fstcw [controlWord] ; set truncate integer mode
@ -559,7 +559,7 @@ atof:
.error:
mov bh, 1 ; Set error code.
; fstp st0 ; Pop top of fpu stack.
; fstp st0 ; Pop top of fpu stack.
.exit:
pop di
@ -661,12 +661,12 @@ draw_window:
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
mov ecx, 200 shl 16 + 210
add ecx, eax ; add skin height to window height
add ecx, eax ; add skin height to window height
mov edx, [sc.work]
or edx, 0x34000000
mov edi, title
mcall 0, <250, 317>
mov eax, SF_DEFINE_BUTTON
mov ebx, 19 shl 16 + 36
mov ecx, 55 shl 16 + 22
@ -719,7 +719,7 @@ next_button:
DrawRectangle DISPLAY_X,DISPLAY_Y,DISPLAY_W,DISPLAY_H, [sc.work_graph]
mcall 38, < DISPLAY_X+1, DISPLAY_W+DISPLAY_X-1>, <DISPLAY_Y+1, DISPLAY_Y+1>, 0xE0E0E0 ; internal shadow
mcall , < DISPLAY_X+1, DISPLAY_X+1>, <DISPLAY_Y+2, DISPLAY_Y+DISPLAY_H-1>, ; internal shadow
call print_display
mcall 12, 2
@ -729,11 +729,11 @@ print_display:
pusha
mcall 13, < DISPLAY_X+2, DISPLAY_W-2>, <DISPLAY_Y+2, DISPLAY_H-2>, 0xFFFfff ; background
mcall 8, <236,53>, <DISPLAY_Y,DISPLAY_H>, 3, [sc.work] ; 'dec-bin-hex'
mov ecx, [sc.work_text]
or ecx, 0x40000000
mcall 4, <135,6>,,calc,1,[sc.work]
mov edx, [display_type]
shl edx, 2
add edx, display_type_text
@ -746,7 +746,7 @@ print_display:
je positive
mcall , <23, 26>, 0, dsign, 1
positive:
positive:
cmp [display_type], 0
jne no_display_decimal
cmp [decimal], 0

View File

@ -24,8 +24,8 @@ _ipc_send:
xchg edx, esi
.send_again:
mov eax, 5
mov ebx, SEND_DELAY
int 0x40
mov ebx, SEND_DELAY
int 0x40
mov eax, 60
mov ebx, 2
@ -65,7 +65,7 @@ _ipc_recv:
push ecx
mov dword [esi + 4], 0 ; unlock buffer
mov dword [esi + 8], 0 ;
mov dword [esi + 8], 0 ;
push edx
mov eax, 60 ; register buffer
@ -89,7 +89,7 @@ _ipc_recv:
cmp eax, 7
jnz .err
mov eax, [clipboard_init.clipserv_pid] ; not message from
mov eax, [clipboard_init.clipserv_pid] ; not message from
cmp eax, [esi + 4] ; daemon, so ignore
jnz .wait
@ -136,13 +136,13 @@ clipboard_init:
; mov [.IPC_buffer], ecx
push ebp
mov ebp, 1
mov ebp, 1
.next_process:
mov eax, 9
mov ebx, .process_info
mov ecx, ebp
int 0x40
mov ecx, eax
mov ecx, eax
mov ebx, .process_info + 10
mov eax, [ebx]
cmp eax, '@CLI'
@ -153,19 +153,19 @@ clipboard_init:
jmp .similar
; mov edx, .clipserv_name
;.compare:
;.compare:
; mov al, [edx]
; cmp al, 0
; jz .similar
; cmp al, [ebx]
; jnz .differ
; inc edx
; jnz .differ
; inc edx
; inc ebx
; jmp .compare
.differ:
inc ebp
cmp ebp, ecx
jae .err ; process not found
jae .err ; process not found
jmp .next_process
.similar:
;print "found server"
@ -185,7 +185,7 @@ clipboard_init:
ret
.clipserv_pid dd 0
.process_info db 1024 dup(0)
;;.clipserv_name db '@clip',0
;;.clipserv_name db '@clip',0
;.IPC_buffer dd .IPC_real_buffer ; sorry
;.IPC_real_buffer db IPC_buffer_size dup(0)
@ -231,7 +231,7 @@ print "write failed"
pop edi
pop edx
pop ecx
ret
ret
.msg_set_size dw 1
dw 1
@ -240,8 +240,8 @@ print "write failed"
clipboard_read:
; esi -> CLIP_buffer, ax = format id
; edx - ¬ áª  ᮡë⨩ ¯® 㬮«ç ­¨î
; result: eax = 1 - success, 0 - general failure,
; edx - маска событий по умолчанию
; result: eax = 1 - success, 0 - general failure,
; -1 - buffer too small
; edx = size of data
@ -262,7 +262,7 @@ clipboard_read:
mov [.msg_get_buf + 2], ax
mov edx, 8
call _ipc_send
or eax, eax
or eax, eax
jz .err
;;mov edx, DEFAULT_MASK
@ -291,7 +291,7 @@ pregs
or eax, eax
jz .err
;print "send fuck"
;print "send DEBUG!"
mov edx, ebp
mov esi, edi
@ -304,8 +304,7 @@ print "read get data"
mov edx, ebx
mov eax, 1
print "read ok"
jmp .exit ; i'm an idiot. Never will I code at night again
; i put jz instead of jmp.
jmp .exit.
.size:
print "buffer small"
@ -347,7 +346,7 @@ clipboard_delete:
mov [esi + 2], ax
mov edx, 8
call _ipc_send
call _ipc_send
pop esi
pop edx
@ -356,4 +355,3 @@ clipboard_delete:
.msg_del dw 0
dw 1
dd 0

View File

@ -115,7 +115,7 @@ no_lit:
button_4:
cmp ah,4 ; was it button 4 - LOAD
jne button_5 ; no then try button 5
mov byte [editstate],0 ; dont want to be in edit mode
mov byte [editstate],0 ; don't want to be in edit mode
call draw_filename ; update filename
call load_file ; load the file
call draw_icon ; update icon screen
@ -124,16 +124,16 @@ no_lit:
button_5:
cmp ah,5 ; was it button 5 - SAVE
jne button_6 ; no then try button 6
mov byte [editstate],0 ; dont want to be in edit mode
mov byte [editstate],0 ; don't want to be in edit mode
call draw_filename ; update filename
call save_file ; save the file
jmp check_mouse ; start loop again
button_6:
cmp ah,6 ; was it button 6 - CLEAR ICON
jne button_7 ; no then try button 7
mov byte [editstate],0 ; dont want to be in edit mode
mov byte [editstate],0 ; don't want to be in edit mode
call draw_filename ; update filename
call clear_graph_icon ; clear the icon and edit screens
call clear_graph_icon ; clear the icon and edit screens
jmp check_mouse
button_7:
@ -179,7 +179,7 @@ draw_window:
mov edx,0x14ffffff ; color of work area 0x00RRGGBB
mov edi,title ; WINDOW LABEL
mcall
mov eax,13 ; function 13 : draw bar
mov ebx,5*65536+window_x_size-9 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-20)*65536+16 ; [y start] *65536 + [y size]
@ -400,7 +400,7 @@ next_b_w_inner:
jne next_b_w_outer
cmp [first_run],0 ; is it the first window draw
jne dont_load ; no then dont reload the file
jne dont_load ; no then don't reload the file
call load_file ; load initial file
mov [first_run],1 ; first window draw done
dont_load:

View File

@ -851,7 +851,7 @@ draw_window:
mov edi,title ; WINDOW LABEL
mcall
mov eax,8 ; START/STOP - id 2
mov ebx,24*65536+77
mov ecx,80*65536+16
@ -977,7 +977,7 @@ text:
db ' '
db ' '
db ' START/STOP << >> REPEAT:OFF '
db 'x <- END MARKER, DONT DELETE '
db 'x <- END MARKER, DON'T DELETE '
now_playing:
db ' '
db 'xx '

View File

@ -355,14 +355,14 @@ void draw_grid()
// column headers + vertical lines
cell_x[0] = 0;
x = cell_w[0];
x = cell_w[0];
nx = 1;
for (i = 1; i < col_count && x-x0 < grid.w; i++)
{
cell_x[i] = -1;
if (i >= grid.firstx)
{
{
{
//if (!sel_moved || (is_x_changed(i))) {
if (is_between(i,sel_x,sel_end_x)) bg_color = HEADER_CELL_COLOR_ACTIVE; else bg_color = HEADER_CELL_COLOR;
kos_DrawBar(x-x0, 0, 1, grid.h, GRID_COLOR);
@ -404,7 +404,7 @@ void draw_grid()
y += cell_h[i];
ny++;
}
// cells itself
y = cell_h[0];
for (i = grid.firsty; i < ny; i++)
@ -449,7 +449,7 @@ void draw_grid()
else if (error) kos_DrawRegion(x+1, y+1, cell_w[j]-1, cell_h[i]-1, 0xff0000, 0);
}
x += cell_w[j];
}
}
y += cell_h[i];
}
DrawScrolls();
@ -464,7 +464,7 @@ void draw_size_grid()
{
int x, x0, i;
x = cell_w[0];
x = cell_w[0];
x0 = 0;
for (i = 1; i < col_count && x - x0 + cell_w[i] < grid.w - 10; i++)
{
@ -483,7 +483,7 @@ void draw_size_grid()
{
int y, y0, i;
y = cell_h[0];
y = cell_h[0];
y0 = 0;
for (i = 1; i < col_count && y - y0 + cell_h[i] < grid.h - 10; i++)
{
@ -516,7 +516,7 @@ void draw_drag()
DWORD x0 = cell_x[k0] - 1;
DWORD x1 = cell_x[k1] + cell_w[k1] + 1;
DWORD y0 = cell_y[n0] - 1;
DWORD y0 = cell_y[n0] - 1;
DWORD y1 = cell_y[n1] + cell_h[n1] + 1;
if (x0 > grid.w - 1) x0 = grid.w - 1;
if (x1 > grid.w - 1) x1 = grid.w - 1;
@ -536,7 +536,7 @@ void draw_window()
{
kos_WindowRedrawStatus(1);
kos_DefineAndDrawWindow(110,40,WND_W,WND_H,0x73,0x40FFFFFF,0,0,(Dword)"Table v" TABLE_VERSION);
kos_WindowRedrawStatus(2);
kos_WindowRedrawStatus(2);
kos_GetSystemColors(&sc);
@ -560,8 +560,8 @@ void draw_window()
int panel_y = cHeight - MENU_PANEL_HEIGHT + 1;
kos_DrawBar(0, panel_y, cWidth, MENU_PANEL_HEIGHT-1, sc.work);
kos_WriteTextToWindow(3 + 1, panel_y + 14, 0x90, sc.work_text, (char*)sFilename, 0);
kos_WriteTextToWindow(3 + 1, panel_y + 14, 0x90, sc.work_text, (char*)sFilename, 0);
file_box.top = panel_y + 10;
file_box.width = cWidth - 265;
int BTX = cWidth - 190;
@ -589,7 +589,7 @@ void process_mouse()
Dword mouse_btn, ckeys, shift, ctrl;
int vert, hor;
kos_GetScrollInfo(vert, hor);
kos_GetScrollInfo(vert, hor);
if (vert != 0)
{
stop_edit();
@ -628,7 +628,7 @@ void process_mouse()
mouse_x -= 5;
mouse_y -= kos_GetSkinHeight();
if (is_edit && mouse_x>=cell_box.left && mouse_x<=cell_box.left+cell_box.width
if (is_edit && mouse_x>=cell_box.left && mouse_x<=cell_box.left+cell_box.width
&& mouse_y>=cell_box.top && mouse_y<=cell_box.top+22) return;
mouse_btn &= 0x0001;
@ -644,7 +644,7 @@ void process_mouse()
if (!size_state && !mouse_btn)
return;
if (mouse_btn && !size_state) // LMB down
if (mouse_btn && !size_state) // LMB down
{
//rtlDebugOutString("lmb down and not resize");
@ -707,7 +707,7 @@ void process_mouse()
}
if (kx != -1 && ky != -1)
{
if (!shift)
if (!shift)
{
move_selection(kx, ky);
//return;
@ -795,13 +795,13 @@ void process_mouse()
}
}
draw_drag();
}
}
size_mouse_x = mouse_x;
size_mouse_y = mouse_y;
size_mouse_y = mouse_y;
}
void shift_selection(int dx, int dy, Dword shift)
void shift_selection(int dx, int dy, Dword shift)
{
if (dx != 0)
{
@ -874,13 +874,13 @@ void process_key()
dword key_editbox;
Byte key_ascii, key_scancode;
// key pressed, read it
// key pressed, read it
ckeys = kos_GetSpecialKeyState();
shift = ckeys & 0x3;
ctrl = ckeys & 0x0c;
sel_moved = 0;
sel_end_move = 0;
kos_GetKeys(key_editbox, key_ascii, key_scancode);
if (cell_box.flags & ed_focus) {
@ -896,7 +896,7 @@ void process_key()
{
mov eax, key_editbox
}
edit_box_key((dword)&cell_box);
edit_box_key((dword)&cell_box);
}
}
else if (file_box.flags & ed_focus) {
@ -961,7 +961,7 @@ void process_key()
//sprintf(debuf, "%U %U %U %U", buf_col, buf_row, x0, y0);
//rtlDebugOutString(debuf);
buffer = (char***)allocmem(buf_col * sizeof(char**));
for (i = 0; i < buf_col; i++)
{
@ -985,7 +985,7 @@ void process_key()
buffer[i][j] = NULL;
}
}
if (key_ascii == 24) ///////WTF????
if (key_ascii == 24) ///////Unexpected!????
calculate_values();
draw_grid();
break;
@ -1149,7 +1149,7 @@ void kos_Main()
file_box.size = file_box.pos = strlen(fname);
EventLoadFile();
}
kos_SetMaskForEvents(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
kos_SetMaskForEvents(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
for (;;)
{
switch (kos_WaitForEvent())
@ -1165,7 +1165,7 @@ void kos_Main()
case EM_BUTTON_CLICK:
process_button();
break;
case EM_WINDOW_REDRAW:
draw_window();
break;

View File

@ -27,6 +27,7 @@
// warnings. See
// https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
// for more info.
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#define _GNU_SOURCE
@ -77,11 +78,11 @@ void notify(char *text);
/*** Data section ***/
// Kolibri defaults
// KolibriOS defaults
int con_def_wnd_width = 80;
int con_def_wnd_height = 25;
/// winFile support
int fileIsOd0a;
int fileIsOd0a;
typedef struct editor_row {
int idx; // Row own index within the file.
@ -137,7 +138,7 @@ struct editor_config {
// Having a dynamic buffer will allow us to write only one
// time once the screen is refreshing, instead of doing
// a lot of write's.
// a lot of writes.
struct a_buf {
char* buf;
int len;
@ -465,7 +466,7 @@ void enableRawMode() {
/// die("Failed to set raw mode");
}
/// by Siemargl rewritten, still Ctrl+ combination works only in english locale, so need analyze scancode
/// by Siemargl rewritten, still Ctrl+ combination works only in English locale, so need analyze scancode
int editorReadKey() {
int key = con_getch2();
if (key == 0)
@ -485,13 +486,13 @@ int editorReadKey() {
case 9: // TAB
return key;
case 22: // Ctrl+V
return CTRL_KEY('v');
case 3: // Ctrl+C
return CTRL_KEY('c');
case 12: // Ctrl+L
return CTRL_KEY('l');
@ -516,7 +517,7 @@ int editorReadKey() {
*/
case 24: // Ctrl+X
return CTRL_KEY('x');
default:
return key;
@ -529,7 +530,7 @@ int editorReadKey() {
case 75: // Left
return ARROW_LEFT;
case 77: // Right
return ARROW_RIGHT;
@ -541,16 +542,16 @@ int editorReadKey() {
case 81: // PgDn
return PAGE_DOWN;
case 73: // PgUp
return PAGE_UP;
case 71: // Home
return HOME_KEY;
case 79: // End
return END_KEY;
default:
return 0;
}
@ -844,7 +845,7 @@ void editorSelectSyntaxHighlight() {
int editorRowCursorXToRenderX(editor_row* row, int cursor_x) {
int render_x = 0;
int j;
// For each character, if its a tab we use rx % TTE_TAB_STOP
// For each character, if it's a tab we use rx % TTE_TAB_STOP
// to find out how many columns we are to the right of the last
// tab stop, and then subtract that from TTE_TAB_STOP - 1 to
// find out how many columns we are to the left of the next tab
@ -1100,7 +1101,7 @@ char* editorRowsToString(int* buf_len) {
// to each one for the newline character we'll add to
// the end of each line.
for (j = 0; j < ec.num_rows; j++) {
total_len += ec.row[j].size + 1
total_len += ec.row[j].size + 1
+ (fileIsOd0a ? 1:0); /// winFile suppor
}
*buf_len = total_len;
@ -1187,7 +1188,7 @@ void editorSave() {
}
free(buf);
editorSetStatusMessage("Cant's save file. Error occurred: %s", strerror(errno));
editorSetStatusMessage("Can't save file. Error occurred: %s", strerror(errno));
}
/*** Search section ***/
@ -1361,11 +1362,11 @@ void editorDrawStatusBar(struct a_buf* ab) {
void editorDrawMessageBar(struct a_buf *ab) {
// Clearing the message bar.
/// abufAppend(ab, "\x1b[K", 3); /// not work in Kolibri
/// abufAppend(ab, "\x1b[K", 3); /// not work in KolibriOS
int msg_len = strlen(ec.status_msg);
if (msg_len > ec.screen_cols)
msg_len = ec.screen_cols;
// We only show the message if its less than 5 secons old, but
// We only show the message if it's less than 5 seconds old, but
// remember the screen is only being refreshed after each keypress.
if (msg_len && time(NULL) - ec.status_msg_time < 5)
abufAppend(ab, ec.status_msg, msg_len);
@ -1730,7 +1731,7 @@ void initEditor() {
}
void printHelp() {
/*
/*
printf("Usage: tte [OPTIONS] [FILE]\n\n");
printf("\nKEYBINDINGS\n-----------\n\n");
printf("Keybinding\t\tAction\n\n");
@ -1751,9 +1752,9 @@ void printHelp() {
printf("\n\nFor now, usage of ISO 8859-1 is recommended.\n");
*/
/// NOTIFY HOTKEYS
char* __help__ =
/// NOTIFY HOTKEYS
char* __help__ =
"'Hotkeys: \n\
^Q, ^Z Exit \n\
Ctrl-S Save \n\
@ -1765,9 +1766,9 @@ Ctrl-C Copy line \n\
Ctrl-X Cut line \n\
Ctrl-V Paste line' -t -I";
notify(__help__);
/// NOTIFY OPTIONS
__help__ =
__help__ =
"'Options:\n\
-h, --help Prints the help \n\
-v, --version Prints the version of tte \n\
@ -1798,7 +1799,7 @@ int handleArgs(int argc, char* argv[]) {
}
int main(int argc, char* argv[]) {
#ifdef TCC_BUILD
con_init_console_dll_param(con_def_wnd_width, con_def_wnd_height, con_def_wnd_width, con_def_wnd_height, "TinyTextEditor");
#endif
@ -1806,19 +1807,19 @@ int main(int argc, char* argv[]) {
load_console();
con_init(con_def_wnd_width, con_def_wnd_height, con_def_wnd_width, con_def_wnd_height, "TinyTextEditor");
#endif
initEditor();
int arg_response = handleArgs(argc, argv);
if (arg_response == 1) {
char* filename = argv[1];
// tolower
for (int i = 0; i < strlen(filename); i++) filename[i] = tolower(filename[i]);
editorOpen(filename);
char* title = argv[1];
strcat(title, " - TinyTextEditor");
con_set_title(title);
}
}
else if (arg_response == -1)
return 0;
enableRawMode();

File diff suppressed because it is too large Load Diff