Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 5498 → Rev 5499

/programs/cmm/lib/obj/box_lib.h
0,0 → 1,172
//BOX_LIB - Asper
dword boxlib = #aEdit_box_lib;
char aEdit_box_lib[]="/sys/lib/box_obj";
 
dword box_lib_init = #aboxlib_init;
 
dword edit_box_draw = #aEdit_box_draw;
dword edit_box_key = #aEdit_box_key;
dword edit_box_mouse = #aEdit_box_mouse;
dword version_ed = #aVersion_ed;
 
dword scrollbar_v_draw = #aScrollbar_v_draw;
dword scrollbar_v_mouse = #aScrollbar_v_mouse;
dword scrollbar_h_draw = #aScrollbar_h_draw;
dword scrollbar_h_mouse = #aScrollbar_h_mouse;
dword version_scrollbar = #aVersion_scrollbar;
 
dword PathShow_prepare = #aPathShow_prepare;
dword PathShow_draw = #aPathShow_draw;
 
dword progressbar_draw = #aProgressbar_draw;
dword progressbar_progress = #aProgressbar_progress;
 
dword check_box_draw = #aCheck_box_draw;
dword check_box_mouse = #aCheck_box_mouse;
dword version_ch = #aVersion_ch;
 
dword frame_draw = #aFrame_draw;
 
$DD 2 dup 0
 
char aEdit_box_draw [] = "edit_box";
char aEdit_box_key [] = "edit_box_key";
char aEdit_box_mouse[] = "edit_box_mouse";
char aVersion_ed [] = "version_ed";
 
char aboxlib_init[] = "lib_init";
char aScrollbar_v_draw [] = "scrollbar_v_draw";
char aScrollbar_v_mouse[] = "scrollbar_v_mouse";
char aScrollbar_h_draw [] = "scrollbar_h_draw";
char aScrollbar_h_mouse[] = "scrollbar_h_mouse";
char aVersion_scrollbar[] = "version_scrollbar";
 
char aCheck_box_draw [] = "check_box_draw2";
char aCheck_box_mouse [] = "check_box_mouse2";
char aVersion_ch [] = "version_ch2";
 
char aOption_box_draw [] = "option_box_draw";
char aOption_box_mouse [] = "option_box_mouse";
char aVersion_op [] = "version_op" ;
 
char aPathShow_prepare [] = "PathShow_prepare";
char aPathShow_draw [] = "PathShow_draw";
 
char aProgressbar_draw [] = "progressbar_draw";
char aProgressbar_progress[] = "progressbar_progress";
 
char aFrame_draw[] = "frame_draw";
 
 
struct PathShow_data
{
dword type;
word start_y,
start_x,
font_size_x, // 6 - for font 0, 8 - for font 1
area_size_x;
dword font_number, // 0 - monospace, 1 - variable
background_flag,
font_color,
background_color,
text_pointer,
work_area_pointer,
temp_text_length;
};
/*
char temp[128];
PathShow_data PathShow = {0, 100,20, 6, 200, 0, 1, 0x0, 0xFFFfff, #email_text, #temp, 0};
PathShow_prepare stdcall(#PathShow);
PathShow_draw stdcall(#PathShow);
*/
 
 
struct edit_box{
dword width, left, top, color, shift_color, focus_border_color, blur_border_color,
text_color, max, text, mouse_variable, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old;
};
 
struct checkbox2
{
dword
left_s,
top_s,
ch_text_margin,
color,
border_color,
text_color,
text,
flags,
size_of_str;
};
 
//flags for checkbox2
#define CH_FLAG_EN 10b
#define CH_FLAG_TOP 0x0
#define CH_FLAG_MIDDLE 100b
#define CH_FLAG_BOTTOM 1000b
 
struct scroll_bar
{
word size_x,
start_x,
size_y,
start_y;
dword btn_height,
type,
max_area,
cur_area,
position,
bckg_col,
frnt_col,
line_col,
redraw;
word delta,
delta2,
r_size_x,
r_start_x,
r_size_y,
r_start_y;
dword m_pos,
m_pos_2,
m_keys,
run_size,
position2,
work_size,
all_redraw,
ar_offset;
};
 
