| 1 |
/* |
| 2 |
* tclLoadNone.c -- |
| 3 |
* |
| 4 |
* This procedure provides a version of the TclpDlopen for use in |
| 5 |
* systems that don't support dynamic loading; it just returns an error. |
| 6 |
* |
| 7 |
* Copyright (c) 1995-1997 Sun Microsystems, Inc. |
| 8 |
* |
| 9 |
* See the file "license.terms" for information on usage and redistribution of |
| 10 |
* this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 11 |
*/ |
| 12 |
|
| 13 |
#include "tclInt.h" |
| 14 |
|
| 15 |
/* |
| 16 |
*---------------------------------------------------------------------- |
| 17 |
* |
| 18 |
* TclpDlopen -- |
| 19 |
* |
| 20 |
* This procedure is called to carry out dynamic loading of binary code; |
| 21 |
* it is intended for use only on systems that don't support dynamic |
| 22 |
* loading (it returns an error). |
| 23 |
* |
| 24 |
* Results: |
| 25 |
* The result is TCL_ERROR, and an error message is left in the interp's |
| 26 |
* result. |
| 27 |
* |
| 28 |
* Side effects: |
| 29 |
* None. |
| 30 |
* |
| 31 |
*---------------------------------------------------------------------- |
| 32 |
*/ |
| 33 |
|
| 34 |
int |
| 35 |
TclpDlopen( |
| 36 |
Tcl_Interp *interp, /* Used for error reporting. */ |
| 37 |
Tcl_Obj *pathPtr, /* Name of the file containing the desired |
| 38 |
* code (UTF-8). */ |
| 39 |
Tcl_LoadHandle *loadHandle, /* Filled with token for dynamically loaded |
| 40 |
* file which will be passed back to |
| 41 |
* (*unloadProcPtr)() to unload the file. */ |
| 42 |
Tcl_FSUnloadFileProc **unloadProcPtr, |
| 43 |
/* Filled with address of Tcl_FSUnloadFileProc |
| 44 |
* function which should be used for this |
| 45 |
* file. */ |
| 46 |
int flags) |
| 47 |
{ |
| 48 |
if (interp) { |
| 49 |
Tcl_SetObjResult(interp, Tcl_NewStringObj( |
| 50 |
"dynamic loading is not currently available on this system", |
| 51 |
-1)); |
| 52 |
} |
| 53 |
return TCL_ERROR; |
| 54 |
} |
| 55 |
|
| 56 |
/* |
| 57 |
*---------------------------------------------------------------------- |
| 58 |
* |
| 59 |
* TclGuessPackageName -- |
| 60 |
* |
| 61 |
* If the "load" command is invoked without providing a package name, |
| 62 |
* this procedure is invoked to try to figure it out. |
| 63 |
* |
| 64 |
* Results: |
| 65 |
* Always returns 0 to indicate that we couldn't figure out a package |
| 66 |
* name; generic code will then try to guess the package from the file |
| 67 |
* name. A return value of 1 would have meant that we figured out the |
| 68 |
* package name and put it in bufPtr. |
| 69 |
* |
| 70 |
* Side effects: |
| 71 |
* None. |
| 72 |
* |
| 73 |
*---------------------------------------------------------------------- |
| 74 |
*/ |
| 75 |
|
| 76 |
int |
| 77 |
TclGuessPackageName( |
| 78 |
const char *fileName, /* Name of file containing package (already |
| 79 |
* translated to local form if needed). */ |
| 80 |
Tcl_DString *bufPtr) /* Initialized empty dstring. Append package |
| 81 |
* name to this if possible. */ |
| 82 |
{ |
| 83 |
return 0; |
| 84 |
} |
| 85 |
|
| 86 |
/* |
| 87 |
* These functions are fallbacks if we somehow determine that the platform can |
| 88 |
* do loading from memory but the user wishes to disable it. They just report |
| 89 |
* (gracefully) that they fail. |
| 90 |
*/ |
| 91 |
|
| 92 |
#ifdef TCL_LOAD_FROM_MEMORY |
| 93 |
|
| 94 |
MODULE_SCOPE void * |
| 95 |
TclpLoadMemoryGetBuffer( |
| 96 |
size_t size) /* Dummy: unused by this implementation */ |
| 97 |
{ |
| 98 |
return NULL; |
| 99 |
} |
| 100 |
|
| 101 |
MODULE_SCOPE int |
| 102 |
TclpLoadMemory( |
| 103 |
void *buffer, /* Dummy: unused by this implementation */ |
| 104 |
size_t size, /* Dummy: unused by this implementation */ |
| 105 |
int codeSize, /* Dummy: unused by this implementation */ |
| 106 |
const char *path, /* Dummy: unused by this implementation */ |
| 107 |
Tcl_LoadHandle *loadHandle, /* Dummy: unused by this implementation */ |
| 108 |
Tcl_FSUnloadFileProc **unloadProcPtr, |
| 109 |
/* Dummy: unused by this implementation */ |
| 110 |
int flags) |
| 111 |
/* Dummy: unused by this implementation */ |
| 112 |
{ |
| 113 |
return TCL_ERROR; |
| 114 |
} |
| 115 |
|
| 116 |
#endif /* TCL_LOAD_FROM_MEMORY */ |
| 117 |
|
| 118 |
/* |
| 119 |
* Local Variables: |
| 120 |
* mode: c |
| 121 |
* c-basic-offset: 4 |
| 122 |
* fill-column: 78 |
| 123 |
* End: |
| 124 |
*/ |