1 module org.eclipse.swt.internal.mozilla.prlink; 2 3 import java.lang.all; 4 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 5 /* ***** BEGIN LICENSE BLOCK ***** 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 8 * The contents of this file are subject to the Mozilla Public License Version 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 * the License. You may obtain a copy of the License at 11 * http://www.mozilla.org/MPL/ 12 * 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 * for the specific language governing rights and limitations under the 16 * License. 17 * 18 * The Original Code is the Netscape Portable Runtime (NSPR). 19 * 20 * The Initial Developer of the Original Code is 21 * Netscape Communications Corporation. 22 * Portions created by the Initial Developer are Copyright (C) 1998-2000 23 * the Initial Developer. All Rights Reserved. 24 * 25 * Contributor(s): 26 * 27 * Alternatively, the contents of this file may be used under the terms of 28 * either the GNU General Public License Version 2 or later (the "GPL"), or 29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 30 * in which case the provisions of the GPL or the LGPL are applicable instead 31 * of those above. If you wish to allow use of your version of this file only 32 * under the terms of either the GPL or the LGPL, and not to allow others to 33 * use your version of this file under the terms of the MPL, indicate your 34 * decision by deleting the provisions above and replace them with the notice 35 * and other provisions required by the GPL or the LGPL. If you do not delete 36 * the provisions above, a recipient may use your version of this file under 37 * the terms of any one of the MPL, the GPL or the LGPL. 38 * 39 * ***** END LICENSE BLOCK ***** */ 40 41 import org.eclipse.swt.internal.mozilla.Common; 42 43 struct PRStaticLinkTable 44 { 45 char *name; 46 void function()fp; 47 } 48 49 extern (System): 50 51 PRStatus PR_SetLibraryPath(char *path); 52 53 char * PR_GetLibraryPath(); 54 char * PR_GetLibraryName(char *dir, char *lib); 55 void PR_FreeLibraryName(char *mem); 56 57 alias void PRLibrary; 58 59 PRLibrary * PR_LoadLibrary(char *name); 60 61 enum PRLibSpecType 62 { 63 PR_LibSpec_Pathname, 64 PR_LibSpec_MacNamedFragment, 65 PR_LibSpec_MacIndexedFragment, 66 } 67 68 alias void FSSpec; 69 70 struct _N3 71 { 72 FSSpec *fsspec; 73 char *name; 74 } 75 76 struct _N4 77 { 78 FSSpec *fsspec; 79 PRUint32 index; 80 } 81 82 union _N2 83 { 84 char *pathname; 85 struct _N3 86 { 87 FSSpec *fsspec; 88 char *name; 89 } 90 _N3 mac_named_fragment; 91 struct _N4 92 { 93 FSSpec *fsspec; 94 PRUint32 index; 95 } 96 _N4 mac_indexed_fragment; 97 } 98 99 struct PRLibSpec 100 { 101 int type; 102 union _N2 103 { 104 char *pathname; 105 struct _N3 106 { 107 FSSpec *fsspec; 108 char *name; 109 } 110 _N3 mac_named_fragment; 111 struct _N4 112 { 113 FSSpec *fsspec; 114 PRUint32 index; 115 } 116 _N4 mac_indexed_fragment; 117 } 118 _N2 value; 119 } 120 121 const PR_LD_LAZY = 0x1; 122 const PR_LD_NOW = 0x2; 123 const PR_LD_GLOBAL = 0x4; 124 const PR_LD_LOCAL = 0x8; 125 126 PRLibrary * PR_LoadLibraryWithFlags(PRLibSpec libSpec, PRIntn flags); 127 PRStatus PR_UnloadLibrary(PRLibrary *lib); 128 void * PR_FindSymbol(PRLibrary *lib, char *name); 129 130 alias void function()PRFuncPtr; 131 132 PRFuncPtr PR_FindFunctionSymbol(PRLibrary *lib, char *name); 133 void * PR_FindSymbolAndLibrary(char *name, PRLibrary **lib); 134 PRFuncPtr PR_FindFunctionSymbolAndLibrary(char *name, PRLibrary **lib); 135 PRLibrary * PR_LoadStaticLibrary(char *name, PRStaticLinkTable *table); 136 char * PR_GetLibraryFilePathname(char *name, PRFuncPtr addr);