projects/aports·blob master · refs

1744 lines · 67.0 KiB

1commit c51ecefde798e81c64f66765d055e0d223001bb1
2Author: Sertonix <[email protected]>
3Date: 2025-09-01T19:54:56+02:00
4
5 Fix compilation with modern toolchain
6
7 Patch-Source: https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/c79702286ddf799bb01d94dc64d54bee173e55aa
8 Patch-Source: https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f9eb3d2efe58a331361cbc7c10b8bf12faa8e375
9 Patch-Source: https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/a1ed45f3102e99d94170fa2a25df5d7d3bba3d60
10 Patch-Source: https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/535886f96ac5b117b55d0cbb6bdffab4643b6043
11 Patch-Source: https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4e2add2d44380218f452c90b489afbb575162f14
12
13 And many more changes
14
15diff --git a/Cross/plugins/AsynchFilePlugin/AsynchFilePlugin.h b/Cross/plugins/AsynchFilePlugin/AsynchFilePlugin.h
16index 0622458..45814fd 100644
17--- a/Cross/plugins/AsynchFilePlugin/AsynchFilePlugin.h
18+++ b/Cross/plugins/AsynchFilePlugin/AsynchFilePlugin.h
19@@ -10,9 +10,9 @@ typedef struct {
20 } AsyncFile;
21
22 int asyncFileClose(AsyncFile *f);
23-int asyncFileOpen(AsyncFile *f, int fileNamePtr, int fileNameSize, int writeFlag, int semaIndex);
24+int asyncFileOpen(AsyncFile *f, char *fileNamePtr, int fileNameSize, int writeFlag, int semaIndex);
25 int asyncFileRecordSize();
26-int asyncFileReadResult(AsyncFile *f, int bufferPtr, int bufferSize);
27+int asyncFileReadResult(AsyncFile *f, char *bufferPtr, int bufferSize);
28 int asyncFileReadStart(AsyncFile *f, int fPosition, int count);
29 int asyncFileWriteResult(AsyncFile *f);
30-int asyncFileWriteStart(AsyncFile *f, int fPosition, int bufferPtr, int bufferSize);
31+int asyncFileWriteStart(AsyncFile *f, int fPosition, char *bufferPtr, int bufferSize);
32diff --git a/Cross/plugins/CroquetPlugin/CroquetPlugin.h b/Cross/plugins/CroquetPlugin/CroquetPlugin.h
33index fa8fbe8..84dbc89 100644
34--- a/Cross/plugins/CroquetPlugin/CroquetPlugin.h
35+++ b/Cross/plugins/CroquetPlugin/CroquetPlugin.h
36@@ -19,5 +19,6 @@
37 Non-zero if successful, zero otherwise.
38 */
39 int ioGatherEntropy(char *bufPtr, int bufSize);
40+int triBoxOverlap(float *a, float *b, float *c, float *d, float *e);
41
42 #endif /* CROQUET_PLUGIN_H */
43diff --git a/Cross/plugins/HostWindowPlugin/HostWindowPlugin.h b/Cross/plugins/HostWindowPlugin/HostWindowPlugin.h
44index fcbe0c8..05be47a 100644
45--- a/Cross/plugins/HostWindowPlugin/HostWindowPlugin.h
46+++ b/Cross/plugins/HostWindowPlugin/HostWindowPlugin.h
47@@ -18,7 +18,7 @@ char * list, sqInt attributeListLength);
48
49 /* ioShowDisplayOnWindow: similar to ioShowDisplay but adds the sqInt windowIndex
50 * Return true if ok, false if not, but not currently checked */
51-extern sqInt ioShowDisplayOnWindow( unsigned char* dispBitsIndex, sqInt width, sqInt
52+extern sqInt ioShowDisplayOnWindow( unsigned* dispBitsIndex, sqInt width, sqInt
53 height, sqInt depth, sqInt affectedL, sqInt affectedR, sqInt affectedT, sqInt affectedB,
54 sqInt windowIndex);
55
56diff --git a/Cross/plugins/MIDIPlugin/MIDIPlugin.h b/Cross/plugins/MIDIPlugin/MIDIPlugin.h
57index 7d25ce1..0362553 100644
58--- a/Cross/plugins/MIDIPlugin/MIDIPlugin.h
59+++ b/Cross/plugins/MIDIPlugin/MIDIPlugin.h
60@@ -7,7 +7,7 @@ int midiShutdown(void);
61 int sqMIDIGetClock(void);
62 int sqMIDIGetPortCount(void);
63 int sqMIDIGetPortDirectionality(int portNum);
64-int sqMIDIGetPortName(int portNum, int namePtr, int length);
65+int sqMIDIGetPortName(int portNum, char * namePtr, int length);
66 int sqMIDIClosePort(int portNum);
67 int sqMIDIOpenPort(int portNum, int readSemaIndex, int interfaceClockRate);
68 int sqMIDIParameterSet(int whichParameter, int newValue);
69diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/header.c b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/header.c
70index dcb53b2..69c7da5 100755
71--- a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/header.c
72+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/header.c
73@@ -31,6 +31,7 @@
74 */
75
76 #include "mpeg3audio.h"
77+#include "mpeg3protos.h"
78 #include "tables.h"
79
80 #include <stdio.h>
81diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer1.c b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer1.c
82index 8bdcba8..63ddd5f 100755
83--- a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer1.c
84+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer1.c
85@@ -32,5 +32,5 @@
86
87 int mpeg3audio_dolayer1(mpeg3audio_t *audio)
88 {
89- ;
90+ return 0;
91 }
92diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer3.c b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer3.c
93index ac7e989..17f01bb 100755
94--- a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer3.c
95+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/layer3.c
96@@ -875,7 +875,7 @@ int mpeg3audio_III_hybrid(mpeg3audio_t *audio,
97 return 0;
98 }
99
100-int mpeg3audio_III_antialias(mpeg3audio_t *audio,
101+void mpeg3audio_III_antialias(mpeg3audio_t *audio,
102 float xr[SBLIMIT][SSLIMIT],
103 struct gr_info_s *gr_info)
104 {
105@@ -919,13 +919,12 @@ int mpeg3audio_III_antialias(mpeg3audio_t *audio,
106 }
107 }
108 }
109- return 0;
110 }
111
112 /*
113 * III_stereo: calculate float channel values for Joint-I-Stereo-mode
114 */
115-int mpeg3audio_III_i_stereo(mpeg3audio_t *audio,
116+void mpeg3audio_III_i_stereo(mpeg3audio_t *audio,
117 float xr_buf[2][SBLIMIT][SSLIMIT],
118 int *scalefac,
119 struct gr_info_s *gr_info,
120diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/mpeg3audio.h b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/mpeg3audio.h
121index c1d7c88..9f902b8 100755
122--- a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/mpeg3audio.h
123+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/mpeg3audio.h
124@@ -4,6 +4,8 @@
125 #ifndef MPEG3AUDIO_H
126 #define MPEG3AUDIO_H
127
128+typedef struct mpeg3 mpeg3_t;
129+
130 #include "ac3.h"
131 #include "bitstream.h"
132 #ifndef M_PI
133@@ -124,5 +126,34 @@ typedef struct
134 } mpeg3audio_t;
135
136
137-
138-#endif
139+/* dct.c */
140+int mpeg3audio_dct64_1(float *out0, float *out1, float *b1, float *b2, float *samples);
141+int mpeg3audio_dct64(float *a, float *b, float *c);
142+int mpeg3audio_dct36(float *inbuf, float *o1, float *o2, float *wintab, float *tsbuf);
143+int mpeg3audio_dct12(float *in, float *rawout1, float *rawout2, register float *wi, register float *ts);
144+int mpeg3audio_imdct_init(mpeg3audio_t *audio);
145+/* header.c */
146+int mpeg3audio_prev_header(mpeg3audio_t *audio);
147+int mpeg3audio_read_header(mpeg3audio_t *audio);
148+/* layer2.c */
149+int mpeg3audio_dolayer2(mpeg3audio_t *audio);
150+/* layer3.c */
151+int mpeg3audio_read_layer3_frame(mpeg3audio_t *audio);
152+int mpeg3audio_dolayer3(mpeg3audio_t *audio);
153+/* mpeg3audio.c */
154+int mpeg3audio_replace_buffer(mpeg3audio_t *audio, long new_allocation);
155+int mpeg3audio_seek_percentage(mpeg3audio_t *audio, double percentage);
156+int mpeg3audio_seek_sample(mpeg3audio_t *audio, long sample);
157+int mpeg3audio_read_raw(mpeg3audio_t *audio, unsigned char *output, long *size, long max_size);
158+int mpeg3audio_decode_audio(mpeg3audio_t *audio, float *output_f, short *output_i, int channel, long start_position, long len);
159+/* pcm.c */
160+int mpeg3audio_read_pcm_header(mpeg3audio_t *audio);
161+int mpeg3audio_do_pcm(mpeg3audio_t *audio);
162+/* synthesizers.c */
163+int mpeg3audio_synth_stereo(mpeg3audio_t *audio, float *bandPtr, int channel, float *out, int *pnt);
164+int mpeg3audio_synth_mono(mpeg3audio_t *audio, float *bandPtr, float *samples, int *pnt);
165+int mpeg3audio_reset_synths(mpeg3audio_t *audio);
166+/* tables.c */
167+int mpeg3audio_new_decode_tables(mpeg3audio_t *audio);
168+
169+#endif /* MPEG3AUDIO_H */
170diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/pcm.c b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/pcm.c
171index 111db6a..a307c65 100755
172--- a/Cross/plugins/Mpeg3Plugin/libmpeg/audio/pcm.c
173+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/audio/pcm.c
174@@ -32,6 +32,7 @@
175 */
176
177 #include "mpeg3audio.h"
178+#include "mpeg3protos.h"
179 #include "mpeg3private.inc"
180
181 int mpeg3audio_read_pcm_header(mpeg3audio_t *audio)
182diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/bitstream.h b/Cross/plugins/Mpeg3Plugin/libmpeg/bitstream.h
183index 90e1f29..71e62d4 100755
184--- a/Cross/plugins/Mpeg3Plugin/libmpeg/bitstream.h
185+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/bitstream.h
186@@ -24,6 +24,22 @@ typedef struct
187
188 unsigned int mpeg3demux_read_char_packet(mpeg3_demuxer_t *demuxer);
189 unsigned int mpeg3demux_read_prev_char_packet(mpeg3_demuxer_t *demuxer);
190+int mpeg3bits_seek_end(mpeg3_bits_t* stream);
191+int mpeg3bits_seek_start(mpeg3_bits_t* stream);
192+int mpeg3bits_seek_time(mpeg3_bits_t* stream, double time_position);
193+int mpeg3bits_seek_byte(mpeg3_bits_t* stream, long position);
194+int mpeg3bits_seek_percentage(mpeg3_bits_t* stream, double percentage);
195+void mpeg3bits_start_reverse(mpeg3_bits_t* stream);
196+void mpeg3bits_start_forward(mpeg3_bits_t* stream);
197+
198+int mpeg3bits_byte_align(mpeg3_bits_t *stream);
199+int mpeg3bits_delete_stream(mpeg3_bits_t *stream);
200+int mpeg3bits_getbitoffset(mpeg3_bits_t *stream);
201+int mpeg3bits_read_buffer(mpeg3_bits_t *stream, unsigned char *buffer, int bytes);
202+int mpeg3bits_refill(mpeg3_bits_t *stream);
203+int mpeg3bits_refill_backwards(mpeg3_bits_t *stream);
204+int mpeg3bits_use_demuxer(mpeg3_bits_t *stream);
205+int mpeg3bits_use_ptr(mpeg3_bits_t *stream, unsigned char *buffer);
206
207 /* ======================================================================== */
208 /* Entry Points */
209diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c b/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c
210index d240988..cc5fe96 100755
211--- a/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c
212+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/changesForSqueak.c
213@@ -34,7 +34,9 @@
214 // May 31st, 2002 JMM a few additions to make it compile on the mac with latest code
215
216 #include <string.h>
217+#include <stdlib.h>
218 #include "mpeg3private.h"
219+#include "mpeg3protos.h"
220 #include "changesForSqueak.h"
221
222 #if defined(TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
223@@ -175,7 +177,7 @@ int mpeg3_generate_toc_for_Squeak(mpeg3_t *file, int timecode_search, int print_
224 sprintf(temp_buffer, "PACKETSIZE: %ld\n", demuxer->packet_size);
225 appendStringToBufferIfPossible(buffer,temp_buffer,bufferSize);
226
227- mpeg3demux_print_timecodes(demuxer->titles[demuxer->current_title], buffer);
228+ mpeg3demux_print_timecodes_for_Squeak(demuxer->titles[demuxer->current_title], buffer, bufferSize);
229
230 mpeg3_delete_demuxer(demuxer);
231 return 0;
232@@ -316,6 +318,29 @@ int mpeg3demux_print_streams_for_Squeak(mpeg3_demuxer_t *demuxer, char *buffer,i
233 return 0;
234 }
235
236+int mpeg3demux_print_timecodes_for_Squeak(mpeg3_title_t *title, char *buffer,int buffer_size)
237+{
238+ mpeg3demux_timecode_t *timecode;
239+ int i;
240+ char temp_buffer[256];
241+
242+ if(title->timecode_table)
243+ {
244+ for(i = 0; i < title->timecode_table_size; i++)
245+ {
246+ timecode = &title->timecode_table[i];
247+
248+ sprintf(temp_buffer, "REGION: %ld %ld %f %f\n",
249+ timecode->start_byte,
250+ timecode->end_byte,
251+ timecode->start_time,
252+ timecode->end_time);
253+ appendStringToBufferIfPossible(buffer,temp_buffer,buffer_size);
254+ }
255+ }
256+ return 0;
257+}
258+
259 mpeg3_css_t* mpeg3_new_css()
260 {
261 return 0;
262diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/libmpeg3.c b/Cross/plugins/Mpeg3Plugin/libmpeg/libmpeg3.c
263index 350dfed..3f5018f 100755
264--- a/Cross/plugins/Mpeg3Plugin/libmpeg/libmpeg3.c
265+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/libmpeg3.c
266@@ -35,6 +35,7 @@
267
268 #include "libmpeg3.h"
269 #include "mpeg3protos.h"
270+#include "video/mpeg3videoprotos.h"
271
272 #include <stdlib.h>
273 #include <string.h>
274@@ -52,7 +53,7 @@ mpeg3_t* mpeg3_new(char *path,int size)
275 return file;
276 }
277
278-int mpeg3_delete(mpeg3_t *file)
279+void mpeg3_delete(mpeg3_t *file)
280 {
281 int i;
282
283diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.c b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.c
284index ebc86f2..e8ce5ae 100755
285--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.c
286+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.c
287@@ -57,7 +57,7 @@ mpeg3_atrack_t* mpeg3_new_atrack(mpeg3_t *file, int stream_id, int format, mpeg3
288 return new_atrack;
289 }
290
291-int mpeg3_delete_atrack(mpeg3_t *file, mpeg3_atrack_t *atrack)
292+void mpeg3_delete_atrack(mpeg3_t *file, mpeg3_atrack_t *atrack)
293 {
294 if(atrack->audio)
295 mpeg3audio_delete(atrack->audio);
296diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.h b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.h
297index 22b306d..836041b 100755
298--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.h
299+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3atrack.h
300@@ -17,4 +17,8 @@ typedef struct
301 long total_samples;
302 } mpeg3_atrack_t;
303
304+mpeg3_atrack_t* mpeg3_new_atrack(mpeg3_t *file, int stream_id, int is_ac3, mpeg3_demuxer_t *demuxer);
305+void mpeg3_delete_atrack(mpeg3_t *file, mpeg3_atrack_t *atrack);
306+mpeg3audio_t* mpeg3audio_new(mpeg3_t *file, mpeg3_atrack_t *track, int is_ac3);
307+
308 #endif
309diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3demux.c b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3demux.c
310index 5084ab4..cb2f517 100755
311--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3demux.c
312+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3demux.c
313@@ -1365,7 +1365,7 @@ mpeg3_demuxer_t* mpeg3_new_demuxer(mpeg3_t *file, int do_audio, int do_video, in
314 return demuxer;
315 }
316
317-int mpeg3_delete_demuxer(mpeg3_demuxer_t *demuxer)
318+void mpeg3_delete_demuxer(mpeg3_demuxer_t *demuxer)
319 {
320 int i;
321
322diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.c b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.c
323index 46ec6d4..57d6087 100755
324--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.c
325+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.c
326@@ -40,6 +40,7 @@
327
328
329 */
330+#include "mpeg3io.h"
331 #include "mpeg3private.h"
332 #include "mpeg3protos.h"
333
334@@ -47,11 +48,7 @@
335 #include <mntent.h>
336 #endif
337
338-#if defined( TARGET_OS_MAC) && !defined ( __APPLE__ ) && !defined ( __MACH__ )
339-#include <stat.h>
340-#else
341 #include <sys/stat.h>
342-#endif
343
344 #include <stdlib.h>
345 #include <string.h>
346@@ -331,18 +328,3 @@ int mpeg3io_end_of_file(mpeg3_fs_t *fs ) {
347
348 return ( ! fs->fd ) || feof(fs->fd);
349 }
350-
351-inline int mpeg3io_fgetc(mpeg3_fs_t *fs) {
352- if (fs->mpeg_is_in_buffer) {
353- unsigned int value;
354- fs->mpeg_is_in_buffer_file_position++;
355- if (fs->mpeg_is_in_buffer_file_position >= fs->mpeg_buffer_size) {
356- fs->mpeg_is_in_buffer_file_position = fs->mpeg_buffer_size;
357- return 0;
358- }
359- value = (unsigned int) fs->mpeg_is_in_buffer[fs->mpeg_is_in_buffer_file_position-1];
360- return value;
361- }
362- return (fs->fd ? fgetc(fs->fd) : 0);
363-}
364-
365diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.h b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.h
366index bb93dc2..db38639 100755
367--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.h
368+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3io.h
369@@ -35,9 +35,25 @@ typedef struct
370 #endif
371
372 #define mpeg3io_total_bytes(fs) (((mpeg3_fs_t *)(fs))->total_bytes)
373-inline int mpeg3io_fgetc(mpeg3_fs_t *fs);
374
375-static inline unsigned int mpeg3io_read_int32(mpeg3_fs_t *fs)
376+static inline int
377+mpeg3io_fgetc(mpeg3_fs_t *fs) {
378+ if (fs->mpeg_is_in_buffer) {
379+ unsigned int value;
380+ fs->mpeg_is_in_buffer_file_position++;
381+ if (fs->mpeg_is_in_buffer_file_position >= fs->mpeg_buffer_size) {
382+ fs->mpeg_is_in_buffer_file_position = fs->mpeg_buffer_size;
383+ return 0;
384+ }
385+ value = (unsigned int) fs->mpeg_is_in_buffer[fs->mpeg_is_in_buffer_file_position-1];
386+ return value;
387+ }
388+ return (fs->fd ? fgetc(fs->fd) : 0);
389+}
390+
391+
392+static inline unsigned int
393+mpeg3io_read_int32(mpeg3_fs_t *fs)
394 {
395 int a, b, c, d;
396 unsigned int result;
397diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3private.h b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3private.h
398index 207b24f..073493c 100755
399--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3private.h
400+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3private.h
401@@ -4,6 +4,8 @@
402 #ifndef MPEG3PRIVATE_H
403 #define MPEG3PRIVATE_H
404
405+void * memoryAllocate(int number,unsigned size);
406+void memoryFree(void *stuff);
407
408 /** configuration **/
409 #if defined(__MWERKS__)
410@@ -33,6 +35,8 @@
411 #endif
412
413
414+typedef struct mpeg3 mpeg3_t;
415+
416 #include "mpeg3atrack.h"
417 #include "mpeg3css.h"
418 #include "mpeg3io.h"
419@@ -40,7 +44,7 @@
420 #include "mpeg3title.h"
421 #include "mpeg3vtrack.h"
422
423-typedef struct
424+struct mpeg3
425 {
426 mpeg3_fs_t *fs; /* Store entry path here */
427 mpeg3_demuxer_t *demuxer; /* Master tables */
428@@ -66,9 +70,6 @@ typedef struct
429 int program; /* Number of program to play */
430 int cpus;
431 int have_mmx;
432-} mpeg3_t;
433-
434-
435-
436+};
437
438 #endif
439diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h
440index 69cb0b3..e095c84 100755
441--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h
442+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3protos.h
443@@ -8,7 +8,7 @@ mpeg3_css_t* mpeg3_new_css();
444 /* DEMUX */
445
446 mpeg3_demuxer_t* mpeg3_new_demuxer(mpeg3_t *file, int do_audio, int do_video, int stream_id);
447-int mpeg3_delete_demuxer(mpeg3_demuxer_t *demuxer);
448+void mpeg3_delete_demuxer(mpeg3_demuxer_t *demuxer);
449 int mpeg3demux_read_data(mpeg3_demuxer_t *demuxer, unsigned char *output, long size);
450 unsigned int mpeg3demux_read_int32(mpeg3_demuxer_t *demuxer);
451 unsigned int mpeg3demux_read_int24(mpeg3_demuxer_t *demuxer);
452@@ -26,23 +26,19 @@ int mpeg3demux_bof(mpeg3_demuxer_t *demuxer);
453 mpeg3_title_t* mpeg3_new_title(mpeg3_t *file, char *path);
454
455
456-/* ATRACK */
457-
458-mpeg3_atrack_t* mpeg3_new_atrack(mpeg3_t *file, int stream_id, int is_ac3, mpeg3_demuxer_t *demuxer);
459-int mpeg3_delete_atrack(mpeg3_t *file, mpeg3_atrack_t *atrack);
460-
461-/* VTRACK */
462-
463-mpeg3_vtrack_t* mpeg3_new_vtrack(mpeg3_t *file, int stream_id, mpeg3_demuxer_t *demuxer);
464-int mpeg3_delete_vtrack(mpeg3_t *file, mpeg3_vtrack_t *vtrack);
465
466 /* AUDIO */
467-mpeg3audio_t* mpeg3audio_new(mpeg3_t *file, mpeg3_atrack_t *track, int is_ac3);
468+#if defined(MPEG3AUDIO_H)
469 int mpeg3audio_delete(mpeg3audio_t *audio);
470+int mpeg3audio_seek_percentage(mpeg3audio_t *audio, double percentage);
471+int mpeg3audio_seek_sample(mpeg3audio_t *audio, long sample);
472+int mpeg3audio_read_raw(mpeg3audio_t *audio, unsigned char *output, long *size, long max_size);
473+int mpeg3audio_decode_audio(mpeg3audio_t *audio, float *output_f, short *output_i, int channel, long start_position, long len);
474+#endif
475
476
477 /* VIDEO */
478-mpeg3video_t* mpeg3video_new(mpeg3_t *file, mpeg3_vtrack_t *track);
479+#if defined(MPEGVIDEO_H)
480 int mpeg3video_delete(mpeg3video_t *video);
481 int mpeg3video_read_frame(mpeg3video_t *video,
482 long frame_number,
483@@ -54,6 +50,7 @@ int mpeg3video_read_frame(mpeg3video_t *video,
484 int out_w,
485 int out_h,
486 int color_model);
487+#endif
488
489 /* FILESYSTEM */
490
491@@ -65,11 +62,110 @@ int mpeg3io_read_data(unsigned char *buffer, long bytes, mpeg3_fs_t *fs);
492 int mpeg3io_end_of_file(mpeg3_fs_t *fs);
493 int mpeg3io_scanf (mpeg3_fs_t *fs,char *format, void * string1, void * string2);
494 int mpeg3io_scanf5 (mpeg3_fs_t *fs,char *format, void * string1, void * string2, void * string3, void * string4, void * string5);
495-int mpeg3io_fgetc(mpeg3_fs_t *fs);
496
497 /* BITSTREAM */
498 mpeg3_bits_t* mpeg3bits_new_stream(mpeg3_t *file, mpeg3_demuxer_t *demuxer);
499 unsigned int mpeg3bits_getbits(mpeg3_bits_t* stream, int n);
500
501-
502+/* Other prototypes added eem '19/7/30, extracted using cproto */
503+/* changesForSqueak.c */
504+int mpeg3_generate_toc_for_Squeak(mpeg3_t *file, int timecode_search, int print_streams, char *buffer, int bufferSize);
505+int mpeg3demux_create_title_for_Squeak(mpeg3_demuxer_t *demuxer, int timecode_search, char *buffer, int buffer_size);
506+int mpeg3demux_print_streams_for_Squeak(mpeg3_demuxer_t *demuxer, char *buffer, int buffer_size);
507+int mpeg3demux_print_timecodes_for_Squeak(mpeg3_title_t *title, char *buffer,int buffer_size);
508+int mpeg3_delete_css(mpeg3_css_t *css);
509+int mpeg3_get_keys(mpeg3_css_t *css, char *path);
510+int mpeg3_decrypt_packet(mpeg3_css_t *css, unsigned char *sector);
511+int IsImageName(char *name);
512+/* libmpeg3.c */
513+mpeg3_t *mpeg3_new(char *path, int size);
514+void mpeg3_delete(mpeg3_t *file);
515+int mpeg3_check_sig(char *path);
516+mpeg3_t *mpeg3_open_copy(char *path, mpeg3_t *old_file, int size);
517+mpeg3_t *mpeg3_open(char *path, int size);
518+int mpeg3_close(mpeg3_t *file);
519+int mpeg3_set_cpus(mpeg3_t *file, int cpus);
520+int mpeg3_set_mmx(mpeg3_t *file, int use_mmx);
521+int mpeg3_generate_toc(FILE *output, char *path, int timecode_search, int print_streams);
522+int mpeg3_read_toc(mpeg3_t *file);
523+int mpeg3_has_audio(mpeg3_t *file);
524+int mpeg3_total_astreams(mpeg3_t *file);
525+int mpeg3_audio_channels(mpeg3_t *file, int stream);
526+int mpeg3_sample_rate(mpeg3_t *file, int stream);
527+long mpeg3_get_sample(mpeg3_t *file, int stream);
528+int mpeg3_set_sample(mpeg3_t *file, long sample, int stream);
529+long mpeg3_audio_samples(mpeg3_t *file, int stream);
530+int mpeg3_has_video(mpeg3_t *file);
531+int mpeg3_total_vstreams(mpeg3_t *file);
532+int mpeg3_video_width(mpeg3_t *file, int stream);
533+int mpeg3_video_height(mpeg3_t *file, int stream);
534+float mpeg3_frame_rate(mpeg3_t *file, int stream);
535+long mpeg3_video_frames(mpeg3_t *file, int stream);
536+long mpeg3_get_frame(mpeg3_t *file, int stream);
537+int mpeg3_set_frame(mpeg3_t *file, long frame, int stream);
538+int mpeg3_seek_percentage(mpeg3_t *file, double percentage);
539+int mpeg3_previous_frame(mpeg3_t *file, int stream);
540+double mpeg3_tell_percentage(mpeg3_t *file);
541+double mpeg3_get_time(mpeg3_t *file);
542+int mpeg3_end_of_audio(mpeg3_t *file, int stream);
543+int mpeg3_end_of_video(mpeg3_t *file, int stream);
544+int mpeg3_read_frame(mpeg3_t *file, unsigned char **output_rows, int in_x, int in_y, int in_w, int in_h, int out_w, int out_h, int color_model, int stream);
545+int mpeg3_drop_frames(mpeg3_t *file, long frames, int stream);
546+int mpeg3_read_yuvframe(mpeg3_t *file, char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h, int stream);
547+int mpeg3_read_audio(mpeg3_t *file, float *output_f, short *output_i, int channel, long samples, int stream);
548+int mpeg3_reread_audio(mpeg3_t *file, float *output_f, short *output_i, int channel, long samples, int stream);
549+int mpeg3_read_audio_chunk(mpeg3_t *file, unsigned char *output, long *size, long max_size, int stream);
550+int mpeg3_read_video_chunk(mpeg3_t *file, unsigned char *output, long *size, long max_size, int stream);
551+/* mpeg3atrack.c */
552+/* mpeg3demux.c */
553+unsigned char mpeg3packet_read_char(mpeg3_demuxer_t *demuxer);
554+int mpeg3_get_adaptation_field(mpeg3_demuxer_t *demuxer);
555+int mpeg3_get_program_association_table(mpeg3_demuxer_t *demuxer);
556+int mpeg3packet_get_data_buffer(mpeg3_demuxer_t *demuxer);
557+int mpeg3_get_pes_packet_header(mpeg3_demuxer_t *demuxer, unsigned long *pts, unsigned long *dts);
558+int get_unknown_data(mpeg3_demuxer_t *demuxer);
559+int mpeg3_get_pes_packet_data(mpeg3_demuxer_t *demuxer, unsigned int stream_id);
560+int mpeg3_get_pes_packet(mpeg3_demuxer_t *demuxer);
561+int mpeg3_get_payload(mpeg3_demuxer_t *demuxer);
562+int mpeg3_read_transport(mpeg3_demuxer_t *demuxer);
563+int mpeg3_get_system_header(mpeg3_demuxer_t *demuxer);
564+unsigned long mpeg3_get_timestamp(mpeg3_demuxer_t *demuxer);
565+int mpeg3_get_pack_header(mpeg3_demuxer_t *demuxer, unsigned int *header);
566+int mpeg3_get_ps_pes_packet(mpeg3_demuxer_t *demuxer, unsigned int *header);
567+int mpeg3_read_program(mpeg3_demuxer_t *demuxer);
568+double mpeg3_lookup_time_offset(mpeg3_demuxer_t *demuxer, long byte);
569+int mpeg3_advance_timecode(mpeg3_demuxer_t *demuxer, int reverse);
570+int mpeg3_read_next_packet(mpeg3_demuxer_t *demuxer);
571+int mpeg3_read_prev_packet(mpeg3_demuxer_t *demuxer);
572+unsigned int mpeg3demux_read_char_packet(mpeg3_demuxer_t *demuxer);
573+unsigned int mpeg3demux_read_prev_char_packet(mpeg3_demuxer_t *demuxer);
574+mpeg3demux_timecode_t *mpeg3_append_timecode(mpeg3_demuxer_t *demuxer, mpeg3_title_t *title, long prev_byte, double prev_time, long next_byte, double next_time, int dont_store);
575+mpeg3demux_timecode_t *mpeg3demux_next_timecode(mpeg3_demuxer_t *demuxer, int *current_title, int *current_timecode, int current_program);
576+mpeg3demux_timecode_t *mpeg3demux_prev_timecode(mpeg3_demuxer_t *demuxer, int *current_title, int *current_timecode, int current_program);
577+int mpeg3demux_open_title(mpeg3_demuxer_t *demuxer, int title_number);
578+int mpeg3demux_assign_programs(mpeg3_demuxer_t *demuxer);
579+int mpeg3demux_create_title(mpeg3_demuxer_t *demuxer, int timecode_search, FILE *toc);
580+int mpeg3demux_print_timecodes(mpeg3_title_t *title, FILE *output);
581+int mpeg3demux_read_titles(mpeg3_demuxer_t *demuxer);
582+int mpeg3demux_copy_titles(mpeg3_demuxer_t *dst, mpeg3_demuxer_t *src);
583+int mpeg3demux_print_streams(mpeg3_demuxer_t *demuxer, FILE *toc);
584+int mpeg3demux_seek_byte(mpeg3_demuxer_t *demuxer, long byte);
585+int mpeg3demux_seek_time(mpeg3_demuxer_t *demuxer, double new_time);
586+int mpeg3demux_seek_percentage(mpeg3_demuxer_t *demuxer, double percentage);
587+long mpeg3demuxer_total_bytes(mpeg3_demuxer_t *demuxer);
588+/* mpeg3io.c */
589+int mpeg3_copy_fs(mpeg3_fs_t *dst, mpeg3_fs_t *src);
590+long mpeg3io_get_total_bytes(mpeg3_fs_t *fs);
591+int mpeg3io_get_id3v2_size(mpeg3_fs_t *fs);
592+int mpeg3io_device(char *path, char *device);
593+int mpeg3io_seek(mpeg3_fs_t *fs, long byte);
594+int mpeg3io_seek_relative(mpeg3_fs_t *fs, long bytes);
595+int mpeg3io_scanf(mpeg3_fs_t *fs, char *format, void *string1, void *string2);
596+int mpeg3io_scanf5(mpeg3_fs_t *fs, char *format, void *string1, void *string2, void *string3, void *string4, void *string5);
597+/* mpeg3title.c */
598+int mpeg3_delete_title(mpeg3_title_t *title);
599+void mpeg3_copy_title(mpeg3_title_t *dst, mpeg3_title_t *src);
600+void mpeg3_dump_title(mpeg3_title_t *title);
601+/* video/mmxtest.c */
602+int mpeg3_mmx_test(void);
603 #endif
604diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3title.c b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3title.c
605index 7257bdb..5e5c7ed 100755
606--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3title.c
607+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3title.c
608@@ -61,7 +61,7 @@ int mpeg3_delete_title(mpeg3_title_t *title)
609 }
610
611
612-int mpeg3_copy_title(mpeg3_title_t *dst, mpeg3_title_t *src)
613+void mpeg3_copy_title(mpeg3_title_t *dst, mpeg3_title_t *src)
614 {
615 int i;
616
617@@ -81,13 +81,13 @@ int mpeg3_copy_title(mpeg3_title_t *dst, mpeg3_title_t *src)
618 }
619 }
620
621-int mpeg3_dump_title(mpeg3_title_t *title)
622+void mpeg3_dump_title(mpeg3_title_t *title)
623 {
624 int i;
625
626 for(i = 0; i < title->timecode_table_size; i++)
627 {
628- printf("%f: %d - %d %f %f %d\n",
629+ printf("%f: %ld - %ld %f %f %d\n",
630 title->timecode_table[i].absolute_start_time,
631 title->timecode_table[i].start_byte,
632 title->timecode_table[i].end_byte,
633diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.c b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.c
634index 4c96e62..2b3d3af 100755
635--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.c
636+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.c
637@@ -55,7 +55,7 @@ mpeg3_vtrack_t* mpeg3_new_vtrack(mpeg3_t *file, int stream_id, mpeg3_demuxer_t *
638 return new_vtrack;
639 }
640
641-int mpeg3_delete_vtrack(mpeg3_t *file, mpeg3_vtrack_t *vtrack)
642+void mpeg3_delete_vtrack(mpeg3_t *file, mpeg3_vtrack_t *vtrack)
643 {
644 if(vtrack->video)
645 mpeg3video_delete(vtrack->video);
646diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.h b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.h
647index c5025ae..3a4234a 100755
648--- a/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.h
649+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/mpeg3vtrack.h
650@@ -17,4 +17,8 @@ typedef struct
651 long total_frames; /* Total frames in the file */
652 } mpeg3_vtrack_t;
653
654+mpeg3video_t* mpeg3video_new(mpeg3_t *file, mpeg3_vtrack_t *track);
655+mpeg3_vtrack_t* mpeg3_new_vtrack(mpeg3_t *file, int stream_id, mpeg3_demuxer_t *demuxer);
656+void mpeg3_delete_vtrack(mpeg3_t *file, mpeg3_vtrack_t *vtrack);
657+
658 #endif
659diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/getpicture.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/getpicture.c
660index 6b3d9f7..4c2db3a 100755
661--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/getpicture.c
662+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/getpicture.c
663@@ -30,14 +30,18 @@
664 /* Changed Sept 15th by John M McIntosh to support Macintosh & Squeak
665 */
666 #include "mpeg3private.h"
667-
668+#include "mpeg3protos.h"
669 #include "mpeg3video.h"
670+#include "mpeg3videoprotos.h"
671 #include "vlc.h"
672
673 #include <stdio.h>
674 #include <stdlib.h>
675 #include <string.h>
676
677+/* Import from slice.c */
678+void mpeg3_slice_loop(mpeg3_slice_t *slice);
679+
680 int mpeg3video_get_cbp(mpeg3_slice_t *slice)
681 {
682 int code;
683@@ -73,23 +77,7 @@ int mpeg3video_get_cbp(mpeg3_slice_t *slice)
684 int mpeg3video_clearblock(mpeg3_slice_t *slice, int comp, int size)
685 {
686 slice->sparse[comp] = 1;
687-
688-/* Compiler error */
689-/*
690- * for(i = 0; i < size; i++)
691- * {
692- * bzero(slice->block[comp] + sizeof(short) * 64 * i, sizeof(short) * 64);
693- * }
694- */
695-
696- if(size == 6)
697- {
698- bzero(slice->block[comp], sizeof(short) * 64 * 6);
699- }
700- else
701- {
702- memset(slice->block[comp], 0, sizeof(short) * 64 * size);
703- }
704+ memset(slice->block[comp], 0, sizeof(short) * 64 * size);
705 return 0;
706 }
707
708@@ -154,7 +142,7 @@ int mpeg3video_getdcchrom(mpeg3_slice_buffer_t *slice_buffer)
709
710 /* decode one intra coded MPEG-1 block */
711
712-int mpeg3video_getintrablock(mpeg3_slice_t *slice,
713+void mpeg3video_getintrablock(mpeg3_slice_t *slice,
714 mpeg3video_t *video,
715 int comp,
716 int dc_dct_pred[])
717@@ -179,7 +167,7 @@ int mpeg3video_getintrablock(mpeg3_slice_t *slice,
718 bp[0] <<= 4;
719 #endif
720
721- if(slice->fault) return 1;
722+ if(slice->fault) return;
723
724 /* decode AC coefficients */
725 for(i = 1; ; i++)
726@@ -265,7 +253,6 @@ int mpeg3video_getintrablock(mpeg3_slice_t *slice,
727 /* not a sparse matrix ! */
728 slice->sparse[comp] = 0;
729 }
730- return 0;
731 }
732
733
734@@ -369,7 +356,7 @@ int mpeg3video_getinterblock(mpeg3_slice_t *slice,
735
736
737 /* decode one intra coded MPEG-2 block */
738-int mpeg3video_getmpg2intrablock(mpeg3_slice_t *slice,
739+void mpeg3video_getmpg2intrablock(mpeg3_slice_t *slice,
740 mpeg3video_t *video,
741 int comp,
742 int dc_dct_pred[])
743@@ -444,7 +431,7 @@ int mpeg3video_getmpg2intrablock(mpeg3_slice_t *slice,
744 {
745 /* fprintf(stderr,"mpeg3video_getmpg2intrablock: invalid Huffman code\n"); */
746 slice->fault = 1;
747- return 1;
748+ return;
749 }
750
751 mpeg3slice_flushbits(slice_buffer, tab->len);
752@@ -492,13 +479,12 @@ int mpeg3video_getmpg2intrablock(mpeg3_slice_t *slice,
753 /* not a sparse matrix ! */
754 slice->sparse[comp] = 0;
755 }
756- return 1;
757 }
758
759
760 /* decode one non-intra coded MPEG-2 block */
761
762-int mpeg3video_getmpg2interblock(mpeg3_slice_t *slice,
763+void mpeg3video_getmpg2interblock(mpeg3_slice_t *slice,
764 mpeg3video_t *video,
765 int comp)
766 {
767@@ -563,7 +549,7 @@ int mpeg3video_getmpg2interblock(mpeg3_slice_t *slice,
768 {
769 /* fprintf(stderr, "mpeg3video_getmpg2interblock: invalid signed_level (escape)\n"); */
770 slice->fault = 1;
771- return 1;
772+ return;
773 }
774 if((sign = (val >= 2048)) != 0) val = 4096 - val;
775 }
776@@ -591,7 +577,6 @@ int mpeg3video_getmpg2interblock(mpeg3_slice_t *slice,
777 {
778 slice->sparse[comp] = 0;
779 }
780- return 0;
781 }
782
783
784@@ -707,7 +692,7 @@ int mpeg3video_allocate_decoders(mpeg3video_t *video, int decoder_count)
785 {
786 for(i = 0; i < video->total_slice_decoders; i++)
787 {
788- mpeg3_delete_slice_decoder(video->slice_decoders[i]);
789+ mpeg3_delete_slice_decoder(&(video->slice_decoders[i]));
790 }
791
792 for(i = 0; i < file->cpus && i < MPEG3_MAX_CPUS; i++)
793diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/headers.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/headers.c
794index d21122b..8239df6 100755
795--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/headers.c
796+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/headers.c
797@@ -32,6 +32,8 @@
798 #include "mpeg3demux.h"
799 #include "mpeg3private.h"
800 #include "mpeg3video.h"
801+#include "mpeg3videoprotos.h"
802+#include "mpeg3protos.h"
803
804 #include <stdio.h>
805 #include <stdlib.h>
806@@ -92,7 +94,7 @@ int mpeg3video_getseqhdr(mpeg3video_t *video)
807
808 /* decode sequence extension */
809
810-int mpeg3video_sequence_extension(mpeg3video_t *video)
811+void mpeg3video_sequence_extension(mpeg3video_t *video)
812 {
813 int prof_lev;
814 int horizontal_size_extension, vertical_size_extension;
815@@ -120,7 +122,7 @@ int mpeg3video_sequence_extension(mpeg3video_t *video)
816
817 /* decode sequence display extension */
818
819-int mpeg3video_sequence_display_extension(mpeg3video_t *video)
820+void mpeg3video_sequence_display_extension(mpeg3video_t *video)
821 {
822 int colour_primaries = 0, transfer_characteristics = 0;
823 int display_horizontal_size, display_vertical_size;
824@@ -143,7 +145,7 @@ int mpeg3video_sequence_display_extension(mpeg3video_t *video)
825
826 /* decode quant matrix entension */
827
828-int mpeg3video_quant_matrix_extension(mpeg3video_t *video)
829+void mpeg3video_quant_matrix_extension(mpeg3video_t *video)
830 {
831 int i;
832 int load_intra_quantiser_matrix, load_non_intra_quantiser_matrix;
833@@ -187,7 +189,7 @@ int mpeg3video_quant_matrix_extension(mpeg3video_t *video)
834
835 /* decode sequence scalable extension */
836
837-int mpeg3video_sequence_scalable_extension(mpeg3video_t *video)
838+void mpeg3video_sequence_scalable_extension(mpeg3video_t *video)
839 {
840 int layer_id;
841
842@@ -212,7 +214,7 @@ int mpeg3video_sequence_scalable_extension(mpeg3video_t *video)
843
844 /* decode picture display extension */
845
846-int mpeg3video_picture_display_extension(mpeg3video_t *video)
847+void mpeg3video_picture_display_extension(mpeg3video_t *video)
848 {
849 int n, i;
850 short frame_centre_horizontal_offset[3];
851@@ -235,7 +237,7 @@ int mpeg3video_picture_display_extension(mpeg3video_t *video)
852
853 /* decode picture coding extension */
854
855-int mpeg3video_picture_coding_extension(mpeg3video_t *video)
856+void mpeg3video_picture_coding_extension(mpeg3video_t *video)
857 {
858 int chroma_420_type, composite_display_flag;
859 int v_axis = 0, field_sequence = 0, sub_carrier = 0, burst_amplitude = 0, sub_carrier_phase = 0;
860@@ -297,7 +299,7 @@ int mpeg3video_picture_coding_extension(mpeg3video_t *video)
861
862 /* decode picture spatial scalable extension */
863
864-int mpeg3video_picture_spatial_scalable_extension(mpeg3video_t *video)
865+void mpeg3video_picture_spatial_scalable_extension(mpeg3video_t *video)
866 {
867 video->pict_scal = 1; /* use spatial scalability in this picture */
868
869@@ -320,7 +322,7 @@ int mpeg3video_picture_spatial_scalable_extension(mpeg3video_t *video)
870 *
871 */
872
873-int mpeg3video_picture_temporal_scalable_extension(mpeg3video_t *video)
874+void mpeg3video_picture_temporal_scalable_extension(mpeg3video_t *video)
875 {
876 fprintf(stderr, "mpeg3video_picture_temporal_scalable_extension: temporal scalability not supported\n");
877 }
878@@ -328,7 +330,7 @@ int mpeg3video_picture_temporal_scalable_extension(mpeg3video_t *video)
879
880 /* decode extension and user data */
881
882-int mpeg3video_ext_user_data(mpeg3video_t *video)
883+void mpeg3video_ext_user_data(mpeg3video_t *video)
884 {
885 int code = mpeg3bits_next_startcode(video->vstream);
886
887diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/idct.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/idct.c
888index 7c394ea..a0a2945 100755
889--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/idct.c
890+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/idct.c
891@@ -70,7 +70,7 @@
892
893
894 inline
895-int mpeg3video_idctrow(short *blk)
896+void mpeg3video_idctrow(short *blk)
897 {
898 int x0, x1, x2, x3, x4, x5, x6, x7, x8;
899
900@@ -134,7 +134,7 @@ int mpeg3video_idctrow(short *blk)
901
902
903 inline
904-int mpeg3video_idctcol(short *blk)
905+void mpeg3video_idctcol(short *blk)
906 {
907 int x0, x1, x2, x3, x4, x5, x6, x7, x8;
908
909diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/macroblocks.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/macroblocks.c
910index cd5b1a1..7664ae1 100755
911--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/macroblocks.c
912+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/macroblocks.c
913@@ -28,6 +28,7 @@
914 http://www.squeak.org/license.html
915 */
916 #include "mpeg3video.h"
917+#include "mpeg3videoprotos.h"
918 #include "slice.h"
919 #include "vlc.h"
920
921diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/motion.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/motion.c
922index 1b0fb66..16fafb1 100755
923--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/motion.c
924+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/motion.c
925@@ -31,6 +31,7 @@
926 */
927 #include "mpeg3private.h"
928 #include "mpeg3video.h"
929+#include "mpeg3videoprotos.h"
930 #include "vlc.h"
931
932 #include <stdio.h>
933diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3video.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3video.c
934index 6b1072c..223c342 100755
935--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3video.c
936+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3video.c
937@@ -296,7 +296,7 @@ mpeg3video_t* mpeg3video_allocate_struct(mpeg3_t *file, mpeg3_vtrack_t *track)
938 return video;
939 }
940
941-int mpeg3video_delete_struct(mpeg3video_t *video)
942+void mpeg3video_delete_struct(mpeg3video_t *video)
943 {
944 int i;
945 mpeg3bits_delete_stream(video->vstream);
946@@ -312,7 +312,7 @@ int mpeg3video_delete_struct(mpeg3video_t *video)
947 if(video->total_slice_decoders)
948 {
949 for(i = 0; i < video->total_slice_decoders; i++)
950- mpeg3_delete_slice_decoder(video->slice_decoders[i]);
951+ mpeg3_delete_slice_decoder(&(video->slice_decoders[i]));
952 }
953 for(i = 0; i < video->slice_buffers_initialized; i++)
954 mpeg3_delete_slice_buffer(&(video->slice_buffers[i]));
955diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h b/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h
956index 0710c72..9942ddb 100755
957--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h
958+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/mpeg3videoprotos.h
959@@ -4,4 +4,56 @@
960 void mpeg3video_idct_conversion(short* block);
961 unsigned int mpeg3slice_showbits(mpeg3_slice_buffer_t *slice_buffer, int bits);
962
963+int mpeg3video_get_cbp(mpeg3_slice_t *slice);
964+int mpeg3video_clearblock(mpeg3_slice_t *slice, int comp, int size);
965+void mpeg3video_getintrablock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp, int dc_dct_pred[]);
966+int mpeg3video_getinterblock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp);
967+void mpeg3video_getmpg2intrablock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp, int dc_dct_pred[]);
968+void mpeg3video_getmpg2interblock(mpeg3_slice_t *slice, mpeg3video_t *video, int comp);
969+int mpeg3video_getpicture(mpeg3video_t *video, int framenum);
970+int mpeg3video_getgophdr(mpeg3video_t *video);
971+int mpeg3video_getpicturehdr(mpeg3video_t *video);
972+int mpeg3video_get_header(mpeg3video_t *video, int dont_repeat);
973+int mpeg3video_getslicehdr(mpeg3_slice_t *slice, mpeg3video_t *video);
974+int mpeg3video_get_macroblock_address(mpeg3_slice_t *slice);
975+int mpeg3video_macroblock_modes(mpeg3_slice_t *slice, mpeg3video_t *video, int *pmb_type, int *pstwtype, int *pstwclass, int *pmotion_type, int *pmv_count, int *pmv_format, int *pdmv, int *pmvscale, int *pdct_type);
976+int mpeg3_mmx_test(void);
977+void mpeg3video_calc_dmv(mpeg3video_t *video, int DMV[][2], int *dmvector, int mvx, int mvy);
978+void mpeg3video_motion_vector(mpeg3_slice_t *slice, mpeg3video_t *video, int *PMV, int *dmvector, int h_r_size, int v_r_size, int dmv, int mvscale, int full_pel_vector);
979+int mpeg3video_motion_vectors(mpeg3_slice_t *slice, mpeg3video_t *video, int PMV[2][2][2], int dmvector[2], int mv_field_sel[2][2], int s, int mv_count, int mv_format, int h_r_size, int v_r_size, int dmv, int mvscale);
980+int mpeg3video_read_frame_backend(mpeg3video_t *video, int skip_bframes);
981+int mpeg3video_set_cpus(mpeg3video_t *video, int cpus);
982+int mpeg3video_set_mmx(mpeg3video_t *video, int use_mmx);
983+int mpeg3video_seek_percentage(mpeg3video_t *video, double percentage);
984+int mpeg3video_previous_frame(mpeg3video_t *video);
985+int mpeg3video_seek_frame(mpeg3video_t *video, long frame);
986+int mpeg3video_read_raw(mpeg3video_t *video, unsigned char *output, long *size, long max_size);
987+int mpeg3video_read_yuvframe(mpeg3video_t *video, long frame_number, char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h);
988+int mpeg3video_init_output(void);
989+int mpeg3video_ditherframeFastRGBA(mpeg3video_t *video, unsigned char **src, unsigned char **output_rows);
990+int mpeg3video_ditherframeFastRGB555(mpeg3video_t *video, unsigned char **src, unsigned char **output_rows);
991+int mpeg3video_present_frame(mpeg3video_t *video);
992+int mpeg3video_display_second_field(mpeg3video_t *video);
993+int mpeg3video_reconstruct(mpeg3video_t *video, int bx, int by, int mb_type, int motion_type, int PMV[2][2][2], int mv_field_sel[2][2], int dmvector[2], int stwtype);
994+int mpeg3video_match_refframes(mpeg3video_t *video);
995+int mpeg3video_seek(mpeg3video_t *video);
996+int mpeg3video_drop_frames(mpeg3video_t *video, long frames);
997+int mpeg3_new_slice_buffer(mpeg3_slice_buffer_t *slice_buffer);
998+int mpeg3_delete_slice_buffer(mpeg3_slice_buffer_t *slice_buffer);
999+int mpeg3_expand_slice_buffer(mpeg3_slice_buffer_t *slice_buffer);
1000+int mpeg3_new_slice_decoder(void *video, mpeg3_slice_t *slice);
1001+int mpeg3_delete_slice_decoder(mpeg3_slice_t *slice);
1002+/* mpeg3video.c */
1003+int mpeg3video_set_cpus(mpeg3video_t *video, int cpus);
1004+int mpeg3video_set_mmx(mpeg3video_t *video, int use_mmx);
1005+int mpeg3video_seek_percentage(mpeg3video_t *video, double percentage);
1006+int mpeg3video_previous_frame(mpeg3video_t *video);
1007+int mpeg3video_seek_frame(mpeg3video_t *video, long frame);
1008+int mpeg3video_read_raw(mpeg3video_t *video, unsigned char *output, long *size, long max_size);
1009+int mpeg3video_read_yuvframe(mpeg3video_t *video, long frame_number, char *y_output, char *u_output, char *v_output, int in_x, int in_y, int in_w, int in_h);
1010+/* seek.c */
1011+unsigned int mpeg3bits_next_startcode(mpeg3_bits_t *stream);
1012+int mpeg3video_next_code(mpeg3_bits_t *stream, unsigned int code);
1013+int mpeg3video_prev_code(mpeg3_bits_t *stream, unsigned int code);
1014+int mpeg3video_drop_frames(mpeg3video_t *video, long frames);
1015 #endif
1016diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/output.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/output.c
1017index 4cda6ea..5a71424 100755
1018--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/output.c
1019+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/output.c
1020@@ -37,6 +37,7 @@
1021 */
1022 #include "libmpeg3.h"
1023 #include "mpeg3video.h"
1024+#include "mpeg3videoprotos.h"
1025 #include <string.h>
1026
1027 unsigned char gClipArray[1026];
1028diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/reconstruct.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/reconstruct.c
1029index 04c587a..419a59f 100755
1030--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/reconstruct.c
1031+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/reconstruct.c
1032@@ -28,6 +28,7 @@
1033 http://www.squeak.org/license.html
1034 */
1035 #include "mpeg3video.h"
1036+#include "mpeg3videoprotos.h"
1037 #include <stdio.h>
1038
1039 #ifdef HAVE_MMX
1040diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/seek.c b/Cross/plugins/Mpeg3Plugin/libmpeg/video/seek.c
1041index 5636193..526c01c 100755
1042--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/seek.c
1043+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/seek.c
1044@@ -32,6 +32,7 @@
1045 #include "mpeg3private.h"
1046 #include "mpeg3protos.h"
1047 #include "mpeg3video.h"
1048+#include "mpeg3videoprotos.h"
1049 #include <stdlib.h>
1050 #include <string.h>
1051
1052diff --git a/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h b/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h
1053index 9b28c86..d21984e 100755
1054--- a/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h
1055+++ b/Cross/plugins/Mpeg3Plugin/libmpeg/video/slice.h
1056@@ -6,6 +6,7 @@
1057 #ifdef USE_PTHREADS
1058 #include <pthread.h>
1059 #endif
1060+
1061 /* Array of these feeds the slice decoders */
1062 typedef struct
1063 {
1064@@ -77,40 +78,37 @@ static inline unsigned int mpeg3slice_getbit(mpeg3_slice_buffer_t *buffer)
1065 {
1066 if(buffer->bits_size)
1067 return (buffer->bits >> (--buffer->bits_size)) & 0x1;
1068- else
1069- if(buffer->current_position < buffer->buffer_size)
1070- {
1071+ if(buffer->current_position < buffer->buffer_size) {
1072 buffer->bits = buffer->data[buffer->current_position++];
1073 buffer->bits_size = 7;
1074 return (buffer->bits >> 7) & 0x1;
1075 }
1076+ return 0; /* eem '19/7/30 */
1077 }
1078
1079 static inline unsigned int mpeg3slice_getbits2(mpeg3_slice_buffer_t *buffer)
1080 {
1081 if(buffer->bits_size >= 2)
1082 return (buffer->bits >> (buffer->bits_size -= 2)) & 0x3;
1083- else
1084- if(buffer->current_position < buffer->buffer_size)
1085- {
1086+ if(buffer->current_position < buffer->buffer_size) {
1087 buffer->bits <<= 8;
1088 buffer->bits |= buffer->data[buffer->current_position++];
1089 buffer->bits_size += 6;
1090 return (buffer->bits >> buffer->bits_size) & 0x3;
1091 }
1092+ return 0; /* eem '19/7/30 */
1093 }
1094
1095 static inline unsigned int mpeg3slice_getbyte(mpeg3_slice_buffer_t *buffer)
1096 {
1097 if(buffer->bits_size >= 8)
1098 return (buffer->bits >> (buffer->bits_size -= 8)) & 0xff;
1099- else
1100- if(buffer->current_position < buffer->buffer_size)
1101- {
1102+ if(buffer->current_position < buffer->buffer_size) {
1103 buffer->bits <<= 8;
1104 buffer->bits |= buffer->data[buffer->current_position++];
1105 return (buffer->bits >> buffer->bits_size) & 0xff;
1106 }
1107+ return 0; /* eem '19/7/30 */
1108 }
1109
1110
1111@@ -125,44 +123,41 @@ static inline unsigned int mpeg3slice_showbits16(mpeg3_slice_buffer_t *buffer)
1112 {
1113 if(buffer->bits_size >= 16)
1114 return (buffer->bits >> (buffer->bits_size - 16)) & 0xffff;
1115- else
1116- if(buffer->current_position < buffer->buffer_size)
1117- {
1118+ if(buffer->current_position < buffer->buffer_size) {
1119 buffer->bits <<= 16;
1120 buffer->bits_size += 16;
1121 buffer->bits |= (unsigned int)buffer->data[buffer->current_position++] << 8;
1122 buffer->bits |= buffer->data[buffer->current_position++];
1123 return (buffer->bits >> (buffer->bits_size - 16)) & 0xffff;
1124 }
1125+ return 0; /* eem '19/7/30 */
1126 }
1127
1128 static inline unsigned int mpeg3slice_showbits9(mpeg3_slice_buffer_t *buffer)
1129 {
1130 if(buffer->bits_size >= 9)
1131 return (buffer->bits >> (buffer->bits_size - 9)) & 0x1ff;
1132- else
1133- if(buffer->current_position < buffer->buffer_size)
1134- {
1135+ if(buffer->current_position < buffer->buffer_size) {
1136 buffer->bits <<= 16;
1137 buffer->bits_size += 16;
1138 buffer->bits |= (unsigned int)buffer->data[buffer->current_position++] << 8;
1139 buffer->bits |= buffer->data[buffer->current_position++];
1140 return (buffer->bits >> (buffer->bits_size - 9)) & 0x1ff;
1141 }
1142+ return 0; /* eem '19/7/30 */
1143 }
1144
1145 static inline unsigned int mpeg3slice_showbits5(mpeg3_slice_buffer_t *buffer)
1146 {
1147 if(buffer->bits_size >= 5)
1148 return (buffer->bits >> (buffer->bits_size - 5)) & 0x1f;
1149- else
1150- if(buffer->current_position < buffer->buffer_size)
1151- {
1152+ if(buffer->current_position < buffer->buffer_size) {
1153 buffer->bits <<= 8;
1154 buffer->bits_size += 8;
1155 buffer->bits |= buffer->data[buffer->current_position++];
1156 return (buffer->bits >> (buffer->bits_size - 5)) & 0x1f;
1157 }
1158+ return 0; /* eem '19/7/30 */
1159 }
1160
1161 static inline unsigned int mpeg3slice_showbits(mpeg3_slice_buffer_t *slice_buffer, int bits)
1162diff --git a/Cross/plugins/SerialPlugin/SerialPlugin.h b/Cross/plugins/SerialPlugin/SerialPlugin.h
1163index 73ff7cd..3df41e2 100755
1164--- a/Cross/plugins/SerialPlugin/SerialPlugin.h
1165+++ b/Cross/plugins/SerialPlugin/SerialPlugin.h
1166@@ -6,9 +6,12 @@ int serialPortShutdown(void);
1167
1168 #pragma export on
1169 int serialPortClose(int portNum);
1170+int serialPortCloseByName(const char *portName);
1171 int serialPortCount(void);
1172 int serialPortOpen(int portNum, int baudRate, int stopBitsType, int parityType, int dataBits,
1173 int inFlowCtrl, int outFlowCtrl, int xOnChar, int xOffChar);
1174+int serialPortOpenByName(char *portName, int dataRate, int stopBitsType, int parityType, int dataBits,
1175+ int inFlowCtrl, int outFlowCtrl, int xOnChar, int xOffChar);
1176 int serialPortReadInto(int portNum, int count, void *bufferPtr);
1177 int serialPortReadIntoByName(const char *portName, int count, void *bufferPtr);
1178 int serialPortWriteFrom(int portNum, int count, void *bufferPtr);
1179diff --git a/Cross/plugins/Squeak3D/b3dMain.c b/Cross/plugins/Squeak3D/b3dMain.c
1180index 2716d4a..b920906 100644
1181--- a/Cross/plugins/Squeak3D/b3dMain.c
1182+++ b/Cross/plugins/Squeak3D/b3dMain.c
1183@@ -63,7 +63,7 @@ int maxEdges = 0;
1184 /*************************************************************/
1185
1186 void b3dAbort(char *msg){
1187- printf(msg);
1188+ printf("%s", msg);
1189 exit(-1);
1190 }
1191
1192diff --git a/Cross/vm/sq.h b/Cross/vm/sq.h
1193index 4006e00..9f0a865 100644
1194--- a/Cross/vm/sq.h
1195+++ b/Cross/vm/sq.h
1196@@ -177,6 +177,7 @@ sqInt ioScreenDepth(void);
1197 sqInt ioSeconds(void);
1198 sqInt ioSetCursor(sqInt cursorBitsIndex, sqInt offsetX, sqInt offsetY);
1199 sqInt ioSetCursorWithMask(sqInt cursorBitsIndex, sqInt cursorMaskIndex, sqInt offsetX, sqInt offsetY);
1200+sqInt ioSetCursorARGB(sqInt cursorBitsIndex, sqInt extentX, sqInt extentY, sqInt offsetX, sqInt offsetY);
1201 sqInt ioShowDisplay(sqInt dispBitsIndex, sqInt width, sqInt height, sqInt depth,
1202 sqInt affectedL, sqInt affectedR, sqInt affectedT, sqInt affectedB);
1203 sqInt ioHasDisplayDepth(sqInt depth);
1204diff --git a/Cross/vm/sqVirtualMachine.c b/Cross/vm/sqVirtualMachine.c
1205index 59b6a6e..2a6d263 100644
1206--- a/Cross/vm/sqVirtualMachine.c
1207+++ b/Cross/vm/sqVirtualMachine.c
1208@@ -4,6 +4,7 @@
1209 #include <string.h>
1210 #include <time.h>
1211 #include <setjmp.h>
1212+#include <unistd.h>
1213
1214 #include "sqVirtualMachine.h"
1215
1216@@ -485,10 +486,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void)
1217 /* This lives here for now but belongs somewhere else.
1218 * platforms/Cross/vm/sqStuff.c??
1219 */
1220-#define STDOUT_STACK_SZ 5
1221-static int stdoutStackIdx = -1;
1222-static FILE stdoutStack[STDOUT_STACK_SZ];
1223-
1224+
1225 /* N.B. As of cygwin 1.5.25 fopen("crash.dmp","a") DOES NOT WORK! crash.dmp
1226 * contains garbled output as if the file pointer gets set to the start of the
1227 * file, not the end. So we synthesize our own append mode.
1228@@ -521,10 +519,6 @@ pushOutputFile(char *filenameOrStdioIndex)
1229
1230 FILE *output;
1231
1232- if (stdoutStackIdx + 2 >= STDOUT_STACK_SZ) {
1233- fprintf(stderr,"output file stack is full.\n");
1234- return;
1235- }
1236 switch ((unsigned)filenameOrStdioIndex) {
1237 case STDOUT_FILENO: output = stdout; break;
1238 case STDERR_FILENO: output = stderr; break;
1239@@ -536,17 +530,11 @@ pushOutputFile(char *filenameOrStdioIndex)
1240 return;
1241 }
1242 }
1243- stdoutStack[++stdoutStackIdx] = *stdout;
1244- *stdout = *output;
1245 }
1246
1247 void
1248 popOutputFile()
1249 {
1250- if (stdoutStackIdx < 0) {
1251- fprintf(stderr,"output file stack is empty.\n");
1252- return;
1253- }
1254 fflush(stdout);
1255 if (fileno(stdout) > STDERR_FILENO) {
1256 /* as of Feb 2011 with fclose@@GLIBC_2.1 under e.g. CentOS 5.3, fclose
1257@@ -558,5 +546,4 @@ popOutputFile()
1258 fclose(stdout);
1259 #endif
1260 }
1261- *stdout = stdoutStack[stdoutStackIdx--];
1262 }
1263diff --git a/unix/CMakeLists.txt b/unix/CMakeLists.txt
1264index 74831a4..eb6f35b 100644
1265--- a/unix/CMakeLists.txt
1266+++ b/unix/CMakeLists.txt
1267@@ -2,9 +2,9 @@
1268 #
1269 # Last edited: 2012-09-16 21:19:57 by piumarta on linux64
1270
1271-PROJECT (squeak)
1272+CMAKE_MINIMUM_REQUIRED (VERSION 3.13)
1273
1274-CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
1275+PROJECT (squeak)
1276
1277 IF (NOT DEFINED VM_HOST OR NOT DEFINED VM_VERSION)
1278 MESSAGE (FATAL_ERROR "
1279@@ -155,8 +155,6 @@ INCLUDE (${unix}/vm/build.cmake)
1280
1281 BUILD_PLUGINS ()
1282
1283-ADD_SUBDIRECTORY (${unix}/npsqueak)
1284-
1285 SET (cmake ${unix}/../../cmake)
1286
1287 IF (EXISTS ${cmake}/Packages.cmake)
1288diff --git a/unix/cmake/PluginInternal.cmake b/unix/cmake/PluginInternal.cmake
1289index 4ee0e33..d80f5ec 100644
1290--- a/unix/cmake/PluginInternal.cmake
1291+++ b/unix/cmake/PluginInternal.cmake
1292@@ -13,3 +13,5 @@ INCLUDE_DIRECTORIES (${@plugin@_include_directories}
1293 )
1294
1295 ADD_LIBRARY (@plugin@ STATIC @plugin_sources@)
1296+TARGET_LINK_LIBRARIES (@plugin@ ${@plugin@_link_libraries})
1297+TARGET_LINK_LIBRARIES (squeakvm${scriptsuffix} @plugin@)
1298diff --git a/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c b/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c
1299index 788287f..feeed2b 100644
1300--- a/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c
1301+++ b/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c
1302@@ -142,7 +142,7 @@ INLINE static FilePtr newFileRec(int fd, int sema)
1303 return fp;
1304 }
1305
1306-INLINE static allocateBuffer(struct FileBuf *buf, int size)
1307+INLINE static int allocateBuffer(struct FileBuf *buf, int size)
1308 {
1309 if (buf->capacity >= size)
1310 return 1;
1311@@ -184,7 +184,7 @@ FilePtr asyncFileAttach(AsyncFile *f, int fd, int semaIndex)
1312 /*** public functions ***/
1313
1314
1315-int asyncFileOpen(AsyncFile *f, int fileNamePtr, int fileNameSize,
1316+int asyncFileOpen(AsyncFile *f, char *fileNamePtr, int fileNameSize,
1317 int writeFlag, int semaIndex)
1318 {
1319 int fd= 0;
1320@@ -239,7 +239,7 @@ int asyncFileRecordSize(void)
1321 }
1322
1323
1324-int asyncFileReadResult(AsyncFile *f, int bufferPtr, int bufferSize)
1325+int asyncFileReadResult(AsyncFile *f, char *bufferPtr, int bufferSize)
1326 {
1327 FilePtr fp= 0;
1328 int n= 0;
1329@@ -333,7 +333,7 @@ static void writeHandler(int fd, void *data, int flags)
1330 }
1331
1332
1333-int asyncFileWriteStart(AsyncFile *f, int fPosition, int bufferPtr, int count)
1334+int asyncFileWriteStart(AsyncFile *f, int fPosition, char *bufferPtr, int count)
1335 {
1336 FilePtr fp= 0;
1337 validate(f);
1338diff --git a/unix/plugins/CameraPlugin/sqCamera-linux.c b/unix/plugins/CameraPlugin/sqCamera-linux.c
1339index 218322f..aa7792e 100644
1340--- a/unix/plugins/CameraPlugin/sqCamera-linux.c
1341+++ b/unix/plugins/CameraPlugin/sqCamera-linux.c
1342@@ -84,7 +84,7 @@ void *hLibv4l2 = NULL;
1343 int (*vd_open)(const char *, int, ...);
1344 int (*vd_close)(int);
1345 int (*vd_dup)(int);
1346-int (*vd_ioctl)(int, unsigned long int, ...);
1347+int (*vd_ioctl)(int, int, ...);
1348 ssize_t (*vd_read)(int, void *, size_t);
1349 void * (*vd_mmap)(void *, size_t, int, int, int, int64_t);
1350 int (*vd_munmap)(void *, size_t);
1351diff --git a/unix/plugins/HostWindowPlugin/sqUnixHostWindowPlugin.c b/unix/plugins/HostWindowPlugin/sqUnixHostWindowPlugin.c
1352index c963f53..8b3232e 100644
1353--- a/unix/plugins/HostWindowPlugin/sqUnixHostWindowPlugin.c
1354+++ b/unix/plugins/HostWindowPlugin/sqUnixHostWindowPlugin.c
1355@@ -69,7 +69,7 @@ sqInt createWindowWidthheightoriginXyattrlength(
1356 * Return true if ok, false if not, but not currently checked
1357 */
1358 sqInt ioShowDisplayOnWindow(
1359- unsigned char *dispBitsIndex,
1360+ unsigned *dispBitsIndex,
1361 sqInt width, sqInt height, sqInt depth,
1362 sqInt affectedL, sqInt affectedR, sqInt affectedT, sqInt affectedB,
1363 sqInt windowIndex)
1364diff --git a/unix/plugins/MIDIPlugin/sqUnixMIDIALSA.inc b/unix/plugins/MIDIPlugin/sqUnixMIDIALSA.inc
1365index cc4bbad..acf9375 100644
1366--- a/unix/plugins/MIDIPlugin/sqUnixMIDIALSA.inc
1367+++ b/unix/plugins/MIDIPlugin/sqUnixMIDIALSA.inc
1368@@ -219,7 +219,7 @@ int sqMIDIGetPortDirectionality(int portNum)
1369 address. Copy at most length characters, and return the number of
1370 characters copied. Fail if there is no port of the given number.
1371 */
1372-int sqMIDIGetPortName(int portNum, int namePtr, int length)
1373+int sqMIDIGetPortName(int portNum, char * namePtr, int length)
1374 {
1375 static char *userName[] = { "out", "in" };
1376
1377@@ -333,7 +333,7 @@ int sqMIDIParameter(int whichParameter, int modify, int newValue)
1378 {
1379 snd_seq_queue_tempo_t *tempo= 0;
1380 snd_seq_queue_tempo_alloca(&tempo);
1381- snd_seq_get_queue_tempo(seq, queue, &tempo);
1382+ snd_seq_get_queue_tempo(seq, queue, tempo);
1383 return snd_seq_queue_tempo_get_tempo(tempo) / 1000.0;
1384 }
1385 break;
1386diff --git a/unix/plugins/MIDIPlugin/sqUnixMIDINone.inc b/unix/plugins/MIDIPlugin/sqUnixMIDINone.inc
1387index 0c4908e..4003a63 100644
1388--- a/unix/plugins/MIDIPlugin/sqUnixMIDINone.inc
1389+++ b/unix/plugins/MIDIPlugin/sqUnixMIDINone.inc
1390@@ -81,7 +81,7 @@ int sqMIDIGetPortDirectionality(int portNum)
1391 /* Copy the name of the given MIDI port into the string at the given
1392 address. Copy at most length characters, and return the number of
1393 characters copied. Fail if there is no port of the given number.*/
1394-int sqMIDIGetPortName(int portNum, int namePtr, int length)
1395+int sqMIDIGetPortName(int portNum, char * namePtr, int length)
1396 {
1397 success(false);
1398 return 0;
1399diff --git a/unix/plugins/WeDoPlugin/WeDoLinux.c b/unix/plugins/WeDoPlugin/WeDoLinux.c
1400index 973c2d3..62e55be 100644
1401--- a/unix/plugins/WeDoPlugin/WeDoLinux.c
1402+++ b/unix/plugins/WeDoPlugin/WeDoLinux.c
1403@@ -38,7 +38,7 @@
1404 #include <sys/stat.h>
1405 #include <fcntl.h>
1406 #include <linux/hiddev.h>
1407-
1408+#include <unistd.h>
1409
1410 #define true 1
1411 #define false 0
1412diff --git a/unix/src/plugins.int b/unix/src/plugins.int
1413index 82a3c42..e62d096 100644
1414--- a/unix/src/plugins.int
1415+++ b/unix/src/plugins.int
1416@@ -1,2 +1,2 @@
1417 # Automatically generated makefile include for internal plugins
1418-INTERNAL_PLUGINS = ADPCMCodecPlugin AsynchFilePlugin BMPReadWriterPlugin B2DPlugin BitBltPlugin CroquetPlugin DSAPrims ZipPlugin DropPlugin FFTPlugin FT2Plugin FilePlugin FloatArrayPlugin FloatMathPlugin GeniePlugin JPEGReadWriter2Plugin JPEGReaderPlugin JoystickTabletPlugin Klatt LargeIntegers LocalePlugin Matrix2x3Plugin MiscPrimitivePlugin RePlugin SecurityPlugin SerialPlugin SlangTestSupportPlugin SocketPlugin SoundCodecPrims SoundGenerationPlugin SoundPlugin StarSqueakPlugin SurfacePlugin
1419+INTERNAL_PLUGINS = ADPCMCodecPlugin AsynchFilePlugin BMPReadWriterPlugin B2DPlugin BitBltPlugin CroquetPlugin DSAPrims ZipPlugin DropPlugin FFTPlugin FT2Plugin FilePlugin FloatArrayPlugin FloatMathPlugin GeniePlugin JPEGReadWriter2Plugin JPEGReaderPlugin JoystickTabletPlugin Klatt LargeIntegers LocalePlugin Matrix2x3Plugin MiscPrimitivePlugin RePlugin SecurityPlugin SerialPlugin SocketPlugin SoundCodecPrims SoundGenerationPlugin SoundPlugin StarSqueakPlugin SurfacePlugin
1420diff --git a/unix/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c b/unix/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c
1421index 4c71420..85050e0 100644
1422--- a/unix/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c
1423+++ b/unix/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c
1424@@ -30,6 +30,12 @@
1425
1426 #include "sqMemoryAccess.h"
1427
1428+void sqPasteboardPutItemFlavordatalengthformatTypeformatLength ( sqInt inPasteboard, char * data, int ndata, char * typeName, int ntypeName);
1429+void sqPasteboardClear( sqInt inPasteboard );
1430+sqInt sqCreateClipboard( void );
1431+int sqPasteboardGetItemCount(sqInt inPasteboard);
1432+int sqPasteboardCopyItemFlavorsitemNumber (sqInt inPasteboard, int formatNumber);
1433+int sqPasteboardCopyItemFlavorDataformatformatLength (sqInt inPasteboard, char* format, int formatLength);
1434
1435 /*** Constants ***/
1436
1437diff --git a/unix/src/plugins/FileCopyPlugin/FileCopyPlugin.c b/unix/src/plugins/FileCopyPlugin/FileCopyPlugin.c
1438index e2f1b5a..694226a 100644
1439--- a/unix/src/plugins/FileCopyPlugin/FileCopyPlugin.c
1440+++ b/unix/src/plugins/FileCopyPlugin/FileCopyPlugin.c
1441@@ -28,6 +28,7 @@
1442 #define EXPORT(returnType) static returnType
1443 #endif
1444
1445+#include "FileCopyPlugin.h"
1446 #include "sqMemoryAccess.h"
1447
1448
1449diff --git a/unix/src/plugins/MIDIPlugin/MIDIPlugin.c b/unix/src/plugins/MIDIPlugin/MIDIPlugin.c
1450index a3fae58..1a5509f 100644
1451--- a/unix/src/plugins/MIDIPlugin/MIDIPlugin.c
1452+++ b/unix/src/plugins/MIDIPlugin/MIDIPlugin.c
1453@@ -161,7 +161,7 @@ EXPORT(sqInt) primitiveMIDIGetPortName(void) {
1454 if (interpreterProxy->failed()) {
1455 return null;
1456 }
1457- sz = sqMIDIGetPortName(portNum, &portName, 255);
1458+ sz = sqMIDIGetPortName(portNum, portName, 255);
1459 nameObj = interpreterProxy->instantiateClassindexableSize(interpreterProxy->classString(), sz);
1460 if (interpreterProxy->failed()) {
1461 return null;
1462diff --git a/unix/src/plugins/RomePlugin/RomePlugin.c b/unix/src/plugins/RomePlugin/RomePlugin.c
1463index aed0e19..986ed13 100644
1464--- a/unix/src/plugins/RomePlugin/RomePlugin.c
1465+++ b/unix/src/plugins/RomePlugin/RomePlugin.c
1466@@ -1191,7 +1191,7 @@ EXPORT(sqInt) primitivePangoComposeString2(void) {
1467 }
1468 inStringSize = interpreterProxy->stSizeOf(inStringOop);
1469 if (inStringSize == 0) {
1470- primitiveFail();
1471+ interpreterProxy->primitiveFail();
1472 return null;
1473 }
1474 aString = alloca(inStringSize);
1475@@ -2432,12 +2432,12 @@ EXPORT(sqInt) primitiveLanguageAttributes(void) {
1476 return null;
1477 }
1478 if (!(interpreterProxy->isWords(stringOop))) {
1479- primitiveFail();
1480+ interpreterProxy->primitiveFail();
1481 return null;
1482 }
1483 arraySize = interpreterProxy->stSizeOf(arrayOop);
1484 if (arraySize <= 0) {
1485- primitiveFail();
1486+ interpreterProxy->primitiveFail();
1487 return null;
1488 }
1489 stringSize = interpreterProxy->stSizeOf(stringOop);
1490@@ -2501,7 +2501,7 @@ l1: /* end utf8CountFor: */;
1491 array[arrayIndex] = array4Oop;
1492 arrayIndex += 1;
1493 if (arrayIndex >= arraySize) {
1494- primitiveFail();
1495+ interpreterProxy->primitiveFail();
1496 return null;
1497 }
1498 currentTag = leadingChar;
1499@@ -3038,7 +3038,7 @@ EXPORT(sqInt) primitiveUTF8StringWith2Indexes(void) {
1500 arrayOop = oArrayOop;
1501 stringOop = oStringOop;
1502 if (interpreterProxy->isPointers(stringOop)) {
1503- primitiveFail();
1504+ interpreterProxy->primitiveFail();
1505 return null;
1506 }
1507 bytes = interpreterProxy->isBytes(stringOop);
1508@@ -3162,7 +3162,7 @@ EXPORT(sqInt) primitiveUTF8StringWithIndex(void) {
1509 arrayOop = oArrayOop;
1510 stringOop = oStringOop;
1511 if (interpreterProxy->isPointers(stringOop)) {
1512- primitiveFail();
1513+ interpreterProxy->primitiveFail();
1514 return null;
1515 }
1516 bytes = interpreterProxy->isBytes(stringOop);
1517diff --git a/unix/src/plugins/Squeak3D/Squeak3D.c b/unix/src/plugins/Squeak3D/Squeak3D.c
1518index 3732e62..2df5487 100644
1519--- a/unix/src/plugins/Squeak3D/Squeak3D.c
1520+++ b/unix/src/plugins/Squeak3D/Squeak3D.c
1521@@ -197,7 +197,7 @@ static sqInt transformVBcountbyandflags(float *vtxArray, sqInt vtxCount, float *
1522 static void* vbLoadArraysize(sqInt oop, sqInt count);
1523 /*** Variables ***/
1524 static char bbPluginName[256] = "BitBltPlugin";
1525-static sqInt copyBitsFn;
1526+static void *copyBitsFn;
1527
1528 #ifdef SQUEAK_BUILTIN_PLUGIN
1529 extern
1530@@ -209,7 +209,7 @@ static double l2vSpecDir[3];
1531 static sqInt lightFlags;
1532 static double lightScale;
1533 static float* litVertex;
1534-static sqInt loadBBFn;
1535+static void *loadBBFn;
1536 static const char *moduleName =
1537 #ifdef SQUEAK_BUILTIN_PLUGIN
1538 "B3DEnginePlugin (i)"
1539diff --git a/unix/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c b/unix/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
1540index 24601e4..cdd333c 100644
1541--- a/unix/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
1542+++ b/unix/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
1543@@ -31,6 +31,7 @@
1544
1545 #include "sqMemoryAccess.h"
1546
1547+void initSurfacePluginFunctionPointers();
1548
1549 /*** Constants ***/
1550 #define FFIAtomicTypeMask 251658240
1551diff --git a/unix/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c b/unix/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
1552index 1a53f09..7b359d6 100644
1553--- a/unix/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
1554+++ b/unix/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
1555@@ -31,6 +31,12 @@
1556
1557 #include "sqMemoryAccess.h"
1558
1559+/* XDisplayControlPlugin class>>preambleCCode */
1560+extern void openXDisplay(void);
1561+extern void disconnectXDisplay(void);
1562+extern void synchronizeXDisplay(void);
1563+extern void forgetXDisplay(void);
1564+/* end XDisplayControlPlugin class>>preambleCCode */
1565
1566 /*** Constants ***/
1567
1568diff --git a/unix/src/vm/interp.c b/unix/src/vm/interp.c
1569index 85f416d..c308f57 100644
1570--- a/unix/src/vm/interp.c
1571+++ b/unix/src/vm/interp.c
1572@@ -428,7 +428,7 @@ sqInt nilObject(void);
1573 sqInt nonWeakFieldsOf(sqInt oop);
1574 sqInt normalizeFloatOrderingInImage(void);
1575 sqInt noteAsRootheaderLoc(sqInt oop, sqInt headerLoc);
1576-sqInt nullCompilerHook(void);
1577+sqInt nullCompilerHook(...);
1578 sqInt objectAfter(sqInt oop);
1579 sqInt obsoleteDontUseThisFetchWordofObject(sqInt fieldIndex, sqInt oop);
1580 sqInt okayFields(sqInt oop);
1581@@ -930,7 +930,8 @@ struct foo * foo = &fum;
1582
1583 sqInt extraVMMemory;
1584 const char *interpreterVersion = "Squeak4.3 of 22 December 2011 [latest update: #11860]";
1585-sqInt (*compilerHooks[16])();
1586+// FIXME this would break if anybody tries to use compilerHooks
1587+sqInt (*compilerHooks[16])(...);
1588 struct VirtualMachine* interpreterProxy;
1589 sqInt imageFormatVersionNumber = 0;
1590 void *primitiveTable[577] = {
1591@@ -14444,7 +14445,7 @@ register struct foo * foo = &fum;
1592
1593 /* This should never be called: either the compiler is uninitialised (in which case the hooks should never be reached) or the compiler initialisation should have replaced all the hook with their external implementations. */
1594
1595-sqInt nullCompilerHook(void) {
1596+sqInt nullCompilerHook(...) {
1597 error("uninitialised compiler hook called");
1598 return 0;
1599 }
1600diff --git a/unix/src/vm/intplugins/FilePlugin/FilePlugin.c b/unix/src/vm/intplugins/FilePlugin/FilePlugin.c
1601index 0495a0f..551a62b 100644
1602--- a/unix/src/vm/intplugins/FilePlugin/FilePlugin.c
1603+++ b/unix/src/vm/intplugins/FilePlugin/FilePlugin.c
1604@@ -734,7 +734,7 @@ EXPORT(sqInt) primitiveFileStdioHandles(void) {
1605 return interpreterProxy->primitiveFail();
1606 }
1607 }
1608- validMask = sqFileStdioHandlesInto((&fileRecords));
1609+ validMask = sqFileStdioHandlesInto(fileRecords);
1610 if (validMask == 0) {
1611 return interpreterProxy->primitiveFail();
1612 }
1613diff --git a/unix/src/vm/intplugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c b/unix/src/vm/intplugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
1614index 501077a..936387d 100644
1615--- a/unix/src/vm/intplugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
1616+++ b/unix/src/vm/intplugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c
1617@@ -48,6 +48,7 @@
1618 #define sizeOfSTArrayFromCPrimitive(cPtr) (interpreterProxy->sizeOfSTArrayFromCPrimitive(cPtr))
1619 #define storeIntegerofObjectwithValue(idx,oop,value) (interpreterProxy->storeIntegerofObjectwithValue(idx,oop,value))
1620 #define primitiveFail() interpreterProxy->primitiveFail()
1621+#define isBytes(v) interpreterProxy->isBytes(v)
1622 /* allows accessing Strings in both C and Smalltalk */
1623 #define asciiValue(c) c
1624
1625diff --git a/unix/src/vm/intplugins/RePlugin/RePlugin.c b/unix/src/vm/intplugins/RePlugin/RePlugin.c
1626index 97a99c9..fd3ac2a 100644
1627--- a/unix/src/vm/intplugins/RePlugin/RePlugin.c
1628+++ b/unix/src/vm/intplugins/RePlugin/RePlugin.c
1629@@ -252,7 +252,7 @@ EXPORT(sqInt) primPCREExec(void) {
1630 /* begin rcvrExtraPtr */
1631 extraObj = interpreterProxy->fetchPointerofObject(3, rcvr);
1632 if (extraObj == (interpreterProxy->nilObject())) {
1633- extraPtr = NULL;
1634+ extraPtr = 0;
1635 goto l1;
1636 }
1637 extraPtr = ((int) (interpreterProxy->arrayValueOf(extraObj)));
1638@@ -317,7 +317,7 @@ EXPORT(sqInt) primPCREExecfromto(void) {
1639 /* begin rcvrExtraPtr */
1640 extraObj = interpreterProxy->fetchPointerofObject(3, rcvr);
1641 if (extraObj == (interpreterProxy->nilObject())) {
1642- extraPtr = NULL;
1643+ extraPtr = 0;
1644 goto l1;
1645 }
1646 extraPtr = ((int) (interpreterProxy->arrayValueOf(extraObj)));
1647diff --git a/unix/src/vm/sqNamedPrims.h b/unix/src/vm/sqNamedPrims.h
1648index 7a6e27e..59dac39 100644
1649--- a/unix/src/vm/sqNamedPrims.h
1650+++ b/unix/src/vm/sqNamedPrims.h
1651@@ -31,7 +31,6 @@ extern sqExport MiscPrimitivePlugin_exports[];
1652 extern sqExport RePlugin_exports[];
1653 extern sqExport SecurityPlugin_exports[];
1654 extern sqExport SerialPlugin_exports[];
1655-extern sqExport SlangTestSupportPlugin_exports[];
1656 extern sqExport SocketPlugin_exports[];
1657 extern sqExport SoundCodecPrims_exports[];
1658 extern sqExport SoundGenerationPlugin_exports[];
1659@@ -68,7 +67,6 @@ sqExport *pluginExports[] = {
1660 RePlugin_exports,
1661 SecurityPlugin_exports,
1662 SerialPlugin_exports,
1663- SlangTestSupportPlugin_exports,
1664 SocketPlugin_exports,
1665 SoundCodecPrims_exports,
1666 SoundGenerationPlugin_exports,
1667diff --git a/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c b/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c
1668index 18d0f7f..86763e1 100644
1669--- a/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c
1670+++ b/unix/vm-sound-pulse/sqUnixSoundPulseAudio.c
1671@@ -214,7 +214,7 @@ static int mixer_setSwitch(char *name, int captureFlag, int parameter);
1672 static int mixer_getSwitch(char *name, int captureFlag, int channel);
1673 static void sound_Volume(double *left, double *right);
1674 static void sound_SetVolume(double left, double right);
1675-static sqInt sound_SetRecordLevel(sqInt level);
1676+static void sound_SetRecordLevel(sqInt level);
1677 static sqInt sound_SetDevice(sqInt id, char *arg);
1678 static sqInt sound_GetSwitch(sqInt id, sqInt captureFlag, sqInt channel);
1679 static sqInt sound_SetSwitch(sqInt id, sqInt captureFlag, sqInt parameter);
1680@@ -995,10 +995,10 @@ DBGMSG("<sound_StartRecording()");
1681 static sqInt sound_StopRecording(void) {
1682 DBGMSG(">sound_StopRecording()");
1683
1684- if (!audioIn.open) return;
1685+ if (!audioIn.open) return 0;
1686 audioIn.open = false;
1687
1688- if (NULL == audioIn.pa_conn) return;
1689+ if (NULL == audioIn.pa_conn) return 1;
1690
1691 ioThreadStall(&audioIn);
1692
1693@@ -1087,10 +1087,8 @@ static void sound_SetVolume(double left, double right) {
1694 trace();
1695 }
1696
1697-static sqInt sound_SetRecordLevel(sqInt level) {
1698+static void sound_SetRecordLevel(sqInt level) {
1699 trace();
1700- return 1;
1701- return level;
1702 }
1703
1704 static sqInt sound_SetDevice(sqInt id, char *arg) {
1705diff --git a/unix/vm/aio.c b/unix/vm/aio.c
1706index 57e054e..f133c8e 100644
1707--- a/unix/vm/aio.c
1708+++ b/unix/vm/aio.c
1709@@ -31,6 +31,7 @@
1710 */
1711
1712 #include "sqaio.h"
1713+#include "sq.h"
1714
1715 #ifdef HAVE_CONFIG_H
1716
1717diff --git a/unix/vm/sqUnixMain.c b/unix/vm/sqUnixMain.c
1718index 98ea3bc..9a88085 100644
1719--- a/unix/vm/sqUnixMain.c
1720+++ b/unix/vm/sqUnixMain.c
1721@@ -35,6 +35,7 @@
1722 #include "sqaio.h"
1723 #include "sqUnixCharConv.h"
1724 #include "debug.h"
1725+#include "sqUnixGlobals.h"
1726
1727 #ifdef ioMSecs
1728 # undef ioMSecs
1729@@ -53,6 +54,7 @@
1730 #include <errno.h>
1731 #include <signal.h>
1732 #include <fcntl.h>
1733+#include <ctype.h>
1734
1735 #if defined(__alpha__) && defined(__osf__)
1736 # include <sys/sysinfo.h>
1737@@ -118,6 +120,7 @@ int runInterpreter = 1;
1738 struct SqDisplay *dpy= 0;
1739 struct SqSound *snd= 0;
1740
1741+sqInt printCallStack(void);
1742
1743 /*** timer support ***/
1744