struct progress_bar
{
dword
value,
left,
top,
width,
height,
style,
min,
max,
back_color,
progress_color,
frame_color;
};
 
struct frame
{
dword type;
word size_x;
word start_x;
word size_y;
word start_y;
dword ext_col;
dword int_col;
dword draw_text_flag; // 0-not,1-yes
dword text_pointer;
dword text_position; // 0-up,1-bottom
dword font_number; // 0-monospace,1-variable
dword font_size_y;
dword font_color;
dword font_backgr_color;
};
/programs/cmm/lib/obj/xml.h
0,0 → 1,126
dword XML = #aXML_lib;
char aXML_lib[] = "/sys/lib/xml.obj";
 
dword XML_lib_init = #aXMLlib_init;
 
dword initializeParser = #aInitializeParser;
dword releaseParser = #aReleaseParser;
dword parse = #aParse;
dword initializeClassParser = #aInitializeClassParser;
dword releaseCkassParser = #aReleaseClassParser;
dword classFromElement = #aClassFromElement;
dword classFromString = #aClassFromString;
 
$DD 2 dup 0
 
char aXMLlib_init [] = "lib_init";
char aInitializeParser[] = "ax_initializeParser";
char aReleaseParser[] = "ax_releaseParser";
char aParse[] = "ax_parse";
char aInitializeClassParser[] = "ax_initializeClassParser";
char aReleaseClassParser[] = "ax_releaseClassParser";
char aClassFromElement[] = "ax_classFromElement";
char aClassFromString[] = "ax_classFromString";
 
//-----------------------------------------------------------------------------
// Error Codes
//-----------------------------------------------------------------------------
#define RC_OK 0 // everything is ok
#define RC_MEMORY 1 // out of memory
 
#define RC_EMPTY_NAME 10 // name empty or not defined
#define RC_ATTR_DEFINED 11 // attribute already defined
#define RC_ELEM_DEFINED 12 // element already defined
#define RC_SCHEMA_EMPTY 13 // schema does not contains a document
#define RC_DOCUMENT_DEFINED 14 // schema contains more than one document
#define RC_UNDEFINED_CLASS 15 // can't find collection in reference
#define RC_UNDEFINED_GROUP 16 // can't find a group in include
#define RC_INVALID_ID 17 // id is not a valid number
#define RC_INVALID_IGNORE 18 // ignore is not 'yes' or 'no'
 
#define RC_INVALID_ENTITY_REFERENCE 20 // must be amp, quot, lt, gt, or apos
#define RC_UNEXPECTED_END 21 // found last char too early
#define RC_INVALID_CHAR 22 // wrong char
#define RC_OVERFLOW 23 // number to big in char reference
#define RC_NO_START_TAG 24 // xml does not start with a tag
#define RC_TAG_MISMATCH 25 // invalid close tag
#define RC_INVALID_TAG 26 // invalid root element
#define RC_INVALID_ATTRIBUTE 27 // unknown attribute
#define RC_INVALID_PI 28 // invalid processing instruction (<?xml)
#define RC_INVALID_DOCTYPE 29 // duplicate doctype or after main element
#define RC_VERSION_EXPECTED 30 // version is missing in xml declaration
 
//-----------------------------------------------------------------------------
// Structures
//-----------------------------------------------------------------------------
 
struct AXElementClass
{
dword offset; // (int) Offset of the element in attribute list
dword name; // (char*) Name of the element (not zero terminated)
dword nameLimit; // (char*) End of the name of the element
dword size; // (unsigned int) size in bytes of an element of this class
dword id; // (unsigned int) container, text or mixed
dword type; // (unsigned int) container, text or mixed
dword propertyCount; // (unsigned int) number of attributes and text elements
dword childCount; // (unsigned int) number of child classes
dword attributes; // (int*) (internal) attribute map
dword elements; // (int*) (internal) element map
dword children; // (AXElementClass*) The list of child classes.
// The order is the one defined in the class
// definition file.
dword reserved; // (int)
dword reserved2; // (void*)
};
 
struct AXClassContext
{
dword base; // (void*)
dword limit; // (void*)
dword chunks; // (void*)
dword chunkSize; // (int)
dword errorCode; // (int)
dword line; // (int)
dword column; // (int)
dword classes; // (AXElementClass**) all global classes
dword rootClass; // (AXElementClass*) the root class
dword rootElement; // (AXElement*)
};
 
