Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8199 → Rev 8252

/programs/demos/life2/kos_cdlg.inc
File deleted
/programs/demos/life2/kos_cdlg.h
File deleted
/programs/demos/life2/kos_cdlg_win.cpp
File deleted
\ No newline at end of file
/programs/demos/life2/include/kolibri.h
8,7 → 8,7
namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace.
{
const char *DebugPrefix = "User program: ";
char CommandLine[257];
char CommandLine[2048];
 
struct TWindowData // Data for drawing a window.
{
510,31 → 510,6
}
}
 
#else // def __KOLIBRI__
 
namespace Kolibri
{
struct TMutex
{
unsigned int mut;
 
TMutex();
~TMutex();
};
#undef KOLIBRI_MUTEX_INIT
#define KOLIBRI_MUTEX_INIT TMutex()
 
struct TRecMutex
{
unsigned int mut;
 
TRecMutex();
~TRecMutex();
};
#undef KOLIBRI_REC_MUTEX_INIT
#define KOLIBRI_REC_MUTEX_INIT TRecMutex()
}
 
#endif // else: def __KOLIBRI__
 
#endif // ndef __KOLIBRI_H_INCLUDED_
/programs/demos/life2/include/kos_func.inc
84,9 → 84,6
cmp esp,eax
cmova esp,eax
and esp,not 3
if defined @Kolibri@CommandLine
mov byte [@Kolibri@CommandLine+256], 0
end if
xor eax,eax
cld
mov edi,@Kolibri@_ThreadTable
389,8 → 386,9
dec esi
jz .window_defined
mov eax,SF_DRAW_TEXT
mov ebx,0x00070007
mov ebx,0x00070005
mov ecx,[ebp+KOLIBRI_THREAD_DATA_C_TITLE*4]
or ecx,1 shl 28 ;make big font
int 0x40
.window_defined:
.redraw_picture:
/programs/demos/life2/include/kos_start.inc
4,12 → 4,24
dd 1
dd @Kolibri@Main$qv
dd I_END
dd U_END+STACKSIZE+HEAPSIZE
dd U_END+STACKSIZE ;+HEAPSIZE
dd U_END+STACKSIZE
dd @Kolibri@CommandLine,0
if defined @Kolibri@CommandLine
dd @Kolibri@CommandLine
else
dd 0
end if
if defined @Kolibri@CurrentDirectoryPath
dd @Kolibri@CurrentDirectoryPath
else
dd 0
end if
 
include "..\..\KOSfuncs.inc"
include "..\..\proc32.inc"
include "..\..\macros.inc"
include "..\..\dll.inc"
include "..\..\load_lib.mac"
 
ptr equ
offset equ
/programs/demos/life2/include/l_proc_lib.h
0,0 → 1,62
#ifndef __L_PROC_LIB_H_INCLUDED_
#define __L_PROC_LIB_H_INCLUDED_
//
// proc_lib.obj
//
 
struct od_filter
{
long size; //size = len(#ext) + sizeof(long)
char ext[25];
};
 
struct OpenDialog_data{
long type;
void* procinfo; //
char* com_area_name;
void* com_area; //
char* opendir_path;
char* dir_default_path;
char* start_path;
void (__stdcall* draw_window)();
long status;
char* openfile_path;
char* filename_area;
od_filter* filter_area;
short int x_size; // Window X size
short int x_start; // Window X position
short int y_size; // Window y size
short int y_start; // Window Y position
};
 
struct ColorDialog_data{
long type;
void* procinfo; //
char* com_area_name;
void* com_area; //
char* start_path;
void (__stdcall* draw_window)();
long status;
short int x_size; // Window X size
short int x_start; // Window X position
short int y_size; // Window y size
short int y_start; // Window Y position
long color_type; // 0- RGB, 1 or other - reserved
long color; // Selected color
};
 
//
// proc_lib - import table
//
void (__stdcall* import_proc_lib)() = (void (__stdcall*)())&"lib_init";
void (__stdcall* OpenDialog_Init)(OpenDialog_data* odd) = (void (__stdcall*)(OpenDialog_data*))&"OpenDialog_init";
void (__stdcall* OpenDialog_Start)(OpenDialog_data* odd) = (void (__stdcall*)(OpenDialog_data*))&"OpenDialog_start";
void (__stdcall* OpenDialog_SetFileName)(OpenDialog_data* odd, char* name) = (void (__stdcall*)(OpenDialog_data*, char*))&"OpenDialog_set_file_name";
void (__stdcall* OpenDialog_SetFileExt)(OpenDialog_data* odd, char* ext) = (void (__stdcall*)(OpenDialog_data*, char*))&"OpenDialog_set_file_ext";
void (__stdcall* ColorDialog_Init)(ColorDialog_data* cdd) = (void (__stdcall*)(ColorDialog_data*))&"ColorDialog_init";
void (__stdcall* ColorDialog_Start)(ColorDialog_data* cdd) = (void (__stdcall*)(ColorDialog_data*))&"ColorDialog_start";
asm{
dd 0,0
}
 
#endif
/programs/demos/life2/include/load_lib.h
0,0 → 1,18
#ifndef __LOAD_LIB_H_LINCLUDED_
#define __LOAD_LIB_H_INCLUDED_
 
// macros '@use_library' and 'load_library' defined in file 'load_lib.mac'
 
asm{
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
}
 
bool LoadLibrary(const char* lib_name, char* lib_path, const char* system_path, void* myimport)
{
asm{
load_library [ebp+8], [ebp+12], [ebp+16], [ebp+20]
}
return true;
}
 
