diff --git a/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c b/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c index 5a68ec9820..09fafae049 100644 --- a/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c +++ b/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c @@ -49,6 +49,7 @@ extern void dndReceived(char *fileName); #if defined(SQUEAK_INTERNAL_PLUGIN) extern SQFile * fileValueOf(sqInt objectPointer); +extern usqIntptr_t fileRecordSize(void); #else /* Return a pointer to the first byte of of the SQFile data structure file record within anSQFileRecord, which is expected to be a ByteArray of size @@ -61,6 +62,15 @@ fileValueOf(sqInt anSQFileRecord) { return interpreterProxy->arrayValueOf(anSQFileRecord); } + +/* Return the size of a Smalltalk file record in bytes. */ + + /* FilePlugin>>#fileRecordSize */ +static usqIntptr_t +fileRecordSize(void) +{ + return sizeof(SQFile); +} #endif /* defined(SQUEAK_INTERNAL_PLUGIN) */ sqInt dropInit(void) { return 1; } diff --git a/platforms/unix/vm-display-X11/sqUnixX11.c b/platforms/unix/vm-display-X11/sqUnixX11.c index 1e0eedfc83..4033a1132a 100644 --- a/platforms/unix/vm-display-X11/sqUnixX11.c +++ b/platforms/unix/vm-display-X11/sqUnixX11.c @@ -55,6 +55,7 @@ #include "sq.h" #include "sqMemoryAccess.h" +#include "sqAssert.h" #include "sqUnixMain.h" #include "sqUnixGlobals.h" diff --git a/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c b/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c index 1a6bb2ef6b..1b49916448 100644 --- a/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c +++ b/platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c @@ -278,13 +278,13 @@ static sqInt sound_AvailableSpace(void) #endif } -static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime) FAIL(frameCount) +static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime) FAIL(frameCount) -static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex) +static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex) { if (playback_handle) { - void *samples= (void *)arrayIndex + startIndex * output_channels * 2; + void *samples= arrayIndex + startIndex * output_channels * 2; int count= snd_pcm_writei(playback_handle, samples, frameCount); if (count < 0) { @@ -382,13 +382,13 @@ static double sound_GetRecordingSampleRate(void) # include static sqInt -protected_sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) +protected_sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) { /* see git://android.git.kernel.org/platform/hardware/alsa_sound.git/ * AudioStreamInALSA.cpp: AudioStreamInALSA::read */ if (capture_handle) { - void *samples= (void *)buf + (startSliceIndex * 2); + void *samples= buf + (startSliceIndex * 2); # if 1 int frameCount= ((bufferSizeInBytes / 2) - startSliceIndex) / input_channels; # else @@ -424,12 +424,12 @@ protected_sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqIn } #endif /* PROTECT_RECORD_SAMPLES */ -static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) +static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) { #if 0 if (capture_handle) { - void *samples= (void *)buf + (startSliceIndex * 2); + void *samples= buf + (startSliceIndex * 2); int frameCount= ((bufferSizeInBytes / 2) - startSliceIndex) / input_channels; int count= snd_pcm_readi(capture_handle, samples, frameCount); if (count < 0) @@ -446,7 +446,7 @@ static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, s return 0; #elif 1 if (capture_handle) { - void *samples= (void *)buf + (startSliceIndex * 2); + void *samples= buf + (startSliceIndex * 2); int frameCount= ((bufferSizeInBytes / 2) - startSliceIndex) / input_channels; int count; @@ -474,7 +474,7 @@ static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, s * AudioStreamInALSA.cpp: AudioStreamInALSA::read */ if (capture_handle) { - void *samples= (void *)buf + (startSliceIndex * 2); + void *samples= buf + (startSliceIndex * 2); # if 0 int frameCount= ((bufferSizeInBytes / 2) - startSliceIndex) / input_channels; # else @@ -823,10 +823,9 @@ static void sound_SetVolume(double left, double right) * where 0 is the lowest recording level and 1000 is the maximum. Do nothing * if the sound input hardware does not support changing the recording level. */ -static sqInt sound_SetRecordLevel(sqInt level) +static void sound_SetRecordLevel(sqInt level) { mixer_default_volume_get_set(CaptureSetting, 0, (double)level / 1000.0); - return 1; } /* Squeak Prim: Get the recording level to the given value in the range 0-1000, @@ -840,7 +839,7 @@ static sqInt sound_GetRecordLevel(void) /* eem Feb 7 2010 after hrs' SoundRecord return level * 1000.0L; } -static sqInt sound_SetDevice(sqInt id, char *arg) +static sqInt sound_SetDevice(int id, char *arg) { #if HARDWIRE_DEFAULT return 1; @@ -864,7 +863,7 @@ static sqInt sound_SetDevice(sqInt id, char *arg) #endif } -static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel) +static sqInt sound_GetSwitch(int id, int captureFlag, int channel) { if (id == 0) return mixer_getSwitch(sound_device, captureFlag, channel); @@ -875,7 +874,7 @@ static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel) return -1; } -static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter) +static sqInt sound_SetSwitch(int id, int captureFlag, int parameter) { if (id == 0) return mixer_setSwitch(sound_device, captureFlag, parameter); diff --git a/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c b/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c index e760144301..967fde5de6 100644 --- a/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c +++ b/platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c @@ -750,16 +750,16 @@ static sqInt sound_AvailableSpace(void) } -static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime) +static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime) { return success(false); } -static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex) +static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex) { assert(out->write != 0); - return out->write(out, pointerForOop(arrayIndex) + startIndex * out->sq.bpf, frameCount); + return out->write(out, ((unsigned char *) arrayIndex) + startIndex * out->sq.bpf, frameCount); } @@ -828,7 +828,7 @@ static double sound_GetRecordingSampleRate(void) } -static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) +static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) { /*PRINTF(("record %d %d %d\n", buf, startSliceIndex, bufferSizeInBytes));*/ @@ -854,7 +854,7 @@ static sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, s frameCount= min(frameCount, framesAvail); /*PRINTF(("<%d", frameCount * in->hw.bpf));*/ return in->read(in, - pointerForOop(buf) + startSliceIndex * 2, + ((unsigned char *) buf) + startSliceIndex * 2, frameCount) * in->sq.channels; } @@ -1026,9 +1026,9 @@ static int sound_RecordLevel(int *level) #endif -static sqInt sound_SetRecordLevel(sqInt level) +static void sound_SetRecordLevel(sqInt level) { - if (noSoundMixer) return 1; + if (noSoundMixer) return; if (mixer || (mixer= mixerOpen(&dev_mixer))) { level= level * LEVEL_MAX / 1000; @@ -1037,23 +1037,22 @@ static sqInt sound_SetRecordLevel(sqInt level) else if (level > 255) level= 255; - if (mixerSetLevel(mixer, SOUND_MIXER_RECLEV, level, level)) return 1; - if (mixerSetLevel(mixer, SOUND_MIXER_IGAIN, level, level)) return 1; + if (mixerSetLevel(mixer, SOUND_MIXER_RECLEV, level, level)) return; + if (mixerSetLevel(mixer, SOUND_MIXER_IGAIN, level, level)) return; } - return 0; } -static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter) +static sqInt sound_SetSwitch(int id, int captureFlag, int parameter) { return -1; } -static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel) +static sqInt sound_GetSwitch(int id, int captureFlag, int channel) { return -1; } -static sqInt sound_SetDevice(sqInt id, char *arg) +static sqInt sound_SetDevice(int id, char *arg) { return -1; } diff --git a/platforms/unix/vm-sound-null/sqUnixSoundNull.c b/platforms/unix/vm-sound-null/sqUnixSoundNull.c index 0656e93957..cb9a58e474 100644 --- a/platforms/unix/vm-sound-null/sqUnixSoundNull.c +++ b/platforms/unix/vm-sound-null/sqUnixSoundNull.c @@ -59,11 +59,11 @@ static sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, /* mixer */ static void sound_Volume(double *left, double *right) { return; } static void sound_SetVolume(double left, double right) { return; } -static sqInt sound_SetRecordLevel(sqInt level) { return level; } +static void sound_SetRecordLevel(sqInt level) { return; } -static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter) FAIL(-1) -static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel) FAIL(-1) -static sqInt sound_SetDevice(sqInt id, char *arg) FAIL(-1) +static sqInt sound_SetSwitch(int id, int captureFlag, int parameter) FAIL(-1) +static sqInt sound_GetSwitch(int id, int captureFlag, int channel) FAIL(-1) +static sqInt sound_SetDevice(int id, char *arg) FAIL(-1) /* eem Feb 7 2010 after hrs' SoundRecorder extras. */ diff --git a/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c b/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c index 5a11eb0d14..f0b915e25c 100644 --- a/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c +++ b/platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c @@ -213,10 +213,10 @@ static int mixer_setSwitch(char *name, int captureFlag, int parameter); static int mixer_getSwitch(char *name, int captureFlag, int channel); static void sound_Volume(double *left, double *right); static void sound_SetVolume(double left, double right); -static sqInt sound_SetRecordLevel(sqInt level); -static sqInt sound_SetDevice(sqInt id, char *arg); -static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel); -static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter); +static void sound_SetRecordLevel(sqInt level); +static sqInt sound_SetDevice(int id, char *arg); +static sqInt sound_GetSwitch(int id, int captureFlag, int channel); +static sqInt sound_SetSwitch(int id, int captureFlag, int parameter); /* ==================== */ @@ -1093,23 +1093,21 @@ static void sound_SetVolume(double left, double right) { trace(); } -static sqInt sound_SetRecordLevel(sqInt level) { +static void sound_SetRecordLevel(sqInt level) { trace(); - return 1; - return level; } -static sqInt sound_SetDevice(sqInt id, char *arg) { +static sqInt sound_SetDevice(int id, char *arg) { trace(); return -1; } -static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel) { +static sqInt sound_GetSwitch(int id, int captureFlag, int channel) { trace(); return -1; } -static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter) { +static sqInt sound_SetSwitch(int id, int captureFlag, int parameter) { trace(); return -1; } diff --git a/platforms/unix/vm-sound-sndio/sqUnixSndioSound.c b/platforms/unix/vm-sound-sndio/sqUnixSndioSound.c index 25c92b4042..5cc882ce1a 100644 --- a/platforms/unix/vm-sound-sndio/sqUnixSndioSound.c +++ b/platforms/unix/vm-sound-sndio/sqUnixSndioSound.c @@ -32,17 +32,17 @@ static sqInt sound_AvailableSpace(void) return par.bufsz * par.bps * par.pchan; } -static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, sqInt srcBufPtr, sqInt samplesOfLeadTime) +static sqInt sound_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime) { trace(); return success(false); } -static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, sqInt arrayIndex, sqInt startIndex) +static sqInt sound_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex) { size_t bytes_played; trace(); - bytes_played = sio_write(snd, pointerForOop(arrayIndex) + startIndex * (par.bps * par.pchan), frameCount * par.bps * par.pchan); + bytes_played = sio_write(snd, ((unsigned char*) arrayIndex) + startIndex * (par.bps * par.pchan), frameCount * par.bps * par.pchan); if (bytes_played < 0) return 0; return bytes_played / (par.bps * par.pchan); @@ -145,7 +145,7 @@ double sound_GetRecordingSampleRate(void) return 8192; } -sqInt sound_RecordSamplesIntoAtLength(sqInt buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) +sqInt sound_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes) { trace(); return 8192; @@ -165,17 +165,16 @@ void sound_SetVolume(double left, double right) trace(); } -sqInt sound_SetRecordLevel(sqInt level) +void sound_SetRecordLevel(sqInt level) { trace(); - return level; } -sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel) { return success(true); } +sqInt sound_GetSwitch(int id, int captureFlag, int channel) { return success(true); } -sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter) { return success(true); } +sqInt sound_SetSwitch(int id, int captureFlag, int parameter) { return success(true); } -sqInt sound_SetDevice(sqInt id, char *name) { return success(true); } +sqInt sound_SetDevice(int id, char *name) { return success(true); } #include "SqSound.h" diff --git a/platforms/unix/vm/sqPlatformSpecific.h b/platforms/unix/vm/sqPlatformSpecific.h index 2dd88e5044..0145b0ef5f 100644 --- a/platforms/unix/vm/sqPlatformSpecific.h +++ b/platforms/unix/vm/sqPlatformSpecific.h @@ -149,4 +149,10 @@ extern void sqFilenameFromString(char *uxName, sqInt stNameIndex, int sqNameLeng # endif /* defined(i386) */ # endif /* COGVM && defined(__SUNPRO_C) */ +/* DISGUSTING HACK to get XDisplayControlPlugin.h to compile without changing VMMaker. Eliot, I'm sorry */ +extern int forgetXDisplay(void); +extern int disconnectXDisplay(void); +extern int openXDisplay(void); +extern int synchronizeXDisplay(void); + #endif /* _SQ_PLATFORM_SPECIFIC_H */ diff --git a/platforms/unix/vm/sqUnixMain.c b/platforms/unix/vm/sqUnixMain.c index c4a5666cd8..b71ab1ac67 100644 --- a/platforms/unix/vm/sqUnixMain.c +++ b/platforms/unix/vm/sqUnixMain.c @@ -1160,7 +1160,7 @@ crashDumpFile() } static void -sigusr1(int sig, siginfo_t *info, ucontext_t *uap) +sigusr1(int sig, siginfo_t *info, void *uap) { int saved_errno = errno; time_t now = time(NULL); @@ -1188,7 +1188,7 @@ sqInt ioCanCatchFFIExceptions() { return 1; } static void -sigsegv(int sig, siginfo_t *info, ucontext_t *uap) +sigsegv(int sig, siginfo_t *info, void *uap) { time_t now = time(NULL); char ctimebuf[32]; @@ -1203,7 +1203,7 @@ sigsegv(int sig, siginfo_t *info, ucontext_t *uap) if (!inFault) { extern sqInt primitiveFailForFFIExceptionat(usqLong exceptionCode, usqInt pc); - primitiveFailForFFIExceptionat(sig, uap->_PC_IN_UCONTEXT); + primitiveFailForFFIExceptionat(sig, ((ucontext_t *) uap)->_PC_IN_UCONTEXT); inFault = 1; crashdump = crashDumpFile(); ctime_r(&now,ctimebuf);