diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h index 07c59659d4..a5d1d51896 100644 --- a/programs/cmm/eolite/include/left_panel.h +++ b/programs/cmm/eolite/include/left_panel.h @@ -95,7 +95,7 @@ void GetSystemDiscs() strncpy(#disk_list[disc_num].Item, #sys_discs,l); disc_num++; } - if (strncmp(#sys_discs, "/rd/1/",6)==0) + if (!strncmp(#sys_discs, "/rd/1/",6)) { if (isdir("/kolibrios")) { diff --git a/programs/cmm/example/example.c b/programs/cmm/example/example.c index fec9a14133..a33527e486 100644 --- a/programs/cmm/example/example.c +++ b/programs/cmm/example/example.c @@ -1,8 +1,5 @@ #define MEMSIZE 0x3E80 -#include "..\lib\kolibri.h" #include "..\lib\strings.h" -#include "..\lib\mem.h" -#include "..\lib\file_system.h" void main() { @@ -19,7 +16,7 @@ void main() case evKey: key = GetKey(); - IF (key==013){ //Enter + if (key==013){ //Enter WriteText(50,90,0x80,0xFF00FF,"Pressed Enter"); } break; diff --git a/programs/cmm/experimental/easyshot/easyshot.c b/programs/cmm/experimental/easyshot/easyshot.c index 21cec73279..546dce4a29 100644 --- a/programs/cmm/experimental/easyshot/easyshot.c +++ b/programs/cmm/experimental/easyshot/easyshot.c @@ -1,8 +1,8 @@ #define MEMSIZE 0xFFFFF -#include "..\lib\kolibri.h" -#include "..\lib\strings.h" -#include "..\lib\mem.h" -#include "..\lib\gui.h" +#include "../lib/kolibri.h" +#include "../lib/strings.h" +#include "../lib/mem.h" +#include "../lib/gui.h" #ifndef AUTOBUILD #include "lang.h--" diff --git a/programs/cmm/experimental/ttf_performance/ttf_performance.c b/programs/cmm/experimental/ttf_performance/ttf_performance.c index 3fb6d02e0b..001531b3cc 100644 --- a/programs/cmm/experimental/ttf_performance/ttf_performance.c +++ b/programs/cmm/experimental/ttf_performance/ttf_performance.c @@ -1,10 +1,10 @@ #define MEMSIZE 397113 -#include "..\lib\kolibri.h" -#include "..\lib\strings.h" -#include "..\lib\mem.h" -#include "..\lib\file_system.h" -#include "..\lib\dll.h" -#include "..\lib\obj\truetype.h" +#include "../lib/kolibri.h" +#include "../lib/strings.h" +#include "../lib/mem.h" +#include "../lib/file_system.h" +#include "../lib/dll.h" +#include "../lib/obj/truetype.h" proc_info Form; dword font_data; diff --git a/programs/cmm/kolibrin/kolibrin.c b/programs/cmm/kolibrin/kolibrin.c index a1d358759f..36e7d7888f 100644 --- a/programs/cmm/kolibrin/kolibrin.c +++ b/programs/cmm/kolibrin/kolibrin.c @@ -1,5 +1,4 @@ #define MEMSIZE 0x9000 -#include "..\lib\kolibri.h" #include "..\lib\strings.h" #include "..\lib\mem.h" #include "..\lib\file_system.h" diff --git a/programs/cmm/lib/clipboard.h b/programs/cmm/lib/clipboard.h index 8f2746bcdd..3cccabab17 100644 --- a/programs/cmm/lib/clipboard.h +++ b/programs/cmm/lib/clipboard.h @@ -1,3 +1,10 @@ +#ifndef INCLUDE_CLIPBOARD_H +#define INCLUDE_CLIPBOARD_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + struct buffer_data { dword size; @@ -49,4 +56,6 @@ dword Clipboard::ResetBlockingBuffer() $mov eax, 54 $mov ebx, 3 $int 0x40 -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/copyf.h b/programs/cmm/lib/copyf.h index 8d43f172ad..cba87f6bd4 100644 --- a/programs/cmm/lib/copyf.h +++ b/programs/cmm/lib/copyf.h @@ -1,4 +1,10 @@ //copyf - copy file or folder with content +#ifndef INCLUDE_COPYF_H +#define INCLUDE_COPYF_H + +#ifndef INCLUDE_FILESYSTEM_H +#include "../lib/file_system.h" +#endif :int copyf(dword from1, in1) { @@ -75,16 +81,12 @@ for (i=0; i=192) + if (BL>=192) { - IF (BL>=240) ESBYTE[ESI] = BL - 16; - ELSE ESBYTE[ESI] = BL - 64; + if (BL>=240) ESBYTE[ESI] = BL - 16; + else ESBYTE[ESI] = BL - 64; } - ELSE + else { - IF (BL==178) ESBYTE[ESI] = 73; //I - IF (BL==179) ESBYTE[ESI] = 105; //i - IF (BL==175) ESBYTE[ESI] = 244; //J - IF (BL==191) ESBYTE[ESI] = 245; //j - IF (BL==170) ESBYTE[ESI] = 242; //E - IF (BL==186) ESBYTE[ESI] = 243; //e - IF (BL==168) ESBYTE[ESI] = 240; // - IF (BL==184) ESBYTE[ESI] = 'e'; //e - IF (BL==180) ESBYTE[ESI] = 254; // - IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34; - IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45; + if (BL==178) ESBYTE[ESI] = 73; //I + if (BL==179) ESBYTE[ESI] = 105; //i + if (BL==175) ESBYTE[ESI] = 244; //J + if (BL==191) ESBYTE[ESI] = 245; //j + if (BL==170) ESBYTE[ESI] = 242; //E + if (BL==186) ESBYTE[ESI] = 243; //e + if (BL==168) ESBYTE[ESI] = 240; // + if (BL==184) ESBYTE[ESI] = 'e'; //e + if (BL==180) ESBYTE[ESI] = 254; // + if ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34; + if ((BL==150) || (BL==151)) ESBYTE[ESI] = 45; } ESI++; } @@ -30,14 +36,14 @@ inline fastcall void wintodos( ESI) byte mas[66] = "椥娩㦢Ꞁ"; inline fastcall void koitodos( EDI) { - WHILE (BL=ESBYTE[EDI]) + while (BL=ESBYTE[EDI]) { - IF (BL >= 0xC0) + if (BL >= 0xC0) { BL -= 0xC0; ESBYTE[EDI] = mas[BL]; } - //IF (ESBYTE[EDI]=='\244') ESBYTE[EDI]='i'; + //if (ESBYTE[EDI]=='\244') ESBYTE[EDI]='i'; EDI++; } } @@ -49,27 +55,27 @@ inline fastcall void utf8rutodos( ESI) EDI=ESI; while (BL=ESBYTE[ESI]) { - IF (BL == 0xD0) || (BL == 0xD1) EDI--; - else IF (BL == 0x81) && (ESBYTE[ESI-1]==0xD0) ESBYTE[EDI] = 0xF0; // - else IF (BL == 0x91) && (ESBYTE[ESI-1]==0xD1) ESBYTE[EDI] = 0xF1; // + if (BL == 0xD0) || (BL == 0xD1) EDI--; + else if (BL == 0x81) && (ESBYTE[ESI-1]==0xD0) ESBYTE[EDI] = 0xF0; // + else if (BL == 0x91) && (ESBYTE[ESI-1]==0xD1) ESBYTE[EDI] = 0xF1; // //0xE2 0x80 - - else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) - SWITCH (ESBYTE[ESI+2]) + else if (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) + switch (ESBYTE[ESI+2]) { case 0x93: //long defis - CASE 0x94: + case 0x94: { ESBYTE[EDI] = '-'; ESI+=2; - BREAK; + break; } - CASE 0xA2: //central point + case 0xA2: //central point { ESBYTE[EDI] = '*'; ESI+=2; - BREAK; + break; } - CASE 0xA6: // + case 0xA6: // { ESBYTE[EDI] = ESBYTE[EDI+1] = ESBYTE[EDI+2] = '.'; EDI+=2; @@ -78,67 +84,67 @@ inline fastcall void utf8rutodos( ESI) } } - else IF (BL == 0xC2) // ? - SWITCH(ESBYTE[ESI+1]) { + else if (BL == 0xC2) // ? + switch(ESBYTE[ESI+1]) { case 0xAB: //" - CASE 0xBB: //" + case 0xBB: //" { ESBYTE[EDI] = '\"'; ESI++; - BREAK; + break; } - CASE 0xB7: // _ + case 0xB7: // _ { ESBYTE[EDI] = '_'; ESI++; - BREAK; + break; } - CASE 0xA0: // Alt+160 - + case 0xA0: // Alt+160 - { ESBYTE[EDI] = ' '; ESI++; - BREAK; + break; } - CASE 0xB0: // + case 0xB0: // { ESBYTE[EDI] = '\29'; ESI++; - BREAK; + break; } - CASE 0xA9: // (c) --- _ + case 0xA9: // (c) --- _ { ESBYTE[EDI] = 'c'; ESI++; - BREAK; + break; } - CASE 0xAE: // (r) + case 0xAE: // (r) { ESBYTE[EDI] = 'r'; ESI++; - BREAK; + break; } } - ELSE IF (BL >= 0x90) && (BL <= 0xAF) + else if (BL >= 0x90) && (BL <= 0xAF) { BL -= 0x10; ESBYTE[EDI] = BL; } - ELSE IF (BL >= 0x80) && (BL <= 0x8F) + else if (BL >= 0x80) && (BL <= 0x8F) { BL += 0x60; ESBYTE[EDI] = BL; } - ELSE IF (BL >= 0xB0) && (BL <= 0xBF) + else if (BL >= 0xB0) && (BL <= 0xBF) { BL -= 0x10; ESBYTE[EDI] = BL; } - ELSE ESBYTE[EDI] = BL; + else ESBYTE[EDI] = BL; ESI++; EDI++; } - WHILE (EDI='0') && (ch<='9')) ch -= '0'; - IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; - IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; + if (ch==0x0d) || (ch=='\9') RETURN 0; + if ((ch>='0') && (ch<='9')) ch -= '0'; + if ((ch>='A') && (ch<='F')) ch -= 'A'-10; + if ((ch>='a') && (ch<='f')) ch -= 'a'-10; symbol = symbol*0x10 + ch; } wintodos(#symbol); @@ -165,3 +171,4 @@ inline fastcall void utf8rutodos( ESI) } +#endif \ No newline at end of file diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index bad31a49c5..1267fabc91 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -1,3 +1,13 @@ +#ifndef INCLUDE_FILESYSTEM_H +#define INCLUDE_FILESYSTEM_H +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_STRING_H +#include "../lib/strings.h" +#endif + :struct f70{ dword func; dword param1; @@ -326,4 +336,5 @@ enum strcat(#size, " Kb"); return #size; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index 955b7ef9cb..9cec1ba1cf 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -1,4 +1,13 @@ -//#include "strings.h" +#ifndef INCLUDE_GUI_H +#define INCLUDE_GUI_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_STRING_H +#include "../lib/strings.h" +#endif :void DrawRectangle(dword x,y,w,h,color1) { @@ -168,4 +177,6 @@ col = strength * DSBYTE[color_image] / 10; DSBYTE[color_image] = col; } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index c591811442..8acf02c190 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -1,5 +1,5 @@ //CODED by Veliant, Leency, Nable. GNU GPL licence. - +#ifndef INCLUDE_KOLIBRI_H #define INCLUDE_KOLIBRI_H #startaddress 0 @@ -877,4 +877,6 @@ void load_init_main() __generator = GetStartTime(); //mem_Init(); main(); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/lexer.h b/programs/cmm/lib/lexer.h new file mode 100644 index 0000000000..a41c356d51 --- /dev/null +++ b/programs/cmm/lib/lexer.h @@ -0,0 +1,232 @@ +#ifndef INCLUDE_LEXER_H +#define INCLUDE_LEXER_H + +#ifndef INCLUDE_STRING_H +#include "../lib/strings.h" +#endif +/** Splits text into tokens + * Author :Pavel Yakovlev + * Homepage:https://vk.com/pavelyakov39 + */ + +/** Example: + * lexer lex; + * lex.load("var a=123;"); + * lex.next(); + * lex.token; //TOKEN == 'var' + * lex.type ; //TYPE == LEX_VAR + * + * lex.next(); + * lex.token; //TOKEN == 'a' + * lex.type ; //TYPE == LEX_VAR + * + * lex.next(); + * lex.token; //TOKEN == '=' + * lex.type ; //TYPE == LEX_IND + * + * lex.next(); + * lex.token; //TOKEN == '123' + * lex.type ; //TYPE == LEX_DEC + * + * lex.next(); + * lex.token; //TOKEN == ';' + * lex.type ; //TYPE == LEX_IND + * + * lex.next(); + * lex.token; //TOKEN == '' + * lex.type ; //TYPE == LEX_END + */ + +#define LEX_END 1 +#define LEX_STR 2 +#define LEX_DEC 3 +#define LEX_VAR 4 +#define LEX_FNC 5 +#define LEX_IND 6 +#define LEX_NUL 0 + +:char const_token_lexer[1024]; +:struct lexer +{ + byte cmd; + dword token,text; + byte type; + char quote; + signed count,length; + dword next(void); + dword back(void); + void load(dword _text); + void expected(dword _text); +}; + + +:void expected(dword _text) +{ + notify(_text); + ExitProcess(); +} + +:void lexer::load(dword _text) +{ + text = _text; +} + +:dword lexer::next(void) +{ + char s; + dword pos,in; + pos = #const_token_lexer; + in = text; + + NEXT_TOKEN: + length = 0; + loop() + { + s = DSBYTE[in]; + if(s!=9)&&(s!=10)&&(s!=13)&&(s!=32)break; + in++; + text++; + } + + if(s==0){type=LEX_END;DSBYTE[pos]=0;token="";return token;} + + if(s=='/') + { + in++; + s = DSBYTE[in]; + + // Line comments + if(s=='/') + { + loop() + { + in++; + s = DSBYTE[in]; + if(s==10)||(s==13)||(s==0)goto NEXT_TOKEN; + /* Add comments*/ + } + } + if(s=='*') + { + loop() + { + in++; + s = DSBYTE[in]; + if(s=='*')if(DSBYTE[in+1]=='/') + { + in+=2; + goto NEXT_TOKEN; + } + } + } + } + + if (strchr("=<>!~&|#",s)) + { + loop() + { + if (!strchr("=<>!~&|#",s)) break; + + DSBYTE[pos] = s; + pos++; + + in++; + s = DSBYTE[in]; + } + type = LEX_IND; + } + else if (strchr(";(,)}{[]+-.*/:^%?$@№`",s)) + { + DSBYTE[pos] = s; + pos++; + type = LEX_IND; + in++; + } + else if(s>='0')&&(s<='9') + { + loop() + { + if(s<'0')||(s>'9')if(s!='.')break; + + DSBYTE[pos] = s; + pos++; + + in++; + s = DSBYTE[in]; + } + type = LEX_DEC; + } + else if(s>='A')&&(s<='z')&&(!strchr("[]\\^`",s)) + { + loop() + { + if(s<'A')||(s>'z')if(s<'0')||(s>'9')break; + if(strchr("[]\\^`",s))break; + + DSBYTE[pos] = s; + pos++; + + in++; + s = DSBYTE[in]; + } + + loop() + { + s = DSBYTE[in]; + if(s!=9)if(s!=10)if(s!=13)if(s!=32)break; + in++; + text++; + } + type = LEX_VAR; + if(s=='(')type = LEX_FNC; + } + else if(s=='"')||(s=='\'') + { + quote = s; + in++; + s = DSBYTE[in]; + loop() + { + if(s=='\\') + { + in++; + s = DSBYTE[in]; + if(!s){type = LEX_STR;goto GOTO_LEX_END;} + if(!cmd)switch(s) + { + case 'n':s='\n';break; + case 'r':s='\r';break; + case 't':s='\t';break; + } + else { + DSBYTE[pos] = '\\'; + pos++; + } + goto LEX_STEP_1; + } + if(!s){type = LEX_STR;goto GOTO_LEX_END;} + else if(s==quote)break; + LEX_STEP_1: + DSBYTE[pos] = s; + pos++; + in++; + s = DSBYTE[in]; + } + in++; + type = LEX_STR; + } + else { + in++; + type = LEX_NUL; + DSBYTE[pos] = s; + pos++; + } + GOTO_LEX_END: + length = in-text; + text = in; + DSBYTE[pos] = 0; + token = #const_token_lexer; + return token; +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/list_box.h b/programs/cmm/lib/list_box.h index 9277446643..ff6dd50d6f 100644 --- a/programs/cmm/lib/list_box.h +++ b/programs/cmm/lib/list_box.h @@ -1,4 +1,10 @@ //list_box +#ifndef INCLUDE_LIST_BOX_H +#define INCLUDE_LIST_BOX_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif struct llist { @@ -150,4 +156,6 @@ int llist::KeyEnd() current=count-1; first=count-visible; return 1; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/mem.h b/programs/cmm/lib/mem.h index afae0f1491..4b44b7e1a6 100644 --- a/programs/cmm/lib/mem.h +++ b/programs/cmm/lib/mem.h @@ -1,7 +1,9 @@ +#ifndef INCLUDE_MEM_H +#define INCLUDE_MEM_H dword mem_init() { - $push ebx + $push ebx $mov eax, 68 $mov ebx, 11 $int 0x40 @@ -96,99 +98,4 @@ L2: #define mem_Free free #define mem_Init mem_init -/*:void fastcall memsetz( EDI, ECX) -{ - asm { - XOR EAX, EAX - MOV EDX, ECX - SHR ECX, 2 - REP STOSD - MOV ECX, EDX - AND ECX, 3 - REP STOSB - } -} - -:void fastcall memset( EDI, ECX, AL) //copy AL to EDI of ECX num (void *dest, size_t, char c ) -{ - asm { - MOV AH, AL - MOVZX EDX, AX - SHL EAX, 16 - OR EAX, EDX - MOV EDX, ECX - SHR ECX, 2 - REP STOSD - MOV ECX, EDX - AND ECX, 3 - REP STOSB - } -} - -:void fastcall memsetd( EDI, ECX, EAX) -{ - asm { - REP STOSD - } -} - -:void fastcall memcpyd( EDI, ESI, ECX) -{ - asm { - REP MOVSD - } -} - -:void fastcall memmov( EDI, ESI, ECX) -{ - asm { - MOV EAX, ECX - CMP EDI, ESI - JG L1 - JE L2 - SAR ECX, 2 - JS L2 - REP MOVSD - MOV ECX, EAX - AND ECX, 3 - REP MOVSB - JMP SHORT L2 -L1: LEA ESI, DSDWORD[ ESI+ECX-4] - LEA EDI, DSDWORD[ EDI+ECX-4] - SAR ECX, 2 - JS L2 - STD - REP MOVSD - MOV ECX, EAX - AND ECX, 3 - ADD ESI, 3 - ADD EDI, 3 - REP MOVSB - CLD -L2: - } -} - -:long fastcall memcmp( ESI, EDI, ECX) -{ - asm { - MOV EAX, ECX - SHR ECX, 2 - REPE CMPSD - MOV ECX, EAX - AND ECX, 3 - REPE CMPSB - XOR EAX, EAX - XOR ECX, ECX - MOV AL, DSBYTE[ ESI-1] - MOV CL, DSBYTE[ EDI-1] - SUB EAX, ECX - } -}*/ - - -/*#define memzset memsetz -#define memset0 memsetz -#define mem0set memsetz -#define memset32 memsetd -#define memcpy32 memcpyd*/ +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/box_lib.h b/programs/cmm/lib/obj/box_lib.h index bdef2035ed..1dafc4e88f 100644 --- a/programs/cmm/lib/obj/box_lib.h +++ b/programs/cmm/lib/obj/box_lib.h @@ -1,4 +1,15 @@ //BOX_LIB - Asper +#ifndef INCLUDE_BOX_LIB_H +#define INCLUDE_BOX_LIB_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif + dword boxlib = #aEdit_box_lib; char aEdit_box_lib[]="/sys/lib/box_lib.obj"; @@ -169,4 +180,6 @@ struct frame dword font_size_y; dword font_color; dword font_backgr_color; -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/http.h b/programs/cmm/lib/obj/http.h index 1440e28b48..40e6df259c 100644 --- a/programs/cmm/lib/obj/http.h +++ b/programs/cmm/lib/obj/http.h @@ -1,4 +1,14 @@ //HTTP library +#ifndef INCLUDE_LIBHTTP_H +#define INCLUDE_LIBHTTP_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif dword libHTTP = #alibHTTP; char alibHTTP[23] = "/sys/lib/http.obj\0"; @@ -65,4 +75,6 @@ struct http_msg{ :dword file_get_contents(dword url,...) { http_get(url,FLAG_HTTP11,""); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/iconv.h b/programs/cmm/lib/obj/iconv.h index 39f3681603..7181286b44 100644 --- a/programs/cmm/lib/obj/iconv.h +++ b/programs/cmm/lib/obj/iconv.h @@ -1,4 +1,14 @@ //convert text characters +#ifndef INCLUDE_LIBICONV_H +#define INCLUDE_LIBICONV_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif dword iconv_lib = #a_iconv_lib; char a_iconv_lib[19]="/sys/lib/iconv.obj\0"; @@ -56,4 +66,6 @@ enum { CH_CP1252, CH_ISO8859_5, CH_CP866 -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/libimg_lib.h b/programs/cmm/lib/obj/libimg_lib.h index ec22b73d8a..ffdb616e0a 100644 --- a/programs/cmm/lib/obj/libimg_lib.h +++ b/programs/cmm/lib/obj/libimg_lib.h @@ -1,4 +1,24 @@ //Asper +#ifndef INCLUDE_LIBIMG_H +#define INCLUDE_LIBIMG_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_MEM_H +#include "../lib/mem.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif + +#ifndef INCLUDE_LIBIO_H +#include "../lib/obj/libio_lib.h" +#endif + +:byte init_imglib_check; //library dword libimg = #alibimg; @@ -100,3 +120,5 @@ dword load_image(dword filename) $stc return 0; } + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/libini.h b/programs/cmm/lib/obj/libini.h index 6c34989bf1..56d574f3d2 100644 --- a/programs/cmm/lib/obj/libini.h +++ b/programs/cmm/lib/obj/libini.h @@ -1,3 +1,14 @@ +#ifndef INCLUDE_LIBINI_H +#define INCLUDE_LIBINI_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif + dword libini = #alibini; char alibini[] = "/sys/lib/libini.obj"; @@ -23,3 +34,5 @@ char aini_set_int[] = "ini_set_int"; //char aini_get_shortcut[] = "ini_get_shortcut"; char aini_get_color[] = "ini_get_color"; //char aini_set_color[] = "ini_set_color"; + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/libio_lib.h b/programs/cmm/lib/obj/libio_lib.h index 5af34f94a3..4f6e1c99a6 100644 --- a/programs/cmm/lib/obj/libio_lib.h +++ b/programs/cmm/lib/obj/libio_lib.h @@ -1,4 +1,14 @@ //Asper +#ifndef INCLUDE_LIBIO_H +#define INCLUDE_LIBIO_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif //library dword libio = #alibio; @@ -32,3 +42,5 @@ char afile_close[12] = "file_close\0"; #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/netcode.h b/programs/cmm/lib/obj/netcode.h index 8a1383955c..a47c1d1924 100644 --- a/programs/cmm/lib/obj/netcode.h +++ b/programs/cmm/lib/obj/netcode.h @@ -1,5 +1,14 @@ //Network library +#ifndef INCLUDE_NETCODE_H +#define INCLUDE_NETCODE_H +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif dword netcode_lib = #a_netcode_lib; char a_netcode_lib[21]="/sys/lib/netcode.obj\0"; @@ -16,4 +25,6 @@ char aQp_decode[10] = "qp_decode\0"; Кодирование массива inp длиной len в массив outp (строку с '\0'). Функция возвращает длину outp. int base64_decode(char inp[], char outp[], int len); -Декодирование массива inp длиной len в массив outp (строку с '\0'). Функция возвращает длину outp.*/ \ No newline at end of file +Декодирование массива inp длиной len в массив outp (строку с '\0'). Функция возвращает длину outp.*/ + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/network.h b/programs/cmm/lib/obj/network.h index df58bae298..37132a37c4 100644 --- a/programs/cmm/lib/obj/network.h +++ b/programs/cmm/lib/obj/network.h @@ -1,5 +1,14 @@ //Network library +#ifndef INCLUDE_NETWORK_H +#define INCLUDE_NETWORK_H +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif dword network_lib = #a_network_lib; char a_network_lib[21]="/sys/lib/network.obj\0"; @@ -61,3 +70,5 @@ struct addrinfo { struct addrinfo *ai_next; }; */ + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/proc_lib.h b/programs/cmm/lib/obj/proc_lib.h index c77bcea262..1835ddd374 100644 --- a/programs/cmm/lib/obj/proc_lib.h +++ b/programs/cmm/lib/obj/proc_lib.h @@ -1,3 +1,13 @@ +#ifndef INCLUDE_PROCLIB_H +#define INCLUDE_PROCLIB_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif dword Proc_lib = #aProc_lib; char aProc_lib[] = "/sys/lib/proc_lib.obj"; @@ -31,3 +41,4 @@ struct opendialog word y_start; }; +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/truetype.h b/programs/cmm/lib/obj/truetype.h index ae070cbe0e..b51997891f 100644 --- a/programs/cmm/lib/obj/truetype.h +++ b/programs/cmm/lib/obj/truetype.h @@ -1,5 +1,14 @@ // Truetype library +#ifndef INCLUDE_LIBTRUETYPE_H +#define INCLUDE_LIBTRUETYPE_H +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif dword libtruetype = #att_libtruetype; char att_libtruetype[22] = "/sys/lib/truetype.obj\0"; @@ -35,3 +44,5 @@ struct stbtt_fontinfo int index_map; // a cmap mapping for our chosen character encoding int indexToLocFormat; // format needed to map from glyph index to glyph }; + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/xml.h b/programs/cmm/lib/obj/xml.h index 2b98596988..9a98cbe07e 100644 --- a/programs/cmm/lib/obj/xml.h +++ b/programs/cmm/lib/obj/xml.h @@ -1,3 +1,13 @@ +#ifndef INCLUDE_LIBXML_H +#define INCLUDE_LIBXML_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_DLL_H +#include "../lib/dll.h" +#endif dword XML = #aXML_lib; char aXML_lib[] = "/sys/lib/xml.obj"; @@ -123,4 +133,6 @@ struct AXParseContext dword strict; // (int) dword reserved1; // (int) AXElement reserved2; // (AXElement) -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/patterns/libimg_load_skin.h b/programs/cmm/lib/patterns/libimg_load_skin.h index 546f2a9ee9..cc9fd51a8c 100644 --- a/programs/cmm/lib/patterns/libimg_load_skin.h +++ b/programs/cmm/lib/patterns/libimg_load_skin.h @@ -1,3 +1,10 @@ +#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H +#define INCLUDE_LIBIMG_LOAD_SKIN_H + +#ifndef INCLUDE_LIBIMG_H +#include "../lib/obj/libimg_lib.h" +#endif + struct libimg_image { dword image, w, h; }; @@ -18,4 +25,6 @@ struct libimg_image { image_data = ESDWORD[struct_pointer + 24]; max_i = w * h * 4 + image_data; for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/patterns/restart_process.h b/programs/cmm/lib/patterns/restart_process.h index 60385825b8..30f7120deb 100644 --- a/programs/cmm/lib/patterns/restart_process.h +++ b/programs/cmm/lib/patterns/restart_process.h @@ -1,3 +1,10 @@ +#ifndef INCLUDE_RESTART_PROCESS_H +#define INCLUDE_RESTART_PROCESS_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + enum { MULTIPLE, SINGLE @@ -16,4 +23,6 @@ void RestartProcessByName(dword proc_name, byte multiple) { } } RunProgram(proc_name, ""); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/random.h b/programs/cmm/lib/random.h index fa376e9043..232d434cba 100644 --- a/programs/cmm/lib/random.h +++ b/programs/cmm/lib/random.h @@ -1,23 +1,10 @@ -/******************************************************************************* +#ifndef INCLUDE_RANDOM_H +#define INCLUDE_RANDOM_H - MenuetOS MineSweeper - Copyright (C) 2003 Ivan Poddubny +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*******************************************************************************/ #define MASK_RAND 123456789 #define IQ_RAND 12773 #define IA_RAND 16807 @@ -93,3 +80,4 @@ inline fastcall randomize() __generator = EAX; } +#endif \ No newline at end of file diff --git a/programs/cmm/lib/socket.h b/programs/cmm/lib/socket.h index c18f9d7d45..a80dc0ddd5 100644 --- a/programs/cmm/lib/socket.h +++ b/programs/cmm/lib/socket.h @@ -1,96 +1,106 @@ -#define SOCK_STREAM 1 -#define SOCK_DGRAM 2 - -#define AF_INET4 2 - -#define MSG_PEEK 0x02 -#define MSG_DONTWAIT 0x40 - -dword errorcode; - -struct sockaddr_in{ - word sin_family; - word sin_port; - dword sin_addr; - char padding[8]; -}; - -inline fastcall dword Socket(ECX, EDX, ESI) -{ - $push ebx - $mov eax, 75 - $mov ebx, 0 - $int 0x40 - errorcode = EBX; - $pop ebx -} - -inline fastcall dword Close(ECX) -{ - $push ebx - $mov eax, 75 - $mov ebx, 1 - $int 0x40 - errorcode = EBX; - $pop ebx -} - -inline fastcall dword Bind(ECX, EDX, ESI) -{ - $push ebx - $mov eax, 75 - $mov ebx, 2 - $int 0x40 - errorcode = EBX; - $pop ebx -} - -inline fastcall dword Listen(ECX, EDX) -{ - $push ebx - $mov eax, 75 - $mov ebx, 3 - $int 0x40 - errorcode = EBX; - $pop ebx -} - -inline fastcall dword Connect(ECX, EDX, ESI) -{ - $push ebx - $mov eax, 75 - $mov ebx, 4 - $int 0x40 - errorcode = EBX; - $pop ebx -} - -inline fastcall dword Accept(ECX, EDX, ESI) -{ - $push ebx - $mov eax, 75 - $mov ebx, 5 - $int 0x40 - errorcode = EBX; - $pop ebx -} - -inline fastcall dword Send(ECX, EDX, ESI, EDI) -{ - $push ebx - $mov eax, 75 - $mov ebx, 6 - $int 0x40 - errorcode = EBX; - $pop ebx -} - -inline fastcall dword Receive(ECX, EDX, ESI, EDI) -{ - $push ebx - $mov eax, 75 - $mov ebx, 7 - $int 0x40 - errorcode = EBX; - $pop ebx -} +#ifndef INCLUDE_SOCKET_H +#define INCLUDE_SOCKET_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 + +#define AF_INET4 2 + +#define MSG_PEEK 0x02 +#define MSG_DONTWAIT 0x40 + +dword errorcode; + +struct sockaddr_in +{ + word sin_family; + word sin_port; + dword sin_addr; + char padding[8]; +}; + +inline fastcall dword Socket(ECX, EDX, ESI) +{ + $push ebx + $mov eax, 75 + $mov ebx, 0 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +inline fastcall dword Close(ECX) +{ + $push ebx + $mov eax, 75 + $mov ebx, 1 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +inline fastcall dword Bind(ECX, EDX, ESI) +{ + $push ebx + $mov eax, 75 + $mov ebx, 2 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +inline fastcall dword Listen(ECX, EDX) +{ + $push ebx + $mov eax, 75 + $mov ebx, 3 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +inline fastcall dword Connect(ECX, EDX, ESI) +{ + $push ebx + $mov eax, 75 + $mov ebx, 4 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +inline fastcall dword Accept(ECX, EDX, ESI) +{ + $push ebx + $mov eax, 75 + $mov ebx, 5 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +inline fastcall dword Send(ECX, EDX, ESI, EDI) +{ + $push ebx + $mov eax, 75 + $mov ebx, 6 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +inline fastcall dword Receive(ECX, EDX, ESI, EDI) +{ + $push ebx + $mov eax, 75 + $mov ebx, 7 + $int 0x40 + errorcode = EBX; + $pop ebx +} + +#endif \ No newline at end of file diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index 5f215cc22a..b5b34379bd 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -1,3 +1,14 @@ +#ifndef INCLUDE_STRING_H +#define INCLUDE_STRING_H + +#ifndef INCLUDE_KOLIBRI_H +#include "../lib/kolibri.h" +#endif + +#ifndef INCLUDE_MEM_H +#include "../lib/mem.h" +#endif + //------------------------------------------------------------------------------ // strspn(dword text1,text2) --- example: strspn("12 year","1234567890") -> return 2 // strpbrk(dword text1,text2) --- example: strpbrk("this test", " ckfi") -> return "is test" @@ -39,6 +50,8 @@ inline fastcall signed int strcmp( ESI, EDI) } */ + + inline int strspn(dword text1,text2) { dword beg; @@ -376,7 +389,7 @@ inline fastcall void chrcat(ESI, BL) } -inline fastcall signed int strchr( ESI,BL) +/*inline fastcall signed int strchr( ESI,BL) { int jj=0; do{ @@ -385,8 +398,19 @@ inline fastcall signed int strchr( ESI,BL) IF(AL==BL) return jj; } while(AL!=0); return 0; -} +}*/ +inline dword strchr(dword shb;char s) +{ + char ss; + loop() + { + ss = DSBYTE[shb]; + if(!ss)return 0; + if(ss==s)return shb; + shb++; + } +} inline fastcall signed int strrchr( ESI,BL) { @@ -732,28 +756,50 @@ inline dword hexdec(dword text) { char s; dword ret,l; - //l = strlen(text); ret = 0; s = DSBYTE[text]; - //if(l==6) while(s) { ret <<= 4; if(s>='A')&&(s<='F')ret |= s-'A'+10; else if(s>='a')&&(s<='f')ret |= s-'a'+10; - else if(s>='0')&&(s<='9')ret |= s-'a'+10; + else if(s>='0')&&(s<='9')ret |= s-'0'; text++; s = DSBYTE[text]; } - /*else if(l==3) while(s) + return ret; +} + +inline signed csshexdec(dword text) +{ + char s; + dword ret,l; + byte tmp; + l = strlen(text); + ret = 0; + s = DSBYTE[text]; + tmp = 0; + if(l==6) while(s) { ret <<= 4; if(s>='A')&&(s<='F')ret |= s-'A'+10; else if(s>='a')&&(s<='f')ret |= s-'a'+10; - else if(s>='0')&&(s<='9')ret |= s-'a'+10; + else if(s>='0')&&(s<='9')ret |= s-'0'; text++; s = DSBYTE[text]; - }*/ + } + else if(l==3) while(s) + { + ret |= tmp; + ret <<= 4; + ret |= tmp; + ret <<= 4; + if(s>='A')&&(s<='F')tmp = s-'A'+10; + else if(s>='a')&&(s<='f')tmp = s-'a'+10; + else if(s>='0')&&(s<='9')tmp = s-'0'; + text++; + s = DSBYTE[text]; + } return ret; } @@ -841,6 +887,19 @@ inline cdecl int sprintf(dword buf, format,...) return buf-ret; } +inline signed strcoll(dword text1,text2) +{ + char s,ss; + loop() + { + s = DSBYTE[text2]; + ss=strchr(text1,s); + if(ss)return ss; + text2++; + } + return 0; +} + inline void debugi(dword d_int) { char tmpch[12]; @@ -854,3 +913,4 @@ inline void debugi(dword d_int) #define stricmp strcmpi #define strcmpn strncmp +#endif \ No newline at end of file