struct AXAttribute
{
dword begin; // (const char*) the value (not zero terminated)
// This slot can also contain an element if
// a <element> has been defined in schema;
// use ax_getElement() to retrieve it.
dword limit; // (const char*) the end of the value
};
 
struct AXElement
{
dword id; // (int) the class of the element
dword nextSibling; // (AXElement*) the next sibling element
dword firstChild; // (AXElement*) the first child element
dword lastChild; // (AXElement*) the last child element
AXAttribute reserved; // (AXAttribute) do not use
AXAttribute attributes; // (AXAttribute[]) the array of attributes
};
 
struct AXParseContext
{
dword base; // (void*)
dword limit; // (void*)
dword chunks; // (void*)
dword chunkSize; // (int)
dword errorCode; // (int)
dword source; // (const char*)
dword current; // (const char*)
dword line; // (int)
dword column; // (int)
dword root; // (AXElement*)
AXAttribute version; // (AXAttribute)
AXAttribute encoding; // (AXAttribute)
dword strict; // (int)
dword reserved1; // (int)
AXElement reserved2; // (AXElement)
};
/programs/cmm/lib/obj/libini.h
0,0 → 1,25
dword libini = #alibini;
char alibini[] = "/sys/lib/libini.obj";
 
dword lib_init = #alib_init;
dword ini_enum_sections = #aini_enum_sections;
dword ini_enum_keys = #aini_enum_keys;
dword ini_get_str = #aini_get_str;
dword ini_get_int = #aini_get_int;
dword ini_get_color = #aini_get_color;
dword ini_set_str = #aini_set_str;
dword ini_set_int = #aini_set_int;
//dword ini_set_color = #aini_set_color;
//dword ini_get_shortcut = #aini_get_shortcut;
$DD 2 dup 0
 
char alib_init[] = "lib_init";
char aini_enum_sections[] = "ini_enum_sections";
char aini_enum_keys[] = "ini_enum_keys";
char aini_get_str[] = "ini_get_str";
char aini_get_int[] = "ini_get_int";
char aini_set_str[] = "ini_set_str";
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";
/programs/cmm/lib/obj/http.h
0,0 → 1,56
//HTTP library
 
dword libHTTP = #alibHTTP;
char alibHTTP[23] = "/sys/lib/http.obj\0";
 
dword http_lib_init = #aLib_init;
dword http_get = #aHTTPget;
dword http_head = #aHTTPhead;
dword http_post = #aHTTPpost;
dword http_find_header_field = #aFHF;
dword http_process = #aHTTPprocess;
dword http_free = #aHTTPfree;
dword http_stop = #aHTTPstop;
dword uri_escape = #aURIescape;
dword uri_unescape = #aURIunescape;
$DD 2 dup 0
 
char aLib_init[9] = "lib_init\0";
char aHTTPget[4] = "get\0";
char aHTTPhead[5] = "head\0";
char aHTTPpost[5] = "post\0";
char aFHF[18] = "find_header_field\0";
char aHTTPprocess[8] = "process\0";
char aHTTPfree[5] = "free\0";
char aHTTPstop[5] = "stop\0";
char aURIescape[7] = "escape\0";
char aURIunescape[9] = "unescape\0";
 
#define FLAG_HTTP11 1 << 0
#define FLAG_GOT_HEADER 1 << 1
#define FLAG_GOT_ALL_DATA 1 << 2
#define FLAG_CONTENT_LENGTH 1 << 3
#define FLAG_CHUNKED 1 << 4
#define FLAG_CONNECTED 1 << 5
 
// error flags go into the upper word
#define FLAG_INVALID_HEADER 1 << 16
#define FLAG_NO_RAM 1 << 17
#define FLAG_SOCKET_ERROR 1 << 18
#define FLAG_TIMEOUT_ERROR 1 << 19
#define FLAG_TRANSFER_FAILED 1 << 20
 
struct http_msg{
dword socket;
dword flags;
dword write_ptr;
dword buffer_length;
dword chunk_ptr;
dword timestamp;
dword status;
dword header_length;
dword content_ptr;
dword content_length;
dword content_received;
char http_header;
};
/programs/cmm/lib/obj/iconv.h
0,0 → 1,59
//convert text characters
 
