Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair linux64x64 compilation #688

Open
wants to merge 5 commits into
base: Cog
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; }
Expand Down
1 change: 1 addition & 0 deletions platforms/unix/vm-display-X11/sqUnixX11.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

#include "sq.h"
#include "sqMemoryAccess.h"
#include "sqAssert.h"

#include "sqUnixMain.h"
#include "sqUnixGlobals.h"
Expand Down
27 changes: 13 additions & 14 deletions platforms/unix/vm-sound-ALSA/sqUnixSoundALSA.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -382,13 +382,13 @@ static double sound_GetRecordingSampleRate(void)
# include <sys/time.h>

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
Expand Down Expand Up @@ -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)
Expand All @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down
25 changes: 12 additions & 13 deletions platforms/unix/vm-sound-OSS/sqUnixSoundOSS.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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));*/

Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions platforms/unix/vm-sound-null/sqUnixSoundNull.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
18 changes: 8 additions & 10 deletions platforms/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);


/* ==================== */
Expand Down Expand Up @@ -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;
}
Expand Down
17 changes: 8 additions & 9 deletions platforms/unix/vm-sound-sndio/sqUnixSndioSound.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions platforms/unix/vm/sqPlatformSpecific.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
6 changes: 3 additions & 3 deletions platforms/unix/vm/sqUnixMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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];
Expand All @@ -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);
Expand Down