1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-
+
|
/*
* tclLoadNext.c --
*
* This procedure provides a version of the TclLoadFile that
* works with NeXTs rld_* dynamic loading. This file provided
* by Pedja Bogdanovich.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclLoadNext.c,v 1.9 2002/07/18 15:04:54 vincentdarley Exp $
* RCS: @(#) $Id: tclLoadNext.c,v 1.10 2002/07/18 16:26:04 vincentdarley Exp $
*/
#include "tclInt.h"
#include <mach-o/rld.h>
#include <streams/streams.h>
/*
|
| ︙ | | |
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
-
+
|
*/
int
TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)
Tcl_Interp *interp; /* Used for error reporting. */
Tcl_Obj *pathPtr; /* Name of the file containing the desired
* code (UTF-8). */
TclLoadHandle *loadHandle; /* Filled with token for dynamically loaded
Tcl_LoadHandle *loadHandle; /* Filled with token for dynamically loaded
* file which will be passed back to
* (*unloadProcPtr)() to unload the file. */
Tcl_FSUnloadFileProc **unloadProcPtr;
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for
* this file. */
{
|
| ︙ | | |
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
-
+
|
NXGetMemoryBuffer(errorStream,&data,&len,&maxlen);
Tcl_AppendResult(interp,"couldn't load file \"",fileName,"\": ",data,NULL);
NXCloseMemory(errorStream,NX_FREEBUFFER);
return TCL_ERROR;
}
NXCloseMemory(errorStream,NX_FREEBUFFER);
*loadHandle = (TclLoadHandle)1; /* A dummy non-NULL value */
*loadHandle = (Tcl_LoadHandle)1; /* A dummy non-NULL value */
*unloadProcPtr = &TclpUnloadFile;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
|
| ︙ | | |
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
-
+
|
* message in the interp's result.
*
*----------------------------------------------------------------------
*/
Tcl_PackageInitProc*
TclpFindSymbol(interp, loadHandle, symbol)
Tcl_Interp *interp;
TclLoadHandle loadHandle;
Tcl_LoadHandle loadHandle;
CONST char *symbol;
{
Tcl_PackageInitProc *proc=NULL;
if(symbol) {
char sym[strlen(symbol)+2];
sym[0]='_'; sym[1]=0; strcat(sym,symbol);
rld_lookup(NULL,sym,(unsigned long *)&proc);
|
| ︙ | | |
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
-
+
|
* Does nothing. Can anything be done?
*
*----------------------------------------------------------------------
*/
void
TclpUnloadFile(loadHandle)
TclLoadHandle loadHandle; /* loadHandle returned by a previous call
Tcl_LoadHandle loadHandle; /* loadHandle returned by a previous call
* to TclpDlopen(). The loadHandle is
* a token that represents the loaded
* file. */
{
}
/*
|
| ︙ | | |