You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
(27) |
Apr
(11) |
May
(112) |
Jun
(8) |
Jul
(10) |
Aug
(68) |
Sep
(12) |
Oct
(3) |
Nov
(19) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(15) |
Mar
(20) |
Apr
(22) |
May
(131) |
Jun
(27) |
Jul
(19) |
Aug
(207) |
Sep
(61) |
Oct
(27) |
Nov
(28) |
Dec
(21) |
| 2004 |
Jan
(7) |
Feb
(25) |
Mar
(14) |
Apr
(55) |
May
(15) |
Jun
(2) |
Jul
(14) |
Aug
(28) |
Sep
(29) |
Oct
|
Nov
|
Dec
|
|
From: Ian P. <piu...@us...> - 2004-04-02 01:28:40
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-sound-MacOSX In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25904 Modified Files: sqUnixSoundMacOSX.c Log Message: Rewrite for OS 10.3 API. Index: sqUnixSoundMacOSX.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-sound-MacOSX/sqUnixSoundMacOSX.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sqUnixSoundMacOSX.c 1 Sep 2003 08:31:53 -0000 1.4 --- sqUnixSoundMacOSX.c 2 Apr 2004 01:16:37 -0000 1.5 *************** *** 3,7 **** * Author: Ian...@in... * ! * Last edited: 2003-02-09 17:52:51 by piumarta on emilia.inria.fr * * Copyright (C) 1996-2003 Ian Piumarta and other authors/contributors --- 3,7 ---- * Author: Ian...@in... * ! * Last edited: 2003-11-23 14:39:18 by piumarta on emilia.local * [...1659 lines suppressed...] } else usleep(1000); } + (void)sound_InsertSamplesFromLeadTime; + (void)sound_PlaySilence; + (void)sound_GetRecordingSampleRate; + (void)sound_StartRecording; + (void)sound_RecordSamplesIntoAtLength; + (void)sound_Volume; + (void)sound_SetVolume; + (void)sound_SetRecordLevel; + return 0; } /* ! cc -g -Wall -DTESTING=1 -o sqUnixSoundMacOSX sqUnixSoundMacOSX.c -framework CoreAudio -framework AudioToolbox ! */ #endif // TESTING |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:27:11
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-sound-MacOSX In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25779 Modified Files: sqUnixSoundDebug.h Log Message: Disable sound debugging. Index: sqUnixSoundDebug.h =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-sound-MacOSX/sqUnixSoundDebug.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sqUnixSoundDebug.h 7 Aug 2003 02:44:57 -0000 1.3 --- sqUnixSoundDebug.h 2 Apr 2004 01:15:08 -0000 1.4 *************** *** 1,3 **** ! #if 1 # define startSpy(); --- 1,3 ---- ! #if 0 # define startSpy(); *************** *** 6,9 **** --- 6,15 ---- #else + #define RED 0xff0000 + #define GREEN 0x00ff00 + #define BLUE 0x0000ff + #define WHITE 0xffffff + #define BLACK 0x000000 + #include <pthread.h> |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:24:56
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25082 Modified Files: sqUnixFBDevMousePS2.c Log Message: Increase all timeouts to 100ms. Work around broken PS/2 protocol emulation in /dev/input/mice. Index: sqUnixFBDevMousePS2.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev/sqUnixFBDevMousePS2.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sqUnixFBDevMousePS2.c 21 Aug 2003 00:55:49 -0000 1.2 --- sqUnixFBDevMousePS2.c 2 Apr 2004 01:12:54 -0000 1.3 *************** *** 3,7 **** * Author: Ian...@IN... * ! * Last edited: 2003-08-21 01:40:38 by piumarta on felina.inria.fr */ --- 3,7 ---- * Author: Ian...@IN... * ! * Last edited: 2003-10-31 11:42:56 by piumarta on emilia.inria.fr */ *************** *** 41,49 **** */ ! #define PS2_DISABLE_DELAY 10*1000 #define PS2_RESET_DELAY 1500*1000 ! #define PS2_FLUSH_DELAY 10*1000 ! #define PS2_READ_DELAY 10*1000 ! #define PS2_SEND_DELAY 10*1000 #define PS2_RESET 0xff --- 41,49 ---- */ ! #define PS2_DISABLE_DELAY 100*1000 #define PS2_RESET_DELAY 1500*1000 ! #define PS2_FLUSH_DELAY 100*1000 ! #define PS2_READ_DELAY 100*1000 ! #define PS2_SEND_DELAY 100*1000 #define PS2_RESET 0xff *************** *** 126,129 **** --- 126,130 ---- { case PS2_OK: + case PS2_SELFTEST_OK: /* /dev/input/mice emulation is broken */ break; case PS2_ERROR: *************** *** 184,187 **** --- 185,192 ---- } } + /* /dev/input/mice emulation returns PS2_SELFTEST_OK where send() + expects PS2_OK, causing control to fall through to here. we pick + up the mouse id immediately in the flush(), so the only harm done + is a misleading "reset failed" message while debugging. */ ms_ps2_flush(self); dprintf("%s: reset failed\n", self->msName); |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:23:49
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24959 Modified Files: sqUnixFBDevMouse.c Log Message: Add diagnostics. Index: sqUnixFBDevMouse.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev/sqUnixFBDevMouse.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sqUnixFBDevMouse.c 22 Aug 2003 17:07:15 -0000 1.3 --- sqUnixFBDevMouse.c 2 Apr 2004 01:11:38 -0000 1.4 *************** *** 93,96 **** --- 93,106 ---- { memcpy(out, self->buf, count); + # if DEBUG_AN_AWFUL_LOT + { + int i= 0; + while (i < count) + { + dprintf("<%02x\n", out[i]); + ++i; + } + } + # endif self->bufSize -= count; if (self->bufSize) |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:23:09
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24684 Modified Files: sqUnixFBDevFramebuffer.c Log Message: Always use accessors for fb struct. Fix problem when xres * bytesPerPixel != scan line pitch. Index: sqUnixFBDevFramebuffer.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev/sqUnixFBDevFramebuffer.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sqUnixFBDevFramebuffer.c 22 Aug 2003 17:07:15 -0000 1.3 --- sqUnixFBDevFramebuffer.c 2 Apr 2004 01:11:05 -0000 1.4 *************** *** 3,7 **** * Author: Ian Piumarta <ian...@in...> * ! * Last edited: 2003-08-21 15:00:23 by piumarta on felina.inria.fr */ --- 3,7 ---- * Author: Ian Piumarta <ian...@in...> * ! * Last edited: 2003-10-31 13:32:59 by piumarta on emilia.inria.fr */ *************** *** 71,74 **** --- 71,75 ---- struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; + long int pitch; int bpp; fb_copyBits_t copyBits; *************** *** 110,113 **** --- 111,115 ---- static inline int fb_width(_self) { return self->var.xres; } + static inline int fb_pitch(_self) { return self->pitch; } static inline int fb_height(_self) { return self->var.yres; } static inline int fb_depth(_self) { return self->var.bits_per_pixel; } *************** *** 116,120 **** static inline unsigned long fb_getPixel_32(_self, int x, int y) { ! return ((x >= 0) && (y >= 0) && (x < self->var.xres) && (y < self->var.yres)) ? *((unsigned long *)(self->addr + (x + self->var.xoffset) * (32 / 8) --- 118,122 ---- static inline unsigned long fb_getPixel_32(_self, int x, int y) { ! return ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self))) ? *((unsigned long *)(self->addr + (x + self->var.xoffset) * (32 / 8) *************** *** 125,129 **** static inline void fb_putPixel_32(_self, int x, int y, unsigned long pix) { ! if ((x >= 0) && (y >= 0) && (x < self->var.xres) && (y < self->var.yres)) { *((unsigned long *)(self->addr --- 127,131 ---- static inline void fb_putPixel_32(_self, int x, int y, unsigned long pix) { ! if ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self))) { *((unsigned long *)(self->addr *************** *** 137,141 **** static inline unsigned long fb_getPixel_16(_self, int x, int y) { ! return ((x >= 0) && (y >= 0) && (x < self->var.xres) && (y < self->var.yres)) ? *((unsigned short *)(self->addr + (x + self->var.xoffset) * (16 / 8) --- 139,143 ---- static inline unsigned long fb_getPixel_16(_self, int x, int y) { ! return ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self))) ? *((unsigned short *)(self->addr + (x + self->var.xoffset) * (16 / 8) *************** *** 146,150 **** static inline void fb_putPixel_16(_self, int x, int y, unsigned long pix) { ! if ((x >= 0) && (y >= 0) && (x < self->var.xres) && (y < self->var.yres)) { *((unsigned short *)(self->addr --- 148,152 ---- static inline void fb_putPixel_16(_self, int x, int y, unsigned long pix) { ! if ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self))) { *((unsigned short *)(self->addr *************** *** 158,162 **** static inline unsigned long fb_getPixel_8(_self, int x, int y) { ! return ((x >= 0) && (y >= 0) && (x < self->var.xres) && (y < self->var.yres)) ? *((unsigned char *)(self->addr + (x + self->var.xoffset) --- 160,164 ---- static inline unsigned long fb_getPixel_8(_self, int x, int y) { ! return ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self))) ? *((unsigned char *)(self->addr + (x + self->var.xoffset) *************** *** 168,172 **** static inline void fb_putPixel_8(_self, int x, int y, unsigned long pix) { ! if ((x >= 0) && (y >= 0) && (x < self->var.xres) && (y < self->var.yres)) { *((unsigned char *)(self->addr --- 170,174 ---- static inline void fb_putPixel_8(_self, int x, int y, unsigned long pix) { ! if ((x >= 0) && (y >= 0) && (x < fb_width(self)) && (y < fb_height(self))) { *((unsigned char *)(self->addr *************** *** 284,289 **** { hideCursor(self); ! self->cursorPosition.x= max(0, min(self->cursorPosition.x + dx, self->var.xres - 1)); ! self->cursorPosition.y= max(0, min(self->cursorPosition.y + dy, self->var.yres - 1)); showCursor(self); } --- 286,291 ---- { hideCursor(self); ! self->cursorPosition.x= max(0, min(self->cursorPosition.x + dx, fb_width(self) - 1)); ! self->cursorPosition.y= max(0, min(self->cursorPosition.y + dy, fb_height(self) - 1)); showCursor(self); } *************** *** 296,302 **** for (y= t; y < b; ++y) { ! int offset= (l + (y * self->var.xres)) * 4; ! unsigned long *in= (unsigned long *)(bits + offset); ! unsigned long *out= (unsigned long *)(self->addr + offset); for (x= l; x < r; x += 1, in += 1, out += 1) { --- 298,303 ---- for (y= t; y < b; ++y) { ! unsigned long *in= (unsigned long *)(bits + ((l + (y * fb_width(self))) * 4)); ! unsigned long *out= (unsigned long *)(self->addr + ((l + (y * fb_pitch(self))) * 4)); for (x= l; x < r; x += 1, in += 1, out += 1) { *************** *** 323,329 **** for (y= t; y < b; ++y) { ! int offset= (l + (y * self->var.xres)) * 2; ! unsigned short *in= (unsigned short *)(bits + offset); ! unsigned short *out= (unsigned short *)(self->addr + offset); for (x= l; x < r; x += 2, in += 2, out += 2) { --- 324,329 ---- for (y= t; y < b; ++y) { ! unsigned short *in= (unsigned short *)(bits + ((l + (y * fb_width(self))) * 2)); ! unsigned short *out= (unsigned short *)(self->addr + ((l + (y * fb_pitch(self))) * 2)); for (x= l; x < r; x += 2, in += 2, out += 2) { *************** *** 347,353 **** for (y= t; y < b; ++y) { ! int offset= (l + (y * self->var.xres)) * 2; ! unsigned short *in= (unsigned short *)(bits + offset); ! unsigned short *out= (unsigned short *)(self->addr + offset); for (x= l; x < r; x += 2, in += 2, out += 2) { --- 347,352 ---- for (y= t; y < b; ++y) { ! unsigned short *in= (unsigned short *)(bits + ((l + (y * fb_width(self))) * 2)); ! unsigned short *out= (unsigned short *)(self->addr + ((l + (y * fb_pitch(self))) * 2)); for (x= l; x < r; x += 2, in += 2, out += 2) { *************** *** 370,376 **** for (y= t; y < b; ++y) { ! int offset= (l + (y * self->var.xres)); ! unsigned char *in= (unsigned char *)(bits + offset); ! unsigned char *out= (unsigned char *)(self->addr + offset); for (x= l; x < r; x += 4, in += 4, out += 4) { --- 369,374 ---- for (y= t; y < b; ++y) { ! unsigned char *in= (unsigned char *)(bits + ((l + (y * fb_pitch(self))))); ! unsigned char *out= (unsigned char *)(self->addr + ((l + (y * fb_pitch(self))))); for (x= l; x < r; x += 4, in += 4, out += 4) { *************** *** 511,517 **** self->var.yoffset= 0; self->var.activate= FB_ACTIVATE_NOW; ! if (ioctl(self->fd, FBIOPAN_DISPLAY, &self->var)) perror("FBIOPAN_DISPLAY"); ! dprintf("%s: %dx%dx%d+%x+%x (%dx%d) %s, rgb %d+%d %d+%d %d+%d pitch %d\n", self->fbName, self->var.xres, self->var.yres, self->var.bits_per_pixel, self->var.xoffset, self->var.yoffset, self->var.xres_virtual, self->var.yres_virtual, --- 509,518 ---- self->var.yoffset= 0; self->var.activate= FB_ACTIVATE_NOW; ! ioctl(self->fd, FBIOPAN_DISPLAY, &self->var); ! self->size= fb_height(self) * self->fix.line_length; ! self->pitch= self->fix.line_length / self->var.bits_per_pixel * 8; ! ! dprintf("%s: %dx%dx%d+%x+%x (%dx%d) %s, rgb %d+%d %d+%d %d+%d pitch %d(%d)\n", self->fbName, self->var.xres, self->var.yres, self->var.bits_per_pixel, self->var.xoffset, self->var.yoffset, self->var.xres_virtual, self->var.yres_virtual, *************** *** 520,526 **** self->var.green.offset, self->var.green.length, self->var.blue .offset, self->var.blue .length, ! self->fix.line_length); ! ! self->size= self->var.yres * self->fix.line_length; if (self->var.bits_per_pixel == 8) --- 521,525 ---- self->var.green.offset, self->var.green.length, self->var.blue .offset, self->var.blue .length, ! self->fix.line_length, self->pitch); if (self->var.bits_per_pixel == 8) *************** *** 634,639 **** assert(self->kb); kb_initGraphics(self->kb); ! for (y= 0; y < self->var.yres; ++y) ! for (x= 0; x < self->var.xres; ++x) self->putPixel(self, x, y, self->whitePixel); } --- 633,638 ---- assert(self->kb); kb_initGraphics(self->kb); ! for (y= 0; y < fb_height(self); ++y) ! for (x= 0; x < fb_width(self); ++x) self->putPixel(self, x, y, self->whitePixel); } *************** *** 645,650 **** { int x, y; ! for (y= 0; y < self->var.yres; ++y) ! for (x= 0; x < self->var.xres; ++x) self->putPixel(self, x, y, 0); } --- 644,649 ---- { int x, y; ! for (y= 0; y < fb_height(self); ++y) ! for (x= 0; x < fb_width(self); ++x) self->putPixel(self, x, y, 0); } *************** *** 656,661 **** static void fb_initCursor(_self) { ! self->cursorPosition.x= self->var.xres / 2; ! self->cursorPosition.y= self->var.yres / 2; } --- 655,660 ---- static void fb_initCursor(_self) { ! self->cursorPosition.x= fb_width(self) / 2; ! self->cursorPosition.y= fb_height(self) / 2; } |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:21:40
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24476 Modified Files: sqUnixFBDev.c Log Message: Add debugging diagnostics. Index: sqUnixFBDev.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-display-fbdev/sqUnixFBDev.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sqUnixFBDev.c 22 Aug 2003 17:07:15 -0000 1.3 --- sqUnixFBDev.c 2 Apr 2004 01:09:37 -0000 1.4 *************** *** 43,46 **** --- 43,47 ---- + #include "config.h" #include "sq.h" #include "sqUnixMain.h" *************** *** 76,80 **** va_list ap; va_start(ap, fmt); ! vfprintf(stderr, fmt, ap); va_end(ap); #endif --- 77,81 ---- va_list ap; va_start(ap, fmt); ! vprintf(fmt, ap); va_end(ap); #endif *************** *** 102,105 **** --- 103,109 ---- } + + /*#define DEBUG_EVENTS 1*/ + #include "sqUnixEvent.c" *************** *** 149,152 **** --- 153,160 ---- static void enqueueKeyboardEvent(int key, int up, int modifiers) { + dprintf("KEY %3d %02x %c %s mod %02x\n", + key, key, ((key > 32) && (key < 127)) ? key : ' ', + up ? "UP" : "DOWN", modifiers); + modifierState= modifiers; if (up) *************** *** 185,188 **** --- 193,199 ---- buttonState= b; mousePosition= fb->cursorPosition; + if (b) + dprintf("mouse %02x at %4d,%4d mod %02x\n", + b, mousePosition.x, mousePosition.y, modifierState); recordMouseEvent(); } |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:20:36
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-display-X11 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24188 Modified Files: sqUnixX11.c Log Message: Fix prototype for initCharmap(). Print more useful diagnostic when setlocate() fails. Index: sqUnixX11.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-display-X11/sqUnixX11.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sqUnixX11.c 16 Sep 2003 07:55:04 -0000 1.12 --- sqUnixX11.c 2 Apr 2004 01:08:32 -0000 1.13 *************** *** 37,41 **** /* Author: Ian Piumarta <ian...@in...> * ! * Last edited: 2003-09-16 06:53:35 by piumarta on emilia.inria.fr * * Support for more intelligent CLIPBOARD selection handling contributed by: --- 37,41 ---- /* Author: Ian Piumarta <ian...@in...> * ! * Last edited: 2004-01-30 02:53:20 by piumarta on emilia.local * * Support for more intelligent CLIPBOARD selection handling contributed by: *************** *** 396,400 **** unsigned char Squeak_to_X[256]; ! void initCharmap() { int i; --- 396,400 ---- unsigned char Squeak_to_X[256]; ! void initCharmap(void) { int i; *************** *** 1050,1054 **** if (!setlocale(LC_CTYPE, "")) { ! fprintf(stderr, "setlocale() failed\n"); goto revertInput; } --- 1050,1054 ---- if (!setlocale(LC_CTYPE, "")) { ! fprintf(stderr, "setlocale() failed (check values of LC_CTYPE, LANG and LC_ALL)\n"); goto revertInput; } |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:19:21
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-display-X11 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24054 Modified Files: Makefile.in Log Message: Always add /usr/X11R6/include to X11 includes. Index: Makefile.in =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-display-X11/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.in 1 Sep 2003 08:31:53 -0000 1.4 --- Makefile.in 2 Apr 2004 01:07:18 -0000 1.5 *************** *** 49,53 **** -I$(topdir)/platforms/Cross/plugins/FilePlugin \ -I$(topdir)/platforms/Cross/plugins/B3DAcceleratorPlugin \ ! -I$(topdir)/platforms/unix/plugins/B3DAcceleratorPlugin $(TARGET) : $(OBJS) Makefile --- 49,54 ---- -I$(topdir)/platforms/Cross/plugins/FilePlugin \ -I$(topdir)/platforms/Cross/plugins/B3DAcceleratorPlugin \ ! -I$(topdir)/platforms/unix/plugins/B3DAcceleratorPlugin \ ! -I/usr/X11R6/include $(TARGET) : $(OBJS) Makefile |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:18:12
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23910 Modified Files: sqUnixMain.h Log Message: Add event definitions for OSX browser plugin. Index: sqUnixMain.h =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm/sqUnixMain.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sqUnixMain.h 7 Aug 2003 02:44:56 -0000 1.3 --- sqUnixMain.h 2 Apr 2004 01:06:06 -0000 1.4 *************** *** 12,14 **** --- 12,16 ---- extern void imgInit(void); + #define EventTypeUpdate 100 + #endif /* __sqUnixMain_h */ |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:17:03
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23662 Modified Files: sqUnixMain.c Log Message: Add runInterpreter flag to allow modules to inhibit entry to interpreter loop. Reinstate global '-nomixer' option. Index: sqUnixMain.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm/sqUnixMain.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sqUnixMain.c 3 Sep 2003 18:07:35 -0000 1.13 --- sqUnixMain.c 2 Apr 2004 01:04:58 -0000 1.14 *************** *** 37,41 **** /* Author: Ian Piumarta <ian...@in...> * ! * Last edited: 2003-09-02 15:29:03 by piumarta on emilia.inria.fr */ --- 37,41 ---- /* Author: Ian Piumarta <ian...@in...> * ! * Last edited: 2003-11-23 13:23:43 by piumarta on emilia.local */ *************** *** 118,128 **** #endif ! int sqIgnorePluginErrors= 0; #include "SqDisplay.h" #include "SqSound.h" ! static struct SqDisplay *dpy= 0; ! static struct SqSound *snd= 0; --- 118,129 ---- #endif ! int sqIgnorePluginErrors = 0; ! int runInterpreter = 1; #include "SqDisplay.h" #include "SqSound.h" ! struct SqDisplay *dpy= 0; ! struct SqSound *snd= 0; *************** *** 658,663 **** struct SqModule *displayModule= 0; struct SqModule *soundModule= 0; ! ! static struct SqModule *modules= 0; #define modulesDo(M) for (M= modules; M; M= M->next) --- 659,663 ---- struct SqModule *displayModule= 0; struct SqModule *soundModule= 0; ! struct SqModule *modules= 0; #define modulesDo(M) for (M= modules; M; M= M->next) *************** *** 989,992 **** --- 989,993 ---- if (!strcmp(argv[0], "-help")) { usage(); return 1; } else if (!strcmp(argv[0], "-noevents")) { noEvents = 1; return 1; } + else if (!strcmp(argv[0], "-nomixer")) { noSoundMixer = 1; return 1; } else if (!strcmp(argv[0], "-notimer")) { useItimer = 0; return 1; } else if (!strncmp(argv[0],"-jit", 4)) { useJit = jitArgs(argv[0]+4); return 1; } *************** *** 1044,1047 **** --- 1045,1049 ---- printf(" -headless quivalent to '-vm-display-X11 -headless'\n"); printf(" -nodisplay quivalent to '-vm-display-null'\n"); + printf(" -nomixer disable modification of mixer settings\n"); printf(" -nosound quivalent to '-vm-sound-null'\n"); printf(" -quartz quivalent to '-vm-display-Quartz'\n"); *************** *** 1292,1299 **** sqIgnorePluginErrors= 1; ! modules= &vm_Module; ! modules->parseEnvironment(); parseArguments(argc, argv); ! loadModules(); sqIgnorePluginErrors= 0; --- 1294,1303 ---- sqIgnorePluginErrors= 1; ! if (!modules) ! modules= &vm_Module; ! vm_Module.parseEnvironment(); parseArguments(argc, argv); ! if ((!dpy) || (!snd)) ! loadModules(); sqIgnorePluginErrors= 0; *************** *** 1350,1354 **** /* run Squeak */ ! interpret(); /* we need these, even if not referenced from main executable */ --- 1354,1359 ---- /* run Squeak */ ! if (runInterpreter) ! interpret(); /* we need these, even if not referenced from main executable */ |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:14:58
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23350 Modified Files: sqUnixCharConv.c Log Message: Use Solaris-specific encoding names on Sparc. Index: sqUnixCharConv.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm/sqUnixCharConv.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sqUnixCharConv.c 1 Sep 2003 08:31:53 -0000 1.4 --- sqUnixCharConv.c 2 Apr 2004 01:02:54 -0000 1.5 *************** *** 36,40 **** * directory `platforms/unix/doc' before proceeding with any such use. * ! * Last edited: 2003-03-05 06:44:50 by piumarta on emilia.inria.fr */ --- 36,40 ---- * directory `platforms/unix/doc' before proceeding with any such use. * ! * Last edited: 2003-09-30 04:50:04 by piumarta on emilia.inria.fr */ *************** *** 64,68 **** // we have to do something special on MacOSX (surprise surprise) because: ! // - MacOSX isn't Unix98 compliant and lacks builtin iconv functions // - the free libiconv cannot handle the canonical decomposition used in HFS+ // ho hum dee dumb --- 64,68 ---- // we have to do something special on MacOSX (surprise surprise) because: ! // - MacOSX is not Unix98 compliant and lacks builtin iconv functions // - the free libiconv cannot handle the canonical decomposition used in HFS+ // ho hum dee dumb *************** *** 90,94 **** { "LATIN1", (void *)kCFStringEncodingISOLatin1 }, { "ISO-8859-1", (void *)kCFStringEncodingISOLatin1 }, ! // there are many tens of these and I can't be bothered. { 0, 0 } }; --- 90,94 ---- { "LATIN1", (void *)kCFStringEncodingISOLatin1 }, { "ISO-8859-1", (void *)kCFStringEncodingISOLatin1 }, ! // there are many tens of these and I cannot be bothered. { 0, 0 } }; *************** *** 152,160 **** typedef char ichar_t; void *sqTextEncoding= (void *)"MACINTOSH"; /* xxxFIXME -> "ISO-8859-15" */ - void *uxTextEncoding= (void *)"ISO-8859-15"; void *uxPathEncoding= (void *)"UTF-8"; ! void *uxUTF8Encoding= (void *)"UTF-8"; void *uxXWinEncoding= (void *)"ISO-8859-1"; void setEncoding(void **encoding, char *rawName) --- 152,168 ---- typedef char ichar_t; + #ifdef __sparc + void *sqTextEncoding= (void *)"mac"; /* xxxFIXME -> "ISO-8859-15" */ + void *uxPathEncoding= (void *)"iso"; + void *uxTextEncoding= (void *)"iso"; + void *uxXWinEncoding= (void *)"iso"; + void *uxUTF8Encoding= (void *)"UTF-8"; + #else void *sqTextEncoding= (void *)"MACINTOSH"; /* xxxFIXME -> "ISO-8859-15" */ void *uxPathEncoding= (void *)"UTF-8"; ! void *uxTextEncoding= (void *)"ISO-8859-15"; void *uxXWinEncoding= (void *)"ISO-8859-1"; + void *uxUTF8Encoding= (void *)"UTF-8"; + #endif void setEncoding(void **encoding, char *rawName) *************** *** 163,168 **** --- 171,178 ---- int len= strlen(name); int i; + #ifndef __sparc for (i= 0; i < len; ++i) name[i]= toupper(name[i]); + #endif if (!strcmp(name, "MACROMAN")) *encoding= "MACINTOSH"; else if (!strcmp(name, "MAC-ROMAN")) *encoding= "MACINTOSH"; |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:13:16
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23102 Modified Files: glibc.h Log Message: Explicitly force all ctype operators to external functions. Rename realpath() to glibc 2.0 version. Index: glibc.h =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm/glibc.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** glibc.h 19 Aug 2003 22:32:32 -0000 1.2 --- glibc.h 2 Apr 2004 01:01:13 -0000 1.3 *************** *** 2,13 **** #if defined(__GNUC__) && defined(__GLIBC_PREREQ) # if __GLIBC_PREREQ(2,3) ! /* squash __ctype_to{upper,lower}_loc */ ! # if defined(__USE_EXTERN_INLINES) ! # undef __USE_EXTERN_INLINES ! # include <ctype.h> ! # undef toupper ! # undef tolower ! # define __USE_EXTERN_INLINES 1 ! # endif /* squash realpath@GLIBC_2.3 */ # include <stdlib.h> --- 2,20 ---- #if defined(__GNUC__) && defined(__GLIBC_PREREQ) # if __GLIBC_PREREQ(2,3) ! /* squash __ctype_to{upper,lower}_loc and avoid including the header */ ! # define _CTYPE_H 1 ! extern int isalnum(int c); ! extern int isalpha(int c); ! extern int isascii(int c); ! extern int isblank(int c); ! extern int iscntrl(int c); ! extern int isdigit(int c); ! extern int isgraph(int c); ! extern int islower(int c); ! extern int isprint(int c); ! extern int ispunct(int c); ! extern int isspace(int c); ! extern int isupper(int c); ! extern int isxdigit(int c); /* squash realpath@GLIBC_2.3 */ # include <stdlib.h> |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:12:01
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22817 Modified Files: acinclude.m4 Log Message: Better validation of iconv headers. Use built-in iconv on OSX 10.3. Provide '-disable-iconv' configuration option. Index: acinclude.m4 =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm/acinclude.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** acinclude.m4 7 Aug 2003 07:37:27 -0000 1.4 --- acinclude.m4 2 Apr 2004 00:59:58 -0000 1.5 *************** *** 23,32 **** ]) ! AC_CHECK_HEADERS(iconv.h) ! AC_ICONV ! AC_LANGINFO_CODESET ! case $host_os in ! darwin*) LIBS="$LIBS -framework CoreFoundation";; ! *) ;; ! esac --- 23,41 ---- ]) ! AC_ARG_ENABLE(iconv, ! [ --disable-iconv disable iconv support [default=enabled]], ! [with_iconv="$withval"], ! [with_iconv="yes"]) ! ! if test "$with_iconv" = "yes"; then ! AC_CHECK_HEADERS(iconv.h) ! AC_ICONV ! AC_LANGINFO_CODESET ! case $host_os in ! darwin*) LIBS="$LIBS -framework CoreFoundation";; ! *) ;; ! esac ! else ! AC_MSG_RESULT([******** disabling iconv]) ! fi |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:10:36
|
Update of /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22429 Modified Files: sqUnixSocket.c Log Message: Don't check for peer disconnect in sqSocketConnectionStatus(). Index: sqUnixSocket.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sqUnixSocket.c 16 Sep 2003 07:56:51 -0000 1.12 --- sqUnixSocket.c 2 Apr 2004 00:58:33 -0000 1.13 *************** *** 37,41 **** /* Author: Ian...@in... * ! * Last edited: 2003-09-12 21:05:50 by piumarta on emilia.inria.fr * * Support for BSD-style "accept" primitives contributed by: --- 37,41 ---- /* Author: Ian...@in... * ! * Last edited: 2003-09-16 20:06:06 by piumarta on emilia.inria.fr * * Support for BSD-style "accept" primitives contributed by: *************** *** 590,593 **** --- 590,594 ---- return Invalid; } + #if 0 /* check for connection closed by peer */ if (SOCKETSTATE(s) == Connected) *************** *** 601,604 **** --- 602,606 ---- } } + #endif FPRINTF((stderr, "socketStatus(%d) -> %d\n", SOCKET(s), SOCKETSTATE(s))); return SOCKETSTATE(s); |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:08:44
|
Update of /cvsroot/squeak/squeak/platforms/unix/plugins/FilePlugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22035 Modified Files: sqUnixFile.c Log Message: Swap uses of modification and changed time in stat() to be consistent with 'ls'. Index: sqUnixFile.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/plugins/FilePlugin/sqUnixFile.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sqUnixFile.c 1 Sep 2003 08:31:50 -0000 1.10 --- sqUnixFile.c 2 Apr 2004 00:56:39 -0000 1.11 *************** *** 37,41 **** /* Author: Ian...@IN... * ! * Last edited: 2003-03-05 05:53:38 by piumarta on emilia.inria.fr */ --- 37,41 ---- /* Author: Ian...@IN... * ! * Last edited: 2003-10-28 10:56:26 by piumarta on emilia.inria.fr */ *************** *** 230,237 **** } ! /* use modification time instead (just like ls) */ ! *creationDate= convertToSqueakTime(statBuf.st_mtime); ! /* use status change time instead */ ! *modificationDate= convertToSqueakTime(statBuf.st_ctime); if (S_ISDIR(statBuf.st_mode)) --- 230,237 ---- } ! /* last change time */ ! *creationDate= convertToSqueakTime(statBuf.st_ctime); ! /* modification time */ ! *modificationDate= convertToSqueakTime(statBuf.st_mtime); if (S_ISDIR(statBuf.st_mode)) |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:06:09
|
Update of /cvsroot/squeak/squeak/platforms/unix/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21482 Modified Files: configure.ac Log Message: Version is 3.6-3 / 3.6-5429. Index: configure.ac =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/config/configure.ac,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** configure.ac 16 Sep 2003 07:59:23 -0000 1.14 --- configure.ac 2 Apr 2004 00:54:06 -0000 1.15 *************** *** 38,46 **** # Author: Ian...@IN... # ! # Last edited: 2003-09-16 08:10:35 by piumarta on emilia.inria.fr AC_INIT([config.h.in]) ! AC_VM_VERSION(3,6g,1, 3,6g,5420) topdir=`cd ${srcdir}/../../..; pwd` --- 38,46 ---- # Author: Ian...@IN... # ! # Last edited: 2004-04-01 14:57:04 by piumarta on emilia.local AC_INIT([config.h.in]) ! AC_VM_VERSION(3,6,3, 3,6,5429) topdir=`cd ${srcdir}/../../..; pwd` |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:05:23
|
Update of /cvsroot/squeak/squeak/platforms/unix/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21386 Modified Files: Makefile.install Log Message: Force compression (gzip -f) on doc files. Index: Makefile.install =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/config/Makefile.install,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile.install 1 Sep 2003 07:59:33 -0000 1.6 --- Makefile.install 2 Apr 2004 00:53:20 -0000 1.7 *************** *** 3,7 **** # Author: ian...@in... # ! # Last edited: 2003-08-31 20:12:26 by piumarta on emilia.inria.fr DOCFILES = COPYING COPYRIGHT LICENSE \ --- 3,7 ---- # Author: ian...@in... # ! # Last edited: 2004-02-09 10:28:52 by piumarta on emilia.local DOCFILES = COPYING COPYRIGHT LICENSE \ *************** *** 63,68 **** echo $(INSTALL_DATA) $(topdir)/platforms/unix/doc/$$f $(ROOT)$(docdir); \ $(INSTALL_DATA) $(topdir)/platforms/unix/doc/$$f $(ROOT)$(docdir); \ done - gzip -9 $(ROOT)$(docdir)/* $(MKINSTALLDIRS) $(ROOT)$(mandir)/man1 $(INSTALL_DATA) squeak.1 $(ROOT)$(mandir)/man1 --- 63,68 ---- echo $(INSTALL_DATA) $(topdir)/platforms/unix/doc/$$f $(ROOT)$(docdir); \ $(INSTALL_DATA) $(topdir)/platforms/unix/doc/$$f $(ROOT)$(docdir); \ + gzip -f9 $(ROOT)$(docdir)/* done $(MKINSTALLDIRS) $(ROOT)$(mandir)/man1 $(INSTALL_DATA) squeak.1 $(ROOT)$(mandir)/man1 |
|
From: Ian P. <piu...@us...> - 2004-04-02 01:04:17
|
Update of /cvsroot/squeak/squeak/platforms/unix/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21127 Modified Files: Makefile.in Log Message: Add rules for OSX browser plugin bundle. Index: Makefile.in =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/config/Makefile.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile.in 1 Sep 2003 07:56:19 -0000 1.8 --- Makefile.in 2 Apr 2004 00:52:12 -0000 1.9 *************** *** 36,40 **** # Author: ian...@in... # ! # Last edited: 2003-08-31 03:15:52 by piumarta on cartman.inria.fr @make_cfg@ --- 36,40 ---- # Author: ian...@in... # ! # Last edited: 2004-02-06 06:37:54 by piumarta on emilia.local @make_cfg@ *************** *** 89,93 **** mkdir -p $(appdir)/MacOS cp -p squeak $(appdir)/MacOS/. ! cp -p */.libs/*.so $(appdir)/MacOS/. cp -p Info.plist $(appdir)/. cp -p $(osxdir)/PkgInfo $(appdir)/. --- 89,95 ---- mkdir -p $(appdir)/MacOS cp -p squeak $(appdir)/MacOS/. ! cp -p */.libs/* $(appdir)/MacOS/. ! rm -f $(appdir)/MacOS/*.la ! rm -f $(appdir)/MacOS/*.lai cp -p Info.plist $(appdir)/. cp -p $(osxdir)/PkgInfo $(appdir)/. *************** *** 101,104 **** --- 103,129 ---- mv Info.plist.tmp Info.plist + # OSX plugin bundle + + nposxdir=$(topdir)/platforms/unix/vm-display-Quartz + npapp=NPSqueak.bundle + npappdir=$(npapp)/Contents + + NPSqueak.bundle : NPSqueak plugins + /bin/rm -rf $(npapp) + mkdir -p $(npappdir)/MacOS + cp -p squeak $(npappdir)/MacOS/. + cp -p */.libs/*.so $(npappdir)/MacOS/. + cp -p Info.plist $(npappdir)/. + cp -p $(nposxdir)/PkgInfo $(npappdir)/. + cp -pr $(nposxdir)/Resources $(npappdir)/. + -find $(npapp) -name '*~' | xargs rm -f + + NPOBJS = vm-display-Quartz/sqUnixSafari.o vm-sound-MacOSX/sqUnixSoundMacOSX.o vm-display-Quartz/sqUnixQuartz.o + NPLIBS = $(NPOBJS) -framework CoreAudio -framework AudioToolbox + + NPSqueak : config.sh $(SQLIBS) version.o $(NPOBJS) + gcc -bundle -flat_namespace -undefined suppress -o NPSqueak \ + $(NPLIBS) $(SQLIBS) version.o $(LIBS) vm/vm.a + # manual page |
|
From: Ned K. <ne...@us...> - 2004-03-30 22:38:21
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm-display-X11 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11319/platforms/unix/vm-display-X11 Modified Files: Tag: ned-branch sqUnixX11.c Log Message: Automake 1.7 compatibility changes. Added plugins: - BerkeleyDbPlugin (Stephen Pair) - FT2Plugin (Arjen van Elteren, mods by Ned Konz) - SpreadPlugin (Ned Konz) Added diagnostics and aioDisable for invalid sockets in sqUnixSocket.c Index: sqUnixX11.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm-display-X11/sqUnixX11.c,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -C2 -d -r1.12.2.1 -r1.12.2.2 *** sqUnixX11.c 21 Nov 2003 02:40:18 -0000 1.12.2.1 --- sqUnixX11.c 30 Mar 2004 22:26:39 -0000 1.12.2.2 *************** *** 4171,4174 **** --- 4171,4175 ---- DPRINTF(3, (fp,"depthBits = %i\r", depth)); } + glGetError(); /* reset error flag */ } *************** *** 4277,4280 **** --- 4278,4285 ---- printf(" -xasync don't serialize display updates\n"); printf(" -xshm use X shared memory extension\n"); + #if (USE_X11_GLX) + printf(" -glxVerbosity <n> set GLX verbosity level to <n>\n"); + #endif + } *************** *** 4363,4366 **** --- 4368,4377 ---- return 3; } + #if (USE_X11_GLX) + else if (!strcmp(arg, "-glxVerbosity")) + { + sscanf(argv[1], "%d", &verboseLevel); + } + #endif else n= 0; /* not recognised */ |
|
From: Ned K. <ne...@us...> - 2004-03-30 22:38:21
|
Update of /cvsroot/squeak/squeak/platforms/unix/vm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11319/platforms/unix/vm Modified Files: Tag: ned-branch acinclude.m4 Log Message: Automake 1.7 compatibility changes. Added plugins: - BerkeleyDbPlugin (Stephen Pair) - FT2Plugin (Arjen van Elteren, mods by Ned Konz) - SpreadPlugin (Ned Konz) Added diagnostics and aioDisable for invalid sockets in sqUnixSocket.c Index: acinclude.m4 =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/vm/acinclude.m4,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** acinclude.m4 7 Aug 2003 07:37:27 -0000 1.4 --- acinclude.m4 30 Mar 2004 22:26:39 -0000 1.4.2.1 *************** *** 23,27 **** ]) ! AC_CHECK_HEADERS(iconv.h) AC_ICONV AC_LANGINFO_CODESET --- 23,27 ---- ]) ! AC_CHECK_HEADERS([iconv.h]) AC_ICONV AC_LANGINFO_CODESET |
|
From: Ned K. <ne...@us...> - 2004-03-30 22:38:21
|
Update of /cvsroot/squeak/squeak/platforms/unix/plugins/SpreadPlugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11319/platforms/unix/plugins/SpreadPlugin Added Files: Tag: ned-branch Makefile.inc acinclude.m4 sqSpread.c Log Message: Automake 1.7 compatibility changes. Added plugins: - BerkeleyDbPlugin (Stephen Pair) - FT2Plugin (Arjen van Elteren, mods by Ned Konz) - SpreadPlugin (Ned Konz) Added diagnostics and aioDisable for invalid sockets in sqUnixSocket.c --- NEW FILE: Makefile.inc --- PLIBS = -lspread XINCLUDES = -I/usr/include [includes] --- NEW FILE: acinclude.m4 --- AC_PLUGIN_CHECK_LIB(spread,SP_connect) AC_CHECK_HEADERS(sp.h) --- NEW FILE: sqSpread.c --- /* * Spread Plugin for Squeak * by Ned Konz <ne...@bi...> * Mon Jul 15 21:45:46 PDT 2002 * License: Squeak's * * Currently this is only Unix specific because it uses aio.h. * If the async file support were to be generalized it could * easily work cross-platform. */ #include "SpreadPlugin.h" #include "aio.h" #include "sqVirtualMachine.h" #define _GNU_SOURCE /* required for strndup */ #include <string.h> #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <time.h> #if defined(DEBUG) # define dprintf(stuff) fprintf stuff #else # define dprintf(stuff) #endif #define max(a,b) (((a) > (b)) ? (a) : (b)) /* lifted from sqUnixAsynchFile.c */ static int sessionID = 0; static fd_set fds; static int nfd = 0; /* maximum file descriptor used */ static struct VirtualMachine *vm= 0; #define isValid(f) (f != NULL && f->sessionID == sessionID) #define validate(f) if (!isValid(f)) return vm->primitiveFail() /* This is called when the file descriptor is ready to read. * It signals the semaphore. */ static void dataReadyCallback(int fd, void *clientData, int flag) { int semaIndex = (int)clientData; /* I know... */ if (semaIndex > 0) signalSemaphoreWithIndex(semaIndex); dprintf((stderr, "dataReady on %d sem %d mask %d\n", fd, semaIndex, flag)); dprintf((stderr, "Poll returns %d\n", SP_poll(fd))); /* aioHandle will be called again at the next receive. */ } /* Close the file handle, and stop aio */ static void closeMbox(SpreadConnection * s) { aioDisable(s->mbox); FD_CLR(s->mbox, &fds); s->sessionID = 0; s->semaIndex = 0; } /* Module initialization */ int sqSpreadInit(void) { vm= sqGetInterpreterProxy(); sessionID= clock() + time(0); FD_ZERO(&fds); nfd= 0; return 1; } /* Module de-initialization */ int sqSpreadShutdown(void) { /* protect against calling stale aio handlers */ int i; for (i= 0; i < nfd; ++i) if (FD_ISSET(i, &fds)) aioDisable(i); nfd= 0; FD_ZERO(&fds); sessionID= 0; return 1; } /* returns error code */ int sqSpreadConnect( SpreadConnection *s, /*OUT*/ const char *daemonName, int daemonNameSize, const char *privateName, int privateNameSize, int wantsGroupMsgs, char *groupBuf, /*OUT*/ int semaIndex) { int retval; int mbox; char *privateNameCopy, *daemonNameCopy; if (s == NULL) return ILLEGAL_SESSION; privateNameCopy = strndup(privateName, privateNameSize); daemonNameCopy = strndup(daemonName, daemonNameSize); retval = SP_connect(daemonNameCopy, privateNameCopy, 0, wantsGroupMsgs, &mbox, groupBuf); dprintf((stderr, "sqSpreadConnect(%1$p, %2$d %3$.*2$s, %4$d %5$.*4$s, %6$d, %7$p)\n", (void*)s, daemonNameSize, daemonName, privateNameSize, privateName, wantsGroupMsgs, groupBuf)); dprintf((stderr, "retval=%d mbox=%d sem=%d\n", retval, mbox, semaIndex)); free(privateNameCopy); free(daemonNameCopy); if (retval == ACCEPT_SESSION) { s->semaIndex = semaIndex; s->mbox = mbox; s->sessionID = sessionID; FD_SET(mbox, &fds); nfd= max(nfd, mbox + 1); aioEnable(mbox, (void*)semaIndex, AIO_EXT); aioHandle(mbox, &dataReadyCallback, AIO_R); } return retval; } /* returns error code */ int sqSpreadDisconnect(SpreadConnection * s) { validate(s); closeMbox(s); return SP_disconnect(s->mbox); } /* returns msg length (0..n) or error code (<0) */ int sqSpreadReceive( SpreadConnection const * s, int *serviceType, /*OUT*/ char *sender, /*OUT*/ int maxGroups, int *numberOfGroups, /*OUT*/ char *groups, /*OUT*//* numberOfGroups*MAX_GROUP_NAME long */ int16 *messageType, /*OUT*/ int *endianMismatch, /*OUT*/ int messageLength, char *message, /*OUT*/ int drop) { int retval; validate(s); *serviceType = drop ? DROP_RECV : 0; retval = SP_receive( s->mbox, serviceType, sender, maxGroups, numberOfGroups, (groups_name*)groups, messageType, endianMismatch, messageLength, message); dprintf((stderr, "recv rval %d mbox %d stype %d sender %s maxG %d numG %d" " groups %s mtype %d endian %d mesLen %d mess %.*s\n", retval, s->mbox, *serviceType, sender, maxGroups, *numberOfGroups, (groups_name*)groups, *messageType, *endianMismatch, messageLength, messageLength, message)); if (retval == CONNECTION_CLOSED) closeMbox(s); else /* make sure we get the next callback */ aioHandle(s->mbox, &dataReadyCallback, AIO_R); return retval; } /* Print out the given Spread error. */ int sqSpreadError(int n) { SP_error(n); return 0; } int sqSpreadMultigroupMulticast( SpreadConnection const *s, int service_type, int num_groups, char const *groups, int mess_type, int mess_len, const char* mess) { int retval; validate(s); retval = SP_multigroup_multicast( s->mbox, service_type, num_groups, (cgroups_name*)groups, (int16)(mess_type & 0xffff), mess_len, mess); if (retval == CONNECTION_CLOSED) closeMbox(s); return retval; } /* return error (<0), nothing (0), or bytes available (>0) */ int sqSpreadPoll(SpreadConnection const *s) { validate(s); return SP_poll(s->mbox); } /* return 0 on success, or error (<0) */ int sqSpreadJoin(SpreadConnection const *s, char const* group, int groupLength) { char *groupString; int retval; validate(s); groupString = strndup(group, groupLength); retval = SP_join(s->mbox, groupString); free(groupString); if (retval == CONNECTION_CLOSED) closeMbox(s); return retval; } /* return 0 on success, or error (<0) */ int sqSpreadLeave(SpreadConnection const *s, char const* group, int groupLength) { char *groupString; int retval; validate(s); groupString = strndup(group, groupLength); retval = SP_leave(s->mbox, groupString); free(groupString); if (retval == CONNECTION_CLOSED) closeMbox(s); return retval; } /* Query for Squeak */ int sqSpreadIsValid(SpreadConnection const *s) { return isValid(s); } /* vim: set ts=4 sw=4 */ |
|
From: Ned K. <ne...@us...> - 2004-03-30 22:38:21
|
Update of /cvsroot/squeak/squeak/platforms/unix/plugins/PseudoTTYPlugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11319/platforms/unix/plugins/PseudoTTYPlugin Modified Files: Tag: ned-branch PseudoTTYPlugin.st Log Message: Automake 1.7 compatibility changes. Added plugins: - BerkeleyDbPlugin (Stephen Pair) - FT2Plugin (Arjen van Elteren, mods by Ned Konz) - SpreadPlugin (Ned Konz) Added diagnostics and aioDisable for invalid sockets in sqUnixSocket.c Index: PseudoTTYPlugin.st =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/plugins/PseudoTTYPlugin/PseudoTTYPlugin.st,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** PseudoTTYPlugin.st 7 Aug 2003 02:44:55 -0000 1.3 --- PseudoTTYPlugin.st 30 Mar 2004 22:26:38 -0000 1.3.2.1 *************** *** 1 **** ! 'From Squeak3.2gamma of 15 January 2002 [latest update: #4881] on 11 July 2002 at 12:42:23 am'! TestInterpreterPlugin subclass: #PseudoTTYPlugin instanceVariableNames: 'sCOAFfn ' classVariableNames: '' poolDictionaries: '' category: 'VMConstruction-Plugins'! !PseudoTTYPlugin commentStamp: '<historical>' prior: 0! Author: Ian Piumarta <ian...@in...> Date: 2002-07-06 Version: 1.0 This plugin extends AsynchFilePlugin with support for Unix98-style pseudo ttys. Pseudo ttys (ptys) are a means for some program A (e.g., Squeak) to spawn a child process B and have B's std{in,out,err} connected to something that smells (to B) like a terminal (the `slave' tty) but which is in fact connected directly to A via another device (the `master' tty). One example of this would be Squeak spawning an interactive shell. If we were to use pipes (or sockets) to communicate with the shell's std{in,out,err} then various screen-oriented programs (such as Emacs) would refuse to run, the shell itself would refuse to implement job control and `cooked' characters (intr, quit, suspend, etc.) would be ignored -- all because pipes (and sockets) are absolutely not the same thing as a tty. Connecting the shell to a slave tty (and talking to it indirectly through our master tty) allows such programs (and shells and interrupts, etc.) to work properly, since they believe themselves to be connected to a `real' terminal. To use this plugin on any system that supports Unix98 pseudo ttys you would do something like this: - open an AsyncFile on /dev/ptmx (the Pseudo Tty master MultipleXor) which returns a handle on the master tty (and creates the slave tty device -- usually something like /dev/ttyN or /dev/pts/N); - prepare the slave tty for use by an inferior process by calling primGrantPt and primUnlockPt on the master; - call primPtsName on the master to obtain the name of the allocated slave tty device; - open the slave tty for read (stdin), write (stdout) and again for write (stderr); - fork; - connect the inferior process's std{in,out,err} to the slave tty device through the three descriptors just opened; - exec the shell (or whatever) in the inferior process. After all that the parent process can write (via the original AsyncFile) to the master tty (to provide data for the inferior process's stdin) and read (via the AsyncFile) from the master (to retrieve data written to std{out,err} by the inferior process). If the inferior process tests std{in,out,err} with isatty() it will be told that it is connected to a login terminal. This plugin provides four primitives, as implied by the above, all of which apply to AsyncFiles: primitivePtGrant - prepare the slave tty for use primitivePtUnlock - allow connections (open) to the slave tty primitivePtsNameLength - return the size of the slave tty's device name primitivePtsName - read the slave tty's device name into a String (designed to be easily useable in conjunction with OSProcess) and one more (just for my convenience) which does all of the above steps atomically (and also promotes the inferior process to a process group leader, and installs a handler to finalise the inferior process on exit and close its parent's master tty -- without the need to use OSProcess at all): primitiveForkAndExecWithPts - create an inferior process connected to a slave tty Note that `Unix98' does NOT imply that this will only work on Unix systems!! Unix98 is the name of a *standard* (describing one possible implementation of pseudo ttys) which can be adopted by any OS, be it Unix or something entirely different. (Unix98 ptys have been adopted by both BSD and Linux, which is why we consider it the most interesting standard to implement here. However, be warned that if [for some bizarre, masochistic reason] you have disabled Unix98 pty support in your BSD or Linux kernel then this plugin will explode in your face. [Although you should never get that far since the initial open of /dev/ptmx will fail.]) Finally note that this plugin might (should) go away in the future if (when) OSProcess implements the required support for pseudo ttys and asynchronous i/o on their master devices. Dave: are you reading this?! !PseudoTTYPlugin methodsFor: 'initialize-release' stamp: 'ikp 7/10/2002 22:41'! initialiseModule self export: true. "We have to load AsyncFile first, to get the sessionID." interpreterProxy ioLoadFunction: 'initializeModule' From: 'AsynchFilePlugin'. ^self cCode: 'ptyInit()' inSmalltalk: [true]! ! !PseudoTTYPlugin methodsFor: 'initialize-release' stamp: 'ikp 7/7/2002 02:29'! shutdownModule self export: true. ^self cCode: 'ptyShutdown()' inSmalltalk: [true]! ! !PseudoTTYPlugin methodsFor: 'primitives' stamp: 'ikp 7/7/2002 05:44'! primitivePtyClose: fHandle | f | self var: #f declareC: 'AsyncFile *f'. self primitive: 'primPtyClose' parameters: #(Oop). f _ self asyncFileValueOf: fHandle. interpreterProxy failed ifFalse: [self cCode: 'ptyClose(f)'].! ! !PseudoTTYPlugin methodsFor: 'primitives' stamp: 'ikp 7/10/2002 22:31'! primitivePtyForkAndExec: cmd arguments: args semaIndex: semaIndex | f cmdLen cmdIdx argLen argIdx fOop | self var: #f declareC: 'AsyncFile *f'. self primitive: 'primPtyForkAndExec' parameters: #(Oop Oop SmallInteger). interpreterProxy success: (interpreterProxy isBytes: cmd). interpreterProxy success: (interpreterProxy isPointers: args). interpreterProxy failed ifTrue: [^nil]. cmdIdx _ self cCoerce: (interpreterProxy firstIndexableField: cmd) to: 'int'. cmdLen _ interpreterProxy slotSizeOf: cmd. "in bytes" argIdx _ self cCoerce: (interpreterProxy firstIndexableField: args) to: 'int'. argLen _ interpreterProxy slotSizeOf: args. "in fields" fOop _ interpreterProxy instantiateClass: interpreterProxy classByteArray indexableSize: (self cCode: 'sizeof(AsyncFile)'). f _ self asyncFileValueOf: fOop. interpreterProxy failed ifFalse: [self cCode: 'ptyForkAndExec(f, semaIndex, cmdIdx, cmdLen, argIdx, argLen)']. ^fOop! ! !PseudoTTYPlugin methodsFor: 'primitives' stamp: 'ikp 7/7/2002 06:38'! primitivePtyWindowSize: fHandle cols: cols rows: rows | f | self var: #f declareC: 'AsyncFile *f'. self primitive: 'primPtyWindowSize' parameters: #(Oop SmallInteger SmallInteger). f _ self asyncFileValueOf: fHandle. interpreterProxy failed ifFalse: [self cCode: 'ptyWindowSize(f, cols, rows)'].! ! !PseudoTTYPlugin methodsFor: 'private' stamp: 'ikp 7/6/2002 19:08'! asyncFileValueOf: oop "Return a pointer to the first byte of the async file record within the given Smalltalk bytes object, or nil if oop is not an async file record." self returnTypeC: 'AsyncFile *'. interpreterProxy success: ((interpreterProxy isIntegerObject: oop) not and: [(interpreterProxy isBytes: oop) and: [(interpreterProxy slotSizeOf: oop) = (self cCode: 'sizeof(AsyncFile)')]]). interpreterProxy failed ifTrue: [^ nil]. ^ self cCode: '(AsyncFile *) (oop + 4)' ! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! PseudoTTYPlugin class instanceVariableNames: ''! !PseudoTTYPlugin class methodsFor: 'translation' stamp: 'ikp 7/6/2002 21:18'! hasHeaderFile ^true! ! !PseudoTTYPlugin class methodsFor: 'translation' stamp: 'ikp 7/6/2002 21:12'! requiresPlatformFiles ^true! ! \ No newline at end of file --- 1 ---- ! 'From Squeak3.2gamma of 15 January 2002 [latest update: #4881] on 11 July 2002 at 12:42:23 am'! TestInterpreterPlugin subclass: #PseudoTTYPlugin instanceVariableNames: 'sCOAFfn ' classVariableNames: '' poolDictionaries: '' category: 'VMConstruction-Plugins'! !PseudoTTYPlugin commentStamp: '<historical>' prior: 0! Author: Ian Piumarta <ian...@in...> Date: 2002-07-06 Version: 1.0 This plugin extends AsynchFilePlugin with support for Unix98-style pseudo ttys. Pseudo ttys (ptys) are a means for some program A (e.g., Squeak) to spawn a child process B and have B's std{in,out,err} connected to something that smells (to B) like a terminal (the `slave' tty) but which is in fact connected directly to A via another device (the `master' tty). One example of this would be Squeak spawning an interactive shell. If we were to use pipes (or sockets) to communicate with the shell's std{in,out,err} then various screen-oriented programs (such as Emacs) would refuse to run, the shell itself would refuse to implement job control and `cooked' characters (intr, quit, suspend, etc.) would be ignored -- all because pipes (and sockets) are absolutely not the same thing as a tty. Connecting the shell to a slave tty (and talking to it indirectly through our master tty) allows such programs (and shells and interrupts, etc.) to work properly, since they believe themselves to be connected to a `real' terminal. To use this plugin on any system that supports Unix98 pseudo ttys you would do something like this: - open an AsyncFile on /dev/ptmx (the Pseudo Tty master MultipleXor) which returns a handle on the master tty (and creates the slave tty device -- usually something like /dev/ttyN or /dev/pts/N); - prepare the slave tty for use by an inferior process by calling primGrantPt and primUnlockPt on the master; - call primPtsName on the master to obtain the name of the allocated slave tty device; - open the slave tty for read (stdin), write (stdout) and again for write (stderr); - fork; - connect the inferior process's std{in,out,err} to the slave tty device through the three descriptors just opened; - exec the shell (or whatever) in the inferior process. After all that the parent process can write (via the original AsyncFile) to the master tty (to provide data for the inferior process's stdin) and read (via the AsyncFile) from the master (to retrieve data written to std{out,err} by the inferior process). If the inferior process tests std{in,out,err} with isatty() it will be told that it is connected to a login terminal. This plugin provides four primitives, as implied by the above, all of which apply to AsyncFiles: primitivePtGrant - prepare the slave tty for use primitivePtUnlock - allow connections (open) to the slave tty primitivePtsNameLength - return the size of the slave tty's device name primitivePtsName - read the slave tty's device name into a String (designed to be easily useable in conjunction with OSProcess) and one more (just for my convenience) which does all of the above steps atomically (and also promotes the inferior process to a process group leader, and installs a handler to finalise the inferior process on exit and close its parent's master tty -- without the need to use OSProcess at all): primitiveForkAndExecWithPts - create an inferior process connected to a slave tty Note that `Unix98' does NOT imply that this will only work on Unix systems!! Unix98 is the name of a *standard* (describing one possible implementation of pseudo ttys) which can be adopted by any OS, be it Unix or something entirely different. (Unix98 ptys have been adopted by both BSD and Linux, which is why we consider it the most interesting standard to implement here. However, be warned that if [for some bizarre, masochistic reason] you have disabled Unix98 pty support in your BSD or Linux kernel then this plugin will explode in your face. [Although you should never get that far since the initial open of /dev/ptmx will fail.]) Finally note that this plugin might (should) go away in the future if (when) OSProcess implements the required support for pseudo ttys and asynchronous i/o on their master devices. Dave: are you reading this?! !PseudoTTYPlugin methodsFor: 'initialize-release' stamp: 'ikp 7/10/2002 22:41'! initialiseModule self export: true. "We have to load AsyncFile first, to get the sessionID." interpreterProxy ioLoadFunction: 'initialiseModule' From: 'AsynchFilePlugin'. ^self cCode: 'ptyInit()' inSmalltalk: [true]! ! !PseudoTTYPlugin methodsFor: 'initialize-release' stamp: 'ikp 7/7/2002 02:29'! shutdownModule self export: true. ^self cCode: 'ptyShutdown()' inSmalltalk: [true]! ! !PseudoTTYPlugin methodsFor: 'primitives' stamp: 'ikp 7/7/2002 05:44'! primitivePtyClose: fHandle | f | self var: #f declareC: 'AsyncFile *f'. self primitive: 'primPtyClose' parameters: #(Oop). f _ self asyncFileValueOf: fHandle. interpreterProxy failed ifFalse: [self cCode: 'ptyClose(f)'].! ! !PseudoTTYPlugin methodsFor: 'primitives' stamp: 'ikp 7/10/2002 22:31'! primitivePtyForkAndExec: cmd arguments: args semaIndex: semaIndex | f cmdLen cmdIdx argLen argIdx fOop | self var: #f declareC: 'AsyncFile *f'. self primitive: 'primPtyForkAndExec' parameters: #(Oop Oop SmallInteger). interpreterProxy success: (interpreterProxy isBytes: cmd). interpreterProxy success: (interpreterProxy isPointers: args). interpreterProxy failed ifTrue: [^nil]. cmdIdx _ self cCoerce: (interpreterProxy firstIndexableField: cmd) to: 'int'. cmdLen _ interpreterProxy slotSizeOf: cmd. "in bytes" argIdx _ self cCoerce: (interpreterProxy firstIndexableField: args) to: 'int'. argLen _ interpreterProxy slotSizeOf: args. "in fields" fOop _ interpreterProxy instantiateClass: interpreterProxy classByteArray indexableSize: (self cCode: 'sizeof(AsyncFile)'). f _ self asyncFileValueOf: fOop. interpreterProxy failed ifFalse: [self cCode: 'ptyForkAndExec(f, semaIndex, cmdIdx, cmdLen, argIdx, argLen)']. ^fOop! ! !PseudoTTYPlugin methodsFor: 'primitives' stamp: 'ikp 7/7/2002 06:38'! primitivePtyWindowSize: fHandle cols: cols rows: rows | f | self var: #f declareC: 'AsyncFile *f'. self primitive: 'primPtyWindowSize' parameters: #(Oop SmallInteger SmallInteger). f _ self asyncFileValueOf: fHandle. interpreterProxy failed ifFalse: [self cCode: 'ptyWindowSize(f, cols, rows)'].! ! !PseudoTTYPlugin methodsFor: 'private' stamp: 'ikp 7/6/2002 19:08'! asyncFileValueOf: oop "Return a pointer to the first byte of the async file record within the given Smalltalk bytes object, or nil if oop is not an async file record." self returnTypeC: 'AsyncFile *'. interpreterProxy success: ((interpreterProxy isIntegerObject: oop) not and: [(interpreterProxy isBytes: oop) and: [(interpreterProxy slotSizeOf: oop) = (self cCode: 'sizeof(AsyncFile)')]]). interpreterProxy failed ifTrue: [^ nil]. ^ self cCode: '(AsyncFile *) (oop + 4)' ! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! PseudoTTYPlugin class instanceVariableNames: ''! !PseudoTTYPlugin class methodsFor: 'translation' stamp: 'ikp 7/6/2002 21:18'! hasHeaderFile ^true! ! !PseudoTTYPlugin class methodsFor: 'translation' stamp: 'ikp 7/6/2002 21:12'! requiresPlatformFiles ^true! ! \ No newline at end of file |
|
From: Ned K. <ne...@us...> - 2004-03-30 22:38:20
|
Update of /cvsroot/squeak/squeak/platforms/unix/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11319/platforms/unix/config Modified Files: Tag: ned-branch Makefile acinclude.m4 configure.ac Log Message: Automake 1.7 compatibility changes. Added plugins: - BerkeleyDbPlugin (Stephen Pair) - FT2Plugin (Arjen van Elteren, mods by Ned Konz) - SpreadPlugin (Ned Konz) Added diagnostics and aioDisable for invalid sockets in sqUnixSocket.c Index: Makefile =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/config/Makefile,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** Makefile 7 Aug 2003 02:44:52 -0000 1.3 --- Makefile 30 Mar 2004 22:26:38 -0000 1.3.2.1 *************** *** 1,5 **** configure : .force ./mkacinc > acplugins.m4 ! aclocal autoconf rm acplugins.m4 --- 1,5 ---- configure : .force ./mkacinc > acplugins.m4 ! aclocal-1.7 autoconf rm acplugins.m4 Index: acinclude.m4 =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/config/acinclude.m4,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** acinclude.m4 1 Sep 2003 08:31:47 -0000 1.7 --- acinclude.m4 30 Mar 2004 22:26:38 -0000 1.7.2.1 *************** *** 38,42 **** # Last edited: 2003-08-08 15:34:41 by piumarta on emilia.inria.fr ! AC_DEFUN(AC_CHECK_VMM_DIR,[ AC_MSG_CHECKING([sanity of VMMaker src directory]) vmmcheck () { --- 38,42 ---- # Last edited: 2003-08-08 15:34:41 by piumarta on emilia.inria.fr ! AC_DEFUN([AC_CHECK_VMM_DIR],[ AC_MSG_CHECKING([sanity of VMMaker src directory]) vmmcheck () { *************** *** 58,62 **** ! AC_DEFUN(AC_VM_VERSION,[ VM_MAJOR=$1 VM_MINOR=$2 --- 58,62 ---- ! AC_DEFUN([AC_VM_VERSION],[ VM_MAJOR=$1 VM_MINOR=$2 *************** *** 69,73 **** ! AC_DEFUN(AC_CHECK_VERSION,[ gendir="${vmmdir}/vm" version=`${cfgdir}/version ${gendir}/interp.c` --- 69,73 ---- ! AC_DEFUN([AC_CHECK_VERSION],[ gendir="${vmmdir}/vm" version=`${cfgdir}/version ${gendir}/interp.c` *************** *** 80,84 **** AC_SUBST(LD) ! AC_DEFUN(AC_REQUIRE_SIZEOF,[ AC_MSG_CHECKING("size of $1") AC_TRY_RUN([#include <sys/types.h> --- 80,84 ---- AC_SUBST(LD) ! AC_DEFUN([AC_REQUIRE_SIZEOF],[ AC_MSG_CHECKING("size of $1") AC_TRY_RUN([#include <sys/types.h> *************** *** 91,95 **** # NOTE: `long long' is 64 bits in ANSI C99 [ISO/IEC 9899:1999 (E)]. ! AC_DEFUN(AC_CHECK_INT64_T,[ AC_CACHE_CHECK([for 64-bit integer type],ac_cv_int64_t, AC_TRY_RUN([int main(){return(sizeof(long) == 8)?0:1;}], --- 91,95 ---- # NOTE: `long long' is 64 bits in ANSI C99 [ISO/IEC 9899:1999 (E)]. ! AC_DEFUN([AC_CHECK_INT64_T],[ AC_CACHE_CHECK([for 64-bit integer type],ac_cv_int64_t, AC_TRY_RUN([int main(){return(sizeof(long) == 8)?0:1;}], *************** *** 105,109 **** ! AC_DEFUN(AC_NEED_SUNOS_H, [case "$host" in *-sunos*) AC_DEFINE(NEED_SUNOS_H, 1) --- 105,109 ---- ! AC_DEFUN([AC_NEED_SUNOS_H], [case "$host" in *-sunos*) AC_DEFINE(NEED_SUNOS_H, 1) *************** *** 111,120 **** ! AC_DEFUN(AC_PROG_CC_WALL, [AC_PROG_CC test "$GCC" = yes && WFLAGS="-Wall -Wno-unknown-pragmas" AC_SUBST(WFLAGS)]) ! AC_DEFUN(AC_GNU_OPT, [AC_MSG_CHECKING([for $host_cpu optimization flags]) ac_optflags="no" --- 111,120 ---- ! AC_DEFUN([AC_PROG_CC_WALL], [AC_PROG_CC test "$GCC" = yes && WFLAGS="-Wall -Wno-unknown-pragmas" AC_SUBST(WFLAGS)]) ! AC_DEFUN([AC_GNU_OPT], [AC_MSG_CHECKING([for $host_cpu optimization flags]) ac_optflags="no" *************** *** 136,140 **** fi]) ! AC_DEFUN(AC_GNU_INTERP, [INTERP="interp" AC_SUBST(INTERP) --- 136,140 ---- fi]) ! AC_DEFUN([AC_GNU_INTERP], [INTERP="interp" AC_SUBST(INTERP) *************** *** 164,168 **** fi]) ! AC_DEFUN(AC_PROG_AS_GNU, [AC_CHECK_PROG(AS,as,as) AC_MSG_CHECKING(for GNU as) --- 164,168 ---- fi]) ! AC_DEFUN([AC_PROG_AS_GNU], [AC_CHECK_PROG(AS,as,as) AC_MSG_CHECKING(for GNU as) *************** *** 176,180 **** AC_MSG_RESULT($GAS)]) ! AC_DEFUN(AC_CHECK_ATEXIT, [AC_CACHE_CHECK([for atexit or on_exit], ac_cv_atexit, AC_TRY_COMPILE([#include <stdlib.h>],[atexit(0);], ac_cv_atexit="atexit", --- 176,180 ---- AC_MSG_RESULT($GAS)]) ! AC_DEFUN([AC_CHECK_ATEXIT], [AC_CACHE_CHECK([for atexit or on_exit], ac_cv_atexit, AC_TRY_COMPILE([#include <stdlib.h>],[atexit(0);], ac_cv_atexit="atexit", *************** *** 185,189 **** fi]) ! AC_DEFUN(AC_CHECK_SOCKLEN_T, [AC_CACHE_CHECK([for socklen_t in sys/socket.h], ac_cv_socklen_t, AC_TRY_COMPILE([#include <sys/socket.h>],[sizeof(socklen_t);], --- 185,189 ---- fi]) ! AC_DEFUN([AC_CHECK_SOCKLEN_T], [AC_CACHE_CHECK([for socklen_t in sys/socket.h], ac_cv_socklen_t, AC_TRY_COMPILE([#include <sys/socket.h>],[sizeof(socklen_t);], *************** *** 191,195 **** test "$ac_cv_socklen_t" != "yes" && AC_DEFINE(socklen_t, int)]) ! AC_DEFUN(AC_CHECK_TZSET, [AC_CACHE_CHECK([for tzset], ac_cv_tzset, AC_TRY_COMPILE([#include <time.h>],[tzet();], --- 191,195 ---- test "$ac_cv_socklen_t" != "yes" && AC_DEFINE(socklen_t, int)]) ! AC_DEFUN([AC_CHECK_TZSET], [AC_CACHE_CHECK([for tzset], ac_cv_tzset, AC_TRY_COMPILE([#include <time.h>],[tzet();], *************** *** 197,201 **** test "$ac_cv_tzset" != "no" && AC_DEFINE(HAVE_TZSET)]) ! AC_DEFUN(AC_CHECK_GMTOFF, [AC_CACHE_CHECK([for gmtoff in struct tm], ac_cv_tm_gmtoff, AC_TRY_COMPILE([#include <time.h>],[struct tm tm; tm.tm_gmtoff;], --- 197,201 ---- test "$ac_cv_tzset" != "no" && AC_DEFINE(HAVE_TZSET)]) ! AC_DEFUN([AC_CHECK_GMTOFF], [AC_CACHE_CHECK([for gmtoff in struct tm], ac_cv_tm_gmtoff, AC_TRY_COMPILE([#include <time.h>],[struct tm tm; tm.tm_gmtoff;], *************** *** 203,207 **** test "$ac_cv_tm_gmtoff" != "no" && AC_DEFINE(HAVE_TM_GMTOFF)]) ! AC_DEFUN(AC_CHECK_TIMEZONE, [AC_CACHE_CHECK([for timezone and daylight variables], ac_cv_timezone, AC_TRY_COMPILE([extern long timezone; extern int daylight;],[timezone;daylight;], --- 203,207 ---- test "$ac_cv_tm_gmtoff" != "no" && AC_DEFINE(HAVE_TM_GMTOFF)]) ! AC_DEFUN([AC_CHECK_TIMEZONE], [AC_CACHE_CHECK([for timezone and daylight variables], ac_cv_timezone, AC_TRY_COMPILE([extern long timezone; extern int daylight;],[timezone;daylight;], *************** *** 209,213 **** test "$ac_cv_timezone" != "no" && AC_DEFINE(HAVE_TIMEZONE)]) ! AC_DEFUN(AC_CHECK_GETHOSTNAME, [AC_CACHE_CHECK([for gethostname in unistd.h], ac_cv_gethostname_p, AC_TRY_COMPILE([#include <unistd.h>],[return (int)gethostname;], --- 209,213 ---- test "$ac_cv_timezone" != "no" && AC_DEFINE(HAVE_TIMEZONE)]) ! AC_DEFUN([AC_CHECK_GETHOSTNAME], [AC_CACHE_CHECK([for gethostname in unistd.h], ac_cv_gethostname_p, AC_TRY_COMPILE([#include <unistd.h>],[return (int)gethostname;], *************** *** 227,231 **** ! AC_DEFUN(AC_C_BYTEORDER, [AC_C_BIGENDIAN if test $ac_cv_c_bigendian != yes --- 227,231 ---- ! AC_DEFUN([AC_C_BYTEORDER], [AC_C_BIGENDIAN if test $ac_cv_c_bigendian != yes *************** *** 234,238 **** ! AC_DEFUN(AC_C_DOUBLE_ALIGNMENT, [AC_CACHE_CHECK([whether unaligned access to doubles is ok], ac_cv_double_align, AC_TRY_RUN([f(int i){*(double *)i=*(double *)(i+4);} --- 234,238 ---- ! AC_DEFUN([AC_C_DOUBLE_ALIGNMENT], [AC_CACHE_CHECK([whether unaligned access to doubles is ok], ac_cv_double_align, AC_TRY_RUN([f(int i){*(double *)i=*(double *)(i+4);} *************** *** 241,245 **** test "$ac_cv_double_align" = "no" && AC_DEFINE(DOUBLE_WORD_ALIGNMENT)]) ! AC_DEFUN(AC_C_DOUBLE_ORDER, [AC_CACHE_CHECK([whether doubles are stored in Squeak order], ac_cv_double_order, AC_TRY_RUN([union { double d; int i[[2]]; } d; --- 241,245 ---- test "$ac_cv_double_align" = "no" && AC_DEFINE(DOUBLE_WORD_ALIGNMENT)]) ! AC_DEFUN([AC_C_DOUBLE_ORDER], [AC_CACHE_CHECK([whether doubles are stored in Squeak order], ac_cv_double_order, AC_TRY_RUN([union { double d; int i[[2]]; } d; *************** *** 250,254 **** # this assumes that libtool has already been configured and built -- # if not then err on the side of conservatism. ! AC_DEFUN(AC_MODULE_LIB_PREFIX, [AC_CACHE_CHECK([for prefix to use for loadable modules], ac_cv_module_prefix, if test -x ./libtool && --- 250,254 ---- # this assumes that libtool has already been configured and built -- # if not then err on the side of conservatism. ! AC_DEFUN([AC_MODULE_LIB_PREFIX], [AC_CACHE_CHECK([for prefix to use for loadable modules], ac_cv_module_prefix, if test -x ./libtool && *************** *** 260,264 **** test "$ac_cv_module_prefix" = lib && mkfrags_lib_prefix=lib]) ! AC_DEFUN(AC_64BIT_ARCH, [AC_MSG_CHECKING(for compiler flags to force 32-bit addresses) case $host in --- 260,264 ---- test "$ac_cv_module_prefix" = lib && mkfrags_lib_prefix=lib]) ! AC_DEFUN([AC_64BIT_ARCH], [AC_MSG_CHECKING(for compiler flags to force 32-bit addresses) case $host in *************** *** 276,295 **** # AC_PLUGIN_SUBST(varname,value) ! AC_DEFUN(AC_PLUGIN_DISABLE_PLUGIN,[ AC_MSG_RESULT([******** disabling $1]) disabled_plugins="${disabled_plugins} $1"]) ! AC_DEFUN(AC_PLUGIN_DISABLE,[ AC_PLUGIN_DISABLE_PLUGIN(${plugin})]) ! AC_DEFUN(AC_PLUGIN_USE_LIB,[ plibs="${plibs} $1"]) ! AC_DEFUN(AC_PLUGIN_DEFINE_UNQUOTED,[ echo 's%[\['$1'\]]%'$2'%g' >> ${plugin}.sub]) # AC_PLUGIN_SEARCH_LIBS(function,libs...) ! AC_DEFUN(AC_PLUGIN_SEARCH_LIBS,[ AC_SEARCH_LIBS($1,$2,, AC_MSG_RESULT([******** disabling ${plugin} due to missing libraries]) --- 276,295 ---- # AC_PLUGIN_SUBST(varname,value) ! AC_DEFUN([AC_PLUGIN_DISABLE_PLUGIN],[ AC_MSG_RESULT([******** disabling $1]) disabled_plugins="${disabled_plugins} $1"]) ! AC_DEFUN([AC_PLUGIN_DISABLE],[ AC_PLUGIN_DISABLE_PLUGIN(${plugin})]) ! AC_DEFUN([AC_PLUGIN_USE_LIB],[ plibs="${plibs} $1"]) ! AC_DEFUN([AC_PLUGIN_DEFINE_UNQUOTED],[ echo 's%[\['$1'\]]%'$2'%g' >> ${plugin}.sub]) # AC_PLUGIN_SEARCH_LIBS(function,libs...) ! AC_DEFUN([AC_PLUGIN_SEARCH_LIBS],[ AC_SEARCH_LIBS($1,$2,, AC_MSG_RESULT([******** disabling ${plugin} due to missing libraries]) *************** *** 298,302 **** # AC_PLUGIN_CHECK_LIB(lib,func,ok,bad) ! AC_DEFUN(AC_PLUGIN_CHECK_LIB,[ AC_CHECK_LIB($1,$2, plibs="${plibs} $1", --- 298,302 ---- # AC_PLUGIN_CHECK_LIB(lib,func,ok,bad) ! AC_DEFUN([AC_PLUGIN_CHECK_LIB],[ AC_CHECK_LIB($1,$2, plibs="${plibs} $1", Index: configure.ac =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/config/configure.ac,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -C2 -d -r1.14.2.1 -r1.14.2.2 *** configure.ac 21 Nov 2003 02:40:17 -0000 1.14.2.1 --- configure.ac 30 Mar 2004 22:26:38 -0000 1.14.2.2 *************** *** 40,46 **** # Last edited: 2003-09-16 20:08:09 by piumarta on emilia.inria.fr ! AC_INIT([config.h.in]) ! AC_VM_VERSION(3,6g,2, 3,6g,5420) topdir=`cd ${srcdir}/../../..; pwd` --- 40,47 ---- # Last edited: 2003-09-16 20:08:09 by piumarta on emilia.inria.fr ! AC_INIT([config.h.in],1) ! AM_INIT_AUTOMAKE ! AC_VM_VERSION(3,7a,0, 3,7a,5816) topdir=`cd ${srcdir}/../../..; pwd` |
|
From: Ned K. <ne...@us...> - 2004-03-30 22:38:20
|
Update of /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11319/platforms/unix/plugins/SocketPlugin Modified Files: Tag: ned-branch sqUnixSocket.c Log Message: Automake 1.7 compatibility changes. Added plugins: - BerkeleyDbPlugin (Stephen Pair) - FT2Plugin (Arjen van Elteren, mods by Ned Konz) - SpreadPlugin (Ned Konz) Added diagnostics and aioDisable for invalid sockets in sqUnixSocket.c Index: sqUnixSocket.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -C2 -d -r1.12.2.1 -r1.12.2.2 *** sqUnixSocket.c 21 Nov 2003 02:40:18 -0000 1.12.2.1 --- sqUnixSocket.c 30 Mar 2004 22:26:38 -0000 1.12.2.2 *************** *** 368,371 **** --- 368,372 ---- pss->sockState= Invalid; perror("acceptHandler"); + aioDisable(fd); close(fd); fprintf(stderr, "acceptHandler: aborting server %d pss=%p\n", fd, pss); *************** *** 433,436 **** --- 434,443 ---- FPRINTF((stderr, "dataHandler(%d=%d, %p, %d)\n", fd, pss->s, data, flags)); + if (pss == NULL) + { + fprintf(stderr, "dataHandler: pss is NULL fd=%d data=%p flags=0x%x\n", fd, data, flags); + return; + } + if (flags & AIO_R) { *************** *** 438,442 **** if (n == 0) { ! fprintf(stderr, "dataHandler: selected socket would block (why?)\n"); } if (n != 1) --- 445,449 ---- if (n == 0) { ! fprintf(stderr, "dataHandler: selected socket fd=%d flags=0x%x would block (why?)\n", fd, flags); } if (n != 1) *************** *** 545,548 **** --- 552,561 ---- /* private socket structure */ pss= (privateSocketStruct *)calloc(1, sizeof(privateSocketStruct)); + if (pss == NULL) + { + fprintf(stderr, "acceptFrom: out of memory\n"); + interpreterProxy->success(false); + return; + } pss->s= newSocket; pss->connSema= semaIndex; *************** *** 745,749 **** if (PSP(serverSocket)->acceptedSock < 0) { ! printf("acceptFrom: no socket available\n"); interpreterProxy->success(false); return; --- 758,762 ---- if (PSP(serverSocket)->acceptedSock < 0) { ! fprintf(stderr, "acceptFrom: no socket available\n"); interpreterProxy->success(false); return; *************** *** 752,759 **** /* got connection -- fill in the structure */ s->sessionID= 0; ! pss= calloc(1, sizeof(*pss)); if (pss == NULL) { ! printf("acceptFrom: out of memory\n"); interpreterProxy->success(false); return; --- 765,772 ---- /* got connection -- fill in the structure */ s->sessionID= 0; ! pss= (privateSocketStruct *)calloc(1, sizeof(privateSocketStruct)); if (pss == NULL) { ! fprintf(stderr, "acceptFrom: out of memory\n"); interpreterProxy->success(false); return; |
|
From: Ned K. <ne...@us...> - 2004-03-30 22:38:20
|
Update of /cvsroot/squeak/squeak/platforms/Cross/plugins/BerkeleyDbPlugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11319/platforms/Cross/plugins/BerkeleyDbPlugin Added Files: Tag: ned-branch BerkeleyDbPlugin.h sqBerkeleyDatabase.c Log Message: Automake 1.7 compatibility changes. Added plugins: - BerkeleyDbPlugin (Stephen Pair) - FT2Plugin (Arjen van Elteren, mods by Ned Konz) - SpreadPlugin (Ned Konz) Added diagnostics and aioDisable for invalid sockets in sqUnixSocket.c --- NEW FILE: BerkeleyDbPlugin.h --- /* Header file for database plugin */ typedef struct { int sessionID; void *privateDbPtr; } Database, *DatabasePtr; typedef struct { int sessionID; void *privateDbcPtr; } DbCursor, *DbCursorPtr; int sqDbInit(void *(*sq_malloc)(size_t size) ); int sqDbShutdown(void); int sqDbIsValid(Database*); int sqDbOpen(Database*,char*,int,int,char**); int sqDbClose(Database*,char**); int sqDbCommit(Database*,char**); int sqDbVerify(Database*,char**); int sqDbSetFlags(Database *db, unsigned int flags, char **errmsg); int sqDbAt(Database*,void*,int,void**,int*,char**); int sqDbAtPut(Database*,void*,int,void*,int,char**); int sqDbRemoveKey(Database*,void*,int,char**); int sqDbSymbolValue(const char* namePtr, int nameSize, unsigned int *retval); int sqDbCursor(Database*,DbCursor*,char**); int sqDbCursorGet(DbCursor*,void**,int*,void**,int*,int,char**); int sqDbCursorNext(DbCursor*,void**,int*,void**,int*,char**); int sqDbCursorPut(DbCursor *dbc, void *key, int keySize, void *value, int valueSize, int flags, char **errmsg); int sqDbCursorDelete(DbCursor *dbc, char **errmsg); int sqDbCursorClose(DbCursor*,char**); --- NEW FILE: sqBerkeleyDatabase.c --- #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define __time_t #include "BerkeleyDbPlugin.h" // Note: this is the main Berkeley DB header, typically found in /usr/include // in Unix systems. #include "db.h" // Well known return codes // 100 indicates a malloc failure // 99 indicates invalid Database handle // 98 indicates invalid DbCursor handle #if DB_VERSION_MAJOR > 3 #define setmalloc(X) dbp->set_alloc(dbp,X,realloc,free) #else #define setmalloc(X) dbp->set_malloc(dbp,X) #endif #define MALLOC(X,TYPE,SIZE) \ X = TYPE malloc(SIZE); if(!X) return 100 #define DBCALL(X) do { \ returnCode = X; \ if(returnCode != 0) { \ *errmsg = db_strerror(returnCode); \ return -1; \ } \ } while(0) #define GETDBP(dbp,db) \ if(!((db != 0) && \ (thisDbSession != 0) && \ (db->privateDbPtr != 0) && \ (db->sessionID == thisDbSession))) \ return 99; \ dbp = (DB *) db->privateDbPtr #define GETDBCP(dbcp,dbc) \ if(!((dbc != 0) && \ (thisDbSession != 0) && \ (dbc->privateDbcPtr != 0) && \ (dbc->sessionID == thisDbSession))) \ return 98; \ dbcp = (DBC *) dbc->privateDbcPtr #define SYMDEF(sym) { #sym, sym } static int thisDbSession = 0; static void* (*sq_malloc)(size_t size); static int returnCode; typedef struct { const char *name; unsigned int value; } symdef; static symdef dbSymbols[]; //****** Plugin Initialization/Shutdown ****** int sqDbInit(void *(*squeak_malloc_function)(size_t size)) { int major, minor; char *version; if (0 != thisDbSession) return 1; /* Already initialized */ sq_malloc = squeak_malloc_function; thisDbSession = clock() + time(0); if (0 == thisDbSession) thisDbSession = 1; db_version(&major, &minor, NULL); // The following check ensures that the version of the db.h // header file that we were compiled against and the version // of the libdb that we are bound with are in agreement if((major != DB_VERSION_MAJOR) || (minor != DB_VERSION_MINOR)) { fprintf(stderr,"Error: BerkeleyDB version mismatch\n"); fprintf(stderr," Header file expected %d.%d but got %d.%d\n", DB_VERSION_MAJOR, DB_VERSION_MINOR, major, minor); return 0; } return 1; } int sqDbShutdown() { return 0; } //****** Database methods ****** int sqDbIsValid(Database *db) { return (db != 0) && (thisDbSession != 0) && (db->privateDbPtr != 0) && (db->sessionID == thisDbSession); } int sqDbOpen(Database *db, char *fileNamePtr, int fileNameSize, int createFlag, char **errmsg) { DB *dbp; char *fname; u_int32_t flags; // Create the DB pointer DBCALL(db_create(&dbp,NULL,0)); // Setup our Squeak database structure db->sessionID = thisDbSession; db->privateDbPtr = (void *) dbp; // Set the malloc function DBCALL(setmalloc(sq_malloc)); // Copy the file name out of the Squeak String MALLOC(fname, (char*), fileNameSize + 1); if(!fname) return 1; memset((void *) (fname + fileNameSize), 0, 1); memcpy((void *) fname, fileNamePtr, fileNameSize); // Set the flags for the call to db->open if(createFlag) { flags = DB_CREATE; } else { flags = 0; } // Make the call to db->open #if (DB_VERSION_MAJOR > 3) && (DB_VERSION_MINOR > 0) DBCALL(dbp->open(dbp,NULL,fname,NULL,DB_BTREE,flags,0664); free(fname)); #else DBCALL(dbp->open(dbp,fname,NULL,DB_BTREE,flags,0664); free(fname)); #endif return 0; } int sqDbClose(Database *db, char **errmsg) { DB *dbp; GETDBP(dbp,db); db->sessionID = 0; /* mark this db struct invalid */ db->privateDbPtr = NULL; DBCALL(dbp->close(dbp,0)); return 0; } int sqDbCommit(Database *db, char **errmsg) { DB *dbp; GETDBP(dbp,db); DBCALL(dbp->sync(dbp, 0)); return 0; } int sqDbVerify(Database *db, char **errmsg) { DB *dbp; GETDBP(dbp,db); DBCALL(dbp->verify(dbp,NULL,NULL,NULL,0)); return 0; } int sqDbSetFlags(Database *db, unsigned int flags, char **errmsg) { DB *dbp; GETDBP(dbp,db); DBCALL(dbp->set_flags(dbp,flags)); return 0; } int sqDbAt(Database *db, void *key, int keySize, void **value, int *valueSize, char **errmsg) { DBT k, v; DB *dbp; int ret; GETDBP(dbp,db); memset(&k, 0, sizeof(k)); memset(&v, 0, sizeof(v)); k.data = key; k.size = keySize; v.flags = DB_DBT_MALLOC; ret = dbp->get(dbp, NULL, &k, &v, 0); if(ret != 0) { *value = NULL; *valueSize = 0; } if(ret == DB_NOTFOUND) return 1; DBCALL(ret); *value = v.data; *valueSize = v.size; return 0; } int sqDbAtPut(Database *db, void *key, int keySize, void *value, int valueSize, char **errmsg) { DBT k, v; DB *dbp; int ret; GETDBP(dbp,db); memset(&k, 0, sizeof(k)); memset(&v, 0, sizeof(v)); k.data = key; k.size = keySize; v.data = value; v.size = valueSize; DBCALL(dbp->put(dbp, NULL, &k, &v, 0)); return 0; } int sqDbRemoveKey(Database *db, void *key, int keySize, char **errmsg) { DBT k; DB *dbp; int ret; GETDBP(dbp,db); memset(&k, 0, sizeof(k)); k.data = key; k.size = keySize; ret = dbp->del(dbp, NULL, &k, 0); if(ret == DB_NOTFOUND) return 1; DBCALL(ret); return 0; } //****** Database Cursor methods ****** int sqDbCursor(Database *db, DbCursor *dbc, char **errmsg) { DB *dbp; DBC *dbcp; GETDBP(dbp,db); DBCALL(dbp->cursor(dbp, NULL, &dbcp, 0)); dbc->sessionID = thisDbSession; dbc->privateDbcPtr = (void *) dbcp; return 0; } // This lets us access the DB in special ways (like getting the next dup) int sqDbCursorGet(DbCursor *dbc, void **key, int *keySize, void **value, int *valueSize, int flags, char **errmsg) { DBC *dbcp; DBT k, v; int ret; GETDBCP(dbcp,dbc); memset(&k, 0, sizeof(k)); memset(&v, 0, sizeof(v)); ret = dbcp->c_get(dbcp, &k, &v, flags); if (ret != 0) { *value = NULL; *valueSize = 0; } switch (ret) { case 0: *key = k.data; *keySize = k.size; *value = v.data; *valueSize = v.size; return 0; break; case DB_NOTFOUND: case DB_KEYEMPTY: return 1; break; default: DBCALL(ret); break; } return -1; /* NOTREACHED */ } int sqDbCursorNext(DbCursor *dbc, void **key, int *keySize, void **value, int *valueSize,char **errmsg) { DBC *dbcp; DBT k, v; int ret; GETDBCP(dbcp,dbc); memset(&k, 0, sizeof(k)); memset(&v, 0, sizeof(v)); ret = dbcp->c_get(dbcp, &k, &v, DB_NEXT); /* mark cursor as invalid because we've hit the end. */ if(ret == DB_NOTFOUND) { dbc->sessionID = 0; dbc->privateDbcPtr = NULL; *keySize = 0; return 1; } DBCALL(ret); *key = k.data; *keySize = k.size; *value = v.data; *valueSize = v.size; return 0; } int sqDbCursorPut(DbCursor *dbc, void *key, int keySize, void *value, int valueSize, int flags, char **errmsg) { DBC *dbcp; DBT k, v; int ret; GETDBCP(dbcp,dbc); memset(&k, 0, sizeof(k)); memset(&v, 0, sizeof(v)); k.data = key; k.size = keySize; v.data = value; v.size = valueSize; ret = dbcp->c_put(dbcp, &k, &v, flags); switch (ret) { case DB_NOTFOUND: // current key has been deleted break; case DB_KEYEXIST: // no duplicate keys; already exists. break; } DBCALL(ret); return 0; } // Delete the record at the cursor. // If followed by a sqDbCursorGet(...DB_CURRENT...) you will get a DB_KEYEMPTY int sqDbCursorDelete(DbCursor *dbc, char **errmsg) { DBC *dbcp; GETDBCP(dbcp,dbc); DBCALL(dbcp->c_del(dbcp, 0)); return 0; } int sqDbCursorClose(DbCursor *dbc, char **errmsg) { DBC *dbcp; GETDBCP(dbcp,dbc); DBCALL(dbcp->c_close(dbcp)); return 0; } /* This defines a number of symbols from the DB4 header. * TODO: There are probably too many here. */ static symdef dbSymbols[] = { // c_get() opcodes: pick one SYMDEF(DB_CURRENT), SYMDEF(DB_FIRST), SYMDEF(DB_GET_BOTH), SYMDEF(DB_GET_BOTHC), SYMDEF(DB_GET_BOTH_RANGE), SYMDEF(DB_GET_RECNO), SYMDEF(DB_JOIN_ITEM), SYMDEF(DB_LAST), SYMDEF(DB_NEXT), SYMDEF(DB_NEXT_DUP), SYMDEF(DB_NEXT_NODUP), SYMDEF(DB_PREV), SYMDEF(DB_PREV_NODUP), SYMDEF(DB_SET), SYMDEF(DB_SET_RANGE), SYMDEF(DB_SET_RECNO), SYMDEF(DB_UPDATE_SECONDARY), // c_put() opcodes: pick one. SYMDEF(DB_AFTER), SYMDEF(DB_BEFORE), SYMDEF(DB_KEYFIRST), SYMDEF(DB_KEYLAST), SYMDEF(DB_NODUPDATA), // op flags (or'd with c_get flags) SYMDEF(DB_DIRTY_READ), SYMDEF(DB_FLUSH), SYMDEF(DB_MULTIPLE), SYMDEF(DB_MULTIPLE_KEY), SYMDEF(DB_RMW), // set_flags SYMDEF(DB_DUP), SYMDEF(DB_DUPSORT), SYMDEF(DB_RECNUM), SYMDEF(DB_RENUMBER), SYMDEF(DB_REVSPLITOFF), SYMDEF(DB_SNAPSHOT), }; #define NUMBER_OF_SYMBOLS (sizeof(dbSymbols)/sizeof(symdef)) /* Symbol lookups */ static int symbolCompare(const void *a, const void *b) { return strcmp(((const symdef *) a)->name, ((const symdef *) b)->name); } /* Return the value of the given #define in *retval. * Return value is 1 on success. */ int sqDbSymbolValue(const char *namePtr, int nameSize, unsigned int *retval) { symdef *where; char *sname; static int sorted = 0; /* Copy the file name out of the Squeak String */ MALLOC(sname, (char *), nameSize + 1); if (!sname) return -1; strncpy(sname, namePtr, nameSize); sname[nameSize] = 0; if (!sorted) { qsort(dbSymbols, NUMBER_OF_SYMBOLS, sizeof(symdef), &symbolCompare); sorted = 1; } where = (symdef *) bsearch(sname, dbSymbols, NUMBER_OF_SYMBOLS, sizeof(symdef), &symbolCompare); if (where != NULL) { *retval = where->value; return 1; } else return 0; } /* vim: ts=2 et ff=dos */ |