Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1372 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.hostenv.name_ = "spidermonkey";
13
dojo.hostenv.name_ = "spidermonkey";
12
dojo.hostenv.println = print;
14
dojo.hostenv.println = print;
13
dojo.hostenv.exit = function (exitcode) {
15
dojo.hostenv.exit = function (exitcode) {
14
	quit(exitcode);
16
	quit(exitcode);
15
};
17
};
16
dojo.hostenv.getVersion = function () {
18
dojo.hostenv.getVersion = function () {
17
	return version();
19
	return version();
18
};
20
};
19
if (typeof line2pc == "undefined") {
21
if (typeof line2pc == "undefined") {
20
	dojo.raise("attempt to use SpiderMonkey host environment when no 'line2pc' global");
22
	dojo.raise("attempt to use SpiderMonkey host environment when no 'line2pc' global");
21
}
23
}
22
function dj_spidermonkey_current_file(depth) {
24
function dj_spidermonkey_current_file(depth) {
23
	var s = "";
25
	var s = "";
24
	try {
26
	try {
25
		throw Error("whatever");
27
		throw Error("whatever");
26
	}
28
	}
27
	catch (e) {
29
	catch (e) {
28
		s = e.stack;
30
		s = e.stack;
29
	}
31
	}
30
	var matches = s.match(/[^@]*\.js/gi);
32
	var matches = s.match(/[^@]*\.js/gi);
31
	if (!matches) {
33
	if (!matches) {
32
		dojo.raise("could not parse stack string: '" + s + "'");
34
		dojo.raise("could not parse stack string: '" + s + "'");
33
	}
35
	}
34
	var fname = (typeof depth != "undefined" && depth) ? matches[depth + 1] : matches[matches.length - 1];
36
	var fname = (typeof depth != "undefined" && depth) ? matches[depth + 1] : matches[matches.length - 1];
35
	if (!fname) {
37
	if (!fname) {
36
		dojo.raise("could not find file name in stack string '" + s + "'");
38
		dojo.raise("could not find file name in stack string '" + s + "'");
37
	}
39
	}
38
	return fname;
40
	return fname;
39
}
41
}
40
if (!dojo.hostenv.library_script_uri_) {
42
if (!dojo.hostenv.library_script_uri_) {
41
	dojo.hostenv.library_script_uri_ = dj_spidermonkey_current_file(0);
43
	dojo.hostenv.library_script_uri_ = dj_spidermonkey_current_file(0);
42
}
44
}
43
dojo.hostenv.loadUri = function (uri) {
45
dojo.hostenv.loadUri = function (uri) {
44
	var ok = load(uri);
46
	var ok = load(uri);
45
	return 1;
47
	return 1;
46
};
48
};
47
dojo.requireIf((djConfig["isDebug"] || djConfig["debugAtAllCosts"]), "dojo.debug");
49
dojo.requireIf((djConfig["isDebug"] || djConfig["debugAtAllCosts"]), "dojo.debug");
48
 
50