Subversion Repositories Kolibri OS

Rev

Rev 1805 | Rev 7481 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1805 Rev 5114
Line 1... Line 1...
1
#include "kosSyst.h"
1
#include "kosSyst.h"
2
#include 
2
#include 
Line 3... Line 3...
3
 
3
 
Line -... Line 4...
-
 
4
#define atexitBufferSize	32
-
 
5
 
-
 
6
// Autobuild uses FASM method for exe->kos,
-
 
7
// MENUET01 header should be present in EXE.
-
 
8
#ifdef AUTOBUILD
-
 
9
char kosExePath[1024];
-
 
10
char exeStack[16384];
-
 
11
// must be alphabetically first in the image
-
 
12
#pragma data_seg(".1seg")
-
 
13
extern "C" struct
-
 
14
{
-
 
15
	char header[8];
-
 
16
	int headerver;
-
 
17
	void* entry;
-
 
18
	void* i_end;
-
 
19
	void* memsize;
-
 
20
	void* stack;
-
 
21
	void* params;
-
 
22
	void* icon;
-
 
23
} header = {
-
 
24
	{'M', 'E', 'N', 'U', 'E', 'T', '0', '1'},
-
 
25
	1,
-
 
26
	&crtStartUp,
-
 
27
	0,	// filled by doexe2.asm
-
 
28
	0,	// filled by doexe2.asm
-
 
29
	exeStack + sizeof(exeStack),
-
 
30
	NULL,
-
 
31
	kosExePath
-
 
32
};
-
 
33
#pragma data_seg()
-
 
34
#else
Line 4... Line 35...
4
#define atexitBufferSize	32
35
char *kosExePath = NULL;
Line 5... Line -...
5
 
-
 
6
 
-
 
7
char pureCallMessage[] = "PURE function call!";
36
#endif
8
 
37
 
9
char *kosExePath = NULL;
38
char pureCallMessage[] = "PURE function call!";
10
 
39
 
11
//
40
//
Line 948... Line 977...
948
//
977
//
949
#pragma comment(linker, "/merge:.CRT=.rdata")
978
#pragma comment(linker, "/merge:.CRT=.rdata")
950
//
979
//
951
void crtStartUp()
980
void crtStartUp()
952
{
981
{
-
 
982
#ifdef AUTOBUILD
-
 
983
// linker will try to remove unused variables; force header to be included
-
 
984
	header.header;
-
 
985
#endif
953
	// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
986
	// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
954
	for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
987
	for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
955
	{
988
	{
956
		//
989
		//
957
		if ( *pbegin != NULL )
990
		if ( *pbegin != NULL )
958
			(**pbegin)();
991
			(**pbegin)();
959
	}
992
	}
960
	// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
993
	// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
961
	rtlSrand( kos_GetSystemClock() );
994
	rtlSrand( kos_GetSystemClock() );
-
 
995
#ifndef AUTOBUILD
962
	// ïóòü ê ôàéëó ïðîöåññà
996
	// ïóòü ê ôàéëó ïðîöåññà
963
	kosExePath = *((char **)0x20);
997
	kosExePath = *((char **)0x20);
-
 
998
#endif
964
	// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
999
	// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
965
	kos_Main();
1000
	kos_Main();
966
	// âûõîä
1001
	// âûõîä
967
	kos_ExitApp();
1002
	kos_ExitApp();
968
}
1003
}