dword iconv_lib = #a_iconv_lib;
char a_iconv_lib[19]="/sys/lib/iconv.obj\0";
 
dword iconv_open = #aIconv_open;
dword iconv = #aIconv;
$DD 2 dup 0
 
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;
 
iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5
if (EAX==-1)
{
debug(from_chs);
debug(to_chs);
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)+1;
new_buf = mem_Alloc(in_len);
iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len);
cd = EAX;
if (cd!=0)
{
debug("iconv: something is wrong with stdcall iconv()");
debugi(cd);
debug("in_len");
debugi(in_len);
debug("out_len");
debugi(out_len);
new_buf = free(new_buf);
return 0;
}
strcpy(conv_buf, new_buf);
free(new_buf);
return conv_buf;
}
 
 
char *charsets[] = { " ", "UTF-8", "KOI8-RU", "CP1251", "CP1252", "ISO8859-5", "CP866"};
int cur_charset;
enum {
CH_NULL,
CH_UTF8,
CH_KOI8,
CH_CP1251,
CH_CP1252,
CH_ISO8859_5,
CH_CP866
};
/programs/cmm/lib/obj/libimg_lib.h
0,0 → 1,102
//Asper
 
//library
dword libimg = #alibimg;
char alibimg[21] = "/sys/lib/libimg.obj\0";
 
dword libimg_init = #alibimg_init;
dword img_is_img = #aimg_is_img;
dword img_to_rgb2 = #aimg_to_rgb2;
dword img_decode = #aimg_decode;
dword img_destroy = #aimg_destroy;
dword img_draw = #aimg_draw;
//dword img_flip = #aimg_flip;
//dword img_rotate = #aimg_rotate;
$DD 2 dup 0
 
//import libimg , \
char alibimg_init[9] = "lib_init\0";
char aimg_is_img[11] = "img_is_img\0";
char aimg_to_rgb2[12] = "img_to_rgb2\0";
char aimg_decode[11] = "img_decode\0";
char aimg_destroy[12] = "img_destroy\0";
char aimg_draw[9] = "img_draw\0";
//char aimg_flip[9] = "img_flip\0";
//char aimg_rotate[11] = "img_rotate\0 ";
 
 
 
dword load_image(dword filename)
{
//align 4
dword img_data=0;
dword img_data_len=0;
dword fh=0;
dword image=0;
 
byte tmp_buf[40];
$and img_data, 0
//$mov eax, filename
//$push eax
//invoke file.open, eax, O_READ
file_open stdcall (filename, O_READ);
$or eax, eax
$jnz loc05
$stc
return 0;
@loc05:
$mov fh, eax
//invoke file.size
file_size stdcall (filename);
$mov img_data_len, ebx
//stdcall mem.Alloc, ebx
mem_Alloc(EBX);
$test eax, eax
$jz error_close
$mov img_data, eax
//invoke file.read, [fh], eax, [img_data_len]
file_read stdcall (fh, EAX, img_data_len);
$cmp eax, -1
$jz error_close
$cmp eax, img_data_len
$jnz error_close
//invoke file.close, [fh]
file_close stdcall (fh);
$inc eax
$jz error_
//; img.decode checks for img.is_img
//; //invoke img.is_img, [img_data], [img_data_len]
//; $or eax, eax
//; $jz exit
//invoke img.decode, [img_data], [img_data_len], 0
EAX=img_data;
img_decode stdcall (EAX, img_data_len,0);
$or eax, eax
$jz error_
$cmp image, 0
$pushf
$mov image, eax
//call init_frame
$popf
//call update_image_sizes
mem_Free(img_data);//free_img_data(img_data);
$clc
return image;
 
@error_free:
//invoke img.destroy, [image]
img_destroy stdcall (image);
$jmp error_
 
@error_pop:
$pop eax
$jmp error_
@error_close:
//invoke file.close, [fh]
file_close stdcall (fh);
@error_:
mem_Free(img_data);
$stc
return 0;
}
/programs/cmm/lib/obj/libio_lib.h
0,0 → 1,34
//Asper
 