#endif
/programs/demos/life2/kos_make.inc
2,12 → 2,11
;//COMPILER// bcc32 -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -Iinclude
;//UTIL_PATH// .
 
STACKSIZE equ 102400
HEAPSIZE equ 102400
STACKSIZE equ 8196
HEAPSIZE equ 0
 
include "include\kos_start.inc"
include "include\kos_func.inc"
include "include\kos_heap.inc"
include "kos_cdlg.inc"
include "mmxlife.inc"
;include "sse2life.inc"
/programs/demos/life2/life2.cpp
1,43 → 1,37
#include <kolibri.h>
#include <kos_heap.h>
#include <kos_file.h>
#include <load_lib.h>
#include <l_proc_lib.h>
#include "lifegen.h"
#include "life_bmp.h"
#include "kos_cdlg.h"
 
using namespace Kolibri;
 
/***
#define StrLen LibbStrLen
#define StrCopy LibbStrCopy
#define MemCopy LibbMemCopy
#define MemSet LibbMemSet
#define Floor LibbFloor
char library_path[2048];
 
unsigned int (*StrLen)(const char *str) = 0;
char *(*StrCopy)(char *dest, const char *src) = 0;
void *(*MemCopy)(void *dest, const void *src, unsigned int n) = 0;
void *(*MemSet)(void *s, char c, unsigned int n) = 0;
double (*Floor)(double x) = 0;
OpenDialog_data ofd;
unsigned char procinfo[1024];
char plugin_path[4096], filename_area[256];
od_filter filter1 = { 8, "LIF\0\0" };
 
void LibbInit()
namespace Kolibri{
char CurrentDirectoryPath[2048];
}
 
void __stdcall DrawWindow()
{
HINSTANCE hLib = LoadLibrary("Libb.dll");
if (!hLib)
{
DebugPutString("Can't load the library.\n");
Kolibri::Abort();
asm{
push ebx
mcall SF_REDRAW,SSF_BEGIN_DRAW
}
StrLen = (unsigned int(*)(const char *str))GetProcAddress(hLib, "StrLen");
StrCopy = (char *(*)(char *dest, const char *src))GetProcAddress(hLib, "StrCopy");
MemCopy = (void *(*)(void *dest, const void *src, unsigned int n))GetProcAddress(hLib, "MemCopy");
MemSet = (void *(*)(void *s, char c, unsigned int n))GetProcAddress(hLib, "MemSet");
Floor = (double (*)(double x))GetProcAddress(hLib, "Floor");
//KolibriOnPaint();
asm{
mcall SF_REDRAW,SSF_END_DRAW
pop ebx
}
}
 
#pragma startup LibbInit
/**/
 
void __stdcall OneGeneration(int w, int h, void *dest, const void *src, int flag);
 
struct GenerateParam
107,7 → 101,7
AxisParam ypar = {0, 0, 0};
MouseParam mpar = {0, 0, 0, 0, 0, MouseParam::HitNull};
MenuParam menu;
TOpenFileStruct open_file_str = KOLIBRI_OPEN_FILE_INIT;
bool open_file_str = false;
TimeGeneration timegen[TimeGenLength];
int timegenpos = 0;
 
1356,11 → 1350,9
 
void MenuOpenDialogEnd(TThreadData th)
{
int state = OpenFileGetState(open_file_str);
if (state <= 0) return;
OpenFileSetState(open_file_str, 0);
if (state != 2) return;
char *name = OpenFileGetName(open_file_str);
if(!ofd.openfile_path[0] || !open_file_str) return;
open_file_str = false;
char *name = ofd.openfile_path;
if (!name) return;
FileInfoBlock* file = FileOpen(name);
if (!file) return;
1467,8 → 1459,9
MenuClearClick(th);
break;
case MenuIOpen:
if (OpenFileGetState(open_file_str) < 0) break;
OpenFileDialog(open_file_str);
ofd.type = 0; // 0 - open
OpenDialog_Start(&ofd);
if(ofd.status==1) open_file_str = true;
break;
case MenuIAbout:
MenuAboutClick(th);
1706,11 → 1699,26
me_start.Width = 500; me_start.Height = 400;
InitGenerate();
InitMenuButton();
if (CommandLine[0])
if(LoadLibrary("proc_lib.obj", library_path, "/sys/lib/proc_lib.obj", &import_proc_lib))
{
open_file_str.state = 2;
OpenFileSetName(open_file_str, CommandLine);
}
ofd.procinfo = procinfo;
ofd.com_area_name = "FFFFFFFF_open_dialog";
ofd.com_area = 0;
ofd.opendir_path = plugin_path;
ofd.dir_default_path = "/rd/1";
ofd.start_path = "/rd/1/File managers/opendial";
ofd.draw_window = DrawWindow;
ofd.status = 0;
ofd.openfile_path = CommandLine;
ofd.filename_area = filename_area;
ofd.filter_area = &filter1;
ofd.x_size = 420;
ofd.x_start = 10;
ofd.y_size = 320;
ofd.y_start = 10;
OpenDialog_Init(&ofd);
} else return false;
if (CommandLine[0]) open_file_str = true;
return true;
}
 
1725,7 → 1733,7
{
static const unsigned int WAIT_TIME = 2, GEN_TIME = 1;
int res = -1;
if (OpenFileGetState(open_file_str) > 0)
if (open_file_str)
{
MenuOpenDialogEnd(th);
res = 0;
1826,8 → 1834,9
break;
case 'o':
case 'O':
if (OpenFileGetState(open_file_str) < 0) break;
OpenFileDialog(open_file_str);
ofd.type = 0; // 0 - open
OpenDialog_Start(&ofd);
if(ofd.status==1) open_file_str=true;
break;
case 'a':
case 'A':