c-- libs partly updated

git-svn-id: svn://kolibrios.org@3106 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-12-14 23:55:44 +00:00
parent f12d8abc6a
commit 14d166eb1e
5 changed files with 92 additions and 35 deletions

View File

@ -170,13 +170,4 @@ dword Hex2Symb(char* htmlcolor)
}
wintodos(#symbol);
AL=symbol;
}
/*
int hex2char(dword c)
{
if (c <=9)
return (c+48);
return (c - 10 + 'a');
}*/
}

View File

@ -17,7 +17,7 @@ void DrawRectangle3D(dword x,y,width,height,color1,color2)
void DrawCaptButton(dword x,y,width,height,id,color_b, color_t,text,text_len)
{
DefineButton(x,y,width,height,id,color_b);
WriteText(-text_len*6+width/2+x+1,height/2-3+y,0x80,color_t,text,0);
WriteText(-text_len*6+width/2+x+1,height/2-3+y,0x80,color_t,text);
}
void DrawCircle(int x, y, r)
@ -31,3 +31,27 @@ void DrawCircle(int x, y, r)
py = -px / r + py;
}
}
void CheckBox(dword x,y,w,h, bt_id, text, graph_color, text_color, is_checked)
{
DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, graph_color);
WriteText(x+w+10, h / 2 + y -3, 0x80, text_color, text);
DrawRectangle(x, y, w, h, graph_color);
if (is_checked == 1)
{
DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
DrawBar(x+2, y+2, w-3, h-3, graph_color);
return; //не дадим стрелять себе в ногу
}
if (is_checked == 2) //not active
{
DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
DrawBar(x+2, y+2, w-3, h-3, 0x888888);
return;
}
else
{
DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff);
DrawBar(x+2, y+2, w-3, h-3, 0xffffff);
}
}

View File

@ -0,0 +1,41 @@
//Network library
dword iconv_lib = #a_iconv_lib;
char a_iconv_lib[19]="/sys/lib/iconv.obj\0";
dword iconv_open = #aIconv_open;
dword iconv = #aIconv;
dword am5__ = 0x0;
dword bm5__ = 0x0;
char aIconv_open[11] = "iconv_open\0";
char aIconv[6] = "iconv\0";
dword ChangeCharset(dword from_chs, to_chs, conv_buf)
{
dword cd, in_len, out_len, new_buf;
debug (from_chs);
debug (to_chs);
iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5
if (EAX==-1) { debug("iconv: wrong charset,\nuse only CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5"); return 0; }
cd = EAX;
in_len = out_len = strlen(conv_buf);
new_buf = mem_Alloc(in_len);
iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len);
cd = EAX;
if (cd!=0)
{
debug("iconv: semething is wrong with stdcall iconv()");
debug(itoa(cd));
debug("in_len");
debug(itoa(in_len));
debug("out_len");
debug(itoa(out_len));
new_buf = 0;
}
return new_buf;
}

View File

@ -0,0 +1,21 @@
//Network library
dword netcode_lib = #a_netcode_lib;
char a_netcode_lib[21]="/sys/lib/netcode.obj\0";
dword base64_encode = #aBase64_encode;
dword base64_decode = #aBase64_decode;
dword qp_decode = #aQp_decode;
dword am4__ = 0x0;
dword bm4__ = 0x0;
char aBase64_encode[14] = "base64_encode\0";
char aBase64_decode[14] = "base64_decode\0";
char aQp_decode[10] = "qp_decode\0";
/*int base64_encode(char inp[], char outp[], int len);
Кодирование массива inp длиной len в массив outp (строку с '\0'). Функция возвращает длину outp.
int base64_decode(char inp[], char outp[], int len);
Декодирование массива inp длиной len в массив outp (строку с '\0'). Функция возвращает длину outp.*/

View File

@ -34,33 +34,13 @@ itoa(addr&0xFF) — это 10
dword GetIPfromAdress(dword addr)
{
dword lpointer;
dword lpointer, IPa;
getaddrinfo stdcall (addr, 0, 0, #lpointer);
if (EAX!=0) return 0; //если ошибка
return DSDWORD[DSDWORD[lpointer+24]+4];
if (EAX!=0) IPa = 0; else IPa = DSDWORD[DSDWORD[lpointer+24]+4];
freeaddrinfo stdcall (lpointer);
return IPa;
}
/*dword GetIPfromAdressASM(dword addr)
{
dword lpointer;
ESP=#lpointer;
$push esp // lpointer
$push esp // fourth parameter
$push 0 // third parameter
$push 0 // second parameter
EAX = addr;
$push eax // first parameter
$call getaddrinfo
if (EAX!=0) return 0; //ошибка
$pop esi
$mov ebx, DSDWORD[lpointer+24]
$mov eax, DSDWORD[EBX+4]
return EAX;
}*/
/*
//Convert the string from standard IPv4 dotted notation to integer IP addr.
inet_addr stdcall ("192.168.0.1");