forked from OpenSmalltalk/opensmalltalk-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oops! Delete platforms/win32/plugins/SqueakFFIPrims/sqWin32FFI.c whic…
…h provides obsolete support. platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c is very much in use! Undo the damage of e632352
- Loading branch information
1 parent
e632352
commit ab171a6
Showing
5 changed files
with
75 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/**************************************************************************** | ||
* PROJECT: Squeak threaded foreign function interface | ||
* FILE: sqFFIPlugin.c | ||
* CONTENT: C support code for the threaded FFIPlugin | ||
* | ||
* AUTHOR: Eliot Miranda | ||
* | ||
*****************************************************************************/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> /* proto for alloca in MINGW */ | ||
#if !_WIN32 && !__FreeBSD__ && !__OpenBSD__ | ||
# include <alloca.h> | ||
#endif | ||
#include <string.h> | ||
|
||
#ifdef _MSC_VER | ||
# include <windows.h> | ||
# define alloca _alloca | ||
#endif | ||
|
||
/* this is a stub through which floating-point register arguments can be loaded | ||
* prior to an FFI call proper. e.g. on the PowerPC this would be declared as | ||
* extern void loadFloatRegs(double, double, double, double, | ||
* double, double, double, double); | ||
* and called with the appropriate values necessary to load the floating-point | ||
* argument registers. Immediately after the actual call is made, using the | ||
* undisturbed register contents created by the call of loadFloatRegs. | ||
*/ | ||
void | ||
loadFloatRegs(void) { return; } | ||
|
||
static FILE *ffiLogFile = NULL; | ||
|
||
int | ||
ffiLogFileNameOfLength(void *nameIndex, int nameLength) | ||
{ | ||
if (nameIndex && nameLength) { | ||
char *fileName; | ||
FILE *fp; | ||
|
||
if (!(fileName = alloca(nameLength+1))) | ||
return 0; | ||
strncpy(fileName, nameIndex, nameLength); | ||
fileName[nameLength] = 0; | ||
/* attempt to open the file and if we can't, fail */ | ||
if (!(fp = fopen(fileName, "at"))) | ||
return 0; | ||
/* close the old log file if needed and use the new one */ | ||
if (ffiLogFile) | ||
fclose(ffiLogFile); | ||
ffiLogFile = fp; | ||
fprintf(ffiLogFile, "------- Log started -------\n"); | ||
fflush(fp); | ||
} | ||
else { | ||
if (ffiLogFile) | ||
fclose(ffiLogFile); | ||
ffiLogFile = NULL; | ||
} | ||
return 1; | ||
} | ||
|
||
int | ||
ffiLogCallOfLength(void *nameIndex, int nameLength) | ||
{ | ||
if (!ffiLogFile) | ||
return 0; | ||
fprintf(ffiLogFile, "%.*s\n", nameLength, (char *)nameIndex); | ||
fflush(ffiLogFile); | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.