mouse_cfg: speed x>=1

lexer.h  : alloc tokens

git-svn-id: svn://kolibrios.org@5631 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2015-07-30 15:49:09 +00:00
parent 00fcd51abd
commit cdfc1d7c00
13 changed files with 176 additions and 100 deletions

View File

@ -9,13 +9,11 @@
//libraries //libraries
#define MEMSIZE 0x100000 #define MEMSIZE 0x100000
#include "..\lib\kolibri.h"
#include "..\lib\strings.h" #include "..\lib\strings.h"
#include "..\lib\gui.h" #include "..\lib\gui.h"
#include "..\lib\encoding.h" #include "..\lib\encoding.h"
#include "..\lib\file_system.h" #include "..\lib\file_system.h"
#include "..\lib\mem.h" #include "..\lib\mem.h"
#include "..\lib\dll.h"
#include "..\lib\draw_buf.h" #include "..\lib\draw_buf.h"
#include "..\lib\list_box.h" #include "..\lib\list_box.h"
#include "..\lib\cursor.h" #include "..\lib\cursor.h"
@ -47,6 +45,8 @@ char homepage[] = FROM "html\\homepage.htm";
char accept_language[]= "Accept-Language: en\n"; char accept_language[]= "Accept-Language: en\n";
#endif #endif
proc_info Form; proc_info Form;
#define WIN_W 799 #define WIN_W 799
#define WIN_H 559 #define WIN_H 559
@ -141,8 +141,7 @@ void main()
CreateDir("/tmp0/1/downloads"); CreateDir("/tmp0/1/downloads");
SetEventMask(0xa7); SetEventMask(0xa7);
loop() BEGIN_LOOP_APPLICATION:
{
WaitEventTimeout(2); WaitEventTimeout(2);
switch(EAX & 0xFF) switch(EAX & 0xFF)
{ {
@ -156,13 +155,8 @@ void main()
//Menu //Menu
if (m.y>WB1.list.y) && (m.y<Form.height) && (bufsize) if (m.y>WB1.list.y) && (m.y<Form.height) && (bufsize)
{ {
if (m.pkm) if (m.pkm) && (m.up)
{ {
show_menu = 1;
}
if (!m.pkm) && (show_menu)
{
show_menu = 0;
SwitchToAnotherThread(); SwitchToAnotherThread();
CreateThread(#menu_rmb,#stak+4092); CreateThread(#menu_rmb,#stak+4092);
break; break;
@ -190,7 +184,7 @@ void main()
btn=WB1.list.first; btn=WB1.list.first;
WB1.list.first = m.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h; 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 (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; break;
case evButton: case evButton:
@ -203,7 +197,7 @@ void main()
if (address_box.flags & 0b10) if (address_box.flags & 0b10)
{ {
if (key==ASCII_KEY_ENTER) Scan(key); else 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); else Scan(key);
break; break;
@ -282,7 +276,7 @@ void main()
} }
} }
} }
} goto BEGIN_LOOP_APPLICATION;
} }
void SetElementSizes() void SetElementSizes()
@ -382,7 +376,7 @@ void Scan(int id)
case 006: //download manager case 006: //download manager
if (!downloader_opened) { if (!downloader_opened) {
strcpy(#DL_URL, "http://"); strncpy(#DL_URL, "http://",7);
CreateThread(#Downloader,#downloader_stak+4092); CreateThread(#Downloader,#downloader_stak+4092);
} }
return; return;
@ -402,15 +396,12 @@ void Scan(int id)
WB1.Parse(); WB1.Parse();
break; break;
case 053: //F4 case 053: //F4
if (strncmp(#URL,"http:",5)==0) if (!strncmp(#URL,"http:",5))
{ {
WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm"); WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
if (EAX==0) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
}
else
{
RunProgram("/rd/1/tinypad", #URL);
} }
else RunProgram("/rd/1/tinypad", #URL);
return; return;
case 054: //F5 case 054: //F5
IF(address_box.flags & 0b10) return; IF(address_box.flags & 0b10) return;
@ -431,18 +422,14 @@ void Scan(int id)
case GOTOURL: case GOTOURL:
case 0x0D: //enter case 0x0D: //enter
if (!editURL[0]) return; if (!editURL[0]) return;
if ((strncmp(#editURL,"http:",5)!=0) && (editURL[0]!='/') && ((strncmp(#editURL,"WebView:",8)!=0)) if (strncmp(#editURL,"http:",5)) && (editURL[0]!='/') && (strncmp(#editURL,"WebView:",9)) strncpy(#URL,"http://",7);
{
strcpy(#URL,"http://");
}
else else
URL[0] = 0; URL[0] = 0;
strcat(#URL, #editURL); strcat(#URL, #editURL);
OpenPage(); OpenPage();
return; return;
case SEARCHWEB: case SEARCHWEB:
strcpy(#URL, #search_path); sprintf(#URL,"%s%s",#search_path,#editURL);
strcat(#URL, #editURL);
OpenPage(); OpenPage();
return; return;
@ -511,11 +498,11 @@ void ProcessLinks(int id)
if (URL[0] == '$') if (URL[0] == '$')
{ {
if (URL[1]=='-') && (condition_href) condition_href--; if (URL[1]=='-') && (condition_href) condition_href--;
if (URL[1]=='+') else if (URL[1]=='+')
{ {
if (condition_href<condition_max) condition_href++; else notify(T_LAST_SLIDE); if (condition_href<condition_max) condition_href++; else notify(T_LAST_SLIDE);
} }
if (URL[1]!='-') && (URL[1]!='+') condition_href = atoi(#URL+1); else condition_href = atoi(#URL+1);
strcpy(#URL, BrowserHistory.CurrentUrl()); strcpy(#URL, BrowserHistory.CurrentUrl());
ShowPage(); ShowPage();
return; return;
@ -542,20 +529,17 @@ void ProcessLinks(int id)
|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1) || (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
{ {
//notify(#URL); //notify(#URL);
if (strcmpn(#URL,"http://", 7)==0) if (!strncmp(#URL,"http://", 7))
{ {
strcpy(#DL_URL, #URL); strcpy(#DL_URL, #URL);
CreateThread(#Downloader,#downloader_stak+4092); CreateThread(#Downloader,#downloader_stak+4092);
} }
else else RunProgram("@open", #URL);
{
RunProgram("@open", #URL);
}
strcpy(#editURL, BrowserHistory.CurrentUrl()); strcpy(#editURL, BrowserHistory.CurrentUrl());
strcpy(#URL, BrowserHistory.CurrentUrl()); strcpy(#URL, BrowserHistory.CurrentUrl());
return; return;
} }
if (!strcmpn(#URL,"mailto:", 7)) if (!strncmp(#URL,"mailto:", 7))
{ {
notify(#URL); notify(#URL);
strcpy(#editURL, BrowserHistory.CurrentUrl()); strcpy(#editURL, BrowserHistory.CurrentUrl());
@ -568,17 +552,17 @@ void ProcessLinks(int id)
void StopLoading() void StopLoading()
{ {
if (http_transfer<>0) if (http_transfer)
{ {
EAX = http_transfer; EAX = http_transfer;
EAX = EAX.http_msg.content_ptr; // get pointer to data EAX = EAX.http_msg.content_ptr; // get pointer to data
$push EAX // save it on the stack $push EAX // save it on the stack
http_free stdcall (http_transfer); // abort connection http_free stdcall (http_transfer); // abort connection
$pop EAX $pop EAX
mem_Free(EAX); // free data free(EAX); // free data
http_transfer=0; http_transfer=0;
bufsize = 0; bufsize = 0;
bufpointer = mem_Free(bufpointer); bufpointer = free(bufpointer);
} }
wv_progress_bar.value = 0; 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); img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 52, 0);
@ -602,29 +586,23 @@ void OpenPage()
souce_mode = false; souce_mode = false;
strcpy(#editURL, #URL); strcpy(#editURL, #URL);
BrowserHistory.AddUrl(); BrowserHistory.AddUrl();
if (strncmp(#URL,"WebView:",8)==0) if (!strncmp(#URL,"WebView:",8))
{ {
SetPageDefaults(); SetPageDefaults();
if (strcmp(#URL, URL_SERVICE_HOME)==0) if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.Prepare(#homepage, sizeof(homepage));
{ else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
WB1.Prepare(#homepage, sizeof(homepage));
}
if (strcmp(#URL, URL_SERVICE_HISTORY)==0)
{
ShowHistory();
}
return; return;
} }
if (strncmp(#URL,"http:",5)==0) if (!strncmp(#URL,"http:",5))
{ {
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 131, 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_get stdcall (#URL, 0, 0, #accept_language);
http_transfer = EAX; http_transfer = EAX;
if (http_transfer == 0) if (!http_transfer)
{ {
StopLoading(); StopLoading();
bufsize = 0; bufsize = 0;
bufpointer = mem_Free(bufpointer); bufpointer = free(bufpointer);
ShowPage(); ShowPage();
return; return;
} }
@ -635,8 +613,8 @@ void OpenPage()
bufsize = EBX; bufsize = EBX;
if (bufsize) if (bufsize)
{ {
mem_Free(bufpointer); free(bufpointer);
bufpointer = mem_Alloc(bufsize); bufpointer = malloc(bufsize);
SetPageDefaults(); SetPageDefaults();
ReadFile(0, bufsize, bufpointer, #URL); ReadFile(0, bufsize, bufpointer, #URL);
//ShowSource(); //ShowSource();
@ -659,7 +637,7 @@ void ShowPage()
if (!bufsize) if (!bufsize)
{ {
PageLinks.Clear(); PageLinks.Clear();
if (http_transfer<>0) if (http_transfer)
{ {
WB1.Prepare(#loading, sizeof(loading)); WB1.Prepare(#loading, sizeof(loading));
} }
@ -675,12 +653,10 @@ void ShowPage()
byte UrlExtIs(dword ext) byte UrlExtIs(dword ext)
{ {
if (strcmpi(#URL + strlen(#URL) - strlen(ext), ext)==0) return 1; else return 0; if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
return false;
} }
stop:
char downloader_stak[4096]; char downloader_stak[4096];
stop:

View File

@ -35,7 +35,8 @@ void menu_rmb()
menu.SetSizes(2,2,177,menu.count*19,0,19); menu.SetSizes(2,2,177,menu.count*19,0,19);
SetEventMask(100111b); SetEventMask(100111b);
loop() switch(WaitEvent()) _BEGIN_APPLICATION_MENU:
switch(WaitEvent())
{ {
case evMouse: case evMouse:
GetProcessInfo(#MenuForm, SelfInfo); GetProcessInfo(#MenuForm, SelfInfo);
@ -43,7 +44,7 @@ void menu_rmb()
mm.get(); mm.get();
if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList(); if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); } if (mm.lkm)&&(mm.up) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
break; break;
case evKey: case evKey:
@ -62,6 +63,7 @@ void menu_rmb()
DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color); DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
DrawMenuList(); DrawMenuList();
} }
goto _BEGIN_APPLICATION_MENU;
} }
void DrawMenuList() void DrawMenuList()

View File

@ -10,11 +10,8 @@ dword ShowSource()
souce_mode = true; souce_mode = true;
new_buf = malloc(bufsize*5); new_buf = malloc(bufsize*5);
new_buf_start = new_buf; 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"); if (strlen(#header)-strlen(#version)>0) header[strlen(#header)-strlen(#version)-2] = 0; else strcpy(#header, "Source");
strcat(new_buf, #header); new_buf += sprintf(new_buf,"<html><head><title>%s</title><body><pre>",#header);
strcat(new_buf, "</title><body><pre>");
new_buf += strlen(new_buf);
for (i=bufpointer; i<bufpointer+bufsize; i++) for (i=bufpointer; i<bufpointer+bufsize; i++)
{ {
ww = ESBYTE[i]; ww = ESBYTE[i];

View File

@ -7,11 +7,9 @@
//libraries //libraries
#define MEMSIZE 0xD0000 #define MEMSIZE 0xD0000
#include "..\lib\kolibri.h"
#include "..\lib\clipboard.h" #include "..\lib\clipboard.h"
#include "..\lib\strings.h" #include "..\lib\strings.h"
#include "..\lib\mem.h" #include "..\lib\mem.h"
#include "..\lib\dll.h"
#include "..\lib\file_system.h" #include "..\lib\file_system.h"
#include "..\lib\gui.h" #include "..\lib\gui.h"
#include "..\lib\list_box.h" #include "..\lib\list_box.h"

View File

@ -44,7 +44,7 @@ void Put_icon(dword extension, xx, yy, fairing_color, icon_n)
PutPaletteImage(icon_n*16*15+#ficons,16,15,xx,yy,8,#ficons_pal); 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 (fairing_color!=0xFFFfff) IconFairing(icon_n, xx, yy, fairing_color);
if (use_big_fonts) font_half_width=4; else font_half_width=3; 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);
} }

View File

@ -63,7 +63,7 @@ void Tip(int y, dword caption, id, arrow)
DrawBar(17,y,160,1,0xEFEDEE); DrawBar(17,y,160,1,0xEFEDEE);
DrawFilledBar(17, y+1, 160, 16); DrawFilledBar(17, y+1, 160, 16);
WriteText(25,y+5,0x80,sc.work_text,caption); WriteText(25,y+5,0x80,sc.work_text,caption);
IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button if (id) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
WriteText(165,y+5,0x80,sc.work_text,arrow); //arrow WriteText(165,y+5,0x80,sc.work_text,arrow); //arrow
DrawBar(17,y+17,160,1,sc.work_graph); DrawBar(17,y+17,160,1,sc.work_graph);
} }

View File

@ -33,15 +33,16 @@ void Sort_by_Type(int a, b) //
filename2 = file_mas[b]*304 + buf+72; filename2 = file_mas[b]*304 + buf+72;
n=strlen(filename1)-1; 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; if (n) ext1 = filename1+n+1; else ext1=0;
n=strlen(filename2)-1; n=strlen(filename2);
WHILE (n>0) && (ESBYTE[filename2+n]<>'.') n--; n--;
WHILE (n>0) && (ESBYTE[filename2+n]!='.') n--;
if (n) ext2 = filename2+n+1; else ext2=0; if (n) ext2 = filename2+n+1; else ext2=0;
n=strcmp(ext1, ext2); n=strcmp(ext1, ext2);
if (n<0) { file_mas[isn] >< file_mas[j]; isn++;} if (n<0) { file_mas[isn] >< file_mas[j]; isn++;}
if (n==0) && (strcmp(filename1, filename2)<=0) { file_mas[isn] >< file_mas[j]; isn++;} if (!n) && (strcmp(filename1, filename2)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
} }
Sort_by_Type(a, isn-2); Sort_by_Type(a, isn-2);
Sort_by_Type(isn, b); Sort_by_Type(isn, b);

View File

@ -1,25 +1,24 @@
#ifndef INCLUDE_DLL_H #ifndef INCLUDE_DLL_H
#define INCLUDE_DLL_H #define INCLUDE_DLL_H
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_FILESYSTEM_H
#include "../lib/file_system.h" #include "../lib/file_system.h"
#endif #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"; char a_libdir[43] = "/sys/lib/\0";
:inline void error_init(dword text) :inline void error_init(dword text)
{ {
dword TEXT_ERROR = malloc(1024); dword TEXT_ERROR = malloc(1024);
#ifdef LANG_RUS sprintf("%s `%s`' -E",_TEXT_ERROR_ADD,text);
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); notify(TEXT_ERROR);
free(TEXT_ERROR); free(TEXT_ERROR);
} }
@ -118,9 +117,9 @@ asm {
push ebp push ebp
mov ebp, esp mov ebp, esp
pushad pushad
mov eax, #mem_Alloc mov eax, #malloc
mov ebx, #mem_Free; mov ebx, #free;
mov ecx, #mem_ReAlloc; mov ecx, #realloc;
mov edx, #dll_Load; mov edx, #dll_Load;
call SSDWORD[EBP+8] call SSDWORD[EBP+8]
popad popad
@ -239,9 +238,14 @@ int load_dll2(dword dllname, import_table, byte need_init)
return -1; return -1;
} }
void load_dll(dword dllname, import_table, byte need_init) byte load_dll(dword dllname, import_table, byte need_init)
{ {
if (load_dll2(dllname, import_table, need_init)!=0) error_init(dllname); if (load_dll2(dllname, import_table, need_init))
{
error_init(dllname);
return false;
}
return true;
} }

View File

@ -291,11 +291,6 @@ enum
return error; return error;
} }
:dword notify(dword notify_param)
{
return RunProgram("@notify", notify_param);
}
:dword abspath(dword relative_path) //GetAbsolutePathFromRelative() :dword abspath(dword relative_path) //GetAbsolutePathFromRelative()
{ {
char absolute_path[4096]; char absolute_path[4096];
@ -324,7 +319,10 @@ enum
sprintf(#ConvertSize_size_prefix,"%d %s",bytes,#size_nm); sprintf(#ConvertSize_size_prefix,"%d %s",bytes,#size_nm);
return #ConvertSize_size_prefix; return #ConvertSize_size_prefix;
} }
:dword notify(dword notify_param)
{
return RunProgram("@notify", notify_param);
}
:dword ConvertSizeToKb(unsigned int bytes) :dword ConvertSizeToKb(unsigned int bytes)
{ {
unsigned char size[25]=0; unsigned char size[25]=0;

View File

@ -826,7 +826,6 @@ inline fastcall dword GetStartTime()
$int 0x40 $int 0x40
} }
:dword X_EventRedrawWindow,Y_EventRedrawWindow; :dword X_EventRedrawWindow,Y_EventRedrawWindow;
:void _EventRedrawWindow() :void _EventRedrawWindow()
{ {

View File

@ -4,9 +4,14 @@
#ifndef INCLUDE_STRING_H #ifndef INCLUDE_STRING_H
#include "../lib/strings.h" #include "../lib/strings.h"
#endif #endif
#ifndef INCLUDE_MEM_H
#include "../lib/mem.h"
#endif
/** Splits text into tokens /** Splits text into tokens
* Author :Pavel Yakovlev * Author :Pavel Yakovlev
* Homepage:https://vk.com/pavelyakov39 * Homepage:https://vk.com/pavelyakov39
* Ver. : 1.51
*/ */
/** Example: /** Example:
@ -49,18 +54,75 @@
:struct lexer :struct lexer
{ {
byte cmd; byte cmd;
dword token,text; dword token,text,mem_list,count,buffer_loading;
dword str_buffer;
byte type; byte type;
char quote; char quote;
signed count,length; signed length;
dword next(void); dword next(void);
dword back(void); dword back(void);
dword list(void);
void free(void);
dword position(dword __);
void load(dword _text); void load(dword _text);
void expected(dword _text); void expected(dword _text);
}; };
:dword back(void)
{
}
:void expected(dword _text) :dword lexer::list(void)
{
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); notify(_text);
ExitProcess(); ExitProcess();
@ -69,15 +131,19 @@
:void lexer::load(dword _text) :void lexer::load(dword _text)
{ {
text = _text; text = _text;
count = 0;
str_buffer = 0;
} }
:dword lexer::next(void) :dword lexer::next(void)
{ {
char s; char s;
dword len_str_buf,tmp;
dword pos,in; dword pos,in;
pos = #const_token_lexer; pos = #const_token_lexer;
in = text; in = text;
//len_str_buf = 1024;
if(str_buffer)::free(str_buffer);
NEXT_TOKEN: NEXT_TOKEN:
length = 0; length = 0;
loop() loop()
@ -184,6 +250,7 @@
{ {
quote = s; quote = s;
in++; in++;
tmp = in;
s = DSBYTE[in]; s = DSBYTE[in];
loop() loop()
{ {
@ -210,9 +277,42 @@
DSBYTE[pos] = s; DSBYTE[pos] = s;
pos++; pos++;
in++; 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]; s = DSBYTE[in];
} }
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; type = LEX_STR;
} }
else { else {

View File

@ -10,6 +10,7 @@
#include "../lib/dll.h" #include "../lib/dll.h"
#endif #endif
dword NOT_INIT_LIBHTTP = true;
dword libHTTP = #alibHTTP; dword libHTTP = #alibHTTP;
char alibHTTP[23] = "/sys/lib/http.obj\0"; char alibHTTP[23] = "/sys/lib/http.obj\0";

View File

@ -107,7 +107,7 @@ void main() {
mouse_cfg.pointer_speed++; mouse_cfg.pointer_speed++;
SetMouseSpeed(mouse_cfg.pointer_speed); SetMouseSpeed(mouse_cfg.pointer_speed);
} }
if (id==121) && (mouse_cfg.pointer_speed>0) if (id==121) && (mouse_cfg.pointer_speed>1)
{ {
mouse_cfg.pointer_speed--; mouse_cfg.pointer_speed--;
SetMouseSpeed(mouse_cfg.pointer_speed); SetMouseSpeed(mouse_cfg.pointer_speed);