1 /**
2  * D bindings to Tcl/Tk
3  *
4  * License:
5  *     MIT. See LICENSE for full details.
6  */
7 module tcltk.tclplatdecls;
8 
9 import tcltk.tcl;
10 
11 version (Windows)
12 {
13 	import core.stdc.stddef : wchar_t;
14 }
15 
16 version (OSX)
17 {
18 	import tcltk.tcl : Tcl_Interp;
19 }
20 
21 version (Windows)
22 {
23 	// wchar_t is used here in lieu of TCHAR.
24 	extern(C) const(wchar_t)* Tcl_WinUtfToTChar(const(char)* str, int len, Tcl_DString* dsPtr) nothrow;
25 	extern(C) const(char)* Tcl_WinTCharToUtf(const(wchar_t)* str, int len, Tcl_DString* dsPtr) nothrow;
26 }
27 
28 version (OSX)
29 {
30 	extern(C) int Tcl_MacOSXOpenBundleResources(Tcl_Interp* interp, const(char)* bundleName, int hasResourceFile, int maxPathLen, const(char)* libraryPath) nothrow;
31 	extern(C) int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp* interp, const(char)* bundleName, const(char)* bundleVersion, int hasResourceFile, int maxPathLen, const(char)* libraryPath) nothrow;
32 }
33 
34 struct TclPlatStubs
35 {
36 	int magic;
37 
38 	struct TclPlatStubHooks;
39 	TclPlatStubHooks* hooks;
40 
41 	version (Windows)
42 	{
43 		// wchar_t is used here in lieu of TCHAR.
44 		extern(C) const(wchar_t)* function(const(char)* str, int len, Tcl_DString* dsPtr) nothrow tcl_WinUtfToTChar;
45 		extern(C) const(char)* function(const(wchar_t)* str, int len, Tcl_DString* dsPtr) nothrow tcl_WinTCharToUtf;
46 	}
47 
48 	version (OSX)
49 	{
50 		extern(C) int function(Tcl_Interp* interp, const(char)* bundleName, int hasResourceFile, int maxPathLen, const(char)* libraryPath) nothrow tcl_MacOSXOpenBundleResources;
51 		extern(C) int function(Tcl_Interp* interp, const(char)* bundleName, const(char)* bundleVersion, int hasResourceFile, int maxPathLen, const(char)* libraryPath) nothrow tcl_MacOSXOpenVersionedBundleResources;
52 	}
53 }
54 
55 extern(C) shared TclPlatStubs* tclPlatStubsPtr;