/programs/cmm/lib/kolibri.h |
---|
826,6 → 826,7 |
$int 0x40 |
} |
:dword X_EventRedrawWindow,Y_EventRedrawWindow; |
:void _EventRedrawWindow() |
{ |
/programs/cmm/lib/dll.h |
---|
1,17 → 1,10 |
#ifndef INCLUDE_DLL_H |
#define INCLUDE_DLL_H |
#ifndef INCLUDE_FILESYSTEM_H |
#ifndef INCLUDE_KOLIBRI_H |
#include "../lib/file_system.h" |
#endif |
#ifdef LANG_RUS |
#define _TEXT_ERROR_ADD "'訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨" |
#elif LANG_EST |
#define _TEXT_ERROR_ADD "'Viga teegi laadimisel" |
#else |
#define _TEXT_ERROR_ADD "'Error while loading library" |
#endif |
char a_libdir[43] = "/sys/lib/\0"; |
18,7 → 11,15 |
:inline void error_init(dword text) |
{ |
dword TEXT_ERROR = malloc(1024); |
sprintf("%s `%s`' -E",_TEXT_ERROR_ADD,text); |
#ifdef LANG_RUS |
strcpy(TEXT_ERROR,"'訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ `"); |
#elif LANG_EST |
strcpy(TEXT_ERROR,"'Viga teegi laadimisel `"); |
#else |
strcpy(TEXT_ERROR,"'Error while loading library `"); |
#endif |
strcat(TEXT_ERROR,text); |
strcat(TEXT_ERROR,"`' -E"); |
notify(TEXT_ERROR); |
free(TEXT_ERROR); |
} |
117,9 → 118,9 |
push ebp |
mov ebp, esp |
pushad |
mov eax, #malloc |
mov ebx, #free; |
mov ecx, #realloc; |
mov eax, #mem_Alloc |
mov ebx, #mem_Free; |
mov ecx, #mem_ReAlloc; |
mov edx, #dll_Load; |
call SSDWORD[EBP+8] |
popad |
238,15 → 239,10 |
return -1; |
} |
byte load_dll(dword dllname, import_table, byte need_init) |
void load_dll(dword dllname, import_table, byte need_init) |
{ |
if (load_dll2(dllname, import_table, need_init)) |
{ |
error_init(dllname); |
return false; |
if (load_dll2(dllname, import_table, need_init)!=0) error_init(dllname); |
} |
return true; |
} |
#endif |
/programs/cmm/lib/obj/http.h |
---|
10,7 → 10,6 |
#include "../lib/dll.h" |
#endif |
dword NOT_INIT_LIBHTTP = true; |
dword libHTTP = #alibHTTP; |
char alibHTTP[23] = "/sys/lib/http.obj\0"; |
/programs/cmm/lib/file_system.h |
---|
291,6 → 291,11 |
return error; |
} |
:dword notify(dword notify_param) |
{ |
return RunProgram("@notify", notify_param); |
} |
:dword abspath(dword relative_path) //GetAbsolutePathFromRelative() |
{ |
char absolute_path[4096]; |
319,10 → 324,7 |
sprintf(#ConvertSize_size_prefix,"%d %s",bytes,#size_nm); |
return #ConvertSize_size_prefix; |
} |
:dword notify(dword notify_param) |
{ |
return RunProgram("@notify", notify_param); |
} |
:dword ConvertSizeToKb(unsigned int bytes) |
{ |
unsigned char size[25]=0; |
/programs/cmm/lib/lexer.h |
---|
4,14 → 4,9 |
#ifndef INCLUDE_STRING_H |
#include "../lib/strings.h" |
#endif |
#ifndef INCLUDE_MEM_H |
#include "../lib/mem.h" |
#endif |
/** Splits text into tokens |
* Author :Pavel Yakovlev |
* Homepage:https://vk.com/pavelyakov39 |
* Ver. : 1.51 |
*/ |
/** Example: |
54,76 → 49,19 |
:struct lexer |
{ |
byte cmd; |
dword token,text,mem_list,count,buffer_loading; |
dword str_buffer; |
dword token,text; |
byte type; |
char quote; |
signed length; |
signed count,length; |
dword next(void); |
dword back(void); |
dword list(void); |
void free(void); |
dword position(dword __); |
void load(dword _text); |
void expected(dword _text); |
}; |
:dword back(void) |
{ |
} |
:dword lexer::list(void) |
:void expected(dword _text) |
{ |
dword count_mem,buf_loop,pos; |
count_mem = 0; |
buf_loop = 5000; // на тыс элементов. |
count = 0; |
buffer_loading = malloc(buf_loop); |
pos = buffer_loading; |
while(type!=LEX_END) |
{ |
pos+=count_mem; |
next(); |
DSDWORD[pos] = strndup(token,length); |
pos+=4; |
DSBYTE [pos] = type; |
pos++; |
count++; |
if(pos-buffer_loading>buf_loop) |
{ |
buf_loop*=2; |
buffer_loading = realloc(buffer_loading,buf_loop); |
} |
} |
return buffer_loading; |
} |
:void lexer::free(void) |
{ |
dword z; |
z = count; |
while(z) |
{ |
z--; |
position(z); |
::free(token); |
} |
count = 0; |
::free(buffer_loading); |
} |
:dword lexer::position(dword __) |
{ |
dword pos1; |
if(!count)list(); |
if(__>=count)__=count-1; |
else if(__<0)__=0; |
pos1 = __*5; |
pos1 += buffer_loading; |
token = DSDWORD[pos1]; |
pos1++; |
type = DSBYTE[pos1]; |
return token; |
} |
:void lexer::expected(dword _text) |
{ |
notify(_text); |
ExitProcess(); |
} |
131,19 → 69,15 |
:void lexer::load(dword _text) |
{ |
text = _text; |
count = 0; |
str_buffer = 0; |
} |
:dword lexer::next(void) |
{ |
char s; |
dword len_str_buf,tmp; |
dword pos,in; |
pos = #const_token_lexer; |
in = text; |
//len_str_buf = 1024; |
if(str_buffer)::free(str_buffer); |
NEXT_TOKEN: |
length = 0; |
loop() |
250,7 → 184,6 |
{ |
quote = s; |
in++; |
tmp = in; |
s = DSBYTE[in]; |
loop() |
{ |
277,43 → 210,10 |
DSBYTE[pos] = s; |
pos++; |
in++; |
/*if(in-tmp>len_str_buf) |
{ |
if(str_buffer) |
{ |
tmp = len_str_buf; |
len_str_buf+=1024; |
str_buffer = realloc(str_buffer,len_str_buf+1); |
strlcpy(str_buffer+tmp,#const_token_lexer,1024); |
pos = #const_token_lexer; |
} |
else { |
len_str_buf+=1024; |
str_buffer = malloc(len_str_buf+1); |
strlcpy(str_buffer,#const_token_lexer,1024); |
pos = #const_token_lexer; |
} |
}*/ |
s = DSBYTE[in]; |
} |
in++; |
/*tmp = pos-in; |
if(str_buffer) |
{ |
if(tmp) |
{ |
str_buffer = realloc(str_buffer,tmp+1); |
strlcpy(str_buffer+len_str_buf,#const_token_lexer,tmp); |
} |
type = LEX_STR; |
length = len_str_buf+tmp; |
text = in; |
tmp = str_buffer+length; |
DSBYTE[tmp] = 0; |
token = str_buffer; |
return token; |
}*/ |
type = LEX_STR; |
} |
else { |
in++; |
/programs/cmm/mouse_cfg/mouse_cfg.c |
---|
107,7 → 107,7 |
mouse_cfg.pointer_speed++; |
SetMouseSpeed(mouse_cfg.pointer_speed); |
} |
if (id==121) && (mouse_cfg.pointer_speed>1) |
if (id==121) && (mouse_cfg.pointer_speed>0) |
{ |
mouse_cfg.pointer_speed--; |
SetMouseSpeed(mouse_cfg.pointer_speed); |
/programs/cmm/browser/WebView.c |
---|
9,11 → 9,13 |
//libraries |
#define MEMSIZE 0x100000 |
#include "..\lib\kolibri.h" |
#include "..\lib\strings.h" |
#include "..\lib\gui.h" |
#include "..\lib\encoding.h" |
#include "..\lib\file_system.h" |
#include "..\lib\mem.h" |
#include "..\lib\dll.h" |
#include "..\lib\draw_buf.h" |
#include "..\lib\list_box.h" |
#include "..\lib\cursor.h" |
45,8 → 47,6 |
char accept_language[]= "Accept-Language: en\n"; |
#endif |
proc_info Form; |
#define WIN_W 799 |
#define WIN_H 559 |
141,7 → 141,8 |
CreateDir("/tmp0/1/downloads"); |
SetEventMask(0xa7); |
BEGIN_LOOP_APPLICATION: |
loop() |
{ |
WaitEventTimeout(2); |
switch(EAX & 0xFF) |
{ |
155,8 → 156,13 |
//Menu |
if (m.y>WB1.list.y) && (m.y<Form.height) && (bufsize) |
{ |
if (m.pkm) && (m.up) |
if (m.pkm) |
{ |
show_menu = 1; |
} |
if (!m.pkm) && (show_menu) |
{ |
show_menu = 0; |
SwitchToAnotherThread(); |
CreateThread(#menu_rmb,#stak+4092); |
break; |
184,7 → 190,7 |
btn=WB1.list.first; |
WB1.list.first = m.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h; |
if (WB1.list.visible+WB1.list.first>WB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible; |
if (btn!=WB1.list.first) WB1.Parse(); |
if (btn<>WB1.list.first) WB1.Parse(); |
} |
break; |
case evButton: |
197,7 → 203,7 |
if (address_box.flags & 0b10) |
{ |
if (key==ASCII_KEY_ENTER) Scan(key); else |
if (key!=0x0d) && (key!=183) && (key!=184) {EAX=key<<8; edit_box_key stdcall(#address_box);} |
if (key<>0x0d) && (key<>183) && (key<>184) {EAX=key<<8; edit_box_key stdcall(#address_box);} |
} |
else Scan(key); |
break; |
276,8 → 282,8 |
} |
} |
} |
goto BEGIN_LOOP_APPLICATION; |
} |
} |
void SetElementSizes() |
{ |
376,7 → 382,7 |
case 006: //download manager |
if (!downloader_opened) { |
strncpy(#DL_URL, "http://",7); |
strcpy(#DL_URL, "http://"); |
CreateThread(#Downloader,#downloader_stak+4092); |
} |
return; |
396,12 → 402,15 |
WB1.Parse(); |
break; |
case 053: //F4 |
if (!strncmp(#URL,"http:",5)) |
if (strncmp(#URL,"http:",5)==0) |
{ |
WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm"); |
if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); |
if (EAX==0) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); |
} |
else RunProgram("/rd/1/tinypad", #URL); |
else |
{ |
RunProgram("/rd/1/tinypad", #URL); |
} |
return; |
case 054: //F5 |
IF(address_box.flags & 0b10) return; |
422,7 → 431,10 |
case GOTOURL: |
case 0x0D: //enter |
if (!editURL[0]) return; |
if (strncmp(#editURL,"http:",5)) && (editURL[0]!='/') && (strncmp(#editURL,"WebView:",9)) strncpy(#URL,"http://",7); |
if ((strncmp(#editURL,"http:",5)!=0) && (editURL[0]!='/') && ((strncmp(#editURL,"WebView:",8)!=0)) |
{ |
strcpy(#URL,"http://"); |
} |
else |
URL[0] = 0; |
strcat(#URL, #editURL); |
429,7 → 441,8 |
OpenPage(); |
return; |
case SEARCHWEB: |
sprintf(#URL,"%s%s",#search_path,#editURL); |
strcpy(#URL, #search_path); |
strcat(#URL, #editURL); |
OpenPage(); |
return; |
498,11 → 511,11 |
if (URL[0] == '$') |
{ |
if (URL[1]=='-') && (condition_href) condition_href--; |
else if (URL[1]=='+') |
if (URL[1]=='+') |
{ |
if (condition_href<condition_max) condition_href++; else notify(T_LAST_SLIDE); |
} |
else condition_href = atoi(#URL+1); |
if (URL[1]!='-') && (URL[1]!='+') condition_href = atoi(#URL+1); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
ShowPage(); |
return; |
529,17 → 542,20 |
|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1) |
{ |
//notify(#URL); |
if (!strncmp(#URL,"http://", 7)) |
if (strcmpn(#URL,"http://", 7)==0) |
{ |
strcpy(#DL_URL, #URL); |
CreateThread(#Downloader,#downloader_stak+4092); |
} |
else RunProgram("@open", #URL); |
else |
{ |
RunProgram("@open", #URL); |
} |
strcpy(#editURL, BrowserHistory.CurrentUrl()); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
return; |
} |
if (!strncmp(#URL,"mailto:", 7)) |
if (!strcmpn(#URL,"mailto:", 7)) |
{ |
notify(#URL); |
strcpy(#editURL, BrowserHistory.CurrentUrl()); |
552,7 → 568,7 |
void StopLoading() |
{ |
if (http_transfer) |
if (http_transfer<>0) |
{ |
EAX = http_transfer; |
EAX = EAX.http_msg.content_ptr; // get pointer to data |
559,10 → 575,10 |
$push EAX // save it on the stack |
http_free stdcall (http_transfer); // abort connection |
$pop EAX |
free(EAX); // free data |
mem_Free(EAX); // free data |
http_transfer=0; |
bufsize = 0; |
bufpointer = free(bufpointer); |
bufpointer = mem_Free(bufpointer); |
} |
wv_progress_bar.value = 0; |
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 52, 0); |
586,23 → 602,29 |
souce_mode = false; |
strcpy(#editURL, #URL); |
BrowserHistory.AddUrl(); |
if (!strncmp(#URL,"WebView:",8)) |
if (strncmp(#URL,"WebView:",8)==0) |
{ |
SetPageDefaults(); |
if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.Prepare(#homepage, sizeof(homepage)); |
else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory(); |
if (strcmp(#URL, URL_SERVICE_HOME)==0) |
{ |
WB1.Prepare(#homepage, sizeof(homepage)); |
} |
if (strcmp(#URL, URL_SERVICE_HISTORY)==0) |
{ |
ShowHistory(); |
} |
return; |
} |
if (!strncmp(#URL,"http:",5)) |
if (strncmp(#URL,"http:",5)==0) |
{ |
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 131, 0); |
http_get stdcall (#URL, 0, 0, #accept_language); |
http_transfer = EAX; |
if (!http_transfer) |
if (http_transfer == 0) |
{ |
StopLoading(); |
bufsize = 0; |
bufpointer = free(bufpointer); |
bufpointer = mem_Free(bufpointer); |
ShowPage(); |
return; |
} |
613,8 → 635,8 |
bufsize = EBX; |
if (bufsize) |
{ |
free(bufpointer); |
bufpointer = malloc(bufsize); |
mem_Free(bufpointer); |
bufpointer = mem_Alloc(bufsize); |
SetPageDefaults(); |
ReadFile(0, bufsize, bufpointer, #URL); |
//ShowSource(); |
637,7 → 659,7 |
if (!bufsize) |
{ |
PageLinks.Clear(); |
if (http_transfer) |
if (http_transfer<>0) |
{ |
WB1.Prepare(#loading, sizeof(loading)); |
} |
653,10 → 675,12 |
byte UrlExtIs(dword ext) |
{ |
if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true; |
return false; |
if (strcmpi(#URL + strlen(#URL) - strlen(ext), ext)==0) return 1; else return 0; |
} |
stop: |
char downloader_stak[4096]; |
stop: |
/programs/cmm/browser/menu_rmb.h |
---|
35,8 → 35,7 |
menu.SetSizes(2,2,177,menu.count*19,0,19); |
SetEventMask(100111b); |
_BEGIN_APPLICATION_MENU: |
switch(WaitEvent()) |
loop() switch(WaitEvent()) |
{ |
case evMouse: |
GetProcessInfo(#MenuForm, SelfInfo); |
44,7 → 43,7 |
mm.get(); |
if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList(); |
if (mm.lkm)&&(mm.up) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); } |
if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); } |
break; |
case evKey: |
63,7 → 62,6 |
DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color); |
DrawMenuList(); |
} |
goto _BEGIN_APPLICATION_MENU; |
} |
void DrawMenuList() |
/programs/cmm/browser/show_src.h |
---|
10,8 → 10,11 |
souce_mode = true; |
new_buf = malloc(bufsize*5); |
new_buf_start = new_buf; |
strcpy(new_buf, "<html><head><title>"); |
if (strlen(#header)-strlen(#version)>0) header[strlen(#header)-strlen(#version)-2] = 0; else strcpy(#header, "Source"); |
new_buf += sprintf(new_buf,"<html><head><title>%s</title><body><pre>",#header); |
strcat(new_buf, #header); |
strcat(new_buf, "</title><body><pre>"); |
new_buf += strlen(new_buf); |
for (i=bufpointer; i<bufpointer+bufsize; i++) |
{ |
ww = ESBYTE[i]; |
/programs/cmm/eolite/Eolite.c |
---|
7,9 → 7,11 |
//libraries |
#define MEMSIZE 0xD0000 |
#include "..\lib\kolibri.h" |
#include "..\lib\clipboard.h" |
#include "..\lib\strings.h" |
#include "..\lib\mem.h" |
#include "..\lib\dll.h" |
#include "..\lib\file_system.h" |
#include "..\lib\gui.h" |
#include "..\lib\list_box.h" |
/programs/cmm/eolite/include/sorting.h |
---|
33,16 → 33,15 |
filename2 = file_mas[b]*304 + buf+72; |
n=strlen(filename1)-1; |
WHILE (n>0) && (ESBYTE[filename1+n]!='.') n--; |
WHILE (n>0) && (ESBYTE[filename1+n]<>'.') n--; |
if (n) ext1 = filename1+n+1; else ext1=0; |
n=strlen(filename2); |
n--; |
WHILE (n>0) && (ESBYTE[filename2+n]!='.') n--; |
n=strlen(filename2)-1; |
WHILE (n>0) && (ESBYTE[filename2+n]<>'.') n--; |
if (n) ext2 = filename2+n+1; else ext2=0; |
n=strcmp(ext1, ext2); |
if (n<0) { file_mas[isn] >< file_mas[j]; isn++;} |
if (!n) && (strcmp(filename1, filename2)<=0) { file_mas[isn] >< file_mas[j]; isn++;} |
if (n==0) && (strcmp(filename1, filename2)<=0) { file_mas[isn] >< file_mas[j]; isn++;} |
} |
Sort_by_Type(a, isn-2); |
Sort_by_Type(isn, b); |
/programs/cmm/eolite/include/left_panel.h |
---|
63,7 → 63,7 |
DrawBar(17,y,160,1,0xEFEDEE); |
DrawFilledBar(17, y+1, 160, 16); |
WriteText(25,y+5,0x80,sc.work_text,caption); |
if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button |
IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button |
WriteText(165,y+5,0x80,sc.work_text,arrow); //arrow |
DrawBar(17,y+17,160,1,sc.work_graph); |
} |
/programs/cmm/eolite/include/icons.h |
---|
44,7 → 44,7 |
PutPaletteImage(icon_n*16*15+#ficons,16,15,xx,yy,8,#ficons_pal); |
if (fairing_color!=0xFFFfff) IconFairing(icon_n, xx, yy, fairing_color); |
if (use_big_fonts) font_half_width=4; else font_half_width=3; |
if (icon_n!=17) && (strlen(extension)<9) WriteText(-strlen(extension)*font_half_width+Form.cwidth-120,yy+4,font_type,0,extension); |
if (icon_n<>17) && (strlen(extension)<9) WriteText(-strlen(extension)*font_half_width+Form.cwidth-120,yy+4,font_type,0,extension); |
} |