//library
dword libio = #alibio;
char alibio[21] = "/sys/lib/libio.obj\0"; //"libio.obj\0";
 
dword libio_init = #alibio_init;
dword file_size = #afile_size;
dword file_open = #afile_open;
dword file_read = #afile_read;
dword file_close = #afile_close;
$DD 2 dup 0
 
 
//import libio , \
char alibio_init[9] = "lib_init\0";
char afile_size[11] = "file_size\0";
char afile_open[12] = "file_open\0";
char afile_read[11] = "file_read\0";
char afile_close[12] = "file_close\0";
 
//align 4
//dword fh=0;
 
#define O_BINARY 0
#define O_READ 1
#define O_WRITE 2
#define O_CREATE 4
#define O_SHARE 8
#define O_TEXT 16
 
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
/programs/cmm/lib/obj/netcode.h
0,0 → 1,19
//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;
$DD 2 dup 0
 
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.*/
/programs/cmm/lib/obj/network.h
0,0 → 1,63
//Network library
 
dword network_lib = #a_network_lib;
char a_network_lib[21]="/sys/lib/network.obj\0";
 
dword network_lib_init = #aLib_init;
dword inet_addr = #aInet_addr; //"192.168.0.1" -> dword IP
dword inet_ntoa = #aInet_ntoa;
dword getaddrinfo = #aGetaddrinfo;
dword getaddrinfo_start = #aGetaddrinfo_start;
dword getaddrinfo_process = #aGetaddrinfo_process;
dword getaddrinfo_abort = #aGetaddrinfo_abort;
dword freeaddrinfo = #aFreeaddrinfo;
$DD 2 dup 0
 
char aLib_init[9] = "lib_init\0";
char aInet_addr[10] = "inet_addr\0";
char aInet_ntoa[10] = "inet_ntoa\0";
char aGetaddrinfo[12] = "getaddrinfo\0";
char aGetaddrinfo_start[18] = "getaddrinfo_start\0";
char aGetaddrinfo_process[20] = "getaddrinfo_process\0";
char aGetaddrinfo_abort[18] = "getaddrinfo_abort\0";
char aFreeaddrinfo[13] = "freeaddrinfo\0";
 
/*
addr соответствует IP 10.101.102.103
itoa((addr&0xFF000000)>>24) равно 103
itoa((addr&0xFF0000)>>16) —это 102
itoa((addr&0xFF00)>>8) — это 101
itoa(addr&0xFF) — это 10
*/
 
dword GetIPfromAdress(dword addr)
{
dword lpointer, IPa;
getaddrinfo stdcall (addr, 0, 0, #lpointer);
if (EAX!=0) IPa = 0; else IPa = DSDWORD[DSDWORD[lpointer+24]+4];
freeaddrinfo stdcall (lpointer);
return IPa;
}
 
/*
//Convert the string from standard IPv4 dotted notation to integer IP addr.
inet_addr stdcall ("192.168.0.1");
server_IP = EAX;
 
 
char* __stdcall inet_ntoa(struct in_addr in);
Convert the Internet host address to standard IPv4 dotted notation.
 
getaddrinfo(__in const char* hostname, __in const char* servname,
__in const struct addrinfo* hints, __out struct addrinfo **res);
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
*/
/programs/cmm/lib/obj/truetype.h
0,0 → 1,27
//ýòî âñòàâèòü ïîñëå çàãðóçêè îñíîâíûõ áèáëèîòåê
char fontinfo[28];
dword libtruetype = #att;
char att[] = "/sys/lib/truetype.obj"; //"truetype.obj\0";
dword truetype = #att_truetype;
dword get_length = #att_get_length;
dword get_width = #att_get_width;
dword text_out = #att_text_out;
dword init_font = #att_init_font;
$DD 2 dup 0
//import libimg , \
char att_truetype[] = "truetype";
char att_get_length[] = "get_length";
char att_get_width[] = "get_width";
char att_text_out[] = "text_out";
char att_init_font[] = "init_font";
//load_dll2(libtruetype, #truetype,0);
//à ýòî - â ìîìåíò îòðèñîâêè îêíà
//text_out stdcall (#text, -1, 40, 0xFF0000, 100, 100);
/programs/cmm/lib/obj/.
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property