Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7048 → Rev 7049

/programs/cmm/lib/collection.h
13,8 → 13,9
int realloc_size, count;
dword data_start;
dword data_size;
dword element_offset[4090];
dword element_offset[4000];
int add();
int addn();
dword get();
void drop();
void increase_data_size();
34,15 → 35,19
}
 
int collection::add(dword in) {
if (count >= 4090) return 0;
if (element_offset[count]+strlen(in)+2 > data_size) {
return addn(in, strlen(in));
}
 
int collection::addn(dword in, len) {
if (count >= 4000) return 0;
if (element_offset[count]+len+2 > data_size) {
increase_data_size();
add(in);
return;
addn(in, len);
return 1;
}
strcpy(data_start+element_offset[count], in);
strncpy(data_start+element_offset[count], in, len);
count++;
element_offset[count] = element_offset[count-1] + strlen(in) + 1;
element_offset[count] = element_offset[count-1] + len + 1;
return 1;
}
 
/programs/cmm/lib/obj/libimg_lib.h
File deleted
\ No newline at end of file
/programs/cmm/lib/obj/libio_lib.h
File deleted
\ No newline at end of file
/programs/cmm/lib/obj/libimg.h
0,0 → 1,136
//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.h"
#endif
 
:byte init_imglib_check;
 
//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;
}
 
void DrawLibImage(dword image_pointer,x,y,w,h,offx,offy) {
img_draw stdcall (
image_pointer,
x,
y,
w,
h,
offx,
offy
);
}
 
#endif
/programs/cmm/lib/obj/libio.h
0,0 → 1,46
//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;
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
 
#endif
/programs/cmm/lib/patterns/libimg_load_skin.h
2,7 → 2,7
#define INCLUDE_LIBIMG_LOAD_SKIN_H
 
#ifndef INCLUDE_LIBIMG_H
#include "../lib/obj/libimg_lib.h"
#include "../lib/obj/libimg.h"
#endif
 
:struct libimg_image {
/programs/cmm/lib/patterns/simple_open_dialog.h
1,16 → 1,18
struct od_filter
{
dword size;
byte end;
dword size; //size = len(#ext) + sizeof(dword)
char ext[16];
};
 
 
proc_info pr_inf;
char communication_area_name[] = "FFFFFFFF_open_dialog";
char opendir_path[4096];
char opendir_path[3072];
char open_dialog_path[] = "/rd/1/File managers/opendial";
char openfile_path[4096];
char filename_area[256];
char filename_area[1024];
 
 
opendialog o_dialog = {
0,
#pr_inf,
/programs/cmm/lib/strings.h
233,6 → 233,18
return 0;
}
 
:void strncpy(dword dst, src, len)
{
while (len)
{
ESBYTE[dst] = ESBYTE[src];
dst++;
src++;
len--;
}
ESBYTE[dst]=0;
}
 
/*
inline fastcall void strtrim( ESI)
{
889,6 → 901,15
return 0;
}
 
replace_char(dword in_str, char from_char, to_char, int length) {
int i;
for (i=0; i<length; i++) {
if (ESBYTE[in_str+i] == from_char) ESBYTE[in_str+i] = to_char;
}
ESBYTE[in_str+length]=0;
}
 
 
#define strnmov strmovn
#define stricmp strcmpi
#define strcmpn strncmp