Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5646 → Rev 5648

/programs/cmm/example/example.c
7,7 → 7,7
int id, key, i;
dword file;
mem_Init();
io.dir_buffer("",DIR_ONLYREAL);
io.dir.load(0,DIR_ONLYREAL);
loop()
{
switch(WaitEvent())
44,6 → 44,4
i++;
}
WriteText(10,110,0x80,0,#param);
}
 
stop:
}
/programs/cmm/lib/io.h
149,6 → 149,7
:struct __DIR
{
int make(dword name);
dword load(...);
dword position(dword i);
dword buffer;
signed count;
171,6 → 172,29
$int 0x40
}
 
:dword __DIR::load(dword PATH;byte options)
{
io.count(PATH);
if(count!=-1)
{
buffer = malloc(count+1*304+32);
___ReadDir(count, buffer, PATH);
if (options == DIR_ONLYREAL)
{
if (!strcmp(".",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
if (!strcmp("..",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
return buffer;
}
if (options == DIR_NOROOT)
{
if (!strcmp(".",buffer+72)) memmov(buffer,buffer+304,count*304-304);
return buffer;
}
return buffer;
}
return NULL;
}
 
:struct __PATH
{
dword file(...);
180,7 → 204,9
:char __PATH_NEW[4096];
:dword __PATH::path(dword PATH)
{
dword pos = PATH;
dword pos;
if(!PATH) return self.dir;
pos = PATH;
if(DSBYTE[pos]=='/')
{
pos++;
196,7 → 222,7
return #__PATH_NEW;
}
if(!strncmp(PATH,"./",2)) return PATH;
sprintf(#__PATH_NEW,"%s/%s",__DIR__,PATH);
sprintf(#__PATH_NEW,"%s/%s",self.dir,PATH);
return #__PATH_NEW;
}
 
222,7 → 248,6
double size(...);
dword get_size_dir(dword name);
signed count(dword path);
dword dir_buffer(dword path;byte options);
signed int run(dword path,param);
byte del(...);
dword read(...);
290,31 → 315,6
return -1;
}
 
:dword IO::dir_buffer(dword PATH;byte options)
{
count(PATH);
if(dir.count!=-1)
{
//if(dir.buffer) dir.buffer = realloc(dir.buffer,dir.count+1*304+32);
//else
dir.buffer = malloc(dir.count+1*304+32);
___ReadDir(dir.count, dir.buffer, PATH);
if (options == DIR_ONLYREAL)
{
if (!strcmp(".",dir.buffer+72)){dir.count--; memmov(dir.buffer,dir.buffer+304,dir.count*304);}
if (!strcmp("..",dir.buffer+72)){dir.count--; memmov(dir.buffer,dir.buffer+304,dir.count*304);}
return dir.buffer;
}
if (options == DIR_NOROOT)
{
if (!strcmp(".",dir.buffer+72)) memmov(dir.buffer,dir.buffer+304,dir.count*304-304);
return dir.buffer;
}
return dir.buffer;
}
return NULL;
}
 
:double IO::size(dword PATH)
{
dword i,tmp_buf,count_dir,count_file;
325,7 → 325,7
if(___GetFileInfo(PATH, #BDVK))return -1;
if(BDVK.isfolder)
{
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
tmp_buf = dir.load(PATH,DIR_ONLYREAL);
if(dir.count<1)return 0;
count_dir = dir.count;
i = 0;
359,7 → 359,7
if(___GetFileInfo(PATH, #BDVK))return false;
if(BDVK.isfolder)
{
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
tmp_buf = dir.load(PATH,DIR_ONLYREAL);
count_dir = dir.count;
i = 0;
count_file = malloc(4096);
388,7 → 388,7
cmd_system = atr&11b;
if(BDVK.isfolder)
{
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
tmp_buf = dir.load(PATH,DIR_ONLYREAL);
count_dir = dir.count;
i = 0;
count_file = malloc(4096);
431,7 → 431,7
{
sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
dir.make(_path_);
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
tmp_buf = dir.load(PATH,DIR_ONLYREAL);
count_dir = dir.count;
i = 0;
count_file = malloc(4096);
/programs/cmm/lib/kolibri.h
7,8 → 7,8
 
char os_name[8] = {'M','E','N','U','E','T','0','1'};
dword os_version = 0x00000001;
dword start_addr = #load_init_main;
dword final_addr = #stop+32;
dword start_addr = #______INIT______;
dword final_addr = #______STOP______+32;
dword alloc_mem = MEMSIZE;
dword x86esp_reg = MEMSIZE;
dword I_Param = #param;
932,22 → 932,26
//DSBYTE[BUF1] = 0;
DSBYTE[BUF] = 0;
}
char __BUF_DIR__[4096];
:struct SELF
{
dword dir;
dword file;
dword path;
} self;
 
dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
 
:dword program_path_length;
 
char __BUF_DIR__[4096];
 
dword __DIR__;
 
//The initialization of the initial data before running
void load_init_main()
void ______INIT______()
{
__DIR__ = #__BUF_DIR__;
self.dir = #__BUF_DIR__;
self.file = 0;
self.path = I_Path;
__path_name__(#__BUF_DIR__,I_Path);
__path_name__(__DIR__,I_Path);
SKIN.height = GetSkinHeight();
screen.width = GetScreenWidth();
screen.height = GetScreenHeight();
958,5 → 962,5
//mem_Init();
main();
}
 
______STOP______:
#endif