File: boot.d

package info (click to toggle)
projectl 1.001.dfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,720 kB
  • ctags: 5
  • sloc: xml: 57; makefile: 32
file content (62 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module br.boot;
private import br.mainloop;
private import util.key;
private import SDL;
private Mainloop mainloop;
private Key key;


version (Win32_release) {
  // Boot as the Windows executable.
  private import std.c.windows.windows;
  private import std.string;

extern (C) void gc_init();
extern (C) void gc_term();
extern (C) void _minit();
extern (C) void _moduleCtor();

extern (Windows)
public int WinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpCmdLine,
	int nCmdShow)
{
	int result;
  gc_init();
	_minit();
	try
	{
	_moduleCtor();
	result = user_start();
	SDL_Quit();
	}catch (Throwable o)
	{
	MessageBoxA(null, cast(const(char)* )o.toString(), "Error",
			MB_OK | MB_ICONEXCLAMATION);
	result = 0; 	// failed
	}
	gc_term();
	return result;
}
} else {
  // Boot as the general executable.
  public int main(string[] args) {
    return user_start();
  }
}

int user_start(){
/*
	version (X86) {
    short cw;
    asm { fnstcw cw; }
    cw &= ~1;
    asm { fldcw cw; }
  }
*/
	key = new Key();
	mainloop = new Mainloop(key);
	mainloop.loop();
	return 0;
}