Skip to content

Commit

Permalink
Oops! Delete platforms/win32/plugins/SqueakFFIPrims/sqWin32FFI.c whic…
Browse files Browse the repository at this point in the history
…h provides

obsolete support. platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c is very
much in use!
Undo the damage of e632352
  • Loading branch information
eliotmiranda committed Sep 16, 2021
1 parent e632352 commit ab171a6
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 397 deletions.
72 changes: 72 additions & 0 deletions platforms/Cross/plugins/SqueakFFIPrims/sqFFIPlugin.c
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;
}
2 changes: 1 addition & 1 deletion platforms/win32/plugins/SqueakFFIPrims/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WIN32DIR:= $(PLATDIR)/win32/plugins/$(LIBNAME)

%:
$(MAKE) -f ../../Makefile.plugin VPATH="$(CROSSDIR) $(MAKERDIR) $(WIN32DIR) $(OBJDIR)" \
CROSSSRC="sqFFITestFuncs.c sqManualSurface.c" \
CROSSSRC="sqFFIPlugin.c sqFFITestFuncs.c sqManualSurface.c" \
MAKERSRC="SqueakFFIPrims.c" \
WIN32SRC="" \
$@
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/plugins/SqueakFFIPrims/Makefile.msvc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2020 3D Immersive Collaboration Consulting, LLC
#############################################################################

LIBSRC:=SqueakFFIPrims.c sqFFITestFuncs.c sqManualSurface.c
LIBSRC:=SqueakFFIPrims.c sqFFIPlugin.c sqFFITestFuncs.c sqManualSurface.c

include ../common/Makefile.msvc.plugin

Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/plugins/SqueakFFIPrims/Makefile.plugin
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WIN32DIR:= $(PLATDIR)/win32/plugins/$(LIBNAME)

%:
$(MAKE) -f ../common/Makefile.plugin VPATH="$(CROSSDIR) $(MAKERDIR) $(WIN32DIR) $(OBJDIR)" \
CROSSSRC="sqFFITestFuncs.c sqManualSurface.c" \
CROSSSRC="sqFFIPlugin.c sqFFITestFuncs.c sqManualSurface.c" \
MAKERSRC="SqueakFFIPrims.c" \
WIN32SRC="" \
$@
Expand Down
Loading

0 comments on commit ab171a6

Please sign in to comment.